X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FITKUnaryFunctorFilters%2FBinaryThresholdImageFilter.cxx;fp=plugins%2FITKUnaryFunctorFilters%2FBinaryThresholdImageFilter.cxx;h=0000000000000000000000000000000000000000;hb=2e142df11d6f312a2a2b5097b8da73571ed523e8;hp=50c0338ce4c41a9d97f2d8fa17075f25843b4d5a;hpb=61b3659afe961ed248f30e26f9ca8f28fcfafddc;p=cpPlugins.git diff --git a/plugins/ITKUnaryFunctorFilters/BinaryThresholdImageFilter.cxx b/plugins/ITKUnaryFunctorFilters/BinaryThresholdImageFilter.cxx deleted file mode 100644 index 50c0338..0000000 --- a/plugins/ITKUnaryFunctorFilters/BinaryThresholdImageFilter.cxx +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include - -#include - -// ------------------------------------------------------------------------- -cpPluginsITKUnaryFunctorFilters::BinaryThresholdImageFilter:: -BinaryThresholdImageFilter( ) - : Superclass( ) -{ - typedef cpInstances::DataObjects::Image _TImage; - this->_ConfigureInput< _TImage >( "Input", true, false ); - this->_ConfigureOutput< _TImage >( "Output" ); - - this->m_Parameters.ConfigureAsReal( "LowerThresholdValue", 0 ); - this->m_Parameters.ConfigureAsReal( "UpperThresholdValue", 1 ); - this->m_Parameters.ConfigureAsUint( "InsideValue", 1 ); - this->m_Parameters.ConfigureAsUint( "OutsideValue", 0 ); -} - -// ------------------------------------------------------------------------- -cpPluginsITKUnaryFunctorFilters::BinaryThresholdImageFilter:: -~BinaryThresholdImageFilter( ) -{ -} - -// ------------------------------------------------------------------------- -void cpPluginsITKUnaryFunctorFilters::BinaryThresholdImageFilter:: -_GenerateData( ) -{ - auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) - this->_Error( "Invalid input image." ); -} - -// ------------------------------------------------------------------------- -template< class _TImage > -void cpPluginsITKUnaryFunctorFilters::BinaryThresholdImageFilter:: -_GD0( _TImage* image ) -{ - typedef unsigned char _TBin; - typedef itk::Image< unsigned char, _TImage::ImageDimension > _TBinImage; - typedef itk::BinaryThresholdImageFilter< _TImage, _TBinImage > _TFilter; - typedef typename _TImage::PixelType _TPixel; - - // Get parameters - _TPixel lt = _TPixel( this->m_Parameters.GetReal( "LowerThresholdValue" ) ); - _TPixel ut = _TPixel( this->m_Parameters.GetReal( "UpperThresholdValue" ) ); - _TBin iv = _TBin( this->m_Parameters.GetUint( "InsideValue" ) ); - _TBin ov = _TBin( this->m_Parameters.GetUint( "OutsideValue" ) ); - - // Configure filter - _TFilter* filter = this->_CreateITK< _TFilter >( ); - filter->SetInput( image ); - filter->SetLowerThreshold( lt ); - filter->SetUpperThreshold( ut ); - filter->SetInsideValue( iv ); - filter->SetOutsideValue( ov ); - filter->Update( ); - - // Connect output - this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); -} - -// eof - $RCSfile$