**Flaw Simulation in Product Radiographs**

### Qian Huang and Yuan Wu

*South China University of Technology China* 

### **1. Introduction**

100 Nondestructive Testing Methods and New Applications

proportional to the exposure. In doing so, the radiographer do not need to perform decay and distance corrections. This method can also be applied in x-ray and gamma-ray

The author would like to express his deepest gratitude to Mr. JateChan Channuie and Mr. Kittiwin Iaemsumang for their assistance in the preparation of the figures and the tables in this chapter. Thanks are also extended to my eldest daughter, Miss Katriya Chankow, and my wife, Mrs. Julie Chankow, for their times spent in correcting the English translation.

[1] J.P. Barton. "Neutron Radiography – An Overview", *Practical Applications of Neutron* 

[2] Commission of the European Communities. *Neutron Radiography Handbook*. Edited by P. von der Hardt and H. Röttger, D. Reidel Publishing Company, Dordrecht, 1981. [3] D.A. Garrett and H. Berger. "The Technological development of Neutron Radiography",

[4] J.R. Lamarsh. *Introduction to Nuclear Engineering.* 2nd Ed., Addison-Wesley, New York, 1983. [5] A.A. Harms. "Physical Processes and Mathematical Methods in Neutron Radiography",

[6] M.R. Hawkesworth. "Neutron Radiography : Equipment and Methods", *Atomic Energy* 

[7] H. Berger. "Detection System for Neutron Radiography", *Practical Applications of Neutron* 

[8] N. Chankow. "A Simple Method for Viewing Track-Etch Neutron Radiographic Images

[9] Y. Suzuki. et al. "Development of Imaging Converter", *Proceedings of the 3rd World* 

[10] S. Jaiyen. , "Development of A Prototype for Low-Flux Thermal Neutron Radiography

[11] S. Wonglee. "Neutron radiography using Neutron Imaging Plate", Master Thesis, Department of Nuclear Technology, Chulalongkorn University, 2007. [12] N. Chankow, S. Punnachaiya and S. Wonglee. "Neutron radiography using Neutron Imaging Plate", *Applied Radiation and Radioisotopes*. Vol.68 (4), 2010, p. 662-665. [13] R. Funklin. "Application of Neutron radiography using Neutron Imaging Plate for

[14] P. Suksawang. "A Study of Neutron radiography", Master Thesis, Department of

[15] P. Orachorn. "Cf-252 Based Neutron radiography using Neutron Imaging Plate", Master Thesis, Department of Nuclear Technology, Chulalongkorn University, 2009. [16] W. Ratanathongchai. "Neutron radiography using BE-10 Neutron Converter Screen", Master Thesis, Department of Nuclear Technology, Chulalongkorn University, 1997.

*System Design and Characterization*, Yokosuka, Nov. 12-18, 1995.

*Radiography and Gauging*. ASTM STP 586, American Society of Testing and

Using a Scanner". *Proceedings of the 2nd International Meeting on Neutron Radiography* 

System Using Cf-252", Master Thesis, Department of Nuclear Technology,

Inspection of Ancient Objects", Master Thesis, Department of Nuclear Technology,

*Radiography and Gauging*. ASTM STP 586, American Society of Testing and

radiography by changing the neutron detector to x-ray/gamma-ray detector.

*Atomic Energy Review.* Vol. 15(2), 1977, p.123 - 142.

*Atomic Energy Review.* Vol. 15(2), 1977, p.143 - 168.

*Conference on Neutron Radiography*, Osaka, 1989.

Nuclear Technology, Chulalongkorn University, 1981.

*Review.* Vol. 15(2), 1977, p.169 - 220.

Chulalongkorn University, 2002.

Chulalongkorn University, 2009.

Materials, 1976, p. 35 - 57.

**9. Acknowledgements** 

Materials, 1976, p. 5 - 19.

**10. References** 

X-ray inspection machines have been widely used in modern industry to explore the interior of products, and to control product quality. With the advancement of automatic product inspection, we need lots of flaw radiographs to validate the system's sensitivity and to help tune the automatic inspection parameters. Flaw simulation in product radiographs has been receiving an increasing attention for over two decades.

Before implementing the program to inspect the work pieces, a large number of sample images are needed to tune the algorithm, examine its performance, and ensure its accuracy. Product radiographs with defects from the production line are the best, however, they are often not available in sufficient quantities or variety. Simulation of casting defects is an alternative approach to deal with this problem.

Recently, the CAD model method, the Monte Carlo method and the generative image method have become the three main approaches for flaw simulation.


In this chapter, we will discuss flaw simulation in product radiographs. The chapter is organized as follows. Section 2 introduces the CAD models for simulation, the three main parts of CAD models will be discussed including the X-ray source, the geometric and material properties of the objects, and the imaging process. Section 3 presents the applications of the Monte Carlo method for X-ray image simulation, a brief introduction of the Monte Carlo method and how to combine it in the simulation application are discussed. Section 4 concludes with the generative image model for flaw simulation in radiographs, the generative models and simulation results are outlined, the authors themselves have produced significant results in this field. Section 5 concludes and offers suggestions for further research. Finally, a reference list is provided for further reading.

Flaw Simulation in Product Radiographs 103

where ��(�) is the incident radiation intensity with energy *E*, ∆Ω is the solid angle that corresponds to the pixel observed from the source point, ��(�) represents the attenuation of material *i* at energy *E*, and �� is the total path length through material *i*. Fig.2 is an example

of a work-piece radiograph simulated from a CAD model and attenuation data.

 Fig. 2. A three-dimensional (3D) model of a workpiece and its generated radiograph

following:

simulated image at right

**2.2 CAD models for flaw only** 

Some flaws, such as cavities, can be simulated as nil X-ray absorption and others, such as incrusted material, with a different attenuation coefficient ��. We rewrite the equation (1) as

Where *d* is the thickness of the flaw. If the flaw is a cavity with zero absorption, �� = 0 (Mackenzie & Totten, 2006). Fig. 3 shows the small cavities in a workpiece on the left and on the right the simulated X-ray image compared with its real radiograph in the middle.

Fig. 3. The 3D image of a work-piece at left volume and its radiograph in the middle and the

In this technique, the entire object, including its defects, will be built up by independent CAD software. It offers excellent flexibility for setting objects and flaws, but it is not convenient and user friendly. The object itself may be complicated. It is time consuming to build up such a complicated model, moreover, in which every point should be calculated according to the attenuation law to form a simulated radiograph. What we need is to show flaws where they may appear on a real product. It is possibly easier to build up the flaw

There is a serious disadvantage in the first approach. Building up an entire CAD model of the object and computing each pixel of the simulated image make the enormous

model only and superimpose the simulated flaws onto a real X-ray radiograph.

�=�� ������(���)� ���(����) = �(�)�����(����)� (3)

### **2. CAD Models for simulation**

The CAD model simulates the entire X-ray imaging process. There are three main components of an X-ray penetration model, the X-ray generator, the interaction between the X-ray and the object and the imaging process (Tillack et al., 2000). In CAD simulation, the Xray source, the geometric and material properties of objects as well as the imaging process are simulated independently. For product flaw simulation, the CAD model can be used in the two approaches, which are for a whole product with defects or flaws embedded, or for the flaws only but using post-processing for its applications.

### **2.1 CAD Models for radiographs**

The X-ray beam comes from the X-ray source, penetrates the object, attenuates and finally projects into the image detector, see Fig. 1. So each pixel (,) *u v* in the simulated image can be projected back though the modelled object to the X-ray beam source. Since it is very difficult to make the X-ray source from the x-ray tube into a single point light source, this can be seen from Fig. 1. The "source", which refers to the area of the emitter aperture should be very small, to minimise the blurring of the edges of the work piece in a radiograph or on the film, the enlarged circle in Fig. 1.

Fig. 1. The X-ray imaging system with the problems of the source and object edges in the radiograph

The X-ray attenuation law is the basis of the simulation process (Haken &Wolf, 1996):

$$
\varphi = \varphi\_0 \exp(-\mu \mathbf{x}) \tag{1}
$$

where���� is the incident radiation intensity, � is the transmitted intensity, *x* is the thickness of the object, and � is the energy attenuation associated with the material. The gray value of the simulated image can be computed as follows:

$$I = A\varphi\_0(E)\Delta\Omega exp\left(-\sum\_{l} \mu\_l(E)\mathbf{x}\_l\right) + B\tag{2}$$

The CAD model simulates the entire X-ray imaging process. There are three main components of an X-ray penetration model, the X-ray generator, the interaction between the X-ray and the object and the imaging process (Tillack et al., 2000). In CAD simulation, the Xray source, the geometric and material properties of objects as well as the imaging process are simulated independently. For product flaw simulation, the CAD model can be used in the two approaches, which are for a whole product with defects or flaws embedded, or for

The X-ray beam comes from the X-ray source, penetrates the object, attenuates and finally projects into the image detector, see Fig. 1. So each pixel (,) *u v* in the simulated image can be projected back though the modelled object to the X-ray beam source. Since it is very difficult to make the X-ray source from the x-ray tube into a single point light source, this can be seen from Fig. 1. The "source", which refers to the area of the emitter aperture should be very small, to minimise the blurring of the edges of the work piece in a radiograph or on

Fig. 1. The X-ray imaging system with the problems of the source and object edges in the

The X-ray attenuation law is the basis of the simulation process (Haken &Wolf, 1996):

� � ���(�)����� ��� ��(�)��

where���� is the incident radiation intensity, � is the transmitted intensity, *x* is the thickness of the object, and � is the energy attenuation associated with the material. The gray value of

�

��������(���) (1)

��� (2)

**2. CAD Models for simulation** 

**2.1 CAD Models for radiographs** 

the film, the enlarged circle in Fig. 1.

the simulated image can be computed as follows:

radiograph

the flaws only but using post-processing for its applications.

where ��(�) is the incident radiation intensity with energy *E*, ∆Ω is the solid angle that corresponds to the pixel observed from the source point, ��(�) represents the attenuation of material *i* at energy *E*, and �� is the total path length through material *i*. Fig.2 is an example of a work-piece radiograph simulated from a CAD model and attenuation data.

Fig. 2. A three-dimensional (3D) model of a workpiece and its generated radiograph

Some flaws, such as cavities, can be simulated as nil X-ray absorption and others, such as incrusted material, with a different attenuation coefficient ��. We rewrite the equation (1) as following:

$$\varphi = \varphi\_0 \exp\{-\mu(\mathbf{x} - d)\} \exp(-\mu\_d d) = \varphi(\mathbf{x}) \exp\{d(\mu - \mu\_d)\} \tag{3}$$

Where *d* is the thickness of the flaw. If the flaw is a cavity with zero absorption, �� = 0 (Mackenzie & Totten, 2006). Fig. 3 shows the small cavities in a workpiece on the left and on the right the simulated X-ray image compared with its real radiograph in the middle.

Fig. 3. The 3D image of a work-piece at left volume and its radiograph in the middle and the simulated image at right

In this technique, the entire object, including its defects, will be built up by independent CAD software. It offers excellent flexibility for setting objects and flaws, but it is not convenient and user friendly. The object itself may be complicated. It is time consuming to build up such a complicated model, moreover, in which every point should be calculated according to the attenuation law to form a simulated radiograph. What we need is to show flaws where they may appear on a real product. It is possibly easier to build up the flaw model only and superimpose the simulated flaws onto a real X-ray radiograph.

### **2.2 CAD models for flaw only**

There is a serious disadvantage in the first approach. Building up an entire CAD model of the object and computing each pixel of the simulated image make the enormous

