Mouse neurons reconstruction -> CCF alignment


I’m working on BrainRender, a python package to render mouse anatomical and morphological data (largely based on the Allen datasets).

I’ve added the possibility to render cell morphologies from theCellTypesCache, but unfortunately their coordinates are not aligned to the reference frame. I’ve seen that the Morphology class has an “apply_affine” method, so my question is if there is a way to get the affine for a cell to align it to the atlas. Have they been registered to the reference space at all?

Thank you for your help,


Hi Federico,

The short answer to your question is no, we do not publish an affine transform that puts a Cell Types Database morphology into the CCF.

The longer answer is that you might be able to do it based on information that is available. First, we do publish the CCF coordinate of the cell’s soma. If you go to the Cell Feature Search page of the Cell Types Database and click the link to download cell feature data, you get a CSV file that has the columns csl__x, csl__y, and csl__z. For mouse cells, those columns contain the x, y, and z CCF coordinates of the cell’s soma. So you can position the soma in the correct location.

Now, the orientation of the morphology still reflects how it was reconstructed in the slice, so a cell put at that location in the CCF wouldn’t be pointing the right way. However, we did publish the angles need to put the cells upright in Supplementary Dataset 3 of our recent Nature Neuroscience paper. That spreadsheet contains the upright_angle needed to rotate the cell (around its z-axis) so that pia is upward and white matter is downward, and the estimated_slice_angle to tilt the cell (around its x-axis) so that the pia/white matter axis is directly along the y-axis of its coordinate system. (The spreadsheet also has an estimated_shrinkage_factor so you could inflate the cell along its z-axis to adjust for the effects of shrinkage from fixation.)

The last step would be to rotate the morphology once more so that its vertical axis is pointing along the direct path between pia and white matter at that particular location in the CCF. I don’t believe that’s directly available anywhere, but it is possible to calculate from the geometry of the structures.

This all might be outside the scope of your package, but I wanted to lay out a path you might take in case you wanted to give it a shot.


Hi Nathan,

Thank’s for the detailed answer, that’s very interesting. It seems that it might be a fair bit of work, but if there is a way to automate it it might be worth it. If I do get around implementing this I will make sure to let you know, others might be interested in having these affine transforms.

Kind regards,