SHO processing narrowband data in PixInsight (part one)

This tutorial is going to be a rough and ready introduction to processing narrowband data (Ha, Oiii, and Sii) using PixInsight. 99% of the credit for these steps goes to Shawn from Visible Dark‘s YouTube tutorials. Any mistakes or terrible suggestions, however, are completely my fault!

For those of you wanting to get into processing narrowband data but don’t have any of your own to work on, I share my integrated data on my google share. For the rest of this tutorial series I’m going to work on my M16 data. The steps I follow are essentially the same regardless of target. One last word on my data before we get into it – I sometimes share my data in multiple different resolutions. When I do this, the number after the channel (ie the 4K in M17_H4K) indicates that the longest side is approximately 4,000 pixels long. The smaller the number, the smaller the files will be.

This first part will take us from the 3 integrated channels of data up until we have a SHO coloured image that has been stretched and is ready for non-linear processing. To get started, load your three channels up into PixInsight. I apply an auto-stretch to each of them (CTRL + A) just so that I can see what I’m working with. I will also rename their identifiers to H, O, and S, because that’s what my PixelMath scripts are expecting later in the process.

  1. Linear Fit

Not all channels are created equal. Which channel is strongest or weakest will vary from target to target and also upon the conditions under which the data was collected, but usually Sulphur or Oxygen will be the weakest channel. With my M16 data, the Oxygen seems to have the least amount of definition and structure over all, so I will use it as the basis for my linear fit. Linear Fit helps balance the intensity of the channels. You will notice when you don’t use it, as typically your combined colour image will have a significant skew towards one colour representing the the channel with the strongest signal. When doing SHO processing, that usually means a very green image, as the lovely rich Hydrogen alpha data just does a number on the other channels!

So open up the Linear Fit tool. (If you don’t remember where any of them are, don’t worry, neither do I. I just go Process Menu -> All Processes, and then they are listed in alphabetical order.) Drag the identifier tab from the O channel up into the text field in the Linear Fit dialog, or just type the letter O if you prefer.

Now drag the execute triangle onto one of the remaining channels, then the other.

(Every now and again, Linear Fit will complain of incompatible geometry. That isn’t its fault, for some reason when I’ve saved my integrated stacks they aren’t perfectly aligned and matched. This is easily fixed! Open up Star Alignment, and drag your favourite channel into the reference image field at the top. Make sure Working mode is set to Register/Match Images (the default), and then drag the execute triangle onto the remaining two channels one after the other.

The end result of this is that 2 new images will be created, in this instance an O_registered and S_registered. These are identical sizes and perfectly aligned to the chosen channel, so we are good to continue. I now close the original O and S windows, and rename the registered ones to O and S.)

Once the channels have been fit, they will look weird. Just click on them and CTRL A to recalculate the screen transfer stretch if it bothers you.

2. SHO Combination

There are a few different way of constructing your colour image. The easiest is simply to use the LRGB Combination tool. Untick the L channel, and assign S to Red, H to Green, and O to Blue.

For a more custom or nuanced approach, I prefer to use PixelMath to produce my combined image. I prefer a blend the channels a follows:

  • RED: 0.7 * S + 0.2 * H + 0.1 * O
  • GREEN: 0.7 * H + 0.2 * O + 0.1 * S
  • BLUE: 0.7 * O + 0.2 * S + 0.1 * H

These equations can be copied into the PixelMath Expression Editor. Remember to make sure that “Use a single RGB/K expression” is not selected, so you can put in different equations for each channel.

One of the great things about processing is that you can experiment and find a palette or approach that works for you. I have this PixelMath expression saved as “Rosco SHO” because it’s a blending of the channels that I go to 9 times out of 10. It is just a touch more subtle that a straight combination, and I like that.

Now that we have a colour image, most of our work from here on in is done with that image, not the monochrome channels. In fact for the rest of these instructions I will call out those times we want to refer back to the Hydrogen Alpha stacked image, and the rest of the time assume we are working on the colour image. (One more note: When we run PixelMath scripts, it may update the window we run it on, or it may crate a new window with the result of the script. It actually doesn’t matter which, just so long as it is the updated window that you work with from that point forward. If PixelMath creates a new image, you can minimise or close the older one.)

3. Deconvolution

