1 Introduction

Extracting the shape of the liver from a computed tomography image represents an important step in software supporting medical diagnostics, as it allows superfluous information which is immaterial in the diagnostic process to be eliminated. The automatic extraction of the liver contour and, as a result, segmenting this organ is rather complex due to the presence of other organs found right next to it: Fig. 1.

Figure 1
figure 1

CT image of the abdominal cavity. Description of the anatomical situation (figure previously presented in [6]).

CT images, the shapes of the liver are highly varied, inter alia due to the individual traits of patients. Computed tomography imaging of the liver can be executed in various phases, namely: parenchymatous, arterial and venous, and this has a major impact on the amount of information found in the image. Computed tomography images can also portray disease units which make extracting the contour difficult.

The liver is quite frequently segmented from CT images. Bae [1] has applied such image processing techniques as thresholding for specified values of grey levels and a method of image smoothing using Gaussian filtration, and has also used specific mathematical morphological operators and B-splines. Chen [5] proposed combining the FBM (Fractional Brownian Motion) technique with a parameterised active contour method to determine the approximated liver contour, while Ballerini [2] presented an active contour method using genetic algorithms. Publications [2, 5] describe a technique consisting in detecting the liver contour before extracting it from the image (DBE-Detect Before Extract). The authors of publication [21] first segmented the lumbar section of the spine, and then determined the borders of regions of interest (ROI) in which the liver shape is found. The lumbar spine section is segmented using thresholding for specified grey-levels of the image and also employing a histogram transformation. Later in the segmentation process, iterative binary morphological transformations like dilatation and erosion are executed. In article [13], neural networks were used to determine the features of an image corresponding to the area occupied by the liver. In article [18], in turn, some varieties of region growing were employed to segment the liver shape from CT images. Another approach is a threshold segmentation, combined with morphological image processing and the use of active contour methods to extract the initial contour, and then segment the liver shape for subsequent CT slices [14].

Many interesting methods and algorithms presented during ”MICCAI 2007 Grand Challenge” workshop [11] and also after its end, some of them are available through the website [10]. In general, interactive methods achieved higher average scores than automatic approaches and featured a better consistency of segmentation quality during this workshop. The three best-rated automatic approaches are all based on statistical shape models with some form of additional deformation [12, 15, 20]. The three best ranked interactive method was based on:

  • graph-cut and interactive refinement [4]

  • region-growing and interactive refinement [3]

  • two-dimensional level sets with transversal contour initialization [9]

Currently, semi-automated method using radial basis functions and level sets is the best ranked [23].The first stage of this method is the manual delineation of cross-sections of the anatomical structure in 2-D multi-planar reconstruction views. From this set of contours, an initial 3-D surface is reconstructed using radial basis functions. In the second stage, this surface is automatically evolved under the level set framework using a combination of both image and shape information.

Organizers of the competition [11] proposed open source toolkit ITK/SNAP and one ITK/Metal0 graphic format of the shared database containing CT liver images. This allows researchers to compare their results and utilize the experience of previously proposed methods in the same environment. On the other hand, ITK / SNAP does not read common graphic formats, such as tiff, jpg and this is a certain limitation. Software which is developing during this research project is implemented in C# and works on Windows 7/8 platform. CT images are analyzed in common graphic formats such as DICOM, tiff, jpg, etc. In order to compare results obtained by participants of the SLIVER07 competition [10] with results presented here efficient module which converts images from ITK/Metal0 format to common graphic formats will be needed.

In this publication, automatic segmentation was executed in such a way that first the liver contour was found, made up of a finite number of connected polylines approximating individual fragments of the liver edge in the computed tomography image. Then, the image area outside the liver contour was split into two polygons and eliminated from the image. The initial seed point during the calculations was the lumbar section of the spine, which is the central point of every CT image of the liver. The method of determining the approximate contour of the liver within CT images proposed here makes it possible to extract the liver shape both for cases free of lesions and for those exhibiting specific disease units, regardless of their number and location within the liver shape.

This article is structured as follows. Section 2 presents methods of determining the approximate liver contour. Section 3 describes the method of automatically segmenting the liver shape from computed tomography images. The next section discusses the experiments conducted and the research results. The last section contains a summary and sets out directions of future research.

2 Determining the Liver Contour in a CT Image

This section presents a method of automatically approximating the edge of the liver in CT images, consisting in determining the liver contour before segmenting its shape from the image. The approximate liver contour traced is used in the procedure of segmenting the shape of this organ from CT images (Fig. 2). The method proposed in this section makes it possible to determine the contour both for cases free of lesions and those showing certain disease units, i.e. focused lesions like those presented in Fig. 3b and c.

Figure 2
figure 2

A schematic of the automated liver segmentation method from CT images.

Figure 3
figure 3

CT liver images with the contour marked. a A CT liver image without lesions. b Multi-focal lesions. c An image with a single focus near the edge of the upper lobe. d An image with the contour extracted using the authors method and the fragment of the CT image marked. e The liver contour obtained using the authors method in the selected fragment of the image. f The marked edge of the anatomical area of the liver.

Radiology images of the liver do not always show a regular shape with a clearly distinguished edge of this organ. Fig. 3c–f show an example liver image with an irregular edge. The contour determining algorithm should enable the edge to be approximated and its regular shape to be obtained. The active contour method in its original form, presented in publications [7, 8, 16], does not make it possible to eliminate situations like those shown in Fig. 3f.

An additional element of the image which must be considered when finding the edge are ribs, visible in item G of Fig. 1. During the determination of the approximate contour, coordinates which are between the ribs must be found, as shown in examples from images in Fig. 3a–d.

The overview of the proposed method is presented in a diagram in Fig. 2. At the first stage the starting point P ST is found, making it possible to begin determining the left-hand side contour L and the right-hand side contour R of the liver.

2.1 Liver Contour Description

In order to describe the liver contour, a specific mathematical model was defined. It represents a certain class of closed figures-polygons-which can be formed using a finite number of component polylines joined together. Formal definitions are presented in Section 2.2.

To describe the liver contour, an assumption was made that every component polyline approximates a specific fragment of the liver edge in the CT image. This assumption was made because the liver edge is irregular on CT images and there are no unanimously defined models of the shape. An example model of component polylines approximating individual fragments of the liver edge in an example CT image is shown in Fig. 4c.

Figure 4
figure 4

