#include <itkImageRegionIterator.h>
#include <itkImageRegionConstIterator.h>
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel1( )
-{
- return( this->GetOutput( 0 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel2( )
-{
- return( this->GetOutput( 1 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel3( )
-{
- return( this->GetOutput( 2 ) );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-const O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel1( ) const
-{
- if( this->GetNumberOfOutputs( ) > 0 )
- return(
- dynamic_cast< const O* >(
- this->itk::ProcessObject::GetOutput( 0 )
- )
- );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-const O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel2( ) const
-{
- if( this->GetNumberOfOutputs( ) > 1 )
- return(
- dynamic_cast< const O* >(
- this->itk::ProcessObject::GetOutput( 1 )
- )
- );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-const O* cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GetChannel3( ) const
-{
- if( this->GetNumberOfOutputs( ) > 2 )
- return(
- dynamic_cast< const O* >(
- this->itk::ProcessObject::GetOutput( 2 )
- )
- );
- else
- return( NULL );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GraftChannel1( O* hue )
-{
- this->GraftNthOutput( 0, hue );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GraftChannel2( O* saturation )
-{
- this->GraftNthOutput( 1, saturation );
-}
-
-// -------------------------------------------------------------------------
-template< class I, class O, class C >
-void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
-GraftChannel3( O* value )
-{
- this->GraftNthOutput( 2, value );
-}
-
// -------------------------------------------------------------------------
template< class I, class O, class C >
cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
: Superclass( )
{
this->SetNumberOfRequiredInputs( 1 );
- this->SetNumberOfRequiredOutputs( 3 );
- for( unsigned int i = 0; i < 3; i++ )
- {
- typename O::Pointer o = O::New( );
- this->SetNthOutput( i, o );
+ this->SetNumberOfRequiredOutputs( 1 );
- } // rof
+ typename O::Pointer o = O::New( );
+ this->SetNthOutput( 0, o );
}
// -------------------------------------------------------------------------
// typedef typename TInputPixel::ComponentType _TComponent;
typedef itk::ImageRegionConstIterator< I > _TInIt;
typedef itk::ImageRegionIterator< O > _TOutIt;
- typedef typename C::TOutPixel _TOutPixel;
_TInIt inIt( this->GetInput( ), region );
- _TOutIt hIt( this->GetChannel1( ), region );
- _TOutIt sIt( this->GetChannel2( ), region );
- _TOutIt vIt( this->GetChannel3( ), region );
+ _TOutIt outIt( this->GetOutput( ), region );
inIt.GoToBegin( );
- hIt.GoToBegin( );
- sIt.GoToBegin( );
- vIt.GoToBegin( );
- for( ; !inIt.IsAtEnd( ); ++inIt, ++hIt, ++sIt, ++vIt )
- {
- _TOutPixel other = this->Converter( inIt.Get( ) );
- hIt.Set( other[ 0 ] );
- sIt.Set( other[ 1 ] );
- vIt.Set( other[ 2 ] );
-
- } // rof
+ outIt.GoToBegin( );
+ for( ; !inIt.IsAtEnd( ); ++inIt, ++outIt )
+ outIt.Set( this->Converter( inIt.Get( ) ) );
}
#endif // __CPEXTENSIONS__ALGORITHMS__RGBIMAGETOOTHERCHANNELSFILTER__HXX__