recon_surf.create_annotation¶
- recon_surf.create_annotation.build_annot(all_labels, all_values, col_ids, trg_white, cortex_label_name=None)[source]¶
Create an annotation from multiple labels.
Here we also consider the label values and overwrite existing labels if values of current are larger (or equal, so the order of the labels matters). No output is written.
- Parameters:
- Returns:
annot_idsIds of build Annotations.
annot_valsValues of build Annotations.
- recon_surf.create_annotation.create_annotation(options, verbose=True)[source]¶
Map (if required), build and write annotation.
(Main function)
- Parameters:
- options
Any Object holding options hemi: “lh” or “rh” for reading labels colortab: colortab with label ids, names and colors labeldir: dir where to find the label files (when reading) white: path/filename of white surface for the annotation outannot: path to output annotation file cortex: optional path to hemi.cortex for optional masking of annotation to only cortex append: optional, e.g. “.thresh” can be appended to label names (I/O) for exvivo FS labels srcsphere: optional, when mapping: path to src sphere.reg trgsphere: optional, when mapping: path to trg sphere.reg.
- verbose
bool True if options should be printed. Defaults to True.
- options
- recon_surf.create_annotation.map_multiple_labels(hemi, src_dir, src_labels, src_sphere_name, trg_sphere_name, trg_white_name, trg_sid, out_dir=None, stop_missing=True)[source]¶
Map a list of labels from one surface (e.g. fsavaerage sphere.reg) to another.
Labels are just names without hemisphere or path, which are passed via hemi, src_dir, out_dir).
- Parameters:
- hemi
str “lh” or “rh” for reading labels.
- src_dir
str Director of the source file.
- src_labels
npt.ArrayLike List of labels.
- src_sphere_name
str Filename of source sphere.
- trg_sphere_name
str Filename of target sphere.
- trg_white_name
str Filename of target white.
- trg_sid
str Target subject id.
- out_dir
Optional[str] Directory for output, defaults to None.
- stop_missing
bool Determines whether to stop on a missing src label file, or continue with a warning. Defaults to True.
- hemi
- Returns:
all_labelsMapped labels.
all_valuesValues of mapped labels.
- Raises:
ValueErrorLabel file missing.
- recon_surf.create_annotation.options_parse()[source]¶
Command line option parser.
- Returns:
optionsObject holding options.
- recon_surf.create_annotation.read_colortable(colortab_name)[source]¶
Read the colortable of given name.
- Parameters:
- colortab_name
str Path and Name of the colortable file.
- colortab_name
- Returns:
idsList of ids.
namesList of names.
colorsList of colors corresponding to ids and names.
- recon_surf.create_annotation.read_multiple_labels(hemi, input_dir, label_names)[source]¶
Read multiple label files from input_dir.
- recon_surf.create_annotation.write_annot(annot_ids, label_names, colortab_name, out_annot, append='')[source]¶
Combine the colortable with the annotations ids to write an annotation file.
The annotation file contains colortable information Care needs to be taken that the colortable file has the same number and order of labels as specified in the label_names list.