A CT of the abdominal cavity and the liver. a An example input image b The model of the approximate liver contour with the direction of creating subsequent component polylines c A model of the liver contour.

The approximate liver contour is built in the following way: beginning with the P ST starting point, interconnected component polylines L s (s = 1 … 6), are built one after another, as shown in Fig. 4b. These components will describe the contour of the left lobe and the front edges of the liver. After the last polyline L s is formed, component polylines R t (s = 1 … 6) describing the right-hand side contour of the liver are build. When building polylines R t , the starting point is also the P ST . As the L s polylines approximate a longer fragment of the liver edge than polylines R t , it was assumed that there are at least five L s (maximum 6) component polylines while there are at least two (maximum 3) R t . Figure 4a shows an example CT image of the abdominal cavity and the liver. Figure 4b is the model of a liver contour drawn using L s and R t polylines with the direction in which they were built marked. Figure 4c is the approximate contour of the liver. The location of the starting point P ST determines the split of component polylines into L s and R t , and as a result, the order of building them. The coordinates of the point P ST are calculated automatically. The method of determining the coordinates of the starting point P ST is presented in Section 2.3.

2.2 The Mathematical Model of the Liver Contour

The purpose of this section is to present the mathematic model of the liver contour searched for. Definitions and properties of the polylines making up the approximate liver contour in CT images can be written as follows:

Let s = 1 … 6 and j ∈ {0, 1}. The polyline [19] is understood as the set \({L}_{s}^{j}\) having the form of

$$ {L}_{s}^{j}=\bigcup\limits_{i=0}^{S} P_{i}P_{i+1} $$
(1)

Where P i P i+1 is a section with the starting point P i and the end point P i+1. The product P i P i+1P i+1 P i+2 is a single-point set containing the end of the section P i P i+1 and the beginning of the section P i+1 P i+2. The product P i P i+1P k P k+1 is empty for k > i + 1. For j = 0 the set \({L}_{s}^{0}\) is empty, while for j = 1, the set \({L}_{s}^{1}\) is not empty.

