1 Introduction

In recent years, the future vision of precision cardiology through digital twinning has gained traction [1, 2]. In such scenarios, a digital replica of a patient’s heart is generated from a variety of measurements in the clinic. Such replica can be used in a multitude of ways, from predicting intervention outcomes to building cohorts for augmented drug trials. However, building such cardiac digital twins faces several difficulties, such as dealing with noisy measurements, or the problem of having multiple possible parametrizations explaining the encountered measurements, mathematically known as ill-posedness [3].

The fiber distribution in the heart is a key determinant of cardiac function and, as such, it has a prominent role in digital twinning [4]. The electrical stimulus activating the myocardium travels at different speeds, depending on whether the propagation occurs along or across the fibers [5]. More precisely, the electrical conduction within the myocardium is anisotropic, because the electrical propagation is faster in the direction of the fibers. There are multiple determinants of anisotropic conduction, and some may uncover a pathological condition [6]. Therefore, an imprecise knowledge of the anisotropic conduction in digital twinning may yield wrong predictions or even non-physiological behaviors.

In patient-specific models, cardiac fibers are generally arranged following some rules, dictated by prior histological knowledge on their distribution in the heart [4, 7]. These algorithms are well established for the ventricles [8]. More recently, some rule-based methods and atlas-based for the atria have also been proposed [9,10,11,12,13]. In all cases, the fiber field is anatomically-tailored, but technically speaking not yet patient-specific. Diffusion-Tensor Magnetic Resonance (DT-MR) imaging of the heart, the gold-standard tool for sub-millimeter imaging of cardiac fibers [14,15,16], is unfortunately not feasible in-vivo for the atrial wall.

A clinically viable way to infer the local fiber direction is based on the conductivity properties of the tissue. Clinically, the conduction velocity (CV) can be indirectly determined with an electroanatomical mapping system [17, 18], a minimally invasive, catheter-based tool to record the local activation of the endocardial wall. Electroanatomical maps are common in clinical electrophysiology, because they are routinely acquired before ablation therapy, and are relatively easy to export in text format for further inspection. By comparing the local CV obtained from multiple maps, it is therefore possible to derive the direction of fastest conduction, that is the fiber direction [19].

In this work, we similarly aim at determining the fibers from multiple maps. Rather than working locally, we solve an inverse problem where the conductivity tensor can be deduced from the activation map through a propagation model, namely the eikonal equation [20, 21]. This formulation has a number of advantages. First, as the fiber field is recovered, we simultaneously fit a predictive model that, in principle, can faithfully reproduce the observed activations. Second, the model can extrapolate, in a physiological manner, the activation map in regions where data are scarce or absent [22]. Third, the inverse problem can be easily informed by prior histological knowledge on the fiber distribution through a regularization term or, more generally, a Bayesian approach, for instance using rule-based fiber fields [13]. Therefore, the fiber field could be extrapolated as well in a consistent and physiological manner.

Physics-informed neural networks (PINNs) are a recently developed variant of machine learning-based methods to efficiently solve inverse problems that are governed by partial differential equations [23]. They have been shown to accurately model complex physical problems with a small number of known data points. Unlike regular neural networks which typically require vast amounts of labeled data to make accurate predictions, PINNs can learn much quicker to simulate this kind of system due to the incorporation of physical laws—represented as systems of partial differential equations—into their loss functions. Moreover, PINNs are a genuinely mesh-free method, overcoming the issue of generating meshes of complex domains like the heart. In fact, the model and data are penalized at collocation and data points, respectively, while neural networks representing the quantities of interests can be evaluated at any spatial location. Thus, no topological information from the geometrical model is required.

In this work, we propose FiberNet, a PINN-based method to solve the inverse problem of identifying fibers in the heart from electroanatomical maps (Fig. 1). This is achieved by simultaneously fitting multiple neural networks to multiple electroanatomical maps while using a common network that predicts the conduction velocity tensor at different locations. In this sense, FiberNet extends our previous work on the same problem [21, 22, 24], which only used a single activation map and was based on a different representation of the conductivity tensor. We extensively validate FiberNet with several numerical experiments and real data. The first set of experiments consists of a completely synthetic example with a 2-D planar geometry and a 3-D atrial geometry, where we compare the single- and multi-map approaches. Second, we apply FiberNet to an atlas of diffusion tensor image fiber fields of human atria [25]. Here, the ground-truth activation times are generated with the Fast Iterative Method (FIM) simulation for triangular surfaces [26, 27]. Moreover, we validate the predictive capabilities of FiberNet by first fitting the fibers on training maps, and then generating an unseen map and attempting to predict it using the learned fibers. Finally, we apply FiberNet to clinically obtained EAMs of the left atrium, thus proving the feasibility of the approach in the clinical setting.

Fig. 1
figure 1

FiberNet translates a set of electroanatomical maps into a continuous estimate of the fiber field and conduction velocity. These estimates can be used for simulating cardiac activation in a predictive model based on the eikonal equation. Internally, FiberNet uses physics-informed neural networks to constrain the parameter space during the training phase

This paper is structured as follows. In Sect. 2, we review some of the existing methods to estimate the conduction velocity from sparse activation recordings, a highly relevant topic for this work. FiberNet is introduced in Sect. 3, along with the PINN framework. The identifiability of the fibers from single and multiple maps and the role of the regularization are discussed in Sect. 3.3. The last part of our work is devoted to numerical validation and applications. In Sect. 4, we verify the robustness to noise of FiberNet in a synthetic 2-D example and on a 3-D atrial geometry. An extensive benchmark with a publicly available atrial fiber atlas [12, 25] is given in Sect. 5. Finally, in Sect. 6, we apply FiberNet to a clinical data set. A discussion and outlook are provided in Sect. 7.

2 Related works

The problem of identifying cardiac fibers from electrical data of atrial activation has been considered only very recently, see e.g. [19, 21, 22, 24]. More broadly, however, the topic is related to the identification of the local conduction velocity (CV) of the tissue, for which several methods have been proposed thus far. In this section, we briefly review the most common approaches. We group them into two categories: data-driven and physics-driven methods. In the former, the CV is directly estimated from the data through either geometrical or statistical arguments; in the latter, the conduction parameters of a cardiac model are fitted to the data; hence, the CV is a byproduct of the forward model.

2.1 Data-driven methods

