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


next up previous contents index
Next: image.getregion - Function Up: image - Tool Previous: image.fitsky - Function


image.getchunk - Function



Package general
Module images
Tool image


Get the pixel values from a regular region of the image into a Glish array


Synopsis
getchunk(blc, trc, inc, axes, list, dropdeg, getmask)


Arguments

blc in Bottom-Left-Corner (beginning) of pixel section
    Allowed: Vector of integers
    Default: Start of image
trc in Top-Right-Corner (end) of pixel section
    Allowed: Vector of positive integers
    Default: End of image
inc in increment (stride) along axes
    Allowed: Vector of positive integers
    Default: 1
axes in Axes to average over
    Allowed: Vector of positive integers
    Default: None
list in List bounding box to logger ?
    Allowed: T or F
    Default: F
dropdeg in Drop degenerate axes ?
    Allowed: T or F
    Default: F
getmask in Get the pixel mask as well
    Allowed: T or F
    Default: F


Returns
Glish array, Record, or fail


Description

This function returns the pixels (and opionally the pixel mask) from the image file between blc and trc inclusively. An increment may be specified with inc. Note that if you retrieve too many pixels, you might cause swapping since the pixels are kept in memory.

Any illegal blc values are set to unity. Any illegal trc values are set to the end of the image. If any trc < blc, you get the whole image for that axis. Any illegal inc values are set to unity.

The argument axes can be used to reduce the dimensionality of the output array. It specifies which pixel axes of the image average the data over. For example, consider a 3-D image. With axes=[1,2] 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.

A related function is getregion which retrieves the pixels and pixel mask from a potentially more complex region-of-interest. Function getchunk is retained because it is faster and therefore preferable for repeated operation in loops if the pixel mask is not required and the region is a simple box.

If you ask for the pixel mask as well, the return value is a record holding two fields, 'pixel' and 'pixelmask'. If you do not ask for the pixel mask (default), the pixels are returned directly.



Example
Suppose that we have a 3-dimensional image called im. Then:
- pix := im.getchunk()                      # all pixels
- pix := im.getchunk([1,1,1], [10,10,1])    # 10 by 10 section of plane # 1
- pix := im.getchunk([1,1], [1,1])          # first spectrum
- pix := im.getchunk(inc=[1,5])             # all planes, decimated by 5 in y
#
- rec := im.getchunk(getmask=T)             # Get pixels and pixelmask
- print field_names(rec)                    # into named fields of record
pixel pixelmask





next up previous contents index
Next: image.getregion - Function Up: image - Tool Previous: image.fitsky - 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