# Algorithms for pre-processing and processing stages of x-ray images

### 1.1 Introduction

This chapter presents algorithms for pre-processing and processing stages of both cervical and lumbar vertebrae x-ray images. Pre-processing stage here is the process of locating and enhancement the spine regionof interestin the x-ray image, where the processing stage includes the shape boundary representation and segmentation algorithms based feature vectors extraction and morphometric measurement. In this research the spine vertebrae are introduced and the objectives of segmentation algorithm are discussed. Then various general segmentation approaches including those based on the shape boundary extraction are discussed and applied to our spinal x-ray image collection. The current approach is introduced with a flow diagram and then the individual blocks of the segmentation process are taken up and discussed in detail.

### 1.2 Image Acquisition

A digital archive of 17,000 cervical and lumbar spine x-ray images from the second National Health and Nutrition Examination Survey (NHANES II) is maintained by the Lister Hill National Center of Biomedical Communications in the National Library of Medicine (NLM) at the National Institutes of Health (NIH). Among these 17,000 images, approximately 10,000 are cervical spine x-rays and 7,000 are lumbar x-rays. Text data (including gender, age, symptom, etc.) are associated with each image. This collection has long been suggested to be very valuable for research into the prevalence of osteoarthritis and musculoskeletal diseases. It is a goal of intramural researchers to develop a biomedical information resource useful to medical researchers and educators. Figure 3.1 shows two sample images from the database. Spine x-ray images generally have low contrast and poor image quality. They do not provide meaningful information in terms of texture or color. Pathologies found on these spine x-ray images that are of interest to the medical researchers are generally expressed along the vertebral boundary. (a) (b)

### 1.3 Proposed segmentation scheme

The proposed process main stages scheme shown at Figure3.2, followed by a details review of the used methods applied to our spinal images and can be listed as follow:

a. Pre-processing stage include image acquisition, region localization (RL) and region localization enhancement.

b. Shape boundary representation and segmentation stage; include active shape model (ASM) segmentation based on two shape boundary representation 9-anatomical points and b-spline representation.

c. Feature extraction stage; include feature extraction based shape feature vector and morphometric measurement-invariant features for indexing.

d. Classification and similarity matching stage; include feature models classifier and similarity matching for diagnosis and retrieval

### 1.4 Pre-processingstage

### 1.4.1 Spineregion localization

Region localization (RL) refers to the estimation of boundaries within the image that enclose objects of interest at a coarse level of precision. RL is important for assisting human experts in rapid image display and review (independent of its use in initializing a segmentation process). For example, with an algorithm that can rapidly, and with high probability identify the spine region with a marked line passing, this region of interest can be automatically zoomed on the display even though the location and orientation of the spine may vary appreciably in these images. This algorithm assumes that a line passing through the maximum amount of bone structure in the image will lie over a large part of the spine area, given a line passing through the image; Figure 3.3 shows the region localization (RL) selection of both cervical and lumbar images. (a) (b)

### 1.4.2 Enhancement approach

Image enhancement is significant part of AVFAS recognition systems. Changes in lighting conditions produces dramatically decrease of recognition performance, if an image is low contrast and dark, we wish to improve its contrast and brightness. The widespread histogram equalization cannot correctly improve all parts of the image. When the original image is irregularly illuminated, some details on resulting image will remain too bright or too dark. Typically, digitized x-ray images are corrupted by additive noise and de-noising can improve the visibility of some structures in medical x-ray images, thus improving the performance of computer assisted segmentation algorithms. However, image enhancement algorithms generally amplify noise [17, 18]. Therefore, higher de-noising performance is important in obtaining images with high visual quality for that reason different enhancement techniques was implemented

### i. Adaptive histogram-based equalization ( Filter 1)

Adaptive histogram-based equalization (AHE) can be applied to aid in the viewing of key cervical and lumbar vertebrae features, and it’s an excellent contrast enhancement method for medical image and other initially no visual images. In medical imaging its automatic operation and effective presentation of all contrast available in the image data make it a competitor of the standard contrast enhancement methods.

