tlambert03 / LLSpy

Lattice light-sheet post-processing utility.
http://llspy.readthedocs.io
Other
27 stars 6 forks source link

FiducialReg saving matrix #33

Closed joaomamede closed 8 months ago

joaomamede commented 3 years ago

What is the most appropriate and efficient way to save a bead registration to use at anytime with other experiment (basically to just to the conversion matrix once and apply subsequently).

Basically, not to use LLSpy as GUI but the fiducialreg.py as a module.

Thanks!

tlambert03 commented 3 years ago

It's a good question, and I've been wanting to use just the figucialreg part of this package myself recently (without having to use LLSpy). Truth is, it's been a long time since I've looked at this module, and I need to remind myself how it works :joy: ...

To be honest, I also feel quite certain that there are probably better packages that are more worth your time. I assume that ITK would be the place to go for this kind of thing.

@thewtex: If I may embarrassingly not rtfd for just a moment ... can you point me/us to the function(s) in ITK that we should read about here? The goal is to estimate the affine matrix that maps one 3D image of a calibration image set of fluorescent beads/point sources to another (so that it can then be applied to experimental data collected later). This package used coherent point drift (which seemed to work better than more general image/feature correlation for that type of data), but what would you recommend these days in the python world, and does ITK have a good routine for this?

joaomamede commented 3 years ago

The good thing about your FigReg, is that it's gpu speed btw! (My files are ...sometimes 1.5TB). I'll look into ITK. Examples: https://github.com/InsightSoftwareConsortium/ITKElastix https://discourse.itk.org/t/python-itk-gpu/2707

tlambert03 commented 3 years ago

ah, true! well mostly it's just the actual affine transform that's gpu-accelerated (not the calculation of the transform). and just so that you're aware, the "best" parts of LLSpy (namely, the decon and affine transforms) have been extracted to pycudadecon, which recently got a lot easier to install since the underlying cuda code is now on conda-forge. So check out https://github.com/tlambert03/pycudadecon and the affine module if you're looking for that part ... (and of course, there's cupy's affine transforms as well)

joaomamede commented 3 years ago

I used pycudadecon before. pretty good. I actually have an issue with it I should report.

Thanks for all your coding Talley.

thewtex commented 3 years ago

Hi @tlambert03 @joaomamede ! Yes, the itk-elastix package could be helpful in computing the affine registration.

There are a number of notebooks that demonstrate how to get started fairly quickly.

The transform parameters could be used with pycudadecon or cupy affine_transform, but I do not think we have an example for those. But we should add one :-).

joaomamede commented 3 years ago

Is it a direct usage with scipy/cupy affine_transform? As in the 'matrix' argument in cupy?