Flaw Simulation in Product Radiographs 105

The CAD model and the X-ray source use virtual 3D world coordinates, but the image uses 2D digital image coordinates. We need to transform between these two systems. 3D

We assume that the digital image has the horizontal and vertical scale factors �� and ��. The focus distance is *f*. To maintain the projected system, the projected plane must be placed within the focus distance *f*. If the digital image has size (*xmax, ymax*) pixels, the projected plane must have the physical size of (����⁄ ) ��� ����⁄�� millimetres. It means that the projected plane samples every � �⁄ � millimetres horizontally and � �⁄ � millimetres vertically during the simulation process. A pixel *m=(x, y)* in the simulated image can be converted into

> ���� �� ���

1/Kv

1 *KU*

To simulate the flaw there are 4 steps needed. First, capture a real X-ray image, and take the parameters *f, Ku* and *Kv,* (*xmax, ymax*) ; Second, build a 3D flaw model as a 3D mesh; Third, position the 3D flaw in the virtual coordinate system and simulate the X-ray capture process, obtaining a depth map matrix W(*x,y*) which stores the length travelled within the component of each ray that penetrated the 3D flaw. Finally, compute the new gray value with the depth matrix using equation (6). A single ray is emitted from every pixel of the 2D image to the X-ray source. The distance travelled by the ray inside the flaw will be

First, each intersection alternates the state of the ray from outside to inside. The final depth is the sum of all internal traces and the attenuation calculation of the X ray will be difficult

Second, the computation is enormous. Every pixel of the simulated image needs to emit a ray to penetrate the 3D model to the source. For simplification, we assume that the X-ray

calculated and stored in the depth matrix (Hahn & Mery, 2003).

**2.4 Discussion of CAD model simulation** 

������� ��

in the 3D coordinate system while (��� ��) is the origin of the projected plane.

� � [� � �]� (10)

(11)

**2.3 Coordinate system** 

coordinates can be denoted as:

Fig. 5. The coordinate system.

for irregular product shape.

computation. The second approach can be regarded as an improvement of the first one. In this technique, a 3D modelled flaw is projected and superimposed onto a real X-ray image.

The gray value displayed from the captured CCD image can be expressed as a linear function of the transmitted radiation:

$$I(\mathbf{x}) = A\varphi(\mathbf{x}) + B \tag{4}$$

where x is the thickness of the object. If there is a cavity with thickness d, according to equation (3), the equation will be changed into:

$$\mathbf{I}\{\mathbf{x}\cdot\mathbf{d}\} = \mathbf{A}\varphi(\mathbf{x})\exp(\mu\mathbf{d}) + \mathbf{B} \tag{5}$$

According to equation (4), ��(�) can be substituted by �(�) − �:

$$I(\mathbf{x} - d) = (I(\mathbf{x}) - B)\exp(\mu d) + B \tag{6}$$

In an X-ray image, the brightest point *Imax* is obtained when the thickness is zero and the darkest point *Imin* is obtained when the thickness is a maximum.

$$I\_{\max} = A\varphi\_0 + B \tag{7}$$

$$I\_{min} = A\varphi\_0 \exp(-\mu x\_{max}) + B \tag{8}$$

With equation (6) and (7), *B* can be estimated as following:

$$B = I\_{max} - \frac{I\_{max} - I\_{m\text{th}}}{1 - \exp\left(-\mu x\_{\text{max}}\right)}\tag{9}$$

In this technique, a 3D flaw model, the material absorption coefficient �, and a real X-ray image are needed. Then, parameter *B* is estimated according to equation (9). The 3D flaw model with thickness d is projected and superimposed onto the real X-ray image using equation (6). The new gray value of a pixel, including the projected 3D flaw, comes from equation (6). All we need are the absorption coefficient and the flaw thickness (Mery, 2001). The original gray value provides us part of the information needed. The work required in this approach is much less than in the first approach. But in this approach, we don't consider the solid angle �� of the X-ray beam that is projected onto the pixel, which generates an error.

Fig. 4. Very simple simulated casting defects compared with the real ones

### **2.3 Coordinate system**

104 Nondestructive Testing Methods and New Applications

computation. The second approach can be regarded as an improvement of the first one. In this technique, a 3D modelled flaw is projected and superimposed onto a real X-ray image. The gray value displayed from the captured CCD image can be expressed as a linear

where x is the thickness of the object. If there is a cavity with thickness d, according to

In an X-ray image, the brightest point *Imax* is obtained when the thickness is zero and the

�=���� <sup>−</sup> ���������

In this technique, a 3D flaw model, the material absorption coefficient �, and a real X-ray image are needed. Then, parameter *B* is estimated according to equation (9). The 3D flaw model with thickness d is projected and superimposed onto the real X-ray image using equation (6). The new gray value of a pixel, including the projected 3D flaw, comes from equation (6). All we need are the absorption coefficient and the flaw thickness (Mery, 2001). The original gray value provides us part of the information needed. The work required in this approach is much less than in the first approach. But in this approach, we don't consider the solid angle �� of the X-ray beam that is projected onto the pixel, which generates an error.

Fig. 4. Very simple simulated casting defects compared with the real ones

�����(������)

�(�) = ��(�) + � (4)

��x�d� = ��(x)exp(μd) + B (5)

�(�−�) = (�(�) − �)exp(��) + �� (6)

���� = ���exp(−�����) + � (8)

���� = ��� + � (7)

(9)

function of the transmitted radiation:

equation (3), the equation will be changed into:

According to equation (4), ��(�) can be substituted by �(�) − �:

darkest point *Imin* is obtained when the thickness is a maximum.

With equation (6) and (7), *B* can be estimated as following:

The CAD model and the X-ray source use virtual 3D world coordinates, but the image uses 2D digital image coordinates. We need to transform between these two systems. 3D coordinates can be denoted as:

$$M = [X \ Y \ Z]^T \tag{10}$$

We assume that the digital image has the horizontal and vertical scale factors �� and ��. The focus distance is *f*. To maintain the projected system, the projected plane must be placed within the focus distance *f*. If the digital image has size (*xmax, ymax*) pixels, the projected plane must have the physical size of (����⁄ ) ��� ����⁄�� millimetres. It means that the projected plane samples every � �⁄ � millimetres horizontally and � �⁄ � millimetres vertically during the simulation process. A pixel *m=(x, y)* in the simulated image can be converted into

$$M = \begin{bmatrix} \frac{U\_0 + \chi}{K\_u} \frac{V\_0 - \chi}{K\_v} f \end{bmatrix}^T \tag{11}$$

in the 3D coordinate system while (��� ��) is the origin of the projected plane.

Fig. 5. The coordinate system.

To simulate the flaw there are 4 steps needed. First, capture a real X-ray image, and take the parameters *f, Ku* and *Kv,* (*xmax, ymax*) ; Second, build a 3D flaw model as a 3D mesh; Third, position the 3D flaw in the virtual coordinate system and simulate the X-ray capture process, obtaining a depth map matrix W(*x,y*) which stores the length travelled within the component of each ray that penetrated the 3D flaw. Finally, compute the new gray value with the depth matrix using equation (6). A single ray is emitted from every pixel of the 2D image to the X-ray source. The distance travelled by the ray inside the flaw will be calculated and stored in the depth matrix (Hahn & Mery, 2003).

### **2.4 Discussion of CAD model simulation**

First, each intersection alternates the state of the ray from outside to inside. The final depth is the sum of all internal traces and the attenuation calculation of the X ray will be difficult for irregular product shape.

Second, the computation is enormous. Every pixel of the simulated image needs to emit a ray to penetrate the 3D model to the source. For simplification, we assume that the X-ray

Flaw Simulation in Product Radiographs 107

Monte Carlo methods vary in different situations, but tend to follow these particular and

For example, consider a circle inscribed in a unit square. Given that the circle and the square have a ratio of areas that is π/4, the value of π can be approximated using a Monte Carlo

2. Uniformly scatter some objects of uniform size (grains of rice or sand) over the square.

4. The ratio of the two counts is an estimate of the ratio of the two areas, which is π/4.

In this procedure the domain of inputs is the square that circumscribes our circle. We generate random inputs by scattering grains over the square then perform a computation on each input (test whether it falls within the circle). Finally, we aggregate the results to obtain

To get an accurate approximation for π this procedure should have two other common properties of Monte Carlo methods. First, the inputs should truly be random. If grains are purposefully dropped into only the centre of the circle, they will not be uniformly distributed, and so our approximation will be poor. Second, there should be a large number of inputs. The approximation will generally be poor if only a few grains are randomly dropped into the whole square. On average, the approximation improves as more grains are

Monte Carlo methods are especially useful for simulating phenomena with significant uncertainty in inputs and systems with a large number of coupled degrees of freedom. Areas of application include: physical sciences, engineering, computational biology, applied

Computer simulation had developed rapidly just after the invention of the computer and the first large-scale deployment is to model the process of nuclear detonation. In this

A computer simulation is a computer program that attempts to simulate an abstract model of a particular system. Computer simulations have become a useful part of mathematical

statistics, games, design and visuals, finance and business, telecommunications, etc.

3. Count the number of objects inside the circle and the total number of objects.

2. Generate inputs randomly from a probability distribution over the domain.

1. Draw a square on the ground, and then inscribe a circle within it.

**3.1.2 Steps** 

simple steps:

dropped.

**3.1.3 Applications** 

1. Define a domain of possible inputs.

4. Aggregate the results.

method (Kalos &Whitlock, 2008):

Multiply the result by 4 to estimate π.

our final result, the approximation of π.

**3.2 Monte Carlo and computer simulation** 

**3.2.1 Monte Carlo and computer simulation** 

simulation, the scientists used a Monte Carlo algorithm.

3. Perform a deterministic computation on the inputs.

comes out from a point source. But actually, the X-ray source is not an ideal point source and it has a scatter effect. Another cause that extends the computation is the shape of the projected plane. The projected plane is by definition a plane with the central pixel closer to the X-ray source than the corner pixels. The intensity of the X-rays is stronger in the middle. We know a perfect detector would be a spherical one which is far more complicated in coordinate computation.

Third, the CAD model is not user friendly. A three-dimensional CAD model is needed as seen from Fig.2, but building up such a CAD model is a time consuming job. Although the second approach doesn't need an entire object model, the 3D flaw model is needed. However there are no prepared parameters for flaws normally. Considering the stochastic shape of the most defects, generating 3D CAD flaw model, which have to be created before all other calculation and projection, is a key technique, because using a fixed CAD model lacks randomization of flaw models.

Finally, there is a lack of description language and criteria for man-made 3D flaws. It's hard to tell whether man-made flaws are like or unlike real flaws.

### **3. Monte Carlo methods and their application in X-ray image simulation**

### **3.1 Monte Carlo methods**

A brief introduction of Monte Carlo methods is presented to better understand the concept and the four steps that Monte Carlo methods usually follow. An example of estimating π is summarised and the applications are discussed.

### **3.1.1 Introduction**

The Monte Carlo method was developed in the 1940s by John von Neumann, Stanislaw Ulam and Nicholas Metropolis, while they were working on nuclear weapon projects (Manhattan Project) in the Los Alamos National Laboratory. It was named in homage to the Monte Carlo Casino, a famous casino, where Ulam's uncle would often gamble away his money (Metropolis, 1987).

Monte Carlo methods are a class of computational algorithms that rely on repeated random sampling to compute their results. Monte Carlo methods are often used in simulating physical and mathematical systems. These methods are most suited to calculation by a computer and tend to be used when it is infeasible to compute an exact result with a deterministic algorithm.

