2 /*=========================================================================
3 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
6 - University of LYON http://www.universite-lyon.fr/
7 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
8 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the copyright notices for more information.
14 It is distributed under dual licence
16 - BSD See included LICENSE.txt file
17 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
18 ======================================================================-====*/
20 #ifndef VVSLICERMANAGER_H
21 #define VVSLICERMANAGER_H
32 #include <vtksys/SystemTools.hxx>
34 class vtkInteractorStyle;
35 class vtkRenderWindow;
39 #include "vvConstants.h"
40 #include "clitkCommon.h"
44 class vvInteractorStyleNavigator;
49 //------------------------------------------------------------------------------
50 class vvSlicerManager : public QObject {
54 vvSlicerManager(int numberOfSlicers);
57 std::string GetLastError() {
61 bool SetImage(std::string filename,LoadedImageType type, int n=0, unsigned int slice=0);
62 void SetImage(vvImage::Pointer image);
63 bool SetImages(std::vector<std::string> filenames, LoadedImageType type, int n=0);
65 bool SetOverlay(std::string filename, int dim, std::string component);
66 bool SetFusion(std::string filename, int dim, std::string component);
67 ///Set a VF by loading it from the disk
68 bool SetVF(std::string filename);
69 ///Set a VF from memory
70 bool SetVF(vvImage::Pointer vf,std::string filename);
71 ///Add a mesh to the slicers, with optional propagation using a vector field
72 void AddContour(vvMesh::Pointer ,bool propagate=false);
73 ///Toggle temporal superposition of contours
74 void ToggleContourSuperposition();
76 std::string GetFileName() { return mFileName; }
77 std::string GetBaseFileName() { return mBaseFileName; }
78 int GetBaseFileNameNumber() { return mBaseFileNameNumber; }
79 std::string GetVFName() { return mVFName; }
80 std::string GetOverlayName() { return mOverlayName; }
81 std::string GetFusionName() { return mFusionName; }
83 ///Switch between nearest neighbor and linear interpolation
84 void ToggleInterpolation();
85 vvSlicer* GetSlicer(int i);
86 void UpdateSlicer(int num, bool state);
87 void SetSlicerWindow(int i, vtkRenderWindow* RW);
88 void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
90 int GetNumberOfSlicers() { return mSlicers.size(); }
91 vvImage::Pointer GetImage() { return mImage; }
92 vvImage::Pointer GetVF() { return mVF; }
93 int GetType() { return mType; }
94 void SetId(std::string id) { mId = id; }
95 std::string GetId() { return mId; }
97 if (mImage) return mImage->GetNumberOfDimensions();
101 void SetFilename(std::string f, int number=0);
103 void SetTSlice(int slice);
104 void SetNextTSlice(int originating_slicer);
105 void SetPreviousTSlice(int originating_slicer);
106 void SetTSliceInSlicer(int tslice, int slicer);
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);
114 void SetColorMap(int colormap);
115 void SetPreset(int preset);
116 void SetOverlayColor(int color) {
117 mOverlayColor = (color/60)*60; //SR: new vvBlendImageActor needs 0 or 255 per component
119 void SetFusionOpacity(int opacity) {
120 mFusionOpacity = opacity;
122 void SetFusionColorMap(int colorMap) {
123 mFusionColorMap = colorMap;
125 void SetFusionWindow(double window) {
126 mFusionWindow = window;
128 void SetFusionLevel(double level) {
129 mFusionLevel = level;
132 double GetColorWindow();
133 double GetColorLevel();
140 int GetOverlayColor() {
141 return mOverlayColor;
144 int GetFusionOpacity() {
145 return mFusionOpacity;
147 int GetFusionColorMap() {
148 return mFusionColorMap;
150 double GetFusionWindow() {
151 return mFusionWindow;
153 double GetFusionLevel() {
157 void SetCursorVisibility(int s);
158 void UpdateViews(int current, int slicer);
159 void UpdateLinked(int slicer);
160 void UpdateLinkedNavigation(vvSlicer *slicer, bool bPropagate=false);
163 void AddLink(std::string newId) {
164 mLinkedId.push_back(newId);
166 void RemoveLink(std::string oldId) {
167 mLinkedId.remove(oldId);
170 ///Remove the actor defined by its type and index (example: 3rd contour)
171 void RemoveActor(const std::string& actor_type, int overlay_index);
174 void ReloadOverlay();
179 void UpdateInfoOnCursorPosition(int slicer);
180 void UpdateWindowLevel();
181 void UpdateSlice(int slicer);
182 void UpdateTSlice(int slicer);
183 void UpdateSliceRange(int slicer);
185 vvLandmarks *GetLandmarks();
186 void AddLandmark(float x,float y,float z,float t);
188 void NextImage(int slicer);
189 void PrevImage(int slicer);
190 void LeftButtonReleaseEvent(int slicer);
191 void VerticalSliderHasChanged(int slicer, int slice);
192 double GetScalarComponentAsDouble(vtkImageData *image, double X, double Y, double Z, int component=0);
195 void currentImageChanged(std::string id);
196 void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
197 void UpdateVector(int display, double x, double y, double z, double value);
198 void UpdateOverlay(int display, double valueOver, double valueRef);
199 void UpdateFusion(int display, double valueFus);
200 void UpdateWindows(int slicer, int view, int slice);
201 void UpdateSlice(int slicer, int slice);
202 void UpdateTSlice(int slicer, int slice);
203 void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
204 void WindowLevelChanged(double window, double level, int preset, int colormap);
205 void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
206 void UpdateLinkedNavigation(std::string, vvSlicerManager*);
207 void LandmarkAdded();
208 void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
209 void LeftButtonReleaseSignal(int slicer);
210 void AVerticalSliderHasChanged(int slicer, int slice);
213 std::vector<vvSlicer*> mSlicers;
214 vvImageReader* mReader;
215 vvImageReader* mOverlayReader;
216 vvImageReader* mFusionReader;
217 vvImage::Pointer mImage;
218 vvImage::Pointer mVF;
219 vvImageReader* mVectorReader;
225 double mFusionWindow;
229 LoadedImageType mType;
230 std::string mVFComponent;
231 std::string mOverlayComponent;
232 std::string mFusionComponent;
233 std::string mFileName;
234 std::string mBaseFileName;
235 int mBaseFileNameNumber;
238 std::string mOverlayName;
239 std::string mFusionName;
241 std::string mLastError;
242 std::list<std::string> mLinkedId;
244 vvLandmarks* mLandmarks;
246 std::vector<int> mPreviousSlice;
247 std::vector<int> mPreviousTSlice;