18 #include "ui_QmitkUSControlsCustomVideoDeviceWidget.h"
19 #include <QMessageBox>
52 (this->
GetDevice()->GetControlInterfaceCustom().GetPointer());
54 if (m_ControlInterface.IsNotNull())
57 ui->crop_left->setValue(cropping.
left);
58 ui->crop_right->setValue(cropping.
right);
59 ui->crop_bot->setValue(cropping.
bottom);
60 ui->crop_top->setValue(cropping.
top);
63 std::vector<mitk::USProbe::Pointer> probes = m_ControlInterface->GetProbes();
64 for (std::vector<mitk::USProbe::Pointer>::iterator it = probes.begin(); it != probes.end(); it++)
66 std::string probeName = (*it)->GetName();
67 ui->m_ProbeIdentifier->addItem(QString::fromUtf8(probeName.data(), probeName.size()));
69 connect(ui->m_UsDepth, SIGNAL(currentTextChanged(
const QString &)),
this, SLOT(OnDepthChanged()));
70 connect(ui->m_ProbeIdentifier, SIGNAL(currentTextChanged(
const QString &)),
this, SLOT(OnProbeChanged()));
75 MITK_WARN(
"QmitkUSAbstractCustomWidget")(
"QmitkUSControlsCustomVideoDeviceWidget")
76 <<
"Did not get a custom video device control interface.";
79 ui->crop_left->setEnabled(m_ControlInterface.IsNotNull());
80 ui->crop_right->setEnabled(m_ControlInterface.IsNotNull());
81 ui->crop_bot->setEnabled(m_ControlInterface.IsNotNull());
82 ui->crop_top->setEnabled(m_ControlInterface.IsNotNull());
89 connect(ui->crop_left, SIGNAL(valueChanged(
int)),
this, SLOT(OnCropAreaChanged()));
90 connect(ui->crop_right, SIGNAL(valueChanged(
int)),
this, SLOT(OnCropAreaChanged()));
91 connect(ui->crop_top, SIGNAL(valueChanged(
int)),
this, SLOT(OnCropAreaChanged()));
92 connect(ui->crop_bot, SIGNAL(valueChanged(
int)),
this, SLOT(OnCropAreaChanged()));
96 void QmitkUSControlsCustomVideoDeviceWidget::OnCropAreaChanged()
98 if (m_ControlInterface.IsNull()) {
return; }
101 cropping.
left = ui->crop_left->value();
102 cropping.
top = ui->crop_top->value();
103 cropping.
right = ui->crop_right->value();
104 cropping.
bottom = ui->crop_bot->value();
108 m_ControlInterface->SetCropArea(cropping);
123 msgBox.setInformativeText(
"The crop area you specified is invalid.\nPlease make sure that no more pixels are cropped than are available.");
124 msgBox.setStandardButtons(QMessageBox::Ok);
126 MITK_WARN <<
"User tried to crop beyond limits of the image";
130 void QmitkUSControlsCustomVideoDeviceWidget::OnDepthChanged()
132 double depth = ui->m_UsDepth->currentText().toDouble();
133 m_ControlInterface->SetNewDepth(depth);
136 void QmitkUSControlsCustomVideoDeviceWidget::OnProbeChanged()
138 std::string probename = ui->m_ProbeIdentifier->currentText().toStdString();
139 m_ControlInterface->SetNewProbeIdentifier(probename);
140 SetDepthsForProbe(probename);
145 bool oldState = target->blockSignals(
true);
146 target->setValue(value);
147 target->blockSignals(oldState);
150 void QmitkUSControlsCustomVideoDeviceWidget::SetDepthsForProbe(std::string probename)
152 ui->m_UsDepth->clear();
153 std::vector<int> depths = m_ControlInterface->GetDepthsForProbe(probename);
154 for (std::vector<int>::iterator it = depths.begin(); it != depths.end(); it++)
156 ui->m_UsDepth->addItem(QString::number(*it));
Defines a region of interest by distances to the four image borders.
An object of this class represents an exception of MITK. Please don't instantiate exceptions manually...
Custom controls for mitk::USVideoDevice. Controls image cropping of the corresponding mitk::USImageVi...
static std::string GetDeviceClassStatic()