vigra - Import/Export of Images and Arrays in HDF5 Format

[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

| Import/Export of Images and Arrays in HDF5 Format |

## Classes
class | HDF5File
| Access to HDF5 files. More...
class | HDF5Handle
| Wrapper for hid_t objects. More...
class | HDF5ImportInfo
| Argument object for the function readHDF5(). More...
## Functions
template<... >
void | readHDF5 (...)
| Read the data specified by the given vigra::HDF5ImportInfo object and write the into the given 'array'.
template<... >
void | writeHDF5 (...)
| Store array data in an HDF5 file.
template<size_t N, class T , class C >
void | writeHDF5Attr (hid_t loc, const char *name, MultiArrayView< N, T, C > const &array)
template<size_t N, class C >
void | writeHDF5Attr (hid_t loc, const char *name, MultiArrayView< N, std::string, C > const &array)
template<class T >
void | writeHDF5Attr (hid_t loc, const char *name, ArrayVectorView< T > &array)
template<class Arr >
void | writeHDF5Attr (std::string filePath, std::string pathInFile, Arr &ar)

## Detailed Description

Supports arrays with arbitrary element types and arbitrary many dimensions. See the HDF5 Website for more information on the HDF5 file format.

## Function Documentation

void vigra::readHDF5 | ( |  | ... | ) |

Read the data specified by the given vigra::HDF5ImportInfo object and write the into the given 'array'.

The array must have the correct number of dimensions and shape for the dataset represented by 'info'. When the element type of 'array' differs from the stored element type, HDF5 will convert the type on the fly (except when the HDF5 version is 1.6 or below, in which case an error will result). Multi-channel element types (i.e. vigra::RGBValue, vigra::TinyVector, and vigra::FFTWComplex) are recognized and handled correctly.

Declaration:

        namespace vigra {
            template<unsigned int N, class T, class StrideTag>
            void
            readHDF5(const HDF5ImportInfo &info, MultiArrayView<N, T, StrideTag> array);
        }

Usage:

#include <vigra/hdf5impex.hxx>
Namespace: vigra

        HDF5ImportInfo info(filename, dataset_name);
        vigra_precondition(info.numDimensions() == 3, "Dataset must be 3-dimensional.");

        MultiArrayShape<3>::type shape(info.shape().begin());
        MultiArray<3, int> array(shape);

        readHDF5(info, array);

void vigra::writeHDF5 | ( |  | ... | ) |

Store array data in an HDF5 file.

The number of dimensions, shape and element type of the stored dataset is automatically determined from the properties of the given array. Strided arrays are stored in an unstrided way, i.e. in contiguous scan-order. Multi-channel element types (i.e. vigra::RGBValue, vigra::TinyVector and vigra::FFTWComplex) are recognized and handled correctly (in particular, the will form the innermost dimension of the stored dataset). pathInFile may contain '/'-separated group names, but must end with the name of the dataset to be created.

Declaration:

        namespace vigra {
            template<unsigned int N, class T, class StrideTag>
            void
            writeHDF5(const char* filePath, const char* pathInFile,
                      MultiArrayView<N, T, StrideTag>const  & array);
        }

Usage:

#include <vigra/hdf5impex.hxx>
Namespace: vigra

        MultiArrayShape<3>::type shape(100, 200, 20);
        MultiArray<3, int> array(shape);
        ... // fill array with data

        writeHDF5("mydata.h5", "/group1/my_dataset", array);

void vigra::writeHDF5Attr | ( | hid_t | loc,
|  | const char * | name,
|  | MultiArrayView< N, T, C > const & | array
| ) |  |

Write a numeric MultiArray as an attribute with name name of the dataset specified by the handle loc.

#include <vigra/hdf5impex.hxx>
Namespace: vigra

void vigra::writeHDF5Attr | ( | hid_t | loc,
|  | const char * | name,
|  | MultiArrayView< N, std::string, C > const & | array
| ) |  |

Write a string MultiArray as an attribute with name name of the dataset specified by the handle loc.

#include <vigra/hdf5impex.hxx>
Namespace: vigra

void vigra::writeHDF5Attr | ( | hid_t | loc,
|  | const char * | name,
|  | ArrayVectorView< T > & | array
| ) |  |

Write a numeric ArrayVectorView as an attribute with name name of the dataset specified by the handle loc.

#include <vigra/hdf5impex.hxx>
Namespace: vigra

void vigra::writeHDF5Attr | ( | std::string | filePath,
|  | std::string | pathInFile,
|  | Arr & | ar
| ) |  |

write an Attribute given a file and a path in the file. the path in the file should have the format [attribute] or /[subgroups/]dataset.attribute or /[subgroups/]group.attribute. The attribute is written to the root group, a dataset or a subgroup respectively

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de) Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany | html generated using doxygen and Python vigra 1.9.0 (Tue Nov 6 2012)