flatironinstitute / NoRMCorre

Matlab routines for online non-rigid motion correction of calcium imaging data
GNU General Public License v2.0
142 stars 88 forks source link

Registration of dual channels. #1

Closed ehennestad closed 7 years ago

ehennestad commented 7 years ago

Thanks for a great package! Works great, and quicker than anything else I tried.

Would it be straight forward to apply shifts from one set of images onto another, e.g if we do dual color imaging?

epnev commented 7 years ago

@ehennestad thanks for the feedback! Yes, you can use the function apply_shifts.m for exactly that purpose. It's not very optimized at the moment but it should work fine. Let me know if you have any issues.

ehennestad commented 7 years ago

That should have been obvious:)

It takes about 33% longer to apply shifts to a second stack compared to registering the first stack, but it seems to work well. As far as I can see the stacks are shifted in the same manner.

epnev commented 7 years ago

@ehennestad The time is to be expected. The algorithm applies the shifts in the frequency domain which means that you need to take the fourier and inverse fourier transform for each frame of your data. This is much slower that using some interpolation scheme in space but it retains more structure since it doesn't smooth the data. I'll include the option to apply shifts in a faster way in the future.

That being said, I updated the function to work in parallel (essentially changed the inner for loop into a parfor, plus some other changes that are necessary for registering single frames/volumes).

ehennestad commented 6 years ago

Hi, I was wondering if you have included a way to apply shifts faster for the nonrigid registration? Best regards, Eivind

epnev commented 6 years ago

I haven't looked into that a lot. I'm pretty sure that one of the for loops in apply_shifts can be run in parallel but will need to look. How big is your grid_size?

epnev commented 6 years ago

That seems to be the case. I'm pretty sure I had the shifts being applied in parallel in the past but turned it off to trace some bug. https://github.com/flatironinstitute/NoRMCorre/commit/76d674eadb17667670b189576d9e0f6f5b8fa0cc