Script for aligning deep sky astronomical images using their coordinates. [more]
Keywords: alignment, coordinates
The alignment of images is a basic tool for processing of astronomical images. PixInsight has an excellent tool (StarAlignment) for aligning images that works comparing the overlapping areas between the target image and a reference image and trying to find a match between them. Then computes a lineal transformation that converts the geometry of the target image so that it is similar to the reference image.
AlignByCoordinates uses a different approach to the alignment: Instead of matching an image against other, it requires that the images are plate solved. Knowing the coordinates of each pixel of the image the script can reproject them so the geometries of the images are compatible.
The geometry of the image has to be defined using the convention FITS World Coordinate System (WCS)  . This can be done using the scripts ImageSolver or ManualImageSolver. There are also other applications that can solve images using this convention such as PinPoint.
AlignByCoordinates can cope with two kind of geometric distortions:
- Projection distortions : When two images are not centered in the same point they have different projections. The difference in the projections causes that there is not a lineal transformation between them. This effect is stronger in images with short focal length.
The following animation shows an example of this effect. The images have been generated from catalog data and the only geometric distortions are caused by the projection. As can be seen in the animation, the Orion asterism has different distortions in each frame.
- Geometric optical aberrations : The plate solving of astronomical images is usually done supposing that the optical system can be modeled by a Gnomonic projection . However, many lenses or telescopes don't follow strictly this projection. The images from these optical systems can not be solved with high accuracy using only lineal polynomials. ImageSolver and ManualImageSolver can use higher degree polynomials to model the geometric distortions. AlignByCoordinates can use the distortion model generated by the plate solving process for fixing it when aligning images with different distortions.
The following image is the distortion map from an image taken with a 17mm lens. It shows the difference between the image and an "ideal" lens that generates images using Gnomonic projection.
The script has three modes operation that can be chosen using the Execution mode box.
Align images against reference
This mode uses an image as a reference and aligns all the images in the target list against this. For each target image a new image is generated that has the same geometry as the reference image.
This option is useful for stacking images that cover the same area.
This mode generates a new image for each target image removing the geometric optical aberrations. The geometry of the output images keep the characteristics of the original geometries (projection, resolution, rotation and dimensions) but removing the aberrations. This mode doesn't use a reference image.
The reference image for the execution mode Align images against reference can be selected using the Reference image list box. This parameter is not used when the Execution mode is "Undistort image".
You can select as reference an open image or a file. The list enumerates initially the open images in PixInsight. With the Browse button you can add a file to the list.
The script can use the active image in PixInsight as target image or it can use a list of images. You can add files to the list using the button Add files or you can add open windows using the button Add windows. The button Remove images removes the selected images from the list. The button Clear list removes all the images.
This option determines the quality of the output:
- Fast : This option calculates the alignment transformation for a few control points and then interpolates the transformation for the rest of values. The interpolations is done using DynamicAligment. The quality of the transformation is usually good enough for some uses but it is not guaranteed that all the pixels are correct.
- High quality : This option calculates the alignment transformation for all the pixels in the image. The quality of the result is the best possible but the process can be quite slow, up to several minutes for each image.
This option determines the algorithm for pixel interpolation when the High quality option is used. The available values are the same used in StarAlignment.
This parameter is explained in the documentation of StarAlignment.
Path of the directory where the aligned images will be written. If it is empty, the images will be written at the same directories as the source images.
This parameter is not used when aligning windows since in this case the images are not written to the disk.
Output file suffix
This suffix will be appended to the filename when saving each image.
Overwrite existing files
If this option is not checked the alignment of an image fails when the output file already exists.
This parameter determines what to do when there are errors during the process. The options are Continue, Abort and Ask user.
- Since AlignByCoordinates uses the coordinates of the image as the sole method for aligning the images, the coordinates solution must be of very high precision. It should have residuals of less than one pixel.
For narrow field images taken with long focal lengths (usually more than 1000mm) and lenses of high optical quality, the solution can be lineal (degree 1). However, images taken with short focal lengths (<100mm) or lenses with strong aberrations (for example, Newton telescopes with coma), the solution must use higher order polynomials in order to achieve the required precision. These solutions can be found using both ImageSolver and ManualImageSolver.
- The "fast" quality is useful to optimize the settings of the mosaic, however the "high quality" option should be always used for the final image.
- Since this script requires to know the geometry of the images it can only work with images that can be plate solved. This is usually only possible for deep sky images where enough stars can be detected and matched to a catalog.
 E. W. Greisen, M. R. Calabretta (2002) Representations of World Coordinates in FITS, Astronomy & Astrophysics, 395, 1061-1075
 M. R. Calabretta, E. W. Greisen (2002) Representations of Celestial Coordinates in FITS, Astronomy & Astrophysics, 395, 1077-1122
 Wikipedia contributors, Gnomonic projection, Wikipedia, The Free Encyclopedia
Copyright © 2013, Andrés del Pozo