MantisBT - ITK
View Issue Details
0008574ITKpublic2009-02-20 14:562010-11-18 13:21
Casey B Goodlett 
Luis Ibanez 
normalminoralways
assignedopen 
ITK-3-10 
 
0008574: SymmetricSecondRankTensor PreMultiply and PostMultiply have incorrect API
Both the PerMultiply and PostMultiply methods of SymmetricSecondRankTensor return a symmetric tensor, but pre or post multiplication of a symmetric tensor by a rotation matrix does not result in a symmetric tensor.

Assuming D is a diffusion tensor and R a rotation matrix, diffusion tensors are usually rotated by

rot(D) = R * D * R^T;

but both R * D and D * R^T are not themselves symmetric matrices. For example let D be an identity matrix and R a non-identity matrix. R*D is R which is not symmetric.

If you try to implement a rotation as D.PreMultiply(R).PostMultiply(R.transpose()), you get incorrect results because the return type enforces symmetry.

My opinion is that these methods should be removed and replaced with a single method named something like Rotate. Only premultiplication or only postmultiplication is probably not a useful operation at least for diffusion tensors. Backwards compatibility should not be preserved here because the current API can never give a correct answer for R * D as the return type enforces symmetry.

I have attached a patch which removes the incorrect methods and replaces them with a usable, though not particularly efficient, Rotate method. I also added to the test class a test that rotating a tensor gives a correct result.
No tags attached.
has duplicate 0010195closed kentwilliams Pre-multiply and Post-mutliply functions in itkSymmetricSecondRankTensor 
patch symmetrictensor-rotate.patch (5,848) 2009-02-20 14:56
https://public.kitware.com/Bug/file/2071/symmetrictensor-rotate.patch
patch SymmetricSecondRankTensorWithRotate.patch (2,269) 2009-04-24 13:09
https://public.kitware.com/Bug/file/2187/SymmetricSecondRankTensorWithRotate.patch
Issue History
2009-02-20 14:56Casey B GoodlettNew Issue
2009-02-20 14:56Casey B GoodlettFile Added: symmetrictensor-rotate.patch
2009-04-24 13:09Luke BloyNote Added: 0016186
2009-04-24 13:09Luke BloyFile Added: SymmetricSecondRankTensorWithRotate.patch
2010-03-08 03:49Tom VercauterenRelationship addedhas duplicate 0010195
2010-11-02 14:03Hans JohnsonStatusnew => assigned
2010-11-02 14:03Hans JohnsonAssigned To => kentwilliams
2010-11-04 12:56kentwilliamsNote Added: 0022837
2010-11-18 13:21kentwilliamsAssigned Tokentwilliams => Luis Ibanez

Notes
(0016186)
Luke Bloy   
2009-04-24 13:09   
I'm attaching an alternative patch that just includes that Rotate method.

The main change is that the component type of the itk::matrix is templated.
(0022837)
kentwilliams   
2010-11-04 12:56   
I'm not enough of a Linear Algebraist to formulate a good regressiontest to add -- anyone want to suggest or write such a test?