34 #ifndef __QGoFilterChanAndVese_h
35 #define __QGoFilterChanAndVese_h
39 #include "QGoGUILibConfigure.h"
42 #include "itkVTKImageImport.h"
43 #include "vtkSmartPointer.h"
44 #include "vtkPolyData.h"
72 std::vector<vtkPolyData*> ApplyFilterLevelSet3D(
double iRadius, vtkPoints* iPoints,
73 int iIterations,
int iCurvature,
77 template<
typename TPixel >
79 typename itk::Image< TPixel, 3 >::Pointer iITKInput,
80 const std::vector< double >& iCenter,
81 const double& iRadius,
82 const int& iIterations,
83 const int& iCurvature)
85 typedef itk::Image< TPixel, 3 > FeatureImageType;
87 SegmentationFilterType;
88 typedef typename SegmentationFilterType::Pointer SegmentationFilterPointer;
90 typedef typename SegmentationFilterType::InternalPointType ITKPointType;
91 typedef typename SegmentationFilterType::InternalCoordRepType ITKCoordType;
94 ITKPointType itk_center;
96 for(
unsigned int dim = 0; dim < 3; dim++ )
98 itk_center[dim] =
static_cast< ITKCoordType
>( iCenter[dim] );
102 ITKCoordType itk_radius =
static_cast< ITKCoordType
>( iRadius );
105 SegmentationFilterPointer filter = SegmentationFilterType::New();
106 filter->SetCenter( itk_center );
107 filter->SetRadius( itk_radius );
108 filter->SetFeatureImage(iITKInput);
109 filter->SetPreprocess(0);
110 filter->SetNumberOfIterations(iIterations);
111 filter->SetCurvatureWeight(iCurvature);
114 typename Output3DType::Pointer resulting_image = filter->GetOutput();
116 if( resulting_image.IsNotNull() )
118 m_Image3D->Graft( resulting_image );
122 itkGenericExceptionMacro(
123 <<
"ChanAndVeseSegmentationFilter's output is NULL" );
128 template<
typename TPixel >
130 typename itk::Image< TPixel, 2 >::Pointer iITKInput,
131 const std::vector< double >& iCenter,
132 const double& iRadius,
133 const int& iIterations,
134 const int& iCurvature)
136 typedef itk::Image< TPixel, 2 > FeatureImageType;
138 SegmentationFilterType;
139 typedef typename SegmentationFilterType::Pointer SegmentationFilterPointer;
141 typedef typename SegmentationFilterType::InternalPointType ITKPointType;
142 typedef typename SegmentationFilterType::InternalCoordRepType ITKCoordType;
145 ITKPointType itk_center;
147 for(
unsigned int dim = 0; dim < 2; dim++ )
149 itk_center[dim] =
static_cast< ITKCoordType
>( iCenter[dim] );
153 ITKCoordType itk_radius =
static_cast< ITKCoordType
>( iRadius );
156 SegmentationFilterPointer filter = SegmentationFilterType::New();
157 filter->SetCenter( itk_center );
158 filter->SetRadius( itk_radius );
159 filter->SetFeatureImage(iITKInput);
160 filter->SetPreprocess(0);
161 filter->SetNumberOfIterations(iIterations);
162 filter->SetCurvatureWeight(iCurvature);
165 typename Output2DType::Pointer resulting_image = filter->GetOutput();
167 if( resulting_image.IsNotNull() )
169 m_Image2D->Graft( resulting_image );
173 itkGenericExceptionMacro(
174 <<
"ChanAndVeseSegmentationFilter's output is NULL" );
178 std::vector<std::vector<vtkPolyData*> > ApplyFilterSetOf2D(
179 double iRadius, std::vector< vtkPoints* >* iPoints,
180 int iIterations,
int iCurvature,
int iSampling,
Levelset segmentation algorithm implementation. Can generate contours and meshes. Will generate 2D ob...
Output2DType::Pointer Output2DPointer
void Apply3DFilter(typename itk::Image< TPixel, 3 >::Pointer iITKInput, const std::vector< double > &iCenter, const double &iRadius, const int &iIterations, const int &iCurvature)
Output3DType::Pointer m_Image3D
Output3DType::Pointer Output3DPointer
void Apply2DFilter(typename itk::Image< TPixel, 2 >::Pointer iITKInput, const std::vector< double > &iCenter, const double &iRadius, const int &iIterations, const int &iCurvature)
Output2DType::Pointer GetOutput2D()
Output2DType::Pointer m_Image2D
Output3DType::Pointer GetOutput3D()
itk::Image< float, 3 > Output3DType
Connects the common signals regarding the seeds segmentation Provides methods to convert images from ...
Interface between image reader and vtkImageData.
itk::Image< float, 2 > Output2DType