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"
33 #include "vvConstants.h"
36 #include "vvToolManager.h"
37 #include "clitkCommon.h"
39 class vvSlicerManager;
41 class vvDocumentation;
42 class vtkRenderWindowInteractor;
45 class vvDicomSeriesSelector;
47 //------------------------------------------------------------------------------
48 struct vvMainWindowToolInfo {
50 std::vector<vvSlicerManager*> * mSlicerManagers;
51 int mSlicerManagerCurrentIndex;
53 //------------------------------------------------------------------------------
56 //------------------------------------------------------------------------------
57 class vvMainWindow : public QMainWindow, private Ui::vvMainWindow
64 void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
65 void AddImage(vvImage::Pointer image,std::string filename);
66 void AddImage(vvSlicerManager * m);
67 void AddField(QString file,int index);
68 void AddOverlayImage(int index, QString filename);
69 ///Adds a mesh to a SlicerManager, with optional warping by vector field
70 void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
71 ///This is used to show an image when opened or computed
74 vvMainWindowToolInfo * GetInfoForTool();
77 ///Allows the user to open and select various surfaces contained in a dicom-struct file
78 void OpenDCStructContour();
79 ///Computes the MIP of the currently selected image and displays it
81 ///Computes the midposition image of a 4D sequence with a VF and displays it
82 void ComputeMidPosition();
84 ///Slot triggered by the dynamically-generated recent file menu actions
85 void OpenRecentImage();
86 void OpenImageWithTime();
88 void MergeImagesWithTime();
90 ///Open a vtkPolyData surface mesh and display it over the current image
91 void OpenVTKContour();
93 void CurrentImageChanged(std::string id);
94 void ImageInfoChanged();
95 void ShowHelpDialog();
96 void ShowDocumentation();
97 void ComputeDeformableRegistration();
99 void ChangeViewMode();
100 void DisplayChanged(QTreeWidgetItem *item, int column);
101 void CloseImage(QTreeWidgetItem* item, int column);
102 void ReloadImage(QTreeWidgetItem* item, int column);
103 void MousePositionChanged(int visibility, double x, double y, double z, double X, double Y, double Z , double value);
104 void VectorChanged(int visibility, double x, double y, double z, double value);
105 void OverlayChanged(int visibility, double valueOver, double valueRef);
106 void FusionChanged(int visibility, double value);
107 void ResampleCurrentImage();
108 void SegmentationOnCurrentImage();
109 void SurfaceViewerLaunch();
111 void WindowsChanged(int window, int view, int slice);
112 void WindowLevelChanged(double window, double level,int preset, int colormap);
113 void UpdateSlice(int slicer, int slice);
114 void UpdateTSlice(int slicer, int slice);
115 void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
116 void WindowLevelEdited();
117 void UpdateColorMap();
118 void UpdateWindowLevel();
119 void SwitchWindowLevel();
120 void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
121 void AddLink(QString image1,QString image2);
122 void RemoveLink(QString image1,QString image2);
124 ///Generic method called when any one of the horizontal sliders is moved
125 void HorizontalSliderMoved(int value,int column, int slicer_index);
126 void NOHorizontalSliderMoved();
127 void NEHorizontalSliderMoved();
128 void SOHorizontalSliderMoved();
129 void SEHorizontalSliderMoved();
131 void NOVerticalSliderChanged();
132 void NEVerticalSliderChanged();
133 void SOVerticalSliderChanged();
134 void SEVerticalSliderChanged();
136 void SaveNEScreenshot();
137 void SaveNOScreenshot();
138 void SaveSEScreenshot();
139 void SaveSOScreenshot();
141 void ShowContextMenu(QPoint point);
147 void SelectOverlayImage();
148 void AddFusionImage();
150 void SetVFProperty(int subsampling,int scale,int lut);
151 void SetOverlayProperty(int color);
152 void SetFusionProperty(int opacity,int colormap,double window,double level);
157 void ChangeFrameRate(int rate) {
160 void UpdateRenderWindows();
163 // void SlicerManagersHasChanged();
168 std::vector<vvSlicerManager*> mSlicerManagers;
169 vvHelpDialog *help_dialog;
170 vvDocumentation *documentation;
171 vvDicomSeriesSelector *dicomSeriesSelector;
173 QString mInputPathName;
179 ///Adds a vector field to slicer manager index
180 void WarpImage(vvSlicerManager* selected_slicer,int reference_phase);
181 void AddFieldEntry(QString filename,int index,bool from_disk);
182 void AddField(vvImage::Pointer vf,QString file,int index);
184 ///Sets the render window and LUT for the last SlicerManager
186 void DisplaySliders(int slicer, int window);
187 QString GetSizeInBytes(unsigned long size);
188 QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
189 QString GetVectorIntAsString(std::vector<int> vectorInt);
190 int GetSlicerIndexFromItem(QTreeWidgetItem* item);
191 void SaveScreenshot(vtkImageData* image);
194 //QMenu *AddSubImageMenu;
195 std::vector<QAction*> contextActions;
196 std::vector<QSlider*> horizontalSliders;
197 std::vector<QSlider*> verticalSliders;
200 vvMainWindowToolInfo * mCurrentToolInfo;
202 static vvMainWindow * mSingleton;
205 #include "vvMainWindow.txx"