\section{Introduction}


Ultrasound (US) imaging has been widely used in interventional applications to monitor and trace target tissue. US possesses many advantages, such as low cost, portable setup and the capability of navigating through patient in real-time for anatomical and functional information. Transrectal ultrasound imaging (TRUS) has been commonly used for guiding prostate cancer diagnosis and can significantly reduce the false negative rate when fused with magnetic resonance imaging (MRI)~\cite{siddiqui2015comparison}. However, 2D US images are difficult to be registered with 3D MRI volume, due to the differences in not only image dimension but also image appearance. In practice, a reconstructed 3D US image volume is usually required to assist such interventional tasks.

A reconstructed 3D US imaging volume visualizes a 3D region of interest (ROI) by using a set of 2D ultrasound frames~\cite{mohamed2019survey}, which can be captured by a variety of scanning techniques such as
mechanical scan~\cite{daoud2015freehand} and freehand tracked scan~\cite{wen2013accurate}. Among these categories, the tracked freehand scanning is the most favorable method in a number of clinical scenarios. For instance, during a prostate biopsy, the freehand scanning allows clinicians to freely move the US probe around the ROI and produces US images with much more flexibility. The tracking device, either an optical or electro-magnetic (EM) tracking system, helps to build a spatial transformation chain between the imaging planes in the world coordinate for 3D reconstruction.

US volume reconstruction from sensorless freehand scans takes a step further by removing the tracking devices attached to the US probe. The prior research on this was mainly supported by the speckle decorrelation~\cite{chen1997determination,tuthill1998automated}, which maps the relative difference of position and orientation between neighboring US images to the correlation of their speckle patterns, \emph{i.e.} higher the speckle correlation, lower the elevational distance between neighboring frames~\cite{chang20033}. By removing the tracking devices, such sensorless reconstruction allows the clinicians to move the probe with less constraint without the concerns of blocking tracking signals. In addition, it also reduces the hardware cost.
Although the speckle correlation carries information of the relative transformation between neighboring frames, relying on the decorrelation alone renders unreliable performance \cite{laporte2011learning,afsham2015nonlocal}.

In the past decade, deep learning (DL) methods based on convolutional neural networks (CNN) have been identified as an important tool for automatic feature extraction. In the field of US volume reconstruction, a pioneer work carried out by Prevost \emph{et~al.}~\cite{prevost20183d} explored the feasibility of using CNN to directly estimate the inter-frame motion between two 2D US scans. A 2D convolutional network takes two consecutive ultrasound frames and a generated optical flow field between them as a stacked input to estimate the relative rotations and translations between these two frames. However, a typical US scanning video contains rich contextual information beyond two neighboring frames. A sequence of 2D US frames can provide a more general representation of the motion trajectory of US probe. Using only two neighboring frames may lose temporal information and thus result in less accurate reconstruction. In addition, optical flow field, which is good at describing in-plane motion, may not help out-of-plane motion analysis. Besides, the prior works on decorrelation suggests that paying more attention to the speckle-rich regions can boost the reconstruction performance, which hasn't been explored.

In this paper, based on the above observations, we propose a novel Deep Contextual Learning Network (DCL-Net) for sensorless freehand 3D ultrasound reconstruction. The underlying framework takes multiple consecutive US frames as input, instead of only two neighboring frames, to estimate the trajectory of US probe by efficiently exploiting the rich contextual information. Furthermore, to make the network focus on the speckle-rich image areas to utilize the decorrelation information between frames, the attention mechanism is embedded into the network architecture. Last but not the least, we introduce a new case-wise correlation loss to enhance the discriminative feature learning to prevent overfitting the scanning style.



\section{Data Materials}
\label{data}
All TRUS scanning videos studied in this work are collected by an EM-tracking device from real clinical cases. The dataset contains 640 TRUS videos all from different subjects acquired by a Philips iU22 scanner in varied lengths.
Every frame corresponds to an EM tracked vector that contains the position and orientation information of that frame. We convert this vector to a 3D homogeneous tranformation matrix $M = [R \; T; 0 \; 1]$,
where $R$ is a 3$\times$3 rotation matrix and $T$ is a 3D translation vector.

The primary task of 3D ultrasound reconstruction is to obtain the relative spatial position of two or more consecutive US frames. 
Without loss of generality, here we use two neighboring frames as an example for illustration. Let $I_i$ and  $I_{i+1}$ denote two consecutive US frames with corresponding transformation matrices $M_i$ and $M_{i+1}$, respectively. The relative transformation matrix $M'_i$ can be computed as $M'_i=M_{i+1}M_i^{-1}$.
By decomposing $M'_i$ into 6 degrees of freedom $\theta_i={\left \{t_x,t_y,t_z,\alpha_x,\alpha_y,\alpha_z \right \}}_i$, which contains the translations in millimeters and rotations in degrees, we can use this $\theta_i$ computed from EM tracking as the ground-truth for network training. 

 \section{Ultrasound Volume Reconstruction} 
