Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From Voxel To Coordinates #49

Closed
FedeClaudi opened this issue Mar 3, 2020 · 4 comments
Closed

From Voxel To Coordinates #49

FedeClaudi opened this issue Mar 3, 2020 · 4 comments

Comments

@FedeClaudi
Copy link

@FedeClaudi FedeClaudi commented Mar 3, 2020

Hi,

I've only recently started using this awesome research, so I might be missing something obvious here. Is there a way to know the coordinates in a given reference frame for one of the voxels in VoxelModel?

I would need this for visualisation and to sort voxels based on their spatial location, but couldn't figure out a way to do this.

Thank you!

@kharris

This comment has been minimized.

Copy link
Contributor

@kharris kharris commented Mar 5, 2020

Can you explain in more detail what you mean by "coordinates in a given reference frame"?
Each voxel in the Allen atlas is assigned a particular 3d coordinate, so you can easily map that way.

@FedeClaudi

This comment has been minimized.

Copy link
Author

@FedeClaudi FedeClaudi commented Mar 5, 2020

Hi,

Thanks for getting back to me and sorry if my question wasn't too clear, I'll try to rephrase it.

What I meant is this, the VoxelArray is loaded as a large (~400.000 by ~ 200.000) matrix representing the connectivity strength from a set of source voxels to a set of target voxels. So each element in this matrix represents the connection strength between two voxels (A and B). What I would like to know is if there is way to know the coordinates in the atlas of A and B.
Now I know that there is Mask.map_masked_to_annotation that maps a 1d vector onto a 3d mask, but this doesn't do exactly what I need.

I hope the question is a bit more clear now. I guess in general I am confused about the shape and number of voxels in the VoxelArray. Given that in the docs it's described as a graph's adjacency matrix I would've expected it to be a square matrix, and I'm not sure I get where the number of rows and columns come from.

Thanks for taking the time,
Federico

@sjkoelle

This comment has been minimized.

Copy link

@sjkoelle sjkoelle commented Mar 5, 2020

Hi,

The reason that the matrix is not square, but rather has one dimension of length 2x the other, is that projections are categorized as coming from the same or different side as the injection (ipsi or contra). You can map from the VoxelArray to the ccf using the coordinates attribute of the Mask class. This object takes a major_brain_structure as an argument. The major_brain_structures are
['CB','CTXsp', 'HPF','HY','Isocortex', 'MB', 'MY', 'OLF', 'P', 'PAL','STR','TH']
(this ordering is findable in the code as well, and important). Once you load a Mask, for example, one corresponding to 'CTXsp', you will have the CCF coordinates of the voxels in that major brain structure in the mask.coordinates attribute. Ordering is consistent with the 200k x 400k table, but cumulative with respect to the major_brain_structure, so, for example, the first coordinate of Mask('CTXsp') will correspond to position len(Mask('CB').coordinates) in the big array.

Hope that helps,
Sam

@FedeClaudi

This comment has been minimized.

Copy link
Author

@FedeClaudi FedeClaudi commented Mar 5, 2020

Hi,

That works, and it explains a lot. Thank you very much Sam!

For reference, the reason why I needed this is because I'm trying to figure out how to visualise voxel-wise projection strength:

Thank you!
Federico

@DrJigsaw DrJigsaw closed this Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.