22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10....

17
22485 Medical Imaging systems Lecture: Two-dimensional signal analysis Jørgen Arendt Jensen Department of Health Technology Biomedical Engineering Group Technical University of Denmark October 26, 2020 1 Topic of today: Two-dimensional signal analysis 1. 2D Fourier transforms (a) Relation to 1D Fourier transforms (b) Examples and filtration 2. Hankel transform 3. Sampling of images (a) Spatial sampling frequencies (b) Discrete Fourier transforms (c) Circular convolution 4. Exercise 5 about image processing 5. Questions for assignments Reading material: L. Prince & J. M. Links: Medical imaging signals and systems, Pearson Prentice Hall Bioengineering, 2006 or 2015, Chapter 2 and 3. 2

Transcript of 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10....

Page 1: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

22485 Medical Imaging systems

Lecture: Two-dimensional signal analysis

Jørgen Arendt Jensen

Department of Health Technology

Biomedical Engineering Group

Technical University of Denmark

October 26, 2020

1

Topic of today: Two-dimensional signal analysis

1. 2D Fourier transforms

(a) Relation to 1D Fourier transforms

(b) Examples and filtration

2. Hankel transform

3. Sampling of images

(a) Spatial sampling frequencies

(b) Discrete Fourier transforms

(c) Circular convolution

4. Exercise 5 about image processing

5. Questions for assignments

Reading material: L. Prince & J. M. Links: Medical imaging signals and systems,Pearson Prentice Hall Bioengineering, 2006 or 2015, Chapter 2 and 3.

2

Page 2: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Two dimensional Fourier transforms

Fourier transforms:

F (u, v) =∫ +∞

−∞

∫ +∞

−∞f(x, y)e−j2π(ux+vy)dxdy

Inverse Fourier transforms:

f(x, y) =∫ +∞

−∞

∫ +∞

−∞F (u, v)ej2π(ux+vy)dudv

3

Properties of two dimensional Fourier transforms

Complex: F (u, v) = R(u, v) + jI(u, v)

Magnitude and phase: F (u, v) = M(u, v)e−jφ(u,v)

M(u, v) =√R(u, v)2 + I(u, v)2

φ(u, v) = arctan(I(u, v), R(u, v))

Calculation of Fourier transforms:

F (u, v) =∫ +∞

−∞

[∫ +∞

−∞f(x, y)e−j2πuxdx

]e−j2πvydy

4

Page 3: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Two dimensional square

−6−4

−20

24

6

x 10−3

−6

−4

−2

0

2

4

6

x 10−3

0

0.2

0.4

0.6

0.8

1

Distance in x [m]

Image

Distance in y [m]

Magnitude

5

Two dimensional Fourier transforms - real and imaginary part

−5000

0

5000

−5000

0

5000

−0.5

0

0.5

1

1.5

2

2.5

3

x 10−3

Spatial frequency fx [m

−1]

Real part

Spatial frequency fy [m

−1]

Magnitude

−5000

0

5000

−5000

0

5000−0.5

0

0.5

Magnitude

Imaginary part

Spatial frequency fx [m

−1]

Spatial frequency fy [m

−1]

6

Page 4: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Two dimensional Fourier transforms - Magnitude

−5000

0

5000

−5000

0

5000

0.5

1

1.5

2

2.5

3

x 10−3

Spatial frequency fx [m

−1]

Absolutte spectrum

Spatial frequency fy [m

−1]

Ma

gn

itu

de

7

Properties of two dimensional Fourier transforms

Linearity: af1(x, y) + bf2(x, y)↔ aF1(u, v) + bF2(u, v)

Shift: f(x− a, y − b)↔ F (u, v)e−j2π(ua+vb)

Convolution: f1(x, y) ∗ f2(x, y)↔ F1(u, v)F2(u, v)

f1(x, y) ∗ f2(x, y) =∫ +∞

−∞

