项目 / TorchIO-project/torchio
TorchIO 是一套 Python 工具包,用于在 [PyTorch](https://pytorch.org/) 深度学习应用中高效读取、预处理、采样、增强和写出三维医学影像。变换既包括随机仿射等常见计算机视觉操作,也包括模拟 MRI 磁场不均匀或 k 空间运动伪影等医学影像中的强度与空间变换。本页按研究中的加载、预处理、增强与采样用途介绍,不涉及诊疗效果。安装步骤和入门示例见[快速开始](https://docs.torchio.org/quickstart.html),更长的例子在[教程目录](https://github.com/TorchIO-project/torchio/blob/main/tutorials/README.md)。说明见[文档](https://docs.torchio.org/)和[仓库 README](https://github.com/TorchIO-project/torchio)。
本站整理,非 GitHub 官方 description。
官方快照(gh_history.db,2026-11-25):总榜 未进 Top50 · 日榜 未进 Top50 · 周榜未满 7 天基线(官方不生成) · 月榜暂无官方口径;下方四卡为站内趋势聚合(周卡按上榜次数,非官方 7 日增量窗)。
以下三段按该项目自己的 GitHub README 章节摘录(可合理截断并标明);README 没有对应章节的留空,不编造。
安装或使用说明见 https://docs.torchio.org/quickstart.html。
文档列出的增强与预处理包括随机模糊、翻转、噪声、仿射与弹性形变,以及偏置场、运动伪影等医学影像常见现象的模拟,并支持基于图块的采样。相关方法发表于 *Computer Methods and Programs in Biomedicine*(2021)。许可为 Apache-2.0。
来自 GitHub 仓库 README / 主页介绍正文,正文较长,已截断:保留前 20000 字符(原始 52,648 字节),完整内容见 GitHub 仓库。
<!-- markdownlint-disable -->
<p align="center">
<a href="https://docs.torchio.org/">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/source/favicon_io/for_readme_2000x462.png" alt="TorchIO logo">
</a>
</p>
<!-- markdownlint-restore -->
> *Tools like TorchIO are a symptom of the maturation of medical AI research using deep learning techniques*.
Jack Clark, Policy Director
at [OpenAI](https://openai.com/), Co-Founder and Head of Policy of Anthropic ([link](https://jack-clark.net/2020/03/17/)).
---
<!-- markdownlint-disable -->
<table align="center">
<tr>
<td align="left">
<b>Package</b>
</td>
<td align="center">
<a href="https://pypi.org/project/torchio/">
<img src="https://img.shields.io/pypi/dm/torchio.svg?label=PyPI%20downloads&logo=python&logoColor=white" alt="PyPI downloads">
</a>
<a href="https://pypi.org/project/torchio/">
<img src="https://img.shields.io/pypi/v/torchio?label=PyPI%20version&logo=python&logoColor=white" alt="PyPI version">
</a>
<a href="https://anaconda.org/conda-forge/torchio">
<img src="https://img.shields.io/conda/v/conda-forge/torchio.svg?label=conda-forge&logo=conda-forge" alt="Conda version">
</a>
</td>
</tr>
<tr>
<td align="left">
<b>CI</b>
</td>
<td align="center">
<a href="https://github.com/TorchIO-project/torchio/actions/workflows/tests.yml">
<img src="https://github.com/TorchIO-project/torchio/actions/workflows/tests.yml/badge.svg" alt="Tests status">
</a>
<a href="https://github.com/TorchIO-project/torchio/actions/workflows/docs.yml">
<img src="https://github.com/TorchIO-project/torchio/actions/workflows/docs.yml/badge.svg" alt="Documentation status">
</a>
<a href="https://app.codecov.io/github/TorchIO-project/torchio">
<img src="https://codecov.io/gh/TorchIO-project/torchio/branch/main/graphs/badge.svg" alt="Coverage status">
</a>
</td>
</tr>
<tr>
<td align="left">
<b>Code</b>
</td>
<td align="center">
<a href="https://docs.astral.sh/ruff/">
<img src="https://camo.githubusercontent.com/bb88127790fb054cba2caf3f3be2569c1b97bb45a44b47b52d738f8781a8ede4/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f636861726c6965726d617273682f727566662f6d61696e2f6173736574732f62616467652f76312e6a736f6e" alt="Code style">
</a>
<a href="https://scrutinizer-ci.com/g/TorchIO-project/torchio/?branch=main">
<img src="https://img.shields.io/scrutinizer/g/TorchIO-project/torchio.svg?label=Code%20quality&logo=scrutinizer" alt="Code quality">
</a>
</td>
</tr>
<tr>
<td align="left">
<b>Tutorials</b>
</td>
<td align="center">
<a href="https://github.com/TorchIO-project/torchio/blob/main/tutorials/README.md">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Google Colab">
</a>
</td>
</tr>
<tr>
<td align="left">
<b>Community</b>
</td>
<td align="center">
<a href="https://www.youtube.com/watch?v=UEUVSw5-M9M">
<img src="https://img.shields.io/youtube/views/UEUVSw5-M9M?label=watch&style=social" alt="YouTube">
</a>
<a href="https://github.com/TorchIO-project/torchio#contributors">
<img src="https://img.shields.io/github/all-contributors/TorchIO-project/torchio?color=ee8449&style=flat-square" alt="All Contributors">
</a>
</td>
</tr>
</table>
---
<p align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html">
<img style="width: 600px; overflow: hidden;" src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/fpg_progressive.gif" alt="Progressive artifacts">
</a>
</p>
<p align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html">
<img style="width: 360px; height: 360px; overflow: hidden;" src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/augmentation.gif" alt="Augmentation">
</a>
</p>
---
<table align="center">
<tr>
<td align="center">Original</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomblur">Random blur</a>
</td>
</tr>
<tr>
<td align="center"><img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/1_Lambda_mri.png" alt="Original"></td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomblur">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/2_RandomBlur_mri.gif" alt="Random blur">
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomflip">Random flip</a>
</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomnoise">Random noise</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomflip">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/3_RandomFlip_mri.gif" alt="Random flip">
</a>
</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomnoise">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/4_Compose_mri.gif" alt="Random noise">
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomaffine">Random affine transformation</a>
</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomelasticdeformation">Random elastic transformation</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomaffine">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/5_RandomAffine_mri.gif" alt="Random affine transformation">
</a>
</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomelasticdeformation">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/6_RandomElasticDeformation_mri.gif" alt="Random elastic transformation">
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randombiasfield">Random bias field artifact</a>
</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randommotion">Random motion artifact</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randombiasfield">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/7_RandomBiasField_mri.gif" alt="Random bias field artifact">
</a>
</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randommotion">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/8_RandomMotion_mri.gif" alt="Random motion artifact">
</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomspike">Random spike artifact</a>
</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomghosting">Random ghosting artifact</a>
</td>
</tr>
<tr>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomspike">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/9_RandomSpike_mri.gif" alt="Random spike artifact">
</a>
</td>
<td align="center">
<a href="https://docs.torchio.org/transforms/augmentation.html#randomghosting">
<img src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/gifs_readme/10_RandomGhosting_mri.gif" alt="Random ghosting artifact">
</a>
</td>
</tr>
</table>
---
<p align="center">
<a href="https://docs.torchio.org/patches/patch_training.html#queue">
<img style="width: 640px; height: 360px; overflow: hidden;" src="https://raw.githubusercontent.com/TorchIO-project/torchio/main/docs/images/queue.gif" alt="Queue">
</a>
</p>
([Queue](https://docs.torchio.org/patches/patch_training.html#queue)
for [patch-based training](https://docs.torchio.org/patches/index.html))
<!-- markdownlint-restore -->
---
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](https://pytorch.org/),
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](https://mriquestions.com/why-homogeneity.html)
or [k-space motion artifacts](http://proceedings.mlr.press/v102/shaw19a.html).
This package has been greatly inspired by NiftyNet,
[which is not actively maintained anymore](https://github.com/NifTK/NiftyNet/commit/935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0).
## 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.](https://doi.org/10.1016/j.cmpb.2021.106236)
BibTeX entry:
```bibtex
@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:
- [Engineering and Physical Sciences Research Council (EPSRC) & UK Research and Innovation (UKRI)](https://epsrc.ukri.org/)
- [EPSRC Centre for Doctoral Training in Intelligent, Integrated Imaging In Healthcare (i4health)](https://www.ucl.ac.uk/intelligent-imaging-healthcare/) (University College London)
- [Wellcome / EPSRC Centre for Interventional and Surgical Sciences (WEISS)](https://www.ucl.ac.uk/interventional-surgical-sciences/) (University College London)
- [School of Biomedical Engineering & Imaging Sciences (BMEIS)](https://www.kcl.ac.uk/bmeis) (King's College London)
## Getting started
See [Getting started](https://docs.torchio.org/quickstart.html) for
[installation](https://docs.torchio.org/quickstart.html#installation)
instructions
and a [Hello, World!](https://docs.torchio.org/quickstart.html#hello-world)
example.
Longer usage examples can be found in the
[tutorials](https://github.com/TorchIO-project/torchio/blob/main/tutorials/README.md).
Read the [documentation](https://docs.torchio.org/) for more information.
Please
[create an issue](https://github.com/TorchIO-project/torchio/issues/new/choose)
if you think something is missing.
## Contributors
Thanks goes to all these people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/fepegar"><img src="https://avatars1.githubusercontent.com/u/12688084?v=4?s=100" width="100px;" alt="Fernando Pérez-García"/><br /><sub><b>Fernando Pérez-García</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=fepegar" title="Code">💻</a> <a href="https://github.com/TorchIO-project/torchio/commits?author=fepegar" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/romainVala"><img src="https://avatars1.githubusercontent.com/u/5611962?v=4?s=100" width="100px;" alt="valabregue"/><br /><sub><b>valabregue</b></sub></a><br /><a href="#ideas-romainVala" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/TorchIO-project/torchio/pulls?q=is%3Apr+reviewed-by%3AromainVala" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/TorchIO-project/torchio/commits?author=romainVala" title="Code">💻</a> <a href="#question-romainVala" title="Answering Questions">💬</a> <a href="https://github.com/TorchIO-project/torchio/issues?q=author%3AromainVala" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/GFabien"><img src="https://avatars1.githubusercontent.com/u/39873986?v=4?s=100" width="100px;" alt="GFabien"/><br /><sub><b>GFabien</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=GFabien" title="Code">💻</a> <a href="https://github.com/TorchIO-project/torchio/pulls?q=is%3Apr+reviewed-by%3AGFabien" title="Reviewed Pull Requests">👀</a> <a href="#ideas-GFabien" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/GReguig"><img src="https://avatars1.githubusercontent.com/u/11228281?v=4?s=100" width="100px;" alt="G.Reguig"/><br /><sub><b>G.Reguig</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=GReguig" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/nwschurink"><img src="https://avatars3.githubusercontent.com/u/12720130?v=4?s=100" width="100px;" alt="Niels Schurink"/><br /><sub><b>Niels Schurink</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=nwschurink" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/ibrhad/ "><img src="https://avatars3.githubusercontent.com/u/18015788?v=4?s=100" width="100px;" alt="Ibrahim Hadzic"/><br /><sub><b>Ibrahim Hadzic</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/issues?q=author%3Aibro45" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/ReubenDo"><img src="https://avatars1.githubusercontent.com/u/17268715?v=4?s=100" width="100px;" alt="ReubenDo"/><br /><sub><b>ReubenDo</b></sub></a><br /><a href="#ideas-ReubenDo" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://julianklug.com"><img src="https://avatars0.githubusercontent.com/u/8020367?v=4?s=100" width="100px;" alt="Julian Klug"/><br /><sub><b>Julian Klug</b></sub></a><br /><a href="#ideas-MonsieurWave" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dvolgyes"><img src="https://avatars1.githubusercontent.com/u/425560?v=4?s=100" width="100px;" alt="David Völgyes"/><br /><sub><b>David Völgyes</b></sub></a><br /><a href="#ideas-dvolgyes" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/TorchIO-project/torchio/commits?author=dvolgyes" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/jfillionr/"><img src="https://avatars0.githubusercontent.com/u/219043?v=4?s=100" width="100px;" alt="Jean-Christophe Fillion-Robin"/><br /><sub><b>Jean-Christophe Fillion-Robin</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=jcfr" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://surajpai.tech"><img src="https://avatars1.githubusercontent.com/u/10467804?v=4?s=100" width="100px;" alt="Suraj Pai"/><br /><sub><b>Suraj Pai</b></sub></a><br /><a href="#ideas-surajpaib" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bcdarwin"><img src="https://avatars2.githubusercontent.com/u/164148?v=4?s=100" width="100px;" alt="Ben Darwin"/><br /><sub><b>Ben Darwin</b></sub></a><br /><a href="#ideas-bcdarwin" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/OeslleLucena"><img src="https://avatars0.githubusercontent.com/u/19919194?v=4?s=100" width="100px;" alt="Oeslle Lucena"/><br /><sub><b>Oeslle Lucena</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/issues?q=author%3AOeslleLucena" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.soumick.com"><img src="https://avatars0.githubusercontent.com/u/20525305?v=4?s=100" width="100px;" alt="Soumick Chatterjee"/><br /><sub><b>Soumick Chatterjee</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=soumickmj" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/neuronflow"><img src="https://avatars1.githubusercontent.com/u/7048826?v=4?s=100" width="100px;" alt="neuronflow"/><br /><sub><b>neuronflow</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=neuronflow" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jwitos"><img src="https://avatars2.githubusercontent.com/u/948674?v=4?s=100" width="100px;" alt="Jan Witowski"/><br /><sub><b>Jan Witowski</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=jwitos" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/dmus"><img src="https://avatars1.githubusercontent.com/u/464378?v=4?s=100" width="100px;" alt="Derk Mus"/><br /><sub><b>Derk Mus</b></sub></a><br /><a href="https://github.com/TorchIO-project/torchio/commits?author=dmus" title="Documentation">📖</a> <a href="https://github.com/TorchIO-project/torchio/commits?author=dmus" title="Code">💻</a> <a href="https://github.com/TorchIO-project/torchio/issues?q=author%3Admus" title="Bug reports">🐛</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://www.linkedin.com/in/che85"><img src="https://avatars2.githubusercontent.com/u/10195822?v=4?s=100