14 #include <QInputDialog> 15 #include <QMessageBox> 34 this->setToolTip(
"Edit ultrasound probe configuration");
36 QVBoxLayout* topLayout =
new QVBoxLayout(
this);
41 topLayout->addWidget(mActiveProbeConfigWidget);
45 "Origin of tool space in the probe image.\nUnits in pixels.",
50 connect(mOrigin.get(), SIGNAL(changed()),
this, SLOT(guiOriginSettingsChanged()));
54 mOriginWidget->showDim(2,
false);
57 QGroupBox* cropGroupBox =
new QGroupBox(
"Crop Box",
this);
58 cropGroupBox->setToolTip(
"Define cropping box for the probe image.\nUnits in pixels.");
59 QVBoxLayout* cropLayout =
new QVBoxLayout(cropGroupBox);
60 topLayout->addWidget(cropGroupBox);
62 QStringList bbCaptions = QStringList() <<
"X (pixels)" <<
"Y (pixels)";
64 cropLayout->addWidget(mBBWidget);
68 QGroupBox* sectorGroupBox =
new QGroupBox(
"Sector");
69 sectorGroupBox->setToolTip(
"Define probe sector parameters.\nUnits in pixels and degrees.");
70 QVBoxLayout* sectorLayout =
new QVBoxLayout(sectorGroupBox);
71 topLayout->addWidget(sectorGroupBox);
73 sectorLayout->addWidget(mOriginWidget);
76 connect(mDepthWidget, SIGNAL(valueChanged(
double,
double)),
this, SLOT(guiProbeSectorChanged()));
77 sectorLayout->addWidget(mDepthWidget);
81 mWidth->setInternal2Display(180.0/
M_PI);
82 connect(mWidth.get(), SIGNAL(changed()),
this, SLOT(guiProbeSectorChanged()));
86 QHBoxLayout* buttonsLayout =
new QHBoxLayout;
87 topLayout->addLayout(buttonsLayout);
89 mSyncBoxToSector =
new QCheckBox(
"Sync Box to Sector",
this);
90 mSyncBoxToSector->setChecked(
true);
91 mSyncBoxToSector->setToolTip(
"" 92 "Synchronize Crop Box to Probe Sector,\n" 93 "changes in the sector will reset the crop box.");
94 connect(mSyncBoxToSector, SIGNAL(toggled(
bool)),
this, SLOT(syncBoxToSectorChanged()));
95 buttonsLayout->addWidget(mSyncBoxToSector);
97 buttonsLayout->addStretch();
99 QIcon(
":/icons/preset_remove.png"),
100 "Delete the current probe config",
"",
101 SLOT(deletePresetSlot()),
105 QIcon(
":/icons/preset_save.png"),
106 "Add the current setting as a probe config",
"",
107 SLOT(savePresetSlot()),
110 topLayout->addStretch();
117 void ProbeConfigWidget::syncBoxToSectorChanged()
122 void ProbeConfigWidget::savePresetSlot()
124 if (!mActiveProbeConfig->getTool())
126 ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
132 QString oldname = probe->getConfigName(probe->getConfigId());
133 if (oldname.isEmpty())
134 oldname = mLastKnownProbeConfigName;
136 QString newName = QString(
"%1 (2)").arg(oldname);
139 newName = QInputDialog::getText(
this,
"Save Config",
140 "Config Name", QLineEdit::Normal,
142 if (!ok || newName.isEmpty())
145 QStringList existingConfigs = probe->getConfigIdList();
149 for (
int i=0; i<existingConfigs.size(); ++i)
151 if (newName==probe->getConfigName(existingConfigs[i]))
153 newUid = existingConfigs[i];
157 if (newUid.isEmpty())
161 newUid.remove(QRegExp(
"(:|\\s|\\(|\\)|,)"));
162 QString root = newUid;
164 while (existingConfigs.contains(newUid))
166 newUid = QString(
"%1_%2").arg(root).arg(i++);
170 probe->saveCurrentConfig(newUid, newName);
173 void ProbeConfigWidget::deletePresetSlot()
175 ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
180 QString message = QString(
"Do you really want to delete configuration\n%1?").arg(probe->getConfigName(probe->getConfigId()));
181 if (QMessageBox::warning(
this,
184 QMessageBox::No | QMessageBox::Yes) != QMessageBox::Yes)
189 probe->removeCurrentConfig();
193 void ProbeConfigWidget::activeProbeConfigurationChangedSlot()
195 cx::ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
216 mWidth->setValueRange(
DoubleRange(0, range.range()[0]*1.5*sx, 1.0*sx));
217 mWidth->setInternal2Display(1.0/sx);
222 mWidth->setInternal2Display(180.0/
M_PI);
225 if (!probe->getConfigId().isEmpty())
227 mLastKnownProbeConfigName = probe->getConfigName(probe->getConfigId());
233 void ProbeConfigWidget::guiProbeSectorChanged()
237 if(!mActiveProbeConfig->getTool())
240 cx::ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
250 if (mSyncBoxToSector->isChecked())
253 probe->setProbeDefinition(data);
256 void ProbeConfigWidget::guiImageSettingsChanged()
261 if (!mActiveProbeConfig->getTool())
263 cx::ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
270 probe->setProbeDefinition(data);
273 void ProbeConfigWidget::guiOriginSettingsChanged()
278 if (!mActiveProbeConfig->getTool())
280 cx::ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
286 if (mSyncBoxToSector->isChecked())
295 probe->setProbeDefinition(data);
DoubleBoundingBox3D transform(const Transform3D &m, const DoubleBoundingBox3D &bb)
boost::shared_ptr< class VisServices > VisServicesPtr
boost::shared_ptr< class TrackingService > TrackingServicePtr
US beam is emitted straight forward.
Utility class for describing a bounded numeric range.
static StringPropertyActiveProbeConfigurationPtr New(TrackingServicePtr trackingService)
void setSector(double depthStart, double depthEnd, double width, double centerOffset=0)
double getDepthStart() const
boost::shared_ptr< Probe > ProbePtr
double getDepthEnd() const
Vector3D getOrigin_p() const
void updateClipRectFromSector()
void setOrigin_p(Vector3D origin_p)
US beam is emitted radially in a flat cone.
static Vector3DPropertyPtr initialize(const QString &uid, QString name, QString help, Vector3D value, DoubleRange range, int decimals, QDomNode root=QDomNode())
void setClipRect_p(DoubleBoundingBox3D clipRect_p)
Transform3D createTransformTranslate(const Vector3D &translation)
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
void changed()
emit when the underlying data value is changed: The user interface will be updated.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Definition of characteristics for an Ultrasound Probe Sector.
Vector3D getSpacing() const
boost::shared_ptr< class DoublePairProperty > DoublePairPropertyPtr
static DoublePropertyPtr initialize(const QString &uid, QString name, QString help, double value, DoubleRange range, int decimals, QDomNode root=QDomNode())
DoubleBoundingBox3D getClipRect_p() const
static DoublePairPropertyPtr initialize(const QString &uid, QString name, QString help, DoubleRange range, int decimals, QDomNode root=QDomNode())
Namespace for all CustusX production code.