From: Romulo Pinho Date: Fri, 27 May 2011 13:23:45 +0000 (+0200) Subject: solved bug 457 X-Git-Tag: v1.3.0~336 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=dd8a36ea0968ce26b9f25166c1c62354cbb4717b;p=clitk.git solved bug 457 - overall, just a matter of calling Render() after updating the contours - another issue corrected: change of slice orientation didn't change contour orientation - still existing issue: flickering and delay in contour update when navigating across slices (added to bug tracker) --- diff --git a/vv/vvImageContour.cxx b/vv/vvImageContour.cxx index ab6d820..2770396 100644 --- a/vv/vvImageContour.cxx +++ b/vv/vvImageContour.cxx @@ -135,13 +135,11 @@ void vvImageContour::ShowActors() { //------------------------------------------------------------------------------ void vvImageContour::Update(double value) { - std::cout << "vvImageContour::Update " << value << std::endl; if (!mSlicer) return; if (mPreviousValue == value) { if (mPreviousSlice == mSlicer->GetSlice()) { if (mPreviousTSlice == mSlicer->GetTSlice()) { if (mPreviousOrientation == ComputeCurrentOrientation()) { - std::cout << "Nothing to do" << std::endl; return; // Nothing to do } } @@ -161,7 +159,7 @@ void vvImageContour::Update(double value) { UpdateWithFastCacheMode(); } - // mSlicer->Render(); //DS ---> REMOVE ?? + //mSlicer->Render(); //DS ---> REMOVE ?? mPreviousTSlice = mSlicer->GetTSlice(); mPreviousSlice = mSlicer->GetSlice(); @@ -174,7 +172,7 @@ void vvImageContour::Update(double value) { //------------------------------------------------------------------------------ void vvImageContour::UpdateWithPreserveMemoryMode() { // Only change actor visibility if tslice change - int mPreviousTslice = mTSlice; + mPreviousTslice = mTSlice; mTSlice = mSlicer->GetTSlice(); vtkMarchingSquares * mSquares = mSquaresList[mTSlice]; @@ -184,11 +182,12 @@ void vvImageContour::UpdateWithPreserveMemoryMode() { int orientation = ComputeCurrentOrientation(); UpdateActor(mSquaresActor, mapper, mSquares, mClipper, mValue, orientation, mSlice); - //mSquaresActorList[mTSlice]->VisibilityOn(); if (mPreviousTslice != mTSlice) { if (mPreviousTslice != -1) mSquaresActorList[mPreviousTslice]->VisibilityOff(); } + + mSlicer->Render(); } //------------------------------------------------------------------------------ @@ -291,7 +290,6 @@ void vvImageContour::UpdateActor(vtkActor * actor, vtkMarchingSquares * squares, vtkImageClip * clipper, double threshold, int orientation, int slice) { - std::cout << "vvImageContour::UpdateActor" << std::endl; // Set parameter for the MarchigSquare squares->SetValue(0, threshold); @@ -329,11 +327,14 @@ void vvImageContour::UpdateActor(vtkActor * actor, } else { extent2 = extent; + actor->VisibilityOn(); } clipper->SetOutputWholeExtent(extent2[0],extent2[1],extent2[2], extent2[3],extent2[4],extent2[5]); + //std::cout << mTSlice << " " << mSlice << " " << extent2[0] << " " << extent2[1] << " " << extent2[2] << " " << extent2[3] << " " << extent2[4] << " " << extent2[5] << std::endl; + if (mHiddenImageIsUsed) delete extent2; // Move the actor to be visible @@ -379,7 +380,9 @@ void vvImageContour::UpdateActor(vtkActor * actor, // } mapper->Update(); - actor->VisibilityOn(); + + + } //------------------------------------------------------------------------------ diff --git a/vv/vvImageContour.h b/vv/vvImageContour.h index d35ce4b..d2be512 100644 --- a/vv/vvImageContour.h +++ b/vv/vvImageContour.h @@ -79,6 +79,7 @@ protected: private: vvImageContour(); ~vvImageContour(); + int mPreviousTslice; }; // end class vvImageContour //------------------------------------------------------------------------------ diff --git a/vv/vvSlicerManager.cxx b/vv/vvSlicerManager.cxx index 5941056..87c4ae3 100644 --- a/vv/vvSlicerManager.cxx +++ b/vv/vvSlicerManager.cxx @@ -381,6 +381,13 @@ void vvSlicerManager::LeftButtonReleaseEvent(int slicer) } //---------------------------------------------------------------------------- +//---------------------------------------------------------------------------- +void vvSlicerManager::SetSliceOrientation(int slicer, int orientation) +{ + mSlicers[slicer]->SetSliceOrientation(orientation); + emit UpdateOrientation(slicer, orientation); +} +//---------------------------------------------------------------------------- //---------------------------------------------------------------------------- void vvSlicerManager::SetTSlice(int slice) @@ -409,6 +416,7 @@ void vvSlicerManager::SetNextTSlice(int originating_slicer) t++; if (t > mSlicers[0]->GetTMax()) t = 0; + //std::cout << "vvSlicerManager::SetNextTSlice" << std::endl; emit UpdateTSlice(originating_slicer,t); } //---------------------------------------------------------------------------- @@ -421,6 +429,7 @@ void vvSlicerManager::SetPreviousTSlice(int originating_slicer) t--; if (t < 0) t = mSlicers[0]->GetTMax(); + //std::cout << "vvSlicerManager::SetPreviousTSlice" << std::endl; emit UpdateTSlice(originating_slicer,t); } //---------------------------------------------------------------------------- @@ -906,6 +915,7 @@ void vvSlicerManager::UpdateSlice(int slicer) //DD("============= NOTHING"); return; } + //std::cout << "vvSlicerManager::UpdateSlice " << slicer << " " << mSlicers[slicer]->GetSlice() << std::endl; emit UpdateSlice(slicer, mSlicers[slicer]->GetSlice()); mSlicers[slicer]->Render(); // DS <-- I add this, this could/must be the only Render ... mPreviousSlice[slicer] = mSlicers[slicer]->GetSlice(); @@ -916,16 +926,18 @@ void vvSlicerManager::UpdateSlice(int slicer) //---------------------------------------------------------------------------- void vvSlicerManager::UpdateTSlice(int slicer) { - std::cout << "vvSlicerManager::UpdateTSlice" << std::endl; - if (mPreviousSlice[slicer] == mSlicers[slicer]->GetSlice()) { - if (mPreviousTSlice[slicer] == mSlicers[slicer]->GetTSlice()) { + int slice = mSlicers[slicer]->GetSlice(); + int tslice = mSlicers[slicer]->GetTSlice(); + if (mPreviousSlice[slicer] == slice) { + if (mPreviousTSlice[slicer] == tslice) { // DD("************** NOTHING ***********"); return; } } - mPreviousSlice[slicer] = mSlicers[slicer]->GetSlice(); - mPreviousTSlice[slicer] = mSlicers[slicer]->GetTSlice(); - emit UpdateTSlice(slicer,mSlicers[slicer]->GetTSlice()); + mPreviousSlice[slicer] = slice; + mPreviousTSlice[slicer] = tslice; + //std::cout << "vvSlicerManager::UpdateTSlice " << slicer << " " << tslice << std::endl; + emit UpdateTSlice(slicer, tslice); } //---------------------------------------------------------------------------- diff --git a/vv/vvSlicerManager.h b/vv/vvSlicerManager.h index bb30f54..cb6cb32 100644 --- a/vv/vvSlicerManager.h +++ b/vv/vvSlicerManager.h @@ -101,6 +101,7 @@ class vvSlicerManager : public QObject { void SetFilename(std::string f, int number=0); + void SetSliceOrientation(int slicer, int orientation); void SetTSlice(int slice); void SetNextTSlice(int originating_slicer); void SetPreviousTSlice(int originating_slicer); @@ -205,6 +206,7 @@ signals : void UpdateOverlay(int display, double valueOver, double valueRef); void UpdateFusion(int display, double valueFus); void UpdateWindows(int slicer, int view, int slice); + void UpdateOrientation(int slicer, int orientation); void UpdateSlice(int slicer, int slice); void UpdateTSlice(int slicer, int slice); void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax); diff --git a/vv/vvSlicerManagerCommand.cxx b/vv/vvSlicerManagerCommand.cxx index d373d98..ab0e5f8 100644 --- a/vv/vvSlicerManagerCommand.cxx +++ b/vv/vvSlicerManagerCommand.cxx @@ -245,17 +245,20 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller, if (KeyPress == "F2") { this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Sagital\n"); - this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(0); + //this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(0); + this->SM->SetSliceOrientation(VisibleInWindow, 0); this->SM->UpdateSliceRange(VisibleInWindow); } if (KeyPress == "F3") { this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Coronal\n"); - this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(1); + //this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(1); + this->SM->SetSliceOrientation(VisibleInWindow, 1); this->SM->UpdateSliceRange(VisibleInWindow); } if (KeyPress == "F4") { this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Axial\n"); - this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(2); + //this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(2); + this->SM->SetSliceOrientation(VisibleInWindow, 2); this->SM->UpdateSliceRange(VisibleInWindow); } diff --git a/vv/vvToolBinarize.cxx b/vv/vvToolBinarize.cxx index 338e2ea..fa22daa 100644 --- a/vv/vvToolBinarize.cxx +++ b/vv/vvToolBinarize.cxx @@ -225,6 +225,8 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m) connect(mCurrentSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int))); connect(mCurrentSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int))); + + connect(mCurrentSlicerManager,SIGNAL(UpdateOrientation(int,int)),this,SLOT(UpdateOrientation(int, int))); // connect(mCurrentSlicerManager, SIGNAL(LeftButtonReleaseSignal(int)), SLOT(LeftButtonReleaseEvent(int))); @@ -244,10 +246,23 @@ void vvToolBinarize::InputIsSelected(vvSlicerManager * m) //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvToolBinarize::UpdateOrientation(int slicer,int orientation) +{ + Update(slicer); +} +//------------------------------------------------------------------------------ + //------------------------------------------------------------------------------ void vvToolBinarize::UpdateSlice(int slicer,int slices) { - std::cout << "vvToolBinarize::UpdateSlice" << std::endl; + Update(slicer); +} +//------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ +void vvToolBinarize::Update(int slicer) +{ if (!mInteractiveDisplayIsEnabled) return; if (!mCurrentSlicerManager) close(); mImageContour[slicer]->Update(mThresholdSlider1->GetValue()); @@ -256,7 +271,6 @@ void vvToolBinarize::UpdateSlice(int slicer,int slices) } //------------------------------------------------------------------------------ - //------------------------------------------------------------------------------ void vvToolBinarize::GetArgsInfoFromGUI() { diff --git a/vv/vvToolBinarize.h b/vv/vvToolBinarize.h index 7251f8e..9e61e68 100644 --- a/vv/vvToolBinarize.h +++ b/vv/vvToolBinarize.h @@ -50,6 +50,7 @@ class vvToolBinarize: virtual void reject(); void valueChangedT1(double v); void valueChangedT2(double v); + void UpdateOrientation(int slicer, int orientation); void UpdateSlice(int slicer,int slices); void enableLowerThan(bool b); void useFGBGtoggled(bool); @@ -64,6 +65,8 @@ class vvToolBinarize: std::vector mImageContour; std::vector mImageContourLower; bool mInteractiveDisplayIsEnabled; + + void Update(int slicer); }; // end class vvToolBinarize //------------------------------------------------------------------------------