Education, tips and tricks to help you conduct better fMRI experiments.
Sure, you can try to fix it during data processing, but you're usually better off fixing the acquisition!

Saturday, February 3, 2024

Core corriculum - Mathematics: Linear algebra I

 

What is linear algebra? To get us going, I'm going to use the excellent lecture series by 3Blue1Brown and do my best to add some MRI-related questions after each video. Hopefully the connections won't be too cryptic. Don't worry if you can't answer my questions. It's more important that you understand the lectures. No doubt you'll find other material on YouTube and web pages to clarify things.

Let's start with a couple of definitions. While you'll find many examples online, for our purposes we can assume that a linear system is one where the size of the output or outputs scales in proportion to the input or inputs. The take-home pay of a worker paid an hourly rate is linear. They might receive their base amount, say 40 hours per week, plus some amount of overtime at twice their hourly rate. The total is still the linear combination of the base plus overtime amounts.

Non-linear systems don't have this simple proportionality. Gravity is the classic physics example. The strength of the interaction between two massive objects changes as the reciprocal of the squared distance (r^2) between them, that is, as 1/r^2. Finding yourself dangling ten meters in the air above the earth is very different from finding yourself ten more meters away from the earth at a height of 1000 km. In the first case you are about a second away from impacting the ground. In the second case you are in orbit and your more immediate health concerns are lack of oxygen and your temperature.

And what about the term algebra? It's just fancy speak for using symbols to represent the relationships between things that vary. We're going to be interested in changes at different positions in space - points in an image - and so we shall eventually use matrices to perform linear algebra. But we have to build up to a matrix from its skinnier cousin, the vector.


A1. Vectors: Essence of linear algebra

 


Q: We will use both a physicist's and a computer scientist's view of vectors at different points in the fMRI process. Given what you know today, can you guess where these different viewpoints might come up? Hint: fMRI is based on MRI, which is a physical measurement technique, while fMRI is typically the analysis of a time series of a certain type of dynamic MRI scans.

 

Q: Changes of basis are quite common in MRI. Even the way we usually label image axes involves a change of basis. The magnet bore direction is labeled the z-axis, while left-to-right is the x-axis and up-down is the y-axis. We refer to this assignment as the lab (or magnet) frame of reference. Now consider an axial MR image of a person's brain. An axial slice lies in the x-y plane in the magnet basis (or lab frame if you prefer). Yet we don't generally label the image with (x,y) dimensions. Instead we use (L-R, A-P) where L-R is left-to-right and A-P means anterior-to-posterior. This is an anatomical basis. How might an anatomical basis be more useful than using a magnet basis in MRI?


A3. Linear transformations and matrices:

 


Q: We usually label images using a basis (or reference frame) related to the subject's anatomy, i.e. with the (orthogonal) axes labeled head-to-foot (HF), left-to-right (LR) and anterior-posterior (AP). This means if a subject's head isn't perfectly straight in the magnet - let's say, the head is rotated 20 degrees to the left - the brain still appears straight in the 2D image. But here's the thing. The MRI hardware is controlled using the (x,y,z) "lab" reference frame. The anatomical and lab bases can be related to each other through a rotation matrix. Can you write down what a rotation matrix might look like that relates the subject's anatomical reference frame to the scanner's lab (x,y,z) reference frame?

________________