]> Creatis software - cpPlugins.git/blob - lib/cpExtensions/Visualization/ImageSliceActors.h
Segmentation and WindowLevel interaction updated
[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       void SetInterpolate( bool v );
54       void InterpolateOn( );
55       void InterpolateOff( );
56
57       double* GetDisplayBounds( ) const;
58       void GetDisplayBounds( double bounds[ 6 ] ) const;
59
60       int GetAxis( ) const;
61       int GetSliceNumber( ) const;
62       int GetSliceNumberMinValue( ) const;
63       int GetSliceNumberMaxValue( ) const;
64       void SetSliceNumber( const int& slice );
65       void UpdateText( );
66       void UpdateText( const double& w, const double& l );
67
68     protected:
69       ImageSliceActors( );
70       virtual ~ImageSliceActors( );
71
72       void _ConfigureNewInput( int axis );
73
74     private:
75       // Purposely not implemented
76       ImageSliceActors( const Self& );
77       Self& operator=( const Self& );
78
79     protected:
80       // Multiple actors
81       std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
82       std::vector< vtkSmartPointer< vtkImageActor > >       ImageActors;
83       bool Interpolate;
84
85       // Unique objects
86       vtkSmartPointer< vtkPolyData >       PlaneSource;
87       vtkSmartPointer< vtkPolyDataMapper > PlaneMapper;
88       char                                 TextBuffer[ 1024 ];
89       vtkSmartPointer< vtkTextActor >      TextActor;
90       vtkSmartPointer< vtkActor >          PlaneActor;
91     };
92
93   } // ecapseman
94
95 } // ecapseman
96
97 #endif //  __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
98
99 // eof - $RCSfile$