Skip to content

bugfix: 3d radial averaging#1298

Merged
biochem-fan merged 1 commit into3dem:ver5.0from
daniel-ji:master
Sep 17, 2025
Merged

bugfix: 3d radial averaging#1298
biochem-fan merged 1 commit into3dem:ver5.0from
daniel-ji:master

Conversation

@daniel-ji
Copy link
Contributor

@daniel-ji daniel-ji commented Sep 16, 2025

When doing 3D radial averaging, the average should be generated from from the entire 3d volume, not just repeatedly using the z = 0 plane of the image (indexed 0...img.zdim). By only pulling from the z=0 plane while calculating the radius using the actual z coordinate of the voxel, this would result in an incorrect 3d radial average.

This radial averaging function (RadialAvg::fftwHalf_3D_lin in src/jaz/image/radial_avg.h) seems to only be used during particle reconstruction (both in STA and SPA) and also during 3D subtomogram extraction. It is called by the Reconstruction::ctfCorrect3D_heuristic function, to generate a radial average of the rings of the 3D CTF, and use the average to prevent any CTF values that are too low (0.001x lower than the average) respective to this average from being used for CTF correction (see: https://github.com/3dem/relion/blob/master/src/jaz/tomography/reconstruction.h#L527-L541)

Testing with real data during subtomogram particle reconstruction (this isn't very comprehensive), it seems like there is no significant difference between the output without the fix and with the fix, since this radial average is just used to prevent CTF values along that radius from being too low (here in the Reconstruction::ctfCorrect3D_heuristic function) but many (if not all) of the values along the radius are not less than 0.001x the average weight. In the case with synthetic data (generated using PolNet) run through a reconstruction without orientations (that holds no biological relevance) a discrepancy can be observed, but I'm not sure this is worth regarding. Nevertheless, for the sake of correctness, I thought this was worth mentioning. Thank you!

@biochem-fan
Copy link
Member

Thank you very much for pointing this out.
I think you are right, but because I do not work on STA, could @scheres confirm?

seems to only be used during particle reconstruction (both in STA and SPA)

Because the code is under jaz/tomograph, I don't think this is used in SPA.

@biochem-fan biochem-fan changed the base branch from master to ver5.0 September 16, 2025 23:38
@daniel-ji
Copy link
Contributor Author

daniel-ji commented Sep 16, 2025

Reconstruction::ctfCorrect3D_heuristic which calls RadialAvg::fftwHalf_3D_lin is also called in SpaBackproject::reconstructNew, which seems to be a standalone script?

https://github.com/3dem/relion/blob/master/src/jaz/single_particle/programs/spa_backproject.cpp#L1160-L1164

Although I do not know if this is a commonly used tool in the SPA workflow (not built as part of the relion build/bin folder).

Apologies for setting the wrong base branch to merge into in this PR, thank you for fixing that.

@biochem-fan
Copy link
Member

Reconstruction::ctfCorrect3D_heuristic which calls RadialAvg::fftwHalf_3D_lin is also called in SpaBackproject::reconstructNew, which seems to be a standalone script?
Although I do not know if this is a commonly used tool in the SPA workflow (not built as part of the relion build/bin folder).

OK. This is an experimental program not intended for general use.

@biochem-fan
Copy link
Member

@daniel-ji
@scheres approved your fix in an email to me. So I am merging this.
This will be included in the next minor release, 5.0.1.

Thank you very much for your contribution.

@biochem-fan biochem-fan merged commit c2d0aba into 3dem:ver5.0 Sep 17, 2025
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants