Skip to content

Commit

Permalink
Merge pull request #308 from BiAPoL/fix_color_future_warning
Browse files Browse the repository at this point in the history
Fix color future warning
  • Loading branch information
jo-mueller authored Aug 13, 2024
2 parents ba6a572 + 7cdf261 commit 44a6587
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions napari_clusters_plotter/_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import pandas as pd
from matplotlib.figure import Figure
from napari.layers import Image, Labels, Layer, Points, Surface
from napari.utils import DirectLabelColormap
from napari.utils.colormaps import ALL_COLORMAPS
from napari_tools_menu import register_dock_widget
from qtpy import QtWidgets
Expand Down Expand Up @@ -719,7 +720,7 @@ def run(
for prediction in np.unique(self.cluster_ids)
}
# take care of background label
cmap_dict[0] = [0, 0, 0, 0]
cmap_dict[None] = [0, 0, 0, 0]

keep_selection = list(self.viewer.layers.selection)

Expand Down Expand Up @@ -820,7 +821,7 @@ def _update_cluster_image(
layer_in_viewer.colormap = self.visualized_layer.colormap
layer_in_viewer.contrast_limits = self.visualized_layer.contrast_limits
elif isinstance(self.visualized_layer, Labels):
layer_in_viewer.color = self.visualized_layer.color
layer_in_viewer.colormap = self.visualized_layer.colormap
else:
print("Update failed")

Expand Down Expand Up @@ -856,11 +857,10 @@ def _draw_cluster_image(
cluster_data = generate_cluster_4d_labels(
self.analysed_layer, plot_cluster_name
)

cluster_layer = Layer.create(
cluster_data,
{
"color": cmap_dict,
"colormap": DirectLabelColormap(color_dict=cmap_dict),
"name": "cluster_ids_in_space",
"scale": self.layer_select.value.scale,
},
Expand All @@ -878,7 +878,7 @@ def _draw_cluster_image(
cluster_layer = Layer.create(
cluster_data,
{
"color": cmap_dict,
"colormap": DirectLabelColormap(color_dict=cmap_dict),
"name": "cluster_ids_in_space",
"scale": self.layer_select.value.scale,
},
Expand Down Expand Up @@ -919,7 +919,7 @@ def _draw_cluster_image(
cluster_layer = Layer.create(
cluster_data,
{
"color": cmap_dict,
"colormap": DirectLabelColormap(color_dict=cmap_dict),
"name": "cluster_ids_in_space",
"scale": self.layer_select.value.scale,
},
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ tornado~=6.2
numpy~=1.23.5
docutils~=0.17.1
pandas~=1.5.3
napari~=0.4.17
napari~=0.4.19
matplotlib~=3.7.1
magicgui~=0.7.2
qtpy~=2.3.0
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ install_requires =
hdbscan
qtpy
dask
napari
napari>=0.4.19
magicgui
scikit-image
superqt
Expand Down

0 comments on commit 44a6587

Please sign in to comment.