]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/ImageBlender.h
Binary image visualization improved.
[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       unsigned int GetNumberOfImages( ) const;
27
28       const double& GetMaxWindow( ) const;
29       const double& GetMaxLevel( ) const;
30       const double& GetMinWindow( ) const;
31       const double& GetMinLevel( ) const;
32       const double& GetWindow( ) const;
33       const double& GetLevel( ) const;
34
35       void SetWindow( const double& w );
36       void SetLevel( const double& l );
37       void SetWindowLevel( const double& w, const double& l );
38
39       void GetColor(
40         const unsigned int& i,
41         double& r,
42         double& g,
43         double& b
44         ) const;
45       void SetColor(
46         const unsigned int& i,
47         const double& r,
48         const double& g,
49         const double& b
50         );
51
52     protected:
53       ImageBlender( );
54       virtual ~ImageBlender( );
55
56       int RequestInformation(
57         vtkInformation* request,
58         vtkInformationVector** inputVector,
59         vtkInformationVector* outputVector
60         );
61       void ThreadedRequestData(
62         vtkInformation* request,
63         vtkInformationVector** inputVector,
64         vtkInformationVector* outputVector,
65         vtkImageData*** inData,
66         vtkImageData** outData,
67         int outExt[ 6 ], int id
68         );
69       int FillInputPortInformation( int i, vtkInformation* info );
70
71       void _GenerateData(
72         vtkImageData** inDatas,
73         int numInputs,
74         vtkImageData* outData,
75         int outExt[6],
76         int id
77         );
78
79     private:
80       // Purposely not implemented.
81       ImageBlender( const Self& other );
82       void operator=( const Self& other );
83
84     protected:
85       struct TColor
86       {
87         double R, G, B;
88         TColor(
89           const double& r = double( 1 ),
90           const double& g = double( 0 ),
91           const double& b = double( 0 )
92           )
93           : R( r ),
94             G( g ),
95             B( b )
96           { }
97       };
98       mutable std::map< unsigned int, TColor > m_Colors;
99
100       double m_MaxWindow;
101       double m_MaxLevel;
102       double m_MinWindow;
103       double m_MinLevel;
104       double m_Window;
105       double m_Level;
106
107       int    m_Extent[ 6 ];
108       double m_WLSlope;
109       double m_WLOffset;
110     };
111
112   } // ecapseman
113
114 } // ecapseman
115
116 #endif //  __CPEXTENSIONS__VISUALIZATION__IMAGEBLENDER__H__
117
118 // eof - $RCSfile$