]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / RGBImageToOtherChannelsFilter.cxx
index 13e6732abc1bd7410ffd31e00ccbc321b3294613..92b8ac5e094cecf404a59b8ab8a66c734434aa0f 100644 (file)
@@ -11,10 +11,8 @@ cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 RGBImageToOtherChannelsFilter( )
   : Superclass( )
 {
-  typedef cpPlugins::Interface::Parameters TParameters;
-
   this->_AddInput( "Input" );
-  this->_MakeOutput< cpPlugins::Interface::Image >( "Output" );
+  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
   std::vector< std::string > choices;
   choices.push_back( "HSV" );
@@ -32,11 +30,7 @@ cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( "Input" );
-  if( image == NULL )
-    return( "RGBImageToOtherChannelsFilter: No input image." );
-
+  auto image = this->GetInputData( "Input" );
   itk::DataObject* itk_image = NULL;
   std::string r = "";
   cpPlugins_Image_Demangle_AllRGBTypes( 2, image, itk_image, r, _GD0 );
@@ -86,16 +80,8 @@ _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( "RGBImageToOtherChannelsFilter: output not correctly created." );
-
+  auto out = this->GetOutputData( "Output" );
+  out->SetITK( filter->GetOutput( ) );
   return( "" );
 }