Skip to main content

HDF5AttributeInfo

HDF5AttributeInfo (locationID, objectNameStr, objectType, attributeNameStr, options, di)

The HDF5AttributeInfo function stores information about the attribute such as its rank, dimension sizes and type in the HDF5DataInfo structure pointed to by di.

Before passing the structure to HDF5AttributeInfo you you must initialize it as shown in the example below.

HDF5AttributeInfo works on attributes of groups, datasets and named datatypes.

The function result is non-zero if an error occurred (typically a bad parameter) or zero if no error occurred.

HDF5AttributeInfo cannot be called from Igor's command line or from a macro. It must be called from a user-defined function.

Prior to Igor Pro 9.00, HDF5AttributeInfo was implemented in an XOP and could be called without assigning its result to anything. It is now built-in so you must assign the function result to a variable as shown in the example below.

Parameters

locationID is an HDF5 file ID number obtained from HDF5CreateFile or HDF5OpenFile or an HDF5 group ID obtained from HDF5CreateGroup or HDF5OpenGroup. If locationID is invalid an error is returned.

objectNameStr is a string containing the HDF5 path to the object (group, dataset or named datatype) whose attribute you are interested in.

For example, to obtain information about an attribute of a dataset at the root level of the file, you would pass the HDF5 file ID as the locationID parameter and "/<dataset>" as the objectNameStr parameter, where <dataset> is the name of the dataset.

To obtain information about a dataset in the group "/images", you could pass the HDF5 file ID as the locationID parameter and "/images/<dataset>" as the objectNameStr parameter or you could pass an HDF5 group ID obtained from HDF5CreateGroup or HDF5OpenGroup as the locationID parameter and "<dataset>" as the objectNameStr parameter.

objectType is one of the following:

1:objectNameStr is the name of a group.
2:objectNameStr is the name of a dataset.
3:objectNameStr is the name of a named datatype.

attributeNameStr is a string containing the name of the attribute of interest.

options is a bitwise parameter:

Bit 0:Suppress errors. Normally this should be set to zero so that if an error occurs (typically a bad parameter), Igor displays an error dialog. Set to 1 to suppress this normal error handling to handle errors yourself.
Bit 1:Get array information. Used for H5T_ARRAY class data only. Returns an error if called for other classes of data.
Returns information about the array base type of the attribute rather than about the attribute itself. For example, if the attribute is class H5T_ARRAY and consists of 10 rows, and if the array is a 5x4 array of signed 32-bit integers, with bit 1 set, HDF5AttributeInfo returns 5x4 (instead of 10) as the dimensionality and H5T_INTEGER (instead of H5T_ARRAY) as the class.
All other bits are reserved and must be set to zero.

See Setting Bit Parameters for details about bit settings.

di is a reference to an HDF5DataInfo structure. Before passing the structure to HDF5AttributeInfo you you must initialize it by calling InitHDF5DataInfo as shown in the example below. InitHDF5DataInfo is defined in the "HDF5 Browser.ipf" procedure file which is automatically loaded when Igor is launched.

Example

Function Example()
STRUCT HDF5DataInfo di
InitHDF5DataInfo(di) // Initialize structure
Variable fileID
HDF5OpenFile /R fileID as "hd:Data:test.h5"
int dummy = HDF5AttributeInfo(fileID, "/image1", 1, "IMAGE_COLORMODEL", 0, di)
Print di
HDF5CloseFile fileID
End

See Also

HDF5DataInfo, HDF5CreateFile, HDF5OpenFile, HDF5LoadData, HDF5ListAttributes, HDF5 Attributes