Add Napari

This commit is contained in:
Simon Li 2019-10-25 17:54:46 +01:00
parent 56ef47e400
commit 9ed5425a16
3 changed files with 96 additions and 2 deletions

View File

@ -79,3 +79,28 @@ COPY --chown=1000:100 *.desktop /home/jovyan/Desktop/
WORKDIR ${HOME}
# https://github.com/napari/napari/blob/v0.2.2/requirements/default.txt
RUN conda install --freeze-installed -y -q -c conda-forge \
dask \
zarr \
fsspec \
imageio \
qtpy \
qtconsole \
scipy \
scikit-image \
vispy \
backcall \
pyopengl \
pyside2 \
wrapt \
numpydoc
# Already installed:
# ipykernel
# numpy
# ipython
# The conda pyside package doesn't appear in pip list so napari tries to reinstall it
RUN pip install --no-dependencies napari==0.2.2
COPY napari.ipynb /home/jovyan/

View File

@ -1,7 +1,8 @@
# Jupyter OMERO client Desktop
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/manics/jupyter-omeroanalysis-desktop/master?urlpath=Desktop)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/manics/jupyter-omeroanalysis-desktop/napari?filepath=napari.ipynb)
Run OMERO clients in a Linux desktop using Jupyter.
Run [OMERO clients](https://www.openmicroscopy.org/omero/downloads/) and [Napari](http://napari.org/) in a Linux desktop using Jupyter.
This is based on https://github.com/ryanlovett/nbnovnc
@ -11,3 +12,5 @@ docker run -it --rm -p 8888:8888 jupyter-omeroanalysis-desktop
```
Open the displayed URL, then go to `/Desktop` e.g. http://localhost:8888/Desktop and if you're lucky you'll see a Linux desktop with icons for OMERO.insight and FIJI.
Once the desktop is open go back to the main Jupyter Notebook window, open `napari.ipynb` and execute the cells one at a time. You should see Napari open in the Desktop window.

66
napari.ipynb Normal file
View File

@ -0,0 +1,66 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Napari\n",
"\n",
"\n",
"## Setup: start the [Desktop](../Desktop)\n",
"The link should open in a different window. If you see an error message try refreshing the window.\n",
"\n",
"Then run the first cell and wait for QT to be initialised before running the following cells. `Run all cells` will not work.\n",
"\n",
"If you are running this locally you should see some log messages. If you are running this on mybinder wait a few seconds before running the Napari cell. Note adding `time.sleep(5)` to the cell does not work!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Use the novnc Desktop in the other window\n",
"import os\n",
"os.environ['DISPLAY'] = ':1.0'\n",
"# instantiate Qt GUI\n",
"%gui qt5"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import napari\n",
"from skimage.data import astronaut\n",
"\n",
"# create the viewer on the Desktop and display the image\n",
"viewer = napari.view_image(astronaut(), rgb=True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}