]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / ExtractSliceImageFilter.cxx
index ff14aa429538a5c5acec2236ff8b48fa0b819bd3..0e553fd1bca1a6fe31e9e4868c2e064042f5f23d 100644 (file)
@@ -8,18 +8,14 @@ cpPlugins::BasicFilters::ExtractSliceImageFilter::
 ExtractSliceImageFilter( )
   : Superclass( )
 {
-  this->m_ClassName = "cpPlugins::BasicFilters::ExtractSliceImageFilter";
-  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::Int, "Axis" );
-  this->m_DefaultParameters.Configure( Parameters::Int, "Slice" );
-  this->m_DefaultParameters.SetValueAsInt( "Axis", 0 );
-  this->m_DefaultParameters.SetValueAsInt( "Slice", 0 );
-  this->m_Parameters = this->m_DefaultParameters;
+  this->m_Parameters->ConfigureAsUint( "Axis" );
+  this->m_Parameters->ConfigureAsInt( "Slice" );
+
+  this->m_Parameters->SetUint( "Axis", 0 );
+  this->m_Parameters->SetInt( "Slice", 0 );
 }
 
 // -------------------------------------------------------------------------
@@ -32,16 +28,16 @@ cpPlugins::BasicFilters::ExtractSliceImageFilter::
 std::string cpPlugins::BasicFilters::ExtractSliceImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( 0 );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "ExtractSliceImageFilter: No input image." );
 
   itk::DataObject* itk_image = NULL;
   std::string r = "";
+/*
   cpPlugins_Image_Demangle_AllTypes( 3, image, itk_image, r, _GD0 );
   else cpPlugins_VectorImage_Demangle_AllTypes( 3, image, itk_image, r, _GD0 );
-  else r = "ExtractSliceImageFilter: Input image type not supported.";
+  else*/ r = "ExtractSliceImageFilter: Input image type not supported.";
   return( r );
 }
 
@@ -62,11 +58,8 @@ _RealGD( itk::DataObject* image )
   typedef typename O::PixelType _OP;
 
   // Get parameters
-  int axis = this->m_Parameters.GetValueAsInt( "Axis" );
-  int slice = this->m_Parameters.GetValueAsInt( "Slice" );
-
-  std::cout << "HOLA: " << slice << std::endl;
-
+  int axis = this->m_Parameters->GetUint( "Axis" );
+  int slice = this->m_Parameters->GetInt( "Slice" );
 
   // Compute region
   I* img = dynamic_cast< I* >( image );
@@ -78,8 +71,6 @@ _RealGD( itk::DataObject* image )
   region.SetSize( size );
   region.SetIndex( index );
 
-  std::cout << "HOLA-: " << region << std::endl;
-
   // Configure filter
   _F* filter = this->_CreateITK< _F >( );
   filter->SetInput( img );
@@ -88,8 +79,7 @@ _RealGD( itk::DataObject* image )
   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( ) );