NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
UndistortView.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 UndistortView_h
16 #define UndistortView_h
17 
18 #include <berryISelectionListener.h>
19 #include <niftkBaseView.h>
20 #include <service/event/ctkEvent.h>
21 #include "ui_UndistortViewControls.h"
22 #include <niftkUndistortion.h>
23 #include <map>
24 #include <string>
25 #include <QFuture>
26 #include <QFutureWatcher>
27 #include <mitkCameraIntrinsicsProperty.h>
28 #include <mitkImage.h>
29 
30 class UndistortView : public niftk::BaseView, public Ui::UndistortViewControls
31 {
32  // this is needed for all Qt objects that should have a Qt meta-object
33  // (everything that derives from QObject and wants to have signal/slots)
34  Q_OBJECT
35 
36 public:
37 
38  UndistortView();
39  virtual ~UndistortView();
40 
41  static const char* VIEW_ID;
42 
43  virtual void CreateQtPartControl(QWidget *parent) override;
44 
45  // from berry::WorkbenchPart
46  virtual void SetFocus() override;
47 
49  virtual void OnPreferencesChanged(const berry::IBerryPreferences*) override;
50 
51 protected:
52  void UpdateNodeTable();
53 
54  void WriteCurrentConfig(const QString& directory) const;
55 
56 signals:
58 
59 private slots:
60  void OnDeferredNodeTableUpdate();
61 
62  // called by m_NodeTable
63  void OnCellDoubleClicked(int row, int column);
64 
65  void OnGoButtonClick();
66 
70  void OnUpdate(const ctkEvent& event);
71 
73  void OnRecordingStarted(const ctkEvent& event);
74 
75  // we connect the future to this slot
76  void OnBackgroundProcessFinished();
77 
78 private:
79 
80  void DataStorageEventListener(const mitk::DataNode* node);
81 
83  void RetrievePreferenceValues();
84 
85  QString m_LastFile;
86  std::map<mitk::Image::Pointer, niftk::Undistortion*> m_UndistortionMap;
87  std::map<std::string, mitk::CameraIntrinsicsProperty::Pointer> m_ParamFileCache;
88 
89  niftk::UndistortionWorker m_BackgroundWorker;
90 
91  QFuture<void> m_BackgroundProcess;
92  QFutureWatcher<void> m_BackgroundProcessWatcher;
93 
94  // these are coming from the ctk event bus admin. we use them to explicitly unregister ourself.
95  qlonglong m_IGIUpdateSubscriptionID;
96  qlonglong m_IGIRecordingStartedSubscriptionID;
97 };
98 
99 #endif // UndistortView_h
UndistortView()
Definition: UndistortView.cxx:42
Definition: niftkUndistortion.h:171
virtual void OnPreferencesChanged(const berry::IBerryPreferences *) override
BlueBerry's notification about preference changes (e.g. from a preferences dialog).
Definition: UndistortView.cxx:679
virtual void CreateQtPartControl(QWidget *parent) override
Definition: UndistortView.cxx:627
void UpdateNodeTable()
Definition: UndistortView.cxx:122
void SignalDeferredNodeTableUpdate()
void WriteCurrentConfig(const QString &directory) const
Definition: UndistortView.cxx:248
GLenum GLenum GLvoid GLvoid * column
Definition: glew.h:4074
Base view component for plugins listening to visibility change events, focus changed events and so on...
Definition: niftkBaseView.h:47
virtual void SetFocus() override
Definition: UndistortView.cxx:673
virtual ~UndistortView()
Definition: UndistortView.cxx:53
GLenum GLenum GLvoid * row
Definition: glew.h:4074
Definition: UndistortView.h:30
cl_event event
Definition: glew.h:3231
static const char * VIEW_ID
Definition: UndistortView.h:41