Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6841c50
Add Mac-optimized enhanced liver vessel segmentation
AbeezUrRehman Sep 2, 2025
b1bebdd
Add enhanced liver vessel segmentation and splitting
AbeezUrRehman Sep 3, 2025
0417544
Revise README with enhanced liver vessel pipeline
AbeezUrRehman Sep 3, 2025
a191726
Refactor enhanced liver vessel pipeline and splitting
AbeezUrRehman Sep 3, 2025
94d462f
Update README with Windows activation command for virtual environment…
AbeezUrRehman Sep 4, 2025
47ac990
Initial plan
Copilot Sep 10, 2025
4e93126
Add TotalSegmentatorImproved CLI with organized outputs and smoothing
Copilot Sep 10, 2025
0e0b631
Add documentation, examples, and README updates for TotalSegmentatorI…
Copilot Sep 10, 2025
eae4446
Add TotalSegmentatorImproved CLI with organized outputs and enhanced …
Copilot Sep 10, 2025
7e984b5
Merge pull request #2 from AbeezUrRehman/copilot/fix-6df84d5e-a540-4b…
AbeezUrRehman Sep 11, 2025
5476962
Add and reorganize CT scan data files
AbeezUrRehman Oct 8, 2025
4336f7e
Improve TotalSegmentator with new features and fixes
AbeezUrRehman Oct 14, 2025
8747b0e
Enhance README.md: Add table of contents, installation instructions, …
AbeezUrRehman Oct 20, 2025
2f3c1ee
Update documentation and CLI: Change STL export to mesh export with f…
AbeezUrRehman Oct 20, 2025
5ef4ac1
Add interactive MPR widget and enhance DICOM to PNG conversion
AbeezUrRehman Oct 21, 2025
1d06b5e
Enhance mesh export functionality: Add options for edge padding, hole…
AbeezUrRehman Oct 21, 2025
92ff53b
Add mesh-only export functionality and Slicer-style exporter script; …
AbeezUrRehman Oct 21, 2025
e4645dd
Add material management and import functionality for organ models
AbeezUrRehman Oct 22, 2025
501013f
Add GUI and material application scripts for pipeline
AbeezUrRehman Nov 4, 2025
8f5f39c
feat: initialize web app with Next.js, Tailwind CSS, and TypeScript s…
AbeezUrRehman Dec 22, 2025
558bba9
feat: Enhance TotalSegmentatorApp with output folder selection and de…
AbeezUrRehman Dec 22, 2025
e3c8788
feat: Update metadata and enhance TotalSegmentatorApp with improved f…
AbeezUrRehman Dec 25, 2025
246e5a8
Add web viewer and update documentation
chenyiyanbbj Jan 7, 2026
1484615
Add i18n support and locale context to app
AbeezUrRehman Jan 19, 2026
5555356
feat: Implement custom alert and folder browser modals in TotalSegmen…
AbeezUrRehman Jan 22, 2026
85024a0
Merge branch 'develop' into web-viewer
chenyiyanbbj Jan 26, 2026
0a6e781
Merge pull request #4 from chenyiyanbbj/web-viewer
AbeezUrRehman Jan 26, 2026
4e2df47
Fix process log display error and add segmentation task selector
chenyiyanbbj Feb 4, 2026
4df8d65
Fix Blender add-on install flow and update CT slider setup
chenyiyanbbj Feb 10, 2026
b8a48ba
Correct coordinate alignment of 3D model to match CT slicer in Blender
chenyiyanbbj Feb 12, 2026
2ab414a
batch case processing
chenyiyanbbj Mar 2, 2026
8922f08
Merge pull request #5 from chenyiyanbbj/vessel-generate-tool
AbeezUrRehman Apr 13, 2026
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
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,14 @@ unittest_prediction_fast_force_split.nii.gz
.terraform/
*.pem
*.log
*.ipynb
*.ipynb
/totalseg_env
/baseline_full
/out_total_all
/test_input_data
/test_out_dir
/woking-checking-mac
dicom_slices
node_modules
**/*.dcm
data/
118 changes: 118 additions & 0 deletions IMPLEMENTATION_SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# TotalSegmentator Improvements - Implementation Summary

## Problem Statement Addressed

The user requested improvements to TotalSegmentator for better segmentation workflows:

1. **Organized outputs with titles** for specific segmentation tasks:
- "liver: segments" → liver_segment_1 through liver_segment_8
- "liver: vessels" → blood vessel, neoplasm
- "total" → inferior vena cava, portal vein and splenic vein

2. **Smoothness adjustment options** for better 3D Slicer accuracy and Blender compatibility

3. **Optional Blender export functionality**

## Solution Implemented

### New CLI Tool: `TotalSegmentatorImproved`

A comprehensive enhancement that provides:

- **Organized Output Structure**: Tasks are organized in separate directories with clear titles
- **Automatic Renaming**: Internal names mapped to user-friendly names (e.g., `liver_vessels.nii.gz` → `blood_vessel.nii.gz`)
- **Smoothing Options**: Four levels (none/light/medium/heavy) for better 3D visualization
- **STL Export**: Direct export to Blender-compatible format using marching cubes
- **Comprehensive Reporting**: JSON summaries with processing metadata

### Key Features

1. **Task Organization**:
```
output_directory/
├── liver_segments/ # "liver: segments"
├── liver_vessels/ # "liver: vessels"
└── total_vessels/ # "total"
```

2. **Smart Renaming**:
- `liver_vessels.nii.gz` → `blood_vessel.nii.gz`
- `liver_tumor.nii.gz` → `neoplasm.nii.gz`

3. **Smoothing for 3D Visualization**:
- Gaussian smoothing with configurable sigma values
- Preserves label integrity for multi-label masks
- Optimized for 3D Slicer and Blender workflows

4. **Blender Integration**:
- Direct STL export using marching cubes algorithm
- Smoothed meshes for better visualization quality

## Files Added/Modified

### New Files
- `totalsegmentator/bin/TotalSegmentatorImproved.py` - Main CLI implementation
- `tests/test_improved_segmentator.py` - Comprehensive test suite
- `docs/TotalSegmentatorImproved.md` - Complete documentation
- `examples/run_totalsegmentator_improved.py` - Usage examples

### Modified Files
- `setup.py` - Added new CLI entry point and enhanced dependencies
- `README.md` - Updated with new feature documentation

## Usage Examples

### Basic Usage
```bash
# Run all tasks with medium smoothing
TotalSegmentatorImproved -i input.nii.gz -o results --smoothing medium
```

### Specific Tasks
```bash
# Liver analysis only with STL export
TotalSegmentatorImproved -i input.nii.gz -o results \
--tasks liver_segments liver_vessels \
--smoothing heavy --export-stl
```

### Vascular Analysis
```bash
# Focus on vascular structures
TotalSegmentatorImproved -i input.nii.gz -o results \
--tasks liver_vessels total_vessels \
--smoothing light
```

## Technical Implementation

- **Conditional Imports**: Graceful degradation when dependencies unavailable
- **Error Handling**: Comprehensive error reporting with clear user feedback
- **Modular Design**: Separate functions for smoothing, export, and task processing
- **Backward Compatibility**: Fully compatible with existing TotalSegmentator

## Testing

- Comprehensive test suite covering all functionality
- Tests work with and without optional dependencies
- CLI argument validation and error handling verification
- Output structure validation

## Benefits

1. **User-Friendly**: Clear task titles and organized outputs
2. **3D Visualization Ready**: Smoothing options optimize for Slicer/Blender
3. **Workflow Integration**: Direct STL export eliminates manual conversion steps
4. **Comprehensive**: All required segmentation tasks supported
5. **Robust**: Handles missing dependencies and errors gracefully

## Next Steps

The implementation is complete and ready for use. Users can:

1. Install with `pip install TotalSegmentator[enhanced]`
2. Use the new `TotalSegmentatorImproved` CLI
3. Follow the documentation for specific workflows
4. Leverage the organized outputs in 3D Slicer and Blender

This solution fully addresses all requirements in the problem statement while maintaining the quality and reliability of the original TotalSegmentator codebase.
Loading