-#include <ITKDistanceMapFilters/BinaryContourImageFilter.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <itkBinaryContourImageFilter.h>
-
-// -------------------------------------------------------------------------
-cpPluginsITKDistanceMapFilters::BinaryContourImageFilter::
-BinaryContourImageFilter( )
- : Superclass( )
-{
- typedef cpInstances::DataObjects::Image _TImage;
-
- this->_ConfigureInput< _TImage >( "Input", true, false );
- this->_ConfigureOutput< _TImage >( "Output" );
-
- this->m_Parameters.ConfigureAsReal( "BackgroundValue", 0 );
- this->m_Parameters.ConfigureAsReal( "ForegroundValue", 1 );
- this->m_Parameters.ConfigureAsBool( "FullyConnected", false );
-}
-
-// -------------------------------------------------------------------------
-cpPluginsITKDistanceMapFilters::BinaryContourImageFilter::
-~BinaryContourImageFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPluginsITKDistanceMapFilters::BinaryContourImageFilter::
-_GenerateData( )
-{
- auto o = this->GetInputData( "Input" );
- cpPlugins_Demangle_Image_VisualDims_1( o, _GD0 )
- this->_Error( "Invalid input image dimension." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void cpPluginsITKDistanceMapFilters::BinaryContourImageFilter::
-_GD0( _TImage* image )
-{
- cpPlugins_Demangle_Image_ScalarPixels_1( image, _GD1, _TImage::ImageDimension )
- this->_Error( "Invalid input image pixel type." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void cpPluginsITKDistanceMapFilters::BinaryContourImageFilter::
-_GD1( _TImage* image )
-{
- typedef
- itk::BinaryContourImageFilter< _TImage, _TImage >
- _TFilter;
-
- // Get parameters
- double b = this->m_Parameters.GetReal( "BackgroundValue" );
- double f = this->m_Parameters.GetReal( "ForegroundValue" );
- double c = this->m_Parameters.GetBool( "FullyConnected" );
-
- // Configure filter
- _TFilter* filter = this->_CreateITK< _TFilter >( );
- filter->SetInput( image );
- filter->SetBackgroundValue( ( typename _TImage::PixelType )( b ) );
- filter->SetForegroundValue( ( typename _TImage::PixelType )( f ) );
- filter->SetFullyConnected( c );
- filter->Update( );
-
- // Connect output
- this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-}
-
-// eof - $RCSfile$