1 #ifndef __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__
2 #define __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__
4 #include <cpExtensions/Config.h>
6 #ifdef cpExtensions_QT4
11 #include <vtkInteractorStyleTrackballCamera.h>
12 #include <vtkRenderWindowInteractor.h>
14 #include <vtkSmartPointer.h>
15 #include <cpExtensions/Visualization/ImageSliceActors.h>
17 #define cpExtensions_MAX_POLYS 65535
19 // -------------------------------------------------------------------------
24 class SimpleMPRWidget;
27 // -------------------------------------------------------------------------
28 namespace cpExtensions
34 class cpExtensions_EXPORT SimpleMPRWidget
40 typedef SimpleMPRWidget Self;
45 const vtkSmartPointer< vtkProp >& a,
46 const vtkSmartPointer< vtkProp >& b
48 { return( a.GetPointer( ) < b.GetPointer( ) ); }
50 typedef std::set< vtkSmartPointer< vtkProp >, TActorCmp > TActors;
51 typedef std::map< std::string, TActors > TNamedActors;
52 typedef cpExtensions::Visualization::ImageSliceActors TSliceActors;
57 class _3DInteractorStyle
58 : public vtkInteractorStyleTrackballCamera
62 _3DInteractorStyle, vtkInteractorStyleTrackballCamera
66 static _3DInteractorStyle* New( );
68 virtual void OnChar( ) { }
69 virtual void OnKeyDown( ) { }
70 virtual void OnKeyUp( ) { }
71 virtual void OnKeyRelease( ) { }
72 virtual void OnKeyPress( );
76 explicit SimpleMPRWidget( QWidget* parent = 0 );
77 virtual ~SimpleMPRWidget( );
81 void SetMainImage( vtkImageData* image, const std::string& name );
82 void SetMainActor( vtkImageActor* actor, const std::string& name );
83 void AddImage( vtkImageData* image, const std::string& name );
84 void AddImageActor( vtkImageActor* actor, const std::string& name );
85 void AddMesh( vtkPolyData* mesh, const std::string& name );
86 void AddMeshActor( vtkProp3D* actor, const std::string& name );
87 void AddActor( vtkProp* actor, const std::string& name );
88 const TActors& GetActors( const std::string& name ) const;
90 void SetWindowLevel( double win, double lev );
91 void ResetWindowLevel( );
94 vtkRenderWindowInteractor* GetInteractor( unsigned int i );
95 vtkRenderer* GetRenderer( unsigned int i );
96 vtkRenderWindow* GetRenderWindow( unsigned int i );
99 void _AssociateSlices( );
102 void _SyncBottom( int a, int b );
103 void _SyncTop( int a, int b );
106 Ui::SimpleMPRWidget* m_UI;
107 QVTKWidget2* m_VTK[ 4 ];
109 vtkSmartPointer< vtkRenderer > m_Renderers[ 4 ];
110 vtkSmartPointer< TSliceActors > m_2DSlices[ 3 ];
111 vtkSmartPointer< TSliceActors > m_3DSlices[ 3 ];
113 TNamedActors m_NamedActors;
120 #endif // cpExtensions_QT4
122 #endif // __CPEXTENSIONS__QT__SIMPLEMPRWIDGET__H__