-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFFT_for_Stack.s
38 lines (33 loc) · 957 Bytes
/
FFT_for_Stack.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// FFT for Stack
// This script generates the FFT complex images for each frame in a stack as a new stack
// Jingshan S. Du | [email protected]
// Based on various codes and examples by D. R. G. Mitchell (dmscripting.com) and Gatan examples
// Check to make sure an image is shown
number nodocs
nodocs=countdocumentwindowsoftype(5)
if(nodocs==0)
{
showalert("There are no images displayed!",0)
exit(0)
}
// Get the foremost image and some data from it
number xsize, ysize, zsize
image stackimg:=getfrontimage()
try
{
get3dsize(stackimg, xsize, ysize, zsize)
}
catch
{
showalert("The front-most image is not a stack.",2)
exit(0)
}
// Create the FFT complex stack
image stackfft := compleximage("FFT Stack", 8, xsize, ysize, zsize)
// Carry out the forward FFT
for (number z = 0; z < zsize; z++)
{
image img := stackimg.slice2(0,0,z, 0,xsize,1, 1,ysize,1)
stackfft.slice2(0,0,z, 0,xsize,1, 1,ysize,1) = RealFFT(img)
}
stackfft.showimage()