casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | List of all members
casa::SDMaskHandler Class Reference

#include <SDMaskHandler.h>

Public Member Functions

 SDMaskHandler ()
 Empty constructor. More...
 
 ~SDMaskHandler ()
 
void resetMask (std::shared_ptr< SIImageStore > imstore)
 
void fillMask (std::shared_ptr< SIImageStore > imstore, casacore::Vector< casacore::String > maskStrings)
 
void fillMask (std::shared_ptr< SIImageStore > imstore, casacore::String maskString)
 
std::shared_ptr
< casacore::ImageInterface
< casacore::Float > > 
makeMask (const casacore::String &maskName, const casacore::Quantity threshold, casacore::ImageInterface< casacore::Float > &tempim)
 Collection of methods translate mask description (text, record, threshold, etc) to mask image where the region(s) of interest are represented by the value (default = 1.0) and the rest of the image is set to 0.0. More...
 
void copyAllMasks (const casacore::Vector< std::shared_ptr< casacore::ImageInterface< casacore::Float > > > inImageMasks, casacore::ImageInterface< casacore::Float > &outImageMask)
 merge mask images to outimage More...
 
void copyMask (const casacore::ImageInterface< casacore::Float > &inimage, casacore::ImageInterface< casacore::Float > &outimage)
 copy and regrid a mask image to outimage More...
 
void expandMask (const casacore::ImageInterface< casacore::Float > &inImageMask, casacore::ImageInterface< casacore::Float > &outImageMask)
 expand smaller chan mask image to larger one. More...
 
void InMaskToImageRegion (const casacore::ImageInterface< casacore::Float > &inimage)
 convert internal mask to imageRegion More...
 
int makeInteractiveMask (std::shared_ptr< SIImageStore > &imstore, casacore::Int &niter, casacore::Int &cycleniter, casacore::String &threshold, casacore::String &cyclethreshold)
 
void makeAutoMask (std::shared_ptr< SIImageStore > imstore)
 Return a reference to an imageinterface for the mask. More...
 
void autoMask (std::shared_ptr< SIImageStore > imstore, casacore::TempImage< casacore::Float > &posmask, const casacore::Int iterdone, casacore::Vector< casacore::Bool > &chanflag, casacore::Record &robuststatsrec, const casacore::String &alg="", const casacore::String &threshold="", const casacore::Float &fracpeak=0.0, const casacore::String &resolution="", const casacore::Float &resbybeam=0.0, const casacore::Int nmask=0, const casacore::Bool autoadjust=false, const casacore::Float &sidelobethreshold=0.0, const casacore::Float &noisethreshold=0.0, const casacore::Float &lownoisethreshold=0.0, const casacore::Float &negativethreshold=0.0, const casacore::Float &cutthreshold=0.0, const casacore::Float &smoothfactor=0.0, const casacore::Float &minbeamfrac=0.0, const casacore::Int growiterations=0, const casacore::Bool dogrowprune=true, const casacore::Float &minpercentchange=0.0, const casacore::Bool verbose=false, const casacore::Bool fastnoise=false, const casacore::Bool isthresholdreached=false, casacore::Float pblimit=0.0)
 Top level autoMask interface Different automasking algorithm can be choosen by specifying a specific alogrithm name in alg. More...
 
void autoMaskByThreshold (casacore::ImageInterface< casacore::Float > &mask, const casacore::ImageInterface< casacore::Float > &res, const casacore::ImageInterface< casacore::Float > &psf, const casacore::Quantity &resolution, const casacore::Float &resbybeam, const casacore::Quantity &qthreshold, const casacore::Float &fracofpeak, const casacore::Record &theStatsffff, const casacore::Float &sigma=3.0, const casacore::Int nmask=0, const casacore::Bool autoadjust=casacore::False)
 automask by threshold with binning before applying it More...
 
void autoMaskByThreshold2 (casacore::ImageInterface< casacore::Float > &mask, const casacore::ImageInterface< casacore::Float > &res, const casacore::ImageInterface< casacore::Float > &psf, const casacore::Quantity &resolution, const casacore::Float &resbybeam, const casacore::Quantity &qthreshold, const casacore::Float &fracofpeak, const casacore::Record &theStats, const casacore::Float &sigma=3.0, const casacore::Int nmask=0)
 automask by threshold : no binning version More...
 
void autoMaskByMultiThreshold (casacore::ImageInterface< float > &mask, casacore::TempImage< casacore::Float > &posmask, const casacore::ImageInterface< casacore::Float > &res, const casacore::ImageInterface< casacore::Float > &psf, const casacore::Record &stats, const casacore::Record &newstats, const casacore::Int iterdone, casacore::Vector< casacore::Bool > &chanFlag, const casacore::Float &maskPercentChange=0.0, const casacore::Float &sidelobeLevel=0.0, const casacore::Float &sidelobeThresholdFactor=3.0, const casacore::Float &noiseThresholdFactor=3.0, const casacore::Float &lowNoiseThresholdFactor=2.0, const casacore::Float &negativeThresholdFactor=0.0, const casacore::Float &cutThreshold=0.01, const casacore::Float &smoothFactor=1.0, const casacore::Float &minBeamFrac=-1.0, const casacore::Int growIterations=100, const casacore::Bool dogrowprune=true, const casacore::Bool verbose=false, const casacore::Bool isthresholdreached=false)
 implementation of Amanda's automasking algorithm using multiple thresholds More...
 
