Main Content

hdfdf24

Gateway to HDF 24-bit raster image (DF24) interface

Syntax

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

Description

hdfdf24 is the MATLAB® gateway to the HDF 24-bit raster image interface.

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

There is a one-to-one correspondence between DF24 functions in the HDF library and valid values for funcstr. For example, hdfdf24('lastref') corresponds to the C library call DF24lastref().

Write Functions

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

Value of funcstrFunction SyntaxDescription
'addimage'

status = hdfdf24('addimage',filename,RGB)

Appends a 24-bit raster image to a file.
'putimage'

status = hdfdf24('putimage',filename,RGB)

Writes a 24-bit raster image to file by overwriting all existing data.
'setcompress'

status = hdfdf24('setcompress',compress_type,...)

Sets the compress method for the next raster image written to the file. compress_type can be 'none', 'rle', 'jpeg', or 'imcomp'. If compress_type is 'jpeg', then two additional parameters must be specified: quality (a scalar between 0 and 100) and force_baseline (either 0 or 1). Other compression types do not have additional parameters.
'setdims'

status = hdfdf24('setdims',width,height)

Sets the dimensions for the next raster image written to the file.
'setil'

status = hdfdf24('setil',interlace)

Sets the interlace format of the next raster image written to the file. interlace can be 'pixel', 'line', or 'component'.
'lastref'

ref = hdfdf24('lastref')

Reports the last reference number assigned to a 24-bit raster image.

Read Functions

Read functions determine the dimensions and interlace format of 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,interlace,status] = hdfdf24('getdims',filename)

Retrieves the dimensions before reading the next raster image. interlace can be 'pixel', 'line', or 'component'.
'getimage'

[RGB,status] = hdfdf24('getimage',filename)

Reads the next 24-bit raster image.
'reqil'

status = hdfdf24('reqil',interlace)

Specifies the interlace format before reading the next raster image. interlace can be 'pixel', 'line', or 'component'.
'readref'

status = hdfdf24('readref',filename,ref)

Reads 24-bit raster image with the specified raster number.
'restart'

status = hdfdf24('restart')

Returns to the first 24-bit raster image in the file.
'nimages'

num_images = hdfdf24('nimages',filename)

Reports the number of 24-bit raster images in a file.

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. hdfdf24 does not automatically convert from C-style ordering to MATLAB style ordering, which means that MATLAB image arrays need to be permuted when using hdfdf24 to read or write from HDF files. The exact permutation depends on the interlace format specified by, for example, hdfdf24('setil',...). The following calls to permute converts HDF arrays to MATLAB arrays, according to the specified interlace format.

RGB = permute(RGB,[3 2 1]);  
'pixel' interlace
RGB = permute(RGB,[3 1 2]); 
'line' interlace
RGB = permute(RGB,[2 1 3]);  
'component' interlace

Version History

Introduced before R2006a