1 Introduction

Coronary artery disease (CAD) is one of the major causes of death in the world. In this disease, the coronary artery get narrowed by a substance called plaque. The narrowness prevents blood to reach the heart properly. This narrowness gradually gets more severe and without treatment, if enough blood does not reach to the heart, heart attack may occur. Another severe problem that may happen in this situation is that the rupture of the plaque made in the arteries can block other vital smaller blood vessels, mainly in the brain, where it provokes a stroke. Cardiologists use different imaging modalities. However, XRA is taken as a gold standard for assessment of CAD [1]. In this imaging method, the patient lies down on the bed, and a thin hallow tube called catheter is inserted through the patient’s arteries from groin, neck, or arm. When the catheter reaches the intended artery, the contrast agent is injected, and usually two to four sequences of heart performance are captured. Cardiologists can find the places of the stenosis and determine their severity by watching these videos. Although XRA images are being extensively used by cardiologists around the world, they are usually very challenging images. Non-uniform illumination, low contrast, low signal to noise ratios, presence of other body tissues, and catheter are some of the most common challenges. In some cases, the mentioned challenges may cause misdiagnosis.

Many image processing methods have been proposed for XRA images. These methods can be categorized into two parts as XRA image enhancement and coronary artery segmentation methods. The aim of the enhancement methods is to improve visual quality of the input XRA image which may help easier segmentation of arteries. In [2], by constructing the Hessian matrix of the input image and analyzing its eigenvalues, a vesselness measure is obtained. Because of some drawbacks of [2], such as noise sensitivity and junction suppression, in [3], a method for vesselness measurement is proposed which is based on decimation-free directional filter bank. In [4], a method for detecting and enhancing the region of interest (ROI) in XRA images was proposed. In this method, the vesselness measure of Hessian filter is enhanced using guided filter. Since the diaphragm border is present in some XRA images and may mislead the artery segmentation method, in [5], a diaphragm border detection and removal method is proposed. In [6] the authors proposed a method that is able to separate an XRA into three separate layers which are breathing layer, a quasi-static layer, and a vessel layer. These layers were extracted by using morphological closing operator and an online Principle Component Analysis (PCA) algorithm.

Another method for increasing XRA image quality is through using digital subtraction angiography (DSA). In DSA method, a frame at the beginning of an XRA sequence, in which the contrast agent is not injected, is considered as a mask frame. Also, a frame, in which the contrast agent is fully injected, is considered as the contrast frame. Then, the mask frame is subtracted from the contrast frame. In an ideal sequence, in which there is no camera and other body organs like lung and heart movements, the background is omitted in the resulted image. But due to the camera and body organ movements, some artifacts will be generated.

In order reduce the artifacts caused by misalignment in DSA, several methods have been proposed for registration of DSA images. In [7], a three-steps DSA method is proposed. In [8], a multi-resolution algorithm for non-rigid image registration was proposed, in which the input images are decomposed into coarse and fine sub-image blocks iteratively.

Segmentation of the coronary artery in XRA images is usually done after a preprocessing step for enhancement. The aim of the segmentation in XRA images is to detect the whole artery structure automatically without missing any major part. A good segmentation method results in less effort for a specialist to look for the artery tree. Some researches in the recent years have been devoted to coronary artery segmentation methods. In [9], several vessel segmentation methods are reviewed and categorized as pattern recognition, model-based, tracking-based, artificial intelligence-based, neural network-based, and miscellaneous tube-like object detection approaches. In [1], another review is done on coronary artery segmentation methods and their capabilities are compared. In [10], the vesselness measure obtained by Hessian filter was combined with flux flow measurements and the vessels were segmented by analyzing the connected components. In [11], a graph-cut based segmentation method was proposed for coronary artery.

In this paper, we propose a new automatic framework for coronary artery segmentation, centerline extraction, and catheter detection. In the preprocessing stage, due to the low contrast nature of the XRA input images, the contrast is enhanced. For better detecting the artery region, a vesselness detection method is used which is based on Hessian matrix analysis. Also for detecting the image ridges for further processing in the next stages, a proper smoothing method is used which uses the contrast-enhanced image and the vesselness map. In the artery segmentation stage, an efficient superpixel algorithm is exploited for coronary artery segmentation. Also, in this method, in order to find the catheter and reduce the false detection caused by detecting the catheter as an artery, we use our previous catheter detection and tracking method [12].

In summary, the contributions of the proposed method are the following:

  • Segmentation of coronary artery by exploiting a superpixel algorithm in a multi-scale fashion in order to detect arteries with different sizes.

  • Exploiting a catheter detection and tracking method, for reducing the false detection caused by detecting the catheter as an artery.

  • Extracting the coronary artery centerlines by using the calculated segmentation mask and the ridges of the input frame of the XRA sequence.

2 Methods

2.1 Background materials

2.1.1 Superpixel

