]> Creatis software - cpPlugins.git/blob - lib/ivq/VTK/ImageViewer.h
...
[cpPlugins.git] / lib / ivq / VTK / ImageViewer.h
1 /* =======================================================================
2  * @author: Leonardo Florez-Valencia
3  * @email: florez-l@javeriana.edu.co
4  * =======================================================================
5  */
6
7 #ifndef __ivq__VTK__ImageViewer__h__
8 #define __ivq__VTK__ImageViewer__h__
9
10 #include <ivq/ivq_export.h>
11
12 #include <vtkSmartPointer.h>
13 #include <vtkObject.h>
14
15 class vtkAlgorithm;
16 class vtkAlgorithmOutput;
17 class vtkCornerAnnotation;
18 class vtkCursor3D;
19 class vtkImageData;
20 class vtkInformation;
21 class vtkPropPicker;
22 class vtkRenderer;
23 class vtkRenderWindow;
24 class vtkRenderWindowInteractor;
25
26 namespace ivq
27 {
28   namespace VTK
29   {
30     class ImageActor;
31     class InteractorStyleImage;
32     class PolyDataActor;
33
34     /**
35      */
36     class IVQ_EXPORT ImageViewer
37       : public vtkObject
38     {
39     public:
40       typedef ImageViewer Self;
41
42     public:
43       vtkTypeMacro( ImageViewer, vtkObject );
44
45       vtkGetMacro( SliceOrientation, int );
46       vtkGetMacro( Slice, int );
47       vtkBooleanMacro( OffScreenRendering, int );
48
49     public:
50       static Self* New( );
51
52       virtual vtkRenderWindow* GetRenderWindow( );
53       virtual vtkRenderer* GetRenderer( );
54       virtual ivq::VTK::ImageActor* GetImageActor( );
55       virtual ivq::VTK::InteractorStyleImage* GetInteractorStyle( );
56
57       virtual const char* GetWindowName( );
58       virtual void Render( );
59
60       virtual void SetInputData( vtkImageData* in );
61       virtual vtkImageData* GetInput( );
62       virtual void SetInputConnection( vtkAlgorithmOutput* input );
63
64       enum
65       {
66         SLICE_ORIENTATION_YZ = 0,
67         SLICE_ORIENTATION_XZ = 1,
68         SLICE_ORIENTATION_XY = 2
69       };
70       virtual void SetSliceOrientation( int orientation );
71       virtual void SetSliceOrientationToXY( );
72       virtual void SetSliceOrientationToYZ( );
73       virtual void SetSliceOrientationToXZ( );
74
75       virtual void SetSlice( int s );
76
77       virtual void UpdateDisplayExtent( );
78
79       virtual int GetSliceMin( );
80       virtual int GetSliceMax( );
81       virtual void GetSliceRange( int range[ 2 ] );
82       virtual void GetSliceRange( int& min, int& max );
83       virtual int* GetSliceRange( );
84
85       virtual double GetColorWindow( );
86       virtual double GetColorLevel( );
87       virtual void SetColorWindow( double s );
88       virtual void SetColorLevel( double s );
89
90       virtual void SetDisplayId( void* a );
91       virtual void SetWindowId( void* a );
92       virtual void SetParentId( void* a );
93
94       virtual int* GetPosition( );
95       virtual void SetPosition( int a, int b );
96       virtual void SetPosition( int a[ 2 ] );
97
98       virtual int* GetSize( );
99       virtual void SetSize( int a, int b );
100       virtual void SetSize( int a[ 2 ] );
101
102       virtual void SetRenderWindow( vtkRenderWindow* win );
103       virtual void SetRenderer( vtkRenderer* ren );
104       virtual void SetupInteractor( );
105       virtual void SetupInteractor( vtkRenderWindowInteractor* rwi );
106
107       virtual void SetOffScreenRendering( int v );
108       virtual int GetOffScreenRendering( );
109
110       virtual void ResetCamera( );
111       virtual void Initialize( );
112       virtual void Start( );
113
114       virtual void GetFocalPoint( double point[ 3 ], int ijk[ 3 ] );
115
116     protected:
117       ImageViewer( );
118       virtual ~ImageViewer( );
119
120       virtual void _InstallPipeline( );
121       virtual void _UnInstallPipeline( );
122       virtual void _UpdateOrientation( );
123
124       vtkAlgorithm* _GetInputAlgorithm( );
125       vtkInformation* _GetInputInformation( );
126
127     private:
128       // Purposely not implemented.
129       ImageViewer( const ImageViewer& other );
130       void operator=( const ImageViewer& other );
131
132     protected:
133       vtkSmartPointer< vtkRenderWindow >                RenderWindow;
134       vtkSmartPointer< vtkRenderer >                    Renderer;
135       vtkSmartPointer< ivq::VTK::ImageActor >           ImageActor;
136       vtkSmartPointer< vtkRenderWindowInteractor >      Interactor;
137       vtkSmartPointer< ivq::VTK::InteractorStyleImage > InteractorStyle;
138       
139       int SliceOrientation;
140       int FirstRender;
141       int Slice;
142
143       vtkSmartPointer< vtkPropPicker >       PropPicker;
144       vtkSmartPointer< vtkCornerAnnotation > CornerAnnotation;
145
146       vtkSmartPointer< vtkCursor3D >             CursorSource;
147       vtkSmartPointer< ivq::VTK::PolyDataActor > CursorActor;
148
149       static const double CursorColors[ 3 ][ 3 ];
150
151       friend class ImageViewerCallback;
152     };
153
154   } // ecapseman
155
156 } // ecapseman
157
158 #endif // __ivq__VTK__ImageViewer__h__
159
160 // eof - $RCSfile$