diff --git a/docs/source/documentation/brainglobe-atlasapi/adding-a-new-atlas.md b/docs/source/documentation/brainglobe-atlasapi/adding-a-new-atlas.md index de2c1b35..443da95a 100644 --- a/docs/source/documentation/brainglobe-atlasapi/adding-a-new-atlas.md +++ b/docs/source/documentation/brainglobe-atlasapi/adding-a-new-atlas.md @@ -69,11 +69,7 @@ Do not use 0 (zero) as the id of a structure, because the annotation stack will ## How to generate an atlas programmatically? -**Atlas generation takes place in two steps:** - -1. Generate an “Atlas script” written in python -2. Use the atlas generation code [available from BrainGlobe](https://github.com/brainglobe/brainglobe-atlasapi/tree/main/brainglobe_atlasapi/atlas_generation/) -3. to generate the atlas from the atlas script. +Each BrainGlobe atlas is generated by its custom atlas script, written in Python. Reusable functionality for atlas generation is [available from BrainGlobe](https://github.com/brainglobe/brainglobe-atlasapi/tree/main/brainglobe_atlasapi/atlas_generation/), such as the `create_region_mesh` function. To use this functionality in your Python virtual (`conda`) environment, install `brainglobe-atlasapi` with optional dependencies `[dev, atlasgen]`. ### Atlas scripts @@ -110,11 +106,11 @@ of each brain region ### Atlas generation Once an atlas script has been written which sets out all the necessary metadata and loads all the files required, -code provided by BrainGlobe’s atlas generation repository can be used to format the data as needed by the BrainGlobe -AtlasAPI. Atlasgen provides one convenient function `wrapup_atlas_from_data` which takes all the metadata and data +code provided by BrainGlobe’s atlas generation submodule can be used to format the data as needed by the BrainGlobe +AtlasAPI. The atlas generation submodule provides one convenient function `wrapup_atlas_from_data` which takes all the metadata and data from above and creates the data structures required. These data structures include .tiff files with the various images, csv files with the structures metadata information, a README file laying out the atlas content, etc. The same function -creates a compressed folder which can be loaded to GIN for distribution (see above). +creates a compressed folder which can be uploaded to GIN for distribution (see above). ### Extracting meshes @@ -154,7 +150,29 @@ inspect_meshes_folder("~/.brainglobe/temp/allen_mouse_10um_v1.0/meshes") ``` Once an atlas is created with BrainGlobe’s atlas generation tools, it can be used with most software from the BrainGlobe software suite. -This includes [brainrender](/documentation/brainrender/index) which provides a convenient GUI for visually inspecting the generated atlas meshes. +These include [brainrender](/documentation/brainrender/index) and [brainrender-napari](/tutorials/visualise-atlas-napari) which provide a convenient way to visually inspect the generated atlas meshes. + +For example, you can visualise various parts of the Max Planck Zebrafish Brain Atlas next to each other by running the script below. You can do the same with your own newly-packaged atlas (or any other BrainGlobe atlas) by replacing as explained in the comments. + +```python +from brainrender_napari.napari_atlas_representation import NapariAtlasRepresentation +from brainglobe_atlasapi import BrainGlobeAtlas +import napari + +if __name__ == "__main__": + viewer = napari.Viewer() + viewer.dims.ndisplay = 3 + # replace "mpin_zfish_1um" with atlas of interest below + napari_atlas = NapariAtlasRepresentation(BrainGlobeAtlas("mpin_zfish_1um"), viewer) + napari_atlas.add_to_viewer() + + # replace "GADb1" with name of additional reference for your atlas (if it has any) + napari_atlas.add_additional_reference("GADb1") + + # replace "root" with acronym of structure of interest below + napari_atlas.add_structure_to_viewer("") + napari.run() +``` ## Uploading the atlas