17 #include "vtkImageData.h" 28 mTrackingService(trackingService),
29 mDataManager(dataManager)
43 std::vector<CoordinateSystem> retval;
56 std::map<QString, DataPtr> data = mDataManager->getDatas();
57 for (std::map<QString, DataPtr>::iterator i=data.begin(); i!=data.end(); ++i)
63 std::map<QString, ToolPtr> tools = mTrackingService->getTools();
64 for (std::map<QString, ToolPtr>::iterator i=tools.begin(); i!=tools.end(); ++i)
76 std::map<QString, QString> retval;
78 retval[
"active"] =
"active";
80 std::map<QString, DataPtr> data = mDataManager->getDatas();
81 for (std::map<QString, DataPtr>::iterator i=data.begin(); i!=data.end(); ++i)
83 retval[i->second->getSpace()] = i->second->getName();
86 std::map<QString, ToolPtr> tools = mTrackingService->getTools();
87 for (std::map<QString, ToolPtr>::iterator i=tools.begin(); i!=tools.end(); ++i)
89 retval[i->first] = i->second->getName();
98 return toMfrom.coord(
Vector3D(0,0,0));
103 QString uid = tool->getUid();
113 ToolPtr tool = mTrackingService->getActiveTool();
115 return Transform3D::Identity();
117 COORDINATE_SYSTEM target;
131 Transform3D to_M_from = get_rMfrom(to).inv() * get_rMfrom(from);
188 ToolPtr refTool = mTrackingService->getReferenceTool();
189 if (refTool && (tool == refTool))
207 ToolPtr refTool = mTrackingService->getReferenceTool();
208 if (refTool && (tool == refTool))
251 DataPtr data = mDataManager->getActiveData()->getActiveUsingRegexp(
"image|trackedStream|mesh");
253 space.
mRefObject = (data!=0) ? data->getUid() :
"";
257 ToolPtr tool = mTrackingService->getActiveTool();
258 space.
mRefObject = (tool!=0) ? tool->getUid() :
"";
266 return Transform3D::Identity();
269 Transform3D SpaceProviderImpl::get_rMd(QString uid)
271 if (!mDataManager->isPatientValid())
272 return Transform3D::Identity();
274 DataPtr data = mDataManager->getData(uid);
276 if (!data && uid==
"active")
279 data = activeData->getActive<
Image>();
284 reportWarning(
"Could not find data with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
285 return Transform3D::Identity();
287 return data->get_rMd();
290 Transform3D SpaceProviderImpl::get_rMdv(QString uid)
292 if (!mDataManager->isPatientValid())
293 return Transform3D::Identity();
295 DataPtr data = mDataManager->getData(uid);
297 if (!data && uid==
"active")
300 data = activeData->getActive<
Image>();
305 reportWarning(
"Could not find data with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
306 return Transform3D::Identity();
321 Transform3D SpaceProviderImpl::get_rMt(QString uid)
323 ToolPtr tool = mTrackingService->getTool(uid);
325 if (!tool && uid==
"active")
326 tool = mTrackingService->getActiveTool();
330 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
331 return Transform3D::Identity();
333 return get_rMpr() * tool->get_prMt();
336 Transform3D SpaceProviderImpl::get_rMto(QString uid)
338 ToolPtr tool = mTrackingService->getTool(uid);
340 if (!tool && uid==
"active")
341 tool = mTrackingService->getActiveTool();
345 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
346 return Transform3D::Identity();
349 double offset = tool->getTooltipOffset();
351 return get_rMpr() * tool->get_prMt() * tMto;
354 Transform3D SpaceProviderImpl::get_rMs(QString uid)
356 ToolPtr tool = mTrackingService->getTool(uid);
358 if (!tool && uid==
"active")
359 tool = mTrackingService->getActiveTool();
363 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
364 return Transform3D::Identity();
367 Transform3D tMs = tool->getCalibration_sMt().inv();
virtual CoordinateSystem getTO(ToolPtr tool)
tool offset coordinate system
virtual Transform3D get_toMfrom(CoordinateSystem from, CoordinateSystem to)
to_M_from
virtual Transform3D get_rMd() const
virtual CoordinateSystem getS(ToolPtr tool)
tools sensor coordinate system
void dataAddedOrRemoved()
virtual CoordinateSystem getT(ToolPtr tool)
tools coordinate system
Transform3D createTransformScale(const Vector3D &scale_)
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class TrackingService > TrackingServicePtr
csSENSOR
a tools sensor space (s)
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
Class that listens to changes in a coordinate system, and emits a signal if that system changes...
virtual CoordinateSystem getD(DataPtr data)
datas coordinate system static CoordinateSystem getPr(); ///<patient references coordinate system ...
virtual Transform3D get_rMpr()
COORDINATE_SYSTEM mId
the type of coordinate system
csPATIENTREF
the patient/tool reference space (pr)
boost::shared_ptr< class Data > DataPtr
virtual CoordinateSystem getPr()
virtual Transform3D getActiveToolTipTransform(CoordinateSystem to, bool useOffset=false)
Get toMt, where t is active tool.
void reportWarning(QString msg)
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
virtual std::map< QString, QString > getDisplayNamesForCoordRefObjects()
Transform3D createTransformTranslate(const Vector3D &translation)
Identification of a Coordinate system.
csTOOL_OFFSET
the tool space t with a virtual offset added along the z axis. (to)
QString mRefObject
for tool, sensor and data we need a object uid to define the coordinate system
virtual CoordinateSystem convertToSpecific(CoordinateSystem space)
convert "active" references to specific tool/data instances
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
virtual std::vector< CoordinateSystem > getSpacesToPresentInGUI()
virtual CoordinateSystem getR()
data references coordinate system
boost::shared_ptr< class SpaceListener > SpaceListenerPtr
virtual SpaceListenerPtr createListener()
SpaceProviderImpl(TrackingServicePtr trackingService, PatientModelServicePtr dataManager)
virtual Vector3D getActiveToolTipPoint(CoordinateSystem to, bool useOffset=false)
P_to, active tools current point in coord.
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr