EEG leadfield computation - On equidistant elements

The leadfield matrix can be computed on different source spaces in shamo. In this example, we consider a subset of the elements of the region of interest by setting a minimal distance between two potential dipoles.

The first steps are the same as in the previous example.

[ ]:
import logging
import sys

logger = logging.getLogger("shamo")
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(logging.Formatter("[{levelname}] {message}", style="{"))
logger.addHandler(handler)
logger.setLevel(logging.INFO)
[ ]:
from shamo import FEM

model = FEM.load("../../derivatives/fem_from_labels/fem_from_labels.json")
[ ]:
from shamo.eeg import ProbEEGLeadfield

problem = ProbEEGLeadfield()
[ ]:
problem.sigmas.set("scalp", 0.4137)
problem.sigmas.set("gm", 0.4660)
problem.sigmas.set("wm", 0.2126)
[ ]:
problem.reference.add("IZ")
[ ]:
problem.markers.adds(["NZ", "LeftEar", "RightEar"])
[ ]:
problem.rois.add("gm")

Minimal distance definition

To limit the amount of potential dipoles in the output leadfield matrix and thus reduce its size, the minimal distance between two elements can be set.

If it is used, the elements are undersampled by removing the one too close to each other recursively.

[ ]:
problem.min_elems_dist = 0.01
[ ]:
solution = problem.solve("single_ssp-dist", "../../derivatives/eeg_leadfield", model)