From: srit Date: Fri, 15 Oct 2010 15:37:37 +0000 (+0000) Subject: Corrected use of vtkSmartPointers and mistakes in constructor / destructor X-Git-Tag: v1.2.0~341 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=cf77f4ffa2fbd52ec35734925fac49c98d274bae;p=clitk.git Corrected use of vtkSmartPointers and mistakes in constructor / destructor --- diff --git a/vv/vvSlicer.cxx b/vv/vvSlicer.cxx index 0e18d54..564dcf2 100644 --- a/vv/vvSlicer.cxx +++ b/vv/vvSlicer.cxx @@ -73,6 +73,7 @@ vtkStandardNewMacro(vvSlicer); //------------------------------------------------------------------------------ vvSlicer::vvSlicer() { + this->UnInstallPipeline(); mImage = NULL; mCurrentTSlice = 0; mUseReducedExtent = false; @@ -107,22 +108,22 @@ vvSlicer::vvSlicer() text += "middle button : grab image\n"; text += "right button : change windowing\n"; - crossCursor = vtkCursor2D::New(); + crossCursor = vtkSmartPointer::New(); crossCursor->AllOff(); crossCursor->AxesOn(); crossCursor->SetTranslationMode(1); crossCursor->SetRadius(2); - pdm = vtkPolyDataMapper2D::New(); + pdm = vtkSmartPointer::New(); pdm->SetInput(crossCursor->GetOutput()); - pdmA = vtkActor2D::New(); + pdmA = vtkSmartPointer::New(); pdmA->SetMapper(pdm); pdmA->GetProperty()->SetColor(255,10,212); pdmA->SetVisibility(0); pdmA->SetPickable(0); - ca = vtkCornerAnnotation::New(); + ca = vtkSmartPointer::New(); ca->GetTextProperty()->SetColor(255,10,212); ca->SetVisibility(1); mFileName = ""; @@ -142,8 +143,8 @@ vvSlicer::vvSlicer() this->WindowLevel->Delete(); this->WindowLevel = vvImageMapToWLColors::New(); - this->InstallPipeline(); + this->InstallPipeline(); } //------------------------------------------------------------------------------ @@ -325,11 +326,11 @@ void vvSlicer::SetOverlay(vvImage::Pointer overlay) mOverlay = overlay; if (!mOverlayMapper) - mOverlayMapper = vtkImageMapToWindowLevelColors::New(); + mOverlayMapper = vtkSmartPointer::New(); mOverlayMapper->SetInput(overlay->GetVTKImages()[0]); if (!mOverlayActor) { - mOverlayActor = vvBlendImageActor::New(); + mOverlayActor = vtkSmartPointer::New(); mOverlayActor->SetInput(mOverlayMapper->GetOutput()); mOverlayActor->SetPickable(0); mOverlayActor->SetVisibility(false); @@ -359,11 +360,11 @@ void vvSlicer::SetFusion(vvImage::Pointer fusion) mFusion = fusion; if (!mFusionMapper) - mFusionMapper = vtkImageMapToWindowLevelColors::New(); + mFusionMapper = vtkSmartPointer::New(); mFusionMapper->SetInput(fusion->GetVTKImages()[0]); if (!mFusionActor) { - mFusionActor = vtkImageActor::New(); + mFusionActor = vtkSmartPointer::New(); mFusionActor->SetInput(mFusionMapper->GetOutput()); mFusionActor->SetPickable(0); mFusionActor->SetVisibility(false); @@ -405,8 +406,8 @@ void vvSlicer::SetVF(vvImage::Pointer vf) mVF = vf; if (!mAAFilter) { - mAAFilter=vtkAssignAttribute::New(); - mVOIFilter = vtkExtractVOI::New(); + mAAFilter= vtkSmartPointer::New(); + mVOIFilter = vtkSmartPointer::New(); mVOIFilter->SetSampleRate(mSubSampling,mSubSampling,mSubSampling); } mVOIFilter->SetInput(vf->GetVTKImages()[0]); @@ -415,14 +416,14 @@ void vvSlicer::SetVF(vvImage::Pointer vf) mAAFilter->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA); if (!mArrow) - mArrow = vvGlyphSource::New(); + mArrow = vtkSmartPointer::New(); mArrow->SetGlyphTypeToSpecificArrow(); mArrow->SetScale(mScale); mArrow->FilledOff(); // Glyph the gradient vector (with arrows) if (!mGlyphFilter) - mGlyphFilter = vvGlyph2D::New(); + mGlyphFilter = vtkSmartPointer::New(); mGlyphFilter->SetInput(mAAFilter->GetOutput()); mGlyphFilter->SetSource(mArrow->GetOutput()); mGlyphFilter->ScalingOn(); @@ -432,13 +433,13 @@ void vvSlicer::SetVF(vvImage::Pointer vf) mGlyphFilter->SetColorModeToColorByVector(); if (!mVFMapper) - mVFMapper = vtkPolyDataMapper::New(); + mVFMapper = vtkSmartPointer::New(); //mVFMapper->SetInputConnection(mGlyphFilter->GetOutputPort()); mVFMapper->SetInput(mGlyphFilter->GetOutput()); mVFMapper->ImmediateModeRenderingOn(); if (!mVFActor) - mVFActor = vtkActor::New(); + mVFActor = vtkSmartPointer::New(); mVFActor->SetMapper(mVFMapper); mVFActor->SetPickable(0); mVFActor->GetProperty()->SetLineWidth(mVFWidth); @@ -459,14 +460,14 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks) if (landmarks) { if (!mCross) - mCross = vtkCursor3D::New(); + mCross = vtkSmartPointer::New(); mCross->SetFocalPoint(0.0,0.0,0.0); mCross->SetModelBounds(-10,10,-10,10,-10,10); mCross->AllOff(); mCross->AxesOn(); if (!mLandGlyph) - mLandGlyph = vtkGlyph3D::New(); + mLandGlyph = vtkSmartPointer::New(); mLandGlyph->SetSource(mCross->GetOutput()); mLandGlyph->SetInput(landmarks->GetOutput()); //mLandGlyph->SetIndexModeToScalar(); @@ -476,20 +477,20 @@ void vvSlicer::SetLandmarks(vvLandmarks* landmarks) mLandGlyph->SetColorModeToColorByScalar(); if (!mClipBox) - mClipBox = vtkBox::New(); + mClipBox = vtkSmartPointer::New(); if (!mLandClipper) - mLandClipper = vtkClipPolyData::New(); + mLandClipper = vtkSmartPointer::New(); mLandClipper->InsideOutOn(); mLandClipper->SetInput(mLandGlyph->GetOutput()); mLandClipper->SetClipFunction(mClipBox); if (!mLandMapper) - mLandMapper = vtkPolyDataMapper::New(); + mLandMapper = vtkSmartPointer::New(); mLandMapper->SetInputConnection(mLandClipper->GetOutputPort()); //mLandMapper->ScalarVisibilityOff(); if (!mLandActor) - mLandActor = vtkActor::New(); + mLandActor = vtkSmartPointer::New(); mLandActor->SetMapper(mLandMapper); mLandActor->GetProperty()->SetColor(255,10,212); mLandActor->SetPickable(0); @@ -1179,7 +1180,7 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max) std::swap(iLocalExtents[i*2], iLocalExtents[i*2+1]); } - vtkSmartPointer voiFilter = vtkExtractVOI::New(); + vtkSmartPointer voiFilter = vtkSmartPointer::New(); voiFilter->SetInput(this->GetInput()); voiFilter->SetVOI(iLocalExtents); voiFilter->Update(); @@ -1189,7 +1190,7 @@ void vvSlicer::GetExtremasAroundMousePointer(double & min, double & max) return; } - vtkSmartPointer accFilter = vtkImageAccumulate::New(); + vtkSmartPointer accFilter = vtkSmartPointer::New(); accFilter->SetInput(voiFilter->GetOutput()); accFilter->Update();