[Insight-developers] Integrating the New Statistics framework into ITK

Karthik Krishnan karthik.krishnan at kitware.com
Sat Apr 4 11:57:48 EDT 2009


Hello:

As you may know, the ITK statistics framework have been revamped. The new
framework follows ITK pipeline mechanics, removes redundant classes and
provides a consistent API. The new classes are not backwards compatible. For
details, please visit


http://www.itk.org/Wiki/Proposals:Refactoring_Statistics_Framework_2007_Migration_Users_Guide

We would like to integrate the new statistics framework into ITK. Given that
there are numerous API changes, to keep things backward compatible, we are
considering taking one of the following approaches :


--------------
Option A

- Rename the existing Statistics/ directory in ITK to StatisticsDeprecated/

- Create a parallel directory Statistics/ containing the new classes.

- Add an ITK_USE_DEPRECATED_STATITSTICS_FRAMEWORK option at configure time
to toggle between the usage of the deprecated and the new framework. The
option will cause (a) the right directory to be compiled (b) headers from
there right directory to be installed (c) the right directory to be added to
the include dirs.

- All existing code in the toolkit using the statistics framework will be
ifdef'ed to work with both the new and the old framework. For instance :

#ifdef ITK_USE_DEPRECATED_STATISTICS_FRAMEWORK
  calculator = Statistics::CovarianceCalculator< ListSampleType >::New();
  calculator->SetInputSample(sample);
  calculator->Update();
#else
  filter = Statistics::CovarianceFilter< ListSampleType >::New();
  filter->SetInput( sampleGenerator->GetOutput() );
  filter->Update();
#endif


--------------------------------------------------

Option B

- Keep all files in a single directory but use two different namespaces.

For instance the file itkSample.h would look like :

namespace itk
  {
  namespace StatisticsDeprecated
    {
    class Sample : public Object { ... }
    }

  namespace StatisticsNew
    {
    class Sample : public DataObject { ... }
    }
  }

- The ITK_USE_DEPRECATED_STATITSTICS_FRAMEWORK option redefines the unused
namespace to be an anonymous namespace. The used namespace to "Statistics".
For instance :

  #ifdef ITK_USE_DEPRECATED_STATITSTICS_FRAMEWORK
    #define StatisticsDeprecated Statistics
    #define StatisticsNew
  #else
    #define StatisticsNew Statistics
    #define StatisticsDeprecated
  #endif

User code still looks the same :

#ifdef ITK_USE_DEPRECATED_STATISTICS_FRAMEWORK
  calculator = Statistics::CovarianceCalculator< ListSampleType >::New();
  calculator->SetInputSample(sample);
  calculator->Update();
#else
  filter = Statistics::CovarianceFilter< ListSampleType >::New();
  filter->SetInput( sampleGenerator->GetOutput() );
  filter->Update();
#endif

-----------------------------------------

Any thoughts the developers have on this issue.

We have gathered a wikipage to assemble ideas:
  http://www.itk.org/Wiki/Proposals:Refactoring_Statistics_Framework_2007

The refactored code is in the NAMIC sandbox.



Thanks
Regards

-- 
Karthik Krishnan
R&D Engineer,
Kitware Inc.
Ph: 518 881 4919
Fax: 518 371 4573
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090404/a5a5756d/attachment.htm>


More information about the Insight-developers mailing list