The Officially Unofficial Reference Guide
The
StarMask process is an excellent tool in PixInsight to build star
masks of many types, including deringing supports. StarMask operates
by extracting the luminance from the target image (or a duplicate of
the image if it's in the grayscale color space) and applying a
multiscale algorithm that detects and extracts all image structures
within a given range of scales (read sizes). The algorithm is based
on the à trous
wavelet transform and on
a proprietary multiscale morphological transform.
Threshold: This value is used to differentiate between noise and significant structures. Basically, all detected structures below this threshold will be considered noise and set to zero, and the rest will survive as significant structures. Obviously, higher thresholds will include less structures in the mask, and vice versa. Therefore, increase this value to prevent inclusion of noise, and decrease it to include more structures.
Mode: You can select one between four available operation modes:
Star Mask, which will generate an actual star mask that you can use to process images. Of course, this mode is used to produce actual deringing supports for deconvolution.
Structure Detection, which generates a special mask with all detected structures, also known as a structure map. A structure map is useful to know exactly which image structures are being detected. It can also be used for actual image processing purposes, especially as the starting point of other mask generation procedures.
Star Mask Overlay. In this mode, StarMask generates an 8-bit RGB test image where the red channel contains the generated star mask superposed to the target image, while the green and blue channels have no mask contribution. The base image to build this overlayed image is the target image after applying the initial histogram transform (see the Shadows Clipping, Midtones Balance and Highlights Clipping parameters below).
Structure Detection Overlay. This mode is essentially the same as Star Mask Overlay, but instead of the star mask, the structure map is overlayed on the target image.
Scale: This parameter is the number of (dyadic) wavelet layers used to extract image structures. The larger value of Scale, the bigger structures will be included in the generated mask. Always try to set this parameter to the lowest value capable of extracting all required image structures; the range between 4 and 6 wavelet layers (scales from 16 to 64 pixels) covers virtually all deep-sky images.
Growth: Overall growth factor, which controls the final sizes of all detected structures on the mask.
Comp.: Small-scale growth compensation. This is the number of small-scale wavelet layers (from zero to the Scale parameter minus one) for small-scale growth compensation (see next parameter).
Small: Small-scale growth factor. This defines an additional growing procedure applied to the set of small-scale structures defined by the small-scale growth compensation parameter.
Smoothness: This parameter determines the smoothness of all structures in the final mask. If generated with insufficient smoothness, the mask will probably cause edge artifacts due to abrupt transitions between protected and unprotected regions. On the other hand, excessive smoothness may degrade masking performance. In the case of a deringing support, finding a correct value for this parameter is very important. If in doubt, it is preferable to exaggerate smoothness, because the effects of leaving too small of a value are usually much worse.
Aggregate: This parameter defines how individual image structures contribute to the mask construction process. Enable this parameter to generate a mask where structures are gathered by summing their representations on all wavelet layers. This leads to structures whose initial values are more proportional to the relevance of their support in the multiscale pyramid.
Binarize: This parameter defines how the initial set of detected structures is truncated to differentiate the noise from significant structures.
If enabled, the initial set of detected image structures is binarized: all structures below the Threshold parameter value are considered noise and hence removed (set to black), and the rest of structures are set to pure white. Therefore you should enable this parameter to generate a mask where all structures are initially white. In this case, only the smoothness parameter will determine the final brightness of all structures (smaller structures will be dimmer when smoothed).
If disabled, the initial set of detected image structures is truncated: all structures below the Threshold parameter value are considered noise and hence removed (set to black), and the rest of structures are rescaled to occupy the whole range from pure black to pure white. In this case, structures have initial values proportional to their relevance in the multiscale pyramid. Structures that are supported by more wavelet layers will be brighter.
Contours: Enable this option to build a mask based on structure contours. This option involves implicit binarization of all structures before contour detection.
Invert: Invert the mask after it has been generated.
Shadows/Midtones/Highlights: These parameters correspond to a histogram transform that is applied to the target image prior to structure detection and mask generation. In fact, this histogram transform is an important preparatory step in the StarMask algorithm. These parameters have default values of 0.0, 0.5 and 1.0, respectively, which define an identity transformation (no change). However, usually you'll need to apply lower values of the midtones balance parameter, especially working with linear images, mainly for two reasons:
To improve overall structure detection. In linear images, the structure detection algorithm may need you to improve local contrast of small structures in order to separate them from the noise.
To block structure detection over bright parts of the image, where you don't want the mask to include structures that are not stars, for example, but actually small-scale nebular features.
Increasing the Shadows parameter may also help to improve detection slightly; however, if you set it to an excessive value, clipping will occur in the shadows, which will prevent inclusion of dim structures. Generally, the highlights parameter is left with its default 1.0 value.
Truncation: Highlights truncation point. This value, in the range [0,1], is a highlights clipping point applied to the final mask (before multiplying by the Limit parameter, see below). It can be used to force the cores of bright structures to be pure white. Decrease this value to improve protection in the cores of mask structures.
Limit: This value, in the range [0,1], multiplies the whole mask after is has been completed, so it is useful to impose an upper limit for all mask pixels. Many deringing supports generated by structure binarization work better with lows limit values, between 0.1 and 0.5. If mask inversion has been selected, this multiplication will take place before the inversion.