The goal of using adaptive histogram equalization is to obtain a uniform histogram for the output image, so that an “optimal” overall contrast is perceived. However, the feature of interest in an image might need enhancement locally. Adaptive Histogram Equalization (AHE) computes the histogram of a local window centred at a given pixel to determine the mapping for that pixel, which provides a local contrast enhancement. However, the enhancement is so strong that two major problems can arise: noise amplification in “flat” regions of the image and “ring” artifacts at strong edges [12, 13].

Histogram equalization maps the input image’s intensity values so that the histogram of the resulting image will have an approximately uniform distribution [9-11].The histogram of a digital image with gray levels in the range [0, L-1] is a discrete function

Where is the gray level, is the number of pixels in the image with that gray level, is the total number of pixels in the image, and k =0, 1, 2… L-1, basically gives an estimate of the probability of occurrence of gray level

The local contrast of the object in the image is increased by applied histogram equalization, especially when the applied data of the image is represented by close contrast values. Through this adjustment the intensity can be better distributed on the histogram, this allows for areas of lower local contrast to gain a higher contrast without affecting the global contrast. (a) (b)

### ii. Adaptive contrast enhancement

The idea is to enhance contrast locally analyzing local grey differences taking into account mean grey level. First we apply local adaptive contrast enhancement. Parameters are set to amplify local features and diminish mean brightness in order to obtain more contrast resulting image. After that we apply histogram equalization.

Adaptive gamma value

Gamma correction

Gamma correction operation performs nonlinear brightness adjustment. Brightness for darker pixels is increased, but it is almost the same for bright pixels. As result more details are visible.

### 1.5 Shape boundary segmentation

Shape boundary segmentation presented at this work is a hierarchical segmentation algorithm tailored to the segmentation of cervical and lumbar vertebrae in digitized x-ray images. The algorithm employs the both shape boundary representation schemes, 9-anatomical point’s representation (9-APR) and B-spline representation (B-SR) to obtain a suitable initialization for segmentation stage that utilize active shape models (ASMs) proposed by Cootes et al. The advantage of using ASMs in medical image segmentation applications is that rather than creating models that are purely data driven, ASMs gain a priori knowledge through a thorough observation of the shape variation across a training set.

### 1.5.1 Shape boundary representation

Shape is an important characteristic for describing pertinent pathologies in various types of medical image and it’s a particular challenges regarding vertebra boundary segmentation in spine x-ray images. It was realized that the shape representation method would need to serve the dual purpose of providing a rich description of the vertebra shape while being acceptable to the end user community consisting of medical professionals. In order to model the spinal vertebra shape we presented by term of set points chosen to place point around the boundary , this must be done for each shape at training stage and the labelling point its important. Two schemes list has been used at this stage to determine a vertebra boundary shape in terms of list points

### i. 9-anatomical point representation (9-APR)

We obtained segmentation data created by medical expertise at an early state of our segmentation work; the purpose of this task was to acquire reference data as a guideline for validating vertebrae segmentation algorithms. These data consisted of (x, y) coordinates for specific geometric locations on the vertebrae; a maximum of 9-anatomical points representation (9-APR) assigned and marked by board certificate radiologist that is indicative of the pathology found to be consistently and reliably detectable per vertebra were collected . Figure 3.7 shows below the points were placed manually on each vertebrae and which is the interest to medical researchers.

Points 1, 3, 4, and 6 are indicative of the four “corners” of the vertebral body as seen in a projective sagittal view. Points 4 and 3 mark the upper and lower posterior corners of the vertebra, respectively; Points 6 and 1 mark the upper and lower anterior corners of the vertebra, respectively. Points 5 and 2 are the median along the upper and lower vertebra edge in the sagittal view; Point 8 is the median along the anterior vertical edge of the vertebra in the sagittal view. Note that Points 7 and 9 mark the upper and lower anterior osteophytes, so if osteophyte(s) are not present on the vertebra, then these points (7-9) coincide with points 6 and 1, respectively.

### ii. B-spline representation (B-SR)

Representation of curves using piecewise polynomial interpolation to obtain curves is widely used in computer graphics .B-spline are piecewise polynomial curves whose shape is closely related to their control polygon a chain of vertices giving a polygonal representation of curves. B-splines of the third order are most common because this is the lowest order which includes the changes of curvatures.

The Advantage of using B-spline techniques at this research is to enhance the 9-anatomical points, B-spline curves require more information (i.e., the degree of the curve and a knot vector) and a more complex theory than Bézier curves. But, it has more advantages to offset this shortcoming.

