NorMIT-nav  22.09
An IGT application
cxPositionStorageFile.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 
12 #ifndef CXPOSITIONSTORAGEFILE_H_
13 #define CXPOSITIONSTORAGEFILE_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include <QString>
18 #include <QFile>
19 #include <QDataStream>
20 #include <boost/cstdint.hpp>
21 
22 #include "cxTransform3D.h"
23 
24 namespace cx {
25 
57 class cxResource_EXPORT PositionStorageReader
58 {
59 public:
60  PositionStorageReader(QString filename);
62  bool read(Transform3D* matrix, double* timestamp, int* toolIndex); // reads only tool data in integer format.
63  bool read(Transform3D* matrix, double* timestamp, QString* toolUid);
64  bool atEnd() const;
65  static QString timestampToString(double timestamp);
66  int version();
67 private:
68  QString mCurrentToolUid;
69  QFile positions;
70  QDataStream stream;
71  quint8 mVersion;
72  bool mError;
73  class Frame3D frameFromStream();
74 };
75 
76 typedef boost::shared_ptr<PositionStorageReader> PositionStorageReaderPtr;
77 
89 class cxResource_EXPORT PositionStorageWriter
90 {
91 public:
92  PositionStorageWriter(QString filename);
94  void write(Transform3D matrix, uint64_t timestamp, int toolIndex);
95  void write(Transform3D matrix, uint64_t timestamp, QString toolUid);
96 private:
97  QString mCurrentToolUid;
98  QFile positions;
99  QDataStream stream;
100 };
101 
102 } // namespace cx
103 
104 
105 #endif /*CXPOSITIONSTORAGEFILE_H_*/
cx::Frame3D
Defines an axis-angle representation of a position+orientation in 3D space.
Definition: cxFrame3D.h:69
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::PositionStorageReader
Reader class for the position file.
Definition: cxPositionStorageFile.h:57
cx::PositionStorageWriter
Writer class for the position file.
Definition: cxPositionStorageFile.h:89
cx::Transform3D
Transform3D Transform3D
Transform3D is a representation of an affine 3D transform.
Definition: cxLandmarkPatientRegistrationWidget.h:33
cx::PositionStorageReaderPtr
boost::shared_ptr< PositionStorageReader > PositionStorageReaderPtr
Definition: cxPositionStorageFile.h:76
cxTransform3D.h