Keywords

1 Introduction

Detecting the spinal cord (SC) on MRI data is important for automating quantitative analysis pipelines, such as SC segmentation or template registration. For example, about 20 published SC segmentation methods still require manual intervention for initialization [1] and could be made fully automatic if preceded by a robust SC centerline localization. While detecting the SC seems like an easy image analysis task at a first glance, it is in fact challenging to make it robust and accurate across a variety of cord shapes, vertebral levels, pathologies, image resolutions and orientations, types of contrast and common image artifacts (e.g., susceptibility, motion, ghosting, blurring, Gibbs).

Some existing automatic methods are based on the characteristic shape of the cord using Hough transform detection with vesselness filtering [2], active contour [3], or max-flow approach [4]. Other methods use image-based strategies by pattern [5] or atlas [6] registration. While these recent automatic algorithms have shown good performances [1], they are often limited to specific contrast and resolution.

In this paper, we introduce a new accurate, automatic, fast and robust method (OptiC) to localize the center of the SC. OptiC is based on a standard machine learning method combined with a distance-transform-based global optimization. To demonstrate its performance on non-curated data (i.e. effectiveness versus efficiency), OptiC is validated across a large dataset (n=653) involving a variety of image quality, contrast and pathologies.

2 Method

The OptiC method models the SC centerline as a continuous curve following the superior-inferior (S-I) axis. To find it, a map of the most probable SC localization is computed using standard object detection tools. An optimization problem compromising this map with the spine continuity is then solved to take into account the global tubular shape of the SC.

Spinal Cord Localization Map. Detection task of a given object can be modeled as a classification problem predicting the presence of that object in a given image-patch. Here, to localize the SC, a classifier is trained on patches containing (positive) and not containing (negative) the SC. Then, for a testing image, the classifier confidence of SC presence within each patch is assigned to the corresponding voxel, resulting in a SC localization map S.

Spinal Cord Centerline Extraction. The SC centerline is modeled as a regularized curve in a trade-off between the localization map values and the SC continuity. Consequently, the centerline curve could be expressed as the solution of the following optimization problem of the cost function C:

$$\begin{aligned} \min _{c_0,\dots ,c_{n-1}} C_{n-1}(c_0,\dots ,c_{n-1}) = \min _{c_0,\dots ,c_{n-1}} - \sum _{z=0}^{n-1} S_z(c_z) + \lambda \sum _{z=0}^{n-2} \left\| c_{z+1}-c_z\right\| ^2. \end{aligned}$$
(1)

with \(\lambda \), a penalization coefficient; \(c_z\), the SC center and \(S_z\), the localization map on the \(z^\textit{th}\) slice; n, the number of slices in the 3D input MRI volume. The first term represents the classifier confidence of the SC localization, whereas the second term is a regularization term to enforce the SC continuity between adjacent slices.

In the following section, a novel algorithm is proposed to solve this problem efficiently. The robustness of the SC localization is ensured by the finding of the global minimum of the optimization problem.

2.1 Optimization Problem Resolution

Several approaches could be used to solve Eq. 1: a brute force algorithm would find the global minimum but would be time consuming (\(O(s^n)\) where s is the number of pixels per slice and n the number of slices), gradient descent would be fast but it does not ensure to find the global minimum. Here, a novel algorithm is presented to find the global minimum very efficiently, in \(O(s\cdot {n})\), using distance-transforms. To do so, a sequence (\(M_k\)) is introduced as:

$$\begin{aligned} M_k(x_k) = \min _{x_0,\ldots ,x_{k-1}} C_k(x_0,\ldots ,x_k). \end{aligned}$$
(2)

Since \(\min _{x_{n-1}} M_{n-1}(x_{n-1}) = \min _{x_0,\ldots ,x_{n-1}} C_{n-1}(x_0,\ldots ,x_{n-1})\), the center solution on the last slice is given by \(c_{n-1} = \mathop {\mathrm {argmin}}_{x_{n-1}} M_{n-1}(x_{n-1})\).

This sequence \((M_k)\) can be expressed to satisfy the following recurrence relationship:

figure a

with D the image transform defined as \(D(f)(x) = \min _y f(y) + \left\| x-y\right\| ^2\). This recurrence relation enables to infer the centerline, solution of the Eq. 1. Indeed, given \(c_k\), \(c_{k-1}\) can be expressed as:

figure b

