Skip to content

Commit

Permalink
Merge pull request #20 from bioimage-io/add-logo
Browse files Browse the repository at this point in the history
Display BioImageIO logo and refactoring example plugin
  • Loading branch information
oeway authored Jul 7, 2022
2 parents 325a3ce + 2e59deb commit 3bfabd1
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 28 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include LICENSE
include README.md
include napari_bioimageio/VERSION
include napari_bioimageio/bioimage-io-logo-white.png
exclude requirements*.txt
exclude .*
exclude pylintrc
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# napari-bioimage-io
# napari-bioimageio

napari plugin for managing AI models in the BioImage Model Zoo.
napari plugin for managing AI models in the [BioImage Model Zoo](https://bioimage.io).

> **WARNING**: This is an alpha release. The API may change in future versions, and please feel free to create issues to report bugs or provide feedbacks.
![](assets/screenshot-model-manager-1.png)

## Installation

Expand All @@ -15,7 +19,6 @@ pip install napari-bioimageio
This library is meant for helping developers to ease the handling of models in napari.

We provide a set of API functions for managing and selecting models.

### `show_model_manager()`
Show the model manager with a model list pulled from the BioImage Model Zoo, the user can explore all the available models, download or remove models.

Expand Down Expand Up @@ -43,6 +46,7 @@ if model_info:
pipeline, input_image, padding=padding
)
```
Note: To run the models, you need to setup the conda environment properly according to the [installation guide of bioimageio.core](https://github.com/bioimage-io/core-bioimage-io-python#installation).

For more examples, see [this example notebook](https://github.com/bioimage-io/core-bioimage-io-python/blob/main/example/bioimageio-core-usage.ipynb) for `bioimageio.core`.

Expand Down
Binary file added assets/screenshot-model-manager-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions examples/bioimageio-hpa/bioimageio_hpa/__init__.py

This file was deleted.

12 changes: 0 additions & 12 deletions examples/bioimageio-hpa/bioimageio_hpa/napari.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ This plugin demonstrate how to use the bioimageio model manager to fetch and run
## Installation

```
cd examples/bioimageio-hpa
cd examples/hpa-single-cell
pip install .
```
5 changes: 5 additions & 0 deletions examples/hpa-single-cell/hpa_single_cell/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from ._bhpa import QTHPASingleCell

__all__ = [
"QTHPASingleCell",
]
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
custom_style = get_stylesheet("dark")


class QtBioImageIOHPA(QDialog):
class QTHPASingleCell(QDialog):
def __init__(self, viewer: "napari.viewer.Viewer"):
super().__init__()
self._viewer = viewer
Expand Down
12 changes: 12 additions & 0 deletions examples/hpa-single-cell/hpa_single_cell/napari.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: hpa-single-cell
display_name: HPA Single Cell

contributions:
commands:
- id: hpa-single-cell.QTHPASingleCell
python_name: hpa_single_cell._bhpa:QTHPASingleCell
title: HPA Single Cell

widgets:
- command: hpa-single-cell.QTHPASingleCell
display_name: HPA Single Cell
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
name = bioimageio_hpa
name = hpa_single_cell
version = 0.0.1
classifiers =
Framework :: napari
Expand All @@ -18,7 +18,7 @@ include_package_data = True

[options.entry_points]
napari.manifest =
bioimageio-hpa = bioimageio_hpa:napari.yaml
hpa-single-cell = hpa_single_cell:napari.yaml

[options.package_data]
bioimageio_hpa = napari.yaml
hpa_single_cell = napari.yaml
File renamed without changes.
2 changes: 1 addition & 1 deletion napari_bioimageio/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2
0.1.3
19 changes: 17 additions & 2 deletions napari_bioimageio/_bmm.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,23 @@ def inspect_popup(self):
d.exec_()

def setup_ui(self):
self.resize(1080, 525)
self.resize(1080, 825)

vlay_1 = QVBoxLayout(self)

folderBox = QHBoxLayout()
logo_file = os.path.join(
os.path.dirname(__file__), "bioimage-io-logo-white.png"
)
# TODO: Deal with light theme
logo_label = QLabel(f'<img src="{logo_file}">')
folderBox.addWidget(logo_label)
folderBox.addSpacing(10)
folderBox.addStretch()
vlay_1.addLayout(folderBox)

folderBox = QHBoxLayout()

modfol_label = QLabel("Models folder:")
self.modfol_value = QLabel(self.models_folder)
modfol_folder_btn = QPushButton("Change")
Expand All @@ -450,6 +462,7 @@ def setup_ui(self):
mov.setScaledSize(QSize(18, 18))
self.working_indicator.setMovie(mov)
mov.start()

folderBox.addWidget(modfol_label)
folderBox.addSpacing(10)
folderBox.addWidget(self.modfol_value)
Expand Down Expand Up @@ -481,12 +494,13 @@ def setup_ui(self):
downloaded = QWidget(self.v_splitter)
lay = QVBoxLayout(downloaded)
lay.setContentsMargins(0, 2, 0, 2)
self.downloaded_label = QLabel("downloaded models:")
self.downloaded_label = QLabel("Downloaded models:")
mid_layout = QHBoxLayout()
mid_layout.addWidget(self.downloaded_label)
mid_layout.addStretch()
lay.addLayout(mid_layout)
self.downloaded_list = QtModelList(downloaded, self, self.select_mode)
self.downloaded_list.setFixedHeight(250)
lay.addWidget(self.downloaded_list)

available = QWidget(self.v_splitter)
Expand All @@ -498,6 +512,7 @@ def setup_ui(self):
mid_layout.addStretch()
lay.addLayout(mid_layout)
self.available_list = QtModelList(available, self, False)
self.available_list.setFixedHeight(250)
lay.addWidget(self.available_list)

self.v_splitter.setStretchFactor(1, 2)
Expand Down
Binary file added napari_bioimageio/bioimage-io-logo-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[metadata]
name = napari_bioimageio
version = file: napari_bioimageio/VERSION
long_description = file: README.md
long_description_content_type = text/markdown; charset=UTF-8; variant=GFM
classifiers =
Framework :: napari
Programming Language :: Python
Expand Down

0 comments on commit 3bfabd1

Please sign in to comment.