Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkStructureSensorParameterWidget.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
15 const std::string QmitkStructureSensorParameterWidget::VIEW_ID = "org.mitk.views.qmitkStructureSensorparameterwidget";
16 
18 {
19  m_ToFImageGrabber = nullptr;
20  m_Controls = nullptr;
21  CreateQtPartControl(this);
22 }
23 
25 {
26 }
27 
29 {
30  if (!m_Controls)
31  {
32  // create GUI widgets
33  m_Controls = new Ui::QmitkStructureSensorParameterWidgetControls;
34  m_Controls->setupUi(parent);
35 
36  this->CreateConnections();
37  }
38 }
39 
41 {
42  if ( m_Controls )
43  {
44  connect( m_Controls->m_640, SIGNAL(toggled(bool)), this, SLOT(OnResolutionChanged()) );
45  connect( m_Controls->m_320, SIGNAL(toggled(bool)), this, SLOT(OnResolutionChanged()) );
46  }
47 }
48 
50 {
51  return this->m_ToFImageGrabber;
52 }
53 
55 {
56  this->m_ToFImageGrabber = aToFImageGrabber;
57 }
58 
60 {
61  this->OnResolutionChanged();
62 }
63 
65 {
66  if (m_ToFImageGrabber.IsNotNull())
67  {
68  if (!m_ToFImageGrabber->IsCameraConnected())
69  {
70  //for know depth and RGB resolution is the same, but this could be different in future
71  this->m_ToFImageGrabber->SetIntProperty("RGBResolution", GetSelectedResolution());
72  this->m_ToFImageGrabber->SetIntProperty("DepthResolution", GetSelectedResolution());
73  }
74  else
75  {
76  MITK_WARN << "Structure Sensor resolution cannot be changed, if the device is connected. Please disconnect first.";
77  }
78  }
79 }
80 
82 {
83  if(m_Controls->m_640->isChecked())
84  {
85  return 640;
86  }
87  else if(m_Controls->m_320->isChecked())
88  {
89  return 320;
90  }
91  else
92  {
93  MITK_ERROR << "Unsupported structure sensor resolution!";
94  return -1;
95  }
96 }
QmitkStructureSensorParameterWidget(QWidget *p=nullptr, Qt::WindowFlags f=nullptr)
#define MITK_ERROR
Definition: mitkLogMacros.h:20
mitk::ToFImageGrabber::Pointer m_ToFImageGrabber
image grabber object to be configured by the widget
mitk::ToFImageGrabber * GetToFImageGrabber()
returns the ToFImageGrabber
void SetToFImageGrabber(mitk::ToFImageGrabber *aToFImageGrabber)
sets the ToFImageGrabber
#define MITK_WARN
Definition: mitkLogMacros.h:19
void OnResolutionChanged()
OnResolutionChanged called when the resolution combobox is changed.
int GetSelectedResolution()
GetSelectedResolution getter for 640/320 resolution.
void ActivateAllParameters()
activate camera settings according to the parameters from GUI
Image source providing ToF images. Interface for filters provided in ToFProcessing module...
Ui::QmitkStructureSensorParameterWidgetControls * m_Controls
member holding the UI elements of this widget