![]()
|
|||
|
|
|||
| NRAO Home > CASA > CasaDocument | |||
1.1.1 Get pixels or mask from a region-of-interest of the image
Description
This function recovers the image pixel or pixel mask values in the given
region-of-interest. Regardless of the shape of the region you have specified,
the shape of the pixels and pixelmask arrays must necessarily be the
bounding box of the specified region. If the region extends beyond the image,
it is truncated.
Recall that the recovered pixel mask will reflect both the pixel mask stored in the image, and the region-of-interest (their masks are ‘anded’) – see the discussion in the introduction about this.
The argument axes can be used to reduce the dimensionality of the output array. It specifies which pixel axes of the image to average the data over. For example, consider a 3-D image. With axes=[0,1] and all other arguments left at their defaults, the result would be a 1-D vector, a profile along the third axis, with the data averaged over the first two axes.
This function differs in three ways from getchunk. First, the region can be much more complex (e.g. a union of polygons) than the simple blc, trc, and inc of getchunk (although such a region can be created of course). Second, it can be used to recover the pixel mask or the pixels. Third, it is less efficient than getchunk for doing the same thing as getchunk. So if you are interested in say, iterating through an image, getting a regular hyper-cube of pixels and doing something with them, then getchunk will be faster. This would be especially noticeable if you iterated line by line through a large image.
Arguments
| Inputs |
| ||
| region |
| The region of interest. Default is whole image.
| |
| allowed: | any |
|
| Default: | record |
|
| axes |
| Axes to average over. Default is none.
| |
| allowed: | intArray |
|
| Default: | -1 |
|
| mask |
| OTF mask, Boolean LEL expression or mask region.
Default is none.
| |
| allowed: | any |
|
| Default: | variant |
|
| list |
| List the bounding box to the logger
| |
| allowed: | bool |
|
| Default: | false |
|
| dropdeg |
| Drop degenerate axes
| |
| allowed: | bool |
|
| Default: | false |
|
| getmask |
| Get the pixel mask rather than pixel values
| |
| allowed: | bool |
|
| Default: | false |
|
Example
Suppose that we have a 3-dimensional image called cube and wish to recover the pixel
from a simple regular region.
"""
# print "\t----\t getregion Ex 1 \t----" ia.fromshape(’cube’, [64,64,64], overwrite=true) #r1=rg.box(blc=[10,10,10],trc=[30,40]) # Create region r1=ia.setboxregion([10,10,10],[30,40,40]) # Create region pixels=ia.getregion(r1) ia.close() # """ |
Example
"""
# print "\t----\t getregion Ex 2 \t----" ia.fromshape(’cube’, [64,64,64], overwrite=true) pixels = ia.getregion() pixelmask = ia.getregion(getmask=T) # """ |
In this example we recover first the pixels and then the pixel mask.
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.