CometAlignment

By Edoardo Luca Radice


This tool is designed to interactively align fast–moving objects among the stars, such as asteroids and comets. The Process also allows you to perform subtraction operations between frames to obtain images of the star field without the comet or a starless comet. [more]

Categories: Image Registration

Keywords: image registration, comet processing

Contents

[hide]

1 Description

[hide]



Comets and asteroids are solar system objects that pass relatively close to Earth at the moment of observation; this is why their movement among the stars is not negligible, even in a short period. Therefore, by integrating star–aligned frames, as typical in astrophotography, the image of the comet will appear blurred.

Since asteroids are usually point–like and structureless objects, it is uncommon for astrophotographers to take long exposures that need to be aligned; therefore, below we will talk about comets. Anyway, the discussion could easily be extended to asteroids.

The initial version of the CometAlignment tool was written by Nikolay Volkov back in 2012. The current version has been released in January of 2023 after a complete redesign and reimplementation.


CometAlignment performs a re–alignment of the frames through a simple translation using the nucleus of the comet as a reference point; therefore, the target frames must show neither rotations nor changes of scale. The best way to meet this prerequisite is to register the images with respect to the stars using the StarAlignment process.

Anyway, star alignment is not strictly necessary if you are sure that there are no rotations or scale changes: CometAlignment can handle non–aligned frames thanks to its PSF Fit feature combined with multiple fixed images to describe the comet's movement. Another essential prerequisite is that each image has accurate acquisition time metadata; this allows the tool to create a time–oriented image sequence.

CometAlignment will retrieve frame acquisition times from standard Observation:Time:Start XISF properties when available. Otherwise acquisition times will be extracted from DATE-OBS FITS keywords. The values of DATE-OBS FITS keywords must be valid time representations in ISO 8601 format.[1] If one or more target frames don't provide valid acquisition time metadata, the alignment cannot be performed.

To compute the comet path between different images, CometAlignment uses a set of at least two fixed frames where the comet nucleus position has been selected interactively by the user. The approximate location of the nucleus in non–fixed images is linearly interpolated, based on their acquisition times, from their closest neighbor pairs of fixed frames. The starting and ending frames of the sequence are always fixed, hence the user must always define the comet nucleus position on the first and last frames.

Let

be the centroid coordinates and acquisition time of the first fixed image,

be the centroid coordinates and acquisition time of the last fixed image,

be the acquisition time of the image.

Then the nucleus coordinates in the image are

If the Compute PSF fits parameter is enabled, the above putative position is refined by computing the nucleus centroid by fitting a point spread function to image pixel data.

In addition to the alignment feature, CometAlignment can subtract an image from each frame of the series. For example, this function can be used to remove the stars from images containing the comet, using, as an operand, a picture of the same starfield taken before or after its passage. Integrating the resulting frames will produce a starless image of the comet helpful in highlighting the weakest portions of the tail.

Alternatively, by obtaining an image of the comet without stars using ImageIntegration with a strong pixel rejection, it is possible to subtract it from the star field to obtain an image without the comet. The two images (starless comet and cometless star field) can then be combined to obtain an artistic representation of the comet stationary among the stars.

CometAlignment is fully compatible with DrizzleIntegration. If available, drizzle definition files (with the .xdrz suffix) can be associated with target images using the Add Drizzle Files button.

During execution, CometAlignment generates new drizzle files, updated with comet translation information, that refer to the original frames. These files can be used as usual: in ImageIntegration first to update them with pixel rejection and statistical data, and, finally, in DrizzleIntegration to produce a drizzle–integrated final image.

2 Target Frames

[hide]

Use these controls to define and manage a list of image files to be aligned on the comet nucleus. Although this is not strictly required, thanks to the ability of this tool to adapt to arbitrary comet trajectories, the set of target frames should normally be already calibrated and star–aligned, either using the ImageCalibration and StarAlignment tools, or with the WeightedBatchPreprocessing script.

