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