1 /*=========================================================================
5 Author : Pierre Seroul (pierre.seroul@gmail.com)
8 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
9 CREATIS-LRMN http://www.creatis.insa-lyon.fr
11 This program is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, version 3 of the License.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 =========================================================================*/
24 #ifndef vvSlicerManager_h
25 #define vvSlicerManager_h
36 #include <vtksys/SystemTools.hxx>
38 class vtkInteractorStyle;
39 class vtkRenderWindow;
43 #include "vvConstants.h"
44 #include "clitkCommon.h"
48 class vvInteractorStyleNavigator;
53 class vvSlicerManager : public QObject {
57 vvSlicerManager(int numberOfSlicers);
60 std::string GetLastError() {
64 bool SetImage(std::string filename,LoadedImageType type);
65 void SetImage(vvImage::Pointer image);
66 void SetExtractedImage(std::string filename, vvImage::Pointer image, int slice);
67 bool SetImages(std::vector<std::string> filenames,LoadedImageType type);
69 bool SetOverlay(std::string filename, int dim, std::string component);
70 bool SetFusion(std::string filename, int dim, std::string component);
71 ///Set a VF by loading it from the disk
72 bool SetVF(std::string filename);
73 ///Set a VF from memory
74 bool SetVF(vvImage::Pointer vf,std::string filename);
75 ///Add a mesh to the slicers, with optional propagation using a vector field
76 void AddContour(vvMesh::Pointer ,bool propagate=false);
77 ///Toggle temporal superposition of contours
78 void ToggleContourSuperposition();
80 std::string GetFileName() {
83 std::string GetVFName() {
86 std::string GetOverlayName() {
89 std::string GetFusionName() {
93 ///Switch between nearest neighbor and linear interpolation
94 void ToggleInterpolation();
95 vvSlicer* GetSlicer(int i);
96 void UpdateSlicer(int num, bool state);
97 void SetSlicerWindow(int i, vtkRenderWindow* RW);
98 void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
99 int NumberOfSlicers() {
100 return mSlicers.size();
102 vvImage::Pointer GetImage() {
105 vvImage::Pointer GetVF() {
109 if (mImage) return mImage->GetNumberOfDimensions();
117 void SetId(std::string id) {
120 std::string GetId() {
124 void SetFilename(std::string f) {
128 void SetTSlice(int slice);
129 void SetNextTSlice(int originating_slicer);
130 void SetPreviousTSlice(int originating_slicer);
131 void SetTSliceInSlicer(int tslice, int slicer);
133 void GenerateDefaultLookupTable();
134 void SetColorWindow(double s);
135 void SetColorLevel(double s);
136 void SetOpacity(int i, double factor);
138 void SetColorMap(int colormap);
139 void SetPreset(int preset);
140 void SetOverlayColor(int color) {
141 mOverlayColor = color;
143 void SetFusionOpacity(int opacity) {
144 mFusionOpacity = opacity;
146 void SetFusionColorMap(int colorMap) {
147 mFusionColorMap = colorMap;
149 void SetFusionWindow(int window) {
150 mFusionWindow = window;
152 void SetFusionLevel(int level) {
153 mFusionLevel = level;
156 double GetColorWindow();
157 double GetColorLevel();
164 int GetOverlayColor() {
165 return mOverlayColor;
168 int GetFusionOpacity() {
169 return mFusionOpacity;
171 int GetFusionColorMap() {
172 return mFusionColorMap;
174 double GetFusionWindow() {
175 return mFusionWindow;
177 double GetFusionLevel() {
181 void SetCursorVisibility(int s);
182 void UpdateViews(int current, int slicer);
183 void UpdateLinked(int slicer);
186 void AddLink(std::string newId) {
187 mLinkedId.push_back(newId);
189 void RemoveLink(std::string oldId) {
190 mLinkedId.remove(oldId);
193 ///Remove the actor defined by its type and index (example: 3rd contour)
194 void RemoveActor(const std::string& actor_type, int overlay_index);
197 void ReloadOverlay();
202 void UpdateInfoOnCursorPosition(int slicer);
203 void UpdateWindowLevel();
204 void UpdateSlice(int slicer);
205 void UpdateTSlice(int slicer);
206 void UpdateSliceRange(int slicer);
208 vvLandmarks *GetLandmarks();
209 void AddLandmark(float x,float y,float z,float t);
212 void currentImageChanged(std::string id);
213 void UpdatePosition(int visibility,double x, double y, double z, double X, double Y, double Z, double value);
214 void UpdateVector(int display, double x, double y, double z, double value);
215 void UpdateOverlay(int display, double valueOver, double valueRef);
216 void UpdateFusion(int display, double valueFus);
217 void UpdateWindows(int slicer, int view, int slice);
218 void UpdateSlice(int slicer, int slice);
219 void UpdateTSlice(int slicer, int slice);
220 void UpdateSliceRange(int slice, int min, int max, int tmin, int tmax);
221 void WindowLevelChanged(double window, double level, int preset, int colormap);
222 void UpdateLinkManager(std::string, int slicer, double x, double y, double z, int temps);
223 void LandmarkAdded();
226 std::vector<vvSlicer*> mSlicers;
227 vvImageReader* mReader;
228 vvImageReader* mOverlayReader;
229 vvImageReader* mFusionReader;
230 vvImage::Pointer mImage;
231 vvImage::Pointer mVF;
232 vvImageReader* mVectorReader;
238 double mFusionWindow;
242 LoadedImageType mType;
243 std::string mVFComponent;
244 std::string mOverlayComponent;
245 std::string mFusionComponent;
246 std::string mFileName;
249 std::string mOverlayName;
250 std::string mFusionName;
252 std::string mLastError;
253 std::list<std::string> mLinkedId;
255 vvLandmarks* mLandmarks;