Superpixel algorithms are segmentation methods used for grouping pixels into perceptually meaningful regions which can be used to replace the rigid structure of the pixel grid [13]. In this method, first of all, a desired superpixel number k is determined on the image with N pixels. Then a superpixel grid is produced with \( \mathrm{SP}=\sqrt{N/K} \) intervals. Each pixel i in the image is assigned to the nearest cluster center whose search region overlaps it. This is done by computing a distance measure shown in (1):

$$ D=\sqrt{d_c^2+{\left(\frac{d_s}{\mathrm{SP}}\right)}^2\ {m}^2} $$
(1)

In Eq. (1), D is the distance between a pixel i and a cluster center, m shows the relative importance between color similarity and spatial proximity, dc and ds are color distance and spatial distance which are shown in Eqs. (2) and (3) respectively:

$$ {d}_c=\sqrt{{\left({l}_j-{l}_i\right)}^2} $$
(2)
$$ {d}_s=\sqrt{{\left({x}_j-{x}_i\right)}^2+{\left({y}_j-{y}_i\right)}^2} $$
(3)

In Eqs. (2) and (3), li, xi, and yi represent the intensity value, row, and column numbers of pixel i respectively. After assigning each pixel to a cluster center, an update step changes the cluster centers to the mean [l, x, y]T vector of all pixels belonging to the cluster. This assignment and updating steps are repeated iteratively until the error, which is computed using L2 norm, converges. By using SLIC superpixel method on XRA images, the superpixels are accurately fit on the arteries borders.

2.1.2 Vesselness map

Vesselness measure is calculated for every pixel, showing the probability of that pixel being a vessel pixel. Vesselness measure could be obtained by using Hessian filter [2]. In this filter, at the beginning, the Hessian matrix of the input XRA image I is constructed as follows:

$$ H=\left[\begin{array}{cc}{I}_{\mathrm{xx}}& {I}_{\mathrm{xy}}\\ {}{I}_{\mathrm{xy}}& {I}_{\mathrm{yy}}\end{array}\right] $$
(4)

Where, Ix and Iy are computed by convolving the first order derivatives of Gaussian function in horizontal and vertical directions on the original image I as shown in Eqs. (5) and (6):

$$ {I}_x={\sigma}^l{G}_{x,\sigma}\ast I $$
(5)
$$ {I}_y={\sigma}^l{G}_{y,\sigma}\ast I $$
(6)

In Eqs.(5) and (6), ∗ is the sign for the mathematical convolution operator, and l is the Lindberg factor used for normalizing the images derivative in different scales, which is 1 in this method. Also, Gx, σ and Gy, σ are the first-order derivatives in x and y directions of the Gaussian function with standard deviation of σ respectively. The second order derivatives Ixx, Iyy indicated in Eq. (4) are obtained by convolving the second-order derivatives of Gaussian function in horizontal and vertical directions on I. By considering two eigenvalues of the Hessian matrix as λ1 and λ2 that λ1 < λ2, the vesselness measure for scale s is computed using Eq. (7):