std::shared_ptr
< casacore::ImageInterface
< float > > 
makeMaskFromBinnedImage (const casacore::ImageInterface< casacore::Float > &image, const casacore::Int nx, const casacore::Int ny, const casacore::Float &fracofpeak, const casacore::Float &sigma, const casacore::Int nmask, const casacore::Bool autoadjust, casacore::Double thresh=0.0)
 
std::shared_ptr
< casacore::ImageInterface
< float > > 
convolveMask (const casacore::ImageInterface< casacore::Float > &inmask, casacore::Int nxpix, casacore::Int nypix)
 Convolve mask image with nx pixel by ny pixel. More...
 
std::shared_ptr
< casacore::ImageInterface
< float > > 
convolveMask (const casacore::ImageInterface< casacore::Float > &inmask, const casacore::GaussianBeam &beam)
 Convolve mask image by a gaussian. More...
 
std::shared_ptr
< casacore::ImageInterface
< float > > 
pruneRegions (const casacore::ImageInterface< casacore::Float > &image, casacore::Double &thresh, casacore::Int nmask=0, casacore::Int npix=0)
 Prune the mask regions found. More...
 
std::shared_ptr
< casacore::ImageInterface
< float > > 
pruneRegions2 (const casacore::ImageInterface< casacore::Float > &image, casacore::Double &thresh, casacore::Int nmask=0, casacore::Double prunesize=0.0)
 Prune the mask regions per spectral plane. More...
 
std::shared_ptr
< casacore::ImageInterface
< float > > 
YAPruneRegions (const casacore::ImageInterface< casacore::Float > &image, casacore::Vector< casacore::Bool > &chanflag, casacore::Vector< casacore::Bool > &allpruned, casacore::Vector< casacore::uInt > &nreg, casacore::Vector< casacore::uInt > &npruned, casacore::Double prunesize=0.0, casacore::Bool showchanlabel=true)
 Yet another Prune the mask regions per spectral plane. More...
 
void makeMaskByPerChanThreshold (const casacore::ImageInterface< casacore::Float > &image, casacore::Vector< casacore::Bool > &chanflag, casacore::ImageInterface< casacore::Float > &mask, casacore::Vector< casacore::Float > &thresholds, casacore::Vector< casacore::Float > &masksizes)
 create a mask image (1/0 image) applying a different threshold for each channel plane More...
 
void binaryDilationCore (casacore::Lattice< casacore::Float > &inlattice, casacore::Array< casacore::Float > &structure, casacore::Lattice< casacore::Bool > &mask, casacore::Array< casacore::Bool > &chanmask, casacore::Lattice< casacore::Float > &outlattice)
 A core method for binary dilation of the input lattice. More...
 
void binaryDilation (casacore::ImageInterface< casacore::Float > &inImage, casacore::Array< casacore::Float > &structure, casacore::Int niteration, casacore::Lattice< casacore::Bool > &mask, casacore::Array< casacore::Bool > &chanmask, casacore::ImageInterface< casacore::Float > &outImage)
 Multiple Binary dilation application of an image with a constraint mask and channel plane based flags. More...
 
casacore::Float pixelBeamArea (const casacore::GaussianBeam &beam, const casacore::CoordinateSystem &csys)
 return beam area in pixel unit More...
 
void makePBMask (std::shared_ptr< SIImageStore > imstore, casacore::Float pblimit=0.1, casacore::Bool combinemask=false)
 Create a mask image applying PB level. More...
 
void autoMaskWithinPB (std::shared_ptr< SIImageStore > imstore, casacore::TempImage< casacore::Float > &posmask, const casacore::Int iterdone, casacore::Vector< casacore::Bool > &chanflag, casacore::Record &robuststatsrec, const casacore::String &alg="", const casacore::String &threshold="", const casacore::Float &fracpeak=0.0, const casacore::String &resolution="", const casacore::Float &resbybeam=0.0, const casacore::Int nmask=0, const casacore::Bool autoadjust=false, const casacore::Float &sidelobethreshold=0.0, const casacore::Float &noisethreshold=0.0, const casacore::Float &lownoisethreshold=0.0, const casacore::Float &negativethreshold=0.0, const casacore::Float &cutthreshold=0.0, const casacore::Float &smoothfactor=0.0, const casacore::Float &minbeamfrac=0.0, const casacore::Int growiterations=0, const casacore::Bool dogrowprune=true, const casacore::Float &minpercentchange=0.0, const casacore::Bool verbose=false, const casacore::Bool fastnoise=false, const casacore::Bool isthresholdreached=false, casacore::Float pblimit=0.1)
 
