petersaj / AP_histology

Histology processing
61 stars 21 forks source link

CCF alignment of brain regions without a full histology brain slice #32

Closed SaraMederos closed 6 months ago

SaraMederos commented 6 months ago

Hi Andrew,

Thank you very much for your pipeline; it's super useful! I have a question. Have you tried or do you have any suggestions on how to align a histology image that is not a full brain slice (i.e., a brain area that can be manually mapped to the CCF)? I am planning to afterwards with your second pipeline transform some image coordinates of points into CCF atlas coordinates.

I assume this can be achieved by using the manual alignment option in your pipeline. I was just wondering if you have already tried something similar.

Thanks a lot in advance for your help. Sara

petersaj commented 6 months ago

Hi Sara - the manual alignment step should hopefully be fine for that step, you can click on whatever landmarks are visible for alignment. Feel free to let me know if you run into any issues when you get to that step

SaraMederos commented 6 months ago

Thank you for your prompt response, Andrew. This solution works perfectly for my requirements. image (1) I just wanted to add a few comments in case they might be helpful for anyone in the future. It's essential to run auto-alignments before attempting any manual adjustments, as the manual process relies on the auto-alignment results (ap_histology.align_manual_histology_atlas line 83). Additionally, I noticed a potential issue when there's only one slice for alignment in the auto process, as it expects 3D data, but a single image results in a 2D matrix. I addressed this by adding the following code snippet at line 120: if ndims(aligned_atlas_montage.CData) == 3 aligned_atlas_montage.CData = aligned_atlas_montage.CData .* permute([1;0;0], [2,3,1]); else % No permutation for 2D data end

Once again, thank you for sharing this solution; it's incredibly useful.

petersaj commented 6 months ago

Great! Good bug find - I've fixed both those issues in the updated repo.