Skip to content

Commit c474480

Browse files
committed
docs+added warning
1 parent 1443457 commit c474480

File tree

2 files changed

+47
-7
lines changed

2 files changed

+47
-7
lines changed

napari_cellseg_annotator/launch_review.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ def launch_review(
3636
to allow the user to have a better all-around view of the object
3737
and determine whether it should be labeled or not.
3838
39+
Args:
40+
viewer (napari.viewer.Viewer): The viewer the widgets are to be displayed in
41+
42+
original (dask.array.Array): The original images/volumes that have been labeled
43+
44+
base (dask.array.Array): The labels for the volume
45+
46+
raw (dask.array.Array): The raw labels from the prediction
47+
48+
r_path (str): Path to the raw labels
49+
50+
model_type (str): The name of the model to be displayed in csv filenames.
51+
52+
checkbox (bool): Whether the "new model" checkbox has been checked or not, to create a new csv
53+
54+
filetype (str): The file extension of the volumes and labels.
55+
3956
4057
"""
4158
global slicer

napari_cellseg_annotator/plugin_loader.py

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from pathlib import Path
44
import napari
55
import numpy as np
6+
from qtpy import QtGui
67
from qtpy.QtWidgets import (
78
QWidget,
89
QVBoxLayout,
@@ -97,13 +98,25 @@ def __init__(self, viewer: "napari.viewer.Viewer", parent=None):
9798
self.lbl = QLabel("Images directory", self)
9899
self.lbl2 = QLabel("Labels directory", self)
99100
self.lbl4 = QLabel("Model name", self)
100-
#####################################################################
101-
# TODO remove once done
102-
self.btntest = QPushButton("test", self)
101+
103102
self.lblft = QLabel("Filetype :", self)
104103
self.lblft2 = QLabel("(Folders of .png or single .tif files)")
105-
self.btntest.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
106-
self.btntest.clicked.connect(self.run_test)
104+
105+
self.warn_label = QLabel(
106+
"WARNING : You already have a review session running.\n"
107+
"Launching another will close the current one,\n"
108+
" make sure to save your work beforehand"
109+
)
110+
pal = self.warn_label.palette()
111+
pal.setColor(QtGui.QPalette.WindowText, QtGui.QColor("red"))
112+
self.warn_label.setPalette(pal)
113+
#####################################################################
114+
# TODO remove once done
115+
self.test_button = True
116+
if self.test_button:
117+
self.btntest = QPushButton("test", self)
118+
self.btntest.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
119+
self.btntest.clicked.connect(self.run_test)
107120
#####################################################################
108121

109122
self.build()
@@ -113,6 +126,15 @@ def build(self):
113126

114127
vbox = QVBoxLayout()
115128

129+
global global_launched_before
130+
if global_launched_before:
131+
vbox.addWidget(self.warn_label)
132+
warnings.warn(
133+
"WARNING : You already have a review session running.\n"
134+
"Launching another will close the current one,\n"
135+
" make sure to save your work beforehand"
136+
)
137+
116138
vbox.addWidget(utils.combine_blocks(self.btn1, self.lbl))
117139

118140
vbox.addWidget(utils.combine_blocks(self.btn2, self.lbl2))
@@ -124,10 +146,11 @@ def build(self):
124146
vbox.addWidget(self.checkBox)
125147
vbox.addWidget(self.btn4)
126148
vbox.addWidget(self.btnb)
149+
127150
##################################################################
128151
# remove once done ?
129-
test_button = True
130-
if test_button:
152+
153+
if self.test_button:
131154
vbox.addWidget(self.btntest)
132155
##################################################################
133156
self.setLayout(vbox)

0 commit comments

Comments
 (0)