Monte Carlo methods are especially useful for simulating systems with many coupled degrees of freedom, such as fluids, disordered materials, strongly coupled solids, and cellular structures. They are used to model phenomena with significant uncertainty in inputs, such as the calculation of risk in business. They are widely used in mathematics, for example to evaluate multidimensional definite integrals with complicated boundary conditions. When Monte Carlo simulations have been applied in space exploration and oil exploration, their predictions of failures, cost overruns and schedule overruns are routinely better than human intuition or alternative "soft" methods.

### **3.1.2 Steps**

106 Nondestructive Testing Methods and New Applications

comes out from a point source. But actually, the X-ray source is not an ideal point source and it has a scatter effect. Another cause that extends the computation is the shape of the projected plane. The projected plane is by definition a plane with the central pixel closer to the X-ray source than the corner pixels. The intensity of the X-rays is stronger in the middle. We know a perfect detector would be a spherical one which is far more complicated in

Third, the CAD model is not user friendly. A three-dimensional CAD model is needed as seen from Fig.2, but building up such a CAD model is a time consuming job. Although the second approach doesn't need an entire object model, the 3D flaw model is needed. However there are no prepared parameters for flaws normally. Considering the stochastic shape of the most defects, generating 3D CAD flaw model, which have to be created before all other calculation and projection, is a key technique, because using a fixed CAD model

Finally, there is a lack of description language and criteria for man-made 3D flaws. It's hard

A brief introduction of Monte Carlo methods is presented to better understand the concept and the four steps that Monte Carlo methods usually follow. An example of estimating π is 

The Monte Carlo method was developed in the 1940s by John von Neumann, Stanislaw Ulam and Nicholas Metropolis, while they were working on nuclear weapon projects (Manhattan Project) in the Los Alamos National Laboratory. It was named in homage to the Monte Carlo Casino, a famous casino, where Ulam's uncle would often gamble away his

Monte Carlo methods are a class of computational algorithms that rely on repeated random sampling to compute their results. Monte Carlo methods are often used in simulating physical and mathematical systems. These methods are most suited to calculation by a computer and tend to be used when it is infeasible to compute an exact result with a

Monte Carlo methods are especially useful for simulating systems with many coupled degrees of freedom, such as fluids, disordered materials, strongly coupled solids, and cellular structures. They are used to model phenomena with significant uncertainty in inputs, such as the calculation of risk in business. They are widely used in mathematics, for example to evaluate multidimensional definite integrals with complicated boundary conditions. When Monte Carlo simulations have been applied in space exploration and oil exploration, their predictions of failures, cost overruns and schedule overruns are routinely

**3. Monte Carlo methods and their application in X-ray image simulation** 

coordinate computation.

lacks randomization of flaw models.

summarised and the applications are discussed.

**3.1 Monte Carlo methods** 

**3.1.1 Introduction** 

money (Metropolis, 1987).

deterministic algorithm.

to tell whether man-made flaws are like or unlike real flaws.

better than human intuition or alternative "soft" methods.

Monte Carlo methods vary in different situations, but tend to follow these particular and simple steps:


For example, consider a circle inscribed in a unit square. Given that the circle and the square have a ratio of areas that is π/4, the value of π can be approximated using a Monte Carlo method (Kalos &Whitlock, 2008):


In this procedure the domain of inputs is the square that circumscribes our circle. We generate random inputs by scattering grains over the square then perform a computation on each input (test whether it falls within the circle). Finally, we aggregate the results to obtain our final result, the approximation of π.

To get an accurate approximation for π this procedure should have two other common properties of Monte Carlo methods. First, the inputs should truly be random. If grains are purposefully dropped into only the centre of the circle, they will not be uniformly distributed, and so our approximation will be poor. Second, there should be a large number of inputs. The approximation will generally be poor if only a few grains are randomly dropped into the whole square. On average, the approximation improves as more grains are dropped.

### **3.1.3 Applications**

Monte Carlo methods are especially useful for simulating phenomena with significant uncertainty in inputs and systems with a large number of coupled degrees of freedom. Areas of application include: physical sciences, engineering, computational biology, applied statistics, games, design and visuals, finance and business, telecommunications, etc.

### **3.2 Monte Carlo and computer simulation**

Computer simulation had developed rapidly just after the invention of the computer and the first large-scale deployment is to model the process of nuclear detonation. In this simulation, the scientists used a Monte Carlo algorithm.

### **3.2.1 Monte Carlo and computer simulation**

A computer simulation is a computer program that attempts to simulate an abstract model of a particular system. Computer simulations have become a useful part of mathematical

Flaw Simulation in Product Radiographs 109

detector. The images are produced by local reduction in the intensity of the primary X-rays produced by the X-ray source reaching the detector through the internal structure of an object in their path. These local intensity reductions correspond to the distribution of absorption (attenuation) in the object under study. The special amount of attenuation by the object depends, in turn, on its thickness, its chemical composition, and the X-ray energy. Besides the source and detector, other auxiliary devices exist in a real imaging system. The

U. Bottigli et al. developed a voxel-based Monte Carlo simulation model of X-ray imaging. They try to get the X-ray images from this simulation model directly. Two main steps can be

The energy spectrum, polarization and profile of the incident beam can be defined so that Xray imaging systems can be modelled. Photoelectric absorption, fluorescent emission, elastic and inelastic scattering are included in the model. The detailed model and the complicated

The Monte Carlo method is employed in the course of simulation. The core of the simulation is a fast routine for the calculation of the path lengths of the photon trajectory intersections

In this experiment, only the absorption is considered, i.e. the photons from scattering or fluorescence emission are discarded. This type of simulations is useful for testing the correctness and the speed of the procedure for numerical integration of the absorption along an arbitrary path inside a grid. The CPU time for the simulation of one projection image was

mathematical descriptions can be found in the literature (Bottigli et al., 2004).

with the grid voxels. The selected simulation result can be seen in Fig. 7 below.

about 3 seconds using a PC based on a PENTIUM IV 1800MHz processor.

schematic diagram is illustrated in Fig. 6.

Fig. 6. The schematic depiction of an X-ray imaging system.

**3.3.2 Direct imaging simulation model** 

summarised as below:

1. Modelling

2. Simulation

modelling of many natural systems in physics (computational physics), astrophysics, chemistry and biology, human systems in economics, psychology, social science, and engineering. Simulations can be used to explore and gain new insights into new technology, and to estimate the performance of systems too complex for analytical solutions.

Computer simulation developed hand-in-hand with the rapid growth of the computer, following its first large-scale deployment during the Manhattan Project in World War II to model the process of nuclear detonation. It was a simulation of 12 hard spheres using a Monte Carlo algorithm. Computer simulation is often used as an adjunct to, or substitute for, modelling systems for which simple closed form analytic solutions are not possible. There are many types of computer simulations; the common feature they all share is the attempt to generate a sample of representative scenarios for a model in which a complete enumeration of all possible states of the model would be prohibitive or impossible.

### **3.2.2 Monte Carlo simulation software**

Many software systems and computer platforms can perform Monte Carlo simulation tasks, Matlab and C++ are the most well-known. Some specially-designed software systems for Monte Carlo simulation are very popular with researchers. Two of them will be introduced below.

1. EGSnrc

The EGSnrc system (EGSnrc, URL) is a package for the Monte Carlo simulation of coupled electron-photon transport. Its current energy range of applicability is considered to be 1 keV to 10 GeV. The EGS acronym stands for Electron Gamma Shower, and EGSnrc is an extended and improved version of the EGS4 package originally developed at Stanford Linear Accelerator Center (SLAC). In particular, it incorporates significant improvements in the implementation of the condensed history technique for the simulation of charged particle transport and better low energy cross sections.

2. GoldSim

GoldSim is the premier Monte Carlo simulation software solution for dynamically modelling complex systems in business, engineering and science (GoldSim, URL). GoldSim supports decision and risk analysis by simulating future performance while quantitatively representing the uncertainty and risks inherent in all complex systems. Organizations worldwide use GoldSim simulation software to evaluate and compare alternative designs, plans and policies in order to minimize risks and make better decisions in an uncertain world.

### **3.3 X-ray images simulation by Monte Carlo methods**

As the X-ray imaging system must be modelled by Monte Carlo simulation, the physical principles of an X-ray imaging system will be introduced firstly. Two publications with the corresponding models and the simulation results are discussed.

### **3.3.1 Principles of the X-ray imaging system**

Typical X-ray imaging systems consist of a point X-ray source and an image recording device (detector). The object to be imaged is placed between the X-ray source and the

modelling of many natural systems in physics (computational physics), astrophysics, chemistry and biology, human systems in economics, psychology, social science, and engineering. Simulations can be used to explore and gain new insights into new technology,

Computer simulation developed hand-in-hand with the rapid growth of the computer, following its first large-scale deployment during the Manhattan Project in World War II to model the process of nuclear detonation. It was a simulation of 12 hard spheres using a Monte Carlo algorithm. Computer simulation is often used as an adjunct to, or substitute for, modelling systems for which simple closed form analytic solutions are not possible. There are many types of computer simulations; the common feature they all share is the attempt to generate a sample of representative scenarios for a model in which a complete

Many software systems and computer platforms can perform Monte Carlo simulation tasks, Matlab and C++ are the most well-known. Some specially-designed software systems for Monte Carlo simulation are very popular with researchers. Two of them will be introduced

The EGSnrc system (EGSnrc, URL) is a package for the Monte Carlo simulation of coupled electron-photon transport. Its current energy range of applicability is considered to be 1 keV to 10 GeV. The EGS acronym stands for Electron Gamma Shower, and EGSnrc is an extended and improved version of the EGS4 package originally developed at Stanford Linear Accelerator Center (SLAC). In particular, it incorporates significant improvements in the implementation of the condensed history technique for the simulation of charged

GoldSim is the premier Monte Carlo simulation software solution for dynamically modelling complex systems in business, engineering and science (GoldSim, URL). GoldSim supports decision and risk analysis by simulating future performance while quantitatively representing the uncertainty and risks inherent in all complex systems. Organizations worldwide use GoldSim simulation software to evaluate and compare alternative designs, plans and policies in order to minimize risks and make better decisions in an uncertain

As the X-ray imaging system must be modelled by Monte Carlo simulation, the physical principles of an X-ray imaging system will be introduced firstly. Two publications with the

Typical X-ray imaging systems consist of a point X-ray source and an image recording device (detector). The object to be imaged is placed between the X-ray source and the

and to estimate the performance of systems too complex for analytical solutions.

enumeration of all possible states of the model would be prohibitive or impossible.

**3.2.2 Monte Carlo simulation software** 

particle transport and better low energy cross sections.

**3.3 X-ray images simulation by Monte Carlo methods** 

**3.3.1 Principles of the X-ray imaging system** 

corresponding models and the simulation results are discussed.

below.

1. EGSnrc

2. GoldSim

world.

detector. The images are produced by local reduction in the intensity of the primary X-rays produced by the X-ray source reaching the detector through the internal structure of an object in their path. These local intensity reductions correspond to the distribution of absorption (attenuation) in the object under study. The special amount of attenuation by the object depends, in turn, on its thickness, its chemical composition, and the X-ray energy. Besides the source and detector, other auxiliary devices exist in a real imaging system. The schematic diagram is illustrated in Fig. 6.

Fig. 6. The schematic depiction of an X-ray imaging system.

### **3.3.2 Direct imaging simulation model**

