Estimating microstructural feature distributions from image data using a Bayesian framework

Many microstructural characterizations methods collect data on a regular pixelized grid. This method of discretization introduces a form of measurement error which can be shown to be proportional to the resolution at which they are collected. Intuitively, measurements made from low‐resolution data are associated with higher error, but quantification of this error is typically not performed. This is reflected in international standards for measurements of grain size, which only provide a recommended minimum number of sample points per microstructural component to ensure each component is sufficiently resolved. In this work, a new method for quantifying the relative uncertainty of such pixelized measurements is presented. Using a Bayesian framework and simulated data collection on features collected from a Voronoi tessellation, the distribution of true geometric properties given a particular set of measurements is computed. This conditional feature distribution provides a quantitative estimate for the relative uncertainty associated with measurements made at difference resolutions. The approach is applied to measurements of size, aspect ratio and perimeter of given microstructural components. Size distributions are shown to be the least sensitive to sampling resolution, and evidence is presented which shows that the international standards provide an overly conservative minimum resolution for grain size measurement in microstructures represented by a Voronoi tessellation.

experimental cost. In addition, resolution of material feature distributions requires large volumes of the material to be imaged, which are significantly larger than those needed to find only averaged quantities.
The inverse relationship between the volume of material which can be reasonably sampled and the resolution at which the data are collected further complicated this problem. 5 It is understood that collecting data at a lower resolution will result in increased epistemic error, but a detailed evaluation of the tradeoff between the increased epistemic error and the reduced sampling error is not found to date in the literature. Currently, the best practice is to use measurement standards published by one of the international measurement societies to select an appropriate resolution and attempt to collect as much data as possible.
The basis for most microstructural experiments on polycrystalline materials are standards for the measurement of the grain size. Beginning in 1955 the American Society for Testing and Materials (ASTM) introduced standards for the measurement of grain size using a light optical microscope. The original technique works well only if grain boundaries can be easily delineated by etching. 6 As such ASTM-E112 7 has been updated several times as methods and technological limits have progressed and still serves as a primary reference for measuring grain boundaries using etching. One of the technological innovations includes the adoption of electron back-scatter diffraction (EBSD) for determining grain size. EBSD can more clearly identify grain boundaries using their orientation. This leads to the introduction of ASTM-E2627 8 in 2013, which outlines how to use EBSD to determine the average grain size. For consistency it still reports the final grain size in terms of an ASTM grain size number, G, which is defined in E112 based on the number of grains/square inch. The ASTM grain size number is used because of its simplicity in reporting the number of grains per unit area. However, due to lack of intuition, many researchers have begun adopting other methods of reporting grain size, such as the circle equivalent diameter. [9][10][11] As such ISO 13067, 12 the International Organization for Standardization (ISO) equivalent of ASTM-E2627, incorporates a formula to compute the circle equivalent diameter measure directly into its standard. In addition, as highlighted in Table 1 there are several other key differences aside from the means of reporting grain size. Most notable is the significant difference between the average grain size resolution. E2627 recommends an average grain resolution of 500 pixels (Px) while ISO 13067 recommends at least a 10 Px lineal intercept across the average grain, or approx. 80-100 Px per grain. There is no clear explanation in the literature as to the reasoning for this large difference. A National Insitute of Standards and Technology study of the ISO 13067 standard revealed that TA B L E 1 Comparison of major differences in the international standards for measuring grain size.

