[Insight-developers] Statistics library : Deprecation & New Framework

Luis Ibanez luis.ibanez at kitware.com
Sun Sep 30 11:42:50 EDT 2007


Hi Stephen,

Filters should return const objects because filters own their
output objects and are the only ones allowed to modify those
objects. The GetOutput() method itself should also be const,
because the invocation of that method doesn't change the state
of the filter.

Given that we are already refactoring the Statistics Framework,
it is probably not worth to look at the API of the current
classes in Code/Numerics/Statistics.

We anticipate that the entire directory will be deprecated in
a couple of released and the current code will just be carried
around under a backward-compatibility-enabler CMake variable.



You may want to look a the new classes in:
http://www.itk.org/Wiki/Proposals:Refactoring_Statistics_Framework_2007

svn checkout
http://www.na-mic.org/svn/NAMICSandBox/trunk/ITKStatisticsPipelineRefactoring

They are conceptually described in:
http://www.itk.org/Wiki/Proposals:Refactoring_Statistics_Framework_2007_New_Statistics_Framework


These new classes has a *consistent const-correct API*:

cd NAMICSandBox/trunk/ITKStatisticsPipelineRefactoring/Source

$ grep "GetOutput()" *.h

itkImageToListSampleFilter.h:  const ListSampleType * GetOutput() const;

itkMeanFilter.h:  const MeasurementVectorDecoratedType * GetOutput() const;

itkSampleClassifierFilter.h:  const OutputType * GetOutput() const;

itkSampleToHistogramFilter.h:  const HistogramType  * GetOutput() const;

itkSampleToSubsampleFilter.h:  const OutputType  * GetOutput() const;

itkScalarImageToCooccurrenceListSampleFilter.h:  const SampleType *
GetOutput() const;

itkScalarImageToCooccurrenceMatrixFilter.h:  const HistogramType * 
GetOutput() const;


----


Following the Backward Compatibility policy of ITK:
http://www.itk.org/Wiki/Proposals:DeprecationProcedure
We have created a Migration Guide:
http://www.itk.org/Wiki/Proposals:Refactoring_Statistics_Framework_2007_Migration_Users_Guide
explaining users of the current framework what they should
do to migrate to the new framework.



     Luis




------------------------
Stephen R. Aylward wrote:
> Hi,
> 
> Am I missing some deeper motivation:  ImageToImageFilter (via 
> ImageSource) has a GetOutput that returns a non-const object; however, 
> the statistics library (code/numerics/statistics/) has some classes 
> whose GetOutput returns a const object (itkImageToHistogramGenerator and 
> 5 others) and others that return a non-const object (itkKdTreeGenerator 
> and 5 others).
> 
> I recall this discussion only vaguely.
> 
> Should the statistics library be updated to be internally consistent and 
> consistent with the image filters?   Seems like making all non-const 
> would be backward compatible...seems like Luis had an argument against 
> this at one time :)
> 
> Thanks,
> Stephen
> 


More information about the Insight-developers mailing list