read_hdf_image

Synopsis

Reads an HDF (Hierarchical Data Format) Image file, and outputs a uniform field containing the image data in ARGB format, and a DataObject suitable for the viewers. Other HDF sub-formats cannot be loaded by this module.

Parameters

filename string filename of the HDF Image file

Output Ports

out Mesh_Unif+ Node_Data uniform field containing ARGB image
obj DataObject data object containing the image

Description

The User Macro read_hdf_image will read in the specified HDF Image file, via filename, and output a uniform field containing the image data, and a DataObject containing the image suitable for the 2D viewers. The HDF Image format supports images with an alpha channel, and the output contains node data of vector length 4, containg the Alpha, Red, Green and Blue channels.

The HDF format supports other forms of datasets, but only images are supported by this module. The module uses the SDSC Image Tools library to read the HDF Image file, and this and other associated libraries must be present on the system, before this module can be compiled and used.

Input Ports

No Inputs.

Parameters

filename

Filename string containing the filename of the HDF Image file.

Output Ports

out

The output field of type Mesh_Unif+Node_Data containg the (2D) image in ARGB format. Each scanline of the HDF image is read in reverse, so that the image appears in the correct orientation for the default 2D image viewers.

obj

The output as a data object suitable for the 2D viewers, containing the above output field.

Utility Macros

The low-level ReadHDFImageField module is used in the Functional Macro ReadHDFImage, and the User Macro read_hdf_image. Additionally these macros also use the ReadHDFImageParams parameter block group object, as does the ReadHDFImageUI UI Macro.

The User Macro read_hdf_image combines the Functional Macro ReadHDFImage with the UI Macro ReadHDFImageUI, via the use of the common parameter block ReadHDFImageParams, to provide a usable macro in the visualization library.

Example

The example application ReadHDFImageEg is provided, and is a basic application containing a Uviewer2D and an instance of the read_hdf_image user macro. The file "image.hdf" is required for the example to work, and may be downloaded from the same directory as the project archive.

Files

iac_proj/r_hdfimg/rhi_macs.v contains the Functional Macro ReadHDFImage, the User Macro read_hdf_image, and the UI Macro ReadHDFImageUI.

Other Notes

The project uses the SDSC image tool libraries, which are linked to when the project is compiled. The SDSC image tool library can be downloaded from ftp.sdsc.edu/pub/sdsc/graphics/imtools. In there you will find the source code archive, along with information about other required libraries, such as the TIFF and JPEG libraries.

The TIFF library is obtainable from ftp.sgi.com/graphics/tiff, and the JPEG library is obtainable from ftp.uu.net/graphics/jpeg, if you do not already have these installed on your system.

Note: By default, the V code for the module, assumes that it will find the "im.h" include file in /usr/local/include (the default installation area for the above libraries; PC users will have a different default), and similarly that it will find the libraries libim, libsdsc, libtiff and libjpeg in /usr/local/lib. Change the module properties hdr_dirs and link_files to point to the appropriate place. Additionally, on some systems, the SDSC library may already contain the TIFF and JPEG libraries, so the -ltiff and -ljpeg parts of the 'link_files' property may not be required.

Author

Paul G. Lever
International AVS Centre
Manchester Visualization Centre
Manchester Computing
University of Manchester
Oxford Road
Manchester
United Kingdom
M13 9PL

See Also

ReadHDFImageParams, ReadHDFImageField, ReadHDFImage, and ReadHDFImageUI.

Read_Image, ReadHDFSDS.