]> Creatis software - clitk.git/commitdiff
Debug 4D ROI
authortbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 2 Mar 2016 15:49:11 +0000 (16:49 +0100)
committertbaudier <thomas.baudier@creatis.insa-lyon.fr>
Wed, 2 Mar 2016 15:49:11 +0000 (16:49 +0100)
vv/vvBinaryImageOverlayActor.cxx
vv/vvROIActor.cxx
vv/vvROIActor.h

index 40fba13bdb92ce2c592aa85cd4a61f89d79d864a..b5935c3692ea3a7c98afe69b14a7c5fba645bea5 100644 (file)
@@ -111,14 +111,30 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
   for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) {
     // how many intensity ?
     vtkSmartPointer<vtkImageMapToRGBA> mOverlayMapper = vtkSmartPointer<vtkImageMapToRGBA>::New();
+    if (mImage->IsTimeSequence())
+    {
+ #if VTK_MAJOR_VERSION <= 5
+        mOverlayMapper->SetInput(mImage->GetVTKImages()[numImage]);
+#else
+        mOverlayMapper->SetInputData(mImage->GetVTKImages()[numImage]);
+#endif
+    }
+    else {
 #if VTK_MAJOR_VERSION <= 5
-    mOverlayMapper->SetInput(mImage->GetVTKImages()[0]); // DS TODO : to change if it is 4D !!!
+        mOverlayMapper->SetInput(mImage->GetVTKImages()[0]);
 #else
-    mOverlayMapper->SetInputData(mImage->GetVTKImages()[0]); // DS TODO : to change if it is 4D !!!
+        mOverlayMapper->SetInputData(mImage->GetVTKImages()[0]);
 #endif
+    }
 
     double range[2];
-    mImage->GetVTKImages()[0]->GetScalarRange(range);
+    if (mImage->IsTimeSequence())
+    {
+        mImage->GetVTKImages()[numImage]->GetScalarRange(range);
+    }
+    else {
+        mImage->GetVTKImages()[0]->GetScalarRange(range);
+    }
     int n = range[1]-range[0]+1;
     mColorLUT->SetRange(range[0],range[1]);
     mColorLUT->SetNumberOfTableValues(n);
@@ -156,7 +172,7 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible)
 
     mMapperList.push_back(mOverlayMapper);
     mImageActorList.push_back(mOverlayActor);
-    mSlicer->GetRenderer()->AddActor(mOverlayActor);
+    mSlicer->GetRenderer()->AddActor(mImageActorList[numImage]);
   }
 }
 //------------------------------------------------------------------------------
@@ -240,10 +256,8 @@ void vvBinaryImageOverlayActor::ShowActors()
   if (!mSlicer) return;
   mSlice = mSlicer->GetSlice();
   mTSlice = mSlicer->GetTSlice();
-  //  for(unsigned int i=0; i<mSquaresActorList.size(); i++) {
   mImageActorList[mTSlice]->VisibilityOn();
   UpdateSlice(0, mSlice);
-  //}
   // Caller MUST call Render
   //mSlicer->Render();
 }
@@ -291,12 +305,14 @@ void vvBinaryImageOverlayActor::UpdateSlice(int slicer, int slice, bool force)
   int orientation = mSlicer->GetOrientation();
   int maskExtent[6];
   ComputeExtent(orientation, mSlice, imageExtent, maskExtent);
-  ComputeExtent(maskExtent, maskExtent, mSlicer->GetImage()->GetFirstVTKImageData(), mImage->GetFirstVTKImageData());
+  ComputeExtent(maskExtent, maskExtent, mSlicer->GetImage()->GetVTKImages()[mTSlice], mImage->GetVTKImages()[mTSlice]);
 #if VTK_MAJOR_VERSION <= 5
   mSlicer->ClipDisplayedExtent(maskExtent, mMapperList[mTSlice]->GetInput()->GetWholeExtent());
 #else
   mSlicer->ClipDisplayedExtent(maskExtent, mMapperList[mTSlice]->GetInput()->GetInformation()->Get(vtkDataObject::DATA_EXTENT()));
 #endif
+  HideActors();
+  mImageActorList[mTSlice]->VisibilityOn();
   SetDisplayExtentAndCameraPosition(orientation, mSlice, maskExtent, mImageActorList[mTSlice], mDepth);
 
   // set previous slice
index 9755e78fba73c28eb69fed3d5a120e79a64a25f8..52ddea57adf28501634c1477b3ab300d3023f659 100644 (file)
@@ -202,7 +202,7 @@ void vvROIActor::Initialize(double depth, bool IsVisible)
       mOverlayActors[i]->SetDepth(mDepth);
     }
     connect(mSlicerManager,SIGNAL(UpdateSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
-    //connect(mSlicerManager,SIGNAL(UpdateTSlice(int,int)),this,SLOT(UpdateSlice(int, int)));
+    connect(mSlicerManager,SIGNAL(UpdateTSlice(int,int,int)),this,SLOT(UpdateSlice(int, int, int)));
     connect(mSlicerManager, SIGNAL(AVerticalSliderHasChanged(int, int)), SLOT(UpdateSlice(int, int)));
   }
 }
@@ -235,7 +235,7 @@ void vvROIActor::Update(bool force)
 
 
 //------------------------------------------------------------------------------
-void vvROIActor::UpdateSlice(int slicer, int slices, bool force)
+void vvROIActor::UpdateSlice(int slicer, int slices, int force)
 { 
   if (!mROI->GetImage())  return;
   if ((!mIsVisible) && (!mIsContourVisible)) return; 
@@ -250,6 +250,7 @@ void vvROIActor::UpdateSlice(int slicer, int slices, bool force)
 
   // Refresh overlays
   mOverlayActors[slicer]->UpdateSlice(slicer, slices, force);
+  mSlicerManager->GetSlicer(slicer)->Render();
 }
 //------------------------------------------------------------------------------
 
index 5a54adeeaa653edbc3efb5914f9a0d29f8636f13..04c90290f9fc16c9465ee6d4a332cf51ea682244 100644 (file)
@@ -61,7 +61,7 @@ class vvROIActor: public QObject {
   void RemoveActors();
 
 public slots:
-  void UpdateSlice(int slicer, int slices, bool force=false);
+  void UpdateSlice(int slicer, int slices, int force=0);
   void UpdateColor();
   void UpdateImage();