This repository contains Python codes for our papers (Sci Rep and bioRxiv) "Flexible annotation atlas of the mouse brain: combining and dividing brain structures of the Allen Brain Atlas while maintaining anatomical hierarchy".
Several FAAs are available in an FAAs folder including FAAocd that was used in NeuroImage for cortico-striatal-thalamo (CST) circuitry analysis.
- A flexible annotation atlas (FAA) for the mouse brain is proposed.
- FAA is expected to improve whole brain ROI-definition consistency among laboratories.
- The ROI can be combined or divided objectively while maintaining anatomical hierarchy by leveraging public resources of the Allen Institute for Brain Science.
- A mere two-step procedure with user-specified, text-based inforamtion and Python codes constructs FAAs with total ROI counts from 1 to more than 1,000.
FAA consists of a JSON-formatted text file (anatomical ontology, AO) and a three-dimensional volume file of the mouse brain (annotation volume, AV). Examples of FAA are shown below: FAAsegment (total node count: 4), FAAcoarse (101), and FAAdetailed (1381). In FAAdetailed, nodes for the hippocampus and striatum were divided to two (dorsal and ventral regions) based on gene expression and fiber projection, respectively.
An icicle plot shows anatomical hierarchy of FAAdetailed with a brain structure acronym and its volume in nL ( e.g. "CH_R: 138284" stands for a brain structure "Cerebrum" in the right hemisphere "_R" with a volume size of 138,284 nl). In an FAAs folder, some FAAs and an HTML file for zoomable visualization of anatomical hierarchy are available.
Run Prepare_AObaseAVbase.ipynb
to obtain preprocessed files in the data folder: a text file ( AObase.json) and a volume file ( AVbase.nrrd). This preprocessing eliminates destructive brain structures in the original anatomical ontology file and an annotation volume of the mouse brain provided by the Allen Institute for Brain Science (AIBS).
Copy AObase.json and rename it to AObase_c.json in the data folder. Edit AObase_c.json with a text editor to combine brain structures in AVbase.nrrd. Specifically, delete all contents within brackets [] of a key "children" for an inner node to combine its all descendent nodes. For example, "children": [ {"id":8, ... }, ..., {"id": 73, ..., "voxel_count": 6136}], "voxel_count": null
would be "children": [], "voxel_count": 12345
(Any number, including null, can be used for 12345, as it will be automatically corrected later. Specifying the volume of the ROI facilitates easier viewing of the follwoing visualization) in a file AObase_c.json. Zoomable visualization of anatomical hierarchy of AObase_c.json is available using an HTML file, which facilitates ROI volume check and is useful to decide which brain structures to be combined or not.
Specify text-based information in Divide_nodes.ipynb
: 1) IDs of brain structures ( Target_ROI_IDs), 2) Experimental ID ( ExpID) of a gene of interest, and 3) Acronyms of a brain structures which are a source and a target of neuronal fiber innervation. Then, run Divide_nodes.ipynb
to obtain your FAA, which consists of an ontology text file ( AO_LR_remapID.json) and an annotation volume ( AV_LR_remapID_RAS.nii) in the data folder.
A more detailed manual describing the step-by-step procedure is available here or at Supplementary Tables 2-4 in our paper.
You can use Python scripts (Prepare_AObaseAVbase.py, Divide_nodes.py) instead of these Jupyter notebooks. For example, execute ipython Prepare_AObaseAVbase.py
in an Anaconda Prompt.
There are two methods to share your FAA:
- Direct Sharing: Share the FAA files directly. This includes the 'AO_LR_remapID.json' and 'AV_LR_remapID_RAS.nii' files.
- Text-Based Sharing: Share text-based information that allows others to reconstruct your FAA. For example, please refer to the 'FAAs' folder.
NRRD images can be converted into NiFTI format in RAS orientation using the code.
Structural images, such as 'average_template_100.nrrd', can be downloaded from the Allen Institute's webpage
The pipeline for FAA construction was created with Python (3.7.1) using AllenSDK (version 0.16.1, python3 -m pip install allensdk
) written in Jupyter Notebook (5.6.0) on Anaconda (2018.12) on Windows 10 (Professional 64 bit, Microsoft). The yaml file for the anaconda environment is available in a yaml folder. Nbparameterise is also necessary.