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.rotate_data(data, vertices, triangles, angles, interpolation='barycentric', neighs=None, weights=None)[source]¶
Rotate data/texture on an icosahedron. the decorator allows the user not to care about the interpolation weights and neighbors, which are automatically computed and stored to be reused the first time the function is called with given arguments.
- Parameters:
data : array (n_samples, N, n_features)
data to be rotated.
vertices : array (N, 3)
vertices of the icosahedron.
triangles : array (N, 3)
triangles of the icosahedron.
angles : 3-uplet
the rotation angles in degrees for each axis (Euler representation).
interpolation : str, default ‘barycentric’.
the type of interpolation to use: ‘euclidean’ or ‘barycentric’.
neighs : array (N, 3) or None, default None
neighbors to interpolate from for each vertex. If None, the function computes the neighbors via the provided interpolation method.
weights : array (N, 3) or None, default None
weights associated to each neighbors for each vertex. If None, the function computes the weights via the provided interpolation method.
- Returns:
rotated_data : array (n_samples, n_vertices, n_features)
rotated data.
Examples
>>> from surfify.utils import icosahedron, rotate_data >>> from surfify.datasets import make_classification >>> import matplotlib.pyplot as plt >>> from surfify.plotting import plot_trisurf >>> ico3_verts, ico3_tris = icosahedron(order=3) >>> X, y = make_classification(ico3_verts, n_samples=1, n_classes=3, scale=1, seed=42) >>> y_rot = rotate_data(y.reshape(1, -1, 1), ico3_verts, ico3_tris, (45, 0, 0)).squeeze() >>> plot_trisurf(ico3_verts, triangles=ico3_tris, texture=y, is_label=False) >>> plot_trisurf(ico3_verts, triangles=ico3_tris, texture=y_rot, is_label=False) >>> plt.show()
Follow us