note | The PHOTO routines are only available on 64-bit PV-WAVE. |
note | If filename is a string array, the Series keyword must be set. For more information on creating a string array containing the names of all files matching a specified file description, please see the
FINDFILE Function. |
note | Multiple images read with PHOTO_READ must all be of the same height, width, and class. If a file contains images of different heights, widths, and/or classes, use the Sub_Img option to read sub-images one at a time. |
BMP | JPG | PNG | TIF |
DICM | MIFF | SUN | XWD |
GIF | PCD | TGA | XPM |
JPEG | PCX | TIFF | XBM |
note | The Img_Count keyword is ignored if the All_Subimages keyword is set. |
note | If Sub_Img is used to request a subimage that is not in the image file, the status key of the returned image associative array is set to a negative number. |
note | When you read a DICOM file with PHOTO_READ, PV-WAVE converts the hexadecimal DICOM tags to a human-readable format and stores them in a string array in the ’comments’ key with the format (####,####) Value. |
File type | Read/Write | Notes | ||
BMP | RW | The BMP format currently supported for writing is version 4. | ||
DICM | RW | Uses Sub_Img option to read sub-images one at a time. Files read with the .dcm extension will have the File_Type set to 'DICM'. | ||
GIF | RW | |||
JPEG* JPG | RW | If your image associative array does not contain a colormap, the 2D image pixel array is preserved and a greyscale color map is added. | ||
MIFF | RW | |||
PCD | R | |||
PCX | RW | |||
PNG | RW | |||
SUN | RW | |||
TGA | RW | |||
TIFF TIF | RW | |||
XWD | RW | Not supported on Windows. | ||
XPM | R | Not supported on Windows. Converted to 24-bit direct color on read/write. (NOTE: In order to read an XPM file, the DISPLAY environment variable must be set.) | ||
XBM | R | Reduces the image to monochrome (black and white) on write. | ||
* PV-WAVE is based in part on the work of the Independent JPEG Group. |
note | File type TGA does not have an encoded ID number. To read this type of file you must specify the File_type keyword or filename must have a .tga suffix. |
; Reads the file teluride24.jpg and returns an
; image associative array.
teluride = PHOTO_READ(!Dir + '/demo/gallery3/data/teluride24.jpg')
; Reads the sorted series of files IM-0042-*.tif in the
; data directory. Returns a list array containing the
; image associative arrays.
CD, !Dir + '/demo/gallery3/data/', Current=curr_dir
filenames = FINDFILE('IM-0042*.tif')
filenames = SORTDIM(filenames,0)
image = PHOTO_READ(filenames, /Series)
CD, curr_dir
; Reads and displays the series of files IM-0042-*.tif in the
; data directory. Returns a list array containing the image
; associative arrays and displays the reversed results
; with a 0.5 second frame-to-frame delay.
CD, !Dir + '/demo/gallery3/data/', Current=curr_dir
filenames = FINDFILE('IM-0042*.tif')
filenames = REVERSE(SORTDIM(filenames,0), 1)
image = PHOTO_READ(filenames, /Series)
CD, curr_dir
PHOTO_DISPLAY, image, /Series, Delay=0.5
; This example demonstrates the use of the Invalid keyword to
; identify and locate images which were not successfully read.
CD, !Dir + '/demo/gallery3/data/', Current=curr_dir
filenames = FINDFILE('IM-0042*.tif')
filenames = REVERSE(SORTDIM(filenames,0), 1)
image = PHOTO_READ(filenames, /Series, Invalid=outvar)
; All the images were read successfully so Invalid returns a -1.
INFO, outvar
; PV-WAVE prints:
; OUTVAR INT = -1
; Put two unreadable files in the list of filenames at positions 4
; and 7.
filenames(4) = "doesntExist.tif"
filenames(7) = "doesntExistEither.tif"
image = PHOTO_READ(filenames, /Series, Invalid=outvar, Quiet=3)
INFO, outvar & PM, outvar
; PV-WAVE prints
; OUTVAR INT = Array(2)
; 4
; 7
INFO, /Full, image(outvar)
; PV-WAVE prints
; <Expression> LIST = List(2)
; AS. ARR = Associative Array(2)
; status LONG = -9
; comments STRING = 'Unable to read file: doesntExist.tif'
; AS. ARR = Associative Array(2)
; status LONG = -9
; comments STRING = 'Unable to read file: doesntExistEither.tif'
; Reads the file dna.miff and returns an
; image associative array with a ROI extracted.
dna = PHOTO_READ(!Dir + '/demo/gallery3/data/dna.miff', ROI=[600,400,100,100])