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();
278 data = activeData->getActive<Image>();
281 data = mDataManager->getData(uid);
285 reportWarning(
"Could not find data with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
286 return Transform3D::Identity();
288 return data->get_rMd();
291 Transform3D SpaceProviderImpl::get_rMdv(QString uid)
293 if (!mDataManager->isPatientValid())
294 return Transform3D::Identity();
300 data = activeData->getActive<Image>();
303 data = mDataManager->getData(uid);
307 reportWarning(
"Could not find data with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
308 return Transform3D::Identity();
311 ImagePtr image = boost::dynamic_pointer_cast<Image>(data);
313 return data->get_rMd();
323 Transform3D SpaceProviderImpl::get_rMt(QString uid)
325 ToolPtr tool = mTrackingService->getTool(uid);
327 if (!tool && uid==
"active")
328 tool = mTrackingService->getActiveTool();
332 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
333 return Transform3D::Identity();
335 return get_rMpr() * tool->get_prMt();
338 Transform3D SpaceProviderImpl::get_rMto(QString uid)
340 ToolPtr tool = mTrackingService->getTool(uid);
342 if (!tool && uid==
"active")
343 tool = mTrackingService->getActiveTool();
347 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
348 return Transform3D::Identity();
351 double offset = tool->getTooltipOffset();
353 return get_rMpr() * tool->get_prMt() * tMto;
356 Transform3D SpaceProviderImpl::get_rMs(QString uid)
358 ToolPtr tool = mTrackingService->getTool(uid);
360 if (!tool && uid==
"active")
361 tool = mTrackingService->getActiveTool();
365 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
366 return Transform3D::Identity();
369 Transform3D tMs = tool->getCalibration_sMt().inv();