tomo: respect _rlnTomoVisibleFrames in particle reconstruction#1344
Open
amineuron wants to merge 1 commit into
Open
tomo: respect _rlnTomoVisibleFrames in particle reconstruction#1344amineuron wants to merge 1 commit into
amineuron wants to merge 1 commit into
Conversation
reconstruct_particle determined per-tilt particle visibility from geometry only (Tomogram::determineVisiblity on the projection trajectory). This ignored the explicit visibility mask written by subtomo at extract time (rlnTomoVisibleFrames in particles.star). When Extract runs with --max_dose, the 2D-stacks contain only the dose-filtered frames; ml_optimiser (Refine3D / Class3D) aligns only those frames (exp_model.cpp 'Add only the visible images for this particle' loop); but reconstruct_particle was silently bringing high-dose frames back. The per-particle CTF / dose-weight math then used a different frame set than the data on disk, producing cloud-of-points-looking merged maps despite data_*.mrc (the un-Wiener-divided numerator) looking healthy. Fix: when EMDL_TOMO_VISIBLE_FRAMES is present on particleSet.partTable, intersect the geometric visibility with the explicit mask before extractAt3D_Fourier. Backwards-compatible: behavior unchanged for inputs without the column. Tested on a 4-tomogram 2D-stack project with --max_dose 50: - pre-fix: 39.2 mean visible frames per particle at reconstruction time - post-fix: 16.5 mean visible frames per particle, matching what Extract baked into the 2D stacks and what Refine3D used for alignment.
Author
|
Worth noting: this fix is complementary to (and independent of) @daniel-ji's open #1305, which corrects the geometric-visibility radius from
I have both fixes stacked locally and they apply cleanly without conflict. Happy to rebase on top of #1305 if it's preferred to merge that one first. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
reconstruct_particle.cpp::processTomogramsdetermines per-tilt visibility for each particle purely fromTomogram::determineVisiblity(traj, s/2.0)(geometric center-in-frame test). This silently ignores the explicit per-particle_rlnTomoVisibleFramesmask thatsubtomowrites intoparticles.starwhen--max_dose(or any frame filter) is set at extraction.ml_optimiser(Refine3D / Class3D) already respects the mask — seesrc/exp_model.cpp"Add only the visible images for this particle". So in a--stack2d --max_dosepipeline, Extract and Refine3D use one frame set, but standalonerelion_tomo_reconstruct_particleuses a different (geometric-only) frame set.This patch makes reconstruction match the same authoritative pattern: when
EMDL_TOMO_VISIBLE_FRAMESis present on the particle table, intersect geometric visibility with the explicit mask.Rationale
When
--max_dosefiltered the 2D stacks down to e.g. 16.5 visible frames per particle on average, reconstruction was using ~39.2 frames per particle (all geometrically visible tilts including dose-excluded ones). The per-particle CTF + dose-weight math at reconstruction time therefore used a different frame set than:*_stack2d.mrcsdata on diskThe symptom in 2D-stack mode is a "cloud-of-points" looking
merged.mrcwhiledata_*.mrc(the un-Wiener-divided numerator) still looks healthy. This is hard to attribute to anything in the user-facing inputs.Compatibility
_rlnTomoVisibleFrames. Thehas_explicit_visible_framescheck only engages the new path when the column is present.ParticleSet::getVisibleFrameshelper thatexp_model.cppalready calls.Tests
git diff --checkver5.1(verified locally as part of the same fix in an unaffiliated fork; same one-file patch).--max_dose 50): post-fix<isVisible>per particle drops from 39.2 to 16.5, matching the_rlnTomoVisibleFramesmask that Extract wrote.🤖 Generated with Claude Code