This documentation provides a comprehensive overview of the segmentation model explicitly designed to work with prostate CT scans. Its primary aim is to detect tumors and provide reliable segmentation of clinically significant prostate cancer (csPCa). This is especially crucial for improved diagnostic processes and potential treatment paths.
The prostate CT scan segmentation model stands at the intersection of clinical data research and deep learning algorithms. The initiative to develop such a model stems from the need to have precise and reliable tools for healthcare professionals to leverage.
This model is engineered using deep learning techniques and is tailored to analyze the PIC-AI challenge dataset. The emphasis is on delineating csPCa, which has been a challenging task due to the inherent complexities and subtleties of medical images.
To get started, you would need the following Python libraries:
os
: Essential for directory and file operations.SimpleITK
: A toolkit for medical imaging, crucial for reading.mha
and.nii.gz
files.numpy
: A library for numerical computing in Python.pickle
: Enables serializing and deserializing Python object structures.torch
: The primary deep learning framework used in this project.matplotlib
: For visualization purposes, especially for reviewing pre-processed images.
- Set Up: Ensure that
myModel.py
andtrain.py
are in the same directory as this code. - Data Path: In the
preprocess
function, provide the correct path pointing to your images and labels. - Data Processing: Invoke the
preprocess
function to handle your data and get it ready for the model. - Training: Utilize the
train_model
function available in thetrain.py
to begin training your segmentation model.
The model is trained on all 5 folds of the PIC-AI challenge dataset, making a total of 1500 samples. Depending on the project specifics, you might want to utilize a 2D U-Net, nnU-Net, or other variations known for their efficiency in segmentation tasks.
- Image Searching: This step involves a systematic search through directories to ensure every MRI image is paired with its corresponding label.
- Image Reading: Leveraging the power of
SimpleITK
, the code reads.mha
and.nii.gz
image formats, which are standard in medical imaging. - Resampling: To maintain consistency and improve image analysis, the images are resampled to have a uniform resolution.
- Image Cropping: Depending on the region of interest, the 3D images are cropped to focus only on pertinent sections.
- Slicing: From the cropped 3D volumes, 2D slices are extracted to facilitate easier model training.
- Conversion: Before feeding into a deep learning model, SimpleITK images undergo conversion to PyTorch tensors.
- Concatenation: For efficient training, all the processed images are concatenated into a singular tensor.
-
searcher: Orchestrates a search operation, listing MRI images (T2W, ADC, HBV) and their matching labels.
-
reader: Employs
SimpleITK
to read image files, both.mha
and.nii.gz
. -
resample_image: A utility function to adjust image resolution based on a pre-defined spacing.
-
crop_image: Handles the cropping operation of 3D images to accentuate the region of interest.
-
slice_image: Efficiently slices 3D MRI volumes into digestible 2D slices for the model.
-
sitk_to_tensor: Acts as a bridge, converting SimpleITK images to the PyTorch tensor format.
-
concat_to_all: Brings together all individual tensors into a collective one for both images and labels.
-
preprocess: A master function that sequences and executes all preprocessing steps.
Medical image segmentation, especially for prostate CT scans, is a rapidly advancing field. With the increasing integration of AI in healthcare, tools like this segmentation model can play a pivotal role in advancing diagnostic capabilities and enhancing patient care outcomes.