X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FBasicFilters%2FOtsuThresholdImageFilter.cxx;h=5c419ae4e1bf6e61930742365e10332ee79c1e27;hb=a89305e04527ebe2e81d0d1a62bbe34e0d35a141;hp=22df71acbe944439fc457bb9587ca9dc0fd55f17;hpb=24dc7fa44ff75dc9336d703b8243ce1e52ff3429;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx index 22df71a..5c419ae 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/OtsuThresholdImageFilter.cxx @@ -9,11 +9,15 @@ OtsuThresholdImageFilter( ) : Superclass( ) { this->_AddInput( "Input" ); - this->_MakeOutput< cpPlugins::Interface::Image >( "Output" ); + this->_AddOutput< cpPlugins::Interface::Image >( "Output" ); - this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins", 100 ); - this->m_Parameters->ConfigureAsUint( "InsideValue", 255 ); - this->m_Parameters->ConfigureAsUint( "OutsideValue", 0 ); + this->m_Parameters->ConfigureAsUint( "NumberOfHistogramBins" ); + this->m_Parameters->ConfigureAsUint( "InsideValue" ); + this->m_Parameters->ConfigureAsUint( "OutsideValue" ); + + this->m_Parameters->SetUint( "NumberOfHistogramBins", 100 ); + this->m_Parameters->SetUint( "InsideValue", 255 ); + this->m_Parameters->SetUint( "OutsideValue", 0 ); } // ------------------------------------------------------------------------- @@ -26,11 +30,7 @@ cpPlugins::BasicFilters::OtsuThresholdImageFilter:: std::string cpPlugins::BasicFilters::OtsuThresholdImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( "Input" ); - if( image == NULL ) - return( "OtsuThresholdImageFilter: No input image." ); - + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); itk::DataObject* itk_image = NULL; std::string r = ""; cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 ); @@ -74,15 +74,9 @@ _RealGD( itk::DataObject* image ) filter->Update( ); // Connect output - cpPlugins::Interface::Image* out = - this->GetOutput< cpPlugins::Interface::Image >( "Output" ); - if( out != NULL ) - { - out->SetITK< O >( filter->GetOutput( ) ); - return( "" ); - } - else - return( "OtsuThresholdImageFilter: output not correctly created." ); + auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" ); + out->SetITK( filter->GetOutput( ) ); + return( "" ); } // eof - $RCSfile$