Author Topic: Blinking Script  (Read 57147 times)

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 864
    • View Profile
Re: Blink?
« Reply #30 on: 2010 May 08 09:41:29 »
great !

Offline Silvercup

  • PixInsight Addict
  • ***
  • Posts: 187
    • View Profile
Re: Blink?
« Reply #31 on: 2010 May 08 13:59:19 »
Great. indeed

Silvercup

Offline sleshin

  • PixInsight Old Hand
  • ****
  • Posts: 431
    • View Profile
Re: Blink?
« Reply #32 on: 2010 May 08 14:11:04 »
Want to add my name to the list of the grateful. Very useful script.

Steve
Steve Leshin

Stargazer Observatory
Sedona, Arizona

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 864
    • View Profile
Re: Blink?
« Reply #33 on: 2010 May 09 05:36:19 »
I think there is a bug. A I have problems selecting images. If I click a image in a directory it opens it.
I am not able to use windows standards : Select/ arrows, click Control, Control A

Also

How do you control display appearance ....STF?

Why do you need a preview?

Max

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
    • View Profile
Re: Blink?
« Reply #34 on: 2010 May 09 23:13:43 »
Hello Max.
I think there is a bug. A I have problems selecting images. If I click a image in a directory it opens it.
I am not able to use windows standards : Select/ arrows, click Control, Control A
It's not bug. It's PixInsight limitation:
Quote
How to move a ImageWindow via script

You can't, right now. A future version of PJSR will include a Workspace object, which will provide management of windows, icons and workspaces.

Quote
or how to enable move it by user when JS Dialog is open?

Impossible, since dialogs are modal windows. This means that they capture the keyboard and mouse blocking the rest of PixInsight's GUI.

Quote
How do you control display appearance ....STF?

Why do you need a preview?
See Instruction (long Version) http://pixinsight.com/forum/index.php?topic=1895.msg11738#msg11738

Offline mmirot

  • PixInsight Padawan
  • ****
  • Posts: 864
    • View Profile
Re: Blink?
« Reply #35 on: 2010 May 10 07:18:07 »

Thanks
 Hard to get all the details. I will look forward to futures versions.

Max

Offline Silvercup

  • PixInsight Addict
  • ***
  • Posts: 187
    • View Profile
Re: Blink?
« Reply #36 on: 2010 May 13 13:01:15 »
Hi Nikolay and all developers:

Just a little trick to force a ImageWindow to place at top left workspace:

Code: [Select]

for(var i=0;i<11;++i) {
FinalView.zoomIn();
}
FinalView.fitWindow();
FinalView.show();
FinalView.zoomToOptimalFit();



FinalView in this case is the ImageWindow object.

Silvercup

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
    • View Profile
Re: Blink?
« Reply #37 on: 2010 May 21 10:42:35 »
Implement an automatic stretch feature in your script. This is actually much easier than what may seem at first glance.
I got the code.
But, for RGB images I have to generate statistics 3 times...   ??? maybe possible to get statistics for all channels at ones?
« Last Edit: 2010 May 21 21:54:39 by NKV »

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2173
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
Re: Blink?
« Reply #38 on: 2010 May 21 13:37:16 »
No. You may create an array of statistics objects, and apply them with a "for" loop (0 to numberOfChannels, or numberOfNominalChannels).
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
    • View Profile
Re: Blink?
« Reply #39 on: 2010 May 21 21:53:35 »
No. You may create an array of statistics objects, and apply them with a "for" loop (0 to numberOfChannels, or numberOfNominalChannels).
Thanks. Done:
Code: [Select]
#define shadowsClipping -1.25
#define targetBackground 0.25

function AutoSTF (img,rgbLinked)
{
   var n = img.image.numberOfChannels;
   if (rgbLinked || n == 1)
   {
      for ( var c = c0 = m = 0; c < n ; c++ )
      {
         img.image.selectedChannel = c;
         var s = new ImageStatistics (img.image);
         c0 += s.median + shadowsClipping*s.avgDev;
         m += s.median;
      }
      c0 /= n;
      m = Math.mtf(targetBackground , m/n - c0 );
      var STF =[[m,1,c0,0,1],[m,1,c0,0,1],[m,1,c0,0,1],[0.5,0, 1,0,1]];
   }
   else
   {
      var STF = new Array();
      for ( var c = 0; c < n ; c++ )
      {
         img.image.selectedChannel = c;
         s = new ImageStatistics (img.image);
         c0 = s.median + shadowsClipping*s.avgDev;
         m = Math.mtf(targetBackground , s.median - c0 );
         STF.push([m, 1, c0, 0, 1]);
      }
      STF.push([0.5,0,1,0,1]);
   }
   img.stf = STF ;
}

