STScI Logo

imfill stsdas.toolbox.imgtools



imfill -- Set fill value in image according to a mask.


imfill image mask expr value


This task takes as input an image and mask of the same size. It evaluates an expression using the mask pixels and sets the corresponding image pixel to the fill value whenever the expression is true. The variable name in the expression which represents the mask may be any alphanumeric string, but the expression may contain only one name. For example, the expressions

x .ge. 100 .and. x .lt. 200


mask .ge. 100 .and. mask .lt. 200

are both legal and have the same meaning. However, the expression

x .ge. 100 .and. y .lt. 200

is illegal and will cause an error. The following logical operators are supported. Logical operators are supported in both their Fortran and SPP form.

.or. ||		logical or	.and. 	&&	logical and
.eq. ==		equality	.ne. 	!=	inequality
.lt. <		less than	.gt. 	>	greater than
.le. <=		less or equal	.ge. 	>=	greater or equal
.not. !		not

All the operators and standard functions of ANSI Fortran are also supported. For a list of these operators and functions, see the help file for the imcalc task. Usually the expression to be evaluated will be some combination of logical operators. However, an arithmetic expression is also acceptable and will be interpreted so that zero is false and any non-zero value is true.


image [file name]
The image name. The image is modified in place. If the image name does not contain a group specifier, all groups in the image will be modified. If the image contains a group specifier, only the specified group will be modified.
mask [file name]
The mask file name. This task supports both full images used as masks and two compressed formats: iraf pixel list (.pl) format and STSDAS table format. For a description of how masks are stored in an STSDAS table, see the help file for the copymask task.
expr [string]
The expression to evaluate. If the expression is too long to pass as a parameter, place the expression in a file and set the value of this parameter to the file name preceded by an "@" character.
value [real]
The fill value. The fill value will be set in the image whenever the expression is true.


1. Set the image to zero when the mask is non-zero. All groups in the image will be changed.

im> imfill w0001.d0h w0001.q0h "x .ne. 0" 0.

2. Set the image to zero when the mask is non-zero. Only change the first group.

im> imfill w0001.d0h[1] w0001.q0h[1] "x .ne. 0" 0.

3. Set the image to zero on the basis of an expression stored in a file.

im> imfill w0001.d0h w0001.q0h @imfill.dat 0.

The file imfill.dat contains the following line:

(x .ge. 100 .and. x .lt. 200) .or. x .eq. 300


copymask, imcalc

Source Code · Package Help · Search Form · STSDAS