1 Introduction

Stroke is now the leading cause of acquired adult disability worldwide [29]. Stroke is caused mainly by the internal cerebrovascular obstruction or hemorrhagic that causes the brain lack of nutrient and oxygen, leading to brain injury or death eventually. Stroke is classified majorly into two types: ischemic stroke and hemorrhagic stroke, in which ischemic stroke accounts for 70–80% of all stroke incidences. According to the statistics of World Health Organization (WHO), there were about 15.2 million people died of stroke and ischemic heart disease in 2016 and these diseases are still the leading causes of death over the last decade [42]. In 2013, global prevalence of stroke was 25.7 million, in which 10.3 million people suffered first attack [10]. In the USA, stroke ranked as No. 5 among all causes of death in 2014 and is also a leading cause of long-term disability and cognitive impairment; according to the estimates in 1999, there were about 795,000 American experienced a new or recurrent stroke, in which 610,000 people were first attacks and others were recurrent incidences [4]; according to the data during 2011–2014, the overall stroke prevalence was estimated 7.2 million American over 20 years of age, accounting for 2.7% of the population [4]; from 2012 to 2013, the estimated overall cost of stroke was US$33.9 billion [4, 26]; it is projected that, by 2030, 3.88% of the US population over 18 years of age will have had a stroke, and the real total direct annual stroke-related medical costs, in 2010, are estimated to increase from $71.55 billion to $184.13 billion between 2012 and 2030 [31]. Age is one of the essential risk factors for stroke. The probability of suffering a stroke attack is nearly doubled every 10 years over age 55 [41]. Due to the increasing growth of aging population worldwide, it has been a critical challenge to reduce the cost of stroke diagnosis and treatment. Therefore, many investigators are highly interested in the research of stroke fields.

In general, the brain has a high demand for oxygen and glucose, i.e., even though the brain tissue represents only about 2% of the whole body weight, it requires 20% of the body’s total oxygen consumption, and adult cerebral blood flow takes up 15% of the cardiac output [6, 27]. The delivery of oxygen and glucose to the brain via cerebral blood flow is essential for normal brain functions. Clinically, the most common type of stroke belongs to ischemic infarcts. Among the several major vessels in the brain, infarction frequently occurs in the greatest branch of internal carotid artery called middle cerebral artery. The sudden loss of cerebral blood supply, even a few minutes, initiates a series of cellular and molecular cascades that lead to irreversible ischemic brain damage, eventually leading to stroke [39].

Although some therapies and drugs have been developed to inhibit or treat ischemic stroke [7, 32], there is no effective strategy or medication treatment yet to completely prevent or cure the disease. Intravenous thrombolysis using recombinant tissue plasminogen activator (rtPA), for example, is now the only approved medical treatment for acute ischemic stroke. However, the administration of rtPA is limited up to 4.5 h after stroke and its applicable rate is only up to 5% of all patients [11]. Even though for stroke patients, the sooner tPA is given to, the greater the benefit they have, and only approximately one quarter of patients receive timely door-to-needle time ≤ 60 min [12]. Therefore, there is an urgent need for developing new medical treatments for acute ischemic stroke. However, successful translation of preclinical stroke research is rare, which may be attributed partially to the complexity of stroke pathobiology or to the inadequate choice of animal model. Even though the limited application of animal experiments in stroke study, several animal models have been applied in stroke research, providing a better understanding of stroke pathophysiologic mechanisms.

Rodent models have long been employed as one of the important methods for understanding ischemic stroke mechanism [3, 18, 25]. For example, middle cerebral artery occlusion (MCAO), one of the animal models that can closely simulate human ischemic stroke and account for  > 40% ischemic stroke animal experiments, is applied in this study to compensate for the flaw of animal model determination. Staining ischemic brain slice with 2,3,5-triphenyl tetrazolium chloride (TTC) has been considered as a common and reliable method for visualizing the infarct region of an animal brain to reveal the severity of stroke level [3, 18]. Commonly, images of TTC-staining brain slice of MCAO-treated ischemic rats are examined by well-trained experts who are familiar with discriminating TTC-staining images, and the infarcted regions are then determined and analyzed. These rodent stroke animal models can not only provide valuable information of pathophysiology of ischemic brain injury, but also aid in the development of novel neuroprotectvie or antioxidant agent against stroke. For example, Xu et al. [43] used MCAO mice model to examine the therapeutic potential of Humanin (HNG) in stroke mice. Brain slices of HNG pretreated and posttreated stroke mice were stained with TTC, and the infarct region of these images were then determined. Their results showed that HNG protects against cerebral ischemia/reperfusion injury in mice. Thus, these animal models can help develop stroke translational research from bench to bedside.

The examination of images of TTC-stain rat brain slice is time-consuming and labor intensive, and sometimes subjective bias may exist due to manual investigation. Therefore, in this study a stroke rat brain infarct and atrophy volumes computation (SRBIAVC) system is provided to segment the infarcts and atrophies in rat brain slice images. Then, the brain infarct and atrophy volumes of the rat can be computed via the segmentation results. Methods including background removal, gamma correction, brain cerebral central line detection, and genetic algorithm will be applied to segment the brain infarct and atrophy regions in the rat brain slice images and to precisely estimate the infarct and atrophy volumes. In segmenting rat brain infarction, not only gamma correction but also local gamma correction are proposed to stretch the contrast of an image. This system can provide a potential tool for the development of stroke medication.

The remainder of this paper is organized as follows. The next section will introduce related works for literature reviews and the ischemic rat stroke images which will be used as the testing data in this paper. Section 3 describes the SRBIAVC System in details. In Sect. 4, two machine learning methods are provided to decide the fittest values for the parameters used in the SRBIAVC System. The experimental results are illustrated in Sect. 5. The conclusions are given in the last section.

2 Related works and materials

2.1 Literature reviews