void depthFirstSearch (casacore::Int x, casacore::Int y, casacore::Int cur_label, casacore::Array< casacore::Float > &inlatarr, casacore::Array< casacore::Float > &lablatarr)
 depth-first-search algorithm for 2D More...
 
void depthFirstSearch2 (casacore::Int x, casacore::Int y, casacore::Int cur_label, casacore::Array< casacore::Float > &inlatarr, casacore::Array< casacore::Float > &lablatarr)
 non-recursive depth-first-search algorithm for 2D More...
 
casacore::Vector
< casacore::IPosition
defineNeighbors (casacore::IPosition &pos, casacore::Int nrow, casacore::Int ncol)
 returns a Vector of neighboring pixels in IPosition (4-direction connectivity) More...
 
void labelRegions (casacore::Lattice< casacore::Float > &inlat, casacore::Lattice< casacore::Float > &lablat)
 label connected regions using depth-first-search algorithm More...
 
casacore::Vector< casacore::FloatfindBlobSize (casacore::Lattice< casacore::Float > &lablat)
 find sizes of bolbs (regions) found by labelRegions More...
 
casacore::Bool isEmptyMask (casacore::ImageInterface< casacore::Float > &maskiamge)
 check if mask image is empty (all zeros) =True or not More...
 
casacore::Int getTotalPixels (casacore::ImageInterface< casacore::Float > &maskiamge)
 
void noMaskCheck (casacore::ImageInterface< casacore::Float > &mask, casacore::Matrix< casacore::String > &thresholdType)
 
for warning messages for empy initial mask in automask

void noMaskCheck(casacore::ImageInterface<casacore::Float>& mask, casacore::Vector<casacore::String>& thresholdType); More...

 
void skipChannels (const casacore::Float &fracChnage, casacore::ImageInterface< casacore::Float > &prevmask, casacore::ImageInterface< casacore::Float > &curmask, const casacore::Matrix< casacore::String > &threshtype, const casacore::Bool isthresholdreached, casacore::Vector< casacore::Bool > &chanFlag, casacore::Vector< casacore::Bool > &zeroChanMask)
 determining skip channels for the mask changed less than the specfied percentage More...
 
void printAutomaskSummary (const casacore::Array< casacore::Double > &rmss, const casacore::Array< casacore::Double > &maxs, const casacore::Array< casacore::Double > &mins, const casacore::Array< casacore::Double > &mdns, const casacore::Matrix< casacore::Float > &maskthreshold, const casacore::Matrix< casacore::String > &masktype, const casacore::Vector< casacore::Bool > &chanflag, const casacore::Matrix< casacore::Bool > &zerochanmask, const casacore::Matrix< casacore::uInt > &nreg, const casacore::Matrix< casacore::uInt > &npruned, const casacore::Matrix< casacore::uInt > &ngrowreg, const casacore::Matrix< casacore::uInt > &ngrowpruned, const casacore::Matrix< casacore::Float > &negmaskpixs, const casacore::Record &miscsummaryinfo)
 
check if input image is a mask image with 0 or a value (if normalize=true, 1)

casacore::Bool checkMaskImage(casacore::ImageInterface<casacore::Float>& maskiamge, casacore::Bool normalize=true); More...

 
casacore::Bool compareSpectralCoordinate (const casacore::ImageInterface< casacore::Float > &inImage, const casacore::ImageInterface< casacore::Float > &outImage)
 
void setPBMaskLevel (const casacore::Float pbmasklevel)
 Store pbmask level (a.k.a pblimit for mask) More...
 
casacore::Float getPBMaskLevel ()
 

Static Public Member Functions

static casacore::Bool regionToImageMask (casacore::ImageInterface< casacore::Float > &maskImage, casacore::Record *regionRec, casacore::Matrix< casacore::Quantity > &blctrcs, casacore::Matrix< casacore::Float > &circles, const casacore::Float &value=1.0)
 Make a mask image from casacore::Record, casacore::Matrix of (nboxes,4) where each row contains [blc_x,blc_y, trc_x,trc_y], and casacore::Matrix of (ncircles, 3) with the specified 'value'. More...
 
static void boxRegionToImageRegion (const casacore::ImageInterface< casacore::Float > &maskImage, const casacore::Matrix< casacore::Quantity > &blctrcs, casacore::ImageRegion *&boxImageRegions)
 Convert boxes defined with blcs and trcs to ImageRegion. More...
 
static void circleRegionToImageRegion (const casacore::ImageInterface< casacore::Float > &maskImage, const casacore::Matrix< casacore::Float > &circles, casacore::ImageRegion *&circleImageRegions)
 Convert circles (in pixels) to ImageRegion. More...
 
static void recordRegionToImageRegion (casacore::Record *imageRegRec, casacore::ImageRegion *&imageRegion)
 Convert region defined by record to Imageregion. More...
 
