In this section we will first review the characteristics of a volume, show how these parameters are set and queried and then explain the basics of loading data from a file or a block of memory. At this point, if you are able to get your data loaded, you may want to skip to the next section and learn about how to control the data range and color mapping. However if your data is very large you should read the subsections about LDM format and converting to LDM format. The following subsections go into more detail about handling some specific file formats including DICOM for medical scanner data and SEGY for seismic data. You may want to read just the sub-section for your data format. Finally we will discuss how VolumeViz handles histogram data.
VolumeViz has built-in support, through “volume readers” (specific classes derived from SoVolumeReader( C++ | Java | .NET )), for some commonly used file formats described in Section 1.2.3, “Loading from a file”. For other data sources, the application can create a new class derived from SoVolumeReader( C++ | Java | .NET ), allowing VolumeViz to load the data directly. Data sources are not limited to disk files. A volume reader could interface to an existing application data manager or a network data server. For small volumes it may be convenient for the application to load the data and give VolumeViz the location of the data in memory. For large volumes we recommend first converting to a tiled and (optionally) multi-resolution format. VolumeViz provides the .ldm (LDM) file format. This is a tiled, multi-resolution file format optimized for the LDM data organization that VolumeViz uses internally. Using a tiled, multi-resolution format like .ldm for large volumes allows an initial rendering to appear very quickly and allows interactive rendering even if the volume will not fit in system or GPU memory. We will discuss the LDM data organization in Section 1.2.5, “LDM Data” and conversion to .ldm format in Section 1.2.6, “Converting to LDM”.
It may also be necessary for the application to access the volume data directly. The application may need to apply a filter to the data, to compute statistics, to compute a derived volume (for example seismic attributes), to apply segmentation algorithms or even to edit the data values. Filters and derived volumes can be implemented using the techniques discussed in Section 1.9.2, “Transforming volumes”. The application can access any portion of the volume, for example to apply statistics or segmentation algorithms, using the LDM Data Access API described in Section 1.10, “Data Access and Computing”. Direct editing of the volume data is also possible.
Use the SoVolumeData( C++ | Java | .NET ) node to access volume data. The data volume can be specified by:
Setting the fileName field
This is the simplest method, assuming that the volume is stored on disk in one of the file formats for which VolumeViz has a built-in reader. VolumeViz will automatically select a volume reader class based on the file extension, for example ".ldm" for the LDM file format. VolumeViz supports a number of common formats including DICOM and SEGY (discussed in more detail later). In addition to single data files, some VolumeViz readers support loading a volume stored as a stack of separate image files. If the filename does not have an extension or does not have the appropriate extension, the application must specify a volume reader explicitly using the setReader() method. If the scene graph is written to a .iv file, the SoVolumeData( C++ | Java | .NET ) node writes the filename field, but not the actual volume data.
Calling the setReader() method
This is the most general method because an application can specify one of the standard VolumeViz readers or implement a custom subclass of SoVolumeReader( C++ | Java | .NET ). VolumeViz will get the volume properties (dimensions, size, data type, etc) and access the volume data through the specified reader object. This allows the application to completely control how, and from where, the data is loaded. For example the data could be loaded from an application data manager. If the scene graph is written to a .iv file, the reader information is not written.
Setting the data field
This implies that the entire volume has been loaded into a contiguous block of system memory, so this method is only suitable for relatively small volumes. If the scene graph is written to a .iv file, the actual volume data is written in the file. This may produce a very large file, especially using the default ASCII format.
Conversion to LDM
The $OIVHOME/src/VolumeViz/Converters directory contains several example command line converter applications. Applications can customize these examples to read other data formats and to manage the conversion using the SoConverter and SoVolumeConverter( C++ | Java | .NET ) classes.
Note that unlike some data nodes in Open Inventor, the volume data is normally not considered to be stored in the scene graph and so is not saved if the scene graph is written to a .iv file. It is possible to have the volume data stored in the scene graph by setting the data field, but this is only practical for small volumes. |