Closed juliencarponcy closed 2 years ago
Yeah I think I can store some more info to make it easy to apply alignments to original files, let me check some things:
I'm guessing you want to use the alignment with the original files because of some properties that are lost in the alignment processing?
Are your original files single slice images, or whole slides?
You were doing the right thing to go backwards, but the rotation/padding/downsampling isn't stored at the moment so wouldn't match up perfectly. Probably in your first example the offset is from padding the slice image (they're padded to be the same size in AP_rotate_histology, but don't have to be), and the second is probably related to resizing the imaging in AP_process_histology.
I'm guessing you want to use the alignment with the original files because of some properties that are lost in the alignment processing?
Yes, it is for super-imposing anterograde projections (GFP on the pictures) of different animals. And the original images obviously have a much more interesting resolution which make looks downsampled results pale in comparison (even if we could still use a lower downsampling, but i assume computation time will be also way longer). For these reason i think it would be cool yes if we were to save the full pipeline of transform to apply and scale them to original pictures.
Are your original files single slice images, or whole slides?
This time it was single section, but I must confess I am a huge fan of your improvement for automatic detection cropping and saving of sections out of sull slides. So short term I guess that adapting to the individual sections process will be more feasible. Then in a second step linking it to positions of sections on the slide would be great, later?
Thank you very much for your insightful answer, it looks like there is shared interest to transform histology ROIs AND pictures to the CCF framework through your version!
Might be worth first trying to just not downsample the images (just setting resize_factor = 1
) in AP_process_histology
? The load times would be longer but I wouldn't think the computation time would be much longer, the rate-limiting step would be automatic alignment but that can be done when you're away from the computer.
If that's not a good solution for your images, I see the benefit of restructuring the code to do alignments on isolated/downsampled/flattened slice images, then applying those alignments to the original slide images for any real processing. In that case, it probably shouldn't save the intermediate small images if they're not useful for anything.
(closing this for now, but let me know of there are continued issues)
Hi,
I read with interest the previous ongoing issue about transforming coordinates into the CCF framework. For the past days, I tried to assist a colleague in aligning different brain section onto a standard CCF section but I struggled on several points. First, it seems that the functions working inside the GUI won't take original files as input. As a consequence, original images have been rotated to align them to dorso/ventral axis, which is I think one parameter needed to obtain the final transformation to CCF coordinates. Also, I must confess that I struggled with the imref2d part. So in the end, I manage to have an image roughly transformed as the CCF one, but i'm missing a few things to realign different original images together onto the same CCF section.
Here is a very bad piece of prototype code of me trying to realign:
A couple of image examples of the results:
I tried to adjust the imref2d to take into account the order of the different transforms but never managed to get everything right. Notably the first transform (based on the inverse of the tform saved) gave me notably smaller picture from the original which i don't get (specifically when i specify imref2d pixelextent of 1). So all of that is still messy to me, don't get to make sense and reverse-engineer it from the original pictures.
Anyway, just checking in after the other issue to see whether you could possibly help for getting directly atlas aligned pictures from original pictures and transform, which should be derived from the function you suggested in the previous issue, but integrating the first downsampling transform, and possibly the first rotation to put the image vertical.
Thank you very much in advance,
Julien