Skip to content

Commit

Permalink
direct construct colormap
Browse files Browse the repository at this point in the history
  • Loading branch information
Czaki committed Jul 2, 2024
1 parent 427c405 commit a7fa090
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package/PartSeg/common_gui/napari_image_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from napari.layers.labels import Labels
from napari.qt import QtViewer
from napari.qt.threading import thread_worker
from napari.utils.colormaps.colormap import ColormapInterpolationMode
from napari.utils.colormaps.colormap import ColormapInterpolationMode, DirectLabelColormap
from packaging.version import parse as parse_version
from qtpy.QtCore import QEvent, QPoint, Qt, QTimer, Signal, Slot
from qtpy.QtWidgets import QApplication, QCheckBox, QHBoxLayout, QLabel, QMenu, QSpinBox, QToolTip, QVBoxLayout, QWidget
Expand Down Expand Up @@ -839,7 +839,7 @@ def _mark_layer(self, num: int, flash: bool, image_info: ImageInfo):
component_mark,
scale=image_info.roi.scale,
blending="translucent",
colormap={0: (0, 0, 0, 0), 1: "white", None: (0, 0, 0, 0)},
colormap=DirectLabelColormap(color_dict={0: (0, 0, 0, 0), 1: "white", None: (0, 0, 0, 0)}),
opacity=0.7,
)
self.viewer.layers.selection.active = active_layer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from magicgui.widgets import Container, HBox, PushButton, SpinBox, create_widget
from napari import Viewer
from napari.layers import Labels
from napari.utils import DirectLabelColormap
from napari.utils.notifications import show_info
from qtpy.QtCore import QTimer
from vispy.geometry import Rect
Expand Down Expand Up @@ -77,7 +78,7 @@ def _highlight(self):
name=HIGHLIGHT_LABEL_NAME,
scale=labels.scale,
blending="translucent",
color={0: (0, 0, 0, 0), 1: "white"},
colormap=DirectLabelColormap(color_dict={0: (0, 0, 0, 0), 1: "white", None: (0, 0, 0, 0)}),
opacity=0.7,
)

Expand Down

0 comments on commit a7fa090

Please sign in to comment.