From: tbaudier Date: Wed, 2 Mar 2016 15:49:11 +0000 (+0100) Subject: Debug 4D ROI X-Git-Tag: v1.4.0~37 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=2a47eef492588295e5c7259bb8a423ff35d34327;p=clitk.git Debug 4D ROI --- diff --git a/vv/vvBinaryImageOverlayActor.cxx b/vv/vvBinaryImageOverlayActor.cxx index 40fba13..b5935c3 100644 --- a/vv/vvBinaryImageOverlayActor.cxx +++ b/vv/vvBinaryImageOverlayActor.cxx @@ -111,14 +111,30 @@ void vvBinaryImageOverlayActor::Initialize(bool IsVisible) for (unsigned int numImage = 0; numImage < mSlicer->GetImage()->GetVTKImages().size(); numImage++) { // how many intensity ? vtkSmartPointer mOverlayMapper = vtkSmartPointer::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; iVisibilityOn(); 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 diff --git a/vv/vvROIActor.cxx b/vv/vvROIActor.cxx index 9755e78..52ddea5 100644 --- a/vv/vvROIActor.cxx +++ b/vv/vvROIActor.cxx @@ -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(); } //------------------------------------------------------------------------------ diff --git a/vv/vvROIActor.h b/vv/vvROIActor.h index 5a54ade..04c9029 100644 --- a/vv/vvROIActor.h +++ b/vv/vvROIActor.h @@ -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();