converting flywire coordinates to hemibrain coordinate

93 views
Skip to first unread message

xinping li

unread,
Oct 1, 2020, 2:16:46 AM10/1/20
to nat-user
Dear Nat-users-

I am trying to convert coordinate between flywire and hemibrain. I managed to get one direction work (from hemibrain to flywire) but not the other (from flywire to hemibrain).

Below are my codes to convert coordinates for a giant fiber neuron:

library(natverse)
library(nat.jrcbrains)
library(neuprintr)
library(fafbseg)

#hemibrain to flywire
gf.hemibrain=neuprint_read_neurons(2307027729)
gf.fafb=xform_brain(gf.hemibrain*8/1000,reference='FAFB14',sample="JRCFIB2018F",via=JRC2018F)
plot3d(gf.fafb)
open_fafb_ngl(gf.fafb,coords.only=FALSE)

#I selected a box around primary neurite, and the code worked beautifully- took me to a location that is right next to giant fiber in flywre. 

#flywire to hemibrain
choose_segmentation(release = 'flywire31') #not sure if this line is necessary
open_fafb_ngl(c(108893, 47740, 4381)*c(4,4,40))#not sure if this line is necessary
gf.flywire=read_cloudvolume_meshes("720575940623301520")

gf.hemibrain2=xform_brain(gf.flywire[[1]]*125,sample='FAFB14',reference="JRCFIB2018F",via=JRC2018F)
wire3d(gf.hemibrain2)
open_fafb_ngl(gf.hemibrain2,coords.only=TRUE)

#I understand that open_fafb_ngl is specific for fafb, that's why I asked for coordinates only, however when I select around primary neurite again, the coordinate I got is :
"11478.8442307023,-2293.04410824724,618.843715260764"- which is clearly wrong.

Any advice/comments/solutions will be greatly appreciated.
Thanks!
Xinping

Greg Jefferis

unread,
Oct 1, 2020, 6:29:41 AM10/1/20
to xinping li, nat-user
Dear Xinping,

Thanks for your interest in the natverse. The problem was that you were applying a scale factor of 125 to your FlyWire neurons before transforming them to hemibrain space. That correction factor of 1000/8=125 is applied to *hemibrain* neurons in order to correct for the fact that they are normally obtained in voxel space i.e. each unit along the coordinate axes corresponds to an 8nm step, whereas the bridging registrations are defined in µm space. At some point I will make a "JRCFIB2018Fraw" space visible which will account for this difference without any manual correction required. Corrected code sample below. Good luck with your analyses!

All the best,

Greg.

#flywire to hemibrain
choose_segmentation(release = 'flywire31') #not sure if this line is necessary
gf.flywire=read_cloudvolume_meshes("720575940623301520")

# NB don't multiply the input by 125 - this is the factor used to convert raw hemibrain (voxel) coordinates into µm
gf.hemibrain.um=xform_brain(gf.flywire[[1]],sample='FAFB14',reference="JRCFIB2018F",via=JRC2018F)

# now you can multiply the output by 125 to convert hemibrain µm -> raw voxel coords
gf.hemibrain.raw=gf.hemibrain.um*125
plot3d(gf.hemibrain, col='red', lwd=3)
# requires package hemibrainr from https://github.com/flyconnectome/hemibrainr
plot3d(hemibrainr::hemibrain.surf, alpha=.2)



--
You received this message because you are subscribed to the Google Groups "nat-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nat-user+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/nat-user/018bf5d6-23f2-4163-9c87-688f3dff92cen%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages