This repository contains Python code to calculate the Normal Tissue Complication Probability (NTCP) for CBCT (Cone Beam Computed Tomography) imaging doses in radiation therapy. The project focuses on evaluating the impact of CBCT imaging doses on normal tissues, specifically for breast cancer treatment scenarios (left and right breast), along with sensitivity analysis of NTCP parameters.
- Overview
- Features
- Files
- Installation
- Usage
- Input Data
- Output Files
- Dependencies
- Contributing
- License
The code in this repository calculates NTCP for CBCT imaging doses used in radiation therapy, focusing on breast cancer treatment. It evaluates the impact of two imaging protocols (5 MU and 10 MU) on organs at risk (OARs) such as the contralateral breast, ipsilateral lung, contralateral lung, and heart. The NTCP calculations are performed using the Logistic model (for the breast) and the Lyman-Kutcher-Burman (LKB) model (for the lungs and heart). Additionally, the code performs statistical analysis (paired t-tests) and generates visualizations (boxplots) to compare the NTCP and mean doses between the two protocols.
- Calculate NTCP for CBCT imaging doses (5 MU and 10 MU protocols) for breast cancer treatment.
- Support for specific regions:
- Left breast (
cbct_ntcp_breast_left.py
) - Right breast (
cbct_ntcp_breast_right.py
)
- Left breast (
- Sensitivity analysis of NTCP parameters (
ntcp_sensitivity.py
). - Statistical analysis using paired t-tests to compare NTCP and mean doses between 5 MU and 10 MU protocols.
- Visualization of results with boxplots for NTCP and mean doses.
- Modular code structure for easy integration into radiation therapy workflows.
cbct_ntcp_breast_left.py
: Calculates NTCP for CBCT imaging doses affecting the left breast, performs statistical analysis, and generates boxplots for visualization.cbct_ntcp_breast_right.py
: Calculates NTCP for CBCT imaging doses affecting the right breast (similar functionality to the left breast script).ntcp_sensitivity.py
: Performs sensitivity analysis on NTCP parameters to evaluate their impact on the results.README.md
: Project documentation (this file).
- Clone the repository to your local machine:
git clone https://github.com/thanhtaiphys/Calc_NTCP_CBCT.git
- Navigate to the project directory:
cd Calc_NTCP_CBCT
- Install the required dependencies (see Dependencies section).
- Ensure all dependencies are installed.
- Prepare your input data in the correct directory structure (see Input Data section).
- Run the desired script. For example, to calculate NTCP for the left breast:
python cbct_ntcp_breast_left.py
- For the right breast:
python cbct_ntcp_breast_right.py
- For sensitivity analysis:
python ntcp_sensitivity.py
The scripts expect DICOM files (RT Structure and RT Dose) in the following directory structure:
C:/RT_Project/data_cbct/Breast_CBCT/breast_left/
├── PatientID1/
│ ├── RS...dcm (RT Structure file)
│ ├── ...CBCT5...dcm (RT Dose file for 5 MU)
│ └── ...CBCT10...dcm (RT Dose file for 10 MU)
├── PatientID2/
│ ├── RS...dcm
│ ├── ...CBCT5...dcm
│ └── ...CBCT10...dcm
...
- RT Structure files should start with "RS".
- RT Dose files should contain "CBCT5" for 5 MU and "CBCT10" for 10 MU in their filenames.
- Update the
root_dir
variable in the script if your data is stored in a different location.
Running the scripts will generate the following output files:
CBCT_Breast_Left_Summary_WithStats.csv
: A CSV file containing NTCP and dose statistics (min, mean, max) for each patient, plan (5 MU or 10 MU), and ROI.CBCT_Breast_Left_Statistics.csv
: A CSV file with statistical analysis results, including mean and standard deviation of doses and NTCP, along with p-values from paired t-tests.CBCT_NTCP_Boxplot_WithStats_for_Breast_Left.png
: A boxplot comparing NTCP values between 5 MU and 10 MU protocols for each ROI.CBCT_Dose_Boxplot_WithStats_for_Breast_Left.png
: A boxplot comparing mean doses between 5 MU and 10 MU protocols for each ROI.
(Note: Similar files will be generated for the right breast when running cbct_ntcp_breast_right.py
.)
The following Python libraries are required:
- Python 3.x
- NumPy (for numerical computations)
- Pandas (for data manipulation and CSV output)
- SciPy (for statistical tests and NTCP calculations)
- Matplotlib (for plotting boxplots)
- Seaborn (for enhanced visualization)
- dicompyler-core (for DICOM file parsing and DVH calculations)
Install them using pip:
pip install numpy pandas scipy matplotlib seaborn dicompyler-core
Contributions are welcome! If you have suggestions, improvements, or bug fixes:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes and commit (
git commit -m "Add feature"
). - Push to your branch (
git push origin feature-branch
). - Open a pull request.