Skip to content

Visualization

reconstruct_surface_marching_cubes(model, domain, device, iso=0, res=100, batch_size=5000, use_tqdm=False)

Extracts isosurfaces of a given neural implicit by using the Marching Cube algorithm.

Parameters:

Name Type Description Default
model Module

the neural implicit function.

required
domain AABB

domain onto which the function values are computed.

required
device str

device onto which the computation are performed.

required
iso int

value of the isosurface. Several values can be provided in a list. If that is the case, one mesh per isovalue will be produced. Defaults to 0.

0
res int

resolution of the marching cubes grid. Defaults to 100.

100
batch_size int

batch size for forward computation. Defaults to 5000.

5000
use_tqdm bool

whether to display a progress bar during computation. Defaults to False.

False

Returns:

Name Type Description
dict dict

returns a dictionnary of ((i,iso), mesh) where i is a unique identifier, iso is the value of the isovalue and mesh is the output surface mesh (mouette.mesh.SurfaceMesh type).

References
  • Marching cubes: A high resolution 3D surface construction algorithm, Lorensen & Cline (1998)
  • https://scikit-image.org/docs/0.25.x/auto_examples/edges/plot_marching_cubes.html

render_lip_constant_2d(img_path, model, domain, device, res=1000, batch_size=5000)

Renders a 2D image of the local Lipschitz constant (maximal gradient norm in a neighborhood) of a 2D model.

Parameters:

Name Type Description Default
img_path str

path to export the render.

required
model Module

the neural model

required
domain AABB

domain onto which the function values are computed.

required
device str

device onto which the computation are performed.

required
res int

resolution of the marching cubes grid. Defaults to 100.

1000
batch_size int

batch size for forward computation. Defaults to 5000.

5000

render_sdf_2d(render_path, contour_path, gradient_path, model, domain, device, res=1000, batch_size=1000, **kwargs)

Renders a 2D SDF

Parameters:

Name Type Description Default
render_path str

Path to export a color render

required
contour_path str

Path to export the contour plot

required
gradient_path str

Path to export the gradient norm plot

required
model

SDF neural model

required
domain AABB

axis aligned bounding box of dimension 2to represent the plotting domain.

required
device str

cpu or cuda

required
res int

Image resolution. Defaults to 800.

1000
batch_size int

Size of forward batches. Defaults to 1000.

1000
Additionnal Args

n_contours (int, optional): Defaults to 16.

render_sdf_quad(render_path, contour_path, gradient_path, model, P0, P1, P2, device, res=800, batch_size=1000, **kwargs)

Renders a 3D sdf along a specified (planar) quad in space.

Parameters:

Name Type Description Default
render_path str

Path to export a color render

required
contour_path str

Path to export the contour plot

required
gradient_path str

Path to export the gradient norm plot

required
model

SDF neural model

required
P0 array

First point of the quad ( (0,0) in parameter space)

required
P1 array

Second point of the quad ( (1,0) in parameter space)

required
P2 array

Thirs point of the quad ( (0,1) in parameter space)

required
device str

cpu or cuda

required
res int

Image resolution. Defaults to 800.

800
batch_size int

Size of forward batches. Defaults to 1000.

1000