v1.65 test: Flowchart, GraXpert
v1.64: Interface changes, narrowband colorization
v1.63: Narrowband mapping, processing history
v1.62: Foraxx, StarNet2, Annotate image
v1.61: File handling and filtering
v1.60: Small updates: binning, ABE, CC, drizzle
The PixInsight AutoIntegrate script is a tool designed to streamline and simplify the process of integrating astronomical images in PixInsight. Here's a summary of its key features and functions:
- Automation of Integration Process: The script automates the complex and time-consuming task of combining multiple exposures into a single, high-quality image. This includes several steps like calibration, alignment, and stacking of images.
- User-Friendly: Aimed at making the integration process more accessible, especially for those who are either new to PixInsight or find its extensive options overwhelming.
- Customizable Parameters: Despite its automation, the script allows users to adjust certain parameters, providing flexibility to cater to different needs and preferences.
- Comprehensive Processing Steps: It includes the entire workflow required for image integration, such as applying calibration frames (flats, darks, bias), aligning images, and integrating them. Additional steps like noise reduction and histogram stretching are an integral part of the script.
- Enhanced Efficiency: By automating routine tasks, it saves time and reduces the likelihood of user error, especially in repetitive tasks.
The AutoIntegrate script is a powerful tool for astrophotographers looking to efficiently process their images while maintaining a high degree of control over the final output. It exemplifies the balance between automation and customization, making advanced image processing more accessible to a broader range of users.
(Generated by ChatGPT)
AutoIntegrate is a PixInsight script to process FITS and other image files and run a basic image processing workflow to create a final image. Script has a GUI interface where some processing options can be selected. AutoIntegrate can do the whole image processing workflow including image calibration.
After running the script there will be integrated light images and an automatically processed final image. LRGB, color/OSC/DSLR and narrowband files are accepted.
AutoIntegrate is best suited for:
- When you are starting out with PixInsight and want to do a quick image processing before learning all the details.
- For quick calibration, alignment and integration (but not a replacement for WBPP), especially useful if you use remote observatories or other existing, pre-calibrated images or prepared masters.
- Quick generation of a reasonably good image, especially with filter combinations that may be difficult to manage when starting out.
- The possibility to have a quick look at a result and manually process the problematic steps if needed (so you do not spend a day processing an image whose color were badly balanced to start with). This is especially useful to see if your calibration/integration is good enough or leave artifacts/gradients/... that should be removed early.
AutoIntegrate works with PixInsight version 1.8.9-1 or later.
I recommend that you use a hashtag #autointegratescript if posting images on social media. You can find my images processed with AutoIntegrate script on Instagram with that tag.
Images created with AutoIntegrate script
You can find my images created with AutoIntegrate script from the following links.
- APOD 2022 January 17, Chamaeleon Dark Nebulas
- APOD 2022 September 14, Waves of the Great Lacerta Nebula
- My Astrobin page
- My Instagram page
Below is a sample output from AutoIntegrate script with otherwise default options but Crop to common area was enabled.
I have created short YouTube videos that show the workflow with AutoIntegrate script. Some of these are created with an older version of AutoIntegrate script so dialog looks a bit different. Basic steps are still the same.
AutoIntegrate dialog screens
Below are the examples of the script dialog screens. Often it is best to start with default options, add files and hit the Run button.
Script remembers the last open or closed states of collapsible sections in the dialog. It is useful for example with smaller screens where it is possible to start with only minimal sections open.
Downloading the script
Using PixInsight update system
It is possible to automatically install and update AutoIntegrate script by adding it to the PixInsight update repository. Whenever PixInsight is started it will then check for updates to AutoIntegrate. To enable automatic updates you need to add the following Url to the PixInsight Resources/Updates/Manage Repositories.https://ruuth.xyz/autointegrate/
AutoIntegrate is added to the Script/Batch Processing menu.
In a page GitHub releases you can find the latest release and download it from there. Releases page has some detailed information of changes in each release. To download the source code click Source code (zip) and save the zip file. After download is complete, unzip the file.
You can also go to GitHub AutoIntegrate main page to find the latest development changes and download it from there. GitHub master branch may contain test changes that are not yet available as a release.
There is also a test repository at https://ruuth.xyz/test/autointegrate/ that usually includes the latest changes from the master branch.
Running the script
Starting the script when using PixInsight update system
Click AutoIntegrate in the Script/Batch Processing menu to start the script.
Starting the script the script from the script editor
Starting from AutoIntegrate version 1.56 there is a dependency to ImageSolver script in the PixInsight distribution. This means that ImageSolver files must be in the ../AdP directory relative to AutoIntegrate directory. You can do this by creating a ../AdP directory and copying the contents of Pixinsight-install-directory/src/scripts/AdP there.
Steps to start the script from the script editor
- Download the script
- Open Script Editor in PixInsight
- Open file AutoIntegrate.js
- Press F9 to start the script from the editor
Running the script
- Add files with add buttons
- Click Run and wait until the script completes
Using SpectrophotometricColorCalibration (SPCC) will mess up with the dialog window. Everything still runs fine. This seems to be a problem in the SPCC process. If you use SPCC during processing you need to close the dialog from the upper right corner close button. Using that button is not normally recommended as it does not save session settings. But in this case it is the only way to close the dialog.
PixInsight strange errors.
AutoIntegrate does not show up in the Script/Batch Processing menu.
If AutoIntegrate does not show up in the Script/Batch Processing menu you can try to reinstall scripts by deleting the updates.xri file in the PixInsight application folder. Or you can try to repair the PixInsight installation, check for updates, close PixInsight to install updates, and restart PixInsight.
AutoIntegrate dialog does not fit on the screen.
AutoIntegrate dialog is quite large so in some cases it is possible that it is not fully visible on the screen and you cannot access the bottom row. In this case the problem can be the preview window size. It is possible to change the preview window size or disable preview in the Interface section. Note that some buttons like Exit and Run are duplicated at the top part of the dialog.
On MacOS if the PixInsight is not set to full screen mode part of the dialog may not be visible. In that case setting the screen to full screen mode helps.
- include file not found: ../AdP/CommonUIControls.js
Starting from AutoIntegrate version 1.56 there is a dependency to ImageSolver script in the PixInsight distribution. This means that ImageSolver files must be in the ../AdP directory relative to AutoIntegrate directory. If you have manually downloaded AutoIntegrate from GitHub you need to create ../AdP directory and copy the contents of Pixinsight-install-directory/src/scripts/AdP there. In Windows the default installation path to AdP is C:\Program Files\PixInsight\src\scripts\AdP.
StarXTerminator File I/O error when using an old version.
When using an old version of StarXTerminator you may get a File I/O Error and stars are not removed from the image. This error is already fixed in later versions of StarXTerminator (August 2023). When using an older version the fix is to manually start and stop the StarXTerminator process once. After that StarXTerminator works also from AutoIntegrate script.
Error Zero or insignificant PSF Signal Weight estimate
In some cases like when using starless images you may get an error "Zero or insignificant PSF Signal Weight estimate" in the AutoIntegrate log files. You may get rid of this problem by using an option ImageIntegration use ssweight.
Files accepted by the script
Script accepts all files that are supported by PixInsight. It can be used with FITS files from telescopes, or RAW files from DSLR. It can be used with both calibrated and non-calibrated files. For non-calibrated files the script can do image calibration.
Calibrated files from remote telescope systems like Telescope Live, iTelescope, Slooh and Deep Sky West have been tested and they work fine.
When using RAW or OSC files, the script by default does debayering of the files. It is recommended to use the Pure RAW setting in PixInsight. If the files are already debayered you should choose None in the Debayer list.
How the script automatically recognizes different files
- First script checks if the file has a FILTER keyword that specifies the image as Luminance, Red, Green, Blue, Ha, SII, OIII or Color data. The following FILTER values are recognized: Luminance, Clear, L, Red, R, Green, G, Blue, B, SII, S, Halpha, Ha, H, OIII, O, Color. If there is a FILTER keyword but it is not one of the recognized values, the file is treated as a color file. Only the first letter of the FILTER keyword is used to detect the filter type.
- If the FILTER keyword is not found then files that end with _L, _R, _G, _B, _H, _S, _O or _C are treated as filter files. For example ngc6514_R.fit is treated as a Red filter file.
- If files do not end with a filter letter then the file name is checked for text '_Luminance_', '_Red_', '_Green_', '_Blue_', '_SII_', '_Halpha_', '_OIII_'.
- Otherwise files are assumed to be color files.
If IMAGETYP keyword is set on files script can automatically detect bias, dark and flat calibration files when adding light files. Also flat dark files are recognized with a special value 'flat dark'.
Adding filter files manually
If automatic detection of the FILTER keyword does not correctly recognize the filter type, it is possible to manually add files for each filter. This can be enabled by checking 'Add manually' or 'Do not use FILTER keyword’ boxes.
There are separate buttons for each filter type recognized by the script. Also color/OSC/DSLR files can be added manually. Manual adding is useful if the FILTER keyword is missing or just for overriding the filter keyword.
AutoIntegrate will by default put output files into subdirectories.
- AutoOutput contains intermediate files generated during processing
- AutoMaster contains generated master calibration files
- AutoCalibrated contains calibrated light files
- AutoProcessed contains processed final images. Also integrated images and log output is here.
By default output files are written into the same directory as the first light file in the file list. It is possible to give an absolute or relative path to the output directory.
There is an option to select the target type for simplified processing. Target type changes some default options so that they are more likely to match to the target.
Following target types are available
- Galaxy - Works well when the target is a lot brighter than the background.
- Nebula - Works well when the target fills the whole image or is not much brighter than the background.
Processing RGB files
Script automatically detects RGB files. If only LRGB, RGB or OSC/DSLR/color files are present it runs a basic RGB workflow.
Processing narrowband files
Narrowband images are supported by the script. They are processed mostly the same way as other images. Main difference is that you can choose the color palette that is used when mapping narrowband images to RGB channels.
Note that AutoIntegrate always uses narrowband mapping if any of the H, S, or O filters are present. So for example HaLRGB workflow always uses narrowband mapping.
Below is a sample output from AutoIntegrate script when using narrowband data and SHO color palette. Otherwise it was run with default settings but Remove green cast and Fix star colors options were checked.
Script can do image calibration if needed. Two basic workflows are supported:
- Calibrating with bias, darks and flats
- Calibrating with darks, flat darks (or dark flats) and flats
If any of the calibration files are not available the script tries to run calibration with the remaining files.
If there is only one file for bias, dark or flat dark it is assumed to be a master file. If you have multiple master files for example for different binning you can give multiple master files but in that case option Master files must be checked. When multiple master files are available, the script picks the one with the same resolution.
YouTube video of image calibration
The script can generate a flowchart of the processing workflow. Flowchart uses the current settings and images. A partially simulated minimal workflow is run to generate the flowchart information. To run the simulated workflow all relevant files must be loaded to the Files tab. A graphical version of the flowchart is printed to the preview window and a text version is printed to the process console.
Flowchart information is always generated during the processing. It can viewed using Show Flowchart after processing. It is saved to the AutosaveSetup file and also the the setup file if available so it can be loaded later. A text version of flowchart is also printed to the AutoIntegrate log file.
Note that with a new preview save button is it possible to save the workflow image to a file.
A startup image is shown in the preview window when the script starts. This startup image can be changed to a user selected image in the Interface section. The startup image can also be disabled there.
Crop to common area
It is possible to automatically crop bad pixels on the sides of the images. This works by integrating all images, finding an area where all images are contributing and cropping channel images to that area.
Automatic cropping makes it easier to get an image with only good data in it. It also helps automatic processes such as stretching because only real data is included in the image.
To check how much cropping was an image file LowRejectionMap_ALL is left minimized on the screen.
Automatic cropping can be used also during AutoContinue. Cropping requires that the LowRejectionMap_ALL file is open in the PixInsight desktop. Cropping can be done only if starting from Integration_[LRGBHSO] or Integration_RGB_color files.
In the case of AutoContinue it is possible to edit the crop preview area in the LowRejectionMap_ALL image. AutoContinue will use the crop preview from LowRejectionMap_ALL. In this way it is possible to rerun the processing using a different crop if needed.
Below is an example that shows the difference between non-cropped image (left) and cropped image (middle). On the right is a LowRejectionMap_ALL file showing the cropped area.
Sometimes the cropping also helps with automatic processing. Below is an example that shows the processing difference between non-cropped image (left) and cropped image (right). Since bad pixels on the side are cropped, automatic processing can better stretch the images since there is only real data in the image.
AutoIntegrate automatically selects the reference images for star align, image integration and local normalization. By default the images with the best SSWEIGHT value are chosen.
It is possible to manually choose reference images. A reference image for star alignment is used to align all light images. For each filter reference images are used for image integration and local normalization.
There is a button that can be used to calculate SSWEIGHT values for each file and automatically mark reference images to the file list. It is useful for checking which files would be chosen and fine tune the selection if needed. SSWEIGHT values are calculated for raw files that are not debayered or cosmetically corrected so they may differ from those calculated during processing. If no reference images are selected manually then automatically selected images are marked to the file list after processing. They can be found also from the AutoIntegrate log file.
Note that manually selecting reference images for filters do not work with OSC images if the Extract channels option is used. In that case extracted channel images should be loaded separately as LRGB images to choose correct reference images.
AutoIntegrate supports the new FastIntegration process. FastIntegration is a new process that is available in PixInsight version 1.8.9-2 or later. It is a faster version of the old ImageIntegration process. It is recommended to use FastIntegration instead of ImageIntegration if you want quick results or if you have a huge number of images.
AutoIntegrate offers a few options to stretch an image from linear to non-linear.
- Auto STF - Uses auto Screen Transfer Function.
- Masked Stretch - Uses MaskedStretch to stretch an image.
- Histogram stretch - Using simple histogram transformation to get histogram median or peak to the target value.
- Hyperbolic - Generalized Hyperbolic Stretching using PixInsight process.
- Arcsinh Stretch - Uses ArcsinhStretch to stretch an image.
- Logarithmic stretch
Auto STF is the default stretch. It is good in most cases. It can be fine tuned with STF targetBackground parameter. If you get too bright an image you can try lowering targetBackground value.
Masked Stretch is a good choice when Auto STF does not give a good image. For example with bright galaxy images Masked Stretch is a good choice as it keeps brightness in control and gives better saturation.
Histogram stretch is a very simple stretch that moves the histogram median or peak to the target value. Stretch is done iteratively in small steps. Also a selected amount of shadow clipping can be done.
Histogram stretch works best with images that are processed with the Crop to common area option.
Generalized Hyperbolic Stretching (GHS) is most useful on bright targets where AutoSTF may not work well. It often preserves background and stars well and also saturation is good. For very dim or small targets the implementation in AutoIntegrate does not work that well. Current implementation in AutoIntegrate is very experimental but may work on some images.
It is recommended that dark background is as clean as possible from any gradients with GHS. Consider using Gradient correction on combined images and maybe also BackgroundNeutralization to clean the image background. Local Normalization can be useful too.
It is also recommended that the Crop to common area option is used. It cleans the image from bad data and makes finding the symmetry point more robust.
Generalized Hyperbolic Stretching is using PixelMath formulas from PixInsight forum member dapayne (David Payne). For more details see ghsastro site.
Logarithmic stretch is a very simple stretch that moves the histogram median to the target value using a logarithmic function. Stretch is done iteratively in small steps.
Arcsinh Stretch is another good choice when Auto STF does not give a good image. Typically Arcsinh Stretch gives a very well saturated image. There are a few parameters to fine tune stretching.
By default noise reduction is done in a linear phase (Channel image noise reduction). In case of channel images (LRGBSHO) noise reduction is done separately for each channel image. In the case of OSC image it is done for RGB image.
With option Combined image noise reduction noise reduction is done for combined RGB image and L image while they are still in the linear phase. For OSC images this is the same as Channel image noise reduction.
With option Non-linear noise reduction noise reduction is done for combined RGB image and L image after they have been stretched to non-linear phase. For OSC images noise reduction is done for stretched RGB image.When using BlurXTerminator it is recommended to do noise reduction after BlurXTerminator is used. Either Combined image noise reduction or Non-linear noise reduction should be selected. But it is always good to experiment what is best for your own data.
By default color calibration is done using the ColorCalibration process. It is run on the linear RGB image before the image is stretched to non-linear. Optionally it can be run before gradient correction if that option is selected.
Optionally SpectrophotometricColorCalibration (SPCC) can be used for color calibration. Option Color calibration using SPCC is used to enable SPCC. SPCC is run on linear RGB image. Some configuration options are available for SPCC.
SPCC requires that the image is plate solved. Plate solving is run automatically on Integration_RGB image which is also saved to disk. Some sources say that you should use Drizzle with scale 1 or 2 when using SPCC.
Sample narrowband color calibration output
Below is an image that shows results from different narrowband processing using different color calibration and AutoSTF auto/linked/unlinked channel options.
First row is using defaults with no color calibration and auto (unlinked) channels for AutoSTF. Second row is using SPCC with auto channel link mode. With narrowband images and SPCC the auto channel link mode AutoIntegrate uses linked channels for AutoSTF when there is H assigned into the red channel, otherwise AutoIntegrate uses unlinked channels.
If the image does not have center coordinates for plate solving then coordinates can be given in a new Image solving section. Coordinates can be given manually or searched using an online database (Sesame). Image solving needs correct focal length to work properly. If focal length is not embedded into image metadata it can be given in the Focal length field.
Automatic processing of multiple all Narrowband palettes
Optionally it is possible to process multiple narrowband palettes in one run.
Narrowband palette option All automatically processes all HSO palettes it knows. Every image is named with the palette option and automatically saved to disk as a .xisf file. Images are also left open on screen. With Save final image files selection it is possible to save them all for example as 16 bit TIFF files. You can also use extra options in images, then images with name Auto_+palette-name+_extra are created.
Automatic processing of selected Narrowband palettes
With option Use multiple mappings it is possible to select needed narrowband palette mappings instead of all. Multiple mappings run the same way as all palettes option but only selected mappings are used.
The fastest way to generate all palettes is to first run processing with one palette and then use already integrated images for other palettes. For processing multiple palettes open Integration_channel files on the desktop, select All narrowband palette or multiple palettes and use AutoContinue to run palettes from already integrated channel files.
Narrowband mapping extra option
Another way to check different narrowband palettes is with the Narrowband mapping option in the Extra processing section. If the processed image is a SHO or HOO image then it is possible to try different narrowband mappings. When the Narrowband mapping option is used, channels are extracted from the SHO or HOO image and mapped again to create a new palette image.
Foraxx palette extra option
In the extra processing section there is also an option to use the Foraxx palette for SHO and HOO images. Foraxx needs nonlinear images so it is best run after other processing. Foraxx palette is the same as Dynamic palettes with Narrowband mapping but for SHO images also Remove green cast and Orange/blue colors options are run for the image.
Extracting color channels from OSC files
When processing Color/OSC/DSLR files it is possible to extract separate color channels from color data. Channels can be extracted as LRGB, HSO or HOS data. After channels are extracted, processing continues as in mono filter processing.
Channels are extracted right after cosmetic correction and debayering. Channel files are saved to disk so they can be used for processing later.
Using separate channels enables different narrowband mappings when collecting narrowband data with OSC cameras. Also LRGB data can benefit from separate processing.
Thanks to René Bondo Hoffmann for providing OSC camera data using Optolong L-eXtreme filter. Image is processed to emulate the Hubble (SHO) color palette using the L-eXtreme SHO palette option. Additional color processing was done after the AutoIntegrate script run.
Fixing linear defects
It is possible to automatically fix linear column and row defects by using linear defect detection algorithm from PixInsight LinearDefectDetection.js script. Defect information is used by CosmeticCorrection to fix the defects.
It is possible to use GraXpert instead of AutomaticBackgroundExtractor for gradient correction in the image. GraXpert is run as an external process so it must be installed on the computer before it can be used.
To use GraXpert first the path to the GraXpert must be set in the GraXpert section. Then GraXpert can be used by checking the Use GraXpert option in the Tools and Batching section. Smoothing and correction settings can be configured. When GraXpert is used from the script it always uses the AI model when removing gradients.
Banding reduction for each light image
Optionally it is possible to run Canon Banding Reduction script code inside AutoIntegrate. In section Banding, binning and cosmetic correction settings there are options to enable Banding reduction, select Protect highlights and Amount.
Banding reduction can be useful for Canon DSLR data and sometimes also for other OSC data too. Banding reduction is run just after debayering so it is run separately for each light image.
Banding reduction extra processing option
There is also an extra processing option to run banding reduction on the final image.
AutoContinue runs automatic processing from previously created LRGB/RGB, Narrowband or OSC/Color images. The idea with AutoContinue is that it is possible to run manually gradient correction, histogram transformation or other steps on the integrated images and then continue automatic processing from there.
AutoContinue looks for images with fixed names and if it finds them it starts processing from those images. It is also possible to load integrated images for example from WBPP to the light files. If fixed image names are not found and light files have only one image for a filter then it is considered as an integrated light image. Image names are based on intermediate images created by the script but they have a special extension to separate them from automatically generated images. An exception is integrated channel images which can be used as a starting point to run different processing on automatically created images. They are useful for example for testing with different stretching options.
Starting points and the search order for AutoContinue are listed below
- AutoLRGB, AutoRGB, AutoRRGB or AutoMono - Final image for extra processing
- L_HT + RGB_HT - Manually stretched L and RGB images
- RGB_HT - Manually stretched RGB image
- Integration_L_GC + Integration_RGB_GC - Gradient corrected L and RGB images
- Integration_RGB_GC - Gradient corrected RGB image
- Integration_L_GC + Integration_R_GC + Integration_G_GC + Integration_B_GC - Gradient corrected channel images
- Integration_H_GC + Integration_S_GC + Integration_O_GC - Gradient corrected channel images
- Light file list - Integrated channel/RGB images if only one image for a filter
- Integration_RGB_color - Integrated Color RGB image
- Integration_RGB_narrowband - Integrated narrowband RGB image
- Integration_H + Integration_S + Integration_O - Integrated channel images
- Integration_L + Integration_R + Integration_G + Integration_B - Integrated channel images
- Integration_L_start + Integration_RGB_start - Integrated L and RGB image
- Integration_RGB_start - Integrated RGB image
Not all images must be present, for example the L image can be missing.
Explanation of terms used in image names:
- RGB = Combined image, can be RGB, Narrowband or Color image.
- HT = Histogram Transformation, image is manually stretched to non-linear state.
- GC = Gradient Corrected, for example manual DBE or GraXpert is run on image. In addition to _GC postfix also _ABE, _DBE and _GraXpert are checked.
- Integration = Individual light images are integrated into one image.
Extra processing allows running several PixInsight image tuning processes on image. Extra processing can be run as part of the basic image workflow or it can be run separately on selected images. When extra processing is run separately on a selected image it is easy to experiment the effect of different processing in a preview window with undo and redo buttons.
Some of the extra processing that can be applied to the image include:
- StarNet2 or StarXTerminator to separate stars and background
- Combine starless and star images using selected option
- Clip shadows
- Gradient correction
- Darker background with a luminance mask
- ExponentialTransformation with a luminance mask
- HDRMultiscaleTransform with a luminance mask
- LocalHistogramEqualization with a luminance mask
- Add contrast
- Different noise reductions
- Smaller stars with a star mask.
If multiple options are selected see tooltips on the script for execution order.
In case of Run or AutoContinue, extra processing steps are applied to a copy of the final image. A new image is created with _extra added to the name. For example if the final image is AutoLRGB then a new image AutoLRGB_extra is created. AutoContinue can be used to apply extra processing after the final image is created.
Target image and apply button
From a drop down list it is possible to select an image into which extra processing is applied. With the Apply button extra processing is by default run on a copy of the image. There is also a simple undo and redo mechanism to iterate with different extra processing options.
Narrowband specific extra processing
There are also narrowband specific extra processing options in the Narrowband processing section. Below are listed some of the options.
- remap SHO or HOO image to a new palette
- Remove green cast, useful in SHO images
- Remove part of the green cast but leave some green color, useful in SHO images
- Fix magenta star colors often visible in SHO images
Extra processing option Colorize narrowband is used to map narrowband (or any other) data to RGB channels using user selected hue, saturation and weight.
AutoIntegrate can automatically remove stars from an image. There are three options to remove stars and combine them back into the starless image. Starnet2 or StarXTerminator can be used to remove stars. Some options work with linear data which require StarXTerminator.
Remove stars from light images
This option removes stars from individual light images. Star removal is done after star alignment and before optional comet alignment.
Remove stars from channel images
With LRGB and narrowband images this option removes stars from L, R, G, B, H, S and O channel images separately before channels are combined and while images are still in the linear stage. Star images from channels are then combined to create a star image.
With color images (DSLR/OSC) the option removes stars after color calibration while the image is still in the linear stage.
Star image stretching and combining settings can be selected in the Image stretching settings section.
Remove stars before stretch
Removes stars from combined RGB or narrowband images just before stretching while it still is in the linear stage. Stars are used only from the RGB/narrowband image, stars from the L image are not used.
For OSC data this may not work well. Separating channels might help.
Star image stretching and combining settings can be selected in the Image stretching settings section.
This option needs the StarXTerminator process.
Remove stars after stretch
Removes stars from combined RGB or narrowband images just after stretching when the image is not any more in linear stage. Stars are used only from the RGB/narrowband image, stars from the L image are not used.
Star image stretching and combining settings can be selected in the Image stretching settings section.
Extra remove stars
Removes stars from the final image to generate a starless image and a separate stars image.
For both normal and extra processing all there is an Unscreen stars checkbox. This option uses a bit of a different method to generate the stars image as described by Russell Croman. For details see this post: "Unscreening" and re-screening: recombining stars with starless images
The Unscreen method usually keeps star colors more correct than simple star removal. It is recommended to use the Screen method when combining star and starless images back together.
Star image stretching
When stars are removed before stretching then a different stretching can be used for the stars and potentially get better star colors. Star image stretching and combining settings can be selected in the Image stretching settings section.
Stars can be reduced either separately or when combining starless and star images.
Extra option Smaller stars reduce star sizes. Number of iterations can be selected when reducing star sizes. Value zero uses Erosion instead of Morphological Selection
When combining starless and star images it is possible to reduce stars using PixelMath expressions created by Bill Blanshan. There are three different methods: Transfer, Halo and Star. There is also a control parameter for each method. For details see this YouTube video
Combining starless and star images
For combining starless and star images there are three different options: add, screen and lighten. Add is a simple PixelMath operation to add stars back. Screen and lighten are equivalent to similar Photoshop blending modes.
Combine option can be set separately in the Image stretching settings section and Extra processing section.
Extra processing to starless and stars images
Extra processing has some additional options when combining starless and stars images.
To use the Extra processing option combine you need to have starless and stars images open on the desktop. Starless image must be selected as the target image.
With a default Auto mode AutoIntegrate tries to automatically find the stars image based on the starless image name. It assumes that your starless image name has a text starless and stars image name has a text stars. So a starless image sameprefix_starless_whatever is matched with a stars image sameprefix_stars_doesnotmatterwhatishere. You should get an error if a matching stars image is not found.
Using the select button it is possible to manually select the stars image from images open on the desktop.
Reduce stars options can be used to reduce star sizes during combine. These options use PixelMath equations created by Bill Blanshan.
Using Photometric Mosaic script
PixInsigth has great tools for creating mosaics. One such tool is the PhotometricMosaic script by John Murphy. You prepare linear images with scripts ImageSolver, MosaicByCoordinates and TrimMosaicTile and then create the mosaic using script PhotometricMosaic.
Using these tools with AutoIntegrate you first need to run a basic workflow which creates integrated linear images Integration_[LRGBHSO] for separate color channels data or Integration_RGB for OSC data. You can then create a mosaic for each channel or for OSC data.
Once you have the mosaic tiles you can load them into PixInsight with names Integration_[LRGBHSO] or Integration_RGB_color. You can then create the final image using the AutoContinue button.
Batch mode for mosaic images
Batch mode is intended to be used with mosaic images. In mosaics there are several sets of images and typically the same basic processing options are used for all images. In Batch mode AutoIntegrate script automatically asks for files for each mosaic panel. You can freely choose the directories for images. Script creates a final processed image which has the same name as the directory where images were read. So if images are from directory P1 then the image name will be P1. At the end of the script only final batch mode images are left open and all intermediate images are closed.
When batch completed is it possible to save all files in a different formats by clicking a button in the section “Save final image files”. Batch mode adds a keyword to each image and it is used to find files for saving. It is possible to save images in PixInsight .xisf format, 16-bit TIFF format or 8-bit TIFF format. If you want to assemble the final image in Photoshop, save images in 16-bit TIFF format.
Batch mode keyword is saved on disk with .xisf format but not with TIFF format. If you want to process images later and use batch save then you should save files also in .xisf format.
Narrowband to RGB mapping
NOTE! Narrowband to RGB mapping is a relatively complex setup and difficult to use. It is kept in the script for historical reasons. It is recommended to use the narrowband mapping or colorization.
A special processing is used for narrowband to (L)RGB image mapping. It is used to enhance (L)RGB channels with narrowband data. It cannot be used without RGB filters. This mapping is similar to the NBRGBCombination script in PixInsight or as described in Light Vortex Astronomy tutorial Combining LRGB with Narrowband. You can find more details on parameters from those sources.
If narrowband RGB mapping is used then narrowband Color palette is not used.
With narrowband RGB mapping you can choose:
- Mapping of narrowband channels to (L)RGB channels
- Boost for (L)RGB channels
- Bandwidth for each filter
- Test the mapping with a test button
Software binning option is available for light files. It is done as the first operation for all light files or only for color channel files. It uses the IntegerResample routine for binning. For very noisy images binning should help to reduce noise at the costs of decreased resolution. If luminance data is good then it can be useful to do binning only for color data.
Below is the suggested workflow with comet processing in AutoIntegrate:
- Run a normal workflow to get correct stars and background objects.
- Load star aligned *_r.xisf files as light files. Those can be found from the AutoOutput directory.
- Set Window prefix to avoid overwriting files in the first step.
- Check Comet align in Image processing parameters.
- Check Remove stars from lights in Other parameters.
- Check No CosmeticCorrection in Other parameters.
- Go to the Processing tab and CometAlignment section.
- Fill in first and last comet position coordinates. To get the coordinates click the Preview button for the first or last image, go to preview, zoom to 1:1 view and click the comet nucleus with the left mouse button. Note that the first and last images are selected automatically based on image timestamps from the DATE-OBS keyword when images are loaded.
- Copy coordinates from the preview coordinates box and paste them to the comet coordinates box. There are arrow buttons in the preview to automatically copy coordinates.
- Copy coordinates from the preview coordinates box and paste them to the comet coordinates box.
- Use the Run button to process images.
Comet alignment will automatically skip star alignment and SCNR. Since already star aligned images (*_r.xisf) are used then Star alignment could invalidate coordinates given here and thus it is not used.
Note that using starless images may cause problems for example with ImageIntegration or BlurXTerminator. In some cases this shows as an error "Zero or insignificant PSF Signal Weight estimate" in the AutoIntegrate log files. With missing PSF error in ImageIntegration you can use an option ImageIntegration use ssweight. Sometimes on starless images PSF value can not be calculated. Then a manual value should be given or BlurXTerminator should not be used.
It is possible to manually run the CometAlignment process. Below are the steps to use AutoIntegrate with manual comet alignment:
- Run a normal workflow to get correct stars and background objects.
- Manually run the CometAlignment on star aligned *_r.xisf files. This will create *_ca.xisf files.
- Remove stars from *_ca.xisf files. StarXTerminator has a batch mode that makes this easier.
- Load comet aligned files into AutoIntegrate as lights files.
- Check Start from ImageIntegration in Other parameters.
- Use the Run button to process images.
Annotate images extra option can be used to add annotations to the final image. When used with the Run or AutoContinue button a new image with _Annotated postfix is created. Annotate image uses PixInsight AnnotateImage script.
Note that the image must have a correct astrometric solution embedded for annotation to work. When using SPCC color calibration the astrometric solution is automatically embedded.
Embedding processing history
AutoIntegrate automatically embeds processing history into image metadata as FITS keywords. This helps to see how the image was processed. Processing history is saved using the HISTORY keywords.
Non-default processing options are saved after the base processing is run. With extra processing the processing option name with possible parameters are saved to the image metadata.
Window name prefix
It is possible to give the user specified prefix to image window names. This makes all generated window names unique and allows results from multiple processing runs to be open at the same time. These images are also iconized at different columns on the screen.
By default the icon column for a new window prefix is automatically managed by the script. Script tries to track used icon column positions and assign free ones for new runs.
Sometimes, like when using multiple workspaces, this automatic management does not work optimally. In that case it is possible to manually set the icon column for a window prefix. This can be enabled by setting option Manual icon column control. The change will be effective when restarting the script.
When manual icon control is enabled there is a new control Icon column. With that control it is possible to manually set the column where icons are placed. The default for the Icon column is Auto where the icon column is chosen automatically. Last icon column is remembered and automatically restored when the script starts.
Image preview and interface configuration
AutoIntegrate includes image preview functionality. It is possible to see a stretched image by clicking through the file list files. Image preview is shown in a preview window that is part of the script dialog. The image in the preview window can be zoomed and moved around.
Files in the file list have a checked flag. Using image preview functionality bad files can be unchecked. Only checked files are used for processing.
Image preview window is also used to show image files during different steps of processing. During processing images are not shown in stretched mode.
By default image preview is shown in a separate tab. When clicking a file or starting to process the preview tab is set as default. Using the Toggle side preview button image preview can be shown as a separate window on the side of the dialog.
Preview window can be disabled in the interface settings section. Also preview window size can be changed there.
By default the image histogram is displayed below the image. Histogram is updated when the image is changed. Clicking on the histogram shows some statistics. Default size for histogram is calculated automatically. Size can be adjusted in the interface section and the histogram display can be disabled in the interface section.
Below are some configuration options for preview and generic interface
Full screen preview
Both dialog and preview window can be maximized to (almost) full screen. This is useful when using a small screen or otherwise when a bigger view of the image is needed.
Single column interface option.
Saving settings to persistent module settings
It is possible to save all settings into PixInsight persistent module settings. These settings are automatically restored on startup.
All saved parameters, persistent module settings, process icon and setup file, will include only those values that are different from default values.
There is also a button to reset all parameters to default values.
Saving settings to script icon
It is possible to save your own default options to a script icon. It can then be used to recall default settings. Script icons can be saved to a file.
Parameter values are first restored from persistent module settings and then from the process icon. So process icon settings overwrite persistent module settings.
Settings are saved by dragging the lower left corner triangle icon to the desktop. By double clicking the icon a script window opens. Clicking the Apply global button starts the script with those settings that are saved to the icon. PixInsight also saves MD5 checksum to the script icon. When using the script icon with a modified script you need to clear the checksum field first.
Save and restore script setup
Current parameter settings and image file lists loaded into light and calibrate image pages can be saved to a setup file. That file can later be restored back to AutoIntegrate. Saved file keeps checked/unchecked status for files. The file must have a .json extension.
File paths that are in a subdirectory of the setup file are saved as relative paths. This makes it possible to move or share setup and images files and it still works in a new location. Relative paths are automatically restored as full paths.
Setup file saves only those parameters that have a non-default value. It is good to note that other parameters settings are not changed when restoring the setup. There is an option Reset on setup load to use only those settings that are loaded from the setup file. Other parameters are reset to default values.
Also window prefix and output directory are saved to a setup file.
When available the setup Json file includes ssweight values for files.
Option Autosave setup saves current setup automatically after successful processing into AutosaveSetup.json file. Autosave is done only after the Run command, it is not done after the AutoContinue command. Starting from version 1.65, Autosave setup is enabled by default.
File is saved to the lights file directory, or to the user given output directory. Saving to lights directory makes it possible to use relative paths to files so it is easy to move the setup file around or even share with lights files.
Setup can be later loaded into AutoIntegrate to see the settings or run the setup again possibly with different options. If the option Add window prefix to log files is selected the current prefix is added to the autosave setup file.
Use already processed files
Option Use processed files tries to use already processed files when possible. This option can be useful when adding files to an already processed set of files. Only files generated before image integration are reused.
Option works best with setup file that is saved after processing or with Autosave setup generated AutosaveSetup.json file because then star alignment reference image and possible defect info is saved.
With image calibration it is possible to use previously generated master files by loading already processed master files info calibration file lists. If only one calibration file is present then the script automatically uses it as a master file.
Sorting and filtering data
Sort and filter file lists
Filtering option is used to filter images using current weighting and filtering settings. If no filtering is set then files are just sorted based on weight calculation. For large data sets it may be useful to use multiple filterings. For example, sort first by PSF Signal and then by Eccentricity and after each sort uncheck bad files that are at the end of the list.
Automatic filtering of bad files
AutoIntegrate has a few ways to automatically filter out files based on image statistics calculated by the SubframeSelector process.
The simplest filtering uses a limit value for SSWEIGHT. Only files with calculated SSWEIGHT above the limit value are included. This is a good way to filter files if the expected SSWEIGHT values are known. Calculated SSWEIGHT values can be checked from the AutoIntegrate.log file after processing.
Additional image filtering is based on two measures. It is possible to filter images for example with FWHM and Eccentricity values. Images that do not meet filtering criteria are not processed.
There are also a few ways to filter files by detecting outliers in the data set. This method does not require previous knowledge of the data. It can be useful in cases with huge data sets where manual filtering gets too complicated.
The following variables can be used for filtering outliers: SSWEIGHT, FWHM, Eccentricity, SNR, Star count, PSF Signal and PSF Power. Each variable is used independently to detect and filter outliers.
There are also three ways to calculate outlier filtering threshold values:
- Two sigma that filters out values that are two sigmas away from mean value.
- One sigma that filters out values that are one sigmas away from mean value.
- Interquartile range (IQR) measurement that is based on median calculations.
By default FWHM and Eccentricity are filtered for too high values, and all others are filtered for too low values. It is also possible to select filtering for both too low and high values.
Embedding AutoIntegrate engine
AutoIntegrate processing engine is separated from AutoIntegrate GUI so the engine can be called without the GUI. This makes it possible to create own interfaces to AutoIntegrate engine.
A sample to show how to call AutoIntegrate engine from a PixInsight script is in the following link: TestCalibrate.js
Processing Hubble data
A YouTube video shows how to process Hubble data using AutoIntegrate script. It includes basic steps to download Hubble data and shows how to do basic processing using AutoIntegrate script.
Some tips for using AutoIntegrate script
- Very often you get good results by running the script with default settings and then continue processing in PixInsight.
- Always before running the script you should check the quality of the data using the AutoIntegrate preview functionality or using a separate Blink process. You should remove all files that have movement like wind effect or bad clouds.
- If your data quality is not the best you may want to increase noise reduction.
- When processing bright galaxy data the image may come out too bright. You can try using MaskedStretch or reduce STF targetBackground value.
- When processing nebulosity data you can try using Histogram stretch.
- With extra processing it is possible to do basic enhancements like remove stars using StarNet2 or StarXTerminator, increase contrast, run HDRMultiscaleTransform, LocalHistogramEqualization and make smaller stars automatically.
- When removing stars you often get better star color with unscreen option. When combining stars and starless in either PixInsight or Photoshop use the screen option.
- Automatic cropping is very handy. But check LowRejectionMap_ALL and verify that the crop is ok.
Tips for processing One Shot Color (OSC) or RAW files
- Default options are typically a pretty good start for color images. If there is a strong color cast and/or vignetting it is worth trying with Gradient correction on combined images and Use BackgroundNeutralization options. Sometimes also choosing a different setting in the Link RGB channels option helps.
- For OSC/DSLR files PixInsight should be put into Pure RAW mode. It can be set in Format Explorer by double clicking RAW format. AutoIntegrate does debayering of images so no automatic debayering should be done.
Erik Westermann has a web site Remote Astrophotography. He talks about AutoIntegrate in his blog post PixInsight AutoIntegrate.js Processing Script. It has a lot of useful information so please check it out.
Glenn Newell discusses his latest (not so) secret PixInsight weapon, the AutoIntegrate script in the San Jose Astronomical Association (SJAA) meeting. Link to the YouTube presentation is: SJAA Imaging Special Interest Group 05 18 2021
Videos on PixInsight
Reading on PixInsight
Written information on PixInsight may not be as up to date as videos but they are still worth a check. At least the book Inside PixInsight by Warren A. Keller is good. Also the website Light Vortex Astronomy has a lot of useful information.
List of processes used by AutoIntegrate
Below are listed PixInsight processes that may be used by AutoIntegrate script with default LRGB processing. AutoIntegrate writes processing output to the Process Console window and to AutoIntegrate.log file. Details of processing steps can be found from the header block of the source code.
- GraXpert (external process)
History of AutoIntegrate script
I started my astrophotography hobby with remote telescopes in 2017. I almost immediately got PixInsight and started working with FITS files. From the start I was happy with the results but also found that there are a lot of repetitive and complex tasks to be done. After a few months I even stopped my new hobby for a while. When I started astrophotography again after the summer 2018 I realized that there is this wonderful scripting capability in PixInsight. So I started developing my script. FITS files from remote telescopes were already calibrated so I did some first steps around ImageIntegration. This is where the script name comes from. Since then I have expanded the script into both image calibration and post processing.
Many thanks to Jean-Marc Lugrin for contributing brilliant Crop to common area code.
Many thanks to rob pfile for contributing the very useful Window name prefix and icon column position code. They are a great help when working with multiple images or multiple image versions.
Jean-Marc Lugrin has also created a great TestAutoIntegrate tool that automates testing. You can find it at GitHub. I have a slightly modified version of that code that works with the latest AutoIntegrate version.
Special thanks to Garth Hunt, Erik Westermann, Glenn Newell and Jari Backman for testing different versions of the script.
Thanks to Erik Westermann for doing a great work on documenting the script in his web site https://remoteastrophotography.com/.
AutoIntegrate Normalization option uses similar PixelMath expressions as Bill Blanshan in his Narrowband Normalization using PixInsight Pixelmath script. See more information in his YouTube channel AnotherAstroChannel.
Narrowband colorizing is inspipred by Steven Miller's YouTube channel Entering Into Space, NBColourMapper script from Mike Cranfield and Adam Block, and CombineImages script by Dean Carr.
Star Reduction equations using PixelMath are created by Bill Blanshan. For details see this YouTube video
Linear Defect Detection code is using the code from Vicent Peris. The PreviewControl module is from Andres del Pozo.
Foraxx and Dynamic palettes, credit The Coldest Nights.
PixInsight scripts that come with the product were a great help when developing this script. Website Light Vortex Astronomy was a great place to find details and best practices when using PixInsight.
Routines ApplyAutoSTF and applySTF used by AutoIntegrate are from scripts that are distributed with PixInsight. Routines for Linear Defect Detection are from PixInsight scripts LinearDefectDetection.js and CommonFunctions.jsh that are distributed with PixInsight.
This product is based on software from the PixInsight project, developed by Pleiades Astrophoto and its contributors (https://pixinsight.com/).