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 =========================================================================*/
25 #ifndef vvMainWindow_h
26 #define vvMainWindow_h
31 #include "ui_vvMainWindow.h"
32 #include "vvMainWindowBase.h"
33 #include "vvToolManager.h"
34 #include "vvConstants.h"
37 class vvSlicerManager;
39 class vvDocumentation;
40 class vtkRenderWindowInteractor;
43 class vvDicomSeriesSelector;
45 //------------------------------------------------------------------------------
46 class vvMainWindow: public vvMainWindowBase,
47 private Ui::vvMainWindow
54 void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
55 void AddImage(vvImage::Pointer image,std::string filename);
56 void AddImage(vvSlicerManager * m);
57 void AddField(QString file,int index);
58 void AddOverlayImage(int index, QString filename);
59 ///Adds a mesh to a SlicerManager, with optional warping by vector field
60 void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
61 ///This is used to show an image when opened or computed
64 virtual void UpdateCurrentSlicer();
65 //vvMainWindowToolInfo * GetInfoForTool();
66 // void AddRunningTool(vvToolCreatorBase * tool);
69 ///Allows the user to open and select various surfaces contained in a dicom-struct file
70 void OpenDCStructContour();
71 ///Computes the MIP of the currently selected image and displays it
73 ///Computes the midposition image of a 4D sequence with a VF and displays it
74 void ComputeMidPosition();
76 ///Slot triggered by the dynamically-generated recent file menu actions
77 void OpenRecentImage();
78 void OpenImageWithTime();
80 void MergeImagesWithTime();
82 ///Open a vtkPolyData surface mesh and display it over the current image
83 void OpenVTKContour();
85 void CurrentImageChanged(std::string id);
86 void ImageInfoChanged();
87 void ShowHelpDialog();
88 void ShowDocumentation();
89 void ComputeDeformableRegistration();
91 void ChangeViewMode();
92 void DisplayChanged(QTreeWidgetItem *item, int column);
93 void CloseImage(QTreeWidgetItem* item, int column);
94 void ReloadImage(QTreeWidgetItem* item, int column);
95 void MousePositionChanged(int visibility, double x, double y, double z, double X, double Y, double Z , double value);
96 void VectorChanged(int visibility, double x, double y, double z, double value);
97 void OverlayChanged(int visibility, double valueOver, double valueRef);
98 void FusionChanged(int visibility, double value);
99 void ResampleCurrentImage();
100 void SegmentationOnCurrentImage();
101 void SurfaceViewerLaunch();
103 void WindowsChanged(int window, int view, int slice);
104 void WindowLevelChanged(double window, double level,int preset, int colormap);
105 void UpdateSlice(int slicer, int slice);
106 void UpdateTSlice(int slicer, int slice);
107 void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
108 void WindowLevelEdited();
109 void UpdateColorMap();
110 void UpdateWindowLevel();
111 void SwitchWindowLevel();
112 void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
113 void AddLink(QString image1,QString image2);
114 void RemoveLink(QString image1,QString image2);
116 ///Generic method called when any one of the horizontal sliders is moved
117 void HorizontalSliderMoved(int value,int column, int slicer_index);
118 void NOHorizontalSliderMoved();
119 void NEHorizontalSliderMoved();
120 void SOHorizontalSliderMoved();
121 void SEHorizontalSliderMoved();
123 void NOVerticalSliderChanged();
124 void NEVerticalSliderChanged();
125 void SOVerticalSliderChanged();
126 void SEVerticalSliderChanged();
128 void SaveNEScreenshot();
129 void SaveNOScreenshot();
130 void SaveSEScreenshot();
131 void SaveSOScreenshot();
133 void ShowContextMenu(QPoint point);
139 void SelectOverlayImage();
140 void AddFusionImage();
142 void SetVFProperty(int subsampling,int scale,int lut);
143 void SetOverlayProperty(int color);
144 void SetFusionProperty(int opacity,int colormap,double window,double level);
149 void ChangeFrameRate(int rate) {
152 void UpdateRenderWindows();
155 // void SlicerManagersHasChanged();
160 // std::vector<vvSlicerManager*> mSlicerManagers;
161 vvHelpDialog *help_dialog;
162 vvDocumentation *documentation;
163 vvDicomSeriesSelector *dicomSeriesSelector;
165 QString mInputPathName;
171 ///Adds a vector field to slicer manager index
172 void WarpImage(vvSlicerManager* selected_slicer,int reference_phase);
173 void AddFieldEntry(QString filename,int index,bool from_disk);
174 void AddField(vvImage::Pointer vf,QString file,int index);
176 ///Sets the render window and LUT for the last SlicerManager
178 void DisplaySliders(int slicer, int window);
179 QString GetSizeInBytes(unsigned long size);
180 QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
181 QString GetVectorIntAsString(std::vector<int> vectorInt);
182 int GetSlicerIndexFromItem(QTreeWidgetItem* item);
183 void SaveScreenshot(vtkImageData* image);
186 //QMenu *AddSubImageMenu;
187 std::vector<QAction*> contextActions;
188 std::vector<QSlider*> horizontalSliders;
189 std::vector<QSlider*> verticalSliders;
192 // vvMainWindowToolInfo * mCurrentToolInfo;
193 // std::vector<vvToolCreatorBase*> mListOfRunningTool;
195 static vvMainWindow * mSingleton;
198 #include "vvMainWindow.txx"