var img = ImageWindow.activeWindow.mainView;
//var rgbLinked = true;
var rgbLinked = false;
AutoSTF(img,rgbLinked);
Actually, I just copied part of code from ScreenTransferFunctionInterface.cpp
But I not understand why original STF and this PIJS produce little bit different result of midtones balance?


 
« Last Edit: 2010 May 21 21:58:45 by NKV »

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2173
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
Re: Blink?
« Reply #40 on: 2010 May 21 22:09:40 »
Are the midtones input values close to 0.5? One way to interpret the MTF value is this: the number tells which pixel value should become middle gray. For just a inspection, I would pick something close to the image's median as MTF value.
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
    • View Profile
Re: Blink?
« Reply #41 on: 2010 May 22 00:14:33 »
Are the midtones input values close to 0.5? One way to interpret the MTF value is this: the number tells which pixel value should become middle gray. For just a inspection, I would pick something close to the image's median as MTF value.
I use ImageContainer to compare results.
Script above result:
STF = [ // c0, c1, m, r0, r1
      [0.15618, 1.00000, 0.32282, 0.00000, 1.00000],
      [0.08093, 1.00000, 0.30584, 0.00000, 1.00000],
      [0.10556, 1.00000, 0.25843, 0.00000, 1.00000],
      [0.00000, 1.00000, 0.50000, 0.00000, 1.00000]
   ];


PI STF (Auto Stretch with default parameter):
STF = [ // c0, c1, m, r0, r1
      [0.15618, 1.00000, 0.32281, 0.00000, 1.00000],
      [0.08093, 1.00000, 0.30579, 0.00000, 1.00000],
      [0.10556, 1.00000, 0.25842, 0.00000, 1.00000],
      [0.00000, 1.00000, 0.50000, 0.00000, 1.00000]
   ];


 ???

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
    • View Profile
Re: Blink?
« Reply #42 on: 2010 May 23 10:23:10 »
Next generation. :)
+AutoSTF
+FileList
« Last Edit: 2010 May 23 21:32:57 by NKV »

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1455
  • We have cookies? Where ?
    • View Profile
Re: Blink?
« Reply #43 on: 2010 May 23 10:45:54 »
Very nice wotk,

I like being able to expand the window 'vertically' (to be able to see more of the list entries), but it would also be nice to expand 'horizontally' to see more of the filenames (mine tend to be rather long, and the numeric ID tends to be at the far right!!)

I need to have a look at how you are applying the AutoSTF - it would be nice to be able to 'control' the STF (even if this means doing so whilst the animation is 'stopped')

I threw 60 images (746x577, mono) into the list and at full speed it was just a pleasant 'blur' - very impressive.

I also wondered about being able to use the mousewheel to 'scroll' through the listed images. At the moment, the mousewheel affects the zoom. I don't know which function is more suited to wheel actions, zoom or image-select?

Juan, I think this deserves inclusion with v1.6.1

Cheers,
Cheers,
Niall Saunders
Clinterty Observatories
Aberdeen, UK

Altair Astro GSO 10" f/8 Ritchey Chr├ętien CF OTA on EQ8 mount with homebrew 3D Balance and Pier
Moonfish ED80 APO & Celestron Omni XLT 120
QHY10 CCD & QHY5L-II Colour
9mm TS-OAG and Meade DSI-IIC

Offline NKV

  • PTeam Member
  • PixInsight Guru
  • ****
  • Posts: 677
    • View Profile
Re: Blink?
« Reply #44 on: 2010 May 23 11:15:06 »
I like being able to expand the window 'vertically' (to be able to see more of the list entries), but it would also be nice to expand 'horizontally' to see more of the filenames (mine tend to be rather long, and the numeric ID tends to be at the far right!!)
Yes, I will modify.
Quote
I also wondered about being able to use the mousewheel to 'scroll' through the listed images. At the moment, the mousewheel affects the zoom. I don't know which function is more suited to wheel actions, zoom or image-select?
Niall, just move mouse cursor to FileList and use mousewheel  ;)
« Last Edit: 2010 May 23 17:34:03 by NKV »