X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvROIActor.cxx;h=d6f5089722b056ce41a81cb29542387ed2e68f67;hb=HEAD;hp=26f13f479df91a6a09fc478019b84d8a409fc71e;hpb=9768b4757920c85042b8fd9710f3ddfc2e9bf5d4;p=clitk.git diff --git a/vv/vvROIActor.cxx b/vv/vvROIActor.cxx index 26f13f4..d6f5089 100644 --- a/vv/vvROIActor.cxx +++ b/vv/vvROIActor.cxx @@ -32,7 +32,7 @@ //------------------------------------------------------------------------------ vvROIActor::vvROIActor() -{ //out << __func__ << endl; +{ mIsVisible = true; mIsContourVisible = false; mOpacity = 0.5; @@ -52,14 +52,14 @@ vvROIActor::vvROIActor() //------------------------------------------------------------------------------ vvROIActor::~vvROIActor() -{ //out << __func__ << endl; +{ } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvROIActor::RemoveActors() -{ //out << __func__ << endl; +{ for(unsigned int i= 0; iRemoveActors(); } @@ -69,15 +69,15 @@ void vvROIActor::RemoveActors() } Update(true); - mImageContour.clear(); - mOverlayActors.clear(); + //mImageContour.clear(); + //mOverlayActors.clear(); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvROIActor::SetROI(clitk::DicomRT_ROI * s) -{ //out << __func__ << endl; +{ mROI = s; } //------------------------------------------------------------------------------ @@ -85,7 +85,7 @@ void vvROIActor::SetROI(clitk::DicomRT_ROI * s) //------------------------------------------------------------------------------ void vvROIActor::SetContourWidth(int n) -{ //out << __func__ << endl; +{ mContourWidth = n; } //------------------------------------------------------------------------------ @@ -93,7 +93,7 @@ void vvROIActor::SetContourWidth(int n) //------------------------------------------------------------------------------ void vvROIActor::SetSlicerManager(vvSlicerManager * s) -{ //out << __func__ << endl; +{ mSlicerManager = s; } //------------------------------------------------------------------------------ @@ -101,7 +101,7 @@ void vvROIActor::SetSlicerManager(vvSlicerManager * s) //------------------------------------------------------------------------------ void vvROIActor::UpdateImage() -{ //out << __func__ << endl; +{ mOverlayActors.clear(); mImageContour.clear(); Initialize(mDepth, mIsVisible); @@ -112,7 +112,7 @@ void vvROIActor::UpdateImage() //------------------------------------------------------------------------------ void vvROIActor::SetVisible(bool b) -{ //out << __func__ << endl; +{ mIsVisible = b; if (!b) { // remove actor for(unsigned int i= 0; iShowActors(); } - Update(); // No Render + //Update(); // No Render } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvROIActor::SetContourVisible(bool b) -{ //out << __func__ << endl; +{ mIsContourVisible = b; if (!b) { // remove actor for(unsigned int i= 0; iShowActors(); } } - Update(); // No Render + //Update(); // No Render } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ bool vvROIActor::IsVisible() -{ //out << __func__ << endl; +{ return mIsVisible; } //------------------------------------------------------------------------------ @@ -155,7 +155,7 @@ bool vvROIActor::IsVisible() //------------------------------------------------------------------------------ bool vvROIActor::IsContourVisible() -{ //out << __func__ << endl; +{ return mIsContourVisible; } //------------------------------------------------------------------------------ @@ -163,7 +163,7 @@ bool vvROIActor::IsContourVisible() //------------------------------------------------------------------------------ void vvROIActor::Initialize(double depth, bool IsVisible) -{ //out << __func__ << endl; +{ if (mROI->GetImage()) { mImageContour.clear(); mOverlayActors.clear(); @@ -185,12 +185,11 @@ void vvROIActor::Initialize(double depth, bool IsVisible) mOverlayActors.push_back(vvBinaryImageOverlayActor::New()); // BG or FG - if (m_modeBG) { - mOverlayActors[i]->SetImage(mROI->GetImage(), mROI->GetBackgroundValueLabelImage()); - } - else { - mOverlayActors[i]->SetImage(mROI->GetImage(), mROI->GetForegroundValueLabelImage(), false); - } + if (m_modeBG) + mOverlayActors[i]->SetImage(mROI->GetImage(), mROI->GetBackgroundValueLabelImage()); + else + mOverlayActors[i]->SetImage(mROI->GetImage(), mROI->GetForegroundValueLabelImage(), false); + mOverlayActors[i]->SetColor(mROI->GetDisplayColor()[0], @@ -202,7 +201,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))); } } @@ -211,7 +210,7 @@ void vvROIActor::Initialize(double depth, bool IsVisible) //------------------------------------------------------------------------------ void vvROIActor::SetDepth(double d) -{ //out << __func__ << endl; +{ mDepth = d; if (!mSlicerManager) return; for(int i=0; iGetNumberOfSlicers(); i++) { @@ -225,7 +224,7 @@ void vvROIActor::SetDepth(double d) //------------------------------------------------------------------------------ void vvROIActor::Update(bool force) -{ //out << __func__ << endl; +{ if (!mSlicerManager) return; for(int i=0; iGetNumberOfSlicers(); i++) { UpdateSlice(i, mSlicerManager->GetSlicer(i)->GetSlice(), force); @@ -235,8 +234,8 @@ void vvROIActor::Update(bool force) //------------------------------------------------------------------------------ -void vvROIActor::UpdateSlice(int slicer, int slices, bool force) -{ //out << __func__ << endl; +void vvROIActor::UpdateSlice(int slicer, int slices, int force) +{ if (!mROI->GetImage()) return; if ((!mIsVisible) && (!mIsContourVisible)) return; if (!mSlicerManager) { @@ -249,14 +248,17 @@ void vvROIActor::UpdateSlice(int slicer, int slices, bool force) } // Refresh overlays - mOverlayActors[slicer]->UpdateSlice(slicer, slices, force); + if (mIsVisible) { + mOverlayActors[slicer]->UpdateSlice(slicer, slices, force); + } + //mSlicerManager->GetSlicer(slicer)->Render(); } //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ void vvROIActor::SetOpacity(double d) -{ //out << __func__ << endl; +{ mOpacity = d; } //------------------------------------------------------------------------------ @@ -264,7 +266,7 @@ void vvROIActor::SetOpacity(double d) //------------------------------------------------------------------------------ void vvROIActor::SetContourColor(double r, double v, double b) -{ //out << __func__ << endl; +{ mContourColor[0] = r; mContourColor[1] = v; mContourColor[2] = b; @@ -274,7 +276,7 @@ void vvROIActor::SetContourColor(double r, double v, double b) //------------------------------------------------------------------------------ void vvROIActor::SetOverlayColor(double r, double v, double b) -{ //out << __func__ << endl; +{ if (mROI) mROI->SetDisplayColor(r,v,b); } @@ -283,7 +285,7 @@ void vvROIActor::SetOverlayColor(double r, double v, double b) //------------------------------------------------------------------------------ std::vector & vvROIActor::GetContourColor() -{ //out << __func__ << endl; +{ return mContourColor; } //------------------------------------------------------------------------------ @@ -291,7 +293,7 @@ std::vector & vvROIActor::GetContourColor() //------------------------------------------------------------------------------ std::vector & vvROIActor::GetOverlayColor() -{ //out << __func__ << endl; +{ return mROI->GetDisplayColor(); } //------------------------------------------------------------------------------ @@ -299,7 +301,7 @@ std::vector & vvROIActor::GetOverlayColor() //------------------------------------------------------------------------------ void vvROIActor::UpdateColor() -{ //out << __func__ << endl; +{ for(unsigned int i=0; iSetOpacity(mOpacity); mOverlayActors[i]->SetColor(mROI->GetDisplayColor()[0], @@ -319,7 +321,7 @@ void vvROIActor::UpdateColor() //------------------------------------------------------------------------------ double vvROIActor::GetOpacity() -{ //out << __func__ << endl; +{ return mOpacity; } //------------------------------------------------------------------------------ @@ -327,7 +329,7 @@ double vvROIActor::GetOpacity() //------------------------------------------------------------------------------ void vvROIActor::SetSelected(bool b) -{ //out << __func__ << endl; +{ mIsSelected = b; if (b) { for(int i=0; iGetNumberOfSlicers(); i++) { @@ -345,7 +347,7 @@ void vvROIActor::SetSelected(bool b) //------------------------------------------------------------------------------ void vvROIActor::CopyParameters(QSharedPointer roi) -{ //out << __func__ << endl; +{ // Overlay SetVisible(roi->IsVisible()); SetOpacity(roi->GetOpacity());