Skip to content

Visualization

reconstruct_surface_marching_cubes(model, domain, device, iso=0, res=256, batch_size=2 ** 16, **kwargs)

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 device

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.

256
batch_size int

batch size for forward computation. Defaults to 2**16.

2 ** 16

Other Parameters:

Name Type Description
use_tqdm bool

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

full_precision bool

by default, the computation is done over torch.float16 for faster inference. This flag enables computation in full torch.float32 precision. Defaults to False.

Returns:

Name Type Description
dict dict

returns a dictionary 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=2 * 15)

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 device

device onto which the computation are performed.

required
res int

Image resolution. Defaults to 1000.

1000
batch_size int

batch size for forward computation. Defaults to 2**15.

2 * 15

render_sdf_2d(render_path, contour_path, gradient_path, model, domain, device, res=1000, batch_size=2 ** 15, **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 device

device onto which the computation are performed.

required
res int

Image resolution. Defaults to 800.

1000
batch_size int

Size of forward batches. Defaults to 2**15.

2 ** 15

Other Parameters:

Name Type Description
n_contours int

Defaults to 16.

render_sdf_quad(render_path, contour_path, gradient_path, model, P0, P1, P2, device, res=1000, batch_size=2 ** 15, **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 Tensor

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

required
P1 Tensor

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

required
P2 Tensor

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

required
device device

device onto which the computation are performed.

required
res int

Image resolution. Defaults to 1000.

1000
batch_size int

Size of forward batches. Defaults to 2**15.

2 ** 15