∫ +∞

−∞f1(α, β)f2(x− α, y − β)dαdβ

Multiplication:f1(x, y)f2(x, y)↔ F1(u, v) ∗ F2(u, v)

8

Page 5: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Separable image and Fourier transform

Image: f(x, y) = fx(x)fy(y)↔ F (u, v) = Fx(u)Fy(v)

Example for square:

fx(x) = 1, |x| < kx, else 0↔ Fx(u) = 2kxsinπu2kxπu2kx

fy(y) = 1, |y| < ky, else 0↔ Fy(v) = 2kysinπv2kyπv2ky

Spectrum for image:

f(x, y) = fx(x)fy(y)↔ F (u, v) = Fx(u)Fy(v) = 2kxsinπu2kxπu2kx

2kysinπv2kyπv2ky

9

Two dimensional Fourier transforms - Magnitude

−5000

0

5000

−5000

0

5000

0.5

1

1.5

2

2.5

3

x 10−3

Spatial frequency fx [m

−1]

Absolutte spectrum

Spatial frequency fy [m

−1]

Ma

gn

itu

de

10

Page 6: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

CT head image

CT image of head

Distance in x [m]

Dis

tan

ce

in

y [

m]

−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 0.25

−0.25

−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

11

Two dimensional Fourier transforms - Magnitude

Spatial frequency fx [m

−1]

Sp

atia

l fr

eq

ue

ncy f

y [

m−

1]

Absolutte spectrum in dB

−500 −400 −300 −200 −100 0 100 200 300 400

−500

−400

−300

−200

−100

0

100

200

300

400

0

5

10

15

20

25

30

35

40

45

50

12

Page 7: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Two dimensional Fourier transforms - Magnitude zoomed

Spatial frequency fx [m

−1]

Sp

atia

l fr

eq

ue

ncy f

y [

m−

1]

Absolutte spectrum in dB

−500 −400 −300 −200 −100 0 100 200 300 400

−500

−400

−300

−200

−100

0

100

200

300

400

0

5

10

15

20

25

30

35

40

45

50

Spatial frequency fx [m

−1]

Sp

atia

l fr

eq

ue

ncy f

y [

m−

1]

Absolutte spectrum in dB

−100 −80 −60 −40 −20 0 20 40 60 80 100

−100

−80

−60

−40

−20

0

20

40

60

80

100 0

5

10

15

20

25

30

35

40

45

50

13

Low-pass filtration of head image

CT image of head

Distance in x [m]

Dis

tan

ce

in

y [

m]

−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 0.25

−0.25

−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

Filtered image of head

Distance in x [m]

Dis

tan

ce

in

y [

m]

−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 0.25

−0.25

−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

14

Page 8: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Low-pass filter for head image

Spatial frequency fx [m

−1]

Sp

atia

l fr

eq

ue

ncy f

y [

m−

1]

Absolutte spectrum in dB

−100 −80 −60 −40 −20 0 20 40 60 80 100

−100

−80

−60

−40

−20

0

20

40

60

80

100 0

5

10

15

20

25

30

35

40

45

50

−0.1

−0.05

0

0.05

0.1

−0.1

−0.05

0

0.05

0.1

−2

0

2

4

6

8

x 10−3

Distance in x [m]

Impulse response of filter

Distance in y [m]

Magnitude

Spectrum in frequency domain Impulse response

15

High-pass filtration of head image

CT image of head

Distance in x [m]

Dis

tan

ce

in

y [

m]

−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 0.25

−0.25

−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

High pass filtered image of head

Distance in x [m]

Dis

tan

ce

in

y [

m]

−0.25 −0.2 −0.15 −0.1 −0.05 0 0.05 0.1 0.15 0.2 0.25

−0.25

−0.2

−0.15

−0.1

−0.05

0

0.05

0.1

0.15

0.2

0.25

16

Page 9: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Circular symmetric images - Hankel transform

