# EPTlib: An Open-Source Extensible Collection of Electric Properties Tomography Techniques
## 3 EPT Techniques
### Gradient-Ept
Considering \(u=\log(\bar{\varepsilon})\) as the unknown, problem (29) can be solved by applying the finite element method (FEM) to the associated Euler equation, here reported in weak form for any test distribution \(v\),  
\[\int_{\Omega}\left(\left(\frac{\partial u}{\partial x}+\mathrm{i}\frac{ \partial u}{\partial y}\right)\left(\frac{\partial v}{\partial x}-\mathrm{i} \frac{\partial v}{\partial y}\right)+\frac{\partial u}{\partial z}\frac{ \partial v}{\partial z}\right)\mathrm{d}V=\int_{\Omega}\left(g_{+,0}\left( \frac{\partial v}{\partial x}-\mathrm{i}\frac{\partial v}{\partial y}\right)+ g_{z,0}\frac{\partial v}{\partial z}\right)\mathrm{d}V\,. \tag{30}\]  
Since it involves only the derivatives of \(u\), this equation has infinitely many solutions amongst which the correct one must be selected by means of a constraint or a regularization term. In the former case, a number of seed points in which the EPs are constrained to assume certain values is introduced [20]. Numerically, this operation is analogous to setting Dirichlet boundary conditions, although in internal isolated points. In the latter case, a regularization term is added to the minimization problem, which becomes [44]  
\[\boxed{\min_{\bar{\varepsilon}}\left(\left\|g_{+}(\bar{\varepsilon})-g_{+0} \right\|_{L^{2}(\Omega)}^{2}+\left\|g_{z}(\bar{\varepsilon})-g_{z,0}\right\|_ {L^{2}(\Omega)}^{2}+\lambda\left\|\log(\bar{\varepsilon}/\bar{\varepsilon}_{0 })\right\|_{L^{2}(\Omega_{0})}^{2}\right)}\,, \tag{31}\]  
with \(\lambda\) the regularization coefficient, \(\bar{\varepsilon}_{0}\) the solution of the local step and \(\Omega_{0}\subset\Omega\) the sub-domain where the regularization is applied. The Euler equation associated to the regularized minimization problem (31) for a generic test function \(v\) is  
\[\cdots+\lambda\int_{\Omega_{0}}uv\,\mathrm{d}V=\cdots+\lambda\int_{\Omega_{0} }\log(\bar{\varepsilon}_{0})v\,\mathrm{d}V\,, \tag{32}\]  
being the omitted parts equal to (30). Since the quality of \(\bar{\varepsilon}_{0}\) is higher in the homogeneous regions, the sub-domain \(\Omega_{0}\) is defined as the union of the voxels where the EPs are almost homogeneous. The region is identified based on the distribution of the gradient magnitude \(G=|g_{+}|^{2}+|g_{z}|^{2}\). Precisely, given a tolerance \(k\), \(\Omega_{0}\) is the union of all and only the voxels where \(G<k\max(G)\). Other definitions of \(\Omega_{0}\) can be found in the literature, like for example definitions based on its extension with respect to the entire computational domain \(\Omega\)[45]. Because of the large number of small linear systems to be solved in the local step and of the large linear system in the global step, gradient-EPT is computationally the most expensive of the presented techniques. The computational burden can be reduced with a two-dimensional approximation of the equations, which can be obtained under the assumption of the longitudinal invariance of the EPs (i.e., \(g_{z}\cong 0\)) and of the reference phase (i.e., \(\partial\varphi_{0}^{+}/\partial z\cong 0\)). In that case, the equation for the local step (28) becomes  
\[\boxed{-\mathrm{i}2\
abla_{xy}B_{1,i}^{+,r}\cdot\
abla_{xy}\varphi_{0}^{+}+ \
abla_{xy}B_{1,i}^{+,r}\cdot(g_{+},-\mathrm{i}g_{+})+B_{1,i}^{+,r}\theta_{xy}^ {+}=\
abla^{2}B_{1,i}^{+,r}}\,, \tag{33}\]with \(\theta^{+}_{xy}=-\omega^{2}\mu_{0}\tilde{\epsilon}+|\
abla_{xy}\varphi^{+}_{0}|^{2 }-\mathrm{i}\
abla^{2}_{xy}\varphi^{+}_{0}+\mathrm{i}\
abla_{xy}\varphi^{+}_{0} \cdot(g_{+},-\mathrm{i}g_{+})\), whereas the global step keeps the same minimization problem (29) without the term relative to \(g_{z}\). _EPTlib_ implements gradient-EPT in the class EPTGradient, which manages the linear systems using the library Eigen 3 and discretizes the Euler Equations (30) and (32) according to a tri-linear FEM whose elements are the image voxels.