Skip to content

Commit

Permalink
chore: Disable thumbnail generation in napari layer as it is fragile …
Browse files Browse the repository at this point in the history
…and not used (#1171)

This PR uses a private API, but should not be fragile as change name of
function will only enable again thumbnail generation.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced control over thumbnail management in the image processing
workflow by disabling automatic updates for thumbnails in specific image
layers.
- **Bug Fixes**
- Resolved issues related to unintended thumbnail updates, improving the
overall user experience when working with images.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
Czaki authored Aug 1, 2024
1 parent 488f52d commit be273fa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion package/PartSeg/common_gui/napari_image_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
USE_THREADS = True


class _NapariImage(NapariImage):
def _update_thumbnail(self, *_, **__):
"""Disable thumbnail update"""


def get_highlight_colormap():
cmap_dict = {0: (0, 0, 0, 0), 1: "white", None: (0, 0, 0, 0)}
if _napari_ge_5:
Expand Down Expand Up @@ -1073,7 +1078,7 @@ def _prepare_layers(image: Image, param: ImageParameters, replace: bool) -> Tupl
blending = "additive" if i != 0 else "translucent"
data = image.get_channel(i)

layer = NapariImage(
layer = _NapariImage(
data,
colormap=param.colormaps[i],
visible=param.visibility[i],
Expand Down

0 comments on commit be273fa

Please sign in to comment.