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:

7 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

Hi @GTMeijer ,

Thankyou for this wonderful clarification. I was wondering if you could clarify one step further for us.

From what I understand, here you describe how to get from an element in the annotated volume (AV), to a distance from bregma in microns. E.g. for your x coordinate in the 10um volume, skipping steps 2-3 …

X coord in microns = (X element in AV - 540) * 10

However, the element in the annotated volume does not seem to be the same as in the ‘CCF Coordinate’, at least in terms of how the latter is often defined; e.g. the CCF coordinates used in the ‘Spatial search’ in the mouse connectivity data here -

http://connectivity.brain-map.org/?searchMode=spatial&sourceDomain=184&primaryStructureOnly=true&isi=false&targetCoordinates=12800,3050,7850&initImage=TWO_PHOTON&experimentCoordinates=12800,3050,7850&experiment=286299886

To go from the CCF coordinate to a distance from bregma in microns, Takatoh et al., 2021 recommend us to do the following -

X coord in microns = (X coord in CCF - 5400) * -1

So…

X element in AV * 10 = X coord in CCF

Suggesting that the coord in the CCF is actually in terms of microns, rather in terms of elements in the annotated volume.

Is that right?

Thanks

Hi @terrenceM,

That’s correct. My original post describes how to transform the entire CCF atlas into stereotactic coordinates. When dealing with the full atlas, you have to pick a resolution because the atlas is voxel based. However, if you have a single coordinate you don’t use the voxels and perform the transform directly on the coordinates.

X coord in microns = (X coord in CCF - 5400) * -1

Looks right to me but bear in mind that this is only step 1, you still have to correct for the tilt and squeeze (step 2 & 3).