Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

A brain lesion is typically a region with abnormal tissue due to brain infection, malformation, injury, or disease. Lesions appear in various types of diseases including brain abscesses, tumors, stroke, and multiple sclerosis (MS). Brain imaging plays a pivotal role in early diagnosis and treatment of such diseases. The identification of the exact location of a lesion helps to determine the lesion characteristics and clinical implications, on the basis of which clinicians make diagnosis and plan treatment. Magnetic resonance imaging (MRI) is widely regarded as one of the most Preferred imaging modalities for visualizing brain lesions, because it is free of ionizing radiation and yields high soft-tissue contrast. In conventional clinical diagnosis, two-dimensional (2D) slices from the MR volume are visually screened, which is a time-consuming task and prone to inter-observer variations. A fully automatic lesion detection tool can make the screening task considerably faster, easier, and potentially more accurate.

Researchers have shown interest in template matching for computer-aided detection of abnormal regions from medical images. In template matching, the image is searched and locally compared with a template image, until the locations in the image that best match the template are found. This process can then be repeated for a set of templates with various lesion sizes, eventually revealing the optimum location and size of the lesion. This technique has been explored in detecting masses from mammogram images [1, 2]. Nodules [3, 4] and metastatic lesions [5] in the lungs have also been detected by template matching algorithms from computed tomography images. In other work, an anatomical template was used to develop an ‘adaptive, template moderated, spatially varying statistical classification’ framework for segmentation of MS lesions and brain tumors [6]. The normalized cross-correlation coefficient (NCCC), which can be computed in the frequency domain, is a suitable choice for the similarity measure between three-dimensional (3D) templates and the MR volumes [7]. The cross-correlation coefficient has also been employed as a similarity metric in contrast-enhanced MRI to detect small metastatic lesions [8], where the tumor growth pattern was simulated by a 3D spherical-shell template. The different characteristics of lesions, e.g. shape, size, and brightness, were explored to set up rule-based criteria, and a nodule enhancement strategy was introduced to improve the overall performance of the proposed technique. In a different study, NCCC was used to measure the similarity between a black-blood MR pulse sequence and 3D spherical templates, and finally artificial neural network driven pattern classifier was adapted to characterize the metastatic lesions and non-tumor regions [9]. In another study, NCCC was adopted as a similarity measure between MRI images and templates, where various steps such as noise reduction, brain extraction and ROI selection, 3D template building, and matching with the tumor region were followed for detection of brain tumors [10]. A challenging issue in existing template matching techniques is the determination of the optimal template size, especially since the runtime of the algorithm increases proportionally to the number of tried sizes. Designing an efficient mathematical framework for faster computation of NCCC is therefore a critical task in the field of computer-aided lesion detection.

In this work, we focus on reducing the time complexity of the computation of NCCC with a 3D Gaussian template. Inspired by a fast method of computation of the continuous wavelet transform [11], we consider the convolution with the 3D Gaussian template as multiple convolutions with a box kernel per the principle of central limit theorem, which takes linear time, \( O\left( N \right) \), with respect to the number of voxels (Sect. 2). This is in contrast to the conventional fast Fourier transform (FFT) based method for NCCC computation, with the computational complexity of \( O\left( {N\,\log N} \right) \). We show through our experiments that the proposed method speeds up the computation of NCCC noticeably, while practically keeping the same accuracy as the FFT-based approach (Sect. 3).

2 Proposed Methodology

Let \( f\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) \) be the D-dimensional input image, the lesions of which are to be detected. In this work, the D-dimensional Gaussian is proposed as the template, which is approximated, following the central limit theorem, by convolving a D-dimensional symmetric and normalized box kernel, \( h_{D} \left( \cdot \right) \), with itself \( n - 1 \) times, denoted as \( h_{D}^{(n)} \left( \cdot \right) \) (aka B-splines). In our experiments, a small value of \( n = 2 \) or \( n = 3 \) turned out to be sufficient. The sizes of the box kernel and the engulfing template are 2a and 2b in all dimensions, respectively; i.e. \( h_{D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) \) is \( 1/\left( {2a} \right)^{D} \) if \( \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} \in\Omega _{a} \), and 0 otherwise, where \( \Omega _{l}\;{:=}\;\left\{ {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} |\left| {X_{1} } \right|, \ldots ,\left| {X_{D} } \right| \le l} \right\} \). To ensure that the box kernel fits in the engulfing template after the convolutions, we restrict its size as: \( 0 < a \le a_{ \hbox{max} } < b/n \). The similarity between the given image and the symmetric template with a varying a can be computed from the following formula for the NCCC:

