ITT Rule IDL Version 7.0 User Manual Page 189

  • Download
  • Add to my manuals
  • Print
  • Page
    / 430
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 188
Chapter 7: Creating an Operation 189
iTool Developer’s Guide Example: Data Resample Operation
INTERP = interp, CUBIC = cubic)
; CONGRID always uses linear interp with 3D
3: data = CONGRID(data, newdims[0], newdims[1], newdims[2])
ENDCASE
RETURN, 1
END
Discussion
The Execute method does the work of our operation. Since example1_opresample is
based on the IDLitDataOperation class, when the operation is requested by a user the
Execute method is automatically called with each of the currently selected data
objects as the data argument.
First, we use the SIZE function to determine the number of dimensions of the input
data item. We use a CASE statement to create a new array (
newdims) that stores the
number of elements of each dimension multiplied by the scale factor for each
dimension. The number of elements in each dimension cannot be less than one.
Next we use the ARRAY_EQUAL function to compare the number of elements of
each dimension of the input data with the number of elements of each dimension of
our
newdims array. If these numbers are equal, no resampling will take place, so we
stop processing and return 1 for success.
If our newdims array contains a different number of elements than the original input
data, some resampling will take place. We check the value of the METHOD property
(stored in the instance data field _method) to determine what type of resampling we
should perform.
Finally, we call the CONGRID function with the appropriate arguments and
keywords, depending on the dimensionality of the input data and the resampling
method specified. We then return 1 for success.
GetProperty Method
PRO example1_opresample::GetProperty, $
X = x, $
Y = y, $
Z = z, $
METHOD = method, $
_REF_EXTRA = _extra
; My properties.
IF ARG_PRESENT(x) THEN $
x = self._x
Page view 188
1 2 ... 184 185 186 187 188 189 190 191 192 193 194 ... 429 430

Comments to this Manuals

No comments