]> Creatis software - clitk.git/commitdiff
Debug cross hair with 1D image
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Thu, 15 Sep 2016 12:06:31 +0000 (14:06 +0200)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Thu, 15 Sep 2016 12:06:31 +0000 (14:06 +0200)
Change look: VTK_VERSION conditions are just written around the problematic part

vv/vvSlicerManager.cxx

index 1a9ad685f80e355b1fc105083e882b05156ad049..fc6c6f2c3fc24df002b14852bdd5fedae4d19329 100644 (file)
@@ -703,67 +703,7 @@ void vvSlicerManager::UpdateViews(int current,int slicer)
       y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2]-0.5 &&\r
       y <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3]+0.5 &&\r
       z >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4]-0.5 &&\r
-      z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]+0.5) {\r
-    mSlicers[slicer]->UpdateCursorPosition();\r
-    mSlicers[slicer]->SetCursorColor(10,212,255);\r
-    mSelectedSlicer = slicer;\r
-\r
-    switch (mSlicers[slicer]->GetSliceOrientation()) {\r
-    case vtkImageViewer2::SLICE_ORIENTATION_XY:\r
-      if (mSlicers[slicer]->GetSlice() != (int)lrint(z))\r
-        mSlicers[slicer]->SetSlice((int)lrint(z));\r
-      break;\r
-\r
-    case vtkImageViewer2::SLICE_ORIENTATION_XZ:\r
-      if (mSlicers[slicer]->GetSlice() != (int)lrint(y))\r
-        mSlicers[slicer]->SetSlice((int)lrint(y));\r
-      break;\r
-\r
-    case vtkImageViewer2::SLICE_ORIENTATION_YZ:\r
-      if (mSlicers[slicer]->GetSlice() != (int)lrint(x))\r
-        mSlicers[slicer]->SetSlice((int)lrint(x));\r
-      break;\r
-    }\r
-    mSlicers[slicer]->Render();\r
-\r
-    for ( unsigned int i = 0; i < mSlicers.size(); i++) {\r
-      if (i != (unsigned int)slicer\r
-          && mSlicers[i]->GetRenderer()->GetDraw()\r
-          && mSlicers[i]->GetRenderWindow()->GetSize()[0] > 2\r
-          && mSlicers[i]->GetRenderWindow()->GetSize()[1] > 2) {\r
-        mSlicers[i]->SetCurrentPosition(p[0], p[1], p[2], mSlicers[slicer]->GetMaxCurrentTSlice());\r
-        mSlicers[i]->UpdateCursorPosition();\r
-        if (current) { //do not display corner annotation if image is the one picked\r
-          mSlicers[i]->SetCurrentPosition(-VTK_DOUBLE_MAX,-VTK_DOUBLE_MAX,\r
-                                          -VTK_DOUBLE_MAX, mSlicers[slicer]->GetMaxCurrentTSlice());\r
-          mSlicers[i]->SetCursorColor(255,10,212);\r
-        } else {\r
-          mSlicers[i]->SetCursorColor(150,10,282);\r
-        }\r
-        switch (mSlicers[i]->GetSliceOrientation()) {\r
-        case vtkImageViewer2::SLICE_ORIENTATION_XY:\r
-          if (mSlicers[i]->GetSlice() != (int)lrint(z))\r
-            mSlicers[i]->SetSlice((int)lrint(z));\r
-          break;\r
-\r
-        case vtkImageViewer2::SLICE_ORIENTATION_XZ:\r
-          if (mSlicers[i]->GetSlice() != (int)lrint(y))\r
-            mSlicers[i]->SetSlice((int)lrint(y));\r
-          break;\r
-\r
-        case vtkImageViewer2::SLICE_ORIENTATION_YZ:\r
-          if (mSlicers[i]->GetSlice() != (int)lrint(x))\r
-            mSlicers[i]->SetSlice((int)lrint(x));\r
-          break;\r
-        }\r
-        \r
-        mSlicers[i]->Render();\r
-        \r
-        UpdateSlice(i);\r
-        UpdateTSlice(i);\r
-      }\r
-    }\r
-  }\r
+      z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]+0.5)\r
 #else\r
 int extentImageReslice[6];\r
 mSlicers[slicer]->GetRegisterExtent(extentImageReslice);\r
@@ -772,7 +712,9 @@ mSlicers[slicer]->GetRegisterExtent(extentImageReslice);
       y >= extentImageReslice[2]-0.5 &&\r
       y <= extentImageReslice[3]+0.5 &&\r
       z >= extentImageReslice[4]-0.5 &&\r
-      z <= extentImageReslice[5]+0.5) {\r
+      z <= extentImageReslice[5]+0.5)\r
+#endif\r
+  {\r
     mSlicers[slicer]->UpdateCursorPosition();\r
     mSlicers[slicer]->SetCursorColor(10,212,255);\r
     mSelectedSlicer = slicer;\r
@@ -833,7 +775,6 @@ mSlicers[slicer]->GetRegisterExtent(extentImageReslice);
       }\r
     }\r
   }\r
-#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
@@ -855,17 +796,7 @@ void vvSlicerManager::UpdateLinked(int slicer)
       y >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2]-0.5 &&\r
       y <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3]+0.5 &&\r
       z >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4]-0.5 &&\r
-      z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]+0.5) {\r
-    for (std::list<std::string>::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++) {\r
-               if (this->IsInvolvedInFusionSequence()) {\r
-                       //this SlicerManager is involved in fusionSequence => do not synchronize the times\r
-                       emit UpdateLinkManager(*i, slicer, p[0], p[1], p[2], -1);\r
-               }\r
-               else {\r
-                       emit UpdateLinkManager(*i, slicer, p[0], p[1], p[2], mSlicers[slicer]->GetMaxCurrentTSlice());\r
-               }\r
-    }\r
-  }\r
+      z <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5]+0.5)\r
 #else\r
 int extentImageReslice[6];\r
 mSlicers[slicer]->GetRegisterExtent(extentImageReslice);\r
@@ -874,7 +805,9 @@ mSlicers[slicer]->GetRegisterExtent(extentImageReslice);
       y >= extentImageReslice[2]-0.5 &&\r
       y <= extentImageReslice[3]+0.5 &&\r
       z >= extentImageReslice[4]-0.5 &&\r
-      z <= extentImageReslice[5]+0.5) {\r
+      z <= extentImageReslice[5]+0.5)\r
+#endif\r
+  {\r
     for (std::list<std::string>::const_iterator i = mLinkedId.begin(); i != mLinkedId.end(); i++) {\r
                if (this->IsInvolvedInFusionSequence()) {\r
                        //this SlicerManager is involved in fusionSequence => do not synchronize the times\r
@@ -885,7 +818,6 @@ mSlicers[slicer]->GetRegisterExtent(extentImageReslice);
                }\r
     }\r
   }\r
-#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
@@ -1189,75 +1121,23 @@ void vvSlicerManager::UpdateInfoOnCursorPosition(int slicer)
   int displayFus = 0;\r
   double valueOver=0, valueFus=0;\r
 #if VTK_MAJOR_VERSION <= 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
-    if (mSlicers[slicer]->GetVFActor() ) {\r
-      displayVec = 1;\r
-      unsigned int currentTime = mSlicers[slicer]->GetMaxCurrentTSlice();\r
-      vtkImageData *vf = NULL;\r
-\r
-      if (mSlicers[slicer]->GetVF()->GetVTKImages().size() > currentTime)\r
-        vf = mSlicers[slicer]->GetVF()->GetVTKImages()[currentTime];\r
-      else\r
-        vf = mSlicers[slicer]->GetVF()->GetVTKImages()[0];\r
-\r
-      if (vf) {\r
-        double Xvf = (x - vf->GetOrigin()[0])/ vf->GetSpacing()[0];\r
-        double Yvf = (y - vf->GetOrigin()[1])/ vf->GetSpacing()[1];\r
-        double Zvf = (z - vf->GetOrigin()[2])/ vf->GetSpacing()[2];\r
-        xVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 0);\r
-        yVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 1);\r
-        zVec = this->GetScalarComponentAsDouble( vf, Xvf, Yvf, Zvf, 2);\r
-        valueVec = sqrt(xVec*xVec + yVec*yVec + zVec*zVec);\r
-      }\r
-    }\r
-    if (mSlicers[slicer]->GetOverlayActor() ) {\r
-      displayOver = 1;\r
-      vtkImageData *overlay = dynamic_cast<vtkImageData*>(mSlicers[slicer]->GetOverlayMapper()->GetInput());\r
-      double Xover = (x - overlay->GetOrigin()[0]) / overlay->GetSpacing()[0];\r
-      double Yover = (y - overlay->GetOrigin()[1]) / overlay->GetSpacing()[1];\r
-      double Zover = (z - overlay->GetOrigin()[2]) / overlay->GetSpacing()[2];\r
-      valueOver = this->GetScalarComponentAsDouble(overlay, Xover, Yover, Zover);\r
-    }\r
-\r
-       if ( mSlicers[slicer]->GetFusionActor() ) {\r
-               displayFus = 1;\r
-               vtkImageData *fusion = dynamic_cast<vtkImageData*>(mSlicers[slicer]->GetFusionMapper()->GetInput());\r
-               double Xover = (x - fusion->GetOrigin()[0]) / fusion->GetSpacing()[0];\r
-               double Yover = (y - fusion->GetOrigin()[1]) / fusion->GetSpacing()[1];\r
-               double Zover = (z - fusion->GetOrigin()[2]) / fusion->GetSpacing()[2];\r
-               valueFus = this->GetScalarComponentAsDouble(fusion, Xover, Yover, Zover);\r
-       }\r
-       else if (this->IsInvolvedInFusionSequence()) { \r
-    //if the cursor moves over the 'independent' version of the secondary sequence\r
-    //do not update the panel, just keep it as it is.\r
-               displayFus = 1;\r
-               valueFus = std::numeric_limits<double>::quiet_NaN();\r
-       }\r
-\r
-    emit UpdatePosition(mSlicers[slicer]->GetCursorVisibility(),\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
-  }\r
+    if (XTransform >= mSlicers[slicer]->GetInput()->GetWholeExtent()[0] -0.5 &&\r
+      XTransform <= mSlicers[slicer]->GetInput()->GetWholeExtent()[1] +0.5 &&\r
+      YTransform >= mSlicers[slicer]->GetInput()->GetWholeExtent()[2] -0.5 &&\r
+      YTransform <= mSlicers[slicer]->GetInput()->GetWholeExtent()[3] +0.5 &&\r
+      ZTransform >= mSlicers[slicer]->GetInput()->GetWholeExtent()[4] -0.5 &&\r
+      ZTransform <= mSlicers[slicer]->GetInput()->GetWholeExtent()[5] +0.5)\r
 #else\r
 int extentImageReslice[6];\r
 mSlicers[slicer]->GetRegisterExtent(extentImageReslice);\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