$$ {L}_{s}^{j} = \left\{ \begin{array}{lll} {L}_{s}^{1} & {\rm{for}}\;s=1\ldots5\\ {L}_{s}^{j\in\{0,1\}} & {\rm{for}\;s=6} \end{array} \right. $$
(2)

Let L be a polyline consisting of at least five component polylines \({L}_{s}^{j}\), i.e.

$$ L=\bigcup\limits_{s=1}^{6} {L}_{s}^{j} $$
(3)

Every component polyline \({L}_{s}^{j}\) approximates a specific fragment of the liver edge in the CT image. The value of the variable j determines whether the next component polyline will be created. In Fig. 5b, if s = 6 , this yields value of j = 1. Thus the polyline \({L}_{6}^{1}\) is the last component approximating the final fragment of the liver edge, while in Fig. 5d the last component polyline is \({L}_{5}^{1}\). In the example from Fig. 5d, for s = 6, so we get j = 0, as there is no fragment of the edge which should be approximated with the polyline \({L}_{6}^{1}\). Conditions making it possible to check whether the \({L}_{6}^{1}\) polyline should be built are defined in Section 2.3 (at stage 4 of the presented algorithm for detecting the approximate liver contour).

Figure 5
figure 5

A CT of the abdominal cavity and the liver. a, c, e Example images. b, d, f Liver contour models.

Let t = 1 … 6 and j ∈ {0, 1}. A set in the form \({R}_{t}^{j}=\bigcup _{i=0}^{T} P_{i}P_{i+1}\), also representing a polyline, is given. For j = 0 the set \({R}_{t}^{0}\) is empty, while for j = 1 the set \({R}_{t}^{1}\) is not.

$$ {R}_{t}^{j} = \left\{ \begin{array}{ll} {R}_{t}^{1} & {\rm{for}}\;t=1\\ {R}_{t}^{j\in\{0,1\}} & {\rm{for}}\;t=2\ldots6 \end{array} \right. $$
(4)

Let R be a polyline composed of component polylines \({R}_{t}^{j}\), i.e.

$$ R=\bigcup_{t=1}^{6} {R}_{t}^{j} $$
(5)

The set R is made up of at least two and maximum three joined polylines. In the example from Fig. 5b and d, the component \({R}_{3}^{1}\) is the last polyline. In the example from Fig. 5d, the polyline R is made up of two component polylines \({R}_{1}^{1}\) and \({R}_{3}^{1}\), so for t = 2, 4, 5, 6 we have \({R}_{t}^{0}\). The conditions making it possible to determine which polylines are to be build and in what order are presented in Section 2.3 (at stage 5 of the represented algorithm for detecting the approximate liver contour). Fig. 5a, c and e show example CT images of the abdominal cavity containing the liver shape, while Fig. 5b, d and f present the corresponding models of contours drawn using polylines L and R. In Fig. 5b and f, the polyline L is made up of six joined component polylines, and the polyline of three. In Fig. 5d, the polyline L is represented by five joined component polylines, and R by two. The point P ST is the common starting point of polylines L and R.

2.3 The Algorithm for Liver Contour Detection

This section presents the algorithm for automatically detecting the liver contour. The first step in the operation of this algorithm is to find the starting point P ST , making it possible to begin determining the coordinates of polylines L and R which approximate the liver contour. Then, the following stages of the method which allow the polylines L and R to be built are presented.

Stage 1. Finding the starting point P ST

Let the mapping g : M 2Z be the grey CT image containing the shape of the liver and (x, y) ∈ [0, M − 1] × [0, M − 1] define pixel coordinates. Then g(x, y) ∈ Z. The set Z represents integers from the [0, 2B − 1] interval, whereas B is the number of bits for representing a single pixel. Assuming that a single pixel is represented by one byte, we get Z = {g : g(x, y) ∈ [0, 255]}.

Images with the size of 512 × 512 were considered in the calculations. So we can assume that M = 512.

Finding the starting point P ST makes it possible to launch the algorithm for detecting the approximate contour of the liver. This point is identified in two stages (Fig. 6b):

  • The Point P SP lying on the edge of the spine is found.

  • The point P SP is projected along the X axis to the edge of the liver, thus marking the point looked for: P ST

The input position allowing the point P SP to be determined is the middle of the axis of symmetry of the computed tomography image. The middle of the symmetry axis may be situated:

  1. 1.

    Above the lumbar section of the spine, Fig. 6a.

  2. 2.

    In the lumbar section of the spine, Fig. 6c.

Figure 6
figure 6

Example CT images of the cross-section of the abdominal cavity and the liver. a A CT image with the symmetry axes marked, which intersect above the lumbar spine section. b Determining the starting point. c An example CT image with the symmetry axes marked, which intersect above the lumbar spine section P ST . d Determining the point p 0.

In the second situation, the coordinates of the point lying above the lumbar spine section should be found, Fig. 6d.

The procedure of finding the coordinates of the starting point situated above the lumbar spine section is as follows:

Procedure Find P 0

Step 1

Calculate:

x = M/2, y = M/2, where M × M is the image size (Calculating the coordinates of the starting point–the centre of symmetry of the image (Fig6 a and c))

Step 2

Read the value of the grey level g of the pixel with the coordinates (x, y). Execute one of the two conditional instructions:

  • If g(x, y) ∈ G SP , then decrease the y coordinate by a constant D, until the grey level value not belonging to the set G SP is obtained, i.e. g(x, y) ∉ G SP Fig6 d (It was assumed that the G SP set of integers defining grey levels of pixels of the lumbar spine section has the form Z = {g : g(x, y) ∈ [190, 255]}, values from this interval were established experimentally)

  • If g(x, y) ∉ G SP , assume x 0 = x, y 0 = y and p 0 = (x 0, y 0) and end the procedure.

In Fig. 6d, the starting point p 0 = (x 0, y 0) situated above the lumbar spine section was obtained in the third iteration. The best results were achieved assuming D = ⌊M/34⌋ = 15 pixels.

If we already have the point p 0 = (x 0, y 0) situated above the lumbar spine section, the eventuality should be considered that the aorta is very close to the spine, Fig. 6b. Its location may hinder determining the point on the edge of the spine, i.e. P SP . Consequently, it was assumed that three points p i+1(i = 0, 1, 2), with the coordinates:

$$p_{i+1}=(x_{i+1},y_{i+1}) = \left\{ \begin{array}{ll} x_{i+1} = x_{0} - D \cdot i \\ y_{i+1} = y_{0} \end{array} \right.$$

should be used for calculations. After projecting points p i+1 to the edge of the lumbar spine section, the distances between them (along the Y axis) are compared and used to determine the coordinates of the point P SP = (xP SP , yP SP ), Fig. 6b. Then, the point P SP is projected along the X axis to the edge of the liver, yielding the coordinates of the starting point P ST , which makes it possible to start identifying coordinates of polylines approximating the liver edge. Below, the procedure of finding the coordinates of the point P SP on the edge of the lumbar section is detailed.

Procedure Find P SP

Step 1

Projecting three points p i+1 (i = 0, 1, 2) along the Y axis to the edge of the lumbar spine section (Fig7 b). For every point \(p_{i+1}{}={}(x_{i+1},y_{i+1}) = \left \{ \begin {array}{ll} x_{i+1} = x_{0} - D \cdot i \\ y_{i+1} = y_{0} \end {array} \right .\) i = (0, 1, 2) add one to the y coordinate value until one of the following two conditions is satisfied:

  1. 1.

    If \(g(x_{i},y_{i+1})-g(x_{i},y_{i}) \in G_{SP}\) (Checking the condition whether the coordinates of the point are on the edge of the lumbar spine section)

  2. 2.

    If \(y_{i}-y_{0}>H\) (The defined height has been exceeded. The point did not end up on the edge of the lumbar spine)

Step 2

Computing the distance along the Y axis between the three points found in Step 2. Example distances are marked in Fig. 7 c.

Calculate:

$$\begin{array}{l}d_{10}=y_{1}-y_{0}\\ d_{21}=y_{2}-y_{1}\\ d_{30}=y_{3}-y_{0}\\ d_{32}=y_{3}-y_{2}\end{array} $$

Step 3

Comparing the distances computed in step 2 and finding the coordinates of point P SP = (xP SP , yP SP ). An example point calculated in step 3 is shown in Fig7 d.

  • \(If \ (d_{32}>0\wedge d_{30}>H\wedge d_{21}>0\wedge d_{32}>d_{21}) \ xP_{SP}=x_{2}, yP_{SP}=y_{2}\)

  • \(If \ (d_{32}>0\wedge d_{30}>H\wedge d_{21}>0\wedge d_{32}<d_{21}) \ xP_{SP}=x_{1}, yP_{SP}=y_{1}\)

  • \(If \ (d_{32}>0\wedge d_{30}{\kern -1.5pt}<{\kern -1.5pt}H\wedge d_{21}{\kern -1.5pt}<{\kern -1.5pt}0) \ xP_{SP}{\kern -1.5pt}={\kern -1.5pt}x_{3}, yP_{SP}{\kern -1.5pt}={\kern -1.5pt}y_{3}\)

  • \(If \ (d_{32}{\kern -1.5pt}>{\kern -1.5pt}0\wedge d_{21}{\kern -1.5pt}<{\kern -1.5pt}0\wedge d_{30}{\kern -1.5pt}\geq {\kern -1.5pt} H) \ xP_{SP}{\kern -1.5pt}={\kern -1.5pt}x_{2}, yP_{SP}{\kern -1.5pt}={\kern -1.5pt}y_{2}\)

  • \(If \ (d_{32}>0\wedge d_{30}<H\wedge d_{21}>0\wedge d_{21}>d_{32}) \ xP_{SP}=x_{3}, yP_{SP}=y_{3}\)

  • \(If \ (d_{32}>0\wedge d_{21}>0\wedge d_{21}<D_{32}) \ xP_{SP}=x_{2}, yP_{SP}=y_{2}\)

  • \(If \ (d_{32}<0\wedge d_{21}\geq 0) \ xP_{SP}=x_{3}, yP_{SP}=y_{3}\)

Notes:

Calculations made for a series of 1,330 CT images led to finding that the distance between subsequent points p i+1 (i = 0, 1, 2) along the X axis is D = ⌊M/34⌋ = 15 pixels, while the distance along the Y axis from the starting point cannot be greater than the value determined by the constant H = ⌊M/15⌋ = 70 pixels. These values were used in test examinations.

Figure 7
figure 7

A CT image of the cross-section of the abdominal cavity and the liver. a A CT image with symmetry axes marked. b Projecting three points along the Y axis to the edge of the lumbar spine section. c Distances of points between the start and the end positions. d The determined point P SP .

Stage 2. Building Polylines Belonging to the Set L

Let P u−1 P u L i (u ≥ 1) be any section of polyline L i for i = 1 … 6, and let points P u − 1 and P u have the following coordinates: P u−1 = (xP u−1, yP u−1), P u = (xP u , yP u ). The following inequality applies to the coordinates of polylines L i ∈ {L 1, L 3, L 4} : 0 <∣ yP u−1yP u ∣ ≤ dy.

This example is shown in Fig. 8c. The most precise approximation of the liver contour and the smallest number of arithmetic operations for determining the coordinates of polylines were achieved for dy = 10. In the case of the polyline L 6 (Fig. 8d) the most precise approximation was obtained under the assumption that the distance between subsequent pixels along the Y axis is no greater than 5. For any polyline L i ∈ {L 1, L 3, L 4}, the distance DY along the Y axis between its beginning and end points is the total of elementary distances dy between neighbouring pixels, as shown in Fig. 8c and d.

Figure 8
figure 8

A CT of the abdominal cavity and the liver. a An example image. b A contour model with the component polylines L 1 and L 6 marked. c Polyline L 1. d Polyline L 6.

If L i ∈ {L 2, L 5}, then for any section P u−1 P u L i (u ≥ 1) of these polylines the inequality 0 <∣ xP u−1xP u ∣ ≤ dx is satisfied. Just as in the dy case, the best results were achieved for dy = 10. Defining DX as the distance between the start and end points of any polyline L i ∈ {L 2, L 5}, it can be assumed that DX is the total of component distances dx between adjacent pixels.

In accordance with formula (3), the polyline L is made up of five joined component polylines. The sixth polyline is added if one of the boundary conditions presented at stage 4 of this method is satisfied during the finding of polyline L 5 points.

To enable the definition of sets of points allowing the approximate liver contour to be found and to undertake the appropriate arithmetic operations to find the coordinates of the approximate contour, the following ranges of grey levels were adopted: \(G_{1}, \overline {G}_{1}, G_{2}, \overline {G}_{2}\), where:

  • \(G_{1}=\{ g \in Z : g \in (0,50] \}\) —Fig. 9d,

  • \(\overline {G}_{1}=\{ g \in Z : g \in (50,255] \}\)—Fig. 9e,

  • \(G_{2}=\{ g \in Z : g \in (0,100] \}\)—Fig. 9f,

  • \(\overline {G}_{1}=\{ g \in Z : g \in (100,255] \}\)—Fig. 9g

Pixels belonging to the appropriate sets made up of defined grey levels were marked with the same colour in the example shown in Fig. 9c–g. The values of constants defining ends of intervals for sets of points \(G_{1}, \overline {G}_{1}, G_{2}, \overline {G}_{2}\), were adopted based on the trials conducted on a set of 1,330 CT images of the liver. The existence of still other numerical dependencies is not ruled out, but values proposed in the above way made it possible to achieve the best results.

Figure 9
figure 9

A liver CT. a An example CT image with the length DY of the polyline L 1 marked. b Points of the polyline L 1 marked. c A model of the liver contour d Points of the polyline L 1 with pixels belonging to the set G 1 marked. e Points of the polyline L 1 with pixels belonging to the set \(\overline {G}_{1}\) marked. f Points of the polyline L 1 with pixels belonging to set G 2 marked g Points of the polyline L 1 with pixels belonging to the set \(\overline {G}_{2}\) marked.

Stage 3. Finding Points of the Polyline L 1

Figure 10 is a diagram containing all the arithmetic operations needed to find the approximate boundary coordinates of the polyline L 1. Beginning from the set A 1which represents gray-level values equal to zero (it means dark background) coordinates are classified to appropriate sets and next moved, according to defined arithmetic operations. If a point belongs to the set A 1 but doesn’t belong to the set A 0 (it means that defined boundary condition is not satisfied) then it can be moved further under the condition that its current position is not exceeding the constant value dl x (measured up from its initial position). If the starting point is not located in the area of the dark background (its grey-level value is greater than zero) then classification to the next set-- C 1 will be checked. Higher gray-level values are considered in the set C 1 (from the interval (50, 255]). The subsequent set D 1contains gray-level values from the interval (100, 255]. In order to find the approximate liver boundary in a CT image point belonging to the set C 1 or D 1 is moved from an area with high gray level values (i.e. (50, 255]) to the area with lower values of gray-levels (i.e. (0, 50]). Certain estimates of distances of coordinates between calculated points are also very important for evenly approximation of the liver contour. In order to estimate a liver contour it is also considered an opposite situation where the point can be moved from an area with low gray level values to the area where significantly higher values of gray-levels are present. This situation is described in definition of sets E 1, F 1 and E 0, F 0respectively. Moreover, it is also presented in the example below.

Figure 10
figure 10

Calculations needed to find the points of the polyline L 1. Sets of points allowing pixels to be classified to determine polyline L 1 coordinates are defined in Section 2.3.1.

As mentioned before, the point P ST = (xP ST , yP ST ) is the starting point from which the subsequent coordinates defining the liver contour are determined. The identification of the point P ST was presented at stage 1 of the procedure of describing the approximate liver contour. Thus we have P ST = P 0 = (xP 0, yP 0), Fig. 11b. The next point of the polyline has the initial coordinates x 0 = xP 0 and y 0 = yP 0 + dy, Fig. 11c. Then, the value of its grey level g(x 0, y 0) (from the interval 0, 255]) is read, Fig. 11d. This forms the basis for classifying it to one of the defined sets of points according to the established constant intervals of grey levels (all sets of points including the conditions describing them are presented in detail further in this stage of the method). For the example from Fig. 11d, the value g(x 0, y 0) = 33. Thus the pixel (x 0, y 0) belongs to two grey level intervals: g(x 0, y 0) ∈ G 1 and g(x 0, y 0) ∈ G 2. Two adjacent pixels with the coordinates (x 0, y 0) and (x 0 − 1, y 0) have grey levels from the interval (0, 50]. This is one of the defined conditions for the set of points, which enables an edge pixel to be found. Namely: E 1 = {(x, y) : g(x, y) ∈ G 1g(x − 1, y) ∈ G 1}. Consequently, an arithmetic operation to reduce the coordinate x is executed, and afterwards the boundary condition defined in the following set \(E^{0}=\{(x,y): g(x,y) \in \overline {G}_{1} \}\) is checked. This condition means that the grey level of a point with the coordinates (x, y) no longer falls within the interval (0, 50], but within the interval (50, 255], Fig. 9e. The boundary condition defined in the set E 0 is met only after the third step, i.e. after the coordinate x is reduced three times. Thus we obtain the second coordinate P 1 of the polyline L 1, Fig. 11e. The next point of the polyline has the initial coordinates x 0 = xP 1 and y 0 = yP 1 + dy. The grey level value g(x 0, y 0) is read for this point, too, and then it is classified to one of the defined sets of point detailed below in this stage of the method. Afterwards, arithmetic operations are executed on its coordinates to find the edge pixel.

Figure 11
figure 11

A liver CT–finding the coordinates of the polyline L 1. a An example CT image with length DY of the polyline L 1 marked. b Points of the polyline L 1. c Initial coordinates of the point P 1 of the polyline L 1. d The first step of determining the point P 1 of the polyline L 1. e Subsequent steps in determining the point P 1. f Estimating distances of coordinates along the X axis (the most precise results were obtained for dl x = 15).

The actions associated with determining the initial coordinates can be presented in the following way:

Let P u P u−1L 1 for u ≥ 1 be any section of the polyline L 1 with the coordinates P u−1 = (xP u−1, yP u−1) and P u = (xP u , yP u ). Let (x 0, y 0) be the initial coordinates of the pixel P u . The following relationship exists: x 0 = xP u−1, y 0 = yP u−1 + dy. An assumption was made that DYDY L1 for DY L1 = ⌊M/6⌋.

Let P u−2 P u−1, P u−1 P u for u ≥ 2 be two subsequent sections of the polyline L 1. Let us assume that (x 1, y 1) = (xP u−2, yP u−2). Then yP u−2 = y 0dy.

Certain estimates of distances of coordinates along the X axis are important for correctly defining sets which make it possible to classify pixels and undertake the appropriate arithmetic operations to find subsequent edge coordinates. Distances along the X axis between the current location of the point with the coordinates (x, y) and its initial location with the coordinates (x 0, y 0) as well as the distance between the last and the penultimate point of the polyline L 1 i.e. x 1x 0 are marked in Fig. 11f, see Fig. 11. The constant dl x denotes the maximum distance along the X axis between the point in its initial and final position.

2.3.1 Sets of Points Allowing Pixels to be Classified to Determine Polyline L 1 Coordinates

Certain sets were defined to make it possible to classify subsequent pixels in order to determine the points of the polyline L 1. The pixel under consideration is classified to one of the defined sets of points based on:

  • the grey level value read for its current position, i.e. g(x, y)

  • the distance along the X axis between the current location of the point with the coordinates (x, y) and its initial position with the coordinates (x 0, y 0)

  • the distance along the X axis between the two last points of the polyline L 1 with the coordinates: (x 0, y 0) and (x 1, y 1)

Sets of points were defined using image algebra notation [19]. After the right classification, the appropriate arithmetic operations detailed in Fig. 10 are executed.

Definition of the set A 1

$$\begin{array}{r} A^{1}=\{(x,y):(g(x,y)=0 \wedge \mid x - x_{0} \mid < dl_{x}) \vee (g(x,y) \\ \neq 0 \wedge g(x-1,y)=0 \wedge \mid x - x_{0} \mid < dl_{x} ) \} \end{array} $$

One of the following two conditions is met:

  1. 1.

    The pixel with the coordinates (x, y) has the value of g = 0 and the distance of its coordinate x from the initial position x 0does not exceed the constant value dl x (the most precise results were obtained for dl x = 15 and also dl y = 15).

  2. 2.

    The pixel with the coordinates (x, y) has the value of g ≠ 0 and the adjacent pixel with the coordinates (x − 1, y) has the value g equal to 0. In addition, the distance of the x coordinate from the initial position x 0does not exceed the constant value dl x .

Definition of the set A 0

$$A^{0}=\{(x,y):g(x,y) \neq 0 \wedge g(x+1,y)=0 \} $$

This is the set in which the boundary condition for stopping the execution of arithmetic operations for pixels belonging to the set A 1 is defined. The pixel with the coordinates (x, y) has the value of g ≠ 0 whereas the adjacent one with the coordinates (x + 1, y) has the value g equal to 0.

Definition of the set B 1

$$B^{1}=\big\{(x,y):g(x,y)=0 \wedge \mid x - x_{0} \mid = dl_{x} \big\} $$

The pixel with the coordinates (x, y) has the value of g = 0 and the distance of its coordinate x from the initial position x 0 is equal to the constant value dl x .

Definition of the set B 0

$$B^{0}=\big\{(x,y):g(x,y) \neq 0 \wedge \mid x - x_{0} \mid = dl_{x} \big\} $$

This is the set in which the boundary condition for stopping the execution of arithmetic operations for pixels belonging to the set B 1 is defined. The pixel with the coordinates (x, y) has the value of g ≠ and the distance of its coordinate X from the initial position x 0 is equal to the constant value dl x .

Definition of the set C 1

$$\begin{array}{rll} C^{1}&=&\big\{(x,y):g(x,y) \in \overline{G}_{1} \wedge (x \leq x_{0}) \wedge (x_{0}-x)\\ \qquad\quad < dl_{x} \wedge \mid x_{1}-x_{0} \mid < 1/3 \cdot dl_{x}\big\} \end{array} $$

The point with the coordinates (x, y) has the g value from the interval specified by the set \(\overline {G}_{1}\). In addition, the distance of the initial coordinate x 0 from x does not exceed the constant value of dl x , while the distance along the X axis of the two last pixels of the polyline L 1 is shorter than the constant 1/3 · dl x .

Definition of the set C 0

$$C^{0}=\{(x,y):g(x,y) \in {G}_{1} \} $$

This is the set in which the boundary condition for stopping the execution of arithmetic operations for pixels belonging to the set C 1 is defined. The pixel with the coordinates (x, y) has the g value from the interval specified by the set G 1.

Definition of the set \(C^{1}_{1}\)

$$\begin{array}{rll} C^{1}_{1}&=&\{(x,y): ((DY_{L_{1}}-DY) \leq 1/2 \cdot DY_{L_{1}}\} \wedge \mid x_{1}-x_{0} \mid\\ &&\qquad\quad {}\geq{} 2/3 {}\cdot{} dl_{x}) {}\vee{} ((DY_{L_{1}}-DY) {}\leq{} 1/4 {}\cdot{} DY_{L_{1}}) \end{array} $$

One of the following two conditions is met:

  1. 1.

    The difference between the constant \(DY_{L_{1}}\) and DY (DY—the total of component distances dy between points of polylines created so far) is smaller than or equal to the value of \(1/2 \cdot DY_{L_{1}}\). In addition, the estimation between the values of x coordinates of the last two points of the polyline L 1is satisfied.

  2. 2.

    The difference between the constants \(DY_{L_{1}}\) and DY is smaller than or equal to the value \(1/4 \cdot DY_{L_{1}}\).

Definition of the set D 1

$$\begin{array}{rll} D^{1}&=&\big\{(x,y):g(x,y) \in \overline{G}_{2} \wedge \mid x_{1} - x_{0} \mid < 1/3 \cdot dl_{x}\\ &&\qquad\quad \wedge \mid x-x_{0} \mid < 1/3 \cdot dl_{x}\big\} \end{array} $$

The pixel with the coordinates (x, y) has the grey level value g from the interval specified by the set \(\overline {G}_{2}\). In addition, two estimations of distances relative to the X axis are satisfied for two pairs of coordinates:

  1. 1.

    The initial value x 0and x 1(i.e. for the one but last coordinate of the polyline L 1).

  2. 2.

    The current value of x and the initial of x 0.

Definition of the set D 0

$$D^{0}=\big\{(x,y):g(x,y) \in {G}_{2} \big\}$$

This is the set in which the boundary condition for stopping the execution of arithmetic operations for pixels belonging to the set D 1 is defined. The pixel with the coordinates (x, y) has the grey level value g from the interval specified by the set G 2.

Definition of the set E 1

$$E^{1}=\big\{(x,y):g(x,y) \in {G}_{1} \wedge g(x-1,y) \in {G}_{1}\big\} $$

Two adjacent pixels with the coordinates (x, y) and (x−1, y) have grey level values from the interval specified by the set G 1.

Definition of the set E 0

$$E^{0}=\big\{(x,y):g(x,y) \in \overline{G}_{1}\big\} $$

This is the set in which the boundary condition for stopping the execution of arithmetic operations for pixels belonging to the set E 1 is defined. The pixel with the coordinates (x, y) has the grey level value g from the interval specified by the set \(\overline {G}_{1}\).

Definition of the set F 1

$$F^{1}=\big\{(x,y):g(x,y) \in {G}_{1} \wedge g(x-1,y) \in \overline{G}_{1}\big\} $$

The pixel with the coordinates (x, y) has the grey level value g from the interval specified by the set G 1, while the pixel with the coordinates (x−1, y) has the grey level value g from the interval specified by the set \(\overline {G}_{1}\).

Definition of the set F 0

$$F^{0}=\big\{(x,y):g(x,y) \in \overline{G}_{1} \big\} $$

This is the set in which the boundary condition for stopping the execution of arithmetic operations for pixels belonging to the set F 1. The pixel with the coordinates (x, y) has the grey level value g from the interval specified by the set \(\overline {G}_{1}\).

Stage 4.   Finding points of subsequent polylines L i : {i = 2…6}

The coordinates belonging to subsequent polylines L i : {i = 2…5} are found in the way shown in Stage 3 of this method for the polyline L 1. Based on the sets of points defined according to pre-set, constant intervals of grey levels, certain arithmetic operations of increasing or reducing the appropriate x and y coordinates of pixels are executed to find boundary coordinates. Ribs form an additional element of the image which must be considered when searching for the boundary represented by polylines L i {i = 2 … 5}. Coordinates must be found which are located in front of ribs, as shown in the example from Fig. 12. For this reason, certain conditions were defined which enable pixel classification to identify subsequent points of polylines. In addition, two sets of grey level values were defined: G 3 and \(\overline {G}_{3}\). These sets were defined as follows: G 3 = {gZ : g ∈ [0, 200)} and \(\overline {G}_{3}=\{ g \in Z: g \in [200,255] \}\).

Figure 12
figure 12

A CT of the abdominal cavity and the liver. a An example CT image with the following distances marked: DY for the polyline L 4 and DX for the polyline L 2. b Points of the polyline L 4 marked. c Pixels belonging to the set \(\overline {G}_{3}\) are marked with a uniform grey colour. d Pixels belonging to the set G 3 are marked with a uniform grey colour. Ribs are distinguished by their white colour. e Points of the polyline L 2 marked. f Pixels belonging to the set G 3 are marked with a uniform grey colour. g Pixels belonging to the set \(\overline {G}_{3}\) are marked with a uniform grey colour. Two areas occupied by ribs, set off by their white colour, are marked with boxes.

In Fig. 12d and g, the ribs have been clearly separated from the rest of the image, transformed into a uniform background. Background pixels belong to the set G 3, while the pixels from the area occupied by the ribs belong to the set \(\overline {G}_{3}\). The example from Fig. 12 is about two polylines:

  • L 2, whose subsequent coordinates are found along the Y axis, while along the X axis, constant distances between them are kept. Fig. 12e, f, g.

  • L 4, whose subsequent coordinates are found along the X axis, while along the Y axis, constant distances between them are kept. Figure 12b, c, d

While the coordinates of the polylines are determined within the anatomical area occupied by the ribs, two situations are considered:

  • While the coordinates are increased or decreased, the point may approach the edge of the area occupied by the rib, Fig. 13.

  • The starting point of the polyline may be located within the area occupied by the rib, Fig. 14.

The method of proceeding in the situation from the example shown in Fig. 13a–d making it possible to find coordinates in front of the area occupied by the ribs is shown by the diagram from Fig. 13e. The method of proceeding in the situation from the example shown in Fig. 14a–d making it possible to find coordinates in front of the area occupied by the ribs is shown by the diagram from Fig. 14e.

Figure 13
figure 13

Determining the coordinates of the polyline L 2. a Determining the initial coordinates of the second point of the polyline L 2. b The first step of determining the point P 1 of the polyline L 2. c Subsequent steps in determining the point P 1. d The last step of determining the point P 1. e Finding boundary points located below the ribs along the X axis.

Figure 14
figure 14

Determining the coordinates of the polyline L 2. a Determining the initial coordinates of the point P 7 of the polyline L 2. b The first step of determining the coordinates of the point P 7 of the polyline L 2. c Subsequent steps in determining the point P 7. d The last step of determining the point P 7. e Finding boundary points located below the ribs along the X axis.

The polyline L 6 is built as an option. It approximates the boundary of the liver in two cases:

  1. 1.

    During the determination of coordinates of polyline L 5the value of the coordinate is x ≥ ⌊2/5 · M⌋, and the value of the y coordinate has increased relative to the last point representing the boundary, Fig. 15a and c.

  2. 2.

    During the determination of coordinates of polyline L 5, the value of the x coordinate is x ≥ ⌊2/5 · M⌋ and in addition, in this CT image, the edge of the liver adjoins muscles and ribs, as shown in Fig. 15b and e.

Figure 15
figure 15

A liver CT–building the polyline L 2. a,b Two anatomical areas approximated with the L 6 polyline are marked within rectangular boxes. c Points of the L 5 polyline and estimations of distances along the Y axis marked. The last point of the L 5 polyline, which is also the first point of the L 6 polyline, is marked in red. d Estimations of distances along the Y axis for points of the L 6 polyline. e Points of the polyline L 5 marked. The last point of the L 5 polyline (in red) is located in the close neighbourhood of the area occupied by muscles and the rib.

Let (x 0, y 0) be the penultimate point of the polyline L 5. In Fig. 14c (x 0, y 0) = P 19 = (xP 19, yP 19). The difference yP 20y 0 has exceeded the set estimation of 1/3 · dly. Thus (x 0, y 0) ∈ A 1, whereas A 1 = {(x, y) : (y 0 < y) ∧ (yy 0) > 1/3 · dly}. Consequently, one should finish building the polyline L 5 and start building the polyline L 6 with the initial point having the coordinates of P 19 = (xP 19, yP 19) = P 0, Fig. 15d. The case described under 2) is presented in Fig. 15b and d. Let us assume:

$$\begin{array}{rll} B(x,y)&=&(x+j+1,y-i-1)_{i \times j} \,\text{for} \\ &&1 \leq i \leq 4\,\text{and}\, 1 \leq j \leq 3 \end{array} $$

It can be observed that the values of grey levels from the neighbourhood of the coordinates P 21 = (xP 21, yP 21) expressed by the matrix B belong to the interval (50, 255], i.e. they belong to the \(\overline {G}_{1}\) found in the anatomical area occupied by muscles and ribs. Consequently, one should finish building the polyline L 5 and start building the polyline L 6 with the initial point having the coordinates of P 21 = (xP 21, yP 21). The condition that values of grey levels of the coordinates of the B matrix should belong to the set \(\overline {G}_{1}\) can be presented as follows: \(B^{1}=\{ (x,y) \in B:g(x,y) \notin \overline {G}_{1} \}\).

Stage 5. Building polylines belonging to the set R

When finding points belonging to subsequent polylines {R i : i = 1 … 6}, the coordinates of the end point P E = (xP E , yP E ) of the last polyline L s (s = 5ors = 6) from the set L (4) are taken into account in accordance with the relationship expressed by formula (4).

Let P T = (xP T , yP T ) be the end point of the polyline R t (t ≤ 6). Based on the trials conducted for a set of liver CT images, certain estimates were made of coordinates (x, y) between the end point of the polyline P T and P E . Namely:

  • \(A= \big \{ (x,y): (xP_{E}-xP_{T}) \geq 8/3 \cdot dl_{x} \wedge (xP_{E} - xP_{T})<4 \cdot dl_{x} \wedge (yP_{T} > yP_{E}) \big \} \)

  • \(B= \{ (x,y): (xP_{E}-xP_{T}) \geq 10/3 \cdot dl_{x} \wedge (xP_{T} - xP_{E})>4/3 \cdot dl_{y} \)

  • \(C = \{ (x,y): (xP_{E}-xP_{T}) \hspace *{-1pt}\geq \hspace *{-1pt} 4 \cdot dl_{x} \wedge (yP_{T} - yP_{E}) < dl_{y} \)

Figure 16b shows the initial situation before the first polyline R 1 is created. The proposed estimations make it possible to select and then build specified polylines R t, which evenly approximate the liver contour. The method of building subsequent polylines R i as a result of the defined estimations is shown in the diagram constituting Fig. 18. Figure 16c shows the model of the contour after first polyline R 1 is created, with the distances marked along the X and Y axes between the last point of this polyline P T = (xP T , yP T ) and the point P E = (xP E , yP E ). Figure 17a presents a model of the contour after another polyline R 2 is created, with the distances expressed by the differences between the coordinates xP E xP T and yP T yP E marked. Figure 17b contains the complete contour after the last polyline R 3 has been created. (Fig. 18)

Figure 16
figure 16

A liver CT. a An example image. b A model of the liver contour before the polylines from the set R are created. c Creating the polyline R 1.

Figure 17
figure 17

Building polylines belonging to the set R. a Creating the polyline R 2 b Creating the polyline R 3.

Figure 18
figure 18

Building polylines belonging to the set R.

Stage 6. Finding points of polylines {R i : i = 1…6}

The point P ST = (xP ST , yP ST ) is the starting point from which subsequent coordinates of the polyline R 1 are determined just as in the case of the polyline L 1. The determination of the point P ST was presented at stage 1 of this method. The coordinates belonging to polylines {R i : i = 1 … 6} are found in the same way as shown in Stages 3 and 4 of this method for polylines {L i : i = 1 … 6}. The classification of pixels to defined sets of points containing set boundary conditions is used to execute specific arithmetic operations of increasing or reducing the appropriate x and y coordinates. If the boundary of the liver is approximated with polylines {R i : i = 1 … 6}, there is no liver area occupied by the ribs, so none such needs to be included in the calculations.

3 Segmenting the Liver from CT Images Using the Approximate Contour Method

This section presents the method of segmenting the liver shape from CT images. The method is based on the approximate liver contour drawn in the previous section.

3.1 Segmenting the Liver Shape Within a CT Image of the Abdominal Cavity

The proposed method of segmenting the liver shape from a CT image makes use of the calculated values of coordinates identifying the liver contour using component polylines presented in Section 2 and determined by relationships (3) and (5).

In order to segment the liver shape from a CT image, two areas will be defined in the form of polygons W 1 and W 2, which represent fragments of the image located outside the liver contour. Polygons W 1 and W 2are shown in Fig. 19a and b respectively. This way, the CT image is split into three parts: two polygons W 1 and W 2, representing the background and the area Lv containing the liver shape presented in Fig. 19c.

Figure 19
figure 19

Segmenting the liver shape within a CT image of the abdominal cavity. a The polygon W 1 containing the polyline L. b The polygon W 2 containing the polyline R. c The segmented shape of the liver.

Under the above assumptions, the segmentation was executed in such a way that a fragment of the CT image showing the liver, defined by the mapping g : M 2Z, was replaced with the area defined by the two polygons W 1 and W 2, in which area all pixels were assigned the black colour. We obtain:

$$ g'= \left\{ \begin{array}{ll} g~ & {\rm{if}}\;(x,y) \in W_{1} \cup W_{2}\\ 0 \ \mbox{(black)} & {\rm{if}}\; (x,y) \notin W_{1} \cup W_{2} \end{array} \right. $$
(6)

Figure 19c presents a CT image with the liver shape segmented.

4 Completed Experiments and Research Results

Materials from the Image Diagnostics Department of the Gdańsk Provincial Specialist Hospital in Poland were used in the research on computed tomography image analysis. The CT images were acquired using the Siemens Somatom Emotion 6 apparatus. A contrast medium was used in the scanning. The exposure parameters for the abdominal cavity were: 130 kVp and 95 mAs for the venous phase, 110 kVp and 90 mAs for the arterial phase, 2 mm slice colimmation and the table speed of 15 mm/sec.

The analysed images come from 120 different patients and include 60 cases in which no lesions were found as well as 60 cases with visible lesions, including: 30 different cases showing hemangiomas and 30 different cases with hepatomas. Figures 21a and g show cases with visible hapatomas, while Fig. 21d presents a single focused hemangioma. For every one of the 120 different cases, between eight and maximum sixteen CT slices were selected, from which liver areas were extracted using the segmentation method proposed here. As a standard, a CT examination can produce a set of between several dozen and about two hundred images of the cross-section of the abdominal cavity and the liver. However, only some of them will show the gradually growing and then shrinking cross-section of the liver with possible lesions in it. After consulting physicians, between eight and the maximum sixteen images showing subsequent cross-sections of the abdominal cavity and the liver were selected for the research work for every one of the 120 different cases analysed.

Figure 20
figure 20

Test results for three measurements based on 1,330 CT images of the abdominal cavity and the liver originating from the three measurements shown in Tables 1 and 2.

4.1 Dice’s Similarity Coefficient

Dice’s similarity coefficient was used to assess the accuracy of the method employed for segmenting the shape of the liver.

Dice’s similarity coefficient [22] is a value making it possible to compare the percentage similarity of sets. These sets can be defined as areas with specific pixel numbers in the analysed digital image.

Let Lv auto ⊂ Z2 be the fragment of the image obtained using the automatic shape extraction method and Lv manual ⊂ Z2 signify the image fragment extracted manually by a radiologist. It was assumed that | Lv auto | is the number of pixels found in the area delineated using the automatic shape extraction, while |Lv manual | is the number of pixels in the area isolated by the radiologist. The number of pixels found in the common area is |Lv auto Lv manual |. Dice’s similarity coefficient is defined as follows:

$$ DSC=\frac{2 \cdot |Lv_{auto} \cap Lv_{manual}|}{|Lv_{auto}|+|Lv_{manual}|} \times 100~\% $$
(7)

As between eight and maximum sixteen CT slices were selected for every one of the 120 different cases, and from theses slices liver areas were extracted, the mean value of the Dices similarity coefficient was calculated as follows:

$$ DSC_{Av}=\frac{1}{k} \cdot \sum\limits_{i=1}^{k} DSC_{i} {\rm{for}}\;k \in [8,16] $$
(8)

The second column of Fig. 21 contains images with the liver shape manually delineated based on the contour traced by the radiologist. The third column contains the results, that is automatically extracted liver shapes. Table 1 and Fig. 20 show the results of three experiments based on measurements taken by three different physicians specialising in radiology. Results of experiments calculated using formula (8) for particular disease units are listed in the order of the number of cases. Table 2 shows the mean values based on all measurements taken by three different physicians and those taken from Table 1. The method applied yielded the best results for CT images of the liver without lesions, and in this case Dice’s similarity coefficient amounted to 84.8 % for 610 images. If lesions, i.e. hemangiomas and hepatomas, were present, Dice’s similarity coefficient was equal to 79.65 % for 720 images.

Figure 21
figure 21

Segmenting the liver shape in CT images of the abdominal cavity. The first column shows example computed tomography images. The second column contains images with the liver shape manually delineated based on the contour traced by the radiologist. The third column contains the automatically extracted liver shapes.

Table 1 Test results for three measurements based on 1,330 CT images of the abdominal cavity and the liver.
Table 2 Mean test results for 1,330 CT images of the abdominal cavity and the liver coming from the three measurements shown in Table 1.

5 Summary and Further Research Directions

The article presents a new method of automatically segmenting the liver shape from CT images of the abdominal cavity, which method uses the lumbar section of the spine as a seed point. After the starting point is identified, an approximate liver contour made up of joined polylines is drawn. These component polylines form the elements of two polygons eliminated from the image, which leaves only the segmented liver shape within the image. For the 1,330 CT images of the abdominal cavity and liver analysed, the Dice’s similarity coefficient amounted to 81.3 %. Better segmentation results were obtained for CT images of the abdominal cavity and the liver without lesions. If they are compared to images showing lesions, the difference is about 5 %.

The research on creating a mathematical description of liver contours in the analysed images shows that this is a key stage of the analysis and it may determine the accuracy and precision of the procedure of segmenting the liver from CT images. The research conducted on this subject can also be summarised in the form of the following conclusions:

  1. 1.

    The shape of the liver can be irregular and distorted in computed tomography images showing its cross-section. In the case of distortion of the edge as shown in Fig. 3b–f, the values of subsequent coordinates are approximated based on previously identified points marking the contour of the analysed shape of the organ.

  2. 2.

    This publication presents a method in which the CT image of the liver is in every instance split into specific fragments for which the approximate contour is determined. This approach makes it possible to reduce the number of operations executed when determining subsequent coordinates defining the contour.

  3. 3.

    The method of extracting the liver shape from CT images is universal and allows the shape of the organ to be extracted from the image for cases free of lesions or containing them. In order to fully confirm the suitability of the presented method, it must still be tested on a greater number of cases, and this is the subject of on-going research.

  4. 4.

    The aim of the future work will also be re-implementation of the software created with C# for the SNAP/ITK environment.