Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1488 |
|
Package | general | |
Module | images | |
Tool | image |
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 |
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.
- 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