[Insight-users] point to point registration - itkMatrix to
vtkMatrix, AffineRegistration
Boettcher, Dr. Peter
Boettcher at kleintierklinik.uni-leipzig.de
Sun Sep 25 10:48:24 EDT 2005
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20050925/058da9c8/attachment.html
More information about the Insight-users
mailing list