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"
29 #include "clitkMemoryUsage.h"
31 class vvSlicerManager;
33 class vvDocumentation;
34 class vtkRenderWindowInteractor;
37 class vvDicomSeriesSelector;
39 //------------------------------------------------------------------------------
40 class vvMainWindow: public vvMainWindowBase,
41 private Ui::vvMainWindow
48 void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
49 vvSlicerManager * AddImage(vvImage::Pointer image,std::string filename);
50 void AddField(QString file,int index);
51 void AddOverlayImage(int index, QString filename);
52 void AddFusionImage(int index, QString filename);
53 void AddROI(int index, QString filename);
54 ///Adds a mesh to a SlicerManager, with optional warping by vector field
55 void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
56 ///This is used to show an image when opened or computed
59 virtual void UpdateCurrentSlicer();
60 virtual QTabWidget * GetTab();
61 //vvMainWindowToolInfo * GetInfoForTool();
62 // void AddRunningTool(vvToolCreatorBase * tool);
65 ///Allows the user to open and select various surfaces contained in a dicom-struct file
66 void OpenDCStructContour();
67 ///Computes the MIP of the currently selected image and displays it
69 ///Computes the midposition image of a 4D sequence with a VF and displays it
70 void ComputeMidPosition();
72 ///Slot triggered by the dynamically-generated recent file menu actions
73 void OpenRecentImage();
74 void OpenImageWithTime();
77 void MergeImagesWithTime();
79 ///Open a vtkPolyData surface mesh and display it over the current image
80 void OpenVTKContour();
82 void CurrentImageChanged(std::string id);
83 void ImageInfoChanged();
84 void ShowHelpDialog();
85 void ShowDocumentation();
86 void ComputeDeformableRegistration();
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 SegmentationOnCurrentImage();
97 void SurfaceViewerLaunch();
99 void WindowsChanged(int window, int view, int slice);
100 void WindowLevelChanged(double window, double level,int preset, int colormap);
101 void UpdateSlice(int slicer, int slice);
102 void UpdateTSlice(int slicer, int slice);
103 void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
104 void WindowLevelEdited();
105 void UpdateColorMap();
106 void UpdateWindowLevel();
107 void SwitchWindowLevel();
108 void ApplyWindowLevelToAllImages();
109 void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
110 void UpdateLinkedNavigation(std::string id, vvSlicerManager *sm);
111 void AddLink(QString image1,QString image2);
112 void RemoveLink(QString image1,QString image2);
113 void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
115 ///Generic method called when any one of the horizontal sliders is moved
116 void HorizontalSliderMoved(int value,int column, int slicer_index);
117 void NOHorizontalSliderMoved();
118 void NEHorizontalSliderMoved();
119 void SOHorizontalSliderMoved();
120 void SEHorizontalSliderMoved();
122 void NOVerticalSliderChanged();
123 void NEVerticalSliderChanged();
124 void SOVerticalSliderChanged();
125 void SEVerticalSliderChanged();
127 void SaveNEScreenshot();
128 void SaveNOScreenshot();
129 void SaveSEScreenshot();
130 void SaveSOScreenshot();
132 void ShowContextMenu(QPoint point);
136 void SelectOverlayImage();
137 void SelectFusionImage();
139 void SetVFProperty(int subsampling,int scale,int lut, int width);
140 void SetOverlayProperty(int color);
141 void SetFusionProperty(int opacity,int colormap,double window,double level);
146 void ChangeFrameRate(int rate) {
149 void UpdateRenderWindows();
150 void UpdateMemoryUsage();
155 // std::vector<vvSlicerManager*> mSlicerManagers;
156 vvHelpDialog *help_dialog;
157 vvDocumentation *documentation;
158 vvDicomSeriesSelector *dicomSeriesSelector;
165 ///Adds a vector field to slicer manager index
166 void WarpImage(vvSlicerManager* selected_slicer,int reference_phase);
167 void AddFieldEntry(QString filename,int index,bool from_disk);
168 void AddField(vvImage::Pointer vf,QString file,int index);
170 ///Sets the render window and LUT for the last SlicerManager
172 void DisplaySliders(int slicer, int window);
173 QString GetSizeInBytes(unsigned long size);
174 QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
175 QString GetVectorIntAsString(std::vector<int> vectorInt);
176 int GetSlicerIndexFromItem(QTreeWidgetItem* item);
177 QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm);
178 void SaveScreenshot(vtkImageData* image);
179 int GetImageDuplicateFilenameNumber(std::string filename);
182 //QMenu *AddSubImageMenu;
183 std::vector<QAction*> contextActions;
184 std::vector<QSlider*> horizontalSliders;
185 std::vector<QSlider*> verticalSliders;
188 std::string mCurrentSelectedImageId;
190 // vvMainWindowToolInfo * mCurrentToolInfo;
191 // std::vector<vvToolCreatorBase*> mListOfRunningTool;
193 static vvMainWindow * mSingleton;
199 #include "vvMainWindow.txx"