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

2.5.1 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 the 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

circles

list of 3 elements lists e.g [[rad0, xcen0, ycen0], [rad1,xcen1, ycen1], .....]

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.  
 
im.open(’test.ms’)  
im.selectvis(field=0, spw=0)  
im.defineimage(nx=400, cellx=’0.001arcsec’, phasecenter=0)  
a=[100.0, 100.0, 200, 200.0]  
b=[50, 50, 80, 80]  
im.regionmask(mask=’bigmask’, boxes=[a,b])  
im.clean(mask=’bigmask’, model=’3C273XC1.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’])  
im.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)  
im.regionmask(mask=’bigmask’,region=rec)  
 
If quantities are to be used to define regions the following is a an example  
 
im.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 2010 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