![Page 1: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/1.jpg)
Lecture 24:
Cross-correlation and spectral analysis
MP574
![Page 2: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/2.jpg)
Correlation and Spectral Analysis
Application 4
![Page 3: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/3.jpg)
Review of covariance
nce)(independe 0)((),cov(
),cov(
:ance with vari variablerandom new a forms
. and , variablesrandomt independenFor
2y
2x
2z
yyxxyx
yx
zx-yz
yx
![Page 4: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/4.jpg)
Autocorrelation (Autocovariance)
covariance captures 0j where,1
)(
general,In
. process noisefor
)(1
that Recall
0
0
22
N
qjqqn
N
qqn
nnN
jR
n
nN
σ
![Page 5: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/5.jpg)
Noise Power
theorem valueDC by the
noise, For white
)]([1
1)(
22
2
0
2
0
kk
n
N
j
ijk
N
qjqqn
NS
jRDFTenN
S
nnN
jR
Njk
![Page 6: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/6.jpg)
Zero-Mean Gaussian Noise
![Page 7: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/7.jpg)
Power Spectrum
E{Pnk2 = 1.12 = Rn(0)
![Page 8: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/8.jpg)
Auto-correlation
>> for j = 1:256,
R(j) = sum(n.*circshift(n',j-1)');
end
,1
)(1
N
qjqqn nn
NjR
Rn2 = 1.12
![Page 9: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/9.jpg)
Window Selection: Hamming
y = filter(Hamming,1,n);
![Page 10: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/10.jpg)
Hamming Filtered Power Spectrum
![Page 11: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/11.jpg)
White Noise Auto-Covariance vs. Hamming Filtered Noise
![Page 12: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/12.jpg)
Image Noise Field Autocovariance
Filtered
Noiseimage = imnoise(I,’gaussian’,0,10);N_autocov = xcorr2(Noiseimage);figure;imagesc(N_autocov/(128*128));colormap(gray);axis('image')
![Page 13: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/13.jpg)
Image Noise Field Power Spectrum
Unfiltered
figure;imagesc(fftshift(abs(fft2(N_autocov/(128*128)))));colormap(gray);axis('image')
![Page 14: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/14.jpg)
Image Noise Field Autocovariance
Filtered (wc = 0.6; order 20; Hamming Window)
N_autocov = xcorr2(Noiseimage_filtered);figure;imagesc(N_autocov/(128*128));colormap(gray);axis('image')
![Page 15: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/15.jpg)
Image Noise Field Power Spectrum
Filtered (wc = 0.6; order 20; Hamming Window)
N_autocov = xcorr2(Noiseimage_filtered);figure;imagesc(N_autocov/(128*128));colormap(gray);axis('image')
![Page 16: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/16.jpg)
Image Filtered Image
Filtered (wc = 0.6; order 20; Hamming Window)
Rose_filtered = filter2(Z,Roseimage,'same');
![Page 17: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/17.jpg)
Windowing vs. Filtering
• “Window” applied in temporal or spatial domain to reduce spectral leakage and ringing artifact– Windows fall into a specialized set of functions
generally used for spectral analysis
• “Filter” applied to reduce noise, i.e. noise matching, or to degrade or improve spatial resolution– Some cross-over: one method of filter design is the
“window” method which uses window functions for frequency space modulating functions.
![Page 18: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/18.jpg)
Windowing vs. Filtering
• Mathematically,
)()()(
)()()(
Window"")()()(
Filter"" )()()(
fWfFfG
PFG
twtftg
xpxfxg
![Page 19: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/19.jpg)
Spectral Analysis: Power Spectral Density
• Typical spectral estimation problem involves estimating spectral components of a signal when there is a mixture of strong and weak frequency components
• Waveform is the sum of two sinusoids– f1 = 10.25 Hz; Amplitude = 1– f2 = 16 Hz; Amplitude = 0.01 (-40dB)
![Page 20: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/20.jpg)
Simple Harmonic WaveformSeparate Components Signals
![Page 21: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/21.jpg)
Simple Harmonic WaveformSummed Signal
![Page 22: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/22.jpg)
Equivalent Noise Bandwidth
Harris, 1974
![Page 23: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/23.jpg)
Equivalent Noise Bandwidth
ENBW= Noise Power/Peak Power Gain
)(
)(ENBW 2
2
n
n
nTw
nTw
![Page 24: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/24.jpg)
Equivalent Noise Bandwidth
Harris, 1974
![Page 25: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/25.jpg)
Spectral Resolution
• Ideal case: fs/N
N
fENBWf s
![Page 26: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/26.jpg)
Window Figures of Merit
• Highest sidelobe level– The effect results in a a bias in spectral
estimates• Leakage • Increased Noise Bandwidth• Stopband for filter design applications
• Similar measure is asymptotic rate of sidelobe falloff
![Page 27: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/27.jpg)
Rect Window
![Page 28: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/28.jpg)
Hann Window
![Page 29: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/29.jpg)
Hann vs Rectangle(incorrectly called ‘Hanning’)
![Page 30: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/30.jpg)
Hann vs Rectangle
![Page 31: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/31.jpg)
Blackman-Harris
![Page 32: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/32.jpg)
Blackman-Harris vs Rect
![Page 33: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/33.jpg)
Blackman-Harris vs Rect
![Page 34: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/34.jpg)
Window Figures of Merit
• Features affecting resolution– Equivalent noise bandwidth– Peak side-lobe level– Asymptotic rate of side-lobe fall off– Spectral resolution
![Page 35: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/35.jpg)
Spectral Analysis
• Type “sptool”• Load in signal
– Import into sptool: startup.spt as a “signal”– Sampling frequency is 1kHz (i.e. Fs = 1000)
• View signal• Back to startup.spt, under “spectra” hit
create and view.• Analyze spectrum as described in the
Application
![Page 36: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/36.jpg)
Step 1: Load in signal
![Page 37: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/37.jpg)
View Signal
![Page 38: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/38.jpg)
Create and View Spectrum
![Page 39: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/39.jpg)
Measure frequency content
![Page 40: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/40.jpg)
Window Conditions
![Page 41: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/41.jpg)
Window Conditions
![Page 42: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/42.jpg)
Cross-Correlation Example
![Page 43: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/43.jpg)
Image Based Statistical Inference
• Motivation– Regional patterns of function and disease– e.g. Model of brain function
• Interconnected networks of structures with specialized function
• Expect regionally localized response to intervention, disease
– Desire a method of making statistical inferences from image-based experimental data
![Page 44: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/44.jpg)
SPM*
• Toolbox for:– Spatial processing
• Registration• Spatial filtering/smoothing
– Regional mismatch– Scale of brain activity
– Voxel by voxel statistical modeling– Test hypotheses specific to experimental
design• Morphometry• Functional MRI (fMRI) – Blood Oxygen Level Dependent contrast• Cerebral perfusion and blood volume
* Friston, KJ. “Introduction: Experimental Design and Statistical Parametric Mapping”
![Page 45: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/45.jpg)
Spatial Processing
• Time series of data– functional MRI
• Application 4 simulation:– Time series of a single slice– Voxel specific time-dependent signal– Experimental design includes a periodic stimulation of
the motor cortex
![Page 46: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/46.jpg)
fMRI Simulation
![Page 47: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/47.jpg)
One Implementation of Cross-Correlation
FFT
FFT*
FFT
×
FFT-1
q1(n) q2(n)
1
02112 )()(
1)(
N
n
jnnqnqN
jr
![Page 48: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/48.jpg)
![Page 49: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/49.jpg)
Image Registration
• Multi-step:• Spatial Alignment
1. Rigid body, 6 degree of freedom (dof) affine, registration of temporal data to mask or mean image
– 3 translation, 3 rotation
2. Co-registration of function and anatomy
3. Spatial normalization to common brain atlas– 12 dof affine transformation
– (rot, trans, shear, scaling)
– Low frequency spatial basis functions– Discrete cosine basis set
![Page 50: Lecture 24: Cross-correlation and spectral analysis MP574](https://reader036.vdocuments.site/reader036/viewer/2022062314/56649dc35503460f94ab5da0/html5/thumbnails/50.jpg)