Image analysis of brain image
Ältere Kommentare anzeigen
I have a small project to do on Image Analysis. I have an excel file for different 6 different pixels and frames for intensities of a brain signal. My job is to analyze the theta waves which in 2x3 pixels region. These are my following task:
- to compute fft
- to find frequency for theta waves
- to use filter to remove noise
So what I think is for 1, I need to create a 2d matrix to load the data for pixel 2 and 3, and compute fft2(). However, I have only done a couple of examples for 1D fft yet. I am not even sure if we need to use 2d fft for theta waves analysis. I am completely stuck. Can somebody help me getting started?
Akzeptierte Antwort
Weitere Antworten (1)
William Rose
am 31 Mär. 2021
0 Stimmen
You are right about the limited frequency range. You said the sampling interval was 0.077 second, i.e. sampling rate fs=13.0 Hz. The Nyquist frequency is fNyq=fs/2=6.5 Hz. The amplitudes in the FFT at frequencies from 6.5 Hz to 13.0 Hz (the top half of the two-sided spectrum) are just the "folded over" amplitudes from the 6.5 to 0 Hz range - IF the analog signal does not have any power above 6.5 Hz. The reason this happens is due to the mathematics of discrete sampling and sinusoidal signals. If there is power above the Nyquist frequency, then the FFT at all frequencies in th two-sided spectrum is a complicated overlay of the amplitudes below and above the Nyquist frequency. You can never disentangle them, after they have been sampled. This is called aliasing, because a signal at a high frequency takes on the appearance, or identity, of a signal at a lower frequency.
Therefore you have two problems:
- The 13 Hz sampling rate is not fast enough to capure the 4-8 Hz band, since the associated Nyquist frequency is 6.5 Hz, which is below 8.
- Aliasing almost certainly occured when the signal was sampled. I say this because the original amplitude spectrum plot shows a fairly constant amplitude (+- some noise) from 2 Hz up to the Nyquist frequency. It very unlikely that the analog signal was sharply band limited right at 6.5 Hz. It is much more likely that the signal had power above 6.5 Hz and that the amplitude we see below 6.5 Hz is a mix of signal that really was below 6.5 Hz plus analog components above the Nyquist frequency, whch got aliased down into the 0-6.5 Hz range due to sampling at 13 Hz.
If this data were from my advisor, I would tell them that it is not possible to reliably determine the theta wave frequency or theta wave content from this recording, due to the low sampling frequency and the likelihood of aliasing. I would propose that we collect more data at a much higher video sampling rate. (See below.) But we can still try to analyze the spectrum that you have, from 4 to 6.5 Hz.
I agree that the frequency which has maximum amplitude may not be a great estimate of mean theta wave frequency, because the spectrum is quite spiky or noisy. Thefore the frequency of one skinny tall spike may not be a very reliable indicator. I would compute the mean and median frequencies as well.
Sinc eyou have 115.5 seconds of data (1500 x 0.077), I recommend you try pwelch() . You will lose frequency resolution (i.e.
in your spectrum will be bigger) but the error bars on your spectrum will get smaller. If you want to post some data, such as the raw data array (3x2x1500), or the orignal one-sided average spectrum (should be a vector of amplitudes, length 751), that could be helpful.
Sampling rate
To avoid aliasing, the analog signal needs to be analog-filtered to remove power above the Nyquist frequency, before it is sampled. The original amplitude spectrum plot which you show makes me suspect that this signal was not sufficiently low-pass filtered before it was sampled.
The sampling rate is chosen based on 1. the range of frequencies you wish to study (up to 8 Hz in this case) and 2. on the properties of the analog low pass filter used to prevent aliasing. This is its own complicated subject, but the end result is that you need to sample fast enough that the Nyquist rate is well above the highest frequency of interest, often by a factor of 2 or more. To study frequencies up to 8 Hz, I want a Nyquist frequency of 16 (or more, depending on my anti-aliasing filter), and therefore a sampling rate of 32 Hz or more. Most EEG system sample at 240 Hz, it says here.
Your signals comes from images. There is no pracitcal way to analog-low-pass-filter the light intensity from a scene. (That is why aliasing causes helicopter blades in a video image to appear to be going very slowly. Their high frequency has been aliased down to a much lower frequency by video sampling.) Therefore it is good to sample at the highest rate which your video system allows.
3 Kommentare
reema shrestha
am 1 Apr. 2021
William Rose
am 1 Apr. 2021
The table in the Excel sheet for pixl order is not important. It tells you which column of the spreadsheet corresponds to which pixel.
In Excel, I computed the mean of 6 pixels intensity at each frame, and save the result as a single clumn of 1500 numbers, in a text file. The file is attached.
The attached Matlab script reads the data from the text file, does the FFT, plots the single sided amplitude spectrum, and finds the peak frequency, average frequency, and median frequency within the 4-8 Hz band. The band ends at 6.5 Hz, due to the 13 Hz sampling rate. The mean and median frequencies are 5.23 Hz. This is about halfway from 4.0 to 6.5, which is not suprising, since the amplitudes are fairly constant over the band. If the amplitudes were exactly constant, the median and mean would be exactly at the halfway point of the band. The frequency of max amplitude is 5.65 Hz.
reema shrestha
am 1 Apr. 2021
Kategorien
Mehr zu EEG/MEG/ECoG finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

