[Back to Interface] [Prev] [Next]

GRreadimage/mgrdimg/mgrcimg

intn GRreadimage(int32 ri_id, int32 start[2], int32 stride[2], int32 edge[2], VOIDP data)

ri_id IN:

Raster image identifier returned by GRcreate or GRselect

start IN:

Array specifying the starting location from where raster image data is read

stride IN:

Array specifying the interval between the values that will be read along each dimension

edge IN:

Array specifying the number of values to be read along each dimension

data OUT:

Buffer for the image data

Purpose

Reads a raster image.

Return value

Returns SUCCEED (or 0) if successful and FAIL (or -1) otherwise.

Description

GRreadimage reads the subsample of the raster image specified by the parameter ri_id into the buffer data. The subsample is defined by the values of the parameters start, stride and edge.

The array start specifies the starting location of the subsample to be read. Valid values of each element in the array start are 0 to the size of the corresponding raster image dimension - 1. The first element of the array start specifies an offset from the beginning of the array data along the fastest-changing dimension, which is the second dimension in C and the first dimension in Fortran. The second element of the array start specifies an offset from the beginning of the array data along the second fastest-changing dimension, which is the first dimension in C and the second dimension in Fortran. For example, if the first value of the array start is 2 and the second value is 3, the starting location of the subsample to be read is at the fourth row and third column in C, and at the third row and fourth column in Fortran. Note that the correspondence between the elements in the array start and the array data dimensions in the GR interface is different from that in the SD interface. See the reference manual page on SDreaddata for an example.

The array stride specifies the reading pattern along each dimension. For example, if one of the elements of the array stride is 1, then every element along the corresponding dimension of the array data will be read. If one of the elements of the array stride is 2, then every other element along the corresponding dimension of the array data will be read, and so on. The correspondence between elements of the array stride and the dimensions of the array data is the same as described above for the array start.

Each element of the array edges specifies the number of data elements to be read along the corresponding dimension. The correspondence between the elements of the array edges and the dimensions of the array data is the same as described above for the array start.

Note that there are two FORTRAN-77 versions of this routine; one for numeric data (mgrdimg) and the other for character data (mgrcimg).

FORTRAN

integer function mgrdimg(ri_id, start, stride, edge, data)

integer ri_id, start(2), stride(2), edge(2)

<valid numeric data type> data(*)

integer function mgrcimg(ri_id, start, stride, edge, data)

integer ri_id, start(2), stride(2), edge(2)

character*(*) data



[Back to Interface] [Prev] [Next]

hdfhelp@ncsa.uiuc.edu
HDF Reference Manual - 07/29/98, NCSA HDF Development Group.