36 #include "boost/bind.hpp"
39 #include <vtkPolyDataMapper.h>
40 #include <vtkProperty.h>
41 #include <vtkRenderer.h>
42 #include <vtkSectorSource.h>
58 mDataManager(dataManager),
68 this->
getView()->getRenderer()->RemoveActor(mCircleActor);
78 mCircleSource = vtkSectorSource::New();
80 mCircleSource->SetInnerRadius(0);
81 mCircleSource->SetStartAngle(0);
82 mCircleSource->SetEndAngle(360);
83 mCircleSource->SetCircumferentialResolution(60);
85 mapper->SetInputConnection(mCircleSource->GetOutputPort());
86 mapper->ScalarVisibilityOff();
87 mCircleActor = vtkActor::New();
88 mCircleActor->SetMapper(mapper);
89 mCircleActor->GetProperty()->LightingOff();
96 if (!mSliceProxy->getTool())
101 double toolOffset = mSliceProxy->getTool()->getTooltipOffset();
102 Transform3D rMt = mDataManager->get_rMpr()*mSliceProxy->getTool()->get_prMt();
107 Vector3D position = mSliceProxy->get_sMr() * centerRef;
108 mCircleActor->SetPosition(position[0], position[1], 0);
110 const double margin = 10;
111 double offsetDistance = (
mMetric->getRefCoord() - toolOffsetPosRef).
length();
112 double distance = (
mMetric->getRefCoord() - toolPosRef).
length();
113 double radius = 0.5 * offsetDistance + margin;
114 mCircleSource->SetOuterRadius(radius);
115 mCircleSource->SetInnerRadius(radius - mOutlineWidth);
117 if (distance < mRequestedAccuracy)
119 mCircleActor->GetProperty()->SetColor(0, 1, 1);
121 else if (offsetDistance < mRequestedAccuracy && toolOffset >= 0 && distance < 4*mRequestedAccuracy)
123 mCircleActor->GetProperty()->SetColor(0, 1, 1.0 - (distance-mRequestedAccuracy)/(3*mRequestedAccuracy));
125 else if (offsetDistance < mRequestedAccuracy && toolOffset >= 0)
127 mCircleActor->GetProperty()->SetColor(0, 1, 0);
131 mCircleActor->GetProperty()->SetColor(1, 0, 0);
140 mSliceProxy = sliceProxy;
148 mOutlineWidth = width;
154 mRequestedAccuracy = accuracy;
vtkRendererPtr getRenderer()
static GuideRep2DPtr New(PatientModelServicePtr dataManager, const QString &uid="")
void setOutlineWidth(double width)
vtkSmartPointer< class vtkPolyDataMapper > vtkPolyDataMapperPtr
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
static boost::shared_ptr< REP > wrap_new(REP *object, QString uid)
void setRequestedAccuracy(double accuracy)
boost::shared_ptr< class GuideRep2D > GuideRep2DPtr
virtual void onModifiedStartRender()
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
RealScalar length() const
void setSliceProxy(SliceProxyPtr slicer)