Real-time envelope detection of ultrasound radiofrequency signals using OpenCV GPU framework

1College of Life Science and Bioengineering, Beijing University of Technology, Beijing, China 2Faculty of Information Technology, Beijing University of Technology, Beijing, China 3Department of Surgery, National Taiwan University Hospital, Taipei, Taiwan 4Department of Medical Imaging and Radiological Sciences, College of Medicine, Chang Gung University, Taoyuan, Taiwan 5Medical Imaging Research Center, Institute for Radiological Research, Chang Gung University and Chang Gung Memorial Hospital at Linkou, Taoyuan, Taiwan 6Department of Medical Imaging and Intervention, Chang Gung Memorial Hospital at Linkou, Taoyuan, Taiwan


Introduction
Ultrasound imaging has been widely used in routine diagnostics because of its low cost, nonionizing radiation, and real-time capability [1,2]. A transducer transmits ultrasound waves into a tissue, which interact with the tissue, and the transducer receives the echoes returned. Constructed from the amplitude of ultrasound echo signals, ultrasound B-mode images suffer from the drawbacks as being qualitative and operator-dependent [1]. To complement B-mode imaging, quantitative ultrasound (QUS) explores frequency, phase, or statistical information of backscattered ultrasound signals for tissue characterization [3][4][5][6][7][8][9][10]. In the context of QUS, parameters including backscatter coefficient, acoustic attenuation, speed of sound, envelope statistics, scatterer properties, and tissue elasticity can be quantified for tissue characterization [4,11,12].
When a tissue is modeled as a collection of scattering particles (i.e., scatterers), the interaction of incident ultrasound waves with tissue scatterers can be reflected in the unprocessed radiofrequency (RF) echo signals. Envelope statistics are directly related to tissue microstructures and are able to characterize structural alterations in tissues that are not apparent on ultrasound B-mode images [4][5][6][7][8][9][10]. Thus, they are useful for quantitative description of pathological state of tissues. Envelope detection of ultrasound RF data is essential for envelope statistics analysis [4][5][6][7][8][9][10]. In order to ensure real-time backscattered envelope analysis, the time efficiency of the envelope detection algorithm is demanded.
OpenCV is an open-source computer vision library written with C/C++ (http://opencv.org/) and has been widely used for image processing and computer vision applications [13][14][15][16]. Specifically, OpenCV has provided a graphics processing unit (GPU) framework for real-time data processing [16]. Considering the open-source nature and GPU framework of OpenCV, we proposed using OpenCV GPU to detect ultrasound backscattered envelope in this work. Envelope detection experiments were conducted on 21 frames of ultrasound RF data. Experimental results demonstrated that real-time RF envelope detection could be realized with the OpenCV GPU framework.

Data acquisition
This study was approved by the Institutional Review Board of National Taiwan University Hospital and the patients signed informed consent forms. Breast ultrasound images were collected with a commercial portable ultrasound scanner (Model 3000, Terason, Burlington, MA, USA), with the raw RF data digitized at a sampling rate of 30 MHz. The transducer comprised a wideband linear array (Model 10L5, Terason) with a center frequency of 7.5 MHz. Twentyone volunteer female patients with breast tumors were recruited. A sonographer performed the ultrasound scanning. Each image acquisition protocol involved a total of 256 beamformed scan lines (1552 sample points per scan line) of the backscattered echoes. The interval between each scan line was 0.15 mm.

Envelope detection
The instantaneous amplitude (A-line) of the ultrasound RF signal is obtained by envelope detection: where e(t) denotes the A-line, r(t) is the ultrasound RF signal, ˆ( ) r t denotes the Hilbert transform of r(t), and j is the imaginary unit. The expression ( ) ( ) r t jr t + is referred to as the analytic signal or complex RF echo. In previous studies, Hilbert transform has been frequently used for envelope detection of ultrasound RF signals [6][7][8][9][10]. Based on the property of Hilbert transform [17,18], the analytic signal ( ) ( ) r t jr t + has no spectrum components at negative frequencies and its spectrum components at positive frequencies are doubled [19]. This property will be considered in the algorithm implementation of envelope detection based on Hilbert transform. Figure 1 shows the flow chart of the envelope detection algorithm.

Algorithm implementation
Suppose that a frame of ultrasound RF data, r(t), comprises M scan lines, and each scan line contains N sample points. For the i th scan line of r(t), 1 i M ≤ ≤ , the Hilbert transform is computed. Then, the envelope of the RF data is computed using Equation (1).
The Hilbert transform of the i th scan line, s, is calculated using the discrete Fourier transform (DFT) [20] and involves a five-step algorithm: (i) Define a complex vector c, whose real part is s and imaginary part is zero vector.
(ii) Conduct N-point forward DFT [20] to c, and a complex vector d is obtained. (iv) Conduct N-point inverse DFT [20] to d, and a complex vector v is obtained.
(v) The Hilbert transform of the i th scan line s is computed as the imaginary part of v divided by N.
In this study, the Hilbert transform based envelope detection algorithm was implemented using the C++ language with OpenCV 2.4.9 and Microsoft (R) Visual C++ 2010. Both OpenCV CPU and OpenCV GPU frameworks based envelope detection was performed, and C++ codes for the algorithm implementation were provided in Tables 1,2 and 3, where "rf" denoted the ultrasound RF data matrix, and "envelope" was the envelope matrix of "rf". Envelope detection with OpenCV CPU was based on the OpenCV matrix data structure, cv::Mat. Forward DFT and inverse DFT on the basis of the OpenCV CPU framework were computed using the OpenCV DFT function, cv::dft(). Envelope detection with OpenCV GPU was based on the OpenCV GPU matrix data structure, cv::gpu::GpuMat. Forward DFT and inverse DFT on the basis of the OpenCV GPU framework were conducted using the OpenCV GPU based DFT function, cv::gpu::dft(). The communication between CPU and GPU was performed using GpuMat::upload() and GpuMat::download() functions.

Results
Envelope detection experiments were conducted on 21 frames of ultrasound RF data using a computer with dual 2.60-GHz Intel (R) Xeon (R) E5-2670 CPU, 64-GB RAM, and 2-GB NVIDIA (R) Quadro TM 4000 GPU. The number of scan lines and sample points are listed in Table 1. Experimental results showed that visually, the OpenCV GPU framework produced the same B-mode image as OpenCV CPU ( Figure  2). For RF data of 256 scan lines × 1552 sample points (n = 21), OpenCV CPU and OpenCV GPU had a running time of 106.00 ± 0.84 ms and 18.43 ± 0.68 ms, respectively (Table 4). The results demonstrated that the significantly improved computational efficiency of the OpenCV GPU method over the OpenCV CPU method.

Discussion and conclusions
Envelope detection of ultrasound backscattered signals is an essential step in many ultrasonic applications, such as envelope statistics based tissue characterization [4-10]. Real-time envelope detection is desired for fast analysis of ultrasound RF signals. However, envelope detection on CPU can be a time-consuming process. To accelerate the computation, parallel GPUs, especially the GPGPU for general purpose computing on GPU, have been used in many fields including machine learning and medical image processing [21,22].
The CUDA (Compute Unified Device Architecture) and OpenCL platforms are the two most widely adopted programming models for GPU computing. OpenCV is an open-source computer vision library with a GPU framework. The OpenCV GPU framework is implemented based on the CUDA platform and is easy and flexible to use. OpenCV has been used in various ultrasound applications including breast ultrasound image segmentation [14] and quasi-real-time ultrasound backscattered statistical parameter imaging (i.e., ultrasound Nakagami imaging) [15]. However, in our previous work, the envelope detection of RF signals was realized on CPU [15], limiting the frame rate of ultrasound Nakagami imaging (1-3 frames per second). In applications such as real-time ultrasonic characterization of cardiac tissues, the computation speed is highly demanded.
To date, quantitative ultrasound research using OpenCV GPU has not been conducted. To our knowledge, this work is the first to use OpenCV GPU framework for backscattered envelope detection. In this work, we proposed using OpenCV GPU framework for envelope detection of ultrasound RF signals. Experimental results demonstrated that the OpenCV GPU framework is capable for real-time envelope detection. The proposed OpenCV GPU based envelope detection method may be used in various ultrasound tissue characterization applications demanding fast computation of the envelope of backscattered RF signals.