$$ {\text{NCCC}}\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right): = \frac{{\int_{{\Omega _{b} }} \left( {f\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \right) - \bar{f}\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right)} \right)\left( {h_{D}^{(n)} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \right) - \overline{{h_{D}^{(n)} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} }}{{\sqrt {\mathop \int_{{\Omega _{b} }} \left( {f\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \right) - \bar{f}\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right)} \right)^{2} {\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \sqrt {\int_{{\Omega _{b} }} \left( {h_{D}^{(n)} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \right) - \overline{{h_{D}^{(n)} }} } \right)^{2} {\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } }}, $$
(1)

where \( \bar{f}\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) \) and \( \overline{{h_{D}^{(n)} }} \) represent the mean of the image inside the template centered at \( \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} \), and the mean of the template, respectively. Our goal is to maximize NCCC with respect to both a and \( \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} \), to accurately localize the lesions. Since by definition \( \int_{{\Omega _{b} }} {\left( {h_{D}^{(n)} (\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} ) - \overline{{h_{D}^{(n)} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } = 0 \), we can omit \( \bar{f}\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) \) from the numerator of Eq. (1). We compute \( \int_{{\Omega _{b} }} {f\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \right)h_{D}^{(n)} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } = \int_{{{\mathbb{R}}^{D} }} {f\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \right)h_{D}^{(n)} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{'} }} } = \left( {f*h_{D}^{\left( n \right)} } \right)\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right). \) Thanks to the separability property of the template, i.e. \( h_{D}^{(n)} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) = \prod\nolimits_{j = 1}^{D} {h_{1}^{(n)} \left( {X_{j} } \right)} \), we can first find the solution to this convolution for \( D = 1 \) and then apply it sequentially for each dimension. For \( D = 1 \), we note that:

$$ f*h_{1}^{{\left( {n + 1} \right)}} = \left( {f*h_{1}^{\left( n \right)} } \right)*h_{1} . $$
(2)

We assume (and then verify) the following solution for the convolution:

$$ \left( {f*h_{1}^{\left( n \right)} } \right)\left( X \right) = \frac{1}{{\left( {2a} \right)^{n} }}\sum\limits_{k = - n}^{n} {\gamma_{n,k} F_{n} \left( {X + ka} \right)} , $$
(3)

where \( F_{n} \left( X \right) = \int_{ - \infty }^{X} {F_{n - 1} \left( {X^{{\prime }} } \right){\text{d}}X^{{\prime }} } \), with \( F_{0} = f \). Let \( \gamma_{n,k} = 0 \) for \( \left| k \right| > n \), and also \( \gamma_{0,0} = 1 \) for the case with no convolution. Now we substitute Eq. (3) in Eq. (2):

$$ \begin{aligned} \left( {f*h_{1}^{{\left( {n + 1} \right)}} } \right)\left( X \right) & = \left( {\frac{1}{{\left( {2a} \right)^{n} }}\sum\limits_{k = - n}^{n} {\gamma_{n,k} F_{n} \left( {X + ka} \right)} } \right) *h_{1} \left( X \right) \\ & = \frac{1}{{\left( {2a} \right)^{n} }}\sum\limits_{k = - n}^{n} {\gamma_{n,k} \int_{ - \infty }^{\infty } {F_{n} \left( {X + ka + X^{\prime}} \right)h_{1} \left( {X^{{\prime }} } \right){\text{d}}X^{{\prime }} } } \\ & = \frac{1}{{\left( {2a} \right)^{n + 1} }}\sum\limits_{k = - n}^{n} {\gamma_{n,k} \left\{ {F_{n + 1} \left( {X + a\left( {k + 1} \right)} \right) - F_{n + 1} \left( {X + a\left( {k - 1} \right)} \right)} \right\}} \\ & = \frac{1}{{\left( {2a} \right)^{n + 1} }}\sum\limits_{k = - n + 1}^{n + 1} {\gamma_{n,k - 1} F_{n + 1} \left( {X + ak} \right)} - \frac{1}{{\left( {2a} \right)^{n + 1} }}\sum\limits_{k = - n - 1}^{n - 1} {\gamma_{n,k + 1} F_{n + 1} \left( {X + ak} \right)} \\ & = \frac{1}{{\left( {2a} \right)^{n + 1} }}\sum\limits_{{k = - \left( {n + 1} \right)}}^{n + 1} {\left( {\gamma_{n,k - 1} - \gamma_{n,k + 1} } \right)F_{n + 1} \left( {X + ak} \right)} . \\ \end{aligned} $$
(4)

According to Eq. (3):

$$ \left( {f*h_{1}^{{\left( {n + 1} \right)}} } \right)\left( X \right) = \frac{1}{{\left( {2a} \right)^{n + 1} }}\sum\limits_{{k = - \left( {n + 1} \right)}}^{n + 1} {\gamma_{n + 1,k} F_{n + 1} \left( {X + ak} \right)} . $$
(5)

This validates our assumption in Eq. (3) by induction, as it is true for the base case \( n = 0 \), and provided that it is true for n, it holds for \( n + 1 \) with the following recursive relationship for \( \gamma \), which is obtained by coefficient matching between Eqs. (4) and (5):

$$ \gamma_{n + 1,k} = \gamma_{n,k - 1} - \gamma_{n,k + 1} . $$
(6)

For example, \( \gamma_{{1,\left\{ { - 1,0,1} \right\}}} = \left\{ { - 1,0,1} \right\} \) and \( \gamma_{{2,\left\{ { - 2, \ldots ,2} \right\}}} = \left\{ {1, 0, - 2, 0, 1} \right\} \). Being closely related to Pascal’s triangle, Eq. (6) is solved as follows:

$$ \gamma_{n,k} = \begin{array}{*{20}c} {\left\{ {\begin{array}{*{20}c} {\left( { - 1} \right)^{{\left( {n + s} \right)}} \left( {\begin{array}{*{20}c} n \\ s \\ \end{array} } \right)} & {n + k = 2s} \\ 0 & {n + k = 2s + 1} \\ \end{array} ,} \right.} & {s \in {\mathbb{Z}}} \\ \end{array} . $$
(7)

We now extend this to D dimensions and solve the first numerator term of Eq. (1):

$$ \int_{{\Omega _{b} }} {f\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } \right)h_{D}^{\left( n \right)} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } = \frac{1}{{\left( {2a} \right)^{nD} }}\mathop \sum \limits_{{k_{1} , \ldots ,k_{D} = - n}}^{n} \left( {\mathop \prod \limits_{j = 1}^{D} \gamma_{{n,k_{j} }} } \right)F_{n,D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + a\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} } \right), $$
(8)

