{'fraction_non_alphanumeric': 0.01797223599405057, 'fraction_numerical': 0.0060733763014377785, 'mean_word_length': 5.124098671726755, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Automated microstructural analysis of titanium alloys using digital image processing

Titanium is a material that exhibits many desirable properties including a very high strength to weight ratio and corrosive resistance. However, the specific properties of any components depend upon the microstructure of the material, which varies by the manufacturing process. This means it is often necessary to analyse the microstructure when designing new processes or performing quality assurance on manufactured parts. For Ti6Al4V, grain size analysis is typically performed manually by expert material scientists as the complicated microstructure of the material means that, to the authors knowledge, no existing software reliably identifies the grain boundaries. This manual process is time consuming and offers low repeatability due to human error and subjectivity. In this paper, we propose a new, automated method to segment microstructural images of a Ti6Al4V alloy into its constituent grains and produce measurements. The results of applying this technique are evaluated by comparing the measurements obtained by different analysis methods. By using measurements from a complete manual segmentation as a benchmark we explore the reliability of the current manual estimations of grain size and contrast this with improvements offered by our approach.


1
Introduction Titanium is a widely used material that is useful in a variety of applications ranging from aerospace to medicine [1]. Its popularity is due to several valuable properties. Titanium is very light with a density of approximately 60% that of iron yet it is still very strong. It also maintains its strength at high temperatures and, due to a high reactivity with oxygen, can form an oxide layer on its surface giving titanium a high corrosive resistance [2]. Titanium alloys are used to improve some of these properties even further. Ti6Al4V is particularly popular in the aerospace sector as it can replace both steel and aluminium parts, offering a weight saving against steel and both a strength and operating temperature improvement versus aluminium [3]. The aerospace sector represents around 50% of the world's titanium usage [3] and Ti6Al4V is the most commonly used alloy [2], making it valuable to research.
The properties of the Ti6Al4V alloy depend on its microstructure. This will vary based on the manufacturing processes used in production. An accurate and reliable analysis of the microstructure therefore benefits quality assurance of manufactured parts as well as research into new manufacturing techniques. Features such as the volume fraction of alpha grains, the size of alpha grains, the volume fraction of globular alpha phase and the width of Widmanstätten alpha laths are often measured as they are known to effect the mechanical properties of the alloys [4].
Much of this analysis is currently carried out by a manual process. For example, measurements of grain size require expert materials scientists with knowledge of the materials microstructure to measure axis lengths of hundreds of grains, a laborious and inefficient process. Existing software packages can provide some assistance by measuring the distance between mouse clicks, meaning axis measurements can be produced and stored simply by selecting points on the grain boundary. However, this process is still slow with users making subjective decisions about the location of grain boundaries. We propose using image processing to improve speed and repeatability. In image processing software, measuring grain parameters, such as length and square area, are relatively and easy once the grain has been identified. The more difficult task is the process of labelling the image such that it is known to which grain, if any, each pixel belongs. This process of partioning an image into a set of labelled regions, where pixels share some measure of homogeneity, is commonly referred to as image segmentation [5]. Despite considerable research being conducted into generic image segmentation algorithms, the complexity of the task means a single technique cannot segment every image suitably for all applications [6]. Typically, combinations of different methods must be combined alongside expert knowledge of the application to produce accurate segmentation results. Ti6Al4V alloys have complex microstructures, containing alpha and beta grains and often contain clusters of grains of the same phase separated only by unclear inter-grain boundaries. Commercial microstructural analysis software, such as Beuhler OmniMet or Clemex Vision PE, struggle to reliably identify these boundaries where grains of the same phase meet. This means their automated measurements are not reliable, particularly when the volume fraction of alpha phase is high. Other research has proposed uses of image processing techniques to improve the analysis of titanium alloys. Tiley et al [7] proposed methods of measuring the Widmanstätten laths. This was incorporated into a list of procedures to semi-automate the analysis of α/β titanium alloys, proposed by Searles et al. [8,9]. In these procedures a Photoshop extension called Fovea Pro is used to obtain measurements of the microstructural features of a material. For example, thresholding techniques are used to determine the volume fraction of alpha phase, a technique the authors of this paper have observed effective use of within industry. However, methods to automatically measure the size of alpha grains have very limited success due to errors in the automatic segmentation methods. In an extension of this work published by P.C. Collins [4] automatic grain segmentation is abandoned and alpha grains are selected manually due to these errors. Our research combines knowledge from the materials science domain with innovative image processing techniques to create a new algorithm that is suitable for segmenting Ti6Al4V microstructural images. This segmentation will allow individual measurements of alpha grains to be made, which will enable the automatic calculation of grain size and the volume fraction of globular alpha grains. For this study images of Ti6Al4V alloy were used and have been obtained by a Scanning Electron Microscope (SEM) Quanta FEG 250. The Watershed Algorithm [10] is then used for segmentation. This algorithm considers an image as a topographic surface where pixel values represent the height of the surface. The algorithm then floods the image from its shallowest regions with the locations these floods meet being marked as grain boundaries. This has been successfully applied to segment images in a range of applications from analysis of sea ice floes [11] to medical images [12]. However, the Watershed algorithm is prone to over-segmentation as flooding from small local minima, caused by noise in the image, results in that region being incorrectly detected as a grain [6]. Pre-defined regions in an image, known as markers, reduce over-segmentation by setting the start points for the flooding process. By combining the Watershed Algorithm with a range of pre and post-processing steps, and using our own method to compute markers for the Watershed, we improve the segmentation accuracy compared to existing techniques, when applied to this application. We also show how the algorithm could be implemented within a software tool that allows the user some intuitive control over results. Finally, the measurements produced by the software are compared with measurements produced by expert materials scientists to demonstrate that the software can achieve accurate results in less time.

Method
This section describes the method proposed to segment the grains within the microstructural images, examples of which are shown in Figure 1. The flow chart in Figure 2 shows the steps in this algorithm.  The Watershed Algorithm is used as the segmentation function in our system. As the Watershed Algorithm is known to often oversegment images we propose a combination of techniques to improve segmentation accuracy. For α/β microstructures we must also separate the phases before taking measurements. As the contrast of the phases differ, we can use thresholding [6] to estimate the locations of each phase. Otsu's method [13] is used to automatically compute a suitable threshold based on the properties of the image under study such that the threshold parameter is dynamic and can be easily adjusted for images of different brightness and contrast. However, noise in the image causes some pixels to be misidentified in this process. Therefore, to improve the reliability of phase separation, we assess each region from the Watershed segmentation based on the percentage of its constituent pixels that are classified as each phase. We label each region as belonging to either the alpha or beta phase to obtain a robust phase separation. The Gaussian filter [15] reduces noise in the image by smoothing the intensity change between adjacent pixels. This helps minimise over-segmentation and increase the reliability of edge detection and thresholding. The effect of this filter is limited so as not to obscure grain boundaries. Markers, as explained in the introduction, are also used to reduce over-segmentation. Other researchers use marker based watersheds to achieve good image segmentation results [14,16,17]. However, none of the methods tested in this study produced good results for the microstructures in our data. A new method of computing markers was therefore used. Our method uses edge detection [5] to mark grain boundaries, based on a variation in intensity, and morphological operators [6] to expand these edges leaving small regions within each grain, that we can use as a marker. Typically, we set edge detection to only detect obvious grain boundaries. However, it also provides a userfriendly way to adjust the segmentation as the number of detected edges affects the number of markers produced. Therefore, we can set the edge detection threshold as a parameter called "sensitivity" that would allow the user to control the segmentation level in a simply and intuitively. A split and merge approach is also applied in our proposed algorithm. Over-segmentation errors are resolved by merging adjacent regions in our segmentation when they meet a certain criterion. In our case: grain size, the difference in the mean intensity between adjacent grains and the length of the boundary between regions could be used to determine if those regions belong to the same grain. The effectiveness of our segmentation approach can be demonstrated by comparing the segmentation we produced to those produced by other segmentation algorithms [6,11,12,14] when applied to the same data. Figures 3 b) and c) show results using implementations of established Watershed methodologies [6,14]. Figures 3 d) and e) use recent algorithms to improve the segmentation accuracy for images within their study [11,12]. All of these algorithms achieve accurate segmentations in certain applications but Figure 3 shows they fail to accurately segment the images in our study. This illustrates the complexity of the segmentation task and why a new method was required.

Figure 3.
Comparison of segmentation of Ti6Al4V image using existing techniques and our method where a) original image, b) watershed using supressed minima [6], c) markers computed using reconstruction [14] d) watershed proposed by Al-Kofahi [12], e) algorithm proposed by Zhang [11], f) our algorithm.

