Scanning electron microscopy (SEM), combined with energy-dispersive spectroscopy (EDS) mapping, is commonly used for gaining a qualitative understanding of elemental and phase distribution in materials. While SEM imaging (especially with backscattered electrons) enables visualization of phase distribution in the sample surface due to the average Z-contrast, EDS elemental maps provide a visualization of the elemental distribution within the sample. However, extracting quantitative data that allow for chemical mapping of phases is rarely attempted. A key impediment in such efforts lies in the self-scaling nature of the individual element map, i.e., the intensities scale between the highest and lowest concentrations of that element vis-à-vis the microstructure instead of scaling according to the absolute concentrations within the alloy. A wealth of such data exists in the microscopy literature where qualitative analysis is done without quantifying the results. The present work seeks to address this challenge via appropriate scaling of intensity, normalized for the actual chemical compositions.

Usually, the separate phases are identified based on the contrast in SEM images (typically using backscattered electrons with some visual cues from EDS maps), and the phase compositions are estimated by sampling small regions within the separate phases. This becomes challenging in scenarios where the phase contrast is not clearly apparent from the backscattered images due to low overall Z-contrast. In this work, we present the EDS-Phase Segmentation (EDS-PhaSe) tool that enables phase segmentation and phase analysis using the EDS elemental map images. It converts the EDS map images into estimated composition maps for calculating markers of selective elemental redistribution in the scanned area and creates a phase-segmented micrograph while providing approximate fraction and composition of each identified phase.

EDS is a quantitative technique wherein the chemical composition of any region on the sample surface can be calculated from the analysis of the characteristic x-ray spectrum emitted by that region when it is impacted by high-energy fast-moving electrons [1]. EDS mapping over a selected area is often used to generate elemental maps, the color intensity of which is scaled according to the relative abundance of the element within that region. However, given the self-scaling nature of the individual elemental maps, a measure of the overall composition is not obtainable by direct visual observation, which, in turn, becomes an impediment for extracting quantitative data from the EDS maps. The major reason behind such treatment is the fact that statistical accuracy of EDS quantification is strongly linked to the number of signals (photon counts) received, which can be very low at a single pixel due to the short dwell time per pixel while mapping large areas. Since phase separation is usually associated with elemental redistribution, EDS elemental maps can be used to identify compositionally different phases. Various commercial software packages are in fact available for automated phase segmentation, but these are coupled with the respective spectroscopic imaging systems and thus cannot work with the elemental mapping data available only as images (for example, data obtained from published literature). Various approaches have been implemented by researchers for EDS-assisted phase segmentation [2,3,4,5,6]. Some of these lack capabilities for generalized implementation for phase analysis, while others are built only for specific use-case scenarios. The edxia tool developed by Georget et al. [4] is especially interesting, albeit it is targeted toward microstructural analysis of cementitious materials only.

The EDS-PhaSe framework presented in this work enables phase segmentation and phase analysis using the EDS data to obtain estimates of phase fractions and phase compositions. The algorithms presented here are available as an interactive workflow with an easy-to-use interface and can be implemented directly to the EDS elemental map images for any material without requiring access to any raw data or proprietary software. The application of EDS-PhaSe is demonstrated here for microstructural analysis in AlCoCrFeNi high-entropy alloy (HEA).


The EDS-PhaSe framework developed in this work enables phase segmentation and phase analysis from raw EDS elemental map images. It was implemented using the Python programming language and associated open-source libraries. ‘OpenCV’ was used for reading and processing the raw EDS maps, ‘numpy’ was used for manipulation and conversion of pixel map arrays, and ‘matplotlib’ was used for plotting the pixel maps, phase masks, and segmented microstructures. The codes were wrapped into Jupyter notebooks wherein interactive controls were incorporated using ‘ipywidgets.’ This enables a user-friendly access to the EDS-PhaSe (akin to a graphical user interface) so that it can be used for analyzing new data and EDS maps without any coding. Please refer to ‘Code availability’ section for more details on how to access and use EDS-PhaSe for your own work.