where \( F_{n,j} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right): = \int_{ - \infty }^{{X_{j} }} {F_{n - 1,j} \left( {X_{1} , \ldots ,X_{j}^{'} , \ldots ,X_{D} } \right){\text{d}}X_{j}^{'} } \), with \( F_{0,j} : = F_{n,j - 1} \) for \( j > 1 \), and \( F_{0,1} : = f \). The remainder of the numerator of Eq. (1) can be computed similarly to Eq. (8) (with \( n = 1 \)):

$$ - \overline{{h_{D}^{\left( n \right)} }} \int_{{\Omega _{b} }} {f\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } = - \frac{1}{{\left( {2b} \right)^{D} }}\mathop \sum \limits_{{k_{1} , \ldots ,k_{D} = - 1}}^{1} \left( {\mathop \prod \limits_{j = 1}^{D} \gamma_{{1,k_{j} }} } \right)F_{1,D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + b\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} } \right). $$
(9)

Next, we rewrite the first factor of the denominator of Eq. (1) using the popular expansion of the variance as \( \int_{{\Omega _{b} }} {\left( {f(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + \overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} ) - \bar{f}(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} )} \right)^{2} {\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } = \left( {2b} \right)^{D} \left( {\overline{{f^{2} }} (\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} ) - \bar{f}(\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} )^{2} } \right) \), where both \( \overline{{f^{2} }} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) \) and \( \bar{f}\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) \) are calculated similarly to Eq. (8) as follows:

