Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
Medical Imaging Interaction Toolkit
QmitkUSControlsProbesWidget.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 #include "ui_QmitkUSControlsProbesWidget.h"
15 
16 QmitkUSControlsProbesWidget::QmitkUSControlsProbesWidget(mitk::USControlInterfaceProbes::Pointer controlInterface, QWidget *parent)
17  : QWidget(parent), ui(new Ui::QmitkUSControlsProbesWidget),
18  m_ControlInterface(controlInterface)
19 {
20  ui->setupUi(this);
21 
22  if ( ! m_ControlInterface )
23  {
24  // I do not see an instance of this being reenabled. We might have to look at it again, if we start to reallyuse multiple probes simultaneously.
25  ui->probesComboBox->setEnabled(false);
26  ui->probesLabel->setEnabled(false);
27  return;
28  }
29 
30  if ( ! m_ControlInterface->GetIsActive() ) { m_ControlInterface->SetIsActive(true); }
31 
32  // get all probes an put their names into a combo box
33  std::vector<mitk::USProbe::Pointer> probes = m_ControlInterface->GetProbeSet();
34  for ( auto it = probes.begin();
35  it != probes.end(); ++it )
36  {
37  std::string probeIdentifier = (*it)->GetName();
38  ui->probesComboBox->addItem(QString::fromUtf8(probeIdentifier.data(), probeIdentifier.size()));
39  }
40 
41  // select first probe as default value
42  if ( probes.size() > 0 )
43  {
44  ui->probesComboBox->setCurrentIndex(0);
45  m_ControlInterface->SelectProbe(0);
46  }
47 
48  connect( ui->probesComboBox, SIGNAL(activated(int)), this, SLOT(OnProbeControlActivated(int)) );
49 }
50 
52 {
53  delete ui;
54 }
55 
56 void QmitkUSControlsProbesWidget::OnProbeControlActivated(int index)
57 {
58  m_ControlInterface->SelectProbe(index);
59 }
QmitkUSControlsProbesWidget(mitk::USControlInterfaceProbes::Pointer controlInterface, QWidget *parent=nullptr)
Widget for probes controls of ultrasound devices. This class handles the mitk::USControlInterfaceProb...