29 mitk::IGTLMeasurements::IGTLMeasurements()
50 return context->GetService(serviceRef);
59 mitk::IGTLMeasurements::~IGTLMeasurements()
65 if (timestamp == 0) { timestamp = std::chrono::high_resolution_clock::now().time_since_epoch().count(); }
68 m_MeasurementPoints[measurementPoint].push_back(TimeStampIndexPair(timestamp, index));
75 std::ostream* out =
new std::ofstream(filename.c_str());
79 oldLocale = setlocale(LC_ALL,
nullptr);
83 setlocale(LC_ALL,
"C");
86 unsigned int numberOfMeasurementPoints = (
unsigned int)m_MeasurementPoints.size();
87 *out << numberOfMeasurementPoints <<
"\n";
89 if (numberOfMeasurementPoints == 0)
98 long long offset = m_MeasurementPoints.begin()->second.front().first;
104 for (
auto entry : m_MeasurementPoints)
106 *out << entry.second.size() <<
";";
107 *out << entry.first <<
";";
108 for (TimeStampIndexPair timestampIndexPair : entry.second)
110 *out << (timestampIndexPair.first) <<
";";
111 *out << (timestampIndexPair.second) <<
";";
119 setlocale(LC_ALL, oldLocale);
126 m_MeasurementPoints.clear();
131 m_IsStarted = started;
void AddMeasurement(unsigned int measurementPoint, unsigned int index, long long timestamp=0)
AddMeasurementPoint.
bool ExportData(std::string filename)
AddMeasurementPoint.
static const std::string filename
static IGTLMeasurements * GetInstance()
void SetStarted(bool started)
Is a helper class to make measurments for latency and fps.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
void Reset()
clears all measurements