# Difference between revisions of "ITK Working Group DTI"

Line 3: | Line 3: | ||

This page is intended to list proposals for changes to ITK to improve the processing of diffusion weighted and diffusion tensor images. | This page is intended to list proposals for changes to ITK to improve the processing of diffusion weighted and diffusion tensor images. | ||

= | == casting support == | ||

neither itkDiffusionTensor3D or itkSymmetricSecondRankTensor have full numericTraits. DiffusionTensor3D doesn't have any. | |||

static_cast< diffusionTensor3d > doesn't work. incorporating constructors like the following to both classes would enable casting. | |||

template < typename TCoordRepB > | template < typename TCoordRepB > | ||

SymmetricSecondRankTensor( const SymmetricSecondRankTensor<TCoordRepB,NDimension> & pa ): BaseArray(pa) { }; | SymmetricSecondRankTensor( const SymmetricSecondRankTensor<TCoordRepB,NDimension> & pa ): BaseArray(pa) { }; | ||

== Pre/Post Multiply == | |||

the product of a symmetric matrix and a matrix is not symmetric. A possible solution may be | the pre/post multiply methods in itkSymmetricSecondRankTensor have the wrong api [http://www.itk.org/Bug/view.php?id=8574 bug0008574] | ||

add | the product of a symmetric matrix and a matrix is not symmetric. | ||

A possible solution may be to add a method like | |||

Self PreMultiply( const Self & m ) const; | Self PreMultiply( const Self & m ) const; | ||

which is ok because a sym matrix times a sym matrix is still symmetric. and then to modify | |||

modify | |||

Self PreMultiply( const MatrixType & m ) const; | Self PreMultiply( const MatrixType & m ) const; | ||

to check if m is symmetric, if it is then call Premultiply( static_cast<Self> m) if m isn't throw an exception. | to check if m is symmetric, if it is then call Premultiply( static_cast<Self> m) if m isn't throw an exception. | ||

Granted this | |||

Granted this will break existing code, however it will only break code that was giving incorrect results. I think that is preferable to maintaining the status quo. | |||

= | == Rotation == | ||

A rotate method should be implemented [http://www.itk.org/Bug/view.php?id=8574 bug0008574] in itkSymmetricSecondRankTensor. I propose the following signatures to enable some generality. | |||

template<typename TMatrixValueType> | template<typename TMatrixValueType> | ||

Self Rotate( const Matrix<TMatrixValueType, NDimension, NDimension> & m); | Self Rotate( const Matrix<TMatrixValueType, NDimension, NDimension> & m); | ||

Line 33: | Line 36: | ||

return this->Rotate( static_cast<Matrix<TMatrixValueType> >(m) ); | return this->Rotate( static_cast<Matrix<TMatrixValueType> >(m) ); | ||

} | } | ||

additionally the application of a transform to dti images necesitates the computation of the spatial jacobian at the points of interest. | |||

[http://www.itk.org/Bug/view.php?id=8786 bug0008786]. This bug proposed putting a numeric version of this computation in itkTransform, and to allow specific classes to override this method with analytical solutions. | |||

== log-euclidean metric == | |||

2 methods are needed to implement the log-euclidean metic | |||

# add GetMatrixExp( ) to SymmetricSecondRankTensor which computes the matrix exponential and returns a SymmetricSecondRankTensor | |||

# add GetMatrixLog() to DiffusionTensor3D, which computes the matrix log and returns a SymmetricSecondRankTensor | |||

{{ITK/Template/Footer}} | {{ITK/Template/Footer}} |

## Latest revision as of 22:45, 24 April 2009

# Motivation

This page is intended to list proposals for changes to ITK to improve the processing of diffusion weighted and diffusion tensor images.

## casting support

neither itkDiffusionTensor3D or itkSymmetricSecondRankTensor have full numericTraits. DiffusionTensor3D doesn't have any.

static_cast< diffusionTensor3d > doesn't work. incorporating constructors like the following to both classes would enable casting.

template < typename TCoordRepB > SymmetricSecondRankTensor( const SymmetricSecondRankTensor<TCoordRepB,NDimension> & pa ): BaseArray(pa) { };

## Pre/Post Multiply

the pre/post multiply methods in itkSymmetricSecondRankTensor have the wrong api bug0008574 the product of a symmetric matrix and a matrix is not symmetric.

A possible solution may be to add a method like

Self PreMultiply( const Self & m ) const;

which is ok because a sym matrix times a sym matrix is still symmetric. and then to modify

Self PreMultiply( const MatrixType & m ) const;

to check if m is symmetric, if it is then call Premultiply( static_cast<Self> m) if m isn't throw an exception.

Granted this will break existing code, however it will only break code that was giving incorrect results. I think that is preferable to maintaining the status quo.

## Rotation

A rotate method should be implemented bug0008574 in itkSymmetricSecondRankTensor. I propose the following signatures to enable some generality.

template<typename TMatrixValueType> Self Rotate( const Matrix<TMatrixValueType, NDimension, NDimension> & m); template<typename TMatrixValueType> Self Rotate( const vnl_matrix_fixed<TMatrixValueType, NDimension, NDimension> & m) { return this->Rotate( static_cast<Matrix<TMatrixValueType, NDimension, NDimension> >(m) ); } template<typename TMatrixValueType> Self Rotate( const vnl_matrix<TMatrixValueType> & m) { return this->Rotate( static_cast<Matrix<TMatrixValueType> >(m) ); }

additionally the application of a transform to dti images necesitates the computation of the spatial jacobian at the points of interest. bug0008786. This bug proposed putting a numeric version of this computation in itkTransform, and to allow specific classes to override this method with analytical solutions.

## log-euclidean metric

2 methods are needed to implement the log-euclidean metic

- add GetMatrixExp( ) to SymmetricSecondRankTensor which computes the matrix exponential and returns a SymmetricSecondRankTensor
- add GetMatrixLog() to DiffusionTensor3D, which computes the matrix log and returns a SymmetricSecondRankTensor