Proposals:Statistics Framework Runtime Vector Size: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
Line 51: Line 51:




2.
2. VariableSizeMatrix
NAMICSandBox/RefactoringITKStatisticsClasses/src/itkVariableSizeMatrix
 
Similar to itk::Matrix with a similar API

Revision as of 18:55, 14 July 2005

Refactoring the Statistics Framework to have Runtime Length

Currently, the Statistics Framework requires the MeasurementVector to have a length defined at compile time.

Rationale for having compile time length

The statistics classes in ITK have MeasurementVectorSize (length of each measurement vector) as a static const value. This has until now been sufficient since typical statistics operations involve sampling an image where the number of measurement vectors is a variable, but the measurement vector size is usually fixed and depends on the dimension of the parametric space.

Rationale for having run time length

For algorithms such as Normalized cuts [1] and other Kernel PCA feature space projection techniques [2], it may be necessary to keep the dimensionality of the feature space as a variable. This requires removing MeasurementVectorSize as a static method and making it an iVar.

[1] PAMI - Vol26, No2, Spectral Grouping using the Nystrom method , Feb 2004

[2] Neural Computation - Nonlinear component analysis as a Kernel Eigenvalue problem, vol 10, 1998

Proposed Implementation Plan

This requires removing MeasurementVectorSize as a static method and making it an iVar.

FixedArrays, itk::Matrix and vnl_fixed that are templated over MeasurementVectorSize will have to be replaced by itk::Array, vnl_matrix and vnl_vector, where the size may be chosen at run time.

The SymmetricEigenAnalysis class must be used for eigen analysis since it is not templated over the dimension.

Bounds checking will have to be performed manually on all methods that use these FixedArrays.

API hiccups are unavoidable.. Warning macros will have to be provided. An open question is how to appropriately provide deprecated warning macros. I would suggest we place them in the constructor of all affected classes.

Very few statistics classes are used outside the statistics group. One of them is itk::Histogram.. Affects Histogram metrics. Typedefs like IndexType and SizeType will have to be replaced.


Testing

See NAMICSandbox/RefactoringStatisticsClasses/

The goal is to test the Tests in the folder running fine before moving them to ITK. The tests can be run as usual after building with CMake. See NAMICSandbox/RefactoringStatisticsClasses/README

Proposed Transition Plan

Current Status

1. VariableDimensionHistogram

Class to handle variable length histograms added in NAMIC sandbox NAMICSandBox/RefactoringITKStatisticsClasses/src/itkVariableDimensionHistogram.h, .txx NAMICSandBox/RefactoringITKStatisticsClasses/Tests/itkVariableDimensionHistogramTest.cxx

The class is similar to itk::Histogram with modifications to allow the dimension of the histogram (which is dependent on the size of each measurement vector) to be set at run-time.


2. VariableSizeMatrix NAMICSandBox/RefactoringITKStatisticsClasses/src/itkVariableSizeMatrix

Similar to itk::Matrix with a similar API