Author Topic: PixelMath - Rescaling Options  (Read 626 times)

Offline dcarr

  • Newcomer
  • Posts: 18
    • View Profile
PixelMath - Rescaling Options
« on: 2018 September 06 17:07:07 »

It would be useful if PixelMath offered explicit options for rescaling in the same way as is done for BackgroundNeutralization – i.e. ‘Truncate’, ‘Rescale’ and ‘Rescale as needed’.

Currently, when ‘Rescale result’ is selected in PixelMath, the result appears to be rescaled even if it is not essential (i.e. when min >=0 and max <= 1).  I can think of several reasons why I may only wish to rescale the resulting image in the event it contains out-of-bounds values (and when I do not wish to truncate data). 

I do understand that I can edit the options in the PixelMath JavaScript to turn off both truncation and rescaling, as long as I do not allow out-of-bounds values to propagate through to the rest of PixInsight. Currently, if I want to limit rescaling to where it is essential, I set both ‘rescale’ and ‘truncate’ to false, execute PixelMath, test for min/max values of the resulting image, and execute the inbuilt ‘Rescale’ process only if the resulting image contains out-of-bounds values (i.e. max > 1 or min < 0).  A bit complicated, but its seems to work.

Explicit options for rescaling in PixelMath may assist in some circumstances and prevent the need for error-prone processes such as the one described above.

« Last Edit: 2018 September 06 19:22:10 by dcarr »

Offline Niall Saunders

  • PTeam Member
  • PixInsight Jedi Knight
  • *****
  • Posts: 1456
  • We have cookies? Where ?
    • View Profile
Re: PixelMath - Rescaling Options
« Reply #1 on: 2018 September 07 06:32:18 »
Hi Dean,

My first thought was, "Surely, if a user has already elected to resort to PixelMath to resolve a problem, then the user might just as well perform the rescaling within their calculation, and hence under their full control, rather than handing that requirement to a limited option to be applied post-process".

So, is it really a question of whether the rescaling should be 'simple but probably inflexible' versus 'complex and fully flexible' (the latter requiring more effort on the part of the user)?

Or, could both options be made available?

I am perfectly happy with the status quo - I have found very little that PixelMath couldn't achieve, and where I did run into its limitations, I still had the options of applying multiple, sequential, PixelMath Processes to achieve what I wanted, or to even turn to a full-blown scripted approach.

That said, I am sure that your idea could be taken into consideration for future upgrades.
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