meshpro / pygalmesh

:spider_web: A Python interface to CGAL's meshing tools
GNU General Public License v3.0
580 stars 57 forks source link

Question about converting volume to surface #194

Open mikami520 opened 2 years ago

mikami520 commented 2 years ago

Hi, I am new to pygalmesh, I have a quick question about converting volume to mesh. Can this library convert nrrd CT volume file to the surface? I have a pipeline following:

  1. Read nrrd file (can be in numpy format)
  2. Convert from volume to surface (can I do simplify method to do compression)
  3. Save surface as new vtk file Is this pipeline possible to achieve?
SoundsSerious commented 8 months ago

+1 for this.

If i try the ring-extrude example with the surface mesh feature I get lots of edge distortion where as the volume method works as described. It would be great to go from volume to surface. This could be as simple as just grabbing the outer faces of the volume and renormalize??

This code similar to the example gives me the following edge distortion on surface mesh:

p = pygalmesh.Polygon2D([[0.5, -0.3], [1.5, -0.3], [1.0, 0.5]])
me = 0.05
domain = pygalmesh.RingExtrude(p, me/100)
mesh = pygalmesh.generate_surface_mesh(
    domain,
    verbose=False,
    min_facet_angle=30,
    max_radius_surface_delaunay_ball=me/2,
    max_facet_distance=me
)

surface_mesh