recon_surf.map_surf_label

recon_surf.map_surf_label.getSurfCorrespondence(src_sphere, trg_sphere, tree=None)[source]

For each vertex in src_sphere find the closest vertex in trg_sphere.

src_sphere and trg_sphere are Nx3 arrays of coordinates on the sphere (usually radius R=100 FS format). They also be a filenames of the corresponding sphere.reg files to be loaded from disk. The KDtree can optionally be passed in cases where src moves around and trg stays fixed.

Parameters:
src_sphereUnion[str, Tuple, np.ndarray]

Either filepath (as str) or surface vertices of source sphere.

trg_sphereUnion[str, Tuple, np.ndarray]

Either filepath (as str) or surface vertices of target sphere.

treeOptional[KDTree]

Defaults to None.

Returns:
mappingnp.ndarray

Surface mapping of the trg surface.

distancesnp.ndarray

Surface distance of the trg surface.

treeKDTree

KDTree of the trg surface.

recon_surf.map_surf_label.mapSurfLabel(src_label_name, out_label_name, trg_surf, trg_sid, rev_mapping)[source]

Map a label from src surface according to the correspondence.

trg_surf is passed so that the label file will list the correct coordinates (usually the white surface), can be vetrices or filename.

Parameters:
src_label_namestr

Path to label file of source.

out_label_namestr

Path to label file of output.

trg_surfUnion[str, np.ndarray]

Numpy array of vertex coordinates or filepath to target surface.

trg_sidstr

Subject id of the target subject (as stored in the output label file header).

rev_mappingnp.ndarray

A mapping from target to source, listing the corresponding src vertex for each vertex on the trg surface.

Returns:
trg_labelnp.ndarray

Target labels.

trg_valuesnp.ndarray

Target values.

Raises:
ValueError

If label and trg vertices are not of same sizes.

recon_surf.map_surf_label.options_parse()[source]

Create a command line interface and return command line options.

Returns:
optionsargparse.Namespace

Namespace object holding options.

recon_surf.map_surf_label.writeSurfLabel(filename, sid, label, values, surf)[source]

Write a FS surface label file to filename (e.g. lh.labelname.label).

Stores sid string in the header, then number of vertices and table of vertex index, RAS wm-surface coords (taken from surf) and values (which can be zero).

Parameters:
filenamestr

File there surface label is written.

sidstr

Subject id.

labelnpt.NDArray[str]

List of label names.

valuesnpt.NDArray

List of values.

surfnpt.NDArray

Surface coordinations.

Raises:
ValueError

If label and values are not the same size.