Keywords

1 Introduction

Skull stripping is a process of the brain tissue segmentation (cortex and cerebellum) from surrounding region (skull and nonbrain area). It is also a very important preprocessing step which precedes further analysis in case of many MRI neurological images (such as image registration or tissue classification) [7]. In clinical practice, this method is widely used in developing automated methods for progress evaluation of neurodegenerative diseases such as: Alzheimer’s disease, multiple sclerosis and other neurological disorders like brain aging or even some mental illness.

In search of the most effective skull stripping techniques there were proposed many innovative automatic and semiautomatic brain segmentation techniques [1–3, 6], particularly in the filed of MR image processing. However, published studies comparing common used algorithms [5] demonstrate that each of methodologies has significant number of advantages and disadvantages as well, so it’s very difficult to find one approach which could be consider as the ideal solution.

These factors result in increasing need for the further development and examination of new effective skull stripping methods. In this paper one of approaches will be introduced.

2 Proposed Method

All images used and processed in this paper are the private property of the Author. They were registered in the John Paul II Hospital in Cracow. The images were registered with the following acquisition parameters: magnetic field: 3T, Spin Echo sequence, T1-weighted, slice thickness: 3 mm and contrast application). During selection of images for algorithms evaluation, the key criteria was to ensure their representativeness (to choose the most common type of images, which are also most often processed and compared in scientific dissertations). Algorithm was tested on images in all 3 projections, all scans were acquired in the middle of the T1-weighted session so that the area of the brain was possibly the greatest in in any case.

Skull stripping techniques can be divided into 3 main categories [7]:

  • Intensity-Based methods. They are based on the threshold classification. The main disadvantage of this approach is its significant sensitivity for intensity fluctuations (in case of MRI caused for example by magnetic field inhomogeneity, registered noise or even device’s properties)

  • Morphology-based Methods. The basic idea is to combine the use of morphological operations, thresholding and edge detection techniques, in order to separate the area of the brain from the surrounding tissue in the most precisely way.

  • Deformable Model-based Methods which applied the active contour deformation and fitting to localise brain area and its identification by using image characteristic.

The algorithm presented in this paper belongs to morphology-based methods’ group. It was implemented using JAVA and MATLAB environment [9–11]. The proposed method has 5 steps.

  1. 1.

    image thresholding (segmentation),

  2. 2.

    filling the gaps in extracted objects using morphological operators,

  3. 3.

    edge detection and improving the edges if it’s needed

  4. 4.

    selection of the largest area in the image and creating a binary mask

  5. 5.

    combining the binary mask and the input image as an output image.

The simplicity of this method which is clear, is one of its more significant advantages rather than flaws. In comparison with the methods used commonly and commercially (AFNI, FSL, Robex algorithm), the proposed algorithm due to its simplicity has a lower computational complexity, process .jpg and DICOM files (usually in these formats medical data are available for patients), enables work on other operating platforms than UNIX, does not require a specialized knowledge about program’s structure (the only requirement is to install the MCR Installer on computers without Matlab environment). At the same time, despite its simplicity, the algorithm gives good visual results. Furthermore its proper working was confirmed by combining the input image and the image with brain extraction mask borders. Mask borders and brain borders in anatomical image are nearly the same! The obtained results of algorithms application and comparison with other methods were shown in further parts of this paper.

Fig. 1.
figure 1

Different thresholding method comparison (sagittal plane). From left to right: input image, global threshold, local threshold, mixed threshold

2.1 Image Thresholding

Image thresholding is essential for best algorithm’s effectiveness. It allows to separate the background noise and foreground brain tissues [8]. In this paper 3 techniques were tested [9]:

  • Global Thresholding. It relies on selection of the arbitrary threshold (usually it is gray scale image mean or median intensity) and its comparing with each pixel value. If the value is greater than or equal to the threshold the pixel is converted to white (for values smaller than threshold pixel became black).

  • Local Thresholding. In this method separate threshold is determined for a particular part of the image or each pixel individually. Frequently the threshold is calculated as mean or median intensity value in pixel’s surrounding with defined radius.

  • Mixed Thresholding which is the same as the local thresholding with only one difference: if the mean or median local to a given pixel differs, by more than a predetermined value from the global threshold, global thresholding is applied.

The best results were obtained for mixed thresholding method. Local thresholding leaves too many details in the image, which made it unclear with specific structures poorly separated. In case of global thresholding part of the important (from the diagnostic point of view) edges were removed from the image, what disqualifies this method for further application. In Figs. 1, 2, 3 the results for each technique and each imaging plane were presented.

Fig. 2.
figure 2

Different thresholding method comparison (horizontal plane). From left to right: input image, global threshold, local threshold, mixed threshold

Fig. 3.
figure 3

Different thresholding method comparison (coronal plane). From left to right: input image, global threshold, local threshold, mixed threshold

2.2 Designing a Mask for the Brain Extraction