Input Images List

The largest control in this section is a list box with all the images currently selected for registration. The list will show full file paths or just file names, depending on the state of the Full Paths checkbox. On this list you can:

  • Double-click an item's file name or path to open it in PixInsight as a new image window.
  • Double-click a green checkmark icon to disable an item (double-click the red crossmark icon to enable it). Disabled files will not be aligned, but will be taken into account for interpolation of comet positions.
  • Double-click on the # column to select the reference image. This image will be used as the starting point to show coordinate and time increments in the list. All frames will be aligned with respect to the reference frame during process execution. The reference image will be identified with a blue arrow.
  • Mouse over an item to see its full file path as a tool tip window.

For each image in the list, the following table columns are shown:

F

A pin icon in this column will identify the image as fixed: fixed images will be used to calculate the comet's path among the stars. See the Basic Usage section for further details.

X

If the comet position is correctly defined in the first and last images, this column shows the X (horizontal) position of the nucleus in pixels.

Y

If the comet position is correctly defined in the first and last images, this column shows the Y (vertical) position of the nucleus in pixels.

ΔT

Acquisition time difference in seconds between the reference image and the current image.

ΔX

If the comet position is correctly defined in the first and last images, this column shows the horizontal (X-axis) offset of the nucleus in pixels between the reference image and the current image.

ΔY

If the comet position is correctly defined in the first and last images, this column shows the vertical (Y-axis) offset of the nucleus in pixels between the reference image and the current image.

Add Files

Click this button to open a standard file dialog where you can select existing image files that will be included in the list of files to be aligned.

The list of input frames will always be kept sorted by acquisition time in ascending order (older images first). Duplicate frames are automatically detected and excluded.

Note — By adding one or more images, all comet positions will be reset to a default undefined state, so the comet's position will need to be manually defined in the first and last frames, along with any necessary intermediate fixed frames, after performing this action.

Select All

Click this button to select all the files in the current list of input images.

Add Drizzle Files

Click this button to associate drizzle data files (with .xdrz extension) with input images. The .xdrz files are generated by the StarAlignment tool when the Generate drizzle data parameter is enabled. These special files store information describing the geometrical transformations of the images used by the DrizzleIntegration tool to create a drizzle–integrated image by reprojecting pixels.

