automation mike marsh national center for macromolecular imaging baylor college of medicine...

44
Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualizatio EMAN Tutorial and Worksho March 14, 200 ourier Transforms, iltering and Convolutio

Upload: norman-bishop

Post on 12-Jan-2016

214 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Automation

Mike MarshNational Center for Macromolecular Imaging

Baylor College of Medicine

Single-Particle Reconstructions and VisualizationEMAN Tutorial and Workshop

March 14, 2007

Fourier Transforms, Filtering and Convolution

Page 2: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Transform is an invertible operator

Image Fourier Transform

v2 will display image or its transform

FT

Page 3: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Transform is an invertible operator

Image

f(x,y)F(kx,ky)

x

y

0 Nx

Ny

{F(kx,ky)} = f(x,y)} {f(x,y)} = F(kx,ky)

Nx ⁄ 2

Ny ⁄ 2Fourier Transform

Page 4: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Continuous Fourier Transform

dsesFxf

dxexfsF

xsi

xsi

2

2

)()(

)()(

dsesFxf

dxexfsF

ixs

ixs

)(2

1)(

)()(

dsesFxf

dxexfsF

ixs

ixs

)(2

1)(

)(2

1)(

f(x) = F(s)

Euler’s Formula

Page 5: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Some Conventions

• Image Domain

• Forward Transform

• f(x,y,z)• g(x)• F

• Fourier Domain– Reciprocal space– Fourier Space– K-space– Frequency Space

• Reverse Transform, Inverse Transform

• F(kx,ky,kz)• G(s)• F

Page 6: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Math Review - Periodic Functions

If there is some a, for a function f(x), such that

f(x) = f(x + na)

then function is periodic with the period a

0

a 2a 3a

Page 7: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Math Review - Attributes of cosine wave

Amplitude

Phase

f(x) = cos (x)

f(x) = 5 cos (x)

f(x) = 5 cos (x + 3.14)

-5

-4

-3

-2

-1

0

1

2

3

4

5

-10 -5 0 5 10

-5

-3

-1

1

3

5

-10 -5 0 5 10

-5

-3

-1

1

3

5

-10 -5 0 5 10

Page 8: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

-5

-3

-1

1

3

5

-10 -5 0 5 10

-5

-4

-3

-2

-1

0

1

2

3

4

5

-10 -5 0 5 10

Math Review - Attributes of cosine wave

Amplitude

Phase

Frequency

f(x) = 5 cos (x)

f(x) = 5 cos (x + 3.14)

f(x) = 5 cos (3 x + 3.14)

-5

-3

-1

1

3

5

-10 -5 0 5 10

Page 9: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Math Review - Attributes of cosine wave

f(x) = cos (x)

Amplitude, Frequency, Phase

-5

-3

-1

1

3

5

-10 -5 0 5 10

f(x) = A cos (kx + )

Page 10: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Math Review - Complex numbers

• Real numbers:1-5.2

• Complex numbers4.2 + 3.7i9.4447 – 6.7i-5.2 (-5.2 + 0i)

1i

Page 11: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Math Review - Complex numbers

• Complex numbers4.2 + 3.7i9.4447 – 6.7i-5.2 (-5.2 + 0i)

• General FormZ = a + biRe(Z) = a

Im(Z) = b

• AmplitudeA = | Z | = √(a2 + b2)

• Phase = Z = tan-1(b/a)

Page 12: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Math Review – Complex Numbers

• Polar CoordinateZ = a + bi

• AmplitudeA = √(a2 + b2)

• Phase = tan-1(b/a)

a

b

A

Page 13: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Math Review – Complex Numbers and Cosine Waves

• Cosine wave has three properties– Frequency– Amplitude– Phase

• Complex number has two properties– Amplitude– Wave

• Complex numbers to represent cosine waves at varying frequency– Frequency 1: Z1 = 5 +2i– Frequency 2: Z2 = -3 + 4i– Frequency 3: Z3 = 1.3 – 1.6i

Page 14: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Analysis

Decompose f(x) into a series of cosine waves that when summed reconstruct f(x)

Page 15: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Analysis in 1D. Audio signals

-5

-4

-3

-2

-1

0

1

2

3

4

5

0 200 400 600 800 1000 1200 1400

-5

-4

-3

-2

-1

0

1

2

3

4

5

0 200 400 600 800 1000 1200 1400

5 10 15(Hz)

5 10 15(Hz)

Amplitude OnlyAmplitude Only

Page 16: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Analysis in 1D. Audio signals

-5

-4

-3

-2

-1

0

1

2

3

4

5

0 200 400 600 800 1000 1200 1400

5 10 15(Hz)

Your ear performs fourier analysis.

Page 17: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Analysis in 1D. Spectrum Analyzer.

iTunes performs fourier analysis.

Page 18: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Synthesis

Summing cosine waves reconstructs the original function

Page 19: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Synthesis of Boxcar Function

Boxcar function

Periodic Boxcar

Can this function be reproduced with cosine waves?

Page 20: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

k=1. One cycle per period

A1·cos(2kx + 1)k=1

Ak·cos(2kx + k)k=1

1

Page 21: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

k=2. Two cycles per period

A2·cos(2kx + 2)k=2

Ak·cos(2kx + k)k=1

2

Page 22: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

k=3. Three cycles per period

A3·cos(2kx + 3)k=3

Ak·cos(2kx + k)k=1

3

Page 23: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Ak·cos(2kx + k)N

Fourier Synthesis. N Cycles

A3·cos(2kx + 3)k=3

k=1

Page 24: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Synthesis of a 2D Function

An image is two dimensional data.

Intensities as a function of x,y

White pixels represent the highest intensities.

Greyscale image of iris128x128 pixels

Page 25: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Synthesis of a 2D Function

F(2,3)F(2,3)

Page 26: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Fourier Filters

• Change the image by changing which frequencies of cosine waves go into the image

• Represented by 1D spectral profile

• 2D Profile is rotationally symmetrized 1D profile

Page 27: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

• Low frequency terms– Close to origin in Fourier Space– Changes with great spatial extent (like ice

gradient), or particle size

• High frequency terms– Closer to edge in Fourier Space– Necessary to represent edges or high-

resolution features

Page 28: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Frequency-based Filters

• Low-pass Filter (blurs) – Restricts data to low-frequency components

• High-pass Filter (sharpens) – Restricts data to high-frequency-componenets

• Band-pass Filter– Restrict data to a band of frequencies

• Band-stop Filter– Suppress a certain band of frequencies

Page 29: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Cutoff Low-pass Filter

Image is blurred

Sharp features are lost

Ringing artifacts

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 0.2 0.4 0.6 0.8 1

Page 30: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Butterworth Low-pass Filter

Flat in the pass-band

Zero in the stop-band

No ringing

Page 31: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Gaussian Low-pass Filter

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 0.2 0.4 0.6 0.8 1

Page 32: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Butterworth High-pass Filter

• Note the loss of solid densities

Page 33: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

How the filter looks in 2D

unprocessed

lowpass

highpass

bandpass

Page 34: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Filtering with EMAN2

LowPass Filtersfiltered=image.process(‘filter.lowpass.guass’, {‘sigma’:0.10})

filtered=image.process(‘filter.lowpass.butterworth’, {‘low_cutoff_frequency’:0.10, ‘high_cutoff_frequency’:0.35})

filtered=image.process(‘filter.lowpass.tanh’, {‘cutoff_frequency’:0.10, ‘falloff’:0.2})

HighPass Filtersfiltered=image.process(‘filter.highpass.guass’, {‘sigma’:0.10})

filtered=image.process(‘filter.highpass.butterworth’, {‘low_cutoff_frequency’:0.10, ‘high_cutoff_frequency’:0.35})

filtered=image.process(‘filter.highpass.tanh’, {‘cutoff_frequency’:0.10, ‘falloff’:0.2})

BandPass Filtersfiltered=image.process(‘filter.bandpass.guass’, {‘center’:0.2,‘sigma’:0.10})

filtered=image.process(‘filter.bandpass.butterworth’, {‘low_cutoff_frequency’:0.10, ‘high_cutoff_frequency’:0.35})

filtered=image.process(‘filter.bandpass.tanh’, {‘cutoff_frequency’:0.10, ‘falloff’:0.2})

Page 35: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Convolution

Convolution of some function f(x) with some kernel g(x)

* =

Continuous

Discrete

Page 36: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

x x

Convolution in 2D

x

x x

=

x

x x

=x x

x xx xx x

Page 37: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Microscope Point-Spread-Function is Convolution

Page 38: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Convolution Theorem

f g = {FG}

f = FG

G

Convolution in image domainIs equivalent to multiplication in fourier domain

Page 39: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Contrast Theory

observed imagef(x) for true particle

point-spread function

envelope functionnoise

obs(x) = f(x) psf(x) env(x) + n(x)

Incoherant average of transform

F2(s) CTF2(s) Env2(s) + N2(s)

Power spectrum

PS =

Page 40: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Lowpass Filtering by Convolution

f g = {FG}

• Camera shake• Crystallographic B-factor

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0 0.2 0.4 0.6 0.8 1

Page 41: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Review

Fourier Transform is invertible operator

Math ReviewPeriodic functions

Amplitude, Phase and Frequency

Complex numberAmplitude and Phase

Fourier Analysis (Forward Transform)Decomposition of periodic signal into cosine waves

Fourier Synthesis (Inverse Transform)Summation of cosine waves into multi-frequency waveform

Fourier Transforms in 1D, 2D, 3D, ND

Image AnalysisImage (real-valued)Transform (complex-valued,

amplitude plot)

Fourier FiltersLow-pass High-pass Band-passBand-stop

Convolution TheoremDeconvolute by Division in

Fourier Space

All Fourier Filters can be expressed as real-space Convolution Kernels

Lens does Foureir transforms Diffraction Microscopy

Page 42: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Further Reading

• Wikipedia

• Mathworld

• The Fourier Transform and its Applications. Ronald Bracewell

Page 43: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Lens Performs Fourier Transform

Page 44: Automation Mike Marsh National Center for Macromolecular Imaging Baylor College of Medicine Single-Particle Reconstructions and Visualization EMAN Tutorial

Gibbs Ringing

• 5 waves

• 25 waves

• 125 waves