Main Content

hdfdfr8

Gateway to HDF 8-bit raster image (DFR8) interface

Syntax

[out1,...,outN] = hdfdfr8(funcstr,input1,...,inputN)

Description

hdfdfr8 is the MATLAB® gateway to the HDF 8-bit raster image (DFR8) interface.

[out1,...,outN] = hdfdfr8(funcstr,input1,...,inputN) returns one or more outputs corresponding to the DFR8 function in the HDF library specified by functstr.

There is a one-to-one correspondence between DFR8 functions in the HDF library and valid values for funcstr. For example, hdfdfr8('setpalette',map) corresponds to the C library call DFR8setpalette(map).

Write Functions

Write functions create raster image sets and store them in new files or append them to existing files.

Value of funcstrFunction SyntaxDescription
'writeref'status = hdfdfr8('writeref',filename,ref)Stores the raster image using the specified reference number.
'setpalette'status = hdfdfr8('setpalette',colormap)Sets palette for multiple 8-bit raster images.
'addimage'status = hdfdfr8('addimage',filename,X,compress)Appends an 8-bit raster image to a file. compress can be 'none', 'rle', 'jpeg', or 'imcomp'.
'putimage'status = hdfdfr8('putimage',filename,X,compress)Writes an 8-bit raster image to an existing file or creates the file. compress can be 'none', 'rle', 'jpeg', or 'imcomp'.
'setcompress'status = hdfdfr8('setcompress',compress_type,...)Sets the compression type. compress_type can be 'none', 'rle', 'jpeg', or 'imcomp'. If compress_type is 'jpeg', then two additional parameters must be passed in: quality (a scalar between 0 and 100) and force_baseline (either 0 or 1). Other compression types do not have additional parameters.

Read Functions

Read functions determine the dimension and palette assignment for an image set, read the actual image data, and provide sequential or random read access to any raster image set.

Value of funcstrFunction SyntaxDescription
'getdims'[width,height,hasmap,status] = hdfdfr8('getdims',filename)Retrieves dimensions for an 8-bit raster image.
'getimage'[X,map,status] = hdfdfr8('getimage',filename)Retrieves an 8-bit raster image and its palette.
'readref'status = hdfdfr8('readref',filename,ref)Gets the next raster image with the specified reference number.
'restart'status = hdfdfr8('restart')Ignores information about last file accessed and restarts from beginning.
'nimages'num_images = hdfdfr8('nimages',filename)Returns number of raster images in a file.
'lastref'ref = hdfdfr8('lastref')Returns reference number of last element accessed.

Input/Output Arguments

A status or identifier output of -1 indicates that the operation failed.

HDF uses C-style ordering of elements, in which elements along the last dimension vary fastest. MATLAB uses FORTRAN-style ordering, in which elements along the first dimension vary fastest. hdfdfr8 does not automatically convert from C-style ordering to MATLAB style ordering, which means that MATLAB image and colormap matrices must be transposed when using hdfdfr8 to read or write from HDF files.

Functions in hdfdfr8 that read and write palette information expect to use uint8 data in the range [0,255], while MATLAB colormaps contain double-precision values in the range [0,1]. Therefore, HDF palettes must be converted to double and scaled to be used as MATLAB colormaps.

Version History

Introduced before R2006a