ImageIntegration updates the drizzle files adding relevant information on normalization, weighting and pixel rejection (see also the Generate drizzle data parameter below.

When a drizzle file is correctly associated with the corresponding input image, a <d> prefix is shown before the image file name.

Clear Drizzle Files

Click this button to remove all associations between input images and drizzle data files.

This action removes just the association between image files and their corresponding .xdrz files, not the actual data files, which remain unaltered on disk.

Set Reference

Click this button to set the selected image as the reference frame. If the comet's position has been correctly defined for the first and last images, all coordinate and time differences shown on the input list will be calculated with respect to this image; therefore its ΔX, ΔY and ΔT columns will be zero.

All target frames will be aligned with respect to the selected reference frame during process execution. By default the reference frame is the first image in the target frames list.

Invert Selection

Click this button to invert the current selection in the list of input images.

Toggle Selected

Click this button to enable/disable the files currently selected in the list of input images.

Remove Selected

This button removes the selected files from the list of input images. This action cannot be undone.

Note — By removing one or more images, all comet positions will be reset to a default undefined state, so the comet's position will need to be manually defined in the first and last frames, along with any necessary intermediate fixed frames, after performing this action.

Clear

Click to empty the list of input images. This action cannot be undone.

Full Paths

When this option is selected, the list of input files will show the full absolute file paths of all selected images. When this option is disabled (default state), only file names will be shown, which simplifies visual inspection. Full file paths are always shown as tool tip windows.

3 Format Hints

[hide]

Format hints are small text strings that allow you to override global file format settings for image files used by specific processes. Input hints change the way input images of some particular file formats are loaded during process execution, while output hints modify the way output frames are written.

Most standard file format modules support hints; each format supports a number of input and/or output hints that you can use for different purposes with tools that give you access to format hints. The complete list of format hints for a particular file format is available in the Format Explorer window by selecting the desired format and double–clicking the Implementation row.

In the format hints list, after the hint's name, an (r ) tag means that it is an input-only hint, a ( w) tag means that it is an output-only hint, and (rw) means that it can be used both as an input and output hint.

4 Output

[hide]

This section allows you to define important parameters to control the generation of aligned images.

Output directory

This is the directory (or folder) where all output files will be written. If this field is left blank (the default value), each output file will be written to the same directory of its corresponding target frame file. In such case, make sure that source directories are writable, or the process will fail upon trying to create the first output file.

Prefix

This is a short piece of text that will be prepended to the file names of all output images. For example, if a target image is "Comet_01.xisf" and you specify "creg_" as a prefix, the corresponding output file will be "creg_Comet_01.xisf". Specifying file prefixes and/or postfixes, along with the use of a specific directory for each task, are good practices to keep your working data well organized. With large data sets these practices can become extremely important.

The default value of this parameter is an empty string, so no output prefix is applied by default.

Postfix

This is a short piece of text that will be appended to the file names of all output images. For example, if a target image is "Comet_01.xisf" and you specify "_ca" as a postfix, the corresponding output file will be "Comet_01_ca.xisf". Specifying file prefixes and/or postfixes, along with the use of a specific directory for each task, are good practices to keep your working data well organized. With large data sets these practices can become extremely important.

The default value of this parameter is "_ca", so this is the postfix added to all output file names by default. Other tools use different file postfixes; for example, the standard StarAlignment tool uses the "_r" postfix. This helps you identify the working data being generated at each stage of your preprocessing procedures.

Overwrite

If this option is selected, CometAlignment will overwrite existing files with the same names as generated output files. This can be dangerous because the original contents of overwritten files will be lost and it will be impossible to recover them.

Warning — Enable this option at your own risk.

Generate comet path mask

If this option is selected, CometAlignment will generate a new image window representing the comet's path from all positions measured on the input frames. The image can be used directly as a mask to check the computed positions on any of the input frames.

5 Parameters

[hide]

This section resumes the parameters for the linear interpolation of the comet path between the stars:

X0, Y0

The coordinates of the centroid of the comet's nucleus in the first image.

X1, Y1

The coordinates of the centroid of the comet's nucleus in the last image.

Ẋ, Ẏ

Horizontal and vertical components of the mean apparent comet velocity in pixels per hour.

Compute PSF fits

If this option is enabled, CometAlignment will find the comet nucleus centroid by fitting an optimal point spread function (PSF) on each target frame during process execution. This greatly improves registration accuracy, which in turn leads to optimal resolution and signal–to–noise ratio in the resulting integrated image. Combined with multiple fixed images, this option can account for nonlinear nucleus trajectories (curved or with variable speed), or to align images not previously star–aligned, where the comet may follow an apparently irregular and arbitrary path.

If this option is disabled, comet coordinates will be linearly interpolated between the previous and next fixed frame positions during process execution.

Figure 1 — PSF fit

Comparison between a comet path computed with the Compute PSF fit parameter ON (left) and OFF (right).

6 Subtract

[hide]

When an existing image file is selected as the operand image in this section, it enables the subtraction working mode. As mentioned above, this feature allows an image to be subtracted from each single frame in the targets list. The operand image can be generated with ImageIntegration from the star–aligned frames or from the comet–aligned frames.

For this feature to work properly, all target frames must be star–aligned and the selected operand image must be an integration of the same set of target frames.

Operand Image

Path to the image to be subtracted from the target sequence. The buttons to the right of the text box, respectively, open a standard Open file dialog, open the selected operand image as a new image window, and reset the field disabling the subtraction mode.

Operand Type

Sets the operand type. This option will change the behavior of the subtraction routine.

  • Stars aligned — The operand image is expected to be aligned on the stars (usually a pure star field). It will be subtracted without any transformation from each target frame, and then the frames will be aligned on the comet.
  • Comet Aligned — The operand image is expected to be aligned on the comet nucleus (usually a starless comet). It will be aligned to the comet's position for each target frame and then subtracted.

When drizzle data files (with the .xdrz file extension) are added, the process uses the original calibrated frames instead of the registered images for all manipulations. In this way the final images will be created directly from unregistered originals to avoid double registration/interpolation. Also, if drizzle data files are added and an operand image is selected for subtraction, the process will write new unregistered original frames suitable for drizzle integration.

Drizzle Output

When drizzle data files (with the .xdrz file extension) are added and an operand image is selected, CometAlignment will write a new unaligned drizzle source image along with its drizzle data file for each target frame. The images can be either star–aligned (for a stars–only image) or comet–aligned (for a starless comet image).

Linear fit

Apply a pixel wise linear fit to each frame to make it statistically compatible with the operand image before subtraction.

Normalize

Equalize median pixel values after subtracting the operand.

Reject low/high

Rejection limits for the linear fit task. The linear fit operation will ignore all pixels whose values are below or equal to the low rejection limit, or above or equal to the high rejection limit. By definition, pure black and pure white (saturated) pixels will always be rejected.

7 Pixel Interpolation

[hide]

These parameters set the pixel interpolation algorithm used by CometAlignment to align target frames.

Lanczos

This is generally the best interpolation algorithm for registering linear images when no large–scale changes are required. Lanczos has excellent detail preservation and subpixel registration performance with minimal generation of aliasing effects. Its main drawback is the generation of undershooting (ringing) artifacts. Still, this problem can be fixed in most cases by enabling a linear clamping mechanism (see the clamping threshold parameter).

Bicubic spline

This is an excellent interpolation algorithm in terms of accuracy and execution time. As Lanczos interpolation, bicubic spline generates ringing artifacts, but the implemented clamping mechanism usually fixes most of them. The main problem of this algorithm is the generation of aliasing effects, such as moire patterns, which can be problematic with noisy images, especially in sky background areas. This is the reason why Lanczos is usually the preferred option.

Bilinear interpolation

This option can be helpful to register low–SNR linear images in the rare cases where the Lanczos and bicubic spline interpolations generate too strong oscillations between noisy pixels that cannot be solved via the implemented clamping mechanism. Bilinear interpolation has no ringing problems, but can generate strong aliasing patterns in noisy areas and provides less accurate results than Lanczos and bicubic spline.

Cubic filter interpolations

The Mitchell–Netravali, Catmull–Rom and Cubic B–Spline algorithms provide higher smoothness and subsampling accuracy that can be necessary when the registration transformation involves relatively strong size reductions. Note that this is never the case with CometAlignment since comet registration only involves translations.

Nearest neighbor

This is the simplest possible pixel interpolation method. It always produces the worst result, especially in terms of registration accuracy (no subpixel registration is possible) and discontinuities due to the simplistic interpolation scheme. However, in the absence of scaling and rotation—as is the case with CometAlignment—, nearest neighbor preserves the original noise distribution in the registered images, a property that can be useful in some image analysis applications.

Clamping threshold

This parameter controls the strength of the linear clamping device applied to reduce generation of ringing artifacts by the Lanczos and bicubic spline interpolation algorithms.

Ringing is caused by the negative lobes of the interpolation functions falling over high–contrast edges and isolated bright pixels. This effect is more prominent with linear data, such as raw CCD and DSLR images, than with nonlinearly stretched images.

In their current PixInsight implementations, Lanczos and bicubic spline include a clamping mechanism that prevents negative interpolated values and ringing artifacts for most images. This parameter represents a threshold value to trigger interpolation clamping. A lower value leads to a more aggressive deringing effect; however, too low of a clamping threshold may degrade interpolation performance, especially regarding aliasing and detail preservation.

8 Basic Usage

[hide]

In this section we'll show a basic example of CometAlignment usage. We'll use a small set of images of the comet C/2022 E3 (ZTF) by Vicent Peris. Even if not strictly necessary, the dataset has been previously registered with respect to the stars with the StarAlignment tool.

The workflow in this case is very straightforward. We start by selecting the files with the Add Files button. The frames are loaded in the Target frames list and ordered according to their observation times.

Important— As mentioned in the general description, CometAlignment can use exclusively files with valid acquisition time metadata, which are retrieved from standard Observation:Time:Start XISF properties or DATE-OBS FITS keywords. In the case of DATE-OBS keywords, keyword values must be valid date and time representations in ISO 8601 format.[1] Any files without valid acquisition time metadata—including wrong DATE-OBS keyword values—cannot be used.

Next, we select an output directory. Although optional, this is strongly recommended to keep the generated aligned files separate from the input target frames.

We now activate the Generate comet path mask option, since this will be helpful to check the alignment accuracy.

If appropriate, select a reference frame for alignment by double clicking on the '#' column, or by clicking the Set Reference button. By default, the reference frame is always the first image of the series. All frames will be aligned with respect to the reference frame during process execution.

Now it's time to define the comet translation parameters. Open the first image by double–clicking on its row in the target frames list and, if needed, apply a screen transfer function (STF) to show the comet. Click on a location close to the comet's nucleus to set the first fixed image. You don't have to be very accurate for this operation: CometAlignment will find the comet automatically and then will fit an optimized PSF to its nucleus. This will define optimal centroid coordinates for the alignment task, which will be shown as the X0 and Y0 parameters.

Figure 2 — Fixing a frame.

Comet nucleus selection.

Figure 3 — PSF fit.

PSF fitted on the nucleus: the small cross shows the fitted centroid position.

Open the last image of the series and repeat the operation to fix the second centroid, which will be shown as the X1 and Y1 parameters in the Parameters section.

Figure 4 — Registration parameters.

Registration parameters of the time sequence. Since the target series is star–aligned, the Ẋ and Ẏ velocity components represent the average apparent speed of the comet on the sky.

Being the image scale 0.68 arcsec/pixel in this example, the X velocity component is -91.96 arcsec/hour and the Y component is -12.88 arcsec/hour, with a total apparent rate of 92.86 arcsec/hour.

Important— The position of the comet's nucleus on the first and last images must always be defined manually. Otherwise the process cannot be executed.

If the comet path is irregular, define one or more fixed frames to account for the deviations from a linear path, and verify that the Compute PSF fits option is checked.

When all the fixed frames have been configured as necessary, the process is ready to run: click the Apply Global button to start the alignment. CometAlignment will save a new set of comet–aligned images on the selected output directory.

Using the comet path mask on a few images, we can verify the alignment precision visually.

Figure 5 — Comet path maps.

Alignment accuracy test using the comet path mask image. It's easy to see that the comet movement has been correctly tracked.

The workflow required for multi–filter sets (RGB/LRGB) is precisely the same: all filter groups must be aligned to the same reference frame (a shared image chosen as the alignment point). We recommend aligning all images of each filter in one pass to align the comet at the same point for each channel. On the other hand, if you want to align the channels separately, you will always need to load the common reference image, disabling it when aligning images taken with a filter other than the reference one. In this way, the image will only serve as a reference without taking part in the alignment process.

9 Integration techniques

[hide]

After CometAlignment execution, the image set is ready for ImageIntegration. Since the comet moves among the stars, two possible approaches exist: getting an integrated image with star tracks showing the comet's movement during the imaging session or getting a starless image of the comet, removing stars through careful pixel rejection.

Before detailing the suggested settings for image integration, we must point out an important concept. Comets are very tricky objects to image: they move fast, have rapidly changing structures in the tails, and are often imaged under challenging environmental conditions during twilight and very low on the horizon. Therefore it is nearly impossible to find always working settings. The following settings should be considered only as guidelines to be customized for each specific object.

9.1 Basic settings

Combination

As usual, Average is the best option here since it allows to get the best possible signal–to–noise ratio.

Normalization

The Additive with scaling option can compensate for both the additive components attributable to the variable brightness of the sky background and the multiplicative ones due to atmospheric extinction, which varies rapidly when the comet is imaged low over the horizon. Local normalization must be used carefully, as explained later.

Weights

In the current PixInsight implementation, image quality assessment and weights computations are performed during the image calibration phase (either performed manually or by the WeightedBatchPreprocessing script on the raw calibrated images) and inherited during all further image manipulations. Therefore the suggested weights are PSF Signal Weight or PSF SNR.

Anyway, suppose the comet is very fast and the exposures are guided on the comet's nucleus. In such case, the stars may become very elongated and hence PSF–based measurements may no longer be possible. In these cases a different weighting algorithm must be chosen or, as a last resort, no weighting at all.

9.2 Using Local normalization

As mentioned above, comets are usually diffuse objects with continuously changing positions. If the tail extends over a significant portion of the field of view, it can simulate the presence of a variable additive gradient and confuse the LocalNormalization algorithm. This is why using local normalization on star–aligned images is strongly discouraged.

On the other hand, local normalization on comet–aligned images might be helpful, mainly for rejection purposes, when strong and variable gradients are present. In these cases, LocalNormalization should be used on the comet–aligned images with some precautions: it is necessary to use a scale significantly larger than the variable structures (like plasma tail knots or synchronic structures in the dust tail), typically at a scale of 1024 or more pixels, and since the stars are often elongated, it is advisable to use the multiscale analysis scale evaluation method instead of PSF flux evaluation.

9.3 Pixel rejection

The pixel rejection strategy must be selected based on the desired final result: a starless comet or a comet with star trails.

Starless comet

A starless integration is helpful to see the faintest details in comet tails; it can be obtained by applying a strong pixel rejection with ImageIntegration.

The rejection algorithm must be chosen, as usual, based on the number of frames to be integrated. Like in the basic usage section, the suggested normalization strategy is Scale + zero offset to account fot both additive and multiplicative components, or Local normalization in presence of strong and variable gradients.

The rejection strenght must be optimized, by trial and error work, to perform the best possible star rejection without degrading too much the signal–to–noise ratio. To achieve this result checking the rejection maps can be very helpful.

The acquisition technique is also important: if the goal is to produce a starless image, then you must make sure that the stars are well separated in the different frames; this, for example, can be obtained by interleaving appropriate time intervals between successive shots or, if you use a grayscale camera with RGB filters, by alternating the filters for each shot to separate the images taken with a specific filter over time.

Figure 6 — Starless comet.

Example of a starless integration of comet C2022/E3 ZTF (Image courtesy Vicent Peris Baixauli (OAUV), Alicia Lozano, OAUV, OAO.)

Comet with trails

A comet with star trails can be helpful to show the apparent motion among the stars and to give dynamism to the image. It can be obtained by applying a bland rejection or no rejection at all.

If you choose to disable pixel rejection, you must pay particular attention to remove all possible artifacts, such as hot pixels or bad columns, during calibration. The CosmeticCorrection process can be helpful for this task.

As per the starless comet, even in this case, the acquisition technique is important: for reducing the chance of rejection and minimizing the gaps between the stars, it is essential to make the intervals between the shots as short as possible to obtain almost continuous star trails.

Figure 7 — Comet with trails.

Example of an integraion of comet C2014 Q2 Lovejoy (Image courtesy Edoardo Luca Radice).

References