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_sphere
Union
[str
,Tuple
,np.ndarray
] Either filepath (as str) or surface vertices of source sphere.
- trg_sphere
Union
[str
,Tuple
,np.ndarray
] Either filepath (as str) or surface vertices of target sphere.
- tree
Optional
[KDTree
] Defaults to None.
- src_sphere
- Returns:
- mapping
np.ndarray
Surface mapping of the trg surface.
- distances
np.ndarray
Surface distance of the trg surface.
- tree
KDTree
KDTree of the trg surface.
- mapping
- 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_name
str
Path to label file of source.
- out_label_name
str
Path to label file of output.
- trg_surf
Union
[str
,np.ndarray
] Numpy array of vertex coordinates or filepath to target surface.
- trg_sid
str
Subject id of the target subject (as stored in the output label file header).
- rev_mapping
np.ndarray
A mapping from target to source, listing the corresponding src vertex for each vertex on the trg surface.
- src_label_name
- Returns:
- trg_label
np.ndarray
Target labels.
- trg_values
np.ndarray
Target values.
- trg_label
- 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:
- options
argparse.Namespace
Namespace object holding options.
- 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:
- Raises:
ValueError
If label and values are not the same size.