]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Extensions/Visualization/ImageSliceActors.h
The beast is alive on MSWin!!!
[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 class vtkAlgorithmOutput;
28
29 namespace cpPlugins
30 {
31   namespace Extensions
32   {
33     namespace Visualization
34     {
35       /**
36        */
37       class cpPlugins_Extensions_EXPORT ImageSliceActors
38         : public vtkPropCollection
39       {
40       public:
41         typedef ImageSliceActors Self;
42
43       public:
44         vtkTypeMacro( ImageSliceActors, vtkPropCollection );
45
46         cpPlugins_ImageSliceActors( Image, vtkImageActor );
47         cpPlugins_ImageSliceActors( Segmentation, vtkImageActor );
48         cpPlugins_ImageSliceActors( Text, vtkTextActor );
49         cpPlugins_ImageSliceActors( Plane, vtkActor );
50
51       public:
52         // Creation
53         static ImageSliceActors* New( );
54
55         void SetInputConnection( vtkAlgorithmOutput* aout, int axis );
56         void SetSegmentationConnection( vtkAlgorithmOutput* aout );
57
58         double* GetDisplayBounds( ) const;
59         void GetDisplayBounds( double bounds[ 6 ] ) const;
60
61         int GetAxis( ) const;
62         int GetSliceNumber( ) const;
63         int GetSliceNumberMinValue( ) const;
64         int GetSliceNumberMaxValue( ) const;
65         void SetSliceNumber( const int& slice );
66         void UpdateText( const double& w, const double& l );
67
68       protected:
69         ImageSliceActors( );
70         virtual ~ImageSliceActors( );
71
72       private:
73         // Purposely not implemented
74         ImageSliceActors( const Self& );
75         Self& operator=( const Self& );
76
77       protected:
78         vtkAlgorithmOutput* InputAlgorithm;
79         vtkAlgorithmOutput* SegmentationAlgorithm;
80
81         vtkSmartPointer< vtkImageSliceMapper > SliceMapper;
82         vtkSmartPointer< vtkImageSliceMapper > SegmentationSliceMapper;
83         vtkSmartPointer< vtkPolyData >         PlaneSource;
84         vtkSmartPointer< vtkPolyDataMapper >   PlaneMapper;
85         char                                   TextBuffer[ 512 ];
86
87         vtkSmartPointer< vtkImageActor > ImageActor;
88         vtkSmartPointer< vtkImageActor > SegmentationActor;
89         vtkSmartPointer< vtkTextActor >  TextActor;
90         vtkSmartPointer< vtkActor >      PlaneActor;
91
92         unsigned int ImageActorIndex;
93         unsigned int SegmentationActorIndex;
94         unsigned int TextActorIndex;
95         unsigned int PlaneActorIndex;
96       };
97
98     } // ecapseman
99
100   } // ecapseman
101
102 } // ecapseman
103
104 #endif //  __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
105
106 // eof - $RCSfile$