\label{method}






\begin{figure}[t]
	\centering
	\includegraphics[width=\textwidth]{figures/dcl.pdf}
	\caption{An overview of the proposed DCL-Net, which takes one video segment as input volume and gives the mean motion vector as the output.} 
	\label{fig:framework}
\end{figure}

Fig.~\ref{fig:framework} shows the proposed DCL-Net architecture, which is designed on top of the 3D ResNext model \cite{xie2017aggregated}. Our model consists of 3D residual blocks and other types of basic CNN layers~\cite{he2016deep}. The skip connections help preserve the gradients to train very deep networks. The use of the multiple pathways (cardinalities) enables the extraction of important features. 
In our design, 3D instead of 2D convolutional kernels are used, mainly because 3D convolutions can better extract the feature mappings along the axis of channel, which is the temporal direction in our case. Such properties enable the network to focus on the slight displacement of image features between consecutive frames. The network can thus be trained to connect these speckle correlated features to estimate the relative position and orientation.


During the training process, we stack a sequence of $N$ frames with height and width denoted by $H$ and $W$, respectively, to form a 3D input volume in the shape of $N \times H \times W$. Let $\{ \mathbf{\theta}_i | i=1,\ldots,N-1 \}$ denote the relative transform parameters between the neighboring frames. Instead of directly using these parameters as ground-truth labels for network training, the mean parameters
\begin{equation}
\bar{\theta} = \frac{1}{N-1} \sum_{i=1}^{N-1} \theta_i,
\end{equation}
are used for the following two reasons.
Most importantly, since the magnitude of motion between two frames is small, using the mean can effectively smooth the noise in probe motion. Another advantage in practice is that there is no need to modify the output layer every time when we change the number of input frames.
During the test, we slide along the video sequence with a window size $N$. The inter-frame motion of two neighboring frames is the average motion computed in all the batches.



\subsection{Attention Module}



The attention mechanism in the deep learning models makes the CNN to focus on a specific region of an image, which carries salient information for the targeted task \cite{bahdanau2014neural}. It has led to significant improvement in various computer vision tasks such as object classification~\cite{fukui2019attention} and segmentation~\cite{oktay2018attention}. 
In our 3D US volume reconstruction task, regions with strong speckle patterns for correlation are of high importance in estimating the transformations.
Thus, we introduce a self-attention block, as shown in Fig.~\ref{fig:framework}, which takes the feature maps produced by the last residual block as input and then outputs an attention map. This helps assign more weights to the highly informative regions. 


\subsection{Case-wise Correlation Loss}
\label{sec:correlation}

\begin{figure}[t]
	\centering
	\includegraphics[width=\textwidth]{figures/corr.pdf}
	\caption{Overview of the case-wise correlation loss computation.} 
	\label{corrflow}
\end{figure}

The loss function of the proposed DCL-Net consists of two components. The first one is the mean squared error (MSE) loss, which is the most commonly used loss in deep regression problems. However, the use of MSE loss alone can lead to the smoothed estimation of the motion and thus the trained network tends to memorize the general style of how the clinicians move the probe, \emph{i.e.} the mean trajectory of the ultrasound probes. This shortcoming of the MSE loss for network training has been reported before~\cite{yang2018low,johnson2016perceptual}. To deal with problem, we introduce a case-wise correlation loss based on the Pearson correlation coefficient to emphasize the specific motion pattern of a scan.

Fig.~\ref{corrflow} shows the workflow of calculating the case-wise correlation loss. $K$ video segments with each having $N$ frames are randomly sampled from a TRUS video.
The correlation coefficients between the estimated motion and the ground truth mean are computed for every degree-of-freedom and the loss is denoted as
\begin{equation}
L_{corr} = 1-\frac{1}{6}\sum_{d=1}^{6}\frac{Cov\left (\bar{\theta}_{d}^{GT}, \bar{\theta}_{d}^{Out} \right )}{\sigma \left (\bar{\theta}_{d}^{GT}  \right )\sigma \left ( \bar{\theta}_{d}^{Out} \right )},
\end{equation}
where $Cov$ gives the covariance and $\sigma$ calculates the standard deviation.
The total loss is the summation of the MSE loss and the case-wise correlation loss.



