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);
62 void SetImage(vvImage::Pointer image);
63 void SetExtractedImage(std::string filename, vvImage::Pointer image, int slice);
64 bool SetImages(std::vector<std::string> filenames, LoadedImageType type, int n=0);
66 bool SetOverlay(std::string filename, int dim, std::string component);
67 bool SetFusion(std::string filename, int dim, std::string component);
68 ///Set a VF by loading it from the disk
69 bool SetVF(std::string filename);
70 ///Set a VF from memory
71 bool SetVF(vvImage::Pointer vf,std::string filename);
72 ///Add a mesh to the slicers, with optional propagation using a vector field
73 void AddContour(vvMesh::Pointer ,bool propagate=false);
74 ///Toggle temporal superposition of contours
75 void ToggleContourSuperposition();
77 std::string GetFileName() { return mFileName; }
78 std::string GetBaseFileName() { return mBaseFileName; }
79 int GetBaseFileNameNumber() { return mBaseFileNameNumber; }
80 std::string GetVFName() { return mVFName; }
81 std::string GetOverlayName() { return mOverlayName; }
82 std::string GetFusionName() { return mFusionName; }
84 ///Switch between nearest neighbor and linear interpolation
85 void ToggleInterpolation();
86 vvSlicer* GetSlicer(int i);
87 void UpdateSlicer(int num, bool state);
88 void SetSlicerWindow(int i, vtkRenderWindow* RW);
89 void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
91 int NumberOfSlicers() { return mSlicers.size(); }
92 vvImage::Pointer GetImage() { return mImage; }
93 vvImage::Pointer GetVF() { return mVF; }
94 int GetType() { return mType; }
95 void SetId(std::string id) { mId = id; }
96 std::string GetId() { return mId; }
98 if (mImage) return mImage->GetNumberOfDimensions();
102 void SetFilename(std::string f, int number=0);
104 void SetTSlice(int slice);
105 void SetNextTSlice(int originating_slicer);
106 void SetPreviousTSlice(int originating_slicer);
107 void SetTSliceInSlicer(int tslice, int slicer);
109 void GenerateDefaultLookupTable();
110 void SetColorWindow(double s);
111 void SetColorLevel(double s);
112 void SetLocalColorWindowing(const int slicer);
113 void SetOpacity(int i, double factor);
115 void SetColorMap(int colormap);
116 void SetPreset(int preset);
117 void SetOverlayColor(int color) {
118 mOverlayColor = (color/60)*60; //SR: new vvBlendImageActor needs 0 or 255 per component
120 void SetFusionOpacity(int opacity) {
121 mFusionOpacity = opacity;
123 void SetFusionColorMap(int colorMap) {
124 mFusionColorMap = colorMap;
126 void SetFusionWindow(double window) {
127 mFusionWindow = window;
129 void SetFusionLevel(double level) {
130 mFusionLevel = level;
133 double GetColorWindow();
134 double GetColorLevel();
141 int GetOverlayColor() {
142 return mOverlayColor;
145 int GetFusionOpacity() {
146 return mFusionOpacity;
148 int GetFusionColorMap() {
149 return mFusionColorMap;
151 double GetFusionWindow() {
152 return mFusionWindow;
154 double GetFusionLevel() {
158 void SetCursorVisibility(int s);
159 void UpdateViews(int current, int slicer);
160 void UpdateLinked(int slicer);
161 void UpdateLinkedNavigation(vvSlicer *slicer, bool bPropagate=false);
164 void AddLink(std::string newId) {
165 mLinkedId.push_back(newId);
167 void RemoveLink(std::string oldId) {
168 mLinkedId.remove(oldId);
171 ///Remove the actor defined by its type and index (example: 3rd contour)
172 void RemoveActor(const std::string& actor_type, int overlay_index);
175 void ReloadOverlay();
180 void UpdateInfoOnCursorPosition(int slicer);
181 void UpdateWindowLevel();
182 void UpdateSlice(int slicer);
183 void UpdateTSlice(int slicer);
184 void UpdateSliceRange(int slicer);
186 vvLandmarks *GetLandmarks();
187 void AddLandmark(float x,float y,float z,float t);
189 void NextImage(int slicer);
190 void PrevImage(int slicer);
191 void LeftButtonReleaseEvent(int slicer);
192 void VerticalSliderHasChanged(int slicer, int slice);
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;