From: David Sarrut Date: Fri, 30 Mar 2012 13:17:29 +0000 (+0200) Subject: Add RemoveActors and CopyParameters X-Git-Tag: v1.3.0~52^2~13 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=708349c09f3bf57754cbc22a25605de43288cdb4;p=clitk.git Add RemoveActors and CopyParameters --- diff --git a/vv/vvROIActor.cxx b/vv/vvROIActor.cxx index b46ae0a..9243431 100644 --- a/vv/vvROIActor.cxx +++ b/vv/vvROIActor.cxx @@ -41,6 +41,11 @@ vvROIActor::vvROIActor() mContourColor.resize(3); m_modeBG = true; mDepth = 1.0; + mROI = 0; + mSlicerManager = 0; + mContourColor[0] = 1; + mContourColor[1] = 1; + mContourColor[2] = 1; } //------------------------------------------------------------------------------ @@ -52,6 +57,24 @@ vvROIActor::~vvROIActor() //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvROIActor::RemoveActors() +{ + for(unsigned int i= 0; iRemoveActors(); + } + + for(unsigned int i= 0; iRemoveActors(); + } + + Update(true); + mImageContour.clear(); + mOverlayActors.clear(); +} +//------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ void vvROIActor::SetROI(clitk::DicomRT_ROI * s) { @@ -140,19 +163,13 @@ void vvROIActor::Initialize(double depth, bool IsVisible) { mOverlayActors.clear(); mDepth = depth; for(int i=0; iGetNumberOfSlicers(); i++) { - mImageContour.push_back(vvImageContour::New()); mImageContour[i]->SetSlicer(mSlicerManager->GetSlicer(i)); mImageContour[i]->SetImage(mROI->GetImage()); - mContourColor[0] = mROI->GetDisplayColor()[0]; - mContourColor[1] = mROI->GetDisplayColor()[1]; - mContourColor[2] = mROI->GetDisplayColor()[2]; mImageContour[i]->SetColor(mContourColor[0], mContourColor[1], mContourColor[2]); mImageContour[i]->SetLineWidth(mContourWidth); mImageContour[i]->SetPreserveMemoryModeEnabled(true); mImageContour[i]->SetDepth(mDepth); - //mImageContour[i]->SetPreserveMemoryModeEnabled(false); // SEG FAULT !!! - mImageContour[i]->SetSlicer(mSlicerManager->GetSlicer(i)); mImageContour[i]->HideActors(); mOverlayActors.push_back(vvBinaryImageOverlayActor::New()); @@ -187,6 +204,7 @@ void vvROIActor::Initialize(double depth, bool IsVisible) { void vvROIActor::SetDepth(double d) { mDepth = d; + if (!mSlicerManager) return; for(int i=0; iGetNumberOfSlicers(); i++) { mOverlayActors[i]->SetDepth(d); mImageContour[i]->SetDepth(d); @@ -199,6 +217,7 @@ void vvROIActor::SetDepth(double d) //------------------------------------------------------------------------------ void vvROIActor::Update(bool force) { + if (!mSlicerManager) return; for(int i=0; iGetNumberOfSlicers(); i++) { UpdateSlice(i, mSlicerManager->GetSlicer(i)->GetSlice(), force); } @@ -243,6 +262,14 @@ void vvROIActor::SetContourColor(double r, double v, double b) { //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +void vvROIActor::SetOverlayColor(double r, double v, double b) { + if (mROI) + mROI->SetDisplayColor(r,v,b); +} +//------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ std::vector & vvROIActor::GetContourColor() { return mContourColor; @@ -250,6 +277,13 @@ std::vector & vvROIActor::GetContourColor() { //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +std::vector & vvROIActor::GetOverlayColor() { + return mROI->GetDisplayColor(); +} +//------------------------------------------------------------------------------ + + //------------------------------------------------------------------------------ void vvROIActor::UpdateColor() { for(unsigned int i=0; i roi) +{ + // Overlay + SetVisible(roi->IsVisible()); + SetOpacity(roi->GetOpacity()); + SetOverlayColor(roi->GetOverlayColor()[0], roi->GetOverlayColor()[1], roi->GetOverlayColor()[2]); + + // Contour + SetContourVisible(roi->IsContourVisible()); + SetContourWidth(roi->GetContourWidth()); + SetContourColor(roi->GetContourColor()[0], roi->GetContourColor()[1], roi->GetContourColor()[2]); + + // Global + SetDepth(roi->GetDepth()); +} +//------------------------------------------------------------------------------