STScI Logo

rmedian images.imfilter


NAME · USAGE · PARAMETERS · DESCRIPTION · REFERENCES · EXAMPLES
TIME_REQUIREMENTS · BUGS · SEE_ALSO

NAME

rmedian -- ring median filter a set of IRAF images

USAGE

rmedian input output rinner router

PARAMETERS

input
List of input images.
output
List of filtered images. The number of input images must be the same as the number of output images. If the input image name equals the output image name the filtered images replaces the original image.
rinner, router
The inner and outer semi-major axes of the ring filter in pixels. If rinner is set to 0.0 then the ring filter becomes a circular filter.
ratio = 1.0
The ratio of the semi-minor axis to the semi-major axis of the ring filter. If ratio is 1.0 the ring filter is circularly symmetric.
theta = 0.0
The position angle of the major axis of the ring filter. Theta is measured in degrees counter-clockwise from the x axis and must be between 0 and 180 degrees.
zloreject = INDEF, zhireject = INDEF
The minimum and maximum good pixel values. Zloreject and zhireject default to -MAX_REAL and MAX_REAL respectively.
boundary = "nearest"
The type of boundary extension. The options are:
nearest
Use the value of the nearest pixel.
constant
Use a constant value.
reflect
Reflect pixel values around the boundary.
wrap
Wrap pixel values around the boundary.
constant = 0.
The value for constant valued boundary extension.

DESCRIPTION

RMEDIAN takes a list of input images input and produces a list of filtered images output . The filter consists of a sliding circular / elliptical or annular circular / elliptical window whose size and orientation is determined by the rinner , router , ratio , and theta parameters. The center pixel in the window is replaced by the median of the pixels in the window, where the median of a sequence of numbers is defined to be the value of the (n + 1) / 2 pixel of the ordered sequence. Out of bounds pixel references are handled by setting the parameter boundary . The principal function of the circular / ellptical filter is to smooth and image using a circularly / elliptically symmetric filter. The principal function of the circular / elliptical ring filter is to remove objects from the image which have a scale length of rinner and replace them with an estimate of the local background value.

The zloreject and zhireject parameters may be used to reject bad data from the median filtering box. If no good data is left in the filtering box, then the median is set to zloreject if the majority of the pixels are less than zloreject, or to zhireject if the majority of pixels are greater than zhireject.

REFERENCES

The properties of the ring median filter and its application to astronomical data analysis problems is summarized in the article "A Ring Median Filter for Digital Images" (Secker, J., 1995, PASP, 107, 496-501) and references therein.

A derivation of the expression for the mode used here can be found in "Statistics in Theory and Practice", Robert Lupton, 1993, Princeton University Press, problem 2.

EXAMPLES

1. Median filter an image using a circular ring filter with an inner radius of 4 pixels and a width of 1 pixel.

   im> rmedian input output 4.0 5.0 

2. Median filter an image using a circular ring filter of outer radius 3.

   im> rmedian input output 0.0 3.0 

3. Median filter the test image dev$pix rejecting any pixels < 5 or greater than 19935 from the medianing process using a circular filter of outer radius 5.0.

    im> rmedian dev$pix output 0.0 5.0 zloreject=5 zhireject=19935

TIME REQUIREMENTS

It requires approximately 59 and 35 CPU seconds to median filter a 512 by 512 square integer image with a circular filter of radius 5 pixels and a ring filter of inner and outer radii of 4.0 and 5.0 pixels respectively. (SPARCStation2).

BUGS

SEE ALSO

median, fmedian, frmedian


Source Code · Search Form · STSDAS