-
Notifications
You must be signed in to change notification settings - Fork 10
feat: Use QScrollArea for components selection
#1328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
40195b5
b38a524
8085ac3
5d68c2e
4c1a8c3
6fb5071
6744bd9
a107e42
6278963
01dccd9
81e0f0b
6b3bc30
590b71e
aaf4ad1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,6 +145,7 @@ def roi(self, val: Union[np.ndarray, ROIInfo]): | |
| if val is None: | ||
| self._roi_info = ROIInfo(val) | ||
| self._additional_layers = {} | ||
| self.post_roi_set() | ||
| self.roi_clean.emit() | ||
| return | ||
| try: | ||
|
|
@@ -155,8 +156,12 @@ def roi(self, val: Union[np.ndarray, ROIInfo]): | |
| except ValueError as e: | ||
| raise ValueError(ROI_NOT_FIT) from e | ||
| self._additional_layers = {} | ||
| self.post_roi_set() | ||
| self.roi_changed.emit(self._roi_info) | ||
|
|
||
| def post_roi_set(self) -> None: | ||
| """called after roi is set, for subclasses to override""" | ||
|
|
||
|
Comment on lines
+159
to
+164
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make Right now this hook only fires in the non- Proposed fix def roi(self, val: Union[np.ndarray, ROIInfo]):
if val is None:
self._roi_info = ROIInfo(val)
self._additional_layers = {}
+ self.post_roi_set()
self.roi_clean.emit()
return
try:
if isinstance(val, np.ndarray):
self._roi_info = ROIInfo(self.image.fit_array_to_image(val))
@@
if result.points is not None:
self.points = result.points
self._roi_info = roi_info
+ self.post_roi_set()
self.roi_changed.emit(self._roi_info)🤖 Prompt for AI Agents |
||
| @property | ||
| def sizes(self): | ||
| return self._roi_info.sizes | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Batch
set_chosen()updates into a single refresh.Each
setChecked()here can emitstateChanged, which reachescheck_change_signalandimage_view.refresh_selected()via Line 544. SinceStackSettingsnow callsset_chosen()after ROI loads at Line 174 and Line 306 inpackage/PartSeg/_roi_mask/stack_settings.py, loading a segmentation with many selected components will refresh the view once per component.Proposed fix
def set_chosen(self, chosen_components: Sequence[int]): chosen_components = set(chosen_components) - for num, check in self.check_box.items(): - check.setChecked(num in chosen_components) + self.blockSignals(True) + try: + for num, check in self.check_box.items(): + check.setChecked(num in chosen_components) + finally: + self.blockSignals(False) + self.check_change_signal.emit()📝 Committable suggestion
🤖 Prompt for AI Agents