U. Bottigli et al. developed a voxel-based Monte Carlo simulation model of X-ray imaging. They try to get the X-ray images from this simulation model directly. Two main steps can be summarised as below:

### 1. Modelling

The energy spectrum, polarization and profile of the incident beam can be defined so that Xray imaging systems can be modelled. Photoelectric absorption, fluorescent emission, elastic and inelastic scattering are included in the model. The detailed model and the complicated mathematical descriptions can be found in the literature (Bottigli et al., 2004).

### 2. Simulation

The Monte Carlo method is employed in the course of simulation. The core of the simulation is a fast routine for the calculation of the path lengths of the photon trajectory intersections with the grid voxels. The selected simulation result can be seen in Fig. 7 below.

In this experiment, only the absorption is considered, i.e. the photons from scattering or fluorescence emission are discarded. This type of simulations is useful for testing the correctness and the speed of the procedure for numerical integration of the absorption along an arbitrary path inside a grid. The CPU time for the simulation of one projection image was about 3 seconds using a PC based on a PENTIUM IV 1800MHz processor.

Flaw Simulation in Product Radiographs 111

Fig. 8. The scattered image simulation. The left half is the simulated projection of a step

**4. Generative image for flaw simulation in product radiographs** 

imaging system is a very complex system including lots of factors which can affect the final image. To simulate this kind of complex system with a Monte Carlo method, to build a proper model, is difficult and important. In this research area there is no readily available model that can be followed, even a tiny difference of hardware or device position can lead a very different model, and the objects under inspection can also affect this model. Another problem is the computing cost of simulation, which may be extremely high due to the model complexity. However, the Monte Carlo method is a very powerful tool to solve complex simulation problems, and its application in X-ray imaging systems is still being explored.

Defect superimposition is another technique that attempts to simulate casting defects. It differs from the CAD approach in the process of defect creation using 2D image technology, to superimpose the simulated casting defects onto real radioscopic images (Filbert et al., 1987). It needs neither complex 3D software packages nor a model of the casting specimen under test, furthermore, it offers a radioscopic image of a real product with a range of possible defects to test, validate and measure the accuracy of different radiograph analysis

The image generation technology for flaw simulation of product radiographs is developed from the idea of the defect superimposition technique, and is based on defect analysis. The descriptions of defects or flaws defined by different standard organizations for specimens or products use a language and high level semantics which can be understood by engineers and workers in the field. Though many sample images are used as standards and are available for demonstration, they cannot include all because almost any defects in the products are distinguished greatly from others in their shapes, grey contrasts, salience of edges, size of areas, girth of counters etc. The defects are recognized from a product X-ray image normally depending on an understanding of the descriptions or definitions of the flaw but also rely on the calculation of their image parameters. We can generate flaw images according to the image semantic interpretation rather than depend heavily on the system parameters of the X-ray imaging or CAD models which provide the geometrical parameters

wedge, and the right half is the simulated scattered image.

procedures, or for tutorial and training purposes.

**4.1 Image generation technology** 

of products.

(a) Experimental image (b) Simulated image

Fig. 7. The simulation result of the voxel-based Monte Carlo simulation model. (a) is the experimental image, and (b) is the simulated image.

### **3.3.3 Scattered image simulation model**

Different from the direct imaging model, the scattered image model focuses on simulating the scattered image. The final image can be obtained by subtracting the scattered image from the real image taken during the inspection. Frank Sukowski et al. provided a simple description of this model in (Sukowski & Uhlmann, 2011).

A lot of effects affect the image quality in radioscopy systems. By optimizing the throughput of the inspection system it is of essential interest to suppress all effects reducing the image quality. One effect e.g. is the scattered X-ray radiation from inside the specimen during inspection which hits the detector and reduces the contrast and sharpness of the projection. This effect leads to reduced possibility of detection of small defects. With the Monte Carlo simulation is it possible to simulate the scattering effects in the specimen and also the distribution of the scattered radiation on the detector. If we know the intensity distribution of the scattered radiation from the specimen on the detector, it can be subtracted from the real image taken during the inspection. With this operation it is possible to get images of the specimen with nearly zero intensity of scattered radiation resulting in better contrast and higher sharpness of the image. The author believes that simulation is the only way to get a realistic and not approximated intensity distribution of scattered radiation. In Fig. 8 the simulated projection of a step wedge and the simulated intensity distribution of the scattered radiation are shown.

### **3.4 Discussion about Monte Carlo simulation method**

Monte Carlo simulation is a method for iteratively evaluating a deterministic model using sets of random numbers as inputs. This method is often used when the model is complex, nonlinear, or involves more than just a couple uncertain parameters. An X-ray based

 (a) Experimental image (b) Simulated image Fig. 7. The simulation result of the voxel-based Monte Carlo simulation model. (a) is the

Different from the direct imaging model, the scattered image model focuses on simulating the scattered image. The final image can be obtained by subtracting the scattered image from the real image taken during the inspection. Frank Sukowski et al. provided a simple

A lot of effects affect the image quality in radioscopy systems. By optimizing the throughput of the inspection system it is of essential interest to suppress all effects reducing the image quality. One effect e.g. is the scattered X-ray radiation from inside the specimen during inspection which hits the detector and reduces the contrast and sharpness of the projection. This effect leads to reduced possibility of detection of small defects. With the Monte Carlo simulation is it possible to simulate the scattering effects in the specimen and also the distribution of the scattered radiation on the detector. If we know the intensity distribution of the scattered radiation from the specimen on the detector, it can be subtracted from the real image taken during the inspection. With this operation it is possible to get images of the specimen with nearly zero intensity of scattered radiation resulting in better contrast and higher sharpness of the image. The author believes that simulation is the only way to get a realistic and not approximated intensity distribution of scattered radiation. In Fig. 8 the simulated projection of a step wedge and the simulated intensity distribution of the

Monte Carlo simulation is a method for iteratively evaluating a deterministic model using sets of random numbers as inputs. This method is often used when the model is complex, nonlinear, or involves more than just a couple uncertain parameters. An X-ray based

experimental image, and (b) is the simulated image.

description of this model in (Sukowski & Uhlmann, 2011).

**3.4 Discussion about Monte Carlo simulation method** 

**3.3.3 Scattered image simulation model** 

scattered radiation are shown.

Fig. 8. The scattered image simulation. The left half is the simulated projection of a step wedge, and the right half is the simulated scattered image.

imaging system is a very complex system including lots of factors which can affect the final image. To simulate this kind of complex system with a Monte Carlo method, to build a proper model, is difficult and important. In this research area there is no readily available model that can be followed, even a tiny difference of hardware or device position can lead a very different model, and the objects under inspection can also affect this model. Another problem is the computing cost of simulation, which may be extremely high due to the model complexity. However, the Monte Carlo method is a very powerful tool to solve complex simulation problems, and its application in X-ray imaging systems is still being explored.

### **4. Generative image for flaw simulation in product radiographs**

Defect superimposition is another technique that attempts to simulate casting defects. It differs from the CAD approach in the process of defect creation using 2D image technology, to superimpose the simulated casting defects onto real radioscopic images (Filbert et al., 1987). It needs neither complex 3D software packages nor a model of the casting specimen under test, furthermore, it offers a radioscopic image of a real product with a range of possible defects to test, validate and measure the accuracy of different radiograph analysis procedures, or for tutorial and training purposes.

### **4.1 Image generation technology**

The image generation technology for flaw simulation of product radiographs is developed from the idea of the defect superimposition technique, and is based on defect analysis. The descriptions of defects or flaws defined by different standard organizations for specimens or products use a language and high level semantics which can be understood by engineers and workers in the field. Though many sample images are used as standards and are available for demonstration, they cannot include all because almost any defects in the products are distinguished greatly from others in their shapes, grey contrasts, salience of edges, size of areas, girth of counters etc. The defects are recognized from a product X-ray image normally depending on an understanding of the descriptions or definitions of the flaw but also rely on the calculation of their image parameters. We can generate flaw images according to the image semantic interpretation rather than depend heavily on the system parameters of the X-ray imaging or CAD models which provide the geometrical parameters of products.

Flaw Simulation in Product Radiographs 113

(a) (b) (c) (d)

(e) (f) (g) Fig. 10. The sample patterns of the American Society for Testing and Materials (ASTM). (a) gas porosity or blow holes (b) shrinkage of needle cavity(c) shrinkage of round cavity (d) sponge shrinkage (e) sand inclusions or dross (f) filamentary shrinkage (g) dendritic

1. "Gas porosity or blow holes are usually smooth-walled rounded cavities of a spherical, elongated or flattened shape caused by accumulated gas or air which is trapped by the metal. The gas or air will be trapped as the molten metal begins to solidify while the sprue is not high enough to provide the necessary heat transfer needed to force the gas

2. Sand inclusions and dross are nonmetallic oxides, which appear on the radiograph as irregular, dark blotches. These come from chipped parts of the mold or core walls and/or from oxides which have not been skimmed off prior to the introduction of the

3. Shrinkage has various forms of discontinuity occurring in all cases as the molten metal shrinks as it solidifies in all parts of the final casting. Shrinkage in its various forms can be recognized by a number of characteristics on the radiographs. There are at least four types of shrinkage: (a) cavity; (b) dendritic; (c) filamentary; and (d) sponge types. Some documents designate these types only by number to avoid misunderstanding. Their

(a) Cavity shrinkage appears as areas with distinct jagged boundaries. It may be produced when metal solidifies between two original streams of melt coming from opposite directions to join a common front. Cavity shrinkage usually occurs at a time when the melt has almost reached solidification temperature and there is no source of supplementary liquid to feed

(b) Dendritic shrinkage is a distribution of very fine lines or small elongated cavities that

(c) Filamentary shrinkage usually occurs as a continuous structure of connected lines or

branches of variable length, width and density, or occasionally as a network.

shrinkage

or air out of the mold.

metal into the mold gates.

possible cavities.

characteristics are summarized in the following:

may vary in density and are usually unconnected.

The flaw generation process, as shown in Fig. 9, consists of five steps. The first step is defect image collecting. Though the definition for one kind of defect is uniform or unique, images have great variety, i.e. polymorphism in the defect formation. From a certain number of defect samples, the qualitative visual features are extracted and analysed. In the second step, which is a key step called "seed feature"or main high frequency feature creation process, the defect images are formed or grown from it. Simultaneously, the fuzzy image representations for each type of feature are expected to apply to the image generation after obtaining the qualitative features and statistical analysis, fuzzy membership is needed and is applied to these image features in the third step. The fourth step is generating low frequency features in the regions of the creative defect, to subject the defect appearances to their semantic definitions. The last step is image synthesizing or superimposing the created flaw image onto real product radiographies.

Fig. 9. Phases of flaw image generation for product radiographs

### **4.2 Defect image collecting**

As X-ray radiation is passed through the material under test, and a detector senses the radiation intensity attenuated by the material, a defect in the material modifies the expected radiation received by the sensor. The contrast in the X-ray image between a flaw and a defect-free area of the specimen is distinctive. In an X-ray image we can see that the defects, such as voids, cracks, or bubbles, show up as bright areas compared to their background, i.e. the imaging of defect-free material.

Defects are defined according to their appearances, as many different kinds are described by the natural language along with some radiograph images, as we can see in Fig.10. The images shown in Fig. 10 are chosen from the reference radiographs presented by The American Society for Testing and Materials (ASTM) E155 (Hoff, 1999). These are standard radiographs of castings produced to help the radiographer make appropriate assessments of the defects in casting components.

