Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1488 |
|
Package | general | |
Module | images | |
Tool | image |
pixels | in | The new value(s) | |
Allowed: | Numeric scalar or LEL expression | ||
region | in | The region of interest | |
Allowed: | Region tool | ||
Default: | Whole image | ||
mask | in | OTF mask | |
Allowed: | Boolean LEL expression or mask region | ||
Default: | None | ||
update | in | Update mask as well ? | |
Allowed: | T or F | ||
Default: | F | ||
list | in | List the bounding box to the logger | |
Allowed: | T or F | ||
Default: | F |
This function (short-hand name rmp) replaces the values of all pixels whose total input mask (default input pixel mask and OTF mask) is bad (F) with the specified value.
If the argument update is F (the default), the actual pixel mask is left unchanged. That is, masked pixels remain masked. However, if you set update=T then the pixel mask will be updated so that the pixel mask will now be T (good) where the total input mask was F (bad).
See maskhandler for information on how to set the default pixel mask.
There are a few ways in which you can specify what to replace the masked pixel values by.
Your expression might be quite complex, and you can think of it as producing another masked lattice. However, in the replace process, the mask of that expression lattice is ignored. Thus, only the mask of the image file you are replacing and the pixel values of the expression lattice are relevant.
The expression must conform with the subimage formed by applying the region-of-interest to the image (i.e. that associated with this Image tool). If you use the mask argument as well, the region-of-interest is applied to it as well (see examples).
- im := image('zz1') - im.replacemaskedpixels(0.0) - im.replacemaskedpixels('min(zz2)')These examples replace all masked pixels by the specified scalar. In the second case, the scalar comes from a LEL expression operating on some other image zz2.
- im := image('zz1') - im.replacemaskedpixels(0.0, mask='zz2>0')
Let us say that zz1 has no mask. By using the mask argument, we generate a transient mask which is T (good) when the pixel values are positive. This means that all non-positive values (when that mask is F [bad]) will be replaced with the value 0. If zz1 did have a mask it would be applied as well as the transient mask (the masks would be logically ORed).
- im := image('zz1') - im2 := image('zz2') - r := drm.quarter() - im.replacemaskedpixels(0.0, region=r, mask='$im2>0')
The specified region takes one quarter of the image by area centered on the image center. The region is applied to the mask expression as well - this means that any images in the mask expression must conform with the zz1 image. The replacement of the scalar is then done only within that region. Note that in the mask expression we have specified the image with the Image tool im2 via the $ syntax (rather than referring to its disk file name zz2).
- im := image('zz1') - im.replacemaskedpixels('zz2+zz3')
In this example, the replacement values are taken from a LEL expression adding two other images together. The expression must conform with the image zz1.
- im := image('zz1') - r := drm.quarter() - im.replacemaskedpixels('zz2[$r]+zz3[$r]', region=r)
In this example, the replacement values are taken from a LEL expression adding two other images together. Because expression must conform with the image zz1 after application of the region, we must specify the region in the expression as well.