This project demonstrates a basic workflow for processing DICOM (Digital Imaging and Communications in Medicine) medical images using the pydicom Python library.
The workflow covers essential steps such as loading and exploring DICOM metadata, accessing pixel data, handling RTSTRUCT files, and even writing new DICOM files. It serves as a foundation for anyone working with medical imaging and machine learning pipelines.
The project walks through the following:
-
Environment Setup
- Clone a repository containing sample DICOM files.
- Install the required Python library (pydicom).
-
Understanding DICOM Structure
- Explore key components: Datasets, DataElements, Tags, and Sequences.
-
Accessing Metadata
- Extract essential information from DICOM headers using tags.
-
Working with Pixel Data
- Access and visualize the image data stored in DICOM files.
- Learn why pixel values often need to be rescaled to Hounsfield Units (HU) for CT images.
-
Handling Volume Data
- Implement a
CT_volumeclass to organize and access a series of CT slices as a 3D volume.
- Implement a
-
Visualizing Volume Data
- Use Plotly to visualize CT data in 3D.
-
Writing DICOM Files
- Learn how to create and save new DICOM files.
- Handle mandatory attributes when writing.
-
Working with RTSTRUCT Files
- Explore RTSTRUCT (Radiotherapy Structure Set) files containing contour data for Regions of Interest (ROIs).
-
Extracting & Visualizing Contours
- Extract ROI contour data from RTSTRUCT files.
- Visualize contours using Matplotlib.
To run this project, you’ll need:
- Google Colab (recommended) or a local Python environment with Jupyter Notebook installed.
- Python libraries:
pip install pydicom numpy matplotlib scipy plotly