Imaging Software


  • There are many software options for light microscopy images
  • Napari and Fiji/ImageJ are popular open-source options
  • Napari’s user interface is split into a few main sections including the canvas, layer list, layer controls…
  • Layers can be of different types e.g. Image, Point, Label
  • Different layer types have different layer controls

What is an image?


  • Digital images are made of pixels
  • Digital images store these pixels as arrays of numbers
  • Light microscopy images are only an approximation of the real sample
  • Napari (and Python more widely) use NumPy arrays to store images - these have a shape and dtype
  • Most images are 8-bit or 16-bit unsigned integer
  • Images use a coordinate system with (0,0) at the top left, x increasing to the right, and y increasing down

Image display


  • The same image array can be displayed in many different ways in Napari
  • Image histograms provide a useful overview of the pixel values in an image
  • Plugins can be searched for on Napari hub and installed via Napari
  • Colormaps (or LUTs) map pixel values to colours
  • Contrast limits change the range of pixel values the colormap is spread over

Multi-dimensional images


  • Microscopy images can have many dimensions, usually representing time (t), channels (c), and spatial axes (z, y, x)
  • Napari can open images with any number of dimensions
  • Napari (and python in general) has no firm rules for axis order. Different libraries and plugins will often use different conventions.
  • RGB images always have 3 channels - red (R), green (G) and blue (B). These channels aren’t separated into different image layers - they’re instead combined together to give the final image display.

Filetypes and metadata


  • Image files contain pixel values and metadata.
  • Metadata is an important record of how an image was acquired and what it represents.
  • Napari-aicsimagio allows many more image file formats to be opened in Napari, along with providing easy browsing of some metadata.
  • Pixel size states how large a pixel is in physical units (e.g. micrometre).
  • Compression can be lossless or lossy - lossless is best for microscopy images.
  • There are many, many different microscopy file formats. The best format to use depends on your use-case e.g. acquisition, analysis or display.

Designing a light microscopy experiment


  • A general workflow for designing a light microscopy experiment should include:

    • Define your research question
    • Define what you need to observe to answer that question
    • Define what you need to measure to answer that question
    • Choose a light microscopy method that fits your data needs
    • Choose acquisition settings that fit your data needs
  • There are many different types of light microscope - including widefield and confocal

  • You should choose the simplest methods (in acquisition, processing, and statistical analysis) that allow you to address your research question

Choosing acquisition settings


  • Choosing acquisition settings is a trade-off between many factors including: spatial resolution, temporal resolution, field of view, data size, light exposure and signal to noise ratio.

  • Signal to noise ratio is a useful measure of image quality.

  • Magnification describes how much larger an object appears through the microscope vs its actual size. This is not the same as the spatial resolution!

  • Pixel size states how large a single image pixel is in physical units e.g.  micrometre. Again, this is not the same as spatial resolution.

  • Image histograms are a useful quality control measure during acquisition. In general, we want our histogram to show pixel values spread over most of the possible intensity range.

Quality control and manual segmentation


  • The first step in any image processing workflow is quality control. For example, checking the histograms of your images.

  • Segmentation is the process of identifying what each pixel in an image represents e.g. is that pixel part of a nucleus or not?

  • Segmentation can be broadly split into ‘semantic segmentation’ and ‘instance segmentation’. Semantic segmentation assigns pixels to specific classes (like nuclei or background), while instance segmentation assigns pixels to individual ‘instances’ of a class (like individual nuclei).

  • Segmentations are represented in the computer in the same way as standard images. The difference is that pixel values represent classes or instances, rather than light intensity.

  • Napari uses Labels layers for segmentations. These offer various annotation tools like the paintbrush, fill bucket etc.

  • Fully manual segmentation is generally only suitable for small images. More automated approaches (based on classic image processing, machine learning or deep learning) are necessary to scale to larger images. Even with automated methods, manual segmentation is often still a key component - both for generating groundtruth data and cleaning up problematic areas of the final segmentation.

Filters and thresholding


  • Thresholding is simply choosing a specific pixel value to use as the cut-off between background and your class of interest.

  • Thresholds can be chosen manually based on the image histogram

  • Thresholds can be chosen automatically with various methods e.g. Otsu

  • Filters modify pixel values in an image by using a specific ‘kernel’

  • Gaussian filters are useful to blur an image before thresholding. The ‘sigma’ controls the strength of the blurring effect.

  • Image processing operations may modify the data type of your image - often converting it to float32 or float64.

Instance segmentation and measurements


  • Connected component analysis (the label function) was used to assign each connected region of a mask a unique integer value. This produces an instance segmentation from a semantic segmentation.
  • Erosion and dilation filters were used to correct the instance segmentation. Erosion was used to separate individual nuclei. Dilation (or expansion) was used to return the nuclei to their (approximate) original size.
  • Partial nuclei at the image edges can be removed with the clear_border function.
  • The napari-skimage-regionprops plugin can be used to interactively examine the nuclei shapes.
  • The Python console can be used to automate and save the image analysis pipeline.

Additional resources