NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkCameraCalView.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkCameraCalView_h
16 #define niftkCameraCalView_h
17 
18 #include <niftkBaseView.h>
19 #include <service/event/ctkEvent.h>
20 #include "ui_niftkCameraCalView.h"
22 #include <QFuture>
23 #include <QFutureWatcher>
24 #include <ctkDictionary.h>
25 
26 namespace niftk
27 {
28 
34 class CameraCalView : public BaseView
35 {
40  Q_OBJECT
41 
42 public:
43 
44  CameraCalView();
45  virtual ~CameraCalView();
46 
50  static const std::string VIEW_ID;
51 
56  virtual std::string GetViewID() const;
57 
58 protected:
59 
63  virtual void CreateQtPartControl(QWidget *parent) override;
64 
68  virtual void SetFocus() override;
69 
70 protected slots:
71 
73  void OnGrab(const ctkEvent& event);
74  void OnUnGrab(const ctkEvent& event);
75  void OnClear(const ctkEvent& event);
76 
78  void OnUpdate(const ctkEvent& event);
79 
80 protected:
81 
82 signals:
83 
84  void PauseIGIUpdate(const ctkDictionary&);
85  void RestartIGIUpdate(const ctkDictionary&);
86 
87 private slots:
88 
89  void OnGrabButtonPressed();
90  void OnUnGrabButtonPressed();
91  void OnClearButtonPressed();
92  void OnSaveButtonPressed();
93  void OnBackgroundGrabProcessFinished();
94  void OnBackgroundCalibrateProcessFinished();
95 
103  void OnComboBoxChanged();
104 
105 private:
106 
107  bool RunGrab();
108  void Calibrate();
109  double RunCalibration();
110 
111  void SetButtonsEnabled(bool isEnabled);
112 
116  void RetrievePreferenceValues();
117 
121  virtual void OnPreferencesChanged(const berry::IBerryPreferences*) override;
122 
123  Ui::CameraCalView *m_Controls;
124  niftk::NiftyCalVideoCalibrationManager::Pointer m_Manager;
125  QFuture<bool> m_BackgroundGrabProcess;
126  QFutureWatcher<bool> m_BackgroundGrabProcessWatcher;
127  QFuture<double> m_BackgroundCalibrateProcess;
128  QFutureWatcher<double> m_BackgroundCalibrateProcessWatcher;
129  QString m_DefaultSaveDirectory;
130 };
131 
132 } // end namespace
133 
134 #endif
virtual std::string GetViewID() const
Returns the view ID.
Definition: niftkCameraCalView.cxx:78
virtual ~CameraCalView()
Definition: niftkCameraCalView.cxx:51
void RestartIGIUpdate(const ctkDictionary &)
void OnClear(const ctkEvent &event)
Definition: niftkCameraCalView.cxx:379
void OnUnGrab(const ctkEvent &event)
Definition: niftkCameraCalView.cxx:369
CameraCalView()
Definition: niftkCameraCalView.cxx:38
static const std::string VIEW_ID
Static view ID = uk.ac.ucl.cmic.igicameracal.
Definition: niftkCameraCalView.h:50
virtual void CreateQtPartControl(QWidget *parent) override
Called by framework, this method creates all the controls for this view.
Definition: niftkCameraCalView.cxx:85
User interface to provide controls to do mono/stereo, video camera calibration.
Definition: niftkCameraCalView.h:34
Base view component for plugins listening to visibility change events, focus changed events and so on...
Definition: niftkBaseView.h:47
void OnGrab(const ctkEvent &event)
Definition: niftkCameraCalView.cxx:359
cl_event event
Definition: glew.h:3231
void OnUpdate(const ctkEvent &event)
Definition: niftkCameraCalView.cxx:389
void PauseIGIUpdate(const ctkDictionary &)
Definition: niftkExceptionObject.h:21
GLsizei const GLcharARB ** string
Definition: glew.h:5194
virtual void SetFocus() override
Called by framework, sets the focus on a specific widget.
Definition: niftkCameraCalView.cxx:274