The SEM micrograph and raw EDS elemental maps of AlCoCrFeNi used in this work correspond to equiatomic AlCoCrFeNi high-entropy alloy that was prepared using mechanical alloying (MA) followed by sintering in the published work of Shivam et al. [7]. The microstructure and EDS elemental maps for AlCoCrFeNi alloy were captured using FEI Quanta 200 F SEM equipped with AMETEK EDS detector operated at 20 kV. The accuracy of this approach was also demonstrated on a commercial Ni-based Haynes 282 superalloy using the actual raw data from the EDS maps as well as the images derived from the commercial software package (Oxford’s AZtec).


Creating Estimated Composition Maps

The elemental maps obtained from EDS capture the distribution of each element within the scan area which is most commonly represented in the form of RGB color images wherein the intensity of each pixel is scaled relative to the spectral contribution of that pixel to the overall spectrum of a given element. Figure 1 shows the methodology used for converting raw EDS maps into estimated composition maps. Suppose a sample has \(N\) number of raw EDS elemental maps (one for each element), and the size of each map is \(m\times n\). The intensity of any \((i, j)\) pixel in the raw EDS map of any element \(k\) is denoted here as \({I}_{ij}^{k}\). The raw EDS map of any element \(k\) is converted to a scaled map wherein the scaled intensity of any \((i, j)\) pixel (\({S}_{ij}^{k}\)) is given as follows:

$${S}_{ij}^{k}=\frac{{\overline{X} }^{k}}{{\sum }_{i=1}^{m}{\sum }_{j=1}^{n}{I}_{ij}^{k}}\times {I}_{ij}^{k}$$

where \({\overline{X} }^{k}\) is the average concentration of element \(k\) in the overall area mapped using EDS, and the denominator (\({\sum }_{i=1}^{m}{\sum }_{j=1}^{n}{I}_{ij}^{k}\)) is the sum of all pixel intensities in the raw EDS map of element \(k\). \({\overline{X} }^{k}\) can be in either atomic percent or weight percent and must match the mode used for creating raw EDS maps. In essence, the scaled map is a representation of how the total quantity of any given element present in the overall scanned area is redistributed to each pixel. This assumes a linear relationship between the pixel intensity at a given spatial location and the relative quantity of the element present (here, relative refers to the maximum quantity of the element within the region captured in the map).

Fig. 1.
figure 1

Methodology for conversion of raw EDS maps into composition maps

The scaled map of any element \(k\) is then converted to an estimated composition map wherein the estimated concentration (\({X}_{ij}^{k}\)) of element \(k\) in any \((i, j)\) pixel is given as follows:

$${X}_{ij}^{k}=\frac{{S}_{ij}^{k}}{{T}_{ij}}\times 100$$

where \({T}_{ij}\) is the summation of scaled intensities for all elements at the \((i, j)\) pixel and is calculated as follows: \({T}_{ij}={\sum }_{k=1}^{N}{S}_{ij}^{k}\). The units of estimated composition maps thus obtained are same as the mode used for capturing the raw EDS elemental maps. Figure 2 shows the raw elemental EDS maps along with the transformed composition maps (atomic percent and weight percent) for AlCoCrFeNi alloy.

Fig. 2.
figure 2

EDS elemental maps and transformed compositional maps for AlCoCrFeNi

Elemental Segregation Markers

Phase separation in alloys, whether it be during solidification or heat treatment, is often marked by the redistribution of elements into different phases. EDS maps capture this elemental redistribution; but, while they give visual cues on the nature of segregation in different regions, the lack of quantitative analysis often makes it difficult to: (a) precisely phase segment the microstructure when phase contrast is lacking in SEM micrographs [8], (b) estimate the extent of elemental redistribution, and (c) differentiate between the Z-contrast (due to average atomic number difference) and grain orientation contrast. Thus, we use two markers that provide quantitative information on the selective redistribution of all element pairs at each pixel in a given alloy and can act as parameters for performing phase segmentation.

