Bandstop filtering fMRI data did not work
4 次查看(过去 30 天)
显示 更早的评论
I have a 64*64*64*2960 matrix of fmri data, where 64*64*64 are the spatial dimensions of the data and 2960 is the temporal dimension.
I need to bandstop filter the matrix in the temporal direction with a bandstop filter. I need to filter the bands [1.290 1.305] hz and [3.05 3.15] hz.
To speed the filtering up, I make a 2960*64 matrix and filter it. I have tried to following code but it did not do any filtering:
[x_len,y_len,z_len,t_len] = size(timeseries);
filtered_timeseries = zeros(x_len,y_len,z_len,t_len);
for k=1:z_len
for j=1:y_len
temp_signal = squeeze(timeseries(:,j,k,:))';
temp_filtered = bandstop(temp_signal,[1.290 1.305],f_sampling,'ImpulseResponse','iir','Steepness',0.95);
temp_filtered = bandstop(temp_filtered,[3.05 3.15],f_sampling,'ImpulseResponse','iir','Steepness',0.95);
filtered_timeseries(:,j,k,:) = reshape(temp_filtered',[x_len,1,1,t_len]);
end
end
0 个评论
回答(1 个)
Hari
2023-12-27
Hi Pseudoscientist,
I understand that you are attempting to apply a bandstop filter to fMRI data represented as a 4D matrix in MATLAB. You want to filter out specific frequency bands in the temporal dimension but your current code does not seem to achieve the desired filtering effect.
Assuming "timeseries" is your 4D fMRI data matrix and "f_sampling" is the sampling frequency of your temporal data, you are using nested loops to apply the "bandstop" filter to each spatial slice of the data. It's important to ensure that the sampling frequency is set correctly to match the temporal resolution of your fMRI data.
Make sure to replace "f_sampling" with the actual sampling frequency of your data. If the filtering still does not work as expected, you may need to verify the design of your filter, ensure the frequency specifications are correct relative to the Nyquist frequency, and check that the "bandstop" function is receiving the correct parameters.
For more information on how to use the `bandstop` function, refer to the documentation of "bandstop filter" - https://www.mathworks.com/help/signal/ref/bandstop.html
To understand more about digital filtering and design methods, you can look at the Filter Design and Analysis Tool documentation - https://www.mathworks.com/help/signal/filter-design.html
Hope this helps!
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!