Background.

In STL, one requests an iterator from a container using the begin()/end() 
methods.  In ITK, we have many potential iterator types to run across an image, 
so we removed the iterators from the containers (image). There is a fair amount 
of work to initialize an image iterator, so rather than constructing new 
iterators (in loops) using methods like begin()/end(), we created the 
GoToBegin()/IsAtEnd() methods.

Current issue.

If Begin() on an iterator returns an iterator, then it should be deprecated. 
We'd rather people use use GoToBegin()/IsAtEnd() to be efficient.

Begin()/End() should have been removed from all Image iterators long ago.

But many of the other types listed (MapContainer, FixedArray, Neighborhood, 
...) follow the STL paradigm more closely (where you ask a container for an 
iterator) and these should have Begin()/End() methods and probably should not 
have GoToBegin()/GoToEnd().

So in summary, Begin()/End() should be called on a container to return an 
iterator while GoToBegin()/IsAtEnd() should be called on an iterator to reset 
or test the end condition.

Jim


From: Insight-developers [mailto:[email protected]] On Behalf 
Of Williams, Norman K
Sent: Friday, July 11, 2014 10:14 AM
To: ITK
Subject: [ITK-dev] Deprecated Begin/End in iterators?

I ran into this when doing an explicit instantiation of ImageRegionIterator.

Explicit instantiation will elaborate every method in a class, not just the 
ones that are called, so ImageRegionIterator::Begin (which is deprecated) is 
implemented by calling Superclass::Begin (which is also deprecated) which 
throws a compiler warning about the method being deprecated.

My first impulse was to change the implementation to call the non-deprecated 
Superclass::GoToBegin,  but that's kind of silly - it's probably not worth the 
effort to push through Gerrit.

The real question is this: Why are Begin and End deprecated in the Image Region 
iterators, and not in all the other classes?  There are a lot of classes that 
have Begin/End and not GoToBegin and GoToEnd:

ConstShapedNeighborhoodIterator
ConstSliceIterator
EquivalencyTable
FixedArray
FixedArray
ImageConstIterator
ImageConstIteratorWithIndex
ImageConstIteratorWithOnlyIndex
ImageIterator
ImageRegionConstIterator
ImageRegionIterator
ImageRegionReverseConstIterator
ImageRegionReverseIterator
ImageReverseConstIterator
IndexedContainerInterface
IndexedContainerInterface
MapContainer
MapContainer
MetaDataDictionary
MetaDataDictionary
Neighborhood
Neighborhood
NeighborhoodIterator
ObjectStore
Point
ShapedNeighborhoodIterator
SliceIterator
SparseFieldLayer
SparseFieldLayer
SpecialCoordinatesImage
ThreadedIteratorRangePartitioner
VectorContainer
VectorContainer
NarrowBand
NarrowBand
MultivariateLegendrePolynomial
MultivariateLegendrePolynomial
Histogram
Histogram
ImageToListSampleAdaptor
ImageToListSampleAdaptor
ImageToNeighborhoodSampleAdaptor
ImageToNeighborhoodSampleAdaptor
JointDomainImageToListSampleAdaptor
JointDomainImageToListSampleAdaptor
ListSample
ListSample
MembershipSample
MembershipSample
PointSetToListSampleAdaptor
PointSetToListSampleAdaptor
Subsample
Subsample
VectorContainerToListSampleAdaptor
VectorContainerToListSampleAdaptor
LevelSetContainerBase
LevelSetContainerBase
LevelSetEquationContainer
LevelSetEquationContainer
LevelSetEquationTermContainer
LevelSetEquationTermContainer
OneWayEquivalencyTable
WatershedSegmentTable
WatershedSegmentTable
WatershedSegmentTree
WatershedSegmentTree


________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the 
Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and 
may be legally privileged.  If you are not the intended recipient, you are 
hereby notified that any retention, dissemination, distribution, or copying of 
this communication is strictly prohibited.  Please reply to the sender that you 
have received the message in error, then delete it.  Thank you.
________________________________
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers

Reply via email to