Class SoConverterParameters


  • public class SoConverterParameters
    extends Inventor
    Container class for LDM converter parameters. This class provides a convenient way to specify parameters for the LDM converter.

    See Also:
    SoConverter
    • Constructor Detail

      • SoConverterParameters

        public SoConverterParameters()
        Default constructor.
    • Method Detail

      • create

        @Deprecated
        public static SoConverterParameters create​(int argc,
                                                   java.lang.String[] argv)
        Deprecated.
        As of Open Inventor 9.3, use create(String[]) instead.
        Static method to build a parameters container from command line arguments.
        The method returns NULL if an error is detected in the arguments. Otherwise, it returns a pointer to an instance of the class, initialized with given parameters. See SoConverter.converter for a list of command line arguments.
      • saveAsBitSet

        public void saveAsBitSet​(boolean flag)
        Calls saveAsBitSet(flag, (double)0).
      • getBitSetThreshold

        public double getBitSetThreshold()
        Returns the bitset generation threshold value.
      • setTileDim

        public void setTileDim​(int tileDim)
        Set tile dimension.
        Like the -t command line argument. The default is 64 and the value must be a power of 2. The same value is used for all dimensions of the tile.
      • setBitSetThreshold

        public void setBitSetThreshold​(double bitsetThreshold)
        Set the bitset threshold value.
        Whichever was called last, saveAsBitSet or this method, determines the threshold value that will be used.

        Parameters:
        bitsetThreshold - 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.
      • setTileDim

        public void setTileDim​(SbVec3i32 tileDim)
        Set tile dimension.
        The default value is 128,128,128 and all values must a power of 2. This method can be used to set a different value for each tile dimension, for example for a "thin volume" or height field.
      • getTileDim

        public SbVec3i32 getTileDim()
        Returns tile dimension.
      • isSavedAsBitSet

        public boolean isSavedAsBitSet()
        Returns true if output will be saved as a bitset (ie: 8 values per byte)
      • getHeaderFileName

        public java.lang.String getHeaderFileName()
        Returns header filename.
      • saveAsBitSet

        public void saveAsBitSet​(boolean flag,
                                 double bitsetThreshold)
        Specify if dataset should be saved as a bitset (8 values per byte) or values.

        Parameters:
        flag - Dataset is a bitset (true) or values (false)

        bitsetThreshold - For each value (V) of a dataset, if V > bitsetThreshold the bitset is set to 1 for this bit, or to 0 otherwise. Used only if flag parameter is set to true. Default is 0.
      • setHeaderFileName

        public void setHeaderFileName​(java.lang.String headerFileName)
        Set header filename (i.e. the .ldm filename).
        Like the -o command line argument. Default is input filename with extension .ldm.
      • isVerticalFlip

        public boolean isVerticalFlip()
        Return if m_bVerticalFlip flag is set.
      • getCompressionLevel

        public int getCompressionLevel()
      • create

        public static SoConverterParameters create​(java.lang.String[] argv)
        Static method to build a parameters container from command line arguments.
        The method returns NULL if an error is detected in the arguments. Otherwise, it returns a pointer to an instance of the class, initialized with given parameters. See SoConverter.converter for a list of command line arguments.
      • setVerticalFlip

        public void setVerticalFlip​(boolean flag)
        Set the m_bVerticalFlip flag.
      • isVerbose

        public boolean isVerbose()
        Returns verbose mode setting.
      • doUpdate

        public void doUpdate​(boolean value)
        Only applies to input files in LDM format. If true the converter must just perform an update of the given file. This means that if no options are specified, the converter will retrieve information from the input file and apply its properties automatically to the generated file.
      • setVerbose

        public void setVerbose​(boolean isVerbose)
        Set verbose mode. Default value is Off.
      • isForUpdate

        public boolean isForUpdate()
        Return true if converter is configured to perform a simple update. Return false otherwise
      • useDefaultCompLvl

        public boolean useDefaultCompLvl()
      • setOutputDataFormat

        public boolean setOutputDataFormat​(java.lang.String dataFormat)
        Set the output data format from a format string.
        Like the -f command line argument. The format is specified as "u*" for unsigned integer, "s*" for signed integer or "f" for float, where * = 8, 16 or 32. Default is no conversion. Returns true if parameter is valid, else returns false.

        Note that if the input reader does not support the requested conversion, the output data format will be the same as the input data format (no conversion).

      • isCrcCheckDone

        public boolean isCrcCheckDone()
      • setOutputDataFormat

        public boolean setOutputDataFormat​(SoDataSet.DataTypes dataType)
        Set the output data format with an SoDataSet.DataType.
        Note that if the input reader does not support the requested conversion, the output data format will be the same as the input data format (no conversion) Returns true if parameter is valid, else returns false.
      • setLowResAlgorithm

        public boolean setLowResAlgorithm​(int lowResAlgorithm)
        Set the algorithm used to build low resolution tiles.
        Available options are :
        • 0: To use decimation algorithm
        • n: To use average algorithm and give a ponderation coefficient of n to the selected voxel. The default is Decimation. Returns true if parameter is valid, else returns false.
      • setOutputHeaderOnly

        public void setOutputHeaderOnly​(boolean headerOnly)
        Set the header only feature.
        Like the -h command line argument. If set, the converter will only write the header file. No data will be generated. Default value is Off.
      • getPondCoef

        public int getPondCoef()
        Retrieve the ponderation coefficient for low resolution tiles.
        Only relevant when low resolution algorithm is set to AVERAGE.
      • getOutputHeaderOnly

        public boolean getOutputHeaderOnly()
        Returns header only setting.
      • getInputRangeMinMax

        public double[] getInputRangeMinMax()
        Returns input data range.
      • setCrcCheck

        public void setCrcCheck​(boolean addCrcCheck)
        Set CRC32 check on compression.
        Like -C command line argument. 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. Default is false.
      • setCompressionName

        public boolean setCompressionName​(java.lang.String compressionName)
        Set compression name.
        Like the -c command line argument. See also setCompressionLevel(). The following compression types are currently supported:.
        • gzip:
          This is a lossless compression and can be used on any type of data. See SoGzipDataCompressor.
        • jpeg:
          This is a lossy compression. See SoJpegDataCompressor.
          Limitation: Can only be used on 8-bit scalar data sets.
        • jp3d:
          This is a wavelet compression that can be lossless or lossy. See SoJp3dDataCompressor.
          Limitation: 32 bit data values (float or integer) are always converted to 16 bit values.

        Returns true if parameter is valid, else returns false.

      • setCompressionLevel

        public void setCompressionLevel​(int compressionLevel)
        Set compression level.
        Like the -l command line argument. See also setCompressionName(). The meaning of this parameter depends on the type of compression used:
        • gzip
          Level must be between 0 and 9: 0 gives no compression, 9 gives best compression but slower speed. Default is 3.
        • jpeg:
          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.
        • jp3d:
          A level of 0 specifies the lossless mode, and any other value sets the target PSNR (Peak Signal to Noise Ratio). Typical values for PSNR are: 70dB for near lossless mode, and 40dB for visually lossless mode.
      • setInputRangeMinMax

        public boolean setInputRangeMinMax​(double min,
                                           double max)
        Set the input data range to map to the output data format.
        Like the -r command line argument. If not specified, and input type is float and output type is integer, the values are simply cast into the output data type. Returns true if parameter is valid, else returns false.
      • setTargetWordFormat

        public boolean setTargetWordFormat​(int wordFormat)
        Set the target machine word format.
        Like the -w command line argument. Default is the current machine word format. wordFormat parameter is 0 for Big Endian, and 1 for Little Endian. Returns true if parameter is valid, else returns false.
      • getOutputDataFormat

        public SoDataSet.DataTypes getOutputDataFormat()
        Returns the output data format.
      • getCompressionName

        public java.lang.String getCompressionName()
        Returns compression type.
      • getTargetWordFormat

        public int getTargetWordFormat()
        Returns word format property.
      • setRGBAMode

        public void setRGBAMode​(boolean flag)
        Set RGBA data mode (output will be unsigned int32 RGBA values).
      • getDataFileName

        public java.lang.String getDataFileName()
        Returns the complete data filename (i.e. : the whole path to .dat file).
      • isInputDataRangeSpecified

        public boolean isInputDataRangeSpecified()
        Return whether or not the input data range has been specified.
      • setInputFileName

        public void setInputFileName​(java.lang.String inputFileName)
        Set the input filename. This is the file containing data to convert. Alternative to setInputVolume(). An input file must be specified. To get more information regarding possible limitation of any readers you may use, please see documentation of Readers.
      • isRGBAMode

        public boolean isRGBAMode()
        Returns true if RGBA mode.
      • setDataFileName

        public void setDataFileName​(java.lang.String dataFileName)
        Set data filename (i.e. the .dat filename).
        Like the -O command line argument. Default is the same as the header file, with .dat extension.
      • isHistogramEnabled

        public boolean isHistogramEnabled()
        Returns true if histogram will be computed.
      • getDataSectionFileName

        public java.lang.String getDataSectionFileName()
        Returns the data filename.
      • enableHistogram

        public void enableHistogram​(boolean flag)
        Specify if the histogram must be computed or not. Default is true.

        Disabling Histogram generation will greatly speedup the conversion process, but some VolumeViz rendering features and optimizations won't be available.

        It also implies that the following information won't be computed:

        • dataset min and max values
        • per Tile min max values

        Note also that if RGBA mode is set then no histogram is computed.

      • setMaxMemory

        public boolean setMaxMemory​(int maxMemory)
        Set maximum memory available for the converter, in MB.
        Like the -m command line argument. Default value is 512 MB. Returns true if parameter is valid, else returns false.
      • getUndefinedValue

        public double getUndefinedValue()
        Returns the undefined value.
      • getMaxMemory

        public int getMaxMemory()
        Returns max memory available for converter.
      • setUndefinedValue

        public void setUndefinedValue​(double undefinedValue)
        Set the undefined value.
        Like the -u command line argument. 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).
      • getInputVolume

        public SoDataSet getInputVolume()
        Returns the the volume used as input.
      • isOutputDataTypeSpecified

        public boolean isOutputDataTypeSpecified()
        Return whether or not the output data type has been specified.
      • getInputFileName

        public java.lang.String getInputFileName()
        Returns input filename.
      • getNbArgs

        public int getNbArgs()
        Returns the number of arguments set during init.
      • setInputVolume

        public void setInputVolume​(SoDataSet inputVolume)
        Define the volume used as input. Allows to convert in-memory data to a LDM file. Alternative to setInputFileName().