The next step was to create a mask which multiplied by the input image would allow to extract only the brain tissue region. Mask was designed using morphological operations, which are based on the application of so called (structural element). It is a set of pixels which may have different shapes and sizes and contain any combination of 0 and 1 values. If pixel’s value is not significant it could be marked in structural element as z. Following morphological operators were applied in proposed method:

  • Dilatation (thickening). The structural element is compared with each pixel of the image. If at least one pixel the neighborhood has a value equal to “1”, the focal point also receives it (in another case is assigned the value “0”). Types of structural element strongly affects the output image.

  • Erosion (thinning). This operation applies rotated structural element for each pixel in the image. If even one pixel in the neighborhood has a value equal to “0”, the focal point also receives this value. Otherwise, its value does not change. This is an operation which is the inverse of dilatation. Erosion is significantly influenced by the choice of the structural element

  • Opening. Imposition of dilatation operation on the result of the erosion of the original image. It causes image smoothing (removal of details, the greater the structural element is used, the stronger image smoothing can be observed).

  • Closing. The imposition of erosion operations on the result of dilatation of the original image. It removes all the holes in the image and the concave lower than the structural element (the greater structural element, the more elements are filled in).

During creating the mask, the main goal was to examine the influence of the various structural elements (shape, size) and the sequence morphological operations selection, for the output mask image. Matlab packages allows to analyze up to nine types of structural elements with different shapes and sizes: diamond (with defined radius), disk (with defined radius), line (with defined length and angle), octagon (with defined distance from the structuring element origin to the octagon’s size, along to the vertical and horizontal axis), pair (the structure with 2 elements), periodicline, rectangle (with specified 2-piece vector defining its size), square (with specified width) and even arbitrary structural element (shape defined by user). In the first step of choosing the optimal structural element, the line and periodicline options were rejected. Assuming that in each imaging plane, the brain structure is nearly symmetrical, structural element should not favor any processing direction. In a consequence it cannot take the angle as a procedure input parameter. In the next step, the square and rectangular structural elements were rejected as well form the further analysis. It was examined that increasing their size of even one pixel can cause unwanted sharpening of the brain edges. The mask constructing procedure should guarantee keeping the edges unchanged in their course and shape, because of their diagnostic value. On the other hand, rectangular structural element was used as very effective in later algorithm’s stages for removing single black pixel (or small group of pixels) within a created mask. Disk, square, diamond and octagon structural elements were tested. It was assumed that due to the edge course, the structural element size can not be too high. Disk with radius equal to 3 has 25 elements (\(5\,\times \,5\) matrix) and square element with width equal to 5 and give same unsatisfactory results. Diamond with the same radius 3 and octagon in the smallest possible size has 49 elements (\(7\,\times \,7\) matrix). That is why the maximum acceptable radius of structural element was assigned as 2. For this size disk and diamond look identical. Finally, the disk element with radius equal to 2 was chosen as providing the best visual results. Unfortunately even then it was not possible to avoid leaving some small unwanted clusters of black pixels. In some cases these clusters caused additional signal areas extractions inside the mask area. Therefore in this step all the gaps in the image were removed by using morphological operators once again (square structural element as it was mentioned before). In Figs. 4, 5, 6 the received masks for each imaging plane were shown.

Fig. 4.
figure 4

The following steps of creating mask for brain region extraction (coronal plane). From left to right: image after mixed thresholding, mask received after image erosion, mask revised by removing small areas from the image

Fig. 5.
figure 5

The following steps of creating mask for brain region extraction (sagittal plane). From left to right: image after mixed thresholding, mask received after image erosion, mask revised by removing small areas from the image

Fig. 6.
figure 6

The following steps of creating mask for brain region extraction (horizontal plane). From left to right: image after mixed thresholding, mask received after image erosion, mask revised by removing small areas from the image

2.3 Edge Detection

Edge detection allows to verify if there is a correlation between the edges of the mask (applied for the brain extraction) and the anatomical edges of the input image. Overlap of the brain’s boundaries in the input image with the boundaries set by the proposed skull stripping method would prove that algorithm is correct. For each imaging plane the Canny edge detection filter was applied. Next, image presenting the edges was combined with corresponding input image. In each case correlation was confirmed which means that mask corresponds to the brain area and that it can be applied for the brain extraction.

Fig. 7.
figure 7

The effect of imposing the edge of the brain extraction mask on the input image (in all planes)

2.4 Selection of the Largest Area in the Image

The main purpose of next step is to find the largest area in the image of connected white pixels representing the brain tissue.

Fig. 8.
figure 8

Skull stripping result after algorithm implementation in all planes

The goal was achieved by assigning labels to each object in the image and counting the number of pixels with a given tag. This operation was performed using built-in Matlab functions. Based on the results a mask representing the brain area was created. With the received mask it was possible to separate the brain tissue (represented by white pixels) from the area diagnostically irrelevant(background represented by black pixels). The last algorithm step was combining the binary mask image and an input MRI image. The output image consists only this part of the input image that corresponds to the brain tissue. In Fig. 8 the results of skull stripping for each imaging plane was shown. The method gave the satisfactory and promising results, although after more careful analysis it can be seen that some part of the information is missing. It is particularly visible on the edges of the isolated brain (white matter area). In addition, the edges are slightly sharpened, and in a consequence the shape of the brain is not recreated in an ideal way.

