]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/MPRActors.h
Widget integration (step 5/6): Just one step leftgit shortlog !
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRActors.h
1 #ifndef __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
2 #define __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
3
4 #include <vector>
5
6 #include <cpExtensions/cpExtensions_Export.h>
7 #include <cpExtensions/Visualization/ImageSliceActors.h>
8
9 /*
10 #include <vtkSmartPointer.h>
11 #include <vtkActor.h>
12 #include <vtkImageMapToColors.h>
13 */
14
15 // -------------------------------------------------------------------------
16 /*
17 class vtkAlgorithmOutput;
18 class vtkImageData;
19 class vtkRenderer;
20 class vtkScalarsToColors;
21 */
22
23 // -------------------------------------------------------------------------
24 namespace cpExtensions
25 {
26   namespace Visualization
27   {
28     /**
29      */
30     class cpExtensions_EXPORT MPRActors
31       : public vtkPropCollection
32     {
33     public:
34       typedef MPRActors Self;
35
36     public:
37       vtkTypeMacro( MPRActors, vtkPropCollection );
38
39     public:
40       // Creation
41       static MPRActors* New( );
42
43       ImageSliceActors* GetSliceActors( const int& i ) const;
44
45       int AddInputConnection(
46         vtkAlgorithmOutput* aout,
47         ImageSliceActors::LUTType lut = ImageSliceActors::LUTType_WindowLevel
48         );
49       int AddInputData(
50         vtkImageData* image,
51         ImageSliceActors::LUTType lut = ImageSliceActors::LUTType_WindowLevel
52         );
53
54       void PushActorsInto(
55         vtkRenderWindow* x,
56         vtkRenderWindow* y,
57         vtkRenderWindow* z,
58         vtkRenderWindow* w
59         );
60       void PopDataFrom(
61         vtkRenderer* x,
62         vtkRenderer* y,
63         vtkRenderer* z,
64         vtkRenderer* w
65         );
66
67       // Lookup table methods
68       void SetLookupTable( unsigned int i, vtkScalarsToColors* lut );
69       vtkScalarsToColors* GetLookupTable( unsigned int i ) const;
70
71       // Grayscale window/level lookup
72       void SetLookupTableToWindowLevel( unsigned int i );
73       double GetMinWindow( unsigned int i ) const;
74       double GetMaxWindow( unsigned int i ) const;
75       double GetMinLevel( unsigned int i ) const;
76       double GetMaxLevel( unsigned int i ) const;
77       double GetWindow( unsigned int i ) const;
78       double GetLevel( unsigned int i ) const;
79       void SetWindow( unsigned int i, const double& w );
80       void SetLevel( unsigned int i, const double& l );
81       void SetWindowLevel( unsigned int i, const double& w, const double& l );
82       void ResetWindowLevel( unsigned int i );
83
84       // Color lookup table
85       void SetLookupTableToColor(
86         unsigned int i,
87         const double& r = double( 1 ),
88         const double& g = double( 0 ),
89         const double& b = double( 0 )
90         );
91
92       // Slice access
93       int GetSliceNumberMinValue( const int& axis ) const;
94       int GetSliceNumberMaxValue( const int& axis ) const;
95       int GetSlice( const int& axis ) const;
96       void SetSlice( const int& axis, const int& slice );
97       void SetSlice( const int& axis, const double& slice );
98       void ResetSlices( );
99
100     protected:
101       MPRActors( );
102       virtual ~MPRActors( );
103
104       vtkImageData* _Image( unsigned int i ) const;
105       void _Update( unsigned int i );
106
107       static void _SetSlices( double* pos, int axis, void* data );
108
109     private:
110       // Purposely not implemented
111       MPRActors( const Self& );
112       Self& operator=( const Self& );
113
114     protected:
115       // TODO: std::vector< vtkSmartPointer< vtkImageMapToColors > > ImageMaps;
116       vtkSmartPointer< vtkActor >         ImageOutlineActor;
117       vtkSmartPointer< ImageSliceActors > Slices[ 2 ][ 3 ];
118     };
119
120   } // ecapseman
121
122 } // ecapseman
123
124 #endif //  __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
125
126 // eof - $RCSfile$