Class RealCursorSpliterator<T>
java.lang.Object
net.imglib2.stream.RealCursorSpliterator<T>
- Type Parameters:
T- the type of elements returned by this Spliterator, and the pixel type of the underlying cursor.
- All Implemented Interfaces:
Spliterator<T>, EuclideanSpace, RealLocalizable, Sampler<T>, RealLocalizableSpliterator<T>, Typed<T>
Spliterator implementation on top of
RealCursor.-
Nested Class Summary
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 intCharacteristics always includeSIZED | SUBSIZED.private final RealCursor<T> The underlying cursor, positioned such thatcursor.next()yields the element atindex.private final longOne past last indexprivate longThe current index, modified on advance/split.Fields inherited from interface Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsConstructorDescriptionRealCursorSpliterator(RealCursor<T> cursor, long origin, long fence, int additionalCharacteristics) Creates a spliterator covering the given range. -
Method Summary
Modifier and TypeMethodDescriptionintcopy()longget()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.getType()Get an instance ofT.voidlocalize(double[] position) Write the current position into the passed array.voidlocalize(float[] position) Write the current position into the passed array.voidlocalize(RealPositionable position) Write the current position into the passedPositionable.intGets the space's number of dimensions.double[]Allocate and return a double array with the position.Allocate and return aRealPointwith the current position.booleantryAdvance(Consumer<? super T> action) trySplit()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Spliterator
forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
cursor
The underlying cursor, positioned such thatcursor.next()yields the element atindex. -
index
private long indexThe current index, modified on advance/split. -
fence
private final long fenceOne past last index -
characteristics
private final int characteristicsCharacteristics always includeSIZED | SUBSIZED.
-
-
Constructor Details
-
RealCursorSpliterator
public RealCursorSpliterator(RealCursor<T> cursor, long origin, long fence, int additionalCharacteristics) Creates a spliterator covering the given range.- Parameters:
cursor- provides elements, starting with the element at origin, on cursor.next()origin- the least index (inclusive) to coverfence- one past the greatest index to coveradditionalCharacteristics- additional characteristics besidesSIZED | SUBSIZED
-
-
Method Details
-
tryAdvance
- Specified by:
tryAdvancein interfaceSpliterator<T>
-
trySplit
- Specified by:
trySplitin interfaceRealLocalizableSpliterator<T>- Specified by:
trySplitin interfaceSpliterator<T>
-
estimateSize
public long estimateSize()- Specified by:
estimateSizein interfaceSpliterator<T>
-
characteristics
public int characteristics()- Specified by:
characteristicsin interfaceSpliterator<T>
-
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. -
copy
- Specified by:
copyin interfaceRealLocalizableSpliterator<T>- Specified by:
copyin interfaceSampler<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)
-
numDimensions
public int numDimensions()Description copied from interface:EuclideanSpaceGets the space's number of dimensions.- Specified by:
numDimensionsin interfaceEuclideanSpace
-
localize
public void localize(float[] position) Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Parameters:
position- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
localize
public void localize(double[] position) Description copied from interface:RealLocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceRealLocalizable- Parameters:
position- receives current position, length 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 interfaceRealLocalizable- Parameters:
position- receives current positionEuclideanSpace.numDimensions()must be ≥EuclideanSpace.numDimensions()
-
positionAsDoubleArray
public double[] positionAsDoubleArray()Description copied from interface:RealLocalizableAllocate and return a double array with the position. Please note that his method allocates a new array each time which introduces notable overhead in both compute and memory. If you query it frequently, you should allocate a dedicated array first and reuse it withRealLocalizable.localize(double[]).- Specified by:
positionAsDoubleArrayin interfaceRealLocalizable- Returns:
- the position
-
positionAsRealPoint
Description copied from interface:RealLocalizableAllocate and return aRealPointwith the current position. Please note that his method allocates a newRealPointeach time which introduces notable overhead in both compute and memory. If you query it frequently, you should allocate a dedicatedRealPointfirst and reuse it withRealLocalizable.localize(RealPositionable).- Specified by:
positionAsRealPointin interfaceRealLocalizable- Returns:
- the position
-
getFloatPosition
public float getFloatPosition(int d) Description copied from interface:RealLocalizableReturn the current position in a given dimension.- 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 interfaceRealLocalizable- Parameters:
d- dimension- Returns:
- dimension of current position
-