Skip to content

Commit

Permalink
Added references to CCFv3 new atlas with extended annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
favreau committed Nov 14, 2024
1 parent a30a3d9 commit 52901e5
Show file tree
Hide file tree
Showing 31 changed files with 35,933 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,19 @@ On the third anniversary of the first lock-down, we look back at how #MachineLea
</a>
</div>


## An extended and improved CCFv3 annotation

The Blue Brain Project presents the first comprehensive mouse brain atlas based on the Allen Institute’s Common Coordinate Framework version 3. This atlas includes anatomical Nissl reference data that has been precisely aligned within this reference space, providing the scientific community with a crucial tool for automated and accurate mapping of a wide range of histological slices or volumes of the mouse brain. We have also integrated additional layers, such as the spinal cord, barrel columns, as well as the granular and molecular layers in the cerebellum. This allowed us to create an enhanced version of our cell atlas, mapping every cell in the mouse brain by location, region, and type. From this data, properties such as neuron soma and morphology can be derived, paving the way for increasingly accurate simulation models.

<div align="center">
<a href="https://www.youtube.com/watch?v=upulBqczL0g"/>
<img src="https://github.com/BlueBrain/BioExplorer/blob/master/bioexplorer/pythonsdk/doc/source/images/ccfv3_movie_preview.png" style="width:50%;">
</a>
</div>

* [An extended and improved CCFv3 annotation and Nissl atlas of the entire mouse brain](https://www.biorxiv.org/content/10.1101/2024.11.06.622212v1)

## The Harvard Brain

Do you want want to know more about the full story? Read the [Studies In Silico: An Interview With Cyrille Favreau On EPFL’s Blue Brain Project](http://www.theharvardbrain.com/spring-2023-8203lara-ota-buse-toksoumlz-and-kei-hayashi.html).
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "f992ef9f",
"metadata": {},
"source": [
"# BioExplorer - CCFv3\n",
"![](../bioexplorer_ccfv3_banner.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5b2edd2b",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import os\n",
"import glob\n",
"from tqdm import tqdm\n",
"\n",
"atlas_data_folder = os.getenv('ATLAS_DATA_FOLDER')\n",
"\n",
"data_folder = os.path.join(atlas_data_folder, 'mouse', 'v3')\n",
"f = open(os.path.join(data_folder, 'brain_regions.json'))\n",
"obj = json.load(f)\n",
"\n",
"region_colors=dict()\n",
"def node_color(node):\n",
" node_id = node['id']\n",
" color = node['color_hex_triplet']\n",
" region_colors[node_id] = color\n",
" for child in node['children']:\n",
" node_color(child)\n",
"\n",
"for node in obj['msg']:\n",
" node_color(node)\n",
"\n",
"def hex_to_rgb(value):\n",
" value = value.lstrip('#')\n",
" lv = len(value)\n",
" return tuple(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3))\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ca01b536",
"metadata": {},
"outputs": [],
"source": [
"def add_material_to_obj(obj_file, material_name, diffuse_color):\n",
" # Open the OBJ file in read mode\n",
" with open(obj_file, 'r') as file:\n",
" lines = file.readlines()\n",
"\n",
" # Insert the material definition before the first usemtl line\n",
" lines.insert(0, 'mtllib {}\\n'.format(os.path.basename(obj_file).replace('.obj', '.mtl')))\n",
"\n",
" # Write the modified lines back to the OBJ file\n",
" with open(obj_file, 'w') as file:\n",
" file.writelines(lines)\n",
"\n",
" # Create the material file with diffuse color\n",
" mtl_filename = obj_file.replace('.obj', '.mtl')\n",
" with open('{}'.format(mtl_filename), 'w') as mtl_file:\n",
" mtl_file.write('newmtl {}\\n'.format(material_name))\n",
" mtl_file.write('Kd {} {} {}\\n'.format(*[int(diffuse_color[i:i+2], 16)/255 for i in (1, 3, 5)]))\n",
" # You might want to add more properties like specular color, shininess, etc. if needed\n",
"\n",
" # print(\"Material '{}' added to '{}' with diffuse color '{}' successfully.\".format(material_name, obj_file, diffuse_color))\n",
"\n",
"\n",
"# Example usage:\n",
"mesh_folder = os.path.join(data_folder, 'meshes', 'obj')\n",
"mesh_files = glob.glob(mesh_folder + '/*.obj')\n",
"for mesh_file in tqdm(mesh_files):\n",
" base_name = os.path.basename(mesh_file).split('.')[0]\n",
" color = region_colors[int(base_name)]\n",
" add_material_to_obj(mesh_file, 'default', color)\n"
]
}
],
"metadata": {
"interpreter": {
"hash": "ea9a5fa46eb6bad2806a8ea1d08e15bb1e255a2d4320b81e765591579963c56b"
},
"kernelspec": {
"display_name": "Python 3.8.10 64-bit ('env': venv)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 52901e5

Please sign in to comment.