[MSD-359][feature] Renumber FM fiducials in multipoint window#3378
[MSD-359][feature] Renumber FM fiducials in multipoint window#3378K4rishma wants to merge 1 commit intodelmic:masterfrom
Conversation
In multi_point_correlation.py, if there are no FIB fiducials at GUI start, renumber FM fiducials so their indices are contiguous starting from 1. This handles cases where FM fiducials may have gaps (e.g. 1,2,3,6). The function renumber_fm_fiducials_on_start method updates both the `index` and `name` fields of the FM targets in-place and persists the feature file via `update_feature_correlation_target` so the rest of the GUI sees the corrected ordering when it initializes.
tmoerkerken
left a comment
There was a problem hiding this comment.
I'm missing where this introduced method is called
| # If targets are not available for any reason, skip renumbering | ||
| return | ||
|
|
||
| # Check if any FIB fiducials exist; if so, we don't renumber on startup |
There was a problem hiding this comment.
I'm missing why numbering isn't problematic when there are fib fiducials.
| # The fiducials are sorted when saved, so we just need to check if they are 1..N without gaps | ||
| expected_indices = list(range(1, len(fm_fiducials) + 1)) | ||
| current_indices = [t.index.value for t in fm_fiducials] | ||
| if current_indices == expected_indices: |
There was a problem hiding this comment.
if indices are unique, it is enough to just check the first and last element, so we don't have to do a list comparison
| # Renumber sequentially and update names preserving the prefix (if present) | ||
| for new_idx, target in enumerate(fm_fiducials, start=1): | ||
| old_name = target.name.value | ||
| old_name_type = re.search(FIDUCIAL_PATTERN, old_name).group() |
There was a problem hiding this comment.
I think we make our lives a bit hard with this. Why didn't we introduce a name and (computed) display_name (where we prepend prefix and append suffix on a callback) for instance.
There was a problem hiding this comment.
I think this is something for the technical debt board:
https://delmic.atlassian.net/jira/software/projects/SWM/boards/33?selectedIssue=SWM-222
In multi_point_correlation.py, if there are no FIB fiducials at GUI start, renumber FM fiducials so their indices are contiguous starting from 1. This handles cases where FM fiducials may have gaps (e.g. 1,2,3,6). The function renumber_fm_fiducials_on_start method updates both the
indexandnamefields of the FM targets in-place and persists the feature file viaupdate_feature_correlation_targetso the rest of the GUI sees the corrected ordering when it initializes.