introduction to bioimage analysis using...

Post on 20-Aug-2018

225 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Introduction to BioImage Analysis using Fiji

CellNetworks Math-Clinic core facility Qi Gao

Carlo A. Beretta 12.05.2017

Data analysis services on bioinformatics & bioimage analysis:

Room 001, BioQuant (INF 267)+49 (0)6221 54 51435math-clinic@bioquant.uni-heidelberg.dehttp://math-clinic.bioquant.uni-heidelberg.de/

Math-Clinic core facility

• 1-to-1 consultancies • research collaboration • courses and workshops • internship, MSc/BSc thesis

Agenda

Introduction to BioImage Analysis using Fiji9:00 - 10:30 Getting to know digital images using Fiji Qi Gao

10:30 - 11:00 Coffee break

11:00 - 12:30 Basic bioimage analysis methods Qi Gao

12:30 - 13:30 Lunch break

13:30 - 15:00 Automating image analysis (ImageJ Macro) I Carlo Beretta

15:00 - 15:30 Coffee break

15:30 - 17:00 Automating image analysis (ImageJ Macro) II Carlo Beretta

Getting to know digital images using Fiji

with slides and figures from

Peter Bankhead Kota Miura Chong Zhang Daniel White

1.1 Digital images• which are digital images?

Images are composed of pixels• each pixel corresponds to a number • brighter region - more photons - larger pixel value • an image is usually display based on grey scale

0 255[figure by PB]

A pixel is NOT a little square!!!• A pixel is a point sample. It exists only at a point. • It generally lies on a grid pattern.

A pixel is NOT a little square!!!

X X X

X X X

X X X=

A pixel is a point sample. It exists only at a point.

0 0

0 00

0

1

1 1

[DW]

Look-Up Table (LUT)• pixels’ representing color is determined by the LUT

0 255[figure by PB]

Look-Up Table (LUT)• pixels’ representing color is determined by the LUT • changing the LUT won’t affect pixel values

0 255[figure by PB]

The numbers contain all information of an image

• an image can be displayed “arbitrarily” • what we really care in image analysis are the numbers

(pixel values)

0 255[figure by PB]

• What I “think” I see ≠ What is actually there

Do not trust your eyes!

“Colour Merge” images could ruin your life

Actually,

both circles

are the same color!

You see: Yellow and Green Circles?

Moral of the story:

You can't measure

colour by eye!

Evolution made you

this way! Why?

Green and yellow circles?

A and B: which is brighter?

Fiji is just imageJ

The main window

Getting started:

See also http://fiji.sc/Getting_started

• The main window

[DW]

• Overview of the menus

Fiji is just imageJ

Overview of the menus

Getting started:

See also http://fiji.sc/Getting_started

File input/output

Selection/ROI handling

Visualization parameters

Image filters

Statistics

Plugins, Macros and Utilities

Windows

Help, Links

[DW]

• The status bar (message & progress) • Shows information about long-running processes.

• Clicking in the status bar shows information about memory consumption.

Fiji is just imageJ

The status bar (messages & progress)

Getting started:

See also http://fiji.sc/Getting_started

● The status bar shows information about long-running processes:

● Clicking in the status bar shows information about memory consumption:

The status bar (messages & progress)

Getting started:

See also http://fiji.sc/Getting_started

● The status bar shows information about long-running processes:

● Clicking in the status bar shows information about memory consumption:

[DW]

Set up memory

• download the ImageJ plugin files (xxx.jar)

• put the files (xxx.jar) in the plugins folder of Fiji (ImageJ) without unzip it

• restart Fiji (ImageJ)

Install plugins

Check updates

Check Update Status:

[Help > Update…]

After confirming to be up-to-date, Click “Manage Update Sites”:

… to add optional plugins

[KM]

Open an image, check the pixel values

x

y

(0,0)

width x height

1. [File -> Open -> Cell_Colony.tif]