Trivially, the CV is the ratio between the distance traveled by an activation front in a given amount of time. The activation time can be detected from local electrograms obtained with contact mapping systems. The location of the electrodes on the catheter is also tracked with good accuracy. Therefore, with sufficient coverage of the atrial surface, it is possible to estimate the local CV in a purely data-driven manner, with no prior assumption on the underpinning physiology.

A first class of methods estimates the local CV \(\theta (\varvec{x}{})\) at some given location \(\varvec{x}{}\) on the basis of the temporal differences in activation between \(\varvec{x}{}\) and its neighbors [17, 28,29,30,31]. These methods are easy to implement and very fast to execute. Here, the main challenge is dealing with noise and inconsistency in the data. Both the location and activation time are subject to noise, hence their incremental ratio, the CV, is greatly susceptible to large variations due to uncertainty. In this scenario, least-squares approaches [29, 30] may perform better than purely geometric methods [17, 28]. Nonetheless, a careful pre-processing of the input data is always necessary, to avoid unrealistically fast or slow CVs [17, 32]. In some cases, very high CVs may actually be due to physiological phenomena, such as breakthroughs and front collisions where, however, the CV is not well-defined.

Rather than estimating the CV from point-wise measurements, other authors suggested to first interpolate or recover a smooth activation map from the data, say \({\tilde{\phi }}(\varvec{x}{})\), and then compute the conduction velocity from its definition, that is

$$\begin{aligned} \theta (\varvec{x}{})=\Vert \nabla {\tilde{\phi }}\Vert ^{-1}. \end{aligned}$$
(1)

This has been recently done with Gaussian Process Regression (GPR) on manifolds [18]. In GPR, the properties of the kernel (smoothness, correlation length) can be optimized to capture the physics of the problem and reduce generalization error. Furthermore, GPR is probabilistic by nature and enables uncertainty quantification in CV estimates and active learning [33].

Since cardiac conduction is anisotropic [6], the value of \(\theta (\varvec{x}{})\) also depends on the propagation direction \(\varvec{p}{}\). In all previous methods, therefore, the estimated CV depends on the activation map, since \(\varvec{p}{}=\nabla {\tilde{\phi }}(\varvec{x}{})/\Vert \nabla {\tilde{\phi }}(\varvec{x}{})\Vert\). With the use of multiple activation maps, or by accounting for prior knowledge on the fiber distribution, it is actually possible to simultaneously estimate the longitudinal and transverse CV, as recently proposed [19]. In this case, it is tacitly assumed that the CV in the myocardium obeys a Riemannian metric, that is \(\theta (\varvec{x}{},\varvec{p}{}) = \sqrt{\varvec{D}{}(\varvec{x}{})\varvec{p}{}\cdot \varvec{p}{}}\), for some symmetric, positive definite tensor field \(\varvec{D}{}(\varvec{x}{})\). In the 2-dimensional case, as for the atrial surface, the tensor \(\varvec{D}{}(\varvec{x}{})\) is determined by three independent parameters, e.g., the fiber angle and the CV along and across the fibers. Therefore, at least 3 independent activation maps are required to uniquely identify \(\varvec{D}{}\).

Interestingly, from Eq. (1) with \(\theta (\varvec{x}{},\varvec{p}{})\) as above, we recover the anisotropic eikonal equation [20], see also Eq. (3) in Sect. 3.2. Therefore, \(\varvec{D}{}(\varvec{x}{})\) may be recovered by imposing Eq. (1) for multiple activation maps \({\tilde{\phi }}_i(\varvec{x}{})\), \(i=1,\ldots ,M\) at each point \(\varvec{x}{}\) of the surface [19]. The corresponding algebraic system for \(M=3\), however, may have no unique solution. For instance, this may happen when \(\nabla {\tilde{\phi }}_i(\varvec{x}{})\) and \(\nabla {\tilde{\phi }}_j(\varvec{x}{})\), for \(i\ne j\), are parallel at some \(\varvec{x}{}\). Similarly, it may happen that the fitted \(\varvec{D}{}(\varvec{x}{})\) is not positive-definite; hence, there is no physiological solution. An alternative approach, valid for an arbitrary number of maps and always ensuring at least one solution, is based on minimizing the residual

$$\begin{aligned} \sum _{i=1}^M \Bigl ( \sqrt{\varvec{D}{}(\varvec{x}{})\nabla {\tilde{\phi }}_i(\varvec{x}{})\cdot \nabla {\tilde{\phi }}_i(\varvec{x}{})} - 1 \Bigr )^2, \end{aligned}$$
(2)

on the space of parameters defining \(\varvec{D}{}\). It is worth noting that finding \(\varvec{D}{}\) can be understood as a fitting-an-ellipse-to-points problem, for which more robust algorithms are available [34].

Finally, it is worth mentioning that there exist methods for estimating the CV directly from the temporal dynamics of the electrograms, without the need for the activation map [35, 36].

2.2 Physics-driven methods

Data-driven methods may suffer when data are scarce or unevenly distributed, as it often happens with electroanatomical maps. In absence of data, prior physiological knowledge may, however, be enforced to still recover a plausible CV. Physics-driven (or physiology-driven) approaches follow this path. For cardiac electrophysiology, several propagation models can be used to constrain the CV to the activation map. These models can be based on the eikonal equation [21, 22, 24, 33], reaction-diffusion systems [37,38,39], or a multi-fidelity combination thereof [40]. The typical workflow aims at minimizing the observational residual between simulated and recorded activation, by optimizing the (distributed) conductivity parameters of the model. Once the optimal parameters of the model have been obtained, the local CV is trivially computed.

Physics-driven approaches are generally more robust than purely data-driven methods, as they allow one to weigh data fidelity against model fidelity, through a regularization term. More importantly, physics-driven methods potentially provide a predictive model of cardiac electrophysiology; thus, they can be employed in personalized therapeutic approaches [41]. However, they have a significantly higher computational footprint, both in terms of memory and time. Moreover, some other parameters, such as the early activation sites, may potentially influence the CV reconstruction [21]. In this respect, a good trade-off between purely data-driven and physics-driven methods consists in accounting for the physics only weakly [23, 24, 33], for instance through a penalization term in the loss function such as Eq. (2), rather than enforcing the model point-wise. This observation further motivates the method presented below.

3 Methods

3.1 Propagation model

