From 56a03f92d04a14da900d745dcbe29b0ad42bf789 Mon Sep 17 00:00:00 2001 From: Markus Kaukonen Date: Mon, 2 Dec 2024 12:25:24 +0200 Subject: [PATCH 1/3] colormap for labels, tests ok fo python3.12 --- setup.cfg | 2 ++ src/napari_segment_anything/_widget.py | 9 +++++++-- tox.ini | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/setup.cfg b/setup.cfg index fc4e7b7..ec56abf 100644 --- a/setup.cfg +++ b/setup.cfg @@ -21,6 +21,8 @@ classifiers = Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 + Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Scientific/Engineering :: Image Processing project_urls = Bug Tracker = https://github.com/jookuma/napari-segment-anything/issues diff --git a/src/napari_segment_anything/_widget.py b/src/napari_segment_anything/_widget.py index 39bb379..69871f0 100644 --- a/src/napari_segment_anything/_widget.py +++ b/src/napari_segment_anything/_widget.py @@ -6,6 +6,7 @@ from magicgui.widgets import ComboBox, Container, PushButton, create_widget from napari.layers import Image, Points, Shapes from napari.layers.shapes._shapes_constants import Mode +from napari.utils import DirectLabelColormap from qtpy.QtCore import Qt from segment_anything import SamPredictor, sam_model_registry from segment_anything.automatic_mask_generator import SamAutomaticMaskGenerator @@ -67,12 +68,16 @@ def __init__(self, viewer: napari.Viewer, model_type: str = "default"): data=np.zeros((256, 256), dtype=int), name="SAM labels", ) - + # mok begin + mask_colormap = DirectLabelColormap() + mask_colormap.color_dict = {1: "cyan"} self._mask_layer = self._viewer.add_labels( data=np.zeros((256, 256), dtype=int), name="SAM mask", - color={1: "cyan"}, + colormap=mask_colormap, ) + # mok end + self._mask_layer.colormap = mask_colormap self._mask_layer.contour = 2 self._pts_layer = self._viewer.add_points(name="SAM points") diff --git a/tox.ini b/tox.ini index cb46906..b387ee5 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ # For more information about tox, see https://tox.readthedocs.io/en/latest/ [tox] -envlist = py{38,39,310}-{linux,macos,windows} +envlist = py{38,39,310,311,312}-{linux,macos,windows} isolated_build=true [gh-actions] @@ -8,6 +8,8 @@ python = 3.8: py38 3.9: py39 3.10: py310 + 3.11: py311 + 3.12: py312 [gh-actions:env] PLATFORM = From c4012209998f51fb0d72363b0aef5aaa09dae4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jord=C3=A3o=20Bragantini?= Date: Mon, 2 Dec 2024 06:04:42 -0800 Subject: [PATCH 2/3] removing python 3.8 and 3.9 and adding napari version --- .github/workflows/test_and_deploy.yml | 6 +++--- setup.cfg | 6 ++---- tox.ini | 4 +--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index ef6ca2a..87b874e 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -23,12 +23,12 @@ jobs: strategy: matrix: platform: [ubuntu-latest] - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.10', '3.11', '3.12'] include: - platform: windows-latest - python-version: '3.10' + python-version: '3.12' - platform: macos-latest - python-version: '3.10' + python-version: '3.12' steps: - uses: actions/checkout@v3 diff --git a/setup.cfg b/setup.cfg index ec56abf..f280a5b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,8 +18,6 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 @@ -39,9 +37,9 @@ install_requires = segment-anything qtpy magicgui - napari + napari>=0.5.0 -python_requires = >=3.8 +python_requires = >=3.10 include_package_data = True package_dir = =src diff --git a/tox.ini b/tox.ini index b387ee5..b389f7c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,10 @@ # For more information about tox, see https://tox.readthedocs.io/en/latest/ [tox] -envlist = py{38,39,310,311,312}-{linux,macos,windows} +envlist = py{310,311,312}-{linux,macos,windows} isolated_build=true [gh-actions] python = - 3.8: py38 - 3.9: py39 3.10: py310 3.11: py311 3.12: py312 From cce2f9a232779f11db69e069361312ec99b8f54a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jord=C3=A3o=20Bragantini?= Date: Mon, 2 Dec 2024 06:05:40 -0800 Subject: [PATCH 3/3] remove apple silicon from CI --- .github/workflows/test_and_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index 87b874e..f622c83 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -27,7 +27,7 @@ jobs: include: - platform: windows-latest python-version: '3.12' - - platform: macos-latest + - platform: macos-13 python-version: '3.12' steps: