Closed winnyning closed 10 months ago
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:
alignatlasdata
from Enny van Beest (this is a copy of my function, but I think she's made improvements): https://github.com/EnnyvanBeest/GeneralNeuropixelAnalysisFunctions/blob/main/Histology/alignatlasdata.matlaselectrophysiology
from Mayo Faulkner at the IBL (in python): https://github.com/int-brain-lab/iblapps/tree/master/atlaselectrophysiologyHopefully that helps, but let me know if anything's unclear.
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?
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: https://github.com/petersaj/AP_histology/issues/29
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