alihaydaroglu / suite3d

Fast, accurate, volumetric cell detection. Developed for Light Beads Microscopy, usable for other volumetric 2P. In development
6 stars 0 forks source link

Features for better lateral offset estimation #42

Closed oterocoronel closed 4 months ago

oterocoronel commented 1 year ago

When some planes have very little signal, the lateral shift estimation across planes is usually off. This is an issue with the data, not suite3d, but I think it could be handled better if one could:

1) Crop the recording before doing any motion correction (e.g. after job.run_init_pass). If the signal is too low for calculating the lateral offset in the mean images, then you probably won't get many neurons from there and could avoid creating a volume that you know has the wrong offsets for alignments

2) Make the x-y offset values accessible to the user to do some kind of basic adjustment. I've seen that the x-y offsets for planes 15-22 are reliable, but for planes 22-30 are sometimes off, I would be curious if I just use a linear interpolation from 15-22 extended to planes 22-30 if I can get anything from there

I thought about this when I noticed that in one recording the lateral-shift estimation was ~300pix for X and Y in a bad plane, thus creating a massively large recording (went from 500x500pix to 800x800pix, which is 2.5x larger and mostly empty with nans) and the only thing I could do was crop it after doing motion correction through all the data

Somewhat related:

3) Could we do lateral offset estimation after doing motion correction? This could help increase the SNR of the mean frames that are used for the shift estimations and give better results.

alihaydaroglu commented 1 year ago

Good suggestions. Because of the way the init_pass is structured right now, some are a little difficult to implement. I need to re-write init_pass on the GPU sometime soon, so I will keep these suggestions in mind.

In the meantime, a few hotfixes:

You can pull the dev branch now to get these updates, or you can wait till I have time to test all my recent changes and I'll merge to main.

alihaydaroglu commented 1 year ago

relevant commit: https://github.com/alihaydaroglu/s2p-lbm/commit/aa24e9dfdc3e6ec036fdc2d29ae79f417221dbcc

alihaydaroglu commented 4 months ago

this has been improved in the new initial pass