Menu

Deep learning for NeuroImaging in Python.

Note

This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the gallery for the big picture.

surfify.utils.sampling.interpolate(vertices, target_vertices, target_triangles)[source]ΒΆ

Interpolate icosahedron missing data by finding nearest neighbors.

Interpolation weights are set to 1 for a regular icosahedron geometry.

Parameters:

vertices : array (n_samples, n_dim)

points of data set.

target_vertices : array (n_query, n_dim)

points to find interpolated texture for.

target_triangles : array (n_query, 3)

the mesh geometry definition.

Returns:

interp_indices : array (n_query, n_feats)

the interpolation indices.

Examples

>>> from surfify.utils import icosahedron, interpolate
>>> from surfify.datasets import make_classification
>>> import matplotlib.pyplot as plt
>>> from surfify.plotting import plot_trisurf
>>> ico2_verts, ico2_tris = icosahedron(order=2)
>>> ico3_verts, ico3_tris = icosahedron(order=3)
>>> X, y = make_classification(ico2_verts, n_samples=1, n_classes=3,
                               scale=1, seed=42)
>>> up_indices = interpolate(ico2_verts, ico3_verts, ico3_tris)
>>> up_indices = np.asarray(list(up_indices.values()))
>>> y_up = y[up_indices.reshape(-1)].reshape(up_indices.shape)
>>> y_up = np.mean(y_up, axis=-1)
>>> plot_trisurf(ico3_verts, triangles=ico3_tris, texture=y_up,
                 is_label=False)
>>> plt.show()

Follow us

© 2025, nidl developers