The latest release includes a new function to predict the landmarks needed to place the 10-10-system on the skin: Predict1010SystemLandmarks
The landmarks are the nasion, inion, and left/right pre-auricular points. Sim4Life now can predict these directly from a T1w MRI.
The following script demonstrates the whole process:
from ImageML import Predict1010SystemLandmarks
from s4l_v1.model import Vec3, Import, Create1010System, PlaceElectrodes, CreateSolidCylinder
from s4l_v1.model.image import HeadModelGeneration, ExtractSurface
img = Import(r"D:\datasets\IXI-T1\IXI021-Guys-0703-T1.nii.gz")[0]
# segment head, skip adding dura,
labelfield = HeadModelGeneration([img], output_spacing=0.6, add_dura=False)
# extract surfaces from segmentation
surfaces = ExtractSurface(labelfield)
surfaces_dict = {e.Name: e for e in surfaces}
skin = surfaces_dict["Skin"]
# predict landmarks, the function returns a list of Vertex entities
verts = Predict1010SystemLandmarks(img)
pts = {e.Name: e.Position for e in verts}
eeg1010_group = Create1010System(skin, Nz=pts["Nz"], Iz=pts["Iz"], RPA=pts["RPA"], LPA=pts["LPA"])
eeg1010_dict = {e.Name: e for e in eeg1010_group.Entities}
# create template electrode and place it at C3 position
electrode_template = CreateSolidCylinder(Vec3(0), Vec3(0,0,5), radius=10)
electrodes = PlaceElectrodes([electrode_template], [eeg1010_dict["C3"]])
For the image used in this example, the result looks like this:
4b86e97a-5c74-4e98-8b56-386c0b967ecf-image.png