READ_IMAGE
The READ_IMAGE function reads the image contents of a file and returns the image in an IDL variable. If the image contains a palette it can be returned as well in three IDL variables. READ_IMAGE returns the image in the form of a two-dimensional array (for grayscale images) or a (3, n, m) array (for TrueColor images). READ_IMAGE can read most types of image files supported by IDL. See QUERY_IMAGE for a list of supported formats.
Example
The following statements open and display a DICOM image file:
image = READ_IMAGE (FILEPATH('mr_knee.dcm',$
SUBDIR=['examples', 'data']))
TV, image
Syntax
Result = READ_IMAGE (Filename [, Red, Green, Blue] [, IMAGE_INDEX=index] )
Return Value
Result is the image array read from the file or scalar value of -1 if the file could not be read.
Arguments
Filename
A scalar string containing the name of the file to read.
Red
An optional named variable to receive the red channel of the color table if a color table exists.
Green
An optional named variable to receive the green channel of the color table if a color table exists.
Blue
An optional named variable to receive the blue channel of the color table if a color table exists.
Keywords
IMAGE_INDEX
Set this keyword to the index of the image to read from the file. The default is 0, the first image.
Version History
5.3 |
Introduced |