I have noticed lately that the images I get from Slooh.com have dust doughnuts in them – here is an example:

This is the integrated Luminance image from four missions to NGC 246. The boxes show the locations of dust doughnuts.

These artifacts do not go away with regular processing, they just become worse and more difficult to deal with later.

The good news is that it is possible to remove these defects from your images and the process is relatively straight-forward thanks to a script called GAME.

You apply the process that this article describes to your linear Luminance image. Ideally, your linear luminance image should have an even background which you can achieve using ABE or DBE.

Overview of the Process of Removing Dust Doughnuts

This article discusses the details of the following steps to remove the dust doughnuts from your images:

  1. Use the GAME script to create a mask that encompasses the dust doughnut
  2. Evaluate the nature of the dust doughnut
  3. Use the PixelMath process to replace the pixel values within the dust doughnut
  4. Use the NoiseGenerator process to blend the corrected area with the surrounding area
  5. Apply your  changes to your image

Once you complete this process, the dust doughnut will be blended with the background of your image and be virtually undetectable.

Overview of the GAME Script

The GAME script is a script developed by PixInsight community member Hartmut Bornemann. Bornemann makes his scripts available in an automatically updating repository that makes it easy to install the scripts into PixInsight.

The GAME script gets its name from the fact that it is a ‘game changer’ in that it makes the process of creating certain types of masks extremely easy. Without the GAME script, you would have to use a complex PixelMath expression to generate a similar mask. With GAME, you simply make selections right on your image.

Installing the GAME Script

Point your browser to this address: http://www.skypixels.at/pixinsight_scripts.html

There you will find the installation instructions for adding the GAME  and other scripts to PixInsight. If you scroll down the page, you’ll find the description of the scripts included in the repository both in German and English.

Using the GAME Script to Create a Mask

The fist step in the process is to create a mask that encompasses the dust doughnut and we’ll use the GAME script to help us do that.

With your image open, from the menu, select Script – Utilities – GAME

The screen will change to display your image without the STF applied to it – click the ‘Auto STF’ checkbox in the upper right of the window to temporarily stretch your image so that you can see it.

Next, click the Add button on the left side of the screen to add a new ellipse shape to your image. 

Click and drag the center of the ellipse so that it is over the dust doughnut and then use the handles on the left, right, top, and bottom of the ellipse to resize the ellipse so that it covers the dust doughnut, as shown:

In the Export Masks section, clear the checkbox next to Gradient Mask and put a checkmark next to Binary Mask. Click Ok to create the mask and exit the script.

The script produces a mask made up of the ellipse you selected.

Evaluate the Nature of the Dust Doughnut  

We need to evaluate the dust doughnut to determine how much lower the pixel values within the doughnut are compared to the pixel values of the surrounding region. Do the following:

1. Zoom in to your image and center it on the dust doughnut.

2. Enable read-out mode for your pointer (press ALT-R on your keyboard)

3. Evaluate the values of the pixels within the dust doughnut and the surrounding region.

You should end up with two very small values; in my case the pixel value within dust doughnut was at 0.0017 and the surrounding area was a 0.0025

You don’t have to worry about getting the values absolutely correct, because we can adjust them in the next step.

Use PixelMath to Replace the Pixel Values within the Dust Doughnut

Do the following:

1. Apply the mask that you created using the GAME script to your image

2. Create a preview that encompasses the dust doughnut and some of the surrounding region

3. Open the PixelMath process and enter the following expression:

iif($T < 0.0017,0.0025, $T)

Replace the first number with your pixel value for the area within the dust doughnut; replace the second number with the pixel value you found from the surrounding region.

4. Drag the New Instance icon from PixelMath onto your preview to evaluate the result.

What the expression does is evaluate the pixel value it is processing and determines if it is less than 0.0017 in this example. If it is less than 0.0017, PixelMath replaces that pixel value with 0.0025. If it isn’t less than 0.0017, PixelMath replaces the value it finds with whatever is in the original image.

You want to adjust the numbers in the expression so that you get to a point where the dust doughnut is barely visible. You’ll still be able to make out the general area of the dust doughnut, but it should almost blend perfectly with the surrounding region.

Once you have it, right-click the Preview tab on your image, and select Store. This saves the state of the preview so that we can add the effect of another process to it.

Use NoiseGenerator to Blend the Corrected Area with the Surrounding Area

The corrected area probably blends almost perfectly with the surrounding region at this point, except that the corrected area is much smoother than the surrounding area.

To blend the smoothed area, we’ll use the NoiseGenerator process to add noise to the smoothed area to make it blend with the surrounding area. Do the following:

1. Open the NoiseGenrator process

2. Select a Distribution option that matches the noise in your image

In my case, I found that Uniform worked best

3. Select or enter a value for the Amplitude

You will have to find this value by experimentation by repeatedly applying the NoiseGenerator process to your preview. In my case, the Amplitude was 0.0005.

The idea is to blend the noise in the surrounding region with the noise you add in the smoothed area.

Apply PixelMath and NoiseGenerator to your Image

Now that you have the correct values for both PixelMath and NoiseGenerator, you can apply both to your image.

Evaluate the result and adjust as necessary to blend the area. This is the corrected area of my image:

Once you are done, continue with your usual workflow to process your image.

Conclusion

In this article, you learned how to remove dust doughnuts on your images using the GAME script, PixelMath, and NoiseGenerator processes.