$$ {V}_o(s)=\left\{\begin{array}{c}0\kern12.5em if{\lambda}_2<0\\ {}{e}^{-\frac{{R_B}^2}{2{\beta}^2}}\left(1-{e}^{-\frac{S^2}{2{c}^2}}\right)\kern4.25em if{\lambda}_2\ge 0\end{array}\right. $$
(7)

where \( S=\sqrt{\lambda_1^2+{\lambda}_2^2} \) is the structural similarity measure and RB = λ1/λ2 is the non-similarity measure. Also β and c are two thresholds that control the non-similarity and the structural similarity measures respectively. The Hessian final vesselness measure is obtained by using all scales as follows:

$$ V=\underset{s_{\mathrm{min}}\le s\le {s}_{\mathrm{max}}}{\max }{V}_o(s) $$
(8)

In Eq. (8), V is the final vesselness measure and smin and smax are minimum and maximum scales used for vessels.

Because of noise sensitivity and junction suppression of Hessian filter, in [3], decimation-free directional filter bank (DDFB) is used. In this method, in order to prevent image degradation due to alignment of vessels with x-axis, the coordinates are rotated. Hence, the Hessian matrix is changed as follows:

$$ {H}^{\prime }=\left[\begin{array}{cc}{I}_{x^{\prime }{x}^{\prime }}& {I}_{x^{\prime }{y}^{\prime }}\\ {}{I}_{x^{\prime }{y}^{\prime }}& {I}_{y^{\prime }{y}^{\prime }}\end{array}\right] $$
(9)

where

$$ {I}_{x^{\prime }{x}^{\prime }}={I}_{\mathrm{xx}}{\cos}^2{\theta}_i+{I}_{\mathrm{xy}}\sin \left(2{\theta}_i\right)+{I}_{\mathrm{yy}}{\sin}^2{\theta}_i $$
(10)
$$ {I}_{y^{\prime }{y}^{\prime }}={I}_{\mathrm{xx}}{\sin}^2{\theta}_i+{I}_{\mathrm{xy}}\sin \left(2{\theta}_i\right)+{I}_{\mathrm{yy}}{\cos}^2{\theta}_i $$
(11)
$$ {I}_{x^{\prime }{y}^{\prime }}=-\frac{1}{2}{I}_{\mathrm{xx}}\sin \left(2{\theta}_i\right)+{I}_{\mathrm{xy}}\cos \left(2{\theta}_i\right)+\frac{1}{2}{I}_{\mathrm{yy}}\sin \left(2{\theta}_i\right) $$
(12)

In Eqs.(10), (11), and (12), θi is the orientation of a directional image with minimum and maximum orientations of θi, min and θi, max which is computed as follows:

$$ {\theta}_i=\frac{\theta_{i,\min }+{\theta}_{i,\max }}{2} $$
(13)

2.2 Proposed method

In this subsection, the proposed framework is explained with details. The block diagram of the proposed framework is shown in Fig. 1. Our method consists of three major stages: preprocessing, catheter detection, and coronary artery segmentation. The results of the preprocessing stage are passed to the catheter detection and coronary artery segmentation stages. After segmenting the coronary artery, and detecting the catheter and extracting the centerlines, three masks are generated for arteries and catheter. Then, they are overlaid on the contrast-enhanced image. The details of each stage are discussed in the following:

Fig. 1
figure 1

Block diagram of the proposed method

2.2.1 Preprocessing

Contrast enhancement

One of the challenging problems in processing XRA images is their low contrast intensity that makes it hard to differentiate vessels from the background. In order to increase the contrast of these images, by considering makes it hard to differentiate vessels from the background. In order to increase the contrast of these images, by considering the scales of arteries, we use multi-scale top-hat transform [14]. In Fig. 2b, the result of applying this transform on an XRA image is shown. By comparing Fig. 2a, b, we can see that the contrast of Fig. 2a has increased properly, and the artery structure is completely visible after contrast enhancement.

Fig. 2
figure 2

Result of the preprocessing stage. a Original image. b Contrast-enhanced image. c Vesselness measurement using directional Hessian-based method. d Smoothed image. e Ridge map

Vesselness measurement

In order to obtain an appropriate vesselness map, we use the method of [4], which has low noise sensitivity and high robustness in junction areas as compared to Hessian filter. We use this vesselness measure in two distinct steps. The first one is for obtaining a vesselness map from the original input image in order to exploit it for smoothing the input image. The second step is for obtaining a vesselness map from the contrast-enhanced image that is used in the segmentation stage for determining the vesselness of each superpixel. In Fig. 2c, the result of applying this vesselness measurement method on an XRA image is shown. By comparing the original image with its vesselness map, we can see that the artery has higher vesselness values as compared to the background.

Guided smoothing

In addition to the presence of artery and catheter structures in the original image and in the contrast-enhanced image, other body organs and tissues might exist in these images. As we want to extract image ridges in the next step, here, we need to smooth the input image. This is done to remove other body tissues and organs that may add some unwanted and extra ridges. Simple smoothing functions such as Gaussian filter can smooth an image properly that may also suppress important image edges. Therefore, we use Guided filter [15] which is an edge-preserving smoothing filter. Here, we used the vesselness map as the guidance image and contrast-enhanced image as the filtering input image. Hence, we can smooth the contrast-enhanced image by preserving its important valleys. In Fig. 2d, the result of applying this edge-preserving smoothing filter on an XRA image is shown. It can be seen that the artery and catheter valleys are preserved appropriately and other regions are smoothed.

Ridge detection

Image ridges have important role in our proposed segmentation and catheter detection. As arteries and catheters are exposed as valleys, finding the valleys and their ridges are essential for their detection. Here, we have exploited a ridge detection method based on [16]. In this ridge, detection method using Eq. (14), valleys that are more than a threshold are obtained and their ridges are determined.

$$ \mathrm{Valley}=\left\{j|{S}_j>{\mu}_v\right\} $$
(14)

In Eq. (14), Valley represents the set of all detected valleys in the smoothed image, Sj is the valley response at pixel j, and μv is the threshold for valley detection. Instead of using one threshold, we use three different thresholds. The higher threshold TH, which generates less ridge lines, is used in the segmentation refinement stage. The medium threshold TM, which results in more ridge lines, is used in the catheter detection and tracking stage. The lower threshold TL, which produces more ridges than medium threshold, is used in the initial segmentation and in the centerline extraction stage. In Fig. 2e, the result of applying this ridge detection method, on the smoothed image with lower threshold TL equal to 0.2, is shown. It can be seen that the image ridges including artery ridges and catheter ridge are properly detected.

2.2.2 Catheter detection and tracking

The purpose of this stage is to detect the catheter ridge in the first frame of the input XRA sequence. The catheter ridges detected in the first XRA frame, and then we can track the catheter ridge throughout the sequence. After detection, a mask for catheter is produced that is used for distinguishing the catheter from the artery.

Catheter detection

In the first few frames of an XRA sequence, only catheter and some artifacts exist. But when the contrast agent is injected, artery ridges appear as well. Therefore, we detect the catheter ridge in the first frame of the input sequence and then track it throughout the sequence.

In order to detect the catheter ridge, we proposed an algorithm based on Hough transform [2]. In this algorithm, we apply Hough transform on the first ridge frame of the XRA sequence and find the top ten longest line segments that are fit on the ridges. In the ridge map, the catheter ridge appears as the longest curve, and more lines are fit on it than other curves in the ridge image. Therefore, the ridge segment with the maximum lines on it is selected as the catheter ridge. Also, if two ridges exist with the same number of line segments on them, we select the ridge with the longest line. In Fig. 3 , the result of the catheter detection algorithm is shown. Figure 3a is first XRA frame; Fig. 3b is the first ridge frame. Figure 3c shows the lines fitted on the first frame ridges. Figure 3d is the catheter ridge that is selected by our proposed algorithm. By comparing Fig. 3b, d, our proposed algorithm could successfully find the catheter ridge in the first frame of the input sequence.

Fig. 3.
figure 3

Result of Proposed catheter detection algorithm. a Original XRA first frame. b First frame ridge map. c Result of finding lines using Hough transform. d Detected catheter ridge

Catheter tracking

Due to the camera and heart motions, the catheter ridge appears to have a movement in different frames. Therefore, the position of catheter ridge in the second frame differs from its position in the first frame of the input sequence. Hence, we can fit a second-order polynomial on the catheter ridge in the first frame and use its parameters in order to find the catheter ridge in the second frame. A second-order polynomial is as follows:

$$ y=\mathrm{a}{\mathrm{x}}^2+\mathrm{bx}+c $$
(15)

By fitting the polynomial in Eq. (15) on the detected catheter ridge in the first frame of the input sequence, we obtain three values for parameters  a, b, and c. We pass these parameters to the second frame and use them as initial values for searching the catheter ridge in limited search area. The second order polynomial, having the most ridge pixels, is detected using Eq. (16). This process is done for all frames sequentially.

$$ {\mathrm{BestCurve}}_i=\underset{a_i,{b}_i,{c}_i}{\mathrm{argmax}}\left\{N\left({a}_i,{b}_i,{c}_i\right)\right\} $$
(16)

In Eq. (16), BestCurvei is the set of coefficients a, b, and c that best fit on the catheter ridge in frame i. Also, N(ai, bi, ci) is the number of ridge pixels that lie on the specified polynomial. The output results of this catheter detection and tracking method will be further discussed in the next section.

2.2.3 Coronary artery segmentation

Here, we propose our coronary artery segmentation method. In this method, initially a naive segmentation is done using superpixel and ridge map. Then, the result of the initial segmentation is refined by finding the orthogonal lines on the arteries and removing extra parts including the background.

Initial segmentation

In this paper, we exploit SLIC superpixel algorithm [13] for artery segmentation. In Fig. 4, the result of applying SLIC superpixel algorithm on a contrast-enhanced XRA image is shown. By applying SLIC superpixel algorithm on XRA images, superpixels are completely fit on artery specially the main vessels. Considering Fig. 4b, in order to segment the artery using superpixel algorithm, there should be an automatic mechanism for making decision on each superpixel, whether that superpixel is on the vessel or not. This is challenging because it directly affects the accuracy of the segmentation task. We use both the contrast-enhanced image and the vesselness map, which were obtained from the preprocessing stage. At first, the SLIC superpixel algorithm is applied on the contrast-enhanced image, as illustrated in Fig. 4. Each contrast-enhanced image has a corresponding vesselness map. Therefore, the superpixel grid obtained on the contrast-enhanced image (e.g., shown in Fig. 4b) is laid on the corresponding vesselness map. This task is shown in Fig. 4c, d. For each superpixel in the contrast-enhanced image in Fig. 4c, we have a corresponding superpixel in its vesselness map in Fig. 4d. Let Ice and Iv be the contrast-enhanced image and the vesselness map respectively. Then, the average intensities of every two corresponding superpixels in Ice and Iv are computed as follows:

$$ {n}_{\mathrm{ce},{s}_i}=\frac{\left\{{\sum}_j{s}_i(j)|{s}_i\in {I}_{\mathrm{ce}}\right\}}{N_{s_i}} $$
(17)
$$ {n}_{v,{s}_i}=\frac{\left\{{\sum}_j{s}_i(j)|{s}_i\in {I}_v\right\}}{N_{s_i}} $$
(18)

where \( {n}_{\mathrm{ce},{s}_i} \) and \( {n}_{v,{s}_i} \) are the average intensities of the ith superpixels in the contrast-enhanced image and vesselness map respectively. Also, j and \( {N}_{s_i} \) are the jth pixel and the number of pixels in the ith superpixel respectively.

Fig. 4
figure 4

Result of applying SLIC superpixel on an XRA image. a Contrast-enhanced XRA images. b SLIC result on a. c Superpixel grid on Contrast-enhanced XRA image. d Superpixel grid on vesselness map

As shown in Fig. 4c, artery pixels are darker than the background pixels in the contrast-enhanced image. This situation is opposite in the vesselness map where artery pixels are brighter than the background pixels. Therefore, the value of \( {n}_{\mathrm{ce},{s}_i} \) should be low in artery superpixels, and it should be high in background superpixels. On other hand, the value of \( {n}_{v,{s}_i} \) should be high in artery superpixels and low in background superpixels.

In order to distinguish artery superpixel from background superpixels, we compute a vesselness probability for each superpixel as follows:

$$ {\rho}_{s_i}={n}_{v,{s}_i}-{n}_{\mathrm{ce},{s}_i} $$
(19)

where \( {\rho}_{s_i} \) is the vesselness probability for the ith superpixel. The value of \( {\rho}_{s_i} \) in Eq. (19) is normalized between 0 and 1. After normalization in the artery superpixels, due to the large values of \( {n}_{v,{s}_i} \) and small values of \( {n}_{\mathrm{ce},{s}_i} \), the \( {\rho}_{s_i} \) values should be high (near 1). In the background superpixels, due to the small values of \( {n}_{v,{s}_i} \) and large values of \( {n}_{\mathrm{ce},{s}_i} \), the \( {\rho}_{s_i} \) values should be low (near 0). Therefore, a vesselness probability is obtained for each superpixel. In order to find artery superpixels, we determine a threshold for \( {\rho}_{s_i} \) values as illustrated in Eq. (20):

$$ \left\{\begin{array}{cc}{s}_i\in \int Vessel& if{\rho}_{s_i}\ge T\\ {}{s}_i\in \int Background& if{\rho}_{s_i}<T\end{array}\right. $$
(20)

where si is the ith superpixel and T is the threshold. Therefore, the superpixels, with \( {\rho}_{s_i} \) values higher than T, are determined as vessels. Also, superpixels with \( {\rho}_{s_i} \) lower than T are considered as background. It is worth mentioning that a very low T value will cause a large part of the background to be selected as arteries and a high T value will dismiss major artery parts. Therefore, a tradeoff should be considered.

In order to make the initial segmentation better, we use the low threshold (TL) ridge map obtained in the preprocessing stage. We find ridges that have overlapped with the segmented regions using superpixels. Any superpixel, which lies on these overlapping ridges, is added to the segmentation result.

In XRA images, arteries with different scales are present. Hence, working with just one scale of superpixels is problematic, and we may lose major parts of arteries. Hence, the whole procedure is performed for three different superpixel scales. Then the three initial segmentation maps obtained from the three scales, are used for generating a unique initial segmentation result. In order to do this, we used a voting mechanism between each corresponding pixel in these three maps. Here, for each pixel, if more than one map votes to its vesselness, the pixel is considered as vessel and otherwise it will be treated as background. In Fig. 5, the results of the initial segmentation stage on two different XRA images are shown. By comparing the segmentation results with the original XRA images, it can be seen that the initial results have completely segmented the arteries. In the initial segmentation results, in addition to the arteries, some background superpixels are also selected as arteries due to having high \( {\rho}_{s_i} \) values (as some background parts resemble the arteries). Therefore, in order to remove the extra parts, we need to do some refinements on the initial segmentation obtained in this step. Therefore, in order to remove the extra parts, we need to do some refinements on the initial segmentation obtained in this step.

Fig. 5
figure 5

Results of initial segmentation. a, b Original XRA images. c, d Final results of the initial segmentations stage

Segmentation refinement

In order to remove the background parts from the initial segmentation result, we process the initial result using orthogonal lines on arteries. For this purpose, the ridge map obtained in the ridge detection stage using a high threshold (TH) is filtered using initial segmentation result. Therefore, the extra ridges are removed.

For finding the orthogonal lines on arteries, as illustrated in Fig. 6, we traverse the ridges and on each ridge pixel O a circle C with the diameter of d is considered that is centered on O. For this circle, all the diameters, with different direction from 1 to 180°, are determined. Then, the average intensities of these diameters are computed. In Fig. 6, the line R is the ridge line and the diameter L is the orthogonal line. As the arteries are darker than the background and the orthogonal diameter has the least number of pixels in the artery, the diameter with the highest average intensity is determined as the orthogonal diameter. In Fig. 7, the result of applying the proposed algorithm for finding orthogonal line is shown. The diameters are the white lines. For example, the diameter with 1, 45, 90, and 180°,, and are shown and the diameter with 165° is detected successfully as the orthogonal line.

Fig. 6
figure 6

Segmentation refinement procedure. The aim here is to detect the green line (L) which is orthogonal to the artery in point (O)

Fig. 7
figure 7

Result of finding orthogonal line. a Original XRA image. b 1° diameter. c 45° diameter. d 90° diameter. e 180° diameter. f The orthogonal diameter with165°

Because of the presence of noise in the contrast-enhanced image, the intensities of orthogonal line pixels are smoothed using an averaging filter. We need to further remove the extra ridge pixels that are still present. Hence, we filter these ridge pixels by considering pixel intensities that exist on the lines orthogonal to these pixels. As the orthogonal lines pass across the arteries at each ridge pixel, their intensities should make an inverse Gaussian profile. Such Gaussian profile has a minimum in the middle and two maximums, one in each side as illustrated in Fig. 8. This means that the differences between the minimum and the two maximums should be higher than a value. Otherwise, the profile does not belong to an artery. Therefore L1 and L2 shown in Fig. 8 should be higher than a minimum distance threshold Td as there may be some exceptions in some XRA images; in which the contrast of the vessels are generally low, we consider another criterion that may keep some ridge pixels that are on vessels and removed using Td threshold. For this aim, firstly, the intensity of contrast-enhanced image pixels corresponding to ridge pixels is sorted in ascending order. Then the average of the fourth quarter of these intensities is computed and named as ar. For each ridge pixel, we find its corresponding pixel value in the contrast-enhanced image. If the grayscale value of that pixel is higher than average value ar, that ridge pixel is kept as an artery ridge. This adaptive threshold will be more robust to varying XRA image quality.

Fig. 8
figure 8

A sample Gaussian profile that is created by the intensities of an orthogonal line to a vessel region

After removing the extra ridge pixels, on the remaining pixels, the Gaussian profiles of the orthogonal lines are processed in order to find the two boundaries of the arteries on each ridge pixel. This process is illustrated in Fig. 9. Here, we begin the search from each side of the profile and compute the difference between the current pixel and the next pixel. If the difference is larger than or equal to a pre-defined threshold, the current pixel is considered as the boundary pixel, otherwise the threshold value is reduced and a new search is performed. As shown in Fig. 9, Ti and Tj are two different thresholds satisfied by d1 and d2 respectively.

Fig. 9
figure 9

Processing a sample Gaussian profile of an orthogonal line to a vessel region in order to find the two boundaries of the arteries on each ridge pixel

After finding the boundary pixels on two sides of a ridge pixel, the minimum of distances between the ridge pixel and the two boundary pixels is computed as rd. Then, a circle centered on the ridge pixel with the radius of rd is drawn. By doing this, a mask for arteries is obtained. By multiplying the obtained mask by the previous mask obtained in the last step using superpixels and ridges (initial segmentation mask), the final arteries mask is formed.

In Fig. 10, the result of this refinement process is shown. By comparing Fig. 10a, b with the initial segmentation results in Fig. 5c, d, it can be seen that the proposed refinement procedure has removed the extra background parts that were counted as arteries segment.

Fig. 10
figure 10

Final results of segmentation and centerline extraction. a, b Final segmentations results. c, d Final centerline extraction results

Centerline extraction

In order to find the artery centerlines, we use the segmentation mask obtained in the former step. By multiplying this mask by the low threshold (TL) ridge map, the extra ridges are removed, and the ridges corresponding to the artery are remained which are the centerlines of the vessels. In Fig. 10c, the final result of centerline extraction is shown. By considering the segmented arteries, it can be observed that the centerlines of the segmented vessels are extracted properly.

3 Results

In this section, we present the evaluation results of our proposed catheter detection and tracking and coronary artery segmentation methods. In multi-scale Top-Hat transform, the structuring elements were disk shape with varying sizes from 3 to 19. In the vesselness map measurement, four different scales were considered as \( 3\sqrt{2} \), \( 4\sqrt{2}, \) \( 5\sqrt{2} \), and \( 6\sqrt{2} \). Therefore, the scale parameters smin and smax in the vesselness map section were initialized as \( 3\sqrt{2} \) and \( 6\sqrt{2} \). Also the two thresholds β and c were set to 0.5 and 450 respectively. The parameters in the Guided filter were window radius r and regularization parameters ϵ that were set to 8 and 0.2 respectively. The low, medium, and high thresholds for ridge detection method were taken as 0.2, 0.25, and 0.4 respectively. In the SLIC superpixel algorithm, the parameter in hand for changing the scales of the superpixels is k, which denotes the number of desired superpixels in the input image. Therefore, in order to obtain three different superpixel scales, we used three different values for k as 2000, 3000, and 4000. The T threshold for differentiating between vessels and background superpixels was set as 0.5. The Td threshold in the refinement step was set to 0.2, and the d diameter was set to 25 pixels. In Figs. 11 and 12, we present the qualitative and quantitative evaluation results of our proposed catheter detection and tracking method. In Figs. 13 and 14 as well as Tables 1 and 2, we compare our coronary artery segmentation method qualitatively and quantitatively with one of the state-of-the-art methods [11], which is based on a Graph-cut algorithm. We also present the comparison of the time complexity of our proposed method and [11] in subsection 3.E. For the comparison, two challenging datasets, DS1 and DS2 containing 164 and 298 XRA images respectively, were collected including 8-bit images with 512 × 512 pixels. In all of the tested XRA images, different kinds of artifacts such as non-uniform illumination, low contrast, other body organs, and low SNR exist. These angiography images were collected from different hospitals, and some of them have brighter scene while the others are darker. Also, in all of the tested images for segmentation, the artery tree is completely visible. The DS1 includes XRA images in which just the arteries are present or if the catheter is present, it has no overlap with the arteries, while the DS2 includes XRA images in which in addition to the existence of the arteries, the catheters are also present and have overlaps with the arteries.

Fig. 11
figure 11

The qualitative evaluation of the proposed catheter detection and tracking method. a Original first frame. b Before injection. c Beginning of injection. d Full injection. e End of injection

Fig. 12
figure 12

Catheter tracking precision computing procedure

Fig. 13
figure 13

Qualitative comparison of proposed method and [11], on several DS1 XRA images. a Original XRA images. b Segmentation results using [11]. c Segmentation results using the proposed method

Fig. 14
figure 14

Qualitative comparison of proposed method and [11], on several DS2 XRA images. a Original XRA images. b Segmentation results using [11]. c Segmentation results using the proposed method

Table 1 Quantitative evaluation on DS1 dataset
Table 2 Quantitative evaluation on DS2 dataset

3.1 Qualitative evaluation of the catheter detection

The results of applying the proposed catheter detection and tracking method are shown on four different XRA sequences in Fig. 11. In Fig. 11, each sequence is shown in a row. Their first frame is shown in the first column. The other four columns consist of four different phases including before injection, beginning of injection, fully injection, and end of injection. In all of these frames, the detected catheters are shown in red. It can be seen that the proposed method successfully tracks the catheter. Even the presence of arteries and their overlapping with the catheter do not affect the performance of our method. Also, in sequences shown in Fig. 11, the catheter displaces, and these displacements have not blundered our method. The qualitative results of the detection and tracking of catheter in the challenging sequences shown in Fig. 11 prove the high effectiveness and accuracy of our method.

3.2 Quantitative evaluation of the catheter detection

In order to quantitatively evaluate our proposed catheter detection method, we compute the precision on 25 challenging XRA sequences containing catheter. For computing the precision in each frame, we count the pixels of the second-order polynomial that do not lie on the catheter. An example of the counting procedure is illustrated in Fig. 12. Green pixels are those that are correctly counted (true positive) and the red pixels are incorrectly considered (false positive). The precision of our method on these sequences turned out to be 0.9597. This high value of precision demonstrates the effectiveness of our method in XRA sequences. Detection and tracking of catheter in such sequences are very challenging.

3.3 Qualitative evaluation of the proposed segmentation method

In Fig. 13 and Fig. 14, the qualitative results of the proposed segmentation method and method of [11] are compared. Images in Fig. 13 were selected from DS1. In the first row of Fig. 13, the original XRA images are shown. In the second row, the segmentation results of the compared method are shown in green, and in the third row, the results of proposed segmentation method are shown in red. The extracted centerlines are shown in green in our results. By comparing the proposed segmentation results with method [11], in Fig. 13, it can be seen that the proposed method has properly segmented the major parts of the arteries but the compared method, has some failure in detection. For example, in Fig. 13, in column (d), they cannot find the arteries. Also, in column (e), (f), (g), and (h), the compared method could not segment the main arteries completely. On the other hand, the proposed method has completely segmented the major arteries which are vital for stenosis detection. For instance, in column (h), our segmentation method has segmented the arteries even in the non-uniform illumination, but this situation has prevented the compared method, from segmenting the whole structure of the arteries.

Also in Fig. 14, the comparisons between our method and [11], on XRA images from DS2 are presented. In the first row of Fig. 14, original images are shown; segmentation results of the compared method shown in the second row, are shown in green; and in the third row, the results of our proposed artery, segmentation are shown in red. Also the results of the catheter detection method and the extracted centerlines are shown in blue and green respectively. In all of these images, the compared method, like other coronary artery segmentation methods, detects the catheter as an artery which causes increase in the false detection. Furthermore, in Fig. 14 in all columns from (d) to (h), the graph-cut based method [11], detected the catheter as the artery. Also as shown in column (e) and (f), the compared method just segmented the catheter and was not even able to detect the artery. But our proposed segmentation method consists of a catheter detection method which can reduce the false detection of our segmentation method in cases that the catheter exists in XRA frames. Figure 14 shows the necessity of a catheter detection method appropriately which improves the segmentation results.

3.4 Quantitative evaluation of the proposed segmentation method

In order to compare our method with [11], the results of both methods were assessed by a cardiologist on DS1 and DS2 datasets. The cardiologist labeled each processed image by one of the following labels:

Label 0: Insufficient—major vessels are missing (not just branches) or major areas without vessels are inappropriately identified as vessels.

Label 1: Limited—major vessels are identified but the results do not include substantial branches or they inappropriately include substantial areas without vessels.

Label 2: Good—major vessels and substantial branches are included; only minor branches that are unlikely to be clinically significant are missing.

Label 3: Excellent—the entire vasculature from major vessels to major and minor branches are included.

The evaluation results for DS1 and DS2 are presented in the Tables 1 and 2 respectively. By comparing the result shown in Table 1, we notice that our method outperforms method of [11] as none of the results of our method were labeled as 0. Also, our proposed method was labeled as 2 or 3 more than the compared method. These results demonstrate that our method is more reliable. The results in Table 2 show the effectiveness of a catheter detection method in the performance of an artery segmentation method. As shown in Table 2, 37% of the results of the graph-cut based method on DS2 dataset were labeled as 0. This is in contrast to our method which only has 1% of such labels. On the other hand, none of the results of the compared method were detected as excellent as it segmented the catheter as an artery. Generally, 83% of the images processed by our proposed segmentation method were labeled as good or excellent, while this score for the compared method is 48%.

3.5 Time complexity comparison

In order to compare the time complexity of the proposed method with [11], we executed both methods in MATLAB on the same system with Core i7 2.6 GHz and 8GB RAM. The proposed method required 67% less time than the compared method. It should be noted that some parts of the graph-cut source code in the compared method, is written in C language which is much faster than a correspondent MATLAB code.

4 Discussions

The coronary artery segmentation method proposed in this paper is based on the superpixel technique. To the best of our knowledge, none of the previous coronary artery segmentation methods have ever used superpixels for segmentation. The reason for proposing a superpixel based method for segmentation is that superpixels are a group of pixels that make the segmentation procedure much easier as they fit on borders of major arteries. Therefore, the only work that is remained is to select the superpixels inside the vessels. As shown in the previous sections, by increasing the contrast of the input XRA images, the superpixels are better able to group the input image pixels into correct clusters (arteries and background). Also, as the superpixel algorithm cannot handle the varying scales of the vessels in each frame, we used multiple superpixel scales. By combining the results of the multiple superpixel scales, handling the problem of different vessels scales was solved. Another reason for proposing a superpixel-based segmentation method is the speed of the superpixel segmentation method. This high speed besides of the high pixels clustering accuracy helped our proposed segmentation algorithm to segment coronary artery in a few seconds even in the presence of artifacts.

Due to the similar shape of the catheter and the arteries, segmentation methods fail in not to segmenting the catheter as the artery. Usually, the segmentation methods do not segment the catheter as arteries when the catheter and the artery tree do not have any overlap. Because the biggest connected component that would result is the coronary artery, therefore, by choosing the biggest connected component, the catheter would not be selected. When they have overlap, the segmentation methods segment them as arteries which will cause an increase in the false detection of those methods. In this paper, our previous catheter detection and tracking algorithm was used in a unified framework with our segmentation method in order to reduce the false detection caused by detection of the catheter as artery.

Another important work that can be done on XRA images is to extract the centerlines of the vessels. The extracted centerline can assist the specialists to find the possible stenosis easier. In the proposed method, we extracted the artery centerlines using the calculated artery segmentation mask. By multiplying this mask with the image ridges, artery centerlines were extracted.

There are still some works in this area that can be done. In the proposed method, whenever we wanted to use the catheter detection method, we assumed that we know in which sequences the catheter exists. A possible future work can be an automatic method for deciding whether the catheter exists in a frame or not. If it exists, then the catheter detection method exploited in this paper can be used; otherwise, the catheter detection method is bypassed. Another future work is to automatically exploit the extracted centerlines of the coronary artery for finding the possible stenosis regions in the artery with their severity percentage using a learning algorithm.

5 Conclusions

A new automatic method for coronary artery segmentation, catheter detection, and centerline extraction was proposed. The proposed artery segmentation method was based on superpixel processing. Also, we exploited our previous automatic catheter detection method for reducing the false detection caused by detecting catheter as artery. We evaluated our catheter detection and artery segmentation method and compared it with one of the state-of-the-art methods. The comparison results showed the superiority of the proposed algorithm to the compared method.