Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation
Chronological Thread
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation
- Date: Wed, 07 Sep 2016 09:16:47 +0200
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:51bXxR18/I1ln7casmDT+DRfVm0co7zxezQtwd8Zse4WLvad9pjvdHbS+e9qxAeQG96KsrQa06GP6vCoGTRZp83Q6DZaKN0EfiRGoP1epxYnDs+BBB+zB9/RRAt+Iv5/UkR49WqwK0lfFZW2TVTTpnqv8WxaQU2nZkJLL+j4UrTfk96wn7jrvcaCOkMW3HHkOOM6bE3v616A7o9O2coqA51y4yOBmmFPdeVSyDEgDnOotDG42P2N+oV++T9bofMr+p0Ie6z7e6MlUe4QV2x+YCgDzZa07lybEUPPuyNdAS0rlAFVCV3F8A3iRcW29TDrs/J0niicJ8z/C74uHi+z6r9iDx7uhiBAPDEw9CTbi9d7kblA8y+nvAF1lo7IfJmOZr05ZbLYZdpcRGxbX88XWTYGGZK5d4JIDuwPOqFToID54lcPthCjHhL/OOS6wTBBgjr63LYxzv86OQDAxg0pWdwU41rOq9CgfpwfW+mu0KjFy33naOlX3iu1qKfFdRUsveudc7t7bc3L2AhlX1feilKKqIv5eTaR/usIummfqeFnULT82CYctwhtr233lY8XgY7Ti9dIkl0=
- Organization: GeometryFactory
Again, nothing catches my eye. If you modified a demo, push it somewhere in github or whatever service and explain how to reproduce
the error.
Sebastien.
On 09/07/2016 07:10 AM, Sukhraj Singh wrote:
Please find the Surface Mesh Deformation Plugin Code having the changes
as attachment.
I think you should be able to find my changes using some code comparison
tool. Else let me know.
It is based on 4.8.1 tag.
A function which is worth noting is as below. In which I get the crash.
=========================================================================================
//Implement it likewise all mesh vertices as roi
void set_segment_vertices_as_roi(Polyhedron mesh)
{
std::size_t number_of_clusters;
double smoothing_lambda ;
// create a property-map for segment-ids
typedef std::map<Polyhedron::Facet_const_handle, std::size_t>
Facet_int_map;
Facet_int_map internal_segment_map;
boost::associative_property_map<Facet_int_map>
segment_property_map(internal_segment_map);
//Run the sdf segmentation algo
int nb_segments =
SegmentPolyhedron(segment_property_map,number_of_clusters, smoothing_lambda
,mesh);
std::vector <Polyhedron> PolySegments;
PolySegments.resize(nb_segments);
//Get the segement of the mesh
GetSegments(mesh,segment_property_map,nb_segments,PolySegments,0);
vertex_iterator vb, ve;
//Make zeroth segment as ROI
for(boost::tie(vb, ve) = vertices(PolySegments[0]); vb != ve; ++vb)
{
//std::cout << __LINE__ << std::endl;
insert_roi_vertex(*vb); // GIVES CRASH
}
}
=============================================================================================
The approach I am following right now is, if you replace the for loop above
with the below code. Also commenting the GetSegments() call, as it will not
be required.
=============================================================================
for(Polyhedron::Facet_iteratorfacet_it=(*polyhedron()).facets_begin();
facet_it!=(*polyhedron()).facets_end();++facet_it) {
if(segment_property_map[facet_it]==segid)// the particular seg id I want
as ROI
{ //Let'stakethethreeverticesoffacet
insert_roi_vertex(facet_it->halfedge()->vertex());
insert_roi_vertex(facet_it->halfedge()->next()->vertex());
insert_roi_vertex(facet_it->halfedge()->opposite()->vertex());
}
}
===============================================================================
Thanks !!
On Wed, Sep 7, 2016 at 2:52 AM, Sebastien Loriot (GeometryFactory)
<
<mailto:>>
wrote:
I see no error in this code, which is why a minimal example showing
the pb would be great.
Sebastien.
On 09/05/2016 03:29 PM, Sukhraj Singh wrote:
Hi Sebastien,
Instead of getting the segment polyhedron and using that to
create an
ROI, I directly used the segment_map to create the ROI as follows.
=============================================================================
for(Polyhedron::Facet_iterator facet_it =
(*polyhedron()).facets_begin();
facet_it != (*polyhedron()).facets_end();
++facet_it)
{
if(segment_property_map[facet_it] == segid)//
the particular seg id I want as ROI
{
//Let's take the three vertices of facet
insert_roi_vertex(facet_it->halfedge()->vertex());
insert_roi_vertex(facet_it->halfedge()->next()->vertex());
insert_roi_vertex(facet_it->halfedge()->opposite()->vertex());
}
}
===============================================================================
I do get a correct ROI as seen form its vizulization, but have a
doubt iterating in this way will push same shared vertex among
faces again.
I have done this because the Segmentation algo implementation
returns a facet based property map.
Thanks to clarify.
On Mon, Sep 5, 2016 at 4:18 PM, Sebastien Loriot (GeometryFactory)
<
<mailto:>
<mailto:
<mailto:>>>
wrote:
Could you provide a full example reproducing the issue?
Thanks,
Sebastien.
On 09/02/2016 07:24 PM, Sukhraj Singh wrote:
Hello,
I am trying to create a particular segment (which is
the output of
surface mesh segmentation) as ROI in Surface Mesh
Deformation.
I implemented following code, which is crashing( psb
comment below)
==========================================================
void set_all_vertices_as_roi()
{
vertex_iterator vb, ve;
for(boost::tie(vb, ve) =
vertices(*polyhedron()); vb
!= ve; ++vb)
{
insert_roi_vertex(*vb);
}
}
//Implement it likewise all mesh vertices as roi
void set_segment_vertices_as_roi(Polyhedron mesh)
{
std::size_t number_of_clusters;
double smoothing_lambda ;
// create a property-map for segment-ids
typedef std::map<Polyhedron::Facet_const_handle,
std::size_t> Facet_int_map;
Facet_int_map internal_segment_map;
boost::associative_property_map<Facet_int_map>
segment_property_map(internal_segment_map);
//Run the sdf segmentation algo
int nb_segments =
SegmentPolyhedron(segment_property_map,number_of_clusters,
smoothing_lambda ,mesh);
std::vector <Polyhedron> PolySegments;
PolySegments.resize(nb_segments);
//Get the segement of the mesh
GetSegments(mesh,segment_property_map,nb_segments,PolySegments,0);
vertex_iterator vb, ve;
//Make zeroth segment as ROI
for(boost::tie(vb, ve) =
vertices(PolySegments[0]);
vb != ve; ++vb)
{
//std::cout << __LINE__ << std::endl;
insert_roi_vertex(*vb); // GIVES CRASH
}
}
===============================================================================
Perhaps it is because of size of deform_mesh, which
was equal to
complete non-segmented mesh size. ?
There is k-ring selection as well, which is used when
picked by
mouse.
Can someone suggest me some other way maybe, so that I
could
make the
mesh segment as ROI
Thanks to provide input.
--
Sukhraj Singh
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>
<https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>>
--
Sukhraj Singh
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>
--
Sukhraj Singh
- [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sukhraj Singh, 09/02/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sebastien Loriot (GeometryFactory), 09/05/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sukhraj Singh, 09/05/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sebastien Loriot (GeometryFactory), 09/06/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sukhraj Singh, 09/07/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sebastien Loriot (GeometryFactory), 09/07/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sukhraj Singh, 09/07/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sebastien Loriot (GeometryFactory), 09/06/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sukhraj Singh, 09/05/2016
- Re: [cgal-discuss] Creating a surface mesh segment as the ROI in Surface mesh deformation, Sebastien Loriot (GeometryFactory), 09/05/2016
Archive powered by MHonArc 2.6.18.