#include #include #include // ------------------------------------------------------------------------- cpPluginsImageFilters::UnaryThresholdImageFilter:: UnaryThresholdImageFilter( ) : Superclass( ) { this->_AddInput( "Input" ); this->_AddOutput< cpPlugins::Image >( "Output" ); this->m_Parameters.ConfigureAsReal( "Threshold" ); this->m_Parameters.ConfigureAsReal( "InsideValue" ); this->m_Parameters.ConfigureAsReal( "OutsideValue" ); this->m_Parameters.ConfigureAsBool( "Strict" ); this->m_Parameters.SetReal( "Threshold", 0 ); this->m_Parameters.SetReal( "InsideValue", 1 ); this->m_Parameters.SetReal( "OutsideValue", 0 ); this->m_Parameters.SetBool( "Strict", false ); } // ------------------------------------------------------------------------- cpPluginsImageFilters::UnaryThresholdImageFilter:: ~UnaryThresholdImageFilter( ) { } // ------------------------------------------------------------------------- void cpPluginsImageFilters::UnaryThresholdImageFilter:: _GenerateData( ) { auto image = this->GetInputData< itk::DataObject >( "Input" ); cpPlugins_Image_Demangle_Pixel_AllScalars ( _GD0, image, 2 ); else cpPlugins_Image_Demangle_Pixel_AllScalars( _GD0, image, 3 ); else this->_Error( "No valid input image." ); } // ------------------------------------------------------------------------- template< class _TImage > void cpPluginsImageFilters::UnaryThresholdImageFilter:: _GD0( _TImage* image ) { typedef cpExtensions::Algorithms::UnaryThresholdImageFilter< _TImage > _TFilter; _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( ); this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$