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

Allen CCF - transformation function for ROI list #41

Open
hossais2 opened this issue Oct 3, 2020 · 2 comments
Open

Allen CCF - transformation function for ROI list #41

hossais2 opened this issue Oct 3, 2020 · 2 comments

Comments

@hossais2
Copy link

hossais2 commented Oct 3, 2020

Hello,

I hope that you are doing well.

We have been using the Allen CCF to register data so that we can compare our findings across multiple animals. We really love the tool (a brilliant idea!), but have a question about functionality.

We are running a rather complex analysis, looking at multiple different cell types simultaneously on a single slice. We would like to register these data to an idealized mouse brain using the Allen CCF, so that we can systematically compare replicates and strains. Unfortunately, we can’t run the analysis after the Allen CCF transformation due to resolution issues from downsampling and apparent channel limitations (we’ve had trouble getting anything other than RGB and single channel images to work).

We have analyzed raw (untransformed) images and derived a list of ROIs with XY coordinates and associated data. Is it possible to extract the transform function that the Allen CCF used to register the slice (from Navigate_Atlas_and Register_Slices), then apply it (hard-coded) to an ROI list? If we can get this function, then we should be able register all of the associated data from our ROI list to the idealized brain. In other words, is it possible to run the analyze particles before the transformation, then apply the transformation that the Allen CCF used to register the slice?

Please let me know if my question isn't clear, or if you have an alternate solution.

@philshams
Copy link
Collaborator

Hi -- I'll copy the response I sent you over email here:
Yes this is possible. Note that in addition to the geometric transformation applied during registration, there is also the downsampling (as you mention) and potentially cropping during the histology processing part of the pipeline. So, these steps would need to be taken into account in your solution. Once you apply the multiplication (due to downsampling) and translation (due to cropping if applicable) to the XY coordinates, then you can apply the geometric transform, yielding your desired output.

This can be done by loading the transform data corresponding to the slice of interest, and using the transform it contains, e.g.
load("C:\Drive\Histology\for tutorial\SS096\processed\transformations\mouse_1_slice_1_transform_data")
geometric_transform = save_transform.transform
transformed_coordinates = transformPointsForward(geometric_transform, X, Y)
(note: I haven't tested this code, so you'll have to confirm that this works!)

One alternative solution, mentioned in the wiki (https://github.com/cortex-lab/allenCCF/wiki/7.-Analyze-other-types-of-regions-of-interest-(e.g.-cells)), is to "
include the ROI image as an additional channel (or the only channel) in the .tif image that undergoes pre-processing and registration (see Pre-processing histology images and Registering slices to the atlas). In this case, the ROI file will be a channel of the pre-processed and transformed image - e.g. '\processed\transformations\slice_1_transformed.tif'. This is recommended if your ROI detection analysis requires high-resolution images. If you use this method for ROIs marking individual cells, or other sparse, point objects, then uncomment the following line to ensure a one-to-one mapping between ROIs in the original and transformed images: rois = uint8(imregionalmax(rois));".

Let me know if you get either of these to work or if you need more guidance.

@philshams
Copy link
Collaborator

Hi -- the expected behavior is that multiple channels get transformed (e.g. below is the expected output for an image with three color channels). I believe testing was done with 1- or 3-channel images, so one thing you could try is to create a third, blank image layer to create a 3-channel image. If that doesn't work, feel free to send a link to some of your data and let me know exactly at which step the second channel disappears, and I can investigate.

Slice_2_9_transformed

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