Minimum-norm estimates model the activity as many dipoles on the cortex (the source space) and choose, among all source distributions that explain the data, the one with the smallest overall strength (see the Introduction to Source Imaging). NeuroAnalyzer computes them as MNE-Python does, and gives the same estimates:
inverse_operator(): the parts that do not depend on the data, computed once from the forward solution and the noise covariance: the whitener, the source covariance (depth weighting and orientation prior) and the singular value decomposition of the whitened and weighted lead field (an INVERSE object)
apply_inverse(): the source estimate of the data (a SOURCEESTIMATE object) with one of three methods: the minimum-norm estimate (MNE, current in A·m), dSPM and sLORETA (noise-normalized, unitless)
Data and forward model
The example is the auditory evoked response of the sample recording of MNE-Python (left-ear tones, MEG and EEG), as in the Introduction to Source Imaging: the forward solution of a coarse BEM model (320 triangles per surface) and a cortical source space of the FreeSurfer surfaces of the subject (source_space(): oct5, about 1000 sources per hemisphere; the folder of the subject contains surf/?h.white and surf/?h.sphere), and the averaged response with the noise covariance of the baseline:
Magnetometers (fT), gradiometers (fT/cm) and EEG channels (μV) are combined by whitening with the noise covariance (whitener()): the data and the lead field are converted to units of the noise standard deviation. MEG and EEG are whitened separately, and the directions removed by the projectors carry no noise and are dropped: the rank of the whitened data is the number of channels minus the 3 SSP projectors of the MEG channels and minus 1 for the average reference of the EEG channels:
inverse_operator() uses the defaults of MNE-Python:
loose orientation (loose = 0.2): three dipoles per source, along the normal of the cortex and two tangential directions; the tangential components are weighted by 0.2 (the currents of the cortex flow mainly along the normal); fixed = true: one dipole per source, along the normal; loose = 1: free orientation
depth weighting (depth = 0.8): the minimum-norm estimate favours superficial sources, which explain the data with smaller currents; the sources are weighted by the inverse of the strength of their lead fields (raised to the power 0.8)
EEG average reference: the EEG channels are always average-referenced (in the whitener)
apply_inverse() applies the inverse operator to the averaged response. The regularization λ is 1 / SNR² for the expected signal-to-noise ratio of the data: 1/9 (SNR = 3) for averaged responses. The noise of an average of nave epochs is the noise of single epochs divided by nave: for averaged data (average_epochs()), nave is the number of averaged epochs (here 75), and the dSPM values increase with its square root:
NeuroAnalyzer SOURCEESTIMATE
sources: 2018 (lh, rh), scalar
time points: 421 (-0.2–0.499 s)
measure: dspm
frame: head
The source estimate has one value per source and time point. The largest dSPM value of each hemisphere between 80 and 120 ms (the N100 of the auditory response) is in the auditory cortex of both hemispheres:
tw =findall(t ->0.08<= t <=0.12, stc.time)peaks =Int64[]for (h, hemi) inenumerate(stc.src.spaces) s =findall(==(h), stc.src.space) m =vec(maximum(stc.data[s, 1, tw]; dims =2)) k = s[argmax(m)]push!(peaks, k) t_peak = stc.time[tw[argmax(stc.data[k, 1, tw])]]println(hemi, ": source ", k,", dSPM ", round(maximum(m); digits =1)," at ", round(Int, 1000* t_peak), " ms")end
lh: source 450, dSPM 28.4 at 100 ms
rh: source 1595, dSPM 25.4 at 88 ms
The sources are vertices of the white matter surface of the subject (stc.src.vertices: vertex numbers of ?h.white): each vertex of the surface (about 155000 per hemisphere) gets the value of its nearest source (MNE-Python smooths the values over the surface instead). The dSPM values at the peak of the left hemisphere (seen from the left):
t_peak = tw[argmax(stc.data[peaks[1], 1, tw])]surf_dir =joinpath(bem_dir, "surf")white = NeuroAnalyzer.SURFACE[]inflated = NeuroAnalyzer.SURFACE[]for (h, hemi) inenumerate(("lh", "rh")) w =import_surf(joinpath(surf_dir, "$hemi.white"); tkr =true)# sources of the hemisphere and their positions on the surface s =findall(==(h), stc.src.space) p = w.vertices[stc.src.vertices[s], :]# nearest source of each vertex near = [argmin(vec(sum(abs2, p .- v'; dims =2))) for v ineachrow(w.vertices)] w.values[:dspm] =reshape(stc.data[s[near], 1, t_peak], :, 1)push!(white, w)# inflated surface: the same vertices f =import_inflated(joinpath(surf_dir, "$hemi.inflated")) f.values[:dspm] = w.values[:dspm]push!(inflated, f)endtitle ="dSPM at $(round(Int, 1000* stc.time[t_peak])) ms"plot_surface(white[1]; values =:dspm, cmap =:hot, cb_title ="dSPM", cam = (0, 180), title = title, gui =false)
On the inflated surface (import_inflated()), the activity in the sulci is visible: the auditory cortex is in the Sylvian fissure, on the upper surface of the temporal lobe:
Inverse operators (-inv.fif, make_inverse_operator()) and source estimates (.stc, .w) of MNE-Python are loaded with import_inv() and import_stc(); the source estimates of apply_inverse() are the same as those of MNE-Python (the inverse operators of MNE-Python with a diagonal noise covariance excepted, see import_inv()):
iop =import_inv("sample_audvis-meg-oct-6-meg-inv.fif")stc =apply_inverse(iop, erp; method =:dspm)# a source estimate of MNE-Python, with its source spacestc =import_stc("sample_audvis-meg-lh.stc", iop.src)
Source spaces of MNE-Python with patch information (import_src(): header[:patch_normals]) use the mean normals of the cortical patches of the sources (use_cps of MNE-Python) for the orientations; the source space of this tutorial (source_space()) has no patch information: the normals of the white matter surface at the sources are used.