37 #include <vtkImageData.h>
38 #include <vtkDoubleArray.h>
39 #include <vtkVectorText.h>
40 #include <vtkFollower.h>
41 #include <vtkSphereSource.h>
42 #include <vtkPolyDataMapper.h>
43 #include <vtkProperty.h>
44 #include <vtkRenderer.h>
45 #include <vtkRenderWindow.h>
51 #include "boost/bind.hpp"
59 connect(mDataManager->getPatientLandmarks().get(), SIGNAL(landmarkAdded(QString)),
this, SIGNAL(
changed()));
60 connect(mDataManager->getPatientLandmarks().get(), SIGNAL(landmarkRemoved(QString)),
this, SIGNAL(
changed()));
61 connect(mDataManager.get(), SIGNAL(rMprChanged()),
this, SIGNAL(
changed()));
65 return mDataManager->getPatientLandmarks()->getLandmarks();
69 return mDataManager->get_rMpr();
98 disconnect(mData->getLandmarks().get(), SIGNAL(landmarkAdded(QString)),
this, SIGNAL(
changed()));
99 disconnect(mData->getLandmarks().get(), SIGNAL(landmarkRemoved(QString)),
this, SIGNAL(
changed()));
100 disconnect(mData.get(), SIGNAL(transformChanged()),
this, SIGNAL(
changed()));
107 connect(mData->getLandmarks().get(), SIGNAL(landmarkAdded(QString)),
this, SIGNAL(
changed()));
108 connect(mData->getLandmarks().get(), SIGNAL(landmarkRemoved(QString)),
this, SIGNAL(
changed()));
109 connect(mData.get(), SIGNAL(transformChanged()),
this, SIGNAL(
changed()));
119 return mData->getLandmarks()->getLandmarks();
125 return Transform3D::Identity();
126 return mData->get_rMd();
131 Vector3D imageCenter = mData->boundingBox().center();
133 Vector3D numberPosition = p_l + 10.0 * centerToSkinVector;
134 return numberPosition;
148 mDataManager(dataManager),
149 mInactiveColor(QColor::fromRgbF(0.5,0.5,0.5)),
150 mColor(QColor(Qt::green)),
152 mSecondaryColor(QColor::fromRgbF(0, 0.9, 0.5)),
153 mShowLandmarks(true),
175 connect(mPrimary.get(), SIGNAL(changed()),
this, SLOT(
internalUpdate()));
186 connect(mSecondary.get(), SIGNAL(changed()),
this, SLOT(
internalUpdate()));
220 for (LandmarkGraphicsMapType::iterator iter =
mGraphics.begin(); iter !=
mGraphics.end(); ++iter)
222 if (iter->second.mPrimaryPoint)
223 iter->second.mPrimaryPoint->getActor()->SetVisibility(on);
224 if (iter->second.mSecondaryPoint)
225 iter->second.mSecondaryPoint->getActor()->SetVisibility(on);
226 if (iter->second.mText)
227 iter->second.mText->getActor()->SetVisibility(on);
228 if (iter->second.mLine)
229 iter->second.mLine->getActor()->SetVisibility(on);
240 for (LandmarkPropertyMap::iterator it = props.begin(); it != props.end(); ++it)
262 if (!view || !view->getRenderer())
284 if (property.getUid().isEmpty())
295 if (!property.getActive())
310 primary =
mPrimary->getLandmarks()[uid];
311 if (!primary.
getUid().isEmpty())
322 current.
mText->setText(property.getName());
323 current.
mText->setSizeInNormalizedViewport(
true, 0.025);
324 current.
mText->setColor(color);
329 current.
mText->setPosition(text_r);
339 if (!secondary.
getUid().isEmpty())
351 if (!secondary.
getUid().isEmpty() && !secondary.
getUid().isEmpty())
354 current.
mLine->setColor(secondaryColor);
355 current.
mLine->setStipple(0x0F0F);
357 current.
mLine->setValue(primary_r, secondary_r);
371 for (LandmarkGraphicsMapType::iterator iter =
mGraphics.begin(); iter !=
mGraphics.end(); ++iter)
373 if (iter->second.mSecondaryPoint)
374 iter->second.mSecondaryPoint->setRadius(sphereSize);
375 if (iter->second.mPrimaryPoint)
376 iter->second.mPrimaryPoint->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)
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
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
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)