Medical Imaging Interaction Toolkit  2016.11.0
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,
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 #include "ui_QmitkUSControlsProbesWidget.h"
19 
21  : QWidget(parent), ui(new Ui::QmitkUSControlsProbesWidget),
22  m_ControlInterface(controlInterface)
23 {
24  ui->setupUi(this);
25 
26  if ( ! m_ControlInterface )
27  {
28  // 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.
29  ui->probesComboBox->setEnabled(false);
30  ui->probesLabel->setEnabled(false);
31  return;
32  }
33 
34  if ( ! m_ControlInterface->GetIsActive() ) { m_ControlInterface->SetIsActive(true); }
35 
36  // get all probes an put their names into a combo box
37  std::vector<mitk::USProbe::Pointer> probes = m_ControlInterface->GetProbeSet();
38  for ( auto it = probes.begin();
39  it != probes.end(); ++it )
40  {
41  std::string probeIdentifier = (*it)->GetName();
42  ui->probesComboBox->addItem(QString::fromUtf8(probeIdentifier.data(), probeIdentifier.size()));
43  }
44 
45  // select first probe as default value
46  if ( probes.size() > 0 )
47  {
48  ui->probesComboBox->setCurrentIndex(0);
49  m_ControlInterface->SelectProbe(0);
50  }
51 
52  connect( ui->probesComboBox, SIGNAL(activated(int)), this, SLOT(OnProbeControlActivated(int)) );
53 }
54 
56 {
57  delete ui;
58 }
59 
60 void QmitkUSControlsProbesWidget::OnProbeControlActivated(int index)
61 {
62  m_ControlInterface->SelectProbe(index);
63 }
itk::SmartPointer< Self > Pointer
QmitkUSControlsProbesWidget(mitk::USControlInterfaceProbes::Pointer controlInterface, QWidget *parent=nullptr)
Widget for probes controls of ultrasound devices. This class handles the mitk::USControlInterfaceProb...