diff --git a/cellfinder/napari/detect/detect.py b/cellfinder/napari/detect/detect.py index 396f90b6..f0efe488 100644 --- a/cellfinder/napari/detect/detect.py +++ b/cellfinder/napari/detect/detect.py @@ -11,9 +11,8 @@ from cellfinder.core.classify.cube_generator import get_cube_depth_min_max from cellfinder.napari.utils import ( add_layers, - header_label_widget, + cellfinder_header, html_label_widget, - widget_header, ) from .detect_containers import ( @@ -40,7 +39,6 @@ def detect_widget() -> FunctionGui: progress_bar = ProgressBar() @magicgui( - header=header_label_widget, detection_label=html_label_widget("Cell detection", tag="h3"), **DataInputs.widget_representation(), **DetectionInputs.widget_representation(), @@ -52,7 +50,6 @@ def detect_widget() -> FunctionGui: scrollable=True, ) def widget( - header, detection_label, data_options, viewer: napari.Viewer, @@ -205,8 +202,7 @@ def update_progress_bar(label: str, max: int, value: int): worker.update_progress_bar.connect(update_progress_bar) worker.start() - widget.header.value = widget_header - widget.header.native.setOpenExternalLinks(True) + widget.native.layout().insertWidget(0, cellfinder_header()) @widget.reset_button.changed.connect def restore_defaults(): diff --git a/cellfinder/napari/images/brainglobe.png b/cellfinder/napari/images/brainglobe.png deleted file mode 100644 index 427bdaba..00000000 Binary files a/cellfinder/napari/images/brainglobe.png and /dev/null differ diff --git a/cellfinder/napari/train/train.py b/cellfinder/napari/train/train.py index 4d5e005b..d604bf4b 100644 --- a/cellfinder/napari/train/train.py +++ b/cellfinder/napari/train/train.py @@ -8,11 +8,7 @@ from qtpy.QtWidgets import QScrollArea from cellfinder.core.train.train_yml import run as train_yml -from cellfinder.napari.utils import ( - header_label_widget, - html_label_widget, - widget_header, -) +from cellfinder.napari.utils import cellfinder_header, html_label_widget from .train_containers import ( MiscTrainingInputs, @@ -41,7 +37,6 @@ def run_training( def training_widget() -> FunctionGui: @magicgui( - header=header_label_widget, training_label=html_label_widget("Network training", tag="h3"), **TrainingDataInputs.widget_representation(), **OptionalNetworkInputs.widget_representation(), @@ -52,7 +47,6 @@ def training_widget() -> FunctionGui: scrollable=True, ) def widget( - header: dict, training_label: dict, data_options: dict, yaml_files: Path, @@ -161,8 +155,7 @@ def widget( ) worker.start() - widget.header.value = widget_header - widget.header.native.setOpenExternalLinks(True) + widget.native.layout().insertWidget(0, cellfinder_header()) @widget.reset_button.changed.connect def restore_defaults(): diff --git a/cellfinder/napari/utils.py b/cellfinder/napari/utils.py index 689b2842..d48b81fb 100644 --- a/cellfinder/napari/utils.py +++ b/cellfinder/napari/utils.py @@ -4,21 +4,7 @@ import numpy as np import pandas as pd from brainglobe_utils.cells.cells import Cell -from pkg_resources import resource_filename - -brainglobe_logo = resource_filename( - "cellfinder", "napari/images/brainglobe.png" -) - - -widget_header = """ -
Efficient cell detection in large images.
- - - - -For help, hover the cursor over each parameter. -""" # noqa: E501 +from brainglobe_utils.qtpy.logo import header_widget def html_label_widget(label: str, *, tag: str = "b") -> dict: @@ -31,13 +17,18 @@ def html_label_widget(label: str, *, tag: str = "b") -> dict: ) -header_label_widget = html_label_widget( - f""" - -
cellfinder
-""", - tag="h1", -) +def cellfinder_header(): + """ + Create the header containing the brainglobe logo and documentation links + for all cellfinder widgets. + """ + return header_widget( + "cellfinder", + "Efficient cell detection in large images.", + documentation_path="cellfinder/user-guide/napari-plugin/index.html", + citation_doi="https://doi.org/10.1371/journal.pcbi.1009074", + help_text="For help, hover the cursor over each parameter.", + ) def add_layers(points: List[Cell], viewer: napari.Viewer) -> None: diff --git a/pyproject.toml b/pyproject.toml index efdb36f0..6e5ac59d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ ] requires-python = ">=3.9" dependencies = [ - "brainglobe-utils>=0.4.2", + "brainglobe-utils>=0.4.3", "brainglobe-napari-io>=0.3.4", "dask[array]", "fancylog>=0.0.7",