T - the label typepublic class LabelRegion<T> extends PositionableInterval implements PositionableIterableRegion<BoolType>
ImgLabeling as a
PositionableIterableRegion. The interval bounds represent the
bounding box of all pixels having the label. If a RandomAccess is
requested for an interval not fully contained
in the bounding box, an OutOfBounds access is created with the value
false for pixels outside the bounding box.currentOffset, initialMax, initialMinpositionn| Modifier | Constructor and Description |
|---|---|
protected |
LabelRegion(LabelRegion<T> other)
Copy constructor.
|
|
LabelRegion(LabelRegions<T> regions,
net.imglib2.roi.labeling.LabelRegions.LabelRegionProperties regionProperties,
T label) |
| Modifier and Type | Method and Description |
|---|---|
LabelRegion<T> |
copy()
Create a copy of this
LabelRegion. |
LabelRegionCursor |
cursor()
Returns a
RealCursor that iterates with optimal speed without
calculating the location at each iteration step. |
long |
dimension(int d)
Default implementation of
Dimensions.dimension(int). |
void |
dimensions(long[] dimensions)
Write the number of pixels in each dimension into long[].
|
Void |
firstElement()
Get the first element of this
IterableRealInterval. |
RealLocalizable |
getCenterOfMass() |
T |
getLabel() |
Object |
iterationOrder()
Returns the iteration order of this
IterableRealInterval. |
LabelRegionCursor |
iterator() |
LabelRegionCursor |
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 |
PositionableLocalizable |
origin()
Get the
Positionable, Localizable origin of this
interval. |
LabelRegionRandomAccess<T> |
randomAccess()
Create a random access sampler for integer coordinates.
|
RandomAccess<BoolType> |
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 |
long |
size()
Returns the number of elements in this
Function. |
bck, fwd, move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPosition, toStringgetDoublePosition, getFloatPosition, getIntPosition, getLongPosition, localize, localize, localize, localizenumDimensionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAt, getAt, getAtforEach, spliteratormaxAsLongArray, maxAsPoint, minAsLongArray, minAsPointmaxAsDoubleArray, maxAsRealPoint, minAsDoubleArray, minAsRealPointallPositive, allPositive, dimensions, dimensionsAsLongArray, dimensionsAsPoint, verify, verify, verifyAllPositive, verifyAllPositivenumDimensionsgetDoublePosition, getFloatPosition, getIntPosition, getLongPosition, localize, localize, localize, positionAsLongArray, positionAsPointlocalize, localize, localize, positionAsDoubleArray, positionAsRealPointbck, fwd, move, move, move, move, move, setPosition, setPosition, setPosition, setPosition, setPositionpublic LabelRegion(LabelRegions<T> regions, net.imglib2.roi.labeling.LabelRegions.LabelRegionProperties regionProperties, T label)
protected LabelRegion(LabelRegion<T> other)
public LabelRegion<T> copy()
LabelRegion. The copy can be independently
positioned and its origin can be independently changed. All copies are
linked to the original Labeling and reflect all changes.copy in interface PositionableIterableInterval<Void>copy in interface PositionableIterableRegion<BoolType>LabelRegion.public PositionableLocalizable origin()
PositionableIntervalPositionable, Localizable origin of this
interval.
The origin is the relative offset of the position to the minimum. For
example if a positionable (bitmask) region is made from a BitType
image with a circular pattern, then it is more natural if the region
position refers to the center of the pattern instead of the upper left
corner of the BitType image. This can be achieved by positioning
the origin.
Assume a region is created from a 9x9 bitmask. The region initially has
min=(0,0), max=(8,8), position=(0,0). Because both position and min are
(0,0), initially origin=(0,0). Now assume the origin is moved to the
center of the bitmask using
origin().setPosition(new int[]{4,4}). After this,
min=(-4,-4), max=(4,4), position=(0,0), and origin=(4,4).
origin in interface PositionableIterableInterval<Void>origin in class PositionableIntervalpublic T getLabel()
public RealLocalizable getCenterOfMass()
public LabelRegionRandomAccess<T> 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<BoolType>public RandomAccess<BoolType> 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<BoolType>interval - in which interval you intend to use the random access.public LabelRegionCursor 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<Void>cursor in interface IterableRealInterval<Void>public LabelRegionCursor 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<Void>localizingCursor in interface IterableRealInterval<Void>public long size()
IterableRealInterval
Returns the number of elements in this Function.
size in interface IterableRealInterval<Void>public Void 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<Void>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<Void>IterableRealInterval.FlatIterationOrderpublic LabelRegionCursor iterator()
public double realMin(int d)
IntervalRealInterval.realMin(int).realMin in interface IntervalrealMin in interface RealIntervalrealMin in class PositionableIntervald - dimensionpublic void realMin(double[] min)
RealIntervalrealMin in interface RealIntervalrealMin in class PositionableIntervalpublic void realMin(RealPositionable min)
RealIntervalRealPositionable to the minimum of this IntervalrealMin in interface RealIntervalrealMin in class PositionableIntervalpublic double realMax(int d)
IntervalRealInterval.realMax(int).realMax in interface IntervalrealMax in interface RealIntervalrealMax in class PositionableIntervald - dimensionpublic void realMax(double[] max)
RealIntervalrealMax in interface RealIntervalrealMax in class PositionableIntervalpublic void realMax(RealPositionable max)
RealIntervalRealPositionable to the maximum of this IntervalrealMax in interface RealIntervalrealMax in class PositionableIntervalpublic long min(int d)
Intervalmin in interface Intervalmin in class PositionableIntervald - dimensionpublic void min(long[] min)
Intervalmin in interface Intervalmin in class PositionableIntervalpublic void min(Positionable min)
IntervalPositionable to the minimum of this Intervalmin in interface Intervalmin in class PositionableIntervalpublic long max(int d)
Intervalmax in interface Intervalmax in class PositionableIntervald - dimensionpublic void max(long[] max)
Intervalmax in interface Intervalmax in class PositionableIntervalpublic void max(Positionable max)
IntervalPositionable to the maximum of this Intervalmax in interface Intervalmax in class PositionableIntervalpublic void dimensions(long[] dimensions)
Dimensionsdimensions in interface Dimensionsdimensions in class PositionableIntervalpublic long dimension(int d)
IntervalDimensions.dimension(int).dimension in interface Dimensionsdimension in interface Intervaldimension in class PositionableIntervalCopyright © 2015–2022 ImgLib2. All rights reserved.