+#include <ITKLevelSetFilters/ThresholdSegmentationLevelSetImageFilter.h>
+#include <cpInstances/Image.h>
+
+#include <itkThresholdSegmentationLevelSetImageFilter.h>
+
+// -------------------------------------------------------------------------
+cpPluginsITKLevelSetFilters::ThresholdSegmentationLevelSetImageFilter::
+ThresholdSegmentationLevelSetImageFilter( )
+ : Superclass( )
+{
+ this->_ConfigureInput< cpInstances::Image >( "Input", true, false );
+ this->_ConfigureInput< cpInstances::Image >( "Feature", true, false );
+ this->_ConfigureOutput< cpInstances::Image >( "Output" );
+
+ this->m_Parameters.ConfigureAsReal( "PropagationScaling", 1 );
+ this->m_Parameters.ConfigureAsReal( "CurvatureScaling", 1 );
+ this->m_Parameters.ConfigureAsReal( "MaximumRMSError", 0.02 );
+ this->m_Parameters.ConfigureAsReal( "UpperThreshold", 1 );
+ this->m_Parameters.ConfigureAsReal( "LowerThreshold", 0 );
+ this->m_Parameters.ConfigureAsReal( "IsoSurfaceValue", 0 );
+ this->m_Parameters.ConfigureAsUint( "NumberOfIterations", 100 );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsITKLevelSetFilters::ThresholdSegmentationLevelSetImageFilter::
+~ThresholdSegmentationLevelSetImageFilter( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsITKLevelSetFilters::ThresholdSegmentationLevelSetImageFilter::
+_GenerateData( )
+{
+ auto o = this->GetInputData( "Input" );
+ cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 )
+ this->_Error( "Invalid input image dimension." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPluginsITKLevelSetFilters::ThresholdSegmentationLevelSetImageFilter::
+_GD0( _TImage* image )
+{
+ auto f = this->GetInputData( "Feature" );
+ cpPlugins_Demangle_Image_RealPixels_2( f, _GD1, _TImage::ImageDimension, image )
+ this->_Error( "Invalid feature image." );
+}
+
+// -------------------------------------------------------------------------
+template< class _TFeature, class _TImage >
+void cpPluginsITKLevelSetFilters::ThresholdSegmentationLevelSetImageFilter::
+_GD1( _TFeature* feature, _TImage* image )
+{
+ typedef typename _TFeature::PixelType _TScalar;
+ typedef
+ itk::ThresholdSegmentationLevelSetImageFilter< _TImage, _TFeature, _TScalar >
+ _TFilter;
+
+ // Configure filter
+ _TFilter* filter = this->_CreateITK< _TFilter >( );
+ filter->SetInput( image );
+ filter->SetFeatureImage( feature );
+ filter->SetPropagationScaling( this->m_Parameters.GetReal( "PropagationScaling" ) );
+ filter->SetCurvatureScaling( this->m_Parameters.GetReal( "CurvatureScaling" ) );
+ filter->SetMaximumRMSError( this->m_Parameters.GetReal( "MaximumRMSError" ) );
+ filter->SetUpperThreshold( this->m_Parameters.GetReal( "UpperThreshold" ) );
+ filter->SetLowerThreshold( this->m_Parameters.GetReal( "LowerThreshold" ) );
+ filter->SetIsoSurfaceValue( this->m_Parameters.GetReal( "IsoSurfaceValue" ) );
+ filter->SetNumberOfIterations( this->m_Parameters.GetUint( "NumberOfIterations" ) );
+ filter->Update( );
+
+ // Connect output
+ this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$