+    if (XTransform >= extentImageReslice[0] -0.5 &&\r
+      XTransform <= extentImageReslice[1] +0.5 &&\r
+      YTransform >= extentImageReslice[2] -0.5 &&\r
+      YTransform <= extentImageReslice[3] +0.5 &&\r
+      ZTransform >= extentImageReslice[4] -0.5 &&\r
+      ZTransform <= extentImageReslice[5] +0.5)\r
+#endif\r
+    {\r
     value = this->GetScalarComponentAsDouble(mSlicers[slicer]->GetInput(), X, Y, Z);\r
 \r
     if (mSlicers[slicer]->GetVFActor() ) {\r
@@ -1310,7 +1190,6 @@ mSlicers[slicer]->GetRegisterExtent(extentImageReslice);
     emit UpdateOverlay(displayOver,valueOver,value);\r
     emit UpdateFusion(displayFus,valueFus);\r
   }\r
-#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
@@ -1709,11 +1588,7 @@ void vvSlicerManager::AddLandmark(float x,float y,float z,float t)
       y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2]-0.5 &&\r
       y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3]+0.5 &&\r
       z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4]-0.5 &&\r
-      z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]+0.5) {\r
-    double value = this->GetScalarComponentAsDouble(mSlicers[mSelectedSlicer]->GetInput(), x_index, y_index, z_index); //Value in selected Slicer (not 0): bug #2848\r
-    this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
-    emit LandmarkAdded();\r
-  }\r
+      z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]+0.5)\r
 #else\r
   int extentImageReslice[6];\r
   mSlicers[0]->GetRegisterExtent(extentImageReslice);\r
@@ -1722,12 +1597,13 @@ void vvSlicerManager::AddLandmark(float x,float y,float z,float t)
       y_index >= extentImageReslice[2]-0.5 &&\r
       y_index <= extentImageReslice[3]+0.5 &&\r
       z_index >= extentImageReslice[4]-0.5 &&\r
-      z_index <= extentImageReslice[5]+0.5) {\r
+      z_index <= extentImageReslice[5]+0.5)\r
+#endif\r
+  {\r
     double value = this->GetScalarComponentAsDouble(mSlicers[mSelectedSlicer]->GetInput(), x_index, y_index, z_index); //Value in selected Slicer (not 0): bug #2848\r
     this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
     emit LandmarkAdded();\r
   }\r
-#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r
@@ -1743,10 +1619,7 @@ void vvSlicerManager::AddLandmarkProfile(float x,float y,float z,float t)
       y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2]-0.5 &&\r
       y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3]+0.5 &&\r
       z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4]-0.5 &&\r
-      z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]+0.5) {\r
-    double value = this->GetScalarComponentAsDouble(mSlicers[mSelectedSlicer]->GetInput(), x_index, y_index, z_index); //Value in selected Slicer (not 0): bug #2848\r
-    this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
-  }\r
+      z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]+0.5)\r
 #else\r
   int extentImageReslice[6];\r
   mSlicers[0]->GetRegisterExtent(extentImageReslice);\r
@@ -1755,11 +1628,12 @@ void vvSlicerManager::AddLandmarkProfile(float x,float y,float z,float t)
       y_index >= extentImageReslice[2]-0.5 &&\r
       y_index <= extentImageReslice[3]+0.5 &&\r
       z_index >= extentImageReslice[4]-0.5 &&\r
-      z_index <= extentImageReslice[5]+0.5) {\r
+      z_index <= extentImageReslice[5]+0.5)\r
+#endif\r
+  {\r
     double value = this->GetScalarComponentAsDouble(mSlicers[mSelectedSlicer]->GetInput(), x_index, y_index, z_index); //Value in selected Slicer (not 0): bug #2848\r
     this->GetLandmarks()->AddLandmark(x,y,z,t,value);\r
   }\r
-#endif\r
 }\r
 //----------------------------------------------------------------------------\r
 \r