]> Creatis software - clitk.git/blob - vv/vvSlicer.h
removed headers
[clitk.git] / vv / vvSlicer.h
1 #ifndef __vvSlicer_h
2 #define __vvSlicer_h
3 #include <iostream>
4 #include <vector>
5
6 #include "vvLandmarks.h"
7 #include "vvImage.h"
8 #include "vtkImageViewer2.h"
9 #include "vvMesh.h"
10 #include <vvMeshActor.h>
11 #include <vtkSmartPointer.h>
12
13 class vtkActor;
14 class vtkActor2D;
15 class vtkCursor2D;
16 class vtkPolyDataMapper2D;
17 class vtkProperty2D;
18 class vtkClipPolyData;
19 class vtkImageActor;
20 class vtkBox;
21 class vtkCornerAnnotation;
22 class vtkExtractVOI;
23 class vtkPolyDataMapper2D;
24 class vtkPolyDataMapper;
25 class vtkGlyph3D;
26 class vvGlyph2D;
27 class vvGlyphSource;
28 class vtkCursor3D;
29 class vtkCutter;
30 class vtkAssignAttribute;
31 class vtkScalarBarActor;
32
33
34 class vvSlicer: public vtkImageViewer2
35 {
36 public:
37     static vvSlicer *New();
38     vtkTypeRevisionMacro(vvSlicer,vtkImageViewer2);
39     void PrintSelf(ostream& os, vtkIndent indent);
40
41     void SetImage(vvImage::Pointer inputImages);
42     vvImage::Pointer GetImage() {
43         return mImage;
44     }
45
46     void SetOverlay(vvImage::Pointer inputOverlay);
47     vvImage::Pointer GetOverlay() {
48         return mOverlay;
49     }
50
51     vtkImageMapToWindowLevelColors* GetOverlayMapper(); 
52     vtkImageActor* GetOverlayActor() ;
53     vtkImageMapToWindowLevelColors* GetFusionMapper() ;
54     vtkImageActor* GetFusionActor() ;
55     vtkActor* GetVFActor() ;
56     vtkCornerAnnotation* GetAnnotation() ;
57
58     void SetFusion(vvImage::Pointer inputFusion);
59     vvImage::Pointer GetFusion() {
60         return mFusion;
61     }
62
63     /**Set an actor's visibility ("overlay, fusion, vf, contour...")
64        Overlay index is the index of the overlay by type, eg. if there are
65        5 contours and we want to activate the 3rd one, pass 2 **/
66     void SetActorVisibility(const std::string& actor_type, int overlay_index,bool vis);
67     void RemoveActor(const std::string& actor_type, int overlay_index);
68
69     void SetVF(vvImage::Pointer vf);
70     vvImage *GetVF() {
71         return mVF;
72     }
73
74     void SetLandmarks(vvLandmarks* landmarks);
75     void SetTSlice(int t);
76     void SetSliceOrientation(int orientation);
77     int GetTSlice();
78     ///Reimplemented from vtkImageViewer2 to add polydata support
79     void SetSlice(int s);
80     int GetTMax() {
81         return mImage->GetVTKImages().size() - 1;
82     }
83
84     void SetOpacity(double s);
85     void SetRenderWindow(int orientation, vtkRenderWindow * rw);
86     void SetDisplayMode(bool i);
87     void FlipHorizontalView();
88     void FlipVerticalView();
89     void Render();
90     ///Sets the camera to fit the image in the window
91     void ResetCamera();
92
93     void SetVFSubSampling(int sub);
94     int GetVFSubSampling() {
95         return mSubSampling;
96     }
97     void SetVFScale(int scale);
98     int GetVFScale() {
99         return mScale;
100     }
101     void SetVFLog(int log);
102     int GetVFLog() {
103         return mVFLog;
104     }
105
106     void SetFileName(std::string filename) {
107         mFileName = filename;
108     }
109     std::string GetFileName() {
110         return mFileName;
111     }
112
113     double* GetCursorPosition() {
114         return mCursor;
115     }
116
117     void SetCurrentPosition(double x, double y, double z, int t);
118     double* GetCurrentPosition() {
119         return mCurrent;
120     }
121
122     void UpdateCursorPosition();
123     void SetCursorVisibility(bool s);
124     bool GetCursorVisibility();
125     void SetCursorColor(int r,int g, int b);
126
127     void GetExtremasAroundMousePointer(double & min, double & max);
128
129     void UpdateLandmarks();
130     void ForceUpdateDisplayExtent();
131
132     int* GetDisplayExtent();
133     /**Add a polydata to be displayed as a contour over the image
134     ** the contour can be propagated to a time sequence using a motion field */
135     void AddContour(vvMesh::Pointer contours,bool propagate);
136     ///Toggle temporal superposition of contours
137     void ToggleContourSuperposition();
138
139     virtual void SetColorWindow(double s);
140     virtual void SetColorLevel(double s);
141
142     
143     void EnableReducedExtent(bool b);
144     void SetReducedExtent(int * ext);
145
146 protected:
147     vvSlicer();
148     ~vvSlicer();
149
150     std::string mFileName;
151     vvImage::Pointer mImage;
152     vvImage::Pointer mOverlay;
153     vvImage::Pointer mFusion;
154     vvImage::Pointer mVF;
155
156     vvLandmarks* mLandmarks;
157
158     vtkSmartPointer<vtkImageMapToWindowLevelColors> mOverlayMapper;
159     vtkSmartPointer<vtkImageActor> mOverlayActor;
160     vtkSmartPointer<vtkImageMapToWindowLevelColors> mFusionMapper;
161     vtkSmartPointer<vtkImageActor> mFusionActor;
162     vtkSmartPointer<vtkCornerAnnotation> ca;
163     vtkSmartPointer<vtkCursor2D> crossCursor;
164     vtkSmartPointer<vtkPolyDataMapper2D> pdm;
165     vtkSmartPointer<vtkActor2D> pdmA;
166     vtkSmartPointer<vvGlyphSource> mArrow;
167     vtkSmartPointer<vtkAssignAttribute> mAAFilter;
168     vtkSmartPointer<vtkExtractVOI> mVOIFilter;
169     vtkSmartPointer<vvGlyph2D> mGlyphFilter;
170     vtkSmartPointer<vtkPolyDataMapper> mVFMapper;
171     vtkSmartPointer<vtkActor> mVFActor;
172     vtkSmartPointer<vtkGlyph3D> mLandGlyph;
173     vtkSmartPointer<vtkCursor3D> mCross;
174     vtkSmartPointer<vtkClipPolyData> mLandClipper;
175     vtkSmartPointer<vtkPolyDataMapper> mLandMapper;
176     vtkSmartPointer<vtkActor> mLandActor;
177     vtkSmartPointer<vtkBox> mClipBox;
178     vtkSmartPointer<vtkScalarBarActor> legend;
179
180     std::vector<vvMeshActor*> mSurfaceCutActors;
181
182     int mCurrentTSlice;
183     double mCurrent[3];
184     double mCursor[4];
185     int mSubSampling;
186     int mScale;
187     int mVFLog;
188     bool mUseReducedExtent;
189     int * mReducedExtent;
190     int * mInitialExtent;
191
192 private:
193     void UpdateOrientation();
194     void UpdateDisplayExtent();
195     void ComputeVFDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int extent[6]);
196     void ComputeOverlayDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int overExtent[6]);
197     void ComputeFusionDisplayedExtent(int x1,int x2,int y1,int y2,int z1,int z2,int overExtent[6]);
198     void ClipDisplayedExtent(int extent[6], int refExtent[6]);
199     ///Sets the surfaces to be cut on the image slice: update the vtkCutter
200     void SetContourSlice();
201
202
203 };
204 #endif