This class stores an fixed number of timestamped items. It provides element retrieval based on timestamp, temporal filtering and interpolation, etc.
More...
#include <src/PlusDataCollection/vtkPlusTimestampedCircularBuffer.h>
|
void | AddToTimeStampReport (unsigned long itemIndex, double unfilteredTimestamp, double filteredTimestamp) |
|
virtual void | Clear () |
|
virtual PlusStatus | CreateFilteredTimeStampForItem (unsigned long itemIndex, double inUnfilteredTimestamp, double &outFilteredTimestamp, bool &filteredTimestampProbablyValid) |
|
virtual void | DeepCopy (vtkPlusTimestampedCircularBuffer *buffer) |
|
virtual int | GetAveragedItemsForFiltering () |
|
virtual ItemStatus | GetBufferIndexFromTime (const double time, int &bufferIndex) |
|
virtual StreamBufferItem * | GetBufferItemPointerFromBufferIndex (const int bufferIndex) |
|
virtual ItemStatus | GetBufferItemPointerFromUid (const BufferItemUidType uid, StreamBufferItem *&itemPtr) |
|
virtual int | GetBufferSize () |
|
virtual ItemStatus | GetFilteredTimeStamp (const BufferItemUidType uid, double &filteredTimestamp) |
|
virtual double | GetFrameRate (bool ideal=false, double *framePeriodStdevSecPtr=NULL) |
|
virtual ItemStatus | GetIndex (const BufferItemUidType uid, unsigned long &index) |
|
virtual ItemStatus | GetItemUidFromTime (const double time, BufferItemUidType &uid) |
|
virtual bool | GetLatestItemHasValidFieldData () |
|
virtual bool | GetLatestItemHasValidTransformData () |
|
virtual bool | GetLatestItemHasValidVideoData () |
|
virtual BufferItemUidType | GetLatestItemUidInBuffer () |
|
virtual ItemStatus | GetLatestTimeStamp (double ×tamp) |
|
virtual double | GetLocalTimeOffsetSec () |
|
virtual int | GetNumberOfItems () |
|
virtual BufferItemUidType | GetOldestItemUidInBuffer () |
|
virtual ItemStatus | GetOldestTimeStamp (double ×tamp) |
|
virtual double | GetStartTime () |
|
virtual ItemStatus | GetTimeStamp (const BufferItemUidType uid, double ×tamp) |
|
virtual bool | GetTimeStampLogging () |
|
virtual bool | GetTimeStampReporting () |
|
PlusStatus | GetTimeStampReportTable (vtkTable *timeStampReportTable) |
|
virtual ItemStatus | GetUnfilteredTimeStamp (const BufferItemUidType uid, double &unfilteredTimestamp) |
|
void | Lock () |
|
virtual PlusStatus | PrepareForNewItem (const double timestamp, BufferItemUidType &newFrameUid, int &bufferIndex) |
|
void | PrintSelf (ostream &os, vtkIndent indent) |
|
virtual void | SetAveragedItemsForFiltering (unsigned int) |
|
virtual PlusStatus | SetBufferSize (int n) |
|
virtual void | SetLocalTimeOffsetSec (double) |
|
virtual void | SetStartTime (double) |
|
virtual void | SetTimeStampLogging (bool) |
|
virtual void | SetTimeStampReporting (bool) |
|
virtual void | TimeStampLoggingOff () |
|
virtual void | TimeStampLoggingOn () |
|
virtual void | TimeStampReportingOff () |
|
virtual void | TimeStampReportingOn () |
|
void | Unlock () |
|
This class stores an fixed number of timestamped items. It provides element retrieval based on timestamp, temporal filtering and interpolation, etc.
Definition at line 37 of file vtkPlusTimestampedCircularBuffer.h.
◆ vtkPlusTimestampedCircularBuffer()
vtkPlusTimestampedCircularBuffer::vtkPlusTimestampedCircularBuffer |
( |
| ) |
|
|
protected |
◆ ~vtkPlusTimestampedCircularBuffer()
vtkPlusTimestampedCircularBuffer::~vtkPlusTimestampedCircularBuffer |
( |
| ) |
|
|
protected |
◆ AddToTimeStampReport()
void vtkPlusTimestampedCircularBuffer::AddToTimeStampReport |
( |
unsigned long |
itemIndex, |
|
|
double |
unfilteredTimestamp, |
|
|
double |
filteredTimestamp |
|
) |
| |
Add values to the timestamp report. If reporting is not enabled then no values will be added. This should only be called if an item is added without calling CreateFilteredTimeStampForItem.
Definition at line 654 of file vtkPlusTimestampedCircularBuffer.cxx.
◆ Clear()
void vtkPlusTimestampedCircularBuffer::Clear |
( |
| ) |
|
|
virtual |
◆ CreateFilteredTimeStampForItem()
PlusStatus vtkPlusTimestampedCircularBuffer::CreateFilteredTimeStampForItem |
( |
unsigned long |
itemIndex, |
|
|
double |
inUnfilteredTimestamp, |
|
|
double & |
outFilteredTimestamp, |
|
|
bool & |
filteredTimestampProbablyValid |
|
) |
| |
|
virtual |
Create filtered and unfiltered timestamp for accurate timing of the buffer item. The timing may be inaccurate because the timestamp is attached to the item when Plus receives it and so the timestamp is affected by data transfer speed (which may slightly vary). A line is fitted to the index and timestamp of the last (AveragedItemsForFiltering) items. The filtered timestamp is the time value that corresponds to the frame index according to the fitted line. If the filtered timestamp is very different from the non-filtered timestamp then filteredTimestampProbablyValid will be false and it is recommended not to use that item, because its timestamp is probably incorrect.
Definition at line 529 of file vtkPlusTimestampedCircularBuffer.cxx.
◆ DeepCopy()
◆ GetAveragedItemsForFiltering()
virtual int vtkPlusTimestampedCircularBuffer::GetAveragedItemsForFiltering |
( |
| ) |
|
|
virtual |
Get number of items used for timestamp filtering (with LSQR mimimizer)
◆ GetBufferIndexFromTime()
ItemStatus vtkPlusTimestampedCircularBuffer::GetBufferIndexFromTime |
( |
const double |
time, |
|
|
int & |
bufferIndex |
|
) |
| |
|
virtual |
◆ GetBufferItemPointerFromBufferIndex()
StreamBufferItem * vtkPlusTimestampedCircularBuffer::GetBufferItemPointerFromBufferIndex |
( |
const int |
bufferIndex | ) |
|
|
virtual |
◆ GetBufferItemPointerFromUid()
◆ GetBufferSize()
virtual int vtkPlusTimestampedCircularBuffer::GetBufferSize |
( |
| ) |
|
|
inlinevirtual |
◆ GetFilteredTimeStamp()
◆ GetFrameRate()
double vtkPlusTimestampedCircularBuffer::GetFrameRate |
( |
bool |
ideal = false , |
|
|
double * |
framePeriodStdevSecPtr = NULL |
|
) |
| |
|
virtual |
Get the frame rate from the buffer based on the number of frames in the buffer and the elapsed time. Ideal frame rate shows the mean of the frame periods in the buffer based on the frame number difference (a.k.a. the device frame rate, a.k.a. the frame rate that would have been achieved if frames were not dropped). If framePeriodStdevSecPtr is not null, then the standard deviation of the frame period is computed as well (in seconds) and stored at the specified address.
Definition at line 431 of file vtkPlusTimestampedCircularBuffer.cxx.
◆ GetIndex()
◆ GetItemUidFromTime()
◆ GetLatestItemHasValidFieldData()
bool vtkPlusTimestampedCircularBuffer::GetLatestItemHasValidFieldData |
( |
| ) |
|
|
virtual |
◆ GetLatestItemHasValidTransformData()
bool vtkPlusTimestampedCircularBuffer::GetLatestItemHasValidTransformData |
( |
| ) |
|
|
virtual |
◆ GetLatestItemHasValidVideoData()
bool vtkPlusTimestampedCircularBuffer::GetLatestItemHasValidVideoData |
( |
| ) |
|
|
virtual |
◆ GetLatestItemUidInBuffer()
virtual BufferItemUidType vtkPlusTimestampedCircularBuffer::GetLatestItemUidInBuffer |
( |
| ) |
|
|
inlinevirtual |
◆ GetLatestTimeStamp()
virtual ItemStatus vtkPlusTimestampedCircularBuffer::GetLatestTimeStamp |
( |
double & |
timestamp | ) |
|
|
inlinevirtual |
◆ GetLocalTimeOffsetSec()
virtual double vtkPlusTimestampedCircularBuffer::GetLocalTimeOffsetSec |
( |
| ) |
|
|
virtual |
Get the local time offset in seconds (global = local + offset)
◆ GetNumberOfItems()
virtual int vtkPlusTimestampedCircularBuffer::GetNumberOfItems |
( |
| ) |
|
|
virtual |
Get the number of items in the list (this is not the same as the buffer size, but is rather the number of transforms that have been added to the list). This will never be greater than the BufferSize.
◆ GetOldestItemUidInBuffer()
virtual BufferItemUidType vtkPlusTimestampedCircularBuffer::GetOldestItemUidInBuffer |
( |
| ) |
|
|
inlinevirtual |
◆ GetOldestTimeStamp()
virtual ItemStatus vtkPlusTimestampedCircularBuffer::GetOldestTimeStamp |
( |
double & |
timestamp | ) |
|
|
inlinevirtual |
◆ GetStartTime()
virtual double vtkPlusTimestampedCircularBuffer::GetStartTime |
( |
| ) |
|
|
virtual |
◆ GetTimeStamp()
◆ GetTimeStampLogging()
virtual bool vtkPlusTimestampedCircularBuffer::GetTimeStampLogging |
( |
| ) |
|
|
virtual |
◆ GetTimeStampReporting()
virtual bool vtkPlusTimestampedCircularBuffer::GetTimeStampReporting |
( |
| ) |
|
|
virtual |
◆ GetTimeStampReportTable()
PlusStatus vtkPlusTimestampedCircularBuffer::GetTimeStampReportTable |
( |
vtkTable * |
timeStampReportTable | ) |
|
◆ GetUnfilteredTimeStamp()
◆ Lock()
void vtkPlusTimestampedCircularBuffer::Lock |
( |
| ) |
|
|
inline |
Lock the buffer: this should be done before changing or accessing the data in the buffer if the buffer is being used from multiple threads.
Definition at line 149 of file vtkPlusTimestampedCircularBuffer.h.
◆ New()
◆ PrepareForNewItem()
◆ PrintSelf()
void vtkPlusTimestampedCircularBuffer::PrintSelf |
( |
ostream & |
os, |
|
|
vtkIndent |
indent |
|
) |
| |
◆ SetAveragedItemsForFiltering()
virtual void vtkPlusTimestampedCircularBuffer::SetAveragedItemsForFiltering |
( |
unsigned int |
| ) |
|
|
virtual |
Set number of items used for timestamp filtering (with LSQR mimimizer)
◆ SetBufferSize()
PlusStatus vtkPlusTimestampedCircularBuffer::SetBufferSize |
( |
int |
n | ) |
|
|
virtual |
◆ SetLocalTimeOffsetSec()
virtual void vtkPlusTimestampedCircularBuffer::SetLocalTimeOffsetSec |
( |
double |
| ) |
|
|
virtual |
Set the local time offset in seconds (global = local + offset)
◆ SetStartTime()
virtual void vtkPlusTimestampedCircularBuffer::SetStartTime |
( |
double |
| ) |
|
|
virtual |
◆ SetTimeStampLogging()
virtual void vtkPlusTimestampedCircularBuffer::SetTimeStampLogging |
( |
bool |
| ) |
|
|
virtual |
If TimeStampLogging is enabled then the timestamps and frame indexes that are used for filtering will be logged at TRACE level for diagnostic purposes.
◆ SetTimeStampReporting()
virtual void vtkPlusTimestampedCircularBuffer::SetTimeStampReporting |
( |
bool |
| ) |
|
|
virtual |
If TimeStampReporting is enabled then all filtered and unfiltered timestamp values will be saved in a table for diagnostic purposes.
◆ TimeStampLoggingOff()
virtual void vtkPlusTimestampedCircularBuffer::TimeStampLoggingOff |
( |
| ) |
|
|
virtual |
◆ TimeStampLoggingOn()
virtual void vtkPlusTimestampedCircularBuffer::TimeStampLoggingOn |
( |
| ) |
|
|
virtual |
◆ TimeStampReportingOff()
virtual void vtkPlusTimestampedCircularBuffer::TimeStampReportingOff |
( |
| ) |
|
|
virtual |
◆ TimeStampReportingOn()
virtual void vtkPlusTimestampedCircularBuffer::TimeStampReportingOn |
( |
| ) |
|
|
virtual |
◆ Unlock()
void vtkPlusTimestampedCircularBuffer::Unlock |
( |
| ) |
|
|
inline |
Unlock the buffer: this should be done before changing or accessing the data in the buffer if the buffer is being used from multiple threads.
Definition at line 155 of file vtkPlusTimestampedCircularBuffer.h.
◆ AveragedItemsForFiltering
unsigned int vtkPlusTimestampedCircularBuffer::AveragedItemsForFiltering |
|
protected |
◆ BufferItemContainer
std::deque<StreamBufferItem> vtkPlusTimestampedCircularBuffer::BufferItemContainer |
|
protected |
◆ CurrentTimeStamp
double vtkPlusTimestampedCircularBuffer::CurrentTimeStamp |
|
protected |
◆ FilterContainerIndexVector
vnl_vector<double> vtkPlusTimestampedCircularBuffer::FilterContainerIndexVector |
|
protected |
◆ FilterContainersNumberOfValidElements
unsigned int vtkPlusTimestampedCircularBuffer::FilterContainersNumberOfValidElements |
|
protected |
Number of valid elements in the frame index and timestamp containers (maximum can be equal to AveragedItemsForFiltering)
Definition at line 244 of file vtkPlusTimestampedCircularBuffer.h.
◆ FilterContainersOldestIndex
unsigned int vtkPlusTimestampedCircularBuffer::FilterContainersOldestIndex |
|
protected |
◆ FilterContainerTimestampVector
vnl_vector<double> vtkPlusTimestampedCircularBuffer::FilterContainerTimestampVector |
|
protected |
◆ LatestItemUid
◆ LocalTimeOffsetSec
double vtkPlusTimestampedCircularBuffer::LocalTimeOffsetSec |
|
protected |
◆ MaxAllowedFilteringTimeDifference
double vtkPlusTimestampedCircularBuffer::MaxAllowedFilteringTimeDifference |
|
protected |
Maximum time difference that is allowed between filtered and the non-filtered timestamp (in seconds). If the filtered value differs too much from the non-filtered one, then it rejects the filtering result. This useful for making the timestamp filtering more robust (the LSQR fitting sometimes fails).
Definition at line 254 of file vtkPlusTimestampedCircularBuffer.h.
◆ Mutex
vtkIGSIORecursiveCriticalSection* vtkPlusTimestampedCircularBuffer::Mutex |
|
protected |
◆ NegligibleTimeDifferenceSec
double vtkPlusTimestampedCircularBuffer::NegligibleTimeDifferenceSec |
|
protected |
Due to numerical inaccuracies (e.g, saving a timestamp to a string and reading from it results in a slightly different value) it's better to use a tolerance value when making comparisons.
Definition at line 277 of file vtkPlusTimestampedCircularBuffer.h.
◆ NumberOfItems
int vtkPlusTimestampedCircularBuffer::NumberOfItems |
|
protected |
◆ StartTime
double vtkPlusTimestampedCircularBuffer::StartTime |
|
protected |
◆ TimeStampLogging
bool vtkPlusTimestampedCircularBuffer::TimeStampLogging |
|
protected |
If TimeStampReporting is enabled then all filtered and unfiltered timestamp values will be saved in a table for diagnostic purposes. It generates quite a lot of output in the logs, so it is recommended to use only for diagnostic purposes.
Definition at line 271 of file vtkPlusTimestampedCircularBuffer.h.
◆ TimeStampReporting
bool vtkPlusTimestampedCircularBuffer::TimeStampReporting |
|
protected |
If TimeStampReporting is enabled then all filtered and unfiltered timestamp values will be saved in a table. As the table is continuously growing it should be enabled only temporarily, for diagnostic purposes.
Definition at line 266 of file vtkPlusTimestampedCircularBuffer.h.
◆ TimeStampReportTable
vtkTable* vtkPlusTimestampedCircularBuffer::TimeStampReportTable |
|
protected |
◆ WritePointer
int vtkPlusTimestampedCircularBuffer::WritePointer |
|
protected |
The documentation for this class was generated from the following files: