]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/Image3DMPR.h
...
[cpPlugins.git] / lib / cpExtensions / Visualization / Image3DMPR.h
1 #ifndef __CPEXTENSIONS__VISUALIZATION__IMAGE3DMPR__H__
2 #define __CPEXTENSIONS__VISUALIZATION__IMAGE3DMPR__H__
3
4 #include <cpExtensions/cpExtensions_Export.h>
5
6 #include <vtkActor.h>
7 #include <vtkCellPicker.h>
8 #include <vtkHandleWidget.h>
9 #include <vtkImageData.h>
10 #include <vtkImagePlaneWidget.h>
11 #include <vtkOutlineSource.h>
12 #include <vtkPointHandleRepresentation3D.h>
13 #include <vtkPolyDataMapper.h>
14 #include <vtkProperty.h>
15 #include <vtkRenderer.h>
16 #include <vtkRendererCollection.h>
17 #include <vtkRenderWindow.h>
18 #include <vtkRenderWindowInteractor.h>
19 #include <vtkSeedRepresentation.h>
20 #include <vtkSeedWidget.h>
21 #include <vtkSmartPointer.h>
22 #include <vtkSphereSource.h>
23 #include <vtkLookupTable.h>
24
25 namespace cpExtensions
26 {
27   namespace Visualization
28   {
29     /**
30      */
31     class cpExtensions_EXPORT Image3DMPR
32     {
33     public:
34       Image3DMPR( );
35       virtual ~Image3DMPR( );
36
37       void SetImage( vtkImageData* image );
38       void SetBackground( double r, double g, double b );
39       void SetSize( unsigned int w, unsigned int h );
40       void SetWindowLevel( double w, double l );
41
42       void AddPolyData( vtkPolyData* pd, double opacity = double( 1 ) );
43       void AddPolyData(
44         vtkPolyData* pd,
45         double r, double g, double b, double opacity = double( 1 )
46         );
47       void AddPolyData(
48         vtkPolyData* pd,
49         vtkLookupTable* lut,
50         double opacity = double( 1 )
51         );
52
53       unsigned int GetNumberOfSeeds( ) const;
54       void GetSeed( int n, double* s ) const;
55       unsigned int AddSeed(
56         const double& x, const double& y, const double& z
57         ) const;
58
59       vtkRenderWindow* GetWindow( ) const;
60       vtkRenderer* GetRenderer( ) const;
61
62       void Start( );
63       void Render( );
64
65     protected:
66       vtkSmartPointer< vtkImageData >              m_Image;
67       vtkSmartPointer< vtkOutlineSource >          m_Outline;
68       vtkSmartPointer< vtkPolyDataMapper >         m_OutlineMapper;
69       vtkSmartPointer< vtkActor >                  m_OutlineActor;
70       vtkSmartPointer< vtkCellPicker >             m_Picker;
71       vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetX;
72       vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetY;
73       vtkSmartPointer< vtkImagePlaneWidget >       m_WidgetZ;
74       vtkSmartPointer< vtkRenderer >               m_Renderer;
75       vtkSmartPointer< vtkRenderWindow >           m_Window;
76       vtkSmartPointer< vtkRenderWindowInteractor > m_Interactor;
77
78       std::vector< vtkSmartPointer< vtkPolyData > >       m_PolyDatas;
79       std::vector< vtkSmartPointer< vtkPolyDataMapper > > m_Mappers;
80       std::vector< vtkSmartPointer< vtkActor > >          m_Actors;
81
82       // Create the widget and its representation
83       vtkSmartPointer< vtkPointHandleRepresentation3D >
84         m_SeedHandleRepresentation;
85       vtkSmartPointer< vtkSeedRepresentation > m_SeedRepresentation;
86       vtkSmartPointer< vtkSeedWidget >         m_SeedWidget;
87     };
88
89   } // ecapseman
90
91 } // ecapseman
92
93 #endif // __CPEXTENSIONS__VISUALIZATION__IMAGE3DMPR__H__
94
95 // eof - $RCSfile$