[Insight-developers] Statistics library : Deprecation & New
Framework
Stephen R. Aylward
Stephen.Aylward at Kitware.com
Sun Sep 30 12:59:02 EDT 2007
Hi,
I understand your motivation. Wasn't this a much debated topic during
ITK development - what was the final decision? I ask because the
proposed statistics refactoring seems to not be consistent with the rest
of ITK. In particular, image filters do not have const GetOutput
functions and do not return const images.
itkImageSource.h : line 113
OutputImageType * GetOutput(void);
with the following typedef in line 71
typedef TOutputImage OutputImageType
itkImageToImageFilter derives from ImageSource and does not change the
definition of GetOutput.
Again - I apologize if I am missing something in the code.
Thanks,
Stephen
Luis Ibanez wrote:
>
> 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
>>
>
--
=============================================================
Stephen R. Aylward, Ph.D.
Chief Medical Scientist
Kitware, Inc. - Chapel Hill Office
http://www.kitware.com
Phone: (518)371-3971 x300
More information about the Insight-developers
mailing list