feat: propagate align-by-correlation across a range#98
Open
dustenhubbard wants to merge 2 commits into
Open
Conversation
Route align-by-correlation through changeTform so the resulting shift is recorded when propagation mode is active. A single correlation alignment can then be propagated to the rest of the series like a manual transform, instead of only affecting the current section. This also corrects the transform composition order. The correlation shift is measured in field space and must be applied after the section's own transform (tform * shift_tform), not before. The previous order applied the shift in section-local space, so the result was wrong whenever the section transform was not the identity.
propagateTo told the user "Locked sections will not be modified" but then set and saved the tform on every section in range, silently overwriting locked alignments. Locked sections are now excluded from the modify loop (matching changeTform's align_locked early return), so their transforms and on-disk files are left untouched. The propagation loop also only logged the change; it now records a series-wide undo state plus per-section states (the same SeriesStates pattern SeriesIterator uses), so a series undo restores the prior transforms of every section the propagation modified. Includes a regression test confirming the corrAlign composition order (tform * shift_tform, field-space shift after the existing transform) against a rotated/scaled transform where the reversed composition visibly differs.
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
Align by correlation(Ctrl+\) aligns the current section to the previously viewed one, but the shift it computes cannot be reapplied across a range, so aligning a stack means repeating the correlation section by section. This lets the correlation alignment record its computed shift and propagate it across a chosen range of sections, the same way a manual transform can be propagated.Approach
corrAlignnow routes its computed FFT shift through the existing propagation-recording path (setPropagationMode/stored_tform/propagateTo, viachangeTform) instead of applying it only to the current section.Correctness fixes included
corrAligncomposes the shift astform * shift_tform(the field-space shift applied after the existing transform), notshift_tform * tform. Pure translations commute, so this was invisible for translation-only sections but produced wrong alignment for sections with rotation or scale.propagateTonow skips align-locked sections (honoring its own confirmation dialog, which states locked sections will not be modified) and records undo state for the sections it does modify. Both are pre-existing behaviors inpropagateTo.tests/test_corr_align_propagate.py,tests/test_propagate_locked_undo.py.Closes #95