Go to the documentation of this file.
14 #ifndef _SCL_SECURE_NO_WARNINGS
15 #define _SCL_SECURE_NO_WARNINGS
21 #include <QStringList>
24 #ifndef Q_MOC_RUN // MT : very important to avoid the error : ' Parse error at
40 #endif // FEVV_USE_CGAL
41 #ifdef FEVV_USE_OPENMESH
43 #endif // FEVV_USE_OPENMESH
46 #endif // FEVV_USE_AIF
57 #if(FEVV_USE_QT5) // see at the end of .cpp for QT4
58 Q_PLUGIN_METADATA(IID
"MSDM2Plugin")
89 std::cerr <<
"BaseWindow is null or not initialized." << std::endl;
100 auto pm_degrad =
get(boost::vertex_point, m_degraded);
101 auto pm_original =
get(boost::vertex_point, m_original);
105 FaceNormalMap fnm_degrad;
108 std::cout <<
"use existing face-normal map for degraded mesh"
115 std::cout <<
"create face-normal map for degraded mesh" << std::endl;
123 FaceNormalMap fnm_original;
126 std::cout <<
"use existing face-normal map for original mesh"
133 std::cout <<
"create face-normal map for original mesh" << std::endl;
139 m_original, pm_original, fnm_original);
144 vertex_msdm2_map msdm2_pmap;
146 if(
has_map(pmaps_bag_degraded, std::string(
"v:msdm2")))
149 boost::any_cast< vertex_msdm2_map >(pmaps_bag_degraded.at(
"v:msdm2"));
154 FEVV::make_vertex_property_map< MeshSurface, double >(m_degraded);
155 pmaps_bag_degraded[
"v:msdm2"] = msdm2_pmap;
175 std::cout <<
"use existing vertex-color map" << std::endl;
181 std::cout <<
"create vertex-color map" << std::endl;
188 double maxMSDM2, minMSDM2;
192 m_degraded, msdm2_pmap, minMSDM2, maxMSDM2);
199 template<
typename HalfedgeGraph >
206 QMessageBox::information(0,
208 QObject::tr(
"MSMD2 filter only works with Surface_mesh "
212 template<
typename HalfedgeGraph >
226 QMessageBox::information(0,
228 QObject::tr(
"An error occur during MSDM2 filter processing."));
233 std::vector< FEVV::PMapsContainer * > properties_maps =
236 if(mixed_meshes.
size() == 2)
239 if( mixed_meshes[0].second == mixed_meshes[1].second )
243 if(dial1.exec() == QDialog::Accepted)
248 auto m1 =
static_cast< HalfedgeGraph *
>(mixed_meshes[0].first);
249 auto pm1 = properties_maps[0];
250 auto m2 =
static_cast< HalfedgeGraph *
>(mixed_meshes[1].first);
251 auto pm2 = properties_maps[1];
253 double MSDM2 = 0, MSDM2_1_2 = 0, MSDM2_2_1 = 0;
256 process(*m2, *pm2, *m1, *pm1, MSDM2_1_2);
261 process(*m1, *pm1, *m2, *pm2, MSDM2_2_1);
266 MSDM2 = (MSDM2_1_2 + MSDM2_2_1) / 2.;
268 std::cout <<
"MSDM2 :" << MSDM2 << std::endl;
276 QMessageBox::information(0,
278 QObject::tr(
"MSDM2 filter can not be applied on meshes "
279 "with different data structures."));
284 QMessageBox::information(0,
286 QObject::tr(
"MSDM2 filter needs two meshes opened "
287 "with the Surface_mesh data structure."));
300 #ifdef FEVV_USE_OPENMESH
305 applyHG< MeshOpenMesh >(_adapter, _mesh, pmaps_bag);
310 void apply(BaseAdapterVisu *_adapter,
314 applyHG< MeshLCC >(_adapter, _mesh, pmaps_bag);
317 void apply(BaseAdapterVisu *_adapter,
321 applyHG< MeshSurface >(_adapter, _mesh, pmaps_bag);
324 void apply(BaseAdapterVisu *_adapter,
328 applyHG< MeshPolyhedron >(_adapter, _mesh, pmaps_bag);
333 void apply(BaseAdapterVisu *_adapter,
337 applyHG< MeshAIF >(_adapter, _mesh, pmaps_bag);
344 return QStringList() <<
"MSDM2Plugin";
virtual bool isInit() const
void put_property_map(PropertyT p, const MeshT &, PMapsContainer &pmaps, const typename PMap_traits< PropertyT, MeshT >::pmap_type &pmap)
void compute_min_max_vertices(const HalfedgeGraph &g, const PropertyMap &prop_map, MapType &min_metric, MapType &max_metric)
Compute min and max value of a numerical property map for the vertices of a mesh.
PMap_traits< PropertyT, MeshT >::pmap_type get_property_map(PropertyT p, const MeshT &, const PMapsContainer &pmaps)
CGAL::Linear_cell_complex_for_combinatorial_map< 2, 3, CGALLCCTraits, CGALItem > MeshLCC
double tr(double &n)
Truncate a number to 1/1000 (only if BOOLEAN_OPERATIONS_DEBUG is enable)
bool has_map(const PMapsContainer &pmaps, const std::string &map_name)
(refer to Property Maps API)
void addParameters(BaseWindow *_window) override
This class is intended to provide some standard message boxes to all plugins.
virtual Viewer * getViewer()
Functions to retrieve the name of the datastructure according to the mesh type.
CGAL::Surface_mesh< CGALPoint > MeshSurface
void applyHG(BaseAdapterVisu *_adapter, HalfedgeGraph *, FEVV::PMapsContainer *)
bool Generic_plugin(const QString &) override
SimpleWindow is a specialization of QMainWindow. This class the Main Window.
std::map< std::string, boost::any > PMapsContainer
void color_vertices_from_map(const HalfedgeGraph &g, const PropertyMap &prop_map, ColorMap &color_pmap, const MapType min_metric, const MapType max_metric, const ColorMeshLUT &colors=make_LUT())
Fill the color map for the vertices of a mesh using a numerical property map.
void draw_or_redraw_mesh(HalfedgeGraph *_g, PMapsContainer *_pmaps, bool _redraw=false, bool _recomputeNT_if_redraw=false, std::string _mesh_filename=std::string(""), bool _recreateOSGobj_if_redraw=true, float _step=0.)
ColorMeshLUT make_LUT(bool color_in_0_255=true, unsigned int colors_nbr=256, float h1=240, float h2=0)
Create a RGB LUT based on an HSV range. Default range creates a blue-cyan-green-yellow-red gradient.
FEVV::Filters::ColorMeshLUT LUT_CourbureClust
FEVV::PCLPointCloudPointMap::value_type get(const FEVV::PCLPointCloudPointMap &pm, FEVV::PCLPointCloudPointMap::key_type key)
Specialization of get(point_map, key) for PCLPointCloud.
SimpleViewer is a specialization of osgViewer::CompositeViewer. This class is a widget where we are a...
MixedMeshesVector getMeshes()
void onModificationParam(std::string _pluginName, BasePlugin *_plugin)
Interfaces for plugins These interfaces will be used for different plugins.
void process(MeshSurface &m_degraded, FEVV::PMapsContainer &pmaps_bag_degraded, MeshSurface &m_original, FEVV::PMapsContainer &pmaps_bag_original, double &MSDM2)
std::vector< float > ColorMeshLUT
QStringList Generic_plugins() const override
void calculate_face_normals(const HalfedgeGraph &g, const PointMap &pm, FaceNormalMap fnm, const GeometryTraits >)
Calculate "some" normal of all the faces of the considered mesh and populate the argument provided Fa...
std::vector< PMapsContainer * > get_properties_maps()
typename Vertex_pmap_traits< MeshT, ValueT >::pmap_type Vertex_pmap
void process(HalfedgeGraph &, FEVV::PMapsContainer &, HalfedgeGraph &, FEVV::PMapsContainer &, double &)
double process_msdm2_multires(const HalfedgeGraph &m_poly_degrad, const PointMap &pm_degrad, const FaceNormalMap &fnm_degrad, FEVV::PMapsContainer &pmaps_degrad, const GeometryTraits >_degrad, const HalfedgeGraph &m_poly_original, const PointMap &pm_original, const FaceNormalMap &fnm_original, FEVV::PMapsContainer &, const GeometryTraits &, const int nb_level, VertexMSDM2Map &msdm2_pmap, const double maxdim, double &msdm2_value)
OpenMesh::PolyMesh_ArrayKernelT< MyTraits > MeshOpenMesh
void getProcess(bool &one_two, bool &two_one, int &scales, bool &colors)
virtual void apply(BaseAdapterVisu *, void *, FEVV::PMapsContainer *) override
CGAL::Polyhedron_3< CGALKernel, CGAL::Polyhedron_items_with_id_3 > MeshPolyhedron
PMap_traits< PropertyT, MeshT >::pmap_type make_property_map(PropertyT, const MeshT &m)
FEVV::DataStructures::AIF::AIFMesh MeshAIF