As discussed in detail in the NDT Resource Center (Iowa State University, 1996), the characteristics of casting defects, the discontinuities produced by gas porosity or blow holes, sand and dross inclusions, various kinds of shrinkages, are summarized in 'radiography-NDT course material' (Iowa State University, 1996) are quoted here:

The flaw generation process, as shown in Fig. 9, consists of five steps. The first step is defect image collecting. Though the definition for one kind of defect is uniform or unique, images have great variety, i.e. polymorphism in the defect formation. From a certain number of defect samples, the qualitative visual features are extracted and analysed. In the second step, which is a key step called "seed feature"or main high frequency feature creation process, the defect images are formed or grown from it. Simultaneously, the fuzzy image representations for each type of feature are expected to apply to the image generation after obtaining the qualitative features and statistical analysis, fuzzy membership is needed and is applied to these image features in the third step. The fourth step is generating low frequency features in the regions of the creative defect, to subject the defect appearances to their semantic definitions. The last step is image synthesizing or superimposing the created flaw image

> Qualitative visual features

As X-ray radiation is passed through the material under test, and a detector senses the radiation intensity attenuated by the material, a defect in the material modifies the expected radiation received by the sensor. The contrast in the X-ray image between a flaw and a defect-free area of the specimen is distinctive. In an X-ray image we can see that the defects, such as voids, cracks, or bubbles, show up as bright areas compared to their background, i.e.

Defects are defined according to their appearances, as many different kinds are described by the natural language along with some radiograph images, as we can see in Fig.10. The images shown in Fig. 10 are chosen from the reference radiographs presented by The American Society for Testing and Materials (ASTM) E155 (Hoff, 1999). These are standard radiographs of castings produced to help the radiographer make appropriate assessments of

As discussed in detail in the NDT Resource Center (Iowa State University, 1996), the characteristics of casting defects, the discontinuities produced by gas porosity or blow holes, sand and dross inclusions, various kinds of shrinkages, are summarized in 'radiography-

Image synthesizing or superimposing

Fuzzy image representations

onto real product radiographies.

Defect image collecting

**4.2 Defect image collecting** 

the imaging of defect-free material.

the defects in casting components.

High & low frequency features generation

Fig. 9. Phases of flaw image generation for product radiographs

NDT course material' (Iowa State University, 1996) are quoted here:

Fig. 10. The sample patterns of the American Society for Testing and Materials (ASTM). (a) gas porosity or blow holes (b) shrinkage of needle cavity(c) shrinkage of round cavity (d) sponge shrinkage (e) sand inclusions or dross (f) filamentary shrinkage (g) dendritic shrinkage


(a) Cavity shrinkage appears as areas with distinct jagged boundaries. It may be produced when metal solidifies between two original streams of melt coming from opposite directions to join a common front. Cavity shrinkage usually occurs at a time when the melt has almost reached solidification temperature and there is no source of supplementary liquid to feed possible cavities.

(b) Dendritic shrinkage is a distribution of very fine lines or small elongated cavities that may vary in density and are usually unconnected.

(c) Filamentary shrinkage usually occurs as a continuous structure of connected lines or branches of variable length, width and density, or occasionally as a network.

Flaw Simulation in Product Radiographs 115

Most casting defects are located on the inner part of the work pieces, as seen in Fig. 12, where the two diagrams on the left are typical of actual radiographs with defects generated from the production line, the images sizes are 540 540 pixels, and the others are the diagrams of what is seen when the porosity defects are cut from the actual images and magnified to display with image sizes of 200 200 pixels. The intensities of casting defects in the radiographs are usually lighter than the parts around them. If the work pieces have different structures and shapes, the defects with the same size often appear as different grey values on different work pieces. This is a result of the different absorption of the X-rays by the metal due to the different thicknesses. The energies required for X-ray penetration of the thicker structures are significantly higher, and the grey values of the casting defects are strongly affected by the corresponding backgrounds. This is illustrated in Fig. 12, showing casting defects in casting products. Though it is not easy to classify them into type one or type two defects, all of them are single large and discontinuous. The aim of this paper is to

The cavities, as shown in Fig. 13 (a) and (b), are both single large casting defects, however, they are considered separately as blow hole and shrinkage defects, and they differ greatly in appearance and volumetric measurement from the porosity defect shown in Fig. 13 (c).

(a) (b) (c)

By careful inspection of the visual features of about 2000 images of casting defects, we have found that stochastic shapes with closed defect contours are the most prominent features. Based on the principle of Active Qualitative Vision (Aloimonos, 1990), an initial shape needs to be designed to provide a starting point followed by the adjustment of the following image parameters during the simulation: grey level value, shape, size, orientation, shading effects, and contrast with background. The random shape template is designed as three embedded nesting stencil-plates, as illustrated in Fig. 14, in which the shapes of each template can be

**4.3.1 Counter based hierarchical template model** 

generate simulated defects similar to these real ones.

 Fig. 12. The sample defects in real casting pieces

Fig. 13. Sample defects in real casting pieces

(d) Sponge shrinkage shows itself as areas of lacy texture with diffuse outlines, generally toward the mid-thickness of heavier casting sections. Sponge shrinkage may be dendritic or filamentary. Filamentary sponge shrinkage appears more blurred as it is projected through the relatively thick coating between the discontinuities and the film surface."

The X-ray image is usually captured with a frame-grabber and stored in a matrix. The size of the image matrix corresponds to the resolution of the image. The gray value between 0 and 255 associated with the image brightness denote from the one hundred percent black to white in an image. Tuned by the voltage and current for the X-ray tube, the gray intensity of a product and its defects will vary significantly, that means the contrast between the defect and its background will change, the examples shown in Fig. 11, in which the tube current is 1.5mA but the tube voltages are varied from 110KV to 105KV and 75KV in each from left to right.

Fig. 11. The radiographs with different tube voltage for the same specimen, the tube voltage used from left to right are separately 110KV, 105KV and 75KV and all with tube current 1.5mA

From the pictures in Fig. 11 we can see that not only the contrast of the defects against their backgrounds vary in every image but the brightness of the defects also changes. Although using high voltage, the defect in the left image is the darkest compared with the defects in the other two images with relatively low voltages, and the contrast around the defect in the left image associated with its background is very low.

It is necessary to collect the sample defect radiographs and classify them into different semantic categories and if possible, get their radiographs with different voltages.

### **4.3 Visual feature analysis and nonparametric sampling**

Deduced from example-based technique for image generation, the nonparametric sampling and modelling that relies on the qualitative visual feature analysis contributes to set up nonparametric models for both main construction of defects, their texture synthesis and other low frequency information. The introduction of nonparametric sampling and defect image reconstruction leads to an intricate feature analysis problem. Here we mention two different classical nonparametric sampling and modelling approaches, one is a stochastic defect counter based on a hierarchical template model and the other is a skeletonizationbased model.

(d) Sponge shrinkage shows itself as areas of lacy texture with diffuse outlines, generally toward the mid-thickness of heavier casting sections. Sponge shrinkage may be dendritic or filamentary. Filamentary sponge shrinkage appears more blurred as it is projected through

The X-ray image is usually captured with a frame-grabber and stored in a matrix. The size of the image matrix corresponds to the resolution of the image. The gray value between 0 and 255 associated with the image brightness denote from the one hundred percent black to white in an image. Tuned by the voltage and current for the X-ray tube, the gray intensity of a product and its defects will vary significantly, that means the contrast between the defect and its background will change, the examples shown in Fig. 11, in which the tube current is 1.5mA but the tube voltages are varied from 110KV to 105KV and 75KV in each from

Fig. 11. The radiographs with different tube voltage for the same specimen, the tube voltage used from left to right are separately 110KV, 105KV and 75KV and all with tube current

From the pictures in Fig. 11 we can see that not only the contrast of the defects against their backgrounds vary in every image but the brightness of the defects also changes. Although using high voltage, the defect in the left image is the darkest compared with the defects in the other two images with relatively low voltages, and the contrast around the defect in the

It is necessary to collect the sample defect radiographs and classify them into different

Deduced from example-based technique for image generation, the nonparametric sampling and modelling that relies on the qualitative visual feature analysis contributes to set up nonparametric models for both main construction of defects, their texture synthesis and other low frequency information. The introduction of nonparametric sampling and defect image reconstruction leads to an intricate feature analysis problem. Here we mention two different classical nonparametric sampling and modelling approaches, one is a stochastic defect counter based on a hierarchical template model and the other is a skeletonization-

semantic categories and if possible, get their radiographs with different voltages.

the relatively thick coating between the discontinuities and the film surface."

left image associated with its background is very low.

**4.3 Visual feature analysis and nonparametric sampling** 

left to right.

1.5mA

based model.

### **4.3.1 Counter based hierarchical template model**

Most casting defects are located on the inner part of the work pieces, as seen in Fig. 12, where the two diagrams on the left are typical of actual radiographs with defects generated from the production line, the images sizes are 540 540 pixels, and the others are the diagrams of what is seen when the porosity defects are cut from the actual images and magnified to display with image sizes of 200 200 pixels. The intensities of casting defects in the radiographs are usually lighter than the parts around them. If the work pieces have different structures and shapes, the defects with the same size often appear as different grey values on different work pieces. This is a result of the different absorption of the X-rays by the metal due to the different thicknesses. The energies required for X-ray penetration of the thicker structures are significantly higher, and the grey values of the casting defects are strongly affected by the corresponding backgrounds. This is illustrated in Fig. 12, showing casting defects in casting products. Though it is not easy to classify them into type one or type two defects, all of them are single large and discontinuous. The aim of this paper is to generate simulated defects similar to these real ones.

Fig. 12. The sample defects in real casting pieces

The cavities, as shown in Fig. 13 (a) and (b), are both single large casting defects, however, they are considered separately as blow hole and shrinkage defects, and they differ greatly in appearance and volumetric measurement from the porosity defect shown in Fig. 13 (c).

Fig. 13. Sample defects in real casting pieces

By careful inspection of the visual features of about 2000 images of casting defects, we have found that stochastic shapes with closed defect contours are the most prominent features. Based on the principle of Active Qualitative Vision (Aloimonos, 1990), an initial shape needs to be designed to provide a starting point followed by the adjustment of the following image parameters during the simulation: grey level value, shape, size, orientation, shading effects, and contrast with background. The random shape template is designed as three embedded nesting stencil-plates, as illustrated in Fig. 14, in which the shapes of each template can be

Flaw Simulation in Product Radiographs 117

The skeleton of set A can be expressed in terms of erosions and openings as following:

�(�) = ���(�) �

���

Where B is a structuring element, and (A⨁kB) indicates k successive erosions of A K times,

The formulation states that S(A) can be obtained as the union of the skeleton subsets Sk(A). Also, it can be shown that A can be reconstructed from these subsets by using the equation

� = ⋃ (��(�)⨁��) �

Another term medial axis transform (MAT) is often used interchangeably with skeletonization but they are not quite the same. The skeleton is simply a binary image showing the simple skeleton, while MAT is a graylevel image where each point on the skeleton has an intensity which represents its distance to a boundary in the original object,

and K is the last iterative step before A erodes to an empty set. In other words,

Where ( () ) *S A kB <sup>k</sup>* denotes k successive dilations of Sk(A);that is

��(�) = (�⨁��) − (�⨁��) � � (13)

(�⨁��) = (� (�⨁�)⨁�)⨁ � )⨁� (14)

(��(�)⨁��) = ((� (��(�)⨁��)⨁�)⨁ � )⨁� (17)

� = �������(�⨁��) � �� (15)

��� (16)

(12)

Fig. 15. Set A and its skeleton denoted by dashed lines

