Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxTrackingSystemIGSTKService.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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #ifndef CXTRACKINGSYSTEMIGSTKSERVICE_H
34 #define CXTRACKINGSYSTEMIGSTKSERVICE_H
35 
36 #include "org_custusx_core_tracking_system_igstk_Export.h"
37 
39 #include "vtkForwardDeclarations.h"
40 
41 class QDomNode;
42 class QDomDocument;
43 class QDomNodeList;
44 class QFileInfo;
45 
46 namespace cx
47 {
54 typedef boost::shared_ptr<class ManualToolAdapter> ManualToolAdapterPtr;
55 typedef boost::shared_ptr<class IgstkTrackerThread> IgstkTrackerThreadPtr;
56 typedef boost::shared_ptr<class PlaybackTime> PlaybackTimePtr;
57 
82 class org_custusx_core_tracking_system_igstk_EXPORT TrackingSystemIGSTKService : public TrackingSystemService
83 {
84 Q_OBJECT
85 
86 public:
88  virtual ~TrackingSystemIGSTKService();
89 
90  virtual QString getUid() const { return "org.custusx.core.tracking.system.igstk"; }
91  virtual std::vector<ToolPtr> getTools();
92  virtual ToolPtr getReference() { return mReference; }
93 // virtual QStringList getSupportedTrackingSystems();
94 
95  virtual Tool::State getState() const;
96  virtual void setState(const Tool::State val);
97 
98  virtual void setLoggingFolder(QString loggingFolder);
99 
100  virtual TrackerConfigurationPtr getConfiguration();
101 
102 signals:
103 
104  // internal use only
105  void configured();
106  void deconfigured();
107  void initialized();
108  void uninitialized();
109  void trackingStarted();
110  void trackingStopped();
111 
112 private slots:
113  void configure();
114  virtual void deconfigure();
115  void initialize();
116  void uninitialize();
117  void startTracking();
118  void stopTracking();
119 
120  void trackerConfiguredSlot(bool on);
121  void initializedSlot(bool);
122  void trackerTrackingSlot(bool);
123 
124  void startTrackingAfterInitSlot();
125  void initializeAfterConfigSlot();
126  void uninitializeAfterTrackingStoppedSlot();
127  void deconfigureAfterUninitializedSlot();
128  void configureAfterDeconfigureSlot();
129  void globalConfigurationFileChangedSlot(QString key);
130 
131 private:
132 
133  bool isConfigured() const;
134  bool isInitialized() const;
135  bool isTracking() const;
136  void setConfigurationFile(QString configurationFile);
137  void destroyTrackerThread();
138 
139  QString mConfigurationFilePath;
140  QString mLoggingFolder;
141 
142  std::vector<ToolPtr> mTools;
143  ToolPtr mReference;
144 
145  Tool::State mState;
146 
147  IgstkTrackerThreadPtr mTrackerThread;
148 
149 #ifndef WIN32
150  bool createSymlink();
151  QFileInfo getSymlink() const;
152  void cleanupSymlink();
153 #endif //WIN32
154 };
155 
156 bool toolTypeSort(const ToolPtr tool1, const ToolPtr tool2);
157 
162 } // namespace cx
163 
164 #endif // CXTRACKINGSYSTEMIGSTKSERVICE_H
virtual ToolPtr getReference()
reference tool used by entire tracking service - NOTE: system fails if several TrackingSystemServices...
boost::shared_ptr< IgstkTrackerThread > IgstkTrackerThreadPtr
bool toolTypeSort(const ToolPtr tool1, const ToolPtr tool2)
function for sorting tools by type
boost::shared_ptr< class PlaybackTime > PlaybackTimePtr
boost::shared_ptr< class TrackerConfiguration > TrackerConfigurationPtr
Tracking System Service.
boost::shared_ptr< class ManualToolAdapter > ManualToolAdapterPtr
Interface towards one tracking system.
boost::shared_ptr< class Tool > ToolPtr