59 mLastComputedTimestampShift(0),
66 double StreamedTimestampSynchronizer::average(ITER
begin, ITER
end)
const 68 int size = std::distance(begin, end);
77 QDateTime ts = imgMsg->getAcquisitionTime();
78 imgMsg->setOriginalAcquisitionTime(ts);
82 imgMsg->setAcquisitionTime(ts);
87 if (mDeltaWindow.empty())
90 QList<double> window = mDeltaWindow;
91 std::sort(window.begin(), window.end(),
AbsDoubleLess(mLastComputedTimestampShift));
93 double shrinkedWindowSize = double(window.size()) * 0.75;
94 int useCount = (int)(shrinkedWindowSize + 0.5);
96 mLastComputedTimestampShift = this->average(window.begin(), window.begin()+useCount);
97 return mLastComputedTimestampShift;
103 double delta = timestamp.msecsTo(QDateTime::currentDateTime());
104 mDeltaWindow.push_back(delta);
105 while (mDeltaWindow.size() > mMaxWindowSize)
106 mDeltaWindow.pop_front();
111 this->
addTimestamp(QDateTime::fromMSecsSinceEpoch(timestamp));
StreamedTimestampSynchronizer()
boost::shared_ptr< class Image > ImagePtr
void addTimestamp(QDateTime timestamp)
AbsDoubleLess(double center)
void syncToCurrentTime(ImagePtr imgMsg)
bool operator()(const double &d1, const double &d2)
Namespace for all CustusX production code.