]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/MPRActors.h
Widget integration (step 6/6): Interactive architecture finished. Needs to be tested...
[cpPlugins.git] / lib / cpExtensions / Visualization / MPRActors.h
1 #ifndef __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
2 #define __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
3
4 #include <vector>
5
6 #include <cpExtensions/cpExtensions_Export.h>
7 #include <cpExtensions/Visualization/ImageSliceActors.h>
8
9 namespace cpExtensions
10 {
11   namespace Visualization
12   {
13     /**
14      */
15     class cpExtensions_EXPORT MPRActors
16       : public vtkPropCollection
17     {
18     public:
19       typedef MPRActors Self;
20
21       typedef ImageSliceActors::TCursorCommand     TCursorCommand;
22       typedef ImageSliceActors::TMouseCommand      TMouseCommand;
23       typedef ImageSliceActors::TMouseWheelCommand TMouseWheelCommand;
24       typedef ImageSliceActors::TKeyCommand        TKeyCommand;
25
26     public:
27       vtkTypeMacro( MPRActors, vtkPropCollection );
28
29     public:
30       // Creation
31       static MPRActors* New( );
32
33       void AddCursorCommand( TCursorCommand command, void* data )
34       {
35         this->Slices[ 0 ][ 0 ]->AddCursorCommand( command, data );
36         this->Slices[ 0 ][ 1 ]->AddCursorCommand( command, data );
37         this->Slices[ 0 ][ 2 ]->AddCursorCommand( command, data );
38       }
39
40       ImageSliceActors* GetSliceActors( const int& i ) const;
41
42       int AddInputConnection( vtkAlgorithmOutput* aout );
43       int AddInputData( vtkImageData* new_image );
44       unsigned int GetNumberOfImages( ) const;
45
46       void PushActorsInto(
47         vtkRenderWindow* x,
48         vtkRenderWindow* y,
49         vtkRenderWindow* z,
50         vtkRenderWindow* w
51         );
52       void PopActorsFrom(
53         vtkRenderWindow* x,
54         vtkRenderWindow* y,
55         vtkRenderWindow* z,
56         vtkRenderWindow* w
57         );
58
59       // Color lookup table
60       void SetLookupTableAsColor(
61         unsigned int i, double r, double g, double b
62         );
63
64       double GetWindow( )
65       {
66         return( this->Slices[ 0 ][ 0 ]->GetWindow( ) );
67       }
68       double GetLevel( )
69       {
70         return( this->Slices[ 0 ][ 0 ]->GetLevel( ) );
71       }
72
73       // Slice access
74       int GetSliceNumberMinValue( const int& axis ) const;
75       int GetSliceNumberMaxValue( const int& axis ) const;
76       int GetSlice( const int& axis ) const;
77       void SetSlice( const int& axis, const int& slice );
78       void SetSlice( const int& axis, const double& slice );
79       void ResetSlices( );
80
81     protected:
82       MPRActors( );
83       virtual ~MPRActors( );
84
85       vtkImageData* _Image( unsigned int i ) const;
86       void _Update( unsigned int i );
87
88       static void _SetSlices( double* pos, int axis, void* data );
89
90     private:
91       // Purposely not implemented
92       MPRActors( const Self& );
93       Self& operator=( const Self& );
94
95     protected:
96       vtkSmartPointer< vtkActor >         ImageOutlineActor;
97       vtkSmartPointer< ImageSliceActors > Slices[ 2 ][ 3 ];
98
99       std::vector< TCursorCommand >     CursorCommands;
100       std::vector< TMouseCommand >      MouseCommands;
101       std::vector< TMouseCommand >      MouseClickCommands;
102       std::vector< TMouseCommand >      MouseDoubleClickCommands;
103       std::vector< TMouseWheelCommand > MouseWheelCommands;
104       std::vector< TKeyCommand >        KeyCommands;
105     };
106
107   } // ecapseman
108
109 } // ecapseman
110
111 #endif //  __CPEXTENSIONS__VISUALIZATION__MPRACTORS__H__
112
113 // eof - $RCSfile$