Package com.openinventor.ldm
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:
- Instantiate this class by passing the data type to the constructor.
- Pass the values by calling the method
addValues()
multiple times. - Get the results using methods
getHistoSize()
,getHistogram()
,getNumValues()
,getValue()
, getMinValue,getMaxValue()
,getNumSignificantBits()
. - Delete the object.
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 withsetInputValueRange
.
- See Also:
SoDataSet
-
-
Nested Class Summary
-
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
-
-
Constructor Summary
Constructors Constructor Description SoVolumeHistogram(SbDataType dataType)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addValues(SoBufferObject values, int numValues)
Add to the histogram a 1D array of values.void
addValues(SoBufferObject values, SbVec3i32 arrayDim)
Add to the histogram a 3D array of values.void
addValues(SoBufferObject values, SbVec3i32 arrayDim, SbBox3i32 range)
Add to the histogram the values in the specified range inside the given array.static double[]
computeMinMax(SoBufferObject valuesBuffer, SbDataType dataType, SbVec3i32 arrayDim, SbBox3i32 range)
Compute min max.static double[]
computeMinMaxWithUndefined(SoBufferObject valuesBuffer, double undefinedValue, SbDataType dataType, SbVec3i32 arrayDim, SbBox3i32 range)
Compute min max.java.nio.LongBuffer
getDirectHistogram()
Returns a 64 bit integer pointer to the histogram data, the size of the histogram array isgetHistoSize()
.long[]
getHistogram()
Returns a 64 bit integer pointer to the histogram data, the size of the histogram array isgetHistoSize()
.long
getHistoSize()
Returns the size of the histogram .double
getMax()
Returns the max value of the dataset according to the specified data type .long
getMaxValue()
Returns the max value of the dataset for integer data types .double
getMaxValueD()
Returns the max value of the dataset for floating data types .double
getMin()
Returns the max value of the dataset according to the specified data type .long
getMinValue()
Returns the min value of the dataset for integer data types .double
getMinValueD()
Returns the min value of the dataset for floating data types .int
getNumSignificantBits()
Returns the number of significant bits for the dataset, only relevant for integer data types .long
getNumValues(long entry)
Returns the histogram value corresponding to the entry.double
getUndefinedValue()
return the current undefined value.long
getValue(long entry)
Returns the value corresponding to the entry for integer data types.double
getValueD(long entry)
Returns the value corresponding to the entry for floating data types.void
set(java.util.Collection<java.lang.Long> histo)
Set the histogram.void
set(java.util.Collection<java.lang.Long> histo, java.util.Collection<java.lang.Double> values)
Set the histogram.void
setInputValueRange(double rangeMin, double rangeMax)
For floating data type, specifies the range the histogram has to be computed in.void
setUndefinedValue(double undefinedValue)
Setup the undefined value to ignore when computing the histogram.void
setValue(SoVolumeHistogram copyFrom)
-
Methods inherited from class com.openinventor.inventor.Inventor
dispose, getNativeResourceHandle
-
-
-
-
Constructor Detail
-
SoVolumeHistogram
public SoVolumeHistogram(SbDataType dataType)
Constructor.
-
-
Method Detail
-
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 toaddValues()
. 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 java.nio.LongBuffer getDirectHistogram()
Returns a 64 bit integer pointer to the histogram data, the size of the histogram array isgetHistoSize()
.
-
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 isgetHistoSize()
.
-
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(java.util.Collection<java.lang.Long> histo, java.util.Collection<java.lang.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 togetHistogram()
[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(java.util.Collection<java.lang.Long> histo)
Set the histogram. Useful to get back scalar parameters such as min/max values and number of significant bits
-
-