Tip: press ‘L’ to use the Command Finder

memorise the menu? not necessary!

Check and change the LUT

1. [File -> Open -> Cell_Colony.tif]

2. [Image -> Color -> Show LUT]

3. Change the LUT by [Image -> Lookup Tables -> Spectrum]

4. Check the LUT again by [Image -> Color -> Show LUT]

5. [Image -> Color -> Display LUTs]

[KM]

Do the pixel values also change?

Image depth• measured intensity by detector

• corresponding level in image

“digital“ intensity

resolution: 10

“digital“ intensity

resolution: 10“digital“ intensity

resolution: 20

“digital“ intensity

resolution: 20“real” analogue

intensities

“real” analogue

intensities

9

0

19

0

Bit Depth

“Intensity” Digitisation[digitization]

[DW]

Bit-depth• determines the dynamic range of image pixel values

• 1bit: 21 = 2 steps • 2bit: 22 = 4 steps • 4bit: 24 = 16 steps

…… • 8bit: 28 = 256 steps

• 16bit: 216 = 65,536 steps • 32bit: 232 = 4,294,967,296 steps

Images can contain far more different pixel values than our eyes can distinguish!

(segmentation)

⟵ (~ limit of human eye)

(intensity-based measurements)

Image bit-depth• A higher bit-depth allows pixels to have more different

values

8 bit (256 values) 4 bit (16 values)

2 bit (4 values) 1 bit (2 values) [PB]

Reducing bit-depth will lose information• data scaling: pixel values are rescaled and rounded to

the nearest valid integer

8-bit image 28 = 256 values

Values changed by rounding

16-bit image 216 = 65536 values

[PB]

Choosing bit-depth during image acquisition

Use the minimum bit-depth that gives the accuracy you need

Use the maximum bit-depth you can (but that doesn’t make the computer crash)

Safer method

Exciting, high-risk method

[PB]

Convert bit-depth 16bit → 8bit

[KM]

with scaling 1. [File -> Open -> m51.tif] then “line” of selection tools 2. [Analyze -> Plot Profile..] 3. [Edit -> Option -> Conversion] (ON!) 4. [Image -> Type -> 8-bit]

5. [Analyze -> Plot Profile..]

without scaling 1. [File -> Open -> m51.tif] [Edit -> Selection -> Restore..] 2. [Edit -> Option -> Conversion] (OFF!) 3. [Image -> Type -> 8-bit]

4. [Analyze -> Plot Profile..]

Image dimension• image can be multi-dimensional

• x, y, z coordinate • color channel • time point

[figure by PB]

2D: x-y

3D: x-y-ch4D: x-y-z-ch

ImageJ makes it (relatively) straightforward to work with images that have up to 5

dimensions

Colour channels

Time pointz-slice

[PB]

Stack basics

Open listeriacells.stk.

… [Start Animation] [Stop Animation]

[Animation Options]

[KM]

Orthogonal view

[KM]

Open mitosis_anaphase_3D.tif

[Image > Stacks > Orthogonal Views]

… Interactive Reslice. Drag the crossing lines.

3D viewer

[KM]

Open mitosis_anaphase_3D.tif [Plugins > 3D Viewer]

rotate and zoom (wheel)! pan: shift-drag

Color image

type composite RGB

data from the microscope converted after acquisition# channels any 3bit-depth any for each channel 8-bit for each channels

adaptability special scientific softwaresappearance varies

most softwaresappearance consistent

When converting a composite image to RGB, information is usually lost

16-bit channels 8-bit channels

Convert to RGB

Composite RGB

[PB]

When converting a composite image to RGB, information is usually lost

16-bit channels 8-bit channels

Convert to RGB

Composite RGB

[PB]

RGB image

for analysisunless you are really really really sure you have not lost vital information

for displayjournal figures, websites, presentations…✔

[PB]

RGB image

1. Open ‘FluorescentCells.tif’

