1. Download the file signal.mat from the website. This is continuous 10 second recording of a signal sampled at 1 khz. Assume the noise is ergodic in time and that it is white. I used the MATLAB Signal Processing Toolbox function sptool, a GUI for analyzing signals to create the plots below. This is a very convenient tool for creating spectra and comparing window types, lengths, spectral estimation methods, etc. a. Use (at least) window lengths of 256, 1024, and 4096 samples to compute the average spectrum using a window overlap of 0.5. Figure 1 compares the spectrum of our signal calculated with a rectangular window of 256, 1024, and 4096 points (blue, green, red, lines, respectively). Lengthening the window increases the spectral resolution and increases the energy in correct frequency channel as the resolution increases. Spectral lines in the signal that were not seen with 256-point windows become apparent with 4096 point windows. Figure 1 b. Use Matlab s sptool (Figure 1) to perform spectral analysis using a sub-optimal window based on the performance characteristics discussed and the table and graph handed out in class. Use (at least) window lengths of 256, 1024, and 4096 samples to compute the average spectrum using a window overlap of 0.5. c. Repeat the analysis with a more optimal window with the same 0.5 overlap.
Figure 2 demonstrates that, given a 256-point window, the window type affects the spectral resolution and sidelobe level. Shown are rectangle, Hann, Chebyshev(blue, green, red lines, respectively). Figure 2 Figure 3 demonstrates that when long windows are used, side-lobe suppression becomes the main issue. 4096- point windows (rectangle, Hann, Chebyshev; blue, green, red lines, respectively) are shown.
Figure 3 d. Tabulate the spectral content of the signal. The correct answer, i.e. the spectral frequencies that were added to the original sequence were at: f1 = 23.123; % all frequencies in Hz. f2 = 29.235; f3 = 31.357; f4 = 43.579; f5 = 47.791; e. Discuss how your results differ for the window types and durations used. See discussion above. Extra Credit: Design a bandpass filter using the fdatool to pass the non-zero frequencies in the spectrum of the signal. This is worth 10 extra points. Design a bandpass filter with bandwidth 20-50 Hz to suppress noise from outside this range. An appropriate selection of filter type would favor low ripple in the pass band over narrow transition bands in order to minimize ringing artifact.
2. In blood oxygen dependent contrast (BOLD) imaging the flow of blood to the brain increases for voxels that are activated during nervous system stimulation, e.g. visual or motor cortex. Our goal is to isolate the pixels that are responding to the stimulation using spectral analysis techniques. These voxels are said to be activated. Download the series of 80 brain images (acquired at a temporal resolution of 2 sec/image) from a functional MRI data set (titled fmri_images.mat ) available on the website. Assume these are the data acquired using a simple finger tapping paradigm recorded in paradigm.mat. a. The measured signal is the hemodynamic response to the paradigm (Figure 2) plus noise. Note that one feature of BOLD data is that the signal changes due to increased blood flow are relatively small. First characterize the noise in the fmri images by calculating the 2D noise power assuming each image represents an independent realization of the underlying noise process. What type of noise appears to be represented in this problem? The approach I took to evaluate the noise process in this experiment was to assume that 2 consecutive images were independent noise realizations. This allows one to remove the signal from the process to evaluate the noise using the autocovariance noise power in directly in 2-dimensions. >> load fmri_images >> I_sub = I{2}-I{1}; >> I_sub = I_sub./sqrt(2); % Assume no covariance in time thus noise variance is root 2 % larger for subtracted image. >> I_ac = xcorr2(i_sub); Figure 4: Raw noise process appears to be structured. Recall the effects of the magnitude operation on a complex noise process. % Matrix is complex but imaginary terms are zero; need to scale the xcorrelation by the matrix size. >> figure;imagesc(abs(i_ac)./(128.^2));axis('image');colormap('gray');colorbar % >> figure;imagesc(i_sub);axis('image');colormap('gray');colorbar
% Calculate the noise power using the DFT of the autocovariance >> i_ac = fftshift(fft2(fftshift(i_ac))); >> figure;imagesc(abs(i_ac)./(128.^2));axis('image');colormap('gray');colorbar >> brighten(0.5) % Display 1D profile through the 2D noise power image >> figure;plot(abs(i{1}(128,:))) Figure 5: The noise process in space appears to be white with a variance of ±2.5 gray levels. (a) The 2D autocovariance is a 2D delta-function with amplitude ~2.5 (b) White noise power b. Now estimate the noise process in time by calculating the noise power along the time dimension. Remember that the MRI data have undergone a magnitude operation. The approach I took here assumed that the time-dependent noise process was well represented by a single sample within tissue that was unlikely to show activation (i.e. fat or skull signal around the brain in the Shepp-Logan phantom). I then subtracted the mean value from this time-dependent signal: % Obtain the time-dependent signal and store in array t1(). >> for i = 1:80, t1(i) = I{i}(8,64); end % Subtract mean from t1 >> tnoise = t1-mean(t1); >> figure; plot(tnoise) % Calculate autocovariance >> tac = xcorr(tnoise)./80; >> figure; plot(abs(tac)) % Calculate noise power
>> Tac = fftshift(fft(fftshift(tac))); >> figure; plot(abs(tac)) Figure 6: The noise process in time appears to be colored and has stronger components and specific frequencies. (a) Raw noise in time (b) Noise power using Rect/Boxcar Window To further analyze, try windowing the original signal and repeating the noise power calculation. % Apply a Kaiser window >> W = kaiser(80,8); >> tac = xcorr(tnoise.*w')./80; >> figure; plot(abs(tac)) % Calculate the noise power of the windowed function >> tac = xcorr(tnoise)./80; >> Tac = fftshift(fft(fftshift(tac))); >> figure; plot(-(79/160):(1/160):(79/160),abs(tac)') Figure 7: The noise process in the windowed function identifies a prominent peak at 0.25 Hz suggestive of a small periodicity of the noise in time. This is something we need to be aware of when cross-correlating with the paradigm function. The paradigm is at much lower frequency than this small periodicity, so we will ignore it in this problem.
c. Calculate the cross-correlation function for each voxel in the data set using the xcorr() function in Matlab. Judicious use of image thresholding may be used to reduce computation time. Your result should be an image that represents a 2D map of correlation coefficients in the brain. Figure 8: Resulting 2D correlation map showing region of activation in the posterior (occipital) lobe. Figure 9: After applying a Kaiser window Figure 10 d. Repeat part c. with the use of a satisfactory window of your choice (see window() function in Matlab). Does windowing improve the quality of your results? I have to admit that I intended for the temporal windowing to improve the results. However, it is clear from the figures above that the application of the Kaiser window, which may lead to more temporal noise correlations, degrades the intensity of the activated region relative to the background. e. Repeat part c. after applying a 2D low pass filter to the image data. Does filtering improve the quality of your results? This clearly improves the results although there is clearly degradation in the spatial resolution. f. No activation is expected in the frontal lobe of the brain. Therefore, we can use the region as a representative of the background correlation. For you best correlation result, use hypothesis testing (i.e. T-test) to select the threshold for activated voxels assuming the null hypothesis, H o, and a twotailed test with α = 0.05.
Now we use the concepts of hypothesis testing to determine which voxels are significant. Where BW is a mask that identifies regions in the frontal lobe versus the center of the region of activation. >> mean(corrmap(find(double(bw).*corrmap))) ans =0.0165 >> std(corrmap(find(double(bw).*corrmap))) ans =0.3014 for i = 1:128*128, if(((corrmap(i)-0.0165)/0.3014)<1.99) % 80-1 degrees of freedom corrmap(i) = 0; end end >> figure; imagesc(1000.*corrmap); axis('image');colorbar Figure 11: Region of significant activation.