static casacore::Bool regionToMask (casacore::ImageInterface< casacore::Float > &maskImage, casacore::ImageRegion &imageregion, const casacore::Float &value)
 Convert casacore::ImageRegion to a mask image with the value. More...
 
static void regionTextToImageRegion (const casacore::String &text, const casacore::ImageInterface< casacore::Float > &regionImage, casacore::ImageRegion *&imageRegion)
 Read CRTF format text or the text file contains CRTF definitions and convert it to a ImageRegion. More...
 
static casacore::Bool cloneImShape (const casacore::ImageInterface< casacore::Float > &inImage, const casacore::String &outImageName)
 
static casacore::Double memoryToUse ()
 max MB of memory to use in TempImage More...
 
static casacore::Record calcImageStatistics (casacore::ImageInterface< casacore::Float > &res, casacore::String &lelmask, casacore::Record *regionPtr, const casacore::Bool robust)
 Calculate statistics on a residual image with additional region and LEL mask specifications using classical method. More...
 
static casacore::Record calcRobustImageStatisticsOld (casacore::ImageInterface< casacore::Float > &res, casacore::ImageInterface< casacore::Float > &prevmask, casacore::LatticeExpr< casacore::Bool > &pbmask, casacore::String &lelmask, casacore::Record *regionPtr, const casacore::Bool robust, casacore::Vector< casacore::Bool > &chanflag)
 Calcuate statistics on a residual image using robust methods to estimate RMS noise. More...
 
static casacore::Record calcRobustImageStatistics (casacore::ImageInterface< casacore::Float > &res, casacore::ImageInterface< casacore::Float > &prevmask, casacore::LatticeExpr< casacore::Bool > &pbmask, casacore::String &lelmask, casacore::Record *regionPtr, const casacore::Bool robust, casacore::Vector< casacore::Bool > &chanflag)
 

Protected Attributes

InteractiveMaskinginteractiveMasker_p
 

Private Attributes

double itsRms
 
double itsMax
 
float itsSidelobeLevel
 
float itsPBMaskLevel
 

Detailed Description

Definition at line 48 of file SDMaskHandler.h.

Constructor & Destructor Documentation

casa::SDMaskHandler::SDMaskHandler ( )

Empty constructor.

casa::SDMaskHandler::~SDMaskHandler ( )

Member Function Documentation

void casa::SDMaskHandler::autoMask ( std::shared_ptr< SIImageStore imstore,
casacore::TempImage< casacore::Float > &  posmask,
const casacore::Int  iterdone,
casacore::Vector< casacore::Bool > &  chanflag,
casacore::Record robuststatsrec,
const casacore::String alg = "",
const casacore::String threshold = "",
const casacore::Float fracpeak = 0.0,
const casacore::String resolution = "",
const casacore::Float resbybeam = 0.0,
const casacore::Int  nmask = 0,
const casacore::Bool  autoadjust = false,
const casacore::Float sidelobethreshold = 0.0,
const casacore::Float noisethreshold = 0.0,
const casacore::Float lownoisethreshold = 0.0,
const casacore::Float negativethreshold = 0.0,
const casacore::Float cutthreshold = 0.0,
const casacore::Float smoothfactor = 0.0,
const casacore::Float minbeamfrac = 0.0,
const casacore::Int  growiterations = 0,
const casacore::Bool  dogrowprune = true,
const casacore::Float minpercentchange = 0.0,
const casacore::Bool  verbose = false,
const casacore::Bool  fastnoise = false,
const casacore::Bool  isthresholdreached = false,
casacore::Float  pblimit = 0.0 
)

Top level autoMask interface Different automasking algorithm can be choosen by specifying a specific alogrithm name in alg.

Not all arguments are used for a choosen alogrithm.

