59 connect(
m_Controls->m_BtnCancel, SIGNAL(clicked()),
this,
61 connect(
m_Controls->m_RadioDeviceSource, SIGNAL(clicked()),
this,
63 connect(
m_Controls->m_RadioFileSource, SIGNAL(clicked()),
this,
65 connect(
m_Controls->m_RadioOIGTLClientSource, SIGNAL(clicked()),
this,
67 connect(
m_Controls->m_RadioOIGTLServerSource, SIGNAL(clicked()),
this,
69 connect(
m_Controls->m_OpenFileButton, SIGNAL(clicked()),
this,
72 connect(
m_Controls->m_BtnSave, SIGNAL(clicked()),
this,
74 connect(
m_Controls->m_BtnLoadConfiguration, SIGNAL(clicked()),
this,
82 connect(
m_Controls->m_Probes, SIGNAL(currentTextChanged(
const QString &)),
this, SLOT(
OnProbeChanged(
const QString &)));
83 connect(
m_Controls->m_Depths, SIGNAL(currentTextChanged(
const QString &)),
this, SLOT(
OnDepthChanged(
const QString &)));
101 mitk::USDevice::Pointer newDevice;
102 if (
m_Controls->m_RadioDeviceSource->isChecked())
104 newDevice = mitk::USVideoDevice::New(
106 m_Controls->m_Manufacturer->text().toStdString(),
108 newDevice->SetComment(
m_Controls->m_Comment->text().toStdString());
110 else if (
m_Controls->m_RadioFileSource->isChecked())
112 newDevice = mitk::USVideoDevice::New(
113 m_Controls->m_FilePathSelector->text().toStdString(),
114 m_Controls->m_Manufacturer->text().toStdString(),
116 newDevice->SetComment(
m_Controls->m_Comment->text().toStdString());
118 else if (
m_Controls->m_RadioOIGTLClientSource->isChecked())
120 std::string host =
m_Controls->m_OIGTLClientHost->text().toStdString();
121 int port =
m_Controls->m_OIGTLClientPort->value();
124 newDevice = mitk::USIGTLDevice::New(
m_Controls->m_Manufacturer->text().toStdString(),
125 m_Controls->m_Model->text().toStdString(), host, port,
false);
131 std::string host =
m_Controls->m_OIGTLServerHost->text().toStdString();
132 int port =
m_Controls->m_OIGTLServerPort->value();
135 newDevice = mitk::USIGTLDevice::New(
m_Controls->m_Manufacturer->text().toStdString(),
136 m_Controls->m_Model->text().toStdString(), host, port,
true);
143 mitk::USImageVideoSource::Pointer imageSource =
145 newDevice->GetUSImageSource().GetPointer());
146 if (imageSource.IsNotNull())
150 imageSource->SetColorOutput(!
m_Controls->m_CheckGreyscale->isChecked());
153 if (
m_Controls->m_CheckResolutionOverride->isChecked())
155 int width =
m_Controls->m_ResolutionWidth->value();
156 int height =
m_Controls->m_ResolutionHeight->value();
157 imageSource->OverrideResolution(width, height);
158 imageSource->SetResolutionOverride(
true);
168 mitk::USProbe::Pointer probe = mitk::USProbe::New(
"default");
170 newDevice->DeleteAllProbes();
171 newDevice->AddNewProbe(probe);
173 newDevice->Initialize();
192 mitk::USProbe::Pointer probe = mitk::USProbe::New(
"default");
200 mitk::USImageVideoSource::Pointer imageSource =
203 if (imageSource.IsNotNull())
206 imageSource->SetColorOutput(!
m_Controls->m_CheckGreyscale->isChecked());
209 if (
m_Controls->m_CheckResolutionOverride->isChecked())
211 int width =
m_Controls->m_ResolutionWidth->value();
212 int height =
m_Controls->m_ResolutionHeight->value();
213 imageSource->OverrideResolution(width, height);
214 imageSource->SetResolutionOverride(
true);
218 MITK_INFO <<
"Finished Editing";
236 m_Controls->m_RadioDeviceSource->isChecked());
238 m_Controls->m_RadioOIGTLClientSource->isChecked());
240 m_Controls->m_RadioOIGTLClientSource->isChecked());
242 m_Controls->m_RadioOIGTLServerSource->isChecked());
244 m_Controls->m_RadioOIGTLServerSource->isChecked());
317 std::string probeName = (*it)->GetName();
318 m_Controls->m_Probes->addItem(QString::fromUtf8(probeName.data(), probeName.size()));
323 m_Controls->m_BtnDone->setText(
"Apply Changes");
334 if (!
m_Controls->m_Probes->currentText().isEmpty())
336 QString depths =
m_Controls->m_AddDepths->text();
337 if( depths.isEmpty() )
340 std::string probename =
m_Controls->m_Probes->currentText().toStdString();
343 QStringList singleDepths = depths.split(
',');
344 for (
int i = 0; i < singleDepths.size(); i++)
346 currentProbe->SetDepth(singleDepths.at(i).toInt());
350 m_Controls->m_BtnRemoveDepth->setEnabled(
true);
357 if (!
m_Controls->m_Probes->currentText().isEmpty() && !
m_Controls->m_Depths->currentText().isEmpty())
359 std::string probename =
m_Controls->m_Probes->currentText().toStdString();
360 int indexOfDepthToRemove =
m_Controls->m_Depths->currentIndex();
362 currentProbe->RemoveDepth(
m_Controls->m_Depths->currentText().toInt());
363 m_Controls->m_Depths->removeItem(indexOfDepthToRemove);
368 m_Controls->m_BtnRemoveDepth->setEnabled(
false);
377 if (!
m_Controls->m_Probes->currentText().isEmpty())
379 std::string probename =
m_Controls->m_Probes->currentText().toStdString();
380 int indexOfProbeToRemove =
m_Controls->m_Probes->currentIndex();
382 m_Controls->m_Probes->removeItem(indexOfProbeToRemove);
386 m_Controls->m_BtnRemoveProbe->setEnabled(
false);
387 m_Controls->m_BtnAddDepths->setEnabled(
false);
390 m_Controls->m_BtnRemoveDepth->setEnabled(
false);
399 if (!probename.isEmpty())
401 std::string name = probename.toStdString();
403 if( probe.IsNotNull() )
405 std::map<int, mitk::Vector3D> depths = probe->GetDepthsAndSpacing();
407 for (std::map<int, mitk::Vector3D>::iterator it = depths.begin(); it != depths.end(); it++)
409 m_Controls->m_Depths->addItem(QString::number(it->first));
419 m_Controls->m_BtnRemoveDepth->setEnabled(
false);
428 m_Controls->m_BtnRemoveDepth->setEnabled(
false);
434 if (probe.IsNotNull())
436 mitk::Vector3D spacing = probe->GetSpacingForGivenDepth(depth);
437 m_Controls->m_XSpacingSpinBox->setValue(spacing[0]);
438 m_Controls->m_YSpacingSpinBox->setValue(spacing[1]);
449 m_Controls->m_BtnRemoveDepth->setEnabled(
true);
453 m_Controls->m_BtnRemoveProbe->setEnabled(
true);
496 QString fileName = QFileDialog::getOpenFileName(
this,
"Open ultrasound device configuration ...");
497 if (fileName.isNull())
507 msgBox.setText(
"Error when parsing the selected file. Could not load stored device information.");
546 m_Controls->m_Probes->addItem(QString::fromStdString(config.
probes.at(index)->GetName()));
551 else if (config.
deviceType.compare(
"oigtl") == 0)
562 m_Controls->m_RadioOIGTLServerSource->setChecked(
true);
563 m_Controls->m_OIGTLServerHost->setText(QString::fromStdString(config.
host));
568 m_Controls->m_RadioOIGTLClientSource->setChecked(
true);
569 m_Controls->m_OIGTLClientHost->setText(QString::fromStdString(config.
host));
593 m_Controls->m_Probes->addItem(QString::fromStdString(config.
probes.at(index)->GetName()));
599 MITK_WARN <<
"Unknown device type detected. The device type must be of type |video|";
604 MITK_WARN <<
"Unknown fileversion. Only fileversion 1.0 is known to the system.";
610 QString probeName =
m_Controls->m_ProbeNameLineEdit->text();
611 probeName = probeName.trimmed();
612 if (probeName.isEmpty())
621 msgBox.setText(
"Probe name already exists. Please choose another name for the probe.");
627 mitk::USProbe::Pointer newProbe = mitk::USProbe::New(probeName.toStdString());
629 m_Controls->m_Probes->addItem(QString::fromStdString(probeName.toStdString()));
632 m_Controls->m_BtnRemoveProbe->setEnabled(
true);
641 MITK_INFO <<
"Changing x-spacing to: " << value;
642 QString probeName =
m_Controls->m_Probes->currentText();
643 int depth =
m_Controls->m_Depths->currentText().toInt();
649 msgBox.setText(
"An error occurred when changing the spacing. \
650 The specified probe does not exist. \
651 Please restart the configuration process.");
656 mitk::Vector3D spacing = probe->GetSpacingForGivenDepth(depth);
658 probe->SetSpacingForGivenDepth(depth, spacing);
663 MITK_INFO <<
"Changing y-spacing to: " << value;
664 QString probeName =
m_Controls->m_Probes->currentText();
665 int depth =
m_Controls->m_Depths->currentText().toInt();
671 msgBox.setText(
"An error occurred when changing the spacing. \
672 The specified probe does not exist. \
673 Please restart the configuration process.");
678 mitk::Vector3D spacing = probe->GetSpacingForGivenDepth(depth);
680 probe->SetSpacingForGivenDepth(depth, spacing);
820 if (
m_Controls->m_RadioOIGTLServerSource->isChecked())
823 config.
host =
m_Controls->m_OIGTLServerHost->text().toStdString();
829 config.
host =
m_Controls->m_OIGTLClientHost->text().toStdString();
854 m_Controls->m_XSpacingSpinBox->setEnabled(enable);
855 m_Controls->m_YSpacingSpinBox->setEnabled(enable);
856 m_Controls->m_XSpacingLabel->setEnabled(enable);
857 m_Controls->m_YSpacingLabel->setEnabled(enable);
859 m_Controls->m_CroppingTopSpinBox->setEnabled(enable);
860 m_Controls->m_CroppingRightSpinBox->setEnabled(enable);
861 m_Controls->m_CroppingBottomSpinBox->setEnabled(enable);
862 m_Controls->m_CroppingLeftSpinBox->setEnabled(enable);
863 m_Controls->m_CroppingTopLabel->setEnabled(enable);
864 m_Controls->m_CroppingBottomLabel->setEnabled(enable);
865 m_Controls->m_CroppingLeftLabel->setEnabled(enable);
866 m_Controls->m_CroppingRightLabel->setEnabled(enable);