35 #include <vtkImageData.h>
50 BaseWidget(parent,
"SamplerWidget",
"Point Sampler")
55 connect(mListener.get(), SIGNAL(changed()),
this, SLOT(
setModified()));
58 connect(mActiveTool.get(), SIGNAL(activeToolChanged(
const QString&)),
this, SLOT(
setModified()));
62 mLayout =
new QHBoxLayout(
this);
63 mLayout->setMargin(4);
64 mLayout->setSpacing(4);
67 QIcon(
":/icons/open_icon_library/system-run-5.png"),
69 "Show Advanced options",
70 SLOT(toggleAdvancedSlot()),
74 mAdvancedWidget =
new QWidget(
this);
75 mAdvancedLayout =
new QHBoxLayout(mAdvancedWidget);
76 mAdvancedLayout->setMargin(0);
77 mLayout->addWidget(mAdvancedWidget);
81 "Select coordinate system to store position in.");
87 mSpaceSelector->setValue(space);
90 mAdvancedLayout->addWidget(spaceSelectorWidget);
91 this->spacesChangedSlot();
93 mCoordLineEdit =
new QLineEdit(
this);
94 mCoordLineEdit->setStyleSheet(
"QLineEdit { width : 30ex; }");
95 mCoordLineEdit->setSizePolicy(QSizePolicy::Fixed,
96 mCoordLineEdit->sizePolicy().verticalPolicy());
97 mCoordLineEdit->setReadOnly(
true);
98 mLayout->addWidget(mCoordLineEdit);
100 this->showAdvanced();
110 "<h3>Utility for sampling the current tool point</h3>"
111 "<p>Displays the current tool tip position in a selected coordinate system.</p>"
116 void SamplerWidget::toggleAdvancedSlot()
119 mAdvancedWidget->setVisible(!mAdvancedWidget->isVisible());
120 this->showAdvanced();
123 void SamplerWidget::showAdvanced()
126 mAdvancedWidget->setVisible(on);
129 void SamplerWidget::spacesChangedSlot()
131 CoordinateSystem space = mSpaceSelector->getValue();
136 mListener->setSpace(space);
144 QString
coord = QString(
"%1, %2, %3").arg(p[0], w,
'f', 1).arg(p[1], w,
'f', 1).arg(p[2], w,
'f', 1);
151 Eigen::Vector3i(image->getBaseVtkImageData()->GetDimensions())-Eigen::Vector3i(1,1,1));
152 if (bb.contains(p.cast<
int>()))
154 double val = image->getBaseVtkImageData()->GetScalarComponentAsFloat(p[0], p[1], p[2], 0);
156 coord += QString(
" I=%1").arg(intVal);
160 mCoordLineEdit->setText(coord);
161 mCoordLineEdit->setStatusTip(QString(
"Position of active tool tip in %1 space\n"
162 "and the intensity of the active volume in that position").arg(space.
toString()));
163 mCoordLineEdit->setToolTip(mCoordLineEdit->statusTip());
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
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)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
static CoordinateSystem reference()
void setValue(const QString &key, const QVariant &value)
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.
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
cxLogicManager_EXPORT PatientModelServicePtr patientService()
cxLogicManager_EXPORT TrackingServicePtr trackingService()
static CoordinateSystem fromString(QString text)