With

shown in the Fig. 16.

given randomly but their sizes are limited so that every smaller one of three shapes fits entirely inside the larger one for the appropriate grey value adjustment. The analysis and the measurement of the profiles of the largest cavity defects, from all of our casting defect images, leads to a size for the profile of the largest stencil-plate of 78x46 pixels (1cm=31.889 pixels), which approximates to the size of the single defect profiles that appear normally in casting pieces.

From Fig. 14 and from the physics of the x-ray process it is easy to find that the middle of the cavities is normally brighter than their edges. For convenience the higher gray value is set to the middle of the entire shape; and also there is a general requirement for the template set that their areas vary, with the smaller being totally enclosed by the larger. With the proposed defect creation algorithm, the stencil-plates are not limited in shape, and changes in their formation will not significantly influence the outcome of the generated defects. Furthermore, the templates used are binary images. The white parts in the templates are the shapes used in the defect simulation. Though these white parts are not the exact final shape of the simulated defects, they approximate to the final shape having some of the features of real casting defects with smooth, continuous, and irregular contours.

Fig. 14. The sample defects in real casting pieces

We use one of shapes in Fig.14 to design the superposing operation to locate the simulated defect onto a specified region of the original X-ray image; this superposing operation can be used by all stencil-plate superposition, the details can be found in reference paper (Huang, et al., 2009).

### **4.3.2 Skeletonization based model**

The skeleton of some dendritic flaws such as filamentary shrinkage and dendritic shrinkage in castings or cracks in any materials can be the main feature or so called 'seed feature' to let simulated flaws grow from it. Skeletonization is a process for reducing foreground regions in a binary image to a skeletal remnant that largely preserves the extent and connectivity of the original region while throwing away most of the original foreground pixels(Gonzalez, 2008). It can be a key step when extracting the nonparametric features from a sample defect. To see how this works, imagine that the foreground regions in the input binary image are made of some uniform slow-burning material. Light fires simultaneously at all points along the boundary of this region and watch the fire move into the interior. At points where the fire travelling from two different boundaries meets itself, the fire will extinguish itself and the points at which this happens form the so called "quench line". This line is the skeleton. Under this definition it is clear that thinning produces a sort of skeleton.

The dash line in set A denotes its skeleton S(A), as shown in Fig. 15,the notion of a skeleton.

Fig. 15. Set A and its skeleton denoted by dashed lines

The skeleton of set A can be expressed in terms of erosions and openings as following:

$$S(A) = \bigcup\_{k=0}^{\kappa} S\_k(A) \tag{12}$$

With

116 Nondestructive Testing Methods and New Applications

given randomly but their sizes are limited so that every smaller one of three shapes fits entirely inside the larger one for the appropriate grey value adjustment. The analysis and the measurement of the profiles of the largest cavity defects, from all of our casting defect images, leads to a size for the profile of the largest stencil-plate of 78x46 pixels (1cm=31.889 pixels), which approximates to the size of the single defect profiles that appear normally in

From Fig. 14 and from the physics of the x-ray process it is easy to find that the middle of the cavities is normally brighter than their edges. For convenience the higher gray value is set to the middle of the entire shape; and also there is a general requirement for the template set that their areas vary, with the smaller being totally enclosed by the larger. With the proposed defect creation algorithm, the stencil-plates are not limited in shape, and changes in their formation will not significantly influence the outcome of the generated defects. Furthermore, the templates used are binary images. The white parts in the templates are the shapes used in the defect simulation. Though these white parts are not the exact final shape of the simulated defects, they approximate to the final shape having some of the features of real casting defects with smooth, continuous, and irregular

We use one of shapes in Fig.14 to design the superposing operation to locate the simulated defect onto a specified region of the original X-ray image; this superposing operation can be used by all stencil-plate superposition, the details can be found in reference paper (Huang,

The skeleton of some dendritic flaws such as filamentary shrinkage and dendritic shrinkage in castings or cracks in any materials can be the main feature or so called 'seed feature' to let simulated flaws grow from it. Skeletonization is a process for reducing foreground regions in a binary image to a skeletal remnant that largely preserves the extent and connectivity of the original region while throwing away most of the original foreground pixels(Gonzalez, 2008). It can be a key step when extracting the nonparametric features from a sample defect. To see how this works, imagine that the foreground regions in the input binary image are made of some uniform slow-burning material. Light fires simultaneously at all points along the boundary of this region and watch the fire move into the interior. At points where the fire travelling from two different boundaries meets itself, the fire will extinguish itself and the points at which this happens form the so called "quench line". This line is the skeleton. Under this definition it is clear that thinning

The dash line in set A denotes its skeleton S(A), as shown in Fig. 15,the notion of a skeleton.

Fig. 14. The sample defects in real casting pieces

**4.3.2 Skeletonization based model** 

produces a sort of skeleton.

casting pieces.

contours.

et al., 2009).

$$\mathcal{S}\_k(A) = \{A \oplus kB\} - \{A \oplus kB\} \circ B \tag{13}$$

Where B is a structuring element, and (A⨁kB) indicates k successive erosions of A K times,

$$(A \oplus kB) = (\cdots (A \oplus B) \oplus B) \oplus \cdots \gg B \tag{14}$$

and K is the last iterative step before A erodes to an empty set. In other words,

$$K = \max\{k | (A \oplus kB) \neq \emptyset\} \tag{15}$$

The formulation states that S(A) can be obtained as the union of the skeleton subsets Sk(A). Also, it can be shown that A can be reconstructed from these subsets by using the equation

$$A = \cup\_{k=0}^{K} \{ \mathbb{S}\_k(\mathcal{A}) \oplus kB \} \tag{16}$$

Where ( () ) *S A kB <sup>k</sup>* denotes k successive dilations of Sk(A);that is

$$\mathfrak{l}\left(\mathbb{S}\_k(A)\oplus kB\right) = \left(\left(\cdots\left(\mathbb{S}\_k(A)\oplus kB\right)\oplus B\right)\oplus \cdots\right)\oplus B\tag{17}$$

Another term medial axis transform (MAT) is often used interchangeably with skeletonization but they are not quite the same. The skeleton is simply a binary image showing the simple skeleton, while MAT is a graylevel image where each point on the skeleton has an intensity which represents its distance to a boundary in the original object, shown in the Fig. 16.

Flaw Simulation in Product Radiographs 119

(a) (b) (c) (d)

Fig. 17. Skeletonization of a real dendritic shrinking for flaw simulation: (a) a radiograph of a workpiece, (b) zoomed dendritic shrinking, (c), (d) the skeleton images based on binarized

Apart from sample defects, skeletons can also be created randomly such as for cracks or

Since the qualitative visual features are fuzzy, so a fuzzy representation of them is appropriate. Set the image grayscale range *[1, Ng]*, *μ* is defined as the membership function of the gray value in a specified image area, it makes the gray value mapped to [0, 1]. On a view, like a factor image with piexls point to a single point of ambiguity in the original image, its corresponding values indicate the membership degree that the image point belongs to the object region. All the pixels in the image form a single dot fuzzy matrix

The following eight fuzzy geometric features impact on the accuracy and speed of operation with more good compromise effects. The image size is *M × N*, the *μ (I)* is denoted by *μ*, the membership definitions of these fuzzy geometric features and the classification functions for

�(�) = ∑∑ |�(�� �) � �(�� � + �)| + ∑∑ |�(�� �) � �(� + �� �)| ���

Circumference pixel horizontal distance and vertical distance weighted and is used to

�(�) = ∑ � (18)

���

��� (19)

� ���

Fig. 18. Randomly created skeleton for crack generation and simulation

filamentary shrinkages, and so on. Please refer Fig. 18.

**4.4 Visual feature analysis and fuzzy representation** 

Area is the weighted sum of the pixels in an object image range.

��� ���

�

measure the undulations of the image area.

images of different thresholds

expressed with *μ (I)*.

2. Circumference:

1. Area:

the object structures are as follow:

Fig. 16. Skeletonization of a binary image, from left to right: the original binary image, normal skeletons, the skeleton image formed by the medial axis transformation

The medial axis of an object is the set of all points having more than one closest point on the object's boundary. In mathematics the closure of the medial axis is known as the cut locus. In 2D, the medial axis of a plane curve S is the locus of the centres of circles that are tangent to curve S in two or more points, where all such circles are contained in S. (It follows that the medial axis itself is contained in S.) The medial axis of a simple polygon is a tree whose leaves are the vertices of the polygon, and whose edges are either straight segments or arcs of parabolas. The medial axis together with the associated radius function of the maximally inscribed discs is called the medial axis transform , which is a complete shape descriptor, meaning that it can be used to reconstruct the shape of the original domain.

According to American Society for Testing and Materials (ASTM), Filamentary shrinkage usually occurs as a continuous structure of connected lines or branches of variable length, width and density, or occasionally as a network. From Fig.17 we can see that, the most obvious feature is the continuous tree structure, wider in the trunk and thinner in the branches. In grayscale, the parts closer to the center of the structure are darker. The outside part is lighter and the branches are between the centre and the outside part. Because of its structure and features, the skeleton description is one of the best. In the application, several layers of skeletons are needed, as showing in Fig.17, the simple and the complicate skeletons for the left dendritic shrinkage are as Fig. 17(c) and (d), which will be used to represent different parts of the defects, some like trunks and some branches.

Fig. 16. Skeletonization of a binary image, from left to right: the original binary image, normal skeletons, the skeleton image formed by the medial axis transformation

meaning that it can be used to reconstruct the shape of the original domain.

different parts of the defects, some like trunks and some branches.

The medial axis of an object is the set of all points having more than one closest point on the object's boundary. In mathematics the closure of the medial axis is known as the cut locus. In 2D, the medial axis of a plane curve S is the locus of the centres of circles that are tangent to curve S in two or more points, where all such circles are contained in S. (It follows that the medial axis itself is contained in S.) The medial axis of a simple polygon is a tree whose leaves are the vertices of the polygon, and whose edges are either straight segments or arcs of parabolas. The medial axis together with the associated radius function of the maximally inscribed discs is called the medial axis transform , which is a complete shape descriptor,

According to American Society for Testing and Materials (ASTM), Filamentary shrinkage usually occurs as a continuous structure of connected lines or branches of variable length, width and density, or occasionally as a network. From Fig.17 we can see that, the most obvious feature is the continuous tree structure, wider in the trunk and thinner in the branches. In grayscale, the parts closer to the center of the structure are darker. The outside part is lighter and the branches are between the centre and the outside part. Because of its structure and features, the skeleton description is one of the best. In the application, several layers of skeletons are needed, as showing in Fig.17, the simple and the complicate skeletons for the left dendritic shrinkage are as Fig. 17(c) and (d), which will be used to represent

Fig. 17. Skeletonization of a real dendritic shrinking for flaw simulation: (a) a radiograph of a workpiece, (b) zoomed dendritic shrinking, (c), (d) the skeleton images based on binarized images of different thresholds

Fig. 18. Randomly created skeleton for crack generation and simulation

Apart from sample defects, skeletons can also be created randomly such as for cracks or filamentary shrinkages, and so on. Please refer Fig. 18.

### **4.4 Visual feature analysis and fuzzy representation**

Since the qualitative visual features are fuzzy, so a fuzzy representation of them is appropriate. Set the image grayscale range *[1, Ng]*, *μ* is defined as the membership function of the gray value in a specified image area, it makes the gray value mapped to [0, 1]. On a view, like a factor image with piexls point to a single point of ambiguity in the original image, its corresponding values indicate the membership degree that the image point belongs to the object region. All the pixels in the image form a single dot fuzzy matrix expressed with *μ (I)*.

