CASA Documentation
Advanced Search…
  • Log in

Navigation

  • Home
  • Latest
  • CASA 6.1
  • CASA 5.6
  • CASA 5.5
  • CASA 5.4.1
  • CASA 5.4.0
  • CASA 5.3.0
  • CASA 5.1.2
  • CASA 5.1.1
  • CASA 5.1.0
  • CASA 5.0.0
Navigation
  • Release Information
  • Hardware Requirements
  • Using CASA
  • Visibility Data Import Export
  • Visibility Data Selection
  • Data Examination and Editing
  • UV Manipulation
  • Synthesis Calibration
  • Ephemeris Data
  • Synthesis Imaging
    • Overview
    • Introduction to Synthesis Imaging
    • Types of images
    • Imaging Algorithms
    • Deconvolution Algorithms
    • Iteration Control
    • Masks for Deconvolution
    • Spectral Line Imaging
    • Wide Band Imaging
    • Wide-Field Imaging
    • Mosaicing
    • Software Implementation (developer)
    • Task: clean
    • Task: tclean
    • Task: imbpcor
    • Task: widebandpbcor
    • Task: deconvolve
    • Tool: imager
    • Tool: linearmosaic
    • Tool: vpmanager
    • Tool: deconvolver
    • Tool: image
    • Tool: parallelimager
  • Single Dish Calibration
  • Single-Dish Imaging
  • Image Combination
  • Image Cube Visualization
  • Image Analysis
  • Simulation
  • Parallel Processing
  • Pipeline
  • Reference Material
  • Global Task List
  • Global Tool List
  • Documentation (developer)
  • CASA on Amazon Web Services
  • CASA Processes (developer)

Masks for Deconvolution

Descriptions of mask types and how to create them

For the most careful imaging, you will want to restrict the region over which you allow CLEAN components to be found by using a mask. This mask is generally referred to as a clean mask.

Creating a clean mask:

There are several different ways to specify a clean mask, including:

  1. A text-based region. The CASA region text format can be used to define clean regions either by specifying the region directly in the tclean/clean command or by using an ASCII text file containing the specifications. You can use the viewer to save a region formatted according to the CRTF specification. To do this, an image must already exist to serve as a reference or template to create the mask image or the region.
  2. An image consisting of only 1 (valid) and 0 (invalid) pixel values. Such images can be generated or modified using tasks such as boxit or makemask.
  3. An automatically generated mask (tclean only). There are several experimental algorithms available in tclean for automatically masking emission during the deconvolution cycle. See the automasking section below for more details. These algorithms will replace the older autoclean option in the clean task.
  4. A mask created by tclean/clean while interactively cleaning using the viewer. You can combine this method with the options above to create an initial clean mask and modify it interactively. 

However they are created, the masks are all converted (as necessary) and stored as CASA images consisting of the pixel values of 1 and 0. When mask files are read in and have undefined values, these values are treated as 1s by CASA. Mixed types of masks can be specified in the clean and tclean tasks. 

In CASA, the term, 'mask' for an image is used in two different contexts. One is used for CASA images/image analysis is a T/F mask (pixel mask), which can be embedded in the parent CASA image.  The 'mask' used in imaging normally refers to a 1/0 image, which is directly used to define deconvolution region(s) (or set a 'clean mask') in the tclean or clean tasks.

Automasking

The tclean task has an option to generate clean masks automatically during the deconvolution process by applying flux density thresholds to the residual image. There are currently three different automasking algorithms available in tclean: "auto-thresh",  "auto-thresh2", or "auto-multithresh". The desired algorithm can be selected via the usemask parameter. For all algorithms, the mask will be updated at the beginning of a minor cycle based on the current residual image. The "auto-thresh" algorithm bins the input residual image by a multiple of the synthesized beam size prior to thresholding to reduce the influence of small spurious regions and avoid masking emission too tightly. The "auto-thresh2" algorithm is the same as the "auto-thresh" algorithm, except it does not bin the image. The "auto-multithresh" uses multiple thresholds based on the noise and sidelobe levels in the residual image to determine what emission to mask. All of the above algorithms have functionality to remove ("prune") small mask regions that are unlikely to be real astronomical emission. More detailed descriptions of each algorithm are given below.

"auto-thresh"

In this algorithm, the pixels in the residual image are binned by a multiple of the major axis of the synthesized beam (in pixels). The binning factor can be specified by the user using the maskresolution parameter. The clean mask is created by applying a threshold based on either a user-specified fraction of the peak or a user-specified multiple of the rms noise in the binned residual image. 

Mask regions can be removed (or pruned) by limiting the size and/or the total number of regions. The mask is separated into regions using an algorithm based on clumpfind [1]; the toolkit equivalent function is the image analysis decomposition function ia.decompose. The regions identified by this method are generally smaller than regions created by selecting contiguous regions of pixels. Regions smaller than a multiple of the major axis beam size (specified via the sub-parameter maskresolution) are removed. The user can also specify that only the brightest nmask regions are retained.