Parameters
[in,out]imstoreSIImageStore
[in,out]positiveonly mask
[in]currentiteration number completed
[in,out]channelflag
[in,out]robustimage statistics
[in]algautoboxing alogrithm name (currently recongnized names are 'one-box', 'thresh','thresh2', and 'multithresh')
[in]thresholdthreshold with a unit
[in]fracpeakFraction of the peak
[in]resolutionResolution with a unit
[in]resbybeamMultiplier of a beam to specify the resolution
[in]nmaskNumber of masks to use
[in]autoadjustUse autoadjustment of mask threshold (for 'thresh')
[in]sidlobethresholdThreshold factor in a multiplier of the sidelobe level
[in]noisethresholdThreshold factor in a multiplier of the rms noise
[in]lownoisethresholdThreshold factor in a multiplier of the rms noise used in the binary dilation
[in]negativethresholdThreshold factor in a multiplier of the rms noise used to set threshold for negative features
[in]cutthresholdCut threshold factor for adjust a mask after smoothing of the mask
[in]smoothfactorSmoothing factor (multiplier of the beam)
[in]minbeamfracPercent change in mask size to trigger a new automask creation for 'noise'-based threshold
[in]growiterations(maximum) number of binary dilation iteartions to grow the mask
[in]dogrowpruneToggle to do or skip pruning on the grow mask
[in]minpercentchangeMininum percentage change in mask to stop updating mask
[in]verboseControls automask related logging messages
[in]isthresholdreachedCheck if cyclethreshold reached threshold
[in]fastnoiseToggle to turn on and off fast (but less robust) noise calculation
[in]pblimitPrimary beam cut off level
void casa::SDMaskHandler::autoMaskByMultiThreshold ( casacore::ImageInterface< float > &  mask,
casacore::TempImage< casacore::Float > &  posmask,
const casacore::ImageInterface< casacore::Float > &  res,
const casacore::ImageInterface< casacore::Float > &  psf,
const casacore::Record stats,
const casacore::Record newstats,
const casacore::Int  iterdone,
casacore::Vector< casacore::Bool > &  chanFlag,
const casacore::Float maskPercentChange = 0.0,
const casacore::Float sidelobeLevel = 0.0,
const casacore::Float sidelobeThresholdFactor = 3.0,
const casacore::Float noiseThresholdFactor = 3.0,
const casacore::Float lowNoiseThresholdFactor = 2.0,
const casacore::Float negativeThresholdFactor = 0.0,
const casacore::Float cutThreshold = 0.01,
const casacore::Float smoothFactor = 1.0,
const casacore::Float minBeamFrac = -1.0,
const casacore::Int  growIterations = 100,
const casacore::Bool  dogrowprune = true,
const casacore::Bool  verbose = false,
const casacore::Bool  isthresholdreached = false 
)

implementation of Amanda's automasking algorithm using multiple thresholds

void casa::SDMaskHandler::autoMaskByThreshold ( casacore::ImageInterface< casacore::Float > &  mask,
const casacore::ImageInterface< casacore::Float > &  res,
const casacore::ImageInterface< casacore::Float > &  psf,
const casacore::Quantity resolution,
const casacore::Float resbybeam,
const casacore::Quantity qthreshold,
const casacore::Float fracofpeak,
const casacore::Record theStatsffff,
const casacore::Float sigma = 3.0,
const casacore::Int  nmask = 0,
const casacore::Bool  autoadjust = casacore::False 
)

automask by threshold with binning before applying it

void casa::SDMaskHandler::autoMaskByThreshold2 ( casacore::ImageInterface< casacore::Float > &  mask,
const casacore::ImageInterface< casacore::Float > &  res,
const casacore::ImageInterface< casacore::Float > &  psf,
const casacore::Quantity resolution,
const casacore::Float resbybeam,
const casacore::Quantity qthreshold,
const casacore::Float fracofpeak,
const casacore::Record theStats,
const casacore::Float sigma = 3.0,
const casacore::Int  nmask = 0 
)

automask by threshold : no binning version

void casa::SDMaskHandler::autoMaskWithinPB ( std::shared_ptr< SIImageStore imstore,
casacore::TempImage< casacore::Float > &  posmask,
const casacore::Int  iterdone,
casacore::Vector< casacore::Bool > &  chanflag,
casacore::Record robuststatsrec,
const casacore::String alg = "",
const casacore::String threshold = "",
const casacore::Float fracpeak = 0.0,
const casacore::String resolution = "",
const casacore::Float resbybeam = 0.0,
const casacore::Int  nmask = 0,
const casacore::Bool  autoadjust = false,
const casacore::Float sidelobethreshold = 0.0,
const casacore::Float noisethreshold = 0.0,
const casacore::Float lownoisethreshold = 0.0,
const casacore::Float negativethreshold = 0.0,
const casacore::Float cutthreshold = 0.0,
const casacore::Float smoothfactor = 0.0,
const casacore::Float minbeamfrac = 0.0,
const casacore::Int  growiterations = 0,
const casacore::Bool  dogrowprune = true,
const casacore::Float minpercentchange = 0.0,
const casacore::Bool  verbose = false,
const casacore::Bool  fastnoise = false,
const casacore::Bool  isthresholdreached = false,
casacore::Float  pblimit = 0.1 
)
void casa::SDMaskHandler::binaryDilation ( casacore::ImageInterface< casacore::Float > &  inImage,
casacore::Array< casacore::Float > &  structure,
casacore::Int  niteration,
casacore::Lattice< casacore::Bool > &  mask,
casacore::Array< casacore::Bool > &  chanmask,
casacore::ImageInterface< casacore::Float > &  outImage 
)

Multiple Binary dilation application of an image with a constraint mask and channel plane based flags.

void casa::SDMaskHandler::binaryDilationCore ( casacore::Lattice< casacore::Float > &  inlattice,
casacore::Array< casacore::Float > &  structure,
casacore::Lattice< casacore::Bool > &  mask,
casacore::Array< casacore::Bool > &  chanmask,
casacore::Lattice< casacore::Float > &  outlattice 
)

A core method for binary dilation of the input lattice.