Results and Discussion
The purpose of this research is to develop an accurate automated method of segmenting and measuring alpha grains in images of Ti6Al4V microstructures. When evaluating the proposed method, the potential for error in existing manual methods must be considered. We use the mean grain size for our comparison and measure the microstructure in Figure 1 a) using three methods. In one method a complete manual segmentation of the image was performed by an expert materials scientist. This allowed for every grain to be accurately measured giving what is as close as possible to the true grain measurements. 5 hours were taken to ensure this result was accurate, meaning this method would typically be impractical to use. Therefore, this result serves only as a benchmark with which to compare other measurements. The proposed automated method was then used to measure the image, as was a manual method for estimating of grain size, currently employed at the Advanced Forming Research Centre. In the manual method measurements are taken by loading the image into the ImageJ software package then measuring axes of the grain by clicking on the points where each axis would cross the grain boundary. This process was repeated until 300 grains were measured in order to obtain statistically valid results. For consistency each method would calculate the grain size as the average of the major and minor axis of the grain and report the average grain size for use in our comparison. The results in Table 1 demonstrate the potential of our approach as they show the software achieved results closer to what is believed to be the true grain size than the existing manual estimation. A possible reason for this result is that the software measures every grain, while due to practical time constraints only a subset is measured during the manual estimation. In our experiment the software was measuring more than twice as many grains as were measured by the manual method. Another factor is that the boundaries of large grains were more obvious and easier to measure. It is possible that this would lead to a user being more likely to ignore small grains and unintentionally bias the result, although further research is required to confirm this hypothesis. The results also show a significant time difference between the proposed automatic approach and manual methods. As this is a software method, our measurement is also repeatable. The proposed automatic method can therefore resolve key issues with existing manual processes provided it can be successfully applied to a variety of microstructural images. The volume fraction of alpha grains, the shape of grains and the presence of Widmanstätten alpha laths varies between different titanium microstructures which presents challenges to image segmentation software. Work is currently in progress to ensure our method can be applied to a variety of microstructural images. Although mean alpha grain size was used in our tests, the automated approach also allows us to calculate a variety of other microstructural properties which are important for industrial and fundamental applications. The segmentation produced by our proposed algorithm allows all microstructural properties relating to alpha grain measurements to be taken. Knowing the axis lengths of each grain allows the distribution of grain size and aspect ratio to be calculated, as well as the volume fraction of globular grains. The total area of alpha phase could also be compared to the total area of beta phase to calculate the volume fraction of alpha grains. These calculations typically take no more than a few seconds once the segmentation is produced, depending on the number of grains measured. An independent software package that calculates such measurements has been produced to aid future efforts to validate our methods. The interface of this software is shown in Figure 4.

Conclusions
The results of this research demonstrates the potential of using image processing techniques for microstructural analysis of Ti6Al4V. Although current evaluation trials have been performed only on a limited dataset, results demonstrate the potential for highly accurate measurements to be produced. In our trial the software obtains a more accurate result than the existing manual process in far less time. We also demonstrated that the complexity of the Ti6Al4V microstructures cause errors in several other segmentation algorithms and that our method is capable of resolving these problems. Further work is in progress to validate the consistency of these results for a variety of microstructures exhibiting different properties.