Author Topic: ApplySTF script?  (Read 7392 times)

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
ApplySTF script?
« on: 2012 May 24 18: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 19 22:42:12 by mschuster »

Offline cs_pixinsight

  • PixInsight Addict
  • ***
  • Posts: 156
Re: ApplySTF script?
« Reply #1 on: 2012 May 25 10: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

Offline troypiggo

  • PixInsight Addict
  • ***
  • Posts: 258
Re: ApplySTF script?
« Reply #2 on: 2012 May 25 14:09:23 »
I've used it several times already.  Simple but very useful.  Thankyou.

Offline oldwexi

  • PixInsight Guru
  • ****
  • Posts: 627
    • Astronomy Pages G.W.
Re: ApplySTF script?
« Reply #3 on: 2012 May 25 14:55:32 »

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

Aloha
Gerald

Offline Bob Hertel

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

Offline Cosmick

  • Member
  • *
  • Posts: 52
Re: ApplySTF script?
« Reply #5 on: 2012 June 05 05: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

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: ApplySTF script?
« Reply #6 on: 2012 June 05 11: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

Offline ClausDuerr

  • Newcomer
  • Posts: 29
Re: ApplySTF script?
« Reply #7 on: 2012 August 21 02:35:16 »

Nice Script! Thx alot :-)

Offline mschuster

  • PTeam Member
  • PixInsight Jedi
  • *****
  • Posts: 1087
Re: ApplySTF script?
« Reply #8 on: 2012 August 21 14:41:29 »
Thank you Claus

Offline jnarro

  • Newcomer
  • Posts: 13
Re: ApplySTF script?
« Reply #9 on: 2015 May 03 07:53:19 »
Hello, I am looking for your script ApplySTF 0.2 Y have your posting  message about it  but I just canĀ“t find the file to download and your sandbox does not have this script, can you tell me please where I can find it?

Many Thanks

Jose