X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=plugins%2FImageThresholdFilters%2FUnaryThresholdImageFilter.cxx;h=84aded188f6393ca83e75db72673b97e97617bac;hb=9b11582dc5062474361432e46838c4e790c21f10;hp=cd16ed3a243ce3e6de71ef48346598eb1d006f0e;hpb=9d315ac836e5fe246a8c987681085ee19898affc;p=cpPlugins.git diff --git a/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.cxx b/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.cxx index cd16ed3..84aded1 100644 --- a/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.cxx +++ b/plugins/ImageThresholdFilters/UnaryThresholdImageFilter.cxx @@ -1,5 +1,6 @@ #include #include +#include #include @@ -12,15 +13,10 @@ UnaryThresholdImageFilter( ) this->_ConfigureInput< _TImage >( "Input", true, false ); this->_ConfigureOutput< _TImage >( "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 ); + this->m_Parameters.ConfigureAsReal( "Threshold", 0 ); + this->m_Parameters.ConfigureAsReal( "InsideValue", 1 ); + this->m_Parameters.ConfigureAsReal( "OutsideValue", 0 ); + this->m_Parameters.ConfigureAsBool( "Strict", false ); } // ------------------------------------------------------------------------- @@ -33,11 +29,9 @@ cpPluginsImageThresholdFilters::UnaryThresholdImageFilter:: void cpPluginsImageThresholdFilters::UnaryThresholdImageFilter:: _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,23 +39,21 @@ template< class _TImage > void cpPluginsImageThresholdFilters::UnaryThresholdImageFilter:: _GD0( _TImage* image ) { - /* TODO - 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( ) ); - */ + 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$