Interpolate Bad Pixels

Command: Tools > Interpolate Bad Pixels

An often encountered problem are isolated bad pixels or even clusters of bad pixels, caused, for example, by gamma rays or detector problems. In principle there are two ways to deal with bad pixels: (1) mark the bad pixels and exclude them from any further calculations, or (2) interpolate the bad pixels from the surrounding pixels.

The decision whether to use method (1) or (2) depends on the problem and on the overall goal of the analysis. In the case of visual representations without any further calculations, it can be helpful to simply replace the spectra of bad pixels by interpolated spectra.

The command "Tools>Interpolate Bad Pixels" allows you to select a particular pixel mask and calculate the interpolated spectra for the masked pixels.

The algorithm for the interpolation of bad pixels aims at isolated bad pixels or small clusters of a few neighboring pixels. If you defined larger areas of bad pixels the interpolated pixels are very likely mere artefacts with little correlation to the true (unknown) spectra. Epina ImageLab accounts for this by reducing the intensity of the interpolated spectra towards zero the farther a pixel is away from valid pixels.

The following figure visualizes the weighting of the pixels: at the left bad pixels are indicated by dark gray. Pixels having at least 3 valid neighboring pixels are indicated by red dots (first shell), the green pixels (second shell) have less than 3 valid neighboring pixels and one to three neighboring pixels of the first shell. The first and the second shell are interpolated without reducing the intensity, all further shells (blue) are weighted with the inverse of the shell number. For larger bad pixel areas this results in clearly visible interpolated regions with very low intensity (right part).

Thus clusters of bad pixels should not contain more than two shells, which means that the maximum size of a cluster for the interpolation of bad pixels is a rectangular shape with one side not larger than 4 pixels.

Hint: Epina ImageLab also provides a Spike Removal Tool which has been specifically designed to remove spikes in the spectra. This tool should be preferred if spikes are to be removed.