You, dear reader, live in the privileged era of Russell Croman and his excellent suite of processing tools to aid in image processing. If you have already dived in and purchased yourself BlurXTerminator, you can use it in place of the PixInsight deconvolution tool.

The PI deconvolution tool is certainly very capable, so don’t feel like you need to rush out and buy BlurXTerminator today. But BlurXTerminator is certainly much easier and requires less fiddling. If you have it, use it and move on.

Tangent: Previews

Some processes – like deconvolution – can take a while, and you really need to get the settings just right before you run it across your whole image. To do this, PixInsight gives us the ability to create Previews.

This little button (or Alt + N) lets you create a preview window – a small section of your main image. Click on it, and then draw a rectangle onto your image for you to preview your processing in.

You will notice a new side tab with Preview01 as its label. Click that tab to see just your preview window.

When you’re creating a preview, have a think about what process you’re wanting to fine tune. In this instance I’m going to demonstrate deconvolution, and so I want an area that has a decent population of stars, especially of different sizes.

Now that I have my preview window open and my deconvolution tool ready, I can simply drag the triangle onto the preview window and see the result.

In this instance, the result is not very nice at all. So we need to experiment with De-ringing to try and eliminate these ugly circles from around our stars.

When we’re tweaking settings in PixInsight, a good guide is usually to use the lowest value you can that gives you the result you’re looking for. The defaults are also usually a pretty good place to start, so I am selecting the Deringing checkbox and running the deconvolution with the default global dark value of 0.1.

OK, our image no longer looks like a star field at all, so we’re going to lower that Global dark value until it looks like a star field again!

Trial and error gets me to a value of 0.01 producing a decent result. So now we can select the main image again and run the deconvolution against the whole thing. As you’ll see, it takes a lot longer on the whole image!

4. AutoColor

This was another hot tip from Shawn at visible dark – go check out Herbert Walter’s site or take a quick read over at Shawn’s site. Once installed you will find AutoColor in the Script -> Utilities menu. It helps balance out the colours.

5. Noise Reduction

Once again I bow at the altar of Russel Croman and turn to NoiseXTerminator. Again PixInsight has an incredibly powerful suite of tools fit for this purpose, the Multiscale Linear Transform tool. I use this tool frequently so it is a good one to learn, and I will update these instructions to include a guide to this awesome little utility.

6. Stretch

6.1 The Quickie

The first stretch to learn in PixInsight is what I call The Quickie – this is doing a permanent stretch using the Screen Transfer Function. From the Process -> Intensity Transformations menu, open up both the HistogramTransform and the ScreenTransferFunction. Firstly, drag the triangle from the Screen Transfer Function dialog onto your unstretched image, and then hit the nuclear button to calculate the stretch.

Now, making sure that the image identifier in the Histogram Transformation is set on your unstretched image (or hit the tick icon in the bottom right of that dialog so it will follow your active window), drag the triangle from the Screen Transfer Function down to the bottom bar of the histogram transformation – just to the right of the circle icon in that bottom bar is perfect. When you release the mouse button, you will see that the histogram has been updated.

Two more steps: turn off the screen transfer preview so the image returns to black (F12), then hit the square button bottom left on the Histogram Transformation dialog (or press F5). Now the Screen Transfer stretch has been applied to your image.

6.2 Histogram Transformation

The second technique for stretching is to manually adjust the histogram rather than letting the STF do all the work.

It is fairly straightforward, especially if you take it slowly rather than trying to stretch too far too fast. So with an unstretched image, open the Histogram Transformation tool and press the circle icon in the bottom left of the dialog to open up the real-time preview.

Now grab the middle triangle on the lower histogram, and drag it to the left up towards the black triangle. You will see the histogram in the top portion has moved up from the far left hand side of the panel, and also you will start to see some details in your preview window.

Keep the histogram peak to the left of the first vertical bar for now, and hit the square button or press F5 to apply this stretch. Your preview window will turn white – this is normal, it is now showing you what you would get if you applied that same stretch again. In the bottom right of the Histogram Transformation dialog is the reset button – press this to return the histogram tool back to its original setting, then you will be ready to do your second stretch.

