]> Creatis software - clitk.git/blob - vv/vvMainWindow.h
- default window level for [0:1] binary image
[clitk.git] / vv / vvMainWindow.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
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
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ======================================================================-====*/
18
19 #ifndef VVMAINWINDOW_H
20 #define VVMAINWINDOW_H
21
22 #include <iostream>
23 #include <vector>
24 #include "ui_vvMainWindow.h"
25 #include "vvMainWindowBase.h"
26 #include "vvToolManager.h"
27 #include "vvConstants.h"
28 #include "vvMesh.h"
29
30 class vvSlicerManager;
31 class vvHelpDialog;
32 class vvDocumentation;
33 class vtkRenderWindowInteractor;
34 class vtkImageData;
35 class vtkRenderer;
36 class vvDicomSeriesSelector;
37
38 //------------------------------------------------------------------------------
39 class vvMainWindow: public vvMainWindowBase,
40                     private Ui::vvMainWindow
41 {
42   Q_OBJECT
43
44   public:
45   vvMainWindow();
46   ~vvMainWindow();
47   void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
48   void AddImage(vvImage::Pointer image,std::string filename);
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
54   void ShowLastImage();
55
56   virtual void UpdateCurrentSlicer();
57   //vvMainWindowToolInfo * GetInfoForTool();
58 //   void AddRunningTool(vvToolCreatorBase * tool);
59
60 public slots:
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
64   void ComputeMIP();
65   ///Computes the midposition image of a 4D sequence with a VF and displays it
66   void ComputeMidPosition();
67   void OpenImages();
68   ///Slot triggered by the dynamically-generated recent file menu actions
69   void OpenRecentImage();
70   void OpenImageWithTime();
71   void MergeImages();
72   void MergeImagesWithTime();
73   void OpenDicom();
74   ///Open a vtkPolyData surface mesh and display it over the current image
75   void OpenVTKContour();
76   void SaveAs();
77   void CurrentImageChanged(std::string id);
78   void ImageInfoChanged();
79   void ShowHelpDialog();
80   void ShowDocumentation();
81   void ComputeDeformableRegistration();
82   void WarpImage();
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 SegmentationOnCurrentImage();
92   void SurfaceViewerLaunch();
93
94   void WindowsChanged(int window, int view, int slice);
95   void WindowLevelChanged(double window, double level,int preset, int colormap);
96   void UpdateSlice(int slicer, int slice);
97   void UpdateTSlice(int slicer, int slice);
98   void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
99   void WindowLevelEdited();
100   void UpdateColorMap();
101   void UpdateWindowLevel();
102   void SwitchWindowLevel();
103   void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
104   void AddLink(QString image1,QString image2);
105   void RemoveLink(QString image1,QString image2);
106   void ChangeImageWithIndexOffset(vvSlicerManager *sm, int slicer, int offset);
107
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();
114
115   void NOVerticalSliderChanged();
116   void NEVerticalSliderChanged();
117   void SOVerticalSliderChanged();
118   void SEVerticalSliderChanged();
119
120   void SaveNEScreenshot();
121   void SaveNOScreenshot();
122   void SaveSEScreenshot();
123   void SaveSOScreenshot();
124
125   void ShowContextMenu(QPoint point);
126   //  void CropImage();
127   void SplitImage();
128   void CloseImage();
129   void ReloadImage();
130   void OpenField();
131   void SelectOverlayImage();
132   void AddFusionImage();
133
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);
137
138   void GoToCursor();
139   void PlayPause();
140   void PlayNext();
141   void ChangeFrameRate(int rate) {
142     mFrameRate = rate;
143   }
144   void UpdateRenderWindows();
145
146 private:
147
148   //variables
149   // std::vector<vvSlicerManager*> mSlicerManagers;
150   vvHelpDialog *help_dialog;
151   vvDocumentation *documentation;
152   vvDicomSeriesSelector *dicomSeriesSelector;
153
154   bool viewMode;
155   bool playMode;
156
157   //functions
158   void UpdateTree();
159   ///Adds a vector field to slicer manager index
160   void WarpImage(vvSlicerManager* selected_slicer,int reference_phase);
161   void AddFieldEntry(QString filename,int index,bool from_disk);
162   void AddField(vvImage::Pointer vf,QString file,int index);
163   void InitDisplay();
164   ///Sets the render window and LUT for the last SlicerManager
165   void InitSlicers();
166   void DisplaySliders(int slicer, int window);
167   QString GetSizeInBytes(unsigned long size);
168   QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
169   QString GetVectorIntAsString(std::vector<int> vectorInt);
170   int GetSlicerIndexFromItem(QTreeWidgetItem* item);
171   QTreeWidgetItem* GetItemFromSlicerManager(vvSlicerManager* sm);
172   void SaveScreenshot(vtkImageData* image);
173
174   QMenu contextMenu;
175   //QMenu *AddSubImageMenu;
176   std::vector<QAction*> contextActions;
177   std::vector<QSlider*> horizontalSliders;
178   std::vector<QSlider*> verticalSliders;
179   int mFrameRate;
180
181   // vvMainWindowToolInfo * mCurrentToolInfo;
182   // std::vector<vvToolCreatorBase*> mListOfRunningTool;
183
184   static vvMainWindow * mSingleton;
185
186   int mCurrentTime;
187
188 };
189
190 #include "vvMainWindow.txx"
191
192 #endif