33 mDataManager = dataManager;
34 mAlwaysUseDefaultCenter =
false;
35 mUseTooltipOffset =
true;
36 connect(mDataManager.get(), SIGNAL(centerChanged()),
this, SLOT(centerChangedSlot()) ) ;
37 connect(mDataManager.get(), SIGNAL(clinicalApplicationChanged()),
this, SLOT(clinicalApplicationChangedSlot()));
39 mDefaultCenter = mDataManager->getCenter();
40 this->centerChangedSlot();
49 void SliceProxy::initCutplane()
51 mCutplane->setFixedCenter(mDefaultCenter);
52 mCutplane->setToolPosition(getSyntheticToolPos(mDefaultCenter));
60 disconnect(mTool.get(), SIGNAL(
toolVisible(
bool)),
this, SLOT(toolVisibleSlot(
bool)));
61 disconnect(mTool.get(), SIGNAL(tooltipOffset(
double)),
this, SLOT(tooltipOffsetSlot(
double)));
62 disconnect(mTool.get(), SIGNAL(toolProbeSector()),
this, SLOT(changed()));
70 connect(mTool.get(), SIGNAL(
toolVisible(
bool)),
this, SLOT(toolVisibleSlot(
bool)));
71 connect(mTool.get(), SIGNAL(tooltipOffset(
double)),
this, SLOT(tooltipOffsetSlot(
double)));
72 connect(mTool.get(), SIGNAL(toolProbeSector()),
this, SLOT(changed()));
75 toolTransformAndTimestampSlot(mTool->get_prMt(), 0);
76 tooltipOffsetSlot(mTool->getTooltipOffset());
79 this->centerChangedSlot();
83 void SliceProxy::toolTransformAndTimestampSlot(
Transform3D prMt,
double timestamp)
92 mCutplane->setToolPosition(rMt);
98 void SliceProxy::tooltipOffsetSlot(
double val)
100 if (mUseTooltipOffset)
102 mCutplane->setToolOffset(val);
111 tooltipOffsetSlot(0);
113 mUseTooltipOffset = use;
116 tooltipOffsetSlot(mTool->getTooltipOffset());
120 void SliceProxy::toolVisibleSlot(
bool visible)
137 this->centerChangedSlot();
142 mAlwaysUseDefaultCenter = on;
143 this->centerChangedSlot();
146 void SliceProxy::centerChangedSlot()
148 if (mAlwaysUseDefaultCenter)
150 mCutplane->setFixedCenter(mDefaultCenter);
154 Vector3D c = mDataManager->getCenter();
155 mCutplane->setFixedCenter(c);
162 void SliceProxy::clinicalApplicationChangedSlot()
164 mCutplane->setClinicalApplication(mDataManager->getClinicalApplication());
171 disconnect(mDataManager.get(), SIGNAL(clinicalApplicationChanged()),
this, SLOT(clinicalApplicationChangedSlot()));
173 mCutplane->setClinicalApplication(application);
181 Vector3D gravityDir = -mDataManager->getOperatingTable().getVectorUp();
188 mCutplane->initializeFromPlane(plane,
189 useGravity, gravityDir,
190 useViewOffset, viewportHeight, toolViewOffset,
191 mDataManager->getClinicalApplication());
209 mCutplane->setOrientationType(orientation);
215 mCutplane->setPlaneType(plane);
221 mCutplane->setFollowType(followType);
227 mCutplane->setGravity(use, dir);
232 mCutplane->setToolViewOffset(use, viewportHeight, toolViewOffset);
238 mCutplane->setToolViewportHeight(viewportHeight);
255 void SliceProxy::changed()
258 if (
similar(plane, mLastEmittedSlicePlane))
260 mLastEmittedSlicePlane = plane;
266 os << indent <<
"sliceproxy" << std::endl;
267 os << indent <<
"sMr: " << std::endl;
void setTool(ToolPtr tool)
Vector3D j
defines the second axis of the plane. unit vector
Provides a slice matrix based on definition and tool.
Transform3D createTransformRotateY(const double angle)
static SliceProxyPtr create(PatientModelServicePtr dataManager)
void setToolViewOffset(bool use, double viewportHeight, double toolViewOffset)
A 2D slice plane in 3D. i,j are perpendicular unit vectors.
void setToolViewportHeight(double viewportHeight)
virtual void printSelf(std::ostream &os, Indent indent)
void setPlane(PLANE_TYPE plane)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
void setComputer(const SliceComputer &val)
void setAlwaysUseDefaultCenter(bool on)
void setGravity(bool use, const Vector3D &dir)
void setClinicalApplicationToFixedValue(CLINICAL_VIEW application)
SliceComputer getComputer() const
void setUseTooltipOffset(bool)
Enable or disable usage of the tools tool tip offset for this slice proxy.
void toolVisible(bool visible)
forwarding of visible in tool
Transform3D createTransformIJC(const Vector3D &ivec, const Vector3D &jvec, const Vector3D ¢er)
Vector3D c
defines the center of the plane
void initializeFromPlane(PLANE_TYPE plane, bool useGravity, bool useViewOffset, double viewportHeight, double toolViewOffset)
void transformChanged(Transform3D sMr)
emitted when transform is changed.
ptTOOLSIDEPLANE
z-rotated 90* relative to anyplane like side plane, but always kept oriented like the plane defined b...
virtual Transform3D get_sMr()
get slice transform, i.e. the matrix sMr transforming a point p in ref to slice space.
void setFollowType(FOLLOW_TYPE followType)
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
Formatting class for debug printing of the ssc library.
Transform3D createTransformTranslate(const Vector3D &translation)
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Vector3D i
defines the first axis of the plane. unit vector
Calculates a slice plane given a definition.
void setOrientation(ORIENTATION_TYPE orientation)
bool similar(const CameraInfo &lhs, const CameraInfo &rhs, double tol)
Transform3D createTransformRotateZ(const double angle)
void setDefaultCenter(const Vector3D &c)
void toolTransformAndTimestamp(Transform3D prMt, double timestamp)
forwarded from tool
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr