Skip to content
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

fix: Fix selection of custom label colors for napari 0.5.0 #1138

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions package/PartSeg/common_gui/napari_image_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@
return res

def set_roi_colormap(self, image_info) -> None:
if _napari_ge_5:
image_info.roi.colormap = self.get_roi_view_parameters(image_info)
return

Check warning on line 487 in package/PartSeg/common_gui/napari_image_view.py

View check run for this annotation

Codecov / codecov/patch

package/PartSeg/common_gui/napari_image_view.py#L486-L487

Added lines #L486 - L487 were not covered by tests
if _napari_ge_4_13:
image_info.roi.color = self.get_roi_view_parameters(image_info)
return
Expand Down Expand Up @@ -583,7 +586,10 @@
else:
image_info.mask.data = mask_marker
image_info.mask.metadata["valid"] = True
image_info.mask.color = self.mask_color()
if _napari_ge_5:
image_info.mask.colormap = self.mask_color()

Check warning on line 590 in package/PartSeg/common_gui/napari_image_view.py

View check run for this annotation

Codecov / codecov/patch

package/PartSeg/common_gui/napari_image_view.py#L590

Added line #L590 was not covered by tests
else:
image_info.mask.color = self.mask_color()
image_info.mask.opacity = self.mask_opacity()
image_info.mask.visible = self.mask_chk.isChecked()
self._toggle_mask_chk_visibility()
Expand All @@ -602,7 +608,10 @@
for image_info in self.image_info.values():
if image_info.mask is not None:
image_info.mask.opacity = opacity
image_info.mask.color = colormap
if _napari_ge_5:
image_info.mask.colormap = colormap

Check warning on line 612 in package/PartSeg/common_gui/napari_image_view.py

View check run for this annotation

Codecov / codecov/patch

package/PartSeg/common_gui/napari_image_view.py#L612

Added line #L612 was not covered by tests
else:
image_info.mask.color = colormap

def set_image(self, image: Optional[Image] = None):
self.image_info = {}
Expand Down