static void casa::SDMaskHandler::boxRegionToImageRegion ( const casacore::ImageInterface< casacore::Float > &  maskImage,
const casacore::Matrix< casacore::Quantity > &  blctrcs,
casacore::ImageRegion *&  boxImageRegions 
)
static

Convert boxes defined with blcs and trcs to ImageRegion.

static casacore::Record casa::SDMaskHandler::calcImageStatistics ( casacore::ImageInterface< casacore::Float > &  res,
casacore::String lelmask,
casacore::Record regionPtr,
const casacore::Bool  robust 
)
static

Calculate statistics on a residual image with additional region and LEL mask specifications using classical method.

static casacore::Record casa::SDMaskHandler::calcRobustImageStatistics ( casacore::ImageInterface< casacore::Float > &  res,
casacore::ImageInterface< casacore::Float > &  prevmask,
casacore::LatticeExpr< casacore::Bool > &  pbmask,
casacore::String lelmask,
casacore::Record regionPtr,
const casacore::Bool  robust,
casacore::Vector< casacore::Bool > &  chanflag 
)
static
static casacore::Record casa::SDMaskHandler::calcRobustImageStatisticsOld ( casacore::ImageInterface< casacore::Float > &  res,
casacore::ImageInterface< casacore::Float > &  prevmask,
casacore::LatticeExpr< casacore::Bool > &  pbmask,
casacore::String lelmask,
casacore::Record regionPtr,
const casacore::Bool  robust,
casacore::Vector< casacore::Bool > &  chanflag 
)
static

Calcuate statistics on a residual image using robust methods to estimate RMS noise.

Basing on presence of a mask the following logic is used. a. If there is no existing clean mask, calculate statistics using the chauvenet algorithm with maxiter=5 and zscore=-1. b. If there is an existing clean mask, calculate the classic statistics with robust=True in the region outside the clean mask and inside the primary beam mask.

static void casa::SDMaskHandler::circleRegionToImageRegion ( const casacore::ImageInterface< casacore::Float > &  maskImage,
const casacore::Matrix< casacore::Float > &  circles,
casacore::ImageRegion *&  circleImageRegions 
)
static

Convert circles (in pixels) to ImageRegion.

static casacore::Bool casa::SDMaskHandler::cloneImShape ( const casacore::ImageInterface< casacore::Float > &  inImage,
const casacore::String outImageName 
)
static
casacore::Bool casa::SDMaskHandler::compareSpectralCoordinate ( const casacore::ImageInterface< casacore::Float > &  inImage,
const casacore::ImageInterface< casacore::Float > &  outImage 
)
std::shared_ptr<casacore::ImageInterface<float> > casa::SDMaskHandler::convolveMask ( const casacore::ImageInterface< casacore::Float > &  inmask,
casacore::Int  nxpix,
casacore::Int  nypix 
)

Convolve mask image with nx pixel by ny pixel.

std::shared_ptr<casacore::ImageInterface<float> > casa::SDMaskHandler::convolveMask ( const casacore::ImageInterface< casacore::Float > &  inmask,
const casacore::GaussianBeam beam 
)

Convolve mask image by a gaussian.

void casa::SDMaskHandler::copyAllMasks ( const casacore::Vector< std::shared_ptr< casacore::ImageInterface< casacore::Float > > >  inImageMasks,
casacore::ImageInterface< casacore::Float > &  outImageMask 
)

merge mask images to outimage

void casa::SDMaskHandler::copyMask ( const casacore::ImageInterface< casacore::Float > &  inimage,
casacore::ImageInterface< casacore::Float > &  outimage 
)

copy and regrid a mask image to outimage

casacore::Vector<casacore::IPosition> casa::SDMaskHandler::defineNeighbors ( casacore::IPosition pos,
casacore::Int  nrow,
casacore::Int  ncol 
)

returns a Vector of neighboring pixels in IPosition (4-direction connectivity)

void casa::SDMaskHandler::depthFirstSearch ( casacore::Int  x,
casacore::Int  y,
casacore::Int  cur_label,
casacore::Array< casacore::Float > &  inlatarr,
casacore::Array< casacore::Float > &  lablatarr 
)

depth-first-search algorithm for 2D

void casa::SDMaskHandler::depthFirstSearch2 ( casacore::Int  x,
casacore::Int  y,
casacore::Int  cur_label,
casacore::Array< casacore::Float > &  inlatarr,
casacore::Array< casacore::Float > &  lablatarr 
)

non-recursive depth-first-search algorithm for 2D

void casa::SDMaskHandler::expandMask ( const casacore::ImageInterface< casacore::Float > &  inImageMask,
casacore::ImageInterface< casacore::Float > &  outImageMask 
)

expand smaller chan mask image to larger one.

  • currently only works for a single channel (continuum) input mask
void casa::SDMaskHandler::fillMask ( std::shared_ptr< SIImageStore imstore,
casacore::Vector< casacore::String maskStrings 
)
void casa::SDMaskHandler::fillMask ( std::shared_ptr< SIImageStore imstore,
casacore::String  maskString 
)
casacore::Vector<casacore::Float> casa::SDMaskHandler::findBlobSize ( casacore::Lattice< casacore::Float > &  lablat)

