X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FPlugins%2FBasicFilters%2FBinaryErodeImageFilter.cxx;h=91402f5b4b1595a8e850a2b7b775c2ee10867a08;hb=1bf710541f1f708f9000096a8d516596bf009d6d;hp=32c8d05bd73bdbe4b9d03087fe12885b1c803306;hpb=dba64a6906e88d6023b2e6c9632da9fd41bfeb53;p=cpPlugins.git diff --git a/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx b/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx index 32c8d05..91402f5 100644 --- a/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx +++ b/lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx @@ -10,18 +10,11 @@ cpPlugins::BasicFilters::BinaryErodeImageFilter:: BinaryErodeImageFilter( ) : Superclass( ) { - this->m_ClassName = "cpPlugins::BasicFilters::BinaryErodeImageFilter"; - this->m_ClassCategory = "ImageToImageFilter"; - this->SetNumberOfInputs( 1 ); - this->SetNumberOfOutputs( 1 ); - this->_MakeOutput< cpPlugins::Interface::Image >( 0 ); + this->_AddInput( "Input", true ); + this->_AddOutput< cpPlugins::Interface::Image >( "Output" ); - using namespace cpPlugins::Interface; - this->m_DefaultParameters.Configure( Parameters::Uint, "Radius" ); - - this->m_DefaultParameters.SetValueAsUint( "Radius", 2 ); - - this->m_Parameters = this->m_DefaultParameters; + this->m_Parameters->ConfigureAsUint( "Radius" ); + this->m_Parameters->SetUint( "Radius", 2 ); } // ------------------------------------------------------------------------- @@ -34,8 +27,7 @@ cpPlugins::BasicFilters::BinaryErodeImageFilter:: std::string cpPlugins::BasicFilters::BinaryErodeImageFilter:: _GenerateData( ) { - cpPlugins::Interface::Image* image = - this->GetInput< cpPlugins::Interface::Image >( 0 ); + auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" ); if( image == NULL ) return( "BinaryErodeImageFilter: No input image." ); @@ -65,31 +57,28 @@ template< class I, class O > inline std::string cpPlugins::BasicFilters::BinaryErodeImageFilter:: _RealGD( itk::DataObject* image ) { - //typedef itk::Image ImageType; - typedef itk::BinaryBallStructuringElement< I::PixelType, I::ImageDimension> StructuringElementType; + //typedef itk::Image ImageType; + typedef itk::BinaryBallStructuringElement< typename I::PixelType, I::ImageDimension> StructuringElementType; typedef itk::BinaryErodeImageFilter< I, O, StructuringElementType > _F; typedef typename _F::RadiusType _RT; // Get parameters _RT rad_val; - rad_val.Fill( this->m_Parameters.GetValueAsUint( "Radius" ) ); + rad_val.Fill( this->m_Parameters->GetUint( "Radius" ) ); // Configure filter - - StructuringElementType structuringElement; - structuringElement.SetRadius(rad_val); - structuringElement.CreateStructuringElement(); - + StructuringElementType structuringElement; + structuringElement.SetRadius( rad_val ); + structuringElement.CreateStructuringElement( ); _F* filter = this->_CreateITK< _F >( ); filter->SetInput( dynamic_cast< I* >( image ) ); - filter->SetKernel(structuringElement); + filter->SetKernel( structuringElement ); 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( ) );