Download HDF4 User's Guide

Transcript
HDF User’s Guide
The syntax of GRgetcompinfo is as follows:
C:
status = GRgetcompinfo(ri_id, comp_type, c_info);
FORTRAN:
status = mggcompress(ri_id, comp_type, comp_prm)
This routine is further defined in Table 8H.
TABLE 8H
GRidtoref, GRreftoindex, GRnametoindex, and GRgetcompinfo Parameter Lists
Routine Name
[Return Type]
(FORTRAN-77)
Parameter
GRidtoref
[uint16]
(mgid2rf)
Description
C
FORTRAN-77
ri_id
int32
integer
Raster image identifier
GRreftoindex
[int32]
(mgr2idx)
gr_id
int32
integer
GR interface identifier
ref
uint16
integer
Reference number of the raster image
GRnametoindex
[int32]
(mgn2ndx)
gr_id
int32
integer
GR interface identifier
name
char *
character *(*)
GRgetcompinfo
[intn]
(mggcompress)
EXAMPLE 4.
Parameter Type
Name of the raster image
ri_id
int32
integer
Raster image identifier
comp_type
comp_coder_t
integer
Type of compression
c_info
comp_info
N/A
comp_prm(1)
N/A
integer
Pointer to compression information structure
Compression parameter in array format
Obtaining File and Image Information.
This example illustrates the use of the routines GRfileinfo/mgfinfo and GRgetiminfo/mggiinf to
obtain information such as the number of images and attributes in an HDF file and the characteristics of a raster image in the file.
In this example, the program gets the number of images in the file using the routine GRfileinfo/
mgfinfo. For each image, the program then obtains and displays its name, number of components,
data type, interlace mode, dimension sizes, and number of attributes using the routine GRgetiminfo/mggiinf.
C:
#include "hdf.h"
#define
FILE_NAME
"General_RImages.hdf"
main( )
{
/************************* Variable declaration **************************/
intn status;
/* status for functions returning an intn */
int32 file_id, gr_id, ri_id,
n_rimages,
/* number of raster images in the file */
n_file_attrs,
/* number of file attributes */
ri_index,
/* index of a image */
dim_sizes[2],
/* dimensions of an image */
n_comps,
/* number of components an image contains */
interlace_mode,
/* interlace mode of an image */
data_type,
/* number type of an image */
n_attrs;
/* number of attributes belong to an image */
char name[MAX_GR_NAME], /* name of an image */
*type_string,
/* mapped text of a number type */
December 2007
8-299