Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoVRLdmFileWriter Class Reference

Large Data Management Write data to disk in LDM format. More...

#include <LDM/writers/SoVRLdmFileWriter.h>

+ Inheritance diagram for SoVRLdmFileWriter:

Public Types

enum  CoordinateType {
  COORDINATES_UNIFORM = SoVolumeReader::COORDINATES_UNIFORM ,
  COORDINATES_RECTILINEAR = SoVolumeReader::COORDINATES_RECTILINEAR
}
 Coordinate type used by this data set. More...
 
- Public Types inherited from SoVolumeWriter
enum  WordFormat {
  WF_BIG_ENDIAN = 0 ,
  WF_LITTLE_ENDIAN = 1
}
 Endianess. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoVRLdmFileWriter ()
 Constructor.
 
virtual SbBool initialize ()
 Initialize writer from current parameters.
 
virtual SbBool closeAllHandles ()
 Close all opened files (ldm, data and completion file) so that someone else can access them for reading or writing.
 
virtual SbBool restoreAllHandles ()
 Re-open ldm, data and completion file that was closed by the closeAllHandles() method.
 
virtual SbBool isDataConverted () const
 Return TRUE, as ldm format is organized in tiles.
 
virtual SbBool writeTile (const SoLDMTileID &tileId, SoBufferObject *buffer)
 Given a tileID, writes a tile if the data is organized in tiles (see SoLDMTileID).
 
virtual SbBool finish ()
 Finalize creation of files.
 
- Public Member Functions inherited from SoVolumeWriter
virtual SbBool writeSubSlice (int sliceIndex, const SbBox2i32 &subSlice, SoBufferObject *buffer)
 Writes the data contained in the specified subslice.
 
- Public Member Functions inherited from SoFieldContainer
void setToDefaults ()
 Sets all fields in this object to their default values.
 
SbBool hasDefaultValues () const
 Returns TRUE if all of the object's fields have their default values.
 
SbBool fieldsAreEqual (const SoFieldContainer *fc) const
 Returns TRUE if this object's fields are exactly equal to fc's fields.
 
void copyFieldValues (const SoFieldContainer *fc, SbBool copyConnections=FALSE)
 Copies the contents of fc's fields into this object's fields.
 