with N the image transform defined as \(N(f)(x) = \mathop {\mathrm {argmin}}_y f(y) + \left\| x-y\right\| ^2\). D and N can be interpreted respectively as the distance transform and nearest neighbors transform of an image, which can be computed very efficiently (with linear complexity), as proposed in [7, 8].

The resolution of Eq. 1 is formalized in Algorithm 1. The sequences \((M_k)\) and \((N_k)\) are first computed using distance and nearest-neighbor transforms, respectively. The SC centerline sequence \((c_k)\) is then inferred by backtracking on the nearest-neighbor-transforms \((N_k)\). As the computation of \(M_k\) and \(N_k\) is linear, in O(s), the complexity of OptiC is also linear, in O(s.n).

figure c

2.2 Implementation Details

For each MRI volume, preprocessing steps involve orienting the image to R-P-I (Right-to-left, Posterior-to-anterior, Inferior-to-superior), and setting the resolution in the axial plane to 1 mm\(\times \)1 mm. Implemented in C++, OptiC computes the SC localization map on each 2D axial slice using a Support Vector Machine (SVM) trained with Histogram of Oriented Gradient features (HOG) [9]. The HOG features were computed using the OpenCV library [10] with default parameters on \(32\times 32\) patches size and with signed gradients. Note that the use of small patch size as well as the sophisticated normalization scheme of HOG makes the computation of the localization map robust to image artifacts and intensity scale changes.

3 Experimental Results

3.1 Data Sets

This is a retrospective study involving 13 different centers. The dataset is composed of 441 subjects, including 133 patients (Multiple Sclerosis (MS) n = 52, Degenerative Cervical Myelopathy (DCM) n = 52, Neuromyelitis Optica (NMO) n = 19, Spinal Cord Injury (SCI) n = 5, Amyotrophic Lateral Sclerosis (ALS) n = 5)). Images were acquired on 3T systems of three vendors: Siemens (n = 437), Philips (n = 40) and GE (n = 176). Contrasts included \(T_2-weighted\) (n = 278), \(T_1-weighted\) (n = 112) and \(T_2^*-weighted\) (n = 263) images. Spatial resolutions included isotropic (n = 353, from 0.7 to 1.3 mm voxel size) and anisotropic data with axial (n = 294, in plane: from 0.3 to 0.9 mm, slice thickness: from 2.5 to 24.5 mm), or sagittal orientation (n = 6, in plane: from 0.4 to 0.7 mm, slice thickness: from 0.8 to 2.8 mm). As ground truth of the SC centerline, the center of the SC was manually localized on each axial slice of each volume.

3.2 Model Training

Each contrast dataset (\(N_{tot}\)) was split into two independent subsets: (1) a validation set (\(N_{valid}\), used to train and validate the model) involving 20% of the healthy controls (HC) randomly selected, (2) a testing set (\(N_{tot} - N_{valid}\), used to test the trained model) with the patients and the remaining HC. For each contrast, the model was trained with only one image, selected from the validation set using a Leave (\(N_{valid} - 1\)) Out cross validation: for each iteration, the trained model is validated on the \(N_{valid} - 1\) remaining images by computing the Mean Squared Error (MSE) between the predicted and ground truth SC centerlines. The averaged MSE was less than 2 mm for 98.79% of iterations, suggesting robustness in the choice of the training image. The model used for the rest of the study is trained with the image having the lowest averaged MSE. Note that we also evaluated models trained with 5, 10, 15, 20 and 25 images and results were similar (or slightly worst) as when using only one image for training.

In order to assess the benefit of the proposed S-I axis regularization, OptiC was compared without (\(\lambda \) set to 0 in Eq. 1) and with (\(\lambda \) set to 1) regularization. When \(\lambda \) is zero, the centerline is given by the maximal values of the SC localization map. MSE was \(5.72 \pm 7.17\) mm for OptiC(\(\lambda \) = 0) and \(1.21 \pm 1.31\) mm for OptiC(\(\lambda \) = 1) (averaged across contrasts n = 560, paired student t-test for each contrast gave p-values \(<0.001\)), demonstrating the interest of the regularization. Despite the complex optimization imposed by the 3D regularization, computation time was on the same ballpark: \(14.6 \pm 5.9\) ms per 2D axial slice for OptiC(\(\lambda \) = 1) vs. \(8.70 \pm 3.91\) ms for OptiC(\(\lambda \) = 0) (including reading/writing tasks, on an iMac i7 4-cores 3.4 GHz 8 Gb RAM). In the rest of the manuscript, the penalization coefficient \(\lambda \) is set to 1.

