]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Algorithms/RGBImageToOtherChannelsFilter.h
...
[cpPlugins.git] / lib / cpExtensions / Algorithms / RGBImageToOtherChannelsFilter.h
1 // -------------------------------------------------------------------------
2 // @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
3 // -------------------------------------------------------------------------
4
5 #ifndef __CPEXTENSIONS__ALGORITHMS__RGBIMAGETOOTHERCHANNELSFILTER__H__
6 #define __CPEXTENSIONS__ALGORITHMS__RGBIMAGETOOTHERCHANNELSFILTER__H__
7
8 #include <itkImageToImageFilter.h>
9
10 namespace cpExtensions
11   {
12     namespace Algorithms
13     {
14       /**
15        */
16       template< class I, class O, class C >
17       class RGBImageToOtherChannelsFilter
18         : public itk::ImageToImageFilter< I, O >
19       {
20       public:
21         typedef RGBImageToOtherChannelsFilter     Self;
22         typedef itk::ImageToImageFilter< I, O > Superclass;
23         typedef itk::SmartPointer< Self >       Pointer;
24         typedef itk::SmartPointer< const Self > ConstPointer;
25
26         typedef I TInputImage;
27         typedef O TOutputImage;
28         typedef C TConverter;
29         typedef typename I::PixelType TInputPixel;
30         typedef typename O::PixelType TOutputPixel;
31
32       public:
33         itkNewMacro( Self );
34         itkTypeMacro( RGBImageToOtherChannelsFilter, itkImageToImageFilter );
35
36       public:
37         O* GetChannel1( );
38         O* GetChannel2( );
39         O* GetChannel3( );
40
41         const O* GetChannel1( ) const;
42         const O* GetChannel2( ) const;
43         const O* GetChannel3( ) const;
44
45         void GraftChannel1( O* c1 );
46         void GraftChannel2( O* c2 );
47         void GraftChannel3( O* c3 );
48
49       protected:
50         RGBImageToOtherChannelsFilter( );
51         virtual ~RGBImageToOtherChannelsFilter( );
52
53         virtual void BeforeThreadedGenerateData( );
54         virtual void AfterThreadedGenerateData( );
55
56         virtual void ThreadedGenerateData(
57           const typename Superclass::OutputImageRegionType& region,
58           itk::ThreadIdType threadId
59           );
60
61       private:
62         // Purposely not implemented
63         RGBImageToOtherChannelsFilter( const Self& other );
64         void operator=( const Self& other );
65
66       private:
67         TConverter Converter;
68       };
69
70     } // ecapseman
71
72 } // ecapseman
73
74 #include <cpExtensions/Algorithms/RGBImageToOtherChannelsFilter.hxx>
75
76 #endif // __CPEXTENSIONS__ALGORITHMS__RGBIMAGETOOTHERCHANNELSFILTER__H__
77
78 // eof - $RCSfile$