]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Interaction/ImageInteractorStyle.h
Double click widget integrated with segmentation and deformation filters.
[cpPlugins.git] / lib / cpExtensions / Interaction / ImageInteractorStyle.h
1 #ifndef __CPEXTENSIONS__INTERACTION__IMAGEINTERACTORSTYLE__H__
2 #define __CPEXTENSIONS__INTERACTION__IMAGEINTERACTORSTYLE__H__
3
4 #include <cpExtensions/Interaction/BaseInteractorStyle.h>
5
6 #include <vector>
7
8 #include <vtkSmartPointer.h>
9 #include <vtkImageActorPointPlacer.h>
10 #include <vtkPropPicker.h>
11 #include <vtkPointHandleRepresentation3D.h>
12 #include <vtkSeedRepresentation.h>
13 #include <cpExtensions/Interaction/SeedWidget.h>
14
15 // Forward definitions
16 class vtkImageActor;
17
18 namespace cpExtensions
19 {
20   namespace Interaction
21   {
22     /**
23      */
24     class cpExtensions_EXPORT ImageInteractorStyle
25       : public BaseInteractorStyle
26     {
27     public:
28       typedef ImageInteractorStyle Self;
29       vtkTypeMacro( ImageInteractorStyle, BaseInteractorStyle );
30
31       // Callbacks types
32       typedef Superclass::TMouseCommand            TMouseCommand;
33       typedef Superclass::TMouseWheelCommand       TMouseWheelCommand;
34       typedef Superclass::TKeyCommand              TKeyCommand;
35       typedef Superclass::TVoidCommand             TVoidCommand;
36       typedef Superclass::TMouseMoveCommand        TMouseMoveCommand;
37       typedef Superclass::TMouseClickCommand       TMouseClickCommand;
38       typedef Superclass::TMouseDoubleClickCommand TMouseDoubleClickCommand;
39       typedef Superclass::TExposeCommand           TExposeCommand;
40       typedef Superclass::TConfigureCommand        TConfigureCommand;
41       typedef Superclass::TEnterCommand            TEnterCommand;
42       typedef Superclass::TLeaveCommand            TLeaveCommand;
43
44       // Widgets
45       struct TSeedWidget
46       {
47         vtkSmartPointer< vtkImageActorPointPlacer >              Placer;
48         vtkSmartPointer< vtkPointHandleRepresentation3D >        Handle;
49         vtkSmartPointer< vtkSeedRepresentation >         Representation;
50         vtkSmartPointer< SeedWidget > Widget;
51
52         TSeedWidget(
53           vtkRenderWindowInteractor* interactor, vtkImageActor* actor
54           );
55         void On( );
56         void Off( );
57       };
58
59     public:
60       static Self* New( );
61
62       // Data for local picker
63       virtual void AssociateImageActor( vtkImageActor* actor );
64
65       // Widgets
66       void SeedWidgetOn( );
67       void SeedWidgetOff( );
68
69     protected:
70       ImageInteractorStyle( );
71       virtual ~ImageInteractorStyle( );
72
73       virtual bool _PickPosition( int idx[ 2 ], double pos[ 3 ] );
74
75     private:
76       // Purposely not implemented
77       ImageInteractorStyle( const Self& );
78       Self& operator=( const Self& );
79
80     protected:
81       vtkSmartPointer< vtkPropPicker > m_PropPicker;
82
83       TSeedWidget* m_SeedWidget;
84     };
85
86   } // ecapseman
87
88 } // ecapseman
89
90 #endif // __CPEXTENSIONS__INTERACTION__IMAGEINTERACTORSTYLE__H__
91
92 // eof - $RCSfile$