Skip to content
greenpoloPublic

About

Register histological brain sections to BrainGlobe atlases using vision-language and image-generation models.

Topics

Resources

Contributing

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

LangSlice

License: BSD-3-Clause Python 3.11 Tests Documentation Status DOI 10.5281/zenodo.23900540

Agent-driven registration of histological brain sections to BrainGlobe atlases.

Two brain sections go to the LangSlice Agent, which runs on Claude, GPT or Gemini and drives DeepSlice, STalign, emlddmm, FireANTs, elastix and SPOmiAlign; out come the same sections with atlas region outlines
Sections: Allen Mouse Brain Connectivity Atlas, Allen Institute for Brain Science (connectivity.brain-map.org).

LangSlice gives a vision-language agent tools to register a stack of histology sections to a BrainGlobe atlas. The agent inspects the anatomy, sets positions and cutting angles, aligns sections in-plane, and optionally fits SyN deformations. It chooses regions and settings and can use an image model to trace borders where useful.

Source images stay unchanged. Work is checkpointed and undoable, with coordinate and label maps, registration.json, and QuickNII / VisuAlign exports. Coronal sections of the Allen mouse atlas are the most tested case.

Install

In a terminal with conda (Miniforge):

conda create -n langslice python=3.11 -y
conda activate langslice
pip install "langslice[registration,mcp]"
langslice login        # ChatGPT sign-in; or set OPENAI_API_KEY / GEMINI_API_KEY (see .env.example)

From the source instead: download and extract it, open a terminal in the folder with environment.yml, and run conda env create -f environment.yml. On Windows, run the commands in Miniforge Prompt. Python 3.11 is required. Atlases are downloaded by BrainGlobe on first use into the user's .brainglobe folder. The environment includes the deformable engine (FireANTs on torch) and the MCP server.

Use LangSlice

  • Getting started: install LangSlice, connect the AI app you already use (Codex, Antigravity or Claude Code) and register a brain.
  • Agents, CLI and MCP: Claude Code, Antigravity or Codex through langslice job, Claude Desktop through MCP, or the built-in agent with langslice linear run sections/.
  • ABBA: export a registration as an ABBA project and open it with ABBA's Load State.
  • Python: coding agents can open a job and write their own workflows using the same tools.

Tools · Tool plugins · File formats · Architecture · Full documentation

Citation and license

Cite LangSlice with its DOI, 10.5281/zenodo.23900540 (all versions; Zenodo lists a DOI for each release), or the metadata in CITATION.cff (GitHub's "Cite this repository" button). BSD-3-Clause; see LICENSE.

About

Register histological brain sections to BrainGlobe atlases using vision-language and image-generation models.

Topics

Resources

Contributing

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages