Package net.imglib2.img.planar
Class PlanarSpliterator<T extends NativeType<T>>
- java.lang.Object
-
- net.imglib2.img.planar.PlanarSpliterator<T>
-
- Type Parameters:
T- pixel type
- All Implemented Interfaces:
java.util.Spliterator<T>,EuclideanSpace,PlanarImg.PlanarContainerSampler,Localizable,RealLocalizable,Sampler<T>,LocalizableSpliterator<T>,RealLocalizableSpliterator<T>,Typed<T>
class PlanarSpliterator<T extends NativeType<T>> extends java.lang.Object implements LocalizableSpliterator<T>, PlanarImg.PlanarContainerSampler
LocalizableSpliterator forPlanarImg. Localizes on demand.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface java.util.Spliterator
java.util.Spliterator.OfDouble, java.util.Spliterator.OfInt, java.util.Spliterator.OfLong, java.util.Spliterator.OfPrimitive<T extends java.lang.Object,T_CONS extends java.lang.Object,T_SPLITR extends java.util.Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>>
-
-
Field Summary
Fields Modifier and Type Field Description private longelementsPerSliceprivate PlanarImg<T,?>imgprivate Indexindexprivate intlastIndexInLastSliceprivate intlastIndexInSliceprivate intlastSliceprivate intsliceprivate int[]tmpused internally to forward all localize() versions to the (abstract) int[] version.private Ttype
-
Constructor Summary
Constructors Modifier Constructor Description (package private)PlanarSpliterator(PlanarImg<T,?> img, long origin, long fence)privatePlanarSpliterator(PlanarSpliterator<T> o)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcharacteristics()PlanarSpliterator<T>copy()longestimateSize()voidforEachRemaining(java.util.function.Consumer<? super T> action)private voidforEachRemainingInSlice(java.util.function.Consumer<? super T> action)Tget()Access the actual T instance providing access to a pixel, sub-pixel or integral region value theSamplerpoints at.intgetCurrentSliceIndex()doublegetDoublePosition(int d)Return the current position in a given dimension.floatgetFloatPosition(int d)Return the current position in a given dimension.intgetIntPosition(int d)Return the current position in a given dimension.longgetLongPosition(int d)Return the current position in a given dimension.TgetType()Get an instance ofT.private longglobalIndex(int slice, int index)voidlocalize(double[] pos)Write the current position into the passed array.voidlocalize(float[] pos)Write the current position into the passed array.voidlocalize(int[] pos)Write the current position into the passed array.voidlocalize(long[] pos)Write the current position into the passed array.voidlocalize(Positionable position)Write the current position into the passedPositionable.voidlocalize(RealPositionable position)Write the current position into the passedPositionable.intnumDimensions()Gets the space's number of dimensions.booleantryAdvance(java.util.function.Consumer<? super T> action)PlanarSpliterator<T>trySplit()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.imglib2.Localizable
positionAsLongArray, positionAsPoint
-
Methods inherited from interface net.imglib2.RealLocalizable
positionAsDoubleArray, positionAsRealPoint
-
-
-
-
Field Detail
-
img
private final PlanarImg<T extends NativeType<T>,?> img
-
type
private final T extends NativeType<T> type
-
elementsPerSlice
private final long elementsPerSlice
-
lastSlice
private final int lastSlice
-
lastIndexInSlice
private final int lastIndexInSlice
-
lastIndexInLastSlice
private final int lastIndexInLastSlice
-
slice
private int slice
-
index
private final Index index
-
tmp
private final int[] tmp
used internally to forward all localize() versions to the (abstract) int[] version.
-
-
Constructor Detail
-
PlanarSpliterator
private PlanarSpliterator(PlanarSpliterator<T> o)
-
-
Method Detail
-
getCurrentSliceIndex
public int getCurrentSliceIndex()
- Specified by:
getCurrentSliceIndexin interfacePlanarImg.PlanarContainerSampler- Returns:
- the index of the slice the sampler is currently accessing.
-
numDimensions
public int numDimensions()
Description copied from interface:EuclideanSpaceGets the space's number of dimensions.- Specified by:
numDimensionsin interfaceEuclideanSpace
-
tryAdvance
public boolean tryAdvance(java.util.function.Consumer<? super T> action)
- Specified by:
tryAdvancein interfacejava.util.Spliterator<T extends NativeType<T>>
-
forEachRemaining
public void forEachRemaining(java.util.function.Consumer<? super T> action)
- Specified by:
forEachRemainingin interfacejava.util.Spliterator<T extends NativeType<T>>
-
forEachRemainingInSlice
private void forEachRemainingInSlice(java.util.function.Consumer<? super T> action)
-
globalIndex
private long globalIndex(int slice, int index)
-
trySplit
public PlanarSpliterator<T> trySplit()
- Specified by:
trySplitin interfaceLocalizableSpliterator<T extends NativeType<T>>- Specified by:
trySplitin interfaceRealLocalizableSpliterator<T extends NativeType<T>>- Specified by:
trySplitin interfacejava.util.Spliterator<T extends NativeType<T>>
-
estimateSize
public long estimateSize()
- Specified by:
estimateSizein interfacejava.util.Spliterator<T extends NativeType<T>>
-
characteristics
public int characteristics()
- Specified by:
characteristicsin interfacejava.util.Spliterator<T extends NativeType<T>>
-
copy
public PlanarSpliterator<T> copy()
- Specified by:
copyin interfaceLocalizableSpliterator<T extends NativeType<T>>- Specified by:
copyin interfaceRealLocalizableSpliterator<T extends NativeType<T>>- Specified by:
copyin interfaceSampler<T extends NativeType<T>>- Returns:
- - A new
Samplerin the same state accessing the same values. It does NOT copy T, just the state of theSampler. Otherwise use T.copy() if available. Sampler.copy().get() == Sampler.get(), i.e. both hold the same value, not necessarily the same instance (this is the case for anArrayCursorfor example)
-
get
public T get()
Description copied from interface:SamplerAccess the actual T instance providing access to a pixel, sub-pixel or integral region value theSamplerpoints at.- Specified by:
getin interfaceSampler<T extends NativeType<T>>
-
getType
public T 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.- Specified by:
getTypein interfaceSampler<T extends NativeType<T>>- Specified by:
getTypein interfaceTyped<T extends NativeType<T>>- Returns:
- an instance of
T
-
localize
public void localize(int[] pos)
Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
getIntPosition
public int getIntPosition(int d)
Description copied from interface:LocalizableReturn the current position in a given dimension.- Specified by:
getIntPositionin interfaceLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
localize
public void localize(float[] pos)
Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(double[] pos)
Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(Positionable position)
Description copied from interface:LocalizableWrite the current position into the passedPositionable. Note for developers: This default implementation forwards toPositionable.setPosition(Localizable), so don't do the same there.- Specified by:
localizein interfaceLocalizable- Parameters:
position- receives current position,EuclideanSpace.numDimensions()must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(RealPositionable position)
Description copied from interface:RealLocalizableWrite the current position into the passedPositionable. Note for developers: This default implementation forwards toRealPositionable.setPosition(RealLocalizable), so don't do the same there.- Specified by:
localizein interfaceLocalizable- Specified by:
localizein interfaceRealLocalizable- Parameters:
position- receives current positionEuclideanSpace.numDimensions()must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(long[] pos)
Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Parameters:
pos- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
getFloatPosition
public float getFloatPosition(int d)
Description copied from interface:RealLocalizableReturn the current position in a given dimension.- Specified by:
getFloatPositionin interfaceLocalizable- Specified by:
getFloatPositionin interfaceRealLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
getDoublePosition
public double getDoublePosition(int d)
Description copied from interface:RealLocalizableReturn the current position in a given dimension.- Specified by:
getDoublePositionin interfaceLocalizable- Specified by:
getDoublePositionin interfaceRealLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
getLongPosition
public long getLongPosition(int d)
Description copied from interface:LocalizableReturn the current position in a given dimension.- Specified by:
getLongPositionin interfaceLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-
-