find sizes of bolbs (regions) found by labelRegions

casacore::Float casa::SDMaskHandler::getPBMaskLevel ( )
casacore::Int casa::SDMaskHandler::getTotalPixels ( casacore::ImageInterface< casacore::Float > &  maskiamge)
void casa::SDMaskHandler::InMaskToImageRegion ( const casacore::ImageInterface< casacore::Float > &  inimage)

convert internal mask to imageRegion

casacore::Bool casa::SDMaskHandler::isEmptyMask ( casacore::ImageInterface< casacore::Float > &  maskiamge)

check if mask image is empty (all zeros) =True or not

void casa::SDMaskHandler::labelRegions ( casacore::Lattice< casacore::Float > &  inlat,
casacore::Lattice< casacore::Float > &  lablat 
)

label connected regions using depth-first-search algorithm

void casa::SDMaskHandler::makeAutoMask ( std::shared_ptr< SIImageStore imstore)

Return a reference to an imageinterface for the mask.

int casa::SDMaskHandler::makeInteractiveMask ( std::shared_ptr< SIImageStore > &  imstore,
casacore::Int niter,
casacore::Int cycleniter,
casacore::String threshold,
casacore::String cyclethreshold 
)
std::shared_ptr<casacore::ImageInterface<casacore::Float> > casa::SDMaskHandler::makeMask ( const casacore::String maskName,
const casacore::Quantity  threshold,
casacore::ImageInterface< casacore::Float > &  tempim 
)

Collection of methods translate mask description (text, record, threshold, etc) to mask image where the region(s) of interest are represented by the value (default = 1.0) and the rest of the image is set to 0.0.

void makeMask(); Create a mask image with maskName from tempim with a threshold applied to the pixel intensity

void casa::SDMaskHandler::makeMaskByPerChanThreshold ( const casacore::ImageInterface< casacore::Float > &  image,
casacore::Vector< casacore::Bool > &  chanflag,
casacore::ImageInterface< casacore::Float > &  mask,
casacore::Vector< casacore::Float > &  thresholds,
casacore::Vector< casacore::Float > &  masksizes 
)

create a mask image (1/0 image) applying a different threshold for each channel plane

std::shared_ptr<casacore::ImageInterface<float> > casa::SDMaskHandler::makeMaskFromBinnedImage ( const casacore::ImageInterface< casacore::Float > &  image,
const casacore::Int  nx,
const casacore::Int  ny,
const casacore::Float fracofpeak,
const casacore::Float sigma,
const casacore::Int  nmask,
const casacore::Bool  autoadjust,
casacore::Double  thresh = 0.0 
)
void casa::SDMaskHandler::makePBMask ( std::shared_ptr< SIImageStore imstore,
casacore::Float  pblimit = 0.1,
casacore::Bool  combinemask = false 
)

Create a mask image applying PB level.

Parameters
[in,out]imstoreSIImageStore
[in]pblimitPrimary beam cut off level
[in]pblimitPrimary beam cut off level
static casacore::Double casa::SDMaskHandler::memoryToUse ( )
inlinestatic

max MB of memory to use in TempImage

Definition at line 385 of file SDMaskHandler.h.

void casa::SDMaskHandler::noMaskCheck ( casacore::ImageInterface< casacore::Float > &  mask,
casacore::Matrix< casacore::String > &  thresholdType 
)

for warning messages for empy initial mask in automask

void noMaskCheck(casacore::ImageInterface<casacore::Float>& mask, casacore::Vector<casacore::String>& thresholdType);

casacore::Float casa::SDMaskHandler::pixelBeamArea ( const casacore::GaussianBeam beam,
const casacore::CoordinateSystem csys 
)

return beam area in pixel unit

void casa::SDMaskHandler::printAutomaskSummary ( const casacore::Array< casacore::Double > &  rmss,
const casacore::Array< casacore::Double > &  maxs,
const casacore::Array< casacore::Double > &  mins,
const casacore::Array< casacore::Double > &  mdns,
const casacore::Matrix< casacore::Float > &  maskthreshold,
const casacore::Matrix< casacore::String > &  masktype,
const casacore::Vector< casacore::Bool > &  chanflag,
const casacore::Matrix< casacore::Bool > &  zerochanmask,
const casacore::Matrix< casacore::uInt > &  nreg,
const casacore::Matrix< casacore::uInt > &  npruned,
const casacore::Matrix< casacore::uInt > &  ngrowreg,
const casacore::Matrix< casacore::uInt > &  ngrowpruned,
const casacore::Matrix< casacore::Float > &  negmaskpixs,
const casacore::Record miscsummaryinfo 
)

check if input image is a mask image with 0 or a value (if normalize=true, 1)

casacore::Bool checkMaskImage(casacore::ImageInterface<casacore::Float>& maskiamge, casacore::Bool normalize=true);

