1 /*=========================================================================
4 Module: $RCSfile: vvSlicerManager.h,v $
6 Date: $Date: 2010/01/06 13:31:58 $
7 Version: $Revision: 1.1 $
8 Author : Pierre Seroul (pierre.seroul@gmail.com)
11 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
12 CREATIS-LRMN http://www.creatis.insa-lyon.fr
14 This program is free software: you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation, version 3 of the License.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 =========================================================================*/
27 #ifndef vvSlicerManager_h
28 #define vvSlicerManager_h
39 #include <vtksys/SystemTools.hxx>
41 class vtkInteractorStyle;
42 class vtkRenderWindow;
46 #include "vvConstants.h"
47 #include "clitkCommon.h"
51 class vvInteractorStyleNavigator;
56 class vvSlicerManager : public QObject {
60 vvSlicerManager(int numberOfSlicers);
63 std::string GetLastError() {
67 bool SetImage(std::string filename,LoadedImageType type);
68 void SetImage(vvImage::Pointer image);
69 void SetExtractedImage(std::string filename, vvImage::Pointer image, int slice);
70 bool SetImages(std::vector<std::string> filenames,LoadedImageType type);
72 bool SetOverlay(std::string filename, int dim, std::string component);
73 bool SetFusion(std::string filename, int dim, std::string component);
74 ///Set a VF by loading it from the disk
75 bool SetVF(std::string filename);
76 ///Set a VF from memory
77 bool SetVF(vvImage::Pointer vf,std::string filename);
78 ///Add a mesh to the slicers, with optional propagation using a vector field
79 void AddContour(vvMesh::Pointer ,bool propagate=false);
80 ///Toggle temporal superposition of contours
81 void ToggleContourSuperposition();
83 std::string GetFileName() {
86 std::string GetVFName() {
89 std::string GetOverlayName() {
92 std::string GetFusionName() {
96 ///Switch between nearest neighbor and linear interpolation
97 void ToggleInterpolation();
98 vvSlicer* GetSlicer(int i);
99 void UpdateSlicer(int num, bool state);
100 void SetSlicerWindow(int i, vtkRenderWindow* RW);
101 void SetInteractorStyleNavigator(int i,vtkInteractorStyle* style);
102 int NumberOfSlicers() {
103 return mSlicers.size();
105 vvImage::Pointer GetImage() {
108 vvImage::Pointer GetVF() {
112 if (mImage) return mImage->GetNumberOfDimensions();
120 void SetId(std::string id) {
123 std::string GetId() {
127 void SetFilename(std::string f) {
131 void SetTSlice(int slice);
132 void SetNextTSlice(int originating_slicer);
133 void SetPreviousTSlice(int originating_slicer);
134 void SetTSliceInSlicer(int tslice, int slicer);
136 void GenerateDefaultLookupTable();
137 void SetColorWindow(double s);
138 void SetColorLevel(double s);
139 void SetOpacity(int i, double factor);
140 void SetColorMap(int colormap);
141 void SetPreset(int preset);
142 void SetOverlayColor(int color) {
143 mOverlayColor = color;
145 void SetFusionOpacity(int opacity) {
146 mFusionOpacity = opacity;
148 void SetFusionColorMap(int colorMap) {
149 mFusionColorMap = colorMap;
151 void SetFusionWindow(int window) {
152 mFusionWindow = window;
154 void SetFusionLevel(int level) {
155 mFusionLevel = level;
158 double GetColorWindow();
159 double GetColorLevel();
166 int GetOverlayColor() {
167 return mOverlayColor;
170 int GetFusionOpacity() {
171 return mFusionOpacity;
173 int GetFusionColorMap() {
174 return mFusionColorMap;
176 double GetFusionWindow() {
177 return mFusionWindow;
179 double GetFusionLevel() {
183 void SetCursorVisibility(int s);
184 void UpdateViews(int current, int slicer);
185 void UpdateLinked(int slicer);
188 void AddLink(std::string newId) {
189 mLinkedId.push_back(newId);
191 void RemoveLink(std::string oldId) {
192 mLinkedId.remove(oldId);
195 ///Remove the actor defined by its type and index (example: 3rd contour)
196 void RemoveActor(const std::string& actor_type, int overlay_index);
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;