1 #include <ITKLevelSetFilters/LaplacianSegmentationLevelSetImageFilter.h>
2 #include <cpInstances/Image.h>
4 #include <itkLaplacianSegmentationLevelSetImageFilter.h>
6 // -------------------------------------------------------------------------
7 cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
8 LaplacianSegmentationLevelSetImageFilter( )
11 this->_ConfigureInput< cpInstances::Image >( "Input", true, false );
12 this->_ConfigureInput< cpInstances::Image >( "Feature", true, false );
13 this->_ConfigureOutput< cpInstances::Image >( "Output" );
15 this->m_Parameters.ConfigureAsReal( "PropagationScaling", 1 );
16 this->m_Parameters.ConfigureAsReal( "CurvatureScaling", 1 );
17 this->m_Parameters.ConfigureAsReal( "MaximumRMSError", 0.02 );
18 this->m_Parameters.ConfigureAsReal( "IsoSurfaceValue", 0 );
19 this->m_Parameters.ConfigureAsUint( "NumberOfIterations", 100 );
22 // -------------------------------------------------------------------------
23 cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
24 ~LaplacianSegmentationLevelSetImageFilter( )
28 // -------------------------------------------------------------------------
29 void cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
32 auto o = this->GetInputData( "Input" );
33 cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
34 this->_Error( "Invalid input image dimension." );
37 // -------------------------------------------------------------------------
38 template< class _TImage >
39 void cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
40 _GD0( _TImage* image )
42 auto f = this->GetInputData( "Feature" );
43 cpPlugins_Demangle_Image_RealPixels_2( f, _GD1, _TImage::ImageDimension, image )
44 this->_Error( "Invalid feature image." );
47 // -------------------------------------------------------------------------
48 template< class _TFeature, class _TImage >
49 void cpPluginsITKLevelSetFilters::LaplacianSegmentationLevelSetImageFilter::
50 _GD1( _TFeature* feature, _TImage* image )
52 typedef typename _TFeature::PixelType _TScalar;
54 itk::LaplacianSegmentationLevelSetImageFilter< _TImage, _TFeature, _TScalar >
58 _TFilter* filter = this->_CreateITK< _TFilter >( );
59 filter->SetInput( image );
60 filter->SetFeatureImage( feature );
61 filter->SetPropagationScaling( this->m_Parameters.GetReal( "PropagationScaling" ) );
62 filter->SetCurvatureScaling( this->m_Parameters.GetReal( "CurvatureScaling" ) );
63 filter->SetMaximumRMSError( this->m_Parameters.GetReal( "MaximumRMSError" ) );
64 filter->SetIsoSurfaceValue( this->m_Parameters.GetReal( "IsoSurfaceValue" ) );
65 filter->SetNumberOfIterations( this->m_Parameters.GetUint( "NumberOfIterations" ) );
69 this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );