[ImageJ-devel] Differences between .fft.FourierTransform and .fft2.FFT

Curtis Rueden ctrueden at wisc.edu
Tue Jan 13 16:08:31 CST 2015


Hi Michael,

Brian Northan wrote:
> If you manage to get the tutorial working with the new FFT I think
> that would be a great addition to the tutorial.

Agreed. If you manage to get tutorial 6C working with the updated FFT API,
a Pull Request would be very helpful!

https://github.com/imglib/imglib2-tutorials
https://help.github.com/articles/using-pull-requests/

Thanks,
Curtis

On Wed, Dec 17, 2014 at 8:42 AM, Brian Northan <bnorthan at gmail.com> wrote:

> Hi Micheal
>
> I am not entirely familiar with 'FourierTransform' because I've been using
> the newer FFT.java class but I think the differences you are seeing are
> because 'FourierTransform' has different preprocessing and extension
> related settings.
>
> If you look at FourierTransform.java you can see that the constructor you
> used in turn calls another constructor
>
>
> https://github.com/imglib/imglib2-algorithm-gpl/blob/master/src/main/java/net/imglib2/algorithm/fft/FourierTransform.java
>
> It looks like the 'preprocessing' option defaults to
> "relativeExtensionFade' and 'relativeImageExtension' is set to 0.25.
>
> In contrast FFT.java only extends to the nearest 'fast' FFT size and uses
> a constant padding strategy.
>
> Keep us up to date on how things are going.  If you manage to get the
> tutorial working with the new FFT I think that would be a great addition to
> the tutorial.
>
> Brian
>
>
>
> On Wed, Dec 17, 2014 at 3:54 AM, Michael Ellis <michael.ellis at dsuk.biz>
> wrote:
>>
>> I am trying to reproduce example
>>
>> imglib2-tutorials Example6c
>>
>>
>> https://github.com/imglib/imglib2-tutorials/blob/master/src/main/java/Example6c.java
>>
>> using the new net.imglib2.algorithm.fft2.FFT rather than the old
>> deprecated net.imglib2.algorithm.fft.FourierTransform
>>
>> The original example code does:
>>
>>         // compute fourier transform of the template
>>         final FourierTransform< FloatType, ComplexFloatType> fft
>>                 = new FourierTransform< FloatType, ComplexFloatType>(
>>                         template, new ComplexFloatType());
>>         fft.process();
>>         Img< ComplexFloatType> templateFFT = fft.getResult();
>>
>> Which produces an image of size templateFFT minX=0 minY=0 maxX=40 maxY=79
>>
>> My new code looks like this:
>>
>>             ImgFactory<ComplexFloatType> fftImgFactory = null;
>>             try {
>>                 fftImgFactory = template.factory().imgFactory(new
>> ComplexFloatType());
>>             } catch (IncompatibleTypeException ex) {
>>                 fftImgFactory = null;
>>             }
>>
>>             // compute fourier transform of the template
>>             Img< ComplexFloatType> templateFFT2 =
>> FFT.realToComplex(template, fftImgFactory);
>>
>> Which produces an image of size templateFFT2 minX=0 minY=0 maxX=36 maxY=71
>>
>> Also it looks like the image produced by the old FourierTransform and new
>> FFT differ in that the results are shifted in X and Y.
>>
>> Can anyone help?
>>
>> In particular I want to achieve the image alignment functionality that is
>> done in Example6c.java without using deprecated code.
>>
>> Many thanks — Michael Ellis
>>
>>
>>
>>
>> _______________________________________________
>> ImageJ-devel mailing list
>> ImageJ-devel at imagej.net
>> http://imagej.net/mailman/listinfo/imagej-devel
>>
>
> _______________________________________________
> ImageJ-devel mailing list
> ImageJ-devel at imagej.net
> http://imagej.net/mailman/listinfo/imagej-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://imagej.net/pipermail/imagej-devel/attachments/20150113/5ef5d095/attachment-0001.html>


More information about the ImageJ-devel mailing list