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