X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FBasicFilters%2FOtsuThresholdImageFilter.cxx;h=22df71acbe944439fc457bb9587ca9dc0fd55f17;hb=d6f15d4cb764982e2b09060a9c0f38636891590c;hp=65df9e012f352533234122fd9d7cdbfca72eb908;hpb=2553991938011b002691361f0ed4ae95a552a686;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx index 65df9e0..22df71a 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx @@ -8,9 +8,8 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter:: OtsuThresholdImageFilter( ) : Superclass( ) { - this->SetNumberOfInputs( 1 ); - this->SetNumberOfOutputs( 1 ); - this->_MakeOutput< cpPlugins::Interface::Image >( 0 ); + this->_AddInput( "Input" ); + this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins", 100 ); this->m_Parameters->ConfigureAsUint( "InsideValue", 255 ); @@ -28,7 +27,7 @@ std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter:: _GenerateData( ) { cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( 0 ); + this->GetInput< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "OtsuThresholdImageFilter: No input image." ); @@ -70,13 +69,13 @@ _RealGD( itk::DataObject* image ) _F* filter = this->_CreateITK< _F >( ); filter->SetInput( dynamic_cast< I* >( image ) ); filter->SetNumberOfHistogramBins( bins ); - filter->SetInsideValue( in_val ); - filter->SetOutsideValue( out_val ); + filter->SetInsideValue( out_val ); // WARNING: these are inverted + filter->SetOutsideValue( in_val ); filter->Update( ); // Connect output cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( 0 ); + this->GetOutput< cpPlugins::Interface::Image >( "Output" ); if( out != NULL ) { out->SetITK< O >( filter->GetOutput( ) );