Requirement ASTM E2627 ISO 13067
Number of grains 500 None this less conservative bound still produced a repeatably reliable measurement. 13 Additional details of the difference between the two standards are discussed in Coutinho et al., 14 but there appears to be no clear reconciliation of the differences and quantitative merits of the two standards.
The primary motivation of this paper is to investigate microstructural measurement errors associated with the resolution at which the measurements are collected. Doing so will provide researchers with a much-needed tool to (1) report full microstructural feature distributions in place of mean values, (2) report measurement error for various metrics and (3) assess the best ways to go about collecting microstructural data and making key measurements of crystalline materials. Currently the best practices for these areas are lacking in several key aspects.
First, many current methods focus on the computation of mean values in place of a feature distribution. This can be attributed to historical preference, as reporting a distribution of the grain size (or any other measurement) can be difficult and leads to more data being stored and understood. All this said, material feature distributions are receiving increasing recognition for their importance. One paper reported that using a distribution of grain size in place of the mean resulted in a 4% difference in the computed yield strength while using the Hall-Petch relation. 14 Other authors have noted that variation in the grain size distributions lead to material heterogeneity, and evaluating the tails of the distribution are important to a full understanding of the material performance. 15 A National Physics Laboratory report also used the grain size distribution in their evaluation of the reproducibility of EBSD grain size measurements. 16 Second, there are few to no standards for other measurement metrics. Imaged data are routinely used for measurement of aspect ratio, shape characteristics such as circularity and perimeter measurements, and connectivity. [17][18][19] These measurements are increasingly being used to enhance understanding of the material morphology, with several works using them to fit key model parameters. 17,20 Significant effort has gone into developing methods to accurately measure these quantities. For example, numerous techniques exist for estimating the perimeter of pixel objects, [21][22][23] yet no clear method is universally applicable. It appears to be common practice to either use the standards for grain size to resolve the dataset for these other measurements, or alternatively to resolve the microstructure to the best available resolution based on experimental limitations, and then assume the resolution is sufficient for these measurements. This practice often expends unnecessary experimental resources in the hope of obtaining highly accurate data, rather than using uncertainty quantification (UQ) tools to evaluate what resolution is actually needed for a specific application.
Third, there is no clear understanding of how to process data which do not fully meet established standards. It is unclear what a user might do with a dataset which does not meet the ASTM-E2627 average component size standard of 500 Px. Discarding and recollecting new data is wasteful and ultimately might be infeasible. One field in which this issue is already proving to be of importance is metal additive manufacturing (AM). It has been reported that high throughput and in situ characterization are key components of linking processing parameters to material properties needed for metal AM. 24,25 High throughput or in situ monitoring applications in which microstructural data are collected for hundreds or thousands of samples will require fast processing, and a 500 Px average component sizes may not be feasible. Collecting these data under the requirements of ASTM-E2627 would be very challenging on an industry-wide scale. 26 This paper seeks to address these pitfalls by developing a method whereby the uncertainty of a measurement can be estimated using a numerical simulation of the imaging process of crystalline materials. This is achieved by establishing a conditional distribution on the measured quantity given a set of simulated virtual microstructures and computational models of the characterization process. This conditional distribution is then applied in a Bayesian construct to determine the distribution of possible true values associated with a given measured value. This method is applicable to not only grain size measurements but any measurement (e.g. aspect ratio, perimeter) which can be made on segmented microstructural images, providing a valuable tool for standardizing error evaluation for these measurements. Furthermore, it leads to a simple construction of full feature distributions without the use of histograms or distribution fitting algorithms. Finally, it provides estimates for the measurement error for objects as small as 5 Px, removing much of the ambiguity of lower resolution datasets. A basic analytical model for this method, showing the variation in area measurement for rectangular objects, is developed in Sections 3.2 and 3.3. This model is then expanded to incorporate more general grain and object structures in Section 2. Finally, in addition to grain size measurements the model is applied to aspect ratio and perimeter measurements in Section 3.4.

Distributions of material characteristics
We begin by defining as a random geometric component that is observed as a discrete object during characterization. Examples of components from materials characterization include grains, inclusions or twins. is treated as a random variable, because it is not typical that the component is fully understood before it is observed. It is therefore viewed as a component randomly selected from an infinite set of possible components that are associated with a given system under characterization. Each component is described by a vector Γ, which contains a set of characteristics that are measured from the component: Examples of such characteristics include component size, number of sides, aspect ratio or perimeter length. The sample space of Γ is discretized into vector ; = 1, 2, … . By integrating over the probability distribution function describing the random components ( ) for all that are a member of the component space Ω , the probability that Γ falls within a given interval on this discretized space is found to be: where [⋅] is the indicator function, set equal to 1 if the expression in the brackets is true and 0 if false. To simplify notation in this and subsequent equations, we express the event that ≤ Γ ≤ + Δ as Γ = .
Quantification of Γ for a randomly selected component is typically the final goal of the characterization, but materials characterization only provides estimates of the measurementsΓ for a given component . Therefore, a relationship between these estimatesΓ and the true characteristics Γ is needed.

F I G U R E 1
Illustrations of the process of discretizing a shape, drawn in black. The sampling grid (…) shown has a Δ = 5, random shift along x and y, and no rotation about the origin.

