]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/ExtractSliceImageFilter.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / ExtractSliceImageFilter.cxx
index 5a65ca67da587acbbb6536b53a544ffb61c56cb3..12cb54034c2e9e2bb26b831d5af315f1dbb6d05e 100644 (file)
@@ -9,7 +9,7 @@ ExtractSliceImageFilter( )
   : Superclass( )
 {
   this->_AddInput( "Input" );
-  this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
+  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   this->m_Parameters->ConfigureAsUint( "Axis" );
   this->m_Parameters->ConfigureAsInt( "Slice" );
@@ -28,11 +28,7 @@ cpPlugins::BasicFilters::ExtractSliceImageFilter::
 std::string cpPlugins::BasicFilters::ExtractSliceImageFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "ExtractSliceImageFilter: No input image." );
-
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   itk::DataObject* itk_image = NULL;
   std::string r = "";
 /*
@@ -80,15 +76,9 @@ _RealGD( itk::DataObject* image )
   filter->Update( );
 
   // Connect output
-  cpPlugins::Interface::Image* out =
-    this->GetOutput< cpPlugins::Interface::Image >( "Output" );
-  if( out != NULL )
-  {
-    out->SetITK< O >( filter->GetOutput( ) );
-    return( "" );
-  }
-  else
-    return( "ExtractSliceImageFilter: output not correctly created." );
+  auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+  out->SetITK( filter->GetOutput( ) );
+  return( "" );
 }
 
 // eof - $RCSfile$