Class SoConverter
- java.lang.Object
-
- com.openinventor.inventor.Inventor
-
- com.openinventor.ldm.converters.SoConverter
-
- Direct Known Subclasses:
SoBaseLDMConverter
public class SoConverter extends Inventor
Abstract base class for converting data sets into LDM format. This is the abstract base class for classes that convert existing data sets into the LDM (Large Data Management) format.SoConverter
provides powerful features including:- Command line parsing for easy creation of stand-alone converter programs.
- Checkpoint and restart for interrupted conversions.
- Multiple subsampling algorithms for creating low resolution tiles.
- Automatic loading of any supported data format (see
SoVolumeData
). - Conversion of any data format by providing a custom reader (see
SoVolumeReader
). - Special handling to minimize disk space for "thin volumes" where one dimension is smaller than the tile size. (Currently only implemented for Z dimension.)
- Optional data compression to reduce disk space.
- Optional data type conversion, e.g. float to byte.
Information common to all converter classes is included here including command line, incomplete conversion, compression and subsampling. Normally you will use, for example, the derived class
SoVolumeConverter
to convert volume data. You can also subclass fromSoVolumeConverter
to use a custom volume reader, provide a custom subsampling method, etc.Command Line
When used as a command line application the string should have the following form:
inputFilename [-t tiledim] [-o filename] [-O [filename]] [-m memsize] [-h] [-w B|L] [-f u8|u16|u32|s8|s16|s32|f [-r min max]] [-q] [-D] [-P portnum] [-c type] [-l level] [-C] [-s [0..N]] [-u value] [-verticalFlip]
where:
- gzip:
This is a lossless compression and can be used on any type of data. SeeSoGzipDataCompressor
. - jpeg:
This is a lossy compression. SeeSoJpegDataCompressor
.
Limitation: Can only be used on 8-bit scalar data sets. - gzip:
Lossless compression. Level must be between 0 and 9: 0 gives no compression, 9 gives best compression but slower speed. Default is 3. - jpeg:
Lossy compression. Level 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. - 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. If not specified, by default the decimation algorithm is used (n=0).
-t tiledim Dimension of tiles. Must be a power of two. Default is 128, meaning 128x128x128. -b bordersize DEPRECATED Since OIV9.0, this parameter will be ignored. -o filename Name of created XML header ldm file. Default is inputFilename with extension .ldm. -O filename Name of the file containing the data. If filename is omitted, the default filename is the same as the output filename specified by the -o option, with extension .dat instead. -m memsize Maximum size of memory to use in MB. Default is 512 MB. -h Output the header only. -w wordfmt Indicates the target machine word format is Big Endian (B) or Little Endian (L). Default is the current machine word format. -f datafmt Indicates the output data format with * = 8,16,32. u*:unsigned integer, s*:signed integer, f:float. If the output data format is float, the values are mapped to the range [0-1]. Default is the input data format. -r min max Indicates the input data range to map to the new data format specified by the -f option. If not specified, and input type is float and ouput type is integer, the values are simply cast into the output data type. -q Quiet mode. -c type Type of compression used. See also "-l level". By default the following compression types are available: -l level Level of compression used. See also "-c type". The meaning of this parameter depends on the type of compression used: -C Data integrity check. When compression is enabled using -c, 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. -s 0..n Specifies the algorithm used to build low resolution tiles. Available options are : -u value Undefined value. The given value will marked as undefined in the LDM file. This is currently used by SoHeightFieldRender
(vertices with undefined values are not rendered).-rgba Specifies that output will be unsigned int32 RGBA values. -noHistogram Disable histogram computation (conversion will be faster). -B value Define threshold value to generate a bitset dataset.
Any value in the dataset less than or equal to the threshold will generate a zero bit. Values greater than threshold will generate a one bit.-verticalFlip Flip the output on Y axis. The return value may be one of the following:
CVT_FINISHED_WITH_WARNINGS Some warnings occured but task complete CVT_NO_ERROR No problem, task complete CVT_INPUT_PARAMS_PROBLEM Input parameters problem: input filename missing, bad parameter value, or invalid option CVT_FILE_EXT_UNKNOWN Unknown file type (file extension) CVT_CANT_OPEN_INPUT_FILE Could not open input file (does not exist) CVT_CANT_CREATE_DATA_FILE Could not create data file CVT_CANT_CREATE_HEADER_FILE Could not create header file CVT_NOT_ENOUGH_DISK_SPACE Could not allocate disk space for the data file CVT_ABORTED Conversion has been aborted by the application, task not complete CVT_NO_NODE Distributed converter cannot be used as the license does not allow any client node CVT_NO_LDM_LICENSE No LDM license Incomplete Conversion
The converter saves the progress of the conversion in case the user wishes to abort or start visualizing the converted data or if the program crashes for any reason. In this case, the LDM files (header and data) are coupled with a completion file (name of the header file with an extension of .fcp). When restarting the converter, if the header file points to a .fcp file (XML tag <completionFilename>), the conversion will restart where it previously ended. When visualizing an incompletely converted file, it is possible to know where data actually exists by turning on the topology outlines (see
SoVolumeRendering
). Red outlines indicate actual data.In order to restart an incomplete conversion, the header file must be in synch with the completion file. For this reason when writing the pair of header/completion files, the converter first backs up the pair of files before overwriting them (.ldm and .fcp with .bck extension). If the header file is lost or its size is less than the size of the backed up header file, then you can rename the backed up completion and header files to restart the conversion.
EXAMPLE A basic command line converter program would look like this:
public class Main { public static void main(String[] args) { // Create parameter object from command line args SoConverterParameters parameters = SoConverterParameters.create( args ); // Start converter SoVolumeConverter converter = new SoVolumeConverter(); int result = converter.convert( parameters ); } } EXAMPLE You can also invoke the converter from an application by creating an instance of
SoConverterParameters
and setting the desired parameters. For example to convert an input file (in a format supported by VolumeViz) to LDM format with compression enabled:// Create parameter object with input file and desired options SoConverterParameters parameters = new SoConverterParameters(); parameters.setInputFileName( "filename.sgy" ); parameters.setTileDim( 128 ); // Start converter SoVolumeConverter converter = new SoVolumeConverter(); int result = converter.convert( parameters );
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SoConverter.ConverterErrors
Converter errors.-
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 Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
convert()
Calls convert((com.openinventor.ldm.converters.SoConverterParameters)null).int
convert(SoConverterParameters parameters)
Main converter function.SoConverter.ConverterErrors
convert(java.lang.String[] argv)
Deprecated.As of Open Inventor 9.0.0.0.-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Method Detail
-
convert
public int convert()
Calls convert((com.openinventor.ldm.converters.SoConverterParameters)null).
-
convert
@Deprecated(since="9.0.0.0") public SoConverter.ConverterErrors convert(java.lang.String[] argv)
Deprecated.As of Open Inventor 9.0.0.0. Use convert( SoConverterParameters* parameters = NULL) instead.Warning Deprecated since Open Inventor 9000. Use convert( SoConverterParameters* parameters = NULL) instead.
-
convert
public int convert(SoConverterParameters parameters)
Main converter function.
Call this method to launch the converter. Conversion parameters may be specified using an instance ofSoConverterParameters
. Returns 0 if conversion was successful, else returns one of the CVT_ error codes above.
-
-