[Insight-developers] CenteredVersorTransformInitializer bug

Simon Warfield warfield at crl.med.harvard.edu
Mon May 15 11:03:44 EDT 2006


The CenteredVersorTransformInitializer seems to have a bug.
The class aims to do the following:
> CenteredVersorTransformInitializer 
> <http://www.itk.org/Doxygen/html/classitk_1_1CenteredVersorTransformInitializer.html> 
> is a helper class intended to initialize the center of rotation, 
> versor, and translation of the VersorRigid3DTransform 
> <http://www.itk.org/Doxygen/html/classitk_1_1VersorRigid3DTransform.html>. 
>
>
> This class derived from the CenteredTransformInitializer 
> <http://www.itk.org/Doxygen/html/classitk_1_1CenteredTransformInitializer.html> 
> and uses it in a more constrained context. It always uses the Moments 
> mode, and also takes advantage of the second order moments in order to 
> initialize the Versor 
> <http://www.itk.org/Doxygen/html/classitk_1_1Versor.html> representing 
> rotation.
>

The code for initialization computes principal axes, but does not appear 
to actually compute a versor.
> template < class TFixedImage, class TMovingImage >
> void
> CenteredVersorTransformInitializer<TFixedImage, TMovingImage >
> ::InitializeTransform() const
> {
>
>   // Compute moments and initialize center of rotaion and translation
>   this->Superclass::InitializeTransform();
>
>   typedef typename Superclass::FixedImageCalculatorType::MatrixType   
> FixedMatrixType;
>   typedef typename Superclass::MovingImageCalculatorType::MatrixType  
> MovingMatrixType;
>
>   FixedMatrixType   fixedPrincipalAxis  = 
> this->GetFixedCalculator()->GetPrincipalAxes();
>   MovingMatrixType  movingPrincipalAxis = 
> this->GetMovingCalculator()->GetPrincipalAxes();
>
> }

When I use this on my data, I do not get an initialized versor. It 
doesn't work with my data and it doesn't work with the brainweb test 
data described in the software guide.  Should there be code added that 
initializes the versor ?

Some of the documentation about transforms is not clear to me (maybe I 
am looking at old documentation).
Are CenteredTransforms deprecated or not ? It seems Centered transforms 
have been deprecated in favor of transforms that have centers.
i.e. what is the relationship between AffineTransform and 
FixedCenterOfRotationAffineTransform



Are the common parameters that characterize transforms the:
1. center
2. translation
3. matrix
 ? 
Several of the classes have methods that say :
``To define an affine transform, you must set the matrix, center, and 
translation OR the matrix and offset Definition at line 250 
<http://www.itk.org/Doxygen/html/itkMatrixOffsetTransformBase_8h-source.html#l00250> 
of file itkMatrixOffsetTransformBase.h 
<http://www.itk.org/Doxygen/html/itkMatrixOffsetTransformBase_8h-source.html>.''
The documentation doesn't say what happens if I use a method such as 
SetRotation() ? 


There are several other possible parameters described (offset, rotation, 
scale parameters) and the nature of which are convenience helper 
functions and which are critical to the transform representation is not 
clear.
This makes it hard to write code that works with families of transforms 
e.g. code that can use a Translation Transform, or a RigidVersor3D 
Transform or an AffineTransform.  Each seems to have a number of special 
case characteristics that don't fit well in an object oriented 
hierarchy.  Is it that each really has to be used through special cases, 
or is it that I can't work out the object orientation ?  It seems to me 
that since a TranslationTransform or a rigid body transform is a special 
kind of AffineTransform.  That is, a developer should be able to cast 
from a simpler transform to a more complicated transform, and use it do 
e.g. do resampling, or to initialize parameters, without too much 
trouble.  This doesn't seem to be the case.

The 2.4 SoftwareGuide has examples that use 
transform->GetRotationMatrix() which is supposed to be deprecated.


ScaleSkewVersorTransforms have a SetMatrix() member function that is a 
stub implementation that prints an error message and fails.

-- 
Simon K. Warfield, Ph.D.        warfield at crl.med.harvard.edu
Phone: 617-732-7090                      FAX:   617-582-6033
Associate Professor of Radiology,     Harvard Medical School
Director, Computational Radiology Laboratory, 
Departments of Radiology at Children's Hospital and
Brigham and Women's Hospital,
Thorn 329, Dept Radiology,  Brigham and Women's Hospital
75 Francis St, Boston, MA, 02115
MA 280, Dept Radiology, Children's Hospital Phone: 617-355-4566



More information about the Insight-developers mailing list