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.setbrightnessunit - Function Up: image - Tool Previous: image.sepconvolvegui - Function


image.set - Function



Package general
Module images
Tool image


Set pixel and/or mask values with a scalar in a region-of-interest of the image


Synopsis
set(pixels, pixelmask, region, list)


Arguments

pixels in The pixel value
    Allowed: LEL scalar expression or numeric scalar
    Default: unset
pixelmask in The pixel mask value
    Allowed: T or F
    Default: unset
region in The region of interest
    Allowed: Region tool
    Default: Whole image
list in List the bounding box and any mask creation to the logger
    Allowed: T or F
    Default: F


Returns
T or fail


Description

This function replaces data and/or mask values into the image in the specified region-of-interest. You can think of it as a simplified version of the image calculator.

Unlike the calc function, you can only set a scalar value for all pixels in the specified region-of-interest. For example, it can be useful to set a whole image to one value, or a mask in a region-of-interest to one value. Although you could do that with the related functions putregion and putchunk, you would have to make an array of the shape of the image and if that is large, it could be resource expensive.

The value for the pixels is specified with the pixels argument. It can be given as either a Lattice Expression Language (or LEL) expression string or a simple numeric scalar. See note 223 for a detailed description of the LEL expression syntax. If you give a LEL expression it must be a scalar expression.

Note that any default mask is ignored by this function when you set pixel values. This is different from calc where the extant mask is honoured.

The value for the pixel mask is specified with the pixelmask argument (T, F, unset). If it's unset then the mask is not changed.

If you specify pixelmask= T or F, then the mask that is affected is the current default mask (see maskhandler). If there is no mask, a mask is created for you and made the default mask.



Example

- im := imagefromshape('xx', [10,20])
- r1 := drm.box([2,2],[6,8])         # Make a box region
- im.set(pixels=1.0)                 # Set all pixels to 1
- im.set(pixels='1.0', region=r1)    # Set all pixels to 1 in the region
- im.set(pixels='min(yy)')           # Set all pixels to minimum of image yy
- im.set(pixels='min($im)', region=r1) # Set pixels in region to minimum of image xx
- im.set(pixelmask=T)                       # Set mask to all T
- im.set(pixels=0, pixelmask=F, region=r1)  #Set pixels and mask in region





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