AnchorBar: Difference between revisions
(Created page with "AnchorBar (aka "Analyzer") is a Python program developed to maintain and compute set operations on FreeSurfer annotation files. It's kind of like SPM's MarsBar plugin, but for FreeSurfer. =Requirements= AnchorBar has a few dependencies that must be met: #argparse #sqlite3 #hashlib #nibabel #random #numpy Attempting to run the scripts will fail and report missing libraries. They can be installed using pip: pip install nibabel The utility is (currently) comprised of 3 scr...") |
No edit summary |
||
Line 17: | Line 17: | ||
AnchorBar_tools.py provides tools to list, rename and relabel annotations. Each annotation has a unique ID and descriptors indicating the hemisphere, a shortname used for naming labels generated from set operations, and a path indicating the file path of the source .annot file. The default set of annotations stored in '''annot.db''' includes the 10 pairs of lhrh annotations from fsaverage/label: | AnchorBar_tools.py provides tools to list, rename and relabel annotations. Each annotation has a unique ID and descriptors indicating the hemisphere, a shortname used for naming labels generated from set operations, and a path indicating the file path of the source .annot file. The default set of annotations stored in '''annot.db''' includes the 10 pairs of lhrh annotations from fsaverage/label: | ||
AnchorBar_tools.py --db annot.db --list | AnchorBar_tools.py --db annot.db --list | ||
=Adding Annotations= | |||
The most common use-case for adding annotations is when working with functional ROIs from group analyses. AnchorBar_init.py is the tool that imports new .annot files into the database for later operations. Imported annotations are associated with a unique identifier based on the labels and vertices that make up an annotation. This allows the scripts to recognize and ignore duplicate annotations that might have been given different names, but also to differentiate distinct annotations that happen to have the same name (as is common when working with functional ROIs). | |||
The import process infers the hemisphere from the filename. Functional cluster annotations are unlikely to have an lh/rh prefix, and so will require renaming prior to importing: | |||
cp $SUBJECTS_DIR/RFX/myanalysis.<span style="color:red">lh</span>/a_vs_b/glm.wls/osgm/cache.th30.abs.sig.ocn.annot ./<span style="color:red">lh</span>.a_vs_b.cache.th30.abs.annot | |||
cp $SUBJECTS_DIR/RFX/myanalysis.<span style="color:red">rh</span>/a_vs_b/glm.wls/osgm/cache.th30.abs.sig.ocn.annot ./<span style="color:red">rh</span>.a_vs_b.cache.th30.abs.annot | |||
To add a new annotation: |
Revision as of 15:46, 17 August 2022
AnchorBar (aka "Analyzer") is a Python program developed to maintain and compute set operations on FreeSurfer annotation files. It's kind of like SPM's MarsBar plugin, but for FreeSurfer.
Requirements
AnchorBar has a few dependencies that must be met:
- argparse
- sqlite3
- hashlib
- nibabel
- random
- numpy
Attempting to run the scripts will fail and report missing libraries. They can be installed using pip:
pip install nibabel
The utility is (currently) comprised of 3 scripts. Syntax help for each of these scripts can be obtained using the -h
switch:
$ AnchorBar_tools.py -h usage: AnchorBar_tools.py [-h] [--list] [--labels annot_id] [--db DB] [--rename annot_id new_shortname] [--relabel annot_id label_id new_label_name] [--abbrev annot_id label_id abbrev_label_name]
Querying Available Annotations
AnchorBar_tools.py provides tools to list, rename and relabel annotations. Each annotation has a unique ID and descriptors indicating the hemisphere, a shortname used for naming labels generated from set operations, and a path indicating the file path of the source .annot file. The default set of annotations stored in annot.db includes the 10 pairs of lhrh annotations from fsaverage/label:
AnchorBar_tools.py --db annot.db --list
Adding Annotations
The most common use-case for adding annotations is when working with functional ROIs from group analyses. AnchorBar_init.py is the tool that imports new .annot files into the database for later operations. Imported annotations are associated with a unique identifier based on the labels and vertices that make up an annotation. This allows the scripts to recognize and ignore duplicate annotations that might have been given different names, but also to differentiate distinct annotations that happen to have the same name (as is common when working with functional ROIs).
The import process infers the hemisphere from the filename. Functional cluster annotations are unlikely to have an lh/rh prefix, and so will require renaming prior to importing:
cp $SUBJECTS_DIR/RFX/myanalysis.lh/a_vs_b/glm.wls/osgm/cache.th30.abs.sig.ocn.annot ./lh.a_vs_b.cache.th30.abs.annot cp $SUBJECTS_DIR/RFX/myanalysis.rh/a_vs_b/glm.wls/osgm/cache.th30.abs.sig.ocn.annot ./rh.a_vs_b.cache.th30.abs.annot
To add a new annotation: