Skip to content

Commit

Permalink
Merge pull request #9 from MPI-Dortmund/notify-umap-parameters
Browse files Browse the repository at this point in the history
Show notification when umap or label mask is not defined.
  • Loading branch information
thorstenwagner authored Aug 11, 2023
2 parents 0c45db5 + 3e9af97 commit 45b5222
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 45b5222

Please sign in to comment.