STIR  6.2.0
Polaris_MT_File.h
Go to the documentation of this file.
1 //
2 //
3 /*
4  Copyright (C) 2003- 2010, Hammersmith Imanet Ltd
5  For internal GE use only.
6 */
17 #ifndef __stir_Polaris_MT_File__
18 #define __stir_Polaris_MT_File__
19 
22 #include "stir/Succeeded.h"
23 
24 #include <vector>
25 #include <string>
26 #include <ctime>
27 
28 #ifdef BOOST_NO_STDC_NAMESPACE
29 namespace std
30 {
31 using ::time_t;
32 using ::tm;
33 using ::localtime;
34 } // namespace std
35 #endif
36 
37 START_NAMESPACE_STIR
38 
70 {
71 
72 public:
73  struct Record
74  {
75  double sample_time;
76  unsigned int frame_num;
77  unsigned int rand_num;
78  char total_num;
79  Quaternion<float> quat;
81  float rms;
82  unsigned int out_of_FOV;
83  };
84 
85  typedef std::vector<Record>::const_iterator const_iterator;
86 
87  ~Polaris_MT_File(){};
88  Polaris_MT_File(const std::string& filename);
89 
91 
92  Record operator[](unsigned int n) const;
93 
95  const_iterator begin() const { return vector_of_records.begin(); }
96  const_iterator end() const { return vector_of_records.end(); }
97  unsigned long num_samples() const { return vector_of_records.size(); }
98 
100  const_iterator begin_all_tags() const { return vector_of_tags.begin(); }
101  const_iterator end_all_tags() const { return vector_of_tags.end(); }
102  unsigned long num_tags() const { return vector_of_tags.size(); }
103 
105  std::time_t get_start_time_in_secs_since_1970();
106 
107 private:
108  std::time_t start_time_in_secs_since_1970;
109 
110  std::vector<Record> vector_of_records;
111  // this contains all tags and times (even those with 'missing data')
112  std::vector<Record> vector_of_tags;
113 
114  void read_Peter_Bloomfield_mt_file(const std::string& mt_filename, std::istream& mt_stream, const char* const first_line);
115  void read_NDI_Toolviewer_mt_file(const std::string& mt_filename, std::istream& mt_stream, const char* const first_line);
116 };
117 
118 END_NAMESPACE_STIR
119 
120 #endif
Declaration of class stir::Quaternion.
Declaration of class stir::Succeeded.
STL namespace.
const_iterator begin() const
iterators that go through complete records
Definition: Polaris_MT_File.h:95
a class for parsing .mt files output by the Polaris software
Definition: Polaris_MT_File.h:69
const_iterator begin_all_tags() const
iterators that go through all tags recorded by the Polaris
Definition: Polaris_MT_File.h:100
defines the stir::CartesianCoordinate3D<coordT> class