flatironinstitute / NoRMCorre

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

Minor fix for apply_shifts and demo.m #17

Closed ingiehong closed 6 years ago

ingiehong commented 6 years ago

Hi Eftychios, thanks again for the great work! I find that in apply_shifts, I need an additional line setting up Xq/Yq/Zq when using 'fft'. Another occasional problem I encountered when using NoRMCorre was that with images that have significant numbers of negative value pixels, the fft registration would produce global phase differences of pi or -pi, and in result, invert the images in terms of pixel intensity. A simple fix to this (I haven't fully explored whether this is a bug or an inevitable result of fft-based registration) is to ensure all pixels are non-negative at start. You had commented this out some time ago, I simply reinstated it. Hope this helps. Cheers! -Ingie

epnev commented 6 years ago

Thanks for this. I'm surprised about the negative values. Another option that I used to have inside the motion correction functions was to subtract and then add back the minimum value to ensure that no problems arise. I'll think about putting it back.