BORDER_INDICES Purpose
This function calculates and returns the (1D) indices corresponding
to the borders of an array. These indices can be conerted back into
n_dimensional indices via array_indices.
Inputs
Array: An array of any size
width: A scalar or vector specifying the border width. If width is
a scalar, than an n-pixel border will be extraced along every
dimension. Otherwise, width must have the same number of elements
as array has dimensions. Each element specifies the border width
along the corresponding dimension.
Keyword Parameters
dimension: Set to an integer (1-8) do extract only the edge of the
ith dimension of the data.
upper: Set to 1 to extract only the upper (high-index valued) edge
of the data
lower: Set to 1 to extract only the lower (low-index valued) edge
of the data
Outputs
The indices corresponding to the border Example
to trim a 10 pixel border off of an image
im = findgen(3,3)
print, im
0 1 2
3 4 5
6 7 8
border = border_indices(im, 1)
im[border] = 0
print, im
0 0 0
0 4 0
0 0 0
See Also
reshape, indices
Modification History
April 2010: Written by Chris Beaumont
July 2010: Added lower, upper, dimension keywords. cnb.