miblab.totseg#
- miblab.totseg(vol, cutoff=None, **kwargs)[source]#
Run totalsegmentator on one or more volumes.
Source: totalsegmentator.
- Parameters:
vol (vreg.Volume3D or list) – Either a single volume, or a list of volumes to be segmented.
cutoff (float, optional) – Pixels with a probability higher than cutoff will be included in the mask. If cutoff is not provided, probabilities will be returned directly. Defaults to None.
kwargs – Any keyword arguments accepted by the totalsegmentor python API.
- Returns:
A vreg volume with the label image. See totalsegmentator documentation for a dictionary mapping labels to anatomical structures.
- Return type:
vreg.Volume3D
Example
Use a machine with a cpu to run the task ‘total_mr’ on a single volume saved as a nifti file:
>>> import miblab >>> import vreg >>> vol = vreg.read_nifti('path/to/volume.nii.gz') >>> label = miblab.totseg(vol, cutoff=0.01, task='total_mr', device='cpu') >>> vreg.write_nifti(label, 'path/to/label.nii.gz')