Photo by Umanoide on Unsplash

Facebook AI’s “fast MRI” in a nutshell

A theoretical and beginner-friendly introduction about the Facebook AI & NYU Langone Health challenge that wants to make Magnetic Resonance Imaging (MRI) scans available in 10 minutes

7 min readApr 13, 2021

--

Schedule:

  1. Challenge Introduction
  2. About Magnetic Resonance Imaging
  3. Machine Learning

3.1 Metrics Discussion

4. Practical Example

5. Fast MRI starter pack

1. Introduction

The magnetic resonance imaging is an imaging technique that is extremely convenient for several reasons. The power of this imaging technique is its flexibility and sensitivity to a broad range of tissue properties. In this sense MRI is an helpful imaging technique to understand much more about the human body, both about its form and its function. Moreover, this imaging technique is absolutely harmless.

So what’s wrong with MRI? Well, the first thing that is unpleasant is its cost.

Image made by me, using Python

Comparing MRI to other Imaging techniques in terms of cost, it is possible to see that MRI is the most expensive technology both in terms of charge per procedure and in terms of mean operating expense [Sistrom and McKay, 2005].

Two other major issues that are related with it are the motion artifacts [Zaitsev et al., 2015] and the patients anxiety [MacKenzie et al., 1995].

Are these three problems related? Yes, they are.

In fact, the one big problem of MRI is that they require a lot of time. This long time scan implies high cost, patients motion and patients anxiety.

Here’s why fast MRI has been created.

In 2018, Facebook Research and NYU Langone Health decided to create the fast MRI challenge. The goal is one and simple: reducing MRI acquisition time.

2. About Magnetic Resonance Imaging

But how do you get an MRI scan?

As the name itself suggests, the MRI scans are made by using the Magnetic Resonance principle of the atoms’ nuclei. It is possible to show that the usage of the Magnetic fields permit to get a Fourier space encoded signal [Haacke et al., 1999]. In other words, during the MRI scan, the image of your body is not acquired in the physical space (x,y,z) but in the frequency one.

This frequency space is known as k-space. The data acquisition process looks like this:

[Haacke et al., 1999]

The thing is that in the read axis, the following equation is valid:

The equation is telling us something simple:

If you want to get more data, you have to wait.

We might be tempted to take less data, and “undersample” the Fourier space.
Nonetheless, if we undersample the Fourier space, the Nyquist-Shannon phenomenon happens. This is the same thing that happens when we are not able to recognize if the wheel of a car is moving fast towards right or moving slow towards left.

Without dot you don’t know if the wheel is moving towards right or left!

In other words, if the images come from an undersampled Fourier space (that means that not enough points are considered) they are blurred, confused, dirty.

The goal is to start from these undersampled Fourier spaces and to understand how to go back to the original fully sampled ones.

But how do we practically get the “undersampled” Fourier (k) space? Well, that’s easy. We build a mask that simulates the undersampling process and we apply it to the original k-space. For example, if we want to consider a 1/8 time undersampled image.

(1) = Mask, (2) = Original K-Space, (3) = Undersampled K-space. Image made by me.

Once that this process is done in the Fourier Space, you can go back to the original one with the Inverse Fourier Transform, and you will get:

Image made by me

Now, the questions we want to answer is the following one. Let’s say we don’t have the lower image, but we only have the upper Fourier k-space

How can we predict what is hidden under the black lines?

Or, less technically:

How can we go from the blurred images to the “good” ones?

3. Machine Learning

Nowadays an analytical function that transforms an input undersampled image into the ground truth doesn’t exist. In general, as the task is extremely complex, the idea of searching for an analytical solution is probably unsuccessful. The classical denoising method are not promising, as they don’t improve the quality of the original image or they decrease it.

Classical denoising methods, image made by me

Instead of trying to follow a deductive approach, the idea is then to follow an inductive one, using Machine Learning.

The fast MRI challenge furnishes a wide dataset, thus paving the way for the implementations of robust Machine Learning algorithms. Here is an example of the dataset:

Image made by me using Python

3.1 Metrics Discussion

The definition of an optimal metric is still a discussed and and complex topic. Nonetheless, choosing a metric is essential both in the training part and in the testing one.

The Structural Similarity Index (SSIM) is a parametric metric that compares ground truth and test image by considering luminance, contrast and structural comparison. The parameter of this metric is the size of the window that slides on the image and computes the three quantities that have been cited above.

On the other hand, the Mean Squared Error (MSE) is the mean squared difference between the pixels of the two images, let’s say v (ground truth) and hat v, its estimated reconstruction . Considering two MxM images, the following equation is valid:

MSE expression

Even if the Mean Squared Error (MSE) metric doesn’t consider the structural similarities between two images while the Structural Similarity Index (SSIM) SSIM does that, the non practical considerations about SSIM makes the MSE a better metric to be considered.

MSE vs SSIM

4. Practical Example

A Deep Learning Encoder-Decoder algorithm is the well known UNet [Ronneberger et al., 2015]. This AI algorithm, originally created to perform biomedical image segmentation, has been considered to be the state of art baseline from the Facebook AI research paper for the 2018/2019 challenge.

It is basically an Encoder-Decoder that uses Convolutional Layers and adopts a U-shape, where the contracting and expanding part meets each other.

UNet in few words, Image made by me

Here is its structure:

[Ronneberger et al., 2015]

And here is some examples:

Image made by me

5. Fast MRI starter pack

This challenge is extremely wide-spread and its potential is huge. For this reason, there are basically no secrets about the challenge, the codes, and the submissions that are made.

If you want to get the dataset you can go here. It is extremely big, and you need to get familiar with the .h5 files. Once you understand and master them, you can start having real fun.

If you want to start exploring the dataset, applying the firsts masks or in general understand how to perform basic operations with data, you can go here. If you are an entry level about MRI, your best option is to follow this guide. It will save you from hours of errors.

If you want to theoretically understand how the state of art methods work, you can read the paper here. It is very well written, and it could be your starting point if you want to discover wether or not to jump into the fast MRI train.

If you want to apply some pre-trained models or trained the existing ones, you can go here. The positive thing is that they work (obviously) extremely well. The bad thing is that, if you want them to work well, you need to be patient and carefully follow their steps.

6. About me

If you liked the article and you want to know more about Machine Learning, or you just want to ask me something you can:

A. Follow me on Linkedin, where I publish all my stories
B. Subscribe to my newsletter. It will keep you updated about new stories and give you the chance to text me to receive all the corrections or doubts you may have.
C. Become a referred member, so you won’t have any “maximum number of stories for the month” and you can read whatever I (and thousands of other Machine Learning and Data Science top writer) write about the newest technology available.

--

--

PhD in Aerospace Engineering at the University of Cincinnati. Machine Learning Engineer @ Gen Nine, Martial Artist, Coffee Drinker, from Italy.