From: Simon Rit Date: Mon, 4 Mar 2013 06:41:53 +0000 (+0100) Subject: Rolled back to middle slice on first load X-Git-Tag: v1.4.0~242^2~3^2~1 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=6e385f9a227796b6a5fde57f8cf3b7965aca266a;p=clitk.git Rolled back to middle slice on first load --- diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 30a8f10..ed53d2c 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -155,6 +155,7 @@ vvSlicer::vvSlicer() mConcatenatedTransform = vtkSmartPointer::New(); mConcatenatedFusionTransform = vtkSmartPointer::New(); mConcatenatedOverlayTransform = vtkSmartPointer::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((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(sCursor); } - -// int *range = this->GetSliceRange(); -// if (range) -// this->Slice = static_cast((range[0] + range[1]) * 0.5); this->UpdateOrientation(); this->UpdateDisplayExtent(); diff --git a/vv/vvSlicer.h b/vv/vvSlicer.h index 570c43d..0bffd1f 100644 --- a/vv/vvSlicer.h +++ b/vv/vvSlicer.h @@ -297,5 +297,6 @@ private: bool mOverlayVisibility; bool mFusionVisibility; bool mVFVisibility; + bool mFirstSetSliceOrientation; }; #endif