Class SoVolumeHistogram

java.lang.Object
com.openinventor.inventor.Inventor
com.openinventor.ldm.SoVolumeHistogram

public class SoVolumeHistogram extends Inventor
Volume Data Histogram. This class allows building a histogram from a dataset or a portion of a dataset.

To implement the histogram computation, follow the steps below:

SoVolumeHistogram has different behavior depending on the datatype:

  • For integer data types:
    • If sizeof(dataType) == 1, histogram will have 256 bins with a bin width of 1.
    • Else, histogram will have 65536 bins with a bin width of (Datatype_max - DataType_min) / 65536.
  • For floating types:
    The Histogram will have 65536 bins with a bin width of (rangeMax - rangeMin) / 65536, where rangeMin and rangeMax are specified with setInputValueRange.

See Also:
  • Constructor Details

    • SoVolumeHistogram

      public SoVolumeHistogram(SbDataType dataType)
      Constructor.
  • Method Details

    • computeMinMaxWithUndefined

      public static double[] computeMinMaxWithUndefined(SoBufferObject valuesBuffer, double undefinedValue, SbDataType dataType, SbVec3i32 arrayDim, SbBox3i32 range)
      Compute min max.

      Parameters:
      valuesBuffer - Input buffer of values.

      undefinedValue - Discarded value in the computation of min and max.

      dataType - Type of datas stored in valuesBuffer.

      arrayDim - Dimensions of valuesBuffer.

      range - Box in which min and max values are computed.

      min - Computed minimum value.

      max - Computed maximum value.
    • getMinValueD

      public double getMinValueD()
      Returns the min value of the dataset for floating data types .
    • getValue

      public long getValue(long entry)
      Returns the value corresponding to the entry for integer data types.
    • getMinValue

      public long getMinValue()
      Returns the min value of the dataset for integer data types .
    • setValue

      public void setValue(SoVolumeHistogram copyFrom)
    • setInputValueRange

      public void setInputValueRange(double rangeMin, double rangeMax)
      For floating data type, specifies the range the histogram has to be computed in. Must be called before any call to addValues(). Default values are -20000. 20000.
    • getValueD

      public double getValueD(long entry)
      Returns the value corresponding to the entry for floating data types.
    • getMaxValue

      public long getMaxValue()
      Returns the max value of the dataset for integer data types .
    • setUndefinedValue

      public void setUndefinedValue(double undefinedValue)
      Setup the undefined value to ignore when computing the histogram.
    • addValues

      public void addValues(SoBufferObject values, int numValues)
      Add to the histogram a 1D array of values. NOTES: this API is limited to INT_MAX numValues to handle.
    • getMax

      public double getMax()
      Returns the max value of the dataset according to the specified data type .
    • addValues

      public void addValues(SoBufferObject values, SbVec3i32 arrayDim)
      Add to the histogram a 3D array of values.
    • getDirectHistogram

      public LongBuffer getDirectHistogram()
      Returns a 64 bit integer pointer to the histogram data, the size of the histogram array is getHistoSize() .
    • getMin

      public double getMin()
      Returns the max value of the dataset according to the specified data type .
    • getHistogram

      public long[] getHistogram()
      Returns a 64 bit integer pointer to the histogram data, the size of the histogram array is getHistoSize() .
    • getNumSignificantBits

      public int getNumSignificantBits()
      Returns the number of significant bits for the dataset, only relevant for integer data types .
    • getHistoSize

      public long getHistoSize()
      Returns the size of the histogram .
    • set

      public void set(Collection<Long> histo, Collection<Double> values)
      Set the histogram. Useful to get back scalar parameters such as min/max values and number of significant bits
    • getNumValues

      public long getNumValues(long entry)
      Returns the histogram value corresponding to the entry. Equivalent to getHistogram()[entry]
    • computeMinMax

      public static double[] computeMinMax(SoBufferObject valuesBuffer, SbDataType dataType, SbVec3i32 arrayDim, SbBox3i32 range)
      Compute min max.

      Parameters:
      valuesBuffer - Input buffer of values.

      dataType - Type of datas stored in valuesBuffer.

      arrayDim - Dimensions of valuesBuffer.

      range - Box in which min and max values are computed.

      min - Computed minimum value.

      max - Computed maximum value.
    • getUndefinedValue

      public double getUndefinedValue()
      return the current undefined value.
    • addValues

      public void addValues(SoBufferObject values, SbVec3i32 arrayDim, SbBox3i32 range)
      Add to the histogram the values in the specified range inside the given array.
    • getMaxValueD

      public double getMaxValueD()
      Returns the max value of the dataset for floating data types .
    • set

      public void set(Collection<Long> histo)
      Set the histogram. Useful to get back scalar parameters such as min/max values and number of significant bits