]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Extensions/Visualization/ImageSliceActors.h
...
[cpPlugins.git] / lib / cpPlugins / Extensions / Visualization / ImageSliceActors.h
1 #ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
2 #define __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
3
4 #include <cpPlugins/Extensions/cpPlugins_Extensions_Export.h>
5
6 #include <vtkActor.h>
7 #include <vtkImageActor.h>
8 #include <vtkImageSliceMapper.h>
9 #include <vtkPolyData.h>
10 #include <vtkPolyDataMapper.h>
11 #include <vtkPropCollection.h>
12 #include <vtkSmartPointer.h>
13 #include <vtkTextActor.h>
14
15 // -------------------------------------------------------------------------
16 #define cpPlugins_ImageSliceActors( name, type )                        \
17   inline type* Get##name##Actor( ) const                                \
18   {                                                                     \
19     return(                                                             \
20       dynamic_cast< type* >(                                            \
21         const_cast< Self* >( this )->                                   \
22         GetItemAsObject( this->name##ActorIndex )                       \
23         )                                                               \
24       );                                                                \
25   }
26
27 // -------------------------------------------------------------------------
28 class vtkAlgorithmOutput;
29 class vtkImageData;
30
31 // -------------------------------------------------------------------------
32 namespace cpPlugins
33 {
34   namespace Extensions
35   {
36     namespace Visualization
37     {
38       /**
39        */
40       class cpPlugins_Extensions_EXPORT ImageSliceActors
41         : public vtkPropCollection
42       {
43       public:
44         typedef ImageSliceActors Self;
45
46       public:
47         vtkTypeMacro( ImageSliceActors, vtkPropCollection );
48
49         cpPlugins_ImageSliceActors( Image, vtkImageActor );
50         cpPlugins_ImageSliceActors( Text, vtkTextActor );
51         cpPlugins_ImageSliceActors( Plane, vtkActor );
52
53       public:
54         // Creation
55         static ImageSliceActors* New( );
56
57         void SetInputConnection( vtkAlgorithmOutput* aout, int axis );
58         void SetInputData( vtkImageData* data, int axis );
59
60         double* GetDisplayBounds( ) const;
61         void GetDisplayBounds( double bounds[ 6 ] ) const;
62
63         int GetAxis( ) const;
64         int GetSliceNumber( ) const;
65         int GetSliceNumberMinValue( ) const;
66         int GetSliceNumberMaxValue( ) const;
67         void SetSliceNumber( const int& slice );
68         void UpdateText( );
69
70       protected:
71         ImageSliceActors( );
72         virtual ~ImageSliceActors( );
73
74       private:
75         // Purposely not implemented
76         ImageSliceActors( const Self& );
77         Self& operator=( const Self& );
78
79       protected:
80         vtkSmartPointer< vtkImageSliceMapper > SliceMapper;
81         vtkSmartPointer< vtkPolyData >         PlaneSource;
82         vtkSmartPointer< vtkPolyDataMapper >   PlaneMapper;
83         char                                   TextBuffer[ 1024 ];
84
85         vtkSmartPointer< vtkImageActor > ImageActor;
86         vtkSmartPointer< vtkTextActor >  TextActor;
87         vtkSmartPointer< vtkActor >      PlaneActor;
88
89         unsigned int ImageActorIndex;
90         unsigned int TextActorIndex;
91         unsigned int PlaneActorIndex;
92       };
93
94     } // ecapseman
95
96   } // ecapseman
97
98 } // ecapseman
99
100 #endif //  __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
101
102 // eof - $RCSfile$