Processing a Hα CCD Image with PixInsight

By Daniel Bosch



1. The Original Image

In this tutorial I want to show you how I have processed one of my recent Hα images. I don't pretend to write a complete guide about the most correct way of working with this kind of photographs, but just to describe a simple method that has given good results to me.

The final processed image, applying the procedure described in this tutorial. Click on the image to see a larger version at approximately one half of the original CCD image.

Takahashi FSQ106ED and STL11000XM C2 CCD camera at –10°C, with a Baader Hα 7nm filter. Calibration (11x10-minute exposures, 15 darks, 15 flats, 15 bias) with Images Plus 3.5 and entire processing with Pixinsight 1.2.

We start with the resulting image just after calibration. In this case it is an image of the Gamma Gygni region that integrates 11 10-minute exposures. Individual images have been calibrated with 15 darks, 15 bias and 15 flat frames each with Images Plus v3.5.

The first step is opening the image with Pixinsight 1.2. It looks as shown on Figure 1.

Figure 1— The original image, just after calibration.
(Click on the image to enlarge)


2. Viewing Image Contents with ScreenTransferFunction (STF)

As every just-calibrated image, the original image of this example is extremely dark. This happens because the image is linear, so its distribution of brightness isn't adapted to the response of nonlinear devices, as display monitors or our own vision system.

Let's see what is hidden in the image by means of the ScreenTransferFunction tool (STF) which, as most of you probably know, doesn't modify actual image data, but just works by altering their representation on the screen.

Double click on the checkmark icon near the bottom right corner of the STF interface (Track View) to link it to the active view. This allows us to see on the image the effects of moving the sliders in real time.

Figure 2— By activating the Track View option of ScreenTransferFunction, we link the interface with the active view.
(Click on the image to enlarge)


Figure 3— With Track View enabled, the result of any slider change is shown on the active view in real time.
(Click on the image to enlarge)

As we can see on Figure 3, STF allows us to see what we are dealing with very easily, without needing to alter the image.

In more complex processing works, STF plays a fundamental role because it allows us to work with the linear data, making it possible to represent them on the screen so that we can evaluate the obtained results. This is particularly important to work with deconvolution, which only makes sense with linear data. Other algorithms also can work much better when the image is linear, as wavelet transformations and sky background modeling.

In this simple case, we are going to use STF just to crop some border artifacts that originated in the stacking of individual images that don't match exactly.


3. Cropping Border Artifacts with DynamicCrop

As we have said, the image shows some dark artifacts on its edges, as a result of stacking individual light frames. We are going to crop these artifacts with the DynamicCrop tool (Figure 4).

Figure 4— Cropping border artifacts with DynamicCrop.
(Click on the image to enlarge)

After cropping the borders, we must reset the active STF to its default values, to avoid false screen renditions during the rest of the processing. We click on the Reset icon of the STF interface (bottom-right corner), while the Track View option is enabled and the active view is the image being processed.

Figure 5— Resetting the active STF after cropping the borders with DynamicCrop.
(Click on the image to enlarge)


4. Nonlinear Stretch

We now open the HistogramTransformation tool and look at the distribution of data in our image. We are going to apply the first nonlinear stretch to the data. It consists of clipping the unused levels at the shadows —note that I have used a strong magnification factor for the input histogram graphic, in order to be very careful to avoid clipping relevant data— and decreasing the midtones balance to redistribute the data across the available dynamic range.

Figure 6— Setting the shadows clipping point with HistogramTransformation.
(Click on the image to enlarge)


Figure 7— Setting the midtones balance with HistogramTransformation.
(Click on the image to enlarge)

Occasionally, after a first try we can perform another HistogramTransformation action to improve the redistribution of values with new adjustments of the shadows clipping and midtones balance parameters. However it is advisable to carry out the initial nonlinear stretch with the minimum number of iterations, ideally with just a single one.

Figure 8— Second iteration of HistogramTransformation to refine the nonlinear redistribution of the data.
(Click on the image to enlarge)


