Copyright (c) 2016, Roger N. Clark, clarkvision.com
All rights reserved.
GNU General Public License https://www.gnu.org/licenses/gpl.html
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
If you install davinci http://davinci.asu.edu/ on linux, macs, or windows, this code should run. I adapted this code from some spectroscopy code I wrote. This version pulls in one color channel at a time, but converts each image plane to floating point. Thus a 20 megabyte image requires 40 megabytes of memory. Stacking 10 images would then require 400 megabytes to store all the images, one color plus the program and intermediate and results data. It is a little slow: I do 3 iterations as I found it does a better job than ImagesPlus even using a higher clip level. On a I7-950 machine at 3 GHz, it takes about a minute per 20-megapixel RGB image and the code is not multi threaded.
I would love to see someone translate this to python.
Davinci reads some tif files issuing the following message which you can ignore:
SAMPLEFORMAT tag missing; assumptions will be made in data format determination
Davinci is scientific data language used in planetary and terrestrial sciences, where the common formats are not tif files (NASA PDS and other science image formats like vicar). It does have fits extensions, but seem difficult to get working so I have ignored that
Davinci also has a quirk which the developers have not yet fixed. It can't write multi-band 16-bit tiffs, so I write png files. But davinci writes png with 16-bit signed integers. So I then read the png result into photoshop and and use levels tool, moving the right slider to 128 and write a tiff.
From a command line, if the images to stack are tiffs, run:
davinci.sigma-clip-average sigma 2.0 -png -images *.tif
And relax for a while. The above is case sensitive. If you try this on windows, please let me know if it works.
With davinci you can also easily subtract a dark frame. No need for commercial software. And if there are any developers out there who want to contribute code or fixes to davinci, I am sure the team at ASU would be accepting.
Any davinci program will be the same as rnc-color-stretch. In windows, copy the launcher batch file, LaunchConsole.bat from the rnc-color-stretch install and the davinci script, e.g. davinci.sigma-clip-average-3pass to the directory and with windows explorer, double click on the LaunchConsole.bat file. That stars a terminal session with everything set up. Then type:
davinci -f davinciscriptfile options.
davinci -f rnc-color-stretch filename.png -rootpower 20
davinci -f davinci.sigma-clip-average-3pass sigma 2.0 -png -images *.tif
The *.tif means all tif images in that directory (folder).
Macs and Linux
On macs and linux, follow the install directions for rnc-color-stretch, then simply copy davinci.sigma-clip-average-3pass to /usr/local/bin and make it executable. You can then use a terminal to cd to the directory where your images are located, and typr the command. e.g.:
davinci.sigma-clip-average-3pass sigma 2.0 -png -images *.tif
Back to Astrophotography Software
First Published Sept. 28, 2016
Last updated December. 5, 2016.