The first parameter is a proxy-order parameter (\({\alpha }_{ij}^{A-B}\)) that is a measure of elemental ordering on a microscopic scale (decided by pixel size in EDS scan) and is calculated at any \((i, j)\) pixel for any binary pair A–B as follows:

$${\alpha }_{ij}^{A-B}=\frac{{X}_{ij}^{A}{ X}_{ij}^{B}}{{\overline{X} }^{A }{\overline{X} }^{B}}-1$$

where \({X}_{ij}^{A}\) and \({X}_{ij}^{B}\) are estimated atomic percent of element A and B, respectively, at \((i, j)\) pixel, and \({\overline{X} }^{A}\) and \({\overline{X} }^{B}\) are the average atomic percent of element A and B, respectively, in the overall area mapped using EDS. Here, \({X}_{ij}^{A}{ X}_{ij}^{B}\) is a measure of co-occurrence of the A and B in the \((i, j)\) pixel whereas \({\overline{X} }^{A }{\overline{X} }^{B}\) is a measure of co-occurrence of A and B under assumption that A and B elements are distributed uniformly throughout the mapped area. Consequently, \({\alpha }_{ij}^{A-B}\) takes positive value in pixels where co-occurrence of AB is higher than what would be obtained with uniform distribution of elements and vice-versa. Thus, \({\alpha }_{ij}^{A-B}\)>0 suggests ordering behavior of AB binary at the \((i, j)\) pixel whereas \({\alpha }_{ij}^{A-B}\)>0 suggests either clustering of A–B binary at \((i, j)\) pixel or rejection of both A and B elements from \((i, j)\) pixel. The formulation of \({\alpha }_{ij}^{A-B}\) parameter here is inspired from the Warren–Cowley parameter [9,10,11,12] used extensively for characterizing the short-range order. Since the formation of new phases is often associated with selective redistribution of elements (while total amount of each element is conserved), it is reasonable to expect that the \({\alpha }_{ij}^{A-B}\) parameter for at least one binary pair would undergo a strong transition as we move from one phase to the next. Thus, mapping of \({\alpha }_{ij}^{A-B}\) parameter for all binaries over the entire scan area, as shown in Fig. 3, can provide contrast for identifying phases that may not be easily distinguishable from SEM images.

Fig. 3.
figure 3

Proxy-order parameter maps and absolute concentration difference maps for all binary pairs

The second parameter is the absolute concentration difference (\({\Delta X}_{ij}^{A-B}\)) that is calculated at any \((i, j)\) pixel for a binary pair A–B as follows:

$${\Delta X}_{ij}^{A-B}={|X}_{ij}^{A}-{X}_{ij}^{B}|$$

where \({X}_{ij}^{A}\) and \({X}_{ij}^{B}\) are the estimated concentration of element A and B, respectively, at \((i, j)\) pixel. It is a fairly straight-forward metric that quantifies the difference between concentrations of element A and B at each pixel; and thus, when mapped over the entire scanned area (as shown in Fig. 3), it can create contrast useful for phase identification.

While these parameters are useful in most cases, there are instances where the use of single-element concentration (\({X}_{ij}^{k}\)) by itself may be preferable for phase identification. For e.g., suppose we have formation of two phases that correspond approximately to A2B and AB2 stoichiometry. The \({\alpha }_{ij}^{A-B}\) and \({\Delta X}_{ij}^{A-B}\) parameter maps over these phases will look identical, but these can be easily distinguished by the elemental concentration of either A or B. Thus, the choice of exact parameter for phase segmentation will vary not only from one sample to another, but also from one phase to another within the same sample. To enable this, EDS-PhaSe framework developed in this work provides the flexibility to use different parameters for identification of different phases within the same sample.

Creating Phase Masks

