X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FImageThresholdFilters%2FBinaryThresholdImageFilter.cxx;h=0fddf92b30bc91468f031f836ae098256e9872fd;hb=9b11582dc5062474361432e46838c4e790c21f10;hp=12537737b1f1c581a6389aca2646c4a9a4d63ba5;hpb=9d315ac836e5fe246a8c987681085ee19898affc;p=cpPlugins.git diff --git a/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.cxx b/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.cxx index 1253773..0fddf92 100644 --- a/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.cxx +++ b/plugins/ImageThresholdFilters/BinaryThresholdImageFilter.cxx @@ -1,5 +1,6 @@ #include #include +#include #include @@ -12,15 +13,10 @@ BinaryThresholdImageFilter( ) this->_ConfigureInput< _TImage >( "Input", true, false ); this->_ConfigureOutput< _TImage >( "Output" ); - this->m_Parameters.ConfigureAsReal( "LowerThresholdValue" ); - this->m_Parameters.ConfigureAsReal( "UpperThresholdValue" ); - this->m_Parameters.ConfigureAsUint( "InsideValue" ); - this->m_Parameters.ConfigureAsUint( "OutsideValue" ); - - this->m_Parameters.SetReal( "LowerThresholdValue", 0 ); - this->m_Parameters.SetReal( "UpperThresholdValue", 10000 ); - this->m_Parameters.SetUint( "InsideValue", 1 ); - this->m_Parameters.SetUint( "OutsideValue", 0 ); + this->m_Parameters.ConfigureAsReal( "LowerThresholdValue", 0 ); + this->m_Parameters.ConfigureAsReal( "UpperThresholdValue", 10000 ); + this->m_Parameters.ConfigureAsUint( "InsideValue", 1 ); + this->m_Parameters.ConfigureAsUint( "OutsideValue", 0 ); } // ------------------------------------------------------------------------- @@ -33,11 +29,9 @@ cpPluginsImageThresholdFilters::BinaryThresholdImageFilter:: void cpPluginsImageThresholdFilters::BinaryThresholdImageFilter:: _GenerateData( ) { - /* TODO - auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_ImageScalars_Dims( o, _GD0 ); - else this->_Error( "Invalid input image." ); - */ + auto o = this->GetInputData( "Input" ); + cpPlugins_Demangle_Image_ScalarPixels_AllDims_1( o, _GD0 ) + this->_Error( "Invalid input image." ); } // ------------------------------------------------------------------------- @@ -45,30 +39,28 @@ template< class _TImage > void cpPluginsImageThresholdFilters::BinaryThresholdImageFilter:: _GD0( _TImage* image ) { - /* TODO - typedef unsigned char _TBin; - typedef itk::Image< unsigned char, _TImage::ImageDimension > _TBinImage; - typedef itk::BinaryThresholdImageFilter< _TImage, _TBinImage > _TFilter; - typedef typename _TImage::PixelType _TPixel; + 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" ) ); + // 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( ); + // 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( ) ); - */ + // Connect output + this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) ); } // eof - $RCSfile$