Let \({\mathcal {S}}\subset {\mathbb {R}}^3\) be a smooth orientable surface representing, for instance, the left atrial endocardium. We model cardiac activation with the anisotropic eikonal equation [20]. We do not consider diffusion or curvature correction terms. The eikonal equation models the arrival times \(\phi (\varvec{x}{})\) resulting from the spread of an electric activation wavefront within the myocardium, propagating with direction-dependent CV. The equation reads as follows

$$\begin{aligned} \sqrt{\varvec{D}{}(\varvec{x}{})\nabla \phi (\varvec{x}{})\cdot \nabla \phi (\varvec{x}{})} = 1, \end{aligned}$$
(3)

where \(\varvec{D}{}(\varvec{x}{})\in {\mathbb {R}}^{3\times 3}\) is a symmetric, positive-definite tensor field representing the conductivity. Specifically,

$$\begin{aligned} \theta (\varvec{x}{},\varvec{p}{}) = \sqrt{\varvec{D}{}(\varvec{x}{})\varvec{p}{}\cdot \varvec{p}{}} \end{aligned}$$
(4)

is the conduction velocity in direction \(\varvec{p}{}\).

We define the local fiber direction as the direction of fastest propagation and we denote it by \(\varvec{l}{}(\varvec{x}{})\in {\mathbb {R}}^3\). Since the propagation is constrained on the atrial surface, \(\varvec{l}{}(\varvec{x}{})\) is orthogonal to \(\varvec{n}{}(\varvec{x}{})\), the normal direction of \({\mathcal {S}}\). A generic way to represent \(\varvec{D}{}\) is therefore as follows:

$$\begin{aligned} \varvec{D}{}(\varvec{x}{}) = v_{\mathrm{l}}^2(\varvec{x}{})\,\varvec{l}{}(\varvec{x}{})\otimes \varvec{l}{}(\varvec{x}{}) + v_{\mathrm{t}}^2(\varvec{x}{})\,\varvec{t}{}(\varvec{x}{})\otimes \varvec{t}{}(\varvec{x}{}), \end{aligned}$$
(5)

where \(\varvec{t}{}(\varvec{x}{})\in {\mathbb {R}}^3\) is the transverse vector field, orthogonal to both \(\varvec{l}{}\) and \(\varvec{n}{}\), while \(v_{\mathrm{l}}\) and \(v_{\mathrm{t}}\) are the conduction velocities respectively along \(\varvec{l}{}\) and \(\varvec{t}{}\). We note that the velocity in the normal direction is zero.

Given an orthonormal basis of the tangent space of \({\mathcal {S}}\) at a location \(\varvec{x}{}\), denoted by \(\{ \varvec{v}{}_1(\varvec{x}{}), \varvec{v}{}_2(\varvec{x}{}) \}\), we formulate the fiber and transverse directions as

$$\begin{aligned} \varvec{l}{}(\varvec{x}{})&= \quad \quad a\varvec{v}{}_1(\varvec{x}{})\otimes \varvec{v}{}_1(\varvec{x}{})+\sqrt{1-a^2} \varvec{v}{}_2(\varvec{x}{})\otimes \varvec{v}{}_2(\varvec{x}{}), \end{aligned}$$
(6)
$$\begin{aligned} \varvec{t}{}(\varvec{x}{})&= - \sqrt{1-a^2}\varvec{v}{}_1(\varvec{x}{})\otimes \varvec{v}{}_1(\varvec{x}{})+\quad \quad a\varvec{v}{}_2(\varvec{x}{})\otimes \varvec{v}{}_2(\varvec{x}{}), \end{aligned}$$
(7)

where \(a\in [-1,1]\) is the cosine of the angle between the fiber direction and \(\varvec{v}{}_1(\varvec{x}{})\). While any orthonormal basis on the tangent space would be feasible (even piecewise-constant), later regularization techniques greatly benefit from the smoothness of the basis. We therefore employed the vector heat method [42], implementing parallel transport of vectors on manifolds, to propagate a first initial vector across the entire atrial surface, thus to obtain \(\varvec{v}{}_1(\varvec{x}{})\). The second vector field \(\varvec{v}{}_2(\varvec{x}{})\) is obtained by orthogonalization. See also Appendix 1 and Fig. 11.

In summary, the conductivity tensor is defined by 3 scalar fields,

  • \(a(\varvec{x}{}) \in [-1,1]\), the cosine of the fiber angle in the \(\{ \varvec{v}{}_1, \varvec{v}{}_2 \}\) basis,

  • \(e_1(\varvec{x}{}) :=v_{\mathrm{l}}^2(\varvec{x}{}) \ge 0\), the square of the longitudinal velocity, and

  • \(e_2(\varvec{x}{}) :=v_{\mathrm{t}}^2(\varvec{x}{}) \ge 0\), the square of the transversal velocity.

3.2 Learning fibers from multiple maps

We consider the problem of simultaneously identifying \(a(\varvec{x}{})\), \(e_1(\varvec{x}{})\) and \(e_2(\varvec{x}{})\) from a set of \(M\ge 1\) electroanatomical maps. For convenience, we define

$$\begin{aligned} \varvec{d}{}(\varvec{x}{}) = \bigl [ a(\varvec{x}{}), e_1(\varvec{x}{}), e_2(\varvec{x}{}) \bigr ], \end{aligned}$$

so that the conductivity tensor \(\varvec{D}{}(\varvec{x}{})\), through Eqs. (5)–(7), is a function of \(\varvec{d}{}(\varvec{x}{})\), that is

$$\begin{aligned} \varvec{D}{}(\varvec{x}{}) = \tilde{\varvec{D}{}}\bigl ( \varvec{d}{}(\varvec{x}{}) \bigr ). \end{aligned}$$

We solve the identification problem with the PINN framework, extending our previous work [24]. Here, we approximate each activation map \(\phi _m(\varvec{x}{})\), \(m=1,\ldots ,M\), and the conductivity parameters vector \(\varvec{d}{}(\varvec{x}{})\) with a total number of \(M+1\) artificial neural networks,

$$\begin{aligned} \phi _m(\varvec{x}{})&\approx {\hat{\phi }}_m(\varvec{x}{}) :=\mathrm {NN}(\varvec{x}{};\varvec{\theta }{}_{\phi _m}), \ \ m=1,\ldots ,M\\ \varvec{d}{}(\varvec{x}{})&\approx \hat{\varvec{d}{}}(\varvec{x}{}) :=\mathrm {NN}(\varvec{x}{};\varvec{\theta }{}_D), \end{aligned}$$

