1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
5 #ifndef __CPEXTENSIONS__ALGORITHMS__RGBIMAGETOOTHERCHANNELSFILTER__HXX__
6 #define __CPEXTENSIONS__ALGORITHMS__RGBIMAGETOOTHERCHANNELSFILTER__HXX__
10 #include <vnl/vnl_math.h>
12 #include <itkImageRegionIterator.h>
13 #include <itkImageRegionConstIterator.h>
15 // -------------------------------------------------------------------------
16 template< class I, class O, class C >
17 cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
18 RGBImageToOtherChannelsFilter( )
21 this->SetNumberOfRequiredInputs( 1 );
22 this->SetNumberOfRequiredOutputs( 1 );
24 typename O::Pointer o = O::New( );
25 this->SetNthOutput( 0, o );
28 // -------------------------------------------------------------------------
29 template< class I, class O, class C >
30 cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
31 ~RGBImageToOtherChannelsFilter( )
35 // -------------------------------------------------------------------------
36 template< class I, class O, class C >
37 void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
38 BeforeThreadedGenerateData( )
42 // -------------------------------------------------------------------------
43 template< class I, class O, class C >
44 void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
45 AfterThreadedGenerateData( )
49 // -------------------------------------------------------------------------
50 template< class I, class O, class C >
51 void cpExtensions::Algorithms::RGBImageToOtherChannelsFilter< I, O, C >::
53 const typename Superclass::OutputImageRegionType& region,
54 itk::ThreadIdType threadId
57 // typedef typename TInputPixel::ComponentType _TComponent;
58 typedef itk::ImageRegionConstIterator< I > _TInIt;
59 typedef itk::ImageRegionIterator< O > _TOutIt;
61 _TInIt inIt( this->GetInput( ), region );
62 _TOutIt outIt( this->GetOutput( ), region );
65 for( ; !inIt.IsAtEnd( ); ++inIt, ++outIt )
66 outIt.Set( this->Converter( inIt.Get( ) ) );
69 #endif // __CPEXTENSIONS__ALGORITHMS__RGBIMAGETOOTHERCHANNELSFILTER__HXX__