Skip to content

[MSD-359][feature] Renumber FM fiducials in multipoint window#3378

Open
K4rishma wants to merge 1 commit intodelmic:masterfrom
K4rishma:improve_fiducial_numbering
Open

[MSD-359][feature] Renumber FM fiducials in multipoint window#3378
K4rishma wants to merge 1 commit intodelmic:masterfrom
K4rishma:improve_fiducial_numbering

Conversation

@K4rishma
Copy link
Contributor

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.

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.
Copy link
Contributor

@tmoerkerken tmoerkerken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@tmoerkerken tmoerkerken Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is something for the technical debt board:
https://delmic.atlassian.net/jira/software/projects/SWM/boards/33?selectedIssue=SWM-222

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants