Optimize electrode placement for brain stimulation
-
Hello all,
I am working on temporal interference on a anatomical model of a human head, with two pairs of electrodes.I would like to run an optimization in order to optimize the placement, on the scalp of the participant, of two pairs of electrodes, in order to maximize the stimulation induced on a specific area of the brain. However, I cannot find a way to have parameters that satisfy my needs, especially the two following:
- the electrodes should move only at the surface of the scalp and not elsewhere
- both pair of electrodes should be considered to optimize stimulation
- TI MAM(x,y,z) should be maximized in a predifined entity
I would be grateful to anyone with ideas on how to tackle that issue.
Thanks in advance!
Best -
Hi,
You could do it with the optimizer/scripting.
Option (1)
For 2 electrode pairs you can create LF multiport simulation (see LF tutorial). In the post-pro you will update the Amp/Phase of the electrodes and use the simulation combiner to extract the TI MAM.
Once you run the simulation once, select the simulation and click on optimize. Switch to the Analysis tab to check if this pipeline is created, click on switch to Expert Mode. Now to include design variables which in your case is the position of the electrode switch to “Model” tab and click on the electrodes, in the controller select “Show Expression” and “Create Expression” . Then switch to Analysis tab and create a pipeline that will look like the following:Option (2)
If you are required to do this, please let me know, I can send you an example script to create a similar pipeline.If you require further help with creating either of these, please email s4l-support@zmt.swiss.
Thanks,
Arjama -
You could try using the Python API. We currently don't expose any functionality to parametrize points on a 3D triangle mesh using e.g. 2D coordinates (a, b).
However, I guess you have following options:
- use a third-party library to parametrize the surface, to give you a mapping from (a,b) to a point (x,y,z) on the surface. Then the optimization would try to optimize (a, b) for each electrode.
- parametrize the skin (outer) surface as a sphere, where (a,b) map to (x,y,z) on the sphere surface. The sphere should share the same center as the head, and have a radius larger than the head. A point (x, y, z) on the sphere can then be projected to the head surface using XCoreModeling.GetEntityPointDistance. This function returns an object, which stores the closest point on the surface, as well as the distance, e.g.,
def project_to_skin(skin: TriangleMesh, point: Vec3) -> Vec3: r = XCoreModeling.GetEntityPointDistance(skin, point) return r.ClosestPosition
-
e.g. something like this
def spherical_parametrization(theta: float, phi: float) -> Vec3 '''Parametrize head skin center and radius computed from head, e.g. using: p1, p2 = XCoreModeling.GetBoundingBox(skin) center = 0.5 * (p1 + p2) radius = 0.51 * (p2-p1).Length() ''' point_on_sphere = center + Vec3(radius * sin(theta) * cos(phi), radius * sin(theta) * sin(phi), radius * cos(theta)) r = XCoreModeling.GetEntityPointDistance(skin, point_on_sphere) return r.ClosestPosition
This should work quite well, except for the concave regions, e.g. behind the ears.