Image analysis workshop

Participants will learn the fundamentals of microscopy image analysis using ImageJ/Fiji.

Target audience:
 - beginners in image analysis
 - people with some image analysis experience

Learning objectives

  • Understand image file formats, bit depth and metadata
  • Working with multi-dimensional images (channels, time series)
  • Perform common image processing tasks in Fiji more effectively:
    • adjusting brightness/contrast
    • Adding scale bar
    • ROIs
    • Intensity measurements
  • Understand when to use image processing filters (Gaussian, Edge detection etc.) to help with cell/nucleus segmentation.

Prerequisite

Participants are recommended to bring their own laptops with the latest Fiji installed.

We will be working with the following images:

  • hela-cells.tif (Fiji sample image)
  • Rat_Hippocampal_Neuron.tif (Fiji sample image)
  • mitosis.tif (Fiji sample image)
  • Dot_Blot.tif (Fiji sample image)
  • MEF_phalloidin.tif

Download the zip file containing above images, unzip and save them on your laptop before the session begins.

Exercise 1: ImageJ/Fiji user interface (Time: 30 min)

Open HeLa cells sample image

Step 1: Use Fiji Search bar to split channels. You should now have three images, one for each channel.

Step 2: Tile images (Window > Tile)

Step 3: Synchronize all three images: Analyze > Tools > Synchronize Windows
Choose the Freehand selection tool and draw a region-of-interest (ROI) around a cell in the green channel. This ROI should automatically appear in the red channel. Click on the red channel image window title. Press M to measure cell intensity.

Step 4: practice moving ROIs around (from one image to the other)

  • Synchronize Windows
  • Edit › Selection › Restore Selection (Shift+E)
    • draw an ROI in one image. Click on another image and press Shift+E to transfer the ROI.
  • ROI Manager
    • Open ROI Manager by pressing T (or go to: Analyze › Tools › ROI Manager...)
    • draw an ROI in one image and press T to add it to the ROI Manager.
    • Click on another image and select the ROI in the ROI Manager to copy it over.

Step 5: Using Control panel

Use case: to change the LUT of an image

  • Open Control panel: Plugins > Utilities > Control Panel...
  • Navigate to Image > Lookup Tables
  • Select Channel 1 image and click on Magenta in the Control panel
  • Select Channel 3 image and click on Cyan in the Control panel
  • Try other LUTs such as mpl-viridis

Step 6: Shortcuts

  • in-built: look around in the Fiji menu. E.g. Ctrl+Shift+D to duplicate an image
    Tip: No need to press Ctrl (default)
  • Custom
    • Plugins > Shortcuts > Add Shortcut...
    • add F11 to open HeLa Cells image
  • Right click options – make all three channels gray
    • right click > Startup Macros… to add
  • Action Bar plugin to create custom toolbars for frequently used commands.

Exercise 2: Opening images – file formats (Time: 15 min)

Native formats: TIFF, JPEG, PNG, DICOM etc.

  • drag and drop to open

Non-native formats: - CZI, ND2, OME-TIFF etc.

  • need Bio-Formats Importer plugin (Fiji already comes with it)

Working with large images
The theoretical maximum size for a Java array is Integer.MAX_VALUE (2,147,483,647 elements)
=> ~ 2 gigapixel limit
=> ~ 2GB 8-bit grayscale TIFF images

Open large images using Virtual stacks

  • disk resident (as opposed to RAM resident). Read-only so changes made to the pixel data are not saved.
  • Drag and drop on the >> icon.
  • Import > Image Sequence...
  • Import > TIFF Virtual Stack
  • Use virtual stack checkbox in Bio-Formats Importer

Show some of the above option on the light sheet image stitched.tif (~ 50 GB, not provided)

Bio-Formats - crop on import option

  • crop: z 800-900; x 1400, y 1200; width and height 200

Opening large images with different resolutions (pyramidal data)
Lymph node image: “LN Uninvolved P6.qptiff” (1.6 GB, not provided)
Using Bio-Formats Importer, open resolution #5 and check out different channels

Exercise 3: Understanding image metadata (Time: 5 min)

Open image: mitosis.tif
Check metadata under Image > Properties...

Metadata can also be checked without opening the image using Bio-Formats Importer plugin with “Metadata only” option. This allows you to check metadata for large images without having to open them.
For image: LN Uninvolved P6.qptiff
use Bio-Formats Importer “Metadata only” option
 search for metadata such as “Objective”, “Filter”, “Compression”

Exercise 4: Displaying images (Time: 15 min)

Open image: MEF_Phalloidin_staining.tif
Generate 6 different versions as discussed in the lecture
 - Duplicate image 5 times. Tile windows.
 - Adjust Brightness/Contrast, Histogram, LUT, bit-depth

Putting scale bar on images
 Open image: MEF_Phalloidin_staining.tif
Analyze > Tools > Scale Bar...

Copying scale bar from one image to the other
 Open image: MEF_Phalloidin_staining.tif
 Duplicate image and remove scale: Analyze > Set Scale > Remove scale
 Select first image, then Analyze > Set Scale > check Global option

Bit-depth conversion
 Open image: MEF_Phalloidin_staining.tif
  Convert to 8-bit image: Image > Type > 8-bit
 Open the same image again
  Edit > Options > Conversions... uncheck Scale when converting
  Convert again: Image > Type > 8-bit...
 compare the two results

Exercise 5: Handling images (Time: 10 min)

Working with multidimensional images (Channels, Time-series)
 Open image: Rat_Hippocampal_Neuron.tif
Image > Color > Channels Tool... (Shift + Z)
 Check out different display modes – composite, color, grayscale

Making substack
 Difference between Duplicate... and Make Substack... commands
 Open image: mitosis.tif, extract z=4 using Image > Duplicate...
 Can not reverse the channel order or extract specific frames (e.g. 5,10,15) using Duplicate.
 Instead use: Image > Stacks > Tools > Make Substack...

Exercise 6: Quantifying images (Time: 15 min)

Open image: mitosis.tif
Plot line profile: Analyze > Plot Profile (or press K), Live view, click on List to get values and plot elsewhere
Plot Z axis profile Image > Stacks > Plot Z-axis Profile
Intensity measurements
Analyze > Measure (M)
Analyze > Set Measurements...

Exercise 7: Segmentation, image processing filters and Deep Learning (Time: 30 min)

Try the following segmentation methods on image: Dot_Blot.tif

  1. Global threshold: Image > Adjust > Threshold...

  2. Local threshold: Image > Adjust > Auto Local Threshold
    Otsu gives the best result among all the methods.
    Need to filter detections out: Analyze > Analyze Particles...
     area: 400-700; circularity: 0.6-1
    Nice results!
    Add ROIs as overlay: Image > Overlay > From ROI Manager
    Save image.

  3. Preprocess the image by running Gaussian blur (radius =2 ) before trying Auto Local Threshold and Analyze Particles. Compare results with (b).

  4. Use Deep learning method - StarDist
    Need to have the following Update sites checked (Help > Update...)
    • CSBDeep
    • StarDist
    Run Plugins > StarDist/StarDist 2D
    Model: Versatile (fluorescent nuclei), accept all default values
    Press OK.
    Compare results with (c)