* B-spline curve can be a Bézier curve.

* B-spline curves satisfy all important properties that Bézier curves have.

* B-spline curves provide more control flexibility than Bézier curves can do.

* The degree of a B-spline curve is separated from the number of control points. More precisely [ReF].

We can use lower degree curves and still maintain a large number of control points and also we can change the position of a control point without globally changing the shape of the whole curve (local modification property). Since B-spline curves satisfy the strong convex hull property, they have a finer shape control. Moreover, there are other techniques for designing and editing the shape of a curve such as changing knots.

B-spline is a generalization of the Bezier curve [Ref] , let a vector known as the knot vector be defined,

Where, is a no decreasing sequence with and define control points, Define the degree as ,The knots ” are called internal knots.

### 1.5.2 Modelling Shape Variations

In ASM, an object shape is represented by a set of landmark points and requires a good initialization of an object’s pose in an image (i.e., location, size, and angle of rotation); therefore, we used the two schemes representation (9-APR & B-SR) in our proposed segmentation technique to create this initialization. Several instances of the same object class are included in a training set and in order to model the variations we need to align the set of shapes.

### i. Training set

In order to build a model that is flexible enough to cover the most typical variations of vertebrae, a sufficiently large training set has to be used. For the purpose of the investigation reported in this work, we locate the shape (by eye) and it’s important that the two schemes representations are accurately located and that there is an exact correspondence between labels in different instances of training shapes. In this research a set of 1100 vertebra for both cervical (400 vertebral) and lumbar (710 vertebra) has been used.

### ii. Aligning trainshapes

The model that will be used to describe a shape and its typical appearances is based on the variations of the spatial position of each landmark point within the training set. Each point will thus have a certain distribution in the image space and therefore the shape model is being referred to as a Point Distribution Model (PDM). In order to obtain the PDM, we use the two shape representation, to align the shapes, and finally, to summarize the landmark variations in a compact form. In what follows, these steps are being described in some detail. We achieve the required alignment by scaling, rotating and translating the training shapes so that they correspond as closely as possible.

### 1.7 Shape boundary Indexing

The shape analysis described here is related to the statistical analysis of vertebrae shapes to shape similarity matching and recognition. Three schemes of shape analysis implemented at this stage. First scheme is the shape analysis based feature vectors extraction includes statistical shape feature (SSF) and Gabor wavelets features (GWF). Second scheme is the shape analysis based morphometric measurement based angles measurement index (AMI) and intra-bone ratio measurement (IBRM). Last is the analysis based similarity matching, the index output result from each analysis will be considered as input to the classifier systems those schemes outlined are described below.

Feature vector is an n-dimensional vector of numerical features represents object shape. Statistical models captured from active shape model, Gabor wavelets filter bank require a numerical representation of vertebrae shape based on both boundary shape representation (9-anatomical point model ,B-spline curve), since such representations facilitate processing and statistical analysis. Figure below shows schematic pattern recognition system based feature vectors.

### 1.7.1 Statistical shapefeatures(SSF)

Each vertebral in the training set, when aligned can be represented by a single points in 2n dimensional space (eq2).Thus a set of N example shapes gives base on each shape boundary representation cloud of N point in this 2n dimensional space. We assume that these points lie within some region of the space which call the “Allowed Shape Domain” and that the points give an indication of the shape and size of this region.

Every 2n-D point within this domain gives a set of landmarks whose shape is broadly similar to that of those in the original training set. Thus by moving about the Allowable shape domain we can generate new shapes in systematic way .The approach given below attempts to model the shape of this cloud in high dimensional space and hence to capture the relationship between the positions of the individual landmark points.

### 1.7.2 Gabor wavelets features(GWF)

The objectives of this stage is to explore the feasibility of using Gabor wavelet-constructed spatial filters to extract feature-based vector from shape boundary consisting of cervical and lumbar vertebrae, and to use these extracted feature vectors to train and test with different classifier. To evaluate the robustness of the method, so many analysis based filter and mask size was experimented to select the suitable Gabor mask that will be convolute with the two vertebra shape boundary extracted.

In order to briefly describe Gabor wavelets and provide a rationale for this stage of work, the Short Time Fourier Transform (STFT) and Gabor Transform need to be explained first. The Fourier transform is a fundamental tool of classical signal analysis.

