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.wmask - Function Up: regionmanager - Tool Previous: regionmanager.wbox - Function


regionmanager.wpolygon - Function



Package general
Module images
Tool regionmanager


Create a world polygon region with quantities


Synopsis
wpolygon(x, y, pixelaxes, csys, absrel, comment)


Arguments

x in The x vector
    Allowed: Quantity vector
y in The y vector
    Allowed: Quantity vector
pixelaxes in which pixel axes
    Allowed: Vector of integers or strings
    Default: [1,2]
csys in Coordinate System
    Allowed: coordinates tool
    Default: Privaet Coordinate System
absrel in Absolute or relative coordinates
    Allowed: String from 'abs', 'relref' and 'relcen'
    Default: 'abs'
comment in A comment stored with the region
    Allowed: String


Returns
Region tool



Description

This function (short-hand name wpoly) creates a 2D world polygon region. The polygon is specified by an x and a y vector. These must be quantities of a vector (the world box function allows both quantities of vectors and vectors of quantities). This means that the units are common to all elements of each vector. Thus, dq.quantity([1,2,3],'rad') (a quantity of a vector) is different from dq.quantity("1rad 2rad 3rad") (a vector of quantities) although the information that they specify is the same.

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

You can specify whether the x and y vector 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'). This argument applies to both the axes of the polygon.

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 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
- im := image('onno')
- cs := im.coordsys()
- im.shape()
[155 178 64]  
- x := dq.quantity([3,6,9,6,5,5,3],'pix')
- y := dq.quantity([3,4,7,9,7,5,5],'pix')
- r1 := drm.wpolygon(x=x, y=y, pixelaxes=[2,3], csys=cs)
- im.statistics(region=r1)
Selected bounding box [1, 3, 3] to [155, 9, 9]
Creating new statistics storage image

Number points = 3875           
Sum           = -9.457746e+01         Mean     = -2.440709e-02  
Variance      = 2.599452e-02          Sigma    = 1.612282e-01   
Rms           = 1.630445e-01   

Minimum value at [50, 7, 5] = -6.885301e-01  
Maximum value at [155, 3, 5] = 6.562161e-01

We applied the 2D polygon, defined in the YZ plane with absolute pixel coordinates, to a 3D image. Therefore, the first (X) axis was automatically extended to the whole image.






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