How to transform CCF (x, y, z) coordinates into stereotactic coordinates

The Common Coordinate Framework (CCF) is defined in a basic image coordinate system, using the top-left-rear pixel as its origin, and incrementing in the X, Y and Z axes up to the number of pixels in each dimension (ML, DV, AP respectively). It was not designed as a targeting coordinate system. Using some transformations the CCF can be roughly aligned to the stereotactic atlas, however, since it was not it’s intended purpose one should take caution when using the CCF for targeting, even after applying these transformations. In the image below the CCF space in 25 μm voxels is depicted.

CCF

There are several transformations necessary to align the Allen brain atlas to the stereotactic framework: (1) there is an estimated 5 degree tilt in the sagittal plane and (2) the CCF is stretched in the DV direction, estimated at 94.3%. Note that the position of Bregma and the above mentioned transformation values are estimations.

Step 1: center the CCF on Bregma
The coordinates of Bregma depend on the resolution of the CCF space you are using. For a 10 μm resolution Bregma is estimated at (x,y,z) (540, 44, 570). For 25 μm this would be: (216, 18, 228). We’ll use the 10 μm resolution in the example below:
x = x - 540
y = y - 44
z = z - 570

Step 2: Rotate the CCF
The CCF is rotated 5 degrees in the sagittal plane compared to the stereotactic atlas; the anterior part of the CCF is tilted in the ventral direction.
X = x * cos(0.0873) - y * sin(0.0873)
Y = x * sin(0.0873) + y * cos(0.0873)
Note that 0.0873 is 5 degrees in radians.

Step 3: squeeze the DV axis
Y = Y * 0.9434

Step 4: transform into micrometers
X,Y,Z = X,Y,Z / resolution

Disclaimers:

6 Likes

Thank you @GTMeijer for your informative post!

Thank you @GTMeijer for this very informative post and tweet (https://twitter.com/guido_meijer/status/1573296562574626823)!

I’ve had a similar request in here: Getting AP position (bregma coordinate) from ABBA to QuPath - Usage & Issues - Image.sc Forum, and I’ll use your formula (warning included).

Just FYI, I’ve always found it weird, but according to the CCFv3 documentation, the axes of the CCFv3 is not like displayed on your image, but like this:

image

Does this change something to your formula ? I think that (540, 44, 570) makes more sense with the image I’ve posted than yours. I’d be tempted to think that the formula is correct, but your image is wrong. Is there something I missed ?

Thanks,

Nicolas

EDIT: Can you write a few corresponding coordinates between both systems ? I just want to make sure that I did not correct the rotation angle the wrong way :sweat:

1 Like

I’m also very confused by this. When you download the CCFv3 atlas and just plot it in 3D it’s clear that the origin is at the posterior-left hand corner (like in my figure) so I really don’t know why the CCFv3 documentation says otherwise. Maybe somebody from the Allen can chip in about this?

I think the Allen docs are correct, it’s consistent with their data e.g. in the 3D viewer.

@GTMeijer did you plot their image data (i.e. not the meshes) in 3D? It may be that the first plane of the image is at the back of the brain, but they define their coordinate system separately.

1 Like

Hi! The orientation described in the Allen docs is also consistent with the average template and annotation volumes available here and here

Thanks Guido for the informative post!
I think all the confusion about coordinate system came from the fact that Guido was probably using the converted CCFv3 data from the UCL cortexlab, as described in the neuropixels_trajectory_explorer readme:

Mouse: download the Allen CCF mouse atlas (all files at http://data.cortexlab.net/allenCCF/) (note on where these files came from: they are a re-formatted version of the original atlas, which has been processed with this script)

1 Like