imProc.mask - EranOfek/AstroPack GitHub Wiki

Description

The imProc.mask package contains functions that search, use, and populate the MaskImage object inside the AstroImage object.

MaskImage is a container class for bit mask images. A bit mask image contains an image in unsigned integer format (default is uint32), in which each pixel corresponds to a pixel in the science image, and each bit in the unsigned integer corresponds to a state or a problem in this pixel. The bit names in the bit mask itself are managed by the BitDictionary class.

Some basic functionality to convert between bit names, indices and decimal representation are available in the BitDictionary class. Some basic functions to treat MaskImage are available as part of the MaskImage class.

Functions

The following functions are available:

  • imProc.mask.allFunList - List of all functions in the package.
  • maskBadColumns - Mask pixels which belong to bad columns, by applying a sliding block filter.
  • maskCR - Mask cosmic rays in an image [TBD]. See also: imProc.sources.cleanSources
  • maskSaturated - Set mask bits for saturated and non-linear pixels. This function can get the saturation level from the image header.
  • replaceMaskedPixVal - Replace the values of image pixels which have a specific bit mask.
  • interpOverMaskedPix - Interpolate over pixels with a specific bit mask.
  • maskHoles - Search for holes (negative sources) in images and add a bitmask marking the hole's central position (A hole can be generated from stars in the flat image).
  • maskSourceNoise - Mask pixels that are dominated by source noise (rather than background noise).
  • maskTracks - Mask satellite/airplane tracks as lines in the image, using Hough transform.
  • unitTest - Test the package.

Examples

% AI is An AstroImage object:

% maskSaturated
AI = AstroImage({rand(10,10).*1000});
Result = imProc.mask.maskSaturated(AI, 'SatLevel',500)
Result = imProc.mask.maskSaturated(AI, 'SatLevel',500, 'NonLinLeve',100)
Result = imProc.mask.maskSaturated(AI, 'SatLevel',500, 'NonLinLeve',100,'MultLevelByGain',true,'Gain',5);
    
% replaceMaskedPixVal
imProc.mask.replaceMaskedPixVal(AI,  'Saturated', NaN);

% interpOverMaskedPix
% Note that by default interpolated pixels will be marked by the 'Interp' bit (see function help).
Result = imProc.mask.interpOverMaskedPix(Obj);
Result = imProc.mask.interpOverMaskedPix(Obj,'BitNamesToInterp',{'Saturated','HighRN'});

% maskHoles
AI=AstroImage({rand(1000,1000)});
AI=imProc.background.background(AI)
AI.MaskData.Image=uint32(zeros(1000,1000));
AI = imProc.mask.maskHoles(AI);

% maskSourceNoise
AI = imProc.mask.maskSourceNoise(AI);