In dealing with MRI data it’s necessary to be familiar with the conventions and terminology used to describe orientation. It’s also necessary to be aware of a number of common differences of custom, and various traps for the unwary.
The following is my effort to get all of this straight. It is a work in progress. Even where something’s correct in my mind, it’s incredibly easy to write it down backwards by mistake. Feel free to send rebuttals to firstname.lastname@example.org
- Basic Direction Terms
- Axes for Spatial Coordinates
- X, Y, Z for Spatial Axes
- MRI Image File Voxel Ordering
- “Radiological” vs “Neurological” Orientation in Viewers
- Interpreting Voxel Order from Viewer — Difficult
- X, Y, Z MRI Array Indexes
- MRI File vs In-Memory Array
- Radiological vs Neurological Voxel Orders
- Talairach Atlas
- Caveat: More to the Story
Basic Direction Terms
If you’re new to the field the first thing you’ll need to know is some basic vocabulary regarding directions.
|Right||Left||Head orientation reference|
- “Up”, “down”, “front”, “back” are not used because they have confusing meanings when dealing with patients in different orientations (eg: lying down), or when dealing with other animals.
- Medial, Lateral: Because the left and right halves of the brain are almost mirror images, it’s useful to have:
“medial”: towards the middle of the R-L axis, on either side, and
“lateral”: away from the middle of the R-L axis on either side.
- Directions are given relative to the patient. (“Right” is patient’s right.) If we need to talk about location on a screen it’s important to distinguish carefully — so we might say that patient-right appears on screen-left.
Axes for Spatial Coordinates
To talk about locations in space in the neighborhood of the brain, we need to be able to talk more precisely about sets of axes, including which direction is positive, and which order we are going to list them when describing a point’s coordinates. There are three axes, which could be used in any order, and where either direction could be positive, so that gives us a total of 3 * 2 * 1 * 2 ^ 3 = 48 possible axis schemes.
In MRI practice it seems that two of these schemes are most popular:
|“Neurological” convention for axes, aka “RAS”||“Radiological” convention for axes, aka “LAS”||Head orientation reference|
- Direction and Order: Note that each convention specifies not just the positive direction of three axes, but also the order for listing them (eg: LAS, but not ALS).
- Right-hand vs Left-hand: Note that RAS is a right-hand coordinate system (thumb = R, 2nd finger = A, middle finger = S.), whereas LAS is a left-hand coordinate system. This is significant when performing matrix and vector math, where a right-hand coordinate system is customarily used (though a left-hand system can be used with appropriate adjustments).
- LSA? The L, A and S axes could provide a right-hand coordinate system if used in the order LSA for example, but nobody seems in favor of this (but see the X, Y, Z topic below!).
- Viewing Direction: In the figures above, I’ve shown them as viewed looking toward the patient’s face. However there are also conventions for viewing, wherein the Neurological view would be from above/behind the patient, hence showing patient left on screen left. More on that below.
X, Y, Z for Spatial Axes
In some contexts, brain data is placed in an X, Y, Z coordinate system, perhaps like this:
|1. Would be described as LSA:
+X = L
+Y = S
+Z = A
|2. Would be described as RAS:
+X = R
+Y = A
+Z = S
|3. Would be described as LAS:
+X = L
+Y = A
+Z = S
|Head orientation reference|
- LSA: Attractive perhaps at first glance to a graphics programmer, and of course you can do whatever you want inside your own program — but does not seem to enjoy wide use as a way to discuss brain coordinates.
- RAS: Corresponds to the Neurologist-preferred RAS axes, and is a right-hand system
- LAS: Corresponds to Radiologist-preferred LAS axes, and is a left-hand system (ie: don’t automatically assume that if X, Y and Z are being used that you are looking at a right-hand coordinate system.)
Why bother renaming perfectly good axes using X, Y, Z, why not just call them R, A, S or whatever? A couple of possible reasons:
- Some environments for manipulating points or images perhaps require you to state coordinates in X, Y, Z dimensions.
- When labeled as X, Y, Z, it’s obvious in what order you should state the coordinates (alphabetical), whereas with R, A and S floating around they might be more prone to listing in the wrong order.
MRI Image File Voxel Ordering
A number of MRI file formats involve storing voxel intensities as simply a stream of intensity numbers in to a file in some agreed-upon manner. (Examples: Analyze; AFNI). These formats require recording a number of characteristics of the image file, including voxel order, type of number used for intensity, and other attributes relating to conditions of image acquisition, processing steps that have been performed and so on.
In this discussion we are interested in the topic of voxel order.
In general terms, voxels are stored in sequence traveling along a row, one row after row another, one slice after slice another. But which directions are the rows and slices?
Like the case of the three axes, we again have a choice of 48 possible different storage orders. Here are some:
|Storage order in file||Slice orientation
|Increasing position in file is in
direction of spatial axes…
|R-L within P-A within I-S||“Axial”||RPI||LAS|
|L-R within P-A within I-S||“Axial”||LPI||RAS|
|R-L within S-I within P-A||“Coronal”||RSP||LIA|
- Storage Order: R-L within P-A within I-S means:
- Voxels ordered from right to left to store a row
- Rows ordered from posterior to anterior to store a slice (corrected 2004-02-13, thanks JR!)
- Slices stored from inferior to superior to store a volume
- Common 3-Letter Name vs Spatial Direction: My current strong impression is that it’s customary to refer to a particular voxel order by using the “from” letters of the three from-to pairs. This is not universal — some people refer to a particular voxel ordering by stating the spatial direction of increasing index. This situation is error-inviting, as the two different naming scheme are opposite.
- Repeat: Terminology is Tricky! For example, data files commonly described as using “RPI” voxel order store voxels in order of increasing LAS, not increasing RPI as might be expected at first glance.
- Slice Orientation names: There are names for the three possible slice planes, but these do no specify the +/- directions of their axes so are suggestive but insufficient to describe the order of voxels in a file:
- Axial (Transverse): R-L x A-P plane
- Coronal: R-L x S-I plane
- Sagittal: A-P x S-I plane
“Radiological” vs “Neurological” Orientation in Viewers
“Radiological” and “Neurological” identify two different conventions for the orientation of views of MRI slices. So far as I can tell, they mean the following:
|Convention||Glib descriptions seen everywhere||Slice orientation||Viewer software displays [Note 1]|
|Looking towards pt||Patient direction||Screen direction|
|Radiological||“Images are viewed as though looking upward from the feet of the subject.””Right is Left”||Axial||Superior||Right||Left|
|Neurological||“Images are viewed as though looking from the top of the head downward.””Right is right”
- Some Fudging on Neuro View: In truth, I haven’t actually seen a viewer that says explicitly that it’s showing an official Neurological view. I’m surmising the Neurological views from the observation that Neurological adherents seem satisfied to use a Radiological-convention viewer when they flip the R-L order of their raw data. Certainly software that shows patient-right on screen-left is generally said to be using the Radiological convention, whereas showing patient-right on the screen-right is said to be Neurological convention. (This most-important distinction is highlighted in yellow above).
- View Unrelated to Coordinate Axes: So far as I have observed, the Radiological vs Neurological view issue has little necessary tie to the Radiological vs Neurological coordinates issue. It does not seem to be the case, for example, that a Radiological viewer presents the three slice views looking consistently towards the Radiological axes L, A, and S, or consistently away from L, A and S.
Of course, a particular viewer might have readouts or labels for coordinates, and it would be important to know whether it is reporting LAS or RAS numbers, but those numbers could be reported while looking at either kind of view. (… which is exactly the case in FreeSurfer’s tkmedit — patient-left is on screen-right Radiological-style, and there’s a Neuro-style RAS readout and RAS coordinates are used for surfaces.)
Interpreting Voxel Order from Viewer — Difficult
Given the various schemes for storing data, and the possibility for voxel order to go awry, it’s essential to be able to cross-check the actual stored voxel order unambiguously. Surely you can use one of many viewers to do that?
Actually, most viewers go to some effort to read a volume’s header file, and orient the view in the most desirable fashion for viewing. This leaves you in the dark regarding the actual order of the data in the file, since it’s usually not clear what helpful rotation the viewer has applied.
MRIcro has done a nice job of orienting the views in desirable way. We see that patient right is on the left of the image, so today we’re Radiologists. (MRIcro has options for flipping.) But what does this tell us about the actual voxel order on disk?
Here’s a screenshot of my format-oblivious Orientation Reality Check viewer that shows the raw data order:
We can see that voxels are ordered (R-L, P-A, I-S) (ie: RPI) in the file. We wouldn’t want to study the MRI this way, but it does tell us that what we see in any particular smarter viewer is apt to obscure the raw data order.
X, Y, Z MRI Array Indexes
Returning to the topic of MRI files and arrays of voxels, some people use letters X, Y and Z when talking about voxel order. Here’s a description from SPM regarding the voxel order of files:
[…]after spatial normalisation, the images must be in the following orientation:
- X increases from Left to Right
Y increases from Posterior to Anterior
Z increases from Inferior to Superior
This is a right handed coordinate system,
First, let’s realize the “images must be in orientation” translates to “voxels must be in this order”. Now, from preceding discussion, we can confidently expect that most people will refer to this voxel ordering as LPI, with some others referring to it as RAS. But it’s also worth understanding what is the role of X, Y, Z in this picture. Here’s my current opinion:
- They convey that the file is like an array: Voxels[X, Y, Z], where X is the fastest-incrementing (innermost-nested) index, with voxels from Left to Right etc etc. Ie: X, Y and Z are introduced just so as to have some index variables, and they could just as well be I, J, K, or N0, N1, N2.
- X, Y, Z many have been chosen based on the idea that of course you are going to stick these voxels into a 3-D space that’s equipped with right-hand X, Y and Z axes, and here’s how to get the voxels into the correct locations. (But some people are content with left-hand X, Y, Z axes…)
MRI File vs In-Memory Array
Previous topic notwithstanding, if you were to actually read an MRI file into memory in one big blob and treat it as an array, it would probably be wrong to access it as: Voxels[X, Y, Z]. (Sticking with X being L-R and so on).
That’s because in popular computer languages the first index is the slowest-incrementing index into memory. So instead we’d need to access that blob of memory as Voxels[Z, Y, X] (in C/C++: Voxels[Z][Y][X] )
Radiological vs Neurological Voxel Orders
The labels “Radiological” and “Neurological” are sometimes applied to particular orderings of voxels in a file. This is quite a surprise to a database analyst, for whom the physical arrangement of bytes in a file has no more to do with what those bytes mean than the issue of whether they are stored clockwise or counter-clockwise on a hard-drive — so long as there’s metadata on hand to inform us what that order is.
Nonetheless, there has apparently been a history of viewers which slavishly copied bytes out of files and plotted them “verbatim” on screen from left to right, top to bottom, as this is the fastest way to get data from file to screen.
If voxel data is stored in a file from patient-right to patient-left, anterior to posterior, for example) , then when this is “copied” to the screen it places the patient’s right on the left of the screen, and anterior at the top, the Radiological preference.
For the Neurological folks who want patient right on the right of the screen, one suspects that there was overwhelming temptation to achieve this effect in early slavishly-Radiological viewers by re-ordering the data. (Or maybe the rationale was to be able to load data into matrices in a particular order — this would also motivate a desire for right-hand-organized data.)
As a consequence, we have the following terminology used by some:
|Storage order in file||Slice orientation
|R-L within P-A within I-S||“Axial”||RPI||Radiological|
|L-R within P-A within I-S||“Axial”||LPI||Neurological|
|I took a quick look at how coordinates in the Talairach atlas are commonly expressed. The Talairach Daemon (University of Texas Health Sciences) provides the reference shown at the right, which seems representative of other Talairach-mentioning web sites.Here we see RAS axes, using the letters X Y Z.|
Caveat: More to the Story
For sake of completeness: it should be noted that choices of axes and indices are only the coarsest issues when it comes to orientation, voxel order and position in space. In addition:
- Often an MRI volume (especially a raw one) is not aligned to some exact orthogonal direction. This emphasizes that the directions attributed to the voxel array indices really can’t be considered to be along particular spatial axes. Nonetheless, it’s useful to know which set of axes the voxel indices correspond to most closely, as this helps when applying alignment or rotation steps.
- There could be multiple volumes in a file, for example for multiple time points.
- When a volume has been aligned to some particular direction and set of axes, then of concern are:
- The location of the origin
- Whether the origin is centered in the middle of some central voxel, or on the corners of eight central voxels.
- Scaling (overall scaling, possible non-linear scaling)