SoNONUNICODE SbBool set (const char *fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
SbBool set (const SbString &fieldDataString)
 Sets one or more fields in this object to the values specified in the given string, which should be a string in the Open Inventor file format.
 
void get (SbString &fieldDataString)
 Returns the values of the fields of this object in the Open Inventor ASCII file format in the given string.
 
virtual int getFields (SoFieldList &list) const
 Appends references to all of this object's fields to resultList, and returns the number of fields appended.
 
virtual int getAllFields (SoFieldList &list) const
 Returns a list of fields, including the eventIn's and eventOut's.
 
virtual SoFieldgetField (const SbName &fieldName) const
 Returns a the field of this object whose name is fieldName.
 
virtual SoFieldgetEventIn (const SbName &fieldName) const
 Returns a the eventIn with the given name.
 
virtual SoFieldgetEventOut (const SbName &fieldName) const
 Returns the eventOut with the given name.
 
SbBool getFieldName (const SoField *field, SbName &fieldName) const
 Returns the name of the given field in the fieldName argument.
 
SbBool enableNotify (SbBool flag)
 Notification at this Field Container is enabled (if flag == TRUE) or disabled (if flag == FALSE).
 
SbBool isNotifyEnabled () const
 Notification is the process of telling interested objects that this object has changed.
 
virtual void setUserData (void *data)
 Sets application data.
 
void * getUserData (void) const
 Gets user application data.
 
- Public Member Functions inherited from SoBase
virtual void touch ()
 Marks an instance as modified, simulating a change to it.
 
virtual SbName getName () const
 Returns the name of an instance.
 
virtual void setName (const SbName &name)
 Sets the name of an instance.
 
void setSynchronizable (const bool b)
 Sets this to be a ScaleViz synchronizable object.
 
bool isSynchronizable () const
 Gets the ScaleViz synchronizable state of this object.
 
- Public Member Functions inherited from SoRefCounter
void ref () const
 Adds a reference to an instance.
 
void unref () const
 Removes a reference from an instance.
 
void unrefNoDelete () const
 unrefNoDelete() should be called when it is desired to decrement the reference count, but not delete the instance if this brings the reference count to zero.
 
int getRefCount () const
 Returns current reference count.
 
void lock () const
 lock this instance.
 
void unlock () const
 unlock this instance.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoVolumeWriter
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoFieldContainer
static SoType getClassTypeId ()
 Returns the type of this class.
 
- Static Public Member Functions inherited from SoBase
static SoType getClassTypeId ()
 Returns type identifier for this class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Public Attributes

SoSFString headerFilename
 Header Filename.
 
SoSFString dataFilename
 Data Filename.
 
SoSFString originalFilename
 Filename of original file.
 
SoSFVec3i32 tileDimension
 Tile dimension.
 
SoSFBool doMultiResolution
 Auto compute sub-resolution tiles when finish writing.
 
SoSFInt32 lowResAlgorithm
 Specifies the algorithm used to build low resolution tiles.
 
SoSFBool saveAsBitSet
 Save the data as a bitSet (8 values per byte).
 
SoSFDouble bitSetThreashold
 Set the bitset threshold value.
 
SoSFBool isRGBA
 true if RGBA mode (output will be unsigned int32 RGBA values).
 
SoSFBool enableHistogram
 Specify if the histogram must be computed or not.
 
SoSFBool enableTileMinMax
 Specify if tile min/max should be computed even if enableHistogram is false.
 
SoSFDouble undefinedValue
 Set the undefined value.
 
SoSFDouble defaultValue
 Set the default value.
 
SoSFString compressionName
 Compression name.
 
SoSFInt32 compressionLevel
 Set compression level.
 
SoSFBool headerOnly
 Generate only header file.
 
SoSFBool verbose
 verbose.
 
SoSFBool crcCheck
 Set CRC32 check on compression.
 
SoSFVec2d inputDataRange
 Range of input datas ((min, max) of data).
 
SoSFEnum coordinateType
 Use enum CoordinateType.
 
SoMFFloat coordinatesX
 Rectilinear coordinates along X.
 
SoMFFloat coordinatesY
 Rectilinear coordinates along Y.
 
SoMFFloat coordinatesZ
 Rectilinear coordinates along Z.
 
- Public Attributes inherited from SoVolumeWriter
SoSFBox3f extent
 Extent of dataset.
 
SoSFVec3i32 dimension
 Dimension of dataset, in voxels.
 
SoSFEnum dataType
 Type of input data (that will be given in the writeXXX method) Use enum SoDataSet::DataType.
 
SoSFEnum wordFormat
 Endianess of data.
 

Detailed Description

Large Data Management Write data to disk in LDM format.

Creates an LDM file (in the VSG .ldm format) and allows the application to store data blocks in any order. The most common usage is to store blocks of full resolution data. This class can automatically generate the lower resolution (subsampled) tiles after the full resolution data has been stored (when the finish() method is called and 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.

EXAMPLE

SEE ALSO

SoVolumeWriter

Definition at line 151 of file SoVRLdmFileWriter.h.

Member Enumeration Documentation

◆ CoordinateType

Coordinate type used by this data set.

Enumerator
COORDINATES_UNIFORM 

Uniform grid spacing along each axis.

COORDINATES_RECTILINEAR 

Grid spacing defined by x, y, z values.

Definition at line 291 of file SoVRLdmFileWriter.h.

Constructor & Destructor Documentation

◆ SoVRLdmFileWriter()

SoVRLdmFileWriter::SoVRLdmFileWriter ( )

Constructor.

Member Function Documentation

◆ closeAllHandles()

virtual SbBool SoVRLdmFileWriter::closeAllHandles ( )
virtual

Close all opened files (ldm, data and completion file) so that someone else can access them for reading or writing.

Reimplemented from SoVolumeWriter.

◆ finish()

virtual SbBool SoVRLdmFileWriter::finish ( )
virtual

Finalize creation of files.

If doMultiResolution is set to true, all missing sub-resolutions will be computed. This operation can be very long with big dataset.

Reimplemented from SoVolumeWriter.

◆ getClassTypeId()

static SoType SoVRLdmFileWriter::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getTypeId()

virtual SoType SoVRLdmFileWriter::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoVolumeWriter.

◆ initialize()

virtual SbBool SoVRLdmFileWriter::initialize ( )
virtual

Initialize writer from current parameters.

Created and allocated data file on disk. This operation can be quite long with big dataset.

Reimplemented from SoVolumeWriter.

◆ isDataConverted()

virtual SbBool SoVRLdmFileWriter::isDataConverted ( ) const
virtual

Return TRUE, as ldm format is organized in tiles.

Implements SoVolumeWriter.

◆ restoreAllHandles()

virtual SbBool SoVRLdmFileWriter::restoreAllHandles ( )
virtual

Re-open ldm, data and completion file that was closed by the closeAllHandles() method.

Reimplemented from SoVolumeWriter.

◆ writeTile()

virtual SbBool SoVRLdmFileWriter::writeTile ( const SoLDMTileID tileId,
SoBufferObject buffer 
)
virtual

Given a tileID, writes a tile if the data is organized in tiles (see SoLDMTileID).


This function must be called only if isDataConverted() return TRUE.

Must be reimplemented in children classes.

Please refer to SoLDMTileID and SoLDMTopoOctree for relation between tileId and tile position.

Reimplemented from SoVolumeWriter.

Member Data Documentation

◆ bitSetThreashold

SoSFDouble SoVRLdmFileWriter::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 if saveAsBitSet is TRUE.

Definition at line 192 of file SoVRLdmFileWriter.h.

◆ compressionLevel

SoSFInt32 SoVRLdmFileWriter::compressionLevel

Set compression level.

The meaning of this parameter depends on the type of compression used (see compressionName): -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.

Definition at line 257 of file SoVRLdmFileWriter.h.

◆ compressionName

SoSFString SoVRLdmFileWriter::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 the compressionLevel field to adjust compression quality. If empty, no compression will be used. Default is empty.

Definition at line 241 of file SoVRLdmFileWriter.h.

◆ coordinatesX

SoMFFloat SoVRLdmFileWriter::coordinatesX

Rectilinear coordinates along X.

Used only if coordinateType is COORDINATES_RECTILINEAR.

Definition at line 282 of file SoVRLdmFileWriter.h.

◆ coordinatesY

SoMFFloat SoVRLdmFileWriter::coordinatesY

Rectilinear coordinates along Y.

Used only if coordinateType is COORDINATES_RECTILINEAR.

Definition at line 285 of file SoVRLdmFileWriter.h.

◆ coordinatesZ

SoMFFloat SoVRLdmFileWriter::coordinatesZ

Rectilinear coordinates along Z.

Used only if coordinateType is COORDINATES_RECTILINEAR.

Definition at line 288 of file SoVRLdmFileWriter.h.

◆ coordinateType

SoSFEnum SoVRLdmFileWriter::coordinateType

Use enum CoordinateType.

Default is COORDINATES_UNIFORM.

Definition at line 279 of file SoVRLdmFileWriter.h.

◆ crcCheck

SoSFBool SoVRLdmFileWriter::crcCheck

Set CRC32 check on compression.

When compression is enabled using (see compressionName), 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.

Definition at line 272 of file SoVRLdmFileWriter.h.

◆ dataFilename

SoSFString SoVRLdmFileWriter::dataFilename

Data Filename.

By default, take headerFilename and use ".ldm" extension.

Definition at line 161 of file SoVRLdmFileWriter.h.

◆ defaultValue

SoSFDouble SoVRLdmFileWriter::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.

Definition at line 231 of file SoVRLdmFileWriter.h.

◆ doMultiResolution

SoSFBool SoVRLdmFileWriter::doMultiResolution

Auto compute sub-resolution tiles when finish writing.

Default is true.

Definition at line 171 of file SoVRLdmFileWriter.h.

◆ enableHistogram

SoSFBool SoVRLdmFileWriter::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.

Definition at line 210 of file SoVRLdmFileWriter.h.

◆ enableTileMinMax

SoSFBool SoVRLdmFileWriter::enableTileMinMax

Specify if tile min/max should be computed even if enableHistogram is false.

Note that when enableHistogram to true, tile min/max is always computed. Default is false.

Definition at line 217 of file SoVRLdmFileWriter.h.

◆ headerFilename

SoSFString SoVRLdmFileWriter::headerFilename

Header Filename.

Definition at line 158 of file SoVRLdmFileWriter.h.

◆ headerOnly

SoSFBool SoVRLdmFileWriter::headerOnly

Generate only header file.

Default is FALSE.

Definition at line 260 of file SoVRLdmFileWriter.h.

◆ inputDataRange

SoSFVec2d SoVRLdmFileWriter::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)

Definition at line 276 of file SoVRLdmFileWriter.h.

◆ isRGBA

SoSFBool SoVRLdmFileWriter::isRGBA

true if RGBA mode (output will be unsigned int32 RGBA values).

Default is FALSE.

Definition at line 196 of file SoVRLdmFileWriter.h.

◆ lowResAlgorithm

SoSFInt32 SoVRLdmFileWriter::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).

Definition at line 180 of file SoVRLdmFileWriter.h.

◆ originalFilename

SoSFString SoVRLdmFileWriter::originalFilename

Filename of original file.

Empty by default. Needed if you want to keep an "history" of file.

Definition at line 165 of file SoVRLdmFileWriter.h.

◆ saveAsBitSet

SoSFBool SoVRLdmFileWriter::saveAsBitSet

Save the data as a bitSet (8 values per byte).

You should specified the bitSetThreashold if you use this feature. Default is FALSE.

Definition at line 184 of file SoVRLdmFileWriter.h.

◆ tileDimension

SoSFVec3i32 SoVRLdmFileWriter::tileDimension

Tile dimension.

Default is (128, 128, 128).

Definition at line 168 of file SoVRLdmFileWriter.h.

◆ undefinedValue

SoSFDouble SoVRLdmFileWriter::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 by SoHeightFieldRender (vertices with undefined values are not rendered).

Definition at line 224 of file SoVRLdmFileWriter.h.

◆ verbose

SoSFBool SoVRLdmFileWriter::verbose

verbose.

Default is TRUE.

Definition at line 263 of file SoVRLdmFileWriter.h.


The documentation for this class was generated from the following file: