]> Creatis software - clitk.git/commitdiff
- correct reload bug : change slice if outside ; update info
authordsarrut <dsarrut>
Mon, 3 May 2010 06:56:02 +0000 (06:56 +0000)
committerdsarrut <dsarrut>
Mon, 3 May 2010 06:56:02 +0000 (06:56 +0000)
vv/vvMainWindow.cxx
vv/vvSlicer.cxx

index a35922f342a414613cf16e48a9c8abae17c422cc..9d6ef03bc918f85b6a3d2d9837c4cea4cbfbef6a 100644 (file)
@@ -1601,6 +1601,10 @@ void vvMainWindow::ReloadImage(QTreeWidgetItem* item, int column) {
     mSlicerManagers[index]->ReloadFusion();
   else
     mSlicerManagers[index]->Reload();
+
+  // Update view and info
+  ImageInfoChanged();
+  mSlicerManagers[index]->Render();
   QApplication::restoreOverrideCursor();  
 }
 //------------------------------------------------------------------------------
index 415d4a8f95398c8cdcd083fcbabe46f98146ce49..b0cc72182fac99fad643da1cea6277e1e0f637a9 100644 (file)
@@ -281,6 +281,26 @@ void vvSlicer::SetImage(vvImage::Pointer image)
     {
       mImage = image;
       this->Superclass::SetInput(image->GetVTKImages()[0]);
+
+      // Prevent crash when reload -> change slice if outside extent
+      int extent[6];
+      this->GetInput()->GetWholeExtent(extent);
+      if (SliceOrientation == 0) {
+        if (Slice >= extent[1]) {
+          Slice = (extent[1]-extent[0])/2.0;
+        }
+      }
+      if (SliceOrientation == 1) {
+        if (Slice >= extent[3]) {
+          Slice = (extent[3]-extent[2])/2.0;
+        }
+      }
+      if (SliceOrientation == 2) {
+        if (Slice >= extent[5]) {
+          Slice = (extent[5]-extent[4])/2.0;
+        }
+      }
+
       this->UpdateDisplayExtent();
       mCurrentTSlice = 0;
       ca->SetText(0,mFileName.c_str());
@@ -1378,7 +1398,8 @@ void vvSlicer::SetSlice(int slice)
 
   //  DD("SetSlice de slicer = Render");
 
-  this->Render();
+  // Seems to work without this line
+  //  this->Render();
 }
 //----------------------------------------------------------------------------