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