where \({\varvec{\theta }{}_{\phi _m}}\) and \(\varvec{\theta }{}_D\) denote the trainable parameters of the networks. The approximated conductivity tensor trivially follows, \(\hat{\varvec{D}{}}(\varvec{x}{}) = \tilde{\varvec{D}{}}\bigl ( \hat{\varvec{d}{}}(\varvec{x}{}) \bigr )\). The output layer of \({\hat{\phi }}_m(\varvec{x}{})\) is the sigmoid function, hence it ranges in [0, 1], whereas for \(\hat{\varvec{d}{}}(\varvec{x}{})\) we consider a sigmoid scaled by a factor \(C > 0\) for \(e_1\) and \(e_2\), and a hyperbolic tangent activation function for the angle a.

Fig. 2
figure 2

Schematic representation of the physics-informed neural networks employed in this work. We use multiple neural networks to represent each of the activation times received for training. We use one neural network to represent the conduction velocity tensor. From here, we can compute the fiber orientation. We train all the networks simultaneously to satisfy the data from the activation time maps and the eikonal equation, which links activation times to conduction velocities

To train our model, we take into consideration the data from the maps, the residual from the eikonal equation, and regularization terms. In Fig. 2 we present a schematic of our approach. We build a loss function that includes all these components, as follows:

$$\begin{aligned} {\mathcal {L}}(\varvec{\theta }{}_\phi , \varvec{\theta }{}_{D}) :={\mathcal {L}}_\mathrm {data} + \alpha _m {\mathcal {L}}_\mathrm {eiko} + \alpha _e {\mathcal {L}}_\mathrm {cv} + \alpha _a {\mathcal {L}}_\mathrm {ang}, \end{aligned}$$
(8)

where \(\alpha _m\), \(\alpha _e\) and \(\alpha _a\) are hyper-parameters. The hyper-parameter \(\alpha _m\) controls the relevance of eikonal equation, while the hyper-parameters \(\alpha _e\) and \(\alpha _a\) control the amount of regularization applied to the conduction velocities and angles, respectively. We also collect all the neural network weights \(\{ \varvec{\theta }{}_{\phi _m} \}_{m=1}^N\) in a single vector \(\varvec{\theta }{}_\phi\).

In detail, we consider a set of data points, denoted by \(\varvec{x}{}_{m,i}\in {\mathcal {S}}\), where \(m=1,\ldots ,M\) indicates the map number, and \(i=1,\ldots ,N_m\) the point number. For each point, we consider a recorded activation time, denoted by \(\phi _m(\varvec{x}{}_{m,i})\). Each activation map is also divided by a factor \(T_\mathrm {max}\), so that the data range in [0, 1]. Furthermore, we have a set of collocation points \(\varvec{y}{}_j \in {\mathcal {S}}\), \(j=1,\ldots ,N_C\), where the eikonal model is enforced. The terms in the loss function are as follows,

$$\begin{aligned} {\mathcal {L}}_\mathrm {data}&= \frac{1}{M} \sum _{m=1}^M \frac{1}{N_m} \sum _{i=1}^{N_m} \left( {\hat{\phi }}(\varvec{x}{}_{m,i}) - \phi (\varvec{x}{}_{m,i})\right) ^2, \\ {\mathcal {L}}_\mathrm {eiko}&= \frac{1}{M N_C} \sum _{m=1}^M\sum _{j=1}^{N_C} \left( T_\mathrm {max} \sqrt{\hat{\varvec{D}{}}(\varvec{y}{}_j) \nabla {\hat{\phi }}_m(\varvec{y}{}_j)\cdot \nabla {\hat{\phi }}_m(\varvec{y}{}_j)} - 1 \right) ^2, \\ {\mathcal {L}}_\mathrm {cv}&= \frac{1}{N_C} \sum _{j=1}^{N_C} \Bigl ( H_{\delta _e}\bigl (\nabla e_1(\varvec{y}{}_j))\bigr ) + H_{\delta _e}\bigl (\nabla e_2(\varvec{y}{}_j))\bigr ) \Bigr ), \\ {\mathcal {L}}_\mathrm {ang}&= \frac{1}{N_C} \sum _{j=1}^{N_C} H_{\delta _a}\bigl (\nabla a(\varvec{y}{}_j)\bigr ). \end{aligned}$$

We note that the eikonal model is not enforced for all \(\varvec{x}{}\in {\mathcal {S}}\), as generally done in PDE-constrained optimization, but rather on a set of collocation points \(\{ \varvec{y}{}_j \}_{j=1}^{N_C}\). In this respect, the method is mesh-free, since there is no need for a triangulation of \({\mathcal {S}}\) to represent the quantities of interest. Moreover, the eikonal equation is never actually solved, an important aspect since we do not have a precise knowledge of the earliest activation sites.

For the regularization terms, we consider the Huber Total Variation function

