]> Creatis software - clitk.git/blob - vv/vvMainWindow.h
remove antique RCS headers
[clitk.git] / vv / vvMainWindow.h
1 /*=========================================================================
2
3  Program:   vv
4  Language:  C++
5  Author :   Pierre Seroul (pierre.seroul@gmail.com)
6
7 Copyright (C) 2008
8 Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
9 CREATIS-LRMN http://www.creatis.insa-lyon.fr
10
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.
14
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.
19
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/>.
22
23 =========================================================================*/
24
25 #ifndef vvMainWindow_h
26 #define vvMainWindow_h
27
28 #include <iostream>
29 #include <vector>
30
31 #include "ui_vvMainWindow.h"
32
33 #include "vvConstants.h"
34 #include "vvImage.h"
35 #include "vvMesh.h"
36
37 class vvSlicerManager;
38 class vvHelpDialog;
39 class vvDocumentation;
40 class vtkRenderWindowInteractor;
41 class vtkImageData;
42 class vtkRenderer;
43 class vvDicomSeriesSelector;
44
45 class vvMainWindow : public QMainWindow, private Ui::vvMainWindow
46 {
47     Q_OBJECT
48
49 public:
50     vvMainWindow();
51     ~vvMainWindow();
52     void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
53     void AddImage(vvImage::Pointer image,std::string filename);
54     void AddImage(vvSlicerManager * m);
55     void AddField(QString file,int index);
56     void AddOverlayImage(int index, QString filename);
57     ///Adds a mesh to a SlicerManager, with optional warping by vector field
58     void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
59     ///This is used to show an image when opened or computed
60     void ShowLastImage();
61
62 public slots:
63     ///Allows the user to open and select various surfaces contained in a dicom-struct file
64     void OpenDCStructContour();
65     ///Computes the MIP of the currently selected image and displays it
66     void ComputeMIP();
67     ///Computes the midposition image of a 4D sequence with a VF and displays it
68     void ComputeMidPosition();
69     void OpenImages();
70     ///Slot triggered by the dynamically-generated recent file menu actions
71     void OpenRecentImage();
72     void OpenImageWithTime();
73     void MergeImages();
74     void MergeImagesWithTime();
75     void OpenDicom();
76     ///Open a vtkPolyData surface mesh and display it over the current image
77     void OpenVTKContour();
78     void SaveAs();
79     void CurrentImageChanged(std::string id);
80     void ImageInfoChanged();
81     void ShowHelpDialog();
82     void ShowDocumentation();
83     void ComputeDeformableRegistration();
84     void WarpImage();
85     void ChangeViewMode();
86     void DisplayChanged(QTreeWidgetItem *item, int column);
87     void CloseImage(QTreeWidgetItem* item, int column);
88     void ReloadImage(QTreeWidgetItem* item, int column);
89     void MousePositionChanged(int visibility, double x, double y, double z, double X, double Y, double Z , double value);
90     void VectorChanged(int visibility, double x, double y, double z, double value);
91     void OverlayChanged(int visibility, double valueOver, double valueRef);
92     void FusionChanged(int visibility, double value);
93     void ResampleCurrentImage();
94     void SegmentationOnCurrentImage();
95     void SurfaceViewerLaunch();
96
97     void WindowsChanged(int window, int view, int slice);
98     void WindowLevelChanged(double window, double level,int preset, int colormap);
99     void UpdateSlice(int slicer, int slice);
100     void UpdateTSlice(int slicer, int slice);
101     void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
102     void WindowLevelEdited();
103     void UpdateColorMap();
104     void UpdateWindowLevel();
105     void SwitchWindowLevel();
106     void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
107     void AddLink(QString image1,QString image2);
108     void RemoveLink(QString image1,QString image2);
109
110     ///Generic method called when any one of the horizontal sliders is moved
111     void HorizontalSliderMoved(int value,int column, int slicer_index);
112     void NOHorizontalSliderMoved();
113     void NEHorizontalSliderMoved();
114     void SOHorizontalSliderMoved();
115     void SEHorizontalSliderMoved();
116
117     void NOVerticalSliderChanged();
118     void NEVerticalSliderChanged();
119     void SOVerticalSliderChanged();
120     void SEVerticalSliderChanged();
121
122     void SaveNEScreenshot();
123     void SaveNOScreenshot();
124     void SaveSEScreenshot();
125     void SaveSOScreenshot();
126
127     void ShowContextMenu(QPoint point);
128     void CropImage();
129     void SplitImage();
130     void CloseImage();
131     void ReloadImage();
132     void OpenField();
133     void SelectOverlayImage();
134     void AddFusionImage();
135
136     void SetVFProperty(int subsampling,int scale,int lut);
137     void SetOverlayProperty(int color);
138     void SetFusionProperty(int opacity,int colormap,double window,double level);
139
140     void GoToCursor();
141     void PlayPause();
142     void PlayNext();
143     void ChangeFrameRate(int rate) {
144         mFrameRate = rate;
145     }
146
147     void UpdateRenderWindows();
148
149 private:
150
151     //variables
152     std::vector<vvSlicerManager*> mSlicerManagers;
153     vvHelpDialog *help_dialog;
154     vvDocumentation *documentation;
155     vvDicomSeriesSelector *dicomSeriesSelector;
156
157     QString mInputPathName;
158     bool viewMode;
159     bool playMode;
160
161     //functions
162     void UpdateTree();
163     ///Adds a vector field to slicer manager index
164     void WarpImage(vvSlicerManager* selected_slicer,int reference_phase);
165     void AddFieldEntry(QString filename,int index,bool from_disk);
166     void AddField(vvImage::Pointer vf,QString file,int index);
167     void InitDisplay();
168     ///Sets the render window and LUT for the last SlicerManager
169     void InitSlicers();
170     void DisplaySliders(int slicer, int window);
171     QString GetSizeInBytes(unsigned long size);
172     QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
173     QString GetVectorIntAsString(std::vector<int> vectorInt);
174     int GetSlicerIndexFromItem(QTreeWidgetItem* item);
175     void SaveScreenshot(vtkImageData* image);
176
177     QMenu contextMenu;
178     //QMenu *AddSubImageMenu;
179     std::vector<QAction*> contextActions;
180     std::vector<QSlider*> horizontalSliders;
181     std::vector<QSlider*> verticalSliders;
182     int mFrameRate;
183 };
184
185 #endif