diff --git a/Dockerfile b/Dockerfile index 2da8e34..a3668ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/ diff --git a/README.md b/README.md index e1c7271..64018fe 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/napari.ipynb b/napari.ipynb new file mode 100644 index 0000000..d6dadc2 --- /dev/null +++ b/napari.ipynb @@ -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 +}