./
border_indices.pro
Routines
result = border_indices(array, width [, lower=lower] [, upper=upper] [, dimension=dimension])This function calculates and returns the (1D) indices corresponding to the borders of an array.
test
Routine details
topborder_indices
result = border_indices(array, width [, lower=lower] [, upper=upper] [, dimension=dimension])
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.
Return value
The indices corresponding to the border
Parameters
- array in required
An array of any size
- width in required
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.
Keywords
- lower in optional
Set to 1 to extract only the lower (low-index valued) edge of the data
- upper in optional
Set to 1 to extract only the upper (high-index valued) edge of the data
- dimension in optional
Set to an integer (1-8) do extract only the edge of the ith dimension of the data.
Examples
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
Author information
- History:
April 2010: Written by Chris Beaumont July 2010: Added lower, upper, dimension keywords. cnb.
toptest
test
File attributes
| Modifcation date: | Mon Aug 2 20:22:07 2010 |
| Lines: | 150 |
![[attach.png]](idldoc-resources/attach.png)