1 of 60

Getting Started with Fiji/ImageJ

Helen Wilson

hwilson23@wisc.edu

Adapted from work by Edward Evans, Michael Nelson, Ellen Dobson, and many others

2 of 60

Who am I?

  • Helen Wilson
  • University of Wisconsin-Madison
    • 3rd year BME Graduate student in Dr. Kevin Eliceiri’s Lab
    • Undergraduate in BME at the University of Delaware

  • Currently:
    • Fluorescence Lifetime Imaging Microscopy
    • Second Harmonic Generation Microscopy

3 of 60

Outline:

  • Software introduction
  • Examining digital images
    • Different types of images and formats
    • 2D and 3D display
    • Enter known scale information
  • Segmenting areas of interest
  • Making measurements
  • Segmentation (StarDist and Labkit)
  • Tracking (Trackmate)

4 of 60

What is ImageJ/Fiji?

  • Open source tool for scientific image analysis
  • ImageJ 1.x maintained since 1997, eventually modernized into ImageJ2
  • FIJI is “batteries included” ImageJ2

Wayne Rasband

Curtis Rueden

5 of 60

Fiji is just ImageJ

  • Is an image processing package— "batteries-included"
  • For Users:
    • easy to install (Mac, Windows, Linux)
    • easy to update
    • bundles a lot of plugins (added functionality)
    • offers comprehensive documentation

https://fiji.sc

Use a search engine

6 of 60

What’s it for? What’s the point?

IMAGES ANSWER QUESTIONS (and maybe create more)

  • What size is it?
    • Smaller than x? Larger than y?
  • Did the shape change?
    • More round? More protrusions?
  • Does it move?
    • What direction? How far? How long?
  • Does it have the molecule?
    • Is it where it should be? “How much?”

7 of 60

How do we know what to look at?

  • Information in the images is driven by the experiment
  • What is important is driven by the biological question

8 of 60

Generally…

https://www.youtube.com/watch?v=kor9E3Qen28

Images

Regions of Interest (ROI)

Measurements

9 of 60

What is a digital image?

10 of 60

Generating scientific digital images

Output

  • Usually 8-bit, 12-bit, 16-bit gray scale images.
  • Can be n-dimensional (i.e. “XYCTZ”).
  • Images are usually .TIFF format or proprietary format (e.g. .nd2).

11 of 60

A closer look: Images are pixels, pixels are values

Notice inverted LUT (colorscale)

12 of 60

Bit Depth - Binary Representation

4 bits = 4 places, 16 combinations

13 of 60

Visualizing image bit depth through gradients

32-bit

16-bit

8-bit

14 of 60

Don’t trust your eyes with image bit depth

  • Depending on your screen you generally will be unable to detect differences in the gradient after 8-10 bits.
  • Converting from a higher bit depth to a lower bit depth (even if the image looks the same) results in data loss.
    • 16-bit -> 8-bit

Adapted from: https://gregbenzphotography.com/photography-tips/8-vs-16-bit-depth-photoshop/

15 of 60

Visualizing image bit depth through “resolution spheres”

8-bit

16-bit

32-bit

Courtesy of Edward Evans

16 of 60

  • File type (.tif, .asc, proprietary files, try to avoid .jpeg)
  • Dimensions
    • Not limited to 2D or 3D
    • X,Y… C? Z? T?
  • Pixel/voxel size
  • Coordinates - 0,0 is which corner?
  • Understanding your metadata is important

What other metadata do you have?

17 of 60

  • A great image is better than perfectly detailed analysis
  • Common artifacts and issues:
    • Scratches, debris
    • Poor staining/staining issues
    • Uneven illumination
    • Spectral crosstalk/bleed-through
    • Improper stitching/stage movement
    • Focus drift
    • Saturated signal
    • Inconsistent parameters

A Note on Artifacts

QUALITY IN = QUALITY OUT

18 of 60

