int-brain-lab / iblapps

pyqt5 dependent applications for IBL sessions
MIT License
23 stars 15 forks source link

Questions about Preparing histology data #122

Open OlyOlympic opened 5 months ago

OlyOlympic commented 5 months ago

Hello,

I am a external user, and I am facing some troubling issues when preparing histology data. I am reaching out to see if you can help me resolve these problems, your assistance would be greatly appreciated.

When I match my brain slices with Allen CCF v3, my bregma coordinates were set as bregma = [540 0 570] (AP, DV, LR; https://github.com/cortex-lab/allenCCF/blob/master/Browsing%20Functions/allenCCFbregma.m). However, in your coordinate systems, the bregma coordinates are ML = 5739 µm, AP = 5400 µm, and DV = 332 µm.

I would like to ask you: first, is the Allen CCF v3 data you use the same as the data used in https://github.com/cortex-lab/allenCCF? If so, how can I convert my data's coordinates to match yours? Finally, how can I obtain the bregma position from different perspectives?

Looking forward to your reply.

Best regards, Oly

mayofaulkner commented 5 months ago

Hello,

If you have your data in the coordinates output in the Allen CCF reference you can use the following code to transform your coordinates to those required for the GUI. Let me know if that helps!

OlyOlympic commented 5 months ago

Hi, mayofaulkner

Thank you for your reply.

Before reaching out for help, I had already visited the webpage you linked, but I still unsure how to convert the coordinates I have obtained into the data format required for the GUI. For example, should I follow the code in 'coordinate systems'? When I compare the coordinates of bregma, I find that bregma coordinates in my data differ significantly from both the CCF origin and the Bregma origin provided in your code, but I find that there is a difference of about 10 times between bregma coordinates in my data ([540 0 570] AP, DV, LR) and the CCF origin in your data ([5400um 332um 5739um] AP, DV, LR).

Additionally, the resolution of map I used for slice registration is 10um. Could this be related to the difference between my coordinates and yours? If the atlas resolution will affect the specific values of the data, will setting the variable 'res' to 10 in your code eliminate the impact of the atlas resolution on subsequent analysis?

Looking forward to your reply. Thank you for your time.

Best regards, Oly

mayofaulkner commented 5 months ago

Hello,

So the roughly 10x difference between your bregma coordinates and the one used in the IBL will be due to the fact that your bregma coordinates are in pixels rather than um. If you multiply by the resolution of your atlas used (10um), then they are roughly equivalent.

If you have your coordinates relative to the bregma that you have ([540 0 570] AP, DV, LR), then you will just need to multiply them by 10 and reorder the columns such that the order is LR, AP, DV.

Let me know if that works :)

OlyOlympic commented 5 months ago

Hi, mayofaulkner

Thank your for your reply, your reply clarified my question.

I have some other questions:

If I multiply my bregma coordinates by 10, the new bregma coordinates should be ([5400, 0, 5700] AP, DV, LR), which is different from the bregma coordinates used in your code ibllib.atlas (ALLEN_CCF_LANDMARKS_MLAPDV_UM = {'bregma': np.array([5739, 5400, 332])} """dict: The ML AP DV voxel coordinates of brain landmarks in the Allen atlas."""). When I use your code, should I change the bregma coordinates in this line of code to my bregma coordinates ([5700, 5400, 0] LR, AP, DV)?

In addition, I want to confirm that since the atlas resolution I used was 10um, I should set 'res=10' in the 'coordinate systems' section of the code you linked, right?

Best regards, Oly

mayofaulkner commented 4 months ago

Hi Oly,

Sorry for the delay in replying! I would suggest to offset your coordinates by the difference in bregma in our code vs your code.

The bregma coordinates that we have defined are for the 25um atlas which is what the gui uses, so I would recommend to keep the res=25. Since your coordinates are now converted to um, it is not necessary to use the 10um resolution atlas for the conversion.