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.wpolygon - Function Up: regionmanager - Tool Previous: regionmanager.union - Function


regionmanager.wbox - Function



Package general
Module images
Tool regionmanager


Create a world box region


Synopsis
wbox(blc, trc, pixelaxes, csys, absrel, comment)


Arguments

blc in blc of the box
    Allowed: Vector of quantities
    Default: Unity
trc in trc of the box
    Allowed: Vector of quantities
    Default: Shape
pixelaxes in Which pixel axes
    Allowed: Vector of integers
    Default: [1,2,...]
csys in Coordinate System
    Allowed: coordinates tool
    Default: Private Coordinate System
absrel in Absolute or relative coordinates
    Allowed: Vector of strings from 'abs', 'relref' and 'relcen'
    Default: 'abs' or last
comment in A comment stored with the region
    Allowed: String


Returns
Region tool



Description

This function creates a multi-dimensional world box region; the corners of the box are specified in world coordinates. However, the box is not a true world volume in that its sides do not follow world contours. Its sides are parallel to the pixel axes. If you are in a region of high world coordinate contour non-linearity (e.g. near a pole), you are probably better off using a world polygon.

The box is specified by a bottom-left corner, and a top-right corner. The coordinates are given as quantities, and you can give a vector of quantities (e.g. blc := dq.quantity("1rad 20deg") or a quantity of a vector (e.g.blc := dq.quantity([10,30], 'rad')).

You can 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'). You can specify this for each axis (the same for the blc and trc). If you specify less values than the number of values in blc or trc then the last value you did specify is used as the default for all higher numbered axes (e.g. absrel='relref' means absrel="relref relref" for two axes).

You specify which pixel axes in the image the blc and trc vector refer to with the pixelaxes argument. If you don't, it defaults to [1,2,...]. This specification is an important part of world regions.

You must also specify the Coordinate System with the csys argument. The Coordinate System is encapsulated in a coordinates tool and can be recovered from an image with the coordsys tool function. You can also set a default Coordinate System in the Regionmanager with the setcoordinates function.

In the Regionmanager we have defined units `pix' and `frac'; these are then known to the quanta system. This means that you can effectively define a pixel box (except for the stride capability) as a world box with most of the advantages of world regions (can be used for compound regions). However, it is still not very portable to other images because the coordinates are pixel based, not world based.

Note that the need to deal with the pixelaxes and csys is hidden from you when using the gui interface of the Regionmanager.



Example
- r := drm.wbox()

This region, on application to an image, will select the entire image.



Example
- im := image('ada')
- cs := im.coordsys()
- cs.summary()

Name             Proj Shape Tile   Coord value at pixel    Coord incr Units
--------------------------------------------------------------------------- 
Frequency                64   16  1.413350e+09     1.00  1.968717e+04 Hz
Velocity                          1.378053e+02     1.00 -4.174021e+00 km/s
Declination       SIN   178   89 -28.59.18.600    90.00  1.000000e+00 arcsec
Right Ascension   SIN   155   31  17:42:29.303    90.00 -1.000000e+00 arcsec
-
-
- blc := dq.quantity("17:42:29.303 -28.59.18.600")
- trc := "17:42:28.303 -28.59.10.600"
- r1 := drm.wbox(blc=blc,trc=trc,pixelaxes=[3,2],csys=cs)
- im.boundingbox(r1)
[blc=[1 90 90] , trc=[64 98 103] , regionShape=[64 9 14], imageShape=[64 178 155] ]

We have specified an RA and DEC for the blc and the trc (they should be quantities; for blc we do that explicitly, but for the trc we just give a vector of strings which is automatically converted for us to a vector of quantities).

From the summary listing you can see that RA and DEC correspond to pixel axes 3 and 2 respectively (don't be confused by the dual listing for the spectral axis) so that is why the pixelaxes argument is set to [3,2]. If we had set blc/trc in DEC/RA order then we would have put pixelaxes=[2,3]. For the unspecified frequency axis, all pixels are selected.



Example
- im := image('bork')
- cs := im.coordsys()
- cs.summary()

Name             Proj Shape Tile   Coord value at pixel    Coord incr Units
--------------------------------------------------------------------------- 
Right Ascension   SIN   155   31  17:42:29.303    90.00 -1.000000e+00 arcsec
Declination       SIN   178   89 -28.59.18.600    90.00  1.000000e+00 arcsec

- drm.setcoordinates(cs)
T
- blc := "-10pix -28.59.18.6"
- trc := "10pix  -28.59.1.6"
- r1 := drm.wbox(blc=blc,trc=trc,absrel="relref abs")   # pixelaxes defaults to [1,2]
Using private CoordinateSystem from image "bork"
- im.boundingbox(r1)
[blc=[80 90] , trc=[100 107] , regionShape=[21 18] , imageShape=[155 178] ]

In this example, we use pixel coordinates relative to the reference pixel for the RA axis and absolute world coordinates for the DEC axis. We also set the state of the Regionmanager with a Coordinate System to use when making world regions. You can see that when the region was made, a message was issued reminding you that the internal Coordinate System from the image bork was being used.



Example
- im := image('hcn')
- cs := im.coordsys()
- cs.summary()

Name             Proj Shape Tile   Coord value at pixel    Coord incr Units
--------------------------------------------------------------------------- 
Right Ascension   SIN   155   31  17:42:29.303    90.00 -1.000000e+00 arcsec
Declination       SIN   178   89 -28.59.18.600    90.00  1.000000e+00 arcsec
Frequency                64   16  1.413350e+09     1.00  1.968717e+04 Hz
Velocity                          1.378053e+02     1.00 -4.174021e+00 km/s
T 
-
- blc := "1.414E9Hz"
- trc := "1.4145GHz"
- r := drm.wbox(blc=blc, trc=trc, pixelaxes=[3], csys=cs)
- im.boundingbox(r)
[blc=[1 1 34] , trc=[155 178 59] , regionShape=[155 178 26] , imageShape=[155 178 64] ]

In this example we only specified a region for the frequency axis (note we used different units for the blc and trc). Therefore, on application, the region selected for the RA and DEC axes is automatically the full image.






next up previous contents index
Next: regionmanager.wpolygon - Function Up: regionmanager - Tool Previous: regionmanager.union - 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