Brain registration (brainreg), segmentation post-processing, and
visualization for use-case / paper workflows.
This workflow has three phases:
- Registration (SLURM): run
brainregto create per-subject output folders withregistered_atlas.tiff. - Segmentation + probe annotations (Napari): open the registered subject outputs, add probe tracks/injections, and save into the subject’s
segmentation/folder. - Visualization (Python): render probe HTML and/or atlas+region PNG views from
segmentation/atlas_space/.
SLURM scripts, data, and outputs are kept together in one project folder (e.g. your NFS project directory). The SLURM config expects:
PROJECT_DIR/data— input TIFs (any subdirs)PROJECT_DIR/brainreg_outputs_<atlas>/— registration outputs
Copy/symlink the bg_viz_pipeline/slurm/ folder into your project folder
(preserving the slurm/ subfolder), and edit slurm/brainreg_config.sh to
set PROJECT_DIR.
See bg_viz_pipeline/slurm/README.md for details of how
the SLURM scripts work and how to run them.
At a minimum:
- edit
slurm/brainreg_config.sh - run
./slurm/submit_brainreg.sh
For each registered subject folder created by Phase 1:
- Open the subject in
napariusing your brainrender/segmentation workflow. - Add probe tracks/injections.
- Save back into the subject's
segmentation/folder in the locations expected by the Python visualizers:segmentation/atlas_space/tracks/*.npysegmentation/atlas_space/tracks/*.csv(per-shank region tables; from brainreg tracks)- optional
segmentation/atlas_space/regions/*.obj
From the workflows repo root (so the bg_viz_pipeline/ package is
importable):
Detailed usage: scripts/README.md
Preset JSON reference: presets/README.md
-
Interactive atlas explorer (slice / camera / pose experiments):
python -m bg_viz_pipeline.scripts.interactive_render
Edit the
SETTINGSdict at the top ofscripts/interactive_render.py. -
Probe HTML:
python -m bg_viz_pipeline.scripts.probes_to_html <atlas> <brainreg_dir> <out.html> [--regions ...]
-
Probe region tables (SVG): edit
BRAINREG_DIRandCELLinscripts/list_regions.py, then:python -m bg_viz_pipeline.scripts.list_regions
Output:
probe_regions_<subject>.svgin the repo root, plus a terminal summary of regions per shank and a copy-pasteREGIONS_TO_SHOWlist. -
Cellfinder cells per region (SVG): edit
SUMMARY_CSVandTOP_Ninscripts/list_cell_counts.py, then:python -m bg_viz_pipeline.scripts.list_cell_counts
Output:
cell_counts_<subject>.svgin the repo root. -
Batch atlas + probe PNGs — edit
presets/viewer_presets.json, then:python -m bg_viz_pipeline.scripts.batch_render # all presets python -m bg_viz_pipeline.scripts.batch_render --only-subject ROI-1 python -m bg_viz_pipeline.scripts.batch_render --only-subdir ds_MPX-R-0033_...
Use a conda environment with BrainGlobe installed
(e.g. brainglobe-env; pip install brainglobe).
teaching/python_oop_exercises.md— hands-on Python OOP exercises tied to this pipeline (SETTINGSdict,settings_from_preset, dataclass concepts).- Branch
refactor-to-batch-and-interactive— modularViewConfigand multi-filelib/layout for studying the same pipeline with dataclasses in production code.