#include #include #include // ------------------------------------------------------------------------- cpPluginsITKUnaryFunctorFilters::UnaryThresholdImageFilter:: UnaryThresholdImageFilter( ) : Superclass( ) { this->_ConfigureInput< cpInstances::Image >( "Input", true, false ); this->_ConfigureOutput< cpInstances::Image >( "Output" ); this->m_Parameters.ConfigureAsReal( "Threshold", 0 ); this->m_Parameters.ConfigureAsReal( "InsideValue", 1 ); this->m_Parameters.ConfigureAsReal( "OutsideValue", 0 ); this->m_Parameters.ConfigureAsBool( "Strict", false ); } // ------------------------------------------------------------------------- cpPluginsITKUnaryFunctorFilters::UnaryThresholdImageFilter:: ~UnaryThresholdImageFilter( ) { } // ------------------------------------------------------------------------- void cpPluginsITKUnaryFunctorFilters::UnaryThresholdImageFilter:: _GenerateData( ) { auto o = this->GetInputData( "Input" ); cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) this->_Error( "Invalid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > void cpPluginsITKUnaryFunctorFilters::UnaryThresholdImageFilter:: _GD0( _TImage* image ) { typedef cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage > _TFilter; // Configure filter _TFilter* filter = this->_CreateITK< _TFilter >( ); filter->SetInput( image ); filter->SetThreshold( this->m_Parameters.GetReal( "Threshold" ) ); filter->SetInsideValue( this->m_Parameters.GetReal( "InsideValue" ) ); filter->SetOutsideValue( this->m_Parameters.GetReal( "OutsideValue" ) ); filter->SetStrict( this->m_Parameters.GetBool( "Strict" ) ); filter->Update( ); // Connect output this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$