Figure 9— Final result after the initial nonlinear stretch.
(Click on the image to enlarge)


5. Protection Mask

Some folks would stop here (Figure 9), but if we look carefully at the brightest regions of the image, we'll notice that it claims for some improvement of fine details. Since these bright areas have relatively high signal-to-noise ratios, they are ideal candidates to apply edge enhancement techniques (also known as sharpening techniques). This is a general category that includes deconvolution, unsharp mask, etc. My preference to carry out this task is to apply wavelet transformations in PixInsight.

As all of us know, edge enhancement techniques tend to perform poorly on low-SNR areas, which correspond to the sky background and the dimmest regions of nebulas. So before applying these techniques, in general we must protect correctly these regions with the help of a suitable mask.

On the other hand, the brightest regions of the image also contain some stars, which shouldn't be left unprotected, since edge enhancement algorithms tend to damage their naturally soft profiles. So we must protect also the stars with a specific mask.

The conclusion is that our final mask must be composed of two partial masks: a conventional star mask (which will work inverted to protect the stars), and a second mask that will left exposed the brightest areas of the image. Let's see how this can be achieved.

Firstly, we'll extract the luminance of the image. For a grayscale image, this operation is just the same as making a duplicate of the image. In our example we'll make two duplicates, one for each partial mask, which we'll combine later into our final mask.

Figure 10— The two duplicates necessary to build the partial masks used (star mask and large-scale mask).
(Click on the image to enlarge)


5.1 Star Mask

Let's begin with the star mask. We'll apply the ATrousWaveletTransform tool, disabling the residual layer (R), as shown on Figure 11.

Figure 11— First step to build a star mask: Remove the residual layer with ATrousWaveletTransform.
(Click on the image to enlarge)

As we see, our star mask also includes some rests of extended nonstellar objects, which we should remove. This can be done with HistogramTransformation. We can join the shadows clipping point and the midtones balance point, then drag them until we think we've achieved a good compromise solution between the amount of stars included in the mask and the amount of artifacts suppressed. There is no fixed rule about the valid adjustments; it's a matter of practice and personal preferences. Having the Real-Time Preview function enabled helps a lot in this task.

Figures 12, 13— Suppressing the rests of nonstellar objects with HistogramTransformation.
(Click on the image to enlarge)

As a result of the previous operation, the sizes of all stellar disks have been decreased to a point that the obtained mask wouldn't block sufficiently the adverse effects of edge enhancement on the stars. So we must extend all star disks on the mask. MorphologicalTransformation is the perfect tool to do this, by means of a dilation filter applied with a set of parameters similar to those shown on Figure 14.

Figure 14— Extending stellar disks with MorphologicalTransformation.
(Click on the image to enlarge)

Don't worry about those gray halos that have appeared around the stars (Figure 14). We'll fix them easily by blurring the image with ATrousWaveletTransform. To this purpose we can disable some small-scale wavelet layers. In our example we have disabled the first two layers, corresponding to scales of one and two pixels, as you can see on Figure 15.

Figure 15— Smoothing edges on the star mask, after the dilation filter.
(Click on the image to enlarge)


5.2 Large-Scale Mask

We have finished one of the two masks, which we'll rename as "Stars" ("Estrellas" on the screenshot figures). Now let's build the second mask. As before, we start with one of the duplicates of the original image, then remove the wavelet layers supporting the image structures that we don't need. We do this with ATrousWaveletTransform (Figure 16).

Figure 16— Suppressing small and intermediate scales as the first step to build a large-scale mask.
(Click on the image to enlarge)

As we did for the previous star mask, we'll also apply HistogramTransformation to this one (Figure 17). We want the sky background well protected (black on the mask), but at the same time we need to preserve most existing gradients on large-scale structures. This can be achieved by carefully adjusting the shadows clipping and midtones balance control points. Remember that the Real-Time Preview function is your best friend here, since it allows you to get an instant feedback from any change you make on the histogram control points.

