KERMA-Demo is a Django-based web application designed for analyzing radiation therapy data, specifically focused on processing DICOM files and Dynalog machine log files. The application provides a user-friendly interface to visualize and analyze radiation treatment planning and delivery data.
The KERMA-Demo Project provides tools for:
- DICOM Analysis: Processing RTSTRUCT and RTDOSE files to extract radiation therapy structure information and dose distributions
- Dynalog Analysis: Analyzing machine log files to compare actual vs. planned radiation delivery through fluence map calculations
- Web Interface: A Django-powered web application for easy data visualization and analysis
- Statistical Analysis: Comprehensive error analysis and quality assurance metrics for radiation therapy delivery
- Extract structure names from RTSTRUCT files
- Calculate maximum dose values from RTDOSE files
- Support for standard DICOM RT objects used in radiation therapy
- Process Varian dynalog files (.dlg format)
- Calculate actual vs. expected fluence maps
- Statistical analysis including:
- Total fluence comparison
- Mean fluence values
- Error calculations (absolute and percentage)
- Quality assurance metrics
- Clean, responsive web interface
- Dark/light theme support
- Real-time data visualization
- Navigation between different analysis sections
- Python 3.8 or higher
- pip (Python package installer)
Install the required Python packages:
pip install -r requirements.txtOr install manually:
pip install django numpy pydicom dicompylercore pylinac- Clone the repository:
git clone https://github.com/gmartincor/KERMA-Project.git
cd KERMA-Project- Install dependencies:
pip install -r requirements.txt- Set up the Django application:
cd kerma_site
python manage.py migrate- Run the development server:
python manage.py runserver- Access the application at
http://localhost:8000
- Home Page: Navigate to the main page to access different analysis sections
- DICOM Results: View processed DICOM files showing:
- RTSTRUCT files with extracted structure names
- RTDOSE files with maximum dose values
- Dynalog Results: View dynalog analysis showing:
- Processed dynalog file pairs (A and B files)
- Fluence calculations and statistical analysis
- Error metrics and quality assurance data
cd scripts
python inspection_dicom.pycd scripts
python parse_dynalog_pylinac.pyKERMA-Project/
├── data/ # Data directory
│ ├── dicom/datasets_dicom/ # DICOM files storage
│ └── dynalogs/datasets_dynalogs/ # Dynalog files storage
├── kerma_site/ # Django web application
│ ├── kerma_app/ # Main Django app
│ │ ├── static/ # CSS, JS, and static files
│ │ ├── templates/ # HTML templates
│ │ ├── views.py # Django views
│ │ ├── urls.py # URL routing
│ │ └── tests.py # Django tests
│ ├── kerma_site/ # Django project settings
│ └── manage.py # Django management script
├── scripts/ # Analysis scripts
│ ├── parse_dicom.py # DICOM processing functions
│ ├── parse_dynalog_pylinac.py # Dynalog processing functions
│ └── inspection_dicom.py # DICOM inspection utility
├── tests/ # Unit tests
│ ├── test_dicom.py # DICOM processing tests
│ └── test_dynalog.py # Dynalog processing tests
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore file
└── README.md # Project documentation
- RTSTRUCT: Radiation therapy structure files containing organ and target contours
- RTDOSE: Radiation therapy dose distribution files
- .dlg files: Varian linear accelerator log files
- File pairs: Requires both A and B files for complete analysis
- Format: Binary files containing machine delivery data
- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install development dependencies:
pip install -r requirements.txt- Run tests:
# Run Django tests
cd kerma_site
python manage.py test
# Run unit tests
cd ..
python -m unittest discover tests/home(): Main page viewshow_dicom_results(): Processes and displays DICOM analysisshow_dynalog_results(): Processes and displays dynalog analysis
parse_dicom.py: Core DICOM processing functionsget_structure_names(): Extract structure names from RTSTRUCTget_max_dose(): Calculate maximum dose from RTDOSE
parse_dynalog_pylinac.py: Core dynalog processing functionsaccumulate_fluence(): Process dynalog files and calculate fluence maps
The project includes comprehensive unit tests:
# Run specific test modules
python -m unittest tests.test_dicom
python -m unittest tests.test_dynalog
# Run all tests
python -m unittest discover tests/- Django: Web framework for the user interface
- NumPy: Numerical computing for data analysis
- pydicom: DICOM file reading and processing
- dicompylercore: Advanced DICOM RT analysis
- pylinac: Medical linear accelerator analysis
- unittest: Python's built-in testing framework
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Make your changes
- Add tests for new functionality
- Run the test suite to ensure everything works
- Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/your-feature) - Create a Pull Request
This project is open source. Please check the repository for license details.
This software is intended for research and educational purposes. It should not be used for clinical decision-making without proper validation and regulatory approval. Always consult with qualified medical physicists and follow institutional protocols for radiation therapy quality assurance.
For questions, issues, or contributions, please use the GitHub issues tracker or contact the project maintainers.