2. [Image -> Type -> RGB Color] what is different than the original?

3. [Image -> Color -> Split Channels]

[CZ]

Composite image

Merge 3 frames [Image -> Color -> Merge Channels…].

[CZ]

Composite imageComposite: you could process individual channels.

-- Do [Image -> Color -> Channel Tool…] and try unchecking some channels!

[KM]

Image format• image image file contains 2 parts

• header: the metadata (data about data) • image data: numbers (pixel values)

ics_version 1.0 filename 3a-z-stack (cropped) layout parameters 6 layout order bits x y z channels t layout sizes 16 243 236 68 2 1 parameter units relative um um um undefined s parameter scale 1 0.082 0.082 0.15 1 0.03 sensor model Hamamatsu C9100-50

448, 462, 438, 447, 442, 451, 480, 467, 467, 440, 447, 461, 482, 493, 432, 490, 445, 459, 473, 455, 443, 443, 430, 457, 423, 442, 469, 437, 422, 438, 461, 455, 447, 446, 458, 446, 441, 477, 470, 452, 449, 461, 446, 472, 452, 461, 454, 471, 462, 464, 456, 434, 440, 446, 463, 438, 449, 483, 473, 470, 442, 438, 472, 464, 450, 454, 453, 445, 469, 441, 434, 459, 435, 465, 454, 433, 459, 427, 445, 457, 434, 424, 467, 444, 467, 458, 445, 455, 454, 436, 489, 427, 433, 466, 474, 461, 458, 449, 458, 467, 456, 464, 487, 496, 463, 453, 460, 465, 456, 464, 448, 458, 455, 476, 494, 444, 491, 420, 478, 451, 468, 465, 467, 456, 450, 460, 450, 496, 430, 486, 481, 468, 453, 477, 458, 470, 436, 476, 446, 471, 455, 440, 454, 462, 466, 463, 459, 446, 441, …

[figure by PB]

Image format • in some formats, image

data is compressed • lossy compression may

make the image no longer suitable for quantitative analysis

original filtered original

jpeg compressed filtered compressed

[PB]

Metadata

[figure by PB]

[open > mitosis.tif] [image -> show info…] [image -> properties…]

Image format • always keep your original files and metadata • avoid using lossy compression (eg, jpeg format) • save your images using “tiff” format

Draw scale bar

1. [Open > hela-cell.tif]

2. [Analysis > Tools > Scale Bar]

3. Click OK!

[KM]

Sometimes there is no scale information

Adding real world scale

1. [open -> micrometer.jpg]

2. Draw line between large bars. (50µm).

3. [Analysis > Set Scale…]

known distance: 50. Unit of length: µm

4. Click “OK”

[KM]

1.2 Image quality• good quality of images always benefit analysis • images need not only proper storage

• high bit-depth • multi-channel • lossless file format

• but also proper acquisition • high resolution • low noise and blur • properly distributed pixel values • fast acquisition

Pixel size• how big a structure in my image? = how big is a pixel? • a pixel is a sample of “intensity” of a point in space • pixel size is pixel spacing distance

• not the imaginary pixel edge length

A pixel is a sample of “intensity” from a POINT in space

“pixel size” is pixel spacing distance

– not the imaginary pixel edge length!

No!

Pixel Size

Yes!

How big is a structure that is represented in my image?

=

How big is one pixel?

A pixel is NOT a little square!!!A pixel is NOT a little square!!!A pixel is a sample of “intensity” from a POINT in space

“pixel size” is pixel spacing distance

– not the imaginary pixel edge length!

No!

Pixel Size

Yes!

How big is a structure that is represented in my image?

=

How big is one pixel?

A pixel is NOT a little square!!!

Digital spatial resolution

Projected pixel “size” at the sample/object is

the point sample “spacing”

• • • • •

• • • • •

• • • • •

• • • • •

• • • • •

• • • • •

• • • • •

• • • • •

