NRAO Home > CASA > CASA Toolkit Reference Manual
deconvolver.regionmask - Function

3.1.2 Construct a mask image from a region


Description

A mask image is an image with the same shape as the other images but with values between 0.0 and 1.0 as a pixel value. Mask images are used in imager to control the region selected in a deconvolution.

In Clark CLEAN, the mask image can usefully have any value between 0.0 and 1.0. Intermediate value is discouraged but do not rule out selection of clean components in that region. This is accomplished by multiplying the residual image by the mask prior to entering the minor cycle. Note that if you do use a mask for the Clark or Hogbom Clean, it must cover only a quarter of the image. regionmask does not enforce this requirement.

The function regionmask also allows multiple regions to be used. A record of the regions can be made as in the example below.

Regions can be made in many different ways using the regionmanager functions. An example using wbox function is given below. The default regionmanager tool ’rg’ can be used for cases the user want to have flexibility in manipulating regions. The region parameter takes a record that comes from the regionmanager output. The parameter boxes allow the user to sent in a list of 4 elements numbers representing blc’s and trc’s

If both the parameters, regions and boxes are used the a union is done with the two sets of region thus defined.

Arguments





Inputs

mask

name of mask image

allowed:

string

Default:

region

Region record usually from regionmanager

allowed:

record

Default:

unset

boxes

list of 4 elements lists e.g [[xblc1, yblc1, xtrc1, ytrc1], [[xblc2, yblc2, xtrc2, ytrc2]]

allowed:

any

Default:

variant

value

Value to set the mask to

allowed:

double

Default:

1.0

Returns
bool

Example

 
 
 
Makes a mask  then cleans using it.  
 
dc.open(dirty.image’, ’psf.image’)  
a=[100.0, 100.0, 200, 200.0]  
b=[50, 50, 80, 80]  
dc.regionmask(mask=’bigmask’, boxes[a,b])  
dc.clean(algorithm=’hogbom’, mask=’bigmask’, model=’model.clean.masked’, niter=1000)  
 
Another example using rg.wbox function:  
ia.open(’dirty’)  
cs:=ia.coordsys()  
rg.setcoordinates(cs.record())  
r1:=dg.wbox(blc=[’173pix’, ’347pix’], trc=[’183pix’, ’370pix’])  
c.regionmask(mask=’bigmask’,region=r1)  
 
Or using a dict of regions:  
 
r2=rg.wbox(blc=[’180pix’, ’344pix’], trc=[’191pix’, ’369pix’])  
r3=rg.wbox(blc=[’189pix’, ’341pix’], trc=[’204pix’, ’364pix’])  
regs={"reg1"’:r1, "reg2":r2, "reg3":r3}  
rec=rg.makeunion(regs)  
dc.regionmask(mask=’bigmask’,region=rec)  
 
If quantities are to be used to define regions the following is a an example  
 
dc.regionmask(mask=’joetest’,boxes=[’15:23:32.902’,’+05.19.32.089’,’15:22:28.631’,’+05.28.52.474’])  
 
 
 
 

__________________________________________________________________


More information about CASA may be found at the CASA web page

Copyright © 2016 Associated Universities Inc., Washington, D.C.

This code is available under the terms of the GNU General Public Lincense


Home | Contact Us | Directories | Site Map | Help | Privacy Policy | Search