Sphere models#

This module may be employed to generate sphere models.

src_rec.sphere_mdl.calculate_sphere_from_octahedron(level)#

Inflate the sphere.

Parameters:

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

Returns:

result

  • vertnumpy.ndarray, shape(inflated_vtx_cnt, 3)

    Vertices of the sphere.

  • facesnumpy.ndarray, shape(inflated_face_cnt, 3)

    Faces of the sphere.

Return type:

tuple of (np.ndarray, np.ndarray)

src_rec.sphere_mdl.calculate_sphere_from_icosahedron(level)#

Calculate an icosahedron from a specific seed.

Parameters:

level (int) – Level of the icosahedron

Returns:

result

  • vertnumpy.ndarray, shape(model_vtx_cnt, 3)

    Vertices of the icosahedron.

  • facesnumpy.ndarray, shape(model_face_cnt, 3)

    Faces of the icosahedron.

Return type:

tuple of (np.ndarray, np.ndarray)

src_rec.sphere_mdl.read_sphere_from_icosahedron_in_fs_order(fs_path, level)#

Read an icosahedron from freesurfer.

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

  • level (int) – Level of the icosahedron

Returns:

result

  • vertnumpy.ndarray, shape(model_vtx_cnt, 3)

    Vertices of the icosahedron.

  • facesnumpy.ndarray, shape(model_face_cnt, 3)

    Faces of the icosahedron.

Return type:

tuple of (np.ndarray, np.ndarray)

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.

  • threshold (float) – Distance threshold.

Returns:

result

  • vertnumpy.ndarray, shape(pruned_vtx_cnt, 3)

    Vertices of the icosahedron.

  • facesnumpy.ndarray, shape(pruned_face_cnt, 3)

    Faces of the icosahedron.

Return type:

tuple of (np.ndarray, np.ndarray)

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:

result

  • vertnumpy.ndarray, shape(inflated_vtx_cnt, 3)

    Inflated vertices of the sphere.

  • facesnumpy.ndarray, shape(inflated_face_cnt, 3)

    Inflated faces of the sphere.

Return type:

tuple of (np.ndarray, np.ndarray)