In this case the volume data is stored in the application’s memory, i.e. in system memory. All the application has to do is make the volume data available to VolumeViz and set the parameters describing the volume data.
The following code fragment shows how to give VolumeViz access to a volume already stored in system memory. In this example the volume dimensions are 256x256x256 and the data values are unsigned 8-bit integers (bytes). These are the essential volume characteristics. The data and characteristics will be set in the data field of the SoVolumeData node using the setValue() method. The third parameter to this method is numSigBits (number of significant bits in each data value). In this case we are using all 8 bits so we can set this parameter to zero, meaning use all bits. In the case, for example, of DICOM data that only uses 12 bits in a 16 bit value we would set this value to 12. The last parameter to this method specifies if VolumeViz should make an internal copy of the data. If VolumeViz makes a copy of the data, then the application can (if desired) free its memory. However to conserve memory, the value NO_COPY is usually used. In this case VolumeViz accesses the data from the application memory and the application is responsible for maintaining that memory as long as the corresponding SoVolumeData node exists.
C++ :
C# :
Volume data must be wrapped in an SbNativeArray to pass efficiently to VolumeViz.
C# :
Java :
Volume data must be stored in a direct buffer with native byte order to pass efficiently to VolumeViz.
Java :