]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/MPRObjects.h
a1ed436206578245922369eedadfbaadaf260ea4
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRObjects.h
1 #ifndef __CPEXTENSIONS__VISUALIZATION__MPROBJECTS__H__
2 #define __CPEXTENSIONS__VISUALIZATION__MPROBJECTS__H__
3
4 #include <cpExtensions/cpExtensions_Export.h>
5 #include <cpExtensions/Visualization/MPRActors.h>
6
7 #include <vtkObject.h>
8 #include <vtkRenderer.h>
9 #include <vtkRenderWindow.h>
10
11 // -------------------------------------------------------------------------
12 #define cpExtensions_MPRObjects_Renderer( DIR )                         \
13   inline vtkRenderer* Get##DIR##Renderer( )                             \
14   { return( this->m_Renderers[ Self::MPRDirections_##DIR ] ); }         \
15   inline const vtkRenderer* Get##DIR##Renderer( ) const                 \
16   { return( this->m_Renderers[ Self::MPRDirections_##DIR ] ); }
17
18 namespace cpExtensions
19 {
20   namespace Visualization
21   {
22     /**
23      */
24     class cpExtensions_EXPORT MPRObjects
25       : public vtkObject
26     {
27     public:
28       typedef MPRObjects Self;
29
30       typedef MPRActors::TStyle                   TStyle;
31       typedef MPRActors::TMouseCommand            TMouseCommand;
32       typedef MPRActors::TMouseWheelCommand       TMouseWheelCommand;
33       typedef MPRActors::TKeyCommand              TKeyCommand;
34       typedef MPRActors::TVoidCommand             TVoidCommand;
35       typedef MPRActors::TMouseMoveCommand        TMouseMoveCommand;
36       typedef MPRActors::TMouseClickCommand       TMouseClickCommand;
37       typedef MPRActors::TMouseDoubleClickCommand TMouseDoubleClickCommand;
38       typedef MPRActors::TExposeCommand           TExposeCommand;
39       typedef MPRActors::TConfigureCommand        TConfigureCommand;
40       typedef MPRActors::TEnterCommand            TEnterCommand;
41       typedef MPRActors::TLeaveCommand            TLeaveCommand;
42
43       enum MPRDirections
44       {
45         MPRDirections_X = 0,
46         MPRDirections_Y = 1,
47         MPRDirections_Z = 2,
48         MPRDirections_W = 3
49       };
50
51     public:
52       vtkTypeMacro( MPRObjects, vtkObject );
53
54       cpExtensions_MPRObjects_Renderer( X );
55       cpExtensions_MPRObjects_Renderer( Y );
56       cpExtensions_MPRObjects_Renderer( Z );
57       cpExtensions_MPRObjects_Renderer( W );
58
59     public:
60       // Creation
61       static MPRObjects* New( );
62
63       // Association
64       void SetRenderWindows(
65         vtkRenderWindow* x, vtkRenderWindow* y,
66         vtkRenderWindow* z, vtkRenderWindow* w
67         );
68
69       void SetInputConnection( vtkAlgorithmOutput* aout );
70       void SetInputImage( vtkImageData* data );
71       int AddBinaryConnection(
72         vtkAlgorithmOutput* aout,
73         const double& r, const double& g, const double& b
74         );
75       int AddBinaryImage(
76         vtkImageData* data,
77         const double& r, const double& g, const double& b
78         );
79       void Clear( );
80
81       vtkImageData* GetInputImage( );
82       const vtkImageData* GetInputImage( ) const;
83       unsigned int GetNumberOfImages( ) const;
84
85       void SetInterpolate( bool v );
86       void InterpolateOn( );
87       void InterpolateOff( );
88
89       double GetMinWindow( ) const;
90       double GetMaxWindow( ) const;
91       double GetMinLevel( ) const;
92       double GetMaxLevel( ) const;
93       double GetWindow( ) const;
94       double GetLevel( ) const;
95       void SetWindow( double w );
96       void SetLevel( double l );
97       void SetWindowLevel( double w, double l );
98       void ResetWindowLevel( );
99
100       int GetSliceNumber( const int& axis ) const;
101       int GetSliceNumberMinValue( const int& axis ) const;
102       int GetSliceNumberMaxValue( const int& axis ) const;
103       void SetSliceNumber( const int& axis, const int& slice );
104       void SetSlice( const int& axis, double* pos );
105
106       void Render( const double& t );
107       void Render( const int& axis, const double& t );
108       void ResetCamera( const int& axis );
109       void ResetCameras( );
110
111     protected:
112       MPRObjects( );
113       virtual ~MPRObjects( );
114
115     private:
116       // Purposely not implemented
117       MPRObjects( const Self& );
118       Self& operator=( const Self& );
119
120     protected:
121       // Inputs
122       vtkSmartPointer< vtkRenderWindow > m_Windows[ 4 ];
123
124       // Internal pipelines
125       vtkSmartPointer< MPRActors >   m_MPRActors;
126       vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
127     };
128
129   } // ecapseman
130
131 } // ecapseman
132
133 #endif //  __CPEXTENSIONS__VISUALIZATION__MPROBJECTS__H__
134
135 // eof - $RCSfile$