Circular symmetric image: f(x, y) = f(r, φ) = f(r)

Fourier transform circular symmetric: F (u, v) = F (q,Θ) = F (q)

Given by the Hankel transform:

F (q) = 2π∫ +∞

0rf(r)J0(2πqr)dr

Bessel function of first kind:

J0(r) =1

π

∫ π0

cos(r sinφ)dφ

17

Circular symmetry - Hankel transform

-5

0.1

0

0.1

Magnitude

×10 -3

5

Impulse response of filter

Distance in y [m]

0

Distance in x [m]

10

0

-0.1 -0.1

0

1

0.5

1

Am

plif

ication

Transfer function of filter

Frequency in y [1/m]

×10 5 0

×10 5

Frequency in x [1/m]

1

0

-1 -1

18

Page 10: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Circular symmetry - Hankel transform

-0.02

0.1

0

0.1

Magnitude 0.02

Impulse response of filter

Distance in y [m]

0

Distance in x [m]

0.04

0

-0.1 -0.1

0

1

0.5

1

Am

plif

ication

Transfer function of filter

×10 5

Frequency in y [1/m]

0

×10 5

Frequency in x [1/m]

1

0

-1 -1

19

List of Hankel transforms

exp(−πr2)↔ exp(−πq2)

1↔ δ(q)

πq

δ(r − a)↔ 2πJ0(2πqa)

sinc(r)↔ 2rect(q)

π√

1− 4q2

20

Page 11: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Discussion after break

Consider what image you will see, if you combine the phase from one

image with the amplitude from another image.

1. What is likely the amplitude spectrum of both images?

2. How would the phase be?

3. What is the combination?

for 10 2d signals/matlab demo/phase demo.m

21

Sampling function

−6

−4

−2

0

2

4

x 10−4

−6

−4

−2

0

2

4

x 10−4

0

0.5

1

1.5

x 10−4

Distance in y [m]

Spatial sampling function

Distance in x [m]

Ma

gn

itu

de

22

Page 12: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Sampling

2D image of δ-functions:

s(x, y) =+∞∑

j=−∞

+∞∑

k=−∞δ(x− j∆x, y − k∆y)

Spatial sampling frequencies: fsx = 1/∆x, fsy = 1/∆y

Sampled image:

fs(x, y) = f(x, y)s(x, y)↔ F (u, v) ∗ S(u, v)

Fourier transform of sampling function:

s(x, y)↔ S(u, v) =1

∆x∆y

+∞∑

m=−∞

+∞∑

n=−∞δ(u−mfsx, v − nfsy)

23

Spectrum of sampled image

Remember

F (u, v) ∗ δ(u−mfsx, v − nfsy) = F (u−mfsx, v − nfsy)

Spectrum

fs(x, y) = f(x, y)s(x, y) ↔ F (u, v) ∗ S(u, v)

= F (u, v) ∗ 1

∆x∆y

+∞∑

m=−∞

+∞∑

n=−∞δ(u−mfsx, v − nfsy)

Fs(u, v) =1

∆x∆y

+∞∑

m=−∞

+∞∑

n=−∞F (u−mfsx, v − nfsy)

Spectrum repeats itself with a period of fsx and fsy

24

Page 13: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Sampling function

−6

−4

−2

0

2

4

x 10−4

−6

−4

−2

0

2

4

x 10−4

0

0.5

1

1.5

x 10−4

Distance in y [m]

Spatial sampling function

Distance in x [m]

Magn

itud

e

−6000

−4000

−2000

0

2000

4000−5000

−4000−3000

−2000−1000

01000

20003000

4000

0

500

1000

1500

Spatial frequency fy [m

−1]

Sampling function in frequency domain

Spatial frequency fx [m

−1]

Magnitude

Spatial domain Spectrum in frequency domain

25

Sampling function

−5000

−4000

−3000

−2000

−1000

0

