UniRad3s is an end-to-end radiology suite built on Googleβs MedSigLIP and MedGemma along with MedSAM2. It enables automated diagnosis, precise lesion segmentation, and longitudinal tracking, generating both clinical and patient-friendly reports.
unirad3s/
βββ app_unirad3s.py # Main Gradio application
βββ simplify_report.py # MedGemma report generation module
βββ pipeline.py # Automated analysis pipeline
βββ folder_watcher.py # File system monitoring for auto-processing
βββ README.md # This file
βββ usage_instruction.md # Detailed usage guide
common_data/ # Patient data directory
βββ comman_format.json # Patient database summary
βββ pid_001/ # Patient folder
β βββ mri_scans/
β β βββ sess_01/ # Session folder
β β βββ *.nii.gz # NIfTI scan files
β βββ json/ # Annotation metadata
β βββ patient_results.json # Session analysis results
β βββ *_seg.nii.gz # Segmentation outputs
βββ ...
checkpoints/ # Model checkpoints
βββ MedSAM2_latest.pt
βββ MedSAM2_CTLesion.pt
βββ ...
sam2/ # SAM2 model implementation
βββ configs/ # Model configuration files
Create Virtual Environment
conda create -n medsam2 python=3.12 -y
conda activate medsam2
Install PyTorch
pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cu124
Clone and Install MedSAM2
git clone https://github.com/bowang-lab/MedSAM2.git
cd MedSAM2
pip install -e ".[dev]"
Download Checkpoints
bash download.sh
Install Additional Dependencies
# System dependencies
sudo apt-get update
sudo apt-get install ffmpeg
# Python packages
pip install -r requirements.txt
The application automatically detects available checkpoints and configs. Ensure:
checkpoints/ directorysam2/configs/ directorycommon_data/ directory exists for patient data storageexport HF_TOKEN="your_huggingface_token" # Required for MedGemma
export GRADIO_SERVER_PORT=18863 # Optional: custom port
cd unirad3s
python app_unirad3s.py
The application will start on http://0.0.0.0:18863 (or your configured port).
For detailed step-by-step instructions, see usage_instruction.md.
The pipeline.py module can be used for batch processing:
from pipeline import run_pipeline_for_patient
success, message = run_pipeline_for_patient("pid_001")
MedGemma can be used independently:
from simplify_report import MedGemmaSimplify
gemma = MedGemmaSimplify(hf_token="your_token")
clinical, patient = gemma.generate_reports(context_data)
This project stands on the shoulders of giants and would not be possible without the following outstanding works:
UniRad3s is primarily powered by Google's MedGemma and MedSigLIP, which serve as the central multimodal engines enabling automated diagnosis, visionβlanguage alignment, and automated clinical reporting.
This codebase builds upon MedSAM2 by the Bo Wang Lab at University of Toronto. MedSAM2 provides the foundational segmentation framework that powers UniRad3s.
For questions, issues, or feature requests:
Python
98.6%
Cuda
1.2%
UniRad3s is an end-to-end radiology suite built on Googleβs MedSigLIP and MedGemma along with MedSAM2. It enables automated diagnosis, precise lesion segmentation, and longitudinal tracking, generating both clinical and patient-friendly reports.
unirad3s/
βββ app_unirad3s.py # Main Gradio application
βββ simplify_report.py # MedGemma report generation module
βββ pipeline.py # Automated analysis pipeline
βββ folder_watcher.py # File system monitoring for auto-processing
βββ README.md # This file
βββ usage_instruction.md # Detailed usage guide
common_data/ # Patient data directory
βββ comman_format.json # Patient database summary
βββ pid_001/ # Patient folder
β βββ mri_scans/
β β βββ sess_01/ # Session folder
β β βββ *.nii.gz # NIfTI scan files
β βββ json/ # Annotation metadata
β βββ patient_results.json # Session analysis results
β βββ *_seg.nii.gz # Segmentation outputs
βββ ...
checkpoints/ # Model checkpoints
βββ MedSAM2_latest.pt
βββ MedSAM2_CTLesion.pt
βββ ...
sam2/ # SAM2 model implementation
βββ configs/ # Model configuration files
Create Virtual Environment
conda create -n medsam2 python=3.12 -y
conda activate medsam2
Install PyTorch
pip install torch==2.5.1 torchvision==0.20.1 --index-url https://download.pytorch.org/whl/cu124
Clone and Install MedSAM2
git clone https://github.com/bowang-lab/MedSAM2.git
cd MedSAM2
pip install -e ".[dev]"
Download Checkpoints
bash download.sh
Install Additional Dependencies
# System dependencies
sudo apt-get update
sudo apt-get install ffmpeg
# Python packages
pip install -r requirements.txt
The application automatically detects available checkpoints and configs. Ensure:
checkpoints/ directorysam2/configs/ directorycommon_data/ directory exists for patient data storageexport HF_TOKEN="your_huggingface_token" # Required for MedGemma
export GRADIO_SERVER_PORT=18863 # Optional: custom port
cd unirad3s
python app_unirad3s.py
The application will start on http://0.0.0.0:18863 (or your configured port).
For detailed step-by-step instructions, see usage_instruction.md.
The pipeline.py module can be used for batch processing:
from pipeline import run_pipeline_for_patient
success, message = run_pipeline_for_patient("pid_001")
MedGemma can be used independently:
from simplify_report import MedGemmaSimplify
gemma = MedGemmaSimplify(hf_token="your_token")
clinical, patient = gemma.generate_reports(context_data)
This project stands on the shoulders of giants and would not be possible without the following outstanding works:
UniRad3s is primarily powered by Google's MedGemma and MedSigLIP, which serve as the central multimodal engines enabling automated diagnosis, visionβlanguage alignment, and automated clinical reporting.
This codebase builds upon MedSAM2 by the Bo Wang Lab at University of Toronto. MedSAM2 provides the foundational segmentation framework that powers UniRad3s.
For questions, issues, or feature requests:
Python
98.6%
Cuda
1.2%