Helper class for SoImageDataAdapter. More...
#include <ImageViz/SbImageDataAdapterHelper.h>
Static Public Member Functions | |
static SoImageDataAdapter * | getAppropriateAdapter (const SbString &filename, size_t maxMemory=0) |
Loads data and returns a preconfigured SoImageDataAdapter instance based on the given filename extension. | |
static void | saveToFile (SoImageDataAdapter *image, const SbString &filename) |
Save given image to a file. | |
Helper class for SoImageDataAdapter.
Contains various utility methods.
SoImageDataAdapter, SoFileDataAdapter, SoMemoryDataAdapter, SoVolumeReaderAdapter
Definition at line 30 of file SbImageDataAdapterHelper.h.
|
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 (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. 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. |
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:
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.
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:
Note: '3D TIFF' files (multiple images in one file) are not currently supported.
|
static |
Save given image to a file.
Filetype is determined by filename extension.
Supported formats are:
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.