SbImageDataAdapterHelper Class Reference
[Images]

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 ALSO

SoImageDataAdapter, SoFileDataAdapter, SoMemoryDataAdapter, SoVolumeReaderAdapter

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.

Parameters:
filename File (or directory) to load
maxMemory If the data is smaller than the specified maximum memory in MB (default 500 MB), getAppropriateAdapter() will load the data in memory and return an SoMemoryDataAdapter. Access to data will be faster using an SoMemoryDataAdapter than a file based adapter.

Returns: If possible (depending on memory limit), returns an SoMemoryDataAdapter object.
If this is not possible, returns an SoFileDataAdapter for simple image formats like JPEG or an SoVolumeReader for complex formats like DICOM (note that this requires initializing the VolumeViz extension!). The application can use dynamic_cast or getTypeId() to identify the type.

Important:

  • '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.
  • 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.
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 by FEI reference manual, generated on 30 Jul 2019
Copyright © FEI S.A.S. All rights reserved.
http://www.openinventor.com/