From cff13ef732b851bc663de9cb8c6742592179f516 Mon Sep 17 00:00:00 2001 From: David Sarrut Date: Fri, 30 Mar 2012 15:16:41 +0200 Subject: [PATCH] Add RemoveActors --- vv/vvBinaryImageOverlayActor.cxx | 20 ++++++++++++++++++-- vv/vvBinaryImageOverlayActor.h | 4 ++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/vv/vvBinaryImageOverlayActor.cxx b/vv/vvBinaryImageOverlayActor.cxx index 612d9c0..4f2e961 100644 --- a/vv/vvBinaryImageOverlayActor.cxx +++ b/vv/vvBinaryImageOverlayActor.cxx @@ -49,9 +49,25 @@ vvBinaryImageOverlayActor::vvBinaryImageOverlayActor() //------------------------------------------------------------------------------ vvBinaryImageOverlayActor::~vvBinaryImageOverlayActor() +{ + mImageActorList.clear(); +} +//------------------------------------------------------------------------------ + + +//------------------------------------------------------------------------------ +void vvBinaryImageOverlayActor::RemoveActors() { for (unsigned int i = 0; i < mImageActorList.size(); i++) { - mSlicer->GetRenderer()->RemoveActor(mImageActorList[i]); + if (mSlicer != 0) { + if (mSlicer != NULL) { + if (mSlicer->GetRenderer() != 0) { + if (mImageActorList[i] != 0) { + mSlicer->GetRenderer()->RemoveActor(mImageActorList[i]); + } + } + } + } } } //------------------------------------------------------------------------------ @@ -173,7 +189,7 @@ void vvBinaryImageOverlayActor::SetOpacity(double d) //------------------------------------------------------------------------------ -void vvBinaryImageOverlayActor::SetImage(vvImage * image, double bg, bool modeBG) +void vvBinaryImageOverlayActor::SetImage(vvImage::Pointer image, double bg, bool modeBG) { mImage = image; if (modeBG) { diff --git a/vv/vvBinaryImageOverlayActor.h b/vv/vvBinaryImageOverlayActor.h index 4437ec1..9559bc7 100644 --- a/vv/vvBinaryImageOverlayActor.h +++ b/vv/vvBinaryImageOverlayActor.h @@ -40,7 +40,7 @@ class vvBinaryImageOverlayActor : public itk::LightObject void SetSlicer(vvSlicer * slicer); void SetColor(double r, double g, double b); void SetOpacity(double d); - void SetImage(vvImage * image, double bg, bool modeBG=true); + void SetImage(vvImage::Pointer image, double bg, bool modeBG=true); void SetDepth(double d) { mDepth = d; } void Initialize(bool IsVisible=true); void UpdateColor(); @@ -55,7 +55,7 @@ class vvBinaryImageOverlayActor : public itk::LightObject int mTSlice; int mPreviousTSlice; int mPreviousSlice; - vvImage * mImage; + vvImage::Pointer mImage; std::vector mColor; double mAlpha; double mBackgroundValue; -- 2.47.1