Here, we are looking at the AlCoCrFeNi high-entropy alloy that was prepared through mechanical alloying route. For this alloy, it is difficult to identify phases directly from the SEM micrograph (Fig. 5b) since these do not exhibit great contrast. The binary parameter maps (Fig. 3) and estimated composition maps (Fig. 2) provide clear insights into what types of phases are present and what parameters may be ideal for their separate identification. From Fig. 3, we can see three separate (non-overlapping) regions which show a strong ordering parameter for different binary pairs. The strongest one is the Co–Ni ordering, followed by Al–Cr and Cr–Fe, thereby indicating that we have three major phases present in the alloy: a (Co, Ni)-rich phase, a (Al, Cr)-rich phase, and a (Fe, Cr)-rich phase. EDS-PhaSe allows interactive mask creation for a phase that gets overlaid on top of the SEM micrograph. First, a condition is defined for each phase using three user inputs: (a) parameter type, (b) operator type, and (c) threshold value. For e.g., the mask for (Co, Ni)-rich phase in Fig. 4a has been created using ‘\({\alpha }_{ij}^{Co-Ni}\)’ parameter and ‘ > ’ (i.e., ‘greater than’) operator for different threshold values viz. {0.1, 0.3, 0.5, 1}. Similarly, the mask for (Al, Cr)-rich phase in Fig. 4b has been created using ‘\({\alpha }_{ij}^{\mathrm{Al}-\mathrm{Cr}}\)’ parameter and ‘ > ’ (i.e., ‘greater than’) operator for different threshold values viz. {0.1, 0.3, 0.5, 1}.

Fig. 4.
figure 4

Phase segmentation masks for different threshold values

Once the condition is defined, the phase mask is created by assigning a value of ‘1’ or ‘0’ at each pixel based on whether the condition is satisfied or not satisfied, respectively. The interactive controls allow creation and visualization of the masks (Fig. 4) in real time so that appropriate parameter choice can be made for final phase segmentation and analysis.

Phase Segmentation and Analysis

Once the conditions for identification of each phase are finalized, these are used to create the individual phase masks. The overall phase-segmented image is created by layering the individual phase masks on top of each other. The analysis of these phase masks yields important information pertaining to: (a) the volume (or area) fraction of each phase and (b) the estimated average composition of each phase.

The phase fraction (\({f}^{p}\)) of any phase \(p\) is calculated as follows:

$${f}^{p}=\left(\frac{1}{m\times n}\right){\sum }_{i=1}^{m}{\sum }_{j=1}^{n}{\delta }_{{M}_{ij}^{p}=1}$$

where (\(m\times n\)) is the total number of pixels in image of size (\(m\times n\)), \({M}_{ij}^{p}\) is the value of phase mask for phase \(p\) at \((i, j)\) pixel, and \({\delta }_{{M}_{ij}^{p}=1}\) is a delta function that returns 1 if \({M}_{ij}^{p}=1\) or else 0. Figure 5a shows the individual phase masks and phase fractions of three phases identified in the AlCoCrFeNi HEA. The estimated phase fractions of (Co, Ni)-rich phase, (Al, Cr)-rich phase, and Fe-rich phase in the scanned area are 0.36, 0.34, and 0.3, respectively.

Fig. 5.
figure 5

Phase segmentation and phase analysis. (a) Phase masks for individual phases. (b) SEM micrograph and phase-segmented micrograph along with the estimated phase compositions in atomic percent

The average concentration (\({\overline{X} }^{k,p}\)) of any element \(k\) in any phase \(p\) is calculated as follows:

$${\overline{X} }^{k,p}=\left(\frac{1}{{f}^{p}}\right)\left(\frac{1}{m\times n}\right) {\sum }_{i=1}^{m}{\sum }_{j=1}^{n}{{X}_{ij}^{k} M}_{ij}^{p}$$

