A RealCursor iterates over a set of RealLocalizable elements, for example intensity values sampled at a finite set of arbitrary real positions.
RealCursor is a combination of several interfaces to achieve this. The {@link Iterator} interface is used to iterate the set. Use{@link Iterator#fwd()} to advance the cursor and {@link Iterator#hasNext()}to check whether there are more elements. Note, that the Cursor starts before the first element, i.e., you have to call {@code fwd()} onceto move to the first element.
The {@link RealLocalizable} interface provides access to the position of thecurrent element. The {@link Sampler#get()} method of the {@link Sampler}interface provides access to the value of the current element.
For convenience, Cursor also extends the {@link java.util.Iterator} interfaceso that you are able to use Cursors in for-each loops. Calling the {@link java.util.Iterator#next()} method is equivalent to calling{@code fwd()} and {@code get()}. That is, after {@code next()} the Cursor ison the element returned by {@code next()}. {@code get()} can be used toobtain that element (again), and {@code getPosition()} to obtain itsposition. The {@link java.util.Iterator#remove()} method is not supported byimglib Cursors, in general.
@author Tobias Pietzsch
@author Stephan Preibisch
@author Stephan Saalfeld