Masking out the missing wedge in fourier space

13 views
Skip to first unread message

Molly Gravett

unread,
Jul 22, 2025, 12:04:27 PMJul 22
to EMAN2
Hello,

I would like to mask out the missing wedge in fourier space for individual subtomograms. Please could you advise on the best way to do this? I have tried mask.wedgefiller, and then to write out the fft of the z-projection to check but I keep getting:    

wedge = subtomo.process("mask.wedgefill", {'maxtilt': 54})
RuntimeError: std::exception

Example code:

            subtomo=EMData(image) # read subtomogram
            z_proj = subtomo.process('misc.directional_sum',{'axis':'z'}) #zproject for easy comparison
            fft = z_proj.do_fft() #fft for unmasked comparison
            fft_shifted = fft.process("xform.fourierorigin.tocenter") #shift to center
            amps=fft_shifted.get_fft_amplitude() #makes visualisation easier
            ab_values=amps.process("math.absvalue")
            ab_values.write_image(f"fft/fft_{MT}_{ptcl}.mrc") #write unmasked fft to file
            wedge = subtomo.process("mask.wedgefill", {'maxtilt': 54}) #fill wedge of tomogram (54 to -54)
            z_proj2 = wedge.process('misc.directional_sum',{'axis':'z'}) #z project masked for easy comparison
            masked_fft = z_proj2.do_fft() #fft of masked for comparison
            masked_fft_shifted = masked_fft.process("xform.fourierorigin.tocenter") #shift to center
            masked_amps=masked_fft_shifted.get_fft_amplitude() #makes visualisation easier
            masked_ab_values=masked_amps.process("math.absvalue")
            masked_ab_values.write_image(f"fft/fft_masked_{MT}_{ptcl}.mrc") #write masked fft to file


Thanks!
Molly


Muyuan Chen

unread,
Jul 22, 2025, 12:55:51 PMJul 22
to em...@googlegroups.com
My suggestion is to make projections and reconstruct. You can do this through some commands, but may be easier with python code. 

// Make projections from 0-180 degrees at alt=90
e2project3d.py emd_4415.hdf --outfile=projections.hdf --orientgen=eman:delta=3:alt_max=90:alt_min=90 --projector=standard

// Take 30-150 degrees images
e2proc2d.py projections.hdf projections_center.hdf --first 10 --last 50

// Reconstruct volume
e2spa_make3d.py --input projections_center.hdf --output projections_recon.hdf

// Rotate it so the missing wedge points toward z. 
e2proc3d.py projections_recon.hdf projections_recon_rot.hdf --rot 90,90,0

--
--
----------------------------------------------------------------------------------------------
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.
To view this discussion visit https://groups.google.com/d/msgid/eman2/baa97ef3-5f68-44d9-9247-a41b16f92e37n%40googlegroups.com.

Tanvir Shaikh

unread,
Jul 24, 2025, 10:01:29 PMJul 24
to em...@googlegroups.com
I'm curious if there's an easy answer, but I had done something like this in SPIDER.  The trick was to "lie" to SPIDER, and say that a Fourier file was a real-space file, and then you could manipulate it at your leisure.

Since in EMAN2, the volume can be treated as a NumPy array, you can manipulate it that way.  I haven't looked at a Fourier file in NumPy though, so there are a lot of conventions to potentially get wrong.

-Tapu Shaikh


Steve Ludtke

unread,
Jul 24, 2025, 10:05:58 PMJul 24
to em...@googlegroups.com
Not sure why Google thought this was spam... Anyway... At the Python level this is easy enough to do with EMData.set_complex(0) or similar, but to manipulate it you have to understand how the complex data is organized. Alternatively, you could use the versions of set_complex_at which allows you to specify coordinates in Fourier space relative to the complex origin. There are quite a lot of different ways to do this. 

Reply all
Reply to author
Forward
0 new messages