]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/ImageSliceActors.h
Widget integration (step 2/6). WARNING: IT DOES NOT COMPILE YETgit shortlog !
[cpPlugins.git] / lib / cpExtensions / Visualization / ImageSliceActors.h
1 #ifndef __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
2 #define __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
3
4 #include <cpExtensions/cpExtensions_Export.h>
5
6 #include <utility>
7 #include <vector>
8
9 #include <vtkActor.h>
10 #include <vtkImageActor.h>
11 #include <vtkImageSliceMapper.h>
12 #include <vtkPlane.h>
13 #include <vtkPolyData.h>
14 #include <vtkPolyDataMapper.h>
15 #include <vtkPropCollection.h>
16 #include <vtkSmartPointer.h>
17 #include <vtkTextActor.h>
18
19 // -------------------------------------------------------------------------
20 class vtkAlgorithmOutput;
21 class vtkImageData;
22
23 // -------------------------------------------------------------------------
24 namespace cpExtensions
25 {
26   namespace Visualization
27   {
28     /**
29      */
30     class cpExtensions_EXPORT ImageSliceActors
31       : public vtkPropCollection
32     {
33     public:
34       typedef ImageSliceActors Self;
35
36     public:
37       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
38
39     public:
40       // Creation
41       static ImageSliceActors* New( );
42
43       void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 0 );
44       void AddInputData( vtkImageData* data, int axis = 0 );
45       void Clear( );
46
47       unsigned int GetNumberOfImageActors( ) const;
48       vtkImageActor* GetImageActor( unsigned int id );
49       const vtkImageActor* GetImageActor( unsigned int id ) const;
50       vtkTextActor* GetTextActor( );
51       const vtkTextActor* GetTextActor( ) const;
52       vtkActor* GetPlaneActor( );
53       const vtkActor* GetPlaneActor( ) const;
54       vtkPlane* GetPlaneFunction( );
55       const vtkPlane* GetPlaneFunction( ) const;
56
57       void AddActor( vtkAlgorithm* algorithm, vtkActor* actor );
58
59       void SetInterpolate( bool v );
60       void InterpolateOn( );
61       void InterpolateOff( );
62
63       double* GetDisplayBounds( ) const;
64       void GetDisplayBounds( double bounds[ 6 ] ) const;
65
66       int GetAxis( ) const;
67       int GetSliceNumber( ) const;
68       int GetSliceNumberMinValue( ) const;
69       int GetSliceNumberMaxValue( ) const;
70       void SetSliceNumber( const int& slice );
71       void UpdateText( );
72       void UpdateText( const double& w, const double& l );
73
74     protected:
75       ImageSliceActors( );
76       virtual ~ImageSliceActors( );
77
78       void _ConfigureNewInput( int axis );
79
80     private:
81       // Purposely not implemented
82       ImageSliceActors( const Self& );
83       Self& operator=( const Self& );
84
85     protected:
86       // Multiple actors
87       std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
88       std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
89       std::vector< std::pair< vtkSmartPointer< vtkAlgorithm >, vtkSmartPointer< vtkActor > > >            OtherActors;
90       bool Interpolate;
91
92       // Unique objects
93       vtkSmartPointer< vtkPlane >          PlaneFunction;
94       vtkSmartPointer< vtkPolyData >       PlaneSource;
95       vtkSmartPointer< vtkPolyDataMapper > PlaneMapper;
96       char                                 TextBuffer[ 1024 ];
97       vtkSmartPointer< vtkTextActor >      TextActor;
98       vtkSmartPointer< vtkActor >          PlaneActor;
99     };
100
101   } // ecapseman
102
103 } // ecapseman
104
105 #endif //  __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
106
107 // eof - $RCSfile$