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"
43 #include "vvImageReader.h"
46 class vvInteractorStyleNavigator;
51 //------------------------------------------------------------------------------
52 class vvSlicerManager : public QObject {
56 vvSlicerManager(int numberOfSlicers);
59 std::string GetLastError() {
63 bool SetImage(std::string filename,LoadedImageType type, int n=0, unsigned int slice=0);
64 void SetImage(vvImage::Pointer image);
65 bool SetImages(std::vector<std::string> filenames, LoadedImageType type, int n=0);
67 bool SetOverlay(std::string filename, int dim, std::string component);
68 bool SetFusion(std::string filename, int dim, std::string component);
69 ///Set a VF by loading it from the disk
70 bool SetVF(std::string filename);
71 ///Set a VF from memory
72 bool SetVF(vvImage::Pointer vf,std::string filename);
73 ///Add a mesh to the slicers, with optional propagation using a vector field
74 void AddContour(vvMesh::Pointer ,bool propagate=false);
75 ///Toggle temporal superposition of contours
76 void ToggleContourSuperposition();
78 std::string GetFileName() { return mFileName; }
79 std::string GetBaseFileName() { return mBaseFileName; }
80 int GetBaseFileNameNumber() { return mBaseFileNameNumber; }
81 std::string GetVFName() { return mVFName; }
82 std::string GetOverlayName() { return mOverlayName; }
83 std::string GetFusionName() { return mFusionName; }
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);
92 int GetNumberOfSlicers() { return mSlicers.size(); }
93 vvImage::Pointer GetImage() { return mImage; }
94 vvImage::Pointer GetVF() { return mVF; }
95 int GetType() { return mType; }
96 void SetId(std::string id) { mId = id; }
97 std::string GetId() { return mId; }
99 if (mImage) return mImage->GetNumberOfDimensions();
103 void SetFilename(std::string f, int number=0);
105 void SetTSlice(int slice);
106 void SetNextTSlice(int originating_slicer);
107 void SetPreviousTSlice(int originating_slicer);
108 void SetTSliceInSlicer(int tslice, int slicer);
110 void GenerateDefaultLookupTable();
111 void SetColorWindow(double s);
112 void SetColorLevel(double s);
113 void SetLocalColorWindowing(const int slicer);
114 void SetOpacity(int i, double factor);
116 void SetColorMap(int colormap);
117 void SetPreset(int preset);
118 void SetOverlayColor(int color) {
119 mOverlayColor = (color/60)*60; //SR: new vvBlendImageActor needs 0 or 255 per component
121 void SetFusionOpacity(int opacity) {
122 mFusionOpacity = opacity;
124 void SetFusionColorMap(int colorMap) {
125 mFusionColorMap = colorMap;
127 void SetFusionWindow(double window) {
128 mFusionWindow = window;
130 void SetFusionLevel(double level) {
131 mFusionLevel = level;
134 double GetColorWindow();
135 double GetColorLevel();
142 int GetOverlayColor() {
143 return mOverlayColor;
146 int GetFusionOpacity() {
147 return mFusionOpacity;
149 int GetFusionColorMap() {
150 return mFusionColorMap;
152 double GetFusionWindow() {
153 return mFusionWindow;
155 double GetFusionLevel() {
159 void SetCursorAndCornerAnnotationVisibility(int s);
160 void UpdateViews(int current, int slicer);
161 void UpdateLinked(int slicer);
162 void UpdateLinkedNavigation(vvSlicer *slicer, bool bPropagate=false);
165 void AddLink(std::string newId) {
166 mLinkedId.push_back(newId);
168 void RemoveLink(std::string oldId) {
169 mLinkedId.remove(oldId);
172 ///Remove the actor defined by its type and index (example: 3rd contour)
173 void RemoveActor(const std::string& actor_type, int overlay_index);
176 void ReloadOverlay();
182 void UpdateInfoOnCursorPosition(int slicer);
183 void UpdateWindowLevel();
184 void UpdateSlice(int slicer);
185 void UpdateTSlice(int slicer);
186 void UpdateSliceRange(int slicer);
188 vvLandmarks *GetLandmarks();
189 void AddLandmark(float x,float y,float z,float t);
191 void NextImage(int slicer);
192 void PrevImage(int slicer);
193 void LeftButtonReleaseEvent(int slicer);
194 void VerticalSliderHasChanged(int slicer, int slice);
195 double GetScalarComponentAsDouble(vtkImageData *image, double X, double Y, double Z, int component=0);
198 void currentImageChanged(std::string id);
199 void currentPickedImageChanged(std::string id);
200 void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
201 void UpdateVector(int display, double x, double y, double z, double value);
202 void UpdateOverlay(int display, double valueOver, double valueRef);
203 void UpdateFusion(int display, double valueFus);
204 void UpdateWindows(int slicer, int view, int slice);
205 void UpdateSlice(int slicer, int slice);
206 void UpdateTSlice(int slicer, int slice);
207 void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
208 void WindowLevelChanged(double window, double level, int preset, int colormap);
209 void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
210 void UpdateLinkedNavigation(std::string, vvSlicerManager*);
211 void LandmarkAdded();
212 void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
213 void LeftButtonReleaseSignal(int slicer);
214 void AVerticalSliderHasChanged(int slicer, int slice);
217 std::vector<vvSlicer*> mSlicers;
218 vvImageReader::Pointer mReader;
219 vvImageReader::Pointer mOverlayReader;
220 vvImageReader::Pointer mFusionReader;
221 vvImageReader::Pointer mVectorReader;
222 vvImage::Pointer mImage;
223 vvImage::Pointer mVF;
229 double mFusionWindow;
233 LoadedImageType mType;
234 std::string mVFComponent;
235 std::string mOverlayComponent;
236 std::string mFusionComponent;
237 std::string mFileName;
238 std::string mBaseFileName;
239 int mBaseFileNameNumber;
242 std::string mOverlayName;
243 std::string mFusionName;
245 std::string mLastError;
246 std::list<std::string> mLinkedId;
248 vvLandmarks* mLandmarks;
250 std::vector<int> mPreviousSlice;
251 std::vector<int> mPreviousTSlice;