Interface IterableRealInterval<T>

Type Parameters:
T -
All Superinterfaces:
EuclideanSpace, Iterable<T>, RealInterval, Typed<T>
All Known Subinterfaces:
Img<T>, IterableInterval<T>, NativeImg<T,A>, RandomAccessibleInterval<T>, SubIntervalIterable<T>
All Known Implementing Classes:
AbstractCellImg, AbstractConvertedIterableInterval, AbstractConvertedIterableRandomAccessibleInterval, AbstractConvertedIterableRealInterval, AbstractConvertedRandomAccessibleInterval, AbstractImg, AbstractListImg, AbstractLongListImg, AbstractNativeImg, ARGBScreenImage, ArrayImg, ArrayImgAWTScreenImage, BiConvertedIterableInterval, BiConvertedIterableRealInterval, BiConvertedRandomAccessibleInterval, ByteAWTScreenImage, CellGrid.CellIntervals, CellImg, CompositeIntervalView, ConvertedIterableInterval, ConvertedIterableRealInterval, ConvertedRandomAccessibleInterval, DiscreteFrequencyDistribution, DoubleAWTScreenImage, FloatAWTScreenImage, Grid.CellIntervals, Histogram1d, HistogramNd, ImgView, IntAWTScreenImage, IntervalView, IterableRandomAccessibleInterval, IterableTransformBuilder.IterableIntervalView, IterableTransformBuilder.Slice, IterableTransformBuilder.SubInterval, KDTree, LazyCellImg, LazyCellImg.LazyCells, ListImg, NtreeImg, PlanarImg, PointSampleList, RealPointSampleList, ShortAWTScreenImage, StackView, SubsampleIntervalView, UnsignedByteAWTScreenImage, UnsignedIntAWTScreenImage, UnsignedShortAWTScreenImage, WriteConvertedIterableInterval, WriteConvertedIterableRandomAccessibleInterval, WriteConvertedIterableRealInterval, WriteConvertedRandomAccessibleInterval

public interface IterableRealInterval<T> extends RealInterval, Iterable<T>, Typed<T>

f:Rn∈[0,s]→T

A function over real space and a finite set of elements in the target domain T. All target elements T can be accessed through Iterators. There is an iterator that tracks its source location at each move and one that calculates it on request only. Depending on the frequency of requesting the source location, either of them is optimal in terms of speed. Iteration order is constant for an individual IterableRealInterval but not further specified.

  • Method Details

    • cursor

      RealCursor<T> cursor()

      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.

      Returns:
      fast iterating iterator
    • localizingCursor

      RealCursor<T> localizingCursor()

      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.

      Returns:
      fast localizing iterator
    • size

      long size()

      Returns the number of elements in this Function.

      Returns:
      number of elements
    • firstElement

      default T firstElement()
      Get the first element of this IterableRealInterval. 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.

      Returns:
      the first element in iteration order.
    • getType

      default T getType()
      Get an instance of T.

      It should not be assumed that the returned T instance is an independent copy. In particular, repeated calls to getType() may return the same instance.

      The default implementation returns firstElement(). Derived classes may choose different implementations for improved performance.

      Specified by:
      getType in interface Typed<T>
      Returns:
      an instance of T
    • iterationOrder

      Object iterationOrder()
      Returns the iteration order of this IterableRealInterval. 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.
      Returns:
      the iteration order of this IterableRealInterval.
      See Also:
    • iterator

      default Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • stream

      default Stream<T> stream()
      Returns a sequential Stream over the elements of this IterableRealInterval.

      Note that the returned Stream gives access only to the values of the elements, not their locations. To obtain a Stream that includes locations, see Streams.localizable(IterableRealInterval).

      The default implementation creates a sequential Stream from the interval's spliterator().

    • parallelStream

      default Stream<T> parallelStream()
      Returns a parallel Stream over the elements of this IterableRealInterval.

      Note that the returned Stream gives access only to the values of the elements, not their locations. To obtain a Stream that includes locations, see Streams.localizable(IterableRealInterval).

      The default implementation creates a parallel Stream from the interval's spliterator().

    • spliterator

      default RealLocalizableSpliterator<T> spliterator()
      Creates a RealLocalizableSpliterator over the elements of this IterableRealInterval. The returned Spliterator iterates with optimal speed without calculating the location at each iteration step. Localization is performed on demand.

      The default implementation wraps a RealCursor on the interval. The created Spliterator reports Spliterator.SIZED, Spliterator.SUBSIZED, Spliterator.ORDERED and Spliterator.NONNULL.

      Specified by:
      spliterator in interface Iterable<T>
    • localizingSpliterator

      default RealLocalizableSpliterator<T> localizingSpliterator()
      Creates a RealLocalizableSpliterator over the elements of this IterableRealInterval. The returned Spliterator calculates its location at each iteration step. That is, localization is performed with optimal speed.

      The default implementation wraps a localizing RealCursor on the interval. The created Spliterator reports Spliterator.SIZED, Spliterator.SUBSIZED, Spliterator.ORDERED and Spliterator.NONNULL.