]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/cpPlugins
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / ExtractSliceImageFilter.cxx
index ff14aa429538a5c5acec2236ff8b48fa0b819bd3..65a70809a3cd136e660a245349d10cd80703f8db 100644 (file)
@@ -8,18 +8,11 @@ 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" );
+  this->_MakeOutput< 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", 0 );
+  this->m_Parameters->ConfigureAsInt( "Slice", 0 );
 }
 
 // -------------------------------------------------------------------------
@@ -33,15 +26,16 @@ std::string cpPlugins::BasicFilters::ExtractSliceImageFilter::
 _GenerateData( )
 {
   cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( 0 );
+    this->GetInput< 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 +56,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 +69,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 );
@@ -89,7 +78,7 @@ _RealGD( itk::DataObject* image )
 
   // Connect output
   cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( 0 );
+    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
   if( out != NULL )
   {
     out->SetITK< O >( filter->GetOutput( ) );