]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/BinaryErodeImageFilter.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / BinaryErodeImageFilter.cxx
index fd207a09eb4e188f20e0339f42b9680d4d8172bd..4391732b024614a538d8d30ce6ec41635cb4e434 100644 (file)
@@ -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" );
+  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,11 +27,7 @@ cpPlugins::BasicFilters::BinaryErodeImageFilter::
 std::string cpPlugins::BasicFilters::BinaryErodeImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( 0 );
-  if( image == NULL )
-    return( "BinaryErodeImageFilter: No input image." );
-
+  auto image = this->GetInputData( "Input" );
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllScalarTypes( 2, image, itk_image, r, _GD0 );
@@ -72,31 +61,23 @@ _RealGD( itk::DataObject* image )
 
   // 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();
-
-
+  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 );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "BinaryErodeImageFilter: output not correctly created." );
+  auto out = this->GetOutputData( "Output" );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$