14 #include <vtkImageData.h> 30 BaseWidget(parent,
"sampler_widget",
"Point Sampler"),
31 mPatientModelService(patientModelService),
32 mSpaceProvider(spaceProvider)
34 this->setToolTip(
"Display current tool tip position");
35 mListener = spaceProvider->createListener();
38 connect(mListener.get(), SIGNAL(changed()),
this, SLOT(
setModified()));
41 connect(mActiveTool.get(), SIGNAL(activeToolChanged(
const QString&)),
this, SLOT(
setModified()));
45 mLayout =
new QHBoxLayout(
this);
46 mLayout->setMargin(4);
47 mLayout->setSpacing(4);
50 QIcon(
":/icons/open_icon_library/system-run-5.png"),
52 "Show Advanced options",
53 SLOT(toggleAdvancedSlot()),
57 mAdvancedWidget =
new QWidget(
this);
58 mAdvancedLayout =
new QHBoxLayout(mAdvancedWidget);
59 mAdvancedLayout->setMargin(0);
60 mLayout->addWidget(mAdvancedWidget);
64 "Select coordinate system to store position in.");
65 mSpaceSelector->setSpaceProvider(spaceProvider);
70 mSpaceSelector->setValue(space);
73 mAdvancedLayout->addWidget(spaceSelectorWidget);
74 this->spacesChangedSlot();
76 mCoordLineEdit =
new QLineEdit(
this);
77 mCoordLineEdit->setStyleSheet(
"QLineEdit { width : 30ex; }");
78 mCoordLineEdit->setSizePolicy(QSizePolicy::Fixed,
79 mCoordLineEdit->sizePolicy().verticalPolicy());
80 mCoordLineEdit->setReadOnly(
true);
81 mLayout->addWidget(mCoordLineEdit);
90 void SamplerWidget::toggleAdvancedSlot()
93 mAdvancedWidget->setVisible(!mAdvancedWidget->isVisible());
97 void SamplerWidget::showAdvanced()
100 mAdvancedWidget->setVisible(on);
103 void SamplerWidget::spacesChangedSlot()
110 mListener->setSpace(space);
116 Vector3D p = mSpaceProvider->getActiveToolTipPoint(space,
true);
118 QString coord = QString(
"%1, %2, %3").arg(p[0], w,
'f', 1).arg(p[1], w,
'f', 1).arg(p[2], w,
'f', 1);
120 ActiveDataPtr activeData = mPatientModelService->getActiveData();
127 Eigen::Vector3i(image->getBaseVtkImageData()->GetDimensions())-Eigen::Vector3i(1,1,1));
128 if (bb.contains(p.cast<
int>()))
130 double val = image->getBaseVtkImageData()->GetScalarComponentAsFloat(p[0], p[1], p[2], 0);
132 coord += QString(
" I=%1").arg(intVal);
136 mCoordLineEdit->setText(coord);
137 mCoordLineEdit->setStatusTip(QString(
"Position of active tool tip in %1 space\n" 138 "and the intensity of the active volume in that position").arg(space.
toString()));
139 mCoordLineEdit->setToolTip(mCoordLineEdit->statusTip());
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class TrackingService > TrackingServicePtr
static SpacePropertyPtr initialize(const QString &uid, QString name, QString help, Space value=Space(), std::vector< Space > range=std::vector< Space >(), QDomNode root=QDomNode())
boost::shared_ptr< class Image > ImagePtr
csDATA_VOXEL
the data voxel space (dv)
void spaceAddedOrRemoved()
csREF
the data reference space (r) using LPS (left-posterior-superior) coordinates.
boost::shared_ptr< class ActiveData > ActiveDataPtr
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
static CoordinateSystem reference()
void setValue(const QString &key, const QVariant &value)
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Identification of a Coordinate system.
Settings * settings()
Shortcut for accessing the settings instance.
Representation of an integer bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
static CoordinateSystem fromString(QString text)
Namespace for all CustusX production code.