Giter VIP home page Giter VIP logo

i2k-2020-zarr-workshop's Introduction

i2k-2020-zarr-workshop

Binder

Set-up

To run the Jupyter Notebooks and napari:

Install Anaconda https://www.anaconda.com/products/individual#Downloads

Then, to create the environment:

$ cd i2k-2020-zarr-workshop
$ conda env create -f environment.yml -n i2k
$ conda activate i2k

This is sufficient to run a Notebook:

$ jupyter notebook ome-zarr-intro.ipynb

To run napari we need to add:

$ pip install napari[all]
$ pip install ome_zarr

$ napari ... (see below)

Demo

NGFF spec

The Next Generation File Format Spec is at https://ngff.openmicroscopy.org/latest/. The current prototype is OME-Zarr, and the following notebook has some examples of working with this data:

# In the environment created above:
$ jupyter notebook ome-zarr-intro.ipynb

JavaScript

zarr-lite

Loading zarr data with zarr-lite (from Trevor Manz's example)

vizarr

Use https://github.com/hms-dbmi/vizarr (Trevor Manz) to browse OME-Zarr 5d images from IDR.

E.g. https://hms-dbmi.github.io/vizarr?source=https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/9822152.zarr

Pro Tip: Open the browser developer tools and choose Network tab to see what zarr chunks and metadata are being loaded.

HCS Data

Sample OME-Zarr HCS Plates

E.g. https://hms-dbmi.github.io/vizarr?source=https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/plates/422.zarr

Click on the images to browse Plate -> Well -> Image

Python (napari)

Open in napari using a napari plugin: ome-zarr as installed above. Can open any OME-zarr 5d images from IDR.

# e.g. 3D image with labels:
$ napari https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/9822152.zarr

Also supports opening Plates and Wells:

# A Well with 9 fields
$ napari https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/plates/5966.zarr/A/1

# Plate with labels
$ napari https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/plates/2551.zarr

# Image with labels
$ napari https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/plates/2551.zarr/A/1/0

The labels metadata on this plate includes properties that were added from a separate csv file using ome-zarr in a workflow describe on PR #63.

We can make use of the labels properties in napari, e.g. to update color based on property values. Open the console in napari:

import numpy as np
layer = viewer.layers[-1]

for c, value in enumerate(layer.properties["area (µm)"]):
    index = layer.properties["index"][c]
    if value > 60:
        layer.color[index] = np.array([1, 0, 0, 1], dtype=np.float32)
    elif value < 30:
        layer.color[index] = np.array([0, 1, 0, 1], dtype=np.float32)
    else:
        layer.color[index] = np.array([1, 1, 1, 1], dtype=np.float32)
layer.color_mode = "direct"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.