X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FBasicFilters%2FBinaryThresholdImageFilter.cxx;h=5f159ce6410de2384beb69fd40b0a54e926be5be;hb=1b600247da314fe62d007ca8a0ce24d0006931f4;hp=10704aac29d1681c8abf57d9bd31b68d396ff5dd;hpb=dba64a6906e88d6023b2e6c9632da9fd41bfeb53;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx index 10704aa..5f159ce 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/BinaryThresholdImageFilter.cxx @@ -8,22 +8,18 @@ cpPlugins::BasicFilters::BinaryThresholdImageFilter:: BinaryThresholdImageFilter( ) : Superclass( ) { - this->SetNumberOfInputs( 1 ); - this->SetNumberOfOutputs( 1 ); - this->_MakeOutput< cpPlugins::Interface::Image >( 0 ); + this->_AddInput( "Input" ); + this->_AddOutput< cpPlugins::Interface::Image >( "Output" ); - using namespace cpPlugins::Interface; - this->m_DefaultParameters.Configure( Parameters::Real, "LowerThresholdValue" ); - this->m_DefaultParameters.Configure( Parameters::Real, "UpperThresholdValue" ); - this->m_DefaultParameters.Configure( Parameters::Real, "InsideValue" ); - this->m_DefaultParameters.Configure( Parameters::Real, "OutsideValue" ); + this->m_Parameters->ConfigureAsReal( "LowerThresholdValue" ); + this->m_Parameters->ConfigureAsReal( "UpperThresholdValue" ); + this->m_Parameters->ConfigureAsUint( "InsideValue" ); + this->m_Parameters->ConfigureAsUint( "OutsideValue" ); - this->m_DefaultParameters.SetValueAsReal( "LowerThresholdValue", 100 ); - this->m_DefaultParameters.SetValueAsReal( "UpperThresholdValue", 500 ); - this->m_DefaultParameters.SetValueAsReal( "InsideValue", 255 ); - this->m_DefaultParameters.SetValueAsReal( "OutsideValue", 0 ); - - this->m_Parameters = this->m_DefaultParameters; + this->m_Parameters->SetReal( "LowerThresholdValue", 0 ); + this->m_Parameters->SetReal( "UpperThresholdValue", 10000 ); + this->m_Parameters->SetUint( "InsideValue", 1 ); + this->m_Parameters->SetUint( "OutsideValue", 0 ); } // ------------------------------------------------------------------------- @@ -36,8 +32,7 @@ cpPlugins::BasicFilters::BinaryThresholdImageFilter:: std::string cpPlugins::BasicFilters::BinaryThresholdImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( 0 ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "BinaryThresholdImageFilter: No input image." ); @@ -74,10 +69,10 @@ _RealGD( itk::DataObject* image ) // Get parameters //unsigned int bins = // this->m_Parameters.GetValueAsUint( "NumberOfHistogramBins" ); - _IP lower_val = _IP( this->m_Parameters.GetValueAsReal( "LowerValue" ) ); - _IP upper_val = _IP( this->m_Parameters.GetValueAsReal( "UpperValue" ) ); - _OP in_val = _OP( this->m_Parameters.GetValueAsReal( "InsideValue" ) ); - _OP out_val = _OP( this->m_Parameters.GetValueAsReal( "OutsideValue" ) ); + _IP lower_val = _IP( this->m_Parameters->GetReal( "LowerThresholdValue" ) ); + _IP upper_val = _IP( this->m_Parameters->GetReal( "UpperThresholdValue" ) ); + _OP in_val = _OP( this->m_Parameters->GetUint( "InsideValue" ) ); + _OP out_val = _OP( this->m_Parameters->GetUint( "OutsideValue" ) ); // Configure filter _F* filter = this->_CreateITK< _F >( ); @@ -89,8 +84,7 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( 0 ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< O >( filter->GetOutput( ) );