1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18 #ifndef vvMainWindow_h
19 #define vvMainWindow_h
23 #include "ui_vvMainWindow.h"
24 #include "vvMainWindowBase.h"
25 #include "vvToolManager.h"
26 #include "vvConstants.h"
29 class vvSlicerManager;
31 class vvDocumentation;
32 class vtkRenderWindowInteractor;
35 class vvDicomSeriesSelector;
37 //------------------------------------------------------------------------------
38 class vvMainWindow: public vvMainWindowBase,
39 private Ui::vvMainWindow
46 void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
47 void AddImage(vvImage::Pointer image,std::string filename);
48 void AddImage(vvSlicerManager * m);
49 void AddField(QString file,int index);
50 void AddOverlayImage(int index, QString filename);
51 ///Adds a mesh to a SlicerManager, with optional warping by vector field
52 void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
53 ///This is used to show an image when opened or computed
56 virtual void UpdateCurrentSlicer();
57 //vvMainWindowToolInfo * GetInfoForTool();
58 // void AddRunningTool(vvToolCreatorBase * tool);
61 ///Allows the user to open and select various surfaces contained in a dicom-struct file
62 void OpenDCStructContour();
63 ///Computes the MIP of the currently selected image and displays it
65 ///Computes the midposition image of a 4D sequence with a VF and displays it
66 void ComputeMidPosition();
68 ///Slot triggered by the dynamically-generated recent file menu actions
69 void OpenRecentImage();
70 void OpenImageWithTime();
72 void MergeImagesWithTime();
74 ///Open a vtkPolyData surface mesh and display it over the current image
75 void OpenVTKContour();
77 void CurrentImageChanged(std::string id);
78 void ImageInfoChanged();
79 void ShowHelpDialog();
80 void ShowDocumentation();
81 void ComputeDeformableRegistration();
83 void ChangeViewMode();
84 void DisplayChanged(QTreeWidgetItem *item, int column);
85 void CloseImage(QTreeWidgetItem* item, int column);
86 void ReloadImage(QTreeWidgetItem* item, int column);
87 void MousePositionChanged(int visibility, double x, double y, double z, double X, double Y, double Z , double value);
88 void VectorChanged(int visibility, double x, double y, double z, double value);
89 void OverlayChanged(int visibility, double valueOver, double valueRef);
90 void FusionChanged(int visibility, double value);
91 void ResampleCurrentImage();
92 void SegmentationOnCurrentImage();
93 void SurfaceViewerLaunch();
95 void WindowsChanged(int window, int view, int slice);
96 void WindowLevelChanged(double window, double level,int preset, int colormap);
97 void UpdateSlice(int slicer, int slice);
98 void UpdateTSlice(int slicer, int slice);
99 void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
100 void WindowLevelEdited();
101 void UpdateColorMap();
102 void UpdateWindowLevel();
103 void SwitchWindowLevel();
104 void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
105 void AddLink(QString image1,QString image2);
106 void RemoveLink(QString image1,QString image2);
108 ///Generic method called when any one of the horizontal sliders is moved
109 void HorizontalSliderMoved(int value,int column, int slicer_index);
110 void NOHorizontalSliderMoved();
111 void NEHorizontalSliderMoved();
112 void SOHorizontalSliderMoved();
113 void SEHorizontalSliderMoved();
115 void NOVerticalSliderChanged();
116 void NEVerticalSliderChanged();
117 void SOVerticalSliderChanged();
118 void SEVerticalSliderChanged();
120 void SaveNEScreenshot();
121 void SaveNOScreenshot();
122 void SaveSEScreenshot();
123 void SaveSOScreenshot();
125 void ShowContextMenu(QPoint point);
131 void SelectOverlayImage();
132 void AddFusionImage();
134 void SetVFProperty(int subsampling,int scale,int lut);
135 void SetOverlayProperty(int color);
136 void SetFusionProperty(int opacity,int colormap,double window,double level);
141 void ChangeFrameRate(int rate) {
144 void UpdateRenderWindows();
147 // void SlicerManagersHasChanged();
152 // std::vector<vvSlicerManager*> mSlicerManagers;
153 vvHelpDialog *help_dialog;
154 vvDocumentation *documentation;
155 vvDicomSeriesSelector *dicomSeriesSelector;
157 QString mInputPathName;
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);
168 ///Sets the render window and LUT for the last SlicerManager
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);
178 //QMenu *AddSubImageMenu;
179 std::vector<QAction*> contextActions;
180 std::vector<QSlider*> horizontalSliders;
181 std::vector<QSlider*> verticalSliders;
184 // vvMainWindowToolInfo * mCurrentToolInfo;
185 // std::vector<vvToolCreatorBase*> mListOfRunningTool;
187 static vvMainWindow * mSingleton;
190 #include "vvMainWindow.txx"