]> Creatis software - clitk.git/blob - vv/vvSlicerManager.h
removed headers
[clitk.git] / vv / vvSlicerManager.h
1 #ifndef vvSlicerManager_h
2 #define vvSlicerManager_h
3 #include <iostream>
4 #include <vector>
5 #include <string>
6
7 // QT
8 #include <QObject>
9
10 // VTK
11 #include <vtksys/SystemTools.hxx>
12 class vtkImageData;
13 class vtkInteractorStyle;
14 class vtkRenderWindow;
15 class vtkPolyData;
16
17 // VV
18 #include "vvConstants.h"
19 #include "clitkCommon.h"
20 #include "vvImage.h"
21 #include "vvMesh.h"
22 class vvSlicer;
23 class vvInteractorStyleNavigator;
24 class vvImageReader;
25 class vvImageReader;
26 class vvLandmarks;
27
28 class vvSlicerManager : public QObject {
29     Q_OBJECT
30
31 public:
32     vvSlicerManager(int numberOfSlicers);
33     ~vvSlicerManager();
34
35     std::string GetLastError() {
36         return mLastError;
37     }
38
39     bool SetImage(std::string filename,LoadedImageType type);
40     void SetImage(vvImage::Pointer image);
41     void SetExtractedImage(std::string filename, vvImage::Pointer image, int slice);
42     bool SetImages(std::vector<std::string> filenames,LoadedImageType type);
43
44     bool SetOverlay(std::string filename, int dim, std::string component);
45     bool SetFusion(std::string filename, int dim, std::string component);
46     ///Set a VF by loading it from the disk
47     bool SetVF(std::string filename);
48     ///Set a VF from memory
49     bool SetVF(vvImage::Pointer vf,std::string filename);
50     ///Add a mesh to the slicers, with optional propagation using a vector field
51     void AddContour(vvMesh::Pointer ,bool propagate=false);
52     ///Toggle temporal superposition of contours
53     void ToggleContourSuperposition();
54
55     std::string GetFileName() {
56         return mFileName;
57     }
58     std::string GetVFName() {
59         return mVFName;
60     }
61     std::string GetOverlayName() {
62         return mOverlayName;
63     }
64     std::string GetFusionName() {
65         return mFusionName;
66     }
67
68     ///Switch between nearest neighbor and linear interpolation
69     void ToggleInterpolation();
70     vvSlicer* GetSlicer(int i);
71     void UpdateSlicer(int num, bool state);
72     void SetSlicerWindow(int i, vtkRenderWindow* RW);
73     void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
74     int NumberOfSlicers() {
75         return mSlicers.size();
76     }
77     vvImage::Pointer GetImage() {
78         return mImage;
79     }
80     vvImage::Pointer GetVF() {
81         return mVF;
82     }
83     int GetDimension() {
84         if (mImage) return mImage->GetNumberOfDimensions();
85         else return -1;
86     }
87
88     int GetType() {
89         return mType;
90     }
91
92     void SetId(std::string id) {
93         mId = id;
94     }
95     std::string GetId() {
96         return mId;
97     }
98
99     void SetFilename(std::string f) {
100         mFileName = f;
101     }
102
103     void SetTSlice(int slice);
104     void SetNextTSlice(int originating_slicer);
105     void SetPreviousTSlice(int originating_slicer);
106     void SetTSliceInSlicer(int tslice, int slicer);
107
108     void GenerateDefaultLookupTable();
109     void SetColorWindow(double s);
110     void SetColorLevel(double s);
111     void SetLocalColorWindowing(const int slicer);
112     void SetOpacity(int i, double factor);
113     void SetColorMap();
114     void SetColorMap(int colormap);
115     void SetPreset(int preset);
116     void SetOverlayColor(int color) {
117         mOverlayColor = color;
118     }
119     void SetFusionOpacity(int opacity) {
120         mFusionOpacity = opacity;
121     }
122     void SetFusionColorMap(int colorMap) {
123         mFusionColorMap = colorMap;
124     }
125     void SetFusionWindow(int window) {
126         mFusionWindow = window;
127     }
128     void SetFusionLevel(int level) {
129         mFusionLevel = level;
130     }
131
132     double GetColorWindow();
133     double GetColorLevel();
134     int GetColorMap() {
135         return mColorMap;
136     }
137     int GetPreset() {
138         return mPreset;
139     }
140     int GetOverlayColor() {
141         return mOverlayColor;
142     }
143
144     int GetFusionOpacity() {
145         return mFusionOpacity;
146     }
147     int GetFusionColorMap() {
148         return mFusionColorMap;
149     }
150     double GetFusionWindow() {
151         return mFusionWindow;
152     }
153     double GetFusionLevel() {
154         return mFusionLevel;
155     }
156
157     void SetCursorVisibility(int s);
158     void UpdateViews(int current, int slicer);
159     void UpdateLinked(int slicer);
160     void Render();
161
162     void AddLink(std::string newId) {
163         mLinkedId.push_back(newId);
164     }
165     void RemoveLink(std::string oldId) {
166         mLinkedId.remove(oldId);
167     }
168
169     ///Remove the actor defined by its type and index (example: 3rd contour)
170     void RemoveActor(const std::string& actor_type, int overlay_index);
171     void RemoveActors();
172     void Reload();
173     void ReloadOverlay();
174     void ReloadFusion();
175     void ReloadVF();
176
177     void Activated();
178     void UpdateInfoOnCursorPosition(int slicer);
179     void UpdateWindowLevel();
180     void UpdateSlice(int slicer);
181     void UpdateTSlice(int slicer);
182     void UpdateSliceRange(int slicer);
183
184     vvLandmarks *GetLandmarks();
185     void AddLandmark(float x,float y,float z,float t);
186
187 signals :
188     void currentImageChanged(std::string id);
189     void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
190     void UpdateVector(int display, double x, double y, double z, double value);
191     void UpdateOverlay(int display, double valueOver, double valueRef);
192     void UpdateFusion(int display, double valueFus);
193     void UpdateWindows(int slicer, int view, int slice);
194     void UpdateSlice(int slicer, int slice);
195     void UpdateTSlice(int slicer, int slice);
196     void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
197     void WindowLevelChanged(double window, double level, int preset, int colormap);
198     void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
199     void LandmarkAdded();
200
201 protected:
202     std::vector<vvSlicer*> mSlicers;
203     vvImageReader* mReader;
204     vvImageReader* mOverlayReader;
205     vvImageReader* mFusionReader;
206     vvImage::Pointer mImage;
207     vvImage::Pointer mVF;
208     vvImageReader* mVectorReader;
209     int mColorMap;
210     int mOverlayColor;
211
212     int mFusionOpacity;
213     int mFusionColorMap;
214     double mFusionWindow;
215     double mFusionLevel;
216
217     int mPreset;
218     LoadedImageType mType;
219     std::string mVFComponent;
220     std::string mOverlayComponent;
221     std::string mFusionComponent;
222     std::string mFileName;
223     std::string mId;
224     std::string mVFName;
225     std::string mOverlayName;
226     std::string mFusionName;
227     std::string mVFId;
228     std::string mLastError;
229     std::list<std::string> mLinkedId;
230
231     vvLandmarks* mLandmarks;
232 };
233
234 #endif