]> Creatis software - clitk.git/commitdiff
Allow landmarking in tilted 2D slices
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Fri, 10 Aug 2012 15:45:55 +0000 (17:45 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Fri, 10 Aug 2012 15:45:55 +0000 (17:45 +0200)
vv/vvSlicerManager.cxx

index 3206fce534af72df6a2610c9601ee2ce745358a7..ee1c084568714d56387f3612374a9c302e4885e4 100644 (file)
@@ -1386,12 +1386,12 @@ 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];
-  if (x_index >= mSlicers[0]->GetInput()->GetWholeExtent()[0] &&
-      x_index <= mSlicers[0]->GetInput()->GetWholeExtent()[1] &&
-      y_index >= mSlicers[0]->GetInput()->GetWholeExtent()[2] &&
-      y_index <= mSlicers[0]->GetInput()->GetWholeExtent()[3] &&
-      z_index >= mSlicers[0]->GetInput()->GetWholeExtent()[4] &&
-      z_index <= mSlicers[0]->GetInput()->GetWholeExtent()[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) {
     double value = this->GetScalarComponentAsDouble(mSlicers[0]->GetInput(), x_index, y_index, z_index);
     this->GetLandmarks()->AddLandmark(x,y,z,t,value);
     emit LandmarkAdded();