$$\begin{aligned} H_{\delta }(\varvec{q}{}) = {\left\{ \begin{array}{ll} \frac{1}{2 \delta } \Vert \varvec{q}{}\Vert ^2, &{} \hbox {if} \quad \Vert \varvec{p}{}\Vert \le \delta , \\ \Vert \varvec{q}{}\Vert - \frac{1}{2} \delta , &{} \quad \hbox {otherwise}. \end{array}\right. } \end{aligned}$$
(9)

The Huber total variation penalization is used in this problem as an additional restriction for the minimization because it has been shown to favor piecewise constant solutions [43]. We use a different penalization for the fiber angle and the conduction velocities to be able to have more control over their individual regularity, as shown in Sect. 4.

In summary, we train the neural networks with the loss function (8) to find the weights \(\varvec{\theta }{}_\phi\) and \(\varvec{\theta }{}_D\), with hyper-parameters \(\alpha _m\), \(\alpha _e\), \(\alpha _a\), \(\delta _e\), \(\delta _a\).

3.3 Identifiability

In view of the discussion in Sect. 2.1, multiple activations are required to reconstruct the fiber field. More precisely, at least 3 maps, along with some conditions, are needed to uniquely determine \(\varvec{d}{}(\varvec{x}{})\). We show here that thanks to the proposed regularization mechanisms this is not the case for FiberNet. In fact, we can always obtain an estimate of the fiber field, even from a single map, as done in [24]. However, multiple maps will significantly improve the estimation of the fiber field and the CVs, as we extensively show in Sect. 4.

As an example, let us consider the problem in a 2-D square domain, and suppose that the true conductivity tensor is \(\varvec{D}{}\in {\mathbb {R}}^{2\times 2}\), a symmetric, positive-definite, constant tensor. Here, the fiber direction is the principal eigenvector of \(\varvec{D}{}\). If we start an activation at the origin, the true activation map is as follows:

$$\begin{aligned} \phi (\varvec{x}{}) = \sqrt{\varvec{D}{}^{-1}\varvec{x}{}\cdot \varvec{x}{}}. \end{aligned}$$
(10)

We construct now multiple conductivity tensors yielding the same activation map. We can rewrite the eikonal model as

$$\begin{aligned} \theta (\varvec{x}{},\varvec{p}{})\Vert \nabla \phi (\varvec{x}{})\Vert = 1, \qquad \varvec{p}{} = \frac{\nabla \phi (\varvec{x}{})}{\Vert \nabla \phi (\varvec{x}{})\Vert }, \end{aligned}$$

where \(\theta (\varvec{x}{},\varvec{p}{})\) is the conduction velocity in the propagation direction \(\varvec{p}{}\). Then, as anticipated above, the most trivial choice is:

$$\begin{aligned} \theta _1(\varvec{x}{},\varvec{p}{}) = \sqrt{\varvec{D}{}\varvec{p}{}\cdot \varvec{p}{}}. \end{aligned}$$

We can also reproduce Eq. (10) with an isotropic model but spatially-varying conduction velocity:

$$\begin{aligned} \theta _2(\varvec{x}{},\varvec{p}{}) = \sqrt{\frac{\varvec{D}{}^{-1}\varvec{x}{}\cdot \varvec{x}{}}{\varvec{D}{}^{-1}\varvec{x}{}\cdot \varvec{D}{}^{-1}\varvec{x}{}}}. \end{aligned}$$

Even by enforcing a space-varying anisotropic model,

$$\begin{aligned} \theta _3(\varvec{x}{},\varvec{p}{}) = \sqrt{\tilde{\varvec{D}{}}(\varvec{x}{})\varvec{p}{}\cdot \varvec{p}{}}, \end{aligned}$$

we can still find multiple choices, besides \(\tilde{\varvec{D}{}}(\varvec{x}{})=\varvec{D}{}\). Consider the following transversely isotropic tensor:

$$\begin{aligned} \tilde{\varvec{D}{}}(\varvec{x}{}) = e_2(\varvec{x}{}) \varvec{I}{} + \bigl ( e_1(\varvec{x}{}) - e_2(\varvec{x}{})\bigr )\varvec{l}{}(\varvec{x}{}) \otimes \varvec{l}{}(\varvec{x}{}), \end{aligned}$$

where \(\varvec{l}{}(\varvec{x}{})\) is the fiber direction. After substituting it in the previous expression, we have

$$\begin{aligned} \theta _3(\varvec{x}{},\varvec{p}{}) = \sqrt{e_2(\varvec{x}{}) + \bigl ( e_1(\varvec{x}{}) - e_2(\varvec{x}{})\bigr ) \bigl (\varvec{l}{}(\varvec{x}{})\cdot \varvec{p}{}\bigr )^2}, \end{aligned}$$

thus, by choosing \(\varvec{l}{}\) such that \(\varvec{l}{}(\varvec{x}{}) \cdot \varvec{p}{} = 0\) for all \(\varvec{x}{}\) and \(e_2(\varvec{x}{})=\theta ^2_2(\varvec{x}{})\), we obtain a solution for any choice of \(e_1(\varvec{x}{}) > e_2(\varvec{x}{})\). Alternatively, by taking \(\varvec{l}{}(\varvec{x}{}) = \varvec{p}{}\) and \(e_1(\varvec{x}{})=\theta ^2_2(\varvec{x}{})\), we again have an infinite number of solutions by varying \(e_2(\varvec{x}{}) < e_1(\varvec{x}{})\). Therefore, as expected, a single map is not sufficient to fully qualify the tensor \(\varvec{D}{}\) from an algebraic point of view. See Fig. 3 for a visual example.

Fig. 3
figure 3

Multiple conductivity tensors reproducing the same activation map. The tensor is represented with its eigenvectors rescaled by the eigenvalues. The solution with lowest Huber norm is \(\theta _1(\varvec{x}{},\varvec{p}{})\), which also corresponds to the ground truth

Which fiber field is the learning algorithm going to prefer? Suppose we have a map sampled from Eq. (10) in absence of noise. Then, all the above choices for \(\theta\) cancel the fidelity term and the eikonal penalization term in the loss function, because they faithfully reproduce the true activation map. All these cases are global minima of the loss function (8), at least when no regularization is present. The neural networks would simply interpolate the data, in a least-squares sense. In the presence of regularization, however, the landscape of the loss function differs significantly. In fact, \(\theta _1\) would likely be favored because, being constant in space, it has the smallest Huber norm amongst all possible choices. However, this choice is mostly dictated by the prior assumption encoded by the regularization itself, rather than the data, thus the reconstructed fibers may sensibly differ from the ground truth, especially in the presence of heterogeneity. Therefore, a reliable method for reconstructing the fibers should rely on multiple maps, as proposed in our approach.

4 Numerical assessment

We implemented FiberNet using Tensorflow [44]. For all experiments, we use 4 CPUs of an AMD EPYC 7702 64-Core Processor in parallel for a fixed number of iterations of ADAM [45] with mini-batches and the default hyper-parameters. We ran 4 different sets of experiments: a synthetic 2-dimensional case, a synthetic 3-dimensional case on a patient-derived geometrical model, 7 different cases where the fiber orientations were measured with DT-MR imaging, and one case where 3 different maps were obtained for a patient. For each of these experiments, we report both activation time and fiber orientation error. For the activation times, we report the root mean squared error. We quantify the fiber error as: \(\frac{1}{N_S}\sum _S \arccos {(\varvec{f}{}\cdot \hat{\varvec{f}{}})}\), where \(\varvec{f}{}\) is the ground truth direction of the fibers used to generate data and \(\hat{\varvec{f}{}}\) is the predicted fiber direction, which is obtained as the eigenvector associated of with largest eigenvalue of \(\hat{\varvec{D}{}}\). The data fidelity error is measured as the root mean squared error (RMSE) of \((\phi -{\hat{\phi }})\) of all the surface points. For the case of having multiple maps, the same RMSE measurement is used but the error is of \((\phi _m-{\hat{\phi }}_m), \forall m\). We fix the following hyper-parameters for all these experiments: \(\{\alpha _a:10^{-9},\ \delta _e:10^{-3},\ \delta _a:10^{-3}\}\). The remaining hyper-parameters used in each experiment are specified in each section.

4.1 Synthetic 2D example

For the first set of numerical experiments, we use a flat domain defined as \(\Omega :=[-1,1]\times [-1,1]\) discretized with a regularly spaced grid of \(35\times 35\) points. We generate a triangular mesh with these points. We create synthetic maps by solving the eikonal equation with a fast iterative method [27]. We select 5 earliest activation sites using a random Latin hypercube design, to avoid selecting points that are close and effectively generate the same map. We set the conduction velocity tensors in the domain with a piece-wise constant function:

$$\begin{aligned} \varvec{D}{}(x,y)= {\left\{ \begin{array}{ll} \begin{bmatrix} 1 &{} 0 \\ 0 &{} \frac{1}{2} \end{bmatrix} &{} x + y < 0, \\ \begin{bmatrix} \frac{1}{2} &{} 0 \\ 0 &{} 1 \end{bmatrix} &{} \hbox {otherwise}.\\ \end{array}\right. } \end{aligned}$$
(11)

From the solution, we select 245 points, using a Latin hypercube design, as data to train the physics-informed neural networks. We feed the neural networks with either 1, 2, 3, or 5 of the generated maps. We split data points between maps, such that the total amount of points remains constant. The synthetic fiber orientations and the 5 maps used to train the model are shown in Fig. 4. We set the hyperparameters to \([\alpha _m : 10^{-2},\ \alpha _a:10^{-9},\ \delta _e:10^{-3},\ \delta _a:10^{-3}]\), while for \(\alpha _e\), the regularization of the conduction velocities, we run a sensitivity study between the values \(10^{-9}\) and \(10^{-3}]\). We use 5 hidden layers of 10 neurons for each of the networks that predict \({\hat{\phi }}\) and 5 hidden layers of 5 neurons each to approximate \(\hat{\varvec{D}{}}\). Each network is then trained for 3000 Adam mini-batch iterations with batch-size 32. Each of these tests is repeated 5 times using the same set of activation sites and sample points to quantify the variability of the training process.

Fig. 4
figure 4

Activation times simulated by the runs with median error for hyper-parameters: \(\{\alpha _m:10^{-2},\ \alpha _e:10^{-5},\ \alpha _a:10^{-9},\ \delta _e:10^{-3},\ \delta _a:10^{-3}\}\) for 1, 3 and 5 activation maps and the corresponding estimated conduction velocities (first row). The sampled points used for each run are represented as black circles and the colors are scaled to the 0.0–3.0 range (with white meaning out of range) for the activation time maps and to the range 0\(^\circ\)–90\(^\circ\) for the fiber orientation error in the conduction velocity maps

In Fig. 4, we show the results for a representative case with median error for \(\alpha _e = 10^{-5}\). First, we observe that the quality of the approximation of the activation maps decreases as the number of maps increases since there are fewer data points per map. However, the accuracy in the reconstruction of the maps does not translate into a more precise reconstruction of the fiber field. For instance, when only one map is used, the activation map is near perfectly reconstructed, but we can observe large fiber errors, some of them up to nearly 90\(^\circ\). With 2 maps, the errors are greatly reduced, however, there is a region of large fiber error near the lower right corner. For 3 and 5 maps, the errors are concentrated near the transition in fiber orientation, which is to be expected, as there are not enough data points to clearly define that boundary.

The fiber orientation errors for varying degrees of \(\alpha _e\) are presented in Fig. 5. As shown in the right panel, we observe that for a larger amount of maps, the fiber error is decreased. Nonetheless, the gains from going from 1 to 3 maps are considerably bigger than going from 3 to 5 maps. We also see that the results tend to be more robust to the level of regularization when we feed the model with 3 or 5 maps. The results for 1 and 2 maps show great variability, which reflects the ill-posedness of this inverse problem when less than 3 maps are available.

Fig. 5
figure 5

Left panel: fiber orientation error for \(\alpha _m = 10^{-2}\) and \(\alpha _{a} = 10^{-9}\). Error values of all runs (shaded areas) and averages for 5 runs (solid lines) in 2D case of PINN with 1, 3 & 5 maps as inputs using different values of the \(\alpha _{e}\) conduction velocity total variation penalization weight. Right panel: fiber orientation errors for all regularization values for different number of maps. The solid line represents the mean

4.2 Atrial geometry with rule-based fibers

In this numerical experiment, we consider a patient-specific geometry of the left atrium. Fibers have been semi-automatically assigned from histological in a previous work [46], shown in Fig. 6. The reference longitudinal \(v_{\mathrm{l}}\) and transverse velocity \(v_{\mathrm{t}}\) are respectively set equal to 0.6 m/s and 0.4 m/s. The smooth basis necessary for the cosine of the fiber angle \(a(\varvec{x}{})\) is obtained from the atrial basis provided in Appendix 1 (see also Fig. 11). With the reference conductivity tensor, we generate 5 activation maps using an eikonal solver [27], by pacing at 5 different locations well apart from each other. The first pacing site is randomly placed, whereas the subsequent ones are obtained through the farthest point sampling approach.

We train physics-informed neural networks that are fed either with 1, 3, or 5 maps. We use 870 measurement points that are split between the different cases, such that the total number of points remains constant.The density ranges 9.9 samples/cm\(^2\) when we use 1 map to 1.9 samples/cm\(^2\). We set the hyperparameter to \(\alpha _m=10^{-4}\). We use neural networks of 7 hidden layers with 20 neurons to approximate \({\hat{\phi }}\) and one neural network with 5 hidden layers with 20 neurons each to generate \(\hat{\varvec{D}{}}\). Each network is then trained for 30,000 Adam mini-batch iterations with batch-size 32. We also perform a sensitivity test for the regularization of conduction velocities and vary the parameter \(\alpha _e\) between \(10^{-9}\) and \(10^{-3}\).

Fig. 6
figure 6

Predicted fiber orientations and activation times learned with 1, 3 and 5 maps. We show the results for the run with median error and hyper-parameters \(\{\alpha _m:10^{-4},\ \alpha _e:10^{-5}\}\)

The results of the effect of conduction velocity regularization on the fiber error in this case are presented in Fig. 7. First, we observe that the fiber error is considerably higher when one map is used, compared to the cases with 3 and 5 maps. We see that increasing the regularization tends to decrease the error for all cases. Nonetheless, the case with one map is more sensitive to the amount of regularization applied than the cases of 3 and 5 maps. As in the 2D case, we see that increasing from 1 to 3 maps has a much bigger effect on fiber error than going from 3 to 5. We also note that the variability in the results decreases for all cases compared to the 2D case.

Fig. 7
figure 7

Fiber orientation error for \(\alpha _m = 10^{-4}\) and \(\alpha _{a} = 10^{-9}\). Error values of all runs (shaded area) and averages for 5 runs (solid lines) in 3D atrial geometry case with 1, 3 & 5 maps as inputs using different values of the \(\alpha _{e}\) conduction velocity total variation penalization weight

We show an example of these results with the case of median error and \(\alpha _e= 10^{-5}\) in Fig. 6. In the right column, we can see the ground truth fiber distribution and the five maps fed to the different models. In general, we observe that all the maps are well reconstructed. However, we see regions of large fiber errors when training with one map. We see that the cases trained with 3 and 5 maps tend to concentrate the errors around the zones where there are sharp transitions in fiber directions, such as near the mitral annulus. Other regions of high error for all cases are near the pulmonary veins, which have a circumferential fiber orientation, which is hard to capture, most likely due to a lack of data.

5 Atrial geometries with diffusion tensor fibers

For the next numerical experiment, we obtain fiber distributions for 7 different left atrium geometries from diffusion tensor magnetic resonance imaging [12, 16]. The images were taken ex-vivo with an isotropic resolution of 0.4 mm and mapped to a biatrial mesh (Fig. 8, bottom row). Here, we attempt to learn the endocardial fibers, generating synthetic activation maps by solving the eikonal equation as described in the previous sections with these fibers. We randomly select 1020 points on each of the surfaces and split them between 1, 3, and 5 maps to obtain the activation time data for training. Since the different geometries have different surface areas, this numbers of measurements corresponds to densities that range from 9.06 to 18.68 samples/cm\(^2\) for one map, and 1.81 to 3.73 samples/cm\(^2\) when we used 5 maps. In this experiment, we also test the robustness to noise of our method. We perturb the generated activation maps with Gaussian noise with zero mean and standard deviation of 0.1, 1 and 2 ms. We also include an additional validation step to test the overall performance of the method. We take the predicted and ground truth fibers and generate an additional map that is initiated from an activation site that is different from the maps used for training. Then, we compare these two maps and compute the error. In this way, we quantify how predictive are the learned fibers to model different scenarios, not included in the original dataset. For all cases, we set the hyper-parameters to \(\{\alpha _m:10^{-4},\ \alpha _e:10^{-5}\}\), which are the same used in the previous section.

The results of these experiments are presented in Figs. 8 and 9, and Table 2. In Fig. 8, we show the fiber predictions and errors for the 7 different cases. We first note that the fibers obtained from DT-MR imaging are not smooth, with recurrent abrupt changes in direction. We also note that the approximation of the fibers improves as the number of maps is increased, which can be noted in the Fig. 8, as the high error regions (in yellow) are less frequent for the cases with more maps. This qualitative result is confirmed in Table 2, where the median fiber errors when training with one map range between 24.8\(^\circ\) and 30.2\(^\circ\), and they are decreased to the range of 18.3\(^\circ\) and 23.2\(^\circ\) when training with 3 maps, and the range of 16.2\(^\circ\) and 23.3\(^\circ\) when training with 5 maps. When we add noise to the activation measurements, we observe in the case of 0.1 ms that there is no clear trend, as some of the cases tend to improve and some cases tend to worsen their accuracy. Nonetheless, the variations in fiber errors are small, less than 5\(^\circ\) for all cases. When we add 1 ms of noise, the performance of the method decreases for all cases and the number of maps. The fiber error increases, on average, 13.2\(^\circ\) when training with one map, 12.4\(^\circ\) when training with 3 maps, and 7.5\(^\circ\) when training with 5 maps. When we add 2 ms of noise, the error increases further, on average, to 61.0\(^\circ\) with 1 map, 19.1\(^\circ\) with 3 maps and 13.1\(^\circ\) with 5 maps. We note here that the hyper-parameters used for the noise study where calibrated for a noiseless case with synthetic geometry and fibers. Thus, it is expected that tuning these parameters, especially \(\alpha _m\), which controls the relevance of the eikonal equation, might improve the results. Overall, we see from the trend that for a fixed amount of data points, it is always better to distribute them in different maps, especially in the presence of noise. The decrease in error is much more pronounced when increasing from 1 to 3 maps than when increasing from 3 to maps.

Fig. 8
figure 8

Fiber predictions on diffusion tensor fibers. We show the results for 7 different cases when we trained FiberNet with 1, 3 and 5 maps and no noise in the activation time data. Errors in the cases with noise can be found in Table 2. All the views are anteroposterior

For the validation with an additional map, we observe in Fig. 9 that in general, using the learned fibers can lead to an accurate prediction of an unseen activation pattern. In the left panel, we see an example using 3 maps for the noiseless case. The map created with the predicted fibers is a smoother version of the one created with ground truth fibers, as the original data presented significant spatial variations. For the cases with 0 and 0.1 ms of noise, we see that number of maps used for training does not influence the predictive capabilities of the methods. For the noiseless case, the root mean squared errors in activation time, on average, range from 2.7 ms when training with 5 maps to 4.4 ms when training with one map. However, when we inject 1 ms of noise, these differences are more pronounced, with an average root mean squared errors ranging from 5.4 ms when training with 5 maps to 17.7 ms when training with one map.

Fig. 9
figure 9

Validation of conduction velocity tensor predictions with an additional map. Left panel, an example of one the cases tested, where we create an activation from a point unseen during training. The top row shows posteroanterior views and the bottom row shows anteroposterior views. Right panel, we show a summary of the results of this validation for different number of maps and different levels of noise

6 Patient-specific geometry with multiple maps

In this final section, we report the application of the proposed methodology to a patient-specific case.

6.1 Data acquisition and pre-processing

Data from a single patient who underwent a pulmonary veins isolation (PVI) procedure have been collected at the Institute of Cardiocentro Ticino with oral and written informed consent for the investigation. The study has been performed in compliance with the Declaration of Helsinki. Data consisted of an electrophysiological study of the left atrium (LA) right before and after PVI performed with an electroanatomical mapping system (RHYTHMIA HDx, Boston Scientific, USA) equipped with an ultra-density mapping catheter (INTELLIMAP ORION, Boston Scientific, USA). A total of 3 electroanatomical maps have been acquired before ablation. Each map contained several electrical recordings of the extracellular voltage of the endocardial atrial wall, as summarized in Table 1.

Table 1 Summary of the electroanatomical mapping data of the patient-specific case

Each recording consisted of the 3-D location of the recording electrode and 700 ms of unfiltered electric signal (sampling resolution is 953 Hz). Up to 64 recordings could be collected simultaneously, with only a portion of them in contact with the wall. Unipolar and bipolar electrograms have been automatically aligned in time to the R peak of the surface 12-lead ECG, simultaneously recorded. Pre-processing of the maps consisted in excluding electrograms with (1) low unipolar amplitude (\(<0.05\) mV); (2) poor contact as indicated by the system; (3) inconsistent surface P wave; (4) discrepancy of \(>20\) ms between unipolar and bipolar activation time. The activation time was computed from the unipolar signal as the steepest negative deflection in the signal after the application of zero-phase forward and reverse 4th order Butterworth with a cutoff frequency of 120 Hz. As reported in Table 1, the pre-processing excluded roughly 75% of the points, most of them because of low amplitude. The analysis has been performed with MATLAB version R2021a.

The left atrial anatomy has been obtained from the mapping system. The original triangular mesh has been re-meshed with fTetWild [47] using the default parameters, with a final median edge length of 2.1 mm (5112 points). Finally, the 3-D location of the electrodes was projected onto the atrial surface. It is worth mentioning that the mesh is only required for sampling collocation points and visualization, as by itself the proposed method is mesh-free.

6.2 Results

The pre-processed maps are shown in Fig. 10, the first 3 columns. We apply our method to these 3 maps and predict the fibers. We use the same hyper-parameters as in the previous sections. Although we do not have access to the real fiber orientations and we cannot compute the fiber error, we can check how well we have approximated the activation maps provided. Overall, we obtain the root mean squared error of 2.09 ms on the 3 activation maps. We show the fit for map 1, which is the most complete, in Fig. 10, fourth column, demonstrating an excellent agreement with the measurements, which are shown as discrete points. Finally, in the predicted fibers we observe some of the expected features of the left atrium fibers in Fig. 10, last column. We see that fibers go from the anterior to the posterior region through the atrial roof, and we also observe some regions where the fibers are aligned to the mitral annulus.

Fig. 10
figure 10

Results of patient-specific case. On the first 3 columns, we show the data points acquired colored by activation time, on the fourth column, we show the learned map with the data points on top and on the last column, we show the predicted fiber orientations

7 Concluding remarks

In this work, we present FiberNet, a novel method to estimate the complete conduction velocity tensor from a set of electroanatomical maps. The decomposition of the tensor simultaneously provides a patient-specific estimate of the fiber directions and conduction velocities. We tested our methodology in 2- and 3-dimensional synthetic examples, ex-vivo fibers obtained from DT-MR imaging, and clinical data. Furthermore, we validated our approach by creating an additional map, unseen during training, and we are able to accurately predict the activation pattern. This step shows that the learned conductivity tensors can be used reliably for personalized modeling and digital twinning. From a methodological perspective, we showed that is not possible to estimate the conduction velocity tensors from a single map. In theory, at least 3 different maps are necessary, although having the correct regularization might reduce the error. Each map should provide different propagation directions in the tissue, albeit not necessarily orthogonal. In our numerical experiments, we see that for the same number of measurements, distributing them across different maps reduces the fiber error. Unsurprisingly, the error of estimating each of the maps increases, but this does not affect the accuracy of the fiber estimates.

FiberNet is currently limited to work on surfaces, which is a reasonable approximation for the atria under several circumstances [11]. We plan to extend FiberNet to work with solid bodies and apply it to the ventricles. Transmurally, fibers rotate from an endocardial to an epicardial direction, and these directions may sensibly differ [7]. In these cases, besides histological knowledge, we would require additional data to learn the activation times transmurally, which might come from body surface potentials and prior histological knowledge [7, 8, 13]. Along this line, we are currently using minimally invasive data, which might limit the applicability of our approach. We plan to extend it to work with the surface electrocardiogram, by converting the activation times into extracellular potentials through the forward bidomain model [48,49,50]. Our method takes on the order of 15 min to train. Even though this is an order of magnitude larger than for some of the local methods [17, 19], this is a competitive time to solve an inverse problem [21]. Furthermore, to our knowledge, this is the first global method to estimate conduction velocity tensor from multiple maps. We plan to accelerate the training process by transfer learning [51] and also by incorporating prior knowledge of the fiber distribution in the basis of vectors that we use to locally parametrize the surface. In this way, the functions that are approximated by the neural network are simpler and can be learned in fewer training steps due to spectral bias [52]. FiberNet cannot be applied during AF in its current formulation, because it assumes that all data points for a single map are from the same beat or, at least from the same activation pattern. However, it could be applied to a patch of tissue covered by the catheter, and it should perform comparably to a local method in estimating the CV. It is worth remarking that during AF, the CV varies beat to beat, due to the restitution properties of the tissue. Finally, FiberNet still needs further validation, especially in its capability to extrapolate activation and fibers, as we only tested it using either known fibers or known activation maps. We plan to study and optimize the performance under noisy conditions to allow the application of this method in the clinical setting. We plan to compare our approach to existing rule-based methods for generating fibers, as recently proposed [10, 13]. In the clinical case, it is unclear whether FiberNet estimated the endocardial fiber orientation, or rather a transmurally homogenized fiber orientation. The results likely depend on the degree of endo-epicardial dissociation [46]. Ideally, we will acquire data from an animal model where we could obtain electroanatomical maps and ex-vivo fiber orientations either from histological measurements or diffusion tensor imaging [53].

FiberNet is a new step in the road of personalized medicine. We hope this method will aid the creation of patient-specific models for accurate diagnosis and procedure planning.