Package com.openinventor.imageviz
Class SbImageDataAdapterHelper
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.imageviz.SbImageDataAdapterHelper
-
public class SbImageDataAdapterHelper extends Inventor
Helper class forSoImageDataAdapter. Contains various utility methods.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
-
Field Summary
-
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SoImageDataAdaptergetAppropriateAdapter(java.lang.String filename)Calls getAppropriateAdapter(filename, (long)0).static SoImageDataAdaptergetAppropriateAdapter(java.lang.String filename, long maxMemory)Loads data and returns a preconfiguredSoImageDataAdapterinstance based on the given filename extension.static voidsaveToFile(SoImageDataAdapter image, java.lang.String filename)Save given image to a file.voidsetValue(SbImageDataAdapterHelper copyFrom)-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Method Detail
-
getAppropriateAdapter
public static SoImageDataAdapter getAppropriateAdapter(java.lang.String filename)
Calls getAppropriateAdapter(filename, (long)0).
-
saveToFile
public static void saveToFile(SoImageDataAdapter image, java.lang.String filename)
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
SbExceptionis 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
SoRasterImageRWor by accessing the data (seeSbImageDataAccessor) and writing explicitly.
-
setValue
public void setValue(SbImageDataAdapterHelper copyFrom)
-
getAppropriateAdapter
public static SoImageDataAdapter getAppropriateAdapter(java.lang.String filename, long maxMemory)
Loads data and returns a preconfiguredSoImageDataAdapterinstance based on the given filename extension. If noSoImageDataAdapteris available for this extension or an error occurs, then NULL is returned.- Parameters:
filename- File (or directory) to loadmaxMemory- If the data is smaller than the specified maximum memory in MB (default 500 MB),getAppropriateAdapter()will load the data in memory and return anSoMemoryDataAdapter. Otherwise, data is not loaded in memory and anSoFileDataAdapteris returned. Access to data will be faster using a memory than a file based adapter. Returns: If possible (depending on memory limit), returns anSoMemoryDataAdapterobject.
If this is not possible, returns anSoFileDataAdapterfor simple image formats like JPEG or anSoVolumeReaderfor complex formats like DICOM (note that this requires initializing the VolumeViz extension!).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.
- When accessing to an LDM file the maxMemory parameter is ignored. The data is systematically loaded in memory and an
SoMemoryDataAdapteris 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 SoVRAmFileReaderAvizo Mesh file format .dc3, .dic, .dicom SoVRDicomFileReaderDICOM file format .fld SoVRAvsFileReaderAVS field file format .lda or .ldm SoVRLdmFileReaderLDM file format .sgy or .segy SoVRSegyFileReaderSEG Y rev 1 file format .vol SoVRVolFileReaderVol file format .vox SoVRVoxFileReaderVox file format .lst SoVRRasterStackReaderLst 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. SeeSoVRAmFileReaderfor 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". SeeSoVRAvsFileReader. - DICOM
A widely used format for storing medical image data (CT, MRI, etc), defined by the National Electrical Manufacturers Association (NEMA) (medical.nema.org). SeeSoVRDicomFileReader - 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 (seeSoVolumeConverter). Preprocessing volume data into this format provides the maximum benefits from the VolumeViz large data management (LDM) features. SeeSoVRLdmFileReader. - SEGY
A widely used format for storing seismic trace data, defined by the Society of Exploration Geophysicists publication "Digital Tape Standards" (www.seg.org). 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. SeeSoVRSegyFileReader. - 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. SeeSoVRVolFileReader. - VOX
A volume interchange format defined by TeraRecon Inc. (www.terarecon.com). 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. SeeSoVRRasterStackReaderfor details and limitations.
Note: '3D TIFF' files (multiple images in one file) are not currently supported.
- Avizo mesh
-
-