Figure 17— Adjusting contrast of the large-scale mask with HistogramTransformation.
(Click on the image to enlarge)


5.3 Combined Mask

Now we have to combine both partial masks into our final mask. First we'll invert the "Stars" mask ("Estrellas" on the figures), by pressing Ctrl+I (or selecting Image > Invert from the main menu).

Figure 18— Inverted star mask.
(Click on the image to enlarge)

The next step is to apply the following expression with the PixelMath tool:

Min( LargeScale, Stars )

This PixelMath instance should be applied to a duplicate of either "LargeScale" ("GranEscala" on the figures) or "Stars" ("Estrellas" on the figures). The reason to use a duplicate is that these masks can be very useful in subsequent processing steps, so preserving them is always a good idea. In this example, we'll reuse the large-scale mask for noise reduction, as we'll see later.

By applying the expression above, each pixel of the final mask will have the smallest (dimmest) value of the corresponding pixels in both partial masks. The result can be seen on Figure 19.

Figure 19— The final mask combined with PixelMath.
(Click on the image to enlarge)

Now we have our mask finished. As you can verify on Figure 20, when we activate the mask for the image being processed (Mask > Set Mask from the main menu, or Ctrl+M), we can see which regions of the image are being protected (dark) and which are not (bright). To hide or show the mask, you can select Mask > Show Mask from the main menu.

Figure 20— The combined mask, activated and shown for the image being processed.
(Click on the image to enlarge)


6. Edge Enhancement with ATrousWaveletTransform

Once we count with the protection of an appropriate mask, we can safely apply wavelets to our image. With the ATrousWaveletTransform tool, the edge enhancement effect will be achieved by increasing the Bias parameter for the small-scale wavelet layers. The exact values depend on the personal taste, but should be limited according to the strength of the signal available. As a rule of thumb, I usually don't use biases below 0.50, and rarely above 2.5. Note the effect achieved for this image on Figures 21 (before ATrousWaveletTransform) and 22 (after ATrousWaveletTransform).

Figure 21— Before edge enhancement with ATrousWaveletTransform.
(Click on the image to enlarge)


Figure 22— After edge enhancement with ATrousWaveletTransform.
(Click on the image to enlarge)

We must be very careful with the Bias parameter. If we apply excessive values we can easily bring on the noise, or cause ugly ringing artifacts.


7. Noise Reduction with ACDNR

In his book The New Astro Zone System for Astro Imaging, Ron Wodaski encourages us to enhance edges on regions with high signal-to-noise ratios (SNR). In the same way, he also encourages us to apply noise reduction on those regions with low SNR. That's what we are going to do with our image.

Note that the low-SNR regions are precisely those that are being protected by our "LargeScale" mask ("GranEscala" on the figures), so we can just replace the current combined mask by our original "LargeScale" mask, but this time with mask inversion enabled because we want to leave background regions unprotected.

Figure 23— Activating the large-scale mask with mask inversion enabled, to use it as a noise reduction mask.
(Click on the image to enlarge)

The noise reduction procedure has been carried out with the ACDNR tool in PixInsight. While default ACDNR parameters can work reasonably well sometimes, you actually must tweak them carefully. Usually you'll need to decrease the Amount parameter and increase the number of iterations. You should make use of previews to find the optimal values for your image. Try to avoid hard changes between smoothed and protected regions, especially those that have been enhanced with wavelets before, which are now being blocked by the mask.

Figure 24— Noise reduction with ACDNR, with the help of the inverted large-scale mask.
(Click on the image to enlarge)


8. Size Reduction for Web Deployment

To show your images on galleries, public forums, etc., normally you'll have to reduce its size in pixels. For example, most free image storage services used for forums impose a maximum size on the images uploaded to their servers.

The Resample tool allows us to reduce the size of any image very easily in PixInsight. In this case I have resampled my image to 2100 pixels wide (Figure 25). At this size the image occupies about 2 MB in JPEG format at 100% quality.

Figure 25— Resizing the image with the Resample tool.
(Click on the image to enlarge)