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

Avoid using Labels.color #307

Closed
zoccoler opened this issue Mar 14, 2024 · 4 comments
Closed

Avoid using Labels.color #307

zoccoler opened this issue Mar 14, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@zoccoler
Copy link
Collaborator

With napari 0.4.19, this warnings pops up after manually selecting a cluster

FutureWarning: Labels.color is deprecated since 0.4.19 and will be removed in 0.5.0, please set Labels.colormap directly with an instance of napari.utils.colormaps.DirectLabelColormap instead.!

It may be solved by replacing at least this line, this line and this line with something like:

layer_in_viewer.colormap= self.visualized_layer.colormap

and

"colormap": DirectLabelColormap(color_dict=cmap_dict),

This needs to be tested.

@gboscagli
Copy link

gboscagli commented Aug 5, 2024

Hi all,
I know I'm probably a bit off-topic. I'm encountering the same Warning message using another Napari plugin (Napari-SpatialData). I have napari v.0.4.19.post1. My data points in Napari are not colored, they remain uniformely grey. To your knowledge, is there a way to set the colormap on-the-fly or some other adjustments I can do? From #308 I saw that this remains an issue in Napari >=0.5.0.

@zoccoler zoccoler added bug Something isn't working and removed low priority labels Aug 9, 2024
@zoccoler
Copy link
Collaborator Author

zoccoler commented Aug 9, 2024

Hi all, I know I'm probably a bit off-topic. I'm encountering the same Warning message using another Napari plugin (Napari-SpatialData). I have napari v.0.4.19.post1. My data points in Napari are not colored, they remain uniformely grey. To your knowledge, is there a way to set the colormap on-the-fly or some other adjustments I can do? From #308 I saw that this remains an issue in Napari >=0.5.0.

Hi @gboscagli !
This issue is because the Labels layer in napari>=0.5.0 does not have a .color attribute anymore. The napari developers left a deprecation warning so that plugin developers could update their plugins in case they were using that attribute.
In your case, it would be best to create the issue directly in the Napari-SpatialData plugin, so that developers there can work on the issue on their code.

@gboscagli
Copy link

Hi @gboscagli ! This issue is because the Labels layer in napari>=0.5.0 does not have a .color attribute anymore. The napari developers left a deprecation warning so that plugin developers could update their plugins in case they were using that attribute. In your case, it would be best to create the issue directly in the Napari-SpatialData plugin, so that developers there can work on the issue on their code.

That's what I did, I'm in contact with Napari-SpatialData developers and they indeed confirmed it's on the roadmap. By the way, I updated Napari to 0.5.0 and the problem remains, so in the case of SpatialData it's probably matter of internal metadata.

Thanks for the response!

@zoccoler
Copy link
Collaborator Author

Fixed via #308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants