]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/ImageBlender.h
b74b51a9ce4d7fb706ecda5a299a0919e2f3b209
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageBlender.h
1 #ifndef __CPEXTENSIONS__VISUALIZATION__IMAGEBLENDER__H__
2 #define __CPEXTENSIONS__VISUALIZATION__IMAGEBLENDER__H__
3
4 #include <cpExtensions/cpExtensions_Export.h>
5
6 #include <map>
7 #include <vtkThreadedImageAlgorithm.h>
8
9 namespace cpExtensions
10 {
11   namespace Visualization
12   {
13     /**
14      */
15     class cpExtensions_EXPORT ImageBlender
16       : public vtkThreadedImageAlgorithm
17     {
18     public:
19       typedef ImageBlender Self;
20       vtkTypeMacro( ImageBlender, vtkThreadedImageAlgorithm );
21
22     public:
23       static Self* New( );
24       void PrintSelf( std::ostream& os, vtkIndent indent );
25
26       const double& GetMaxWindow( ) const;
27       const double& GetMaxLevel( ) const;
28       const double& GetMinWindow( ) const;
29       const double& GetMinLevel( ) const;
30       const double& GetWindow( ) const;
31       const double& GetLevel( ) const;
32
33       void SetWindow( const double& w );
34       void SetLevel( const double& l );
35       void SetWindowLevel( const double& w, const double& l );
36
37       void GetColor(
38         const unsigned int& i,
39         double& r,
40         double& g,
41         double& b
42         ) const;
43       void SetColor(
44         const unsigned int& i,
45         const double& r,
46         const double& g,
47         const double& b
48         );
49
50     protected:
51       ImageBlender( );
52       virtual ~ImageBlender( );
53
54       int RequestInformation(
55         vtkInformation* request,
56         vtkInformationVector** inputVector,
57         vtkInformationVector* outputVector
58         );
59       void ThreadedRequestData(
60         vtkInformation* request,
61         vtkInformationVector** inputVector,
62         vtkInformationVector* outputVector,
63         vtkImageData*** inData,
64         vtkImageData** outData,
65         int outExt[ 6 ], int id
66         );
67       int FillInputPortInformation( int i, vtkInformation* info );
68
69       void _GenerateData(
70         vtkImageData** inDatas,
71         int numInputs,
72         vtkImageData* outData,
73         int outExt[6],
74         int id
75         );
76
77     private:
78       // Purposely not implemented.
79       ImageBlender( const Self& other );
80       void operator=( const Self& other );
81
82     protected:
83       struct TColor
84       {
85         double R, G, B;
86         TColor(
87           const double& r = double( 1 ),
88           const double& g = double( 0 ),
89           const double& b = double( 0 )
90           )
91           : R( r ),
92             G( g ),
93             B( b )
94           { }
95       };
96       mutable std::map< unsigned int, TColor > m_Colors;
97
98       double m_MaxWindow;
99       double m_MaxLevel;
100       double m_MinWindow;
101       double m_MinLevel;
102       double m_Window;
103       double m_Level;
104     };
105
106   } // ecapseman
107
108 } // ecapseman
109
110 #endif //  __CPEXTENSIONS__VISUALIZATION__IMAGEBLENDER__H__
111
112 // eof - $RCSfile$