In this Python3 code example, a set of MRI images from one scanning session is resampled to match the imaging axis of a reference scan. The DICOM images are handled using PyDICOM. The resampling function is implemented using SimpleITK.
An example use case for this code example is as follows. Consider two MRI scans, A and B, with scan A imaged along the sagittal (longitudinal) plane and scan B along the axial (horizontal) plane.
If the reference image is set as scan A, then the scan B images will be transformed to appear as image slices along the sagittal plane; instead of the original axial plane used during the scan acquisition.
Similarly, if the reference image is set as scan B, then the scan A images will be transformed to appear as image slices along the axial plane; instead of the original sagittal plane used during the scan acquisition.
The example notebook is hosted in Kaggle. The MRI scans used in this notebook are from the RSNA MICCAI brain tumor classification dataset.
MRI scan resampling function using SimpleITK
Convert to UINT8 array
Defining the data handling variables including the reference image scan
Function to save the resampled MRI images
Generating resampled images
Moad Computer is an actionable insights firm. We provide enterprises with end-to-end artificial intelligence solutions. Actionable Insights blog is a quick overview of things we are most excited about.