CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxTrackingSystemPlaybackService.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 #ifndef CXTRACKINGSYSTEMPLAYBACKSERVICE_H
12 #define CXTRACKINGSYSTEMPLAYBACKSERVICE_H
13 
14 #include "org_custusx_core_tracking_Export.h"
16 
17 namespace cx
18 {
19 typedef boost::shared_ptr<class PlaybackTime> PlaybackTimePtr;
20 typedef boost::shared_ptr<class PlaybackTool> PlaybackToolPtr;
21 
35 class org_custusx_core_tracking_EXPORT TrackingSystemPlaybackService : public TrackingSystemService
36 {
37 Q_OBJECT
38 
39 public:
40  TrackingSystemPlaybackService(PlaybackTimePtr controller, std::vector<TrackingSystemServicePtr> base, ManualToolPtr manual);
42 
43  virtual QString getUid() const { return "org.custusx.core.tracking.system.playback"; }
44  virtual std::vector<ToolPtr> getTools();
45  virtual ToolPtr getReference() { return ToolPtr(); }
46 
47  virtual Tool::State getState() const;
48  virtual void setState(const Tool::State val);
49 
50  virtual void setLoggingFolder(QString loggingFolder);
51  virtual TrackerConfigurationPtr getConfiguration();
52 
53  std::vector<TrackingSystemServicePtr> getBase() { return mBases; }
54 
55 public slots:
56  void onActiveToolChanged(const QString &uId);
57 
58 private slots:
59  void onToolPositionChanged(Transform3D matrix, double timestamp);
60 
61 private:
62  void start();
63  void stop();
64  bool forceBaseToConfiguredState();
65  void waitForState(TrackingSystemServicePtr base, Tool::State state, int timeout);
66  bool isRunning() const;
67 
68  std::vector<PlaybackToolPtr> mTools;
69  Tool::State mState;
70  PlaybackTimePtr mController;
71  ManualToolPtr mManual;
72  QString mActiveToolId;
73  std::vector<TrackingSystemServicePtr> mBases;
74 };
75 
76 
77 } // namespace cx
78 
79 
80 #endif // CXTRACKINGSYSTEMPLAYBACKSERVICE_H
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
boost::shared_ptr< class PlaybackTool > PlaybackToolPtr
boost::shared_ptr< class ManualTool > ManualToolPtr
boost::shared_ptr< class PlaybackTime > PlaybackTimePtr
boost::shared_ptr< class TrackerConfiguration > TrackerConfigurationPtr
Tracking System Service.
virtual ToolPtr getReference()
reference tool used by entire tracking service - NOTE: system fails if several TrackingSystemServices...
std::vector< TrackingSystemServicePtr > getBase()
Interface towards a playback tracking system.Wraps another tracking system, enabling playback of the ...
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr
boost::shared_ptr< class TrackingSystemService > TrackingSystemServicePtr