public class NaiveHistogram3D extends java.lang.Object implements Histogram3D
int value
per counter at construction time.
This means that a histogram with 8 bits for each channel will have
28 + 8 + 8 = 224 = 16,777,216 int values,
making it 64 MB large.| Modifier and Type | Field and Description |
|---|---|
private int[][][] |
data |
private int[] |
values |
| Constructor and Description |
|---|
NaiveHistogram3D(int numValues)
Creates a histogram with the same number of values for all three dimensions.
|
NaiveHistogram3D(int numValuesLevel1,
int numValuesLevel2,
int numValuesLevel3)
Creates a histogram
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Sets all counters to zero.
|
int |
getEntry(int index1,
int index2,
int index3)
Returns the counter value of (index1, index2, index3).
|
int |
getMaxValue(int index)
Returns the maximum index value for one of the three indexes.
|
int |
getNumUsedEntries()
Returns the number of used entries (those entries with
a counter value larger than zero).
|
void |
increaseEntry(int index1,
int index2,
int index3)
Increases the counter value of (index1, index2, index3) by one.
|
void |
setEntry(int index1,
int index2,
int index3,
int newValue)
Sets the counter value of (index1, index2, index3) to newValue.
|
public NaiveHistogram3D(int numValuesLevel1,
int numValuesLevel2,
int numValuesLevel3)
throws java.lang.IllegalArgumentException,
java.lang.OutOfMemoryError
java.lang.IllegalArgumentExceptionjava.lang.OutOfMemoryErrorpublic NaiveHistogram3D(int numValues)
throws java.lang.IllegalArgumentException,
java.lang.OutOfMemoryError
(int, int, int), repeating numValues
three times.numValues - the number of levels for all three dimensionsjava.lang.IllegalArgumentExceptionjava.lang.OutOfMemoryErrorpublic void clear()
clear in interface Histogram3Dpublic int getEntry(int index1,
int index2,
int index3)
throws java.lang.IllegalArgumentException
getEntry in interface Histogram3Dindex1 - first of the three values forming the threedimensional indexindex2 - second of the three values forming the threedimensional indexindex3 - three of the three values forming the threedimensional indexjava.lang.IllegalArgumentException - could be (read: need not necessarily) be
thrown if the index formed by the arguments is invalidpublic int getMaxValue(int index)
throws java.lang.IllegalArgumentException
Histogram3DgetMaxValue in interface Histogram3Djava.lang.IllegalArgumentException - if the index formed by the arguments is invalidpublic int getNumUsedEntries()
getNumUsedEntries in interface Histogram3Dpublic void increaseEntry(int index1,
int index2,
int index3)
throws java.lang.IllegalArgumentException
setEntry(index1, index2, index3, getEntry(index1, index2, index3) + 1);
However, this method is expected to be faster in some contexts.increaseEntry in interface Histogram3Dindex1 - first of the three values forming the threedimensional indexindex2 - second of the three values forming the threedimensional indexindex3 - three of the three values forming the threedimensional indexjava.lang.IllegalArgumentException - could be (read: need not necessarily) be
thrown if the index formed by the arguments is invalidpublic void setEntry(int index1,
int index2,
int index3,
int newValue)
throws java.lang.IllegalArgumentException
setEntry in interface Histogram3Dindex1 - first of the three values forming the threedimensional indexindex2 - second of the three values forming the threedimensional indexindex3 - three of the three values forming the threedimensional indexnewValue - the counter value that is assigned to the argument indexjava.lang.IllegalArgumentException - could be (read: need not necessarily) be
thrown if the index formed by the first three arguments is invalid