AutoSeg runs TotalSegmentator on every .nii or .nii.gz file inside a folder tree.
Given a root folder, it searches that folder and all subfolders for NIfTI files, runs:
TotalSegmentator -i <input_file> -o <output_folder> -ta <task>and saves each segmentation output beside the source scan.
- Python 3.9 or newer
- TotalSegmentator installed and available on your command line
Install TotalSegmentator separately before using this package. You should be able to run:
TotalSegmentator --helpAfter this package is published to PyPI, users will be able to install it with:
pip install autosegAutoSeg adds the -ta flag to the TotalSegmentator command for you. You only need to provide the task name:
autoseg "C:\path\to\scans" totalRun AutoSeg on a folder:
autoseg "C:\path\to\scans" totalUse another TotalSegmentator task by passing the task name after the folder:
autoseg "C:\path\to\scans" <task name>If you leave the task name off, AutoSeg prompts for it during runtime:
autoseg "C:\path\to\scans"Use TotalSegmentator's --statistics option for volume and intensity calculations
autoseg "C:\path\to\scans" <task name> statisticsPreview what would run without starting TotalSegmentator (Reduced wait time for testing/troubleshooting):
autoseg "C:\path\to\scans" total --dry-runFor each input file, AutoSeg creates a segmentation folder in the same directory as the scan.
Example:
C:\data\patient01\scan.nii.gz
C:\data\patient01\scan_segmentations\
If the expected output folder already exists and contains files, AutoSeg skips that scan so it does not run segmentation again.