MEDIAN: Compute Median of Several Images

   
Form: MEDIAN dest im1 im2 im3 [im4 im5 ...] [TTY] [NOMEAN]
dest
is the buffer holding the median
im1 im2 ...
are the input images for computing the median
TTY
provide output of the progress of the computation.
NOMEAN
tells the program not to scale each image by its mean before taking the median
MEDIAN loads the 'dest' buffer with the median of images im1, im2, im3, ... Each pixel in the destination image is the median of the corresponding pixels in the input images. Normally, the program scales each image to have the same mean before computing the median of the stack. If you wish to do the background determination and scaling yourself, you can suppress the auto-rescaling by using the NOMEAN keyword.

Note that all input images must be in VISTA buffers. This prevents computing the median of very large numbers of images because of insufficient memory. For this purpose, try the command BIGMEDIAN, which will median input disk FITS files and store the median in a VISTA buffer.

At least 3 input images must be given. None of the images can be in the same buffer as the output image. All the images must have the same size and starting pixel.

The program is useful for removing cosmic-ray hits from many exposures of the same object. Make sure the location of the objects on the image (stars, location of spectrum, etc) are the SAME on ALL images! Use SHIFT or ALIGN to align images before using MEDIAN.

Example:

MEDIAN 11 1 2 3 4 5 TTY
Loads into buffer 11 the median of the images in buffers 1 through 5.