ITT Rule IDL Version 7.0 Manual de usuario Pagina 251

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 430
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 250
Chapter 9: Creating a File Reader 251
iTool Developer’s Guide Example: TIFF File Reader
RETURN, result
END
Discussion
The GetData method for our TIFF file reader begins by retrieving the name of the file
associated with the reader object. We then use the IDL QUERY_TIFF function to
check whether the image specified by the value of the IMAGE_INDEX property
(stored in the
_index instance data field) exists, returning 0 for failure if the
specified image does not exist.
QUERY_TIFF also returns a structure containing information about the image; we
use this structure to determine whether the image has a palette. We use the presence
of a palette to choose the correct call to the READ_TIFF function, which places the
image data in a set of local variables.
Next, we construct an IDLitDataIDLImage object to store the image data, using the
base name of the image file for the object’s NAME property. We use the SetData
method to place the image data into the newly created image data object, specifying
the string
'Image' as the data object’s identifier. A check of the return value from
the SetData method allows us to return 0 from our GetData method if we are unable
to store the image data in the image object for any reason.
If the image includes palette data, we store the array of red, green, and blue values
using the SetData method, specifying
'Palette' as the identifier. The palette
variables returned by READ_TIFF represent image planes; since the IDLitVisImage
visualization type that we will use to display the image expects data interleaved by
pixel, we use the TRANSPOSE function to convert the palette data into the correct
format.
Finally, we use the StatusMessage method of the IDLitIMessaging class to report to
the user which image was retrieved from the TIFF file. The message is displayed in
the status area of the iTool window.
GetProperty Method
PRO example1_readtiff::GetProperty, IMAGE_INDEX = image_index, $
_REF_EXTRA = _extra
IF (ARG_PRESENT(image_index)) THEN $
image_index = self._index
IF (N_ELEMENTS(_extra) GT 0) THEN $
self->IDLitReader::GetProperty, _EXTRA = _extra
Vista de pagina 250
1 2 ... 246 247 248 249 250 251 252 253 254 255 256 ... 429 430

Comentarios a estos manuales

Sin comentarios