The following eight fuzzy geometric features impact on the accuracy and speed of operation with more good compromise effects. The image size is *M × N*, the *μ (I)* is denoted by *μ*, the membership definitions of these fuzzy geometric features and the classification functions for the object structures are as follow:

1. Area:

$$a(\mu) = \Sigma \mu \tag{18}$$

Area is the weighted sum of the pixels in an object image range.

2. Circumference:

$$p(\mu) = \Sigma\_{l=1}^{M} \Sigma\_{j=1}^{N-1} |\mu(l,j) - \mu(l,j+1)| + \Sigma\_{l=1}^{M} \Sigma\_{j=1}^{N-1} |\mu(l,j) - \mu(l+1,j)|\tag{19}$$

Circumference pixel horizontal distance and vertical distance weighted and is used to measure the undulations of the image area.

Flaw Simulation in Product Radiographs 121

needle cavity and small round cavity as well as sponge shrinkage showing in Fig. 19

Fig. 19. Defect texture, from left to right: shrinkages of needle cavity and small round cavity

Efros and Leung (1999) have proposed a nonparametric model to synthesize an output image from a given metric sample. Their approach works surprisingly well for a wide range

1. The output image is initialized with a random noise whose histogram is equalized with

2. For each pixel in the output image, in scan-line order, the already-synthesized values in neighbourhood of current pixel *z* of specific size *N(z)* is considered and is compared with all possible neighbourhoods from the input sample. The value of the input pixel x with the

Efros & Leung's algorithm is significantly useful for some kinds of defect simulation. After, initialize a synthesized texture with a 3x3 pixel "seed" from the source defect texture, for every unfilled pixel which borders some filled pixels, find a set of patches in the source image that most resemble the unfilled pixel's filled neighbors. Choose one of those patches at random and assign to the unfilled pixel a grey value from the center of the chosen patch, and do it repeatedly. The only crucial parameter is how large a neighbourhood you consider when searching for similar patches. As the "window size" increases, the resulting textures capture larger structures of the source image. The finer details of this approach can be found in the Efros' paper. The other problem which arises from radiograph simulation is to merge together the generated flaws with the workpiece or other parts of the background image. In a similar manner to the heat diffusion equation, the image diffusion technique is

Embedding simulated flaws into the objects' radiographs, which is called augmented reality in the simulation research field, is not an avoidable step and is important both in simulation application and the technology of image superimposing. Take the X-ray penumbra into account, we know that the edges of the defects are blurred and sometimes fused with their background, furthermore, the grey values of the defect vary when the background changes,

of textures. Their algorithm consists of the following steps:

respect to the histogram of the input sample.

most similar *N(x)* is then assigned to *z*.

adopted, which is discussed below.

**4.5.2 Imagediffusion technique** 

(Hoff, 1999).

as well as sponge shrinkage

**4.5.1 Texture generation** 

### 3. Firmness

$$comp(\mu) = \frac{a(\mu)}{p^2(\mu)}\tag{20}$$

Firmness reflects the degree of fuzzy compact region

### 4. Height and width

Height

$$h(\mu) = \Sigma\_{l=1}^{M} \max\_{l=1} \{ \mu(l, f) \} \tag{21}$$

Width

$$\text{cov}(\mu) = \Sigma\_{f=1}^{N} \max\_{\mathbf{1}} \{ \mu(\mathbf{i}, f) \} \tag{22}$$

Height is the total number of the largest membership of the rows of the image, and width isthe total number of the largest membership of the columns of the image. The height and width can be used, respectively, to reflect the image of certain areas in the overall vertical and horizontal directionfeatures.

### 5. Length and width

Length

$$l(\mu) = \max \{ \Sigma\_l^M \: \mu(l, f) \} \tag{23}$$

Width

$$h(\mu) = \max \{ \Sigma\_l^N \mu(l, f) \} \tag{24}$$

Length is the total number of the largest membership of the rows of the image, width is the total number of the largest membership of the columns of the image. The use of the X-ray image can be described in certain regions in the vertical and horizontal distribution of the extreme characteristics of the membership.

### 6. Area coverage

$$IOAC\left(\mu\right) = \frac{a(\mu)}{l(\mu)b(\mu)}\tag{25}$$

The characteristic quantity is the fuzzy area defined by the length and width of the moment shaped area ratio, length and width defined by the area of image certain areas of the largest possible area of fuzzy.

### **4.5 Generation of the low frequency information**

No matter how the generative flaw image is rendered from a creative counter or from a simple skeleton, the counters or skeletons normally are the crucial characteristics of most inner defects of the materials and are used mainly to produce the similar perceivable structures with the original flaw. While some types of flaws are not obvious in their high frequency information, but present as apparent textural features such as shrinkages of

����(�) <sup>=</sup> �(�)

ℎ(�) = ∑ ����{�(�� �)} �

�(�) = ∑ ����{�(�� �)} �

Height is the total number of the largest membership of the rows of the image, and width isthe total number of the largest membership of the columns of the image. The height and width can be used, respectively, to reflect the image of certain areas in the overall vertical

�(�) = �����∑ �(�� �) �

�(�) = �����∑ �(�� �) �

Length is the total number of the largest membership of the rows of the image, width is the total number of the largest membership of the columns of the image. The use of the X-ray image can be described in certain regions in the vertical and horizontal distribution of the

����(�) <sup>=</sup> �(�)

The characteristic quantity is the fuzzy area defined by the length and width of the moment shaped area ratio, length and width defined by the area of image certain areas of the largest

No matter how the generative flaw image is rendered from a creative counter or from a simple skeleton, the counters or skeletons normally are the crucial characteristics of most inner defects of the materials and are used mainly to produce the similar perceivable structures with the original flaw. While some types of flaws are not obvious in their high frequency information, but present as apparent textural features such as shrinkages of

Firmness reflects the degree of fuzzy compact region

��(�) (20)

��� (21)

��� (22)

� � (23)

� � (24)

�(�)�(�) (25)

3. Firmness

Height

Width

Length

Width

4. Height and width

and horizontal directionfeatures.

extreme characteristics of the membership.

**4.5 Generation of the low frequency information** 

5. Length and width

6. Area coverage

possible area of fuzzy.

needle cavity and small round cavity as well as sponge shrinkage showing in Fig. 19 (Hoff, 1999).

Fig. 19. Defect texture, from left to right: shrinkages of needle cavity and small round cavity as well as sponge shrinkage

### **4.5.1 Texture generation**

Efros and Leung (1999) have proposed a nonparametric model to synthesize an output image from a given metric sample. Their approach works surprisingly well for a wide range of textures. Their algorithm consists of the following steps:

1. The output image is initialized with a random noise whose histogram is equalized with respect to the histogram of the input sample.

2. For each pixel in the output image, in scan-line order, the already-synthesized values in neighbourhood of current pixel *z* of specific size *N(z)* is considered and is compared with all possible neighbourhoods from the input sample. The value of the input pixel x with the most similar *N(x)* is then assigned to *z*.

Efros & Leung's algorithm is significantly useful for some kinds of defect simulation. After, initialize a synthesized texture with a 3x3 pixel "seed" from the source defect texture, for every unfilled pixel which borders some filled pixels, find a set of patches in the source image that most resemble the unfilled pixel's filled neighbors. Choose one of those patches at random and assign to the unfilled pixel a grey value from the center of the chosen patch, and do it repeatedly. The only crucial parameter is how large a neighbourhood you consider when searching for similar patches. As the "window size" increases, the resulting textures capture larger structures of the source image. The finer details of this approach can be found in the Efros' paper. The other problem which arises from radiograph simulation is to merge together the generated flaws with the workpiece or other parts of the background image. In a similar manner to the heat diffusion equation, the image diffusion technique is adopted, which is discussed below.

### **4.5.2 Imagediffusion technique**

Embedding simulated flaws into the objects' radiographs, which is called augmented reality in the simulation research field, is not an avoidable step and is important both in simulation application and the technology of image superimposing. Take the X-ray penumbra into account, we know that the edges of the defects are blurred and sometimes fused with their background, furthermore, the grey values of the defect vary when the background changes,

Flaw Simulation in Product Radiographs 123

during the image generation process. As the seed feature grows, simultaneously, the low frequency features in the regions of the creative defect should be taken out to ensure that the defect appearances reflect their semantic definitions. Finally, image superimposing onto real product radiographs is also an important step that contributes to the success of the simulation application. The super impositions rely on the location as well as the associated gray values, which generally are implanted in the simulated flaws according to the contrast

of the defect against its background.

constrained by the law of X-ray attenuation and simultaneity, the grey values of the workpiece and its defect vary enormously in the large range of tube potential.

Similar to the effects of the heat diffusion equation, image diffusion is suitable for edge preserving blur and can be used widely in a flaw superimposing into a real radiograph, the apparent visual characteristics of blurred edges by diffusion can be seen from Fig. 20.

Fig. 20. The original panda image with the diffused ones on their right

To an initial image *u(x,y,0)* change to be image *u(x,y,t)* after a time *t*, the anisotropic diffusion first proposed by Perona and Malik (1990) is denoted as:

$$\frac{\partial \langle \mathbf{x}, \mathbf{y}, t \rangle}{\partial t} = \operatorname{div} [g(\mathbf{x}, \mathbf{y}, t) \nabla u(\mathbf{x}, \mathbf{y}, t)] \tag{26}$$

where ∇u(x, y, t) is the gradient of the image and g(x, y, t) is diffusion coefficient, which can be isotropic or anisotropic and depends on different applications. Teboul et al.(1998) further discussed the conditions of the coefficient g(x, y, t) and three constraints are given as follows:


There are many research contributions to the diffusion coefficient function, such as Gauss Smoothing Diffusion(Catte, et al. 1992), Morphological Diffusion(Segall& Acton, 1997), Degeneration Diffusion Mode(You, et al. 1995)Statistical Diffusion Mode(Black, et al. 1998), Curvature Diffusion Mode(Alvarez, et al. 1992), but the anisotropic diffusion models are illposed, it is difficult to determine the convergence condition. In the flaw simulation, we still rely on the qualitative visual feature analysis of real radiographs.

### **4.6 Synthesizing and generating radiographs**

The flaws generated in Fig. 21, follow a similar procedure though their 'seed features' differ from greatly from each other. After analysis of sample images and grouping them into different defect categories, extract their qualitative visual features; choosing the 'seed feature' and decide the flaw rendering approach such as the template method or the skeletonization method or texture synthesizing. Based on statistical analysis, calculate thefuzzy image representations for each type of feature, which are expected to be relevant for the image generation, fuzzy membership as needed is applied to these image features

constrained by the law of X-ray attenuation and simultaneity, the grey values of the work-

Similar to the effects of the heat diffusion equation, image diffusion is suitable for edge preserving blur and can be used widely in a flaw superimposing into a real radiograph, the

apparent visual characteristics of blurred edges by diffusion can be seen from Fig. 20.

To an initial image *u(x,y,0)* change to be image *u(x,y,t)* after a time *t*, the anisotropic

where ∇u(x, y, t) is the gradient of the image and g(x, y, t) is diffusion coefficient, which can be isotropic or anisotropic and depends on different applications. Teboul et al.(1998) further discussed the conditions of the coefficient g(x, y, t) and three constraints are given as

