Commit 7b5d6379 authored by sarrazij's avatar sarrazij
Browse files

NEW: MonitorDistanceX, Y & Z to calculate errors

NEW: MonitorComputingTime to get the user time 

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@207 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 977d2998
......@@ -235,6 +235,10 @@ set(monitoring_H
monitor/monitors/MonitorDisplacement.h
monitor/monitors/MonitorNormDisplacement.h
monitor/monitors/MonitorPointToTriangleMeshDistanceFinal.h
monitor/monitors/MonitorComputingTime.h
monitor/monitors/MonitorDistanceX.h
monitor/monitors/MonitorDistanceY.h
monitor/monitors/MonitorDistanceZ.h
reference/Reference.h
tools/Chrono.h
tools/Tools.h
......@@ -288,7 +292,11 @@ set(monitoring_SRCS
monitor/monitors/MonitorSurface.cpp
monitor/monitors/MonitorDisplacement.cpp
monitor/monitors/MonitorNormDisplacement.cpp
monitor/monitors/MonitorPointToTriangleMeshDistanceFinal.cpp
monitor/monitors/MonitorPointToTriangleMeshDistanceFinal.cpp
monitor/monitors/MonitorComputingTime.cpp
monitor/monitors/MonitorDistanceX.cpp
monitor/monitors/MonitorDistanceY.cpp
monitor/monitors/MonitorDistanceZ.cpp
reference/Reference.cpp
tools/Chrono.cpp
tools/Tools.cpp
......@@ -390,6 +398,10 @@ export_headers(
monitor/monitors/MonitorPointSetDistance.h
monitor/monitors/MonitorPointFinalSetDistance.h
monitor/monitors/MonitorPointToTriangleMeshDistanceFinal.h
monitor/monitors/MonitorComputingTime.h
monitor/monitors/MonitorDistanceX.h
monitor/monitors/MonitorDistanceY.h
monitor/monitors/MonitorDistanceZ.h
SUBDIRECTORY monitor/monitors
COMPONENT monitoring
)
......
......@@ -47,7 +47,11 @@ Monitor* MonitorFactory::createMonitor(mml::Monitor* m,MonitoringManager* monito
case mml::MonitorType::PointFinalSetDistance: return (new MonitorPointFinalSetDistance(m,monitoringManager)); break;
case mml::MonitorType::Volume: return (new MonitorVolume(m,monitoringManager)); break;
case mml::MonitorType::Surface: return (new MonitorSurface(m,monitoringManager)); break;
case mml::MonitorType::DistanceToTriangularMeshFinal: return (new MonitorPointToTriangleMeshDistanceFinal(m,monitoringManager)); break;
case mml::MonitorType::DistanceToTriangularMeshFinal: return (new MonitorPointToTriangleMeshDistanceFinal(m,monitoringManager)); break;
case mml::MonitorType::ComputingTime: return (new MonitorComputingTime(m,monitoringManager)); break;
case mml::MonitorType::DistanceX: return (new MonitorDistanceX(m,monitoringManager)); break;
case mml::MonitorType::DistanceY: return (new MonitorDistanceY(m,monitoringManager)); break;
case mml::MonitorType::DistanceZ: return (new MonitorDistanceZ(m,monitoringManager)); break;
default: std::cout << "Monitor type error" << std::endl;
}
return NULL;
......
......@@ -39,6 +39,10 @@
#include "monitor/monitors/MonitorDisplacement.h"
#include "monitor/monitors/MonitorNormDisplacement.h"
#include "monitor/monitors/MonitorPointToTriangleMeshDistanceFinal.h"
#include "monitor/monitors/MonitorComputingTime.h"
#include "monitor/monitors/MonitorDistanceX.h"
#include "monitor/monitors/MonitorDistanceY.h"
#include "monitor/monitors/MonitorDistanceZ.h"
/**
* A factory to create monitors
......
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2012 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#include "monitor/monitors/MonitorComputingTime.h"
#include "tools/AtomIterator.h"
// -------------------- constructor --------------------
MonitorComputingTime::MonitorComputingTime(mml::Monitor* m,MonitoringManager* monitoringManager): Monitor(m,monitoringManager,SCALAR){}
// -------------------- destructor --------------------
MonitorComputingTime::~MonitorComputingTime(){}
// -------------------- calculate --------------------
void MonitorComputingTime::calculate(){
values.clear();
values.push_back(monitoringManager->getComputingTime());
write();
}
// -------------------- getType --------------------
std::string MonitorComputingTime::getTypeName()
{
return "ComputingTime";
}
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2012 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef MONITOR_MONITORS_MONITORCOMPUTINGTIME_H
#define MONITOR_MONITORS_MONITORCOMPUTINGTIME_H
#include <string>
#include "MonitorIn.hxx"
#include "monitor/Monitor.h"
/**
* A monitor based on the computing time
*/
class MonitorComputingTime: public Monitor{
public:
/**
* constructor
* @param m the xsdcxx generated monitor
*/
MonitorComputingTime(mml::Monitor* m,MonitoringManager* monitoringManager);
/// destructor
~MonitorComputingTime();
/// calculate current followed data and store them in values vector
void calculate();
/// return a string relative to monitor type
std::string getTypeName();
};
#endif // MONITOR_MONITORS_MONITORCOMPUTINGTIME_H
\ No newline at end of file
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2012 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#include "monitor/monitors/MonitorDistanceX.h"
#include "tools/Tools.h"
#include "tools/AtomIterator.h"
#include "math.h"
// -------------------- constructor --------------------
MonitorDistanceX::MonitorDistanceX(mml::Monitor* m,MonitoringManager* monitoringManager): Monitor(m,monitoringManager,SCALARSET){}
// -------------------- destructor --------------------
MonitorDistanceX::~MonitorDistanceX(){}
// -------------------- calculate --------------------
void MonitorDistanceX::calculate(){
values.clear();
double posSimul[3];
double posRef[3];
double realTime;
AtomIterator it=AtomIterator(monitoringManager->getPml(),target);
for (it.begin();!it.end();it.next()){
it.currentAtom()->getPosition(posSimul);
posSimul[0]=posSimul[0]+dx;
if (references[0]->getMonitoredData("Position",monitoringManager->getCurrentTime(),it.currentAtom()->getIndex(),realTime,posRef)){
double resultat = fabs(posSimul[0]-posRef[0]);
values.push_back(resultat);
}else{
cerr << "getPosition non implemented" << endl;
}
}
write();
}
// -------------------- getType --------------------
string MonitorDistanceX::getTypeName()
{
return "Distance x";
}
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2012 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef MONITOR_MONITORS_MONITORDISTANCEX_H
#define MONITOR_MONITORS_MONITORDISTANCEX_H
#include <string>
#include "MonitorIn.hxx"
#include "monitor/Monitor.h"
/**
* A monitor that calculate the distance between two points
*/
class MonitorDistanceX: public Monitor{
public:
/**
* constructor
* @param m the xsdcxx generated monitor
*/
MonitorDistanceX(mml::Monitor* m,MonitoringManager* monitoringManager);
/// destructor
~MonitorDistanceX();
/// calculate current followed data and store them in values vector
void calculate();
/// return a string relative to monitor type
std::string getTypeName();
};
#endif // MONITOR_MONITORS_MONITORDISTANCEX_H
\ No newline at end of file
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2012 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#include "monitor/monitors/MonitorDistanceY.h"
#include "tools/Tools.h"
#include "tools/AtomIterator.h"
#include "math.h"
// -------------------- constructor --------------------
MonitorDistanceY::MonitorDistanceY(mml::Monitor* m,MonitoringManager* monitoringManager): Monitor(m,monitoringManager,SCALARSET){}
// -------------------- destructor --------------------
MonitorDistanceY::~MonitorDistanceY(){}
// -------------------- calculate --------------------
void MonitorDistanceY::calculate(){
values.clear();
double posSimul[3];
double posRef[3];
double realTime;
AtomIterator it=AtomIterator(monitoringManager->getPml(),target);
for (it.begin();!it.end();it.next()){
it.currentAtom()->getPosition(posSimul);
posSimul[1]=posSimul[1]+dy;
if (references[0]->getMonitoredData("Position",monitoringManager->getCurrentTime(),it.currentAtom()->getIndex(),realTime,posRef)){
double resultat = fabs(posSimul[1]-posRef[1]);
values.push_back(resultat);
}else{
cerr << "getPosition non implemented" << endl;
}
}
write();
}
// -------------------- getType --------------------
string MonitorDistanceY::getTypeName()
{
return "Distance y";
}
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2012 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef MONITOR_MONITORS_MONITORDISTANCEY_H
#define MONITOR_MONITORS_MONITORDISTANCEY_H
#include <string>
#include "MonitorIn.hxx"
#include "monitor/Monitor.h"
/**
* A monitor that calculate the distance between two points
*/
class MonitorDistanceY: public Monitor{
public:
/**
* constructor
* @param m the xsdcxx generated monitor
*/
MonitorDistanceY(mml::Monitor* m,MonitoringManager* monitoringManager);
/// destructor
~MonitorDistanceY();
/// calculate current followed data and store them in values vector
void calculate();
/// return a string relative to monitor type
std::string getTypeName();
};
#endif // MONITOR_MONITORS_MONITORDISTANCEY_H
\ No newline at end of file
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2012 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#include "monitor/monitors/MonitorDistanceZ.h"
#include "tools/Tools.h"
#include "tools/AtomIterator.h"
#include "math.h"
// -------------------- constructor --------------------
MonitorDistanceZ::MonitorDistanceZ(mml::Monitor* m,MonitoringManager* monitoringManager): Monitor(m,monitoringManager,SCALARSET){}
// -------------------- destructor --------------------
MonitorDistanceZ::~MonitorDistanceZ(){}
// -------------------- calculate --------------------
void MonitorDistanceZ::calculate(){
values.clear();
double posSimul[3];
double posRef[3];
double realTime;
AtomIterator it=AtomIterator(monitoringManager->getPml(),target);
for (it.begin();!it.end();it.next()){
it.currentAtom()->getPosition(posSimul);
posSimul[2]=posSimul[2]+dz;
if (references[0]->getMonitoredData("Position",monitoringManager->getCurrentTime(),it.currentAtom()->getIndex(),realTime,posRef)){
double resultat = fabs(posSimul[2]-posRef[2]);
values.push_back(resultat);
}else{
cerr << "getPosition non implemented" << endl;
}
}
write();
}
// -------------------- getType --------------------
string MonitorDistanceZ::getTypeName()
{
return "Distance z";
}
/*****************************************************************************
$CAMITK_LICENCE_BEGIN$
CamiTK - Computer Assisted Medical Intervention ToolKit
Visit http://camitk.imag.fr for more information
Copyright (C) 2012 Celine Fouard, Emmanuel Promayon, Yannick Keraval
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
$CAMITK_LICENCE_END$
*****************************************************************************/
#ifndef MONITOR_MONITORS_MONITORDISTANCEZ_H
#define MONITOR_MONITORS_MONITORDISTANCEZ_H
#include <string>
#include "MonitorIn.hxx"
#include "monitor/Monitor.h"
/**
* A monitor that calculate the distance between two points
*/
class MonitorDistanceZ: public Monitor{
public:
/**
* constructor
* @param m the xsdcxx generated monitor
*/
MonitorDistanceZ(mml::Monitor* m,MonitoringManager* monitoringManager);
/// destructor
~MonitorDistanceZ();
/// calculate current followed data and store them in values vector
void calculate();
/// return a string relative to monitor type
std::string getTypeName();
};
#endif // MONITOR_MONITORS_MONITORDISTANCEZ_H
\ No newline at end of file
......@@ -239,6 +239,10 @@ $CAMITK_LICENCE_END$
<xsd:enumeration value="Displacement"/>
<xsd:enumeration value="NormDisplacement"/>
<xsd:enumeration value="DistanceToTriangularMeshFinal"/>
<xsd:enumeration value="ComputingTime"/>
<xsd:enumeration value="DistanceX"/>
<xsd:enumeration value="DistanceY"/>
<xsd:enumeration value="DistanceZ"/>
</xsd:restriction>
</xsd:simpleType>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment