38 mLastComputedTimestampShift(0),
45 double StreamedTimestampSynchronizer::average(ITER
begin, ITER
end)
const 47 int size = std::distance(begin, end);
56 QDateTime ts = imgMsg->getAcquisitionTime();
57 imgMsg->setOriginalAcquisitionTime(ts);
61 imgMsg->setAcquisitionTime(ts);
66 if (mDeltaWindow.empty())
69 QList<double> window = mDeltaWindow;
70 std::sort(window.begin(), window.end(),
AbsDoubleLess(mLastComputedTimestampShift));
72 double shrinkedWindowSize = double(window.size()) * 0.75;
73 int useCount = (int)(shrinkedWindowSize + 0.5);
75 mLastComputedTimestampShift = this->average(window.begin(), window.begin()+useCount);
76 return mLastComputedTimestampShift;
82 double delta = timestamp.msecsTo(QDateTime::currentDateTime());
83 mDeltaWindow.push_back(delta);
84 while (mDeltaWindow.size() > mMaxWindowSize)
85 mDeltaWindow.pop_front();
90 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.