Computer Assited Medical Intervention Tool Kit  version 5.0
Criterion.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 STOPPINGCRITERION_STOPPINGCRITERIA_CRITERIA_H
27 #define STOPPINGCRITERION_STOPPINGCRITERIA_CRITERIA_H
28 
29 #include "MMLAPI.h"
30 
31 #include <vector>
32 
33 #include <MonitorIn.hxx>
34 
35 // Stopping criteria includes
36 #include "StoppingCriterion.h"
37 #include "Method.h"
48 public:
53  Criterion(mml::Criteria* c, MonitoringManager* monitoringManager, MultipleCriterion* parent = nullptr);
55  ~Criterion() override;
56 
58  bool checkCriterion() override;
59 
61  int getNumberOfChildren() override;
62 
64  StoppingCriterion* getChild(const unsigned int i) override;
65 
67  std::string getName() override = 0;
68 
70  std::string getMethodString();
71 
73  std::string scopeToString();
74 
75 protected:
77  Method* meth;
79  double factor;
81  std::vector<double> values;
83  virtual void calculate() = 0;
85  void write();
87  mml::Criteria* mappedObject;
89  std::string unit;
90 
91 };
92 
93 #endif // STOPPINGCRITERION_STOPPINGCRITERIA_CRITERIA_H
Criterion::scopeToString
std::string scopeToString()
get Method scope as string
Definition: Criterion.cpp:84
Criterion
Class which represents a simple criterion A criterion can be checked using checkCriterion method to k...
Definition: Criterion.h:47
Criterion::unit
std::string unit
unit
Definition: Criterion.h:112
Criterion::mappedObject
mml::Criteria * mappedObject
the xsdcxx object representing criterion, used for serialization
Definition: Criterion.h:110
Method::scopeTosString
std::string scopeTosString()
get a String of the scope
Definition: Method.cpp:90
MethodFactory::createMethod
static Method * createMethod(mml::Method &m)
create a method according to the xsdcxx object method
Definition: MethodFactory.cpp:38
MML_API
#define MML_API
Definition: MMLAPI.h:43
Criterion::getChild
StoppingCriterion * getChild(const unsigned int i) override
get the child repered by index, return null if no child
Definition: Criterion.cpp:69
Criterion::getNumberOfChildren
int getNumberOfChildren() override
get number of childre; return -1 for non multiple criteria
Definition: Criterion.cpp:74
StoppingCriterion::getName
virtual std::string getName()=0
get stopping criterion name
Criterion::meth
Method * meth
the computationnal method used to check if criterion is true
Definition: Criterion.h:100
StoppingCriterion::checkCriterion
virtual bool checkCriterion()=0
return true if the stopping criterion is reach
Criterion::calculate
virtual void calculate()=0
calculate stopping criteria data and store it into values vector
StoppingCriterion::getChild
virtual StoppingCriterion * getChild(const unsigned int i)=0
get the child repered by index, return nullptr if no child
Method::test
virtual bool test(std::vector< double > &values)
return true if the vector of fouble values passed the test (see scope)
Definition: Method.cpp:56
Criterion::Criterion
Criterion(mml::Criteria *c, MonitoringManager *monitoringManager, MultipleCriterion *parent=nullptr)
constructor
Definition: Criterion.cpp:36
MethodFactory.h
MMLAPI.h
StoppingCriterion.h
Method.h
MonitoringManager
Manager of the benchmark tests. Do simulation loop and tests.
Definition: MonitoringManager.h:50
StoppingCriterion::getNumberOfChildren
virtual int getNumberOfChildren()=0
get number of childre; return -1 for non multiple criteria
Criterion::getMethodString
std::string getMethodString()
get Method Name
Definition: Criterion.cpp:79
StoppingCriterion
class which represent the stopping criterion to check to stop simulation a StoppingCriterion is eithe...
Definition: StoppingCriterion.h:48
Criterion::write
void write()
write values in the mmlOut file
Definition: Criterion.cpp:58
Criterion::values
std::vector< double > values
vector that stores current data of the stopping criteria
Definition: Criterion.h:104
Criterion.h
Criterion::checkCriterion
bool checkCriterion() override
return true if the criterion is reach
Definition: Criterion.cpp:52
Criterion::~Criterion
~Criterion() override
destructor
Definition: Criterion.cpp:43
MultipleCriterion
class which represents a multiple criterion a multiple criterion is either an OrMUltipleCriterion or ...
Definition: MultipleCriterion.h:45
Method::toString
virtual std::string toString()=0
get Method name
Method
A Method represent how to make the boolean assessment with criteria data (a vector of double)
Definition: Method.h:42