35 #include <QInputDialog> 36 #include <QMessageBox> 55 this->setToolTip(
"Edit ultrasound probe configuration");
57 QVBoxLayout* topLayout =
new QVBoxLayout(
this);
62 topLayout->addWidget(mActiveProbeConfigWidget);
66 "Origin of tool space in the probe image.\nUnits in pixels.",
71 connect(mOrigin.get(), SIGNAL(changed()),
this, SLOT(guiOriginSettingsChanged()));
75 mOriginWidget->showDim(2,
false);
78 QGroupBox* cropGroupBox =
new QGroupBox(
"Crop Box",
this);
79 cropGroupBox->setToolTip(
"Define cropping box for the probe image.\nUnits in pixels.");
80 QVBoxLayout* cropLayout =
new QVBoxLayout(cropGroupBox);
81 topLayout->addWidget(cropGroupBox);
83 QStringList bbCaptions = QStringList() <<
"X (pixels)" <<
"Y (pixels)";
85 cropLayout->addWidget(mBBWidget);
89 QGroupBox* sectorGroupBox =
new QGroupBox(
"Sector");
90 sectorGroupBox->setToolTip(
"Define probe sector parameters.\nUnits in pixels and degrees.");
91 QVBoxLayout* sectorLayout =
new QVBoxLayout(sectorGroupBox);
92 topLayout->addWidget(sectorGroupBox);
94 sectorLayout->addWidget(mOriginWidget);
97 connect(mDepthWidget, SIGNAL(valueChanged(
double,
double)),
this, SLOT(guiProbeSectorChanged()));
98 sectorLayout->addWidget(mDepthWidget);
102 mWidth->setInternal2Display(180.0/
M_PI);
103 connect(mWidth.get(), SIGNAL(changed()),
this, SLOT(guiProbeSectorChanged()));
107 QHBoxLayout* buttonsLayout =
new QHBoxLayout;
108 topLayout->addLayout(buttonsLayout);
110 mSyncBoxToSector =
new QCheckBox(
"Sync Box to Sector",
this);
111 mSyncBoxToSector->setChecked(
true);
112 mSyncBoxToSector->setToolTip(
"" 113 "Synchronize Crop Box to Probe Sector,\n" 114 "changes in the sector will reset the crop box.");
115 connect(mSyncBoxToSector, SIGNAL(toggled(
bool)),
this, SLOT(syncBoxToSectorChanged()));
116 buttonsLayout->addWidget(mSyncBoxToSector);
118 buttonsLayout->addStretch();
120 QIcon(
":/icons/preset_remove.png"),
121 "Delete the current probe config",
"",
122 SLOT(deletePresetSlot()),
126 QIcon(
":/icons/preset_save.png"),
127 "Add the current setting as a probe config",
"",
128 SLOT(savePresetSlot()),
131 topLayout->addStretch();
138 void ProbeConfigWidget::syncBoxToSectorChanged()
143 void ProbeConfigWidget::savePresetSlot()
145 if (!mActiveProbeConfig->getTool())
147 ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
153 QString oldname = probe->getConfigName(probe->getConfigId());
154 if (oldname.isEmpty())
155 oldname = mLastKnownProbeConfigName;
157 QString newName = QString(
"%1 (2)").arg(oldname);
160 newName = QInputDialog::getText(
this,
"Save Config",
161 "Config Name", QLineEdit::Normal,
163 if (!ok || newName.isEmpty())
166 QStringList existingConfigs = probe->getConfigIdList();
170 for (
int i=0; i<existingConfigs.size(); ++i)
172 if (newName==probe->getConfigName(existingConfigs[i]))
174 newUid = existingConfigs[i];
178 if (newUid.isEmpty())
182 newUid.remove(QRegExp(
"(:|\\s|\\(|\\)|,)"));
183 QString root = newUid;
185 while (existingConfigs.contains(newUid))
187 newUid = QString(
"%1_%2").arg(root).arg(i++);
191 probe->saveCurrentConfig(newUid, newName);
194 void ProbeConfigWidget::deletePresetSlot()
196 ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
201 QString message = QString(
"Do you really want to delete configuration\n%1?").arg(probe->getConfigName(probe->getConfigId()));
202 if (QMessageBox::warning(
this,
205 QMessageBox::No | QMessageBox::Yes) != QMessageBox::Yes)
210 probe->removeCurrentConfig();
214 void ProbeConfigWidget::activeProbeConfigurationChangedSlot()
216 cx::ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
237 mWidth->setValueRange(
DoubleRange(0, range.range()[0]*1.5*sx, 1.0*sx));
238 mWidth->setInternal2Display(1.0/sx);
243 mWidth->setInternal2Display(180.0/
M_PI);
246 if (!probe->getConfigId().isEmpty())
248 mLastKnownProbeConfigName = probe->getConfigName(probe->getConfigId());
254 void ProbeConfigWidget::guiProbeSectorChanged()
258 if(!mActiveProbeConfig->getTool())
261 cx::ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
271 if (mSyncBoxToSector->isChecked())
274 probe->setProbeDefinition(data);
277 void ProbeConfigWidget::guiImageSettingsChanged()
282 if (!mActiveProbeConfig->getTool())
284 cx::ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
291 probe->setProbeDefinition(data);
294 void ProbeConfigWidget::guiOriginSettingsChanged()
299 if (!mActiveProbeConfig->getTool())
301 cx::ProbePtr probe = mActiveProbeConfig->getTool()->getProbe();
307 if (mSyncBoxToSector->isChecked())
316 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.