### i. Gabor wavelets filter bank

The Gabor wavelet function used in this research for AOs feature extraction was same as Naghdy (1996) used and was defined.

Where: the different choices of frequency j and orientation constructed a set of filters.

### ii. Filter frequency and mask size analysis

As the frequency of the sinusoid changes, the window size will be changed. (Fig. 3.28, 3.29, 3.30 and 3.32) shows real and imaginary parts of eight two-dimensional wavelets filters. When j is changed from 1 to 4, the sinusoid frequency is reduced whereas the Gaussian window size increases. In comparison, for the Gabor transform, Gaussin window size will remain same.

### iii. Convolution vertebral region with the filter bank

The elementary Gabor wavelet functions were used to construct spatial domain filters, Each filter was made of a pair of filters, which were the real and imaginary part of the complex sinusoid. These pair was convolved with the green channel signal of texture image separately. The reason of choosing the green channel to do convolution was that the green channel was found to have the best texture quality, which means the best contrast level between plants and soil, among red, blue and MExG channels.

This scenario is absolutely sensor dependent and may not be the case for other sensors. For one frequency level, the filtering output was the modulation of the average of the convolution output from real and imaginary filter masks on all convolved pixels in the green channel image, which was computed.

### iv. Gabor wavelets filer bank block diagram

### 1.8 Shape boundary morphometric measurement

### 1.8.1 Morphometric measurement-invariant features

For efficient image retrieval, it is important that the pathological features of interest be detected with high accuracy. In this stage of Automatic Vertebral Fracture Assessment System techniques, new morphometric measurement-invariant features were investigated for the detection of anterior osteophytes, including lumbar and cervical vertebrae. The goal in this stage of work is to investigate a measurement algorithm for high accuracy and avoid the complex calculation. Two approaches morphometric measurement-invariant features were developed based:

1) Angles – invariant features (A-IF)

2) Intra-distance ratio invariant features (ID-IF)

The results of this morphometric extraction geometries calculation will produce a signal of two index based on angle and distance measurement that can be used to distinguish between the anterior osteoporosis classes and their severity implemented as input for classifier algorithm. Figure below show the block diagram of the shape analyses based morphometric technique.

### Stage 1: AOs detection

Two classification schemes for anterior osteophytes were established by a medical expert to evaluate the accuracy of the PSM algorithm. The first is Macnab’s classification, established by Macnab and his coworkers in 1956 on radiological and pathological bases [6, 7].Two types of osteophytes are adapted from Macnab’s classification: claw and traction, as shown in Figure 1. Their visual characteristics are:

1. Claw spur rises from the vertebral rim and curves toward the adjacent disk. It is often triangular in shape and curved at the tips.

2. Traction spur protrudes horizontally, is moderately thick, does not curve at the tips, and never extends across the intervertebral disk space.

The second classification is a grading system which was defined by the medical expert consistent with reasonable criteria for assigning severity levels to anterior osteophytes (AO). Three grades of AO are slight, moderate, and severe, also shown in Table 1. Their visual characteristics are:

1. Slight grade includes normal, where the corner angles on the vertebral boundary are approximately right angles. It may have a slight protuberance, where the tip of the osteophyte is round and no narrowing is observed at the base of the protuberance.

2. Moderate grade is characterized by evident protuberance from the ideal horizontal or vertical edge of the vertebra. The bounding edges of the AO form an angle of at least 45 degrees and the osteophyte has a relatively wider base than severe grade.

3. Severe grade is characterized by presence of hook, the angle is less than 45 degrees and has a narrow base, or protrudes far (about 1/3 of the length of the horizontal border) from the normal (ideal 90 degree) vertebral corner.

### Angles – invariant features (A-IF)

We explore three main angles for measurement that make sense of difference between the AO classes from the 9-anatomical landmarks model. Shape below show the angle of interest selected that will be used next as input for our classifier system to make decision

(a) Turning Angle (b) Intra-Distance Across the Shape

### Turn Angle (TA)

