Background Masking Filter

Calculates a mask based on specific criteria as a means of determining which pixels belong to the background and which do not.

Category

category_mask_selection Mask and Selection

Node

backgroundmasking_node

Parameters

MaskingMethod: How to perform the background masking (see below for details)

SimilarityLevel: if MaskingMethod is Cosine this specifies how similar to the background another spectrum must be to be considered background itself (higher values indicate that a greater similarity is required, range is from 0 to 1)

Threshold: if MaskingMethod is not Cosine this is the threshold that will be used to compare to the average value of the input to determine if another spectrum is considered to be background or not

Inputs

Input: the input to use to determine the mask

Outputs

Mask: the resulting mask

Supplementary

AverageSpectrum: the average background spectrum that will be used as a baseline (only present if MaskingMethod is Cosine

Effect of the Filter

The filter has to primary modes, selected by the MaskingMethod parameter.

If MaskingMethod is GlobalAverageLesser or GlobalAverageGreater the node will calculate the value of the input averaged over all channels (e.g. all wavelengths if the input is spectral data) and compare that to the specified Threshold parameter. For GlobalAverageLesser a pixel is considered to be part of the background if the average value of the pixel is smaller than the threshold, for GlobalAverageGreater if its average value is larger than the threshold.

If MaskingMethod is Cosine the filter will require training data consisting of pixels that have been assigned to the background. The spectra of these pixels will be averaged and used as the reference for what a background pixel should be considered to be. When applied a normalized scalar product with that reference is calculated for each pixel, and if the pixel has a spectrum similar enough to the background (the scalar product being close to 1), it will be considered to be a background pixel. The SimilarityLevel parameter will determine the threshold here. A SimilarityLevel of 1 is the strictest possible value, requiring that all pixels that should be considered background to have spectra that are exact multiples of the reference spectrum. (Which in practice likely means none at all.) Decreasing that parameter to less than 1 will start to include more and more pixels in will be considered to be background.

The GlobalAverageLesser and GlobalAverageGreater modes can also be achieved by an Instrument Function Filter that calculates the global average of the input, followed by a Threshold Filter to perform the actual thresholding operations.

See also