Medical Imaging Interaction Toolkit  2016.11.0
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,
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 
18 
19 const std::string QmitkStructureSensorParameterWidget::VIEW_ID = "org.mitk.views.qmitkStructureSensorparameterwidget";
20 
22 {
23  m_ToFImageGrabber = NULL;
24  m_Controls = NULL;
25  CreateQtPartControl(this);
26 }
27 
29 {
30 }
31 
33 {
34  if (!m_Controls)
35  {
36  // create GUI widgets
37  m_Controls = new Ui::QmitkStructureSensorParameterWidgetControls;
38  m_Controls->setupUi(parent);
39 
40  this->CreateConnections();
41  }
42 }
43 
45 {
46  if ( m_Controls )
47  {
48  connect( m_Controls->m_640, SIGNAL(toggled(bool)), this, SLOT(OnResolutionChanged()) );
49  connect( m_Controls->m_320, SIGNAL(toggled(bool)), this, SLOT(OnResolutionChanged()) );
50  }
51 }
52 
54 {
55  return this->m_ToFImageGrabber;
56 }
57 
59 {
60  this->m_ToFImageGrabber = aToFImageGrabber;
61 }
62 
64 {
65  this->OnResolutionChanged();
66 }
67 
69 {
70  if (m_ToFImageGrabber.IsNotNull())
71  {
72  if (!m_ToFImageGrabber->IsCameraConnected())
73  {
74  //for know depth and RGB resolution is the same, but this could be different in future
75  this->m_ToFImageGrabber->SetIntProperty("RGBResolution", GetSelectedResolution());
76  this->m_ToFImageGrabber->SetIntProperty("DepthResolution", GetSelectedResolution());
77  }
78  else
79  {
80  MITK_WARN << "Structure Sensor resolution cannot be changed, if the device is connected. Please disconnect first.";
81  }
82  }
83 }
84 
86 {
87  if(m_Controls->m_640->isChecked())
88  {
89  return 640;
90  }
91  else if(m_Controls->m_320->isChecked())
92  {
93  return 320;
94  }
95  else
96  {
97  MITK_ERROR << "Unsupported structure sensor resolution!";
98  return -1;
99  }
100 }
#define MITK_ERROR
Definition: mitkLogMacros.h:24
mitk::ToFImageGrabber::Pointer m_ToFImageGrabber
image grabber object to be configured by the widget
QmitkStructureSensorParameterWidget(QWidget *p=0, Qt::WindowFlags f=0)
mitk::ToFImageGrabber * GetToFImageGrabber()
returns the ToFImageGrabber
void SetToFImageGrabber(mitk::ToFImageGrabber *aToFImageGrabber)
sets the ToFImageGrabber
#define MITK_WARN
Definition: mitkLogMacros.h:23
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