$$ \begin{aligned} \bar{f}\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) & = \frac{1}{{\left( {2b} \right)^{D} }}\mathop \sum \limits_{{k_{1} , \ldots ,k_{D} = - 1}}^{1} \left( {\mathop \prod \limits_{j = 1}^{D} \gamma_{{1,k_{j} }} } \right)F_{1,D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + b\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} } \right), \\ \overline{{f^{2} }} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) & = \frac{1}{{\left( {2b} \right)^{D} }}\mathop \sum \limits_{{k_{1} , \ldots ,k_{D} = - 1}}^{1} \left( {\mathop \prod \limits_{j = 1}^{D} \gamma_{{1,k_{j} }} } \right)G_{1,D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + b\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} } \right), \\ \end{aligned} $$
(10)

where \( G_{n,j} \) is defined similarly to \( F_{n,j} \), except that \( G_{0,1} = f^{2} \). Lastly, we calculate the second factor in the denominator of Eq. (1):

$$ \int_{{\Omega _{b} }} {\left( {h_{D}^{\left( n \right)} (\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} ) - \overline{{h_{D}^{\left( n \right)} }} } \right)^{2} {\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } = \left( {2b} \right)^{D} \left( {\overline{{h_{D}^{{\left( n \right)^{2} }} }} - \overline{{h_{D}^{\left( n \right)} }}^{2} } \right). $$
(11)

The Fourier transform of the box function is \( {\mathcal{F}}\left\{ {h_{D} } \right\} = \prod\nolimits_{j = 1}^{D} {{\text{sinc}}\left( {a\omega_{j} } \right)} \), which leads to the Fourier transform of the kernel \( \mathcal{F}\left\{ {h_{D}^{\left( n \right)} } \right\} = \mathcal{F}\left\{ {h_{D} } \right\}^{n} = \prod\nolimits_{j = 1}^{D} {{\text{sinc}}^{n} \left( {a\omega_{j} } \right)} \) via the convolution theorem. The integral of the template is \( \int_{{\Omega _{b} }} {h_{D}^{\left( n \right)} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } = \int_{{{\mathbb{R}}^{D} }} {h_{D}^{\left( n \right)} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } = \left. {{\mathcal{F}}\left\{ {h_{D}^{\left( n \right)} } \right\}} \right|_{{\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {\omega } = 0}} = 1 \), from which the template mean is computed as \( \overline{{h_{D}^{\left( n \right)} }} = 1/\left( {2b} \right)^{D} \). As for the mean of the square of the template, we use Parseval’s theorem as follows:

$$ \begin{aligned} \int_{{\Omega _{b} }} {h_{D}^{{\left( n \right)^{2} }} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } & = \int_{{{\mathbb{R}}^{D} }} {h_{D}^{{\left( n \right)^{2} }} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } = \frac{1}{{\left( {2\pi } \right)^{D} }}\mathop \int \limits_{{{\mathbb{R}}^{D} }} {\mathcal{F}}\left\{ {h_{D}^{\left( n \right)} } \right\}^{2} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {\omega } } \right){\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {\omega } \\ & = \mathop \prod \limits_{j = 1}^{D} \frac{1}{2\pi }\int_{ - \infty }^{\infty } {{\text{sinc}}^{2n} \left( {a\omega_{j} } \right){\text{d}}\omega_{j} } = \left( {\frac{1}{2\pi a}\int_{ - \infty }^{\infty } {{\text{sinc}}^{2n} \omega \;{\text{d}}\omega } } \right)^{D} . \\ \end{aligned} $$
(12)

We now define and compute [12]:

$$ \beta_{n} {:=} \frac{1}{2\pi }\int_{ - \infty }^{\infty } {{\text{sinc}}^{2n} \omega {\kern 1pt} \;{\text{d}}\omega } = n\mathop \sum \limits_{i = 0}^{n - 1} \frac{{\left( { - 1} \right)^{i} \left( {n - i} \right)^{2n - 1} }}{{i!\left( {2n - i} \right)!}}. $$
(13)

Therefore, \( \overline{{h_{D}^{{\left( n \right)^{2} }} }} = \left( {\frac{{\beta_{n} }}{2ab}} \right)^{D} \), and substituting in Eq. (11) leads to:

$$ \int_{{\Omega _{b} }} {\left( {h_{D}^{\left( n \right)} (\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} ) - \overline{{h_{D}^{\left( n \right)} }} } \right)^{2} {\text{d}}\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}}{{X^{{\prime }} }} } = \left( {\frac{{\beta_{n} }}{a}} \right)^{D} - \frac{1}{{\left( {2b} \right)^{D} }}. $$
(14)

