Here we will reuse the DICOM files from assignment 5 in NESC3505 Permission granted by Dr. Newman

Here imageio is used to process the DICOM files under the folder '5.T1_GRE_3D_AXIAL' from graded-Assignment_5

It is important to always see what type of data you are dealing with

In our case we can see that we are dealing with magnetic resonance data! 'MR' for short.

This is done by indexing the Modality row of the meta column in the data imageio array.

We can plot the data along the Sagittal plane and add an arrow at the point where we can see the Corpus callosum!

Here we use plt.imshow() to show a slice of the brain such that the Corpus callosum is clearly visible in the image. The axis is turned off and annotate is used to provide a clean arrow and caption of anatomy region using a curved arrow to not distract the viewer.

Lets suppose the patient wanted to see a sagittal plane view of their cranium on different layers to show everyone, here is a mp4 so they can keep it forever!

In this cell I first start by ensuring that there is no mp4 file already stored by using try if the file isn't there already then i simply continue on the except statement. A list is used for image file storage. I then iterate though the size of the data and use matplotlib.pyplot to plot the sagittal layers of the brain. If during this time I'm in the range of 80-100 then I annotate the the image. I then save the image using plt.savefig and storing it to cocalc's servers as a png. Next using imageio.imread the file is then reread from cocalc servers at which it is added to the images list, if traversal occurs in range of the Corpus callosum I add extra copies to the list to later simulate a slow motion effect. Calling plt.close() ensures the image will not interfere with the next iteration and os.remove() is called to free up storage space. Lastly imageio.mimsave is used to construct an mp4 file at 55 fps by iterating through the list filled with the sagittal plane png images through out the brain.

The code below demonstrates how I have learned and become proficient at input and output / file handling / annotations / matplotlib.pyplot and imageio methods beyond the original scope of the course.