Proposals:Refactoring Statistics Framework 2007 Migration Users Guide: Difference between revisions
(→Algorithms: note change in Algorithm namespace.) |
|||
(94 intermediate revisions by 4 users not shown) | |||
Line 62: | Line 62: | ||
|| | || | ||
|- | |- | ||
| ListSample || Refactored | | ListSample || Refactored || | ||
* It does not derive from the ListSampleBase (since that class was deprecated) | |||
* The iterators API was updated, | |||
** const-correctness is now enforced | |||
** Constructor with instance identifier was moved to the protected section | |||
** ConstIterator does not refer to the non-const Iterator any more. | |||
** Method that allowed to convert ConstIterator into non-const Iterators were removed because they were facilitating the violation of const-correctness | |||
* Various API modifications | |||
** SearchResultVectorType trait was removed. Search is to be implemented as an external algorithm. | |||
** Resize( unsigned int ) now is Resize( InstanceIdentifier ) (keeping 64bits in mind) | |||
** PushBack() before passed the argument by copy, now it passes it as a const reference | |||
** Size() method used to return unsigned int, now it returns InstanceIdentifier (keeping 64bits in mind) | |||
** GetMeasurementVector() instance identifier argument is now passed by copy, since it is just a number | |||
** SetMeasurementVector() now passes InstanceIdentifier by copy, not by const reference | |||
** SetMeasurement() now passes InstanceIdentifier by copy, not by const reference | |||
** GetFrequency() now passes InstanceIdentifier by copy, not by const reference | |||
* GetMeasurementVectorSize() method was removed. The default implementation of the superclass is now functional for this class too. | |||
* The implementation code of most methods was moved to the .txx file. | |||
|| | |||
* It derives now from the Sample class directly | |||
* Iterators | |||
** ConstIterator use friendship to the ListSample | |||
** operator-- removed | |||
** non-const Iterator is no longer a friend of the ConstIterator. Instead it derives from the ConstIterator | |||
** The following methods were declared but not implemented, in the protected section with the purpose of preventing const-correctness violations | |||
*** Iterator() constructor | |||
*** Iterator(const Self * sample) constructor of non-const iterator from const sample | |||
*** Iterator( typename InternalDataContainerType::const_iterator iter, InstanceIdentifier iid) constructor of non-const iterator from const sample iterator | |||
*** Iterator(const ConstIterator & it) constructor of non-const iterator from ConstIterator | |||
*** ConstIterator& operator=(const ConstIterator& it) Assignment of ConstIterator to non-const Iterator. | |||
** The followin methods were moved to the protected section, since only the ListSample class (which is a friend) should call them | |||
*** Iterator( typename InternalDataContainerType::iterator iter, InstanceIdentifier iid):ConstIterator( iter, iid ) | |||
|- | |- | ||
| MembershipSample || Refactoring in Progress <font style="color: #006400;">'''Luis'''</font> || | | MembershipSample || Refactoring in Progress <font style="color: #006400;">'''Luis'''</font> || | ||
Line 69: | Line 100: | ||
|- | |- | ||
| Histogram || Refactored | | Histogram || Refactored same name || | ||
* Modified by removing the measurement vector size from its template parameters. This Histogram class can now be used for Samples whose measurement vector size is not known at compilation time. The consequence is that now users MUST remember to set the measurement vector size before they call the Initialize() method, otherwise, an Exception will be thrown. | |||
* GetIndex() now take the InstanceIdentifier by copy, not as a const reference. | |||
* Size() doesn't return unsigned int anymore. Instead it returns InstanceIdentifier (64 bits in mind) | |||
* GetSize() now returns a const reference to the Size object. | |||
* GetSize( dimension ) : const specifier of the argument was removed (it was useless) | |||
* GetBinMin( ), GetBinMax(), SetBinMin and SetBinMax() | |||
** const specifier of the dimension was removed (it was useless) | |||
** bin number parameter type "unsigned long" was replaced with InstanceIdentifier | |||
* GetBinMinFromValue( ), GetBinMaxFromValue() | |||
** const specifier of the dimension was removed (it was useless) | |||
* GetDimensionMins( ), GetDimensionMaxs() | |||
** const specifier of the dimension was removed (it was useless) | |||
* GetHistogramMinFromIndex() and GetHistogramMaxFromIndex() | |||
** Is now declared const (as any Get method should be) | |||
** It returns a const reference (it used to return a non-const reference) | |||
* GetFrequency() | |||
** const specifier of the InstanceIdentifier was removed (it was useless) | |||
* SetFrequency( value ) | |||
** const specifier of the FrequencyType value was removed (it was useless) | |||
* SetFrequency( id, value ) | |||
** const reference specifier of the InstanceIdentifier was removed. It is now passed by copy | |||
** const specifier of the FrequencyType value was removed (it was useless) | |||
* IncreaseFrequency( id, value ) | |||
** const reference specifier of the InstanceIdentifier was removed. It is now passed by copy | |||
** const specifier of the FrequencyType value was removed (it was useless) | |||
* IncreaseFrequency( index, value ) | |||
** const specifier of the FrequencyType value was removed (it was useless) | |||
* GetMeasurementVector( id ) | |||
** const specifier of the InstanceIdentifier was removed (it was useless) | |||
* GetMeasurement( id, dimension ) | |||
** type "const unsigned long" of the id, was replaced with InstanceIdentifier, (const part was removed, it was useless) | |||
** const specifier of the dimension value was removed (it was useless) | |||
* GetFrequency( id, dimension ) | |||
** type "const unsigned long" of the id, was replaced with InstanceIdentifier, (const part was removed, it was useless) | |||
** const specifier of the dimension value was removed (it was useless) | |||
* Quantile( dimension, value ) | |||
* const specifier of the dimension type was removed (it was useless) | |||
* const & specifier of the value type was removed (it was useless), value is now passed by copy. | |||
* SetMeasurementVectorSize() | |||
** const modified of the argument was removed (it was useless) | |||
* Iterators | |||
** non-const Iterator now derives from the ConstIterator | |||
** SetFrequency() method was removed from the non-const Iterator, and put in the ConstIterator | |||
|| | |||
* Iterators | |||
** API now made compliant with the other containers. | |||
** const correctness is enforced | |||
** non-const Iterator derives from the ConstIterator | |||
** Preventing any construction of non-const Iterator from ConstIterators by making the following methods be "protected" | |||
*** Iterator(const Self * histogram); | |||
*** Iterator(InstanceIdentifier id, const Self * histogram); | |||
*** Iterator(const ConstIterator & it); | |||
*** ConstIterator& operator=(const ConstIterator& it); | |||
** Constructor with instance identifier was moved out of the public API into the protected section | |||
*** This method is quite unsafe, and doesn't provide any required functionality (it seems to be just a sign of feature-creep) | |||
|- | |- | ||
| VariableDimensionHistogram || | | VariableDimensionHistogram || Merged with the Histogram class above || || | ||
|- | |- | ||
| KdTree || | | KdTree || moved with the same name || || | ||
|- | |- | ||
|} | |} | ||
Line 79: | Line 165: | ||
== Frequency Containers == | == Frequency Containers == | ||
The use of the data type "FrequencyType" defined in the frequency containers was very confusing in the previous statistics framework. FrequencyType was used to refer to the number of counts(hits) in a histogram bin. This is basically what absolute frequency is. In other instances, FrequencyType was used to refer to relative (normalized) frequencies. This concept mixing creates a lot of confusion. Hence, in the new statistics framework, we have separated the two concepts and defined separate types. | |||
//Absolute Frequency type alias <br> | |||
typedef MeasurementVectorTraits::AbsoluteFrequencyType AbsoluteFrequencyType; | |||
//Relative Frequency type alias <br> | |||
typedef MeasurementVectorTraits::RelativeFrequencyType RelativeFrequencyType; | |||
Formal definition of relative and absolute frequencies can be found at | |||
http://en.wikipedia.org/wiki/Frequency_(statistics) | |||
The above frequency types are defined in the MeasurmentVectorTraits as follows <br> | |||
<font style="color: red;"> | |||
/** In the old framework, the FrequencyType is set to float. The problem is for large histograms the total frequency can be more than 1e+7, than increasing the frequency by one does not change the total frequency (because of lack of precision). Using double type will also ultimately fall into the same problem. Hence in the new statistics framework, InstanceIdentifier/FrequencyTypes are set to the the largest possible integer on the machine */ <br> | |||
</font> | |||
typedef std::vector<int>::size_type InstanceIdentifier; <br> | |||
/** Type defined for representing the frequency of measurement vectors */ <br> | |||
typedef InstanceIdentifier AbsoluteFrequencyType; <br> | |||
typedef NumericTraits< AbsoluteFrequencyType >::RealType RelativeFrequencyType; <br> | |||
typedef NumericTraits< AbsoluteFrequencyType >::AccumulateType TotalAbsoluteFrequencyType; <br> | |||
typedef NumericTraits< RelativeFrequencyType >::AccumulateType TotalRelativeFrequencyType; <br> | |||
The containers are renamed with a suffix "2" to be able to generate a separate ITKStatistics library and be able to link with the old library during the refactoring. But once the refactoring is finialized, the name should be changed back to the original names. | |||
{| border="1" | {| border="1" | ||
Line 96: | Line 197: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| | | DenseFrequencyContainer || Refactored into DenseFrequencyContainer2 || | ||
* FrequencyType typedef is deprecated ( replaced with AbsoluteFrequencyType and RelativeFrequencyType ) | |||
* TotalFrequencyType typedef is deprecated ( replaced with AbsoluteFrequencyType and RelativeFrequencyType ) | |||
|| | |||
* New data types are defined | |||
** AbsoluteFrequencyType | |||
** RelativeFrequencyType | |||
** AbsoluteTotalFrequencyType | |||
** RelativeTotalFrequencyType | |||
|- | |- | ||
| | | SparseFrequencyContainer || Refactored into SpareFrequencyContainer2 || | ||
* FrequencyType typedef is deprecated ( replaced with AbsoluteFrequencyType and RelativeFrequencyType ) | |||
* TotalFrequencyType typedef is deprecated ( replaced with AbsoluteFrequencyType and RelativeFrequencyType ) | |||
|| | |||
* New data types are defined | |||
** AbsoluteFrequencyType | |||
** RelativeFrequencyType | |||
** AbsoluteTotalFrequencyType | |||
** RelativeTotalFrequencyType | |||
|} | |} | ||
== Traits == | == Traits == | ||
Line 138: | Line 257: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| ImageToCoocurrenceListAdaptor || | | ImageToCoocurrenceListAdaptor || Refactored into "ScalarImageToCoocurrenceListSampleFilter" || | ||
* Compute() method removed ( Update() ) should be used instead | |||
* SetImage() method removed ( SetInput() ) should be used instead | |||
|| | |||
* Derives from Process Object and integrated into the pipeline | |||
** SetInput() method added | |||
** User should invoke Update() to generate the coocurrence list sample | |||
** GetOutput() returns the list sample generated | |||
|- | |- | ||
| ImageToListAdaptor || Refactored into "ImageToListSampleAdaptor". This class handles images with scalar, fixed size array (itk::FixedArray) and variable length vector (itk::VariableLengthVector) pixel types. | | ImageToListAdaptor || Refactored into "ImageToListSampleAdaptor". This class handles images with scalar, fixed size array (itk::FixedArray) and variable length vector (itk::VariableLengthVector) pixel types. | ||
Line 156: | Line 283: | ||
| JointDomainImageToListAdaptor || Refactored into "JointDomainImageToListSampleAdaptor" || | | JointDomainImageToListAdaptor || Refactored into "JointDomainImageToListSampleAdaptor" || | ||
* The class is not derived from the ImageToListSampleAdaptor. This design decision was made due to the new changes in the ImageToListSample adaptor to handle different pixel types ( scalar, Fixed length array, variable length vector). | * The class is not derived from the ImageToListSampleAdaptor. This design decision was made due to the new changes in the ImageToListSample adaptor to handle different pixel types ( scalar, Fixed length array, variable length vector). | ||
* Search() method | * Search() (and helper method ComputeRegion()) methods are removed . This class is not the appropriate place for such functionality. | ||
|| | || | ||
* Iterator and ConstIterator API added. ( | * Derives from ListSample | ||
* Iterator and ConstIterator API added and it is consistent with the ListSample class. | |||
* Set/GetUsePixelContainer() and UsePixelContainerOn/Off methods added | |||
|- | |- | ||
| PointSetToListAdapor || Refactored into "PointSetToListSampleAdaptor" || | | PointSetToListAdapor || Refactored into "PointSetToListSampleAdaptor" || | ||
Line 165: | Line 294: | ||
|| | || | ||
* The class derives from ListSample with the measurement vector type determined from the point set type. | * The class derives from ListSample with the measurement vector type determined from the point set type. | ||
* GetPointSet() returns a const PointSet ( constant correctness | * GetPointSet() returns a const PointSet ( constant correctness | ||
* GetSize() returns InstanceIdentifer type ( to have a consistent signature with the superclass ) | * GetSize() returns InstanceIdentifer type ( to have a consistent signature with the superclass ) | ||
* The Iterator and ConstIterator API is modified to be consistent with the iterator and constiterators of the ListSample class. | * The Iterator and ConstIterator API is modified to be consistent with the iterator and constiterators of the ListSample class. | ||
Line 182: | Line 311: | ||
== Algorithms == | == Algorithms == | ||
Algorithms, including FloorLog, MedianOfThree, FindSampleBound, FindSampleBoundAndMean, Partition, QuickSelect, NthElement, InsertSort, DownHeap, HeapSort, IntrospectiveSortLoop, IntrospectiveSort, have been '''moved''' from the '''itk::Statistics''' namespace to the '''itk::Statistics::Algorithm''' namespace. | |||
{| border="1" | {| border="1" | ||
|- bgcolor="#abcdef" | |- bgcolor="#abcdef" | ||
Line 195: | Line 325: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| MeanCalculator || Refactored into | | MeanCalculator || Refactored into MeanSampleFilter || | ||
* SetSample() method | * SetSample() method replaced with SetInput() | ||
* GetOutput() method return type modified ( the new signature returns a data object decorator ) | * GetOutput() method return type modified ( the new signature returns a data object decorator ) | ||
|| | || | ||
Line 202: | Line 332: | ||
** SetInput() | ** SetInput() | ||
** GetOutput() (returns a data object decorated type of the mean vector ) | ** GetOutput() (returns a data object decorated type of the mean vector ) | ||
* GetMean() (returns the mean vector as it is without any decoration ) | * GetMean() (returns the mean vector as it is without any decoration ) | ||
|- | |- | ||
| WeightedMeanCalculator || Refactored into | | WeightedMeanCalculator || Refactored into WeightedMeanSampleFilter || | ||
* SetSample() method replaced with SetInput() | * SetSample() method replaced with SetInput() | ||
* SetWeightFunction() | * SetWeights() method input argument modified ( the new signature takes dataobject decorated weight array) | ||
* SetWeightFunction() method replaced with SetWeightingFunction() | |||
* GetWeights() method return type modified ( new signature returns a data object decorator of the weight array) | |||
* GetWeightingFunction() method replaced with GetWeightingFunction() | |||
* GetOutput() method return type modified ( the new signature returns a data object decorator of the mean ) | |||
|| | || | ||
* | * Derives from ProcessObject and the following methods added to integrate the class into the pipeline | ||
* | ** SetInput() | ||
** GetOutput() (returns a data object decorated type of the mean vector ) | |||
** SetWeights() (Takes dataObjecte decorated version of weight array type ) | |||
** SetWeightingFunction (Takes dataObject decorated version of weighting function type ) | |||
|- | |- | ||
| CovarianceCalculator || Refactored into | | CovarianceCalculator || Refactored into CovarianceSampleFilter || | ||
* SetMean() removed ( the mean will always be computed inside the class. Keeping track of mean computed internally and set from outside creates lots of inconsistencies in the pipeline). | |||
* SetSample() replaced with SetInput() | |||
* GetOutput() replaced with GetCovarianceMatrixOutput() which returns a decorated version of the covariance matrix | |||
* | |||
* | |||
|| | || | ||
* Derived from | * Derived from process object and the following methods added to integrate the class into the pipeline | ||
** SetInput() | ** SetInput() | ||
** | ** GetMeanOutput() ( returns a decorated version of the mean vector ) | ||
** | ** GetCovarianceMatrixOutput() ( returns a decorated version of the covariance matrix ) | ||
|- | |- | ||
| WeightedCovarianceCalculator || Refactored into | | WeightedCovarianceCalculator || Refactored into WeightedCovarianceSampleFilter || | ||
* | * SetSample() method replaced with SetInput() | ||
* SetWeightFunction() | * SetWeights() method input argument modified ( the new signature takes dataobject decorated weight array) | ||
* SetWeightFunction() method replaced with SetWeightingFunction() | |||
* GetWeights() method return type modified ( new signature returns a data object decorator of the weight array) | |||
* GetWeightingFunction() method replaced with GetWeightingFunction() | |||
|| | || | ||
* | * Derives from itk::CovarianceFilter and all the methods defined in the CovarianceFilter for pipeline integration (SetInput(), GetMeanOutput(), GetCovarianceMatrixOutput() )should be used | ||
* | * SetWeights() (Takes dataObjecte decorated version of weight array type ) | ||
* SetWeightingFunction (Takes dataObject decorated version of weighting function type ) | |||
* GetWeights() returns decorated version of the weight array | |||
* GetWeightingFunction() returns decorated version of the weighting function | |||
|- | |||
| GreyLevelCooccurrenceMatrixTextureCoefficientsCalculator || Refactored into HistogramToTextureFeaturesFilter || | |||
* Compute() removed ( Update() method should be used in the new API ) | |||
* SetHistogram() removed ( replaced by SetInput() in the new API ) | |||
| | || | ||
* Derives from ProcessObject and the following methods added to integrate it to the pipeline | |||
** SetInput() | |||
** GenerateData() ( user should invoke Update() to compute the features ) | |||
** Data object decorated versions of the Get methods for each feature was added. | |||
*** GetEnergyOutput() | |||
*** GetEntropyOutput() | |||
*** GetCorrelationOutput() | |||
*** GetInverseDifferenceMomentOutput() | |||
*** GetInertiaOutput() | |||
*** GetClusterShadeOutput() | |||
*** GetClusterProminenceOutput() | |||
*** GetHaralickCorrelationOutput() | |||
|- | |- | ||
| ScalarImageTextureCalculator || | | ScalarImageTextureCalculator || Refactored into ScalarImageToTextureFeaturesFilter || | ||
* Compute() removed ( Update() method should be used in the new API ) | |||
|| | |||
* Derives from ProcessObject and the following methods added to integrate it to the pipeline | |||
** GenerateData() ( user should invoke Update() to compute the features ) | |||
** Decorated data types for the mean and standard deviation feature values were defined. | |||
** Data object decorated versions of the GetOutput methods for the mean and standard deviation were added. | |||
*** GetFeatureMeansOutput() | |||
*** GetStandardDeviationsOutput() | |||
* GetInput and GetMaskImage() methods were added | |||
|} | |} | ||
Line 248: | Line 410: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| ListSampleToHistogramGenerator || Refactored into SampleToHistogramFilter || | | ListSampleToHistogramGenerator || Refactored into SampleToHistogramFilter || | ||
* It used to derive from Object, now derives from ProcessObject | |||
* It used to be templated over | |||
** SampleType and the | |||
** HistogramMeasurementType | |||
** Histogram frequency container. | |||
* Not it is templated over TSample and THistogram | |||
* SetListSample() removed. Replaced with SetInput() | |||
* The following member variables were removed and now are managed through Decorated inputs | |||
** Histogram Size | |||
** Marginal scale | |||
** Histogram Mins | |||
** Histogram Maxs | |||
** AutoMinMax | |||
|| | |||
* It derives now from ProcessObject | |||
* It is now templated over TSample and THistogram types | |||
* SetInput( const SampleType * ) | |||
* const SampleType * GetInput() const | |||
* Copy Constructor and Operator=() are declared protected are purposely not implemented in order to enforce the correct use of SmartPointers. | |||
* MakeOutput() method added, so that the filter is compatible with the DisconnectPipeline() API of the output DataObject. | |||
* Added DataDecorated Inputs for | |||
** Histogram Size | |||
** AutoMinimumMaximum | |||
** MarginalScale | |||
** HistogramBinMinimum | |||
** HistogramBinMaximum | |||
* Decorated inputs provide | |||
** Set/Get methods for the decorated type and | |||
** '''ONLY''' Set method for the undecorated type. | |||
** Get method for undecorated type cannot be provided because their API uses a const reference, and the decorated input may have been a NULL pointer, in which case there is not possible const reference to return. | |||
|- | |- | ||
| ImageToListGenerator || Refactored into ImageToListSampleFilter || | | ImageToListGenerator || Refactored into ImageToListSampleFilter || | ||
* GetListSample() replaced with GetOutput() | |||
* GenerateData() moved to protected interface | |||
|| | |||
* Integrated with the pipeline | |||
** GetOutput() added | |||
* The measurement vector type is determined using MeasurementVectorTraits and hence this adaptor handles scalar, fixed array and variable length vector pixel type | |||
|- | |- | ||
| ScalarImageToGreyLevelCooccurrenceMatrixGenerator || Refactored into ScalarImageToCooccurrenceMatrixFilter || || | | ScalarImageToGreyLevelCooccurrenceMatrixGenerator || Refactored into ScalarImageToCooccurrenceMatrixFilter || | ||
* | * Compute() method removed ( Update() ) should be used instead | ||
|| | |||
* Derives from Process Object and integrated into the pipeline | |||
** User should invoke Update() to compute the matrix | |||
** GetOutput() returns the computed matrix | |||
* Takes a mask image as well | |||
** SetMaskImage() added | |||
** GetMaskImage() added | |||
|- | |- | ||
| MaskedScalarImageToGreyLevelCooccurrenceMatrixGenerator || Deprecated ( ScalarImageToCooccurrenceMatrixFilter | | MaskedScalarImageToGreyLevelCooccurrenceMatrixGenerator || Deprecated ( Use ScalarImageToCooccurrenceMatrixFilter instead since this takes a mask image in addition to the input image ) || || | ||
|- | |||
| ImageToHistogramGenerator || Refactored into ImageToHistogramFilter || | |||
* It used to derive from Object, now derives from ProcessObject | |||
* It used to expect a ListSample as input, it now takes any class that complies with the Sample API | |||
* Compute() implementation removed, the default Update() of the superclass ProcessObject() provides the correct functionality. Compute() was replaced with GenerateData(). | |||
* Member variables removed | |||
|| | |||
* It derives now from ProcessObject | |||
* SetInput( const SampleType * ) | |||
* const SampleType * GetInput() const | |||
* const HistogramType * GetOutput() const | |||
* Copy Constructor and Operator=() are declared protected are purposely not implemented in order to enforce the correct use of SmartPointers. | |||
* MakeOutput() method added, so that the filter is compatible with the DisconnectPipeline() API of the output DataObject. | |||
* Added DataDecorated Inputs for | |||
** Histogram Size | |||
** AutoMinimumMaximum | |||
** MarginalScale | |||
** HistogramBinMinimum | |||
** HistogramBinMaximum | |||
* Decorated inputs provide | |||
** Set/Get methods for the decorated type and | |||
** '''ONLY''' Set method for the undecorated type. | |||
** Get method for undecorated type cannot be provided because their API uses a const reference, and the decorated input may have been a NULL pointer, in which case there is not possible const reference to return. | |||
|} | |} | ||
Line 264: | Line 492: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| ListSampleToHistogramFilter || || | | ListSampleToHistogramFilter || Refactored as SampleToHistogramFilter || | ||
* It used to derive from Object, now derives from ProcessObject | |||
* It used to expect a ListSample as input, it now takes any class that complies with the Sample API | |||
* SetListSample() removed. The method SetInput() should be used instead. | |||
* SetHistogram() removed. The resulting histogram is now obtained from the GetOutput() method, according to a standard Filter API. | |||
* Update() implementation removed, the default Update() of the superclass ProcessObject() provides the correct functionality. | |||
* Run() method removed. The method Update() in the superclass provides the equivalent functionality. | |||
* Member variables removed | |||
** A pointer to the ListSample. This is now managed by the Input of the ProcessObject. | |||
** A pointer to the output histogram. This is now manged by the Output of the ProcessObject. | |||
* In the old API it was expected that the user will | |||
** Construct an instance of the Histogram class | |||
** Setup in that histogram all the parameters such as: | |||
*** Histogram Size | |||
*** Histogram bin Minimum | |||
*** Histogram bin Maximum | |||
*** AutoMinMax | |||
* In the new API this setup is done directly in the filter, since the output object is supposed to be created by the filter, and provided as a '''const object''', therefore the users do not have access to it for applying any modifications. | |||
|| | |||
* It derives now from ProcessObject | |||
* SetInput( const SampleType * ) | |||
* const SampleType * GetInput() const | |||
* const HistogramType * GetOutput() const | |||
* Copy Constructor and Operator=() are declared protected are purposely not implemented in order to enforce the correct use of SmartPointers. | |||
* MakeOutput() method added, so that the filter is compatible with the DisconnectPipeline() API of the output DataObject. | |||
* Added DataDecorated Inputs for | |||
** Histogram Size | |||
** AutoMinimumMaximum | |||
** MarginalScale | |||
** HistogramBinMinimum | |||
** HistogramBinMaximum | |||
* Decorated inputs provide | |||
** Set/Get methods for the decorated type and | |||
** '''ONLY''' Set method for the undecorated type. | |||
** Get method for undecorated type cannot be provided because their API uses a const reference, and the decorated input may have been a NULL pointer, in which case there is not possible const reference to return. | |||
|- | |||
| HistogramToImageFilter || HistogramToImageFilter || || ImageDimension was added as second template parameter. This is needed because now the number of components in the Histogram class are defined at run time. | |||
|- | |||
| HistogramToIntensityImageFilter || HistogramToIntensityImageFilter || || ImageDimension was added as second template parameter. See HistogramToImageFilter | |||
|- | |||
| HistogramToLogProbabilityImageFilter || HistogramToLogProbabilityImageFilter || || ImageDimension was added as second template parameter. See HistogramToImageFilter | |||
|- | |||
| HistogramToProbabilityImageFilter || HistogramToProbabilityImageFilter || || ImageDimension was added as second template parameter. See HistogramToImageFilter | |||
|- | |||
| HistogramToEntropyImageFilter || HistogramToEntropyImageFilter || || ImageDimension was added as second template parameter. See HistogramToImageFilter | |||
|} | |} | ||
Line 274: | Line 545: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| || | | DensityFunction || Removed ( it is a duplication of what MembershipFunction) does || || | ||
|- | |||
| GaussianDensityFunction || Refactored as GaussianMembershipFunction || || | |||
|} | |} | ||
Line 283: | Line 556: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| || || || | | DistanceMetric || Refactored (Same name ) || | ||
*Evaluate method with two arguments removed | |||
|| | |||
*Derives now from FunctionBase ( not MembershipFunctionBase ) | |||
*SetMeasurmentVectorSize reimplemented | |||
|- | |||
| EuclideanDistance || Refactored as EuclideanDistanceMetric || | |||
*Evaluate method with two arguments removed (unnecessary for the classification pipeline ) | |||
*IsWithinRange method removed (unnecessary for the classification pipeline ) | |||
|| | |||
|- | |||
| MahalanobisDistanceMetric || Refactored same name || || | |||
|- | |||
|- | |||
| EuclideanSquareDistanceMetric|| New class || || Same API as EuclideanDistance | |||
|- | |||
| ManhattanDistanceMetric|| New class || || Same API as EuclideanDistance | |||
|} | |||
== MembershipFunctions == | |||
{| border="1" | |||
|- bgcolor="#abcdef" | |||
! Class Name !! Fate !! Deprecated API !! New API | |||
|- | |||
| DistanceToCentroidMembershipFunction || Refactored (Same name ) || | |||
*Set/Get Number of samples method removed ( not used at all ) | |||
|| | |||
*SetMeasurmentVectorSize reimplemented | |||
|- | |||
| GaussianDensityFunction || Refactored as GaussianMembershipFunction || | |||
|| | |||
|- | |||
|} | |||
== Process Objects == | |||
{| border="1" | |||
|- bgcolor="#abcdef" | |||
! Class Name !! Fate !! Deprecated API !! New API | |||
|- | |||
| SampleClassifier || These are now Classifiers, see below || || | |||
|- | |||
| SampleClassifierWithMask || These are now Classifiers, see below || || | |||
|} | |||
== Classifiers == | |||
{| border="1" | |||
|- bgcolor="#abcdef" | |||
! Class Name !! Fate !! Deprecated API !! New API | |||
|- | |||
| ClassifierBase || Deprecated || || | |||
|- | |||
| SampleClassifier || Refactored (as SampleClassifierFilter) || || | |||
* Derives from ProcessObject to integrate the classifier to ITK pipeline | |||
* Add Datadecorated inputs | |||
** Classlabels | |||
** MembershipFunctions | |||
* Throw an exception if the specified number of class doesn't match with | |||
the number of class labels or the number of membership functions specified. | |||
* Add Set/Get method for DecisionRule | |||
|- | |||
| ImageClassifierBase || Refactored (as ImageClassifierFilter) || || | |||
* Derives from ImageToImageFilter to integrate the classifier to ITK pipeline | |||
* Add Datadecorated inputs | |||
** Classlabels | |||
** MembershipFunctions | |||
** MembershipFunctionsWeightArray | |||
** DecisionRule | |||
* Throw an exception if the specified number of class doesn't match with | |||
the number of class labels or the number of membership functions specified. | |||
* Add Set/Get method for DecisionRule | |||
* GetOutput returns MembershipSampleType | |||
|- | |||
* SetSample becomes SetInput | |||
|} | |||
== Decision rules == | |||
{| border="1" | |||
|- bgcolor="#abcdef" | |||
! Class Name !! Fate !! Deprecated API !! New API | |||
|- | |||
| DecisionRuleBase || Refactored as DecisionRule || * Remove Evaluate(ArrayType ) method || | |||
* Define MembershipVector type which is of std::vector< double > type and store the membership score | |||
* Define only ONE Evaluate method that takes MembershipVector type | |||
|- | |||
| MaximumDecisionRule || Refactored as MaximumDecisionRule2 || || | |||
|- | |||
| MinimumDecisionRule || Refactored as MinimumDecisionRule2 || || | |||
|- | |||
|- | |||
| MaximumDecisionRatioRule || Refactored as MaximumDecisionRationRule2 || || | |||
|} | |} | ||
Line 292: | Line 663: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| || | | itkMixtureModelComponentBase || Refactored(same name) || | ||
* WeightsArrayType * GetWeights() non-const | |||
* double GetWeight( int ) non-const | |||
* void SetWeight( int ) | |||
* void CreateWeightArray() | |||
* void DeleteWeightArray() | |||
|| | |||
* const WeightsArrayType & GetWeights() const | |||
* double GetWeight( unsigned int ) const | |||
* void SetWeight( unsigned int ) | |||
* Removed (not needed now that Weights is not a pointer) | |||
* Removed (not needed now that Weights is not a pointer) | |||
|- | |||
| itkGaussianMixtureModelComponent || Refactored(same name) || || | |||
|} | |} | ||
Line 301: | Line 686: | ||
! Class Name !! Fate !! Deprecated API !! New API | ! Class Name !! Fate !! Deprecated API !! New API | ||
|- | |- | ||
| || | |itkKdTreeBasedKmeansEstimator || Refactored (same name) || || | ||
|- | |||
|itkExpectationMaximizationMixtureModelEstimator || Refactored (same name) || || | |||
|} | |} |
Latest revision as of 07:06, 20 December 2010
How To Migrate your code to the New Statistics Framework
Measurement Containers
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
Sample | Refactored |
|
|
Subsample | Refactored |
|
|
ListSampleBase | Deprecated. The class was unecessary, it was providing only a Search() method that should in fact be provided by a process class, not a data container. |
|
|
ListSample | Refactored |
|
|
MembershipSample | Refactoring in Progress Luis |
|
|
Histogram | Refactored same name |
|
|
VariableDimensionHistogram | Merged with the Histogram class above | ||
KdTree | moved with the same name |
Frequency Containers
The use of the data type "FrequencyType" defined in the frequency containers was very confusing in the previous statistics framework. FrequencyType was used to refer to the number of counts(hits) in a histogram bin. This is basically what absolute frequency is. In other instances, FrequencyType was used to refer to relative (normalized) frequencies. This concept mixing creates a lot of confusion. Hence, in the new statistics framework, we have separated the two concepts and defined separate types.
//Absolute Frequency type alias
typedef MeasurementVectorTraits::AbsoluteFrequencyType AbsoluteFrequencyType;
//Relative Frequency type alias
typedef MeasurementVectorTraits::RelativeFrequencyType RelativeFrequencyType;
Formal definition of relative and absolute frequencies can be found at
http://en.wikipedia.org/wiki/Frequency_(statistics)
The above frequency types are defined in the MeasurmentVectorTraits as follows
/** In the old framework, the FrequencyType is set to float. The problem is for large histograms the total frequency can be more than 1e+7, than increasing the frequency by one does not change the total frequency (because of lack of precision). Using double type will also ultimately fall into the same problem. Hence in the new statistics framework, InstanceIdentifier/FrequencyTypes are set to the the largest possible integer on the machine */
typedef std::vector<int>::size_type InstanceIdentifier;
/** Type defined for representing the frequency of measurement vectors */
typedef InstanceIdentifier AbsoluteFrequencyType;
typedef NumericTraits< AbsoluteFrequencyType >::RealType RelativeFrequencyType;
typedef NumericTraits< AbsoluteFrequencyType >::AccumulateType TotalAbsoluteFrequencyType;
typedef NumericTraits< RelativeFrequencyType >::AccumulateType TotalRelativeFrequencyType;
The containers are renamed with a suffix "2" to be able to generate a separate ITKStatistics library and be able to link with the old library during the refactoring. But once the refactoring is finialized, the name should be changed back to the original names.
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
DenseFrequencyContainer | Refactored into DenseFrequencyContainer2 |
|
|
SparseFrequencyContainer | Refactored into SpareFrequencyContainer2 |
|
|
Traits
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
MeasurementVectorTraits | Refactored (same name) |
|
MeanShift
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
Adaptors
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
ImageToCoocurrenceListAdaptor | Refactored into "ScalarImageToCoocurrenceListSampleFilter" |
|
|
ImageToListAdaptor | Refactored into "ImageToListSampleAdaptor". This class handles images with scalar, fixed size array (itk::FixedArray) and variable length vector (itk::VariableLengthVector) pixel types. |
|
|
ScalarImageToListAdaptor | Deprecated ( This class is redundant as the new ImageToListSampleAdaptor also handles scalar images with scalar pixel type. ) | ||
JointDomainImageToListAdaptor | Refactored into "JointDomainImageToListSampleAdaptor" |
|
|
PointSetToListAdapor | Refactored into "PointSetToListSampleAdaptor" |
|
|
Univariate Distributions
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
Algorithms
Algorithms, including FloorLog, MedianOfThree, FindSampleBound, FindSampleBoundAndMean, Partition, QuickSelect, NthElement, InsertSort, DownHeap, HeapSort, IntrospectiveSortLoop, IntrospectiveSort, have been moved from the itk::Statistics namespace to the itk::Statistics::Algorithm namespace.
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
Calculators
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
MeanCalculator | Refactored into MeanSampleFilter |
|
|
WeightedMeanCalculator | Refactored into WeightedMeanSampleFilter |
|
|
CovarianceCalculator | Refactored into CovarianceSampleFilter |
|
|
WeightedCovarianceCalculator | Refactored into WeightedCovarianceSampleFilter |
|
|
GreyLevelCooccurrenceMatrixTextureCoefficientsCalculator | Refactored into HistogramToTextureFeaturesFilter |
|
|
ScalarImageTextureCalculator | Refactored into ScalarImageToTextureFeaturesFilter |
|
|
Generators
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
ListSampleToHistogramGenerator | Refactored into SampleToHistogramFilter |
|
|
ImageToListGenerator | Refactored into ImageToListSampleFilter |
|
|
ScalarImageToGreyLevelCooccurrenceMatrixGenerator | Refactored into ScalarImageToCooccurrenceMatrixFilter |
|
|
MaskedScalarImageToGreyLevelCooccurrenceMatrixGenerator | Deprecated ( Use ScalarImageToCooccurrenceMatrixFilter instead since this takes a mask image in addition to the input image ) | ||
ImageToHistogramGenerator | Refactored into ImageToHistogramFilter |
|
|
Filters
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
ListSampleToHistogramFilter | Refactored as SampleToHistogramFilter |
|
|
HistogramToImageFilter | HistogramToImageFilter | ImageDimension was added as second template parameter. This is needed because now the number of components in the Histogram class are defined at run time. | |
HistogramToIntensityImageFilter | HistogramToIntensityImageFilter | ImageDimension was added as second template parameter. See HistogramToImageFilter | |
HistogramToLogProbabilityImageFilter | HistogramToLogProbabilityImageFilter | ImageDimension was added as second template parameter. See HistogramToImageFilter | |
HistogramToProbabilityImageFilter | HistogramToProbabilityImageFilter | ImageDimension was added as second template parameter. See HistogramToImageFilter | |
HistogramToEntropyImageFilter | HistogramToEntropyImageFilter | ImageDimension was added as second template parameter. See HistogramToImageFilter |
Multivariate Density Functions
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
DensityFunction | Removed ( it is a duplication of what MembershipFunction) does | ||
GaussianDensityFunction | Refactored as GaussianMembershipFunction |
Distance Metrics
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
DistanceMetric | Refactored (Same name ) |
|
|
EuclideanDistance | Refactored as EuclideanDistanceMetric |
|
|
MahalanobisDistanceMetric | Refactored same name | ||
EuclideanSquareDistanceMetric | New class | Same API as EuclideanDistance | |
ManhattanDistanceMetric | New class | Same API as EuclideanDistance |
MembershipFunctions
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
DistanceToCentroidMembershipFunction | Refactored (Same name ) |
|
|
GaussianDensityFunction | Refactored as GaussianMembershipFunction |
Process Objects
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
SampleClassifier | These are now Classifiers, see below | ||
SampleClassifierWithMask | These are now Classifiers, see below |
Classifiers
- SetSample becomes SetInput
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
ClassifierBase | Deprecated | ||
SampleClassifier | Refactored (as SampleClassifierFilter) |
the number of class labels or the number of membership functions specified.
| |
ImageClassifierBase | Refactored (as ImageClassifierFilter) |
the number of class labels or the number of membership functions specified.
|
Decision rules
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
DecisionRuleBase | Refactored as DecisionRule | * Remove Evaluate(ArrayType ) method |
|
MaximumDecisionRule | Refactored as MaximumDecisionRule2 | ||
MinimumDecisionRule | Refactored as MinimumDecisionRule2 | ||
MaximumDecisionRatioRule | Refactored as MaximumDecisionRationRule2 |
Components
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
itkMixtureModelComponentBase | Refactored(same name) |
|
|
itkGaussianMixtureModelComponent | Refactored(same name) |
Estimators
Class Name | Fate | Deprecated API | New API |
---|---|---|---|
itkKdTreeBasedKmeansEstimator | Refactored (same name) | ||
itkExpectationMaximizationMixtureModelEstimator | Refactored (same name) |