NifTK
16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
|
Manages a buffer of niftk::IGIDataType. More...
Classes | |
struct | TimeStampComparator |
Public Types | |
typedef std::set < niftk::IGIDataType::Pointer, TimeStampComparator > | BufferType |
Public Member Functions | |
mitkClassMacroItkParent (IGIDataSourceBuffer, itk::Object) mitkNewMacro1Param(IGIDataSourceBuffer | |
BufferType::size_type QString | GetName () const |
void | SetName (QString name) |
bool | Contains (const niftk::IGIDataType::IGITimeType &time) const |
Returns true if the buffer already contains a data item with an exactly matching timestamp, false otherwise. More... | |
void | AddToBuffer (niftk::IGIDataType::Pointer item) |
Adds an item to the buffer, which if the calling object deletes pointers, then the buffer is effectively the owner. More... | |
void | DestroyBuffer () |
Destroy all items in the buffer. More... | |
virtual void | CleanBuffer () |
Clears down the buffer, leaving behind a minimum size buffer. The deletion policy can be overriden by sub-classes. More... | |
void | SetLagInMilliseconds (unsigned int milliseconds) |
Sets the lag in milliseconds. More... | |
unsigned int | GetLagInMilliseconds () const |
Retrieves the lag value in milliseconds. More... | |
BufferType::size_type | GetBufferSize () const |
Returns the number of items in the buffer. More... | |
niftk::IGIDataType::IGITimeType | GetFirstTimeStamp () const |
Returns the time stamp of the first item in the buffer. More... | |
niftk::IGIDataType::IGITimeType | GetLastTimeStamp () const |
Returns the time stamp of the last item in the buffer. More... | |
float | GetFrameRate () const |
Returns the frame rate, in frames per second. More... | |
niftk::IGIDataType::Pointer | GetItem (const niftk::IGIDataType::IGITimeType &time) const |
Gets the item from the buffer most closely before the specified time. More... | |
Protected Member Functions | |
IGIDataSourceBuffer (BufferType::size_type minSize) | |
virtual | ~IGIDataSourceBuffer () |
IGIDataSourceBuffer (const IGIDataSourceBuffer &) | |
IGIDataSourceBuffer & | operator= (const IGIDataSourceBuffer &) |
Protected Attributes | |
itk::FastMutexLock::Pointer | m_Mutex |
BufferType | m_Buffer |
BufferType::iterator | m_BufferIterator |
BufferType::size_type | m_MinimumSize |
QString | m_Name |
Manages a buffer of niftk::IGIDataType.
Note: This class MUST be thread-safe.
Note: All errors should thrown as mitk::Exception or sub-classes thereof.
typedef std::set<niftk::IGIDataType::Pointer, TimeStampComparator> niftk::IGIDataSourceBuffer::BufferType |
|
protected |
|
protectedvirtual |
|
protected |
void niftk::IGIDataSourceBuffer::AddToBuffer | ( | niftk::IGIDataType::Pointer | item | ) |
Adds an item to the buffer, which if the calling object deletes pointers, then the buffer is effectively the owner.
This assumes the timestamp on the item is already correctly set.
|
virtual |
Clears down the buffer, leaving behind a minimum size buffer. The deletion policy can be overriden by sub-classes.
This class simply has a minimum number of items specified in the constructor, so the CleanBuffer method will never reduce the buffer size to less than this amount.
Reimplemented in niftk::IGIWaitForSavedDataSourceBuffer.
bool niftk::IGIDataSourceBuffer::Contains | ( | const niftk::IGIDataType::IGITimeType & | time | ) | const |
Returns true if the buffer already contains a data item with an exactly matching timestamp, false otherwise.
void niftk::IGIDataSourceBuffer::DestroyBuffer | ( | ) |
Destroy all items in the buffer.
If no items are in the buffer, this does nothing.
IGIDataSourceBuffer::BufferType::size_type niftk::IGIDataSourceBuffer::GetBufferSize | ( | ) | const |
Returns the number of items in the buffer.
niftk::IGIDataType::IGITimeType niftk::IGIDataSourceBuffer::GetFirstTimeStamp | ( | ) | const |
Returns the time stamp of the first item in the buffer.
mitk::Exception | if the buffer is empty. |
float niftk::IGIDataSourceBuffer::GetFrameRate | ( | ) | const |
Returns the frame rate, in frames per second.
niftk::IGIDataType::Pointer niftk::IGIDataSourceBuffer::GetItem | ( | const niftk::IGIDataType::IGITimeType & | time | ) | const |
Gets the item from the buffer most closely before the specified time.
If there are no items in the buffer, will return NULL. If the lag is specified, will ofset backwards in time and retrieve that item. If that item is not available, will also return NULL.
unsigned int niftk::IGIDataSourceBuffer::GetLagInMilliseconds | ( | ) | const |
Retrieves the lag value in milliseconds.
niftk::IGIDataType::IGITimeType niftk::IGIDataSourceBuffer::GetLastTimeStamp | ( | ) | const |
Returns the time stamp of the last item in the buffer.
mitk::Exception | if the buffer is empty. |
QString niftk::IGIDataSourceBuffer::GetName | ( | ) | const |
niftk::IGIDataSourceBuffer::mitkClassMacroItkParent | ( | IGIDataSourceBuffer | , |
itk::Object | |||
) |
|
protected |
Sets the lag in milliseconds.
void niftk::IGIDataSourceBuffer::SetName | ( | QString | name | ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |