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. boxmask 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 'drm' can be used for most
cases unless it is already set for some other images.
For gui users regions to be masked can be made from an image:
- Fill in the desired name of the mask.
- On the ``Spanner'' button for the region, select the 'FromImage'.
- This will pop a catalogue GUI, select the image you want to use
a template to draw mask and press the 'send & Dismiss' button. This
will display the image using the viewer.
- To set a polygonal region, click once on the bottommost button on
the lefthand side of the viewer (clue: it looks like a polygon with a
letter 'R' on it). Then set the vertices of the polygon by left-clicking
each in turn. Finish with a double click on the last vertex and then
another double click inside the polygon.
- In the region box a name of the region like 'myregion1' will appear.
- Press the ``Go'' button for imager:regionmask.
Now to set multiple regions a 'union of regions' can be easily made
by using the viewer in step 3 above. Under the Tools menu, select
'ImageAnalysis'. A box of rollups will appear. Select the region
rollup. Select 'union' and press 'Start'. Then on the viewer click on
one of the Region making buttons (the two bottom most buttons on the
left margin with 'R's on them). After making a region click twice
inside. The 'accumulate' on the Region rollup should increment. Keep
repeating this process of making a region at different places and
clicking twice in (remember 'ESC' key is used to get rid of a box you
have drawn before drawing the next one). Press on the 'Finish' button
and dismiss the rollup and viewer. A region with a name like
'myregion1' would have appeared in the region box, which represent a
union of all the regions the user has selected.
For script writers who still want to interactively set the regions,
a call to the gopherwidgets:gopher tool can used.
Arguments
mask |
in |
name of mask image |
|
|
Allowed: |
String |
region |
in |
Region |
|
|
Allowed: |
Any valid region or a record of regions |
|
|
Default: |
unset |
value |
in |
Value to set the mask to |
|
|
Allowed: |
Any scalar |
|
|
Default: |
1.0 |
Returns
Bool
Example
The following the image bigmask, and then sets the inner quarter to unity. Then cleans using it as the mask.
- imgr.regionmask(mask='bigmask', region=drm.quarter())
- imgr.clean(mask='bigmask', model='3C273XC1.clean.masked', niter=1000)
Another example using drm.wbox function:
- im:=image('dirty')
- cs:=im.coordsys()
- drm.setcoordinates(cs,F)
- r1:=drm.wbox(blc=['173pix', '347pix'], trc=['183pix', '370pix'])
- imagr.regionmask(mask='bigmask',region=r1)
Or using a record of regions:
- r2:=drm.wbox(blc=['180pix', '344pix'], trc=['191pix', '369pix'])
- r3:=drm.wbox(blc=['189pix', '341pix'], trc=['204pix', '364pix'])
- rec:=[=]
- rec[1]:=r1
- rec[2]:=r2
- rec[3]:=r3
- imagr.regionmask(mask='bigmask',region=rec)
Now one may wish to make regions and later use it with higher
resolution images etc. Regions can be stored in tables on disk and
recovered later for re-use (especially if its a long series of regions
making using the gui as described above.
- drm.fromglobaltotable('mytab.region', 'T', 'F', "myregionoftoday", myregion1)
The above command using the default regionmanager tool saves the
region 'myregion1' into a table 'mytab.region'
Subsequently this table is used to recover the region and use it to
create a mask image as below. We use the function drm.namesintable()
to remind ourselves under what names the regions was saved and hence
allow us to pick the one we want.
- drm.namesintable('mytab.region')
myregionoftoday
- myoldregion:=drm.fromtabletoglobal('mytab.region', T, 'myregionoftoday')
- imagr.regionmask(mask='newmask',region=myoldregion)
Next: imager.residual - Function
Up: imager - Tool
Previous: imager.plotweights - Function
 
Contents
 
Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc.,
Washington, D.C.
Return to AIPS++ Home Page
2006-10-15