1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef vvSlicerManager_h
19 #define vvSlicerManager_h
28 #include <vtksys/SystemTools.hxx>
30 class vtkInteractorStyle;
31 class vtkRenderWindow;
35 #include "vvConstants.h"
36 #include "clitkCommon.h"
40 class vvInteractorStyleNavigator;
45 class vvSlicerManager : public QObject {
49 vvSlicerManager(int numberOfSlicers);
52 std::string GetLastError() {
56 bool SetImage(std::string filename,LoadedImageType type);
57 void SetImage(vvImage::Pointer image);
58 void SetExtractedImage(std::string filename, vvImage::Pointer image, int slice);
59 bool SetImages(std::vector<std::string> filenames,LoadedImageType type);
61 bool SetOverlay(std::string filename, int dim, std::string component);
62 bool SetFusion(std::string filename, int dim, std::string component);
63 ///Set a VF by loading it from the disk
64 bool SetVF(std::string filename);
65 ///Set a VF from memory
66 bool SetVF(vvImage::Pointer vf,std::string filename);
67 ///Add a mesh to the slicers, with optional propagation using a vector field
68 void AddContour(vvMesh::Pointer ,bool propagate=false);
69 ///Toggle temporal superposition of contours
70 void ToggleContourSuperposition();
72 std::string GetFileName() {
75 std::string GetVFName() {
78 std::string GetOverlayName() {
81 std::string GetFusionName() {
85 ///Switch between nearest neighbor and linear interpolation
86 void ToggleInterpolation();
87 vvSlicer* GetSlicer(int i);
88 void UpdateSlicer(int num, bool state);
89 void SetSlicerWindow(int i, vtkRenderWindow* RW);
90 void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
91 int NumberOfSlicers() {
92 return mSlicers.size();
94 vvImage::Pointer GetImage() {
97 vvImage::Pointer GetVF() {
101 if (mImage) return mImage->GetNumberOfDimensions();
109 void SetId(std::string id) {
112 std::string GetId() {
116 void SetFilename(std::string f) {
120 void SetTSlice(int slice);
121 void SetNextTSlice(int originating_slicer);
122 void SetPreviousTSlice(int originating_slicer);
123 void SetTSliceInSlicer(int tslice, int slicer);
125 void GenerateDefaultLookupTable();
126 void SetColorWindow(double s);
127 void SetColorLevel(double s);
128 void SetLocalColorWindowing(const int slicer);
129 void SetOpacity(int i, double factor);
131 void SetColorMap(int colormap);
132 void SetPreset(int preset);
133 void SetOverlayColor(int color) {
134 mOverlayColor = color;
136 void SetFusionOpacity(int opacity) {
137 mFusionOpacity = opacity;
139 void SetFusionColorMap(int colorMap) {
140 mFusionColorMap = colorMap;
142 void SetFusionWindow(int window) {
143 mFusionWindow = window;
145 void SetFusionLevel(int level) {
146 mFusionLevel = level;
149 double GetColorWindow();
150 double GetColorLevel();
157 int GetOverlayColor() {
158 return mOverlayColor;
161 int GetFusionOpacity() {
162 return mFusionOpacity;
164 int GetFusionColorMap() {
165 return mFusionColorMap;
167 double GetFusionWindow() {
168 return mFusionWindow;
170 double GetFusionLevel() {
174 void SetCursorVisibility(int s);
175 void UpdateViews(int current, int slicer);
176 void UpdateLinked(int slicer);
179 void AddLink(std::string newId) {
180 mLinkedId.push_back(newId);
182 void RemoveLink(std::string oldId) {
183 mLinkedId.remove(oldId);
186 ///Remove the actor defined by its type and index (example: 3rd contour)
187 void RemoveActor(const std::string& actor_type, int overlay_index);
190 void ReloadOverlay();
195 void UpdateInfoOnCursorPosition(int slicer);
196 void UpdateWindowLevel();
197 void UpdateSlice(int slicer);
198 void UpdateTSlice(int slicer);
199 void UpdateSliceRange(int slicer);
201 vvLandmarks *GetLandmarks();
202 void AddLandmark(float x,float y,float z,float t);
205 void currentImageChanged(std::string id);
206 void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
207 void UpdateVector(int display, double x, double y, double z, double value);
208 void UpdateOverlay(int display, double valueOver, double valueRef);
209 void UpdateFusion(int display, double valueFus);
210 void UpdateWindows(int slicer, int view, int slice);
211 void UpdateSlice(int slicer, int slice);
212 void UpdateTSlice(int slicer, int slice);
213 void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
214 void WindowLevelChanged(double window, double level, int preset, int colormap);
215 void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
216 void LandmarkAdded();
219 std::vector<vvSlicer*> mSlicers;
220 vvImageReader* mReader;
221 vvImageReader* mOverlayReader;
222 vvImageReader* mFusionReader;
223 vvImage::Pointer mImage;
224 vvImage::Pointer mVF;
225 vvImageReader* mVectorReader;
231 double mFusionWindow;
235 LoadedImageType mType;
236 std::string mVFComponent;
237 std::string mOverlayComponent;
238 std::string mFusionComponent;
239 std::string mFileName;
242 std::string mOverlayName;
243 std::string mFusionName;
245 std::string mLastError;
246 std::list<std::string> mLinkedId;
248 vvLandmarks* mLandmarks;