In addition to the selection of animal model, how to appropriately interpret the animal experimental results is another important issue. Some studies, for example, employed well-trained animal physiologist to determine the area of rat ischemic stroke, and some employed public image procession program such as ImageJ to determine its severity [5, 13, 14, 34]. In the preclinical animal studies of stroke drug development, there are massive demands for stroke image analysis. However, few attempts have been made to develop automatic calculation algorithms to deal with this problem [13, 23, 24]. Therefore, it is critical to develop methods that can assess the effects of drugs or treatments on stroke animal models.

In general, the size of infarct region is often examined to determine the severity of brain damage after stroke. Hence, it is reasonable to assess the effects of a regimen by comparing differences in brain infarct regions between stroke patients with or without the treatment. Furthermore, the estimation of differences in the daily progression of infarct regions can aid doctors to diagnose patients’ stroke conditions. Therefore, the correct estimation of infarct volume is a very important issue on stroke therapy. Traditionally, infarct volume is estimated manually by conducting calculations on images of brain slices. However, these time-consuming tasks do not yield precise approximations of infarct volume as the estimation of infarct area is often hindered by factors such as background, lighting, and corpus callosum. Currently, many methods have been applied to detect the infarct region and various studies have constructed many algorithms aiming to correctly compute the infarct volume [22,23,24, 28, 35]. This study is to develop an automatic identification system to distinguish infarcts and calculate their volume by utilizing experimental stroke rat brain images.

Recently, there are many researches focused on medical image segmentation and recognition, in which artificial intelligence has the potential to help civilization flourish—as long as we manage to keep the technology beneficial to image analysis [15, 16]. Peng et al. [33] proposed an ELBP (extend local binary pattern), a rotation invariant texture; however, ELBP cannot describe the local structural information but gradient orientation difference can. ELBP was hence combined with the feature of gradient orientation difference to describe the local brightness and structure of a chest CT image. Then, SVM was used to recognize lung disease. In 2011, Somasundaram and Kalaiselvi [38] used an adaptive intensity thresholding method to convert a magnetic resonance image of head and brain scan into a binary image, and the mathematical morphology and a 3D approach were applied to eliminate noise. After that, the binary images were processed into mask images, and fine brain slices were then obtained. Lee et al. [24] developed a program called InfarctSizer that can automatically detect the infarct region and compute the infarct volume of TTC-stained brain slice images from mice treated with MCAO. In their study, the infarct region was determined by collecting the pixels with values greater than the average RGB value of the total brain image, and the infarct volume proportional to the pixel intensity was calculated. Vanderbeck et al. [40] applied liver biopsy images to identify the non-alcoholic fatty liver disease. Each liver biopsy sample was stained with an H&E stain. An image was obtained by scanning the sample. Then, a gray-level image was created from the green channel of the image. The gray-level image was smoothed by the average filter, and the gamma correction method was employed to increase the contrast of the gray-level image. After that Otsu’s method was used to convert the gray-level image into a binary image. K-means clustering algorithm and 4-neighborhood connectivity were employed to remove the background of the image. A supervised machine learning classifier was applied to categorize the white regions in liver biopsies.

From the literature mentioned above, obviously one can find that most of the medial image processing follows the steps to pre-select the masks in segmentation stage such as using gamma correction to heighten the contrast, and using Otsu’s thresholding method and mathematical morphology or LBP (local binary pattern) to extract the ROI (region of interest) in the image.

2.2 Materials

Ischemic rat stroke images were obtained from Taichung Veteran General Hospital. In this study, rats with ischemic stroke were introduced by performing MCAO and were used as experimental subjects [2]. All animal experimental procedures were approved by the Institutional Animal Care and Use Committee of Taichung Veteran General Hospital. For MCAO procedures, anesthesia was induced with 4% isoflurane (Baxter, U.S.A.) and maintained with 2% isoflurane. A midline cervical incision was made to isolate the right bilateral common carotid artery. A small incision was subsequently made in the proximal portion of the external carotid artery, and a 25-mm-long 3-0 nylon monofilament suture was gently inserted (approximately 18 mm) into the internal right carotid bifurcation. After 60 min MCAO, the nylon surgical thread was removed to allow complete reperfusion of the ischemic area. The infarction size would be determined by the severity of ischemic brain injury. In worst case, the infarct zone may cover half of the whole brain [37]. Twenty-eight adult male Wistar rats were used in this study. All of the rats were subjected to the MCAO procedure. On the day of operation, ten of the 28 rats were sacrificed for brain removal. Coronal sections of each brain were obtained by cutting them into six 2 mm-thick slices, which were labeled as “day-1.” Following the same procedures, six rats were randomly selected for brain removal and sectioned on day-7, day-14, and day-28, and the obtained brain slices were labeled accordingly. In order to distinguish the infarct regions from normal regions in the rat brain, the slices were stained with 2% TTC (Sigma, Germany) for 30 min at 37 °C in the dark. After the stain developed, tissue blocks were placed into 10% phosphate-buffered formalin for 45 min. TTC does not stain brain regions with neuronal loss, and therefore, infarcted tissues remain white in these areas [37]. The six slices obtained from each brain were vertically arranged and recorded in Fig. 1, in which each column of brain images represents one rat.

Fig. 1
figure 1

The slices of rat brains for a Day-1, b Day-7, c Day-14, and d Day-28

3 The SRBIAVC system

Figure 2 portrays the framework of the SRBIAVC System. Each rat brain is cut into six slices. A slice image is taken from one brain slice. RBS segmentation step is to extract the rat brain slice (RBS) from a slice image. Drawing cerebral central line step is to draw the cerebral central line to cut the RBS into cerebral hemisphere and ipsilateral hemisphere. Extracting corpus callosum step is to segment the corpus callosum from the cerebral hemisphere. Extracting infarct step is to segment the infarct from the ipsilateral hemisphere. The step of removing corpus callosum from infarct is to eliminate the corpus callosum from the segmented infarct. The step of computing infarct and atrophy volumes is to compute the volumes of the infarct and the atrophy based on the segmented infarct, cerebral hemisphere, and ipsilateral hemisphere.

Fig. 2
figure 2

The framework of the SRBIAVC system

3.1 RBS segmentation

