Class CellSpliterator<T extends NativeType<T>, C extends Cell<?>>
java.lang.Object
net.imglib2.img.cell.CellSpliterator<T,C>
- Type Parameters:
T- pixel type
- All Implemented Interfaces:
Spliterator<T>, EuclideanSpace, Localizable, RealLocalizable, Sampler<T>, LocalizableSpliterator<T>, RealLocalizableSpliterator<T>, Typed<T>
class CellSpliterator<T extends NativeType<T>, C extends Cell<?>>
extends Object
implements LocalizableSpliterator<T>
LocalizableSpliterator for
CellImg.
Localizes on demand.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classCellSpliterator.CursorOnCells<C extends Cell<?>>Nested classes/interfaces inherited from interface Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CellSpliterator.CursorOnCells<C> private final CellGridprivate final AbstractCellImg<T, ?, C, ?> private final Indexprivate final longprivate intprivate final intprivate final long[]used internally to forward all localize() versions to the (abstract) long[] version.private final long[]private final TFields inherited from interface Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)CellSpliterator(AbstractCellImg<T, ?, C, ?> img, long origin, long fence) private -
Method Summary
Modifier and TypeMethodDescriptionprivate voidintcopy()longvoidforEachRemaining(Consumer<? super T> action) private voidforEachRemainingInCell(Consumer<? super T> action) get()Access the actual T instance providing access to a pixel, sub-pixel or integral region value theSamplerpoints at.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.getType()Get an instance ofT.private longglobalIndex(long cell, int index) private voidjumpBefore(long i) 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.intGets the space's number of dimensions.toString()booleantryAdvance(Consumer<? super T> action) trySplit()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Localizable
positionAsLongArray, positionAsPointMethods inherited from interface RealLocalizable
positionAsDoubleArray, positionAsRealPointMethods inherited from interface Spliterator
getComparator, getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
img
-
grid
-
type
-
index
-
currentCell
-
lastIndexInCurrentCell
private int lastIndexInCurrentCell -
lastCell
private final long lastCell -
lastIndexInLastCell
private final int lastIndexInLastCell -
tmpIndices
private final long[] tmpIndices -
tmp
private final long[] tmpused internally to forward all localize() versions to the (abstract) long[] version.
-
-
Constructor Details
-
CellSpliterator
CellSpliterator(AbstractCellImg<T, ?, C, ?> img, long origin, long fence) -
CellSpliterator
-
-
Method Details
-
jumpBefore
private void jumpBefore(long i) -
cellUpdated
private void cellUpdated() -
tryAdvance
- Specified by:
tryAdvancein interfaceSpliterator<T extends NativeType<T>>
-
forEachRemaining
- Specified by:
forEachRemainingin interfaceSpliterator<T extends NativeType<T>>
-
forEachRemainingInCell
-
globalIndex
private long globalIndex(long cell, int index) -
trySplit
- Specified by:
trySplitin interfaceLocalizableSpliterator<T extends NativeType<T>>- Specified by:
trySplitin interfaceRealLocalizableSpliterator<T extends NativeType<T>>- Specified by:
trySplitin interfaceSpliterator<T extends NativeType<T>>
-
estimateSize
public long estimateSize()- Specified by:
estimateSizein interfaceSpliterator<T extends NativeType<T>>
-
characteristics
public int characteristics()- Specified by:
characteristicsin interfaceSpliterator<T extends NativeType<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
-
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
-
toString
-
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
-
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()
-
numDimensions
public int numDimensions()Description copied from interface:EuclideanSpaceGets the space's number of dimensions.- Specified by:
numDimensionsin interfaceEuclideanSpace
-
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()
-
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
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
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()
-
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
-
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
-