![]()
|
|||
|
|
|||
| NRAO Home > CASA > CasaDocument | |||
1.1.1 Get the bounding box of the specified region
Description
This function finds the bounding box of a region of interest when it is applied
to a particular image. It is returned in a record which has fields ‘blc’,
‘trc’, ‘inc’, ‘bbShape’, ‘regionShape’, ‘imageShape’, ‘blcf’ and
‘trcf’ containing the bottom-left corner, the top-right corner (in absolute
image pixel coordinates), the increment (stride) of the region, the shape of the
boundingbox, the shape of the region, the shape of the image, the blc in
formatted absolute world coordinates and the trc in formatted absolute world
coordinates, respectively.
Note that the shape of the bounding box will be different from the shape of the region if a non-unit stride (increment) is involved (see the example below).
Arguments
| Inputs |
| ||
| region |
| The region of interest. Default is whole image.
| |
| allowed: | any |
|
| Default: | record |
|
Example
"""
# print "\t----\t boundingbox Ex 1 \t----" ia.maketestimage() # Create image tool x=[’3pix’,’6pix’,’9pix’,’6pix’,’5pix’,’5pix’,’3pix’] # X vector in abs pixels y=[’3pix’,’4pix’,’7pix’,’9pix’,’7pix’,’5pix’,’5pix’] # Y vector in abs pixels mycs = ia.coordsys() r1=rg.wpolygon(x=x,y=y,csys=mycs.torecord()) # Create polygonal world region mycs.done() bb = ia.boundingbox(r1) # Find bounding box print bb #{’regionShape’: array([7, 7]), ’trc’: array([9, 9]), # ’imageShape’: array([113, 76]), # ’blcf’: ’00:00:27.733, -00.06.48.000’, # ’trcf’: ’00:00:24.533, -00.05.36.000’, ’bbShape’: array([7, 7]), # ’blc’: array([3, 3]), ’inc’: array([1, 1])} ia.close() # """ |
Example
"""
# print "\t----\t boundingbox Ex 2 \t----" ia.maketestimage() b = rg.box([10,10],[20,20],[2,3]) print ia.boundingbox(b) #{’regionShape’: array([6, 4]), ’trc’: array([20, 19]), # ’imageShape’: array([113, 76]), # ’blcf’: ’00:00:24.000, -00.05.24.000’, # ’trcf’: ’00:00:18.667, -00.03.36.000’, ’bbShape’: array([11, 10]), # ’blc’: array([10, 10]), ’inc’: array([2, 3])} ia.close() # """ |
In this example we see the difference between bbShape and regionShape because of the increment (stride). See also that the trc is modified by the increment.
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.