Built-in datasets
TorchIO provides demo datasets for testing and tutorials. Each downloads on first use and caches locally.
Synthetic
ZonePlate
Bases: Subject
Synthetic data generated from a zone plate.
The zone plate is a circular diffraction grating that produces concentric rings of light and dark bands. This dataset is useful for testing image processing algorithms, particularly those related to frequency analysis and interpolation.
See equation 10.63 in Practical Handbook on Image Processing for
Scientific Applications
<https://www.routledge.com/Practical-Handbook-on-Image-Processing-for-Scientific-and-Technical-Applications/Jahne/p/book/9780849319006>_
by Bernd Jähne.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
int
|
The size of the generated image along all dimensions. |
501
|
Source code in src/torchio/datasets/zone_plate.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
MNI
Colin27
Bases: SubjectMNI
Colin27 MNI template.
More information can be found in the website of the
1998 <https://nist.mni.mcgill.ca/colin-27-average-brain/> and
2008 <http://www.bic.mni.mcgill.ca/ServicesAtlases/Colin27Highres>
versions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
version
|
int
|
Template year. It can be |
1998
|
Warning
The resolution of the 2008 version is quite high. The
subject instance will contain four images of size
362 x 434 x 362, therefore applying a transform to
it might take longer than expected.
Source code in src/torchio/datasets/mni/colin.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
download_root
property
Return the download root directory for this atlas.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
ICBM2009CNonlinearSymmetric
Bases: SubjectMNI
ICBM template.
More information can be found in the
website <http://www.bic.mni.mcgill.ca/ServicesAtlases/ICBM152NLin2009>_.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
load_4d_tissues
|
bool
|
If |
False
|
Source code in src/torchio/datasets/mni/icbm.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
download_root
property
Return the download root directory for this atlas.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
Pediatric
Bases: SubjectMNI
MNI pediatric atlases.
See the MNI website
<https://nist.mni.mcgill.ca/pediatric-atlases-4-5-18-5y/>_
for more information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
years
|
tuple[float, float]
|
Tuple of 2 ages. Possible values are: |
required |
symmetric
|
bool
|
If |
False
|
Source code in src/torchio/datasets/mni/pediatric.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
download_root
property
Return the download root directory for this atlas.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
Sheep
Bases: SubjectMNI
Ovine brain atlas at 0.5 mm resolution.
See the MNI website
<https://nist.mni.mcgill.ca/?page_id=714>_ for more information.
Source code in src/torchio/datasets/mni/sheep.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
download_root
property
Return the download root directory for this atlas.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
IXI
ixi
IXI dataset: ~600 brain MRIs from healthy subjects.
The Information eXtraction from Images (IXI)
<https://brain-development.org/ixi-dataset/>_ dataset contains
nearly 600 MR images from normal, healthy subjects.
This data is made available under the Creative Commons CC BY-SA 3.0 license. If you use it, please acknowledge the source.
ixi(root, *, download=False, modalities=('T1', 'T2'))
Download and load the full IXI dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
TypePath
|
Root directory for the dataset. |
required |
download
|
bool
|
If |
False
|
modalities
|
Sequence[str]
|
Modalities to include. Must be a subset of
|
('T1', 'T2')
|
Returns:
| Type | Description |
|---|---|
list[Subject]
|
List of subjects, one per scan with all requested modalities. |
Warning
The dataset is several GB. Downloading may take a while.
Source code in src/torchio/datasets/ixi.py
ixi_tiny(root, *, download=False)
Download and load IXITiny (566 \(T_1\) images + segmentations).
All images have shape \(83 \times 44 \times 55\). Useful as a medical image MNIST for quick experiments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
TypePath
|
Root directory for the dataset. |
required |
download
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
list[Subject]
|
List of subjects with |
Source code in src/torchio/datasets/ixi.py
ixi_tiny(root, *, download=False)
Download and load IXITiny (566 \(T_1\) images + segmentations).
All images have shape \(83 \times 44 \times 55\). Useful as a medical image MNIST for quick experiments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
TypePath
|
Root directory for the dataset. |
required |
download
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
list[Subject]
|
List of subjects with |
Source code in src/torchio/datasets/ixi.py
ITK-SNAP
BrainTumor
Bases: SubjectITKSNAP
BRATS brain tumor sample data.
Source code in src/torchio/datasets/itk_snap/itk_snap.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
T1T2
Bases: SubjectITKSNAP
Multi-site T1 and T2 brain MRI.
Source code in src/torchio/datasets/itk_snap/itk_snap.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
AorticValve
Bases: SubjectITKSNAP
Cardiac aortic valve CT frames with segmentation.
Source code in src/torchio/datasets/itk_snap/itk_snap.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
3D Slicer
Slicer
Bases: Subject
Sample data provided by 3D Slicer <https://www.slicer.org/>_.
See the Slicer wiki <https://www.slicer.org/wiki/SampleData>_
for more information.
For information about licensing and permissions, check the Sample Data
module <https://github.com/Slicer/Slicer/blob/31c89f230919a953e56f6722718281ce6da49e06/Modules/Scripted/SampleData/SampleData.py#L75-L81>_.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
One of the keys in
|
'MRHead'
|
Source code in src/torchio/datasets/slicer.py
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
Plot all images as a grid of orthogonal slices.
Requires the [plot] extras (pip install torchio[plot]).
See plot_subject for the
full list of keyword arguments.
Source code in src/torchio/data/subject.py
FPG
FPG
Bases: Subject
3T :math:T_1-weighted brain MRI and corresponding parcellation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
load_all
|
bool
|
If |
False
|
Source code in src/torchio/datasets/fpg.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | |
metadata
property
Non-spatial metadata.
spatial_shape
property
Spatial shape, checked for consistency across all images.
shape
property
Shape of the first image, checked for consistency.
spacing
property
Spacing from the first image, checked for consistency.
device
property
Device of the data, checked for consistency across all entries.
images
property
Dict of all Image entries.
points
property
Dict of all Points entries.
bounding_boxes
property
Dict of all BoundingBoxes entries.
get_inverse_transform(*, warn=True, ignore_intensity=False)
Get a composed transform that inverts the applied history.
Returns a Compose of the inverse of each
applied transform, in reverse order. Non-invertible transforms
are skipped (with a warning if warn=True).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
warn
|
bool
|
Issue a warning for non-invertible transforms. |
True
|
ignore_intensity
|
bool
|
Skip all intensity transforms. |
False
|
Returns:
| Type | Description |
|---|---|
Any
|
A |
Source code in src/torchio/data/invertible.py
apply_inverse_transform(**kwargs)
Apply the inverse of all applied transforms, in reverse order.
Non-invertible transforms are skipped. Intensity transforms
can be ignored with ignore_intensity=True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**kwargs
|
Any
|
Forwarded to
|
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
Data with transforms undone. |
Examples:
Source code in src/torchio/data/invertible.py
clear_history()
all_points()
Collect points from both subject-level and image-level.
Subject-level points are keyed by their name (str).
Image-level points are keyed by a (image_name, points_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], Points]
|
Merged dict of all points across both levels. |
Source code in src/torchio/data/subject.py
all_bounding_boxes()
Collect bounding boxes from both subject-level and image-level.
Subject-level boxes are keyed by their name (str).
Image-level boxes are keyed by a (image_name, boxes_name)
tuple.
Returns:
| Type | Description |
|---|---|
dict[str | tuple[str, str], BoundingBoxes]
|
Merged dict of all bounding boxes across both levels. |
Source code in src/torchio/data/subject.py
load()
to(*args, **kwargs)
Move all data to a device and/or cast to a dtype.
Calls .to() on every Image, Points, and BoundingBoxes.
Returns:
| Type | Description |
|---|---|
Self
|
|
Source code in src/torchio/data/subject.py
plot(**kwargs)
MedMNIST
3D datasets from MedMNIST v2. Each function returns a list of subjects for the requested split.
organ_mnist_3d(split='train')
3D organ segmentation dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
split
|
str
|
|
'train'
|
nodule_mnist_3d(split='train')
3D lung nodule dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
split
|
str
|
|
'train'
|
adrenal_mnist_3d(split='train')
3D adrenal gland dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
split
|
str
|
|
'train'
|
fracture_mnist_3d(split='train')
3D bone fracture dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
split
|
str
|
|
'train'
|
vessel_mnist_3d(split='train')
3D vessel dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
split
|
str
|
|
'train'
|
synapse_mnist_3d(split='train')
3D synapse dataset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
split
|
str
|
|
'train'
|