]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/ImageSliceActors.h
0e1fdae463622b857a0c655b4da8ca9ee0919df8
[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 <vector>
7
8 #include <vtkActor.h>
9 #include <vtkImageActor.h>
10 #include <vtkImageSliceMapper.h>
11 #include <vtkPolyData.h>
12 #include <vtkPolyDataMapper.h>
13 #include <vtkPropCollection.h>
14 #include <vtkSmartPointer.h>
15 #include <vtkTextActor.h>
16
17 // -------------------------------------------------------------------------
18 class vtkAlgorithmOutput;
19 class vtkImageData;
20
21 // -------------------------------------------------------------------------
22 namespace cpExtensions
23 {
24   namespace Visualization
25   {
26     /**
27      */
28     class cpExtensions_EXPORT ImageSliceActors
29       : public vtkPropCollection
30     {
31     public:
32       typedef ImageSliceActors Self;
33
34     public:
35       vtkTypeMacro( ImageSliceActors, vtkPropCollection );
36
37     public:
38       // Creation
39       static ImageSliceActors* New( );
40
41       void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 0 );
42       void AddInputData( vtkImageData* data, int axis = 0 );
43       void Clear( );
44
45       unsigned int GetNumberOfImageActors( ) const;
46       vtkImageActor* GetImageActor( unsigned int id );
47       const vtkImageActor* GetImageActor( unsigned int id ) const;
48       vtkTextActor* GetTextActor( );
49       const vtkTextActor* GetTextActor( ) const;
50       vtkActor* GetPlaneActor( );
51       const vtkActor* GetPlaneActor( ) const;
52
53       double* GetDisplayBounds( ) const;
54       void GetDisplayBounds( double bounds[ 6 ] ) const;
55
56       int GetAxis( ) const;
57       int GetSliceNumber( ) const;
58       int GetSliceNumberMinValue( ) const;
59       int GetSliceNumberMaxValue( ) const;
60       void SetSliceNumber( const int& slice );
61       void UpdateText( );
62
63     protected:
64       ImageSliceActors( );
65       virtual ~ImageSliceActors( );
66
67     private:
68       // Purposely not implemented
69       ImageSliceActors( const Self& );
70       Self& operator=( const Self& );
71
72     protected:
73       // Multiple actors
74       std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
75       std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
76
77       // Unique objects
78       vtkSmartPointer< vtkPolyData >       PlaneSource;
79       vtkSmartPointer< vtkPolyDataMapper > PlaneMapper;
80       char                                 TextBuffer[ 1024 ];
81       vtkSmartPointer< vtkTextActor >      TextActor;
82       vtkSmartPointer< vtkActor >          PlaneActor;
83     };
84
85   } // ecapseman
86
87 } // ecapseman
88
89 #endif //  __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
90
91 // eof - $RCSfile$