From: dsarrut Date: Mon, 3 May 2010 06:56:02 +0000 (+0000) Subject: - correct reload bug : change slice if outside ; update info X-Git-Tag: v1.2.0~670 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=56630ebe0ae16fce4fd89d9632b396104fd04990;p=clitk.git - correct reload bug : change slice if outside ; update info --- diff --git a/vv/vvMainWindow.cxx b/vv/vvMainWindow.cxx index a35922f..9d6ef03 100644 --- a/vv/vvMainWindow.cxx +++ b/vv/vvMainWindow.cxx @@ -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(); } //------------------------------------------------------------------------------ diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 415d4a8..b0cc721 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -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(); } //----------------------------------------------------------------------------