]> Creatis software - clitk.git/commitdiff
Fixed slice bug when toggling between voxels and world reslicing
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Fri, 10 Aug 2012 15:39:14 +0000 (17:39 +0200)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Fri, 10 Aug 2012 15:39:14 +0000 (17:39 +0200)
vv/vvSlicerManager.cxx

index b6f21562a6e19887cdb921f01f784aa6e900c2ff..3206fce534af72df6a2610c9601ee2ce745358a7 100644 (file)
@@ -1099,21 +1099,24 @@ void vvSlicerManager::SetSlicingPreset(SlicingPresetType preset)
   mImage->GetTransform()[this->GetTSlice()]->GetInverse(imageTransformInverse);
 
   for(int i=0; i< this->GetNumberOfSlicers(); i++){
+    vvSlicer *s = this->GetSlicer(i);
     switch(preset)
     {
     case WORLD_SLICING:
-      this->GetSlicer(i)->GetSlicingTransform()->Identity();
+      s->GetSlicingTransform()->Identity();
       break;
     case VOXELS_SLICING:
-      this->GetSlicer(i)->GetSlicingTransform()->SetMatrix(imageTransformInverse);
+      s->GetSlicingTransform()->SetMatrix(imageTransformInverse);
       break;
     default:
       imageTransformInverse->Delete();
       return;
     }
-    this->GetSlicer(i)->ForceUpdateDisplayExtent();
-    this->GetSlicer(i)->ResetCamera();
-    this->GetSlicer(i)->Render();
+    s->ForceUpdateDisplayExtent();
+    s->SetSlice((s->GetInput()->GetWholeExtent()[s->GetSliceOrientation()*2+1]
+                +s->GetInput()->GetWholeExtent()[s->GetSliceOrientation()*2])/2.0);
+    s->ResetCamera();
+    s->Render();
   }
 
   imageTransformInverse->Delete();