Author: Radvile Mauricaite

Brain imaging, neural networks and a year in research

As the last conference (for now) has passed I found myself in a position to bring the blog back to life after a bit of a pause during the summer. As this month also marks the end of my first year working in research, I thought I’d familiarize you with some of the work that got me into the lab and formed a large part of my first year.

A year in research it has been and I still remember vividly my first days within the lab which started even more way back – during the last year of my Bsc degree at Imperial College London. Given that an online python course over the summer and a statistical course in R during my studies were the only things relating me to coding or computer science, it was indeed a slightly frightening situation I got myself into – doing a final year project (on which a major part of my final score depends) training a machine learning algorithm to segment a muscle in brain images. Fast forward half a year, there was I with a degree in my hands (figuratively speaking, as Covid restrictions led me to finishing my degree from home) and a trained neural network, which I did not know then, but would base an important part of my work later on.

But let’s not go down the memory lane for too long and focus on what’s important – what is a neural network and why did I need to train it to segment a muscle in the brain?  A neural network is a type of machine learning algorithm which mimics the human brain in its architecture and uses training data to solve a problem and improve its performance over time without input from a user.  As the training progresses, the network determines the best parameters to produce the desired output – in our case a segmentation (a version of the original image where all of the pixels denoting the desired object are assigned one value and all of the pixels denoting the background a different one).

In our case we wanted to segment temporalis muscle, which is observed on routinely performed brain scans in brain tumour patients. We chose this muscle for a reason – there is evidence that it could be used to assess sarcopenia, which is the loss of muscle mass and/or function. Furtner et al. showed that temporal muscle thickness is predictive of overall and progression-free survival in glioblastoma patients and in a paper by Zakaria et al., temporalis muscle width accurately predicts 30 and 90-day mortality as well as overall survival from diagnosis.  You can find a quick overview of sarcopenia and its assessment in a previous blog post by Dr James Wang (https://blogs.imperial.ac.uk/componc/2021/04/06/covid-and-the-return-to-research/ ). Using temporalis muscle is advantageous in a brain tumour patient cohort, as other types of scans on which sarcopenia could be assessed are not usually available as part of their general cancer treatment. Thus, we wanted to train a neural network to automatically segment temporalis muscle, which would be much quicker than manually measuring the width in each patient scan.

During my final year project, I successfully trained a network to segment temporalis muscle. I used an already existing implementation of a U-Net (a type of neural network architecture) on GitHub, however, as I was not getting the required output, I had to find ways to make it work. Finally, after deciding to use a difference loss function (which was more suitable for our task, when the segmentation object only occupies a small proportion of the whole image) and trying hyperparameters optimization, I managed to get a good performing model just in time before the end of my placement.

The U-Net was trained to segment temporalis muscle in 2D slices, however in real world, brain images come in 3D. Thus, we needed to rethink and expand on this work. We wanted to automate the whole process – from having a 3D brain scan to having a segmentation in 2D at a specific level of the 3D scan and also the area of the muscle. We decided to use a slice-based approach as it is commonly used in medical imaging tasks and to use a 2D segmentation, as it is very difficult to outline temporalis muscle in some levels of the 3D scan, it is not clear how much additional information that would provide compared to taking one slice where the muscle is wide and clearly distinguishable from surrounding tissues as well as it would have taken us an enormous amount of time to do the manual segmentations on a larger amount of images. Thus, for our approach, we created a pipeline combining two neural networks – one network was trained to segment the eyeball and the other one to segment temporalis muscle as previously. We used the output of the first network to select one slice per patient at a desired level based on a threshold. Then, once we have one slice at a desired level per patient, we feed these slices into the second neural network, which segments the muscle and outputs its area.

The road to get to the final pipeline was not easy and without obstacles, as was my first year in research. I’ve learned the importance of keeping track of every file and folder, the methods used as well as the reasoning behind choosing a specific approach. The final product is not perfect – the code sometimes selects images at an incorrect level so there’s still room for improvement. Nonetheless, some of my colleagues have already started using this tool in their research and it is nice to see something that started off as my final year project slowly molding into an actual tool.