|
|||
NRAO Home > CASA > CASA Toolkit Reference Manual |
|
image.maskhandler - Function
1.1.1 Handle pixel masks
Description
This function is used to manage or handle pixel masks . A CASA image may
contain zero, one or more pixel masks. Any of these masks can be designated
the default pixel mask. The default mask is acted upon by
CASA applications. For example, if you ask for statistics from an image, pixels
which are masked as bad (F) will be excluded from the calculations.
This function has an argument (op) that specifies the behaviour. In all cases, you can shorten the operation string to three characters. It is not the job of this function to modify the values of masks.
- default - this retrieves the name of the default pixel mask as the return value of the function call.
- get - this retrieves the name(s) of the existing pixel masks as the return value of the function call (string or vector of strings).
- set - this lets you change the default pixel mask to that given by the name argument. If name is empty, then the default mask is unset (i.e. an all good mask is effectively applied).
- delete - this lets you delete the pixel masks specified by the name argument. To delete more than one mask, name can be a vector of strings. Any supplied pixel mask name that does not exist is silently ignored.
- rename - this lets you rename the mask specified by name[0] to name[1]. Thus the name argument must be a vector of length 2.
-
copy
-
this
lets
you
copy
a
mask
to
another
in
the
same
image,
or
copy
a
mask
from
another
image
into
this
image.
Thus
the
name
argument
must
be
a
vector
of
length
2.
For the first case, the first element of name must be the name of the mask to copy, and the second element must be the name of the pixel mask to which it will be copied.
For the second case, the first element of name must be the name of the input image and pixel mask with a colon delimiter (e.g. hcn:mask2). The second element must be the name of the pixel mask to which the input pixel mask will be copied.
Use the summary function to see the available pixel masks. You can do this either via the logger display, or via the returned record, which contains the mask names. In the logger display, any pixel mask which is not the default mask is listed in square brackets. If a default mask is set, it is listed first, and is not enclosed in square brackets.
Arguments
Inputs |
| ||
op |
| The operation. One of ’set’, ’delete’, ’rename’, ’get’,
’copy’ or ’default’
| |
| allowed: | string |
|
| Default: | default |
|
name |
| Name of mask or masks.
| |
| allowed: | stringArray |
|
| Default: |
|
|
stringArray
Example
"""
#
print "\t----\t maskhandler Ex 1 \t----"
ia.maketestimage(’g1.app’, overwrite=true)
ia.calcmask(’T’, name=’mask1’)
ia.close()
ia.maketestimage(’myimage’, overwrite=true)
ia.calcmask(’T’) # Create some masks
ia.calcmask(’T’, name=’mask1’)
ia.calcmask(’T’, name=’mask2’)
names = ia.maskhandler(’get’) # Get the mask names
print names
#[’mask0’, ’mask1’, ’mask2’]
name = ia.maskhandler(’default’) # Get the default mask name
print name
#mask2
ia.maskhandler(’set’, [’mask1’]) # Make ’mask1’ the default mask
ia.maskhandler(’set’, [’’]) # Unset the default mask
ia.maskhandler(’delete’, [’mask1’]) # Delete ’mask1’
ia.calcmask(’T’, name=’mask1’) # Make another ’mask1’
ia.maskhandler(’delete’, [’mask0’, ’mask1’])# Delete ’mask0’ and ’mask1’
ia.calcmask(’T’, name=’mask1’)
ia.maskhandler(’rename’, [’mask1’, ’mask0’])# Rename ’mask1’ to ’mask0’
# Copy ’mask1’ from image ’g1.app’ to ’mask10’ in image ’myimage’
ia.maskhandler(’copy’, [’g1.app:mask1’, ’mask10’])
ia.removefile(’g1.app’) # Cleanup
ia.close()
#
"""
__________________________________________________________________
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