]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/MedianImageFilter.cxx
MAC compilation issues solved... Now some tests please
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / MedianImageFilter.cxx
index 083c6b92f83799799f174e2b1a249aaa8b1499fd..0046f07e76abe73bdd10bd614fcfc636ffdd31f4 100644 (file)
@@ -8,16 +8,11 @@ cpPlugins::BasicFilters::MedianImageFilter::
 MedianImageFilter( )
   : 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::Uint, "Radius" );
-
-  this->m_DefaultParameters.SetValueAsUint( "Radius", 3 );
-
-  this->m_Parameters = this->m_DefaultParameters;
+  this->m_Parameters->ConfigureAsUint( "Radius" );
+  this->m_Parameters->SetUint( "Radius", 3 );
 }
 
 // -------------------------------------------------------------------------
@@ -30,11 +25,7 @@ cpPlugins::BasicFilters::MedianImageFilter::
 std::string cpPlugins::BasicFilters::MedianImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( 0 );
-  if( image == NULL )
-    return( "MedianImageFilter: 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 );
@@ -66,7 +57,7 @@ _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
   _F* filter = this->_CreateITK< _F >( );
@@ -75,15 +66,9 @@ _RealGD( itk::DataObject* image )
   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( "MedianImageFilter: output not correctly created." );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$