The CONGRID function shrinks or expands the size of an array by an arbitrary amount. CONGRID is similar to REBIN in that it can resize a one, two, or three dimensional array, but where REBIN requires that the new array size must be an integer multiple of the original size, CONGRID will resize an array to any arbitrary size. (REBIN is somewhat faster, however.) REBIN averages multiple points when shrinking an array, while CONGRID just resamples the array.
The returned array has the same number of dimensions as the original array and is of the same data type.
This routine is written in the IDL language. Its source code can be found in the file
congrid.pro
in the
lib
subdirectory of the IDL distribution.
The new X-dimension of the resized array. X must be an integer or a long integer, and must be greater than or equal to 2.
Set this keyword to a value between -1 and 0 to use the cubic convolution interpolation method with the specified value as the interpolation parameter. Setting this keyword equal to a value greater than zero specifies a value of -1 for the interpolation parameter. Park and Schowengerdt (see reference below) suggest that a value of -0.5 significantly improves the reconstruction properties of this algorithm. This keyword has no effect when used with 3-dimensional arrays.
Cubic convolution is an interpolation method that closely approximates the theoretically optimum sinc interpolation function using cubic polynomials. According to sampling theory, details of which are beyond the scope of this document, if the original signal, f , is a band-limited signal, with no frequency component larger than w 0 , and f is sampled with spacing less than or equal to 1/(2 w 0 ), then f can be reconstructed by convolving with a sinc function: sinc( x ) = sin( p x ) / ( p x ).
In the one-dimensional case, four neighboring points are used, while in the two-dimensional case 16 points are used. Note that cubic convolution interpolation is significantly slower than bilinear interpolation.
Rifman, S.S. and McKinnon, D.M., "Evaluation of Digital Correction Techniques for ERTS Images; Final Report", Report 20634-6003-TU-00, TRW Systems, Redondo Beach, CA, July 1974.
S. Park and R. Schowengerdt, 1983 "Image Reconstruction by Parametric Cubic Convolution", Computer Vision, Graphics & Image Processing 23, 256.
Set this keyword to force CONGRID to use linear interpolation when resizing a 1- or 2-dimensional array. CONGRID automatically uses linear interpolation if the input array is 3-dimensional. When the input array is 1- or 2-dimensional, the default is to employ nearest-neighbor sampling.
Set this keyword to prevent CONGRID from extrapolating one row or column beyond the bounds of the input array. For example, if the input array has the dimensions ( i, j ) and the output array has the dimensions ( x, y ), then by default the array is resampled by a factor of ( i/x ) in the X direction and ( j/y ) in the Y direction. If MINUS_ONE is set, the array will be resampled by the factors ( i -1)/( x -1) and ( j -1)/( y -1).
Given
vol
is a 3-D array with the dimensions (80, 100, 57), resize it to be a (90, 90, 80) array