Atlas creation
This python code contains utility methods related to:
atlas stuff
This program will create an atlas from the original anatomist’s annotations and create a new Atlas named AtlasV8. The tasks are run in sequence. Data is saved to disk on birdstore, so you only need to rerun the tasks if you change the data.
python src/atlas/scripts/create_atlas.py –task json –debug false
python src/atlas/scripts/create_atlas.py –task create –debug false
python src/atlas/scripts/create_atlas.py –task merge –debug false
python src/atlas/scripts/create_atlas.py –task neuroglancer –debug false –affine true
Explanation for the tasks:
json - This parses the original anatomist’s annotations and creates JSON data. This makes it easier for the later steps.
create - This take the JSON data and creates the origins and volumes of each of the 3 foundation brains. The origin is the upper left corner of the volume box. Origins at 0,0,0 start on the very first section in the upper left corner.
merge - This takes each of the 3 foundation brains ands merges them into one volume. It initially uses elastix to align the volumes with a affine transformation. The mean of these aligned images is then used to create the volume. The volume will contain only zeros or the Allen color. This process will also take any polygons stored in the database, e.g., the TG_L and TG_R, and merge them into a volume.
neuroglancer - This takes the merged volume and moves the origins into Allen space. A neuroglancer view is then created from all these merged volumes.
- class atlas.scripts.create_atlas.AtlasManager(animal, task, um=10, affine=False, debug=False)
Bases:
object
- create_brain_json()
# 1st step, this parses the original CSV files and creates the JSON files
- create_brain_volumes_and_origins()
# 2nd step, this takes the JSON files and creates the brain volumes and origins
- create_neuroglancer_volume()
Creates a Neuroglancer-compatible volume for visualization.
This method utilizes the brainManager to generate a volume that can be used with Neuroglancer, a web-based tool for visualizing volumetric data.
- Returns:
None
- evaluate()
Evaluates the current state of the alignment of the atlas to the Allen atlas.
- Returns:
None
- list_coms()
Lists the center of mass (COM) coordinates for all regions in the atlas.
This method utilizes the brainManager to retrieve and display the COMs for each region defined in the atlas. It is useful for inspecting or debugging the spatial organization of the atlas regions.
- Returns:
None
- merge_all()
# 3rd step, this merges the volumes and origins from the foundation brains into the new atlas # The fixed brain is, well, fixed. # All foundation polygon brain data is under: Edward ID=1 # All foundation COM brain data is under: Beth ID=2”
- save_atlas_volume()
Saves the atlas volume using the brain manager.
This method delegates the task of saving the atlas volume to the brainManager instance, ensuring that the current state of the atlas volume is persisted.
- Returns:
None
- test_brain_volumes_and_origins()
# optional step, this draws the brains from the cleaned images so you can check the placement of the volumes # The output is in /net/birdstore/Active_Atlas_Data/data_root/pipeline_data/MDXXX/preps/C1/drawn
- update_atlas_coms()
Updates the atlas center of mass (COM) information by delegating the task to the brainManager instance. This ensures that the atlas COMs are kept up-to-date with any changes in the underlying data.
- Returns:
None
- validate()
Validates the volumes managed by the brainManager.
This method ensures that the volumes associated with the brainManager meet the required criteria or constraints. This ensures the volumes only have two values and are of the correct shape.