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.restoringbeam - Function Up: image - Tool Previous: image.rename - Function


image.replacemaskedpixels - Function



Package general
Module images
Tool image


replace the values of pixels which are masked bad


Synopsis
replacemaskedpixels(pixels, region, mask, update, list)


Arguments

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


Returns
T or fail


Description

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.

  • First, you can give the pixels argument a simple numeric scalar (e.g. pixels=1.0). Then, all masked values will be replaced by that value.

  • Second, you can give a scalar LEL expression string (e.g. pixels='min(myimage)'). Then, all masked values will be replaced by the scalar that results from the expression. If the scalar expression is illegal (e.g. in the expression pixels='min(myimage)' there were no good pixels in myimage) then the value 0 is used for replacement.

  • Third, you can give a LEL expression string which has the same shape as the image file you are applying the function to. For example, putting pixels='myotherimage' means replace all masked pixels in this image file with the equivalent pixel in the image file called myotherimage.

    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).



Example
- 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.



Example
- 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).



Example
- 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).



Example
- 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.



Example
- 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.





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