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 ======================================================================-====*/
19 #ifndef VVSLICERMANAGER_H
20 #define VVSLICERMANAGER_H
30 #include <vtksys/SystemTools.hxx>
32 class vtkInteractorStyle;
33 class vtkRenderWindow;
37 #include "vvConstants.h"
38 #include "clitkCommon.h"
42 class vvInteractorStyleNavigator;
47 //------------------------------------------------------------------------------
48 class vvSlicerManager : public QObject {
52 vvSlicerManager(int numberOfSlicers);
55 std::string GetLastError() {
59 bool SetImage(std::string filename,LoadedImageType type, int n=0);
60 void SetImage(vvImage::Pointer image);
61 void SetExtractedImage(std::string filename, vvImage::Pointer image, int slice);
62 bool SetImages(std::vector<std::string> filenames, LoadedImageType type, int n=0);
64 bool SetOverlay(std::string filename, int dim, std::string component);
65 bool SetFusion(std::string filename, int dim, std::string component);
66 ///Set a VF by loading it from the disk
67 bool SetVF(std::string filename);
68 ///Set a VF from memory
69 bool SetVF(vvImage::Pointer vf,std::string filename);
70 ///Add a mesh to the slicers, with optional propagation using a vector field
71 void AddContour(vvMesh::Pointer ,bool propagate=false);
72 ///Toggle temporal superposition of contours
73 void ToggleContourSuperposition();
75 std::string GetFileName() { return mFileName; }
76 std::string GetBaseFileName() { return mBaseFileName; }
77 int GetBaseFileNameNumber() { return mBaseFileNameNumber; }
78 std::string GetVFName() { return mVFName; }
79 std::string GetOverlayName() { return mOverlayName; }
80 std::string GetFusionName() { return mFusionName; }
82 ///Switch between nearest neighbor and linear interpolation
83 void ToggleInterpolation();
84 vvSlicer* GetSlicer(int i);
85 void UpdateSlicer(int num, bool state);
86 void SetSlicerWindow(int i, vtkRenderWindow* RW);
87 void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
89 int NumberOfSlicers() { return mSlicers.size(); }
90 vvImage::Pointer GetImage() { return mImage; }
91 vvImage::Pointer GetVF() { return mVF; }
92 int GetType() { return mType; }
93 void SetId(std::string id) { mId = id; }
94 std::string GetId() { return mId; }
96 if (mImage) return mImage->GetNumberOfDimensions();
100 void SetFilename(std::string f);
102 void SetTSlice(int slice);
103 void SetNextTSlice(int originating_slicer);
104 void SetPreviousTSlice(int originating_slicer);
105 void SetTSliceInSlicer(int tslice, int slicer);
107 void GenerateDefaultLookupTable();
108 void SetColorWindow(double s);
109 void SetColorLevel(double s);
110 void SetLocalColorWindowing(const int slicer);
111 void SetOpacity(int i, double factor);
113 void SetColorMap(int colormap);
114 void SetPreset(int preset);
115 void SetOverlayColor(int color) {
116 mOverlayColor = color;
118 void SetFusionOpacity(int opacity) {
119 mFusionOpacity = opacity;
121 void SetFusionColorMap(int colorMap) {
122 mFusionColorMap = colorMap;
124 void SetFusionWindow(int window) {
125 mFusionWindow = window;
127 void SetFusionLevel(int level) {
128 mFusionLevel = level;
131 double GetColorWindow();
132 double GetColorLevel();
139 int GetOverlayColor() {
140 return mOverlayColor;
143 int GetFusionOpacity() {
144 return mFusionOpacity;
146 int GetFusionColorMap() {
147 return mFusionColorMap;
149 double GetFusionWindow() {
150 return mFusionWindow;
152 double GetFusionLevel() {
156 void SetCursorVisibility(int s);
157 void UpdateViews(int current, int slicer);
158 void UpdateLinked(int slicer);
161 void AddLink(std::string newId) {
162 mLinkedId.push_back(newId);
164 void RemoveLink(std::string oldId) {
165 mLinkedId.remove(oldId);
168 ///Remove the actor defined by its type and index (example: 3rd contour)
169 void RemoveActor(const std::string& actor_type, int overlay_index);
172 void ReloadOverlay();
177 void UpdateInfoOnCursorPosition(int slicer);
178 void UpdateWindowLevel();
179 void UpdateSlice(int slicer);
180 void UpdateTSlice(int slicer);
181 void UpdateSliceRange(int slicer);
183 vvLandmarks *GetLandmarks();
184 void AddLandmark(float x,float y,float z,float t);
187 void currentImageChanged(std::string id);
188 void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
189 void UpdateVector(int display, double x, double y, double z, double value);
190 void UpdateOverlay(int display, double valueOver, double valueRef);
191 void UpdateFusion(int display, double valueFus);
192 void UpdateWindows(int slicer, int view, int slice);
193 void UpdateSlice(int slicer, int slice);
194 void UpdateTSlice(int slicer, int slice);
195 void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
196 void WindowLevelChanged(double window, double level, int preset, int colormap);
197 void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
198 void LandmarkAdded();
201 std::vector<vvSlicer*> mSlicers;
202 vvImageReader* mReader;
203 vvImageReader* mOverlayReader;
204 vvImageReader* mFusionReader;
205 vvImage::Pointer mImage;
206 vvImage::Pointer mVF;
207 vvImageReader* mVectorReader;
213 double mFusionWindow;
217 LoadedImageType mType;
218 std::string mVFComponent;
219 std::string mOverlayComponent;
220 std::string mFusionComponent;
221 std::string mFileName;
222 std::string mBaseFileName;
223 int mBaseFileNameNumber;
226 std::string mOverlayName;
227 std::string mFusionName;
229 std::string mLastError;
230 std::list<std::string> mLinkedId;
232 vvLandmarks* mLandmarks;