]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/Plugins/BasicFilters/RGBImageToOtherChannelsFilter.cxx
Merge branch 'master' of ssh://git.creatis.insa-lyon.fr/cpPlugins
[cpPlugins.git] / lib / cpPlugins / Plugins / BasicFilters / RGBImageToOtherChannelsFilter.cxx
index 38cec311f0dde0506660f91708a626f2c6635e5a..13e6732abc1bd7410ffd31e00ccbc321b3294613 100644 (file)
@@ -13,14 +13,13 @@ RGBImageToOtherChannelsFilter( )
 {
   typedef cpPlugins::Interface::Parameters TParameters;
 
-  this->m_ClassName = "cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter";
-  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" );
 
-  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 );
 }
 
 // -------------------------------------------------------------------------
@@ -34,7 +33,7 @@ std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
 _GenerateData( )
 {
   cpPlugins::Interface::Image* image =
-    this->GetInput< cpPlugins::Interface::Image >( 0 );
+    this->GetInput< cpPlugins::Interface::Image >( "Input" );
   if( image == NULL )
     return( "RGBImageToOtherChannelsFilter: No input image." );
 
@@ -54,7 +53,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;
@@ -88,7 +87,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( ) );