Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit e55ac7a2 authored by Kenneth Vanhoey's avatar Kenneth Vanhoey
Browse files

export/import for fittingErrors in plygen files

parent 12fe16e7
...@@ -82,7 +82,7 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, ...@@ -82,7 +82,7 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
* @return true * @return true
*/ */
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const FunctorSelect& good = SelectorTrue()) ; bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[6], const typename PFP::TREAL errL2 = AttributeHandler<typename PFP::REAL>(), const typename PFP::TREAL errLmax = AttributeHandler<typename PFP::REAL>(), const typename PFP::TREAL stdDev = AttributeHandler<typename PFP::REAL>(), const FunctorSelect& good = SelectorTrue()) ;
} // namespace Export } // namespace Export
......
...@@ -248,7 +248,7 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, ...@@ -248,7 +248,7 @@ bool exportCTM(typename PFP::MAP& the_map, const typename PFP::TVEC3& position,
} }
template <typename PFP> template <typename PFP>
bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[15], const FunctorSelect& good) bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], const typename PFP::TVEC3 colorPTM[15], const typename PFP::TREAL errL2, const typename PFP::TREAL errLmax, const typename PFP::TREAL stdDev, const FunctorSelect& good)
{ {
typedef typename PFP::MAP MAP; typedef typename PFP::MAP MAP;
typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
...@@ -364,6 +364,12 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -364,6 +364,12 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
out << "property float L3_a12" << std::endl ; out << "property float L3_a12" << std::endl ;
out << "property float L3_a13" << std::endl ; out << "property float L3_a13" << std::endl ;
out << "property float L3_a14" << std::endl ; out << "property float L3_a14" << std::endl ;
if (errL2.isValid())
out << "property float errL2" << std::endl ;
if (errLmax.isValid())
out << "property float errLmax" << std::endl ;
if (stdDev.isValid())
out << "property float stdDev" << std::endl ;
out << "element face " << nbf << std::endl ; out << "element face " << nbf << std::endl ;
out << "property list uchar int vertex_indices" << std::endl ; out << "property list uchar int vertex_indices" << std::endl ;
...@@ -378,7 +384,14 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P ...@@ -378,7 +384,14 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const typename P
out << frame[2][vi][0] << " " << frame[2][vi][1] << " " << frame[2][vi][2] << " " ; out << frame[2][vi][0] << " " << frame[2][vi][1] << " " << frame[2][vi][2] << " " ;
out << colorPTM[0][vi][0] << " " << colorPTM[1][vi][0] << " " << colorPTM[2][vi][0] << " " << colorPTM[3][vi][0] << " " << colorPTM[4][vi][0] << " " << colorPTM[5][vi][0] << " " << colorPTM[6][vi][0] << " " << colorPTM[7][vi][0] << " " << colorPTM[8][vi][0] << " " << colorPTM[9][vi][0] << " " << colorPTM[10][vi][0] << " " << colorPTM[11][vi][0] << " " << colorPTM[12][vi][0] << " " << colorPTM[13][vi][0] << " " << colorPTM[14][vi][0] << " " ; out << colorPTM[0][vi][0] << " " << colorPTM[1][vi][0] << " " << colorPTM[2][vi][0] << " " << colorPTM[3][vi][0] << " " << colorPTM[4][vi][0] << " " << colorPTM[5][vi][0] << " " << colorPTM[6][vi][0] << " " << colorPTM[7][vi][0] << " " << colorPTM[8][vi][0] << " " << colorPTM[9][vi][0] << " " << colorPTM[10][vi][0] << " " << colorPTM[11][vi][0] << " " << colorPTM[12][vi][0] << " " << colorPTM[13][vi][0] << " " << colorPTM[14][vi][0] << " " ;
out << colorPTM[0][vi][1] << " " << colorPTM[1][vi][1] << " " << colorPTM[2][vi][1] << " " << colorPTM[3][vi][1] << " " << colorPTM[4][vi][1] << " " << colorPTM[5][vi][1] << " " << colorPTM[6][vi][1] << " " << colorPTM[7][vi][1] << " " << colorPTM[8][vi][1] << " " << colorPTM[9][vi][1] << " " << colorPTM[10][vi][1] << " " << colorPTM[11][vi][1] << " " << colorPTM[12][vi][1] << " " << colorPTM[13][vi][1] << " " << colorPTM[14][vi][1] << " " ; out << colorPTM[0][vi][1] << " " << colorPTM[1][vi][1] << " " << colorPTM[2][vi][1] << " " << colorPTM[3][vi][1] << " " << colorPTM[4][vi][1] << " " << colorPTM[5][vi][1] << " " << colorPTM[6][vi][1] << " " << colorPTM[7][vi][1] << " " << colorPTM[8][vi][1] << " " << colorPTM[9][vi][1] << " " << colorPTM[10][vi][1] << " " << colorPTM[11][vi][1] << " " << colorPTM[12][vi][1] << " " << colorPTM[13][vi][1] << " " << colorPTM[14][vi][1] << " " ;
out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << " " << colorPTM[6][vi][2] << " " << colorPTM[7][vi][2] << " " << colorPTM[8][vi][2] << " " << colorPTM[9][vi][2] << " " << colorPTM[10][vi][2] << " " << colorPTM[11][vi][2] << " " << colorPTM[12][vi][2] << " " << colorPTM[13][vi][2] << " " << colorPTM[14][vi][2] << std::endl ; out << colorPTM[0][vi][2] << " " << colorPTM[1][vi][2] << " " << colorPTM[2][vi][2] << " " << colorPTM[3][vi][2] << " " << colorPTM[4][vi][2] << " " << colorPTM[5][vi][2] << " " << colorPTM[6][vi][2] << " " << colorPTM[7][vi][2] << " " << colorPTM[8][vi][2] << " " << colorPTM[9][vi][2] << " " << colorPTM[10][vi][2] << " " << colorPTM[11][vi][2] << " " << colorPTM[12][vi][2] << " " << colorPTM[13][vi][2] << " " << colorPTM[14][vi][2] << " " ;
if (errL2.isValid())
out << errL2[vi] << " " ;
if (errLmax.isValid())
out << errLmax[vi] << " " ;
if (stdDev.isValid())
out << stdDev[vi] << " " ;
out << std::endl ;
} }
std::vector<unsigned int>::iterator it = faces.begin(); std::vector<unsigned int>::iterator it = faces.begin();
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
#ifndef __IMPORT_H__ #ifndef __IMPORT_H__
#define __IMPORT_H__ #define __IMPORT_H__
#include "Topology/generic/attributeHandler.h"
#include "Topology/generic/cellmarker.h"
#include "Topology/generic/dartmarker.h"
#include "Algo/Import/import2tables.h" #include "Algo/Import/import2tables.h"
namespace CGoGN namespace CGoGN
......
...@@ -579,6 +579,7 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect ...@@ -579,6 +579,7 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect
return false; return false;
} }
// va au nombre de sommets // va au nombre de sommets
do do
{ {
...@@ -591,6 +592,7 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect ...@@ -591,6 +592,7 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect
std::vector<unsigned int> verticesID; std::vector<unsigned int> verticesID;
verticesID.reserve(nbp); verticesID.reserve(nbp);
AttributeHandler<typename PFP::REAL> errors[3] ;
// va au nombre de faces en comptant le nombre de "property" // va au nombre de faces en comptant le nombre de "property"
unsigned int nb_props = 0; unsigned int nb_props = 0;
do do
...@@ -598,6 +600,16 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect ...@@ -598,6 +600,16 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect
fp >> tag; fp >> tag;
if (tag == std::string("property")) if (tag == std::string("property"))
nb_props++; nb_props++;
if (tag == std::string("errL2")) {
CGoGNout << "errors" << CGoGNendl ;
errors[0] = m_map.template addAttribute<typename PFP::REAL>(VERTEX_ORBIT, "errL2") ;
errors[1] = m_map.template addAttribute<typename PFP::REAL>(VERTEX_ORBIT, "errLmax") ;
errors[2] = m_map.template addAttribute<typename PFP::REAL>(VERTEX_ORBIT, "stdDev") ;
for (unsigned int i = 0 ; i < 3 ; ++i)
attrNames.push_back(errors[i].name()) ;
}
} while (tag != std::string("face")); } while (tag != std::string("face"));
fp >> m_nbFaces; fp >> m_nbFaces;
...@@ -633,6 +645,10 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect ...@@ -633,6 +645,10 @@ bool MeshTablesSurface<PFP>::importPlyPTM(const std::string& filename, std::vect
for (unsigned int k = 0 ; k < 3 ; ++k) for (unsigned int k = 0 ; k < 3 ; ++k)
for (unsigned int l = 0 ; l < 15 ; ++l) for (unsigned int l = 0 ; l < 15 ; ++l)
colorPTM[l][id][k] = properties[12+(15*k+l)]; colorPTM[l][id][k] = properties[12+(15*k+l)];
if (errors[0].isValid())
for (unsigned int k = 0 ; k < 3 ; ++k)
errors[k][id] = properties[57 + k] ;
} }
m_nbVertices = verticesID.size(); m_nbVertices = verticesID.size();
......
Markdown is supported
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