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

Identifying laminar boundaries and issue using AP_histology2ccf #27

Closed
winnyning opened this issue Aug 7, 2023 · 3 comments
Closed

Comments

@winnyning
Copy link

Hi Andy,

I am trying to align my histology with spiking and LFP data to identify laminar boundaries but am confused about the last few lines using AP_histology2ccf since it is missing histology_points. What are the inputs to this function? Or is this step not necessary since it doesn't change the output mat files.

After doing the alignment with the function AP_align_probe_histology, is there a way to get the DV coordinates of the shifted blue boundary lines? I'd like to be able to identify which cells are in each layer.

Thanks,
Winny

@petersaj
Copy link
Owner

petersaj commented Aug 8, 2023

Hi Winny - the function AP_histology2ccf isn't needed for this - that's just a general function to convert histology coordinates to CCF, for example if you mark an injection site on your histology image and want to translate that into CCF coordinates.

If you've been able to successfully use AP_align_probe_histology, then it should have saved a field probe_depths in probe_ccf, so you load your probe_ccf file and access it as probe_ccf.probe_depths. The short answer to your question: if you have a unit at depth X, you find where depth X lies along probe_ccf.probe_depths, and then get the corresponding area in probe_ccf.trajectory_areas to get the are the unit lives in.

For example, you might have a probe_ccf.trajectory_areas which represents a possible trajectory of 6200um, and you've aligned your probe to start at 1000um. Your probe_ccf.probe_depths in this case will be [-1000 : 5200]. If you then have a unit that lives at 2500um depth on the probe, you find where probe_ccf.probe_depths is closest to 2500 (in this example, it would be ~value 3500), and then you use that as an index to get the area from probe_ccf.trajectory_areas (in this example, probe_ccf.trajectory_areas(3500)).

Apologies for this function being a bit rough and undocumented, in my experience it's more robust to use electrophysiological landmarks, if possible. For example, I used CSD to split superficial and deep layers here (https://www.nature.com/articles/s41586-020-03166-8/figures/9). Alternately, you could try these other ephys alignment tools:

Hopefully that helps, but let me know if anything's unclear.

@winnyning
Copy link
Author

Hi Andy,

Ok I see, thanks for the clarification. This resource is very helpful! I also had another question with norm_template_spike_n and template_depths not matching in dimensions. It looks like there's more values in template_depths?

@petersaj
Copy link
Owner

Ah, I see that depends on how the templates are loaded in and named. I've changed it to assume spike_templates are 1-indexed (kilosort output + 1) if you wanted to try it again?

This function is very old and not very good, I'll hopefully upgrade it in the next few months, if you'd like an alert you can subscribe to this issue I just opened: #29

@petersaj petersaj closed this as completed Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants