]> Creatis software - clitk.git/commitdiff
solved bug 457
authorRomulo Pinho <pinho@lyon.fnclcc.fr>
Fri, 27 May 2011 13:23:45 +0000 (15:23 +0200)
committerRomulo Pinho <pinho@lyon.fnclcc.fr>
Fri, 27 May 2011 13:23:45 +0000 (15:23 +0200)
- 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)

vv/vvImageContour.cxx
vv/vvImageContour.h
vv/vvSlicerManager.cxx
vv/vvSlicerManager.h
vv/vvSlicerManagerCommand.cxx
vv/vvToolBinarize.cxx
vv/vvToolBinarize.h

index ab6d8202647e24485c156f51251e4dbbf4be6fc0..27703963c345be05e09715957a59423295319d38 100644 (file)
@@ -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();
+  
+  
 }
 //------------------------------------------------------------------------------
 
index d35ce4bd2255b5aeba33ecd203ac94853cffdce6..d2be5129a6e00d6bb1d7c63dbe7f5b1ff1815b56 100644 (file)
@@ -79,6 +79,7 @@ protected:
 private:
   vvImageContour();
   ~vvImageContour();
+    int mPreviousTslice;
 }; // end class vvImageContour
 //------------------------------------------------------------------------------
 
index 59410567ffdc472933096d32fd84aa9efd7c447d..87c4ae3830b73d2bd6cfdff3a9a3b0034500a4f9 100644 (file)
@@ -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);
 }
 //----------------------------------------------------------------------------
 
index bb30f54d5aa255611b6fb9901de7463a078ea6b3..cb6cb32778ebc422a09d6a2ccbb4e5f9de519b9d 100644 (file)
@@ -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);
index d373d980ba1433c1362f2f39f3612b5b5d31b1d1..ab0e5f8b8835b0440a2fe170472d796cb9b9cc11 100644 (file)
@@ -245,17 +245,20 @@ void vvSlicerManagerCommand::Execute(vtkObject *caller,
 
         if (KeyPress == "F2") {
           this->SM->GetSlicer(VisibleInWindow)->GetAnnotation()->SetText(2,"Sagital\n<slice>");
-          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<slice>");
-          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<slice>");
-          this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(2);
+          //this->SM->GetSlicer(VisibleInWindow)->SetSliceOrientation(2);
+          this->SM->SetSliceOrientation(VisibleInWindow, 2);
           this->SM->UpdateSliceRange(VisibleInWindow);
         }
 
index 338e2ea6b9c67debf54a00a7e4fdffe53d4a948e..fa22daad122e54bb2337d1feb1700f40bbd152e0 100644 (file)
@@ -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()
 {
index 7251f8e8133494aaa88f78d48f857f80fca8b6e0..9e61e683cd284872456b3d5030fbdbef1987af90 100644 (file)
@@ -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<vvImageContour::Pointer> mImageContour;
   std::vector<vvImageContour::Pointer> mImageContourLower;
   bool mInteractiveDisplayIsEnabled;
+  
+  void Update(int slicer);
 
 }; // end class vvToolBinarize
 //------------------------------------------------------------------------------