RT-Rename is a web-based application designed to standardize radiotherapy (RT) structure nomenclature according to the TG263 guidelines using Large Language Models (LLMs). The application provides an intuitive interface for renaming RT structure sets, supporting both local models (via Ollama) and cloud-based models for intelligent structure name suggestions.
- π₯ Rename structure names: Standardizes structure names according to international radiotherapy guidelines such as TG-263.
- π€ AI-Powered: Uses state-of-the-art LLMs for name suggestions such as Llama 3.3, Gemma 3, Qwen 3, Deepseek R1, Deepseek V3 ...
- π Multiple Formats: Supports DICOM RTstruct, CSV, and .nrrd files
- π Web Interface: User-friendly interface
- π³ Docker Ready: Containerized deployment with Docker Compose
- πΎ Export Options: Export as CSV or updated DICOM files
- Docker and Docker Compose
- NVIDIA GPU with Docker GPU support (optional, for local LLM models)
-
Clone the repository
git clone https://github.com/LMUK-RADONC-PHYS-RES/rt-rename.git cd rt-rename -
Start the application
cd docker docker-compose up -d -
Access the application
- Web interface: http://localhost:8055
- Ollama API: http://localhost:11435
If you want to use cloud inference create a .env file in the root directory for open-ai API compatible cloud-based models:
OPEN_AI_URL=your_api_url_here
OPEN_AI_API_KEY=your_api_key_here- Python 3.8 or higher
- pip package manager
-
Clone the repository
git clone <repository-url> cd rt-rename
-
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r docker/requirements.txt
-
Install Ollama (for local models)
# On Linux/macOS curl -fsSL https://ollama.ai/install.sh | sh # On Windows # Download from https://ollama.ai/download
-
Start Ollama service
ollama serve
-
Pull required models
ollama pull llama3.1:70b-instruct-q4_0 # or other models as configured in config/models.json -
Run the application
python app.py
-
Access the application
- Web interface: http://localhost:8055
-
Configure Settings
- Select nomenclature type (TG263 or TG263_reverse)
- Choose anatomical regions (Thorax, Head and Neck, etc.)
- Set target volume filtering (yes/no)
- Select LLM model and prompt version
-
Upload Structure Data
- DICOM RTstruct files (.dcm)
- CSV files with structure names
- Directory with .nrrd files (drag & drop supported)
-
Review Suggestions
- View AI-generated TG263 name suggestions
- Check confidence scores and verification status
- Accept/reject individual suggestions
- Add comments for manual review
-
Export Results
- Export as CSV file
- Export as updated DICOM RTstruct file
For large-scale processing, modify the example batch script:
python batch_rename.pyEdit the script to specify:
- Input file paths
- Output file paths
- Model and prompt settings
- Batch size
- Standard DICOM RT Structure Set files
- Automatically extracts ROI names
- Can export updated DICOM files
- First column: structure names
- Optional additional columns for existing TG263 names, confidence, etc.
- Exports enhanced CSV with AI suggestions
- Directory containing structure files
- Filters out intermediate files related to synthRAD2025 preprocessing (_stitched, _s2_def, _s2)
- Supports batch processing
Edit config/models.json to add or modify available models:
{
"name": "Qwen 3",
"parameters": "30B",
"model_str": "qwen3:30b-a3b",
"cloud": false
},name: Display name in the UIparameters: Model size (e.g., 30B, 70B)model_str: ifcloud == falseOllama model string else model string used by the cloud inference api (e.g.,llama3.3:70b-instruct-q4_0)cloud: Set totruefor cloud-based models,falsefor local models
Customize prompts in config/prompt_v*.txt:
- Add domain-specific instructions
- Modify output format requirements
- Include additional context or examples
The config/TG263_nomenclature.xlsx file contains the official TG263 nomenclature. Update this file to use custom guidelines or newer versions.
-
GPU Memory Issues
# Use smaller models or increase swap ollama pull llama3.2:3b-instruct-fp16 -
Port Conflicts
# Change ports in docker/compose.yaml ports: - "8056:8055" # Change external port
-
Model Loading Errors
# Pull model manually docker exec -it rt-rename-ollama-1 ollama pull llama3.1:70b-instruct-q4_0
-
File Upload Issues
- Check file permissions
- Verify file format compatibility
- Ensure sufficient disk space
- Use GPU acceleration for local models
- Adjust batch sizes based on available memory
- Use cloud models for faster inference
- Enable caching for repeated operations
- Update
config/models.json - Implement model-specific handling in
utils.py - Test with sample data
- Update documentation
If you use RT-Rename in your research, please cite:
add paper once it's publishedThis project is licensed under the MIT License - see the LICENSE file for details.
- TG263 Working Group for nomenclature standards
- Ollama team for local LLM infrastructure
- Dash/Plotly for the web framework
- PyDICOM developers for DICOM handling capabilities