NorMIT-nav  22.09
An IGT application
cxStreamedTimestampSynchronizer.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 STREAMEDTIMESTAMPSYNCHRONIZER_H
13 #define STREAMEDTIMESTAMPSYNCHRONIZER_H
14 
15 #include "cxResourceExport.h"
16 
17 
18 #include <vector>
19 #include "boost/shared_ptr.hpp"
20 #include <QDateTime>
21 #include "cxForwardDeclarations.h"
22 
23 namespace cx
24 {
25 
41 class cxResource_EXPORT StreamedTimestampSynchronizer
42 {
43 public:
49  void syncToCurrentTime(ImagePtr imgMsg);
50 
55  void addTimestamp(QDateTime timestamp);
59  void addTimestamp(double timestamp);
60 
66  double getShift() const;
67 
68 private:
73  template<class ITER>
74  double average(ITER begin, ITER end) const;
75 
76  mutable double mLastComputedTimestampShift;
77  QList<double> mDeltaWindow;
78  int mMaxWindowSize;
79 };
80 
81 
85 } //end namespace cx
86 
87 #endif // STREAMEDTIMESTAMPSYNCHRONIZER_H
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cxForwardDeclarations.h
begin
Scalar * begin()
Definition: cxPlainObjectEigenAddons.h:22
cx::ImagePtr
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
cx::StreamedTimestampSynchronizer
Definition: cxStreamedTimestampSynchronizer.h:41
end
Scalar * end()
Definition: cxPlainObjectEigenAddons.h:32