Class LocalizableSamplerWrapper<T>
java.lang.Object
net.imglib2.stream.LocalizableSamplerWrapper<T>
- Type Parameters:
T- pixel type
- All Implemented Interfaces:
Spliterator<LocalizableSampler<T>>, EuclideanSpace, Localizable, LocalizableSampler<T>, RealLocalizable, RealLocalizableSampler<T>, Sampler<T>, Typed<T>
class LocalizableSamplerWrapper<T>
extends Object
implements Spliterator<LocalizableSampler<T>>, LocalizableSampler<T>
Wraps
LocalizableSpliterator as Spliterator<LocalizableSampler<T>>.
Concretely, it implements LocalizableSampler, forwarding all methods
to the wrapped LocalizableSpliterator. And passes itself as a proxy
to the Consumer in tryAdvance(Consumer) and forEachRemaining(Consumer).
-
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
FieldsFields inherited from interface Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsConstructorDescriptionLocalizableSamplerWrapper(LocalizableSpliterator<T> delegate) Wrap the givendelegateasSpliterator<LocalizableSampler<T>>. -
Method Summary
Modifier and TypeMethodDescriptionintcopy()longvoidforEachRemaining(Consumer<? super LocalizableSampler<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.voidlocalize(double[] position) Write the current position into the passed array.voidlocalize(float[] position) Write the current position into the passed array.voidlocalize(int[] position) Write the current position into the passed array.voidlocalize(long[] position) 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.booleantryAdvance(Consumer<? super LocalizableSampler<T>> action) trySplit()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Localizable
positionAsLongArray, positionAsPointMethods inherited from interface RealLocalizable
positionAsDoubleArray, positionAsRealPointMethods inherited from interface Spliterator
getComparator, getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
delegate
-
-
Constructor Details
-
LocalizableSamplerWrapper
LocalizableSamplerWrapper(LocalizableSpliterator<T> delegate) Wrap the givendelegateasSpliterator<LocalizableSampler<T>>.- Parameters:
delegate- spliterator to wrap
-
-
Method Details
-
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 interfaceLocalizableSampler<T>- Specified by:
copyin interfaceRealLocalizableSampler<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)
-
forEachRemaining
- Specified by:
forEachRemainingin interfaceSpliterator<T>
-
tryAdvance
- Specified by:
tryAdvancein interfaceSpliterator<T>
-
trySplit
- Specified by:
trySplitin interfaceSpliterator<T>
-
estimateSize
public long estimateSize()- Specified by:
estimateSizein interfaceSpliterator<T>
-
characteristics
public int characteristics()- Specified by:
characteristicsin interfaceSpliterator<T>
-
numDimensions
public int numDimensions()Description copied from interface:EuclideanSpaceGets the space's number of dimensions.- Specified by:
numDimensionsin interfaceEuclideanSpace
-
localize
public void localize(int[] position) Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Parameters:
position- receives current position, length must be ≥EuclideanSpace.numDimensions()
-
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
public void localize(long[] position) Description copied from interface:LocalizableWrite the current position into the passed array.- Specified by:
localizein interfaceLocalizable- Parameters:
position- 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()
-
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
-
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
-
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
-