MCPcopy Index your code
hub / github.com/TorchIO-project/torchio

github.com/TorchIO-project/torchio @v2.0.0a1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.0a1 ↗ · + Follow
2,767 symbols 8,463 edges 165 files 851 documented · 31% updated 1d agov1.2.1 · 2026-06-02★ 2,41825 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TorchIO logo

Tools like TorchIO are a symptom of the maturation of medical AI research using deep learning techniques.

Jack Clark, Policy Director at OpenAI, Co-Founder and Head of Policy of Anthropic (link).


Package PyPI downloads PyPI version Conda version
CI Tests status Documentation status Coverage status
Code Code style Code quality
Tutorials Google Colab
Community YouTube All Contributors

Progressive artifacts

Augmentation


Original Random blur
Original Random blur
Random flip Random noise
Random flip Random noise
Random affine transformation Random elastic transformation
Random affine transformation Random elastic transformation
Random bias field artifact Random motion artifact
Random bias field artifact Random motion artifact
Random spike artifact Random ghosting artifact
Random spike artifact Random ghosting artifact

Queue

(Queue for patch-based training)


TorchIO is a Python package containing a set of tools to efficiently read, preprocess, sample, augment, and write 3D medical images in deep learning applications written in PyTorch, including intensity and spatial transforms for data augmentation and preprocessing. Transforms include typical computer vision operations such as random affine transformations and also domain-specific ones such as simulation of intensity artifacts due to MRI magnetic field inhomogeneity or k-space motion artifacts.

This package has been greatly inspired by NiftyNet, which is not actively maintained anymore.

Credits

If you like this repository, please click on Star!

If you use this package for your research, please cite our paper:

F. Pérez-García, R. Sparks, and S. Ourselin. TorchIO: a Python library for efficient loading, preprocessing, augmentation and patch-based sampling of medical images in deep learning. Computer Methods and Programs in Biomedicine (June 2021), p. 106236. ISSN: 0169-2607.doi:10.1016/j.cmpb.2021.106236.

BibTeX entry:

@article{perez-garcia_torchio_2021,
    title = {{TorchIO}: a {Python} library for efficient loading, preprocessing, augmentation and patch-based sampling of medical images in deep learning},
    journal = {Computer Methods and Programs in Biomedicine},
    pages = {106236},
    year = {2021},
    issn = {0169-2607},
    doi = {https://doi.org/10.1016/j.cmpb.2021.106236},
    url = {https://www.sciencedirect.com/science/article/pii/S0169260721003102},
    author = {P{\'e}rez-Garc{\'i}a, Fernando and Sparks, Rachel and Ourselin, S{\'e}bastien},
}

This project was originally supported by the following institutions:

Getting started

See Getting started for installation instructions and a Hello, World! example.

Longer usage examples can be found in the tutorials.

Read the documentation for more information.

Please create an issue if you think something is missing.

Contributors

Thanks goes to all these people (emoji key):

Fernando Pérez-García Fernando Pérez-García 💻 📖 valabregue valabregue 🤔 👀

Core symbols most depended-on inside this repo

clone
called by 227
src/torchio/data/affine.py
numpy
called by 99
src/torchio/data/image.py
save
called by 72
src/torchio/data/image.py
from_subjects
called by 71
src/torchio/data/batch.py
apply_inverse_transform
called by 54
src/torchio/data/batch.py
to
called by 51
src/torchio/data/image.py
sample_1d
called by 40
src/torchio/transforms/parameter_range.py
_get_images
called by 37
src/torchio/transforms/transform.py

Shape

Method 1,920
Function 425
Class 419
Route 3

Languages

Python100%
TypeScript1%

Modules by API surface

tests/test_spatial.py131 symbols
tests/test_image.py124 symbols
src/torchio/transforms/spatial/spatial.py93 symbols
tests/test_backends.py85 symbols
tests/test_crop_or_pad.py81 symbols
tests/test_transforms_base.py71 symbols
tests/test_subject.py67 symbols
src/torchio/data/image.py64 symbols
tests/test_bboxes.py58 symbols
tests/test_affine.py56 symbols
tests/test_visualization.py49 symbols
tests/test_parameter_range.py47 symbols

For agents

$ claude mcp add torchio \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact