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 ======================================================================-====*/
19 #ifndef VVMAINWINDOW_H
20 #define VVMAINWINDOW_H
24 #include "ui_vvMainWindow.h"
25 #include "vvMainWindowBase.h"
26 #include "vvToolManager.h"
27 #include "vvConstants.h"
30 class vvSlicerManager;
32 class vvDocumentation;
33 class vtkRenderWindowInteractor;
36 class vvDicomSeriesSelector;
38 //------------------------------------------------------------------------------
39 class vvMainWindow: public vvMainWindowBase,
40 private Ui::vvMainWindow
47 void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
48 vvSlicerManager * AddImage(vvImage::Pointer image,std::string filename);
49 void AddField(QString file,int index);
50 void AddOverlayImage(int index, QString filename);
51 void AddFusionImage(int index, QString filename);
52 void AddROI(int index, QString filename);
53 ///Adds a mesh to a SlicerManager, with optional warping by vector field
54 void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
55 ///This is used to show an image when opened or computed
58 virtual void UpdateCurrentSlicer();
59 virtual QTabWidget * GetTab();
60 //vvMainWindowToolInfo * GetInfoForTool();
61 // void AddRunningTool(vvToolCreatorBase * tool);
64 ///Allows the user to open and select various surfaces contained in a dicom-struct file
65 void OpenDCStructContour();
66 ///Computes the MIP of the currently selected image and displays it
68 ///Computes the midposition image of a 4D sequence with a VF and displays it
69 void ComputeMidPosition();
71 ///Slot triggered by the dynamically-generated recent file menu actions
72 void OpenRecentImage();
73 void OpenImageWithTime();
76 void MergeImagesWithTime();
78 ///Open a vtkPolyData surface mesh and display it over the current image
79 void OpenVTKContour();
81 void CurrentImageChanged(std::string id);
82 void ImageInfoChanged();
83 void ShowHelpDialog();
84 void ShowDocumentation();
85 void ComputeDeformableRegistration();
87 void ChangeViewMode();
88 void DisplayChanged(QTreeWidgetItem *item, int column);
89 void CloseImage(QTreeWidgetItem* item, int column);
90 void ReloadImage(QTreeWidgetItem* item, int column);
91 void MousePositionChanged(int visibility, double x, double y, double z, double X, double Y, double Z , double value);
92 void VectorChanged(int visibility, double x, double y, double z, double value);
93 void OverlayChanged(int visibility, double valueOver, double valueRef);
94 void FusionChanged(int visibility, double value);
95 void SegmentationOnCurrentImage();
96 void SurfaceViewerLaunch();
98 void WindowsChanged(int window, int view, int slice);
99 void WindowLevelChanged(double window, double level,int preset, int colormap);
100 void UpdateSlice(int slicer, int slice);
101 void UpdateTSlice(int slicer, int slice);
102 void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
103 void WindowLevelEdited();
104 void UpdateColorMap();
105 void UpdateWindowLevel();
106 void SwitchWindowLevel();
107 void ApplyWindowLevelToAllImages();
108 void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
109 void UpdateLinkedNavigation(std::string id, vvSlicerManager *sm);
110 void AddLink(QString image1,QString image2);
111 void RemoveLink(QString image1,QString image2);
112 void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
114 ///Generic method called when any one of the horizontal sliders is moved
115 void HorizontalSliderMoved(int value,int column, int slicer_index);
116 void NOHorizontalSliderMoved();
117 void NEHorizontalSliderMoved();
118 void SOHorizontalSliderMoved();
119 void SEHorizontalSliderMoved();
121 void NOVerticalSliderChanged();
122 void NEVerticalSliderChanged();
123 void SOVerticalSliderChanged();
124 void SEVerticalSliderChanged();
126 void SaveNEScreenshot();
127 void SaveNOScreenshot();
128 void SaveSEScreenshot();
129 void SaveSOScreenshot();
131 void ShowContextMenu(QPoint point);
135 void SelectOverlayImage();
136 void SelectFusionImage();
138 void SetVFProperty(int subsampling,int scale,int lut, int width);
139 void SetOverlayProperty(int color);
140 void SetFusionProperty(int opacity,int colormap,double window,double level);
145 void ChangeFrameRate(int rate) {
148 void UpdateRenderWindows();
153 // std::vector<vvSlicerManager*> mSlicerManagers;
154 vvHelpDialog *help_dialog;
155 vvDocumentation *documentation;
156 vvDicomSeriesSelector *dicomSeriesSelector;
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 QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm);
176 void SaveScreenshot(vtkImageData* image);
177 int GetImageDuplicateFilenameNumber(std::string filename);
180 //QMenu *AddSubImageMenu;
181 std::vector<QAction*> contextActions;
182 std::vector<QSlider*> horizontalSliders;
183 std::vector<QSlider*> verticalSliders;
186 std::string mCurrentSelectedImageId;
188 // vvMainWindowToolInfo * mCurrentToolInfo;
189 // std::vector<vvToolCreatorBase*> mListOfRunningTool;
191 static vvMainWindow * mSingleton;
197 #include "vvMainWindow.txx"