Proposals:Refactoring Statistics Framework 2007 Iterators

From KitwarePublic
Revision as of 21:27, 30 March 2007 by Davisb (talk | contribs)
Jump to navigationJump to search

Review of Iterators from the Statistics Framework

Summary Table

The ITK Statistics Framework has a collection of data containers many of which have Iterators associated with them.

This page presents a review of issues that have been identified with some iterators in the Statistics Framework and describes proposed actions intended to fix those issues.

List of Issues

  • Decrement operator was not implemented correctly in itkListSample.h (Fixed)
  • Testing coverage of iterators is not complete, allowing problems like the one above to go unnoticed.
  • Functionality was not available to create (or assign) a const iterator from a non-const iterator in itkSubsample.h (Fixed). This problem was found in a number of classes (Not yet fixed).
  • In general a consistent set of iterator operations is not present.
  • MembershipSample iterator does not allow for nested subsamples.

Proposed Solutions

  • Propose a set of core iterator functionality for sample containers.
  • Update containers to include this core functionality where necessary.
  • Write tests that cover all iterator operations.
  • Fix iterator implementation bugs as uncovered by tests.

Timetable

This task is straightforward and does not require a large amount of effort. Planned completion: Monday 9 April.

List of Sample containers with iterators

  • ListSample
  • ImageToListAdaptor
  • PointSetToListAdaptor
  • Histogram
  • MembershipSample
  • Subsample
  • VariableDimensionHistogram

Common iterator interface for Sample containers

[Under construction]

In the statistics library algorithms are intended to be used for any type of sample. This generality is provided by templating algorithms over the sample type. Therefore, it is important to define a common interface for sample iterators.

All Sample containers

SampleType:

  • ConstIterator Begin() const
  • ConstIterator End() const

SampleType::ConstIterator

  • ConstIterator()
  • ConstIterator(const ConstIterator& rhs)
  • FrequencyType GetFrequency() const
  • const MeasurementVector& GetMeasurementVector() const
  • InstanceIdentifier GetInstanceIdentifier() const
  • ConstIterator& operator++()
  • bool operator==(const ConstIterator& rhs)
  • bool operator!=(const ConstIterator& rhs)
  • ConstIterator operator=(const ConstIterator& rhs)