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