]> Creatis software - clitk.git/commitdiff
Consistency of information between Info Pannel and Cursor Position Overlay
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Fri, 19 Feb 2016 15:29:21 +0000 (16:29 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Fri, 19 Feb 2016 15:29:21 +0000 (16:29 +0100)
> Now the position in voxel is the same and change with transformation (as the value and not the position in mm)

vv/vvSlicerManager.cxx

index 82d6508bf8445eed080b45706bb645cac50efa4a..b1829e0a29223abb5b578e0932355276c9ab98c3 100644 (file)
@@ -1171,6 +1171,17 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
     mSlicers[slicer]->GetInput()->GetSpacing()[1];\r
   double Z = (z - mSlicers[slicer]->GetInput()->GetOrigin()[2])/\r
     mSlicers[slicer]->GetInput()->GetSpacing()[2];\r
+  double xyz[3], xyzTransform[3];\r
+  xyz[0] = x;\r
+  xyz[1] = y;\r
+  xyz[2] = z;\r
+  mSlicers[slicer]->GetConcatenatedTransform()->TransformPoint(xyz, xyzTransform);\r
+  double XTransform = (xyzTransform[0] - mSlicers[slicer]->GetInput()->GetOrigin()[0])/\r
+    mSlicers[slicer]->GetInput()->GetSpacing()[0];\r
+  double YTransform = (xyzTransform[1] - mSlicers[slicer]->GetInput()->GetOrigin()[1])/\r
+    mSlicers[slicer]->GetInput()->GetSpacing()[1];\r
+  double ZTransform = (xyzTransform[2] - mSlicers[slicer]->GetInput()->GetOrigin()[2])/\r
+    mSlicers[slicer]->GetInput()->GetSpacing()[2];\r
   double value = -VTK_DOUBLE_MAX;\r
   int displayVec = 0;\r
   double xVec=0, yVec=0, zVec=0, valueVec=0;\r
@@ -1178,12 +1189,12 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
   int displayFus = 0;\r
   double valueOver=0, valueFus=0;\r
 #if VTK_MAJOR_VERSION <= 5\r
-    if (X >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] &&\r
-      X <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] &&\r
-      Y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2] &&\r
-      Y <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3] &&\r
-      Z >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4] &&\r
-      Z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]) {\r
+    if (XTransform >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] &&\r
+      XTransform <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] &&\r
+      YTransform >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2] &&\r
+      YTransform <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3] &&\r
+      ZTransform >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4] &&\r
+      ZTransform <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]) {\r
 \r
     value = this->GetScalarComponentAsDouble(mSlicers[slicer]->GetInput(), X, Y, Z);\r
 \r
@@ -1232,7 +1243,7 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
        }\r
 \r
     emit UpdatePosition(mSlicers[slicer]->GetCursorVisibility(),\r
-                        x,y,z,X,Y,Z,value);\r
+                        x,y,z,XTransform,YTransform,ZTransform,value);\r
     emit UpdateVector(displayVec,xVec, yVec, zVec, valueVec);\r
     emit UpdateOverlay(displayOver,valueOver,value);\r
     emit UpdateFusion(displayFus,valueFus);\r
@@ -1240,12 +1251,12 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
 #else\r
 int extentImageReslice[6];\r
 mSlicers[slicer]->GetRegisterExtent(extentImageReslice);\r
-    if (X >= extentImageReslice[0] &&\r
-      X <= extentImageReslice[1] &&\r
-      Y >= extentImageReslice[2] &&\r
-      Y <= extentImageReslice[3] &&\r
-      Z >= extentImageReslice[4] &&\r
-      Z <= extentImageReslice[5]) {\r
+    if (XTransform >= extentImageReslice[0] &&\r
+      XTransform <= extentImageReslice[1] &&\r
+      YTransform >= extentImageReslice[2] &&\r
+      YTransform <= extentImageReslice[3] &&\r
+      ZTransform >= extentImageReslice[4] &&\r
+      ZTransform <= extentImageReslice[5]) {\r
 \r
     value = this->GetScalarComponentAsDouble(mSlicers[slicer]->GetInput(), X, Y, Z);\r
 \r
@@ -1294,7 +1305,7 @@ mSlicers[slicer]->GetRegisterExtent(extentImageReslice);
        }\r
 \r
     emit UpdatePosition(mSlicers[slicer]->GetCursorVisibility(),\r
-                        x,y,z,X,Y,Z,value);\r
+                        x,y,z,XTransform,YTransform,ZTransform,value);\r
     emit UpdateVector(displayVec,xVec, yVec, zVec, valueVec);\r
     emit UpdateOverlay(displayOver,valueOver,value);\r
     emit UpdateFusion(displayFus,valueFus);\r