Login  Register

Re: Feature Request: FFT of image stack

Posted by John Oreopoulos on May 23, 2017; 3:30am
URL: http://imagej.273.s1.nabble.com/Macro-to-measure-particles-and-save-ROI-on-to-original-image-tp5018747p5018776.html

Much thanks as usual!

John Oreopoulos

On May 22, 2017, at 10:45 PM, Wayne Rasband <[hidden email]> wrote:

>> On May 19, 2017, at 5:49 PM, John Oreopoulos <[hidden email]> wrote:
>>
>> Hello,
>>
>> I'd like to make the following ImageJ feature request: Would it be possible to modify the FFT command to prompt the user and ask if it wants to apply the FFT function to each frame in a stack (as opposed to just applying the FFT to the active frame of a stack)? I have a series of time-lapse imaging data where I'd like to analyze the FFT of each frame in the stack and do some filtering there, and subsequently inverse FFT the stack back to the image domain. Hoping Wayne can work his magic!
>
> Upgrade to the latest daily build (1.51o20) and you can use simple macros to do FFTs and Inverse FFTs on the images in a stack. I included two macros. The first runs the “FFT” command on the images in the T1 Head sample stack, saving the output in a virtual stack. The second runs the “Inverse FFT” command on the virtual stack. You will need to modify the second line of the first macro so that ‘dir’ points to an empty folder.
>
> -wayne
>
>  macro "Stack FFT" {
>     requires("1.51o");
>     dir = "/Users/wayne/Downloads/FFT_Stack/";
>     setBatchMode(true);
>     run("T1 Head (2.4M, 16-bits)");
>     for (i=1; i<=nSlices; i++) {
>        setSlice(i);
>        run("FFT");
>        saveAs("TIFF", dir+"FFT of "+IJ.pad(i,4));
>        close;
>     }
>     run("Image Sequence...", "open=&dir sort use");
>     setBatchMode(false);
>  }
>
> macro "Stack Inverse FFT" {
>     stack = getImageID;
>     setBatchMode(true);
>     setSlice(2);
>     n = nSlices;
>     for (i=1; i<=n; i++) {
>        selectImage(stack);
>        setSlice(i);
>        run("Inverse FFT");
>      }
>     run("Images to Stack", "title=[Inverse FFT] use");
>     setBatchMode(false);
>  }
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html