Distribution of measured approximations to material characteristics
For practical purposes, measurement of Γ is performed from characterizations that provide an approximation to each component, s. Frequently, is discretized onto a sampling grid through a discretization operation ( , ), as illustrated in Figure 1, which simulates data collection processes that rely on a 2D pixelized image. The sampling grid, = (Δ , , Θ), is defined by a sample point spacing Δ , an in-plane shift vector that lies in the range (0, Δ ) along each coordinate direction and a rotation Θ of the grid relative to the component. This discretization process (Δ , , Θ) introduces random uncertainty into measurement, due to the random in-plane shift and random rotation Θ. The characteristic Γ for a given component is therefore approximated byΓ( = ): Similar to Γ, the set of possibleΓ is discretized aŝ∶ = 1, 2, …̂, so that the eventΓ =̂is equated to the event ≤Γ ≤̂+ Δ̂. The probability thatΓ =̂for component at a resolution level Δ is calculated by integrating over all possible grid orientations and shift vectors : wherê(̂, , Δ , , ) = [ ( ( , (Δ , , ))) =̂] (6) and the functions ( ) and Θ ( ) are the probability distribution functions describing the shift vector and the rotation , respectively. The shift vector and orientation are assumed to be independent, both following a uniform distribution. Each component of the shift vector lies on the range [0, Δ ] and the orientation lies on the range [0, 2 ]. Equation (5) can therefore be recast as: where is the number of dimensions of the component . This probability for a randomly selected component is found by integrating over the component distribution ( ):

Conditional distribution on the true characteristics
The indicator functions inside the integrals in Equations (2) and (8) are easily combined to find the probability that bothΓ =̂and Γ = : Substituting Equations (8) and (9) into the general equation for conditional probability: This expression gives the probability of a true component characteristic falling into the specified range, given a particular measurement value. This equation is the foundation for subsequent Bayesian analysis of a finite set of measurements where the distribution of components, ( ), is a prior distribution. In such analyses, it is typically assumed that the prior distribution is a uniform distribution across all feasible values of . This assumption is rooted in the idea that no information is known about the components beforehand, so any component is equally likely as the next. Previous work in Bayesian approaches suggests that this conditional probability is not very sensitive to the prior. This will be studied in more detail in the context of a numerical example in the next section.

CALCULATION OF THE CONDITIONAL PROBABILITY INTEGRAL
A major challenge to directly implementing Equation (10) is that closed-form expressions for̂and are difficult to identify for most realistic component families. Even for these simple components for which closed-form expressions for̂and are available, the integration and subsequent solution are cumbersome. Examples of such cases are shown in Section 3.1 which develops a solution for characterizing the length and area of 1D lines and 2D rectangles, respectively. To expand the applicability of this approach to arbitrary component shapes and characteristics, a simulation-based approach based on a discretized version of Equation (10) is introduced in Section 3.2.

An analytical model
Equation (10) can be applied directly for a few very simple cases. For example, consider a 1D line segment of random length measured with a fixed sample spacing Δ = 1, in which an integer number̂sample points are recorded to lie within that line segment. The value = is a realvalued random variable that lies between̂− 1 and̂+ 1.
We assume here that the prior distribution of the actual length ( ) is uniformly distributed across a range of values from zero to length . Equating to Γ and̂toΓ and recognizing that there is no grid rotation in this 1D configuration, the expression in Equation (10) simplifies to: where the function ( , )∕ was recognized to be equivalent to the Dirac delta function ( − ), which allows further simplification of this expression. Comparing the F I G U R E 2 Examples of the conditions of Equation (12). The combined length of and must be between̂and̂+ 1.
length to the shift distance and adjacent pointŝ− 1, and̂+ 1, the function̂is found to be (see Figure 2): Substituting Equation (12) into Equation (11) and completing the integrations, the probability density function describing the true length given the measured lengtĥ =̂is calculated as: Equation (13) is a triangular distribution with an expected value, ( ) =̂. Further expanding the model to two dimensions, consider a rectangle with random dimensions 1 Δ × 2 Δ with axes aligned with the grid so that there is no rotation , and with random measured valueŝ 1 Δ ×̂2Δ . If we assume the actual side dimensions are independent, then the conditional distribution on the true area given measurementŝ1 =̂1 and̂2 =̂2 is 27 : The PDF describing the area is calculated by substituting Equation (13) into Equation (14). Because these functions are piecewise linear, the individual integrations are straightforward, but it requires care to account F I G U R E 3 Probability density function ( ) describing the true distribution of a rectangular component given measurements of 2 × 2, 3 × 3, 4 × 4, and 5 × 5 pixels.
correctly for the intervals on the piecewise integrations. For the special case of̂1 =̂2 =̂, the probability distribution function describing the true area becomes: where =̂2 − 1 + , Figure 3 shows some of the conditional probabilities evaluated using Equation (15). While the above formulation is cumbersome, it is useful in that it provides insights into the distribution of the true component area given a set of area measurements. In particular, these results suggest that the distribution of true area given a particular set of measurements is something akin to a bounded Gaussian distribution for larger size measurements. It is more skewed for very small measurements such aŝ = 1. The limitation to rectangular components in this analytical approach significantly reduces the applicability of this formulation to true microstructural components that are not typically rectangular. With this in mind, the next section describes a simulation-based approach to approximating the distribution of true component sizes given pixelized measurements, for a range of different component shapes.

