If you think about it, CT scans are really quite awesome. They allow you to see inside the human body without cutting it open. Like, imagine if someone asks you to look inside a room, but not to open the door.
That's effectively what a CT is doing. But the question is, how do they work? If we cut open a CT scanner, you can see that the inside is just an x-ray generator and detector spinning really fast in a circle.
The Xrays travel through your body and get absorbed or scattered by your different body parts. This is called attenuation. You can think of it like how much the Xrays are being blocked from reaching the detector.
Materials that are dense, like bone, have a high attenuation coefficient, so block more X rays and appear white. Less dense materials, like your lungs have a low attenuation coefficient, so let more X rays pass through and appear black. So when you're looking at a radiograph, you're actually looking at a map of attenuation coefficients.
The brightness of the pixel corresponds to the total attenuation of everything along the path of that X ray. Now, the aim of the CT scan is to reconstruct the values of those attenuation coefficients for the tissues that the X ray beam passes through. It does this by shooting a narrow beam of X rays to image a small slice of you at a time and then stacking those slices at the end.
We can simulate this with a three by three grid representing a single slice of human tissue. Just imagine you have something like bone in the centre of the image, which is a high attenuation coefficient of, say, 30. And everything around it is just empty space with an attenuation coefficient of zero.
If we get an X ray from this angle, we get total attenuations along these paths to be 0, 30 and 0. This process is called forward projection. It's just taking a simple X ray.
We keep doing this forward projection from multiple different angles, and we get all these values. Now, say we didn't know what the values in the table were. How do we figure them out?
Well, we do something called back-projection, where we spread out the total numbers across the table. So we take the 30 and the zeros and spread it evenly across the row like this, and then do the same for all the other different angles. You can see how this creates a decent representation of our original image, where the centre is a high attenuation and the edges have a relatively low attenuation.
So it's a similar concept in CTs, except the image is 1024 pixels wide. Okay, so let's see this in practice. Say we have this image here.
It's supposed to represent a brain that's been sliced axially and just pretend that we don't know what the inside of this image looks like. So we need to put it through a CT scanner to find out. We take X rays at multiple different angles and then spread out the result across the image using back projection, like we explained earlier.
As we collect more and more data from different angles, you can see that we get closer and closer to our original image. And badabing badaboom, we get. .
. uh. .
. a blurry image? Why is this?
Well, back projection isn't 100% accurate, leading to some uncertainty in localising the boundaries between different tissues. And you can see that earlier in our three by three grid. To understand why, we have to first understand that all images are actually just made up of waves of different frequencies.
I found this really cool simulation on MATLAB. You can see how this image is being split up into a set of black and white sinusoidal waves like this, each with its own frequency. Splitting up an image or a signal into its constituent frequencies like this, is called a Fourier Transform.
The Fourier transform is a super important mathematical function that pops up almost everywhere in physics and engineering. The most important takeaway from this is that the low frequency waves in our image gives us our large, broad structures and the high frequency waves gives us the edges and the finer details. Now, let's get back to our CT image.
The problem with back projection is that we oversample the low frequencies and we undersample the high frequencies, which results in a blurry image. So to get around this, we apply something called a high pass filter to our signal, which, as its name suggests, lets the high frequencies pass through and reduces the intensity of lower frequencies. And side note, the high pass filter is usually applied to the signal obtained at the detector way before the back projection step, just because it's faster and easier that way.
So we do a back projection of these filtered signals and bam, we get a sharper image, which is pretty close to the original. And interestingly, when you edit a photo and increase its sharpness, your computer is doing a similar thing. It's performing a Fourier transform and applying a sort of high pass filter to the image.
And if you're doing a Gaussian blur, then you're doing the opposite by applying some sort of low pass filter. This is all well and good, but there are actually better ways to create the CT image. It's called iterative reconstruction and is basically a guess and check method.
Again, say we have this simplified slice of a brain which we're putting through a CT scanner and trying to reconstruct. In the first iteration, you start with a guess of what the final image looks like. This can be a decent guess made from back projection or as simple as a blank image, like in this case.
The next step is to do a forward projection of our estimate at multiple different angles like before. But this time we stack all the different X rays on top of each other to form something called a sinogram. You can see what I mean here.
It's called a sinogram because it's forming these sine waves. Then you shoot X-rays through the actual patient in the CT scanner and get the measured sinogram the aim is to get our estimate sinogram to look like our measured sinogram so that we can reconstruct what the inside of the patient looks like. We do this by dividing the measured sinogram by the estimated sinogram to form the ratio sinogram.
The ratio sinogram is then back projected and the result is multiplied with our initial estimate to form our new guess. So that's one iteration and watch what happens with subsequent iterations. The idea is we get closer and closer to the true image until further iterations make no difference to our estimate.
So what's the difference between this method and filtered back projection? Well, amazingly, this guess and check method produces higher quality images at the same radiation dose. You can see in this comparison here.
The only downside is that Iterative reconstruction takes a lot of computing power and time. So up until recently, filtered back projection was the industry standard. Now, with modern computers, which are super fast and powerful, iterative reconstruction has become the norm.
Okay, so we've done all this work, but we've only ended up with one slice of the human body. So we need to repeat this whole process for the rest of the slices in the body part you want to image. Then you can stack all those slices on top of each other, and the radiologist can scroll through it.
You can also do something called multiplanar reformation, meaning you can scroll through the images in different planes. You can also do fancy 3d reconstructions, and you can even print out these 3d models. At its core, CT reconstruction is an inverse maths problem, meaning we have a set of observations and we try to define the factors that led to those observations.
Inverse problems crop up in a lot of other places. For example, when you use a photo editing program and remove an object, the software is trying to solve an inverse problem by trying to figure out what was behind that object. And it all comes down to a bit of maths, which is why I find CTs so fascinating.
Sure, the maths you learnt at school seemed boring and pointless, but it's this math things like algebra and calculus which helps us look inside people without need to cut them open.