]> Creatis software - clitk.git/commitdiff
fix crash when origin is negative
authorschaerer <schaerer>
Wed, 23 Jun 2010 11:13:14 +0000 (11:13 +0000)
committerschaerer <schaerer>
Wed, 23 Jun 2010 11:13:14 +0000 (11:13 +0000)
vv/vvSegmentationDialog.cxx

index e1f0ffd7395d107654abbceaf6c48f7a55c14055..4fb788e45384bbd865cd99523f8dd3a5de5c7f56 100644 (file)
@@ -413,9 +413,9 @@ void vvSegmentationDialog::InsertSeed()
   point4D[3] = mManager->GetLandmarks()->GetCoordinates(
                  mManager->GetLandmarks()->GetNumberOfPoints()-1)[3];
 
-  point4D[0] = point4D[0]/mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetSpacing()[0];
-  point4D[1] = point4D[1]/mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetSpacing()[1];
-  point4D[2] = point4D[2]/mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetSpacing()[2];
+  point4D[0] = (point4D[0]-mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetOrigin()[0])/mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetSpacing()[0];
+  point4D[1] = (point4D[1]-mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetOrigin()[1])/mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetSpacing()[1];
+  point4D[2] = (point4D[2]-mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetOrigin()[2])/mManager->GetSlicer(0)->GetImage()->GetVTKImages()[0]->GetSpacing()[2];
 
   vtkImageSeedConnectivity* seed = vtkImageSeedConnectivity::New();
   seed->SetInputConnectValue(1);