Class LocalizingRealIntervalIterator

java.lang.Object
net.imglib2.AbstractEuclideanSpace
net.imglib2.AbstractRealInterval
net.imglib2.iterator.LocalizingRealIntervalIterator
All Implemented Interfaces:
EuclideanSpace, Iterator, RealInterval, RealLocalizable

public class LocalizingRealIntervalIterator extends AbstractRealInterval implements Iterator, RealLocalizable
Use this class to iterate a virtual RealInterval in flat order, that is: with the first dimension varying most quickly and the last dimension varying most slowly. This is useful for iterating an arbitrary real interval in a defined order.
  • Field Details

    • step

      protected final double[] step
    • location

      protected final double[] location
  • Constructor Details

    • LocalizingRealIntervalIterator

      public LocalizingRealIntervalIterator(RealInterval interval, double[] step)
      Iterates an RealInterval with given min and max with the provided step along each dimension.
      Parameters:
      interval - the real interval
      step - iteration step
    • LocalizingRealIntervalIterator

      public LocalizingRealIntervalIterator(double[] min, double[] max, double[] step)
      Iterates an RealInterval with given min and max the the provided step along each dimension.
      Parameters:
      min - real interval min
      max - real interval min
      step - iteration steps
  • Method Details

    • reset

      public void reset()
      Description copied from interface: Iterator
      Reset the Iterator, that is put it to where it would be if newly created.
      Specified by:
      reset in interface Iterator
    • hasNext

      public boolean hasNext()
      Description copied from interface: Iterator
      Returns true if another step forward is possible.
      Specified by:
      hasNext in interface Iterator
      Returns:
      true, if there is another step forward is possible, otherwise false
    • toString

      public String toString()
      Overrides:
      toString in class AbstractRealInterval
    • localize

      public void localize(float[] position)
      Description copied from interface: RealLocalizable
      Write the current position into the passed array.
      Specified by:
      localize in interface RealLocalizable
      Parameters:
      position - receives current position, length must be ≥ EuclideanSpace.numDimensions()
    • localize

      public void localize(double[] position)
      Description copied from interface: RealLocalizable
      Write the current position into the passed array.
      Specified by:
      localize in interface RealLocalizable
      Parameters:
      position - receives current position, length must be ≥ EuclideanSpace.numDimensions()
    • getFloatPosition

      public float getFloatPosition(int d)
      Description copied from interface: RealLocalizable
      Return the current position in a given dimension.
      Specified by:
      getFloatPosition in interface RealLocalizable
      Parameters:
      d - dimension
      Returns:
      dimension of current position
    • getDoublePosition

      public double getDoublePosition(int d)
      Description copied from interface: RealLocalizable
      Return the current position in a given dimension.
      Specified by:
      getDoublePosition in interface RealLocalizable
      Parameters:
      d - dimension
      Returns:
      dimension of current position
    • jumpFwd

      public void jumpFwd(long steps)
      Description copied from interface: Iterator
      Move steps × forward.

      Highly recommended to override this with a more efficient version.

      Specified by:
      jumpFwd in interface Iterator
      Parameters:
      steps - number of steps to move forward
    • fwd

      public void fwd()
      Description copied from interface: Iterator
      Move forward.
      Specified by:
      fwd in interface Iterator
    • fwdDim

      private void fwdDim(int d)