Sphere models#

This module may be employed to generate sphere models.

src_rec.sphere_mdl.calculate_sphere_from_octahedron(level)#

Inflates the sphere.

Parameters:

level (int) – Target level of the sphere model.

Returns:

  • vert (numpy.ndarray, shape(inflated_vtx_cnt, 3)) – Vertices of the sphere.

  • faces (numpy.ndarray, shape(inflated_face_cnt, 3)) – Faces of the sphere.

src_rec.sphere_mdl.calculate_sphere_from_icosahedron(level)#

Calculates an icosahedron from a specific seed.

Parameters:

level (int) – Level of the icosahedron

Returns:

  • vert (numpy.ndarray, shape(model_vtx_cnt, 3)) – Vertices of the icosahedron.

  • faces (numpy.ndarray, shape(model_face_cnt, 3)) – Faces of the icosahedron.

src_rec.sphere_mdl.read_sphere_from_icosahedron_in_fs_order(fs_path, level)#

Reads an icosahedron from freesurfer.

Parameters:
  • fs_path (string) – Path of the freesurfer directory.

  • level (int) – Level of the icosahedron

Returns:

  • vert (numpy.ndarray, shape(model_vtx_cnt, 3)) – Vertices of the icosahedron.

  • faces (numpy.ndarray, shape(model_face_cnt, 3)) – Faces of the icosahedron.

src_rec.sphere_mdl.prune_closeby_vert(vert, faces, threshold=1e-06)#

Prunes below threshold vertices from the model.

Parameters:
  • vert (numpy.ndarray, shape(model_vtx_cnt, 3)) – Vertices of the icosahedron.

  • faces (numpy.ndarray, shape(model_face_cnt, 3)) – Faces of the icosahedron.

  • level (float) – Distance threshold.

Returns:

  • vert (numpy.ndarray, shape(pruned_vtx_cnt, 3)) – Vertices of the icosahedron.

  • faces (numpy.ndarray, shape(pruned_face_cnt, 3)) – Faces of the icosahedron.

src_rec.sphere_mdl._tessellate_sphere(vert, faces, level)#

Inflates the sphere.

Parameters:
  • vert (numpy.ndarray, shape(initial_vtx_cnt, 3)) – Vertices of the sphere seed.

  • faces (numpy.ndarray, shape(initial_face_cnt, 3)) – Faces of the sphere seed.

  • level (int) – Target level of the sphere model.

Returns:

  • vert (numpy.ndarray, shape(inflated_vtx_cnt, 3)) – Inflated vertices of the sphere.

  • faces (numpy.ndarray, shape(inflated_face_cnt, 3)) – Inflated faces of the sphere.