2.5 Comparison with Other Methods

To be able to fully evaluate the algorithm’s capabilities it is necessary to compare it with other commonly used brain extraction methods.

The most popular are AFNI (3DSkullStrip module) [13] and FSL (BET algorithm) [14]. AFNI approach is automated process based on three steps: preprocessing (removing artifacts and brain positioning), expanding a spherical surface (until it envelopes the brain) and finally creating all sets of masks and surfaces for brain modeling. FSL is a set of libraries of analysis tools for fMRI (Functional Magnetic Resonance Imaging), MRI and DTI (Diffusion Tensor Weighting) brain imaging data. Unfortunately, it was found that both programs have certain limitations, critical for the comparing them with proposed algorithm. The main difficulty is related to the type of supported files: both programs process only files with the .nii extension (Neuroimaging Informatics Technology Initiative, NIfTI), optionally .dcm files (Digital Imaging and Communications in Medicine, DICOM) after their conversion to .nii. During preparing this article Author did not have access to this kind of files and conversion was obligatory. The second limitation is that program dependant on operating system: both programs run under Unix and MacOS (none of them runs directly under Windows environment). What is more AFNI approach requires at leat 16 MRI scans (only 3D brain extraction is possible), what ultimately made it impossible to compare developed algorithm with AFNI results. Taking it into consideration, it is crucial to highlight the advantages of the Authors method and its suitability for processing .jpg files, specially under the Windows operating system. Short comparison of the developed algorithm and methods AFNI and FSL was shown in the Table 1.

Table 1. Comparison of the author’s method with FSL and AFNI approach.
Fig. 9.
figure 9

Comparison of the proposed method (b), FSL-BET result (c) and the alternative Matlab approach (d). Horizontal plane. Methods description was presented in the text

Fig. 10.
figure 10

Comparison of the proposed method (b), FSL-BET result (c) and the alternative Matlab approach (d). Sagittal plane. Methods description was presented in the text

Fig. 11.
figure 11

Comparison of the proposed method (b), FSL-BET result (c) and the alternative Matlab approach (d). Coronal plane. Methods description was presented in the text

Obtained images were compared with FSL-BET results and some alternative method, also based on using morphological operators. In case of alternative approach first step was image global thresholding with the threshold equals to After that small noise speckles were removed by using bwareaopen function(the concept of speckles means all connected components that have fewer than 10 pixels). In next step the holes in binary image were removed by applying imfill function. In a final step single erosion with disk structural element (radius 15) was made. The results of all method comparison were shown in Figs. 9, 10, 11. As it can be seen only in case of horizontal plane all methods gave similar results. In case of sagittal and coronal plane, proposed in this paper method not only makes it possible to eliminate the skull structure but also extract only the brain tissue. This was possible thanks to an implementation in the algorithm the part which is responsible for the selection of the largest area in the image. Based on this area, filtration mask was built. It can also be noted that in the alternative method filtration leads to the removal some of the brain tissue sections which is unacceptable in case of diagnostic applications. In addition FSL methods in coronal plane leaves some redundant tissue.

Another approach to verify the algorithm’s effectiveness is to evaluate its performance in the boundary conditions. In this case, it is the analysis of images in which the share of the signal from the skull and the brain tissue is comparable. It turns out that the algorithm may encounter some difficulties at the stage of segmentation (thresholding). The main cause is the lack of the cerebrospinal fluid signal which low intensity (dark, similar to black color) would precisely separate two light areas: the skull and brain tissue. As a result, even in the case of mixed thresholding, automatically predetermined threshold is too low and the tissues are not separated properly. The implementation of further steps of the algorithm was considered unreliable. That is why algorithm’s application in the boundary conditions will be a subject of further development and research. The obtained results was presented in Fig. 12.

Fig. 12.
figure 12

Different thresholding method comparison (horizontal plane). From left to right: input image, global threshold, local threshold, mixed threshold

3 Summary and Conclusions

In this paper a skull stripping method for T1-weighted MRI images based on using morphological operators was proposed. The algorithm gives satisfactory and promising results. However despite the fact the area of the skull was removed from the image completely, closer image analysis shows cerebrospinal fluid (CSF) space the was partially preserved, while it should be removed as well. This will be the subject of further work and algorithm improvement. Another challenge is to correct edge detection of the brain area i.e. by using morphological gradients. In the present algorithm’s version, the edges are sharpened, what is related to the partial loss of information on the borders of the area. Proposed method was compared with the commonly used solutions which have certain limitations associated with programming environment (AFNI, FSL). The algorithm assured comparable and is some cases even better results. High efficiency of the algorithm is associated with the use of the thresholding as one of the basic processing steps which allows for precise separation of the structures. It is planned to perform the algorithm’s evaluation on a large database of images to confirm its effectiveness for images with a higher degree of complexity. The algorithm has a preliminary study status, therefore it is also planned in a future to compare its efficiency with other common used skull stripping methods and taking into consideration gray-scale morphology.