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

Show notification when umap or label mask is not defined. #9

Merged
merged 1 commit into from
Aug 11, 2023
Merged
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
11 changes: 10 additions & 1 deletion src/napari_tomotwin/load_umap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pandas as pd
import numpy as np
from matplotlib.patches import Circle
from napari.utils import notifications

plotter_widget: PlotterWidget = None
circle: Circle = None
Expand All @@ -18,7 +19,15 @@ def load_umap_magic(
label_layer: "napari.layers.Labels",
filename: pathlib.Path
):
global plotter_widget
if label_layer == None:
notifications.show_error("Label mask is not specificed")
return

if filename.suffix not in ['.tumap']:
notifications.show_error("UMAP is not specificed")
return


umap = pd.read_pickle(filename)
if "label" not in umap.keys().tolist():
lbls = [int(l+1) for l,_ in enumerate(umap[['umap_1', 'umap_0']].itertuples(index=True, name='Pandas'))]
Expand Down