where \({f}^{p}\) is the phase fraction of phase \(p\), (\(m\times n\)) is the total number of pixels in image of size (\(m\times n\)), \({X}_{ij}^{k}\) is the estimated concentration of element k at \((i, j)\) pixel, and \({M}_{ij}^{p}\) is the value of phase mask of phase \(p\) at \((i, j)\) pixel. Implementing this phase analysis on the AlCoCrFeNi HEA results in the estimated average compositions (in atomic percent) of (Co, Ni)-rich, (Al, Cr)-rich, and Fe-rich phases as {Al: 13.6, Co: 25.5, Cr: 16, Fe: 17.6, Ni: 27.3}, {Al: 27.6, Co: 15.8, Cr: 24.6, Fe: 17.7, Ni: 14.3}, and {Al: 16.7, Co: 18.7, Cr: 21.1, Fe: 26, Ni: 17.5}, respectively. To highlight the significance of phase analysis enabled by EDS-PhaSe framework, it must be noted that in the original work [7], the authors had identified three phases through XRD, but could sample only two phases during SEM-EDS due to a lack of clear phase contrast in SEM micrographs. EDS-PhaSe shines especially in such scenarios where the phase identification is otherwise difficult.

The estimated phase fractions and phase compositions through EDS-PhaSe are especially sensitive to the threshold values used while creating the phase masks and thus represent only rough estimates of what the actual phase compositions might be. But that said, the type of elemental redistribution indicated by the analysis would still be accurate, i.e., (Co, Ni)-rich phase identified here would be rich in Co and Ni in actual sample also, even though the extent of segregation may be under- or over-estimated based on the choice of threshold values.

Using Raw Count Maps for EDS-PhaSe Analysis

The vast majority of EDS elemental mapping data is collected and distributed as graphic images, and thus, in sections ‘Creating estimated composition maps’–‘Phase segmentation and analysis,’ we focused on the methodology (Fig. 1) and implementation (Figs. 2, 3, 4, and 5) of EDS-PhaSe for analyzing EDS images. But some EDS software (such as AZtec by Oxford Instruments) provide easy access to raw count maps, containing the counts of characteristic x-rays used for quantification of each element, that can be exported in a tabular format as Excel or csv files. EDS-PhaSe has the capability to analyze these raw count maps in a manner similar to how graphic images are analyzed above. To showcase this, we have analyzed Haynes 282 alloy (Fig. 6) using two different data sources—(a) the raw count maps created using Kα1 and Lα1 energies for mapping of {Al, Co, Cr, Ni, Si, Ti} and Mo, respectively, and (b) graphic images of elemental maps. We further calculated the compositions of various regions, as marked in Fig. 6c, with EDS-PhaSe using both data sources and compared these with the compositions measured directly through EDS region scans (Fig. 6d) to address three key questions: (a) How accurate are the compositions calculated by EDS-PhaSe model as compared to actual EDS region scans? (b) What is the extent of improvement (if any) obtained when raw count maps are used instead of graphic images? and (c) How sensitive are the EDS-PhaSe calculations to size of the scanned area? To quantify the difference between calculated and actual concentrations, the error metric (Fig. 6d) has been calculated as follows:


where \(N\) is the number of elements, \({X}_{\mathrm{model}}^{i}\) is the concentration of ith element as calculated by the EDS-PhaSe model, and \({X}_{\mathrm{EDS}}^{i}\) is the concentration of ith element as determined by the EDS region scan.

Fig. 6.
figure 6

Comparing performance of EDS-PhaSe model using different data sources (EDS images and raw count maps) over scan areas of varying size. (a) Microstructure and elemental maps of Haynes 282 alloy. EDS element maps were collected as both graphic images as well as raw count maps. (b) Composition maps [atomic percent] created using EDS-PhaSe. (c) Marked regions with region id varying from 02 to 17. The composition of each of these regions was measured first using the EDS software and then using the EDS-PhaSe tool presented in this work. (d) Error in composition of regions marked in (b) as calculated by EDS-PhaSe model using two different data sources—raw count maps (Lα1 for Mo and Kα1 for all other elements) and EDS images. The labels (2–17) in (c) correspond to respective region id marked in (b). The error is calculated as sum of absolute difference between concentration of each element measured by EDS-PhaSe model (\({X}_{\mathrm{model}}^{i}\)) vs. the actual concentration measured by EDS software (\({X}_{\mathrm{EDS}}^{i}\))

