OSCR

FREQ-NESS Reveals Age-Related Differences in Frequency-Resolved Brain Networks During Auditory Recognition and Resting State.

Code ↔ Paper

10 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 10 matches · 1 of them tie a paragraph to a whole file, not to given lines: a weak match, whose lines are not tinted
  1. [1] § Methods › Source Reconstruction ↔ MEG_SR_Beam_LBPD.m, lines 1–96 · score 0.92 · leadfield model, FieldTrip, single shell, MNI152 T1, MEG channels, MEG sensors
  2. [2] § Methods › Source Reconstruction ↔ MEGSourceReconstruction_LeadFieldModel_Workshop.m, lines 28–71 · score 0.90 · leadfield model, FieldTrip, MNI152 T1, MEG channels, source reconstruction, MEG sensors
  3. [3] § Methods › Source Reconstruction ↔ MEG_SR_Beam_LBPD.m, lines 1–96 · score 0.72 · leadfield model, beamforming algorithm, MEG sensor, source reconstruction, brain source, weights
  4. [4] § Methods › Source Reconstruction ↔ MEGSourceReconstruction_LeadFieldModel_Workshop.m, lines 28–71 · score 0.69 · leadfield model, source reconstruction, MEG sensor, brain source, orientations
  5. [5] § Methods › Data Acquisition ↔ MEG_sensors_MCS_plottingclusters_LBPD_D.m, lines 58–128 · score 0.65 · channel Elekta Neuromag, TRIUX, Position, MEG
  6. [6] § Methods › Frequency Analysis › Morlet Wavelet Transform ↔ MEG_sensors_MonteCarlosim_LBPD_D.m, lines 1–69 · score 0.63 · Monte Carlo, original clusters, binarizing, permutation, threshold, computational
  7. [7] § Methods › Frequency Analysis › Morlet Wavelet Transform ↔ oneD_MCS_LBPD_D.m, the whole file · a weak match · score 0.63 · Monte Carlo, original clusters, binarizing, permutation, threshold
  8. [8] § Methods › Preprocessing ↔ MEG_SR_Beam_LBPD.m, lines 288–357 · score 0.63 · planar gradiometers, FieldTrip, head, segmented, SPM, position
  9. [9] § Results › Overview on Experimental Design and Analysis ↔ FREQNESS_Toolbox/FREQNESS_Functions/FREQNESS_NetworkEstimation.m, lines 281–367 · score 0.53 · narrowband covariance matrix, spatial activation patterns, eigenvectors, broadband, eigenvalues, filter
  10. [10] § Methods › Generalized Eigenvector Decomposition ↔ FREQNESS_Toolbox/FREQNESS_Functions/FREQNESS_NetworkEstimation.m, lines 1–91 · score 0.53 · source reconstructed brain, multichannel, covariance matrices, eigenvalue, vector, voxels

Paper

Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