Substituting all of the above in Eq. (1) and simplifying results in the following formula for the proposed fast approach of computing NCCC:

$$ {\text{NCCC}}\left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} } \right) = \frac{{\left( {\frac{2b}{{\left( {2a} \right)^{n} }}} \right)^{D} \mathop \sum \nolimits_{{\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} = - n}}^{n} \left( {\mathop \prod \nolimits_{j = 1}^{D} \gamma_{{n,k_{j} }} } \right)F_{n,D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + a\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} } \right) - \mathop \sum \nolimits_{{\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} = - 1}}^{1} \left( {\mathop \prod \nolimits_{j = 1}^{D} \gamma_{{1,k_{j} }} } \right)F_{1,D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + b\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} } \right)}}{{\sqrt {\left( {2b} \right)^{D} \mathop \sum \nolimits_{{\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} = - 1}}^{1} \left( {\mathop \prod \nolimits_{j = 1}^{D} \gamma_{{1,k_{j} }} } \right)G_{1,D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + b\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} } \right) - \left( {\mathop \sum \nolimits_{{\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} = - 1}}^{1} \left( {\mathop \prod \nolimits_{j = 1}^{D} \gamma_{{1,k_{j} }} } \right)F_{1,D} \left( {\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {X} + b\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} } \right)} \right)^{2} } \sqrt {\left( {\frac{{2\beta_{n} b}}{a}} \right)^{D} - 1} }}, $$
(15)

where \( \sum\nolimits_{{\overset{\lower0.5em\hbox{$\smash{\scriptscriptstyle\rightharpoonup}$}} {k} = - n}}^{n} {\left( \cdot \right)} \) is short for \( \sum\nolimits_{{k_{1} , \ldots ,k_{D} = - n}}^{n} {\left( \cdot \right)} \). NCCC values range from −1 to 1.

Note that \( F_{n,D} ,\,F_{1,D} \), and \( G_{1,D} \) are independent of a and can be pre-computed, along with the second term in the numerator and the first factor in the denominator of Eq. (15). Furthermore, the second factor in the denominator is a scalar that is computed fast in \( O\left( 1 \right) \) for each a. Thus, in the proposed approach to estimate NCCC with the Gaussian template, the bulk of the computational cost is only due to the first term in the numerator of Eq. (15), which can be computed in \( O\left( N \right) \) for each a, with N the number of voxels in the image. On the contrary, the computational complexity of FFT is \( O\left( {N\,\log N} \right) \) [13], making the overall computational cost of lesion detection noticeably higher for the FFT-based algorithm (template has to be zero-padded to the size of the image) than the proposed approach. This difference in computational cost is particularly amplified given that the NCCC needs to be repeatedly computed for many values of a.

3 Experimental Results

We evaluated the proposed template matching approach by comparing its performance with that of the conventional FFT-based approach. We used both artificial volumes, and real brain T2-weighted Fluid Attenuation Inversion Recovery (FLAIR) MRI volumes containing MS lesions. To avoid boundary artifacts, the images were zero-padded with b elements on the positive side of each dimension. In each experiment, the NCCC was computed for \( a = 1, \ldots ,a_{ \hbox{max} } \). Both algorithms were implemented in MATLAB.

