[Insight-developers] CR vs CR+LF in ImageLinear Iterator
Luis Ibanez
luis.ibanez@kitware.com
Wed, 06 Mar 2002 09:56:30 -0500
Hi,
After the changes in ImageLinearIterator it became
visible that we may have to decide between a CR and
a CR/LF approach with LinearIterators.
When the LinearIterator was designed it was assumed
that it will always be used to continuously visit the image
in lexicographic order (e.g. left to right, line by line) no
matter what Dimension the image was. This iterator only
warranties to visit in linear order along the dimension
selected with SetDirection(int). The lines themselves can
be visited in any order.
The iterator was designed then to do (++) until the end of
the line and then call NextLine(). This call assumed that the
iterator was at the last pixel of the current line and moved
it to the first pixel of the next line.
Yesterday this was modified so the iterator can be sent to
the next line even if it is not at the last pixel of the current
line....
but it is still going to the first position of the next line.
This is not wrong or right, it is just a matter of what users
expect from the name of the function. Right now the
NextLine() call behaves like : CR+LF does in text: go to the
next line *and* move to the beginning of the line.
Those expecting the iterator to just go to the homologous
pixel in the next line will be disapointed.
In any case, NextLine() is not intended to be used for something
like traveling through the image in the Y direction. For that,
it is enough to use the iterator in the normal way and call
SetDirection(1) instead of SetDirection(0)
when the iterator is initialized.
A method GoToBeginOfLine() also exist... maybe it will be clearer
if NextLine() just move to the homologous pixel in the next line,
and if the user wants to go to the beggining he will have to add an
explicit call to GoToBeginOfLine().
Any thoughts ?
Luis