Developing an Analysis Workflow

  • Define what information you need and research existing tools
    • Define your control
    • Segmentation, tracking
    • Start simple
  • Consider how each step might “skew” the original image or analysis process during pre or post processing
    • Filters, thresholding (avoid manual thresholds), processing masks
    • Record what you do so it is reproducible (consider automation/scripting)
  • Take measurements from the initial image
    • WORK ON A COPY OF THE ORIGINAL

https://imagej.net/imaging/principles

19 of 60

FIJI Basics

20 of 60

The Main Window

  • Tip: click on the status bar
  • Tip: right / double-click on Tools

Getting Started page of the ImageJ wiki

21 of 60

The Main Window

  • Right / double-click on Tools
  • Hold shift to draw horizontal or vertical lines
  • Hold alt and use arrow keys to change sizes
  • Hold spacebar to move

22 of 60

CTRL + L: Search Bar

Edit ▶ Options ▶ Search Bar... ▶ Pressing L focuses the search bar

23 of 60

Staying Up-To-Date

Not this one!

https://imagej.net/plugins/updater

24 of 60

Staying Up-To-Date

https://imagej.net/update-sites/following

25 of 60

What to do if you have analysis questions…

26 of 60

How do we analyze images in FIJI?

27 of 60

Data Visualization

2D, 3D, Hyperstacks

28 of 60

Look up tables (LUTs)

  • See different types of LUTs
  • Examine change in perceived information based on LUT
  • Add calibration bar
  • See how the image looks for different types of colorblindness
    • Mlp-viridis can be a good option as perceptually uniform

29 of 60

Image color selection

  • Estimated 1/12 men and 1/200 women have some type of colorblindness
  • Grayscale when printing
  • Include colorbar

FIJI - Simulate Color Blindness

BioVoxxel Plugin

30 of 60

Profile Plots

  • Easily look at background noise level
  • Help estimate size of objects

31 of 60

Get to Know Your Data…

  • File ▶ Open Samples ▶ Boats
  • Analyze ▶ Histogram (Ctrl+H)

  • Can look at pixel values and bit depth changes

What would cause this histogram?

32 of 60

A real example of bit depth loss

  • A look at image histograms
  • See how changing image type affects the pixel information

33 of 60

Thresholding Segmentation

  • Use histogram to threshold
  • Compare with other auto threshold methods
  • Create a mask or binary image

34 of 60

Masks from thresholds may need adjustments…

  • Images may be difficult to threshold and create usable masks
  • Considering preprocessing the image before thresholding
  • Masks can be altered with watershed, erode, or dilate
    • If you are doing this a lot, look into plugins like MorphoLibJ or SAMJ

Cell Image courtesy of Kasia Wiesh, Skala Lab UW-Madison

35 of 60

Analyze Particles

  • Select and identify individual blobs
  • Use size exclusion to eliminate smaller blobs
  • Add the selections to the ROI (region of interest) manager

36 of 60

Take Measurements

  • Decide which measurements to include
  • Measure individual blobs

37 of 60

Background Subtraction - Gaussian Filters

  • Designed to blur out objects, especially good for filtering noise
  • Width controlled with sigma value
  • Difference of Gaussians can highlight different objects within size range

Adapted from Pete Bankhead: https://petebankhead.gitbooks.io/imagej-intro/content/chapters/filters/filters.html#sec-filters_gaussian

Input

Gaussian blur (σ = 5)

Blur Image - Input Image

38 of 60

https://forum.image.sc/t/consensus-on-subtract-background-built-in-or-other/7061

39 of 60

2D Gaussian Subtraction Script

https://github.com/elevans/fiji-scripts/

40 of 60

Background suppression: Mean * Input image

Input

Mean filter

(radius = 5)

Input * Mean

Nuclei 1

Nuclei 3

41 of 60

(Mean*input) Threshold Comparison

42 of 60

StarDist - Object Segmentation

  • Uses deep learning to segment cells, which can be done with pretrained models
    • Can sometimes have better results if you have overlapping objects
  • Can be used to classify cells
  • Works for 2D in FIJI, supports 3D elsewhere (Napari)