3.1 Experiments on Synthetic Data

We first evaluated the performance of the proposed approach on synthetic data. Twenty artificial volumes of the size 513 × 513 × 513 voxels were created, each of which contained an enhancing sphere with random radius (from 8 to 21 pixels) and random location in the volume. We used both our algorithm \( (n = 2,\,b = 50,\,a_{ \hbox{max} } = 24) \) and the FFT-based approach (similar parameters, using the exact Gaussian kernel) to detect the sphere from the volume. We computed the NCCC for 24 values for the radius and found its maximum with respect to the location and the radius. Both methods accurately recovered the locations of all of the spheres i.e. the centers of the detected spheres are identical to the original ones for all 20 volumes. Since the standard deviation of the Gaussian is proportional, but not necessarily equal to the size of the sphere that it detects, we conducted a regression analysis on the liner relationship between the original radius and the detected radius. Their ratio was 1.61 ± 0.05 and 1.74 ± 0.06 for the proposed and the FFT methods, respectively, both values significant (p = 9 × 10−18).

We performed a different experiment on volumes with varying dimensions to compare the computational costs of the proposed and the FFT-based algorithms for NCCC computation.Footnote 1 We made 20 volumes with linearly increasing number of voxels, from 106 (100 × 100 × 100) to 1.25 × 108 (500 × 500 × 500), with each volume containing a bright sphere of radius 17 pixels at the center. For each volume, each algorithm was run 10 times on a Xeon 5472 3.0 GHz processor \( (n = 2,\,b = 50,\,a_{ \hbox{max} } = 24) \). The mean and the standard deviation of the runtimes are shown in Fig. 1. Our method (red curve) was 2.4 ± 0.4 times faster than the conventional FFT-based method (blue curve), while using 38% ± 4% less resident memory. The irregularity in the FFT runtime is partly because it is fastest when each dimension is a power of two (e.g., the valley at 9.9 × 107).

Fig. 1.
figure 1

Runtime analysis of proposed (red) and FFT-based (blue) approaches. (Color figure online)

3.2 Lesion Detection Experiments on Real MR Volumes

Next, we tested the two algorithms on a T2-FLAIR 1 mm3 isotropic-voxel human brain MR volume that contained MS lesions. We used n = 2, b = 7, and \( a_{ \hbox{max} } = 3 \) due to the small size of the lesions (according to Sect. 3.1, a = 3 corresponds to a radius of 5). For each voxel, we computed the maximum value of NCCC across all a. Then, to locate the top 10 most probable lesion areas on this a-maximized volume, we found the voxel with the maximum value, masked a sphere around it (with a radius twice the optimal a), then repeated this process to find the next maxima. The true positive (red circle) and false positive (blue circle) lesions from top 10 detected areas are shown in their respective slices in Fig. 2 for the proposed (two top rows) and the FFT-based (two bottom rows) approaches. The green circles are the intersection of the slice with the spheres that represent detected lesions centered in other slices. Essentially, these results show the ability of proposed algorithm in efficient detection of non-rounded lesions, which is utterly useful for the clinicians. Both methods equally identified six true lesions and four false lesions. Among the true positives, five were commonly identified by both algorithms. The results suggest that the accuracies of the two methods are similar for brain lesion detection from MRI. In this experiment, we detected the lesions from the entire brain; however, if desired, one can restrict the detection to the white matter (or any other region of interest) using a mask.

Fig. 2.
figure 2

The top 10 (from left to right) detected lesions by the proposed method (top two rows) and the FFT-based approach (bottom two rows) are each represented in their corresponding slices by a red (true positive) or a blue (false positive) circle. Green circles are intersections with other detected spheres in nearby slices. (Color figure online)

4 Conclusions

In this work, we have presented a fast NCCC-based template-matching framework, with an approximated multi-dimensional Gaussian kernel. The proposed algorithm significantly reduces the computational complexity of automatic detection of brain lesions compared to the FFT-based approach, virtually without compromising the accuracy. As part of the future work, we will extend the proposed framework to use more flexible templates, especially those suitable for the detection of ring enhancing lesions containing non-enhancing region in the center from MRI with contrast agents.