-
Notifications
You must be signed in to change notification settings - Fork 0
/
__main__.py
47 lines (39 loc) · 1.49 KB
/
__main__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# launch_napari.py
from napari import Viewer, run
# import tifffile
from qtpy.uic import compileUi
from pathlib import Path
from pprint import pprint
import logging
# logging.basicConfig(filename="nisd.log",
# filemode='a',
# format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
# datefmt='%H:%M:%S',
# level=logging.CRITICAL)
def build():
UI_DIR = Path(__file__).resolve().parent.joinpath(
'src', 'napari_intensity_step_detection', 'ui')
UI_FILE = UI_DIR.joinpath("h_slider.ui")
pyfile_name = f"ui_{UI_FILE.stem}.py"
pyfile = open(UI_FILE.with_name(pyfile_name), 'wt', encoding='utf8')
compileUi(UI_FILE, pyfile) # from_imports=True, import_from='qtpy'
pprint(pyfile)
# for uifile in UI_FILES:
# pyfile_name = f"ui_{uifile.stem}.py"
# pyfile = open(uifile.with_name(pyfile_name), 'wt', encoding='utf8')
# compileUi(uifile, pyfile) # from_imports=True, import_from='qtpy'
# pprint(pyfile)
def launch():
viewer = Viewer()
dock_widget, plugin_widget = viewer.window.add_plugin_dock_widget(
"napari-intensity-step-detection", "Step Detection"
)
# viewer.add_image(tifffile.imread("image.tif"))
# viewer.add_labels(tifffile.imread("mask.tif"))
run()
if __name__ == "__main__":
try:
launch()
except Exception as e:
print(e)
# logging.exception(e)