Additional interfaces

TorchIO features can be accessed through the standard Python interface, the Command-line tools or the 3D Slicer GUI.

Command-line tools


A transform can be quickly applied to an image file using the command-line tool torchio-transform, which is automatically installed by pip during installation of TorchIO:

$ torchio-transform input.nii.gz RandomAffine output.nii.gz --kwargs "degrees=(0,0,10) scales=0.1" --seed 42

For more information, run torchio-transform --help.

3D Slicer GUI

3D Slicer is an open-source software platform for medical image informatics, image processing, and three-dimensional visualization.

You can download and install Slicer 4.11 from their download website or, if you are on macOS, using Homebrew: brew cask install slicer-nightly.

TorchIO provides a 3D Slicer extension for quick experimentation and visualization of the package features without any coding.

The TorchIO extension can be easily installed using the Extensions Manager.

The code and installation instructions are available on GitHub.

TorchIO Transforms

This module can be used to quickly visualize the effect of each transform parameter. That way, users can have an intuitive feeling of what the output of a transform looks like without any coding at all.

TorchIO Transforms module for 3D Slicer

Usage example

Go to the Sample Data module to get an image we can use:

Go to Sample Data module

Click on an image to download, for example MRHead 1, and go to the TorchIO Transforms module:


All the data in Sample Data can be downloaded and used in the TorchIO Python library using the torchio.datasets.slicer.Slicer class.

Download MRHead and go to TorchIO Transforms module

Select the input and output volume nodes:

Select volume nodes

Modify the transform parameters and click on Apply transform. Hovering the mouse over the transforms will show tooltips extracted from the TorchIO documentation.

Select volume nodes

You can click on the Toggle volumes button to switch between input and output volumes.