## 4 Method
### Solver
#### 4.2.2 Minimizing \(\mathbf{u}\)  
As \(\mathbf{v}^{p}\) is pre-fixed, the \(\mathbf{u}^{p}\) estimation can be represented in a quadratic function  
\[\underset{\mathbf{u}}{\mathbf{min}}\ E(\mathbf{u})=\underset{\mathbf{u}}{ \mathbf{min}}\left\{\sum_{p}|\boldsymbol{\psi}_{r}^{p}+\
abla\boldsymbol{\psi }^{p}\cdot\mathbf{u}^{p}|^{2}+\beta_{T}|\mathbf{u}^{p}|^{2}+\beta_{A}|\
abla \mathbf{u}^{p}-\mathbf{v}^{p}|^{2}\right\} \tag{12}\]  
(12) formulates a \(L_{2}\) based minimization. The solution is similar to the method of \(L_{2}\) based optical flow [5]. Setting the gradient of \(E(\mathbf{u})\) to be zero gives a closed solution for (12), which can be expressed as a linear equation  
\[\left(\left[\
abla\boldsymbol{\psi}\right]^{T}\left[\
abla\boldsymbol{\psi} \right]+\beta_{T}\mathbf{E}+\beta_{A}\ \mathbf{L}\right)\cdot\mathbf{u}=\beta_{A}\mathbf{v}-\left[\
abla\boldsymbol{ \psi}\right]^{T}\boldsymbol{\psi}_{r} \tag{13}\]The \(\mathbf{\psi}_{r}\) was computed with \(\mathbf{\psi}_{1}-\mathbf{\psi}_{2}\), where the source and target inputs are denoted by \(\mathbf{\psi}_{1}\) and \(\mathbf{\psi}_{2}\) respectively. The spatial gradient \(\
abla\mathbf{\psi}\) is denoted with the target surface. \(\mathbf{L}\) denotes the discrete Laplacian. The optical flow based on \(L_{0}\) regularizer is summarized in Algorithm 1. Initially, the algorithm was performed with two SDF inputs \(\mathbf{\psi}\) and a zero deformation field \(\mathbf{u}=0\). The function \(\mathit{deform}(\mathbf{\psi},\mathbf{u},\alpha)\) applied the deformation \(\mathbf{u}\) to input \(\mathbf{\psi}\) with weight \(\alpha\in[0...1]\). A single, smooth linear deformation from source to target was required rather than deformation sequences produced by the iteration runtime. We followed [5] to align multiple deformations with the \(\mathit{alignVelocity}(\mathbf{u})\) function. The reliable error metric [5] was adopted to quantitatively evaluate whether the current optical flow solve led to an improvement. More emphasis was put on the surface region rather than the volume itself. Given two inputs \(\mathbf{\psi}_{1}\) and \(\mathbf{\psi}_{2}\)(which we define them in a discrete setting), the error metric becomes  
\[error(\mathbf{\psi}_{1},\mathbf{\psi}_{2})=\sum_{x}h(\mathbf{\psi}_{1}(x),\mathbf{\psi}_{2}(x))V \tag{14}\]  
where \(V\) is the volume of a cell. The indicator function \(h\) detecting misalignment surfaces is defined as  
\[h(s_{1},s_{2})=\left\{ \begin{array}{ll}0,&\quad if\,sgn(s_{1})=sgn(s_{2})\\ min(1,\frac{|s_{1}-s_{2}|}{\Delta x}),&\quad otherwise\end{array} \right. \tag{15}\]  
where \(s_{1}\) and \(s_{2}\) represent two input SDFs \(\mathbf{\psi}_{1}\) and \(\mathbf{\psi}_{2}\). ```
Input: inputs \(\mathbf{\psi}_{1}\) and \(\mathbf{\psi}_{2},\mathbf{u},\mathit{smoothing\ weight\ \beta_{S},\) parameters
1\(\beta_{T},\beta_{A},\alpha,\kappa\) Output: Optimized \(\mathbf{u}\) Initialization:\(\beta_{A}\gets 2\beta_{S},\mathbf{u}^{(0)}\gets 0,\mathbf{v}^{(0)}\leftarrow\
abla \mathbf{u}^{(0)}\)for\(i=1:\) maxdo
2\(\mathbf{\psi}^{\prime}_{1}=\mathit{deform}(\mathbf{\psi}_{1},\mathbf{u}^{(i-1)},\alpha)\); \(\mathbf{v}^{(i)}\leftarrow\mathbf{min}_{\mathbf{v}}(\beta_{S},\beta_{A},\mathbf{ u}^{(i-1)})\)\(\mathbf{u}^{tmp}(i)\leftarrow\mathbf{min}_{u}(\mathbf{\psi}^{\prime}_{1},\mathbf{\psi}_{2},\mathbf{v}^{(i)}, \beta_{T},\beta_{A})\)
3 begin
4\(\mathbf{u}^{tmp}=\mathbf{u}^{(i-1)}+\mathit{alignVelocity}(\mathbf{u}^{tmp (i)})\); if\(error(\mathit{deform}(\mathbf{\psi}_{1},\mathbf{u}^{(i)},\alpha),\mathbf{\psi}_{2}) \geq error(\mathit{deform}(\mathbf{\psi}_{1},\mathbf{u}^{tmp},\alpha),\mathbf{\psi}_{ 2})\)then
5\(\mathbf{u}^{(i)}=\mathbf{u}^{tmp}\); \(\beta_{A}=\kappa\cdot\beta_{A}\)
6 else
7 break;
8
9 end if
10
11 end for
```  
**Algorithm 1** Optical flow based on L\({}_{0}\) regularizer  
In our proposed method, we also utilized the commonly used hierarchical procedure to recursively re-sample and deform the data on coarser resolutions.