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

colormap for labels, tests ok fo python3.12 #30

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
- platform: macos-latest
python-version: '3.10'
python-version: '3.12'
- platform: macos-13
python-version: '3.12'

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ 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
Topic :: Scientific/Engineering :: Image Processing
project_urls =
Bug Tracker = https://github.com/jookuma/napari-segment-anything/issues
Expand All @@ -37,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
Expand Down
9 changes: 7 additions & 2 deletions src/napari_segment_anything/_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# For more information about tox, see https://tox.readthedocs.io/en/latest/
[tox]
envlist = py{38,39,310}-{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

[gh-actions:env]
PLATFORM =
Expand Down
Loading