Skip to content

fix merge with background error and add debug logging#1449

Open
mrariden wants to merge 1 commit intomainfrom
merge_cells_fix
Open

fix merge with background error and add debug logging#1449
mrariden wants to merge 1 commit intomainfrom
merge_cells_fix

Conversation

@mrariden
Copy link
Copy Markdown
Collaborator

@mrariden mrariden commented May 7, 2026

Previously, it was possible to merge the background (0) with a cell. This PR makes this impossible by skipping when one of the indices matches the background value of 0.

Comment thread cellpose/gui/gui.py
Comment on lines +1308 to +1310
if self.selected == self.prev_selected:
self.logger.debug('Cells are same, skipping merging')
return
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Use a guard claude for readability

Comment thread cellpose/gui/gui.py
Comment on lines +1311 to +1314
if 0 in [self.prev_selected, self.selected]:
self.logger.debug('Skipping attempted merge with background')
return
self.logger.debug(f'Attempting to merge {self.prev_selected} and {self.selected}')
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added logging

Comment thread cellpose/gui/gui.py
self.logger.debug('Skipping attempted merge with background')
return
self.logger.debug(f'Attempting to merge {self.prev_selected} and {self.selected}')
for z in range(self.NZ):
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

identical block but de-indented because of guard clause

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.

1 participant