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.patch_tri(order=6, standard_ico=False, size=3, direct_neighbor=False, n_jobs=1)[source]ΒΆ

Build triangular patches that map the icosahedron.

This is the base function for Vision Transformers.

Parameters:

order : int, default 6

the icosahedron order.

standard_ico : bool, default False

optionally uses a standard icosahedron tessalation. FreeSurfer tesselation is used by default.

size : int, default 3

the patch size.

direct_neighbor : bool, default False

order patch vertices.

n_jobs : int, default 1

the maximum number of concurrently running jobs.

Returns:

patches : array

triangular patches containing icosahedron indices.

Examples

>>> from surfify.utils import icosahedron, patch_tri
>>> import matplotlib.pyplot as plt
>>> from surfify.plotting import plot_trisurf
>>> ico3_verts, ico3_tris = icosahedron(order=3)
>>> patches = patch_tri(order=3, size=1, size=1)
>>> fig, ax = plt.subplots(1, 1, subplot_kw={
        "projection": "3d", "aspect": "auto"}, figsize=(10, 10))
>>> plot_trisurf(ico2_verts, triangles=ico2_tris, colorbar=False, fig=fig,
                 ax=ax)
>>> for cnt, idx in enumerate(patches[10]):
>>>     point = ico3_verts[idx]
>>>     ax.scatter(point[0], point[1], point[2], marker="o", s=100)
>>> plt.show()

Follow us

© 2025, nidl developers