SbImageDataAdapterHelper Class Reference

ImageViz Helper class for SoImageDataAdapter. More...

#include <ImageViz/SbImageDataAdapterHelper.h>

List of all members.

Static Public Member Functions

static SoImageDataAdaptergetAppropriateAdapter (const SbString &filename, size_t maxMemory=0)
static void saveToFile (SoImageDataAdapter *image, const SbString &filename)

Detailed Description

ImageViz Helper class for SoImageDataAdapter.

Contains various utility methods.

See related examples:

InteractiveThresholding, OverlayDisplay, CreatingImage2D, CreatingImage3D, ExtractingROI

Member Function Documentation

static SoImageDataAdapter* SbImageDataAdapterHelper::getAppropriateAdapter ( const SbString filename,
size_t  maxMemory = 0 
) [static]

Loads data and returns a preconfigured SoImageDataAdapter instance based on the given filename extension.

If no SoImageDataAdapter is available for this extension or an error occurs, then NULL is returned.

filename File to load
maxMemory If the data is smaller than the specified maximum memory in MB (megabytes), getAppropriateAdapter() will load the data in memory and return an SoMemoryDataAdapter. Otherwise, data is not loaded in memory and an SoFileDataAdapter is returned. Access to data will be faster using a memory than a file based adapter.


  • 'filename' should be a valid filename or pattern.
  • A volume dataset can be loaded using a pattern like a simple regular expression.
    e.g.: "/dataset/motor3d/motor_*.jpg"). This implies all images in the generated list should be a part of the same volume.
  • The file extension is mandatory except for a DICOM directory.
    Therefore "/dataset/motor3d/*.jpg" is valid but "/dataset/motor3d/*" or "/dataset/motor3d/*.*" isn't.
  • Special case for DICOM: "/dataset/head3d/*" is valid, but only if it's a valid DICOM directory and the generated files contain only DICOM parts of the volume.
  • When accessing to an LDM file the maxMemory parameter is ignored. The data is systematically loaded in memory and an SoMemoryDataAdapter is returned.
  • If 'maxMemory' is not set, the value of the environment variable IMAGEVIZ_MAX_MEMORY_ADAPTER is used, which is set to 500 MB by default.

Supported file formats:

    The following file formats are supported without additional license:

    BMP (Windows only), DDS, GIF, JPEG 2000, JPEG, PGX, PNG, PNM, SGI RGBA, Sun, TIFF

    The table below shows file formats which are supported in combination with a VolumeViz license:

    File extension Reader class Description
    .am SoVRAmFileReader Avizo Mesh file format
    .dc3, .dic, .dicom SoVRDicomFileReader DICOM file format
    .fld SoVRAvsFileReader AVS field file format
    .lda or .ldm SoVRLdmFileReader LDM file format
    .sgy or .segy SoVRSegyFileReader SEG Y rev 1 file format
    .vol SoVRVolFileReader Vol file format
    .vox SoVRVoxFileReader Vox file format
    .lst SoVRRasterStackReader Lst file format (stack of images)

    File format notes:

    • Avizo mesh
      Avizo mesh is a general purpose file format that can contain many different kinds of data. The VolumeViz file reader can load Avizo mesh files containing a 3-dimensional "Lattice" data object with uniform coordinates and any data type. See SoVRAmFileReader for limitations.
    • AVS field
      AVS field is a general purpose file format that can contain many different kinds of data. The VolumeViz file reader can load AVS field files containing 3-dimensional, uniform data of type "byte". See SoVRAvsFileReader.
    • DICOM
      A widely used format for storing medical image data (CT, MRI, etc), defined by the National Electrical Manufacturers Association (NEMA) ( See SoVRDicomFileReader
    • LDM
      LDM is a format defined by VSG for storing hierarchical multi-resolution volume data. VolumeViz includes a utility program that can convert any other format supported by VolumeViz into this format (see SoVolumeConverter). Preprocessing volume data into this format provides the maximum benefits from the VolumeViz large data management (LDM) features. See SoVRLdmFileReader.
    • SEGY
      A widely used format for storing seismic trace data, defined by the Society of Exploration Geophysicists publication "Digital Tape Standards" ( The VolumeViz reader supports all sizes of integer and float data, and can correctly determine the number of samples per trace in many cases. However the reader also has many options to adapt to differences in SEGY file headers. See SoVRSegyFileReader.
    • VOL
      A simple volume interchange format (see "Introduction to Volume Rendering", Lichtenbelt, Crane, Naqvi, 1998). The VolumeViz reader can load files containing 8- or 16-bit voxels. See SoVRVolFileReader.
    • VOX
      A volume interchange format defined by TeraRecon Inc. ( The VolumeViz reader can load "Vox1999a" files containing 8- or 16-bit voxels (first volume only). See SOVRVoxFileReader.
    • LST (stack of images)
      A simple format for loading a stack of images (one image per file). Specify the names of the image files in a .lst file. VolumeViz can load image data in most common image formats including BMP, DDS, GIF, JPEG, JPEG2000, PNG and TIFF. See SoVRRasterStackReader for details and limitations.

    Note: '3D TIFF' files (multiple images in one file) are not currently supported.

static void SbImageDataAdapterHelper::saveToFile ( SoImageDataAdapter image,
const SbString filename 
) [static]

Save given image to a file.

Filetype is determined by filename extension.

Supported formats are:

  • .ldm: Supports 2D or 3D image. Note: A VolumeVizLDM or LDMWriter license is required.
  • .tif: Supports only 2D images. To save a volume as a stack of tiff files, please use the .lst extension. If given image depth is > 1, an SbException is thrown.
  • .lst: If depth is >1, the volume is saved as a sequentially numbered set of TIFF files plus a “.lst” file. This collection of files can be reloaded as a volume by ImageViz or VolumeViz using SoVRRasterStackReader.

Any other file extension will result in throwing an exception. A time series (getSize()[3] > 1) will result in throwing an exception.

This is just a convenience method. Other formats may be written using subclasses of SoRasterImageRW or by accessing the data (see SbImageDataAccessor) and writing explicitly.

The documentation for this class was generated from the following file:

Open Inventor Toolkit reference manual, generated on 15 May 2022
Copyright © Thermo Fisher Scientific All rights reserved.