[ITK-dev] [ITK] Deprecated Begin/End in iterators?
Williams, Norman K
norman-k-williams at uiowa.edu
Fri Jul 18 10:36:42 EDT 2014
I can’t find his reply in my ITK developer list folder — likely because Outlook for OS X is a total piece of crap — but here is what Jim Miller said:
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
On 7/11/14, 9:53 AM, "Matt McCormick" <matt.mccormick at kitware.com<mailto:matt.mccormick at kitware.com>> wrote:
Hi Kent,
I think this is a bug -- they should all be deprecated -- with ITKv4
we tried to use GoToBegin and GoToEnd consistently.
Thanks,
Matt
On Fri, Jul 11, 2014 at 10:14 AM, Williams, Norman K
<norman-k-williams at uiowa.edu<mailto:norman-k-williams at uiowa.edu>> wrote:
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
_______________________________________________
Community mailing list
Community at itk.org<mailto:Community at itk.org>
http://public.kitware.com/mailman/listinfo/community
_______________________________________________
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
________________________________
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.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20140718/a6d71885/attachment-0001.html>
More information about the Insight-developers
mailing list