RGBImageToOtherChannelsFilter( )
: Superclass( )
{
- typedef cpPlugins::Interface::Parameters TParameters;
+ this->_AddInput( "Input" );
+ this->_AddOutput< cpPlugins::Interface::Image >( "Output" );
- this->SetNumberOfInputs( 1 );
- this->SetNumberOfOutputs( 1 );
- this->_MakeOutput< cpPlugins::Interface::Image >( 0 );
-
- 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 );
}
// -------------------------------------------------------------------------
std::string cpPlugins::BasicFilters::RGBImageToOtherChannelsFilter::
_GenerateData( )
{
- cpPlugins::Interface::Image* image =
- this->GetInput< cpPlugins::Interface::Image >( 0 );
- if( image == NULL )
- return( "RGBImageToOtherChannelsFilter: No input image." );
-
+ auto image = this->GetInputData< cpPlugins::Interface::Image >( "Input" );
itk::DataObject* itk_image = NULL;
std::string r = "";
cpPlugins_Image_Demangle_AllRGBTypes( 2, image, itk_image, r, _GD0 );
{
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;
filter->Update( );
// Connect output
- cpPlugins::Interface::Image* out =
- this->GetOutput< cpPlugins::Interface::Image >( 0 );
- if( out != NULL )
- {
- out->SetITK< _O >( filter->GetOutput( ) );
- return( "" );
- }
- else
- return( "RGBImageToOtherChannelsFilter: output not correctly created." );
-
+ auto out = this->GetOutputData< cpPlugins::Interface::Image >( "Output" );
+ out->SetITK( filter->GetOutput( ) );
return( "" );
}