35 #include <vtkImageData.h> 51 BaseWidget(parent,
"sampler_widget",
"Point Sampler"),
52 mPatientModelService(patientModelService),
53 mSpaceProvider(spaceProvider)
55 this->setToolTip(
"Display current tool tip position");
56 mListener = spaceProvider->createListener();
59 connect(mListener.get(), SIGNAL(changed()),
this, SLOT(
setModified()));
62 connect(mActiveTool.get(), SIGNAL(activeToolChanged(
const QString&)),
this, SLOT(
setModified()));
66 mLayout =
new QHBoxLayout(
this);
67 mLayout->setMargin(4);
68 mLayout->setSpacing(4);
71 QIcon(
":/icons/open_icon_library/system-run-5.png"),
73 "Show Advanced options",
74 SLOT(toggleAdvancedSlot()),
78 mAdvancedWidget =
new QWidget(
this);
79 mAdvancedLayout =
new QHBoxLayout(mAdvancedWidget);
80 mAdvancedLayout->setMargin(0);
81 mLayout->addWidget(mAdvancedWidget);
85 "Select coordinate system to store position in.");
86 mSpaceSelector->setSpaceProvider(spaceProvider);
91 mSpaceSelector->setValue(space);
94 mAdvancedLayout->addWidget(spaceSelectorWidget);
95 this->spacesChangedSlot();
97 mCoordLineEdit =
new QLineEdit(
this);
98 mCoordLineEdit->setStyleSheet(
"QLineEdit { width : 30ex; }");
99 mCoordLineEdit->setSizePolicy(QSizePolicy::Fixed,
100 mCoordLineEdit->sizePolicy().verticalPolicy());
101 mCoordLineEdit->setReadOnly(
true);
102 mLayout->addWidget(mCoordLineEdit);
104 this->showAdvanced();
111 void SamplerWidget::toggleAdvancedSlot()
114 mAdvancedWidget->setVisible(!mAdvancedWidget->isVisible());
115 this->showAdvanced();
118 void SamplerWidget::showAdvanced()
121 mAdvancedWidget->setVisible(on);
124 void SamplerWidget::spacesChangedSlot()
131 mListener->setSpace(space);
137 Vector3D p = mSpaceProvider->getActiveToolTipPoint(space,
true);
139 QString coord = QString(
"%1, %2, %3").arg(p[0], w,
'f', 1).arg(p[1], w,
'f', 1).arg(p[2], w,
'f', 1);
141 ActiveDataPtr activeData = mPatientModelService->getActiveData();
147 Eigen::Vector3i(image->getBaseVtkImageData()->GetDimensions())-Eigen::Vector3i(1,1,1));
148 if (bb.contains(p.cast<
int>()))
150 double val = image->getBaseVtkImageData()->GetScalarComponentAsFloat(p[0], p[1], p[2], 0);
152 coord += QString(
" I=%1").arg(intVal);
156 mCoordLineEdit->setText(coord);
157 mCoordLineEdit->setStatusTip(QString(
"Position of active tool tip in %1 space\n" 158 "and the intensity of the active volume in that position").arg(space.
toString()));
159 mCoordLineEdit->setToolTip(mCoordLineEdit->statusTip());
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
std::string toString(T const &value)
converts any type to a string
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.