Class SoVRLdmFileWriter
- All Implemented Interfaces:
SafeDisposable
doMultiResolution
is set to true). However the writeTile() method also allows the application to directly store lower resolution tiles in case a proprietary subsampling algorithm is being used. The result will normally be a .ldm file (LDM header) and a .dat file (data).
It is not necessary, in all cases, to create the lower resolution tiles or even to create the complete set of full resolution tiles. This class supports partial writing feature. If some tiles are missing when the finish method is called, then in addition to the header and data files there will also be a .fcp file with the same name as the header and data files. The LDM header file will contain a reference to this file in the CompletionFilename tag. The .fcp file stores information about which tiles actually exist. Tiles that do not exist are considered to be filled with a constant default value (see defaultValue
). This feature allows us, for example, to compute and visualize a subset of the volume before committing to computation on the whole volume. However note that the writer currently pre-allocates disk space for the ".dat" file assuming that all tiles will exist. So skipping creation of the subsampled tiles or writing only a subset of the tiles can reduce computation time and disk I/O time, but it does not reduce the disk space requirement for the volume.
The first step is to create an SoVRLdmFileWriter
object and initialize it with the desired characteristics for the output volume. The initialize methods initialize the writer using its current parameters. It must not be modified once initialized.
The next step is to write data into the LDM file using the writeTile methods.
The final step is to call the finish method. This will optionally generate the lower resolution tiles (see doMultiResolution
), cleanup and close the LDM file.
SoVRLdmFileWriter writer = new SoVRLdmFileWriter(); // set parameters writer.headerFilename.setValue( "myFile.ldm" ); writer.dimension.setValue( 128, 128, 128 ); writer.extent.setValue( -1,-1,-1, 1,1,1 ); // Initialize writer.initialize(); // Write data SoLDMTileID tileID = new SoLDMTileID( 0 ); SoCpuBufferObject tileBuffer = new SoCpuBufferObject(); writer.writeTile( tileID, tileBuffer ); // Finalize writer.finish();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Coordinate type used by this data set.Nested classes/interfaces inherited from class com.openinventor.ldm.writers.SoVolumeWriter
SoVolumeWriter.WordFormats
Nested classes/interfaces inherited from class com.openinventor.inventor.Inventor
Inventor.ConstructorCommand
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal SoSFDouble
Set the bitset threshold value.final SoSFInt32
Set compression level.final SoSFString
Compression name.final SoMFFloat
Rectilinear coordinates along X.final SoMFFloat
Rectilinear coordinates along Y.final SoMFFloat
Rectilinear coordinates along Z..final SoSFBool
Set CRC32 check on compression.final SoSFString
Data Filename.final SoSFDouble
Set the default value.final SoSFBool
Auto compute sub-resolution tiles when finish writing.final SoSFBool
Specify if the histogram must be computed or not.final SoSFBool
Specify if tile min/max should be computed even ifenableHistogram
is false.final SoSFString
Header Filename.final SoSFBool
Generate only header file.final SoSFVec2d
Range of input datas ((min, max) of data).final SoSFBool
true if RGBA mode (output will be unsigned int32 RGBA values).final SoSFInt32
Specifies the algorithm used to build low resolution tiles.final SoSFString
Filename of original file.final SoSFBool
Save the data as a bitSet (8 values per byte).final SoSFVec3i32
Tile dimension.final SoSFDouble
Set the undefined value.final SoSFBool
verbose.Fields inherited from class com.openinventor.ldm.writers.SoVolumeWriter
dataType, dimension, extent, wordFormat
Fields inherited from class com.openinventor.inventor.Inventor
VERBOSE_LEVEL, ZeroHandle
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.openinventor.ldm.writers.SoVolumeWriter
closeAllHandles, finish, initialize, isDataConverted, restoreAllHandles, writeSubSlice, writeTile
Methods inherited from class com.openinventor.inventor.fields.SoFieldContainer
copyFieldValues, copyFieldValues, enableNotify, fieldsAreEqual, get, getAllFields, getEventIn, getEventOut, getField, getFieldName, hasDefaultValues, isNotifyEnabled, set, setToDefaults
Methods inherited from class com.openinventor.inventor.misc.SoBase
dispose, getName, isDisposable, isSynchronizable, setName, setSynchronizable, touch
Methods inherited from class com.openinventor.inventor.Inventor
getNativeResourceHandle
-
Field Details
-
headerFilename
Header Filename. -
dataFilename
Data Filename. By default, take headerFilename and use ".ldm" extension. -
originalFilename
Filename of original file. Empty by default. Needed if you want to keep an "history" of file. -
tileDimension
Tile dimension. Default is (128, 128, 128). -
doMultiResolution
Auto compute sub-resolution tiles when finish writing. Default is true. -
lowResAlgorithm
Specifies the algorithm used to build low resolution tiles. Available options are :- 0 to use decimation algorithm (one voxel out of two).
- n to use weighted average algorithm : voxels of tile of resolution N+1 are built from the average of the 6 neighbors from resolution N and the current voxel value weighted by n. by default the decimation algorithm is used (n=0).
-
saveAsBitSet
Save the data as a bitSet (8 values per byte). You should specified thebitSetThreashold
if you use this feature. Default is false. -
bitSetThreashold
Set the bitset threshold value. For each value (V) of a dataset, if V > threshold the bitset is set to 1 for this bit, or to 0 otherwise. Default is 0. Used only ifsaveAsBitSet
is true. -
isRGBA
true if RGBA mode (output will be unsigned int32 RGBA values). Default is false. -
enableHistogram
Specify if the histogram must be computed or not. Default is true.Disabling histogram generation will greatly speedup the writing process, but some VolumeViz rendering features and optimizations won't be available.
Enabling the histogram enables computation of:
- dataset min and max values
- per Tile min max values
Note also that if RGBA mode is set then no histogram is computed.
-
enableTileMinMax
Specify if tile min/max should be computed even ifenableHistogram
is false. Note that when enableHistogram to true, tile min/max is always computed. Default is false. -
undefinedValue
Set the undefined value.
The given value will be stored in the LDM file. Default is NaN (Not a Number). This is currently used bySoHeightFieldRender
(vertices with undefined values are not rendered). -
defaultValue
Set the default value. The given value will be stored in the LDM file. Default is 0. If tiles are missing, LDM will use this value to display missing tiles. -
compressionName
Compression name. The following compression types are currently supported: "gzip" and "jpeg". Jpeg is a lossy compression format and should not be used if data degradation is unacceptable. You can set thecompressionLevel
field to adjust compression quality. If empty, no compression will be used. Default is empty. -
compressionLevel
Set compression level. The meaning of this parameter depends on the type of compression used (seecompressionName
): -For gzip, it must be between 0 and 9: 0 gives no compression, 9 gives best compression but slower speed. Default is 3. -For jpeg, it must be between 0 and 100: 0 gives best compression but most loss of data, 100 gives minimum compression and minimum data alteration. Default is 85.-1 use default value of specified compressor (3 for gzip, 85 for jpeg). Default is -1.
-
headerOnly
Generate only header file. Default is false. -
verbose
verbose. Default is true. -
crcCheck
Set CRC32 check on compression. When compression is enabled using (seecompressionName
), adds a data integrity check value to all compressed tiles. If the environment variable LDM_COMPRESS_CHECK_CRC32 is set, data values will be checked each time they are read from disk. Default is false. -
inputDataRange
Range of input datas ((min, max) of data). If not specified, range has to be computed, which will increase writing time. Default is an invalid range (1, -1) -
coordinateType
. Default is COORDINATES_UNIFORM. -
coordinatesX
Rectilinear coordinates along X. Used only if coordinateType is COORDINATES_RECTILINEAR. -
coordinatesY
Rectilinear coordinates along Y. Used only if coordinateType is COORDINATES_RECTILINEAR. -
coordinatesZ
Rectilinear coordinates along Z. Used only if coordinateType is COORDINATES_RECTILINEAR.
-
-
Constructor Details
-
SoVRLdmFileWriter
public SoVRLdmFileWriter()Constructor.
-