This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


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


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


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

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

Appends a 24-bit raster image to a file.

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

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

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.

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

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

status = hdfdf24('setil',interlace)

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

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

[width,height,interlace,status] = hdfdf24('getdims',filename)

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

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

Reads the next 24-bit raster image.

status = hdfdf24('reqil',interlace)

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

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

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

status = hdfdf24('restart')

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

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

Introduced before R2006a

Was this topic helpful?