The second stretch is similar to the first. Again we move the midtones (middle) triangle towards the left of the bottom histogram until the upper histogram peaks around the first main bar (approx 25%). But now we take the far left triangle (the black point) and slide it slowly to the right until the curves in the preview histogram seem to start just right of the left of the chart. You will notice that changing the black point has moved the histogram back to the left, so you will need to adjust the midpoints again to get the histogram peaking at the 25% line. Keep adjusting the black point and midpoint sliders until you have a curve (or 3 curves) that start just to the right of the edge of the chart, and peak on the 25% line. Hit apply, and reset the histogram transformation tool like before.

6.3 Mask Stretching

With many deep sky objects there is a large dynamic range between the bright core of the nebula or galaxy, and the outer nebulosity or galaxy arms. Stretching can feel like a balancing act between overblowing the core, or under-stretching the outer details. We can use mask stretching to have our cake and eat it too.

Open the Range Selection tool (Process -> Mask Generation) and turn on the preview. Your preview window will again turn white – this is what we expect. Firstly, drag the Smoothness slider all the way to the right (100%). Now adjust the Lower limit slider until you are left with a white blob that corresponds to the bright inner core area of the nebula. When you are done, hit apply.

This has created a new image called the Range Mask. Drag its name tab over to your image, and release it on the left hand bar below the main image name tab. This is applying the mask over your main image. Now any operations that you perform on your image will only be applied to the areas that are not red. Areas that are red are “masked” off so that the transformations or operations you apply do not affect those areas.

In our case though, this is actually the opposite of what we want – we want to protect or mask the nebula core, and stretch the surrounding areas.

These three buttons all affect the masking currently being applied to the image. From right to left, these buttons show or hide the mask (the magnifying glass), apply or turn off the mask (the tick), or invert the mask (the left button with the circle half black half white). Click this left hand button once, and you will see the mask is now protecting the core, and leaving the rest of the image open.

Now that our core is protected, we can return to the Histogram Transformation, turn on the preview (the circle in the bottom left of the dialog), and start to raise the midtones by moving the middle slider towards the left again. (Don’t forget to reset the histogram tool before you start tweaking).

The best way to see the affect of the mask is to drag the midtones slider too far to the left. This will allow you to see the outer nebula being blown out, while the core stays nicely stretched because it is protected by the mask. From this position, slowly slide the midtones triangle back to the RIGHT until you get nice even stretching that has brought out the surrounding nebulosity without leaving a harsh or stark transition between outer and core.

Stretch-wise this is looking pretty good. The contrast has been lost but we can recover that a little further through our processing.

Note the left hand side bar on the preview window – beneath the red circle at the top, there is a circle in a white rectangle. This button allows you to toggle the preview on and off – in other words, while the rectangle is white, you are seeing the effect of the tool (in this case, the histogram tool).

Click that circle in a rectangle once to deactivate the preview, and you will see the image as it is now, without the change being applied. Once you’re happy, hit apply, then hit the button to the left of the invert mask button, to remove the mask.

7. Demagenta

One of the side effects of SHO processing is the horrible magenta halo around all the stars! Thankfully Shawn has once again saved the day, with a PixelMath script to de-magenta the image. Just as we saw for using PixelMath to create the SHO image, we can open up PixelMath and then open the expression editor. Once again we do not want a single editor, as the instructions are different for the three channels. This time we will also create some symbols in the Symbols tab. Set up the expression editor with the following:



R/K: $T[0]
G: iif((CIEL($T)>MIN_BRIGHTNESS)||((min($T[0],$T[2])/(max($T[0],$T[2])>MAGENTA_DEFN))&&(mean($T[0],$T[2])>$T[1])),mean($T[0],$T[2]),$T[1])
B: $T[2]
Symbols: MAGENTA_DEFN = 0.9, MIN_BRIGHTNESS = 0.9

It’s also a good idea to ensure that Replace target image is selected at this point. Drag the triangle across onto your image, and watch as PixelMath neatly rids our image of the magenta halos.

8. SCNR Noise Reduction

Last step in this tutorial is to use SCNR from the Process -> Noise Reduction menu to tone down the green level in the image. By default the SCNR tool suggests removing 100% but I usually play around with values between 50% and 100%.

This is the end of this first tutorial, taking us from our integrated narrowband data to a stretched and colour corrected Hubble Palette image. Part 2 will cover the selective processing I do to bring out some of the detail in the nebula, apply some selective colour saturation adjustments, and star minimisation.