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

Fix color future warning #308

Merged
merged 10 commits into from
Aug 13, 2024
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 @@
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 @@
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

Check warning on line 824 in napari_clusters_plotter/_plotter.py

View check run for this annotation

Codecov / codecov/patch

napari_clusters_plotter/_plotter.py#L824

Added line #L824 was not covered by tests
else:
print("Update failed")

Expand Down Expand Up @@ -856,11 +857,10 @@
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 @@
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 @@
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
Loading