jlevy44 / PathFlow-MixMatch

Don't mix, match! Simple utilities for improved registration of Histopathology Whole Slide Images.
10 stars 6 forks source link

Using PathFlow-MixMatch to register Nissl histology #19

Open horsto opened 3 years ago

horsto commented 3 years ago

Hi! I discovered your repository and preprint since I was looking for a way to align Nissl stained histology pictures to each other. My goal is to align the image on the right (see figure below) to the one on the left. The left half is actually a slice from the allen institute reference atlas (mouse brain) and the right is my own histology. Do you think there is way to use your algorithm to find the optimal alignment / warping, which would transform the right into something that can be an overlay on the left? image

I should say that I don't actually need a perfect warping and an intermediate goal would be to find some kind of maximum likelihood estimate of how / whether the image on the right fits to the one on the left. The left is a stack of images and the goal would be to find the "best fit" location in that stack. If (near perfect) warping is possible that would be great of course. I am sending this message a bit out of the blue since I am not sure where to start with this problem - so any tipps/suggestions are welcome.

jlevy44 commented 3 years ago

Hi there, sorry for the delay in response. We have been undergoing a bit of a refactor here. Were you able to get this registered? If not, I'm happy to give some tips!

horsto commented 3 years ago

Thanks, @jlevy44, I didn't actually proceed. Tipps on how to get started would be appreciated! Also, do you have a better alternative than looping through 2D slices of the 3D stack, finding a "best fit" and then doing fine alignment for individual slices: Is there a way to take the (native) 3D stack and try to find the alignment (2D sample to 3D stack)?

jlevy44 commented 3 years ago

Yeah, what would be really nice would be software that adjusts all alignments simultaneously. Not out of question, but not covered by this software unfortunately. As for 2D slices, common approach is to align by neighboring slices, I can point you to similar software that can be more robust. In any case, you'd probably want to mask out the tissue that is not in common, then utilize some cost function to perform the alignment (you can think of the transformation as a set of alignment parameters with an "MLE"-like solution). I'd probably recommend doing some tissue detection and filtering first to build masks for both images, then apply the MSE or one of loss functions here: https://github.com/jlevy44/PathFlow-MixMatch/blob/master/pathflow_mixmatch/cli.py#L169

I can also point to software for 2D -> 3D stack.

This seems like interesting software for alignment of multiple point sets if you converted your images as such: https://github.com/felja633/RLLReg , but something I'm looking into.

horsto commented 3 years ago

Thanks for the links @jlevy44, especially the RLLReg - this looks cool.