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 ======================================================================-====*/
18 #ifndef VVSLICERMANAGER_H
19 #define VVSLICERMANAGER_H
29 #include <vtksys/SystemTools.hxx>
31 class vtkInteractorStyle;
32 class vtkRenderWindow;
36 #include "vvConstants.h"
37 #include "clitkCommon.h"
41 class vvInteractorStyleNavigator;
46 class vvSlicerManager : public QObject {
50 vvSlicerManager(int numberOfSlicers);
53 std::string GetLastError() {
57 bool SetImage(std::string filename,LoadedImageType type);
58 void SetImage(vvImage::Pointer image);
59 void SetExtractedImage(std::string filename, vvImage::Pointer image, int slice);
60 bool SetImages(std::vector<std::string> filenames,LoadedImageType type);
62 bool SetOverlay(std::string filename, int dim, std::string component);
63 bool SetFusion(std::string filename, int dim, std::string component);
64 ///Set a VF by loading it from the disk
65 bool SetVF(std::string filename);
66 ///Set a VF from memory
67 bool SetVF(vvImage::Pointer vf,std::string filename);
68 ///Add a mesh to the slicers, with optional propagation using a vector field
69 void AddContour(vvMesh::Pointer ,bool propagate=false);
70 ///Toggle temporal superposition of contours
71 void ToggleContourSuperposition();
73 std::string GetFileName() {
76 std::string GetVFName() {
79 std::string GetOverlayName() {
82 std::string GetFusionName() {
86 ///Switch between nearest neighbor and linear interpolation
87 void ToggleInterpolation();
88 vvSlicer* GetSlicer(int i);
89 void UpdateSlicer(int num, bool state);
90 void SetSlicerWindow(int i, vtkRenderWindow* RW);
91 void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
92 int NumberOfSlicers() {
93 return mSlicers.size();
95 vvImage::Pointer GetImage() {
98 vvImage::Pointer GetVF() {
102 if (mImage) return mImage->GetNumberOfDimensions();
110 void SetId(std::string id) {
113 std::string GetId() {
117 void SetFilename(std::string f);
119 void SetTSlice(int slice);
120 void SetNextTSlice(int originating_slicer);
121 void SetPreviousTSlice(int originating_slicer);
122 void SetTSliceInSlicer(int tslice, int slicer);
124 void GenerateDefaultLookupTable();
125 void SetColorWindow(double s);
126 void SetColorLevel(double s);
127 void SetLocalColorWindowing(const int slicer);
128 void SetOpacity(int i, double factor);
130 void SetColorMap(int colormap);
131 void SetPreset(int preset);
132 void SetOverlayColor(int color) {
133 mOverlayColor = color;
135 void SetFusionOpacity(int opacity) {
136 mFusionOpacity = opacity;
138 void SetFusionColorMap(int colorMap) {
139 mFusionColorMap = colorMap;
141 void SetFusionWindow(int window) {
142 mFusionWindow = window;
144 void SetFusionLevel(int level) {
145 mFusionLevel = level;
148 double GetColorWindow();
149 double GetColorLevel();
156 int GetOverlayColor() {
157 return mOverlayColor;
160 int GetFusionOpacity() {
161 return mFusionOpacity;
163 int GetFusionColorMap() {
164 return mFusionColorMap;
166 double GetFusionWindow() {
167 return mFusionWindow;
169 double GetFusionLevel() {
173 void SetCursorVisibility(int s);
174 void UpdateViews(int current, int slicer);
175 void UpdateLinked(int slicer);
178 void AddLink(std::string newId) {
179 mLinkedId.push_back(newId);
181 void RemoveLink(std::string oldId) {
182 mLinkedId.remove(oldId);
185 ///Remove the actor defined by its type and index (example: 3rd contour)
186 void RemoveActor(const std::string& actor_type, int overlay_index);
189 void ReloadOverlay();
194 void UpdateInfoOnCursorPosition(int slicer);
195 void UpdateWindowLevel();
196 void UpdateSlice(int slicer);
197 void UpdateTSlice(int slicer);
198 void UpdateSliceRange(int slicer);
200 vvLandmarks *GetLandmarks();
201 void AddLandmark(float x,float y,float z,float t);
204 void currentImageChanged(std::string id);
205 void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
206 void UpdateVector(int display, double x, double y, double z, double value);
207 void UpdateOverlay(int display, double valueOver, double valueRef);
208 void UpdateFusion(int display, double valueFus);
209 void UpdateWindows(int slicer, int view, int slice);
210 void UpdateSlice(int slicer, int slice);
211 void UpdateTSlice(int slicer, int slice);
212 void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
213 void WindowLevelChanged(double window, double level, int preset, int colormap);
214 void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
215 void LandmarkAdded();
218 std::vector<vvSlicer*> mSlicers;
219 vvImageReader* mReader;
220 vvImageReader* mOverlayReader;
221 vvImageReader* mFusionReader;
222 vvImage::Pointer mImage;
223 vvImage::Pointer mVF;
224 vvImageReader* mVectorReader;
230 double mFusionWindow;
234 LoadedImageType mType;
235 std::string mVFComponent;
236 std::string mOverlayComponent;
237 std::string mFusionComponent;
238 std::string mFileName;
241 std::string mOverlayName;
242 std::string mFusionName;
244 std::string mLastError;
245 std::list<std::string> mLinkedId;
247 vvLandmarks* mLandmarks;