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.

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:

Returns
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