samwell Claude commited on
Commit
f372684
·
1 Parent(s): 18ae80c

Add ChestXRaySegmentationTool for anatomical structure segmentation

Browse files

Enables pixel-perfect segmentation of 14 anatomical structures:
- Left/Right Clavicle, Scapula, Lung, Hilus Pulmonis
- Heart, Aorta, Diaphragm, Mediastinum, Weasand, Spine

Features:
- Automatic segmentation of all organs
- Detailed metrics (area, centroid, bbox, size, intensity)
- Segmentation visualization overlays
- Uses TorchXRayVision PSPNet model

This completes MedRAX2 with 8 tools total:
1. NV-Reason-CXR - Clinical reasoning
2. MAIRA-2 Grounding - Phrase grounding with bboxes
3. CheXagent VQA - Interactive Q&A
4. Classification - Pathology detection
5. Report Generation - Radiology reports
6. Segmentation - Anatomical structure segmentation (NEW)
7. DICOM Processor - File handling
8. Web Browsing - Medical information

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -93,6 +93,17 @@ if device == "cuda":
93
  except Exception as e:
94
  print(f"✗ Failed to load report generation tool: {e}")
95
 
 
 
 
 
 
 
 
 
 
 
 
96
  # Load non-GPU tools
97
  try:
98
  from medrax.tools.dicom import DicomProcessorTool
 
93
  except Exception as e:
94
  print(f"✗ Failed to load report generation tool: {e}")
95
 
96
+ try:
97
+ from medrax.tools.segmentation import ChestXRaySegmentationTool
98
+ segmentation_tool = ChestXRaySegmentationTool(
99
+ device=device,
100
+ temp_dir="temp"
101
+ )
102
+ tools.append(segmentation_tool)
103
+ print("✓ Loaded segmentation tool")
104
+ except Exception as e:
105
+ print(f"✗ Failed to load segmentation tool: {e}")
106
+
107
  # Load non-GPU tools
108
  try:
109
  from medrax.tools.dicom import DicomProcessorTool