[Top] [Prev] [Next] [Bottom]

GRreadimage/mgrdimg/mgrcimg

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

IN:

General raster image identifier returned by GRcreate or GRselect

start

IN:

Array containing the two-dimensional coordinate of the initial location for the read

stride

IN:

Array containing the number of data locations the current location is to be moved forward before each read

edge

IN:

Array containing the number of data elements that will be read along each dimension

data

OUT:

Buffer for the image data to be read

Purpose

Reads a general raster image to the current HDF file.

Return value

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

Description

By setting the start, stride and edge parameters appropriately , GRreadimage will perform subsampling and image slab writes. Setting stride to NULL assumes a stride value of 1.

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

Example

This example illustrates the use of GRreadimage:

     #include "hdf.h"

     int32 gr_id, ri_id, stat;
     char *name = "Image name";
     int32 ncomp = 0;
     int32 interlace_mode = MFGR_INTERLACE_PIXEL;
     int32 data_type = DFNT_UINT16;
     int32 start[2], stride[2], edge[2];
     VOIDP data[100];
     int32 dim_sizes[2] = {50, 60};
file_id = Hopen("myfile", DFACC_READ, 0); gr_id = GRstart(file_id); ri_id = GRcreate(gr_id, name, ncomp, data_type, interlace_mode, dim_sizes); ... start[0] = start[1] = 0; stride[0] = stride[1] = 1; edge[0] = edge[1] = 10; stat = GRreadimage(ri_id, start, stride, edge, data); ... stat = GRendaccess(ri_id); stat = GRend(gr_id); Hclose(file_id);
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



[Top] [Prev] [Next] [Bottom]

hdfhelp@ncsa.uiuc.edu
HDF User's Reference Manual, Draft 06/09/97, NCSA HDF Development Group.