3.2
Simulation-based approach to calculating the conditional probability Using standard image discretization, the functionŝand can be evaluated explicitly for any given component , grid discretization Δ , grid orientation and grid shift . Therefore, an approximate solution to Equation (10) is enabled for a family of 2D components using a discretized integral: Most of this summation itself is very straightforward to implement. The main challenge computationally is discretizing the set of possible component shapes, . In general, these components are not universal quantities and they will be dependent on the type of microstructure under evaluation. For example, the component family for a 2D image of a porous material might be a set of circular shapes with varying size. On the other hand, microstructures with long components such as fibres or twins might be better described as elliptical shapes with varying size and aspect ratio. Therefore, when evaluating Equation (17), selecting an appropriate set of components is important. The more closely the set of components represents the underlying microstructure, the more accurate the estimated conditional probabilities will be.
This work focuses on polycrystalline materials with grain components that are typically polygonal with varying size and aspect ratio. Voronoi tessellations are commonly used to represent synthetic microstructures of polycrystalline materials, and their ability to match grain size F I G U R E 4 Examples of shapes taken from Voronoi tessellation. Each shape seed, n, was scaled to produce over 600,000 unique shapes with sizes. measurements has been shown to be reasonable. 28 Therefore, Voronoi cells are used here to serve as a reasonable approximation for the component set. This was done by first randomly selecting individual cells from a 2D Voronoi tessellation to serve as shape seeds, 1 . To ensure that the set of components spans a sufficiently wide range of possible sizes, 2 , and aspect ratios, 3 , each individual shape seed was scaled and stretched to produce a larger set of components, as shown in Figure 4. The result is a set of components, ∶ = 1, 2, … , where each component was formed through a linear combination of possible shapes 1 ∶ = 1, 2 … 1 , sizes 2 ∶ = 1, 2, … 2 , and aspect ratios 3 ∶ = 1, 2, … 3 . The total number of components was therefore: and because no dependence between these three characteristics was assumed, the distribution of component, ( ), can be represented as the product of three independent distributions: where each of the individual characteristics are assumed to follow a uniform prior distribution: Using other initial priors is straightforward. Some alternatives have been considered and a study of their effects on the resulting conditional distribution is detailed in Section 3.4.1, which will show that sensitivity of these results to the selection of the prior distribution is low.

Measurement definitions
The last step in evaluating either the continuous or discretized conditional probability is determining what measurements, (), are of interest and how to calculate them. For each component, , certain geometric quantities such as the area and perimeter length are easily computed using basic geometry. The size is defined by the area inside the edges, and the perimeter is merely the sum of the edge lengths between the vertices. Other properties such as aspect ratio are not universally defined because of the irregular nature of the shape. There are various techniques for estimating the aspect ratio for non-regular geometric shapes. The most commonly used method is drawing a bounding box around the shape and taking the aspect ratio as the ratio of the side lengths, however this method is sensitive to the orientation of the shape relative to the horizontal plane. 18 To control for this sensitivity, the axes of bounding box can be aligned with the principal axes of feature prior to computing the aspect ratio.
Calculating the properties of the discretized components is similar. The size is defined as the sum of the total number of pixels, N, times the area of each pixel, Δ , and the perimeter can be found by adding the exterior side lengths of each boundary pixel. The authors note that it is well known that this simple method of computing the perimeter erroneously over estimates the true boundary length. More exact methods could be used as many studies have analysed the local neighbours of each boundary pixels to better predict the location and curvature of the boundary 14,21,22 ; however, the simple perimeter measurement is still commonly used and was selected for its simplicity. Finding the aspect ratio of the discretized objects can also be done by orienting a bounding box along the principal axis and then computing its aspect ratio. For the discretized object the principal axis can be found by finding the rotation which minimizes the object's moment of inertia, defined as: where is the number of pixels in the component, and are the coordinates of each pixel, ( 1 , 2 ) is the location of the centroid of the pixelized component and Δ 2 is the area of each pixel.

