[Insight-users] Re: Problem with CenteredTransformInitializer

Luis Ibanez luis.ibanez at kitware.com
Mon May 31 12:05:27 EDT 2004


Hi Soumend,


Thanks for pointing this out.

This was a bug in the CenteredTransformInitializer
class.

The bug was fixed on April 25 2004:
http://www.itk.org/cgi-bin/cvsweb.cgi/Insight/Code/Common/itkCenteredTransformInitializer.txx.diff?r1=1.11;r2=1.12;cvsroot=Insight

The center and moving images were being computed
only in 2D. The code is now modified for supporting
N-Dimensional images.


Please update your checkout of ITK in order to
get the fix.


---

About the registration parameters that you get
with this transform:

They are six. The first three are the components of
a Versor, which is the right part of a quaternion.
Versors are Unit Quaternions and their three components
can be interpreted as:

       V1 = ax * sin( angle / 2 )
       V2 = ay * sin( angle / 2 )
       V3 = az * sin( angle / 2 )

where (ax,ay,az) are the vector component of the
unit vector parallel to the rotation axis. While
"angle" is the angle of rotation (in radians of
course).

The three other values of the parameters array are
the three components of the translation vector.

This is explained in the SoftwareGuide

     http://www.itk.org/ItkSoftwareGuide.pdf

Section 8.7.11, pdf-page 303.


Note that if you use the VersorRigid3DTransform
you *must* use the VersorRigid3DOptimizer since
Versors do not form a vector space under the
addition operation. They must use the composition
operation. This optimizer is aware of the operations
that are valid in a Versor space.

For more information about Quaternions please look
at the two tutorials in:

    http://www.itk.org/HTML/Tutorials.htm

1) QuaternionsI.pdf
http://www.itk.org/CourseWare/Training/QuaternionsI.pdf

2) QuaternionsII.pdf
http://www.itk.org/CourseWare/Training/QuaternionsII.pdf



-----------



Let us know if you have any other questions.



   Thanks


    Luis



--------------
S Dey wrote:

> Hi!!!!
> 
> Presently I am trying to register two 3D images using Versor3DRigidTransform
> amd MattesMI metric. I am initializing the transform by CenteredTransform
> Initializer. Now the problem is initializer is not initializing the Z
> coordinate values of centerMoving and centerFixed.
> 
> fixed Image Origin is [-140.2373,-140.2372,79]
> moving Image Origin is [-270.5,-270.5,-688.5]
> 
> What i am getting as initial transform parameters is as follows....
> [0,0,0,0,0,-9.25596e+061,5.7373,166.737,0]
> 
> then registration exceptions out by saying.....
> 
> itk::ExceptionObject (00F5FC88)
> Location: "Unknown"
> File:
> C:\AnuVi\Insight\Code\Algorithms\itkMattesMutualInformationImageToImageMet
> ric.txx
> Line: 547
> Description: itk::ERROR:
> MattesMutualInformationImageToImageMetric(01371490): Too many samples map
> outside moving image buffer: 0 / 10000
> 
> but if i change the initializer's initializetransform()
> from
> 
> typename TransformType::InputPointType centerFixed;
> 
>     centerFixed[0] = fixedOrigin[0] + fixedSpacing[0] * fixedSize[0] / 2.0;
>     centerFixed[1] = fixedOrigin[1] + fixedSpacing[1] * fixedSize[1] / 2.0;
> 
>     const double * movingSpacing = m_MovingImage->GetSpacing();
>     const double * movingOrigin  = m_MovingImage->GetOrigin();
> 
>     typename MovingImageType::SizeType movingSize =
>       m_MovingImage->GetLargestPossibleRegion().GetSize();
> 
>     typename TransformType::InputPointType centerMoving;
> 
>     centerMoving[0] = movingOrigin[0] + movingSpacing[0] * movingSize[0] /
> 2.0;
>     centerMoving[1] = movingOrigin[1] + movingSpacing[1] * movingSize[1] /
> 2.0;
> to
> typename TransformType::InputPointType centerFixed;
> 
>     centerFixed[0] = fixedOrigin[0] + fixedSpacing[0] * fixedSize[0] / 2.0;
>     centerFixed[1] = fixedOrigin[1] + fixedSpacing[1] * fixedSize[1] / 2.0;
> 	centerFixed[2] = fixedOrigin[2] + fixedSpacing[2] * fixedSize[2] /
> 2.0;-----> Line added
> 
> 
>     const double * movingSpacing = m_MovingImage->GetSpacing();
>     const double * movingOrigin  = m_MovingImage->GetOrigin();
> 
>     typename MovingImageType::SizeType movingSize =
>       m_MovingImage->GetLargestPossibleRegion().GetSize();
> 
>     typename TransformType::InputPointType centerMoving;
> 
>     centerMoving[0] = movingOrigin[0] + movingSpacing[0] * movingSize[0] /
> 2.0;
>     centerMoving[1] = movingOrigin[1] + movingSpacing[1] * movingSize[1] /
> 2.0;
> 	centerMoving[2] = movingOrigin[2] + movingSpacing[2] * movingSize[2] /
> 2.0;----> line added
> 
> the registration process gets completed .
> 
> Now what is the problem ..is it a bug in initializer or am i doing something
> wrong.
> 
> Another thing ..will u plz explain me the registration parameters obtained
> after registration(i.e. versor x,versory..etc)
> 
> Soumen
> 
> 
> 







More information about the Insight-users mailing list