First time here? Checkout the FAQ!
0 votes
by (550 points)

Has anyone tried to create and simulate a spherical sensing electrode on top of a 3D/2D substrate?

I'm trying to create a simple 1-mm^3 spherical electrode so I can sense unipolar electrograms from a substrate. What I've tried so far is as follows:

1) Recreating the extracellular potentials tutorial to fit my simulations. Although this gives me an extracellular potential, it is derived from a single point at the bath/tissue border, this does not replicate electrode conductivities and the averaging effect on the signal due to the electrode surface.

2) I defined a spherical region on top of my substrate to represent my electrode and defined isotropic conductivities to simulate an Ag/AgCl electrode. However, openCARP automatically assigns LuoRudy94 on the spherical region and produces its own transmembrane potentials when executed.

Any tips for creating unipolar electrodes to sense extracellular potentials in openCARP? Is this a matter of post-processing phie?

Thanks in advance!


1 Answer

+1 vote
by (17.5k points)
selected by
Best answer
The bath and the electrode should not be part of your intracellular domain. You can find instructions how to split your domain in intra+extra and extra-only in this example

Like this, you can run pseudo-bidomain or bidomain simulations with the electrode included in the extracellular-only part of the mesh.
by (550 points)
edited by
Thank you, Dr. Loewe.

I just had the chance to implement this example in my simulations.

This specific example simulates only discrete points in space to recover phie from. I rewrote the function writeECGgrid as writeEGMgrid as below. I hoped to simulate a 1 mm^3 spherical electrode, but this function gave me 28 discrete points instead, spaced by 0.5, within the bath to view unipolar EGMs.

def writeEGMgrid(dim):
    # centerline
    xCtr = dim[0]/2
    yCtr = dim[1]/2
    z_endo = dim[2] + 0.5

    xtemp = np.linspace((dim[0]/2)-0.5, (dim[0]/2)+0.5, int(((((dim[0]/2)+0.5) - ((dim[0]/2)-0.5))/0.5) + 1))
    ytemp = np.linspace((dim[1]/2)-0.5, (dim[1]/2)+0.5, int(((((dim[1]/2)+0.5) - ((dim[1]/2)-0.5))/0.5) + 1))
    ztemp = np.linspace((dim[2]), (dim[2])+1, int(((((dim[2])+1) - (dim[2])) / 0.5) + 1))

    x, y, z = np.meshgrid(xtemp, ytemp, ztemp)
    elecSpace = np.c_[x.ravel(), y.ravel(), z.ravel()]

    T = spatial.cKDTree(elecSpace)
    centre = np.asarray([xCtr, yCtr, z_endo])
    elecElems = T.query_ball_point(centre,1)

# write a pts file
    elecSpatialPts = np.array([xCtr*1e3, yCtr*1e3, z_endo*1e3])
    for e in elecElems:
        elecSpatialPts = np.vstack((elecSpatialPts,[elecSpace[e][0]*1e3, elecSpace[e][1]*1e3, elecSpace[e][2]*1e3]))

    txt.write(os.path.join(CALLER_DIR, 'egm.pts'), elecSpatialPts)

Besides decreasing the stepsize of my spatial points, how can I simulate a solid sphere 1 mm^3? I also imagine I must postprocess these EGMs in Matlab, take their average to get a representative unipolar EGM from a solid spherical electrode. Is this correct?
by (17.5k points)
You can either do
 - Phi_e recovery to simulate point electrodes. These can be located at arbitrary locations and their number can vary. Just as you did with your 28 points above. Later on, you can do postprocessing. Averaging over the volume of the electrode will give you a result closer to an actual solid metal electrode but it's not the same
- a bidomain simulation where the electrode is physically represented by mesh elements with a high conductivity. Computationally more expensive and less flexible (you'll need a full new simulation per electrode location) but more accurate, especially for big electrodes.
- a pseduo bidomain simulation (more flexible, computationally cheaper, neglecting effect of metal on activation). See here for more details:

The Phi_e recovery and pseudo domain use cases are covered in the example referenced above:
Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance