![]()
|
|||
|
|
|||
| NRAO Home > CASA > CasaDocument | |||
1.1.1 Image mask calculator
Description
This function is used to create a new pixel mask via a Boolean LEL
expression. This gives you much more scope than the simple set and putregion
functions.
See note 223 which describes the the syntax and functionality of LEL in detail.
If the expression is not a scalar, the shapes and coordinates of the image and expression must conform. If the expression is a scalar then the entire pixel mask will be set to that value.
By default (argument name) the name of a new pixel mask is made up for you. However, if you specify a pixel mask name (use function summary or maskhandler to see the mask names) then it is used. If the pixel mask already exists, it is overwritten.
You can specify whether the new pixel mask should be the default mask or not. By default, it is made the default pixel mask !
Arguments
| Inputs |
| ||
| mask |
| Boolean LEL expression or mask region. Must be
specified.
| |
| allowed: | string |
|
| Default: |
|
|
| name |
| Mask name. Default is auto new name.
| |
| allowed: | string |
|
| Default: |
|
|
| asdefault |
| Make specified mask the default mask?
| |
| allowed: | bool |
|
| Default: | true |
|
Example
"""
# print "\t----\t calcmask Ex 1 \t----" ia.maketestimage(’zz’, overwrite=true) subim = ia.subimage() # Make "another" image ia.calcmask(’T’) # Specify ’True’ mask as a string ia.calcmask(’zz>0’) # Mask of zz ignored ia.calcmask(’mask(zz) && zz>0’) # Mask of zz included ia.calcmask(subim.name(true)+’>min(’+subim.name(true)+’)’) # Use tool names ia.calcmask(’zz>min(zz:nomask)’) # Mask of zz not used in scalar function subim.done() ia.close() # """ |
The first calcmask example is the equivalent of ia.set(pixelmask=1). It sets the entire mask to True.
The second example creates a new pixel mask which is True when the pixel values in image zz are greater than 0.
Now for some subtlety. Read carefully ! Any LEL expression can be thought of as having a value and a mask. Usually the value is Float and the mask Boolean. In this case, because the expression is Boolean itself, the value is also Boolean. The expression mask would just be the mask of zz. Now what calcmask does is create a mask from the expression value (which is Boolean) and discards the expression mask. Therefore, the resulting mask is independent of any mask that zz might have.
If you wish the mask of the expression be honoured as well, then you can do as in the third example. It says the output pixel mask will be True if the current pixel mask of zz is True and the expression value is True.
The fourth example is like the second, except that we use the pixel values associated with the on-the-fly subim Image tool disk file. Note one further subtlety here. When the scalar function min evaluates a value from subim.name(), which in this case is just zz, the default mask of subim.name() will be used. All the scalar functions look at the mask. If you didn’t want the mask to be used you can use the special :nomask syntax shown in the final example.
Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu
Copyright © 2007 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
Updated daily during alpha development.