Source: https://github.com/stardist/stardist

Additional info: https://stardist.net/index.html

43 of 60

Labkit - Pixel Classifier

  • Supervised pixel classifier - segmentation tool to identify objects of interest
  • Works to separate foreground and background using calculated pixel metrics
  • For 2D and 3D

Source: https://github.com/juglab/labkit-ui

Additional Info: https://imagej.net/plugins/labkit/

44 of 60

Scripting in FIJI

Why are scripts useful?

They facilitate reproducible science…

  • Document your work
  • Automate your analysis
  • Share with the world

Supported Languages:

Groovy, ImageJ Macro, Python(Jython), JavaScript, Ruby(JRuby), Lisp(Clojure), R(Renjin), Java, BeanShell, Scala

45 of 60

Scripting in FIJI...

ImageJ Macro language

  • Less powerful
  • Easy to learn and use

46 of 60

Batch Processing

  • Simple and quick way to run macro script on a folder of files
  • Can sometimes have odd functionality with certain plugins

https://imagej.net/scripting/batch

47 of 60

Batch Processing Within Code

  • Usually completed with a for loop - template provided with FIJI
  • Requires some basic knowledge of coding, especially if not using the ImageJ macro language
  • More versatile and easy to make changes to code

48 of 60

Macro language examples

Variables: User input statements:

Functions and calling functions:

49 of 60

Trackmate - Cell Tracking

  • Designed to segment and track cells
  • Multiple algorithms to choose from
  • Works for 3D
  • Latest Version - segmentation with Cellpose

Source: https://github.com/trackmate-sc/TrackMate

Additional Resources:

https://imagej.net/media/plugins/trackmate/trackmate-manual.pdf

50 of 60

Figure Making in FIJI

  • Save as vector based graphics (.eps, .pdf)
    • Careful of how the pixel size and representation is changing
    • Watch for pixel interpolation (ex. Rotating changes straight lines)

BioVoxxel Plugin

Figure Creation Macro

51 of 60

Image.sc Forum

52 of 60

Helpful Resources:

  • Help from the community - Scientific Community Image Forum:

  • ImageJ User Guides:

  • Additional workshops and presentations:

https://imagej.net/learn/user-guides

https://imagej.net/events/presentations

53 of 60

Acknowledgements

Get Involved!

  • Edward Evans

  • Michael Nelson

  • Kevin Eliceiri

  • Ellen TA Dobson
  • Everyone who has worked to make ImageJ/FIJI/Image.sc possible
  • Curtis Rueden

54 of 60

Thank You!

Questions?

55 of 60

Share your results

Preparing microscopy figures and workflows for publication (in review)

FigureJ for creating accurate publication figures

QuickFigures - also for creating publication figure panels

Reproducible image handling by Kota Miura and Simon F Nørrelykke

56 of 60

Additional Resources:

57 of 60

Other software

  • Napari: ImageJ but in Python
    • Deep Learning
    • Strong CZI support
    • Growing plugin ecosystem
    • PyImageJ
      • Napari-ImageJ bridge
  • CellProfiler, QuPath, Ilastik, Icy and more
    • More biological/microscopy focused
    • Much quicker to get results for “standard” images
    • Convenience Vs. Flexibility
    • Integrate ImageJ
  • Proprietary software:
    • Handling large volumes of data: Imaris/Arivis etc.
    • Validated for clinical trials: Oncotopix-Visiopharm

58 of 60

Trainable Weka Segmentation plugin

Create labels

Select features (Variance)

Train a machine learning algorithm

Get segmentation masks

59 of 60

Tracking in Fiji

Fiji Plugin = TrackMate

Single particle tracking plugin

Simple/sensible user interface

Segmentation / filtering / particle-linking processes visualized in 2D or 3D

MaMuT for big data!

60 of 60

Follow along - download the sample data and

Install StarDist and CSBDeep plugins

Google Drive:

http://tinyurl.com/yj332a6p

For further questions: hwilson23@wisc.edu