VMTK
Loading...
Searching...
No Matches
vtkvmtkGeodesicActiveContourLevelSetImageFilter.cxx
Go to the documentation of this file.
1/*=========================================================================
2
3Program: VMTK
4Module: $RCSfile: vtkbvsGeodesicActiveContourLevelSetImageFilter.cxx,v $
5Language: C++
6Date: $Date: 2006/04/06 16:48:25 $
7Version: $Revision: 1.1 $
8
9 Copyright (c) Luca Antiga, David Steinman. All rights reserved.
10 See LICENSE file for details.
11
12 Portions of this code are covered under the VTK copyright.
13 See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm
14 for details.
15
16 Portions of this code are covered under the ITK copyright.
17 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm
18 for details.
19
20 This software is distributed WITHOUT ANY WARRANTY; without even
21 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
22 PURPOSE. See the above copyright notices for more information.
23
24=========================================================================*/
25
27#include "vtkObjectFactory.h"
28
30
31#include "itkGeodesicActiveContourLevelSetImageFilter.h"
32
34
36{
37 this->IsoSurfaceValue = 0.0;
38 this->NumberOfIterations = 0;
39 this->PropagationScaling = 0.0;
40 this->CurvatureScaling = 0.0;
41 this->AdvectionScaling = 0.0;
42 this->MaximumRMSError = 1E-6;
43 this->UseNegativeFeatures = 0;
44 this->AutoGenerateSpeedAdvection = 1;
45 this->InterpolateSurfaceLocation = 1;
46 this->UseImageSpacing = 1;
47 this->DerivativeSigma = 0.0;
48 this->RMSChange = 0.0;
49 this->ElapsedIterations = 0;
50 this->FeatureImage = NULL;
51 this->SpeedImage = NULL;
52}
53
55{
56 if (this->FeatureImage)
57 {
58 this->FeatureImage->Delete();
59 this->FeatureImage = NULL;
60 }
61 if (this->SpeedImage)
62 {
63 this->SpeedImage->Delete();
64 this->SpeedImage = NULL;
65 }
66}
67
68void vtkvmtkGeodesicActiveContourLevelSetImageFilter::SimpleExecute(vtkImageData* input, vtkImageData* output)
69{
70 typedef itk::Image<float,3> ImageType;
71
72 ImageType::Pointer inImage = ImageType::New();
73
75
76 typedef itk::GeodesicActiveContourLevelSetImageFilter<ImageType,ImageType> LevelSetFilterType;
77
78 ImageType::Pointer featureImage = ImageType::New();
79 ImageType::Pointer speedImage = ImageType::New();
80
81 LevelSetFilterType::Pointer levelSetFilter = LevelSetFilterType::New();
82 levelSetFilter->SetInput(inImage);
83 if (this->FeatureImage)
84 {
85 vtkvmtkITKFilterUtilities::VTKToITKImage<ImageType>(this->FeatureImage,featureImage);
86 levelSetFilter->SetFeatureImage(featureImage);
87 }
88 if (this->SpeedImage)
89 {
90 vtkvmtkITKFilterUtilities::VTKToITKImage<ImageType>(this->SpeedImage,speedImage);
91 levelSetFilter->SetSpeedImage(speedImage);
92 }
93 levelSetFilter->SetIsoSurfaceValue(this->IsoSurfaceValue);
94 levelSetFilter->SetNumberOfIterations(this->NumberOfIterations);
95 levelSetFilter->SetPropagationScaling(this->PropagationScaling);
96 levelSetFilter->SetCurvatureScaling(this->CurvatureScaling);
97 levelSetFilter->SetAdvectionScaling(this->AdvectionScaling);
98 levelSetFilter->SetMaximumRMSError(this->MaximumRMSError);
99 levelSetFilter->SetReverseExpansionDirection(this->UseNegativeFeatures);
100 levelSetFilter->SetAutoGenerateSpeedAdvection(this->AutoGenerateSpeedAdvection);
101 levelSetFilter->SetInterpolateSurfaceLocation(this->InterpolateSurfaceLocation);
102 levelSetFilter->SetUseImageSpacing(this->UseImageSpacing);
103 levelSetFilter->SetDerivativeSigma(this->DerivativeSigma);
104
106
107 levelSetFilter->Update();
108
109 this->RMSChange = levelSetFilter->GetRMSChange();
110 this->ElapsedIterations = levelSetFilter->GetElapsedIterations();
111
112 vtkvmtkITKFilterUtilities::ITKToVTKImage<ImageType>(levelSetFilter->GetOutput(),output);
113}
114
virtual void SimpleExecute(vtkImageData *input, vtkImageData *output) override
static void ConnectProgress(itk::Object *obj, vtkAlgorithm *alg)
static void ITKToVTKImage(typename TImage::Pointer input, vtkImageData *output)
static void VTKToITKImage(vtkImageData *input, typename TImage::Pointer output)
vtkStandardNewMacro(vtkvmtkGeodesicActiveContourLevelSetImageFilter)