pyvista.examples.downloads.download_whole_body_ct_male#

download_whole_body_ct_male(load=True)[source]#

Download a CT image of a male subject with 117 segmented anatomic structures.

This dataset is subject 's1397' from the TotalSegmentator dataset, version 2.0.1, available from zenodo. See the original paper for details:

Jakob Wasserthal et al., “TotalSegmentator: Robust Segmentation of 104 Anatomic Structures in CT Images,” Radiology, Jul. 2023, doi: https://doi.org/10.1148/ryai.230024.

The dataset is loaded as a MultiBlock with three blocks:

  • 'ct': ImageData with CT data.

  • 'segmentations': MultiBlock with 117 ImageData blocks, each containing a binary segmentation label. The blocks are named by their anatomic structure (e.g. 'heart') and are sorted alphabetically. See the examples below for a complete list label names.

  • 'label_map': ImageData with a label map array. The label map is an alternative representation of the segmentation where the masks are combined into a single scalar array.

    Note

    The label map is not part of the original data source.

Licensed under Creative Commons Attribution 4.0 International.

Parameters:
loadbool, default: True

Load the dataset after downloading it when True. Set this to False and only the filename will be returned.

Returns:
pyvista.MultiBlock or str

DataSet or filename depending on load.

Examples

Load the dataset and get some of its properties.

>>> from pyvista import examples
>>> import pyvista as pv
>>> dataset = examples.download_whole_body_ct_male()

Get the CT image

>>> ct_image = dataset['ct']
>>> ct_image
ImageData (...)
  N Cells:      55561506
  N Points:     56012800
  X Bounds:     0.000e+00, 4.785e+02
  Y Bounds:     0.000e+00, 4.785e+02
  Z Bounds:     0.000e+00, 8.190e+02
  Dimensions:   320, 320, 547
  Spacing:      1.500e+00, 1.500e+00, 1.500e+00
  N Arrays:     1

Get the segmentation label names and show the first three

>>> segmentations = dataset['segmentations']
>>> label_names = segmentations.keys()
>>> label_names[:3]
['adrenal_gland_left', 'adrenal_gland_right', 'aorta']

Get the label map and show its data range

>>> label_map = dataset['label_map']
>>> label_map.get_data_range()
(np.uint8(0), np.uint8(117))

Create a surface mesh of the segmentation labels

>>> labels_mesh = label_map.contour_labeled(smoothing=True)

Plot the CT image and segmentation labels together.

>>> pl = pv.Plotter()
>>> _ = pl.add_volume(
...     ct_image,
...     cmap="bone",
...     opacity="sigmoid_9",
...     show_scalar_bar=False,
... )
>>> _ = pl.add_mesh(labels_mesh, cmap='glasbey', show_scalar_bar=False)
>>> pl.view_zx()
>>> pl.camera.up = (0, 0, 1)
>>> pl.camera.zoom(1.3)
>>> pl.show()
../../../_images/pyvista-examples-downloads-download_whole_body_ct_male-1_00_00.png

See also

Whole Body Ct Male Dataset

See this dataset in the Dataset Gallery for more info.

Whole Body Ct Female Dataset

Similar dataset of a female subject.

Medical Datasets

Browse other medical datasets.