Practical overview
When it fits
Use Torchio when a medical-imaging project needs image processing or random augmentation within a Python deep-learning workflow.
Who it is for
- Developers building Python-based medical-imaging machine-learning workflows.
- Researchers preparing medical imaging data for deep-learning experiments.
Documented uses
- Apply random blur, flips or noise to medical images.
- Apply affine or elastic transformations during image augmentation.
- Prepare medical imaging data for machine-learning experiments.
Requirements & limits
- Torchio is a Python library, so use involves a development workflow rather than a standalone image-editing interface.
- The repository links to installation instructions, a Hello, World! example and longer tutorials.
- The project is licensed under Apache-2.0.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install TorchIO and verify the CLI version
Install TorchIO with pip and check the installed version.
Before you start
- A Python environment with pip.
Steps
Run the command below.
pip install torchioRun
torchio --versionto verify the installation.
Expected outcome
TorchIO is installed, and its CLI prints a version.
Guide limitations
- Optional extras are needed for NIfTI-Zarr support, cloud storage integrations, or the NiiVue Jupyter viewer.
Build and apply a TorchIO augmentation pipeline to a batch
Load paired T1 and segmentation images as subjects, apply random transforms to a batch on a device, and inspect the resulting image tensor.
Before you start
- TorchIO v2 experimental pre-release, as the example is on the v2 development documentation.
- Subject directories containing
t1.nii.gzandseg.nii.gzfiles. - A CUDA or MPS device for the documented GPU/device batch example.
Steps
Create a
tio.Subjectfor each directory withtio.ScalarImagefor T1 andtio.LabelMapfor segmentation.Create a
tio.Composepipeline withtio.Flip(),tio.Affine(degrees=(-15, 15)),tio.Standardize(), andtio.Noise(std=(0, 0.1)).Convert the subjects to a batch with
tio.SubjectsBatch.from_subjects(subjects)and move it tocudaormps.Apply the pipeline to the batch and inspect
augmented.t1.data.shapeand.device.
Expected outcome
The transformed batch contains augmented image and segmentation data; the documented example reports T1 tensor shape `(4, 1, 256, 256, 176)` on `cuda:0`.
Guide limitations
- TorchIO v2 is an experimental pre-release under active development and may contain bugs or breaking changes; v1 is identified as the current stable release.
- The shown example uses four subject directories and a CUDA device for its reported output.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 13 October 2026
- Original website title
- TorchIO-project/torchio · Official homepage title · retained in its source language

