Cortical surface mesh
A surface consists of a set of vertices (each with an x, y, and z coordinate) and a set of faces (triangles; each has three indices referring to the vertices that make up a triangle).
In the present implementation new surfaces should be made using the __init__ constructor; internal fields should not be changed manually
Parameters : | vertices : numpy.ndarray (float)
faces : numpy.ndarray (int)
check: boolean (default=True) :
|
---|---|
Returns : | s : Surface
|
Methods
circlearound_n2d(src, radius[, metric]) | Finds the distances from a center node to surrounding nodes. |
connected_components() | |
connected_components_slow() | |
coordinates_to_box_indices(box_size[, ...]) | ‘Boxes’ coordinates into triples |
dijkstra_distance(src[, maxdistance]) | Computes Dijkstra distance from one node to surrounding nodes |
dijkstra_shortest_path(src[, maxdistance]) | Computes Dijkstra shortest path from one node to surrounding nodes. |
dijkstra_shortest_path_visiting(to_visit) | Computes a list of paths that visit specific nodes |
euclidean_distance(src[, trg]) | Computes Euclidean distance from one node to other nodes |
map_to_high_resolution_surf(highres[, ...]) | Finds a mapping to a higher resolution (denser) surface. |
map_to_high_resolution_surf_slow(highres[, ...]) | Finds a mapping to a higher resolution (denser) surface. |
merge(*others) | Merges the present surface with other surfaces |
nearest_node_index(src_coords[, ...]) | Computes index of nearest node to src |
nodes_on_border([node_indices]) | Determines which nodes are on the border of the surface |
nodes_on_border_paths() | Find paths of nodes on the border |
pairwise_near_nodes([max_distance, src, trg]) | Finds the distances between pairs of nodes |
project_vertices(n[, v]) | Projects vertex coordinates onto a vector |
rotate(theta[, center, unit]) | Rotates the surface |
same_topology(other) | Returns whether another surface has the same topology |
split_by_connected_components() | Splits a surface by its connected components |
sub_surface(src, radius) | Makes a smaller surface consisting of nodes around a center node |
vonoroi_map_to_high_resolution_surf(highres_surf) | Computes a Vonoroi mapping for the current (low-res) surface |
write(fn) |
Average length of edges associated with each face
Returns : | n2el: np.ndarray :
|
---|
Computes the center of mass
Returns : | np.array :
|
---|
Finds the distances from a center node to surrounding nodes.
Parameters : | src : int
radius : float
metric : string (default: euclidean)
|
---|---|
Returns : | n2d : dict
|
‘Boxes’ coordinates into triples
Parameters : | box_sizes: : min_coord: triple or ndarray :
max_coord: triple or ndarray :
master: Surface.surf (default: None) :
|
---|---|
Returns : | boxes_indices: np.ndarray of float :
|
Computes Dijkstra distance from one node to surrounding nodes
Parameters : | src : int
maxdistance: float (default: None) :
|
---|
Computes Dijkstra shortest path from one node to surrounding nodes.
Parameters : | src : int
maxdistance: float (default: None) :
|
---|
Computes a list of paths that visit specific nodes
Parameters : | to_visit: list of int :
|
---|---|
Returns : | path_distances: list of tuple (int, list of int) :
|
A mapping from edges to the face that contains that edge
Returns : | e2f: dict :
|
---|
Computes Euclidean distance from one node to other nodes
Parameters : | src : int or numpy.ndarray
trg : int
|
---|
Length of edges associated with each face
Returns : | f2el: np.ndarray :
|
---|
Returns : | faces: numpy.ndarray (float) :
|
---|
Finds a mapping to a higher resolution (denser) surface. A typical use case is mappings between surfaces generated by MapIcosahedron, where the lower resolution surface defines centers in a searchlight whereas the higher resolution surfaces is used to delineate the grey matter for voxel selection. This function implements an optimization which in most cases yields solutions much faster than map_to_high_resolution_surf_exact, but may fail to find the correct solution for larger values of epsilon.
Parameters : | highres: surf.Surface :
epsilon: float :
accept_only_icosahedron: bool :
|
---|---|
Returns : | low2high: dict :
|
Finds a mapping to a higher resolution (denser) surface. A typical use case is mappings between surfaces generated by MapIcosahedron, where the lower resolution surface defines centers in a searchlight whereas the higher resolution surfaces is used to delineate the grey matter for voxel selection. Unlike the function named “map_to_high_resolution_surf”, this function is both slow and exact—and is actually used in case the former function does not find a solution.
Parameters : | highres: surf.Surface :
epsilon: float :
accept_only_icosahedron: bool :
|
---|---|
Returns : | low2high: dict :
|
Merges the present surface with other surfaces
Parameters : | others: list of surf.Surface :
|
---|---|
Returns : | surf.Surface :
|
Computes index of nearest node to src
Parameters : | src_coords: numpy.ndarray (Px3 array) :
node_mask_idxs numpy.ndarray (default: None): :
|
---|---|
Returns : | idxs: numpy.ndarray (P-valued vector) :
|
Finds the neighbours for each node and their (Euclidean) distance.
Returns : | nbrs : dict
|
---|
Returns : | nfaces: int :
|
---|
A mapping from node indices to the faces that contain those nodes.
Returns : | n2v : dict
|
---|
Determines which nodes are on the border of the surface
Parameters : | node_indices: np.ndarray or None :
|
---|---|
Returns : | on_border: np.ndarray :
|
Find paths of nodes on the border
Returns : | paths: list of lists :
|
---|
Returns : | nvertices: int :
|
---|
Finds the distances between pairs of nodes
Parameters : | max_distance: None or float :
src: array of int or None :
trg: array of int or None :
|
---|---|
Returns : | source_target2distance: dict :
|
Notes
If src and trg are both None, then this function checks if the surface has two components; if so they are taken as source and target. A use case for this behaviour is a surface consisting of two hemispheres
Projects vertex coordinates onto a vector
Parameters : | n: np.ndarray :
v: np.ndarray or None :
|
---|---|
Returns : | p: np.ndarray :
|
Rotates the surface
Parameters : | theta: :
center: :
unit: :
|
---|---|
Returns : | surf.Surface :
|
Returns whether another surface has the same topology
Parameters : | other: surf.Surface :
|
---|---|
Returns : | bool :
|
Splits a surface by its connected components
Returns : | splits: list of surf.Surface :
|
---|
Makes a smaller surface consisting of nodes around a center node
Parameters : | src : int
radius : float
|
---|---|
Returns : | small_surf: Surface :
nsel: np.array (int) :
fsel: np.array (int) :
orig_src: int :
|
Returns : | vertices: numpy.ndarray (int) :
|
---|
Computes a Vonoroi mapping for the current (low-res) surface
Parameters : | highres_surf: Surface :
highres_indices: np.ndarray :
epsilon: float :
accept_only_icosahedron: bool :
|
---|---|
Returns : | high2high_in_low: dict :
|