There are many research contributions to the diffusion coefficient function, such as Gauss Smoothing Diffusion(Catte, et al. 1992), Morphological Diffusion(Segall& Acton, 1997), Degeneration Diffusion Mode(You, et al. 1995)Statistical Diffusion Mode(Black, et al. 1998), Curvature Diffusion Mode(Alvarez, et al. 1992), but the anisotropic diffusion models are illposed, it is difficult to determine the convergence condition. In the flaw simulation, we still

The flaws generated in Fig. 21, follow a similar procedure though their 'seed features' differ from greatly from each other. After analysis of sample images and grouping them into different defect categories, extract their qualitative visual features; choosing the 'seed feature' and decide the flaw rendering approach such as the template method or the skeletonization method or texture synthesizing. Based on statistical analysis, calculate thefuzzy image representations for each type of feature, which are expected to be relevant for the image generation, fuzzy membership as needed is applied to these image features

�� = �����(�, �, �)��(�, �, �)� (26)

Fig. 20. The original panda image with the diffused ones on their right

diffusion first proposed by Perona and Malik (1990) is denoted as:

�(�,�,�)

rely on the qualitative visual feature analysis of real radiographs.

follows:

1. ��������� �(�) = �,0����;

3. �(�) *i*s a strictly decreasing function of ���(�)�*.*

**4.6 Synthesizing and generating radiographs** 

2. ��������� �(�) = 0;

piece and its defect vary enormously in the large range of tube potential.

during the image generation process. As the seed feature grows, simultaneously, the low frequency features in the regions of the creative defect should be taken out to ensure that the defect appearances reflect their semantic definitions. Finally, image superimposing onto real product radiographs is also an important step that contributes to the success of the simulation application. The super impositions rely on the location as well as the associated gray values, which generally are implanted in the simulated flaws according to the contrast of the defect against its background.

Flaw Simulation in Product Radiographs 125

Aloimonos, J. (1990). Purposive and Qualitative Active Vision, *Proceedings of 10th* 

Alvarez, L. et al. (1992). Image selective smoothing and edge detection by nonlinear diffusion II. SIAM *Journal of Numerical Analysis*, (1992), Vol.29, No.3, pp. 845-866 Black, M. et al. (1998). Robust anisotropic diffusion, *IEEE Transactions on Image Processing*,

Bottigli et al. (2004). Voxel-based Monte Carlo Simulation of X-ray Imaging and

Catte, F. et al.(1992). Image selective smoothing and edge detection by nonlinear Diffusion,

Efros, A. & Leung, K. (1999). Texture Synthesis by Non-parametric Sampling, Proceedings of

Filbert, D.; Klatte, R.; Heinrich, W. & Purschke,, M. (1987). Computer Aided Inspection of Castings. *Proceedings of the IEEE-IAS Annual Meeting,* pp. 1087-1095, Atlanta, USA

Gonzalez, C. & Woods, E. (2008). *Digital Image Processing*, Prentice Hall, ISBN: 0201180758,

Haken, H. &Wolf, H. (1996). *The Physics of Atoms and Quanta: Introduction to Experiments and* 

Hoff, A. (1999). Reference Radiographs, In: *The American Society for Nondestructive testing*,

http://www.asnt.org/publications/materialseval/basics/oct99basics/oct99basics.

Iowa State University. (1996), Radiograph Interpretation – Castings, In : *NDT resource center*,

http://www.ndt-ed.org/EducationResources/CommunityCollege/Radiography/

Mery, D. (2001). Flaw Simulation in Castings inspection by radioscopy, INSIGHT, *Journal of the British Institute of Non-Destructive Testing*, (2001), Vol.43, No.10, pp.664-668 Metropolis, N. (1987). *The Beginning of the Monte Carlo Method*, Los Alamos Science (1987

Perona, P. & Malik, J. (1990). Scale-space and edge detection using anisotropic diffusion.

Segall, A. & Acton, T. (1997). Morphological anisotropic diffusion, *Proceedings of IEEE* 

Sukowski, F. & Uhlmann, N. (2011). *Applications of Monte Carlo Method in Science and Engineering*, Shaul Mordechai (Ed.), InTech, ISBN: 978-953-307-691-1

*international conference on image processing*, (1997), No.1, pp. 356-361

*Superalloys*, CRC Press, Taylor & Francis Group, (2006). pp. 718-721, ISBN:

*IEEE Transactions Pattern Anal. Mach. Intel*., (1990), Vol.12, No.7, pp. 629–639, ISSN:

Kalos, H. & Whitlock, A. (2008). *Monte Carlo Methods*, Wiley-VCH, ISBN: 978-3527407606 Mackenzie, D.& Totten, G. (2006). *Anyalytical Characterization of Aluminum, Steel, And* 

*SIAM Journal of Numerical Analysis*, et al. (1992), Vol.29, pp. 182-193

EGSnrc (URL). Available from http://irs.inms.nrc.ca/software/egsnrc/

Spectroscopy Experiments, *Spectrochimica Acta Part B: Atomic Spectroscopy*, (2004),

*IEEE International Conference on Computer Vision*, pp. 1033-1038, Corfu, Greece,

*International Conference on Pattern Recognition (ICPR)*, pp. 346-361

(1998), Vol. 7, No.3, pp. 421-432, ISSN: 1057-7149

GoldSim(URL). Available from http://www.goldsim.com/Home/

*Theory*. Berlin, Heidelberg: Springer, 5th edition, 1996

TechCalibrations/RadiographInterp\_Castings.htm

Special Issue dedicated to Stanislaw Ulam), pp. 125–130

Vol.59, No.10-11, pp. 1747-1754

September 1999

0130946508

htm

03.08.2011, Available from

04.08.2011, Available from

9780824758431

0162-8828

**6. References** 

Fig. 21. Comparison simulated flaws with real defects on different products, at the third row the original is on the left and the simulated is on the right

### **5. Conclusion**

X-ray defect simulation is associated with many uncertainties in terms of shape, inconsistancy of grey values and the blurring of simulated defect edges against the background. The approaches discussed in this section have shown how to simulate and create various kinds of defects including stochastic large discontinuity defects and regular shape defects such as circular and elliptical spots, which can be used to build a sample library for testing and tuning automatic inspection programs. The new defect superposition methods using nesting stencil-plates, texture generation as well as skeletonization have been shown to be able to simulate the normal range of casting defects. These new methods are not only capable of simulating the casting defects, but also able to be used to simulate irregular objects in different kinds of X-ray images. Apart from the crucial high frequency image features that were adopted to render the structures of the flaws, the anisotropic diffusion method has received more attention as nearly all the objects appearing in radiographs have shading effects, which could be visually represented by diffusion technology.

Compared with the CAD model and the Monte Carlo method, the advantages and characteristics of image generation method, that is the augmented reality simulation method, can be summarized as: (1) It has more randomness and flexibility and provides a better match for the shape variability of the defects: (2) The 'seed features' are not limited in shape or size, and changes in their form will not significantly influence the simulated defects. (3) Many and varied defects can be created by the user and added to a real casting piece image. The program is easy to use and, by choosing and tuning the parameters, it can be used for the majority of casting pieces without any advanced measurements on the work piece. (4) The program works directly on the radiographs, and the location for the simulated defect can be chosen randomly by the user in any X-ray image. (5) Since no part of the programme is based on a CAD platform, there is no need of a CAD software package or any other database, the defect simulation function can be organized as a program module and integrated into the casting automatic inspection system to share the stored data.

### **6. References**

124 Nondestructive Testing Methods and New Applications

Fig. 21. Comparison simulated flaws with real defects on different products, at the third row

X-ray defect simulation is associated with many uncertainties in terms of shape, inconsistancy of grey values and the blurring of simulated defect edges against the background. The approaches discussed in this section have shown how to simulate and create various kinds of defects including stochastic large discontinuity defects and regular shape defects such as circular and elliptical spots, which can be used to build a sample library for testing and tuning automatic inspection programs. The new defect superposition methods using nesting stencil-plates, texture generation as well as skeletonization have been shown to be able to simulate the normal range of casting defects. These new methods are not only capable of simulating the casting defects, but also able to be used to simulate irregular objects in different kinds of X-ray images. Apart from the crucial high frequency image features that were adopted to render the structures of the flaws, the anisotropic diffusion method has received more attention as nearly all the objects appearing in radiographs have shading effects, which could be visually represented by diffusion

Compared with the CAD model and the Monte Carlo method, the advantages and characteristics of image generation method, that is the augmented reality simulation method, can be summarized as: (1) It has more randomness and flexibility and provides a better match for the shape variability of the defects: (2) The 'seed features' are not limited in shape or size, and changes in their form will not significantly influence the simulated defects. (3) Many and varied defects can be created by the user and added to a real casting piece image. The program is easy to use and, by choosing and tuning the parameters, it can be used for the majority of casting pieces without any advanced measurements on the work piece. (4) The program works directly on the radiographs, and the location for the simulated defect can be chosen randomly by the user in any X-ray image. (5) Since no part of the programme is based on a CAD platform, there is no need of a CAD software package or any other database, the defect simulation function can be organized as a program module and

integrated into the casting automatic inspection system to share the stored data.

the original is on the left and the simulated is on the right

**5. Conclusion** 

technology.


EGSnrc (URL). Available from http://irs.inms.nrc.ca/software/egsnrc/


04.08.2011, Available from http://www.ndt-ed.org/EducationResources/CommunityCollege/Radiography/ TechCalibrations/RadiographInterp\_Castings.htm


**6** 

*France* 

**Study of Metallic Dislocations by** 

**Using Eddy Currents** 

*Electromagnétisme (L2E), Paris* 

**Methods of Nondestructive Evaluation** 

Bettaieb Laroussi, Kokabi Hamid and Poloujadoff Michel *Université Pierre et Marie Curie (UPMC), Laboratoire d'Electronique et* 

This chapter summarizes a work which we have conducted over the period 2005-2010 [Bettaieb et al., 2008; Bettaieb, 2009]. The aim was to better understand the Non Destructive Evaluation (NDE) method based on the use of eddy currents. A very simple example, well adapted for beginners, was the evaluation of a homogenous rectangular aluminum plate of constant thickness, in case of a calibrated crack. Such a choice had a great advantage: it allowed the development of simple theoretical analysis, and therefore a very good

Naturally, theoretical results must be checked experimentally. To this end, we built a Helmholtz arrangement of two circular coils, to create a convenient uniform alternating field within the plate. Then, to measure the reaction field of the plate, we had to use a sensor. We used alternately a SQUID and a Hall sensor. The choice between those is not obvious, as will be shown later. Indeed, the SQUID is about 1000 times more sensitive than the Hall sensor, but its sensitive part is more remote than the Hall sensor, and this may reduce significantly

Indeed, if we cut a rectangular plate, the cut being parallel to one side and normal to the excitation field, it seems natural that the plate is equivalent to a homogeneous one. Therefore, the cut cannot be detected. Just in case, we made the experiment and there was an unexpected signal!! We rapidly realized the reason of this result: the cut through the plate did not interrupt any current, but the cutting tool had damaged the microstructure of the aluminum over a small part of each half plate. Therefore, none of the two half parts had remained homogeneous. We realized that the microstructure of a small part of the half plates had been modified. In fact, the two halves of the original plate were equivalent to a homogeneous plate, except along the cut. Therefore, *we did not detect the cut, but the metallic dislocations around it.* Some more theoretical investigations allowed to evaluate the importance of the change in the electrical resistivity associated with the dislocations, and their extension. Then, we started to investigate the dislocations due to hammer shocks and

its advantage. We found this comparison extremely interesting [Bettaieb et al., 2010].

**1. Introduction** 

to mechanical flexions.

understanding of the physics of the problem.

