]> Creatis software - cpPlugins.git/blob - plugins/VTKWidgets/SeedWidget.h
yet another refactoring
[cpPlugins.git] / plugins / VTKWidgets / SeedWidget.h
1 #ifndef __cpPluginsVTKWidgets__SeedWidget__h__
2 #define __cpPluginsVTKWidgets__SeedWidget__h__
3
4 #include <cpPlugins_VTKWidgets_Export.h>
5 #include <cpPlugins/Pipeline/Widget.h>
6 #include <vtkCommand.h>
7
8 // -------------------------------------------------------------------------
9 class vtkImageData;
10 class vtkPointHandleRepresentation3D;
11 class vtkPolyData;
12 class vtkSeedRepresentation;
13 namespace cpExtensions
14 {
15   namespace Interaction
16   {
17     class ImageSlicePointPlacer;
18     class SeedWidget;
19   }
20   namespace Visualization
21   {
22     class WindowLevelImageActor;
23   }
24 }
25
26 // -------------------------------------------------------------------------
27 namespace cpPluginsVTKWidgets
28 {
29   /**
30    */
31   class cpPlugins_VTKWidgets_EXPORT SeedWidget
32     : public cpPlugins::Pipeline::Widget
33   {
34     cpPluginsObject( SeedWidget, cpPlugins::Pipeline::Widget, Widgets );
35
36   public:
37     typedef vtkPointHandleRepresentation3D                     THandleRep;
38     typedef vtkSeedRepresentation                              TSeedRep;
39     typedef cpExtensions::Interaction::SeedWidget              TWidget;
40     typedef cpExtensions::Interaction::ImageSlicePointPlacer   TPlacer;
41     typedef cpExtensions::Visualization::WindowLevelImageActor TImageActor;
42
43   public:
44     virtual void Clear( ) cpPlugins_OVERRIDE;
45     virtual void SetEnabled( bool v ) cpPlugins_OVERRIDE;
46     virtual bool GetEnabled( ) const cpPlugins_OVERRIDE;
47
48   protected:
49     /**
50      */
51     class TCallback
52       : public vtkCommand
53     {
54     public:
55       static TCallback* New( );
56       virtual void Execute(
57         vtkObject* caller, unsigned long id, void* data
58         ) cpPlugins_OVERRIDE;
59       void SetSeeds( vtkPolyData* seeds );
60
61     protected:
62       TCallback( );
63       virtual ~TCallback( );
64
65     protected:
66       vtkPolyData*         m_Seeds;
67       std::set< TWidget* > m_Widgets;
68     };
69
70   protected:
71     inline void _GD0_Image( vtkImageData* image );
72
73   protected:
74     std::map< vtkRenderWindowInteractor*, vtkSmartPointer< TWidget > > m_Widgets;
75     vtkSmartPointer< TCallback > m_Command;
76   };
77
78 } // ecapseman
79
80 #endif // __cpPluginsVTKWidgets__SeedWidget__h__
81
82 // eof - $RCSfile$