38 #include "vtkImageData.h"
49 mTrackingService(trackingService),
50 mDataManager(dataManager)
64 std::vector<CoordinateSystem> retval;
77 std::map<QString, DataPtr> data = mDataManager->getData();
78 for (std::map<QString, DataPtr>::iterator i=data.begin(); i!=data.end(); ++i)
84 std::map<QString, ToolPtr> tools = mTrackingService->getTools();
85 for (std::map<QString, ToolPtr>::iterator i=tools.begin(); i!=tools.end(); ++i)
97 std::map<QString, QString> retval;
99 retval[
"active"] =
"active";
101 std::map<QString, DataPtr> data = mDataManager->getData();
102 for (std::map<QString, DataPtr>::iterator i=data.begin(); i!=data.end(); ++i)
104 retval[i->second->getSpace()] = i->second->getName();
107 std::map<QString, ToolPtr> tools = mTrackingService->getTools();
108 for (std::map<QString, ToolPtr>::iterator i=tools.begin(); i!=tools.end(); ++i)
110 retval[i->first] = i->second->getName();
119 return toMfrom.coord(
Vector3D(0,0,0));
124 QString uid = tool->getUid();
134 ToolPtr tool = mTrackingService->getActiveTool();
136 return Transform3D::Identity();
138 COORDINATE_SYSTEM target;
152 Transform3D to_M_from = get_rMfrom(to).inv() * get_rMfrom(from);
209 ToolPtr refTool = mTrackingService->getReferenceTool();
210 if (refTool && (tool == refTool))
228 ToolPtr refTool = mTrackingService->getReferenceTool();
229 if (refTool && (tool == refTool))
272 DataPtr data = mDataManager->getActiveData()->getActiveUsingRegexp(
"image|trackedStream|mesh");
274 space.
mRefObject = (data!=0) ? data->getUid() :
"";
278 ToolPtr tool = mTrackingService->getActiveTool();
279 space.
mRefObject = (tool!=0) ? tool->getUid() :
"";
287 return Transform3D::Identity();
290 Transform3D SpaceProviderImpl::get_rMd(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();
308 return data->get_rMd();
311 Transform3D SpaceProviderImpl::get_rMdv(QString uid)
313 if (!mDataManager->isPatientValid())
314 return Transform3D::Identity();
316 DataPtr data = mDataManager->getData(uid);
318 if (!data && uid==
"active")
321 data = activeData->getActive<Image>();
326 reportWarning(
"Could not find data with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
327 return Transform3D::Identity();
330 ImagePtr image = boost::dynamic_pointer_cast<Image>(data);
332 return data->get_rMd();
342 Transform3D SpaceProviderImpl::get_rMt(QString uid)
344 ToolPtr tool = mTrackingService->getTool(uid);
346 if (!tool && uid==
"active")
347 tool = mTrackingService->getActiveTool();
351 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
352 return Transform3D::Identity();
354 return get_rMpr() * tool->get_prMt();
357 Transform3D SpaceProviderImpl::get_rMto(QString uid)
359 ToolPtr tool = mTrackingService->getTool(uid);
361 if (!tool && uid==
"active")
362 tool = mTrackingService->getActiveTool();
366 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
367 return Transform3D::Identity();
370 double offset = tool->getTooltipOffset();
372 return get_rMpr() * tool->get_prMt() * tMto;
375 Transform3D SpaceProviderImpl::get_rMs(QString uid)
377 ToolPtr tool = mTrackingService->getTool(uid);
379 if (!tool && uid==
"active")
380 tool = mTrackingService->getActiveTool();
384 reportWarning(
"Could not find tool with uid: "+uid+
". Can not find transform to unknown coordinate system, returning identity!");
385 return Transform3D::Identity();
388 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 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
cxLogicManager_EXPORT TrackingServicePtr trackingService()
virtual SpaceListenerPtr createListener()
SpaceProviderImpl(TrackingServicePtr trackingService, PatientModelServicePtr dataManager)
virtual Vector3D getActiveToolTipPoint(CoordinateSystem to, bool useOffset=false)
P_to, active tools current point in coord.
boost::shared_ptr< class Tool > ToolPtr