From be273fa7d17ef82b81af5581cc85ab9694f770ac Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Thu, 1 Aug 2024 16:52:49 +0200 Subject: [PATCH] chore: Disable thumbnail generation in napari layer as it is fragile 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. ## 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. --- package/PartSeg/common_gui/napari_image_view.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/package/PartSeg/common_gui/napari_image_view.py b/package/PartSeg/common_gui/napari_image_view.py index e4f90f8c0..7013dd256 100644 --- a/package/PartSeg/common_gui/napari_image_view.py +++ b/package/PartSeg/common_gui/napari_image_view.py @@ -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: @@ -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],