Fig. 1.
figure 1

Localization rate (top) and MSE (bottom) results, compared between Hough (left distribution plots) and OptiC (right distribution plots), where each point represents a subject. The best value of each metric is indicated in green in the y-axis. Each method was evaluated on the 3 contrast testing sets: \(T_2w\), \(T_1w\) and \(T_2^*w\) (from left to right). The table presents for each method the mean±std and the [5\(^{th}\);95\(^{th}\)] percentile values.

Fig. 2.
figure 2

Examples of automatic SC centerline localization on HC and patients, on \(T_2w\) (top), \(T_2^*w\) (bottom) and \(T_1w\) (left) images. Comparison between ground-truth (red) and automatic (blue) SC centerlines on axial and sagittal views.

3.3 Performance Evaluation

Figure 1 shows a comparison between OptiC and a recently-published automatic SC localization [2], based on Hough transform detection with vesselness filtering (referred as Hough in the following paragraphs). Evaluation metrics were the localization rate (defined as the percentage of slices for which the predicted centerline is included in the manually-segmented SC) and the MSE (defined as the mean squared error between the predicted and the ground-truth centerlines, calculated per volume). The localization rates were \(98.53 \pm 4.94\%\) for OptiC and \(40.96 \pm 41.78\%\) for Hough (averaged across contrasts n = 560, paired student t-test gave p-values \(<0.001\)). The MSE results, for subjects with a detected cord (localization rate \(>0\%\)), were \(1.21 \pm 1.31\) mm for OptiC and \(2.79 \pm 4.50\) mm for Hough (averaged across contrasts n = 560, paired student t-test gave a p-value \(< 0.001\)). Qualitative examples of 3D SC detection are illustrated in Fig. 2.

Moreover, OptiC outperformed Hough on challenging images such as pathological cases: the localization rates were \(97.05 \pm 6.85\%\) for OptiC and \(35.63 \pm 45.18\%\) for Hough, the MSE results, for patients with a detected cord (localization rate \(>0\%\)), were \(1.33 \pm 1.39\) mm for OptiC and \(3.69 \pm 5.39\) mm for Hough, averaged across contrasts n = 201 (paired student t-test gave p-values \(<0.001\)).

As a proof-of-concept application, OptiC was used for initializing a SC segmentation method which uses propagation of 3D meshes (PropSeg) [2]. Dice coefficient (DC) calculated between the predicted and the ground-truth segmentations were \(0.87 \pm 0.15\) when using OptiC initialization versus \(0.45 \pm 0.43\) when using the default initialization (n = 560, paired student t-test gave p-values \(<0.001\)). OptiC was particularly reliable in pathological cases with a DC of \(0.82 \pm 0.16\) versus \(0.36 \pm 0.41\) (n = 201, paired student t-test gave p-values \(<0.001\)).

4 Discussion and Conclusion

OptiC can detect SC centerline on MRI data by solving an optimization problem combining a standard pattern detection algorithm [9] and regularization along the S-I axis. Key benefits of this combination are (1) robustness to image artifacts thanks to the sophisticated normalization HOG scheme [9], (2) anatomical consistency with the cord continuity thanks to shape regularization, (3) robustness of the localization, ensured by the global minimization of the optimization problem, and (4) fast computation time, linear with the number of voxels. However, the current method makes the assumption that the SC is present in each axial slice. Future work can address this issue by rejecting a slice that does not contain the SC.

This paper demonstrated the strong performances of the OptiC method to automatically detect the SC on MRI data. By validating OptiC on a large multi-contrast/center/resolution/field-of-view dataset, both accuracy and robustness of this method have been shown, even on challenging subjects with pathological hyperintense lesions or cord deformations (such as encountered in MS (n = 52) or DCM (n = 52) patients). Moreover, since these good results were obtained with only one training image, it suggests the possibility to create a new model if needed (for example, adapted to a new contrast) without requiring a large amount of training images.

Future work will compare OptiC with other available methods [6], investigate (i) the impact of adding image preprocessing steps and (ii) the optimization of model hyperparameters, such as SVM and HOG parameters, penalization coefficient \(\lambda \), number of training images, characteristics of the training image(s) (vertebral coverage, image resolution). Another promising strategy would be to augment the training data by image rotations around the S-I axis. A proof-of-concept application demonstrated the utility of OptiC for improving SC segmentation, and other applications such as gray matter segmentation or shape analysis could benefit from the proposed approach.