Computer Assited Medical Intervention Tool Kit  version 5.0
Monitor.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2021 Univ. Grenoble Alpes, CNRS, Grenoble INP, TIMC, 38000 Grenoble, France
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef MONITOR_MONITOR_H
27 #define MONITOR_MONITOR_H
28 
29 #include "MMLAPI.h"
30 
31 #include <string>
32 #include <vector>
33 
34 // Monitor includes
35 #include "MonitoringManager.h"
36 #include <MonitorIn.hxx>
37 
38 // Reference includes
39 #include "Reference.h"
50 
51 public:
52 
60  enum type {
61  SCALAR,
62  SCALARSET,
63  VECTORSET,
64  MATRIX_33SET
65  };
67  static const unsigned int typeCount = 4;
68 
73  Monitor(mml::Monitor* m, MonitoringManager* monitoringManager, Monitor::type type);
75  virtual ~Monitor();
76 
78  virtual void calculate() = 0;
80  virtual void write();
81 
82  int getIndex();
83  double getStartAt();
84  double getStopAt();
85  std::string getReferenceName();
86  std::string getTargetName();
87  Monitor::type getValueType();
88  virtual std::string getTypeName() = 0;
89 
91  bool getValuesOfIndex(int i, double values[]);
93  int getIndexOfValues(const unsigned int i);
95  double getValue(const unsigned int i);
97  unsigned int getNumberOfIndex();
99  unsigned int getNumberOfValues();
100 
101 protected:
103  int index;
105  double startAt;
107  double stopAt;
109  std::vector<Reference*> references;
111  std::string target;
113  std::map<int, std::vector<double> > indexToValuesMap;
115  mml::Monitor* mappedObject;
117  MonitoringManager* monitoringManager;
119  Monitor::type valueType;
121  int dimension;
123  double dx;
125  double dy;
127  double dz;
129  std::vector<double> values;
131  std::vector<int> indexes;
132 };
133 
134 #endif // MONITOR_MONITOR_H
135 
Monitor::stopAt
double stopAt
time to stop monitoring
Definition: Monitor.h:130
timeParameter2double
double timeParameter2double(mml::TimeParameter &t)
convert a TimeParameter (from xsd-cxx generetaed file) to double
Definition: Tools.cpp:69
Monitor::dy
double dy
offset in y direction (if reference is not aligned)
Definition: Monitor.h:148
AtomIterator.h
Monitor::startAt
double startAt
time to start monitoring
Definition: Monitor.h:128
Monitor::Monitor
Monitor(mml::Monitor *m, MonitoringManager *monitoringManager, Monitor::type type)
constructor
Definition: Monitor.cpp:37
Monitor::mappedObject
mml::Monitor * mappedObject
the xsdcxx object representing monitor, used for serialization
Definition: Monitor.h:138
Monitor::getStopAt
double getStopAt()
Definition: Monitor.cpp:212
Monitor::index
int index
index of monitor
Definition: Monitor.h:126
Monitor::getValuesOfIndex
bool getValuesOfIndex(int i, double values[])
populate values with the corresponding values at index i
Definition: Monitor.cpp:227
MonitoringManager.h
Monitor::monitoringManager
MonitoringManager * monitoringManager
monitoring manager
Definition: Monitor.h:140
getValue
static Value getValue(const QMap< const QtProperty *, PrivateData > &propertyMap, const QtProperty *property, const Value &defaultValue=Value())
Definition: qtpropertymanager.cpp:222
Monitor::values
std::vector< double > values
the vector which contains data monitored
Definition: Monitor.h:152
Monitor::SCALARSET
@ SCALARSET
Definition: Monitor.h:108
Structure::getIndex
unsigned int getIndex() const
get the structure unique index (stored in its property)
Definition: Structure.cpp:30
Monitor::getValueType
Monitor::type getValueType()
Definition: Monitor.cpp:222
MML_API
#define MML_API
Definition: MMLAPI.h:43
Monitor::indexes
std::vector< int > indexes
vector which contains target's atoms index (in same order that values associate with)
Definition: Monitor.h:154
Monitor::getIndex
int getIndex()
Definition: Monitor.cpp:201
Monitor::MATRIX_33SET
@ MATRIX_33SET
Definition: Monitor.h:110
Monitor::getReferenceName
std::string getReferenceName()
Definition: Monitor.cpp:192
Monitor::write
virtual void write()
write data stored in values vector into mmlOut file
Definition: Monitor.cpp:171
Monitor::~Monitor
virtual ~Monitor()
destructor
Definition: Monitor.cpp:142
Monitor::SCALAR
@ SCALAR
Definition: Monitor.h:107
Monitor::getIndexOfValues
int getIndexOfValues(const unsigned int i)
get index i of indexes vector
Definition: Monitor.cpp:240
Monitor::getTargetName
std::string getTargetName()
Definition: Monitor.cpp:217
Monitor::dx
double dx
offset in x direction (if reference is not aligned)
Definition: Monitor.h:146
Monitor::indexToValuesMap
std::map< int, std::vector< double > > indexToValuesMap
map between indexes and values
Definition: Monitor.h:136
Reference
A reference is used to compare to simulated data.
Definition: Reference.h:63
Monitor::dz
double dz
offset in z direction (if reference is not aligned)
Definition: Monitor.h:150
Monitor::VECTORSET
@ VECTORSET
Definition: Monitor.h:109
Monitor::type
type
type of the values stored (please update typeCount and doc if you update the enum) SCALAR: the monito...
Definition: Monitor.h:83
AtomIterator::next
void next()
if iteration is not finished, advance to next atom
Definition: AtomIterator.cpp:72
Monitor::getValue
double getValue(const unsigned int i)
get value i of values vector
Definition: Monitor.cpp:250
MMLAPI.h
MonitoringManager
Manager of the benchmark tests. Do simulation loop and tests.
Definition: MonitoringManager.h:50
Monitor::getNumberOfIndex
unsigned int getNumberOfIndex()
get number of index in indexes vetor
Definition: Monitor.cpp:260
AtomIterator::currentAtom
Atom * currentAtom()
return current atom
Definition: AtomIterator.cpp:79
Reference.h
AtomIterator::end
bool end()
return true if iterator is over the last atom
Definition: AtomIterator.cpp:67
AtomIterator
Allow iteration over a set of atoms given by a target list (component name or index list)
Definition: AtomIterator.h:40
Monitor::target
std::string target
the name of the component targeted by the monitor
Definition: Monitor.h:134
MonitoringManager::getInitPml
PhysicalModel * getInitPml()
Definition: MonitoringManager.cpp:258
Monitor
A monitor calculate and store followed data (ex:calculation between current position and references) ...
Definition: Monitor.h:49
Monitor::valueType
Monitor::type valueType
type of the values stored
Definition: Monitor.h:142
Tools.h
Monitor::getNumberOfValues
unsigned int getNumberOfValues()
get number of value in values vetor
Definition: Monitor.cpp:270
Monitor::references
std::vector< Reference * > references
references used when monitor need references
Definition: Monitor.h:132
Monitor.h
Monitor::getStartAt
double getStartAt()
Definition: Monitor.cpp:207
AtomIterator::begin
void begin()
place iterator on first atom
Definition: AtomIterator.cpp:62
Monitor::dimension
int dimension
dimension of data stored
Definition: Monitor.h:144