y

x

A pixel is not a

“little square”

Point sample

=

Picture Element

=

PixEl

[DW]

Resolution / pixel size• # of pixels in unit length

64.2 µm

Pixel size = 64.2 µm / 600 = 0.107 µm

600 px

[figure by PB]

Resolution / pixel size• # of pixels in unit length • resolution affects spatial information

64.2 µm

Pixel size = 64.2 µm / 75 = 0.856 µm

75 px

[figure by PB]

Higher resolution, more details

512 x 512 pixels

4 x 4 pixels 16 x 16 pixels

64 x 64 pixels 256 x 256 pixels [PB]

But …• increasing resolution doesn’t add more details indefinitely

8 x 8 pixels 16 x 16 pixels 32 x 32 pixels 64 x 64 pixels

128 x 128 pixels 256 x 256 pixels 512 x 512 pixels 1024 x 1024 pixels

Why?• An image we can record is the result of replacing each

point with a corresponding PSF

Point PSF

[PB]

Why?• An image we can record is the result of replacing each

point with a corresponding PSF

Point PSF

[PB]

Noise• adds ‘randomness’ to the pixel values • 2 main sources of noise in fluorescence microscopy

• photon noise - from the random emission of photons • read noise - from sources in the detector (microscope)

• detecting more light helps to overcome both noise

1 10 100 1000exposure time (ms) [PB]

Extra light can be obtained with costs

• increase the pixel size • loses spatial information

• longer exposure time • loses temporal information • beware of over-exposure

[PB]

Understanding histograms

Find the corresponding histograms!

1. Open images ‘2D_Gel.tif’ and ‘gel_inv.tif’

2. Do [Analyze -> histogram]

3. Compare the pixel value in the image and the histogram.

under-/over-exposure• occur when storing values too low/high for the bit-depth • don’t know what happens in the darkest/brightest regions

Which image is better?• a wider and evener distributed histogram means

more details stored and good contrast

1.3 ROI (region of interest) & measurements

Rectangular

Oval

Polygo

n

Freeha

nd

Line

Segmented

FreehandBrush

Elliptical

Rounded rectangle

Arrow

selection tools

ROI

Cropping. [image -> Crop].

Masking. Select a region by rectangular ROI. [Edit -> Clear outside]. [Edit -> Fill].

( same as [Edit -> Selection -> Create Mask])

Invert ROI. [Edit -> Selection -> Make Inverse].

Redirecting ROI. Open any two images. In one of the image, select a region by rectangular ROI. Then activate the other image [Edit -> Selection -> Restore Selection].

ROI manager. [Analysis -> Tools -> Roi Manager]. Click ‘Add’ button to store ROI information. Stored ROI can be saved as a file, and could be loaded again when you restart the ImageJ.

Open any image and then…

[KM]

Intensity measurements

1. [Analyze -> Set measurements]

2. Open cells_Actin.tif

3. Use Polygon ROI and select a cell.

4. [Analyze -> Measure]

5. Measure also the background.

Measure Background as wellIntensity = Cell - Background

[KM]

Intensity measurements

1. [Analyze > Tools > ROI manager]

2. Open [cells_actin.tif] zoom up! (‘+’ key)

3. Use Polygon ROI and select a cell.

4. In ROI manager, click “Add”.

5. Use Rectangular ROI and select background.

3. In ROI manager, click “Add”.

7. Click Measure!

Measure Background as well

Intensity = Cell - Background

[KM]

Creating tricky ROIs

Marking a whole cell in hela-cell.tif, excluding the nucleus

Draw 2 ROIs & add to the ROI Manager (press t)

a polygon around the cell an ellipse around the nucleus

under “More >>”, remove the nucleus ROI from the cell ROI, using XOR

[Edit -> Selection -> Create Mask]

[CZ]

Combination of ROIs (binary images)

roi1

roi2

AND OR XOR“exclusive or”

top related