The syntax of the DF24getimage routine is as follows:
C: status = DF24getimage(filename, image, width, height); FORTRAN: status = d2gimg(filename, image, width, height)
DF24getimage retrieves the next 24-bit image from the HDF file specified by the filename parameter. If the image is compressed, DF24getimage decompresses it and places it in memory at the location pointed to by the image parameter. DF24getimage assumes the data is stored using pixel interlacing. The space allocated to hold the image is specified by the width and height parameters and may be larger than the actual image.The parameters for DF24getimage are further defined below. (See Table 7F on page 195.)
7.5.2 Determining the Dimensions of an Image: DF24getdims
DF24getdims opens a named file, finds the next image or the first image if the file is being opened for the first time, retrieves the dimensions of the image, then determines the interlace format of the image. Images are read in the order they were written.
C: status = DF24getdims(filename, width, height, il); status = DF24getimage(filename, image, width, height);
FORTRAN: status = d2gdim(filename, width, height, il) status = d2gimg(filename, image, width, height)
DF24getdims takes four parameters: filename, width, height, and il. It retrieves dimension and interlace format information of the next 24-bit image stored in the HDF file specified by the filename parameter. The width and height are returned in the space pointed to by the width and height parameters respectively. The il parameter is used to determine the interlace format. The parameters for DF24getdims are further defined below. (See Table 7F.)
7.5.3 Modifying the Interlacing of an Image: DF24reqil
DF24reqil specifies an interlace format to be used when reading a 24-bit image from a file into memory. Regardless of what interlace format is used to store the image, DF24reqil forces the image to be loaded into memory using the specified interlace format.
C: status = DF24reqil(il); status = DF24getimage(filename, image, width, height);
FORTRAN: status = d2reqil(il) status = d2gimg(filename, image, width, height)
DF24reqil takes il as its only parameter. Valid il values are DFIL_PIXEL, DFIL_LINE and DFIL_PLANE. As a call to DF24reqil may require a substantial reordering of the data, a much slower I/O performance than would be achieved if the interlace format wasn't reset may result.
TABLE 7F DF24getimage, DF24getdims and DF24reqil Parameter List
C:
#include "hdf.h" #define WIDTH 5 #define HEIGHT 6 #define PIXEL_DEPTH 3 main( ) { uint8 raster_data[PIXEL_DEPTH][HEIGHT][WIDTH]; int32 width, height; intn interlace, status; /* Get the image dimensions from the HDF file. */ status = DF24getdims("Example2.hdf", &width, &height, &interlace); /* * Read raster data if the dimensions are * correct. */ if (width <= WIDTH && height <= HEIGHT) status = DF24getimage("Example2.hdf", (VOIDP)raster_data, width, height); }
PROGRAM READ RIS24 integer d2gimg, d2gdims, status, width, height, interlace integer*4 X_LENGTH, Y_LENGTH, PIXEL_DEPTH parameter(X_LENGTH = 5, Y_LENGTH = 6, PIXEL_DEPTH = 3) integer raster_data(PIXEL_DEPTH, X_LENGTH, Y_LENGTH) C Read the dimensions raster image. status = d2gdims('Example2.hdf', width, height, interlace) C Read image data from the HDF file if the dimensions are C correct. if (width .eq. X_LENGTH .and. height .eq. Y_LENGTH) then status = d2gimg('Example2.hdf', raster_data, width, height) endif end
7.5.4 Reading a 24-Bit Raster Image with a Given Reference Number: DF24readref
DF24readref is used to access specific images stored in files containing multiple raster image sets. It is optionally used before DF24getimage. DF24readref can be used in connection with vgroups, which identify their members by tag/reference number pairs. See Chapter 5, titled Vgroups (V API), for a discussion of vgroups and tag/reference number pairs.
C: status = DF24readref(filename, ref); status DF24getimage(filename, image, width, height);
FORTRAN: status = d2rref(filename, ref) status = d2gimg(filename, image, width, height)
DF24readref sets the reference number for the next read operation performed on the HDF file filename to the reference number contained in ref. Because reference numbers are not always assigned in sequence, it is not guaranteed that a reference number represents the location of the image in the file.
TABLE 7G DF24readref Parameter List
C: status = DF24restart( ); FORTRAN: status = d2first( )
TABLE 7H DF24restart Parameter List
Routine Name (Fortran-77)
|
Parameter
|
Data Type
|
Description
| |
C
|
Fortran-77
| |||
DF24restart (d2first)
|
None
|
None
|
None
|
None.
|