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

| Import/export of volume data. |

## Classes
class | VolumeExportInfo
| Argument object for the function exportVolume(). More...
class | VolumeImportInfo
| Argument object for the function importVolume(). More...

## Functions
template<... >
void | exportVolume (...)
| Function for exporting a 3D volume. More...
template<... >
void | importVolume (...)
| Function for importing a 3D volume. More...

## Detailed Description

## Function Documentation

void vigra::importVolume | ( |  | ... | ) |

Function for importing a 3D volume.

Declarations:

namespace vigra {
// variant 1: read data specified by the given VolumeImportInfo object
template <class T, class Stride>
void
importVolume(VolumeImportInfo const & info,
MultiArrayView <3, T, Stride> &volume);
// variant 2: read data using a single filename, resize volume automatically
template <class T, class Allocator>
void
importVolume(MultiArray <3, T, Allocator> & volume,
const std::string &filename);
// variant 3: read data from an image stack, resize volume automatically
template <class T, class Allocator>
void
importVolume(MultiArray <3, T, Allocator> & volume,
const std::string &name_base,
const std::string &name_ext);
}

Data can be read either from a single file containing 3D data (supported formats: Andor .SIF or multi-page TIFF), a ".info" text file which describes the contents of an accompanying raw data file, or a stack of 2D images (numbered according to the scheme `name_base+"[0-9]+"+name_extension`) each representing a slice of the volume. The decision which of these possibilities applies is taken in the VolumeImportInfo constructor, see there for full details.

Variant 1 is the basic version of this function. Here, the info object and a destination array of approriate size must already be constructed. The other variants are just abbreviations provided for your convenience:

// variant 2 is equivalent to
VolumeImportInfo info(filename);
volume.reshape(info.shape());
importVolume(info, volume); // call variant 1
// variant 3 is equivalent to
VolumeImportInfo info(name_base, name_ext);
volume.reshape(info.shape());
importVolume(info, volume); // call variant 1

Usage:

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

// read data from a multi-page TIFF file, using variant 1
VolumeImportInfo info("multipage.tif");
MultiArray<3, float> volume(info.shape());
importVolume(info, volume);
// read data from a stack of 2D png-images, using variant 1
VolumeImportInfo info("my_data", ".png"); // looks for files 'my_data0.png', 'my_data1.png' etc.
MultiArray<3, float> volume(info.shape());
importVolume(info, volume);

Notice that slice numbers in a stack need not be consecutive (i.e. gaps are allowed) and will be interpreted according to their numerical order (i.e. "009", "010", "011" are read in the same order as "9", "10", "11"). The number of images found determines the depth of the volume.

void vigra::exportVolume | ( |  | ... | ) |

Function for exporting a 3D volume.

Declarations:

namespace vigra {
// variant 1: writa data as specified in the given VolumeExportInfo object
template <class T, class Tag>
void
exportVolume (MultiArrayView <3, T, Tag> const & volume,
const VolumeExportInfo & info);
// variant 2: write data to a multi-page TIFF file
template <class T, class Tag>
void
exportVolume (MultiArrayView <3, T, Tag> const & volume,
const std::string &filename);
// variant 3: write data to an image stack
template <class T, class Tag>
void
exportVolume (MultiArrayView <3, T, Tag> const & volume,
const std::string &name_base,
const std::string &name_ext);
}

The volume can either be exported as a multi-page TIFF file (variant 2, only available if libtiff is installed), or as a stack of 2D images, one image per slice (variant 3, files are named according to the scheme `name_base+"000"+name_ext`, `name_base+"001"+name_ext` etc.). If the target image format does not support the source `value_type`, all slices will be mapped to the appropriate target range in the same way.

Variant 1 is the basic version of the function. It allows full control over the export via an already constructed vigra::VolumeExportInfo object. The other two are just abbreviations that construct the VolumeExportInfo object internally.

Usage:

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

MultiArray<3, RGBValue<UInt8> > volume(shape);
... // fill in data
// export a stack named "my_data01.jpg", "my_data02.jpg" etc.
VolumeExportInfo info("my_data", ".jpg");
info.setCompression("JPEG QUALITY=95");
exportVolume(volume, info);

© 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.11.1 (Fri May 19 2017)