Skip to content

greenpolo/LangSlice

Repository files navigation

LangSlice

License: BSD-3-Clause Python 3.10+ Tests Documentation Status Hugging Face Model

Register histological brain sections to BrainGlobe atlases.
A VLM estimates position, an image-gen model lays down atlas colors, Elastix warps the rest.

Warning

LangSlice is in-development. Some atlases may produce mixed results; and horizontal and sagittal orientations haven't yet been thoroughly tested. LangSlice does not offer manual registration methods — it is meant to be used in combination with other registration software (ABBA, QUINT, PyNutil, BrainGlobe ecosystem, etc.). Export functions to these tools have not been fully developed yet.

Three histology slices registered to the Allen mouse atlas

How it works

Agent loop: inspect, explore atlas candidates, submit AP

A VLM agent (default langslice-gemma-4-E4B) inspects the slice, explores candidate atlas planes through tool calls, and submits an AP coordinate. Image generation then produces an atlas-colored target from the histology, and itk-elastix recovers a dense B-spline deformation. Results export to VisuAlign-compatible JSON for QUINT / ABBA.

LangSlice registration pipeline: histology slice to atlas-colored target, dense warp, and overlay

Quick start

conda env create -f environment.yml
conda activate langslice
pip install -e .
cp .env.example .env  # add AI Studio / Vertex / OpenAI keys
# Position estimation
langslice estimate slice.png

# End-to-end registration at a known atlas position
langslice register slice.png --position 3.9

Full CLI: langslice --help. Pipeline detail: docs/index.md.

Model Hub

LangSlice hosts training/data helpers in shared packages under models/:

  • models/langslice-traces/langslice_traces
  • models/training-core/langslice_training
  • models/data/langslice_data

Training entrypoints are exposed as model-scoped launchers: langslice-gemma-rl and langslice-gemma-sft.

Public model-card metadata for the released variant is in models/langslice-gemma-4/variants/langslice-gemma-4-e4b/README.md.

Links

Citation

If you use LangSlice in your work, please cite the project metadata in CITATION.cff. GitHub renders a "Cite this repository" button in the right sidebar from that file.

License

BSD-3-Clause. See LICENSE.

About

Use vision-language models to perform alignment and registration of histological brain sections to any BrainGlobe atlas in any orientation plane.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors