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
31 #include <vtksys/SystemTools.hxx>
33 class vtkInteractorStyle;
34 class vtkRenderWindow;
38 #include "vvConstants.h"
39 #include "clitkCommon.h"
43 class vvInteractorStyleNavigator;
48 //------------------------------------------------------------------------------
49 class vvSlicerManager : public QObject {
53 vvSlicerManager(int numberOfSlicers);
56 std::string GetLastError() {
60 bool SetImage(std::string filename,LoadedImageType type, int n=0);
61 void SetImage(vvImage::Pointer image);
62 void SetExtractedImage(std::string filename, vvImage::Pointer image, int slice);
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 NumberOfSlicers() { 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);
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;
119 void SetFusionOpacity(int opacity) {
120 mFusionOpacity = opacity;
122 void SetFusionColorMap(int colorMap) {
123 mFusionColorMap = colorMap;
125 void SetFusionWindow(int window) {
126 mFusionWindow = window;
128 void SetFusionLevel(int 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);
162 void AddLink(std::string newId) {
163 mLinkedId.push_back(newId);
165 void RemoveLink(std::string oldId) {
166 mLinkedId.remove(oldId);
169 ///Remove the actor defined by its type and index (example: 3rd contour)
170 void RemoveActor(const std::string& actor_type, int overlay_index);
173 void ReloadOverlay();
178 void UpdateInfoOnCursorPosition(int slicer);
179 void UpdateWindowLevel();
180 void UpdateSlice(int slicer);
181 void UpdateTSlice(int slicer);
182 void UpdateSliceRange(int slicer);
184 vvLandmarks *GetLandmarks();
185 void AddLandmark(float x,float y,float z,float t);
187 void NextImage(int slicer);
188 void PrevImage(int slicer);
191 void currentImageChanged(std::string id);
192 void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
193 void UpdateVector(int display, double x, double y, double z, double value);
194 void UpdateOverlay(int display, double valueOver, double valueRef);
195 void UpdateFusion(int display, double valueFus);
196 void UpdateWindows(int slicer, int view, int slice);
197 void UpdateSlice(int slicer, int slice);
198 void UpdateTSlice(int slicer, int slice);
199 void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
200 void WindowLevelChanged(double window, double level, int preset, int colormap);
201 void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
202 void LandmarkAdded();
203 void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
206 std::vector<vvSlicer*> mSlicers;
207 vvImageReader* mReader;
208 vvImageReader* mOverlayReader;
209 vvImageReader* mFusionReader;
210 vvImage::Pointer mImage;
211 vvImage::Pointer mVF;
212 vvImageReader* mVectorReader;
218 double mFusionWindow;
222 LoadedImageType mType;
223 std::string mVFComponent;
224 std::string mOverlayComponent;
225 std::string mFusionComponent;
226 std::string mFileName;
227 std::string mBaseFileName;
228 int mBaseFileNameNumber;
231 std::string mOverlayName;
232 std::string mFusionName;
234 std::string mLastError;
235 std::list<std::string> mLinkedId;
237 vvLandmarks* mLandmarks;