Author Topic: ApplySTF script?  (Read 678 times)

mschuster

  • PixInsight Old Hand
  • ****
  • Posts: 325
    • View Profile
ApplySTF script?
« on: 2012 May 25 01:26:44 »
I'd like to share another script. This one is kind of a silly little script that may or may not end up being handy.

Sometime I want to apply a view's STF via a Histogram Transformation, ie, map a linear image to a nonlinear image using the view's current STF.

Doing this now seems a bit tedious to me: Open a HT instance, open a STF instance, make sure the STF instance reflects the target view, drag the STF's instance icon to the HT, reset the view's STF and then apply the HT.

If there is a faster way now to do this in PI, please let me know. :-)

If not, you can try this script. It attempts to do this with a single button click.

Do this once: Run the script, drag its instance icon to your workspace and rename it appropriately.

Then when you want to apply a STF drag the icon to the target view and click Apply. That's it.

You will see the view's STF blink to the reset state and then after a moment when HT completes you will see the original view, but now in its nonlinear and reset STF state.

Note: I think the script converts STF parameters to HT parameters properly. By trial and error I found I needed to twiddle the matrix. If it does not work correctly for you please let me know and I will try it again. The alpha channel (if any) is left unchanged, which I think is the right thing to do.

Update: 0.2 bug fix.

Update: 0.3 HT now ignores mask (if present) to match STF AutoStretch behavior.
« Last Edit: 2013 January 20 06:42:12 by mschuster »

cs_pixinsight

  • PixInsight Addict
  • ***
  • Posts: 110
    • View Profile
Re: ApplySTF script?
« Reply #1 on: 2012 May 25 17:44:02 »
Mike, thanks for another useful and time saving script.  I always found the process a bit tedious too for such a simple operation.  It would be nice if the STF instance had an apply option/button which applied an HT transform to the image using the STF settings and reset itself (with a keyboard shortcut of course)  :)

But this will help until that day comes,
Craig

troypiggo

  • PixInsight Addict
  • ***
  • Posts: 166
    • View Profile
Re: ApplySTF script?
« Reply #2 on: 2012 May 25 21:09:23 »
I've used it several times already.  Simple but very useful.  Thankyou.
PI x86_64 OSX

oldwexi

  • PixInsight Addict
  • ***
  • Posts: 165
    • View Profile
    • Astronomy Pages G.W.
Re: ApplySTF script?
« Reply #3 on: 2012 May 25 21:55:32 »

Mike,
Nice shortcut. Very useful.
Thank you for your work.

Aloha
Gerald

Bob Hertel

  • Newbie
  • Posts: 19
    • View Profile
Re: ApplySTF script?Thanks
« Reply #4 on: 2012 June 05 04:16:05 »
Thanks, Mike.That was making me nuts, and your script is perfect.
Bob Hertel

Cosmick

  • Newbie
  • Posts: 3
    • View Profile
Re: ApplySTF script?
« Reply #5 on: 2012 June 05 12:01:00 »

Do this once: Run the script, drag its instance icon to your workspace and rename it appropriately.

Then when you want to apply a STF drag the icon to the target view and click Apply. That's it.

You will see the view's STF blink to the reset state and then after a moment when HT completes you will see the original view, but now in its nonlinear and reset STF state.


When used this way on my machine this script seems to be bypassing the image history as there is no undo possible.
When run directly from the script there is the option to undo the Histogram Transform.
Win7 64
Clear Skies

Mick

mschuster

  • PixInsight Old Hand
  • ****
  • Posts: 325
    • View Profile
Re: ApplySTF script?
« Reply #6 on: 2012 June 05 18:51:34 »
Quote
When used this way on my machine this script seems to be bypassing the image history as there is no undo possible.

Mick, thanks for the bug report and sorry for the trouble. I have noticed this problem also. Exactly the same script code runs in both cases, I don't understand why PI captures history/undo in one case but not the other. I will post a fix as soon as I can.

Mike

ClausDuerr

  • Newbie
  • Posts: 13
    • View Profile
Re: ApplySTF script?
« Reply #7 on: 2012 August 21 09:35:16 »

Nice Script! Thx alot :-)

mschuster

  • PixInsight Old Hand
  • ****
  • Posts: 325
    • View Profile
Re: ApplySTF script?
« Reply #8 on: 2012 August 21 21:41:29 »
Thank you Claus