Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
settings.local.json
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ jobs:
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-unit-${{ matrix.os }}-py${{ matrix.python-version }}
Expand Down Expand Up @@ -233,6 +234,7 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: integration-tests
name: codecov-integration
Expand Down Expand Up @@ -317,6 +319,7 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: gpu-tests
name: codecov-gpu
Expand Down Expand Up @@ -380,7 +383,6 @@ jobs:
# - tests/test_register_images_icon.py (requires CUDA for ICON)
# - tests/test_transform_tools.py (depends on slow registration tests)
# - tests/test_segment_chest_total_segmentator.py (requires CUDA for TotalSegmentator)
# - tests/test_segment_chest_vista_3d.py (requires CUDA for VISTA-3D, 20GB+ RAM)
#
# Experiment tests (EXTREMELY SLOW - hours to complete):
# - tests/test_experiments.py (runs all notebooks in experiments/ subdirectories)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: slow-tests-gpu
name: codecov-slow-gpu
Expand Down
3 changes: 1 addition & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ uv pip install -e .
ruff check . --fix && ruff format .

# Type checking
mypy src/
mypy src/ tests/

# All pre-commit hooks
pre-commit run --all-files
Expand All @@ -28,7 +28,6 @@ py -m pytest tests/test_contour_tools.py::test_extract_surface -v

# Skip GPU-dependent tests
py -m pytest tests/ --ignore=tests/test_segment_chest_total_segmentator.py \
--ignore=tests/test_segment_chest_vista_3d.py \
--ignore=tests/test_register_images_icon.py

# With coverage
Expand Down
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ PhysioMotion4D is a comprehensive medical imaging package that converts 4D CT sc
## 🚀 Key Features

- **Complete 4D Medical Imaging Pipeline**: End-to-end processing from 4D CT data to animated USD models
- **Multiple AI Segmentation Methods**: TotalSegmentator, VISTA-3D, and ensemble approaches
- **Multiple AI Segmentation Methods**: TotalSegmentator and ensemble approaches
- **Deep Learning Registration**: GPU-accelerated image registration using Icon algorithm
- **NVIDIA Omniverse Integration**: Direct USD file export for medical visualization
- **Physiological Motion Analysis**: Capture and visualize cardiac and respiratory motion
Expand Down Expand Up @@ -106,9 +106,6 @@ print(f"PhysioMotion4D version: {physiomotion4d.__version__}")
- `WorkflowFitStatisticalModelToPatient`: Model-to-patient registration workflow
- **Segmentation Classes**: Multiple AI-based chest segmentation implementations
- `SegmentChestTotalSegmentator`: TotalSegmentator-based segmentation
- `SegmentChestVista3D`: VISTA-3D model-based segmentation
- `SegmentChestVista3DNIM`: NVIDIA NIM version of VISTA-3D
- `SegmentChestEnsemble`: Ensemble segmentation combining multiple methods
- `SegmentAnatomyBase`: Base class for custom segmentation methods
- **Registration Classes**: Multiple registration methods for different use cases
- Image-to-Image Registration:
Expand Down Expand Up @@ -142,7 +139,7 @@ print(f"PhysioMotion4D version: {physiomotion4d.__version__}")
- **AI/ML**: PyTorch, CuPy (CUDA 13 default; CUDA 12 via `[cuda12]` extra), transformers, MONAI
- **Registration**: icon-registration, unigradicon
- **Visualization**: USD-core, PyVista
- **Segmentation**: TotalSegmentator, VISTA-3D models
- **Segmentation**: TotalSegmentator

## 🎯 Quick Start

Expand Down Expand Up @@ -262,11 +259,11 @@ registered_mesh = workflow.run_workflow()
### Custom Segmentation

```python
from physiomotion4d import SegmentChestVista3D
from physiomotion4d import SegmentChestTotalSegmentator
import itk

# Initialize VISTA-3D segmentation
segmenter = SegmentChestVista3D()
# Initialize TotalSegmentator segmentation
segmenter = SegmentChestTotalSegmentator()

# Load and segment image
image = itk.imread("chest_ct.nrrd")
Comment on lines +262 to 269
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this example, SegmentChestTotalSegmentator.segment() returns a dict of masks (e.g., result['labelmap'], result['heart']). The snippet below currently assigns to masks = ... and then unpacks multiple values; after switching to TotalSegmentator the example should be updated to use the dict keys instead of tuple unpacking.

Copilot uses AI. Check for mistakes.
Expand Down Expand Up @@ -578,14 +575,12 @@ pytest tests/test_register_images_greedy.py -v # Greedy registration
pytest tests/test_register_images_icon.py -v # Icon registration
pytest tests/test_register_time_series_images.py -v # Time series registration
pytest tests/test_segment_chest_total_segmentator.py -v # TotalSegmentator
pytest tests/test_segment_chest_vista_3d.py -v # VISTA-3D segmentation
pytest tests/test_contour_tools.py -v # Mesh and contour tools
pytest tests/test_image_tools.py -v # Image processing utilities
pytest tests/test_transform_tools.py -v # Transform operations

# Skip GPU-dependent tests (segmentation and registration)
pytest tests/ --ignore=tests/test_segment_chest_total_segmentator.py \
--ignore=tests/test_segment_chest_vista_3d.py \
--ignore=tests/test_register_images_icon.py

# Run with coverage report
Expand All @@ -594,7 +589,7 @@ pytest tests/ --cov=src/physiomotion4d --cov-report=html

**Test Categories:**
- **Data Pipeline**: Download, conversion, and preprocessing
- **Segmentation**: TotalSegmentator and VISTA-3D (GPU required)
- **Segmentation**: TotalSegmentator (GPU required)
- **Registration**: ANTs, Icon, and time series methods (slow, ~5-10 min)
- **Geometry & Visualization**: Contour tools, transform tools, VTK to USD
- **USD Utilities**: Merging, time preservation, material handling
Expand Down Expand Up @@ -637,7 +632,7 @@ Use `/plan` to get an inspection of the affected classes, a numbered implementat
plan, and a list of open questions — without touching any files.

```text
/plan add a confidence-weighted voting mode to SegmentChestEnsemble
/plan add a new segmentation method to SegmentChestTotalSegmentator
```

Claude will read the relevant source, summarize current behavior, list files that
Expand Down Expand Up @@ -767,7 +762,7 @@ This project is licensed under the Apache 2.0 License - see the LICENSE file for
- **NVIDIA Omniverse** team for USD format and visualization platform
- **MONAI** community for medical imaging AI tools
- **DirLab** for providing the 4D-CT benchmark datasets
- **TotalSegmentator** and **VISTA-3D** teams for segmentation models
- **TotalSegmentator** team for segmentation models
- **Icon Registration** team for deep learning registration methods

## 📞 Support
Expand Down
3 changes: 3 additions & 0 deletions data/test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.hdf
*.mha
*.nrrd
Loading
Loading