[Insight-developers] ImageRandomConstIteratorWithIndex
Luis Ibanez
luis.ibanez@kitware.com
Thu, 20 Feb 2003 16:48:58 -0500
Hi Josh,
We can probably go either way,
and it will be more a matter of convention.
Actually, some weeks ago a user suggested that
we modify the MutualInformation metric to keep
generating samples until all of them where
inside the overlap region.
It happens that this behaviour could be easily
implemented with the ++ and -- operators iff
the numberOfSamples where decremented as you
just suggested.
The original reason for incrementing samples in
the -- operator was to make possible for the
iterator to behave like a reverse iterator, but...
probably nobody is in need of such functionality
at this point.
I'm ok with changing the behavior on the operator--.
Lydia may have a deeper insight on this issue
since this will affect mostly the MutualInformation
metric.
Luis
----------------------------------
Joshua Cates wrote:
> Hi,
>
> In the implementation of ImageRandomConstIteratorWithIndex, the member
> variable m_NumerOfSamplesDone is incremented in both operator++ and
> operator--. This works fine for common cases of iteratation in one
> "direction" through the whole random sample set because IsAtBegin,
> IsAtEnd are defined appropriately.
>
> But for cases where you might want to reverse iteration direction in a
> loop, or go back a few random samples, (for example, an it++ followed by a
> conditional it--), this implementation will fail. Is there any reason not
> to modify this class so that operator-- decrements m_NumberOfSamplesDone?
>
> Josh.
> ______________________________
> Josh Cates
> School of Computer Science
> University of Utah
> Email: cates@sci.utah.edu
> Phone: (801) 587-7697
> URL: http://www.sci.utah.edu/~cates
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>
>