print per-channel automask summary

Parameters
maskthresholdconst casacore::Vector<casacore::Float>& maskthreshold,
masktypeconst casacore::Vector<casacore::String>& masktype,
zerochanmaskconst casacore::Vector<casacore::Bool>& zerochanmask,
nregconst casacore::Vector<casacore::uInt>& nreg,
nprunedconst casacore::Vector<casacore::uInt>& npruned,
ngrowregconst casacore::Vector<casacore::uInt>& ngrowreg,
ngrowprunedconst casacore::Vector<casacore::uInt>& ngrowpruned,
negmaskpixsconst casacore::Vector<casacore::Float>& negmaskpixs,
std::shared_ptr<casacore::ImageInterface<float> > casa::SDMaskHandler::pruneRegions ( const casacore::ImageInterface< casacore::Float > &  image,
casacore::Double thresh,
casacore::Int  nmask = 0,
casacore::Int  npix = 0 
)

Prune the mask regions found.

std::shared_ptr<casacore::ImageInterface<float> > casa::SDMaskHandler::pruneRegions2 ( const casacore::ImageInterface< casacore::Float > &  image,
casacore::Double thresh,
casacore::Int  nmask = 0,
casacore::Double  prunesize = 0.0 
)

Prune the mask regions per spectral plane.

static void casa::SDMaskHandler::recordRegionToImageRegion ( casacore::Record imageRegRec,
casacore::ImageRegion *&  imageRegion 
)
static

Convert region defined by record to Imageregion.

static void casa::SDMaskHandler::regionTextToImageRegion ( const casacore::String text,
const casacore::ImageInterface< casacore::Float > &  regionImage,
casacore::ImageRegion *&  imageRegion 
)
static

Read CRTF format text or the text file contains CRTF definitions and convert it to a ImageRegion.

static casacore::Bool casa::SDMaskHandler::regionToImageMask ( casacore::ImageInterface< casacore::Float > &  maskImage,
casacore::Record regionRec,
casacore::Matrix< casacore::Quantity > &  blctrcs,
casacore::Matrix< casacore::Float > &  circles,
const casacore::Float value = 1.0 
)
static

Make a mask image from casacore::Record, casacore::Matrix of (nboxes,4) where each row contains [blc_x,blc_y, trc_x,trc_y], and casacore::Matrix of (ncircles, 3) with the specified 'value'.

Each row of circles are radius, x_center, y_center in pixels. blctrcs and circles are applied to all the spectral and stokes while regions specified in record can specify selections in spectral and stokes axes. static casacore::Bool regionToImageMask(const casacore::String& maskimage, casacore::Record* regionRec, casacore::Matrix<casacore::Quantity> & blctrcs,

static casacore::Bool casa::SDMaskHandler::regionToMask ( casacore::ImageInterface< casacore::Float > &  maskImage,
casacore::ImageRegion imageregion,
const casacore::Float value 
)
static

Convert casacore::ImageRegion to a mask image with the value.

void casa::SDMaskHandler::resetMask ( std::shared_ptr< SIImageStore imstore)
void casa::SDMaskHandler::setPBMaskLevel ( const casacore::Float  pbmasklevel)

Store pbmask level (a.k.a pblimit for mask)

void casa::SDMaskHandler::skipChannels ( const casacore::Float fracChnage,
casacore::ImageInterface< casacore::Float > &  prevmask,
casacore::ImageInterface< casacore::Float > &  curmask,
const casacore::Matrix< casacore::String > &  threshtype,
const casacore::Bool  isthresholdreached,
casacore::Vector< casacore::Bool > &  chanFlag,
casacore::Vector< casacore::Bool > &  zeroChanMask 
)

determining skip channels for the mask changed less than the specfied percentage

std::shared_ptr<casacore::ImageInterface<float> > casa::SDMaskHandler::YAPruneRegions ( const casacore::ImageInterface< casacore::Float > &  image,
casacore::Vector< casacore::Bool > &  chanflag,
casacore::Vector< casacore::Bool > &  allpruned,
casacore::Vector< casacore::uInt > &  nreg,
casacore::Vector< casacore::uInt > &  npruned,
casacore::Double  prunesize = 0.0,
casacore::Bool  showchanlabel = true 
)

Yet another Prune the mask regions per spectral plane.

Member Data Documentation

InteractiveMasking* casa::SDMaskHandler::interactiveMasker_p
protected

Definition at line 421 of file SDMaskHandler.h.

double casa::SDMaskHandler::itsMax
private

Definition at line 426 of file SDMaskHandler.h.

float casa::SDMaskHandler::itsPBMaskLevel
private

Definition at line 428 of file SDMaskHandler.h.

double casa::SDMaskHandler::itsRms
private

Definition at line 425 of file SDMaskHandler.h.

float casa::SDMaskHandler::itsSidelobeLevel
private

Definition at line 427 of file SDMaskHandler.h.


The documentation for this class was generated from the following file: