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://www.centreleonberard.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 "vvImageReader.h"
29 #include "clitkMemoryUsage.h"
31 #include "vtkSmartPointer.h"
34 class vvSlicerManager;
36 class vvDocumentation;
37 class vtkRenderWindowInteractor;
41 class vvDicomSeriesSelector;
44 //------------------------------------------------------------------------------
45 class vvMainWindow: public vvMainWindowBase,
46 private Ui::vvMainWindow
53 void LoadImages(std::vector<std::string> filenames, vvImageReader::LoadedImageType type);
54 vvSlicerManager * AddImage(vvImage::Pointer image,std::string filename);
55 void AddField(QString file,int index);
56 void AddOverlayImage(int index, QString filename);
57 void AddFusionImage(int index, QString filename);
58 void AddROI(int index, QString filename);
59 ///Adds a mesh to a SlicerManager, with optional warping by vector field
60 void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
61 ///This is used to show an image when opened or computed
64 virtual void UpdateCurrentSlicer();
65 virtual QTabWidget * GetTab();
66 //vvMainWindowToolInfo * GetInfoForTool();
67 // void AddRunningTool(vvToolCreatorBase * tool);
70 ///Allows the user to open and select various surfaces contained in a dicom-struct file
71 void OpenDCStructContour();
72 ///Computes the midposition image of a 4D sequence with a VF and displays it
73 void ComputeMidPosition();
75 ///Slot triggered by the dynamically-generated recent file menu actions
76 void OpenRecentImage();
77 void OpenImageWithTime();
80 void MergeImagesWithTime();
82 ///Open a vtkPolyData surface mesh and display it over the current image
83 void OpenVTKContour();
85 void CurrentImageChanged(std::string id);
86 void CurrentPickedImageChanged(std::string id);
87 void ImageInfoChanged();
88 void ShowHelpDialog();
89 void ShowDocumentation();
90 void PopupRegisterForm(bool checkCanPush=false);
91 void ComputeDeformableRegistration();
93 void ChangeViewMode();
94 void DisplayChanged(QTreeWidgetItem *item, int column);
95 void CloseImage(QTreeWidgetItem* item, int column);
96 void ReloadImage(QTreeWidgetItem* item, int column);
97 void MousePositionChanged(int visibility, double x, double y, double z, double X, double Y, double Z , double value);
98 void VectorChanged(int visibility, double x, double y, double z, double value);
99 void OverlayChanged(int visibility, double valueOver, double valueRef);
100 void FusionChanged(int visibility, double value);
101 void SegmentationOnCurrentImage();
102 void SurfaceViewerLaunch();
104 void WindowLevelChanged();
105 void UpdateSlice(int slicer, int slice);
106 void UpdateTSlice(int slicer, int slice);
107 void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
108 void WindowLevelEdited();
109 void SetWindowLevel(double w, double l);
110 void UpdateColorMap();
111 void UpdateWindowLevel();
112 void SwitchWindowLevel();
113 void ApplyWindowLevelToAllImages();
114 void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
115 void UpdateLinkedNavigation(std::string id, vvSlicerManager *sm, vvSlicer* refSlicer);
116 void AddLink(QString image1,QString image2);
117 void RemoveLink(QString image1,QString image2);
118 void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
120 ///Generic method called when any one of the horizontal sliders is moved
121 void HorizontalSliderMoved(int value,int column, int slicer_index);
122 void NOHorizontalSliderMoved();
123 void NEHorizontalSliderMoved();
124 void SOHorizontalSliderMoved();
125 void SEHorizontalSliderMoved();
127 void NOVerticalSliderChanged();
128 void NEVerticalSliderChanged();
129 void SOVerticalSliderChanged();
130 void SEVerticalSliderChanged();
132 void SaveNEScreenshot();
133 void SaveNOScreenshot();
134 void SaveSEScreenshot();
135 void SaveSOScreenshot();
136 void SaveScreenshotAllSlices();
138 void ShowContextMenu(QPoint point);
142 void SelectOverlayImage();
143 void SelectFusionImage();
144 void ResetTransformationToIdentity();
146 void SetVFProperty(int subsampling,int scale,int lut, int width, double r, double g, double b);
147 void SetOverlayProperty(int color, int linked, double window, double level);
148 void SetFusionProperty(int opacity, int tresOpacity, int colormap,double window,double level);
153 void ChangeFrameRate(int rate) {
156 void UpdateRenderWindows();
157 void UpdateMemoryUsage();
162 void createRecentlyOpenedFilesMenu();
163 void updateRecentlyOpenedFilesMenu(const std::list<std::string> &files);
168 // std::vector<vvSlicerManager*> mSlicerManagers;
169 vvHelpDialog *help_dialog;
170 vvDocumentation *documentation;
171 vvDicomSeriesSelector *dicomSeriesSelector;
178 ///Adds a vector field to slicer manager index
179 void WarpImage(vvSlicerManager* selected_slicer,int reference_phase);
180 void AddFieldEntry(QString filename,int index,bool from_disk);
181 void AddField(vvImage::Pointer vf,QString file,int index);
183 ///Sets the render window and LUT for the last SlicerManager
185 void DisplaySliders(int slicer, int window);
186 QString GetSizeInBytes(unsigned long size);
187 QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
188 QString GetVectorIntAsString(std::vector<int> vectorInt);
189 QString Get4x4MatrixDoubleAsString(vtkSmartPointer<vtkMatrix4x4> matrix);
190 int GetSlicerIndexFromItem(QTreeWidgetItem* item);
191 QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm);
192 void SaveScreenshot(QVTKWidget *widget);
193 int GetImageDuplicateFilenameNumber(std::string filename);
196 QMenu* recentlyOpenedFilesMenu;
197 //QMenu *AddSubImageMenu;
198 std::vector<QAction*> contextActions;
199 std::vector<QSlider*> horizontalSliders;
200 std::vector<QSlider*> verticalSliders;
203 std::string mCurrentSelectedImageId;
204 std::string mCurrentPickedImageId;
205 unsigned int mCurrentPickedImageIndex;
207 // vvMainWindowToolInfo * mCurrentToolInfo;
208 // std::vector<vvToolCreatorBase*> mListOfRunningTool;
210 static vvMainWindow * mSingleton;