Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkToFMESAParameterWidget.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 //#define _USE_MATH_DEFINES
19 
20 //QT headers
21 #include <qmessagebox.h>
22 #include <qfiledialog.h>
23 #include <qcombobox.h>
24 
25 //itk headers
26 #include <itksys/SystemTools.hxx>
27 
28 const std::string QmitkToFMESAParameterWidget::VIEW_ID = "org.mitk.views.qmitktofpmdparameterwidget";
29 
30 QmitkToFMESAParameterWidget::QmitkToFMESAParameterWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f)
31 {
32  this->m_IntegrationTime = 0;
33  this->m_ModulationFrequency = 0;
34  this->m_ToFImageGrabber = NULL;
35 
36  m_Controls = NULL;
37  CreateQtPartControl(this);
38 }
39 
41 {
42 }
43 
45 {
46  if (!m_Controls)
47  {
48  // create GUI widgets
49  m_Controls = new Ui::QmitkToFMESAParameterWidgetControls;
50  m_Controls->setupUi(parent);
51  this->CreateConnections();
52  }
53 }
54 
56 {
57  if ( m_Controls )
58  {
59  connect( m_Controls->m_IntegrationTimeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnChangeIntegrationTimeSpinBox(int)) );
60  connect( m_Controls->m_ModulationFrequencyComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeModulationFrequencyComboBox(int)) );
61  connect( m_Controls->m_FPNCB, SIGNAL(toggled(bool)), this, SLOT(OnChangeFPNCheckBox(bool)) );
62  connect( m_Controls->m_ConvGrayCB, SIGNAL(toggled(bool)), this, SLOT(OnChangeConvGrayCheckBox(bool)) );
63  connect( m_Controls->m_MedianCB, SIGNAL(toggled(bool)), this, SLOT(OnChangeMedianCheckBox(bool)) );
64  connect( m_Controls->m_ANFCB, SIGNAL(toggled(bool)), this, SLOT(OnChangeANFCheckBox(bool)) );
65  }
66 }
67 
69 {
70  return this->m_ToFImageGrabber;
71 }
72 
74 {
75  this->m_ToFImageGrabber = aToFImageGrabber;
76 }
77 
79 {
80  this->m_IntegrationTime = m_Controls->m_IntegrationTimeSpinBox->value();
82 
83  switch(m_Controls->m_ModulationFrequencyComboBox->currentIndex())
84  {
85  case 0: this->m_ModulationFrequency = 29; break;
86  case 1: this->m_ModulationFrequency = 30; break;
87  case 2: this->m_ModulationFrequency = 31; break;
88  default: this->m_ModulationFrequency = 30; break;
89  }
91 
92  //set the MESA acquire mode according to the check boxes
93  bool boolValue = false;
94  boolValue = m_Controls->m_FPNCB->isChecked();
95  this->m_ToFImageGrabber->SetBoolProperty("SetFPN", boolValue);
96  boolValue = m_Controls->m_ConvGrayCB->isChecked();
97  this->m_ToFImageGrabber->SetBoolProperty("SetConvGray", boolValue);
98  boolValue = m_Controls->m_MedianCB->isChecked();
99  this->m_ToFImageGrabber->SetBoolProperty("SetMedian", boolValue);
100  boolValue = m_Controls->m_ANFCB->isChecked();
101  this->m_ToFImageGrabber->SetBoolProperty("SetANF", boolValue);
102 
103  //reset the GUI elements
104  m_Controls->m_IntegrationTimeSpinBox->setValue(this->m_IntegrationTime);
105  //m_Controls->m_ModulationFrequencyComboBox->setValue(this->m_ModulationFrequency);
106 }
107 
109 {
110  this->m_ToFImageGrabber->SetBoolProperty("SetFPN", checked);
111 }
112 
114 {
115  this->m_ToFImageGrabber->SetBoolProperty("SetConvGray", checked);
116 }
117 
119 {
120  this->m_ToFImageGrabber->SetBoolProperty("SetMedian", checked);
121 }
122 
124 {
125  this->m_ToFImageGrabber->SetBoolProperty("SetANF", checked);
126 }
127 
129 {
130  if (this->m_ToFImageGrabber != NULL)
131  {
132  // stop camera if active
133  bool active = m_ToFImageGrabber->IsCameraActive();
134  if (active)
135  {
137  }
138  this->m_IntegrationTime = m_Controls->m_IntegrationTimeSpinBox->value();
140  if (active)
141  {
143  }
144  }
145 }
146 
148 {
149  if (this->m_ToFImageGrabber != NULL)
150  {
151  // stop camera if active
152  bool active = m_ToFImageGrabber->IsCameraActive();
153  if (active)
154  {
156  }
157  switch(index)
158  {
159  case 0: this->m_ModulationFrequency = 29; break;
160  case 1: this->m_ModulationFrequency = 30; break;
161  case 2: this->m_ModulationFrequency = 31; break;
162  default: this->m_ModulationFrequency = 30; break;
163  }
165  if (active)
166  {
168  }
169  }
170 }
171 
virtual void StopCamera()
Stops the continuous updating of the camera.
int SetIntegrationTime(int integrationTime)
Set the integration time used by the ToF camera. For default values see the corresponding device clas...
virtual bool IsCameraActive()
Returns true if the camera is connected and started.
virtual void CreateQtPartControl(QWidget *parent)
void OnChangeModulationFrequencyComboBox(int index)
slot updating the member m_ModulationFrequency and the parameter "modulation frequency" of the curren...
int m_IntegrationTime
member for the current integration time of the ToF device
virtual void StartCamera()
Starts the continuous updating of the camera. A separate thread updates the source data...
void SetBoolProperty(const char *propertyKey, bool boolValue)
void ActivateAllParameters()
activate camera settings according to the parameters from GUI
mitk::ToFImageGrabber * GetToFImageGrabber()
returns the ToFImageGrabber which was configured after selecting a camera / player ...
int SetModulationFrequency(int modulationFrequency)
Set the modulation frequency used by the ToF camera. For default values see the corresponding device ...
QmitkToFMESAParameterWidget(QWidget *p=0, Qt::WindowFlags f1=0)
void SetToFImageGrabber(mitk::ToFImageGrabber *aToFImageGrabber)
sets the ToFImageGrabber which was configured after selecting a camera / player
Image source providing ToF images. Interface for filters provided in ToFProcessing module...
mitk::ToFImageGrabber * m_ToFImageGrabber
member holding the current ToFImageGrabber
void OnChangeIntegrationTimeSpinBox(int value)
slot updating the member m_IntegrationTime and the parameter "integration time" of the current ToFIma...
Ui::QmitkToFMESAParameterWidgetControls * m_Controls
member holding the UI elements of this widget
int m_ModulationFrequency
member for the current modulation frequency of the ToF device