]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/MPRActors.h
91c0b5089d9e19eca6b90ba7a6bda710ae1f0be2
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRActors.h
1 #ifndef __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
2 #define __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
3
4 #include <cpExtensions/cpExtensions_Export.h>
5 #include <cpExtensions/Visualization/ImageSliceActors.h>
6
7 namespace cpExtensions
8 {
9   namespace Visualization
10   {
11     /**
12      */
13     class cpExtensions_EXPORT MPRActors
14       : public vtkPropCollection
15     {
16     public:
17       typedef MPRActors Self;
18
19       typedef ImageSliceActors::TStyle                   TStyle;
20       typedef ImageSliceActors::TMouseCommand            TMouseCommand;
21       typedef ImageSliceActors::TMouseWheelCommand       TMouseWheelCommand;
22       typedef ImageSliceActors::TKeyCommand              TKeyCommand;
23       typedef ImageSliceActors::TVoidCommand             TVoidCommand;
24       typedef ImageSliceActors::TMouseMoveCommand        TMouseMoveCommand;
25       typedef ImageSliceActors::TMouseClickCommand       TMouseClickCommand;
26       typedef ImageSliceActors::TMouseDoubleClickCommand TMouseDoubleClickCommand;
27       typedef ImageSliceActors::TExposeCommand           TExposeCommand;
28       typedef ImageSliceActors::TConfigureCommand        TConfigureCommand;
29       typedef ImageSliceActors::TEnterCommand            TEnterCommand;
30       typedef ImageSliceActors::TLeaveCommand            TLeaveCommand;
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       void SetInputConnection( vtkAlgorithmOutput* aout );
42       void SetInputImage( vtkImageData* data );
43       int AddBinaryConnection(
44         vtkAlgorithmOutput* aout,
45         const double& r, const double& g, const double& b
46         );
47       int AddBinaryImage(
48         vtkImageData* data,
49         const double& r, const double& g, const double& b
50         );
51       void Clear( );
52
53       vtkImageData* GetInputImage( );
54       const vtkImageData* GetInputImage( ) const;
55
56       unsigned int GetNumberOfImages( ) const;
57
58       void SetInterpolate( bool v );
59       void InterpolateOn( );
60       void InterpolateOff( );
61
62       void PushActorsInto(
63         vtkRenderWindow* x,
64         vtkRenderWindow* y,
65         vtkRenderWindow* z,
66         vtkRenderWindow* w
67         );
68       void PopActorsFrom(
69         vtkRenderWindow* x,
70         vtkRenderWindow* y,
71         vtkRenderWindow* z,
72         vtkRenderWindow* w
73         );
74
75       double GetMinWindow( ) const;
76       double GetMaxWindow( ) const;
77       double GetMinLevel( ) const;
78       double GetMaxLevel( ) const;
79       double GetWindow( );
80       double GetLevel( );
81       void SetWindow( double w );
82       void SetLevel( double l );
83       void SetWindowLevel( double w, double l );
84       void ResetWindowLevel( );
85
86       // Slice access
87       int GetSliceNumber( const int& axis ) const;
88       int GetSliceNumberMinValue( const int& axis ) const;
89       int GetSliceNumberMaxValue( const int& axis ) const;
90       void SetSliceNumber( const int& axis, const int& slice );
91       void SetSlice( const int& axis, double* pos );
92       void SetAxesCursor( const int& axis, double* pos );
93
94       // Rendering controls
95       void Render( const int& axis );
96       void Render( );
97       void ResetCamera( const int& axis );
98       void ResetCameras( );
99
100     protected:
101       MPRActors( );
102       virtual ~MPRActors( );
103
104       void _CreateBoundingBox( );
105
106       static void _SlicesCommand( double* pos, int axis, void* data );
107       static void _WindowLevelCommand(
108         double window, double level, void* data
109         );
110       static void _RenderCommand( void* data );
111
112     private:
113       // Purposely not implemented
114       MPRActors( const Self& );
115       Self& operator=( const Self& );
116
117     protected:
118       vtkSmartPointer< vtkActor >         ImageOutlineActor;
119       vtkSmartPointer< ImageSliceActors > Slices[ 2 ][ 3 ];
120     };
121
122   } // ecapseman
123
124 } // ecapseman
125
126 #endif //  __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
127
128 // eof - $RCSfile$