]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Extensions/Visualization/MPRWithDifferentWindows.h
b0f8c40de6a8d7b18aa1aa6e6c8eaceb3409c435
[cpPlugins.git] / lib / cpPlugins / Extensions / Visualization / MPRWithDifferentWindows.h
1 #ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
2 #define __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
3
4 #include <cpPlugins/Extensions/Visualization/MPRActors.h>
5 #include <cpPlugins/Extensions/Visualization/ImageInteractorStyle.h>
6
7 #include <vtkImageData.h>
8 #include <vtkRenderer.h>
9 #include <vtkRenderWindow.h>
10 #include <vtkSmartPointer.h>
11
12 // -------------------------------------------------------------------------
13 #define cpPlugins_MPRWithDifferentWindows_ObserverMacro( e )    \
14 inline void Add##e##Observer( vtkCommand* observer )            \
15 {                                                               \
16   for( int i = 0; i < 3; ++i )                                  \
17     if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
18       this->m_Styles[ i ]->Add##e##Observer( observer );        \
19 }                                                               \
20 inline void Remove##e##Observer( vtkCommand* observer )         \
21 {                                                               \
22   for( int i = 0; i < 3; ++i )                                  \
23     if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
24       this->m_Styles[ i ]->Remove##e##Observer( observer );     \
25 }                                                               \
26 inline void Remove##e##Observers( )                             \
27 {                                                               \
28   for( int i = 0; i < 3; ++i )                                  \
29     if( this->m_Styles[ i ].GetPointer( ) != NULL )             \
30       this->m_Styles[ i ]->Remove##e##Observers( );             \
31 }
32
33 namespace cpPlugins
34 {
35   namespace Extensions
36   {
37     namespace Visualization
38     {
39       /**
40        */
41       class MPRWithDifferentWindows
42       {
43       public:
44         typedef cpPlugins::Extensions::Visualization::
45         MPRActors TMPRActors;
46         typedef cpPlugins::Extensions::Visualization::
47         ImageInteractorStyle TStyle;
48
49       public:
50         cpPlugins_MPRWithDifferentWindows_ObserverMacro( DoubleClick );
51         cpPlugins_MPRWithDifferentWindows_ObserverMacro( Cursor );
52         cpPlugins_MPRWithDifferentWindows_ObserverMacro( Radius );
53
54       public:
55         MPRWithDifferentWindows(
56           vtkRenderWindow* xWin = NULL,
57           vtkRenderWindow* yWin = NULL,
58           vtkRenderWindow* zWin = NULL,
59           vtkRenderWindow* auxWin = NULL
60           );
61         virtual ~MPRWithDifferentWindows( );
62
63
64         void SetImage( vtkImageData* image );
65         void SetSegmentation( vtkImageData* image );
66
67         void ResetCamera( const int& id );
68         void ResetCameras( );
69         void Render( const int& id );
70         void RenderAll( );
71
72       protected:
73         // Inputs
74         vtkRenderWindow* m_Windows[ 4 ];
75
76         // Internal pipelines
77         vtkSmartPointer< TMPRActors >  m_MPRActors;
78         vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
79         vtkSmartPointer< TStyle >      m_Styles[ 3 ];
80       };
81
82     } // ecapseman
83
84   } // ecapseman
85
86 } // ecapseman
87
88 #endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__MPRWITHDIFFERENTWINDOWS__H__
89
90
91 // eof - $RCSfile$