1000

2000

3000

4000−5000 −4000 −3000 −2000 −1000 0 1000 2000 3000 4000

Spatial frequency fy [m

−1]

Sampling function in frequency domain in plane

Sp

atia

l fr

eq

ue

ncy f

x [

m−

1]

−4000

−3000

−2000

−1000

0

1000

2000

3000

−4000 −3000 −2000 −1000 0 1000 2000 3000Spatial frequency f

y [m

−1]

Sampling function in frequency domain in plane

Spatial fr

equency f

x [m

−1]

26

Page 14: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Spatial Aliasing

27

Discrete two dimensional Fourier transforms

Discrete Fourier transforms:

F (ud, vd) =1

MN

M−1∑

m=0

N−1∑

n=0

f(m,n)e−j2π

(mudM +

nvdN

)

Frequency variables are discrete: ud = 0..M − 1 and vd = 0..N − 1

Spectrum is discrete and periodic;

F (ud, vd) = F (M − ud, N − vd)

Inverse discrete Fourier transforms:

f(m,n) =M−1∑

ud=0

N−1∑

vd=0

F (ud, vd)ej2π

(mudM +

nvdN

)

28

Page 15: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Circular convolution

−100 −80 −60 −40 −20 0 20 40 60 800

0.01

0.02

h(n

)

Filter

−100 −80 −60 −40 −20 0 20 40 60 800

5

10

15

20

g1(n

)

Periodic time signal

−100 −80 −60 −40 −20 0 20 40 60 800

2

4

g1(n

)

Resulting periodic time signal with overlap

N1 - Length signal 1, N2 - Length signal 2, N - Transform length

Here: N < N1 +N2 − 1

29

Circular convolution

−100 −80 −60 −40 −20 0 20 40 60 800

2

4

Sample number (n)

g2(n

)

Periodic time signal without overlap

−100 −80 −60 −40 −20 0 20 40 60 800

0.01

0.02

h(n

)

Filter

−100 −80 −60 −40 −20 0 20 40 60 800

5

10

15

20

g1(n

)

Periodic time signal

N1 - Length signal 1, N2 - Length signal 2, N - Transform length

Here: N > N1 +N2 − 1

30

Page 16: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Circular convolution for Shepp-Logan phantom

Ideal Shepp−logan phantom, 512 x 512 pixels, Range: [0.95 1.1]

Relative x−coordinate

Rela

tive y

−coord

inate

−3 −2 −1 0 1 2

−3

−2

−1

0

1

2

31

Exercise 5 about Image processing

Ideal Shepp−logan phantom, 512 x 512 pixels, Range: [0.95 1.1]

Relative x−coordinate

Rela

tive y

−coord

inate

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

Ideal image of Shepp-Logan phantom

Mapping of gray scale values for CT images

32

Page 17: 22485 Medical Imaging systemsbme.elektro.dtu.dk/31545/notes/lecture_10_2_per_page.pdf · 2020. 10. 26. · 22485 Medical Imaging systems Lecture: Two-dimensional signal analysis J

Hounsfield Units

From: W. A. Kalender: Computed Tomography, Publicis, 2005

33

Exercise 5 about Image processing

1. Show Shepp-Logan phantom images.

2. Shepp-Logan phantom gray scale mapping.

3. Clinical images of the brain and its gray scale mapping.

4. Make a two-dimensional Fourier transform of the sh black image, and make a meshplot of the amplitude spectrum with the command mesh. Plot the spectrum withthe correct spatial frequency axis. Study the symmetry relations for the Fouriertransform.

5. Make a low-pass filter with a circularly symmetric transfer function that removesall frequencies above a value of 116 m−1.

6. Use an edge enhancement filter given as [-1 -1 -1; -1 9 -1; -1 -1 -1] to enhance theedges in the image sh black.

7. Try the above mentioned image processing on the clinical images downloaded pre-viously.

34