Re: using eman2 to mask layer lines in Fourier space

75 views
Skip to first unread message

Steven Ludtke

unread,
Oct 23, 2013, 6:18:05 PM10/23/13
to Rui Zhang, em...@googlegroups.com
Hi Rui. EMAN2 uses FFTW convention (which is the same for pretty much all other FFT libraries out there). If you just say
fft=image.do_fft()

then the phase origin in real-space is at (0,0), the corner of the image, not the center. In Fourier space, the Fourier origin (0 in x and y) is also at (0,0). 

In most cases the phase-origin is more intuitive if it's at the center of the image. This can be accomplished with:

image.process_inplace("xform.phaseorigin.tocorner")
fft=image.do_fft()

The complex origin will still be at the origin of the image, however. There are two solutions to this issue. From Python, if you access the complex pixel values as:

fft[x,y]
or
fft[x,y]=newcomplex

it will properly handle all periodic boundary conditions, and x and y can range from -box_size/2 to +box_size/2. That is

fft[0,0] will be at the Fourier origin.
fft[4,0] will be 4 complex pixels away from the origin in the x direction

To convert these pixel locations in the FFT to 1/Å,  ds=1.0/(Apix*box_size)

for example location fft[0,4] is 4 pixels from the origin. with a box size of 100 and 2.0 A/pix, this would 
correspond to 1/50 1/Å. 

----------------------------------------------------------------------------
Steven Ludtke, Ph.D.
Professor, Dept of Biochemistry and Mol. Biol.         (www.bcm.edu/biochem)
Co-Director National Center For Macromolecular Imaging        (ncmi.bcm.edu)
Co-Director CIBR Center                          (www.bcm.edu/research/cibr)
Baylor College of Medicine                             





On Oct 23, 2013, at 3:30 PM, Rui Zhang <ru...@lbl.gov> wrote:

Hi, Steve,

I am trying to write a python script to mask out a certain layer line (say 40 Angstrom) for a microtubule image in Fourier space, but I am not sure I understand how FT is stored/displayed in EMAN2. The fourier origin and mirror things are confusing to me.

Can you or someone help me out?

Basically I want to do:

a = EMData('MT.hed',0)
f = a.do_fft()
# to set some pixels in Fourier space to zero
b = f.do_ift()

Thank you!

Rui

Rui Zhang

unread,
Oct 23, 2013, 7:20:35 PM10/23/13
to em...@googlegroups.com, Rui Zhang
Hi, Steve,

Thanks for the explanation!
Now my python script works, although I found for fft[x,y], the x and y cannot be negative.

here is my script, please let me know if I did something wrong.

a = EMData('helical.hed',0)

# I found I can skip this step because I am just going to set the complex pixel to zero
#a.process_inplace("xform.phaseorigin.tocorner")

fft = a.do_fft()

nx = fft.get_xsize()
ny = fft.get_ysize()

for x in range(0,nx):
fft[x,16] = 0
fft[x,17] = 0
fft[x,ny-1-16] = 0
fft[x,ny-1-17] = 0

#display(fft)

b = fft.do_ift()

display(b)

Steven Ludtke

unread,
Oct 23, 2013, 8:57:11 PM10/23/13
to em...@googlegroups.com
Hmm, I thought the direct coordinate access would handle the wraparound. You can use the explicit function call instead:

In [3]: a=test_image()

In [4]: b=a.do_fft()

In [5]: b.get_complex_at(-2,-2)
Out[5]: (1489.08056640625-144.55996704101562j)

In [6]: b.get_complex_at(2,2)
Out[6]: (1489.08056640625+144.55996704101562j)
-- 
-- 
----------------------------------------------------------------------------------------------
You received this message because you are subscribed to the Google
Groups "EMAN2" group.
To post to this group, send email to em...@googlegroups.com
To unsubscribe from this group, send email to eman2+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/eman2
 
--- 
You received this message because you are subscribed to the Google Groups "EMAN2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eman2+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages