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.coord.text2grid(vertices, texture, resx=192, resy=192)[source]ΒΆ

Convert a texture onto a spherical surface into an image by evenly resampling the spherical surface with respect to sin(e) and a, where e and a are elevation and azimuth, respectively. Nearest-neighbor interpolation is used to convert data from the 3-D surface to the 2-D grid.

Parameters:

vertices : array (N, 3)

x, y, z coordinates of an icosahedron.

texture : array (N, )

the input icosahedron texture.

resx : int, default 192

the generated image number of samples in the x direction.

resy : int, default 192

the generated image number of samples in the y direction.

Returns:

proj : array (resx, resy)

the projecteed texture.

See also

grid2text

Examples

>>> from surfify.utils import icosahedron, text2grid
>>> from surfify.datasets import make_classification
>>> import matplotlib.pyplot as plt
>>> from surfify.plotting import plot_trisurf
>>> ico2_verts, ico2_tris = icosahedron(order=2)
>>> X, y = make_classification(ico2_verts, n_samples=1, n_classes=3,
                               scale=1, seed=42)
>>> y_grid = text2grid(ico2_verts, y)
>>> plt.imshow(y_grid)
>>> plt.show()

Follow us

© 2025, nidl developers