
110 Chapter 5: Creating an iTool
Example: Simple iTool iTool Developer’s Guide
functionality automatically. Any “extra” keywords specified in the call to our Init
method are passed to the IDLitToolbase::Init method via the keyword inheritance
mechanism.
Because our iTool class will inherit from the IDLitToolbase class, our tool will
automatically provide all of the standard features of the iTools. In addition, we
register the following custom items:
• A custom visualization type: Image-Contour. This visualization type is
described in Chapter 6, “Creating a Visualization”.
• A new operation: Example Resample. This operation is described in Chapter 7,
“Creating an Operation”.
• A new file reader: Example TIFF Reader. This file reader is described in
Chapter 9, “Creating a File Reader”.
• We unregister the standard TIFF file writer, and register our a new filewriter:
Example TIFF Writer. This file reader is described in Chapter 10, “Creating a
File Writer”.
Finally, we return the value 1 to indicate successful initialization.
Launch Routine
Our iTool launch routine also uses the class name example1tool. It accepts a single
data argument, which we assume will contain an image array.
Example Code
The code for this example iTool launch routine is included in the file
example1tool.pro in the examples/doc/itools subdirectory of the IDL
distribution. Run the example procedure by entering
example1tool at the IDL
command prompt or view the file in an IDL Editor window by entering
.EDIT
example1tool.pro.
The code is shown below:
PRO example1tool, data, IDENTIFIER = identifier,
_EXTRA = _extra
IF (N_PARAMS() gt 0) THEN BEGIN
oParmSet = OBJ_NEW('IDLitParameterSet', $
NAME = 'example 1 parameters', $
ICON = 'image', $
DESCRIPTION = 'Example tool parameters')