]> Creatis software - clitk.git/blobdiff - vv/vvSlicer.cxx
basic GUI state loading/saving functionality
[clitk.git] / vv / vvSlicer.cxx
index 2473c87e27c3ca8dd84b33c047d199bea685f7b3..92cb2686d25cdb543f188a7112c101220c9712d2 100644 (file)
@@ -755,12 +755,14 @@ void vvSlicer::SetSliceOrientation(int orientation)
 // of the displayed image in the slicing direction.
 void vvSlicer::AdjustResliceToSliceOrientation(vtkImageReslice *reslice)
 {
-  // Reset autocrop
-  double origin[3] = {VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX};
-  double spacing[3] = {VTK_DOUBLE_MAX, VTK_DOUBLE_MAX, VTK_DOUBLE_MAX};
-  reslice->SetOutputOrigin(origin);
-  reslice->SetOutputSpacing(spacing);
+  // Reset autocrop and update output information
+  reslice->SetOutputOriginToDefault();
+  reslice->SetOutputSpacingToDefault();
   reslice->GetOutput()->UpdateInformation();
+
+  // Ge new origin / spacing
+  double origin[3];
+  double spacing[3];
   reslice->GetOutput()->GetOrigin(origin);
   reslice->GetOutput()->GetSpacing(spacing);
 
@@ -1106,7 +1108,7 @@ void vvSlicer::SetColorWindow(double window)
   vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
   if ( LUT ) {
     double level = this->GetWindowLevel()->GetLevel();
-    LUT->SetTableRange(level-fabs(window)/4,level+fabs(window)/4);
+    LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
     LUT->Build();
   }
   this->vtkImageViewer2::SetColorWindow(window);
@@ -1119,7 +1121,7 @@ void vvSlicer::SetColorLevel(double level)
   vtkLookupTable* LUT = static_cast<vtkLookupTable*>(this->GetWindowLevel()->GetLookupTable());
   if ( LUT ) {
     double window = this->GetWindowLevel()->GetWindow();
-    LUT->SetTableRange(level-fabs(window)/4,level+fabs(window)/4);
+    LUT->SetTableRange(level-fabs(window)/2,level+fabs(window)/2);
     LUT->Build();
   }
   this->vtkImageViewer2::SetColorLevel(level);