As shown in Fig. 6d, the overall error in EDS-PhaSe calculated compositions is quite small; ranging between 0.46 and 2.24 at.% with raw count maps and between 0.17 and 2.69 at.% with graphic images as the data source. These error values are small since these are not average errors in concentration of elements, but are instead cumulative errors representing summation over absolute errors in concentration of all elements. The accuracy of EDS-PhaSe calculated compositions shows a direct relation to the area of the scanned region (represented by number of pixels lying within the region) as the accuracy decreases with decrease in the size of sampled region and vice-versa, as shown in Fig. 6d.


This work presents the EDS-PhaSe framework that incorporates an interactive workflow for phase segmentation and phase analysis using the EDS elemental map images. It converts the EDS map images into estimated composition maps that are used for calculating markers of selective elemental redistribution in the scanned area. The proxy-order parameter, defined as a measure of deviation in occurrence frequency of binary atom pairs, is especially helpful in highlighting chemical contrast between different phases. EDS-PhaSe creates individual phase masks with the additional flexibility of using different identification parameters and conditions for each phase. It further creates a phase-segmented micrograph and provides approximate fraction and composition of each phase. The approach offers two unique advantages. Firstly, it enables the direct processing of EDS elemental map images without requiring any raw or proprietary data/software; thereby enabling analysis of EDS results available in the published literature as images or in cases where either the raw data are not available/collected or the access to proprietary software is limited. Secondly, it enables segmentation and analysis of phases even when the phase contrast is missing in SEM micrographs; thereby assisting in correlating the XRD and SEM-EDS data as shown in this work for AlCoCrFeNi high-entropy alloy. The quantitative phase analysis obtained from EDS-PhaSe, comprising phase fractions and phase compositions, can be further integrated with insights obtained from other computational techniques such as: (a) phase selection, phase fractions, and phase constitutions predicted by machine learning models and CALPHAD calculations [13,14,15,16,17,18,19,20], (b) ordering and clustering tendencies predicted by ab initio calculations and atomistic simulations [21,22,23], and (c) microstructural changes such as phase separation and precipitate formation predicted by phase field modeling [16, 24, 25].

The current implementation of EDS-PhaSe has certain limitations also—(a) the phase masks are very sensitive to the threshold value, which is a user input parameter, and thus, the phase fractions and phase compositions should only be treated as rough estimates, (b) EDS-PhaSe does not perform any spectrum correction and assumes that the EDS software has taken into account all corrections (such as ZAF correction) while capturing the elemental maps, which is often the case, and (c) it is assumed that no post-processing has been done on the input EDS element map images post-acquisition; but that said, linear adjustment of the intensity spectrum (brightness and contrast adjustments) in input images will not make a difference as long as the thresholds are kept above (below) the maximum (minimum) intensity values in raw spectrum.

The best use-case scenario, and the future thrust, for EDS-PhaSe framework is its integration with the EDS software so that the phase segmentation and analysis is done simultaneously in real time during the acquisition of EDS elemental maps. This would provide critical insights for the SEM operator as to which areas should be sampled further for accurate quantification of phase compositions. As EDS-PhaSe code is available as open access with this article, there are various other collaborative avenues for improvements such as—(a) while EDS-PhaSe is capable of analyzing raw count maps, these are not readily accessible from all EDS software, and thus, there is scope for the development of algorithms that can break down the raw spectrum into count maps, (b) development of new and innovative markers using the composition maps to create unique masks, (c) development of algorithms to guide selection of appropriate threshold parameters, and (d) unique masking techniques to probe different microstructural features such as grain boundary segregation.