STScI Logo

taperedge stsdas.analysis.fourier



taperedge -- Apply a taper function to image edges.


taperedge input output


This task applies a taper function to the edges of a list of 1-D or 2-D images. The image values will be tapered down from their original values toward zero at the edges. This task is intended to prepare images for cross correlation. The crosscor task extends the input images with zeros to reduce the effect of aliasing, but if the images have non-zero values around the edges, the discontinuities will bias the cross correlation.

If input and output image names are identical, the image will be modified in-place. This is done by writing the output to a temporary image, then deleting the input image and renaming the temporary image.

This task includes an option to subtract a value from the input image before applying the taper. The default is to subtract the mean of the values near the edges.

The specific function used for the taper may be selected to be either the cosine bell or a linear function, as follows:

	i is the pixel number, starting at one at the edge.

	function = "cosbell":

	    taper(i) = (1 - cos(x)) / 2,
	    where x = i * pi / (width + 1)

	function = "linear":

	    taper(i) = i / (width + 1)

Near the corners of a 2-D image, the taper function is the product of the taper in each dimension.


input = "" [file name template]
Names of the input images.
output = "" [file name template]
Names of the output images created by this task. If the output list is null, all the input images will be modified in-place; otherwise, the number of input and output names must be the same. If an output name is identical to the corresponding input name, the input image will be modified in-place.
(width = "%") [string]
Width of taper zone at each edge. If width is set to zero, this task may be used to subtract the mean from each input image.

The taper effects pixels to and including width pixels from each edge, and the taper is such that the result does not actually reach zero at the pixels at the edge. The result would reach zero one pixel beyond the edges of the image. For example, for a 1-D input image filled with a value of one, using parameters width="5", subtract="none", function="cosbell", the first six output values would be 0.067, 0.25, 0.5, 0.75, 0.933, 1; the last six would be the same in reverse order.

If width contains a "%" sign or the word "percent", the numerical value is interpreted to be a percent of the image size. In this case, for 2-D images the width of the taper region may be different for the two axes. For each axis, the width in pixels will be the nearest integer to the product of width and the axis length divided by 100.

If width does not contain "%" or "percent", only a single numerical value may be given, and that value is taken to be the width in pixels. For 2-D images the width will be the same for both axes.

(subtract = "edge") [string]
Value to be subtracted from each input image before applying taper.

The value to be subtracted may be specified as "none", "mean", "edge", or a specific numerical value. (This is case insensitive, and only the first letter is examined.)

If subtract = "none" or "0", then nothing will be subtracted. For subtract = "mean", the value is the average of the entire input image. For subtract = "edge", the value is the average within the band of width pixels around the edge, or for 1-D the average of width pixels at the left end and width pixels at the right end. You can also specify a specific numerical value for subtract.

(function = "cosbell") [string, Allowed values: cosbell | linear ]

This is the function to use for the taper. The default is to use the cosine bell function, but a linear taper is also available.

(verbose = yes) [boolean]
Print names of input and output images along with width in pixels as each image is processed?

If subtract is something other than "none", the value that was subtracted will also be printed. The image names and width are printed before processing begins, and the value subtracted is printed after processing is completed.


1. Taper the edges of "x4", writing the output to "x4t". The average of the edge values are subtracted from "x4" before tapering toward zero.

	fo> taperedge x4 x4t subtract="edge"

2. Add 27.3 to "x4" and use a linear taper.

	fo> taperedge x4 x4t subtract="-27.3" function="linear"

If verbose=yes, you could get the following output.

	x4 --> x4t
	    xwidth = 5, ywidth = 7 pixels;  subtract = -27.3

3. Apply a taper to the edges of "x4", "x5", and "x6", writing the output back into the input images. No value is subtracted from the input before tapering.

	fo> taperedge "x4,x5,x6" "" subtract="none"



Type "help fourier option=sys" for a higher-level description of the fourier package.

Source Code · Package Help · Search Form · STSDAS