From: David Sarrut Date: Fri, 30 Mar 2012 13:16:41 +0000 (+0200) Subject: Add RemoveActors X-Git-Tag: v1.3.0~52^2~16 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cff13ef732b851bc663de9cb8c6742592179f516;p=clitk.git Add RemoveActors --- 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;