Simulation-based conditional probability results
To evaluate Equation (17), a total 30 different shapes were selected ( 1 = 30), and each was scaled to produce grain F I G U R E 5 Three different assumed prior distributions (shown in A) all produced nearly identical conditional measurement distributions (shown in B) for an assumed measured size of 100 Px. sizes ranging from 1 Px to 1500 Px in 1 Px increments ( 2 = 1500), and aspect ratios ranging from 1 to 5, with a step size of 0.01 ( 3 = 401). The bounds of these domains were selected to encompass typical ranges for grains in a polycrystalline material, noting that changes to these bounds are straightforward to implement. In total, this process led to a set of ∼ 18 million components, each of which was then sampled 240 times using different semirandomly generated sampling grids (Δ , 1 , 2 , ). The result was a set of conditional probabilities which map a given measurement to a range of probable true values.

3.4.1
Effects of prior distribution Figure 5B shows the probability distribution of the true component size given a measured size of 100, for different prior assumed prior distributions 2 ( 2 ) on the size, shown in Figure 5A. Despite varying significantly, all the prior distributions produce very similar solutions in Figure 5B. In a similar fashion, Figure 6 shows the effect on the conditional size distribution of changing the prior distribution describing aspect ratio, 3 ( 3 ). Again three different priors on aspect ratio all yielded approximately the same result conditional distribution on size.
Various combinations of prior distributions on size and aspect ratio were examined, and no meaningful variations in the resulting conditional distribution describing size were found. Changing the prior shape distribution, 1 ( 1 ), is less straightforward. For the assumed crystalline material structure, there is no logical reason to assume that one shape seed should be favoured over another; therefore, assuming uniform distribution is justifiable. However, changing the number, a different shape seed used can have an effect on this prior distribution. Figure 7 shows the effect of specific shape selection on the conditional size distribution for a measured size of 125 Px computed using 1 = 1 for the six different shapes shown in Figure 4. The variability across individual shapes is small, but is more noticeable than that observed when changing the prior distributions of size or aspect ratio. For perimeter measurements, the difference is even more noticeable. Figure 8 shows conditional perimeter distribution (measured at an equivalent resolution) for the same six shapes. Different shapes lead to somewhat different distributions. This is in contrast to what is seen in Figure 7 where the shape had very little effect on the distribution of size. This effect can be reduced by adding additional shape seeds to the prior shape distribution, which eventually leads to a convergence of the conditional distribution, as shown in Figure 9. Convergence was evaluated via the root mean squared error (RMSE) between the conditional probability distribution corresponding to 1 = F I G U R E 6 Using different prior distributions of aspect ratio, 2 (), did not have any significant effect on the conditional distribution for size.

F I G U R E 7
The conditional size distribution (for an object with a measured size of 125 units) shown when 1 = 1 for six different shape IDs. The averaged (black) distribution was computed using 1 = 30 with each of the 30 unique shape seeds being equally weighted. and the conditional probability distribution corresponding to 1 = + 1. Ultimately, 30 unique shapes were selected to serve as the component space, as the relative change between 1 = 29 and 1 = 30 was ≃ 1%.
Studies of the effects of prior distributions were repeated for the conditional aspect ratio distribution and the condi- tional perimeter distribution. In general the results were similar, with the prior distributions having little effect on the converged conditional distribution. The notable exception occurs in poorly framed cases where an assumed prior has zero probability within the domain where actual component measurements exist; under these conditions, the solution will be entirely incorrect. Assuming a uniform distribution across the entire feasible domain works well for F I G U R E 9 Curves showing the relative change in computed conditional measurement distribution as the number of shapes in the component space increased. The conditional distribution was evaluated for measurements of: size (blue), aspect ratio (red) and perimeter (yellow). All showed a convergence to less than 1% with the conditional size distribution converging for 1 = 6. The convergence of the perimeter measurements were the slowest (see Figure 8).

F I G U R E 1 0
Contour plot showing the decreasing width of the conditional measurement distribution for aspect ratio as measured size increases. these analyses, because this assumption ensures that such spurious results will not occur.

Size effects
When studying the conditional aspect ratio distribution, it became apparent that there was a relationship between the measured size (̂S IZE ) of an object and the conditional aspect ratio distribution. This is illustrated in Figure 10 by The conditional aspect ratio distribution for a measured aspect ratio of 1.5 evaluated for serval measured sizes. By further conditioning the aspect ratio distribution on the measured size, a more precise range of possible true aspect ratios is achieved compared to the baseline case where all measured sizes are considered. In general, components with smaller measured sizes have much wider distributions. This dependence is further illustrated in the subplot showing the coefficient of variation for various measured aspect ratios as a function of the assumed measured size.
a contour plot of the conditional probability distribution of a given measured aspect ratio of 1.5, as a function of the measured size of the component. The width of the distribution increased dramatically for measured size below 50 Px/component. This is shown in Figure 11 where the conditional aspect ratio distribution (for a measured aspect ratiôA R = 1.5) is evaluated for different ranges of measured component size. A small component (25 Px in size) is seen to have a much wider range of possible true aspect ratios for the given measured aspect ratio compared to the large component (350 Px). It therefore makes sense to further condition the conditional aspect ratio distribution on the known measured size. This method yields a more precise prediction of aspect ratio distribution, compared to evaluating the aspect ratio over the entire size domain.

