Skip to main content

autoflatten logo

Tests codecov PyPI version Python versions License DOI

autoflatten: automatically create cortical flatmaps from FreeSurfer surfaces

autoflatten is a Python pipeline for 🌟automatically🌟 flattening cortical surfaces generated by FreeSurfer

TL;DR: run autoflatten /path/to/your/freesufer/subject; done.

Features

  • Automatic cut mapping from a template to individual subjects
  • Two flattening backends: JAX-accelerated pyflatten (default) or FreeSurfer's mris_flatten
  • Visualization with area distortion metrics
  • Animation of the flattening process — capture snapshots and render videos

Quick Start

# Install
pip install autoflatten

# Run on a FreeSurfer subject (requires FreeSurfer 6.0+ for projection)
autoflatten /path/to/subjects/sub-01

Documentation

For full documentation, usage examples, and configuration options, visit the autoflatten website.

See example outputs to preview what autoflatten produces.

Citation

If you use autoflatten in your research, please cite both autoflatten and the original FreeSurfer flattening method:

Visconti di Oleggio Castello, M., & Gallant, J. L. (2025). autoflatten: automatically create cortical flatmaps from FreeSurfer surfaces. Zenodo. https://doi.org/10.5281/zenodo.17933205

@software{visconti_di_oleggio_castello_2025_autoflatten,
  author       = {Visconti di Oleggio Castello, Matteo and Gallant, Jack L.},
  title        = {autoflatten: automatically create cortical flatmaps from FreeSurfer surfaces},
  year         = 2025,
  publisher    = {Zenodo},
  doi          = {10.5281/zenodo.17933205},
  url          = {https://doi.org/10.5281/zenodo.17933205}
}

Fischl, B., Sereno, M. I., & Dale, A. M. (1999). Cortical surface-based analysis II: Inflation, flattening, and a surface-based coordinate system. NeuroImage, 9(2), 195-207. https://doi.org/10.1006/nimg.1998.0396

@article{fischl1999cortical,
  author       = {Fischl, Bruce and Sereno, Martin I. and Dale, Anders M.},
  title        = {Cortical surface-based analysis {II}: Inflation, flattening, and a surface-based coordinate system},
  journal      = {NeuroImage},
  year         = 1999,
  volume       = 9,
  number       = 2,
  pages        = {195--207},
  doi          = {10.1006/nimg.1998.0396}
}

License

BSD 2-Clause License. See LICENSE file for details.

Acknowledgments

  • Default fsaverage template cuts by Mark Lescroart and Natalia Bilenko
  • Geodesic refinement step inspired by code from Bhavin Gupta and Alex Huth

Metadata

Release files for autoflatten 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autoflatten 1.0.7
File Size Uploaded
autoflatten-1.0.7.tar.gz 204.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autoflatten 1.0.7
File Interpreter ABI Platform
autoflatten-1.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 412.8 kB

Release files / autoflatten-1.0.7.tar.gz

Download URL autoflatten-1.0.7.tar.gz
Size 204.2 kB
Tags Source
SHA-256 checksum
How to use checksums
34e8a8b6650ae78af8dbbe8f4bbc0bfffd4a5dadb299386d7139e4024524b0f9
BLAKE2b-256 checksum
How to use checksums
d3d0739297e7fa924f5c556cd0ea12dfc0041fc1fba886ffae40dad0f4966ac3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release files / autoflatten-1.0.7-py3-none-any.whl

Download URL autoflatten-1.0.7-py3-none-any.whl
Size 208.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df862676ba993a116e2b352d832ed5ce016a19ac85c7cf1f3ee96e9a4e18a362
BLAKE2b-256 checksum
How to use checksums
ccc55c303087ba05c85659d8c16fcda86959af4fba1b4f1c1fdb9a685ea494d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.7 This release

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page