STScI Logo

hfilter stsdas.analysis.restore


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

NAME

hfilter -- Adaptive low-pass filter based on H-transform.

USAGE

hfilter input output

DESCRIPTION

The H-transform is a form of image coding based on (but not an extension of) the Haar transform. Contrary to other types of image transform (Fourier, Hadamard, Walsh, etc.), the H (and Haar) transform keeps a tight one-to-one relationship between "pixels" in the transform space (called "coefficients") and true pixels in the image space. This property makes it a very convenient device for designing adaptive filters, that is, filters that adapt themselves to the local properties of the signal.

This task implements, in the IRAF environment, the filtering procedures described by Fritze 1977 [1] and Richter et al. 1978 [2] (see also Capaccioli et al. 1988 [3] and Richter et al. 1991 [4]). Two types of adaptive local low-pass filtering are implemented:

o
Threshold filter, which adapts itself to the local signal-to-noise ratio in the image. Low signal-to-noise ratio regions (like sky background) are strongly smoothed out, while high signal-to-noise ratio regions like star images are kept untouched. Intermediate regions like galaxies are filtered in an amount proportional to the local noise-to-signal ratio.
o
Spectral filter, which exploits the fact that H-transform coefficients have a direct relationship with Fourier transform coefficients. This filter is designed to filter out pixel regions whose spectral properties in Fourier space do not agree with the ones expected from an astronomical image, and thus contain unwanted information.

More detailed filter characteristics (passbands, etc.) can be seen in [2].

The H-transform in its strictest sense is defined only for square arrays with side dimension an integer power of two. In this implementation, the image to be filtered is divided into a number of square arrays (blocks), of size given by task parameter blksize; it must be an integer power of two. If either image axis is not an integer multiple of blksize, the input image is read with boundary extension to generate the missing lines or columns that fill up the border blocks. The output image will always have a size which is an integer multiple of blksize in both axes, that is, it will contain the extra lines or columns generated by boundary extension. This drawback will be corrected in future versions; for the time being, a simple section copy with task imcopy suffices to restore the image to its original size.

Parameter blksize also controls the filter cutoff frequency, which is related to the maximum H-transform order. Larger blocks correspond to lower spatial cutoff frequencies.

The block-by-block processing of the input image can be done either by reading the full input pixel array, processing it and outputing it to the output image file; or reading each block from disk, processing it and writing it before reading the next block. The i/o mode is switched by task parameter storage. The second mode (disk) must be used only when an "Out of memory" condition develops, since it can be much slower than memory mode.

Both filter types can be switched on and off independently by task parameters thfilter and spfilter.

The threshold filter works by comparing the H-transform coefficients local to a certain pixel with a threshold derived from a "blank" (sky background) region in the same image (or in another image with similar characteristics). The filter behavior is controlled by two task parameters: thresh and gain. Coefficients larger (in absolute value) than parameter thresh times the variance of the corresponding coefficients from the blank region are kept as significant. Smaller coefficients are assumed to contain no meaningful information, and are discarded. Discarding means lowering their absolute values, in the limit zeroing them. This behavior is defined by parameter gain, which, when set to 1., generates maximum filtering, zeroing the non-significant coefficients. When set to zero, non-significant coefficients are not affected, thus restoring the image to its input status. Intermediate values produce intermediate degrees of filtering.

The "blank", or background, image, is defined by parameter skysec. It can be a section from any image, including the input image. If skysec="input", then the background image is the same as the input image. This may be useful when processing a list of images within a single call to the task.

Variance computation in the background image is done in a loop repeated three times, rejecting coefficients which deviate from zero more than 2.5 times the variance in the previous loop. This enables the use of image sections mildly contaminated by stars and other objects.

The spectral filter is a straight implementation of the procedure described in [1] and [2]. The spectral factor defined by parameter spfactor is related to the "steepness" of the local Fourier power spectrum. See the references for more details.

Typical CPU time is 8-10 sec. in a Sparc 2, 512 X 512 image, block size = 16, memory intermediate storage.

PARAMETERS

input [file name template]
Input 2-d image section(s) to be filtered. A list of files may be used.
output [file name list or directory]
Output filtered image(s). This may be a list of files or a directory.
(blksize = 8) [integer, min=2]
H-transform maximum block size. Defines the maximum order of transform computation, as well as the filter passband. Must be an integer power of two.
(storage = "memory") [string, allowed values: memory | disk]
Type of intermediate storage used when computing the H-transform block by block. Disk must be used only in cases of "Out or memory" condition.
(thfilter = yes) [boolean]
Threshold filter activated?
(thresh = 2.0) [real, min=0.]
Threshold value.
(gain = 1.0) [real, min=0., max=1.]
Threshold filter gain.
(skysec = "input") [file name]
Image section from where the coefficient variances will be computed. If "input", background is taken from the full, current input image section defined by parameter input.
(spfilter = no) [boolean]
Spectral filter activated?
(spfactor = 4.0) [real]
Spectral factor.
(verbose = no) [boolean]
Print file names, block numbers and execution times?

EXAMPLES

BUGS

REFERENCES

[1] Fritze, K., M. Lange, G. Mostl, H. Oleak, and G.M. Richter, 1977, Astron.Nachr., v. 298, p. 189.
[2] Richter, G.M., 1978, Astron.Nachr., v. 299, p. 283.
[3] Capaccioli, M., E.V. Held, H. Lorenz, G.M. Richter, and R. Ziener, 1988 Astron.Nachr., v. 309, p. 69.
[4] Richter, G.M., P. Bohm, H. Lorenz, and A. Priebe, 1991, Astron.Nachr., v. 312, p. 346.
This task was written by I.Busko

SEE ALSO

adaptive


Source Code · Package Help · Search Form · STSDAS