CONSTRUCTION OF MATERIAL FEATURE DISTRIBUTIONS FROM DATA
The conditional distribution of the true measure Γ, given an observationΓ =̂, provides a tool for calculating the distribution on Γ given a set of experimental measure-mentsΓ =̄∶ = 1, 2, … . In particular, the law of total probability suggests that the distribution on the true characteristics can be estimated as: F I G U R E 1 2 Histogram of grain size, based on data from an EBSD scan of Magnesium AZ31B with approximately 90,000 Px, along with the associated size distribution estimated using the conditional measurement distribution (in black). The data were collected on a TESCAN MIRA3 GMU FEG-SEM using hexagonal grid sampling, comprising a little more than 1000 individual grains after removal of boundary grains. 29 . and since each measured data pointΓ =̄can be viewed as equally likely, then Clearly, the more data collected (larger ), the more accurate this estimate becomes. If relatively few data points have been collected, the resulting prediction of the feature distribution may be noisy. However, as more data are incorporated, this prediction converges towards the true distribution.
To demonstrate the ability of Equation (22) to predict feature distributions, this expression was applied to a set of grain size measurements from an EBSD scan of Magnesium AZ31B. 29 Because this scan was conducted using a hexagonal grid, the sampling process for generating the conditional measurement distributions from the set of digitally generated Voronoi tessellations was adjusted accordingly (Equation 17). Sampling on a randomly shifted and randomly oriented hexagonal versus square grid is a simple change, requiring only a size adjustment for each pixel in the process of estimating feature measurements. Applying these conditional measurement distributions to the overall condition distribution (Equation 22), the computed grain size distribution is shown in Figure 12. This computed distribution provides a smoothed approximation to the discrete grain size data that show good agreement; however, the true grain size distribution is unknown, so it is difficult to quantify the accuracy.
To demonstrate the accuracy of this method for constructing feature distributions, synthetic datasets with known feature distributions were used. This was done by selecting a unique shape seed from a Voronoi tessellation and scaling that shape seed by sampling from prescribed distributions for the grain size and the grain aspect ratio. The following steps were followed to generate sample points in the synthetic dataset: (1) a random shape was selected; (2) the shape was scaled by random variables drawn from the grain size and aspect distributions, generating a component (or grain) ; (3) a discretization operation, ( , (Δ , , Θ), was performed to generate an image of the grain for a randomly selected shift vector and grid orientation and (4) any desired measurements (Equation 4) of the grain were performed and recorded. This process was repeated until a predetermined number of grains and/or pixel counts were exceeded.
During the generation of the synthetic datasets, it was assumed that each of these true feature distributions was independent. It is possible that complex microstructures may have feature distributions which are not independent. Such microstructures could be simulated by sampling from a joint conditional distribution. However, in both cases, the computed feature distributions can be expected to have the same amount of error, as long as the set of components, , used to compute them spans the full range of both the independent and joint distributions.
The analysis was performed several times, using different sample point spacings Δ , so that the effect of resolution could be analysed. This resulted in a set of measurements for each of the grains at multiple resolutions. Figure 13 provides a histogram corresponding to a synthetic dataset that meets all the requirements of ASTM 2627, 8 which recommends a minimum average resolution of 500 Px per grain. The grain sizes were sampled from a lognormal distribution with parameters = log(525) and = 0.15, corresponding to a mean grain size of 531 Px. The simulated dataset was constructed by measuring 750 grains comprising a total of ∼ 400, 000 pixels, using a spacing of Δ = 1. The first entry of Table 2 shows the mean and standard deviation of the average grain size computing using sections 13 and 14 of ASTM 2627, with an error in the mean relative to the true mean of 531 Px of 0.5%.

Comparison to ASTM 2627
Also plotted in Figure 13 is a dataset collected and processed using the conditional distribution approach proposed in this work. These data are collected at a lower resolution, using a spacing of Δ = 4.47. Keeping the total F I G U R E 1 3 Dataset meeting the recommendations of ASTM 2627 compared to a predicted distribution using a low-resolution dataset (∼ 26 Px/F) and the conditional measurement distribution.

TA B L E 2
Expected value of mean grain size sampled at different resolutions. Results for the conditional measurement distribution were averaged over 10 simulations. number of pixels constant, this resolution results in an average of only 26 pixels per grain (Px/F) but a much larger number of grains (∼ 15, 000) sampled. Processing these data using the appropriate conditional distributions leads to a size distribution that accurately represents the true data. Using the computed distribution to estimate the mean grain size led to a similar (in this case slightly less) error than the 531 Px/F resolution dataset (see Row 2 of Table 2). This table also shows results when averaging over 10 different datasets, using both the ASTM 2627 standard and the data processed from the conditional distribution. Again, the level of error is very small using both approaches, though there is a slightly higher error observed in the data based on the conditional distribution. These results demonstrate that using the conditional distribution based on simulated data can be applied to the experimentally obtained data, in order to account for the variability of low-resolution measurements. This enables reconstruction of the feature distributions that closely match those obtained using larger high-resolution datasets, benefiting from an increase in the number of grains that can be sampled with the same number of total pixels. Figure 14 explores the effect of the data size (in terms of total number of pixels collected) and resolution (defined in terms of average pixels per grain, Px/F). These results assumed a lognormal size distribution with parameters = log(225) and = 0.48. In absolute terms, the large 1.5M Px dataset is the better of the two, which is to be expected. However, the 42 Px/F resolution performs much better with the small dataset of 75K data points. In fact, this resolution performs almost equally as well with 75K Px as the 125 Px/F resolution does with 1.5M Px. Figure 15 shows the measurement error as a function of the total number of pixels in the dataset. The error between the predicted distribution using the conditional probabilities (̂) and the assumed true distribution ( ) was calculated using the RMSE:

Size measurements
and normalized to a percent error (by dividing by the sum of the densities); it can be view as the percent of F I G U R E 1 4 Constructed feature distributions for two different dataset sizes (A) 75,000 and (B) 1,500,000 Px. Construction of data sampled at a lower resolution yielded a smoother size distribution. As the total number of sample points increase, the higher resolution measurements begin to outperform lower resolution measurements.

F I G U R E 1 5
Average error in the measured size distribution, compared to the true distribution computed for an increasing number of pixels. Higher resolution data limit the total number of sampled grains, leading to a higher average error. Shaded regions show the 95th percentile range for each resolution.
non-overlapping area of the two densities. It is plotted for five different resolutions, each averaged over a 100 trials. A 95% confidence interval for each point is indicated by the lighter coloured shading above and below the curves. The lowest resolution data at 21 Px/F outperformed the higher resolution datasets by a considerable margin, until around 1.2M pixels of data were collected, at which point most distributions converged to a very good approximation of the true distribution. The highest resolution of 251 Px/F on average still had measurably higher error than the other resolutions (≈ 2% higher), even at a total sample size of 1.5M Px. These results can be interpreted as follows: When sampling with a resolution below 100 Px/F, there are more grains in the dataset, even if they are poorly resolved. Also, the conditional distribution on the true measure given the data from a lower resolution feature has a higher variance, which has the effect of smoothing out the predicted probability distribution between adjacent observations in the data. At higher resolutions, the increased confidence resulting from a more finely sampled grain results in a conditional distribution with a lower coefficient of variation. This leads to predicted distributions that are noisier because they perform less smoothing between adjacent observations of size. This effect is readily apparent in Figure 14A. It is also important to note that size is a measure that is not sensitive to the shape of the grain, so that a higher resolution observation of the grain is less likely to provide significantly different information. Other features such as aspect ratio and perimeter are expected to be more heavily influenced by resolution.

4.3
Aspect ratio measurements Figure 16 shows the error between the prescribed aspect ratio distribution (a truncated exponential with parameter = 0.5 and range [1, 4.5]) and the predicted aspect F I G U R E 1 6 () exhibits many of the same trends as (), however due to the higher sensitivity to measured size (see Figure 11), lower resolution data preform poorly compared to higher resolution data. ratio distribution using the conditional distribution. As explained in Section 3.4.1 the conditional aspect ratio distribution was further conditioned on the measured size. This resulted in low-resolution data (< 50 Px/F) quickly reaching an asymptote after which additional data points did not improve the predicted feature distribution. The 42 Px/F resolution outperformed the resolution of 21 Px/F even at very small sample sizes (5000 total Px). Similarly, for datasets larger than 250,000 Px, the optimal resolution increased to ∼ 125 Px/F.

Perimeter measurements
When generating shapes, the true perimeter distribution was not independently prescribed because the perimeter is dependent on the defined size and aspect ratio. Therefore, the distribution of perimeter lengths was calculated using the known perimeters from all 18 million components (grains) sampled when generating the grain set in Section 3.2. This is referred to as the true perimeter distribution. In Figure 17, the distribution of perimeter lengths, computed with the conditional measurement distribution and simulated data collected at ∼ 251 Px/F, is compared to a histogram of the true perimeter distribution. The results show a good correlation between the true and estimated distribution despite the known bias that exists with the defined method of measuring perimeter. Figure 18 shows the error in the predicted perimeter distribution. An examination of the detailed window shows that for a dataset consisting of more that 200k pixels, an approximate resolution of 125 Px/F is needed. This optimal sampling is similar to that found for aspect ratio, but it is higher than that found for size distributions. F I G U R E 1 7 Construction of the perimeter length distribution for a simulated dataset. Despite differences in bias, the conditional probability formulation was able to correct both measurements. The mean perimeter lengths were within less than 1% of the true value. The measurement error of the distribution as a whole was lower for the simple perimeter measurement by just over 1%.

F I G U R E 1 8
() has the lowest resolution cross overs of the measurements considered. For low resolutions, the error plateaued above 4%.

General distribution prediction trends
The general trend appears to be that more complex feature distributions (like perimeter and aspect ratio) require higher resolutions to resolve than the simple size distribution. However, all three distribution types showed that accurate prediction can be made using sampling resolutions lower than those recommended by ASTM 2627. Results also show that for all measurements, every sampling resolution eventually reaches an asymptotic value, at which more data collection does not lead to a significant improvement of the predicted distribution. The rate of F I G U R E 1 9 The best preforming sampling resolution for each measurement type.
convergence to this asymptotic value is dependent on the measurement type, sampling resolution, and underlying true feature distribution.
It is worth noting that the results shown are specific to the assumed conditions. One powerful application of this approach is the ability to estimate the optimal sampling resolution for various experimental constraints. Figure 19 shows the resolution that leads to the least error in the measurement distribution, for a fixed total number of pixels and for each measurement type. This clearly highlights how higher resolution is preferable for aspect ratio while lower resolution is preferable for the size of the component (or grain in the case of the current example). These results can inform an ideal sampling resolution for a particular measurement which might have similar feature distributions. For materials with different feature distributions, the same process could be repeated using a different set of assumed ground truth distributions to obtain a better estimate of the proper sampling resolution.

CONCLUSIONS
The use of conditional probabilities to estimate feature distributions is a data processing methodology that provides accurate distributions. Specifically, the framework is shown to accurately estimate the grain size, aspect ratio and perimeter feature distributions from synthetically generated datasets using Voronoi tessellations, and it is also applied to estimating the grain size distribution from a 2D magnesium EBSD dataset. The methodology accounts for the inherent measurement error associated with discrete sampling, providing a standardized method for constructing the feature distributions across varying length scales, and a consistent methodology for estimating the uncertainty for various types of measurements.
The method further showed that the use of highresolution data collection has an application-dependent impact on the accuracy of the predicted feature distributions, especially when dataset sizes are limited. Highresolution datasets were found to be limited by the total number of microstructural components sampled. The conditional probabilities showed how the gains obtained from high-resolution data were offset by the associated increase in sampling error due to this limited sampling. For the Voronoi cell geometries used in the trial datasets, it was found that sampling resolutions with much lower average feature sizes than those recommended by ASTM 2627 (∼ 500 Px/grain) were best able to reconstruct the target distributions. ISO standard 13067, which recommends a minimum of 10 Px across an average feature (i.e. > 80 Px feature), provided a closer estimate of the optimal sampling resolution; however, even lower resolutions were also used effectively.
This effect was exhibited to varying degrees for all three measurements of size, aspect ratio and perimeter. However, when making geometric measurements to estimate the aspect ratio and perimeter distributions, the measurement error was higher, resulting in higher optimal sampling resolutions. This can be attributed to the increased complexity and sensitivity of these measurements to the local grain geometry. By analogy, it can be expected that microstructures with more complex geometries than these Voronoi microstructures, such as those containing twins, would have a more stringent optimal sampling resolution for all three measurements. A detailed examination of such structures is certainly possible simply by modifying the underlying shapes outlined in Section 3.2.
Finally, the natural extension of the method from analysing 2D images to 3D volumes would certainly provide additional insights. Evaluating the conditional probabilities in 3D is not conceptually more complicated than in 2D, but evaluating these probabilities would be computationally expensive and requires significantly more analysis time. It may be possible to reduce the computational effort of such calculations by efficient reduction of geometric shifts and rotations through any material symmetries that might exist. Even so, the extra computational effort in 3D may be valuable, when considering the significant cost and time associated with experimental collection and manipulation of large 3D microstructural datasets.