Closed bnorthan closed 7 years ago
@imagejan you were correct that my script was not bandpass, it is actually lowpass. I was going to do a bandpass, but then decided to keep it simple.
My main purpose is to illustrate the structure of the FFT (ie, where zero frequency is, the fact that the redundant samples are not stored), and show how to construct a simple frequency filter. Once people understand that they can then make other filters.
Anyway I changed the name of the branch and script to "lowpass"
Thank you for looking into this. I am away from the computer this week and probably the next one too so I won't be able to test anytime soon.
From my side I trust you to merge if you think it's good enough and I will anyway review it in few weeks.
It's good to have this kind of filters here. But I really would like to see it in ops/imglib2.
Where do you think it should lived ? A convenient function implementing your script in imglib2 + a wrapper method in ops ?
@hadim it should be in ops and I can work on getting it into ops, over the next few weeks. It is a slight variation on a convolution filter, and we should make sure that the ops frequency filter design can handle this elegantly.
The ussual case is you have a kernel and image, if small you do naive convolution, if large you perform an FFT on both and multiply in frequency domain.
In this case you only perform an FFT on the image, the filter, in this case is allready in the frequency domain.
I like to have a script first, because it is much quicker prototyping and testing.
Also @hadim are you in Montreal for the foreseeable future?? I was thinking it could be useful to have a "northeast" hackathon at some point in the winter.
I'll review this later today.
For the hackathon that would be great to do that but it seems complicated to me, I am very busy with non-coding stuff to do for my postdoc... I'll keep you in touch about that.
As I said that would be nice to have it in ops whenever you'll have time for that.
That would be nice to add a small test also here.
Beside that LGTM.
@hadim , @imagejan
I think the problem @hadim had when using "bandpass" is that it expected frequency 0,0 to be in the center of the image, however the newer imglib2 FFT (which ops is based on) puts frequency 0,0 at the origin.
Also the redundant information of the real to complex transform is not kept, which means there are only half as many complex pixels in the x direction
I think this script implements lowpass... let me know if I have it right. Also there are probably more elegant ways to implement this using Views, so feel free to make suggestions on improvements.