]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
...
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / RGBImageToOtherChannelsFilter.cxx
index 5282f602b4f44f439e55216dc88dd27286d5cc52..f06cda81fff5b0c477b35c6ea3e9a9606c3dfe3b 100644 (file)
@@ -13,12 +13,13 @@ RGBImageToOtherChannelsFilter( )
 {
   typedef cpPlugins::Interface::Parameters TParameters;
 
-  this->SetNumberOfInputs( 1 );
-  this->SetNumberOfOutputs( 1 );
-  this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
+  this->_AddInput( "Input" );
+  this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
 
-  this->m_DefaultParameters.Configure( TParameters::String, "OutChannel" );
-  this->m_Parameters = this->m_DefaultParameters;
+  std::vector< std::string > choices;
+  choices.push_back( "HSV" );
+  choices.push_back( "YPbPr" );
+  this->m_Parameters->ConfigureAsChoices( "OutChannel", choices );
 }
 
 // -------------------------------------------------------------------------
@@ -31,8 +32,7 @@ cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _GenerateData( )
 {
-  cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( 0 );
+  auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "RGBImageToOtherChannelsFilter: No input image." );
 
@@ -52,7 +52,7 @@ _GD0( itk::DataObject* image )
 {
   typedef typename I::PixelType _P;
 
-  std::string outc = this->m_Parameters.GetValueAsString( "OutChannel" );
+  std::string outc = this->m_Parameters->GetSelectedChoice( "OutChannel" );
   std::string r = "";
 
   using namespace cpExtensions::Algorithms;
@@ -85,8 +85,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( ) );