]> Creatis software - clitk.git/commitdiff
Rolled back to middle slice on first load
authorSimon Rit <simon.rit@creatis.insa-lyon.fr>
Mon, 4 Mar 2013 06:41:53 +0000 (07:41 +0100)
committerSimon Rit <simon.rit@creatis.insa-lyon.fr>
Mon, 4 Mar 2013 06:41:53 +0000 (07:41 +0100)
vv/vvSlicer.cxx
vv/vvSlicer.h

index 30a8f1034931e169815e884c2ada69129a72ae4c..ed53d2c83b138c600eeabf680da7edd775854cbc 100644 (file)
@@ -155,6 +155,7 @@ vvSlicer::vvSlicer()
   mConcatenatedTransform = vtkSmartPointer<vtkTransform>::New();
   mConcatenatedFusionTransform = vtkSmartPointer<vtkTransform>::New();
   mConcatenatedOverlayTransform = vtkSmartPointer<vtkTransform>::New();
+  mFirstSetSliceOrientation = true;
 }
 //------------------------------------------------------------------------------
 
@@ -853,15 +854,17 @@ void vvSlicer::SetSliceOrientation(int orientation)
   // DDV(cursorPos, 3);
   // SetCurrentPosition(cursorPos[0],cursorPos[1],cursorPos[2],cursorPos[3]);
 
-  if (this->Renderer && this->GetInput()) {
+  if (mFirstSetSliceOrientation) {
+    int *range = this->GetSliceRange();
+    if (range)
+      this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
+    mFirstSetSliceOrientation = false;
+  }
+  else if (this->Renderer && this->GetInput()) {
     double s = mCursor[orientation];
     double sCursor = (s - this->GetInput()->GetOrigin()[orientation])/this->GetInput()->GetSpacing()[orientation];
     this->Slice = static_cast<int>(sCursor);
   }
-  
-//   int *range = this->GetSliceRange();
-//   if (range)
-//     this->Slice = static_cast<int>((range[0] + range[1]) * 0.5);
 
   this->UpdateOrientation();
   this->UpdateDisplayExtent();
index 570c43ddcbd83b027fab6b7ac7f2a87f7e0c453a..0bffd1f36abcc46f92d5b43a3c51aab519685e59 100644 (file)
@@ -297,5 +297,6 @@ private:
   bool mOverlayVisibility;
   bool mFusionVisibility;
   bool mVFVisibility;
+  bool mFirstSetSliceOrientation;
 };
 #endif