\section{Experiments and Results}
\label{experiments}

For the experiments performed in this study, a total of 640 TRUS scanning videos (640 patients) from the Nation Institute of Health (NIH) were acquired from IRB-approved clinical trial. During an intervention, a physician used an end-firing transrectal ultrasound probe to acquire axial images by steadily sweeping through the prostate from base to apex. The positioning information given by an electromagnetic tracking device serves as the ground truth label in our training phase. The dataset is split into 500, 70 and 70 cases as training, validation and testing, respectively. Our network is trained for 300 epochs with batch size $K=20$ using Adam optimizer~\cite{kingma2014adam} with initial learning rate of 5$\times 10^{-5}$, which decays by 0.9 after 5 epochs. 
Since the prostate US image only takes a relative small part of each frame, each frame is cropped without exceeding the imaging field and then resized to $224 \times 224$ to fit the design of ResNexts~\cite{xie2017aggregated}.  We implemented the DCL-Net using the publicly available Pytorch library~\cite{pytorch}. The entire training phase of the DCL-Net takes about 4h, taking 5 frames as input. During testing, it takes about 2.58s to produce all the transformation matrix of an US video with 100 frames.

Two evaluation metrics are used for performance evaluation. The first one is the average distance between all the corresponding frame corner-points throughout a video. This distance error reveals the difference in speed and orientation variations across the entire video. The other one is the final drift~\cite{prevost20183d}, which is the distance between the center points of the transformed end frames of a video segment using the EM tracking data and our DCL-Net estimated motion.

\subsection{Parameter Setting}

\begin{figure}[t]

	\subfloat{\includegraphics[width=.45\textwidth]{figures/box2.pdf}}
	\subfloat{\includegraphics[width=.55\textwidth]{figures/attention.pdf}}
	\caption{(Left) Effect of number of input frames. Green curve shows the mean distance error of each box. (Right) Visualization of two attention maps regarding rotation around the Y-axis.} \label{fig:nsat}
\end{figure}

We first performed experiments to determine an optimal $N$ number of frames for each video segment. The left panel of Fig.~\ref{fig:nsat} shows how the overall reconstruction performance varies as the number of consecutive frames changes. There is a decrease then increase in the error, with neighboring frame number equaling to 5 or 6 has similarly the best performance. According to our paired t-test, the calculated p-value is smaller than the confidence level of 0.05, indicating the result using 5 frames is significantly better than that using only 2 frames. The explanation is that the network takes advantage of the rich contextual information along the time-series and produces more stable trajectory estimation.

The right panel of Fig.~\ref{fig:nsat} visualizes two example attention maps. The first image column shows the cropped US images. The second column is the speckle correlation map~\cite{chang20033} between a US image and its following neighboring frame. Inside this speckle correlation map, brighter the area, longer the elevational distance to the next frame. Such pattern with dark areas at the bottom and brighter on the upper part is consistent with our TRUS scanning protocol, as there is less motion around the tip of the ultrasound probe. The third column shows the attention map regarding the rotation $\alpha_y$ around the Y-axis, which also indicates part of the out-of-plane rotation. The attention maps have strong activation at the bright speckle correlation regions, indicating that the attention module helps the network to focus on speckle-rich areas for better reconstruction.


\subsection{Reconstruction Performance and Discussions}
\begin{table}[t]
\caption{Performance of different methods on the EM-tracking dataset.}
\centering
\begin{tabular}{l|cccc|cccc}\hline
\multicolumn{1}{c|}{\multirow{2}{*}{Methods}}                                 & \multicolumn{4}{c|}{Distance Error (mm)}                            & \multicolumn{4}{c}{Final Drift (mm)}                                \\ \cline{2-9} 
\multicolumn{1}{c|}{}                                                         & Min           & Median        & Max            & Average       & Min           & Median        & Max           & Average        \\\hline 
Linear Motion                                                                 & 7.17          & 19.73         & 60.79          & 22.53         & 12.53         & 37.15         & 114.02        & 42.62          \\
Decorrelation~\cite{chang20033}    & 9.62          & 17.58         & 56.72          & 18.89         & 15.32         & 38.45         & 104.13        & 38.26          \\
2D CNN~\cite{prevost20183d}                                                           & 5.66          & 15.8          & 43.35          & 17.42         & 7.05          & 23.13         & 68.87         & 26.81          \\
3D CNN (NS2)~\cite{xie2017aggregated}                                                                 & 2.38          & 10.14         & 31.34          & 12.34         & 1.42          & 19.08         & 68.61         & 21.74          \\
Our DCL-Net  & \textbf{1.97} & \textbf{9.15} & \textbf{27.03} & \textbf{10.33} & \textbf{1.09} & \textbf{17.40} & \textbf{55.50} & \textbf{17.39}\\\hline
\end{tabular}
\label{tabcompare}
\end{table}

