Hi Andrés,
Very nice! You're doing a fantastic work. Congratulations to both!
This script can be developed into something very powerful and useful. A user interface to define parameters would be nice. Also, you could add false color to improve visual detection of image features, and a nonlinear representation to enhance the dimmest parts of the image (for example, a deep-sky object is represented with a too low profile, and this script would be perfect to represent the profile of a galaxy for example.
I'd remove the error test at line #82. I'm generating 3D profiles for images of 1Kx1K pixels and larger without problems.
Andrés, do you agree with including this script in PI 1.5 distribution (the latest version available at the date of release) ?
Would it be worthwhile to re-implement this is PCL so it's compiled code rather than javascript?
Of course, Sander. As PCL/C++ code with some optimizations (generation of a downsampled representation, multithreaded implementation as an interruptible process), this script could run in nearly real-time. It could be an observer tool just like Statistics.
However, the JavaScript runtime in PixInsight has a great advantage over compiled C++ modules: you can develop a tool with JavaScript without exiting the PixInsight platform, with all the advantages of an interpreted language backed by a powerful, native runtime. We have used JavaScript to develop several important tools that were implemented in C++ after thorough testing as interpreted routines. An example is HDRWaveletTransform.