]> Creatis software - clitk.git/commitdiff
Debug landmarks with transformation matrix
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 9 Jan 2017 10:25:46 +0000 (11:25 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Mon, 9 Jan 2017 10:25:46 +0000 (11:25 +0100)
vv/vvSlicerManager.cxx

index b3e2890f9d6d531df58fcfafa947945293d69722..e9d1c215fc91b4f6886e74c343bf8c2eddbe5c47 100644 (file)
@@ -1571,28 +1571,26 @@ void vvSlicerManager::AddNewLandmark(float x,float y,float z,float t)
 //----------------------------------------------------------------------------
 void vvSlicerManager::AddLandmark(float x,float y,float z,float t)
 { 
-  double x_index = (x - mSlicers[0]->GetInput()->GetOrigin()[0])/mSlicers[0]->GetInput()->GetSpacing()[0];
-  double y_index = (y - mSlicers[0]->GetInput()->GetOrigin()[1])/mSlicers[0]->GetInput()->GetSpacing()[1];
-  double z_index = (z - mSlicers[0]->GetInput()->GetOrigin()[2])/mSlicers[0]->GetInput()->GetSpacing()[2];
+  double x_index = (x - mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetOrigin()[0])/mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetSpacing()[0];
+  double y_index = (y - mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetOrigin()[1])/mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetSpacing()[1];
+  double z_index = (z - mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetOrigin()[2])/mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetSpacing()[2];
 #if VTK_MAJOR_VERSION <= 5
-  if (x_index >= mSlicers[0]->GetInput()->GetWholeExtent()[0]-0.5 &&
-      x_index <= mSlicers[0]->GetInput()->GetWholeExtent()[1]+0.5 &&
-      y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2]-0.5 &&
-      y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3]+0.5 &&
-      z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4]-0.5 &&
-      z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]+0.5)
+    if (x_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[0]-0.5 &&
+        x_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[1]+0.5 &&
+        y_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[2]-0.5 &&
+        y_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[3]+0.5 &&
+        z_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[4]-0.5 &&
+        z_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[5]+0.5)
 #else
-  int extentImageReslice[6];
-  mSlicers[0]->GetRegisterExtent(extentImageReslice);
-  if (x_index >= extentImageReslice[0]-0.5 &&
-      x_index <= extentImageReslice[1]+0.5 &&
-      y_index >= extentImageReslice[2]-0.5 &&
-      y_index <= extentImageReslice[3]+0.5 &&
-      z_index >= extentImageReslice[4]-0.5 &&
-      z_index <= extentImageReslice[5]+0.5)
+    if (x_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[0]-0.5 &&
+        x_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[1]+0.5 &&
+        y_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[2]-0.5 &&
+        y_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[3]+0.5 &&
+        z_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[4]-0.5 &&
+        z_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[5]+0.5)
 #endif
   {
-    double value = this->GetScalarComponentAsDouble(mSlicers[mSelectedSlicer]->GetInput(), x_index, y_index, z_index); //Value in selected Slicer (not 0): bug #2848
+    double value = this->GetScalarComponentAsDouble(mSlicers[mSelectedSlicer]->GetImage()->GetVTKImages()[mSlicers[mSelectedSlicer]->GetTSlice()], x_index, y_index, z_index); //Value in selected Slicer (not 0): bug #2848
     this->GetLandmarks()->AddLandmark(x,y,z,t,value);
     emit LandmarkAdded();
   }
@@ -1602,28 +1600,26 @@ void vvSlicerManager::AddLandmark(float x,float y,float z,float t)
 //----------------------------------------------------------------------------
 void vvSlicerManager::AddLandmarkProfile(float x,float y,float z,float t)
 { 
-  double x_index = (x - mSlicers[0]->GetInput()->GetOrigin()[0])/mSlicers[0]->GetInput()->GetSpacing()[0];
-  double y_index = (y - mSlicers[0]->GetInput()->GetOrigin()[1])/mSlicers[0]->GetInput()->GetSpacing()[1];
-  double z_index = (z - mSlicers[0]->GetInput()->GetOrigin()[2])/mSlicers[0]->GetInput()->GetSpacing()[2];
+  double x_index = (x - mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetOrigin()[0])/mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetSpacing()[0];
+  double y_index = (y - mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetOrigin()[1])/mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetSpacing()[1];
+  double z_index = (z - mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetOrigin()[2])/mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetSpacing()[2];
 #if VTK_MAJOR_VERSION <= 5
-  if (x_index >= mSlicers[0]->GetInput()->GetWholeExtent()[0]-0.5 &&
-      x_index <= mSlicers[0]->GetInput()->GetWholeExtent()[1]+0.5 &&
-      y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2]-0.5 &&
-      y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3]+0.5 &&
-      z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4]-0.5 &&
-      z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[5]+0.5)
+    if (x_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[0]-0.5 &&
+        x_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[1]+0.5 &&
+        y_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[2]-0.5 &&
+        y_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[3]+0.5 &&
+        z_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[4]-0.5 &&
+        z_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetWholeExtent()[5]+0.5)
 #else
-  int extentImageReslice[6];
-  mSlicers[0]->GetRegisterExtent(extentImageReslice);
-  if (x_index >= extentImageReslice[0]-0.5 &&
-      x_index <= extentImageReslice[1]+0.5 &&
-      y_index >= extentImageReslice[2]-0.5 &&
-      y_index <= extentImageReslice[3]+0.5 &&
-      z_index >= extentImageReslice[4]-0.5 &&
-      z_index <= extentImageReslice[5]+0.5)
+    if (x_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[0]-0.5 &&
+        x_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[1]+0.5 &&
+        y_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[2]-0.5 &&
+        y_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[3]+0.5 &&
+        z_index >= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[4]-0.5 &&
+        z_index <= mSlicers[0]->GetImage()->GetVTKImages()[mSlicers[0]->GetTSlice()]->GetInformation()->Get(vtkDataObject::DATA_EXTENT())[5]+0.5)
 #endif
   {
-    double value = this->GetScalarComponentAsDouble(mSlicers[mSelectedSlicer]->GetInput(), x_index, y_index, z_index); //Value in selected Slicer (not 0): bug #2848
+    double value = this->GetScalarComponentAsDouble(mSlicers[mSelectedSlicer]->GetImage()->GetVTKImages()[mSlicers[mSelectedSlicer]->GetTSlice()], x_index, y_index, z_index); //Value in selected Slicer (not 0): bug #2848
     this->GetLandmarks()->AddLandmark(x,y,z,t,value);
   }
 }