IRAF Newsletter -- Number 14 -- April 1998

[ Previous ] [ Next ] [ Table of Contents ] [ Search this issue ]


Pixel Masks in DISPLAY, FIXPIX, and CCDPROC

We are slowly making progress on incorporating pixel masks into various IRAF tasks. A pixel mask is a special type of non-negative integer image, identified by the extension "pl" for pixel list, typically used to select a small set of pixels or regions in an associated image. A mask might be used to identify bad pixels or regions for some operation. In IRAF V2.11 there are three tasks in the core and NOAO packages which have been revised to support pixel masks. These are display , fixpix , and ccdproc .

One of the common uses of pixel masks is to identify bad pixels. These "bad pixel masks" have zero values for good pixels and non-zero values for bad pixels. The bad pixel mask is assigned to one or more data images and then applications can identify good and bad pixels by matching the pixel positions in the bad pixel mask and the data image. The assignment of bad pixel masks to data images in the three tasks discussed here is done by specifying the filename of the bad pixel mask in a task parameter. As a special case the task parameter can take the value "BPM" which directs the task to get the filename of the bad pixel mask associated with an image from the keyword "BPM" in the header of the image.

The pixel positions used to match the mask pixels and the data pixels in these particular tasks use physical coordinates. For many images the physical coordinates are simply the lines and columns of the pixels in the image. In this common situation the mask and data image have the same size, pixel sampling, and alignment. However, if an image section is specified or extracted from the data image, or some operation like a block average is performed, the lines and columns will no longer match. The physical coordinates of a data pixel, however, remain the same during such operations. Thus, the masks assigned to data images will continue to be valid in these cases. If the tasks cannot match the pixel positions then a warning or error will be given.

So what do these tasks do with the bad pixels? They replace them by linear interpolation from nearby good pixels. The interpolation is either across columns or lines depending on which dimension is smallest except that fixpix also allows you to use mask values to define the direction. In display the pixels are replaced only in the displayed image and do not modify the data image, while in fixpix and ccdproc they modify the data image.

The display task also uses bad pixel or region masks in two other ways. The masks can be used to exclude pixels from the automatic scaling algorithm. Clearly bad pixels should not be used for the scaling calculation since they may greatly skew the display levels. The second use is as a color overlay. The overlay color or colors are selected by task parameters or the mask values can be used to define the colors. In an overlay zero values are transparent and only the non-zero mask values are displayed.

In the earlier versions of IRAF bad pixels could also be replaced by fixpix or ccdproc . However the bad pixels were defined by a text file of individual pixel coordinates or rectangular regions. If you still have these files and want to use them the two tasks continue to recognize them. Or you can convert such files to pixel masks using the new task proto.text2mask .

Frank Valdes

[ Previous ] [Next ] [ Table of Contents ] [ Search this issue ]

IRAF Group, National Optical Astronomy Observatories, P.O. Box 26732, Tucson, AZ 85726, Phone: (520) 318-8160, FAX: (520) 318-8360, Email iraf@noao.edu

Posted: 07May1998