An RGB image is composed of red, green, and blue independent color channels; an HSV image consists of hue, saturation, and bright color channels. In this study, an RGB (resp. HSV) color image is first separated into red, green, and blue (reps. hue, saturation, and bright) color components. The intensities of color channel C of all the pixels in the color image can compose a gray-level image IC for C = R, G, B, H, S, and V.

Figure 3 reveals that IH is less affected by the texture of image background; thus in this study, IH is applied to remove image background. In order to more effectively distinguish the brain from the background, the gray levels of IH is stretched via the following formula:

Fig. 3
figure 3

The gray-level images IC for C = R, G, B, H, S, and V: a Original image b IR, c IG, d IB, e IH, f IS, and g IV

$$I_{H}^{'} \left( {i, j} \right) = \frac{{I_{H} \left( {i, j} \right) - \min_{H} }}{{\max_{H} - \min_{H} }} \times 255,$$
(1)

where IH(i, j) denotes the gray level of the pixel located at coordinates (i, j) in IH; minH and maxH are, respectively, the minimal and maximal gray levels of the pixels in IH. After stretching the contrast, IH in Fig. 3e is converted into the image in Fig. 4a.

Fig. 4
figure 4

RBS segmentation: a image \(I_{H}^{'}\), b image \(I_{H}^{''} ,\) c a structure element for erosion and dilation, and d the obtained binary image Ib

In Fig. 4a, the gray levels of some pixels in brain slices are greater than and others are less than the gray levels of the pixels in background. The SRBIAVC system hence changes \(I_{H}^{'}\) into \(I_{H}^{''}\) by the following formula:

$$I_{H}^{''} \left( {i, j} \right) = |I_{H}^{'} \left( {i, j} \right) - M_{H} |$$
(2)

where MH is the mean of the gray levels of all the pixels in \(I_{H}^{'}\). Figure 4b demonstrates the result obtained by running this operation on Fig. 4a.

In Fig. 4b, the gray level of the pixel in background region is mostly lower than that in slice region. Otsu thresholding operation [30] is a commonly used image binarization operation. In this study, Otsu thresholding operation is applied to calculate a suitable threshold TH for binarizing \(I_{H}^{''}\). The pixels with gray levels larger then TH are regarded as white pixels (their gray levels are set to “1”); otherwise, they are considered to black pixels (their gray level are set to “0”). Otsu thresholding operation can convert \(I_{H}^{''}\) into a binary image Ib. Since there may be some minor white or black spots in Ib, erosion operation [17, 36] and then dilation operation [17, 36] with a 5 × 5 structure element shown in Fig. 4c are used to eliminate the noise (minor white and black spots) and smooth the contour of RBS. Figure 4d is the Ib obtained by running Otsu thresholding operation and noise removing on the image in Fig. 4b. Each white region in Fig. 4d describes a rat brain slice (RBS). We call the smallest rectangle containing the whole RBS the RBS rectangle of the brain slice. Figure 5 depicts the RBS rectangles obtained from some rat brain slice images.

Fig. 5
figure 5

The RBS rectangles obtained from some rat brain slice images

3.2 Drawing cerebral central line

The aim of the SRBIAVC system is to segment the infarct from each RBS. The corpus callosum, such as the regions indicated by the blue outlines in Fig. 6, resembles the infarct in color and is often misidentified as the infarct during image segmentation. Since the corpus callosum is bilaterally symmetrical in a normal rat brain, the SRBIAVC system solves the problem by dividing the brain into two hemispheres based on its cerebral central line. The cerebral hemisphere with infarct is called the ipsilateral hemisphere, whereas the hemisphere with normal function is called the contralateral hemisphere. The SRBIAVC system will segment the brain infarct and corpus callosum from the ipsilateral hemisphere, and extracts the corpus callosum from the contralateral hemisphere. Then, the area of the infarct obtained in the ipsilateral hemisphere subtracting the area of the corpus callosum in the contralateral hemisphere is considered as the actual area of infarct.

Fig. 6
figure 6

The corpus callosum is outlined in blue line (color figure online)

Let us call the RBS in the top half of the RBS rectangle the upper half RBS, and that in the lower half of the RBS rectangle the lower half RBS. As indicated by the blue arrows in Fig. 7, there is a groove at the center of the upper half RBS, and normally, drawing a vertical line from this point would align with the cerebral central line (see the yellow lines in Fig. 7a). Since the image may be taken with different shooting angles, the RBS in the brain slice image may be slanted so it may cause the shift and rotation variations of the cerebral central line (see the RBSs in Fig. 7b, c). To deal with this problem, the SRBIAVC system looks for the concave point in the upper half RBS and the convex point in the lower half RBS. The cerebral central line is then formed by connecting the concave point and the convex point. The steps to detect the convex point and the concave point are described in detail below.

Fig. 7
figure 7

A schematic diagram of the cerebral central line

3.2.1 Convex point detecting

The SRBIAVC system cuts the RBS rectangle into upper-left (UL), lower-left (LL), upper-right (UR), and bottom-right (BR) four equal-sized regions (such as the yellow dotted lines in Fig. 8a). It finds the highest points ULTP and URTP (such as the blue points in Fig. 8a) of the RBSs in UL and UR regions, and then considers the lowest point on the RBS contour between ULTP and URTP to be the top central groove Tg (such as the red points in Fig. 8a).

Fig. 8
figure 8

The steps in finding the cerebral central line of RBS

3.2.2 Concave point detecting

Next, the SRBIAVC system draws a vertical line Lg which passes through Tg and at Dg crosses the RBS contour in the lower half RBS (see Fig. 8b). Let Dl be the lowest point on the RBS contour at the left side of Dg, and Dr the lowest point on the RBS contour at the right side of Dg in the lower half RBS. Also let Dlh(xlh, ylh) be the highest point along the RBS contour from Dl to Dg, and Drh(xrh, yrh) be the highest point along the RBS contour from Dr to Dg. Dc(xc, yc) is considered to the concave point where Dc(xc, yc) is on the RBS contour in the lower half RBS and xc =  \(\left( {x_{rh} + x_{lh} } \right)/2\). The SRBIAVC system draws a line Lgc to connect Tg and Dc. Lgc hence separates the RBS into the left half region and the right half region (see Fig. 8b). We call Lgc the cerebral central line of the RBS. The green line in Fig. 8c is the cerebral central line of the RBS.

The obtained cerebral central line divides the RBS into two halves. The corpus callosum and the infarct are generally brighter than others in the RBS. Let Dag be the difference of the average gray levels in two halves of the RBS, and Srg be the average gray level in the RBS. If |Dag/Drg| is greater than a given threshold Tas =  0.2, the SRBIAVC system considers that the rat brain is stocked. After that, the half of the RBS with a greater average gray level is regarded as the ipsilateral hemisphere, and the other is considered to the contralateral hemisphere.

3.3 Extracting infarct

The SRBIAVC system then intends to extract the infarct from each the ipsilateral hemisphere. In Fig. 9, a color ipsilateral hemisphere RBIH is converted into three gray-level ipsilateral hemispheres RIH, GIH, BIH, which, respectively, consist of the R, G, and B color components of all the pixels in RBIH. From Fig. 9, one can obviously observe that GIH provides a higher contrast between infarct and non-infarct in ipsilateral hemisphere. Hence, the SRBIAVC system will extract the infarct from GIH.

Fig. 9
figure 9

Convert a color ipsilateral hemisphere image RBIH into three gray-level ipsilateral hemispheres RIH, GIH, BIH: a Original image (RBIH), b RIH, c GIH, d BIH

The SRBIAVC system employs gamma correction operation [1, 44] to stretch the contrast of GIH, and generates a gray-level image GG:

$$G_{G} (x,y) = \left( {\frac{{G_{IH} (x,y) - Min_{IH} }}{{Max_{IH} - Min_{IH} }}} \right)^{{\gamma_{IH} }} \times 255$$
(3)

where MinIH and MaxIH are the minimal and maximal gray levels in GIH, and γIH is a given constant. Figure 10a shows the results obtained by running the gamma correction operation on GIH in Fig. 9c.

Fig. 10
figure 10

The steps to identify infarct: a gamma correction, b binarization operation, c mode filter, d merged image

Next, Otsu thresholding operation [30] is applied to provide a threshold TO for GG to create a binary image GO. If GG[x, y] is greater than TO, then GO[x, y] = 1 (respecting a white pixel), which indicates that GG[x, y] is an infarct pixel; otherwise, GO[x, y] = 0 (respecting a black pixel), which indicates that GG[x, y] is a non-infarct pixel. Taking the images in Fig. 11a as examples, the pink areas should be the less severe infarct. Since the mild infarction may lead to brain necrosis in the future, the SRBIAVC system also considers the regions outlined by the green closed curves in Fig. 11b is the infarct regions. Therefore, in this study, TO is replaced with \(T_{O}^{'}\)  =  TOkO× σO where kO is a given constant, and σO is the standard deviation of the gray levels of all the pixels in GO. Figure 10b shows the result obtained by running the binarization operation on GG in Fig. 10a.

Fig. 11
figure 11

A schematic diagram of image binarization: a the results of binarization by TO, b the binarization results by using \(T_{O}^{'}\) including the regions surrounded by white and green closed curves

There exist some small white spots and black holes in Fig. 10b. The SRBIAVC system applies mode filter to eliminate the small white spots and black holes. For each pixel GO[x, y], it gives a window WO consisting of mO ×  mO pixels in GO where GO[x, y] is the central pixel of WO. Let n1 and n0, respectively, be the numbers of 1-bits and 0-bits in WO. If n1> n0, \(G_{O}^{'}\)[x, y]  = 1; otherwise \(G_{O}^{'}\)[x, y] = 0. Figure 10c demonstrates the result obtained by running the mode filter on the image in Fig. 10b. The contour obtained from Fig. 10c is then applied in Fig. 9a and the result is shown in Fig. 10d.

3.4 Extracting corpus callosum

This subsection is to segment the corpus callosum from the contralateral hemisphere RBCH. Each pixel in a color image RBCH can be separated into red, green, and blue color components. The values of color component c of all the pixels in the RGB color contralateral hemisphere compose a gray-level image cCH for c = R, G, and B. Figure 12b–d show the RCH, GCH, and BCH of the contralateral hemisphere in Fig. 12a. As shown in Fig. 12, GCH has a better contrast. Therefore, the SRBIAVC system will extract the corpus callosum from GCH.

Fig. 12
figure 12

The contralateral hemisphere in different color components: a original image RBCH, b RCH, c GCH, and d BCH

Similarly, gamma correction is applied to enhance the contrast of GCH, and then, Otsu thresholding operation is employed to transform GCH into a binary image. Global gamma correction works well on the images containing objects with a uniform intensity on a contrasting background. However, it cannot give a good result for the image with a low contrast between the object and the background for a noisy image or for the image across which the background intensity varies significantly. Figure 13a illustrates the results provided by the global gamma correction operation. There is a low contrast for part of the corpus callosum in Fig. 13a. In this study, a local gamma correction is hence provided to highlight the contrast of the corpus callosum.

Fig. 13
figure 13

The steps of identifying the corpus callosum: a the segmentation result obtained by global gamma correction operation, b the result obtained by local gamma correction operation, c the result obtained by opening operation, d converting GCH into a binary image, e after removing small regions, f after removing the long strip closed to the boundary of the brain, g the segmentation result

For each pixel GCH(x, y), the local gamma correction operation is given a mCH× mCH window WCH in GCH, where GCH(x, y) is the central pixel of WCH. Let MinCH, MaxCH and MeanCH be the minimal gray level, the maximal gray level, and the mean of gray levels in GCH. Then, the local gamma correction operation converts GCH into GlG by the following formula:

$$G_{lG} (x,y) = \left\{ {\begin{array}{ll} {\left( {\frac{{G_{CH} \left( {x, y} \right) - {\text{Min}}_{CH} }}{{{\text{Max}}_{CH} - {\text{Min}}_{CH} }}} \right)^{{\frac{1}{{\gamma_{CH} }} }} ,} & {{\text{if}}\,\, G_{CH} \left( {x, y} \right) > {\text{mean}}_{CH} , \quad {\text{and}}} \\ {\left( {\frac{{G_{CH} \left( {x, y} \right) - {\text{Min}}_{CH} }}{{{\text{Max}}_{CH} - {\text{Min}}_{CH} }}} \right)^{{\gamma_{CH} }} \times 255,} & {{\text{otherwise}}\, G_{CH} \left( {x, y} \right) \le {\text{mean}}_{CH} .} \\ \end{array} } \right.$$
(4)

where γCH is a given constant. Figure 11b shows the result obtained by the local gamma correction operation on GCH to create a gray-level image GlG.

There are some small bright regions which are not the corpus callosum in Fig. 11b. The SRBIAVC system hence uses gray-level opening operation [17, 36] to remove the small bright spots where the structure element is a 5 × 5 small window in which all the gray levels are zero. Figure 13c displays the result obtained by running the gray-level opening operation on the image in Fig. 13b. After that, Otsu thresholding operation is used to compute the fittest threshold from the gray levels of all the pixels in the image and then to change the image into a binary image Gb based on the threshold. Figure 13d is the binary image Gb obtained by executing Otsu thresholding operation on the image in Fig. 13c. In addition, the small regions with the area less then Ta are eliminated from Gb. Figure 13e is the Gb after getting rid of the small regions from Fig. 13d.

There may be the arachnoid mater, long white strips near the boundary of the brain (see Fig. 13e). If the average minimal distance of each pixel in one region in Gb to the contour of the brain is less than a threshold Td, then the region is eliminated. Figure 13f is the result after removing the long white strips closed to the contour of the brain in Fig. 13e. Figure 13g displays the result obtained by applying the contour in Fig. 13f to the image in Fig. 12a.

3.5 Removing corpus callosum from infarct

Since the color of corpus callosum is very close to the color of the infarct in a rat brain, the SRBIAVC system cannot effectively separate the corpus callosum from the infarct in the ipsilateral hemisphere; while the color of corpus callosum is quite different from others in the contralateral hemisphere, extracting the corpus callosum in contralateral hemisphere is much easier. Moreover, the corpus callosum is bilaterally symmetrical in the normal brain. The SRBIAVC system hence replaces the corpus callosum in ipsilateral hemisphere with the corpus callosum in contralateral hemisphere.

Assume that the ipsilateral hemisphere is the right hemisphere of an RBS RB. If RB(x, y) is in the contralateral hemisphere and a corpus callosum pixel RB(x + d, y) is in the cerebral central line, the SRBIAVC system sets RB(x + 2d, y) to a corpus callosum pixel, too. Assume that the ipsilateral hemisphere is the left hemisphere of an RBS RB. If RB(x, y) is in the contralateral hemisphere and a corpus callosum pixel RB(x + d, y) is in the cerebral central line, the SRBIAVC system also sets RB(x-d, y) to a corpus callosum pixel. Figure 14a is the segmented infarcts (in the right half side) combined with the segmented corpus callosum (in the left half side). Figure 14b is the segmented infarct after removing the corpus callosum. Figure 14c is the segmentation result.

Fig. 14
figure 14

The steps of removing corpus callosum from infarct: a the segmented infarct (on the right half) combined with the segmented corpus callosum (on the left half), b the infarct after removing corpus callosum, c the segmented infarct

3.6 Computing infarct and atrophy volumes

The SRBIAVC system calculates the volumes of the stroke and atrophy of a rat brain based on the segmented RBS and infarcts on the six slices of a rat brain. Let Ai1, Ai2,…, Ai6, respectively, be the areas of the segmented infarcts in the six slices. The infarct volume Vi of the rat brain is defined as:

$$V_{i} = \mathop \sum \limits_{j = 1}^{6} A_{{w_{ij} }} \times TH,$$
(5)

where TH is the thickness of each slice, and in this study TH  = 2 mm.

The left half and the right half of a normal rat brain are bilaterally symmetrical. It means that the volumes of the left half and the right half of a normal rat brain are very close. Since the volume of ipsilateral hemisphere may shrink, the proportion of the infarct volume to the volume of contralateral hemisphere is more helpful for a doctor. The proportion of the infarct volume to the volume of contralateral hemisphere can be defined as:

$$V_{i} = \frac{{\mathop \sum \nolimits_{j = 1}^{6} A_{{w_{ij} }} }}{{\mathop \sum \nolimits_{j = 1}^{6} A_{{w_{pj} }} }},$$
(6)

where Ap1, Ap2, …, Ap6, respectively, are the areas of the segmented contralateral hemisphere in the six slices of the bat brain. Since the volume of ipsilateral hemisphere may shrink, it is very difficult to measure the original volume of the ipsilateral hemisphere. The SRBIAVC system hence determines the percentage Pa of the atrophy volume in ipsilateral hemisphere by

$$P_{a} = \frac{{\mathop \sum \nolimits_{j = 1}^{6} A_{{w_{pj} }} - \mathop \sum \nolimits_{j = 1}^{6} A_{{w_{ij} }} }}{{\mathop \sum \nolimits_{j = 1}^{6} A_{{w_{pj} }} }}$$
(7)

3.7 Time complexity

Assume that SI is the size of the input image. The time complexity of each step in the SRBIAVC system is described as follows:

  1. (a)

    In step RBS Segmentation: The SRBIAVC system spends time SI to filter out the hue color component of the input image and create a new image IH, and time 2 × SI to execute Eqs. (1) and (2). It also takes time 2553 to perform Otsu’s thresholding method. Hence, the time complexity of this step is O(3 × SI).

  2. (b)

    In step Drawing Cerebral Central Line: The time complexity in this step is far less than SI.

  3. (c)

    In step Extracting Infarct: The SRBIAVC system spends time SI/2 to filter out the green color component of image RBIH and create a new image GIH, and time SI/2 to execute Eq. (3). It also takes time 2553 to perform Otsu’s thresholding method. Hence, the time complexity of this step is O((2 × SI)/2).

  4. (d)

    In step Extracting Corpus Callosum: In this step, the SRBIAVC system takes time SI/2 to run gamma correction and 2553 to perform Otsu’s thresholding method.

  5. (e)

    In step Removing Corpus Callosum from Infarct: Time SI/2 is consumed to remove the corpus callosum.

  6. (f)

    In step Computing Infarct and Atrophy Volumes: Time SI is taken to compute the areas of Infarct and Atrophy.

Therefore, the SRBIAVC system spends time about 6 × SI to extract the brain infarct and atrophy and compute their areas.

4 Fittest parameters determining

In this study, two algorithms are provided to decide the fittest parameters used in the SRBIAVC system. In this section, we will describe them in details.

4.1 Genetic algorithm-based parameters determining

In this study, a genetic algorithm [19]-based parameters detector (GABPD) is provided to determine the fittest values of the parameters used in the SRBIAVC system; we call it the SRBIAVC system with GABPD. If there are np parameters in a system, the GABPD gives each chromosome np substrings s1, s2,…, \(s_{{n_{p} }}\) which, respectively, consist of n1, n2, …, \(n_{{n_{p} }}\) binary bits and their corresponding decimal values are v1, v2, …, \(v_{{n_{p} }}\). Each chromosome composes of n1+ n2+··· + \(n_{{n_{p} }}\) binary bits and vi is employed to describe the value of the i-th parameter in the system. Hence, each chromosome will give np values mapping to all the parameters in the system, and then, the system can provide a performance based on the test data collected in advance. The performance is considered to the fitness of the chromosome.

In the initial step, GABPD randomly generates Ni chromosomes. We call the Ni chromosomes the reserved chromosomes. To evolve the best solution, GABPD repeatedly and alternately executes three operations mutation, crossover, and selection, until the fitness of all the reserved chromosomes is similar or the number of iterations is equal to a given constant MAX_NO_RUN.

For the crossover operation, GABPD randomly assigns Nc chromosome pairs from the reserved chromosomes. For each chromosome pair (Ch1, Ch2), a binary string SM, consisting of n1+ n2+ ···,+ \(n_{{n_{p} }}\) binary bits, is offered. GABPD then randomly selects (n1+ n2+ ···,+ \(n_{{n_{p} }}\))/2 binary bits in SM and sets all the selected bits to 1-bits, and sets others in SM to 0-bits. After that, GABPD runs the following formula to create a new chromosome Ch:

$$Ch=(Ch_{1}{{\wedge}} S_{M}){\vee}(Ch_{2}{{\wedge}}\neg S_{M}),$$

where ˄ is the logical AND operator, ˅ is the logical OR operator, and \(\overline{{S_{M} }}\) is the logical NOT operator.

For the mutation operation, for each of the Ni reserved chromosomes, GABPD uses a random number generator to specify one bit b for each of its substrings, and replaces b with ¬b to generate a new chromosome, where ¬ signifies the logical NOT operator. Therefore, in this operation, Ni new chromosomes are created.

For the selection operation, 0.9 × Ni chromosomes with the best fitness are selected from the reserved chromosomes and the chromosomes generated by the crossover and mutation operations. The selection operation also randomly creates 0.1 × Ni chromosomes. Moreover, the 0.9 × Ni selected chromosomes and 0.1 × Ni created chromosomes are used as the reserved chromosomes in next iteration. The GABPD repeatedly and alternately executes the operations crossover, mutation, and selection, until the fitness of all reserved chromosomes is very simliar, or the number of iterations is equal to a given constant MAX_NO_RUN.

GABPD trains the fittest parameters used in a system based on the accumulated historical data. When given a chromosome, the values of the parameters used in the system can be determined. The system then extracts the ROI (region of interest) via the values of the parameters. Let X be the segmentation result and Y the ground truth (the result drawn by the experts). Jaccard coefficient (JC) [20] can be used to measure the segmentation result:

$$JC = \frac{{\left| {X \cap Y} \right|}}{{\left| {X \cup Y} \right|}}.$$

The average Jaccard coefficients obtained by the systems based on the parameters decided by the chromosome are considered to the fitness of the chromosome.

GABPD is helpful for a system with multiple parameters. In the SRBIAVC system, the parameters γI, kO, mO are used in the extracting infarct step, and the parameters γCH, Ta, Td are employed in the extracting corpus callosum step. In this study, GABPD is hence applied to determine the fittest parameters used in the extracting infarct step and in the extracting corpus callosum step:

4.1.1 The fittest values of γI, kO, mO

To determine the fittest the parameters used in the extracting infarct step, γI, kO, and mO is mapped to s1, s2, s3, where n1 =  n2 =  6, n3 =  3, γI =  v1× 0.05, kO =v2×  0.05, and mO =  3+v3.

4.1.2 The fittest values of γCH, Ta, Td

To determine the fittest parameters used in the corpus callosum step, γCH, Ta, Td is related to s1, s2, s3, and n1 =  n2= 6, and n3 =  3. γCH =  v1×  0.05, Ta =  v2×  0.05, and Td =  3+v3.

4.2 PSO-based parameters determining

In this study, a particle swarm optimization (PSO) algorithm [9]-based parameters detector (PSOBPD) is also provided to determine the fittest values of the parameters used in the SRBIAVC system; we call it the SRBIAVC system with PSO. Particle swarm optimization (PSO) searches the optimal solution by iteratively improving a set of candidate solutions with regard to a given quality measure. Each particle has its own position, and the i-th particle position in t-th iteration can be expressed as Xi(t) =  (xi1(t), xi2(t),…, \(x_{{in_{p} }}\)(t)), where xid(t) is the position of the d-th dimension of the i-th particle in the t-th iteration. Assume Vi(t) = (vi1(t), vi2(t), …, \(v_{{in_{p} }}\)(t)) is the velocity of the i-th particle in the t-th iteration, where vid(t) is the velocity of the d-th dimension of the i-th particle in the t-th iteration; Pbesti is the obtained local best solution of the i-th particle obtained thus far, and Gbest is the global best solution obtained until now from all the particles in the population.

The new velocities and positions of the i-th particle in the t-th generation are evolved by the following equations:

$$\begin{aligned} v_{id} \left( {t + 1} \right) \, & = c_{0} \times v_{id} \left( t \right) \, + c_{1} \times rand_{1} \times \left( {Pbest_{id} \left( t \right) \, - x_{id} \left( t \right)} \right) \, + c_{2} \times rand_{2} \times \left( {Pbest_{id} \left( t \right) \, - x_{id} \left( t \right)} \right), \\ x_{id} \left( {t + 1} \right) \, & = x_{id} \left( t \right) \, + v_{id} \left( {t + 1} \right), \\ \end{aligned}$$

where c0 is an inertial parameter affecting the movement propagation given by last velocity value, and two acceleration coefficients c1 and c2, respectively, are the importance of personal best value and the importance of social best value; rand1 and rand2 are two random numbers between [0, 1]. Shi and Eberhart [21] indicated that choosing c0 ϵ [0.8, 1.2] results in faster convergence, hence, in this study, we set c0= 1. Generally, c1 and c2 are set to 2. The PSOBPD can be implemented by the following Algorithm PSO():

figure a

In this study, each particle Xi(t) is a candidate solution, and xid(t) describes the value of the i-th parameter in the SRBIAVC system. Hence, each particle Xi(t) will give np values representively mapping to all the parameters in the system, and then the system can provide a performance based on the test data collected in advance. The performance is considered to the fitness of the particle. In addition, Nump is set to 10.

5 Experiments and discussions

In this study, 168 ischemic stroke rat brain images with sizes between 185 × 134 and 360 × 261 pixels provided by Taichung Veteran General Hospital are used as the test images. Twenty-eight rats were subjected to the MCAO procedure approved by the Institutional Animal Care and Use Committee of Taichung Veteran General Hospital. On the day of operation, ten of the 28 rats were sacrificed for brain removal. Each brain was cut into six coronal sections, each of which was a 2 mm-thick slices and was labeled as “day-1.” Following the same procedures, six rats were randomly selected for brain removal and sectioned on day 7 and the obtained brain slices were labeled as “day-7.” Similarly, other six rats were randomly selected for brain removal and sectioned on day 14 and the obtained brain slices were labeled as “day-14.” The brains of the remaining six rats were also removed and sectioned on day 28 and the obtained brain slices were labeled as “day-28.”

The first experiment intends to investigate the performance of removing the image backgrounds of the 168 ischemic stroke rat brain images. The experimental results show that the average dice similarity (DS) provided by the SRBIAVC system in removing the image background of the 168 ischemic stroke rat brain images is 98% which is much higher than the DS = 85.95% obtained by J. Lee’s method [23]. Figure 15 displays the results obtained by J. Lee’s method and the SRBIAVC system in removing the image background of some ischemic stroke rat brain images.

Fig. 15
figure 15

The results of image background removal: a original images, b ground truth given by medical experts, c obtained by J. Lee’s method, d obtained by the SRBIAVC system

The SRBIAVC system automatically draws the cerebral central line but J. Lee’s method requires the user to draw the cerebral central line by himself. Let line Lgc be the cerebral central line drawn by the SRBIAVC system and line \(L_{gc}^{\prime }\) be the ground truth drawn by the expert. Assume that Tg and Dc are the convex point and the concave point on Lgc and \(T_{g}^{\prime }\), and \(D_{c}^{\prime }\) are the convex point and the concave point on \(L_{gc}^{\prime }\). In this study, MAX(|Tg\(T_{g}^{\prime }\) |, |Dc\(D_{c}^{\prime }\) |) is defined as the difference between Lgc and \(L_{gc}^{\prime }\). The average of the difference between Lgc and \(L_{gc}^{\prime }\) is only 5.48 pixels. Figure 16 illustrates some cerebral central lines drawn by the SRBIAVC system and the expert.

Fig. 16
figure 16

Some cerebral central lines drawn by the SRBIAVC system and the expert, where row Lgc is the cerebral central line drawn by the SRBIAVC system and row \(L_{gc}^{\prime }\) is the ground truth drawn by the expert

However, the brain slices in Fig. 17 do not contain a recognizable groove. Figure 17a depicts the cerebral central lines drawn by the SRBIAVC system and Fig. 17b illustrates the cerebral central lines drawn by the expert. The SRBIAVC system cannot give good cerebral central lines for both brain slices.

Fig. 17
figure 17

The brain slices containing the difficult recognizable groove: a the cerebral central lines drawn by the SRBIAVC system, b the cerebral central lines drawn by the expert

In next experiment, GABPD is employed to train the fittest parameters γI, kO, and mO used in the extracting infarct step based on the brain slice images of two rats which were randomly selected from the 28 adult male Wistar rats. Moreover, the brain slice images of other 26 adult male Wistar rats were used as the testing images. In this experiment, GABPD gives the fittest parameters γI = 0.95, kO = 0.65, mO =  5.

Apart from Jaccard coefficient (JC), dice similarity (DS) is frequently used to evaluate the object segmentation result [8]. DS is defined as:

$${\text{DS}} = \frac{{2\left| {X \cap Y} \right|}}{\left| X \right| + \left| Y \right|},$$

where X is the segmentation result and Y is the ground truth. In this study, both of JC and DS are used to measure the performance of object segmentation. Based on the fittest parameters γI =  0.9, kO = 0.65, mO =  5 and the testing images, the SRBIAVC system obtains the experimental results: the average JC = 72.08% and the average DS = 81.83%. Figure 18 demonstrates the segmented infarct regions in the ipsilateral hemisphere of the brain slice images of some day-1 and day-14 rats. However, the SRBIAVC system is sensitive to the mild infarct (pink area) in the extracting infarct, so that it cannot give a good result for extracting the infarcts in Fig. 19.

Fig. 18
figure 18

The segmented infarcts in the ipsilateral hemisphere for the brain slice images of rats day-1 and day-14

Fig. 19
figure 19

The bad infarct segmentation: a The infarcts extracted by the SRBIAVC system, b ground truth

In experiment 4, similarly GABPD is employed to train the fittest parameters γCH, Ta, and Td used in the extracting corpus callosum step based on the same training data and testing data adopted in experiment 3. In this experiment, GABPD gives the fittest parameters γCH= 1.95, Ta= 0.05, Td= 21. Based on the fittest parameters γCH= 1.95, Ta= 0.05, Td= 21, and the testing images, the experimental result shows that the SRBIAVC system can obtain the average JC = 71.08% and the average DS = 77.48%. Figure 20 displays the segmented corpus callosums in the contralateral hemispheres of the brain slice images of some rats. However, the accuracy of this method is compromised when the color of the corpus callosum resembled that of its surroundings, as shown in Fig. 21. As demonstrated in the middle panel of Fig. 21, the white areas pointed by the yellow arrow are misidentified to be the corpus callosum.

Fig. 20
figure 20

The segmented corpus callosums in the contralateral hemispheres of the brain slice images of some rats

Fig. 21
figure 21

The bad corpus callosum segmentation

Experiment 5 is to explore the performances of infarct segmentation after removing corpus callosum. The experimental result shows that the SRBIAVC system obtaining the average JC = 75.54% and the average DS = 82.22% is much better than J. Lee’s method providing the average JC = 51.43% and the average DS = 64.14% in infarct segmentation after removing corpus callosum. Figure 22 depicts some infarct segmentation results after removing corpus callosum from the rat brain slice images.

Fig. 22
figure 22figure 22

The experimental results of infarct segmentation after removing corpus callosum

Experiment 6 is to compute the infarct volumes and the atrophy volumes. Figure 23a illustrates the results computing the infarct volumes of 28 adult male Wistar rats by the SRBIAVC system with PSO, the SRBIAVC system with GABPD, J. Lee’s method, and the expert. Figure 23b demonstrates the results computing the infarct volumes of the rat brains according to their labels. The experimental results shows that the proportions of the infarct volumes to the contralateral hemisphere volumes computed by the SRBIAVC system with GABPD are quite closed to those computed by the expert.

Fig. 23
figure 23

a the proportions of infarct volumes to the contralateral hemisphere volumes computed by the SRBIAVC system (red line), J. Lee’s method (blue line), and the expert (gray line); b the proportions of infarct volumes to the contralateral hemisphere volumes of the rat brains according to their labels (color figure online)

J. Lee’s method does not describe how to compute the atrophy volume. Therefore, in this experiment, only the atrophy volumes computed by the SRBIAVC system and the expert are displayed. Figure 24a shows the results computing the atrophy volumes of 28 adult male Wistar rats by the SRBIAVC system and the expert. Figure 24b displays the results computing the atrophy volumes of the rat brains according to their labels. Similarly, the experimental results show that the proportions of the atrophy volumes to the contralateral hemisphere volumes computed by the SRBIAVC system are very closed to those computed by the expert.

Fig. 24
figure 24

a the proportions of atrophy volumes to the contralateral hemisphere volumes computed by the SRBIAVC system (blue line) and the expert (red line); b the proportion of atrophy volumes to the contralateral hemisphere volumes of the rat brains according to their labels (color figure online)

6 Conclusions

To assess the effectiveness of stroke treatment and diagnosis, the SRBIAVC system is proposed to take the place of the manual method in computing the infarct volumes and the atrophy volumes of rat brains. First, the SRBIAVC system uses H color layer of an HSV color rat brain slice image, in which there is the most significant difference of the contrast between the RBS and image background, to extract the RBS in the image.

To eliminate the influence of the corpus callosum on infarct volume estimation, in this paper, a cerebral central line detection method is provided to automatically divide the brain into ipsilateral and contralateral hemispheres. Then, the corpus callosum volume in the contralateral hemisphere is subtracted from the infarct volume in the ipsilateral hemisphere. Since the contrast between the infarct region and the background is more apparent in the G color layer, this layer is used in infarct region segmentation. To make the infarct region segmentation easier, a local gamma correction method is proposed to enhance the contrast of an image.

In image background removal, the SRBIAVC system obtaining the experimental result DS = 98% is much better than J. Lee’s method obtaining the experimental result DS = 85.95%. In cerebral central line detection, J. Lee’s method requires the user manually to draw the cerebral central line, while the SRBIAVC system draws the cerebral central line automatically. The experimental results showed that the average distance between the cerebral central lines drawn by the SRBIAVC system and by the experts is 4.479 pixels.

As mentioned previously, examining TTC-staining images of ischemic rat brain slice is time-consuming and labor intensive, and some subjective bias may appear. Even though some automated methods were invented to overcome the possible bias produced by manual examination, several flaws remain to be taken into account. For example, determining the cerebral central line or outlining the infarct region in ischemic brain images usually achieves manually. Comparing with J. Lee’s study, our SRBIAVC system can determine the central line and outline the infarct region automatically. The SRBIAVC system also removes corpus callosum area when calculating ischemic infarct region to avoid interferencing the accuracy. The SRBIAVC system further employs two algorithms to determine the fittest parameter values in the extracting infarct step. Therefore, the proportion of infarct volume obtained by the SRBIAVC system is much closer to the results calculated by experts comparing with J. Lee’s method. In addition, the atrophy volumes computed by the SRBIAVC system are in close proximity to that calculated by the experts, while J. Lee’s method does not offer atrophy volume calculations. In summary, the SRBIAVC system is recommended for assessing the effectiveness of stroke therapy, development of stroke medications, and diagnosis of stroke conditions.

Even though our results show that all of these measures can improve the accuracy of infarct region detection effectively, there are still some limitations as well. First, although the SRBIAVC system can automatically draw the cerebral central line of the brain slice images, some images are not regularly shaped and the center groove cannot be easily recognized (Fig. 17). Second, such as in Fig. 19, the SRBIAVC system is sensitive to the mild infarct area in the extracting step, so if the brain slice images are not well-stained or not easily distinguished, it cannot give a good result for extracting the infarcts. Therefore, future studies can dedicate to develop new algorithms to overcome these shortcomings and provide more precisely evaluating programs for stroke animal models analysis.