To capture the characteristics of shape in local regions, we use two different features. The first is Turn Angle (TA). Turn Angle is also called Turning Angle or Bent Angle. It is defined as follows [3]: if the points on the polygon are ordered in the counterclockwise direction, and the polygon is traversed in this direction, the Turn Angle is the angle between the direction vector for the current polygon segment and the next one; the sense of the Turn Angle is calculated such that a clockwise turn gives a negative angle whereas a counterclockwise turn gives a positive angle. Figure 3 (a) shows an example.

For an arbitrary shape, the Turn Angle feature could be calculated from the approximating polygon for that shape. Turn Angle for a polygon with n vertices is simply a vector in Rn . For example, if the vertebra is represented as a polygon with 72 vertices (our “sparse” representation), the Turn Angle is a 72-element vector. If the polygon has the concept of an initial vertex, similarity computation is

straightforward, e.g., with a Euclidean metric. If there is no initial vertex, similarity between two shapes may be computed by a combinatorial comparison of distances between possibly-matching sets of vertices. This computation may be optimized by dynamic programming.

### Intra-distance ratio invariant features (ID-IF)

Distance across the shape [4] is another local shape feature. DAS is defined, for each vertex P in a polygon, as the length of the angle bisector at P, measured as the line segment from P to the intersecting side of the polygon. For Example, the interior bisector of angle âˆ P2P3P4 in the figure

3 (b) intersects the contour at point I3. The length of P3I3 is the DAS at point P3. If the bisector intersects the shape multiple times, the distance to the closest intersection is used. Similarly as for turn angle, if we represent the vertebra shape as a polygon with 72 sample points, the DAS feature may be calculated on those 72 points.

Where,

V: is called as vertical angle calculated between the points 7-8-9

H: is called as horizontal angle calculated between the points 1-2-3

C: is called as corner angle calculated between the points 8-9-1

Angle formula calculation between these three points coordinates as follow

### 1.9 Operation

Step 1: Calculate the Horizontal angle and this calculation based on the

Step 2: Calculate the Horizontal angle and this calculation based on the

Step 3: Calculate the Horizontal angle and this calculation based on the

Step 4: build the rule base and evaluate the result by visual inspection

### Intra-Distance ratio Measurement (I-DRM)

Inter-bone ration is another morphometric measurement issue, it was explored based on the shape distance here we focused

Where,

: Represents the distance posterior height calculated between the points 3-4

: Represents the distance medial height calculated between the points 5-2

: Represents the distance interior height calculated between the points 1-6

: Represents the distance calculated between the points 8-mp, where mp Midpoint between the points 3-4, the Midpoint (mp) coordinates calculation formula as the following:

With;

(, ) is the point 3 coordinate, (,) is the point 4 coordinate

Given the two points (, ) and (,), the distance between these points is given by the formula:

The normal vertebra was estimated to have the following ratio distance

Distance () =Distance () =Distance ()

Base on this estimation by expert radiologist we develop another rule base decision system that can work properly to and true classify the normal and abnormal and bone

The criteria of the

X=

### Stage 2: AOsLocation

Detection of the Ao position conduct us to determine the location either upper or lower AO

a) b)

The position of the AO is determined by sample way calculation based of angles too

Stage 3: Disc space narrowing (DSN)

Stage 4 & Stage 5:Subluxation/Spondylolisthesis

### Segmentation and Pre-processing

The vertebra shapes were segmented using an active contours method modified to constrain evolving contour points to follow “orthogonal curves” [18], to avoid convergence to a self-intersecting solution contour at vertebra corners [9]. The solution contours have 36 points. Nine of these 36 points were distinguished as geometrical or anatomical reference points, with relative locations that are approximately constant across the veterbra shapes. The nine points, shown in Figure 2 were either manually marked by experts, or extracted automatically or semi-automatically by specialized algorithms [9].

For the current work, we preprocess these segmented shapes by curve smoothing (to reduce noise), fitting (for smoothness), interpolation, and re-sampling (for larger number of evenly distributed points) to obtain the final shape contour description. The curve fitting and interpolation are done with the natural cubic spline algorithm. Then the shape contour is resampled by equal arc length sampling.

Finally, the vertebra whole shape is represented by two boundary point sets with different resolutions. The “dense sampling set” contains 180 points, and the superior and the inferior anterior corners are represented by 60 points, respectively. The “sparse sampling set” contains 72 points, with the superior and the inferior anterior corners represented by 25 points, respectively.