[Insight-users] point to point registration - itkMatrix to vtkMatrix, AffineRegistration

Luis Ibanez luis.ibanez at kitware.com
Wed Sep 28 14:29:41 EDT 2005


Hi Peter


About your questions:


1) It is possible to use Affine Transform withoug shearing?

Answer:

    Yes,
    you have at least two options:


    A) Use the ScaleSkewVersor3DTransform and set the Skew to zero
http://www.itk.org/Insight/Doxygen/html/classitk_1_1ScaleSkewVersor3DTransform.html


    B) Use the Similarity3DTransform
http://www.itk.org/Insight/Doxygen/html/classitk_1_1Similarity3DTransform.html



    Both of those transform cab give you the parameters in the form
    of a Matrix + Translation, so you will recognize the format as
    it is very similar to the 4 X 4 Matrix in homogeneous coordinates
    that you might be used to.



2) About the direction of the transform please read the
    relevant comments in the ITK Software Guide

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

    In particular in section 8.3.1, "Direction of the Transform Mapping"
    in pdf-page 350.

    The transforms that you get in ITK indicate how to map
    a point from the Fixed coordinate system into the Moving
    coordinate system. This is explained in length in that section.



Note that you have other options, Point To Point registration is not
only inefficient, but it also has the *very annoying feature* of being
*patented by General Motors*. You cannot use the ICP algorithm without
asking General Motors for a license. This is regardless of whether you
use the code for research of for a commercial application.  The only
allowed use of patented material (without a license) is for


         "solely for amusement,
          to satisfy idle curiosity,
          or for strictly philosophical inquiry"

    http://www.ladas.com/BULLETINS/2003/MadeyDukeUniversity.html




So... instead of ICP, another approach that you could consider is
the PointSet to ImageRegistration, or the Model to Image registration.

For the first one you can use the class
http://www.itk.org/Insight/Doxygen/html/classitk_1_1PointSetToImageRegistrationMethod.html

For the second you may want to look at the example on the ITK Software
Guide, in section 8.16 "Model Based Registration" in pdf-page 499.



    Regards,


       Luis



-----------------------------
Boettcher, Dr. Peter wrote:
> Hello
> 
>  
> 
> I would like to fit a cylinder on to the medial condyle of the femur 
> reconstructed based on CT images within vtk. For that purpose I pick 
> several points on the surface of the condyle within vtk and pass them as 
> the fixed point cloud to a point to point registration like the one in 
> example\patented\ iterativerClosestPoint2 or 3. Second I generate a 
> cylinder 3D-object in vtk (vtkCylinderSource) and extract its points. 
> They a passed to the registration as the moving point cloud. In contrast 
> to the examples in the itk-book I use AffineTransformation, because I 
> need scaling in addition to translation and rotation of the cylinder.
> 
>  
> 
> Here comes my first question: is it possible using AffineTransformation 
> without shearing? I am only interested in translation, rotation and 
> scaling. I woul prefer using AffineTransformatino because its output is 
> more familiar to me than the other transformer.
> 
>  
> 
> At the end of the registration (at the moment with shearing) I extract 
> the transformation matrix and translate it to vtk:
> 
>  
> 
> vtkMatrix4x4 *matrixVTK = vtkMatrix4x4::New();
> 
>  
> 
>   TransformType::MatrixType matrixITK =  transform->GetMatrix();
> 
>   TransformType::OffsetType offset = transform->GetOffset();
> 
>  
> 
>             matrixVTK->SetElement(0,0,*matrixITK[0,0]);
> 
>             matrixVTK->SetElement(0,1,*matrixITK[0,1]);
> 
>             matrixVTK->SetElement(0,2,*matrixITK[0,2]);
> 
>             matrixVTK->SetElement(0,3,offset[0]);
> 
>             matrixVTK->SetElement(1,0,*matrixITK[1,0]);
> 
>             matrixVTK->SetElement(1,1,*matrixITK[1,1]);
> 
>             matrixVTK->SetElement(1,2,*matrixITK[1,2]);
> 
>             matrixVTK->SetElement(1,3,offset[1]);
> 
>             matrixVTK->SetElement(2,0,*matrixITK[2,0]);
> 
>             matrixVTK->SetElement(2,1,*matrixITK[2,1]);
> 
>             matrixVTK->SetElement(2,2,*matrixITK[2,2]);
> 
>             matrixVTK->SetElement(2,3,offset[2]);
> 
>             matrixVTK->SetElement(3,0,0);
> 
>             matrixVTK->SetElement(3,1,0);
> 
>             matrixVTK->SetElement(3,2,0);
> 
>             matrixVTK->SetElement(3,3,1);
> 
>  
> 
> Using
> 
> m_actorCylinder->SetUserMatrix(matrixVTK);
> 
> m_renWin->Render();
> 
>  
> 
> shows the result in 3D (vtk).
> 
>  
> 
> The script runs well, but the results are not what I expected. 
> Especially the scaling factors are well too small. Moreover I doubt that 
> the conversion from the itk-matrix to the vtk-matrix is
> 
> right the way I did. It seems for example, that the matrixVTK[0,1] does 
> not correspond to the matrixITK[0,1]. To translate the moving 3D object 
> onto the fixed 3D object in vtk do I have to invert the transformation I 
> got in the itk?
> 
>  
> 
> Last but not least I implemented a registration observer and its class 
> to monitor  the registration process in 3D by updating the vtk-pipeline 
> - but the observer is not invoked during the registration process:
> 
>             // Observer
> 
>             CommandIterationUpdate::Pointer observer = 
> CommandIterationUpdate::New();
> 
>             optimizer->AddObserver( itk::IterationEvent(), observer );
> 
>  
> 
> I would deeply appreciate any help or comment
> 
>  
> 
> Peter.
> 
>  
> ------------------------------------
> P. Böttcher, Dr med vet, DipECVS
> European Veterinary Specialist in Surgery
> Klinik für Kleintiere
> Universität Leipzig
> An den Tierkliniken 23
> D-04103 Leipzig (Germany)
> Tel: +49-341-9738700
> Fax: +49-341-9738799
> email: boettcher at kleintierklinik.uni-leipzig.de 
> <mailto:boettcher at kleintierklinik.uni-leipzig.de>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list