petersaj / AP_histology

Histology processing
61 stars 21 forks source link

Can I map the multiple probes from multiple mice onto a single brain? #21

Closed Virginia9733 closed 10 months ago

Virginia9733 commented 1 year ago

Can I map the multiple probes from multiple mice onto a single brain? As shown below?

Screenshot 2023-03-08 232210 Screenshot 2023-03-08 232613

Many thanks!

petersaj commented 1 year ago

Sure, you can do this with this script I've got in a different repo: https://github.com/petersaj/AP_scripts_cortexlab/blob/master/allen_interface/AP_ccf_outline.m

The first two cells in that script set up axes showing the brain in 2D/3D

Then, optionally, you can run this cell multiple times to search for and draw areas of interest: %% Get area in search, draw

Then you can run the final cell to choose and plot probe locations (run once for each probe file) %% Draw probes (from AP_histology)

You might have to modify this script a bit depending on exactly what you want to plot, but might be good out of the box.

Virginia9733 commented 1 year ago

Hey Andy,

Thanks a lot!!! It works! But may I ask a few more questions?

  1. How could I loop in a folder that has multiple probe_ccf.mat for different mice? Currently, when it pops up a window to choose the probe_ccf.mat file, it has to be in the same directory of the AP_histology, otherwise, no such file in the directory.
  2. I assume the coordinates of each probe have been registered on the Allen CCF, therefore, they should somehow share the same coordinates system. In that case, can I merge different probe coordinates information of one mouse into one probe_ccf.mat containing multiple probes from multiple mice?
  3. How can I assign colors to multiple probes instead of red by default? Is it possible to assign a set of similar colors for one mouse, but different from the probes of other mice? For example, in my case, I have one probe in CA3 and one probe in MEC in each mouse. Can I assign red to mouse 1 and green to mouse 2, and so on and so forth?
  4. Can I select multiple regions to show on 3-D brain in one code, instead of running the cells multiple times? For example, if I would like to plot CA3 and MEC, is there a way to write them in a list, then plot multiple regions all at once?
  5. I noticed that after I plot probes from 2 mice, the result is a bit weird that it suppose to target CA3 and MEC quite well after the manual CCF registrations, but when I plot them in the same brain, some of the probes are not in the right positions. Screenshot 2023-03-10 201338
petersaj commented 1 year ago

How could I loop in a folder that has multiple probe_ccf.mat for different mice? Currently, when it pops up a window to choose the probe_ccf.mat file, it has to be in the same directory of the AP_histology, otherwise, no such file in the directory.

You should be able to navigate to any folder from the file chooser, or otherwise you can hard-code your particular file locations and put the code in a loop to load and plot. This script is just one of mine rather than something intended for public use, so it'd probably be most useful if you went line-by-line to see what the code is doing and customize it for yourself as you'd like it.

I assume the coordinates of each probe have been registered on the Allen CCF, therefore, they should somehow share the same coordinates system. In that case, can I merge different probe coordinates information of one mouse into one probe_ccf.mat containing multiple probes from multiple mice?

Sure, you could load and concatenate probe info, I'm not sure what advantage this would have over loading from each mouse separately though.

How can I assign colors to multiple probes instead of red by default? Is it possible to assign a set of similar colors for one mouse, but different from the probes of other mice? For example, in my case, I have one probe in CA3 and one probe in MEC in each mouse. Can I assign red to mouse 1 and green to mouse 2, and so on and so forth?

As above - I'd suggest you go through the code to customize it for your needs. The color is currently defined in line 100.

Can I select multiple regions to show on 3-D brain in one code, instead of running the cells multiple times? For example, if I would like to plot CA3 and MEC, is there a way to write them in a list, then plot multiple regions all at once?

Yes, you can just hard code which structures to plot rather than selecting them from a list. An example of how to do this is in lines 1748-1774 of this script.

I noticed that after I plot probes from 2 mice, the result is a bit weird that it suppose to target CA3 and MEC quite well after the manual CCF registrations, but when I plot them in the same brain, some of the probes are not in the right positions.

Hm that's strange - you mean they're plotted one way after running the histology code, and a different way after running this code? I can look into it if you attach the probe_ccf files and let me know which scripts produce different results?