MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkUSNavigationStepTimer.h
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
13#ifndef mitkUSNavigationStepTimer_h
14#define mitkUSNavigationStepTimer_h
15
16#include <mitkCommon.h>
17
18#include <itkObjectFactory.h>
19#include <itkTimeProbe.h>
20
21namespace mitk {
22
35class USNavigationStepTimer : public itk::Object {
36public:
39
45 void Stop();
46
50 void Reset();
51
57 void SetOutputFileName(std::string filename);
58
62 void SetActiveIndex(unsigned int index, std::string description = "");
63
67 double GetTotalDuration();
68
69
74 double GetDurationForIndex(unsigned int index);
75
80 void ReadFromFile(std::string filename);
81
82protected:
84 ~USNavigationStepTimer() override;
85
87 unsigned int index;
88 double duration;
89 std::string description;
92 };
93
94 void FinishCurrentIndex();
95 void WriteLineToFile(const DurationForIndex& element);
97
98 typedef std::vector<DurationForIndex> DurationsVector;
100
101 unsigned int m_CurrentIndex;
103 itk::TimeProbe m_TimeProbe;
104
105 std::string m_OutputFileName;
106};
107} // namespace mitk
108
109#endif
Timer for measureing the durations of navigation steps. The different steps are identified by indices...
void Reset()
Removes all measured durations.
void ReadFromFile(std::string filename)
Read durations from the file of the given file name. This file must have exactly the same format as i...
void Stop()
Stops the timer for the current index. The measured time to if written to the output file if a file p...
std::vector< DurationForIndex > DurationsVector
double GetTotalDuration()
Returns the sum of all durations.
double GetDurationForIndex(unsigned int index)
Returns measured duration for the step with the given index. All measurements of this index are summe...
void SetActiveIndex(unsigned int index, std::string description="")
Starts measurement for the step with the given index.
mitkClassMacroItkParent(USNavigationStepTimer, itk::Object)
void WriteLineToFile(const DurationForIndex &element)
itkNewMacro(USNavigationStepTimer)
void SetOutputFileName(std::string filename)
Sets the name of the output file. If there are already measurements of durations, they are written to...
IGT Exceptions.
DurationForIndex(unsigned int index, double duration)
DurationForIndex(unsigned int index, double duration, std::string description)