+++ /dev/null
-#include <ITKBinaryFunctorFilters/BinaryBooleanImageFilter.h>
-#include <cpInstances/DataObjects/Image.h>
-
-#include <itkAndImageFilter.h>
-#include <itkOrImageFilter.h>
-#include <itkXorImageFilter.h>
-
-// -------------------------------------------------------------------------
-cpPluginsITKBinaryFunctorFilters::BinaryBooleanImageFilter::
-BinaryBooleanImageFilter( )
- : Superclass( )
-{
- typedef cpInstances::DataObjects::Image _TImage;
-
- this->_ConfigureInput< _TImage >( "Input1", true, false );
- this->_ConfigureInput< _TImage >( "Input2", true, false );
- this->_ConfigureOutput< _TImage >( "Output" );
-
- std::vector< std::string > choices;
- choices.push_back( "And" );
- choices.push_back( "Or" );
- choices.push_back( "Xor" );
- this->m_Parameters.ConfigureAsChoices( "Operator", choices );
-}
-
-// -------------------------------------------------------------------------
-cpPluginsITKBinaryFunctorFilters::BinaryBooleanImageFilter::
-~BinaryBooleanImageFilter( )
-{
-}
-
-// -------------------------------------------------------------------------
-void cpPluginsITKBinaryFunctorFilters::BinaryBooleanImageFilter::
-_GenerateData( )
-{
- auto o = this->GetInputData( "Input1" );
- cpPlugins_Demangle_Image_IntPixels_AllDims_1( o, _GD0 )
- this->_Error( "Invalid input image." );
-}
-
-// -------------------------------------------------------------------------
-template< class _TImage >
-void cpPluginsITKBinaryFunctorFilters::BinaryBooleanImageFilter::
-_GD0( _TImage* image1 )
-{
- typedef itk::AndImageFilter< _TImage, _TImage > _TAnd;
- typedef itk::OrImageFilter< _TImage, _TImage > _TOr;
- typedef itk::XorImageFilter< _TImage, _TImage > _TXor;
-
- auto image2 = this->GetInputData< _TImage >( "Input2" );
- if( image2 == NULL )
- this->_Error( "Incompatible second input image." );
- std::string op = this->m_Parameters.GetSelectedChoice( "Operator" );
- if ( op == "And" ) this->_GD1< _TAnd, _TImage >( image1, image2 );
- else if( op == "Or" ) this->_GD1< _TOr, _TImage >( image1, image2 );
- else if( op == "Xor" ) this->_GD1< _TXor, _TImage >( image1, image2 );
-}
-
-// -------------------------------------------------------------------------
-template< class _TFilter, class _TImage >
-void cpPluginsITKBinaryFunctorFilters::BinaryBooleanImageFilter::
-_GD1( _TImage* image1, _TImage* image2 )
-{
- // Configure filter
- auto filter = this->_CreateITK< _TFilter >( );
- filter->SetInput1( image1 );
- filter->SetInput2( image2 );
- filter->Update( );
-
- // Connect output
- this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
-}
-
-// eof - $RCSfile$