35 #include <vtkImageData.h>
51 BaseWidget(parent,
"SamplerWidget",
"Point Sampler")
53 this->setToolTip(
"Display current tool tip position");
57 connect(mListener.get(), SIGNAL(changed()),
this, SLOT(
setModified()));
60 connect(mActiveTool.get(), SIGNAL(activeToolChanged(
const QString&)),
this, SLOT(
setModified()));
64 mLayout =
new QHBoxLayout(
this);
65 mLayout->setMargin(4);
66 mLayout->setSpacing(4);
69 QIcon(
":/icons/open_icon_library/system-run-5.png"),
71 "Show Advanced options",
72 SLOT(toggleAdvancedSlot()),
76 mAdvancedWidget =
new QWidget(
this);
77 mAdvancedLayout =
new QHBoxLayout(mAdvancedWidget);
78 mAdvancedLayout->setMargin(0);
79 mLayout->addWidget(mAdvancedWidget);
83 "Select coordinate system to store position in.");
89 mSpaceSelector->setValue(space);
92 mAdvancedLayout->addWidget(spaceSelectorWidget);
93 this->spacesChangedSlot();
95 mCoordLineEdit =
new QLineEdit(
this);
96 mCoordLineEdit->setStyleSheet(
"QLineEdit { width : 30ex; }");
97 mCoordLineEdit->setSizePolicy(QSizePolicy::Fixed,
98 mCoordLineEdit->sizePolicy().verticalPolicy());
99 mCoordLineEdit->setReadOnly(
true);
100 mLayout->addWidget(mCoordLineEdit);
102 this->showAdvanced();
109 void SamplerWidget::toggleAdvancedSlot()
112 mAdvancedWidget->setVisible(!mAdvancedWidget->isVisible());
113 this->showAdvanced();
116 void SamplerWidget::showAdvanced()
119 mAdvancedWidget->setVisible(on);
122 void SamplerWidget::spacesChangedSlot()
124 CoordinateSystem space = mSpaceSelector->getValue();
129 mListener->setSpace(space);
137 QString coord = QString(
"%1, %2, %3").arg(p[0], w,
'f', 1).arg(p[1], w,
'f', 1).arg(p[2], w,
'f', 1);
145 Eigen::Vector3i(image->getBaseVtkImageData()->GetDimensions())-Eigen::Vector3i(1,1,1));
146 if (bb.contains(p.cast<
int>()))
148 double val = image->getBaseVtkImageData()->GetScalarComponentAsFloat(p[0], p[1], p[2], 0);
150 coord += QString(
" I=%1").arg(intVal);
154 mCoordLineEdit->setText(coord);
155 mCoordLineEdit->setStatusTip(QString(
"Position of active tool tip in %1 space\n"
156 "and the intensity of the active volume in that position").arg(space.
toString()));
157 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) 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)
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)