]> Creatis software - clitk.git/blob - vv/vvMainWindow.h
removed headers
[clitk.git] / vv / vvMainWindow.h
1 #ifndef vvMainWindow_h
2 #define vvMainWindow_h
3 #include <iostream>
4 #include <vector>
5
6 #include "ui_vvMainWindow.h"
7 #include "vvMainWindowBase.h"
8 #include "vvToolManager.h"
9 #include "vvConstants.h"
10 #include "vvMesh.h"
11
12 class vvSlicerManager;
13 class vvHelpDialog;
14 class vvDocumentation;
15 class vtkRenderWindowInteractor;
16 class vtkImageData;
17 class vtkRenderer;
18 class vvDicomSeriesSelector;
19
20 //------------------------------------------------------------------------------
21 class vvMainWindow: public vvMainWindowBase,
22                     private Ui::vvMainWindow
23 {
24   Q_OBJECT
25
26   public:
27   vvMainWindow();
28   ~vvMainWindow();
29   void LoadImages(std::vector<std::string> filenames, LoadedImageType type);
30   void AddImage(vvImage::Pointer image,std::string filename);
31   void AddImage(vvSlicerManager * m);
32   void AddField(QString file,int index);
33   void AddOverlayImage(int index, QString filename);
34   ///Adds a mesh to a SlicerManager, with optional warping by vector field
35   void AddContour(int image_index, vvMesh::Pointer contour, bool propagation);
36   ///This is used to show an image when opened or computed
37   void ShowLastImage();
38
39   virtual void UpdateCurrentSlicer();
40   //vvMainWindowToolInfo * GetInfoForTool();
41 //   void AddRunningTool(vvToolCreatorBase * tool);
42
43 public slots:
44   ///Allows the user to open and select various surfaces contained in a dicom-struct file
45   void OpenDCStructContour();
46   ///Computes the MIP of the currently selected image and displays it
47   void ComputeMIP();
48   ///Computes the midposition image of a 4D sequence with a VF and displays it
49   void ComputeMidPosition();
50   void OpenImages();
51   ///Slot triggered by the dynamically-generated recent file menu actions
52   void OpenRecentImage();
53   void OpenImageWithTime();
54   void MergeImages();
55   void MergeImagesWithTime();
56   void OpenDicom();
57   ///Open a vtkPolyData surface mesh and display it over the current image
58   void OpenVTKContour();
59   void SaveAs();
60   void CurrentImageChanged(std::string id);
61   void ImageInfoChanged();
62   void ShowHelpDialog();
63   void ShowDocumentation();
64   void ComputeDeformableRegistration();
65   void WarpImage();
66   void ChangeViewMode();
67   void DisplayChanged(QTreeWidgetItem *item, int column);
68   void CloseImage(QTreeWidgetItem* item, int column);
69   void ReloadImage(QTreeWidgetItem* item, int column);
70   void MousePositionChanged(int visibility, double x, double y, double z, double X, double Y, double Z , double value);
71   void VectorChanged(int visibility, double x, double y, double z, double value);
72   void OverlayChanged(int visibility, double valueOver, double valueRef);
73   void FusionChanged(int visibility, double value);
74   void ResampleCurrentImage();
75   void SegmentationOnCurrentImage();
76   void SurfaceViewerLaunch();
77
78   void WindowsChanged(int window, int view, int slice);
79   void WindowLevelChanged(double window, double level,int preset, int colormap);
80   void UpdateSlice(int slicer, int slice);
81   void UpdateTSlice(int slicer, int slice);
82   void UpdateSliceRange(int slicer, int min, int max, int tmin, int tmax);
83   void WindowLevelEdited();
84   void UpdateColorMap();
85   void UpdateWindowLevel();
86   void SwitchWindowLevel();
87   void UpdateLinkManager(std::string id, int slicer, double x, double y, double z, int temps);
88   void AddLink(QString image1,QString image2);
89   void RemoveLink(QString image1,QString image2);
90
91   ///Generic method called when any one of the horizontal sliders is moved
92   void HorizontalSliderMoved(int value,int column, int slicer_index);
93   void NOHorizontalSliderMoved();
94   void NEHorizontalSliderMoved();
95   void SOHorizontalSliderMoved();
96   void SEHorizontalSliderMoved();
97
98   void NOVerticalSliderChanged();
99   void NEVerticalSliderChanged();
100   void SOVerticalSliderChanged();
101   void SEVerticalSliderChanged();
102
103   void SaveNEScreenshot();
104   void SaveNOScreenshot();
105   void SaveSEScreenshot();
106   void SaveSOScreenshot();
107
108   void ShowContextMenu(QPoint point);
109   //  void CropImage();
110   void SplitImage();
111   void CloseImage();
112   void ReloadImage();
113   void OpenField();
114   void SelectOverlayImage();
115   void AddFusionImage();
116
117   void SetVFProperty(int subsampling,int scale,int lut);
118   void SetOverlayProperty(int color);
119   void SetFusionProperty(int opacity,int colormap,double window,double level);
120
121   void GoToCursor();
122   void PlayPause();
123   void PlayNext();
124   void ChangeFrameRate(int rate) {
125     mFrameRate = rate;
126   }
127   void UpdateRenderWindows();
128
129 // signals:
130 //   void SlicerManagersHasChanged();
131
132 private:
133
134   //variables
135   // std::vector<vvSlicerManager*> mSlicerManagers;
136   vvHelpDialog *help_dialog;
137   vvDocumentation *documentation;
138   vvDicomSeriesSelector *dicomSeriesSelector;
139
140   QString mInputPathName;
141   bool viewMode;
142   bool playMode;
143
144   //functions
145   void UpdateTree();
146   ///Adds a vector field to slicer manager index
147   void WarpImage(vvSlicerManager* selected_slicer,int reference_phase);
148   void AddFieldEntry(QString filename,int index,bool from_disk);
149   void AddField(vvImage::Pointer vf,QString file,int index);
150   void InitDisplay();
151   ///Sets the render window and LUT for the last SlicerManager
152   void InitSlicers();
153   void DisplaySliders(int slicer, int window);
154   QString GetSizeInBytes(unsigned long size);
155   QString GetVectorDoubleAsString(std::vector<double> vectorDouble);
156   QString GetVectorIntAsString(std::vector<int> vectorInt);
157   int GetSlicerIndexFromItem(QTreeWidgetItem* item);
158   void SaveScreenshot(vtkImageData* image);
159
160   QMenu contextMenu;
161   //QMenu *AddSubImageMenu;
162   std::vector<QAction*> contextActions;
163   std::vector<QSlider*> horizontalSliders;
164   std::vector<QSlider*> verticalSliders;
165   int mFrameRate;
166
167   // vvMainWindowToolInfo * mCurrentToolInfo;
168   // std::vector<vvToolCreatorBase*> mListOfRunningTool;
169
170   static vvMainWindow * mSingleton;
171 };
172
173 #include "vvMainWindow.txx"
174
175 #endif