public class DiscreteFrequencyDistribution extends Object implements Img<LongType>
| Constructor and Description |
|---|
DiscreteFrequencyDistribution(Img<LongType> img)
Construct an n-dimensional counter using a provided
Img<LongType> to
store counts. |
DiscreteFrequencyDistribution(long[] binCounts)
Construct an n-dimensional counter with the given number of bins
|
| Modifier and Type | Method and Description |
|---|---|
DiscreteFrequencyDistribution |
copy() |
Cursor<LongType> |
cursor()
Returns a
RealCursor that iterates with optimal speed without
calculating the location at each iteration step. |
void |
decrement(long[] binPos)
Decrements the frequency count of a specified bin.
|
long |
dimension(int d)
Default implementation of
Dimensions.dimension(int). |
void |
dimensions(long[] dimensions)
Write the number of pixels in each dimension into long[].
|
ImgFactory<LongType> |
factory()
Get a
ImgFactory that creates Imgs of the same kind as
this one. |
LongType |
firstElement()
Get the first element of this
IterableRealInterval. |
long |
frequency(long[] binPos)
Returns the frequency count associated with a given bin.
|
void |
increment(long[] binPos)
Increments the frequency count of a specified bin.
|
Object |
iterationOrder()
Returns the iteration order of this
IterableRealInterval. |
Iterator<LongType> |
iterator() |
Cursor<LongType> |
localizingCursor()
Returns a
RealLocalizable Iterator that calculates its
location at each iteration step. |
long |
max(int d)
Get the maximum in dimension d.
|
void |
max(long[] max)
Write the maximum of each dimension into long[].
|
void |
max(Positionable max)
Sets a
Positionable to the maximum of this Interval |
long |
min(int d)
Get the minimum in dimension d.
|
void |
min(long[] min)
Write the minimum of each dimension into long[].
|
void |
min(Positionable min)
Sets a
Positionable to the minimum of this Interval |
long |
modeCount()
Returns the highest frequency count found within the bins.
|
List<long[]> |
modePositions()
Returns a list of bin positions of the highest frequency bins.
|
int |
numDimensions()
Gets the space's number of dimensions.
|
RandomAccess<LongType> |
randomAccess()
Create a random access sampler for integer coordinates.
|
RandomAccess<LongType> |
randomAccess(Interval interval)
Create a random access sampler for integer coordinates.
|
void |
realMax(double[] max)
Write the maximum of each dimension into double[].
|
double |
realMax(int d)
Default implementation of
RealInterval.realMax(int). |
void |
realMax(RealPositionable max)
Sets a
RealPositionable to the maximum of this Interval |
void |
realMin(double[] min)
Write the minimum of each dimension into double[].
|
double |
realMin(int d)
Default implementation of
RealInterval.realMin(int). |
void |
realMin(RealPositionable min)
Sets a
RealPositionable to the minimum of this Interval |
double |
relativeFrequency(long[] binPos)
Returns the relative frequency
(0 <= f <= 1) associated with a given bin. |
void |
resetCounters()
Resets all frequency counts to zero.
|
void |
setFrequency(long[] binPos,
long value)
Sets the frequency count associated with a given bin.
|
long |
size()
Returns the number of elements in this
Function. |
long |
totalValues()
Returns the total number of values counted by this distribution.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAt, getAt, getAtforEach, spliteratormaxAsLongArray, maxAsPoint, minAsLongArray, minAsPointmaxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPointallPositive, allPositive, dimensions, dimensionsAsLongArray, dimensionsAsPoint, verify, verify, verifyAllPositive, verifyAllPositivepublic DiscreteFrequencyDistribution(long[] binCounts)
public void resetCounters()
public long frequency(long[] binPos)
public void setFrequency(long[] binPos,
long value)
public double relativeFrequency(long[] binPos)
(0 <= f <= 1) associated with a given bin.public void increment(long[] binPos)
public void decrement(long[] binPos)
public long totalValues()
public long modeCount()
public List<long[]> modePositions()
public RandomAccess<LongType> randomAccess()
RandomAccessibleThe returned random access covers as much of the domain as possible.
Please note:RandomAccessibleIntervals have a finite domain (their Interval),
so RandomAccessible.randomAccess() is only guaranteed to cover this finite domain.
This may lead to unexpected results when using Views. In
the following code
RandomAccessible<T> extended = Views.extendBorder( img ) RandomAccessibleInterval<T> cropped = Views.interval( extended, img ); RandomAccess<T> a1 = extended.randomAccess(); RandomAccess<T> a2 = cropped.randomAccess();The
access a1 on the extended image is valid
everywhere. However, somewhat counter-intuitively, the
access a2 on the extended and cropped image
is only valid on the interval img to which the extended image was
cropped. The access is only required to cover this interval, because it
is the domain of the cropped image. Views attempts 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 the RandomAccessibleInterval, and you know that the
RandomAccessibleInterval is actually defined beyond its interval
boundaries, then use the RandomAccessible.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.
randomAccess in interface RandomAccessible<LongType>public RandomAccess<LongType> randomAccess(Interval interval)
RandomAccessible
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.
randomAccess in interface RandomAccessible<LongType>interval - in which interval you intend to use the random access.public int numDimensions()
EuclideanSpacenumDimensions in interface EuclideanSpacepublic long min(int d)
Intervalpublic void min(long[] min)
Intervalpublic void min(Positionable min)
IntervalPositionable to the minimum of this Intervalpublic long max(int d)
Intervalpublic void max(long[] max)
Intervalpublic void max(Positionable max)
IntervalPositionable to the maximum of this Intervalpublic double realMin(int d)
IntervalRealInterval.realMin(int).realMin in interface IntervalrealMin in interface RealIntervald - dimensionpublic void realMin(double[] min)
RealIntervalrealMin in interface RealIntervalpublic void realMin(RealPositionable min)
RealIntervalRealPositionable to the minimum of this IntervalrealMin in interface RealIntervalpublic double realMax(int d)
IntervalRealInterval.realMax(int).realMax in interface IntervalrealMax in interface RealIntervald - dimensionpublic void realMax(double[] max)
RealIntervalrealMax in interface RealIntervalpublic void realMax(RealPositionable max)
RealIntervalRealPositionable to the maximum of this IntervalrealMax in interface RealIntervalpublic void dimensions(long[] dimensions)
Dimensionsdimensions in interface Dimensionspublic long dimension(int d)
IntervalDimensions.dimension(int).dimension in interface Dimensionsdimension in interface Intervalpublic Cursor<LongType> cursor()
IterableRealInterval
Returns a RealCursor that 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.
cursor in interface IterableInterval<LongType>cursor in interface IterableRealInterval<LongType>public Cursor<LongType> localizingCursor()
IterableRealInterval
Returns a RealLocalizable Iterator that 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.
localizingCursor in interface IterableInterval<LongType>localizingCursor in interface IterableRealInterval<LongType>public long size()
IterableRealInterval
Returns the number of elements in this Function.
size in interface IterableRealInterval<LongType>public LongType firstElement()
IterableRealIntervalIterableRealInterval. This is a
shortcut for cursor().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
the IterableRealInterval.firstElement in interface IterableRealInterval<LongType>public Object iterationOrder()
IterableRealIntervalIterableRealInterval. If the
returned object equals (Object.equals(Object)) the iteration
order of another IterableRealInterval f then they can be
copied by synchronous iteration. That is, having an Iterator on
this and another Iterator on 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.iterationOrder in interface IterableRealInterval<LongType>IterableRealInterval.FlatIterationOrderpublic ImgFactory<LongType> factory()
ImgImgFactory that creates Imgs 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.public DiscreteFrequencyDistribution copy()
Copyright © 2015–2022 ImgLib2. All rights reserved.