16 #include <vtkImageData.h> 17 #include <vtkDoubleArray.h> 18 #include <vtkVectorText.h> 19 #include <vtkFollower.h> 20 #include <vtkSphereSource.h> 21 #include <vtkPolyDataMapper.h> 22 #include <vtkProperty.h> 23 #include <vtkRenderer.h> 24 #include <vtkRenderWindow.h> 30 #include "boost/bind.hpp" 38 connect(mDataManager->getPatientLandmarks().get(), SIGNAL(landmarkAdded(QString)),
this, SIGNAL(
changed()));
39 connect(mDataManager->getPatientLandmarks().get(), SIGNAL(landmarkRemoved(QString)),
this, SIGNAL(
changed()));
40 connect(mDataManager.get(), SIGNAL(rMprChanged()),
this, SIGNAL(
changed()));
44 return mDataManager->getPatientLandmarks()->getLandmarks();
48 return mDataManager->get_rMpr();
77 disconnect(mData->getLandmarks().get(), SIGNAL(landmarkAdded(QString)),
this, SIGNAL(
changed()));
78 disconnect(mData->getLandmarks().get(), SIGNAL(landmarkRemoved(QString)),
this, SIGNAL(
changed()));
79 disconnect(mData.get(), SIGNAL(transformChanged()),
this, SIGNAL(
changed()));
86 connect(mData->getLandmarks().get(), SIGNAL(landmarkAdded(QString)),
this, SIGNAL(
changed()));
87 connect(mData->getLandmarks().get(), SIGNAL(landmarkRemoved(QString)),
this, SIGNAL(
changed()));
88 connect(mData.get(), SIGNAL(transformChanged()),
this, SIGNAL(
changed()));
98 return mData->getLandmarks()->getLandmarks();
104 return Transform3D::Identity();
105 return mData->get_rMd();
110 Vector3D imageCenter = mData->boundingBox().center();
112 Vector3D numberPosition = p_l + 10.0 * centerToSkinVector;
113 return numberPosition;
122 return wrap_new(
new LandmarkRep(dataManager), uid);
127 mDataManager(dataManager),
128 mInactiveColor(QColor::fromRgbF(0.5,0.5,0.5)),
129 mColor(QColor(Qt::green)),
131 mSecondaryColor(QColor::fromRgbF(0, 0.9, 0.5)),
132 mShowLandmarks(true),
154 connect(mPrimary.get(), SIGNAL(changed()),
this, SLOT(
internalUpdate()));
165 connect(mSecondary.get(), SIGNAL(changed()),
this, SLOT(
internalUpdate()));
199 for (LandmarkGraphicsMapType::iterator iter =
mGraphics.begin(); iter !=
mGraphics.end(); ++iter)
201 if (iter->second.mPrimaryPoint)
202 iter->second.mPrimaryPoint->getActor()->SetVisibility(on);
203 if (iter->second.mSecondaryPoint)
204 iter->second.mSecondaryPoint->getActor()->SetVisibility(on);
205 if (iter->second.mText)
206 iter->second.mText->getActor()->SetVisibility(on);
207 if (iter->second.mLine)
208 iter->second.mLine->getActor()->SetVisibility(on);
219 for (LandmarkPropertyMap::iterator it = props.begin(); it != props.end(); ++it)
241 if (!view || !view->getRenderer())
263 if (property.getUid().isEmpty())
274 if (!property.getActive())
289 primary =
mPrimary->getLandmarks()[uid];
290 if (!primary.
getUid().isEmpty())
301 current.
mText->setText(property.getName());
302 current.
mText->setSizeInNormalizedViewport(
true, 0.025);
303 current.
mText->setColor(color);
308 current.
mText->setPosition(text_r);
318 if (!secondary.
getUid().isEmpty())
330 if (!secondary.
getUid().isEmpty() && !secondary.
getUid().isEmpty())
333 current.
mLine->setColor(secondaryColor);
334 current.
mLine->setStipple(0x0F0F);
336 current.
mLine->setValue(primary_r, secondary_r);
348 for (LandmarkGraphicsMapType::iterator iter =
mGraphics.begin(); iter !=
mGraphics.end(); ++iter)
356 primaryPoint->setRadius(sphereSize);
362 secondaryPoint->setRadius(sphereSize);
virtual void addRepActorsToViewRenderer(ViewPtr view)
static LandmarkRepPtr New(PatientModelServicePtr dataManager, const QString &uid="")
bool mShowLandmarks
whether or not the actors should be showed in (all) views
virtual Vector3D getTextPos(Vector3D p_l) const
vtkRendererPtr getRenderer()
void internalUpdate()
updates the text, color, scale etc
PatientLandmarksSource(PatientModelServicePtr dataManager)
boost::shared_ptr< class GraphicalPoint3D > GraphicalPoint3DPtr
PlainObject normal() const
One landmark, or fiducial, coordinate.
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
virtual Vector3D getTextPos(Vector3D p_l) const
LandmarksSourcePtr mSecondary
void setGraphicsSize(double size)
Helper for rendering a point in 3D.
boost::shared_ptr< class View > ViewPtr
void showLandmarks(bool on)
turn on or off showing landmarks
void addLandmark(QString uid)
Listens to changes in viewport and camera matrix.
ViewportListenerPtr mViewportListener
boost::shared_ptr< class Data > DataPtr
QColor mSecondaryColor
color used on the secondary coordinate
virtual Transform3D get_rMl() const
QColor mInactiveColor
color given to inactive landmarks
vtkSmartPointer< class vtkRenderer > vtkRendererPtr
LandmarksSourcePtr mPrimary
void setSecondarySource(LandmarksSourcePtr secondary)
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Helper for rendering a line in 3D.
void setPrimarySource(LandmarksSourcePtr primary)
void setColor(QColor color)
sets the reps color
GraphicalLine3DPtr mLine
line between primary and secondary point
virtual LandmarkMap getLandmarks() const
Default implementation of Rep.
Vector3D getCoord() const
GraphicalPoint3DPtr mPrimaryPoint
the primary coordinate of the landmark
void setData(DataPtr image)
Helper for rendering 3D text that faces the camera and has a constant viewed size.
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
FollowerText3DPtr mText
name of landmark, attached to primary point
boost::shared_ptr< LandmarksSource > LandmarksSourcePtr
std::map< QString, class Landmark > LandmarkMap
QColor mColor
the color of the landmark actors
void setLabelSize(double size)
void setSecondaryColor(QColor color)
sets the reps color
LandmarkGraphicsMapType mGraphics
std::map< QString, LandmarkProperty > LandmarkPropertyMap
virtual Transform3D get_rMl() const
GraphicalPoint3DPtr mSecondaryPoint
secondary landmark coordinate, accosiated with the primary point
PatientModelServicePtr mDataManager
boost::shared_ptr< class LandmarkRep > LandmarkRepPtr
virtual LandmarkMap getLandmarks() const
virtual void removeRepActorsFromViewRenderer(ViewPtr view)
Namespace for all CustusX production code.