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:

8 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).

Hi @GTMeijer,
I still seem to be missing a step somewhere. From the connectivity atlas, we find injection sites within the SSp-m (WT), and for each of these injections, we have CCF coordinates and Bregma coordinates, 3 of which I list below:
InjectionID CCF Bregma
180717881 [4620, 3340, 9380] 0.74, 3.3,1.63
157654817 [4370, 3460, 9310] 1.1, 3.3,1.15
112936582 [4470, 2700, 9140] 0.74, 3.25,0.75
If I follow the suggestions of Takatoh et al., 2021 (i.e. AP in CCF = –1 × AP coordinates × 1000 + 5400; DV in CCF = DV coordinates × 1000; ML in CCF = ML coordinates × 1000 + 5700.)
InjectionID Proposed CCF Bregma
180717881 [4660, 3300, 7330] 0.74, 3.3,1.63
157654817 [4300, 3300, 6850] 1.1, 3.3,1.15
112936582 [4660, 3250, 6450] 0.74, 3.25,0.75
I understand from your previous post that we need to accommodate for rotation and squeezing, i.e.
X = x * cos(0.0873) - y * sin(0.0873)
Y = x * sin(0.0873) + y * cos(0.0873)
Y = Y * 0.9434, which yields
InjectionID Proposed CCF Bregma
180717881 [4354, 3484, 7330] 0.74, 3.3,1.63
157654817 [3996, 3455, 6850] 1.1, 3.3,1.15
112936582 [4359, 3438, 6450] 0.74, 3.25,0.75
Clearly, the proposed CCF does not match the actual CCF. I need to understand what I am doing wrong, because I aim to transform points from CCF to Bregma for which I have no Allen Institute provided ground truth. Can we only convert from CCF to Bregma, not Bregma to CCF? And, if so, what would the conversion from CCF to Bregma be, since the Z position is dramatically incorrect. Any advice you have would be tremendously appreciated.

Hi @akriebs,
Let me be clear: there is no ground truth conversion between CCF and Bregma coordinates. The CCF atlas is an atlas which was constructed from histological slices, therefore it is an imperfect reflection of how the brain is actually positioned and shaped in the skull of a live animal. How did you get the original CCF and Bregma coordinates that you listed at the top? How do you know that these are “correct”? One possibility is to inject at a Bregma coordinate, slice the brain, register it to the Allen CCF and then determine the CCF coordinate of where your injection ended up. However, you have to do this many times to get an accurate estimation of the Bregma-to-CCF conversion. This is because each mouse brain/skull is different and there is also targeting error when you use Bregma coordinates. The equations I provide above are based on an estimation. In the end the only thing you can do to know for sure that you are using the right coordinates is to do some pilot injections, slice the brain, register to CCF, and see if you were in the right place.

If you aim to do injections in SSp-m I can also recommend to use Pinpoint (Pinpoint), when you click “Click to add new probe” you can choose injections pipettes. With this tool you can then position the pipette in your target area and it will provide you with the Bregma coordinates to hit that target. Pinpoint already does the transform for you.

To map the CCF to skull coordinates, this publication may be of use.

1 Like

Do you have any instights of how to move from Ox, Oy, Oz, Vx, Vy, Vz, Ux, Uy, Uz into Bregama(mm) as presented in the quickNII, and vis-a-versa?

I am having hard time to understand how to transform from the output of the program back to Bregma (mm) and will appritiate any help.

Thanks
Sivan

@GTMeijer I believe there is a typo in your rotation instructions. If xyz are ML, DV, AP respectively, then surely a rotation in the sagittal plane means adjusting the y and z coordinates, rather than the x and y?