[Insight-developers] ConditionalConstIterator Error?

Miller, James V (Research) millerjv@crd.ge.com
Wed, 16 Apr 2003 09:07:46 -0400


I would derive from ConditionalConstIterator then.  Sounds to me like you
can move the method IsPixelIncluded down to the subclass.  Why don't you do
that and run the tests and make sure they still pass. If they do, check it
in.

Jim

> -----Original Message-----
> From: John M. Galeotti [mailto:jgaleotti@cmu.edu]
> Sent: Wednesday, April 16, 2003 4:20 AM
> To: Luis Ibanez
> Cc: insight-developers@public.kitware.com
> Subject: Re: [Insight-developers] ConditionalConstIterator Error?
> 
> 
> If I derive from ImageConstIterator, then I am forced to have a 
> SetIndex method, which is ill-defined since multiple locations on a 
> path can map to the same image index, and many image indices will not 
> map to any point on a path.
> 
> So, should I try to descend from ImageConstIterator, 
> ConditionalConstIterator, or nothing at all?
> 
> John
> 
> On Tuesday, April 15, 2003, at 10:08 PM, Luis Ibanez wrote:
> 
> >
> > Hi John,
> >
> >
> > It is not a problem that the path does not cover all
> > the image. In fact, most iterator don't cove the full
> > image since they are conditioned to walk over a region.
> >
> > You can safely derive your new iterator from the
> > ImageConstIterator (or the ImageConstIteratorWithIndex).
> >
> > There is no advantage in deriving from the
> > ConditionalConstIterator. As a matter of fact you just
> > encountered that the conditional iterator has additional
> > functionality that is not needed in your path iterator.
> >
> >
> > Please note also that Josh recently added a chapter on
> > iterators to the SoftwareGuide.pdf.
> >
> > Hope that helps
> >
> >
> >    Luis
> >
> >
> > --------------------------------------
> > John M. Galeotti wrote:
> >> Hello, I am working on an iterator to walk through an 
> image following 
> >> any type of path.  Since most paths will not cover all 
> image indices, 
> >> it would be logical for this iterator to descend from 
> >> ConditionalConstIterator, but there is one small problem.  
> >> ConditionalConstIterator includes the pure virtual function 
> >> IsPixelIncluded(), which would be almost useless and prohibitively 
> >> expensive to calculate for some types of paths (paths are almost 
> >> always traveled linearly), and so I really do not want to 
> implement 
> >> the exhaustive search required for it.  The documentation in 
> >> ConditionalConstIterator states that this function is used to 
> >> "Compute whether the index of interest should be included in the 
> >> flood."  Therefore, it seems that this pure virtual 
> function should 
> >> be introduced into the ITK class hierarchy in its child 
> >> FloodFilledFunctionConditionalConstIterator, not in 
> >> ConditionalConstIterator.  A quick look at the 
> >> ConditionalConstIterator inheritance diagram seems to 
> indicate that 
> >> this would not be a problem, and 
> >> FloodFilledFunctionConditionalConstIterator.h would not 
> even have to 
> >> be modified.
> >> Could someone please remove the IsPixelIncluded() function from 
> >> ConditionalConstIterator.h?
> >> Thank you,
> >> John Galeotti
> >> jgaleotti@cmu.edu
> >> _______________________________________________
> >> Insight-developers mailing list
> >> Insight-developers@public.kitware.com
> >> http://public.kitware.com/mailman/listinfo/insight-developers
> >
> >
> >
> > _______________________________________________
> > Insight-developers mailing list
> > Insight-developers@public.kitware.com
> > http://public.kitware.com/mailman/listinfo/insight-developers
> 
> _______________________________________________
> Insight-developers mailing list
> Insight-developers@public.kitware.com
> http://public.kitware.com/mailman/listinfo/insight-developers
>