Dear MITK developers,

I had a problem using the interactive manual translation of the RigidRegistration functionality. In my case I tried to manually align two datasets (one CT and one ultrasound dataset). To initially align the two datasets I had to position the (much smaller) ultrasound volume at a certain location in space which is different from 0,0,0 in x,y and z direction. This was done by modifying the header file of the dataset.

When I tried to use the manual sliders to correct my initial alignment a bit, an error occurred. The ultrasound volume was pushed back to 0,0,0 and then translated just by the amount given by the slider positions. Looking at the code I found out that it is not correct to subtract the old volume position from the translation vector given by the sliders. This approach only works for volumes at 0,0,0.

Please have a look at my patch, where I store the old slider values and translate the volume by the difference between these stored values and the current slider values.

Best wishes,
Matthias

--
| Dipl.-Ing. Matthias Keil
|
| Fraunhofer Institute for Computer Graphics (IGD)
| Cognitive Computing & Medical Imaging
| Fraunhoferstraße 5, 64283 Darmstadt, Germany
|
| phone  : +49.6151.155.212
| fax    : +49.6151.155.480
| e-mail : [EMAIL PROTECTED]
| skype  : matthias.keil.office
| web    : http://www.igd.fraunhofer.de/~makeil

Index: QFunctionalities/QmitkRigidRegistration/QmitkRigidRegistration.cpp
===================================================================
--- QFunctionalities/QmitkRigidRegistration/QmitkRigidRegistration.cpp  
(revision 15726)
+++ QFunctionalities/QmitkRigidRegistration/QmitkRigidRegistration.cpp  
(working copy)
@@ -37,6 +37,10 @@
   m_ShowRedGreen(false), m_ShowFixedImage(false), m_ShowMovingImage(false), 
m_ShowBothImages(true), m_Opacity(0.5), m_OriginalOpacity(1.0), 
m_OldMovingLayer(0),
   m_NewMovingLayer(0), m_OldMovingLayerSet(false), m_NewMovingLayerSet(false)
 {
+  m_TranslateSliderPos[0] = 0;
+  m_TranslateSliderPos[1] = 0;
+  m_TranslateSliderPos[2] = 0;
+
   SetAvailability(true);
 }
 
@@ -546,16 +550,16 @@
 { 
   if (m_MovingNode != NULL)
   {
-    float* oldPos = new float[3];
+    mitk::Vector3D translateVec; 
 
-    oldPos[0] = m_MovingNode->GetVtkTransform()->GetMatrix()->GetElement(0,3);
-    oldPos[1] = m_MovingNode->GetVtkTransform()->GetMatrix()->GetElement(1,3);
-    oldPos[2] = m_MovingNode->GetVtkTransform()->GetMatrix()->GetElement(2,3);
+    translateVec[0] = translateVector[0] - m_TranslateSliderPos[0];
+    translateVec[1] = translateVector[1] - m_TranslateSliderPos[1];
+    translateVec[2] = translateVector[2] - m_TranslateSliderPos[2];
 
-    mitk::Vector3D translateVec; 
-    translateVec[0] = translateVector[0] - oldPos[0];
-    translateVec[1] = translateVector[1] - oldPos[1];
-    translateVec[2] = translateVector[2] - oldPos[2];
+    m_TranslateSliderPos[0] = translateVector[0];
+    m_TranslateSliderPos[1] = translateVector[1];
+    m_TranslateSliderPos[2] = translateVector[2];
+
     m_MovingNode->GetData()->GetGeometry()->Translate( translateVec );
 
     m_MovingNode->GetData()->Modified();
Index: QFunctionalities/QmitkRigidRegistration/QmitkRigidRegistration.h
===================================================================
--- QFunctionalities/QmitkRigidRegistration/QmitkRigidRegistration.h    
(revision 15726)
+++ QFunctionalities/QmitkRigidRegistration/QmitkRigidRegistration.h    
(working copy)
@@ -215,6 +215,7 @@
     mitk::Color m_FixedColor;
     mitk::Color m_MovingColor;
     invisibleNodesList m_InvisibleNodesList;
+    int m_TranslateSliderPos[3];
 };
 
 #endif //QMITKRigidREGISTRATION_H
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to