Finally, the binned image is smoothed by the maskresolution and regridded to match the original input residual image. For spectral line imaging, a single threshold value is applied to all the planes of the cube.

"auto-thresh2"

This algorithm is a variant of the "auto-thresh" algorithm that does not bin the residual image. Otherwise the rest of the steps are identical to the "auto-thresh" algorithm. 

"auto-multithresh"

This algorithm is intended to mimic what an experienced user would do when manually masking images while interactively cleaning. It calculates the appropriate threshold level for each minor cycle based on the rms noise and sidelobe levels in the current residual image.

Regions smaller than a user-specified fraction of the beam can be removed, or "pruned", from the mask. The size of the region is defined as the number of contiguous pixels in the region. This is different from the "auto-thresh" and "auto-thresh2" algorithms, which use a decomposed region size from based on ia.decompose. The figure below shows an example of the pruning process.

 
Type Figure
ID masks-for-deconvolution-fig-prune
Caption Figure 1 - An example of the pruning process. The image on the left shows the original threshold mask, while the image on the right shows the resulting mask after all regions smaller than a user-specified fraction of the beam area have been removed.


The resulting masks are all convolved with a Gaussian that is a multiple of the synthesized beam size, which is controlled by the parameter smoothfactor. Only values above some fraction of the smoothed Gaussian peak are retained, which is defined via the cutthreshold parameter. Note that cutthreshold is defined as a fraction of the smoothed Gaussian peak, not as an absolute value. This procedure ensures that sources are not masked too tightly, i.e., there is a margin between the emission and the mask.  Note that smoothfactor and cutthreshold are related. A large smoothfactor and high cutthreshold can give a similar region to a lower smoothfactor but lower cutthreshold. Note that setting the cuttreshold too high (>~0.2) will tend to remove faint regions.

An image showing a threshold mask, a smoothed threshold image, and the final smoothed threshold mask created by cutting above particular fraction of the peak threshold..

Type Figure
ID masks-for-deconvolution-fig-smooth-and-cut
Caption Figure 2 - An example of the process used to ensure that sources are not masked too tightly. The left hand image shows the initial threshold mask. The middle image shows the threshold mask convolved with a Gaussian. The right image shows the final threshold mask where only emission above some fraction of the peak in the smoothed mask is retained. The final mask is larger than the original threshold mask and better encapsulates the emission.

The initial threshold mask can be expanded down to lower signal-to-noise via binary dilation. This feature is particularly useful when there is significant faint extended emission. Binary dilation grows each mask region using a structuring element (also known as a kernel). Currently the structuring element is fixed with a 3x3 matrix with the diagonal element being 0. We use a constraint mask based on a low signal-to-noise threshold to limit the expansion of the mask to regions with signal. 

Type Figure
ID masks-for-deconvolution-fig-grow
Caption

Figure 3 - An example of how the masks are expanded into low signal-to-noise regions. The top row shows the binary dilation process. Left: The low signal-to-noise threshold mask used as a constraint mask. Middle: The final mask from the previous clean cycle. Right: The result of binary dilating the mask from the previous clean major cycle into the constraint mask. The bottom left image shows the binary dilated mask multiplied by the constraint mask to pick out only those regions in the constraint mask associated with the previous clean mask. The bottom middle image shows the final pruned, smoothed, and cut mask.

All the operations described above, including obtaining image statistics, are done per spectral plane for spectral line imaging. 

Algorithm

  1. Calculate threshold values based on the input parameters.
    1. sidelobeThresholdValue = sidelobeThreshold * sidelobeLevel * peak in residual image
    2. noiseThresholdValue =  noiseThreshold * rms in residual image
    3. lowNoiseThresholdValue = lowNoiseThreshold * rms in residual image

  2. Create the threshold mask.
    1. maskThreshold = max(sidelobeThresholdValue,noiseThresholdValue)
    2. Create threshold mask by masking all emission greater than maskThreshold.
    3. Prune regions smaller than minBeamFrac times the beam area from threshold mask.
    4. Smooth the mask image by smoothFactor * (beam size).
    5. Mask everything above cutThreshold * the peak in the smoothed mask image.

  3. Expand the mask to low signal-to-noise.
    1. lowMaskThreshold = max(sidelobeThresholdValue,lowNoiseThresholdValue)
    2. Create constraintMask by masking all emission greater than lowMaskThreshold.
    3. Use binary dilation expand the previous clean cycle mask into the constraintMask.
    4. Create the low S/N mask by retaining only the regions in the constraintMask that are connected to the previous clean cycle mask.
    5. Prune, cut, and smooth the low S/N mask the same way as was done for the threshold mask.

  4. Add threshold mask, the low S/N mask, and mask from previous clean cycle together.

  5. Repeat major/minor clean cycles until converges.
Citation Number 1
Citation Text Williams, de Geus, and Blitz (1994) (ADS)
« Previous: Iteration Control Next: Spectral Line Imaging »  
The Plone® Open Source CMS/WCM is © 2000-2021 by the Plone Foundation and friends. Distributed under the GNU GPL license.
  • Site Map
  • Accessibility
  • Contact
Powered by Plone & Python