Segmentation Modules

AI-powered anatomical structure identification from medical images using state-of-the-art deep learning models.

Overview

PhysioMotion4D supports multiple segmentation approaches:

  • TotalSegmentator: Whole-body CT segmentation (100+ structures)

  • Simpleware: Cardiac-focused segmentation (requires Simpleware Medical)

All segmentation classes inherit from SegmentAnatomyBase and provide consistent interfaces.

Choosing a Method

Method

Speed

Accuracy

Best For

TotalSegmentator

Fast (~30s)

Good

General purpose

Simpleware

Medium

Excellent

Cardiac imaging

Quick Start

Basic Segmentation

from physiomotion4d import SegmentChestTotalSegmentator

segmenter = SegmentChestTotalSegmentator()
result = segmenter.segment(ct_image, contrast_enhanced_study=False)
labelmap = result['labelmap']

Module Documentation

Common Operations

Structure Extraction

Extract individual anatomical structures from segmentation results. The key set returned by segment() is segmenter-specific (see Segmentation Base Class for the anatomy taxonomy contract), so check membership before accessing:

result = segmenter.segment(ct_image)
for group in ("heart", "lung", "bone"):
    if group in result:
        itk.imwrite(result[group], f"{group}_mask.mha")

Batch Processing

Process multiple images efficiently:

from pathlib import Path
import itk

segmenter = SegmentChestTotalSegmentator()

for image_file in Path("data").glob("*.nrrd"):
    image = itk.imread(str(image_file))
    result = segmenter.segment(image)
    labelmap = result['labelmap']
    itk.imwrite(labelmap, f"{image_file.stem}_labels.mha")

Error Handling

try:
    result = segmenter.segment(image)
except RuntimeError as e:
    print(f"Segmentation failed: {e}")

See Also

Navigation

API Reference | Segmentation Base Class | TotalSegmentator | Simpleware Heart Segmenter