MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
QmitkToFMESAParameterWidget.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
13//#define _USE_MATH_DEFINES
15
16//QT headers
17#include <qmessagebox.h>
18#include <qfiledialog.h>
19#include <qcombobox.h>
20
21//itk headers
22#include <itksys/SystemTools.hxx>
23
24const std::string QmitkToFMESAParameterWidget::VIEW_ID = "org.mitk.views.qmitktofpmdparameterwidget";
25
26QmitkToFMESAParameterWidget::QmitkToFMESAParameterWidget(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f)
27{
28 this->m_IntegrationTime = 0;
29 this->m_ModulationFrequency = 0;
30 this->m_ToFImageGrabber = nullptr;
31
32 m_Controls = nullptr;
34}
35
39
41{
42 if (!m_Controls)
43 {
44 // create GUI widgets
45 m_Controls = new Ui::QmitkToFMESAParameterWidgetControls;
46 m_Controls->setupUi(parent);
47 this->CreateConnections();
48 }
49}
50
52{
53 if ( m_Controls )
54 {
55 connect( m_Controls->m_IntegrationTimeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnChangeIntegrationTimeSpinBox(int)) );
56 connect( m_Controls->m_ModulationFrequencyComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(OnChangeModulationFrequencyComboBox(int)) );
57 connect( m_Controls->m_FPNCB, SIGNAL(toggled(bool)), this, SLOT(OnChangeFPNCheckBox(bool)) );
58 connect( m_Controls->m_ConvGrayCB, SIGNAL(toggled(bool)), this, SLOT(OnChangeConvGrayCheckBox(bool)) );
59 connect( m_Controls->m_MedianCB, SIGNAL(toggled(bool)), this, SLOT(OnChangeMedianCheckBox(bool)) );
60 connect( m_Controls->m_ANFCB, SIGNAL(toggled(bool)), this, SLOT(OnChangeANFCheckBox(bool)) );
61 }
62}
63
68
70{
71 this->m_ToFImageGrabber = aToFImageGrabber;
72}
73
75{
76 this->m_IntegrationTime = m_Controls->m_IntegrationTimeSpinBox->value();
78
79 switch(m_Controls->m_ModulationFrequencyComboBox->currentIndex())
80 {
81 case 0: this->m_ModulationFrequency = 29; break;
82 case 1: this->m_ModulationFrequency = 30; break;
83 case 2: this->m_ModulationFrequency = 31; break;
84 default: this->m_ModulationFrequency = 30; break;
85 }
87
88 //set the MESA acquire mode according to the check boxes
89 bool boolValue = false;
90 boolValue = m_Controls->m_FPNCB->isChecked();
91 this->m_ToFImageGrabber->SetBoolProperty("SetFPN", boolValue);
92 boolValue = m_Controls->m_ConvGrayCB->isChecked();
93 this->m_ToFImageGrabber->SetBoolProperty("SetConvGray", boolValue);
94 boolValue = m_Controls->m_MedianCB->isChecked();
95 this->m_ToFImageGrabber->SetBoolProperty("SetMedian", boolValue);
96 boolValue = m_Controls->m_ANFCB->isChecked();
97 this->m_ToFImageGrabber->SetBoolProperty("SetANF", boolValue);
98
99 //reset the GUI elements
100 m_Controls->m_IntegrationTimeSpinBox->setValue(this->m_IntegrationTime);
101 //m_Controls->m_ModulationFrequencyComboBox->setValue(this->m_ModulationFrequency);
102}
103
105{
106 this->m_ToFImageGrabber->SetBoolProperty("SetFPN", checked);
107}
108
110{
111 this->m_ToFImageGrabber->SetBoolProperty("SetConvGray", checked);
112}
113
115{
116 this->m_ToFImageGrabber->SetBoolProperty("SetMedian", checked);
117}
118
120{
121 this->m_ToFImageGrabber->SetBoolProperty("SetANF", checked);
122}
123
125{
126 if (this->m_ToFImageGrabber != nullptr)
127 {
128 // stop camera if active
129 bool active = m_ToFImageGrabber->IsCameraActive();
130 if (active)
131 {
133 }
134 this->m_IntegrationTime = m_Controls->m_IntegrationTimeSpinBox->value();
136 if (active)
137 {
139 }
140 }
141}
142
144{
145 if (this->m_ToFImageGrabber != nullptr)
146 {
147 // stop camera if active
148 bool active = m_ToFImageGrabber->IsCameraActive();
149 if (active)
150 {
152 }
153 switch(index)
154 {
155 case 0: this->m_ModulationFrequency = 29; break;
156 case 1: this->m_ModulationFrequency = 30; break;
157 case 2: this->m_ModulationFrequency = 31; break;
158 default: this->m_ModulationFrequency = 30; break;
159 }
161 if (active)
162 {
164 }
165 }
166}
167
void OnChangeIntegrationTimeSpinBox(int value)
slot updating the member m_IntegrationTime and the parameter "integration time" of the current ToFIma...
QmitkToFMESAParameterWidget(QWidget *p=nullptr, Qt::WindowFlags f1={})
int m_IntegrationTime
member for the current integration time of the ToF device
void OnChangeModulationFrequencyComboBox(int index)
slot updating the member m_ModulationFrequency and the parameter "modulation frequency" of the curren...
int m_ModulationFrequency
member for the current modulation frequency of the ToF device
Ui::QmitkToFMESAParameterWidgetControls * m_Controls
member holding the UI elements of this widget
mitk::ToFImageGrabber * GetToFImageGrabber()
returns the ToFImageGrabber which was configured after selecting a camera / player
mitk::ToFImageGrabber * m_ToFImageGrabber
member holding the current ToFImageGrabber
void SetToFImageGrabber(mitk::ToFImageGrabber *aToFImageGrabber)
sets the ToFImageGrabber which was configured after selecting a camera / player
virtual void CreateQtPartControl(QWidget *parent)
void ActivateAllParameters()
activate camera settings according to the parameters from GUI
Image source providing ToF images. Interface for filters provided in ToFProcessing module.
virtual void StopCamera()
Stops the continuous updating of the camera.
int SetModulationFrequency(int modulationFrequency)
Set the modulation frequency used by the ToF camera. For default values see the corresponding device ...
void SetBoolProperty(const char *propertyKey, bool boolValue)
int SetIntegrationTime(int integrationTime)
Set the integration time used by the ToF camera. For default values see the corresponding device clas...
virtual void StartCamera()
Starts the continuous updating of the camera. A separate thread updates the source data,...
virtual bool IsCameraActive()
Returns true if the camera is connected and started.