NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkIGIDataSourceBuffer.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkIGIDataSourceBuffer_h
16 #define niftkIGIDataSourceBuffer_h
17 
18 #include <niftkIGIDataSourcesExports.h>
19 #include <niftkIGIDataType.h>
20 
21 #include <mitkCommon.h>
22 
23 #include <itkVersion.h>
24 #include <itkObject.h>
25 #include <itkObjectFactoryBase.h>
26 #include <itkFastMutexLock.h>
27 
28 #include <set>
29 #include <QString>
30 
31 namespace niftk
32 {
33 
42 class NIFTKIGIDATASOURCES_EXPORT IGIDataSourceBuffer : public itk::Object
43 {
44 public:
45 
47  {
48  bool operator()(const niftk::IGIDataType::Pointer& a, const niftk::IGIDataType::Pointer& b);
49  };
50 
51  typedef std::set<niftk::IGIDataType::Pointer, TimeStampComparator> BufferType;
52 
53  mitkClassMacroItkParent(IGIDataSourceBuffer, itk::Object)
54  mitkNewMacro1Param(IGIDataSourceBuffer, BufferType::size_type)
55 
56  QString GetName() const;
57  void SetName(QString name);
58 
63  bool Contains(const niftk::IGIDataType::IGITimeType& time) const;
64 
71  void AddToBuffer(niftk::IGIDataType::Pointer item);
72 
78  void DestroyBuffer();
79 
88  virtual void CleanBuffer();
89 
93  void SetLagInMilliseconds(unsigned int milliseconds);
94 
98  unsigned int GetLagInMilliseconds() const;
99 
103  BufferType::size_type GetBufferSize() const;
104 
109  niftk::IGIDataType::IGITimeType GetFirstTimeStamp() const;
110 
115  niftk::IGIDataType::IGITimeType GetLastTimeStamp() const;
116 
120  float GetFrameRate() const;
121 
129  niftk::IGIDataType::Pointer GetItem(const niftk::IGIDataType::IGITimeType& time) const;
130 
131 protected:
132 
133  IGIDataSourceBuffer(BufferType::size_type minSize); // Purposefully hidden.
134  virtual ~IGIDataSourceBuffer(); // Purposefully hidden.
135 
136  IGIDataSourceBuffer(const IGIDataSourceBuffer&); // Purposefully not implemented.
137  IGIDataSourceBuffer& operator=(const IGIDataSourceBuffer&); // Purposefully not implemented.
138 
139  itk::FastMutexLock::Pointer m_Mutex;
140  BufferType m_Buffer;
141  BufferType::iterator m_BufferIterator;
142  BufferType::size_type m_MinimumSize;
143  QString m_Name;
144 
145 private:
146 
147  void UpdateFrameRate();
148 
149  float m_FrameRate;
150  niftk::IGIDataType::IGITimeType m_Lag; // stored in nanoseconds.
151 
152 };
153 
154 } // end namespace
155 
156 #endif
std::set< niftk::IGIDataType::Pointer, TimeStampComparator > BufferType
Definition: niftkIGIDataSourceBuffer.h:51
Definition: niftkIGIDataSourceBuffer.h:46
Definition: niftkITKAffineResampleImage.cxx:74
GLdouble GLdouble GLdouble b
Definition: glew.h:7885
Abstract base class for IGI Data, such as objects containing tracking data, video frames or ultrasoun...
Definition: niftkIGIDataType.h:35
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:8272
Manages a buffer of niftk::IGIDataType.
Definition: niftkIGIDataSourceBuffer.h:42
GLuint const GLchar * name
Definition: glew.h:1798
Definition: niftkExceptionObject.h:21