ITT Rule IDL Version 7.0 User Manual Page 188

  • Download
  • Add to my manuals
  • Print
  • Page
    / 430
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 187
188 Chapter 7: Creating an Operation
Example: Data Resample Operation iTool Developers Guide
Next, we call the Init method of the superclass. In this case, we are creating a subclass
of the IDLitDataOperation class; this provides us with all of the standard iTool data
operation functionality automatically. We specify three iTool data types on which our
operation will work: “IDLVECTOR”, “IDLARRAY2D”, and “IDLARRAY3D”. Any
“extra” keywords specified in the call to our Init method are passed to the
IDLitDataOperation::Init method via the keyword inheritance mechanism. If the call
to the superclass Init method fails, we return immediately with a value of 0.
Next we store the default values for the three resampling factors (one each for the X,
Y, and Z dimensions) in the object instance data fields
_x, _y, and _z. We register
each of these values as a property of the operation. We also register the METHOD
property, assigning to it an enumerated list with three strings describing three
different interpolation methods (“Nearest Neighbor”, “Linear”, and “Cubic”).
If any “extra” keywords were specified in the call to our Init method, we pass them to
the SetProperty method our example1_opresample object.
Finally, we return the value 1 to indicate successful initialization.
Execute Method
FUNCTION example1_opresample::Execute, data
dims = SIZE(data, /DIMENSIONS)
CASE N_ELEMENTS(dims) OF
1: newdims = dims*ABS([self._x]) > [1]
2: newdims = dims*ABS([self._x, self._y]) > [1, 1]
3: newdims = dims*ABS([self._x, self._y, self._z]) > [1, 1,
1]
ELSE: RETURN, 0
ENDCASE
; No change in size.
IF (ARRAY_EQUAL(newdims, dims)) THEN RETURN, 1
interp = 0 & cubic = 0
CASE (self._method) OF
0: ; do nothing
1: interp = 1
2: cubic = 1
ENDCASE
CASE N_ELEMENTS(dims) OF
1: data = CONGRID(data, newdims[0], $
INTERP = interp, CUBIC = cubic)
2: data = CONGRID(data, newdims[0], newdims[1], $
Page view 187
1 2 ... 183 184 185 186 187 188 189 190 191 192 193 ... 429 430

Comments to this Manuals

No comments