Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1488
News FAQ
Search Home


next up previous contents index
Next: regionmanager.complement - Function Up: regionmanager - Tool Previous: regionmanager.absreltype - Function


regionmanager.box - Function



Package general
Module images
Tool regionmanager


Create a pixel box region


Synopsis
box(blc, trc, inc, absrel, frac, comment)


Arguments

blc in blc of the box
    Allowed: Numeric vector
    Default: Unity
trc in trc of the box
    Allowed: Numeric vector
    Default: Shape
inc in increment
    Allowed: Numeric vector
    Default: unity
absrel in Absolute or relative coordinates
    Allowed: One of 'abs', 'relref' or 'relcen'
    Default: 'abs'
frac in Pixel or fractional coordinates
    Allowed: T or F
    Default: F
comment in A comment stored with the region
    Allowed: String


Returns
Region tool or fail



Description

This function creates a multi-dimensional pixel box region. The box is specified by a bottom-left corner, and top-right corner and an increment (or stride). Pixel coordinates are considered to run from 1 at the bottom left corner of the image to the image shape at the top-right corner of the image.

You can specify whether the coordinates are given as pixel coordinates (frac=F) or fractions of the image shape (frac=T). Absolute fractions are in the range [0,1].

You can also specify whether the coordinates are given as absolute coordinates (absrel='abs') or relative to the reference pixel (absrel='relref') or relative to the center of the image (absrel='relcen').



Example
- im := image('myimage')
- im.shape()
[155 178 256]
-
- r := drm.box()                 # create region
-
- im.bb(r)
[blc=[1 1 1] , trc=[155 178 256] , inc=[1 1 1] , bbShape=[155 178 256] , 
regionShape=[155 178 256] , imageShape=[155 178 256] ]

This region, on application to an image, selects the entire image.



Example
- im := image('myimage')
- im.shape()
[155 178 256]  
-
- r := drm.box(blc=[5,10])
- im.bb(r)
[blc=[5 10 1] , trc=[155 178 256] , inc=[1 1 1] , bbShape=[151 169 256] , 
regionShape=[151 169 256] , imageShape=[155 178 256] ]

This region is only specified for the first two axes of the blc. Automatic extension rules apply for the other axis and the trc (defaults to the shape).



Example
- im := image('myimage')
- im.shape()
[155 178 256]
-
- r := drm.box(blc="10 10 10", trc="20 20 20", inc="2 2 2")
- im.boundingbox(r)                                        
[blc=[10 10 10] , trc=[20 20 20] , inc=[2 2 2] , bbShape=[11 11 11] , 
regionShape=[6 6 6] , imageShape=[155 178 256] ] 
-
- im.stats(stats, region=r, list=F);
- stats.npts
216

This region picks out every other pixel in the 3D box. The ``regionShape'' field of the bounding box record does reflect the increment whereas ``bbShape'' does not. You can see that the number of points used in determining the statistics (216) reflects the increment as well.



Example
- im := image('myimage')
- im.shape()
[64 128]  
-
- rmd := drm.def()
- r := drm.box([-5,-10], [rmd,20], absrel='relcen')
-
- im.boundingbox(r)
[blc=[28 55] , trc=[64 85] , inc=[1 1] , bbShape=[37 31] , 
regionShape=[37 31] , imageShape=[64 128] ]

The region is specified in pixels relative to the center of the image. Note the use of the default value (drm.def()) to default the first axis of the trc argument to the image shape without having to know the image shape.



Example
- im := image('myimage')
- im.shape()
[155 178 256] 
-
- im.summary(summ, list=F)
- summ.refpix
[90 90 1]
-
- r := drm.box([-0.25,-0.3], [0.25, 0.5], frac=T, absrel='relref')
- im.bb(r)
[blc=[39 37 1] , trc=[116 178 256] , inc=[1 1 1] , bbShape=[78 142 256] , 
regionShape=[78 142 256] , imageShape=[155 178 256] ]

This example shows selection by relative to reference pixel fractional coordinates plus auto extension to unspecified axes.





next up previous contents index
Next: regionmanager.complement - Function Up: regionmanager - Tool Previous: regionmanager.absreltype - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-08-01