Table~\ref{tabcompare} summarizes the overall comparison of the proposed DCL-Net against other existing methods. The approach of ``Linear Motion'' means that we first calculate the mean motion vector of the training set and then apply this fixed vector to all the testing cases. The approach of ``Decorrelation'' is based on the speckle decorrelation algorithm presented in \cite{chang20033}. ``2D CNN'' refers to the method presented by Prevost \emph{et~al.}~\cite{prevost20183d}. ``3D CNN'' is the vanilla ResNext~\cite{xie2017aggregated} architecture taking only two slices as input.

It can be seen from Table~\ref{tabcompare} that our proposed DCL-Net outperforms all the other methods. Paired t-test was performed and the performance improvement made by DCL-Net is significant in all the cases with $p$-value$<$0.05. It is worth noting that although the average distance error of 10.33mm achieved DCL-Net is still a large error, this is the best performance on real clinical data instead of phamtom studies. The performance of the state-of-the-art 2D-CNN method reproduced in our experiments has consistent performance compared to the accuracy reported in the paper \cite{prevost20183d}. It is a challenging task to reconstruct 3D US volume using these freehand TRUS scans and we have been making significant progress in this important area.


\begin{figure}[t]
	\centering
	\includegraphics[width=\textwidth]{figures/corrloss.pdf}
	\caption{Predicted rotation $\alpha_y$ on one video sequence with different methods. Applying correlation loss makes our prediction (blue line) more sensitive to the strongly varying speed of the ground-truth (green line).} 
	\label{fig:corrstudy}
\end{figure}


\begin{figure}[t]
	\centering
	\includegraphics[width=\textwidth]{figures/volume.pdf}
	\caption{Comparison of the US volume reconstruction results of four cases with different qualities.}
	\label{fig:recon}
\end{figure}

Next, we demonstrate the effectiveness of incorporating case-wise correlation loss into the network training. Fig.~\ref{fig:corrstudy} shows the prediction of $\alpha_y$ along a video sequence. We can observe that the network trained with MSE loss can only produce mediocre results (red line) which are nearly constant, showing almost no sensitivity to the change in speed and orientation. Its prediction wonders around the linear motion (black line) which represents the mean value of the probe's trajectory. The correlation coefficients of all testing cases show a mean of $0.09 \pm 0.03$ which represents little correlation. This indicates that using MSE alone makes the network memorizing the general style of the US probe motion trajectory and fails to produce valid prediction based on image contents. By incorporating the correlation loss (CL) into the loss function (blue line), the correlation coefficients of all testing cases have a mean of $0.21 \pm 0.09$, representing weak correlation. Based on a paired t-test with $\alpha=0.05$, this is found to be significantly better than the previous results. Intuitively, the network's prediction reacts more sensitively to the variation of the probe's real translation and rotation (green line). 

Last but not the least, we report the volume reconstruction results using four testing cases with different reconstruction qualities as shown in Fig.~\ref{fig:recon}. One good case, one bad case, and two median cases are included to offer a complete view of the performance. To reduce the clutter in the figure, we only show the comparison between our DCL-Net, the 2D-CNN~\cite{prevost20183d} and the ground-truth. While producing competitive performance, the 2D-CNN method is less sensitive to the speed variations of US probe and the estimated trajectory has noisy vibration. The results sometimes even severely deviate from the ground-truth. Our proposed DCL-Net shows a much smoother trajectory estimation thanks to the contextual information provided by video segments.

\section{Conclusions}
\label{Conclusion}
This paper introduced a sensorless freehand 3D US volume reconstruction method based on deep learning. The proposed DCL-Net can well extract the information among multiple US frames to improve the US probe trajectory estimation. Experiments on a well-sized EM-tracked ultrasound dataset demonstrated that the proposed DCL-Net has benefited from the contextual learning and showed superior performance when compared to other existing methods. Further experiments on the ultrasound videos with different scanning protocols will be studied in our future work.

\section{Acknowledgements}
\label{Acknowledgements}
This work was partially supported by National Institute of Biomedical Imaging and Bioengineering (NIBIB) of the National Institutes of Health (NIH) under awards R21EB028001 and R01EB027898, and through an NIH Bench-to-Bedside award made possible by the National Cancer Institute.

\bibliographystyle{splncs04} 
