Pycad for Medical Imaging (all you need to know)

Python Academy Resources for Medical Imaging

Mohammed El Amine Mokhtari
5 min readAug 6, 2022

I compiled all the medical imaging resources from my blogs, GitHub repositories, and YouTube channel in this blog post. You can use this to get a sense of my current and previous work.

What is the difference between dicom and nifti files?

Every newcomer to medical imaging asks this topic frequently, therefore I made a blog post about it, which you can see here.

Medical imaging conversions

In this part, I’ll include the specific GitHub repositories and blog entries I’ve written to assist with converting between regular images and medical images.

Convert JPG/PNG images into dicoms

If you’re interested in learning how to create dicom files from regular grayscale or RGB (3-channel) images, you can check out these:

Blog

GitHub

Convert nifti file into dicom series

After reading the blog post comparing dicom and nifti files, you now realize that a nifti file is simply a collection of dicom series. Because of this, I wrote a blog post and code that demonstrate how to perform this conversion.

NOTE: you need to notice that the method explained in this blog post is not very sufficient but I created a proper way to do this conversion and you will find it in the Medical Conversions app that I will show in the next sections.

Blog

GitHub

YouTube

Convert dicom series into nifti file

Since we are able to convert the nifti file into the dicom series, we can also perform the opposite process, allowing you to create a single 3D file (nifti) as opposed to numerous 2D (dicoms) files.

Blog

YouTube

Convert numpy array into nifti file

I occasionally had to convert a 3D numpy array into a nifti file. For example, this 3D numpy array could be a mask that you need to save as a nifti file in order to overlay over the actual scans. Here’s how to go about it.

All Conversion in One Code

I combined all the processes with the troubleshooting and optimization into one code that can be used as a graphical user interface after having all these scripts for the various conversions. This will make it easier for you to live a life where everything is at hand.

Pycad Resources for Deep Learning for Medical Imaging

I also have several resources for deep learning for medical imaging on my website and YouTube channel. I’ll put them all in this section.

Preprocessing 3D medical images

Preprocessing is usually a crucial step before training the models in any field where deep learning is being applied. However, this is slightly different with medical imaging, particularly 3D images. Because of this, there is an open source framework called MONAI that may assist you in performing this and many other tasks.

Blog

GitHub

YouTube

Augmenting 3D medical images

The data augmentation step is another one that is frequently necessary to train a deep learning model. We are aware that a lot of data is needed to train a neural network. Augmenting medical images differs from augmenting regular images. Here is an illustration of how to use always MONAI to augment 3D medical images.

Blog

GitHub

YouTube

Full Premium Course

A new course on MONAI for medical image segmentation in 2D and 3D is shortly to be released. The entire process — from annotating the data to creating a trained model — will be covered, and a full lifetime of support is provided. You can sign up for our waiting list here if you’re interested:

--

--

Mohammed El Amine Mokhtari
Mohammed El Amine Mokhtari

Written by Mohammed El Amine Mokhtari

I'm a computer vision research assistant, YouTuber and online content creator. Co-founder at: https://pycad.co/

No responses yet