Class HistogramNd<T>
- java.lang.Object
-
- net.imglib2.histogram.HistogramNd<T>
-
- All Implemented Interfaces:
java.lang.Iterable<LongType>,Dimensions,EuclideanSpace,Img<LongType>,Interval,IterableInterval<LongType>,IterableRealInterval<LongType>,RandomAccessible<LongType>,RandomAccessibleInterval<LongType>,RealInterval,Typed<LongType>
public class HistogramNd<T> extends java.lang.Object implements Img<LongType>
A HistogramNd is an n-dimensional histogram that tracks up to four kinds of values: 1) values in the center of the distribution 2) values to the left of the center of the distribution (lower tail) 3) values to the right of the center of the distribution (upper tail) 4) values outside the other areasNote: the last three classifications may not be present depending upon the makeup of the input data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static interfaceHistogramNd.Counterprivate classHistogramNd.Decrementerprivate classHistogramNd.Incrementer
-
Field Summary
Fields Modifier and Type Field Description private HistogramNd.Decrementerdecrementerprivate DiscreteFrequencyDistributiondistribprivate longignoredCountprivate HistogramNd.Incrementerincrementerprivate java.util.List<BinMapper1d<T>>mappersprivate long[]pos
-
Constructor Summary
Constructors Constructor Description HistogramNd(java.lang.Iterable<java.util.List<T>> data, java.util.List<BinMapper1d<T>> mappers)Construct a histogram from an iterable set of data and a list of bin mapping algorithms.HistogramNd(java.util.List<java.lang.Iterable<T>> data, java.util.List<BinMapper1d<T>> mappers)Construct a histogram from an iterable set of data and a list of bin mapping algorithms.HistogramNd(java.util.List<BinMapper1d<T>> mappers)Construct a histogram from a list of bin mapping algorithms.HistogramNd(HistogramNd<T> other)Construct a histogram whose bin mappings match another histogram.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidadd(java.lang.Iterable<java.util.List<T>> data)private voidadd(java.util.List<java.lang.Iterable<T>> data)voidaddData(java.lang.Iterable<java.util.List<T>> data)Counts additional data contained in a given iterable collection.voidaddData(java.util.List<java.lang.Iterable<T>> data)Counts additional data contained in a given iterable collection.HistogramNd<T>copy()private voidcount(java.util.List<T> values, HistogramNd.Counter counter)voidcountData(java.lang.Iterable<java.util.List<T>> data)Counts the data contained in the given data source using the underlying bin distribution.voidcountData(java.util.List<java.lang.Iterable<T>> data)Counts the data contained in the given data source using the underlying bin distribution.Cursor<LongType>cursor()Returns aRealCursorthat iterates with optimal speed without calculating the location at each iteration step.voiddecrement(long[] binPos)Directly decrement a bin by position.voiddecrement(java.util.List<T> values)Directly decrement a bin by value,DiscreteFrequencyDistributiondfd()Get the discrete frequency distribution associated with this histogram.longdimension(int d)Return the size of the given dimension of the frequency distribution of this histogram.voiddimensions(long[] dims)Fill the provided long[] with the sizes of all dimensions of the frequency distribution of this histogram.longdistributionCount()Returns the frequency count of all values in the distribution: lower tail + middle + upper tail.longdistributionCount(int dim, long dimVal)Returns the frequency count of all values in the specified dimension of the distribution: lower tail + middle + upper tail.ImgFactory<LongType>factory()Get aImgFactorythat createsImgs of the same kind as this one.LongTypefirstElement()Get the first element of thisIterableRealInterval.longfrequency(long[] binPos)Returns the frequency count of the values within a bin.longfrequency(java.util.List<T> values)Returns the frequency count of values within a bin using a set of representative values.longgetBinCount()Returns the number of bins contained in the histogram.voidgetCenterValues(long[] binPos, java.util.List<T> values)Gets the values associated with the center of a bin.voidgetLowerBounds(long[] binPos, java.util.List<T> values)Gets the values associated with the left edge of a bin.LongTypegetType()Get an instance ofT.voidgetUpperBounds(long[] binPos, java.util.List<T> values)Gets the values associated with the right edge of a bin.booleanhasTails()Returns true if the histogram has tail bins which count extreme values for one or more dimensionsbooleanhasTails(int dim)Returns true if the histogram has tail bins which count extreme values for the given dimension.longignoredCount()Returns the frequency count of values that were ignored because they could not be mapped to any bin.booleanincludesLowerBound(int dim, long binPos)Returns true if the given bin interval is closed on the left for the given dimension.booleanincludesLowerBounds(long[] binPos)Returns true if the given bin interval is closed on the leftbooleanincludesUpperBound(int dim, long binPos)Returns true if the given bin interval is closed on the right for the given dimension.booleanincludesUpperBounds(long[] binPos)Returns true if the given bin interval is closed on the rightvoidincrement(long[] binPos)Directly increment a bin by position.voidincrement(java.util.List<T> values)Directly increment a bin by value.private voidinit(java.lang.Iterable<java.util.List<T>> data)private voidinit(java.util.List<java.lang.Iterable<T>> data)booleanisInLowerTail(int dim, T value)Returns true if a given value for a given dimension is mapped to the lower tail of the distribution.booleanisInLowerTail(java.util.List<T> values)Returns true if a given set of values are mapped to the lower tail of the distribution.booleanisInMiddle(int dim, T value)Returns true if a given value for a given dimension is mapped to the middle of the distribution.booleanisInMiddle(java.util.List<T> values)Returns true if a given set of values are mapped to the middle of the distribution.booleanisInUpperTail(int dim, T value)Returns true if a given value for a given dimension is mapped to the upper tail of the distribution.booleanisInUpperTail(java.util.List<T> values)Returns true if a given set of values are mapped to the upper tail of the distribution.booleanisOutside(int dim, T value)Returns true if a given value for a given dimension is outside the distribution.booleanisOutside(java.util.List<T> values)Returns true if a given set of values are outside the distribution.java.lang.ObjectiterationOrder()Returns the iteration order of thisIterableRealInterval.java.util.Iterator<LongType>iterator()Cursor<LongType>localizingCursor()Returns aRealLocalizableIteratorthat calculates its location at each iteration step.longlowerTailCount()Returns the frequency count of values in all lower tail bins (if any).longlowerTailCount(int dim)Returns the frequency count of values in the lower tail bin (if any) for the given dimension.voidmap(java.util.List<T> values, long[] binPos)Fills a bin position by mapping from a set of representative values.longmax(int d)Get the maximum in dimension d.voidmax(long[] max)Write the maximum of each dimension into long[].voidmax(Positionable max)Sets aPositionableto the maximum of thisIntervallongmin(int d)Get the minimum in dimension d.voidmin(long[] min)Write the minimum of each dimension into long[].voidmin(Positionable min)Sets aPositionableto the minimum of thisIntervalprivate voidmodifyCounts(java.lang.Iterable<java.util.List<T>> data, HistogramNd.Counter counter)private voidmodifyCounts(java.util.List<java.lang.Iterable<T>> data, HistogramNd.Counter counter)intnumDimensions()Return the number of dimensions of the frequency distribution of this histogram.RandomAccess<LongType>randomAccess()Create a random access sampler for integer coordinates.RandomAccess<LongType>randomAccess(Interval interval)Create a random access sampler for integer coordinates.voidrealMax(double[] max)Write the maximum of each dimension into double[].doublerealMax(int d)Get the maximum in dimension d.voidrealMax(RealPositionable max)Sets aRealPositionableto the maximum of thisIntervalvoidrealMin(double[] min)Write the minimum of each dimension into double[].doublerealMin(int d)Get the minimum in dimension d.voidrealMin(RealPositionable min)Sets aRealPositionableto the minimum of thisIntervaldoublerelativeFrequency(long[] binPos, boolean includeTails)Returns the relative frequency of values within a bin.doublerelativeFrequency(java.util.List<T> values, boolean includeTails)Returns the relative frequency of values within a bin using a set of representative values.private voidreset()voidresetCounters()Resets all data counts to 0.longsize()Returns the number of elements in thisFunction.private voidsubtract(java.lang.Iterable<java.util.List<T>> data)private voidsubtract(java.util.List<java.lang.Iterable<T>> data)voidsubtractData(java.lang.Iterable<java.util.List<T>> data)Uncounts some original data contained in a given iterable collection.voidsubtractData(java.util.List<java.lang.Iterable<T>> data)Uncounts some original data contained in a given iterable collection.longtotalCount()Returns the total count of all values observed; both within and without the entire distribution.longupperTailCount()Returns the frequency count of values in all upper tail bins (if any).longupperTailCount(int dim)Returns the frequency count of values in the upper tail bin (if any) for the given dimension.longvalueCount()Returns the frequency count of all values in the middle of the distribution.longvalueCount(int dim)Returns the frequency count of all values in the middle of the distribution for a given dimension.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.imglib2.Dimensions
dimensions, dimensionsAsLongArray, dimensionsAsPoint
-
Methods inherited from interface net.imglib2.Interval
maxAsLongArray, maxAsPoint, minAsLongArray, minAsPoint
-
Methods inherited from interface net.imglib2.IterableInterval
localizingSpliterator, spliterator
-
Methods inherited from interface net.imglib2.IterableRealInterval
parallelStream, stream
-
Methods inherited from interface net.imglib2.RandomAccessible
getAt, getAt, getAt
-
Methods inherited from interface net.imglib2.RealInterval
maxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPoint
-
-
-
-
Field Detail
-
mappers
private java.util.List<BinMapper1d<T>> mappers
-
distrib
private DiscreteFrequencyDistribution distrib
-
pos
private long[] pos
-
ignoredCount
private long ignoredCount
-
incrementer
private final HistogramNd.Incrementer incrementer
-
decrementer
private final HistogramNd.Decrementer decrementer
-
-
Constructor Detail
-
HistogramNd
public HistogramNd(java.util.List<BinMapper1d<T>> mappers)
Construct a histogram from a list of bin mapping algorithms. Use countData() to populate it.- Parameters:
mappers- The algorithms used to map values to bins
-
HistogramNd
public HistogramNd(HistogramNd<T> other)
Construct a histogram whose bin mappings match another histogram. After this construction the histogram bins are unpopulated.- Parameters:
other- The histogram to copy.
-
HistogramNd
public HistogramNd(java.lang.Iterable<java.util.List<T>> data, java.util.List<BinMapper1d<T>> mappers)
Construct a histogram from an iterable set of data and a list of bin mapping algorithms. Must be given one iterable data source that returns multiple data values at each point.- Parameters:
data- The iterable set of values to calculate uponmappers- The algorithms used to map values to bins
-
HistogramNd
public HistogramNd(java.util.List<java.lang.Iterable<T>> data, java.util.List<BinMapper1d<T>> mappers)
Construct a histogram from an iterable set of data and a list of bin mapping algorithms. Must be given multiple iterable data sources that each return a single data value at each point.- Parameters:
data- The iterable set of values to calculate uponmappers- The algorithms used to map values to bins
-
-
Method Detail
-
hasTails
public boolean hasTails(int dim)
Returns true if the histogram has tail bins which count extreme values for the given dimension.
-
hasTails
public boolean hasTails()
Returns true if the histogram has tail bins which count extreme values for one or more dimensions
-
lowerTailCount
public long lowerTailCount(int dim)
Returns the frequency count of values in the lower tail bin (if any) for the given dimension.
-
lowerTailCount
public long lowerTailCount()
Returns the frequency count of values in all lower tail bins (if any).
-
upperTailCount
public long upperTailCount(int dim)
Returns the frequency count of values in the upper tail bin (if any) for the given dimension.
-
upperTailCount
public long upperTailCount()
Returns the frequency count of values in all upper tail bins (if any).
-
valueCount
public long valueCount(int dim)
Returns the frequency count of all values in the middle of the distribution for a given dimension.
-
valueCount
public long valueCount()
Returns the frequency count of all values in the middle of the distribution.
-
distributionCount
public long distributionCount(int dim, long dimVal)Returns the frequency count of all values in the specified dimension of the distribution: lower tail + middle + upper tail. Does not include ignored values.
-
distributionCount
public long distributionCount()
Returns the frequency count of all values in the distribution: lower tail + middle + upper tail. Does not include ignored values.
-
ignoredCount
public long ignoredCount()
Returns the frequency count of values that were ignored because they could not be mapped to any bin.
-
totalCount
public long totalCount()
Returns the total count of all values observed; both within and without the entire distribution. Thus it includes ignored values. One should decide carefully between using distributionCount() and totalCount().
-
frequency
public long frequency(java.util.List<T> values)
Returns the frequency count of values within a bin using a set of representative values. Note that multiple values can be mapped to one bin so this is NOT the frequency count of this exact set of values in the distribution.- Parameters:
values- A set of representative values of interest
-
frequency
public long frequency(long[] binPos)
Returns the frequency count of the values within a bin.
-
relativeFrequency
public double relativeFrequency(java.util.List<T> values, boolean includeTails)
Returns the relative frequency of values within a bin using a set of representative values. Note that multiple values can be mapped to one bin so this is NOT the relative frequency of this exact set of values in the distribution.This calculation is of the number of values in the bin divided by either the number of values in the distribution or the number of values in the center of the distribution (tails ignored).
One can devise other ways to count relative frequencies that consider ignored values also. If needed one can use the various count methods and frequency methods to calculate any relative frequency desired.
- Parameters:
values- A representative set of values of interestincludeTails- Flag for determining whether to include tails in calculation.
-
relativeFrequency
public double relativeFrequency(long[] binPos, boolean includeTails)Returns the relative frequency of values within a bin.This calculation is of the number of values in the bin divided by either the number of values in the distribution or the number of values in the center of the distribution (tails ignored).
One can devise other ways to count relative frequencies that consider ignored values also. If needed one can use the various count methods and frequency methods to calculate any relative frequency desired.
- Parameters:
binPos- The position of the bin of interestincludeTails- Flag for determining whether to include tails in calculation.
-
getBinCount
public long getBinCount()
Returns the number of bins contained in the histogram.
-
map
public void map(java.util.List<T> values, long[] binPos)
Fills a bin position by mapping from a set of representative values.
-
getCenterValues
public void getCenterValues(long[] binPos, java.util.List<T> values)Gets the values associated with the center of a bin.- Parameters:
binPos- The bin index of interestvalues- The outputs to fill with the center values
-
getLowerBounds
public void getLowerBounds(long[] binPos, java.util.List<T> values)Gets the values associated with the left edge of a bin.- Parameters:
binPos- The bin index of interestvalues- The outputs to fill with the left edge values
-
getUpperBounds
public void getUpperBounds(long[] binPos, java.util.List<T> values)Gets the values associated with the right edge of a bin.- Parameters:
binPos- The bin index of interestvalues- The outputs to fill with the right edge values
-
includesUpperBounds
public boolean includesUpperBounds(long[] binPos)
Returns true if the given bin interval is closed on the right- Parameters:
binPos- The bin number of the interval of interest
-
includesLowerBounds
public boolean includesLowerBounds(long[] binPos)
Returns true if the given bin interval is closed on the left- Parameters:
binPos- The bin number of the interval of interest
-
includesUpperBound
public boolean includesUpperBound(int dim, long binPos)Returns true if the given bin interval is closed on the right for the given dimension.- Parameters:
dim- The dimension of interestbinPos- The bin number of the interval of interest
-
includesLowerBound
public boolean includesLowerBound(int dim, long binPos)Returns true if the given bin interval is closed on the left for the given dimension.- Parameters:
dim- The dimension of interestbinPos- The bin number of the interval of interest
-
isInLowerTail
public boolean isInLowerTail(java.util.List<T> values)
Returns true if a given set of values are mapped to the lower tail of the distribution.- Parameters:
values- The set of values to determine the location of
-
isInLowerTail
public boolean isInLowerTail(int dim, T value)Returns true if a given value for a given dimension is mapped to the lower tail of the distribution.- Parameters:
dim- The dimension number of the axis of interestvalue- The value to determine the location of
-
isInUpperTail
public boolean isInUpperTail(java.util.List<T> values)
Returns true if a given set of values are mapped to the upper tail of the distribution.- Parameters:
values- The set of values to determine the location of
-
isInUpperTail
public boolean isInUpperTail(int dim, T value)Returns true if a given value for a given dimension is mapped to the upper tail of the distribution.- Parameters:
dim- The dimension number of the axis of interestvalue- The value to determine the location of
-
isInMiddle
public boolean isInMiddle(java.util.List<T> values)
Returns true if a given set of values are mapped to the middle of the distribution.- Parameters:
values- The set of values to determine the location of
-
isInMiddle
public boolean isInMiddle(int dim, T value)Returns true if a given value for a given dimension is mapped to the middle of the distribution.- Parameters:
dim- The dimension number of the axis of interestvalue- The value to determine the location of
-
isOutside
public boolean isOutside(java.util.List<T> values)
Returns true if a given set of values are outside the distribution.- Parameters:
values- The set of values to determine the location of
-
isOutside
public boolean isOutside(int dim, T value)Returns true if a given value for a given dimension is outside the distribution.- Parameters:
value- The value to determine the location of
-
dfd
public DiscreteFrequencyDistribution dfd()
Get the discrete frequency distribution associated with this histogram.
-
countData
public void countData(java.lang.Iterable<java.util.List<T>> data)
Counts the data contained in the given data source using the underlying bin distribution.- Parameters:
data- The total data to count
-
countData
public void countData(java.util.List<java.lang.Iterable<T>> data)
Counts the data contained in the given data source using the underlying bin distribution.- Parameters:
data- The total data to count
-
addData
public void addData(java.lang.Iterable<java.util.List<T>> data)
Counts additional data contained in a given iterable collection. One can use this to update an existing histogram with a subset of values.- Parameters:
data- The new data to count
-
addData
public void addData(java.util.List<java.lang.Iterable<T>> data)
Counts additional data contained in a given iterable collection. One can use this to update an existing histogram with a subset of values.- Parameters:
data- The new data to count
-
subtractData
public void subtractData(java.lang.Iterable<java.util.List<T>> data)
Uncounts some original data contained in a given iterable collection. One can use this to update an existing histogram with a subset of values.- Parameters:
data- The old data to uncount
-
subtractData
public void subtractData(java.util.List<java.lang.Iterable<T>> data)
Uncounts some original data contained in a given iterable collection. One can use this to update an existing histogram with a subset of values.- Parameters:
data- The old data to uncount
-
increment
public void increment(long[] binPos)
Directly increment a bin by position.- Parameters:
binPos- The 1-d index of the bin
-
decrement
public void decrement(long[] binPos)
Directly decrement a bin by position.- Parameters:
binPos- The 1-d index of the bin
-
increment
public void increment(java.util.List<T> values)
Directly increment a bin by value.- Parameters:
values- The values to map to a bin position
-
decrement
public void decrement(java.util.List<T> values)
Directly decrement a bin by value,- Parameters:
values- The values to map to a bin position
-
resetCounters
public void resetCounters()
Resets all data counts to 0.
-
numDimensions
public int numDimensions()
Return the number of dimensions of the frequency distribution of this histogram.- Specified by:
numDimensionsin interfaceEuclideanSpace
-
dimension
public long dimension(int d)
Return the size of the given dimension of the frequency distribution of this histogram.- Specified by:
dimensionin interfaceDimensions- Specified by:
dimensionin interfaceInterval
-
dimensions
public void dimensions(long[] dims)
Fill the provided long[] with the sizes of all dimensions of the frequency distribution of this histogram.- Specified by:
dimensionsin interfaceDimensions
-
randomAccess
public RandomAccess<LongType> randomAccess()
Description copied from interface:RandomAccessibleCreate a random access sampler for integer coordinates.The returned random access covers as much of the domain as possible.
Please note:RandomAccessibleIntervals have a finite domain (theirInterval), soRandomAccessible.randomAccess()is only guaranteed to cover this finite domain. This may lead to unexpected results when usingViews. In the following codeRandomAccessible<T> extended = Views.extendBorder( img ) RandomAccessibleInterval<T> cropped = Views.interval( extended, img ); RandomAccess<T> a1 = extended.randomAccess(); RandomAccess<T> a2 = cropped.randomAccess();
Theaccessa1on the extended image is valid everywhere. However, somewhat counter-intuitively, theaccessa2on the extended and cropped image is only valid on the intervalimgto which the extended image was cropped. The access is only required to cover this interval, because it is the domain of the cropped image.Viewsattempts to provide the fastest possible access that meets this requirement, and will therefore strip the extension. To deal with this, if you know that you need to access pixels outside the domain of theRandomAccessibleInterval, and you know that theRandomAccessibleIntervalis actually defined beyond its interval boundaries, then use theRandomAccessible.randomAccess(Interval)variant and specify which interval you actually want to access. In the above example,RandomAccess<T> a2 = cropped.randomAccess( Intervals.expand( img, 10 ) );
will provide the extended access as expected.- Specified by:
randomAccessin interfaceRandomAccessible<T>- Returns:
- random access sampler
-
randomAccess
public RandomAccess<LongType> randomAccess(Interval interval)
Description copied from interface:RandomAccessibleCreate a random access sampler for integer coordinates.The returned random access is intended to be used in the specified interval only. Thus, the RandomAccessible may provide optimized versions. If the interval is completely contained in the domain, the random access is guaranteed to provide the same values as that obtained by
RandomAccessible.randomAccess()within the interval.- Specified by:
randomAccessin interfaceRandomAccessible<T>- Parameters:
interval- in which interval you intend to use the random access.- Returns:
- random access sampler
-
min
public long min(int d)
Description copied from interface:IntervalGet the minimum in dimension d.
-
min
public void min(long[] min)
Description copied from interface:IntervalWrite the minimum of each dimension into long[].
-
min
public void min(Positionable min)
Description copied from interface:IntervalSets aPositionableto the minimum of thisInterval
-
max
public long max(int d)
Description copied from interface:IntervalGet the maximum in dimension d.
-
max
public void max(long[] max)
Description copied from interface:IntervalWrite the maximum of each dimension into long[].
-
max
public void max(Positionable max)
Description copied from interface:IntervalSets aPositionableto the maximum of thisInterval
-
realMin
public double realMin(int d)
Description copied from interface:RealIntervalGet the minimum in dimension d.- Specified by:
realMinin interfaceInterval- Specified by:
realMinin interfaceRealInterval- Parameters:
d- dimension- Returns:
- minimum in dimension d.
-
realMin
public void realMin(double[] min)
Description copied from interface:RealIntervalWrite the minimum of each dimension into double[].- Specified by:
realMinin interfaceRealInterval
-
realMin
public void realMin(RealPositionable min)
Description copied from interface:RealIntervalSets aRealPositionableto the minimum of thisInterval- Specified by:
realMinin interfaceRealInterval
-
realMax
public double realMax(int d)
Description copied from interface:RealIntervalGet the maximum in dimension d.- Specified by:
realMaxin interfaceInterval- Specified by:
realMaxin interfaceRealInterval- Parameters:
d- dimension- Returns:
- maximum in dimension d.
-
realMax
public void realMax(double[] max)
Description copied from interface:RealIntervalWrite the maximum of each dimension into double[].- Specified by:
realMaxin interfaceRealInterval
-
realMax
public void realMax(RealPositionable max)
Description copied from interface:RealIntervalSets aRealPositionableto the maximum of thisInterval- Specified by:
realMaxin interfaceRealInterval
-
cursor
public Cursor<LongType> cursor()
Description copied from interface:IterableRealIntervalReturns a
RealCursorthat iterates with optimal speed without calculating the location at each iteration step. Localization is performed on demand.Use this where localization is required rarely/ not for each iteration.
- Specified by:
cursorin interfaceIterableInterval<T>- Specified by:
cursorin interfaceIterableRealInterval<T>- Specified by:
cursorin interfaceRandomAccessibleInterval<T>- Returns:
- fast iterating iterator
-
localizingCursor
public Cursor<LongType> localizingCursor()
Description copied from interface:IterableRealIntervalReturns a
RealLocalizableIteratorthat calculates its location at each iteration step. That is, localization is performed with optimal speed.Use this where localization is required often/ for each iteration.
- Specified by:
localizingCursorin interfaceIterableInterval<T>- Specified by:
localizingCursorin interfaceIterableRealInterval<T>- Specified by:
localizingCursorin interfaceRandomAccessibleInterval<T>- Returns:
- fast localizing iterator
-
size
public long size()
Description copied from interface:IterableRealIntervalReturns the number of elements in this
Function.- Specified by:
sizein interfaceIterableRealInterval<T>- Specified by:
sizein interfaceRandomAccessibleInterval<T>- Returns:
- number of elements
-
firstElement
public LongType firstElement()
Description copied from interface:IterableRealIntervalGet the first element of thisIterableRealInterval. This is a shortcut forcursor().next().This can be used to create a new variable of type T using
firstElement().createVariable(), which is useful in generic methods to store temporary results, e.g., a running sum over pixels in theIterableRealInterval.- Specified by:
firstElementin interfaceIterableRealInterval<T>- Returns:
- the first element in iteration order.
-
iterationOrder
public java.lang.Object iterationOrder()
Description copied from interface:IterableRealIntervalReturns the iteration order of thisIterableRealInterval. If the returned object equals (Object.equals(Object)) the iteration order of anotherIterableRealIntervalf then they can be copied by synchronous iteration. That is, having anIteratoron this and anotherIteratoron f, moving both in synchrony will point both of them to corresponding locations in their source domain. In other words, this and f have the same iteration order and means and the same number of elements.- Specified by:
iterationOrderin interfaceIterableRealInterval<T>- Specified by:
iterationOrderin interfaceRandomAccessibleInterval<T>- Returns:
- the iteration order of this
IterableRealInterval. - See Also:
FlatIterationOrder
-
iterator
public java.util.Iterator<LongType> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<T>- Specified by:
iteratorin interfaceIterableRealInterval<T>
-
factory
public ImgFactory<LongType> factory()
Description copied from interface:ImgGet aImgFactorythat createsImgs of the same kind as this one. This is useful to create Imgs for temporary storage in generic methods where the specific Img type is unknown. Note, that the factory can be used even if all references to this Img have been invalidated.
-
copy
public HistogramNd<T> copy()
-
getType
public LongType getType()
Description copied from interface:TypedGet an instance ofT.It should not be assumed that the returned
Tinstance is an independent copy. In particular, repeated calls togetType()may return the same instance.
-
reset
private void reset()
-
init
private void init(java.lang.Iterable<java.util.List<T>> data)
-
init
private void init(java.util.List<java.lang.Iterable<T>> data)
-
add
private void add(java.lang.Iterable<java.util.List<T>> data)
-
add
private void add(java.util.List<java.lang.Iterable<T>> data)
-
subtract
private void subtract(java.lang.Iterable<java.util.List<T>> data)
-
subtract
private void subtract(java.util.List<java.lang.Iterable<T>> data)
-
modifyCounts
private void modifyCounts(java.lang.Iterable<java.util.List<T>> data, HistogramNd.Counter counter)
-
modifyCounts
private void modifyCounts(java.util.List<java.lang.Iterable<T>> data, HistogramNd.Counter counter)
-
count
private void count(java.util.List<T> values, HistogramNd.Counter counter)
-
-