MATLAB · 910 lines · 53 KB · GPL-3.0 · 3 matches

  1. function [ OUT ] = MEG_SR_Beam_LBPD( S )
  2. % Function to run the several steps required for source reconstruction
  3. % using a beamforming algorithm.
  4. % The algorithms used here are based on work of other brilliant people and
  5. % I do not want to take any credit for that. This function was created simply
  6. % to handle several steps more easily, make small different choices, try various solutions,
  7. % and also use such algorithms in connection to the cluster of computers of Aarhus University
  8. % (for this particular purpose, set the correspondent label below).
  9. % Furthermore, writing these codes allowed me to deeply study the beamforming as well as to prepare
  10. % materials for teaching purposes. Specifically, this function is based on
  11. % a combination of codes and functions from FieldTrip, OSL and SPM
  12. % (beamforming toolbox), plus some in-house-built solutions.
  13. % Thus, to run this function you should first download OSL (https://github.com/OHBA-analysis/osl-core),
  14. % which comprises also the required functions from FieldTrip and SPM. Then,
  15. % you should also start OSL up so that all functions paths are known by Matlab.
  16. % If you work with Aarhus University (and in some cases Oxford University)
  17. % facilities, I would suggest you to contact me to set everything up.. best way could be using the set of functions named: LBPD.
  18. % Leonardo Bonetti, [email hidden]
  19. % The function handles the following steps:
  20. % I) NORMALIZING MEG SENSORS, MAINLY FOR COVARIANCE ESTIMATION (OPTIONAL BUT STRONGLY RECOMMENDED)
  21. % II) GRID (i), LEADFIELD MODEL (ii), MEG SENSORS DATA EXTRACTION (iii), SPATIAL FILTERS COMPUTATION (iv)
  22. % III) FULL INVERSION
  23. % IV) SPATIAL AND/OR TEMPORAL SMOOTHING (OPTIONAL) (TO BE UPDATED SINCE I HAVE TO CHECK WHETHER THE NEW MASK IS COMPATIBLE WITH THE ORIGINAL ONE IN TERMS OF MNI COORDINATES, ETC.)
  24. % V) CREATION OF NIFTI IMAGES (OPTIONAL)
  25. % INPUT: -S.norm_megsensors (I)
  26. % S.norm_megsensors.zscorel_cov: 1 = z-score normalization; 0 = no normalization;
  27. % (SUGGESTED 1!)
  28. % S.norm_megsensors.workdir: working directory (where computation will be made and output stored; highly recommended
  29. % to have a different workdir per subject.
  30. % S.norm_megsensors.MEGdata_e: path to MEG data (epoched)
  31. % S.norm_megsensors.freq: frequency range in Hertz to be used for the source reconstruction (e.g. [2 8]); leave empty [] to not apply any filter
  32. % S.norm_megsensors.MEGdata_c: path to MEG data (continuous).
  33. % This must be passed only if you ask more filtering (so if S.norm_megsensors.freq is not empty).
  34. % This is done since you should do the filtering on the continuous (and not on the epoched) data.
  35. % S.norm_megsensors.forward: forward solution for leadfield; at the moment should be: 'Single Shell'
  36. % -S.beamfilters (II)
  37. % S.beamfilters.sensl: 1 = magnetometers; 2 = gradiometers; 3 = both MEG sensors (mag and grad) (SUGGESTED 3!)
  38. % S.beamfilters.maskfname: path to brain mask: (e.g. 8mm MNI152-T1: '/projects/MINDLAB2017_MEG-LearningBach/scripts/Leonardo_FunctionsPhD/External/MNI152_T1_8mm_brain.nii.gz')
  39. % -S.inversion (III)
  40. % S.inversion.znorml: 1 for inverting MEG data using the zscored normalized data.
  41. % 0 to normalize the original data with respect to maximum and minimum of the experimental conditions if you have both magnetometers and gradiometers.
  42. % 0 to use original data in the inversion if you have only mag or grad (while e.g. you may have used zscored-data for covariance'matrix)
  43. % (SUGGESTED 0 IN BOTH CASES!)
  44. % (PLEASE, NOTE THAT THE COVARIANCE MATRIX IS ALWAYS CALCULATED BEFORE WITH THE OPTION PROVIDED WITH: "S.norm_megsensors.zscorel_cov")
  45. % S.inversion.timef: data-points to be extracted (e.g. 1:300); leave it empty [] for working on the full length of the epoch (both for covariance matrix and for ERF data to be multiplied by weights W)
  46. % S.inversion.conditions: cell with characters for the labels of the experimental conditions (e.g. {'Old_Correct','New_Correct'})
  47. % S.inversion.bc: specify the time-samples to be used for baseline correction (as usual, subtraction of the mean of the baseline from the whole timeseries; independently done for each brain source).
  48. % e.g. [1 15] means first 15 time-samples (e.g. 100ms if you have sampling rate = 150Hz).
  49. % Leave empty [] for non calculating it.
  50. % S.inversion.abs: 1 for absolute values of brain sources values; 0 otherwise.
  51. % Please, note that the sign of the reconstructed signal is not really meaningful or at least it may be normalized after this function if you have knowledge of the polarity of the signal you are reconstructing.. THIS LAST STATEMENT MUST BE CHECKED WITH SOME TESTS!! IT SEEMED FINE IN OAT, BUT I'M NOT SURE YET HERE..
  52. % (SUGGESTED 1!)
  53. % S.inversion.effects: Defining solution for computing main effects and contrasts:
  54. % -Main effects of experimental conditions:
  55. % 1 = simple mean over trials
  56. % 2 = mean divided by standard deviation
  57. % 3 = mean divided by square root of standard deviation
  58. % 4 = mean divided by (standard deviation divided by square root of number of trials) (actual t-value..)
  59. % 5 = single trials (i.e. all trials independently)
  60. % 6 = custom data (matrix: MEG channels x time-points x (new) conditions); OBS!! This requires "S.inversion.alternative_data"
  61. % -Contrasts between two experimental conditions:
  62. % 1 = simple difference of means over trials
  63. % 2-3-4 = two-sample t-tests,
  64. % S.inversion.alternative_data: cell array: {1} = new data (double matrix: MEG channels x time-points x (new) conditions)
  65. % {2} = new conditions label (cell array with characters)
  66. % -S.smoothing (IV)
  67. % S.smoothing.spatsmootl: 1 for spatial smoothing; 0 otherwise
  68. % S.smoothing.spat_fwhm: spatial smoothing fwhm (suggested = 100)
  69. % S.smoothing.tempsmootl: 1 for temporal smoothing; 0 otherwise
  70. % S.smoothing.temp_param: temporal smoothing parameter (suggested = 0.01)
  71. % S.smoothing.tempplot: vector with sources indices to be plotted (original vs temporally smoothed timeseries; e.g. [1 2030 3269]).
  72. % Leave empty [] for not having any plot.
  73. % -S.nifti (V): 1 for plotting nifti images of the reconstructed sources of the experimental conditions
  74. % Please, note that no statistics is computed; that will be done by other functions/scripts.
  75. % -S.Aarhus_cluster: 1 for using the cluster of computers (Haydes) of Aarhus (CFIN-MIB).
  76. % Please, note that to use this you need to have access to the Aarhus' facilities.
  77. % Please, contact me, Leonardo Bonetti ([email hidden]), for further information.
  78. % -S.out_name: name (character) for saving output results and nifti images (conditions name is automatically detected and added) on disk
  79. % OUTPUT: -OUT: struct (both outputted and saved in S.norm_megsensors.workdir) with:
  80. % -MEG sensor data (ERFs)
  81. % -source reconstructed data (data before and after smoothing is stored)
  82. % -S structure with information used for the computations
  83. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  84. % [email hidden]
  85. % Leonardo Bonetti, Aarhus, DK, 19/02/2021
  86. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  87. if S.Aarhus_cluster == 1
  88. %starting LBPD up (and therefore also OSL and a subset of SPM and FieldTrip functions)
  89. pathl = '/projects/MINDLAB2017_MEG-LearningBach/scripts/Leonardo_FunctionsPhD'; %path to stored functions
  90. addpath(pathl);
  91. LBPD_startup_D(pathl);
  92. end
  93. %preparing output structure
  94. OUT = [];
  95. OUT.S = S;
  96. %checking input for baseline correction
  97. if ~isempty(S.inversion.bc) && length(S.inversion.bc) ~= 2
  98. error('S.inversion.bc (baseline correction) must be either empty [] or comprise two values (e.g. [1 15])')
  99. end
  100. %%%%% I - MEG SENSORS NORMALIZATION %%%%%
  101. disp('%%%%% I - MEG SENSORS NORMALIZATION %%%%%')
  102. %loading SPM object (D)
  103. workdir = S.norm_megsensors.workdir;
  104. if ~exist(workdir,'dir') %creating working folder if it does not exist
  105. mkdir(workdir)
  106. end
  107. %filtering, if requested
  108. if ~isempty(S.norm_megsensors.freq) %if you have provided a frequency range
  109. if ~isfield(S.norm_megsensors,'MEGdata_c') || isempty(S.norm_megsensors.MEGdata_c) %checking if you have provided continuous data for filtering purposes
  110. error('if you want to apply the bandpass filter you need to provide continuous data (in S.norm_megsensors.MEGdata_c)')
  111. end
  112. disp('filtering MEG sensor data')
  113. %%% original (for some reasons, in some cases the bandpass filter did not work and I had to use a low pass filter which in this particular case was also fine
  114. S3 = [];
  115. S3.D = S.norm_megsensors.MEGdata_c; %continuous data
  116. S3.freq = S.norm_megsensors.freq; %frequency range
  117. S3.band = 'bandpass';
  118. % S.prefix = 'f_LBPD';
  119. D = spm_eeg_filter(S3); %actual function
  120. %%%
  121. %%% temporary
  122. % S3 = [];
  123. % S3.D = S.norm_megsensors.MEGdata_c; %continuous data
  124. % S3.freq = [3.5]; %frequency range
  125. % S3.band = 'low';
  126. % % S.prefix = 'f_LBPD';
  127. % D = spm_eeg_filter(S3); %actual function
  128. %%%
  129. disp('epoching MEG filtered sensor data with epochinfo from your previously epoched data')
  130. D_e = spm_eeg_load(S.norm_megsensors.MEGdata_e); %loading previously computed epoched data to get epochinfo (info about trials specification, labels, etc.)
  131. epochinfo = D_e.epochinfo; %getting the epochinfo information
  132. %%% TEMPORARY!! for communications biology..
  133. %1000ms
  134. % epochinfo.trl(:,1) = epochinfo.trl(:,1) - 135;
  135. % epochinfo.trl(:,3) = ones(length(epochinfo.trl),1).*(-150);
  136. %500ms
  137. % epochinfo.trl(:,1) = epochinfo.trl(:,1) - 60;
  138. % epochinfo.trl(:,3) = ones(length(epochinfo.trl),1).*(-75);
  139. %2000ms
  140. % epochinfo.trl(:,1) = epochinfo.trl(:,1) - 285;
  141. % epochinfo.trl(:,3) = ones(length(epochinfo.trl),1).*(-300);
  142. %%%
  143. %building structure for spm_eeg_epochs
  144. S3 = [];
  145. S3.D = D; %filtered continuous data
  146. S3.trl = epochinfo.trl; %trial information from epochinfo
  147. S3.conditionlabels = epochinfo.conditionlabels; %condition labels
  148. S3.prefix = 'e_LBPD'; %prefix to clearly identify that I am doing a further epoching
  149. D = spm_eeg_epochs(S3); %actual function
  150. %store the epochinfo structure inside the D object
  151. D.epochinfo = epochinfo;
  152. %switch the montage to 1 (ICA denoised data; before was 0 (non-ICA-denoised data) since OSL people did it.. however should not really matter.. what is important in my understanding is that here it is switched back to 1)
  153. D = D.montage('switch',1);
  154. D.save(); %saving on disk
  155. Dfilte = D; %copying file for potential later usage when extracting MEG sensors for inversion
  156. clear D_e
  157. else
  158. D = spm_eeg_load(S.norm_megsensors.MEGdata_e); %otherwise loading non-filtered (presumably broad band) data
  159. end
  160. %cloning SPM object
  161. [workdiroriginal, fname, ext] = fileparts(D.fullfile); %getting information about the path of the data
  162. if S.norm_megsensors.zscorel_cov == 1
  163. Dnew = D.clone( fullfile(workdir,['Clone' fname ext]) );
  164. idxMEGc1 = find(~cellfun(@isempty,strfind(D.chanlabels,'MEG'))); %elaborated way to get indices of MEG channels (even though I am mainly interested in the first MEG channel index)
  165. % dat = D(idxMEGc1,:,:); %extracting only MEG channels
  166. % for jj = 1:size(dat,3) %over trials
  167. % dat(:,:,jj) = zscore(dat(:,:,jj),[],2);
  168. % disp(['normalizing trial ' num2str(jj) ' / ' num2str(size(dat,3))])
  169. % end
  170. % dat = zeros(length(idxMEGc1),size(D,2),size(D,3));
  171. for jj = 1:size(D,3) %over trials
  172. Dnew(idxMEGc1,:,jj) = zscore(D(idxMEGc1,:,jj),[],2);
  173. % dat(:,:,jj) = zscore(D(idxMEGc1,:,jj),[],2);
  174. disp(['normalizing trial ' num2str(jj) ' / ' num2str(size(D,3))])
  175. end
  176. % Dnew(idxMEGc1,:,:) = dat; %storing normalized MEG channels
  177. Dnew.save();
  178. D = Dnew;
  179. %%% OBS!!! NOTE THAT AFTER CLONE, HERE WE TAKE DATA FROM AFTER
  180. %%% AFRICA (SO THE ICA-DENOISED DATA) BUT WE HAVE TO STORE IT IN
  181. %%% THE MONTAGE = 0 OF THE CLONED SPM OBJECT.. SO IN THE CLONE
  182. %%% MONTAGE = 0 SHOULD CONTAIN THE ICA-DENOISED DATA AFTER ZSCORE
  183. %%% NORMALIZATION..
  184. % else %otherwise just passing the data
  185. % Dnew(:,:,:) = D(:,:,:);
  186. % Dnew.save();
  187. end
  188. % clear D Dnew
  189. % if S.norm_megsensors.zscorel_cov == 1 %this is just to make sure to properly work on normalized or non-normalized MEG data
  190. % D = spm_eeg_load([workdir '/Clone' fname ext]);
  191. % else
  192. if S.norm_megsensors.zscorel_cov ~= 1 %this is just to make sure to properly work on normalized or non-normalized MEG data
  193. if exist('Dfilte','var')
  194. D = Dfilte; %getting filtered file, if you previously computed it
  195. else %otherwise original epoched data provided by the user
  196. D = spm_eeg_load(S.norm_megsensors.MEGdata_e);
  197. end
  198. end
  199. S2 = [];
  200. S2.forward_meg = S.norm_megsensors.forward; %- Specify forward model for MEG data ('Single Shell' or 'MEG Local Spheres')
  201. D = osl_forward_model(D,S2);
  202. D.save();
  203. %previous specifications from SPM beamforming toolbox
  204. space = 'MNI-aligned';
  205. val = 1;
  206. gradsource = 'inv';
  207. %retrieving data from SPM object
  208. BF.data = spm_eeg_inv_get_vol_sens(D, val, space, gradsource);
  209. idxMEGc1 = find(~cellfun(@isempty,strfind(D.chanlabels,'MEG'))); %elaborated way to get indices of MEG channels (even though I am mainly interested in the first MEG channel index)
  210. BF.data.MEG.sens.label = D.chanlabels(idxMEGc1)'; %to prevent possible discrepancies between MEG channel labels..
  211. %emulating SPM beamforming toolbox
  212. BF.data.D = D;
  213. BF.data.mesh = D.inv{val}.mesh;
  214. BF.data.zscorel_cov = S.norm_megsensors.zscorel_cov; %storing information about normalization of MEG data
  215. %1 BF file for each subject
  216. save([workdir '/BF_' fname '.mat'],'BF');
  217. %%%%% II - GRID (i), LEADFIELD MODEL (ii), MEG SENSORS DATA EXTRACTION (iii), SPATIAL FILTERS COMPUTATION (iv) %%%%%
  218. disp('%%%%% II - GRID (i), LEADFIELD MODEL (ii), MEG SENSORS DATA EXTRACTION (iii), SPATIAL FILTERS COMPUTATION (iv) %%%%%')
  219. sensl = S.beamfilters.sensl; %getting information about MEG sensors to be used
  220. % timef = S.beamfilters.timef; %getting time-points to be used
  221. %%% 1) COMPUTING GRID (8-MM MNI152 STANDARD MASK TRANSFORMED INTO SPACE WHERE WE DO THE BEAMFORMING)
  222. disp('computing grid')
  223. %loading prepared data (preprocessed, epoched, coregistered (rhino), (maybe normalized), forward model done (vol in ft))
  224. load([workdir '/BF_' fname '.mat']);
  225. [ mni_coords, ~ ] = osl_mnimask2mnicoords(S.beamfilters.maskfname);
  226. %emulating SPM beamforming toolbox
  227. S2 = [];
  228. S2.pos = mni_coords;
  229. % transform MNI coords in MNI space into space where we are doing the beamforming
  230. M = inv(BF.data.transforms.toMNI);
  231. gridv.pos = S2.pos;
  232. %actual transformation of MNI coordinates into the space where we are doing the beamforming
  233. res = ft_transform_geometry(M, gridv);
  234. % establish index of nearest bilateral grid point (for potential use in lateral beamformer); NOT REALLY USED HERE..
  235. res.bilateral_index = zeros(size(S2.pos,1),1);
  236. for jj = 1:size(S2.pos,1)
  237. mnic = S2.pos(jj,:);
  238. mnic(1) = -mnic(1);
  239. res.bilateral_index(jj) = nearest_vec(S2.pos,mnic);
  240. end;
  241. BF.sources.mni = res;
  242. %%% 2) COMPUTING LEADFIELD MODEL
  243. disp('computing leadfield model')
  244. %simulating SPM beamforming toolbox
  245. BF.sources.pos = BF.sources.mni.pos;
  246. BF.sources.ori = [];
  247. nvert = size(BF.sources.pos, 1); %number of dipoles
  248. modalities = {'MEG', 'EEG'};
  249. reduce_rank = 2;
  250. %getting some information
  251. chanind = indchantype(BF.data.D, {'MEG', 'MEGPLANAR'}, 'GOOD'); %channels index
  252. % chanunits = units(BF.data.D, chanind); %channels unit
  253. %preparing data for computation of lead field model
  254. [vol, sens] = ft_prepare_vol_sens(BF.data.(modalities{1}).vol, BF.data.(modalities{1}).sens, 'channel', chanlabels(BF.data.D, chanind));
  255. %getting locations of dipoles (derived from original MNI coordinates from standard space mask)
  256. pos = BF.sources.pos;
  257. %plotting together grid in the brain, vertices and triangles from segmentation and MEG channels
  258. %here I think I am plotting the native space with the dipoles derived from standard mask in MNI coordinates transformed into native space
  259. figure
  260. ft_plot_vol(vol, 'edgecolor', [0 0 0], 'facealpha', 0);
  261. hold on
  262. plot3(pos(:, 1), pos(:, 2), pos(:, 3), '.r', 'MarkerSize', 10);
  263. hold on
  264. plot3(BF.data.MEG.sens.chanpos(:, 1), BF.data.MEG.sens.chanpos(:, 2), BF.data.MEG.sens.chanpos(:, 3), '.b', 'MarkerSize', 10);
  265. rotate3d on;
  266. axis off
  267. axis vis3d
  268. axis equal
  269. %getting label indices (the order of the triplets is fine since the
  270. %leadfield function reads it from sens.label and now I am also reading that
  271. %from sens.label for extracting proper channels (e.g. magnetometers only)
  272. %from leadfield computation
  273. cntmag = 0; cntgrad2 = 0; cntgrad3 = 0; IDXMAG = zeros(102,1); IDXGRAD2 = zeros(102,1); IDXGRAD3 = zeros(102,1);
  274. for gg = 1:length(sens.label) %over MEG channels
  275. if strcmp(sens.label{gg}(end),'1') %if it is a magnetometer
  276. cntmag = cntmag + 1;
  277. IDXMAG(cntmag) = gg; %storing index
  278. elseif strcmp(sens.label{gg}(end),'2') %same concept for gradiometers (first of the couple)
  279. cntgrad2 = cntgrad2 + 1;
  280. IDXGRAD2(cntgrad2) = gg;
  281. elseif strcmp(sens.label{gg}(end),'3') %second of the couple
  282. cntgrad3 = cntgrad3 + 1;
  283. IDXGRAD3(cntgrad3) = gg;
  284. end
  285. end
  286. IDXGRAD = sort(cat(1,IDXGRAD2,IDXGRAD3)); %combining indices of planar gradiometers (according to progressive order in sens.label)
  287. %preallocating space for lead field
  288. L = cell(1,nvert);
  289. Ltot = cell(1,nvert);
  290. %actual computation of lead field
  291. for ii = 1:nvert
  292. dumL = ft_compute_leadfield(BF.sources.pos(ii, :), sens, vol, 'reducerank', reduce_rank(1)); %computation of the leadfield using FieldTrip function
  293. if sensl == 1 %magnetometers
  294. %previous
  295. % L{ii} = dumL(1:3:306,:);
  296. %new
  297. L{ii} = dumL(IDXMAG,:);
  298. elseif sensl == 2 %gradiometers
  299. %previous
  300. % dumdumL = zeros(204,size(dumL,2));
  301. % dumdumL(1:2:204,:) = dumL(2:3:306,:);
  302. % dumdumL(2:2:204,:) = dumL(3:3:306,:);
  303. % L{ii} = dumdumL;
  304. L{ii} = dumL(IDXGRAD,:);
  305. else %all MEG sensors
  306. L{ii} = dumL;
  307. end
  308. Ltot{ii} = dumL; %storing full leadfield for later plotting computations
  309. % L{i} = ft_compute_leadfield(BF.sources.pos(ii, :), sens, vol, 'reducerank', reduce_rank(1),'normalize', 'yes'); %trying to use the normalize option to reduce the bias towards the center of the head
  310. disp(['computing leadfield model.. source: ' num2str(ii) ' / ' num2str(nvert)])
  311. end
  312. %%%%%% CONSIDER TO REMOVE THIS IF EVERYTHING WORKS FINE
  313. % %%% 3) EXTRACTING MEG SENSORS DATA
  314. % disp('extracting MEG sensors data')
  315. % %loading and extracting data (you need to decide whether the normalization should be used for all processes of source reconstruction or only for computing the covariance matrix)
  316. % %z-scored normalized data (if you previously asked for normalization, otherwise simply clone of the original MEG data)
  317. % Dc = spm_eeg_load([workdir '/Clone' fname ext]);
  318. % if ~exist('timef','var')
  319. % warning('timef was not specified, so working on full length of the epoch.. you may want to check whether you need a subset of the time-window or the full epoch..')
  320. % timef = 1:size(D,2);
  321. % end
  322. % %extracting data (only MEG sensors and first timef time-points)
  323. % idxMEGc1 = find(strcmp(Dc.chanlabels,'MEG0111')); %getting extreme channel index (first MEG channel, then I add 305 to get them all)
  324. % chans = Dc.chanlabels(idxMEGc1:idxMEGc1+305); %extracting labels for MEG channels
  325. % if sensl == 1 %magnetometers
  326. % datameg = Dc(idxMEGc1:3:idxMEGc1+305,timef,:); %data
  327. % elseif sensl == 2 %gradiometers
  328. % datameg = zeros(204,length(timef),size(Dc,3));
  329. % datameg(1:2:204,:,:) = Dc(idxMEGc1+1:3:idxMEGc1+305,timef,:); %data
  330. % datameg(2:2:204,:,:) = Dc(idxMEGc1+2:3:idxMEGc1+305,timef,:); %data
  331. % else
  332. % datameg = Dc(idxMEGc1:idxMEGc1+305,timef,:); %data
  333. % end
  334. % time = Dc.time(timef);
  335. % ERFmean = mean(datameg(:,:,1:80),3);
  336. % ERFmedian = median(datameg(:,:,1:80),3);
  337. %%%%%%% UNTIL HERE
  338. %RESHAPING ORDER OF MNI COORDINATES (FROM ORIGINAL STANDARD BRAIN TO BRAIN LAYOUT BUILT FOR BETTER VISUALIZATION PURPOSES, you find it here: /projects/MINDLAB2017_MEG-LearningBach/scripts/Leonardo_FunctionsPhD/External/MNI152_8mm_coord_dyi.mat)
  339. %this is important for printing the nifti image with the results to be visualized
  340. disp('reshaping order of MNI coordinates.. just for handling better some visualization purposes..')
  341. % if ~exist('MNI8','var') %if not already loaded..
  342. warning('loading MNI152-T1 8mm brain newly sorted set of coordinates.. remember that if you want a different spatial resolution (e.g. 2mm), you need to create a new mask and update this line of code!!')
  343. load('/projects/MINDLAB2017_MEG-LearningBach/scripts/Leonardo_FunctionsPhD/External/MNI152_8mm_coord_dyi.mat') %loading coordinates for the new IDs
  344. % end
  345. % if ~exist('mni_coords','var') %if not already loaded..
  346. % [ mni_coords, ~ ] = osl_mnimask2mnicoords('/scratch5/MINDLAB2017_MEG-LearningBach/MNI152_T1_8mm_brain_PROVA.nii.gz');
  347. % end
  348. MNI_sorted_index = zeros(length(mni_coords),1);
  349. for ii = 1:length(MNI8) %over coordinates (ii = coordinates from file: MNI152_8mm_coord_dyi)
  350. coorddum = MNI8(ii,:); %getting new IDs coordinates
  351. source = find((double(mni_coords(:,1)==coorddum(1)) + double(mni_coords(:,2)==coorddum(2)) + double(mni_coords(:,3)==coorddum(3))) == 3); %finding old ID coordinates (from leadfield) corresponding to new IDs coordinates (image MNI152_8mm_coord_dyi.nii.gz)
  352. MNI_sorted_index(ii,1) = source; %storing correspondance between MNI8 and mni_coords
  353. end
  354. L2 = L(MNI_sorted_index); %sorting leadfield model (selected MEG channels only)
  355. Ltot2 = Ltot(MNI_sorted_index); %sorting leadfield model (all MEG channels)
  356. pos2 = pos(MNI_sorted_index,:); %sorting coordinates of brain sources for later plotting purposes
  357. %storing outputs
  358. OUT.L = L2; %leadfield model only for requested MEG channels (either magnetometers or gradiometers)
  359. OUT.Ltot = Ltot2; %all MEG channels leadfield model (useful for later plotting purposes)
  360. OUT.pos_brainsources_MNI8 = pos2; %position of coordinates
  361. OUT.vol = vol; %volume conduction model (vol) from FieldTrip
  362. OUT.sens = sens; %information about MEG channels
  363. OUT.transforms = BF.data.transforms; %transform matrix from and to MNI and native
  364. OUT.IDXMAG = IDXMAG; %storing magnetometers indices
  365. OUT.IDXGRAD = IDXGRAD; %storing gradiometers indices
  366. %%% 3) COMPUTING SPATIAL FILTERS
  367. disp('extracting MEG sensors data for covariance estimation')
  368. conditions = S.inversion.conditions;
  369. %%% EXTRACTING MEG SENSORS DATA FOR COVARIANCE ESTIMATION
  370. % disp('extracting MEG sensors data')
  371. %loading and extracting data (z-scored normalized data)
  372. if S.norm_megsensors.zscorel_cov == 1 %this is just to make sure to properly work on normalized or non-normalized MEG data
  373. Dc = spm_eeg_load([workdir '/Clone' fname ext]);
  374. else
  375. warning('you are computing covariance matrix on MEG sensors which are not zscore-normalized.. so you should expect much stronger contribution of magnetometers than gradiometers in the reconstructed signal')
  376. warning('please, note that even if you use only magnetometers or gradiometers, I still suggest you to zscore-normalize the data for covariance matrix computation')
  377. if exist('Dfilte','var')
  378. Dc = Dfilte; %getting filtered file, if you previously computed it
  379. else %otherwise original epoched data provided by the user
  380. Dc = spm_eeg_load(S.norm_megsensors.MEGdata_e);
  381. end
  382. end
  383. % Dc = spm_eeg_load([workdir '/Clone' fname ext]);
  384. if isempty(S.inversion.timef)
  385. warning('timef was not specified, so working on full length of the epoch.. you may want to check whether you need a subset of the time-window or the full epoch..')
  386. timef = 1:size(D,2);
  387. else
  388. timef = S.inversion.timef;
  389. end
  390. %getting indices of conditions
  391. condcat = [];
  392. for ii = 1:length(conditions) %over condition labels
  393. condcat = cat(2,condcat,find(strcmp((Dc.conditions),conditions{ii}))); %getting the condition numbers ordered according to the specification of the user (concatenated together since the covariance matrix is computed on all experimental conditions trials)
  394. end
  395. %extracting data (only MEG sensors and first timef time-points)
  396. %previous
  397. % idxMEGc1 = find(strcmp(Dc.chanlabels,'MEG0111')); %getting extreme channel index (first MEG channel, then I add 305 to get them all)
  398. % if isempty(idxMEGc1)
  399. % warning('there is no channel named MEG0111, is your data from Elekta-Neuromag?')
  400. % warning('trying to load MEG 0111, in case it is simply a problem of labels..')
  401. % idxMEGc1 = find(strcmp(Dc.chanlabels,'MEG 0111')); %getting extreme channel index (first MEG channel, then I add 305 to get them all)
  402. % end
  403. %new
  404. % idxMEGc1 = find(strcmp(Dc.chanlabels,'MEG0111')); %getting extreme channel index (first MEG channel, then I add 305 to get them all)
  405. idxMEGc1 = find(~cellfun(@isempty,strfind(Dc.chanlabels,'MEG'))); %elaborated way to get indices of MEG channels (even though I am mainly interested in the first MEG channel index)
  406. % chans = Dc.chanlabels(idxMEGc1:idxMEGc1+305); %extracting labels for MEG channels
  407. if S.beamfilters.sensl == 1 %magnetometers
  408. %previous
  409. % datameg = Dc(idxMEGc1:3:idxMEGc1+305,timef,condcat); %data
  410. %new
  411. datameg = Dc(idxMEGc1(1)-1 + IDXMAG,timef,condcat); %mag indices previously computed, here adding idxMEGc1(1), in case you have other channels before MEG channels; here I assume that once you have the first MEG channel then you have all the other ones, without any interruption
  412. elseif sensl == 2 %gradiometers
  413. %this solution would be better.. here and in general..
  414. %gradi = sort(cat(2,[2:3:306],[3:3:306])); magi = 1:3:306;
  415. %datameg = Dc(idxMEGc1+gradi,timef,condcat);
  416. %primitive codes.. previous
  417. % datameg = zeros(204,length(timef),length(condcat));
  418. % datameg(1:2:204,:,1:length(condcat)) = Dc(idxMEGc1+1:3:idxMEGc1+305,timef,condcat); %data
  419. % datameg(2:2:204,:,1:length(condcat)) = Dc(idxMEGc1+2:3:idxMEGc1+305,timef,condcat); %data
  420. %new
  421. datameg = Dc(idxMEGc1(1)-1 + IDXGRAD,timef,condcat); %mag indices previously computed, here adding idxMEGc1(1), in case you have other channels before MEG channels; here I assume that once you have the first MEG channel then you have all the other ones, without any interruption
  422. else
  423. datameg = Dc(idxMEGc1,timef,condcat); %data
  424. end
  425. time = Dc.time(timef);
  426. OUT.time = time; %storing time for later purposes
  427. disp('computing spatial filters')
  428. %YOU MAY CONSIDER TO TRY ALSO WITH COVARIANCE OVER TRIALS INSTEAD THAT OVER TIME.. BUT THIS IS MORE EXPERIMENTAL AND I WOULD DO THAT LATER..)
  429. %please, note that you compute the covariance matrix on the same (amount of) data that you want to invert later
  430. %THE SOLUTION BELOW (meancovl = 1 or meancovl = 3) SEEMS TO PROVIDE ALMOST THE SAME RESULTS (COVARIANCE OF CONCATENATED TRIALS SHOULD BE BETTER IN PRINCIPLE AND IT IS ALSO SLIGHTLY FASTER TO COMPUTE)
  431. %conversely, as expected, meancovl = 2 is not fine
  432. %I do not delete this since it may be useful to read it later on
  433. % meancovl = 3; %THIS SHOULD BE = 3
  434. % if meancovl == 1 %mean of trials covariance
  435. % Ct = zeros(size(datameg,1),size(datameg,1),size(datameg,3));
  436. % Cinvt = zeros(size(datameg,1),size(datameg,1),size(datameg,3));
  437. % for cc = 1:size(datameg,3) %over trials
  438. % Ct(:,:,cc) = cov(datameg(:,:,cc)'); %computing covariance matrix (time-sample x MEG channels, so covariance of MEG channels according to Matlab cov function)
  439. % Cinvt(:,:,cc) = pinv_plus(Ct(:,:,cc),50); %Mark Woolrich inv; 50 is the pca_dim related to Maxfilter computation (which makes the matrix of the data with a rank = 50)
  440. % end
  441. % C = mean(Ct,3); %mean over trials covariance
  442. % Cinv = mean(Cinvt,3); %mean over inv of trials coavariance
  443. % elseif meancovl == 2 %covariance calculated over mean of the trials
  444. % C = cov(ERFmean');
  445. % Cinv = pinv_plus(C,50); %Mark Woolrich inv; 50 is the pca_dim related to Maxfilter computation (which makes the matrix of the data with a rank = 50)
  446. % elseif meancovl == 3
  447. %computing covariance between MEG sensors (trials concatenated)
  448. datacov = reshape(datameg,size(datameg,1),size(datameg,2)*size(datameg,3))'; %data was extracted from SPM object previously loaded (2 sections above)
  449. C = cov(datacov); %computing covariance matrix (time-sample x MEG channels, so covariance of MEG channels according to Matlab cov function)
  450. Cinv = pinv_plus(C,50); %Mark Woolrich inv; 50 is the pca_dim related to Maxfilter computation (which makes the matrix of the data with a rank = 50)
  451. %this function uses at most X (in this case 50) PCs to estimate inverted matrix; in this case 50 should stabilize the computation of pinv
  452. % end
  453. W = cell(1,length(L2)); %initializing spatial filters
  454. WW = zeros(length(L2),size(L2{1},1));
  455. %computing the spatial filters (independently for each MEG source)
  456. for ii = 1:length(L2) %over brain sources
  457. llf = L2{ii}; %extracting brain source ii
  458. %combining dipole orientations
  459. tmp = llf' * Cinv * llf; %temporary estimation of covariance between sources
  460. nn = size(llf,2); %number of orientations
  461. [u, ~] = svd(real(pinv_plus(tmp(1:nn,1:nn),2,0)),'econ'); %single value decomposition, code from Mark Woolrich and Robert Oostenveld; (2 would be equal to the "reduce_rank" variable..)
  462. eta = u(:,1);
  463. llf = llf * eta; %actual reduction of the 3 orientations to 1 global vector
  464. %compuation of weights
  465. W{ii} = pinv_plus(llf' * Cinv * llf,2,0) * llf' * Cinv; %actual computation of spatial filter (Mark Woolrich pinv); I guess equivalent to: W{ii} = pinv_plus(llf' * Cinv * llf) * llf' * Cinv; pinv_plus(data,2,0) should not use 2 as maximum number of PCs.. anyway, I reproduce previous codes here..
  466. W{ii} = W{ii}./sqrt(W{ii}*W{ii}'); %applying a weight normalization to counterbalance the bias towards the centre of the head, as suggested by Woolrich, Huang, Van Veen
  467. % W{ii} = pinv(llf' * Cinv * llf) * llf' * Cinv; %actual computation of spatial filter
  468. WW(ii,:) = W{ii}(1,:);
  469. % disp(['computing spatial filters.. source: ' num2str(ii) ' / ' num2str(length(L2))])
  470. end
  471. %plotting images of filters (with weight normalisation)
  472. figure
  473. imagesc(WW)
  474. colorbar
  475. %storing output
  476. OUT.W = W;
  477. %%%%% III - FULL INVERSION %%%%%
  478. disp('%%%%% III - FULL INVERSION %%%%%')
  479. %%% EXTRACTING MEG SENSORS DATA
  480. disp('extracting MEG sensors data for actual inversion')
  481. %loading and extracting data
  482. if S.inversion.znorml == 1
  483. %z-scored normalized data
  484. Dc = spm_eeg_load([workdir '/Clone' fname ext]);
  485. else
  486. %original data (non-normalized)
  487. if exist('Dfilte','var')
  488. Dc = Dfilte; %getting filtered file, if you previously computed it
  489. else %otherwise epoched data provided by the user
  490. Dc = spm_eeg_load(S.norm_megsensors.MEGdata_e);
  491. end
  492. end
  493. %previous codes
  494. %extracting data (only MEG sensors and first timef time-points)
  495. % idxMEGc1 = find(strcmp(Dc.chanlabels,'MEG0111')); %getting extreme channel index (first MEG channel, then I add 305 to get them all)
  496. % if isempty(idxMEGc1)
  497. % warning('there is no channel named MEG0111, is your data from Elekta-Neuromag?')
  498. % warning('trying to load MEG 0111, in case it is simply a problem of labels..')
  499. % idxMEGc1 = find(strcmp(Dc.chanlabels,'MEG 0111')); %getting extreme channel index (first MEG channel, then I add 305 to get them all)
  500. % end
  501. % % chans = Dc.chanlabels(idxMEGc1:idxMEGc1+305); %extracting labels for MEG channels
  502. % if S.beamfilters.sensl == 1 %magnetometers
  503. % datameg = Dc(idxMEGc1:3:idxMEGc1+305,timef,:); %data
  504. % elseif sensl == 2 %gradiometers
  505. % datameg = zeros(204,length(timef),size(Dc,3));
  506. % datameg(1:2:204,:,:) = Dc(idxMEGc1+1:3:idxMEGc1+305,timef,:); %data
  507. % datameg(2:2:204,:,:) = Dc(idxMEGc1+2:3:idxMEGc1+305,timef,:); %data
  508. % else
  509. % datameg = Dc(idxMEGc1:idxMEGc1+305,timef,:); %data
  510. % end
  511. %new codes
  512. idxMEGc1 = find(~cellfun(@isempty,strfind(Dc.chanlabels,'MEG'))); %elaborated way to get indices of MEG channels (even though I am mainly interested in the first MEG channel index)
  513. if S.beamfilters.sensl == 1 %magnetometers
  514. datameg = Dc(idxMEGc1(1)-1 + IDXMAG,timef,:); %mag indices previously computed, here adding idxMEGc1(1), in case you have other channels before MEG channels; here I assume that once you have the first MEG channel then you have all the other ones, without any interruption
  515. elseif sensl == 2 %gradiometers
  516. datameg = Dc(idxMEGc1(1)-1 + IDXGRAD,timef,:); %mag indices previously computed, here adding idxMEGc1(1), in case you have other channels before MEG channels; here I assume that once you have the first MEG channel then you have all the other ones, without any interruption
  517. else
  518. datameg = Dc(idxMEGc1,timef,:); %data
  519. end
  520. time = Dc.time(timef);
  521. %getting indices of conditions (Old_Correct and New_Correct)
  522. conds = cell(1,length(conditions));
  523. for ii = 1:length(conditions) %over condition labels
  524. conds{ii} = find(strcmp((Dc.conditions),conditions{ii})); %getting the condition numbers ordered according to the specification of the user in S.conditions (sum to avoid the problem of zero-vector occurring if it does not find the match between the specified label and the data label.. of course if you specify two times the same label in the structure S it crashes as well.. but you would need to be quite peculiar to do that so I assume you will not do that..)
  525. end
  526. %meanll = 1 or = 0 seem to return very similar (almost identical) results; this is slightly surprising, I would expect similar but not almost identical results.. anyway.. the procedure seems correct, so I'll just live with it..
  527. % meanll = 1; % (SUGGESTED 1!) 1 for source reconstruction of mean over trials; 0 for mean over single-trials source reconstruction
  528. %I did not delete these lines since it may useful to read this information in the future
  529. % if meanll == 1 %mean over trials and then source reconstruction
  530. %computing mean of ERFs (consider to compute also median later..)
  531. if S.inversion.effects == 6 %custom data provided by the user
  532. ERFs = cell(1,size(S.inversion.alternative_data,3));
  533. for ii = 1:size(S.inversion.alternative_data{1},3) %over 3rd dimension of the custom data (which is supposed to be the new "condition")
  534. dumdim = S.inversion.alternative_data{1}; %extracting the data
  535. ERFs{ii} = dumdim(:,:,ii); %placing the data in the required format
  536. conditions = S.inversion.alternative_data{2}; %extrating the new conditions label
  537. end
  538. else
  539. ERFs = cell(1,length(conditions));
  540. for ii = 1:length(conditions) %over experimental conditions
  541. if ~isempty(conds{ii}) %it mis empty if there are is no match between condition requested by user and condition in MEG data (it may happen for a few subjects..)
  542. if S.inversion.effects == 1 %simple mean over trials
  543. ERFs{ii} = mean(datameg(:,:,conds{ii}),3);
  544. elseif S.inversion.effects == 2 %mean divided by st
  545. ERFs{ii} = mean(datameg(:,:,conds{ii}),3) ./ std(datameg(:,:,conds{ii}),0,3);
  546. elseif S.inversion.effects == 3 %mean divided by square root of st
  547. ERFs{ii} = mean(datameg(:,:,conds{ii}),3) ./ sqrt(std(datameg(:,:,conds{ii}),0,3)); %(variation of t-value, dividing mean over trials by their standard error
  548. elseif S.inversion.effects == 4 %mean divided by (st divided by square root of number of trials) (actual t-value..)
  549. ERFs{ii} = mean(datameg(:,:,conds{ii}),3) ./ (std(datameg(:,:,conds{ii}),0,3)./sqrt(length(conds{ii}))); %t-value (sort of), dividing mean over trials by their standard error
  550. elseif S.inversion.effects == 5 %all trials
  551. ERFs{ii} = datameg(:,:,conds{ii});
  552. end
  553. end
  554. end
  555. end
  556. %this should be ok, but a further check could be suggested..
  557. if S.beamfilters.sensl == 3 && S.inversion.znorml ~= 1 && S.inversion.effects ~= 6 %custom data provided by the user
  558. %if you have both MEG sensors and they should be normalized with reference to their overall maximum value
  559. %getting maximum and minimum values experimental conditions together
  560. maxx = zeros(length(conditions),1);
  561. minn = zeros(length(conditions),1);
  562. rmaxx = zeros(length(conditions),1);
  563. rminn = zeros(length(conditions),1);
  564. indg = sort([2:3:306 3:3:306]); %index of gradiometers
  565. for cc = 1:length(conditions) %over conditions
  566. if S.inversion.effects < 5
  567. maxx(cc) = max(max(abs(ERFs{cc}))); %maximum for each conditions (all MEG sensors, so magnetometers..)
  568. minn(cc) = min(min(abs(ERFs{cc}))); %minimum for each condition (all MEG sensors, so magnetometers..)
  569. rmaxx(cc) = max(max(abs(ERFs{cc}(indg,:)))); %maximum for each conditions (only gradiometers)
  570. rminn(cc) = min(min(abs(ERFs{cc}(indg,:)))); %minimum for each condition (only gradiometers)
  571. else
  572. maxx(cc) = max(max(max(abs(ERFs{cc})))); %maximum for each conditions (all MEG sensors, so magnetometers..)
  573. minn(cc) = min(min(min(abs(ERFs{cc})))); %minimum for each condition (all MEG sensors, so magnetometers..)
  574. rmaxx(cc) = max(max(max(abs(ERFs{cc}(indg,:,:))))); %maximum for each conditions (only gradiometers)
  575. rminn(cc) = min(min(min(abs(ERFs{cc}(indg,:,:))))); %minimum for each condition (only gradiometers)
  576. end
  577. end
  578. rmax = max(maxx); %global maximum over all conditions (all MEG sensors, so magnetometers..)
  579. rmin = min(minn); %global minimum over all conditions (all MEG sensors, so magnetometers..)
  580. rmaxg = max(rmaxx); %global maximum over all conditions (only gradiometers)
  581. rming = min(rminn); %global minimum over all conditions (only gradiometers)
  582. for cc = 1:length(conditions) %over conditions
  583. %this should be important since we want the experimental conditions
  584. %to maintain their different relative strengths (if you zscore
  585. %normalized (X-mean(X)./std(X), you should loose their relative
  586. %different strengths.. thus now:
  587. % 1) COVARIANCE MATRIX COMPUTED ON Z-SCORE NORMALIZED MEG DATA
  588. % 2) INVERSION COMPUTED ON MEG DATA SCALED WITH RESPECT TO RELATIVE DIFFERENCES BETWEEN EXPERIMENTAL CONDITIONS
  589. if S.inversion.effects < 5
  590. dumones = ones(size(ERFs{cc},1),size(ERFs{cc},2));
  591. dumones(ERFs{cc}<0) = -1; %getting a matrix with values -1 and 1 according to the original sign in ERFs{cc}
  592. ERFs{cc} = abs(ERFs{cc}); %absolute value
  593. ERFs{cc}(indg,:) = (ERFs{cc}(indg,:)-rming)./(rmaxg-rming).*(rmax-rmin) + rmin; %normalizing gradiometers on the basis of magnetometers (with respect to the conditions different strengths)
  594. ERFs{cc} = ERFs{cc} .* dumones; %assigning the original sign to the data
  595. else
  596. dumones = ones(size(ERFs{cc},1),size(ERFs{cc},2),size(ERFs{cc},3));
  597. dumones(ERFs{cc}<0) = -1; %getting a matrix with values -1 and 1 according to the original sign in ERFs{cc}
  598. ERFs{cc} = abs(ERFs{cc}); %absolute value
  599. ERFs{cc}(indg,:,:) = (ERFs{cc}(indg,:,:)-rming)./(rmaxg-rming).*(rmax-rmin) + rmin; %normalizing gradiometers on the basis of magnetometers (with respect to the conditions different strengths)
  600. ERFs{cc} = ERFs{cc} .* dumones; %assigning the original sign to the data
  601. end
  602. end
  603. end
  604. %until here
  605. disp('computing inversion')
  606. if S.inversion.effects ~= 5 %aggregated trials (e.g. averaged)
  607. sources_ERFs = zeros(length(W),length(time),length(conditions));
  608. for cc = 1:length(conditions) %over conditions
  609. if ~isempty(ERFs{cc}) %if there was no condition cc in MEG data
  610. for ii = 1:length(W) %over spatial filters (brain sources)
  611. for tt = 1:length(time) %over time-points
  612. sources_ERFs(ii,tt,cc) = W{ii} * ERFs{cc}(:,tt); %actual inversion
  613. end
  614. disp(ii)
  615. end
  616. end
  617. end
  618. else %single trials independently
  619. % sources_ERFs = zeros(length(W),length(time),length(conditions));
  620. s_tr_ERFs = cell(length(conditions),1); %there may be a different number of trials in different conditions (e.g. in learningbach-recogminor), so you need to sotre different conditions in cells
  621. for cc = 1:length(conditions) %over conditions
  622. if ~isempty(ERFs{cc}) %if there was no condition cc in MEG data
  623. sources_ERFs = zeros(length(W),length(time),size(ERFs{cc},3));
  624. for ii = 1:length(W) %over spatial filters (brain sources)
  625. for tt = 1:length(time) %over time-points
  626. for rr = 1:size(ERFs{cc},3) %over trials
  627. sources_ERFs(ii,tt,rr) = W{ii} * ERFs{cc}(:,tt,rr); %actual inversion
  628. end
  629. end
  630. disp(['spatial filter ' num2str(ii) ' / ' num2str(length(W)) ' - condition ' num2str(cc) ' / ' num2str(length(conditions))])
  631. end
  632. s_tr_ERFs{cc} = sources_ERFs;
  633. end
  634. end
  635. end
  636. %baseline correction (subtracting mean activity in the baseline)
  637. if ~isempty(S.inversion.bc)
  638. disp('computing baseline correction')
  639. if S.inversion.effects < 5
  640. for cc = 1:length(conditions) %over conditions
  641. if ~isempty(ERFs{cc}) %if there was no condition cc in MEG data
  642. for ii = 1:length(W) %over spatial filters (brain sources)
  643. sources_ERFs(ii,:,cc) = sources_ERFs(ii,:,cc) - mean(sources_ERFs(ii,S.inversion.bc(1):S.inversion.bc(2),cc),2);
  644. end
  645. end
  646. end
  647. else %single trials independently
  648. for cc = 1:length(conditions) %over conditions
  649. if ~isempty(ERFs{cc}) %if there was no condition cc in MEG data
  650. sources_ERFs = s_tr_ERFs{cc};
  651. for ii = 1:length(W) %over spatial filters (brain sources)
  652. for rr = 1:size(s_tr_ERFs{cc},3) %over trials
  653. sources_ERFs(ii,:,rr) = sources_ERFs(ii,:,rr) - mean(sources_ERFs(ii,S.inversion.bc(1):S.inversion.bc(2),rr),2);
  654. end
  655. disp(['baseline correction - condition ' num2str(cc) ' / ' num2str(length(conditions))])
  656. end
  657. s_tr_ERFs{cc} = sources_ERFs;
  658. end
  659. end
  660. end
  661. end
  662. % else %source reconstruction of single-trials and then mean
  663. % %extracting single-trial data
  664. % ERF_Old_st = datameg(:,:,conds{1}); %condition OLD
  665. % ERF_New_st = datameg(:,:,conds{2}); %condition NEW
  666. % sources_OLD = zeros(length(W),length(time));
  667. % sources_NEW = zeros(length(W),length(time));
  668. % for ii = 1:length(W) %over spatial filters (brain sources)
  669. % for tt = 1:length(time) %over time-points
  670. % %OLD condition
  671. % temptr = zeros(size(ERF_Old_st,3),1);
  672. % for rr = 1:size(ERF_Old_st,3) %over trials (OLD)
  673. % temptr(rr,1) = W{ii} * ERF_Old_st(:,tt,rr); %actual inversion
  674. % end
  675. % sources_OLD(ii,tt) = mean(temptr); %mean over trials for source ii and time-point tt
  676. % %NEW condition
  677. % temptr = zeros(size(ERF_New_st,3),1);
  678. % for rr = 1:size(ERF_New_st,3) %over trials (NEW)
  679. % temptr(rr,1) = W{ii} * ERF_New_st(:,tt,rr); %actual inversion
  680. % end
  681. % sources_NEW(ii,tt) = mean(temptr); %mean over trials for source ii and time-point tt
  682. % end
  683. % disp(['source ' num2str(ii) ' / ' num2str(length(W))])
  684. % end
  685. % end
  686. %scatter plotting (to check the distribution of the sources at a specific time-point)
  687. % figure
  688. % scatter(1:length(W),sources_OLD(:,timeselected),'o','r')
  689. % hold on
  690. % scatter(1:length(W),sources_NEW(:,timeselected),'o','b')
  691. %storing outputs
  692. OUT.data_MEG_sensors = ERFs;
  693. if S.inversion.effects < 5
  694. if S.inversion.abs == 1 %absolute values, if requested
  695. sources_ERFs = abs(sources_ERFs);
  696. end
  697. OUT.sources_ERFs = sources_ERFs; %no absolute values
  698. else
  699. if S.inversion.abs == 1 %absolute values, if requested
  700. for cc = 1:length(conditions) %over conditions
  701. s_tr_ERFs{cc} = abs(s_tr_ERFs{cc});
  702. end
  703. end
  704. OUT.sources_ERFs = s_tr_ERFs; %no absolute values
  705. end
  706. %%% MUST BE UPDATED SINCE NOW I GUESS IT WORKS WITH PREVIOUS MNI COORDINATES..
  707. %%%%% IV - SMOOTHING %%%%%
  708. %actual computations
  709. %spatial smoothing
  710. % if S.smoothing.spatsmootl == 1
  711. % disp('%%%%% IV - SMOOTHING %%%%%')
  712. % fwhm = S.smoothing.spat_fwhm; %spatial smoothing parameter
  713. % x1 = S.smoothing.temp_param;
  714. % %spatial smoothing
  715. % %preparing inputs
  716. % disp('computing spatial smoothing')
  717. % ERFs_spat_smooth = zeros(size(sources_ERFs,1),size(sources_ERFs,2),size(sources_ERFs,3));
  718. % for cc = 1:size(sources_ERFs,3) %over conditions
  719. % vol_as_matrix = sources_ERFs(:,:,cc); %data
  720. % %plotting original image
  721. % figure; imagesc(vol_as_matrix); title('original')
  722. % mask_fname = S.beamfilters.maskfname; %path to standard brain mask (MAYBE HERE THE NEW MASK??)
  723. % %actual function
  724. % ERFs_spat_smooth(:,:,cc) = smooth_vol_osl(vol_as_matrix, mask_fname, fwhm);
  725. % %plotting smoothed image
  726. % figure; imagesc(ERFs_spat_smooth(:,:,cc)); title(['spatially smoothed - condition ' S.inversion.conditions{cc}])
  727. % end
  728. % %storing outputs
  729. % OUT.spatial_smoothing = ERFs_spat_smooth;
  730. % sources_ERFs = ERFs_spat_smooth; %assigning spatially smoothed matrix to previously computed "full inversion" matrix since you want the spatially smoothed data to be passed to the next steps (temporally smoothing and printing nifti images)
  731. % else
  732. % OUT.spatial_smoothing = [];
  733. % end
  734. %temporal smoothing
  735. if S.smoothing.tempsmootl == 1 && S.inversion.effects < 5
  736. disp('computing temporal smoothing')
  737. %preparing inputs (same for all experimental conditions)
  738. x2 = 1; %dimension 1 of matrix requested by osl_gauss
  739. x3 = size(sources_ERFs,2); %dimension 2 of matrix requested by osl_gauss
  740. f = fftshift(osl_gauss(x1/(time(2)-time(1)),x2,x3)'); %current_level.time_smooth_std/tres,1,length(datstd))');
  741. for cc = 1:size(sources_ERFs,3) %over conditions
  742. dat = sources_ERFs(:,:,cc); %data (condition cc)
  743. %plotting original image
  744. figure; imagesc(dat); title('original')
  745. ERFs_temp_smooth = zeros(size(sources_ERFs,1),size(sources_ERFs,2),size(sources_ERFs,3));
  746. for ii = 1:size(sources_ERFs,1) %over brain voxels
  747. ERFs_temp_smooth(ii,:,cc) = fftconv(dat(ii,:)',f);
  748. end
  749. %plotting temporally smoothed image
  750. figure; imagesc(ERFs_temp_smooth(:,:,cc)); title(['temporally smoothed - condition ' S.inversion.conditions{cc}])
  751. if ~isempty(S.smoothing.tempplot) %plotting difference between original and temporal smoothed data (only for requested brain voxels)
  752. for pp = 1:length(S.smoothing.tempplot)
  753. figure
  754. plot(dat(S.smoothing.tempplot(pp),:))
  755. hold on
  756. plot(fftconv(dat(S.smoothing.tempplot(pp),:)',f))
  757. end
  758. end
  759. end
  760. %storing output
  761. OUT.ERFs_temp_smooth = ERFs_temp_smooth;
  762. sources_ERFs = ERFs_temp_smooth; %assigning temporally smoothed matrix to previously computed "full inversion" matrix since you want the printing nifti images to be run on temporally (and maybe also spatially) smoothed data
  763. else
  764. OUT.ERFs_temp_smooth = [];
  765. if S.smoothing.tempsmootl == 1 && S.inversion.effects == 5
  766. warning('spatial and temporal smoothing are implemented for averaged ERFs only')
  767. end
  768. end
  769. %%%%% V - PRINTING NIFTI IMAGE(s) %%%%%
  770. if S.nifti == 1
  771. if S.inversion.effects < 5
  772. disp('%%%%% V - PRINTING NIFTI IMAGE(s) %%%%%')
  773. % %getting maximum and minimum values experimental conditions together (used for scaling images)
  774. % maxx = zeros(length(conditions),1);
  775. % minn = zeros(length(conditions),1);
  776. % for cc = 1:length(conditions)
  777. % maxx(cc) = max(max(abs(sources_ERFs(:,:,cc)))); %maximum for each conditions
  778. % minn(cc) = min(min(abs(sources_ERFs(:,:,cc)))); %minimum for each condition
  779. % end
  780. % rmax = max(maxx); %global maximum over all conditions
  781. % rmin = min(minn); %global minimum over all conditions
  782. warning('loading MNI152-T1 8mm brain newly sorted set of coordinates.. remember that if you want a different spatial resolution (e.g. 2mm), you need to create a new mask and update this line of code!!')
  783. maskk = load_nii('/projects/MINDLAB2017_MEG-LearningBach/scripts/Leonardo_FunctionsPhD/External/MNI152_8mm_brain_diy.nii.gz'); %getting the mask for creating the figure
  784. for iii = 1:length(conditions)
  785. fnamenii = [workdir '/' S.out_name '_cond_' conditions{iii} '_norm' num2str(S.inversion.znorml) '_spatsmoot_' num2str(S.smoothing.spatsmootl) '_tempsmoot_' num2str(S.smoothing.tempsmootl) '_abs_' num2str(S.inversion.abs) '.nii.gz']; %path and name of the image to be saved
  786. % %normalization of nifti image
  787. % SO = (abs(sources_ERFs(:,:,iii))-rmin)./(rmax-rmin).*(100-0) + 0; %normalizing according to some scale (e.g. 0-100)
  788. % if S.inversion.abs ~= 1 %absolute values, if requested
  789. % dumones = ones(size(sources_ERFs,1),size(sources_ERFs,2)); %matrix of ones with dimensions of sources_ERFs(:,:,iii)
  790. % dumones(sources_ERFs(:,:,iii)<0) = -1; %getting a matrix with values -1 and 1 according to the original sign in sources_ERFs(:,:,iii)
  791. % SO = SO .* dumones; %rebuilding the original sign of the matrix with scaled values
  792. % end
  793. %without normalization
  794. SO = sources_ERFs(:,:,iii);
  795. %building nifti image
  796. SS = size(maskk.img);
  797. dumimg = zeros(SS(1),SS(2),SS(3),length(time));
  798. for ii = 1:size(sources_ERFs,1) %over brain sources
  799. dum = find(maskk.img == ii); %finding index of sources ii in mask image (MNI152_8mm_brain_diy.nii.gz)
  800. [i1,i2,i3] = ind2sub([SS(1),SS(2),SS(3)],dum); %getting subscript in 3D from index
  801. dumimg(i1,i2,i3,:) = SO(ii,:); %storing values for all time-points in the image matrix
  802. end
  803. nii = make_nii(dumimg,[8 8 8]); %making nifti image from 3D data matrix (and specifying the 8 mm of resolution)
  804. nii.img = dumimg; %storing matrix within image structure
  805. nii.hdr.hist = maskk.hdr.hist; %copying some information from maskk
  806. disp(['saving nifti image - condition ' num2str(iii)])
  807. save_nii(nii,fnamenii); %printing image
  808. end
  809. else
  810. warning('printing nifti images is implemented only for averaged ERFs')
  811. end
  812. end
  813. %saving output on disk
  814. disp('saving results')
  815. %for the future better saving assuming the all files are big
  816. if S.inversion.effects < 5 %normally small(ish) file
  817. save([S.norm_megsensors.workdir '/' S.out_name '_norm' num2str(S.inversion.znorml) '_abs_' num2str(S.inversion.abs) '.mat'],'OUT','-v7.3')
  818. else %single trial data can be way bigger..
  819. save([S.norm_megsensors.workdir '/' S.out_name '_norm' num2str(S.inversion.znorml) '_abs_' num2str(S.inversion.abs) '.mat'],'OUT','-v7.3')
  820. end
  821. %deleting Clone data and variable BF
  822. disp('deleting Clone data, BF and, if any, filtered MEG sensor data')
  823. delete([workdir '/BF_' fname '.mat']) %BF
  824. delete([workdir '/Clone' fname '.mat']) %Clone .mat
  825. delete([workdir '/Clone' fname '.dat']) %Clone .dat
  826. if ~isempty(S.norm_megsensors.freq) %if you have provided a frequency range
  827. delete([workdiroriginal '/' fname(7:end) '.mat']) %deleting the filtered MEG sensor data for saving space on disk (this does not affect the source reconstruction) .mat file
  828. delete([workdiroriginal '/' fname(7:end) '.dat']) %deleting the filtered MEG sensor data for saving space on disk (this does not affect the source reconstruction) .dat file
  829. delete([workdiroriginal '/' fname '.mat']) %epoched data by LBPD .mat
  830. delete([workdiroriginal '/' fname '.dat']) %epoched data by LBPD .dat
  831. end
  832. if S.Aarhus_cluster == 1
  833. OUT = []; %Aarhus cluster usually do not have output like normal Matlab functions, but saves results on disk
  834. end
  835. end

MEG_SR_Beam_LBPD.m at commit 17ce460, under GPL-3.0 · at the source

Overview

Authors: Chiara Malvaso1,2, Gemma Fernández‐Rubio1, Mattia Rosso1, Elisa Serra1,3,4, Vera Rudi1,3,4, Peter Vuust1, Morten L Kringelbach1,3,4, Claudia Testa2, Leonardo Bonetti1,3,4
  1. Center for Music in the Brain, Department of Clinical Medicine, Aarhus University & The Royal Academy of Music, Aarhus/Aalborg, Denmark
  2. Department of Physics and Astronomy, University of Bologna, Bologna, Italy
  3. Centre for Eudaimonia and Human Flourishing, Linacre College, University of Oxford, Oxford, UK
  4. Department of Psychiatry, University of Oxford, Oxford, UK
Institutions: University of Bologna (Italy); Aarhus University (Denmark); Royal Academy of Music (Denmark); Ghent University (Belgium); University of Oxford (United Kingdom)
Journal: Annals of the New York Academy of Sciences, volume 1562, issue 1, article e70349
Dates: received 9 September 2025; accepted 21 May 2026; published online 30 July 2026; in print August 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1111/nyas.70349 · PMID 42529957 · PMCID PMC13419915 · OpenAlex W4412024099
Open access: hybrid, a free copy (OpenAlex)
Status: code verified
Categories: MEG (modality), human (organism), cognitive (subfield)
Methods: Spectral & time-frequency, Connectivity, Statistics, Smoothing, state filtering, decompositions, Machine learning, Preprocessing, fMRI & imaging, Physiology & signal measures
MeSH: Aging*, Auditory Perception*, Brain*, Nerve Net*, Rest*, Acoustic Stimulation, Adolescent, Adult, Aged, Brain Mapping, Female, Humans, Magnetoencephalography, Male, Middle Aged, Young Adult (* major topic)
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Pettit Foundation; Society for Education, Music and Psychology Research (SEMPRE); Nordic Mensa Fund; Lundbeck Foundation (R469-2024-1573); Carlsberg Foundation; Luxembourg National Research Fund (FNR) (17906488); Købmand herman Sallings Fond; Independent Research Fund Denmark (DFF) (10.46540/5253-00003B); Danish National Research Foundation (DNRF117); Aker Scholarship; Danmarks Grundforskningsfond (DNRF117)
Citations: not cited yet (Europe PMC); 82 references in the paper

Abstract

Understanding how brain networks operate across different frequencies during cognitive tasks, and how these dynamics change with age, remains a central challenge in cognitive neuroscience. While previous studies have focused on resting‐state activity and passive listening, less is known about frequency‐specific brain dynamics during event‐related tasks that require active memory engagement. In this study, we extend the recently developed FREQ‐NESS analytical pipeline by adapting it to event‐related task and resting‐state source‐reconstructed magnetoencephalography (MEG) data from 140 healthy participants. This method quantified the variance explained by frequency‐specific brain networks, their spatial organization, and associated time‐resolved power estimates. We found significant effects of age, condition, and their interaction in the variance explained by leading components at 8.6, 10.0, and 20.0 Hz. Older adults exhibited peaks at 8.6 and 10.0 Hz across both rest and task, while younger adults displayed a task‐related reduction, suggesting a different organization of brain networks during memory processing with age. Time–frequency analysis revealed age‐ and condition‐dependent desynchronization in the alpha and beta bands (7.1–22.9 Hz). These findings demonstrate the effectiveness of the adapted FREQ‐NESS pipeline for event‐related tasks and highlight the importance of frequency‐resolved network analysis for characterizing age‐related changes in active auditory memory processing.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repositories

Its files are read in the Code ↔ Paper reader above, with 10 matches between paragraphs and lines of code.

leonardob92/LBPD-1.0

License: GPL-3.0
State: the link answers, verified on 26 September 2026
Evidence: files inventoried
Commit: 17ce460e8036eb77f2d81dc2fa0f24c0a8ecb6b1, 2 June 2025
Languages: MATLAB (166), Java (1)
Size: 201 files, 167 scripts
Software Heritage: not archived
Found in: “Data Availability Statement”
Holds: README, license file
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 26 September 2026: the link answers
  • 26 September 2026: the link answers
168 files

malvasochiara/FREQ-NESS-for-age-related-differences-in-brain-networks-during-auditory-recognition-and-resting

License: MIT
State: the link answers, verified on 26 September 2026
Evidence: files inventoried
Commit: e798c9ff809bda4c6f72d84cde2f9a056dc050ff, 23 April 2026
Languages: MATLAB (12)
Size: 13 files, 12 scripts
Software Heritage: not archived
Found in: “Data Availability Statement”
Holds: license file
Not found: README, CITATION.cff, environment file, tests, continuous integration, documentation
Availability: 1 check, the latest on 26 September 2026: the link answers
  • 26 September 2026: the link answers
13 files

mattiarosso92/frequency-resolved_brain_network_estimation_via_source_separation_freq-ness

License: none: the authors keep all their rights
State: the link answers, verified on 26 September 2026
Evidence: files inventoried
Commit: 49e4b7815a0458e5f7e0e3904e3bf5c9efbd2f90, 9 September 2026
Languages: MATLAB (116), Python (32), Jupyter (1)
Size: 170 files, 149 scripts
Software Heritage: not archived
Found in: “Data Availability Statement”
Holds: README, environment (FREQNESS_Toolbox/python/pyproject.toml), tests, continuous integration, 1 notebook
Not found: license file, CITATION.cff, documentation
Tools: NumPy (31 files), Tools for NIfTI and ANALYZE image (MATLAB) (19 files), Matplotlib (15 files), SciPy (10 files), Statistics and Machine Learning Toolbox (5 files), SPM (4 files), FSL (3 files), OHBA Software Library (OSL) (3 files), NiBabel (2 files), Image Processing Toolbox (1 file)
Availability: 1 check, the latest on 26 September 2026: the link answers
  • 26 September 2026: the link answers
150 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 3 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 328 scripts, each with its path and the digest of its content;
  • 10 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

No dataset and no data link were found in the paper.

Data Availability Statement

The code for the preprocessing is available at the following link: https://github.com/leonardob92/LBPD‐1.0.git (https://github.com/leonardob92/LBPD-1.0.git)

The pipeline for the current study is available at the following link: https://github.com/malvasochiara/FREQ‐NESS‐for‐age‐related‐differences‐in‐brain‐networks‐during‐auditory‐recognition‐and‐resting (https://github.com/malvasochiara/FREQ-NESS-for-age-related-differences-in-brain-networks-during-auditory-recognition-and-resting)

The FREQ‐NESS Toolbox is available at the following link: https://github.com/mattiaRosso92/Frequency‐resolved_brain_network_estimation_via_source_separation_FREQ‐NESS/tree/main/FREQNESS_Toolbox (https://github.com/mattiaRosso92/Frequency-resolved_brain_network_estimation_via_source_separation_FREQ-NESS/tree/main/FREQNESS_Toolbox)

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 3, 28 September 2026

  • Publisher: n/a → Wiley

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 9 authors, 16 MeSH terms, 11 funders, 79 references.

Cite

This paper

Malvaso, C., Fernández‐Rubio, G., Rosso, M., Serra, E., Rudi, V., Vuust, P., Kringelbach, M. L., Testa, C., & Bonetti, L. (2026). FREQ-NESS Reveals Age-Related Differences in Frequency-Resolved Brain Networks During Auditory Recognition and Resting State. Annals of the New York Academy of Sciences, 1562(1), e70349. https://doi.org/10.1111/nyas.70349

BibTeX

@article{malvaso2026freq,
author = {Malvaso, Chiara and Fernández‐Rubio, Gemma and Rosso, Mattia and Serra, Elisa and Rudi, Vera and Vuust, Peter and Kringelbach, Morten L and Testa, Claudia and Bonetti, Leonardo},
title = {{FREQ-NESS Reveals Age-Related Differences in Frequency-Resolved Brain Networks During Auditory Recognition and Resting State}},
journal = {Annals of the New York Academy of Sciences},
year = {2026},
month = aug,
volume = {1562},
number = {1},
pages = {e70349},
publisher = {Wiley},
issn = {0077-8923},
doi = {10.1111/nyas.70349},
url = {https://doi.org/10.1111/nyas.70349},
pmid = {42529957},
pmcid = {PMC13419915}
}

RIS

TY - JOUR
AU - Malvaso, Chiara
AU - Fernández‐Rubio, Gemma
AU - Rosso, Mattia
AU - Serra, Elisa
AU - Rudi, Vera
AU - Vuust, Peter
AU - Kringelbach, Morten L
AU - Testa, Claudia
AU - Bonetti, Leonardo
TI - FREQ-NESS Reveals Age-Related Differences in Frequency-Resolved Brain Networks During Auditory Recognition and Resting State
T2 - Annals of the New York Academy of Sciences
J2 - Ann N Y Acad Sci
PY - 2026
DA - 2026/08/01
VL - 1562
IS - 1
SP - e70349
SN - 0077-8923
PB - Wiley
DO - 10.1111/nyas.70349
UR - https://doi.org/10.1111/nyas.70349
LA - en
ER -

CSL-JSON

{
"id": "10.1111/nyas.70349",
"type": "article-journal",
"title": "FREQ-NESS Reveals Age-Related Differences in Frequency-Resolved Brain Networks During Auditory Recognition and Resting State",
"container-title": "Annals of the New York Academy of Sciences",
"author": [
{
"family": "Malvaso",
"given": "Chiara"
},
{
"family": "Fernández‐Rubio",
"given": "Gemma"
},
{
"family": "Rosso",
"given": "Mattia"
},
{
"family": "Serra",
"given": "Elisa"
},
{
"family": "Rudi",
"given": "Vera"
},
{
"family": "Vuust",
"given": "Peter"
},
{
"family": "Kringelbach",
"given": "Morten L"
},
{
"family": "Testa",
"given": "Claudia"
},
{
"family": "Bonetti",
"given": "Leonardo"
}
],
"container-title-short": "Ann N Y Acad Sci",
"volume": "1562",
"issue": "1",
"page": "e70349",
"DOI": "10.1111/nyas.70349",
"PMID": "42529957",
"PMCID": "PMC13419915",
"ISSN": "0077-8923",
"publisher": "Wiley",
"URL": "https://doi.org/10.1111/nyas.70349",
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
1
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.1007/s00429-025-03012-5 [code]
The neurophysiology of healthy and pathological aging: a comprehensive systematic review
Journal: n/a
In common: MEG, 30 references, 2 authors
[2] doi:10.1002/advs.77857 [code]
Brain Network Dynamics of Local and Global Predictive Processing in Aging.
Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)
In common: OHBA Software Library (OSL), export_fig, Brain Connectivity Toolbox, 9 other tools, cognitive, 19 references, 2 authors
[3] doi:10.1111/nyas.70314 [code]
Neural Oscillatory Dynamics in Joint Action: Dissociable Roles of Entrainment and Beta Modulation in Self-Other Integration.
Journal: Annals of the New York Academy of Sciences
In common: FieldTrip, Signal Processing Toolbox, Statistics and Machine Learning Toolbox, cognitive, 9 references
[4] doi:10.7554/elife.108408 [code]
Frequency and laminar profile of feature-specific visual activity revealed by interleaved EEG-fMRI.
Journal: eLife
In common: Connectome Workbench, Tools for NIfTI and ANALYZE image (MATLAB), FieldTrip, 9 other tools, 2 references
[5] doi:10.1038/s41467-026-73668-y [code]
Convergent and divergent brain-cognition development in early adolescence.
Journal: Nature communications
In common: Connectome Workbench, Tools for NIfTI and ANALYZE image (MATLAB), FieldTrip, 9 other tools, 1 reference
[6] doi:10.1038/s41398-026-04025-2 [code]
Brain energetic landscapes shape state dysregulation in major depressive disorder: a morphological network controllability perspective.
Journal: Translational psychiatry
In common: Brain Connectivity Toolbox, Connectome Workbench, Tools for NIfTI and ANALYZE image (MATLAB), 9 other tools
[7] doi:10.1038/s41467-026-71151-2 [code]
Common and distinct neural correlates of social interaction processing and theory of mind in narratives.
Journal: Nature communications
In common: Brain Connectivity Toolbox, Connectome Workbench, FieldTrip, 9 other tools, cognitive
[8] doi:10.1038/s41467-026-76452-0 [code]
Music evokes shared neural representations of imagined narratives across sensory modalities.
Journal: Nature communications
In common: Connectome Workbench, Tools for NIfTI and ANALYZE image (MATLAB), FieldTrip, 8 other tools, cognitive, 1 reference
[9] doi:10.1038/s41467-026-76011-7 [code]
Human cortex organizes dynamic co-fluctuations along the sensorimotor-association axis.
Journal: Nature communications
In common: Brain Connectivity Toolbox, Connectome Workbench, FieldTrip, 9 other tools
[10] doi:10.1016/j.crmeth.2026.101473 [code]
AmygdalaGo-BOLT for boundary-aware segmentation of the human amygdala.
Journal: Cell reports methods
In common: Brain Connectivity Toolbox, Connectome Workbench, FieldTrip, 9 other tools

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.

Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.