Parent grain reconstruction from partially or fully transformed microstructures in MTEX

A versatile generic framework for parent grain reconstruction from fully or partially transformed child microstructures has been integrated into the open-source crystallographic toolbox MTEX. The framework extends traditional parent grain reconstruction, phase transformation and variant analysis to all parent–child crystal symmetry combinations and allows the programmatic creation of individual workflows to reconstruct parent grains.


Introduction
Depending on the chemistry and thermomechanical processing history of a material system, its free energy difference may lead to the phase transformation of a pre-existing parent phase with a given crystal symmetry to a new child phase with a similar or different crystal symmetry (Porter & Easterling, 1992). In many instances, this phase transformation occurs via the operation of an orientation relationship (OR). An OR refers to the coherent geometric parallelism between specific planes and directions of parent-child crystal symmetries on either side of their common boundary segment (Bhadeshia, 1991). In all parent-child crystal symmetry combinations, one or more favoured ORs exist that provide the best fit at their boundary segment interfaces and enable crystallographic phase transformation between them.
In the late 1800s, the now well known martensitic transformation in steel was discovered (Parr, 1965). It involves a phase transformation from face-centred cubic (f.c.c.) parent austenite () to body-centred tetragonal (b.c.t.) child martensite ( 0 ) via the operation of different ORs. Of these, the Bain (1924), Kurdjumov-Sachs (K-S) (Kurdjumow & Sachs, 1930), Nishiyama-Wassermann (Nishiyama, 1934) and Greninger-Troiano (Greninger & Troiano, 1949) ORs are the most frequently reported. To serve as an example, the K-S OR between austenite and martensite is expressed as f111g jj f110g 0 , h110i jj h111i 0 . In this case, the h110i and h111i 0 directions lie in the f111g and f110g 0 planes, respectively. The crystal symmetries of austenite and martensite are such that, when the K-S OR is operative, a parent grain with ISSN 1600-5767 a given orientation may transform to any of 24 uniquely oriented child 0 grains. The latter are referred to as child orientation variants, or more simply as variants. Depending on the circumstances of the phase transformation, variant selection may occur when only a few of the theoretically predicted child orientation variants dominate the partially or fully transformed microstructure.
The martensitic phase transformation has been harnessed to increase the mechanical strength of a wide range of commercial alloys (Lo et al., 2009;Edmonds et al., 2006). The increase in mechanical strength is obtained by a Hall-Petchtype hardening effect where the hierarchical subdivision of parent grains into child martensitic domains results in a decrease in the effective grain size of the alloy (Morito et al., 2006;Swarr & Krauss, 1976). Depending on the alloy type, further strengthening may be achieved by interstitial solidsolution strengthening (Winchell & Cohen, 1962;Krauss, 1999) and/or increasing the dislocation density in the retained parent and child phases by plastic strain to accommodate the volume mismatch between them (Villa et al., 2018).
The above example of martensitic transformation is representative of a diffusionless displacive mechanism and signifies that (i) the chemical compositions of the parent and child phases are similar, (ii) the atoms in the parent and child unit cells maintain their sequence and atomic correspondence, and (iii) a shape change consistent with the parent-child crystal symmetry combination requires accommodation (Bhadeshia, 1991). On the other hand, phase transformations that operate by diffusion-and growth-based mechanisms occurring at relatively high temperatures may also involve an OR. Such mechanisms involve elemental diffusion based on their preferential solubility in the parent or child phases which, in turn, leads to differences in chemical composition and the loss of atomic correspondence between them. An often-cited example of such a mechanism is the parent to child phase transformation during the cooling of Ti and Zr alloys. Regardless of their displacive or diffusional origins, phase transformation mechanisms tend to involve ORs and variants.
For most of the 20th century, uncovering ORs and analysing local groupings of child orientation variants was only possible by laborious manual X-ray diffraction (Kurdjumow & Sachs, 1930;Nishiyama, 1934) and transmission electron microscopy (Sandvik & Wayman, 1983) work. The continuous development of electron backscattering diffraction (EBSD) (Dingley, 1984) from the 1980s onwards has enabled the mapping of entire microstructures and the characterization of a statistically significant number of parent and child orientations and morphologies (Kitahara et al., 2006).
With the widespread adoption of EBSD as a routine materials characterization technique, the first algorithms to reconstruct the parent phase from child orientation variants were concurrently developed to enable (i) the analysis of parent phase microstructures prior to transformation and (ii) variant analysis in the case of fully transformed microstructures. Humbert et al. (1994) focused on child to parent reconstruction in Ti and Zr alloys, and later, Cayron et al. (2006) were the first to reconstruct parent austenite from child martensite in steel. Since then, various reconstruction algorithms have been developed [examples include those reported by Miyamoto et al. (2010), Germain et al. (2012), Gomes & Kestens (2015), Nyyssö nen et al. (2018, Pham et al. (2015), Huang et al. (2020), Giri et al. (2019), Ranger et al. (2018), Bernier et al. (2014) and Wang et al. (2019)], with each new or modified iteration claiming improved performance in reconstruction accuracy and/or computational efficiency compared with previous implementations.
Of the many strategies for parent grain reconstruction that have been presented in the scientific literature to date, several have tended to be proprietary software solutions for a limited number of ORs and/or parent-child crystal symmetry combinations. Consequently, the motivating factors for the present work are (i) the implementation of a generic framework for parent grain reconstruction in the open-source crystallographic toolbox MTEX (Bachmann et al., 2010), and (ii) the extension of parent grain reconstruction, phase transformation and variant analysis to all parent-child crystal symmetry combinations. The implementation features different parent reconstruction methods that may be called on and combined by users to create individual workflows to obtain a confident reconstruction of parent phase microstructures. The aim of the present paper is to introduce the overall framework, while detailed explanations of the computational methods will be part of a follow-up paper.
Following a brief overview of the common approaches to parent grain reconstruction, this work introduces the new parent grain reconstruction features in MTEX and the add-on software suite ORTools . The latter comprises tools for OR discovery and analysis as well as variant analysis, and plots publication-ready figures of microstructures that have undergone partial or full transformation.
The parent grain reconstruction and analytical capabilities are demonstrated for three example alloys, namely (i) 0 -toreconstruction in a lath martensitic steel (Nyyssö nen et al., 2018), (ii) -toreconstruction in a Ti alloy, and (iii) a twostep reconstruction from 0 to hexagonal close-packed (h.c.p.) "-martensite to in a twinning and transformation-induced plasticity steel (Pramanik et al., 2018).

Theory of parent grain reconstruction
In this section, a parent orientation S R P is a rotation matrix R that describes the coordinate transformation from the parent crystal basis P into the specimen coordinate basis S. The formation of a child orientation S R C via phase transformation of the parent orientation is then characterized by a misorientation P R C that transforms the child coordinates into parent coordinates, ð1Þ csP ¼ crystalSymmetryð 0 432 0 ; ½3:3; 3:3; 3:3; 0 mineral 0 ; 0 Beta 0 Þ ð2Þ oriP ¼ orientation:cubeðcsPÞ ðCode 1Þ The Burgers OR C R P towards the h.c.p. child phase is defined as ð1Þ csC ¼ crystalSymmetryð 0 622 0 ; ½3:0; 3:0; 4:7; 0 mineral 0 ; 0 Alpha 0 Þ ð2Þ CRP ¼ orientation:BurgersðcsP; csCÞ ðCode 2Þ With P R C ¼ C R À1 P , the resulting child orientation is computed as If k = 1, . . . , K symmetry operators S k P for the parent phase and ' = 1, . . . , L symmetry operators S ' C for the child phase are applied on the OR, it results in K Â L symmetrically equivalent ORs, S ' C C R P S k P . For a particular parent orientation S R P , these produce a maximum number K of symmetrically non-equivalent child orientation variants, In cases when the OR transforms certain parent symmetries S k P into child symmetries S ' C ¼ C R P S k P P R C , a degenerate number of child variants occur, i.e. the number of variants reduces to K divided by the number of symmetry operators (k) that fulfil this condition. Note that for k ¼ 1, the matching symmetry condition is always fulfilled as it describes the identical symmetry operation. In MTEX, unique orientation variants are computed by either of the following two equivalent lines: In the specific example of the Burgers OR, the number of unique child variants is reduced from K = 24 to K = 12 as the twofold [110] cubic axis is transformed into the sixfold [0001] hexagonal axis.
The problem may now be reversed. Given an OR C R P and a child orientation S R C , the possible parent orientation variants S R P are obtained as In combination with the OR, when the crystal symmetries of parent-child phases match, the number of unique variants reduces by the same factor as above. In MTEX, the unique variants of the parent phase are computed by either of the following two expressions: In summary, the true parent orientation of an OR-based phase transformation cannot readily be determined from a single child orientation because of crystal symmetry. A parent grain orientation is determined with a high degree of confidence only when multiple unique and adjacent child grains that originated from the same parent grain via different symmetry operations are identified. This is the primary objective of all parent grain reconstruction algorithms. It follows that, if the number of possible orientation variants of the parent orientation increases, higher numbers of unique and adjacent child variants require identification. This is one of the reasons why 0 -to-parent grain reconstruction in martensitic steels is more challenging than, say, -toparent grain reconstruction in Ti or Zr alloys. 1 In this specific comparison, the former involves a transformation of point groups 432 to 432, whereas the latter requires a transformation of point groups 432 to 632.

Computational approaches to parent grain reconstruction
The computational approaches to parent grain reconstruction presented in the scientific literature to date can be roughly divided into two groups using either pixel- (Miyamoto et al., 2010;Bernier et al., 2014;Wang et al., 2019) or grain-level (Cayron et al., 2006;Germain et al., 2012;Gomes & Kestens, 2015;Gomes de Araujo et al., 2021;Pham et al., 2015;Huang et al., 2020;Giri et al., 2019;Ranger et al., 2018) EBSD map data. The first group of methods claim to be more accurate to local changes in the parent orientation, and are apparently superior in identifying annealing twins in austenite and in reconstructing ausformed alloys, whereas the second group of methods are said to be computationally more efficient. Perhaps because the sizes of EBSD maps are rapidly increasing, the most recently developed parent grain reconstruction algorithms from Nyyssö nen et al.  A class in MTEX, parentGrainReconstructor, was designed to contain the methods and properties needed for parent grain reconstruction. The methods enable the selection of different parent grain reconstruction strategies. The properties track the progress of reconstruction and include the OR, the orientation variants, the grain graph and applied weights, the cluster definitions, the reconstructed parent grains, and lists of grain identification numbers that link parent grains with their child grains.
Since all reconstruction algorithms in MTEX are grain level, the parameters chosen during the initial grain reconstruction step are important. Grain reconstruction in MTEX is realized by a Voronoi decomposition (Bachmann et al., 2010) that is robust against zero solutions (non-indexed or missing pixels) in EBSD maps. In the context of parent grain reconstruction, a threshold angle of, say, 3 is recommended as such a value (i) is small, (ii) is above the orientation noise floor to separate grains and (iii) avoids large orientation gradients within child grains. Following parent grain reconstruction, neighbouring parent grains separated by low-angle boundaries will be merged in any case.

Growth algorithms in partially transformed microstructures
In instances where a significant area fraction of evenly distributed parent phase is retained in partially transformed microstructures or obtained from other reconstruction algorithms, parent grain reconstruction is undertaken by a growth algorithm. The retained parent phase grains represent nuclei that are made to grow into the surrounding child phase. The misorientations at parent-child grain boundaries are compared with the theoretical OR [equation (2)] and neighbouring parent grains return a vote for the preferred parent orientation of a child grain based on the best fit. The collection of votes from all neighbouring parent grains allows the best fitting parent orientation to be determined via the application of voting metrics. This approach was applied by Cayron et al. (2006), Germain et al. (2012), Ranger et al. (2018) and Bernier et al. (2014) to grow the parent phase from previously calculated nuclei.
In MTEX, the two steps of (i) computing the votes for a parent orientation using neighbouring grains and (ii) determining the best fitting parent orientation are implemented in the methods calcGBVotes('p2c') and calcParentFromVote, respectively. Here the option 'p2c' indicates that only neighbouring parent grains to a child grain take part in the vote. The application of these methods is demonstrated in Section 4 via examples. It is reemphasized that the most crucial parameter for computing the vote is the definition of the threshold angle to identify potential parent-child boundaries.

Nucleation algorithms in fully transformed microstructures
In instances when the parent phase is absent, meaning in fully transformed microstructures, methods that generate nuclei from neighbouring child grains may be employed. In their simplest form, nucleation algorithms identify child grains sharing a boundary or triple junction and calculate their disorientation to the OR. The best fitting parent orientation between neighbouring child grains is registered as a vote. After the votes have been collected from all neighbouring child grains, the best fitting parent orientation is determined via the application of additional criteria.
In MTEX, the syntax for these two steps is similar to that used for growth algorithms. The methods calcGBVotes and calcTPVotes compute the votes based on grain boundaries or triple junctions, respectively. The determination of the parent orientations from the votes is done by the method calcParentFromVote.
The criteria for parent reconstruction in the initial algorithms by Humbert et al. (1994) on Ti and Zr alloys and Cayron et al. (2006) on steel required the identification of three child variants belonging to a common parent grain. The latter subsequently applied a growth algorithm to finalize the parent reconstruction. The criteria applied by Germain et al. (2012) comprised an iterative procedure that graphically searched neighbouring child grains with low disorientation to a given OR and computed the best fitting common parent orientation for these grains. Following the nucleation stage, a growth algorithm was applied to reconstruct the parent orientation for the remaining child grains. Most grain-level algorithms described by Pham et al. (2015), Huang et al. (2020), Giri et al. (2019) and Ranger et al. (2018) are based on this approach and apply various adjustments to improve specific parent grain reconstruction scenarios.

Graph clustering algorithms
While nucleation and growth algorithms begin reconstruction locally and evolve iteratively to the full map, graph clustering algorithms work on a global map scale right from the start. These algorithms assign an OR probability value as a weight to the edges of grain graphs. The OR probability is a parameter derived from the disorientation between grain misorientations and the OR. Subsequently, a graph clustering algorithm is applied to the grain graph by clustering together all child grains that are likely to belong to the same parent grain. The third step fits parent orientations to each of these clusters. Graph clustering reconstruction algorithms were previously proposed by Gomes & Kestens (2015) and Nyyssö nen et al. (2018).
In MTEX, these three steps are applied in the methods calcGraph, clusterGraph and calcParentFromGraph, respectively.

Example applications of MTEX to parent grain reconstruction
In this section, the syntax and functionality of parent grain reconstruction in MTEX are demonstrated for three example alloys that undergo well known phase transformations, namely 0 to in a lath martensitic steel, to in a Ti alloy, and a two-computer programs step transformation, 0 to " to , in a twinning and transformation-induced plasticity steel. Some of the more advanced plots are created using ORTools .
4.1. a 0 0 0 -to-c reconstruction in a lath martensitic steel The EBSD map data are used courtesy of Nyyssö nen et al. (2018). The microstructure, shown in Fig. 1, consists of lath martensite ( 0 ) and 27% unindexed points. Lath martensite is coloured according to the colour key for the enantiomorphic point group 432 (Nolze & Hielscher, 2016). The script used to reconstruct the parent grains from a child 0 microstructure is made available in the repository of .

Irrational OR determination
from EBSD map data. Before parent grain reconstruction can begin, the irrational OR from EBSD map data, which usually lies somewhere in between the rational K-S and Nishiyama-Wassermann ORs in lath martensite, needs to be determined. In this example, the accurate determination of the irrational OR from EBSD map data is necessary to increase the success rate of parent variant indexing, which in turn may also enable the detection of twinned parent grains, if any (Miyamoto et al., 2010).
In MTEX, parent grain reconstruction begins by constructing an object job from the parentGrainReconstructor class by supplying the ebsd data and the computed grains (Code 7.1). An initial guess for the OR is provided by assigning the K-S OR as a misorientation to the property p2c (Code 7.2). The method calcParent2Child (Code 7.3) then determines the irrational OR from EBSD map data via iterative refinement: Accurate irrational OR determination from EBSD map data is a necessary requirement for successful parent grain reconstruction. This is especially the case when an OR contains many orientation variants and/or deviates significantly from the closest rational OR, as shown in this example (Miyamoto et al., 2010).
The method calcParent2Child is an improvement of the iterative OR refinement procedure presented by Nyyssö nen et al. (2016). The refinement method iteratively identifies boundary misorientations that reasonably agree with the current best guess of the OR and refines the best guess in each iteration by taking the mean of the identified boundary misorientations. Once the refinement procedure has converged, the property p2c is updated with the OR that gives the best fit to the misorientations in the microstructure.
In Fig. 2(a), the disorientation distribution between martensitic grain misorientations and the misorientations of the initial K-S and refined ORs is shown. It is evident that the disorientation has been minimized by iterative OR refinement. It is also clear that no OR exists that reduces the disorientation for all grains to zero in the present microstructure. The disorientation from the refined OR is caused by local plastic deformation induced during phase transformation. Depending on the magnitude of plastic strain and the parent-child crystal systems involved, the disorientation typically ranges between 1 and 5 . The distribution in Fig. 2     shows a mean disorientation of 1.9 from the refined OR. Adapting the OR to reduce the disorientation for some grains would inevitably lead to larger disorientations for other grains. The (001) pole figure of the 24 martensitic variants of the refined OR is given in Fig. 2(b).

Building and clustering the weighted grain graph.
The disorientations between martensitic grain misorientations and the refined OR [ Fig. 2(b)] are plotted by colour coding the martensitic boundaries in Fig. 3 with a threshold of 5 . It is obvious that the network of boundaries with disorientations >5 corresponds to prior austenite grain boundaries. Although short segments along such boundaries have disorientations <5 , the latter are, on balance, likely to be prior austenite grain boundaries, on the basis of their connectivity to similar boundaries with overall disorientations >5 . Keeping the above in mind and considering the many orientation variants in this example, the low disorientation across the short boundary segments of prior austenite grain boundaries is ascribed to coincidence.
Using the methods described in Section 3.3, a graph of martensitic grains is subsequently built. Neighbouring grains are connected by edges that are weighted by the probabilities of them belonging to the same parent grain. The probability is derived from the disorientation shown in Fig. 3 and is expressed by a cumulative Gaussian distribution with a given mean and standard deviation. In MTEX, this functionality is integrated into the method calcGraph (Code 8.1).
After the graph has been built, a clustering algorithm is applied to identify clusters of strongly connected grains according to the above calculated probability using the method clusterGraph (Code 8.2). By default, this method features a Markov clustering (MCL) algorithm which simulates a random walk across nodes that connect neighbouring grains. MCL is an attractive choice for the current application as it is (i) an unsupervised algorithm, (ii) computationally efficient and (iii) resistant to noise (Gomes & Kestens, 2015). The OR probability assigned to the nodes is equivalent to the probability with which the MCL algorithm walks along the different nodes. 2 With each iteration of the random walk, nodes that connect grains belonging to the same parent orientation are gradually strengthened, whereas nodes connecting the grains that do not belong to the same parent orientation are gradually cut off. The resulting clusters are depicted by black boundaries overlaid on a semitransparent inverse pole figure martensite map in Fig. 4 The distribution of the disorientation histogram in Fig. 2   red outlines in Fig. 3) are divided into several clusters, and most clusters contain different martensitic variants. (i) All possible parent orientations are calculated by applying the inverse OR to each child grain orientation in the cluster as per equation (3). A common parent orientation is computed by minimizing the overall disorientation to a possible parent grain orientation that is common or close to all child grain orientations in the cluster. The area of the child grains is used as the weight in this fitting procedure.
(ii) The parent orientation of each child grain in a cluster is determined by calculating the parent orientation with the least disorientation to the common parent orientation of the cluster by applying the OR.
The procedure produces the reconstructed clusters in Fig. 5. The regions previously identified with <5 disorientation to the OR in Fig. 3 are regions with a common parent austenite orientation.

Evaluation and local reversion
of the reconstruction. After the common parent orientation of each cluster and the parent orientation of each child grain in the cluster have been calculated, the disorientation between them may be evaluated. This disorientation is plotted by applying a 5 threshold in Fig. 6.
Martensite grains with a high disorientation are likely to have been assigned to the wrong cluster in the above procedure. Very small clusters are also likely to yield an uncertain parent orientation. Consequently, the disorientation and cluster size criteria (and any others if defined by the user) are applied to martensite grains to revert such poorly reconstructed austenite grains using the method revert: ð1Þ job:revertðjob:grains:fit > 5 Ã degreeÞ ð2Þ job:revertðjob:grains:clusterSize < 15Þ ðCode 9Þ It follows that, after reversion, the remaining reconstructed austenite grains have a higher likelihood of being actual parent grains (see Fig. 7).  The disorientation between the common parent orientation of each cluster and the parent orientation of each child grain in the cluster with a threshold of 5 . The scale bar is 25 mm.

Figure 5
The reconstructed parent microstructure from child grain clusters shown in Fig. 4 using the method calcParentFromGraph. The scale bar is 25 mm. fraction of austenite grains was unsuccessful within the given confidence criteria (Fig. 7), the remaining reconstructed parent phase serves as a set of nuclei in a growth algorithm (see Section 3.1) within the reverted regions: ð1Þ job:calcGBVotesð 0 p2c 0 ; 0 threshold 0 ; 2:5 Ã degreeÞ ð2Þ job:calcParentFromVote ðCode 10Þ Fig. 8(a) is an example of this algorithm at work in a local region defined by the dashed white rectangle in Fig. 7. In this example, the white area corresponds to martensite grains that have two neighbouring parent grains and have not yet been reconstructed. In the method calcGBVotes, the boundary misorientations of all possible parent orientations of a child grain with neighbouring parent grains are computed and voting probabilities are assigned. The threshold angle of 2.5 marks the misorientation angle between a neighbouring parent orientation and the reconstructed parent orientation of the child grain at which the probability is 50%. After three iterations of Code 10, the reconstructed parent grain microstructure in Fig. 8 Although the microstructure is not fully reconstructed, the reconstructed areas have a high confidence. Depending on the microstructure, parent grain reconstruction may be continued with lower confidence criteria. It is apparent that regions located at or near the vertical and horizontal edges of the EBSD map were not reconstructed. This could be ascribed to the lack of neighbouring grains and unique child orientation variants in these regions.
4.1.6. Cleaning the parent grain microstructure and reconstructing the EBSD data. In Fig. 8  The remaining reconstructed parent microstructure after reverting certain grains with Code 9. The reverted regions are in white. The scale bar is 25 mm. The area outlined with a dashed line is shown in more detail in Fig. 8(a).  within any prior austenite grain. The misorientation between these fragmented grains is used to merge them to prior austenite grains by calling the method mergeSimilar with a threshold for the maximum allowed misorientation angle between neighbouring grains (Code 11.1). Subsequently, the method mergeInclusions merges small grains within a specified maximum area (Code 11.2).
ð1Þ job:mergeSimilarð 0 threshold 0 ; 7:5 Ã degreeÞ ð2Þ job:mergeInclusionsð 0 maxSize 0 ; 50Þ ðCode 11Þ In this way, child grain clusters containing common parent orientations (Fig. 8) are transformed into parent grains (Fig. 9). A distinguishing feature of these methods is that the merging process is tracked by the property mergeId . This property enables users to list the child grains belonging to a particular parent grain and is crucial for subsequent variant analysis. Evidently, some regions in Fig. 10 were not successfully reconstructed and thus remain unresolved. This is a result of the relatively conservative thresholds that were applied during reconstruction (Code 10). Larger thresholds will lead to the complete reconstruction of the parent microstructure, albeit with lower confidence. In the current framework, while a user can either choose high confidence or a high reconstruction rate, the former strategy is always recommended.
In a final step, the EBSD data of the parent phase are reconstructed from the EBSD data of the child phase using the method calcParentEBSD. Here the grain-level record of the particular parent orientation variant reconstructed for each child grain is applied to the child EBSD data (Fig. 1) and the OR. The resulting parent EBSD data are shown in Fig. 10 with the prior austenite grain boundaries overlaid in black.

a-to-b reconstruction in a Ti alloy
The EBSD map data used for this example are courtesy of Susanne Hemes, Access e.V. The initial microstructure consists of 94.5% phase, 0.2% phase and 5.3% unindexed points and is shown in Fig. 11(a). The script used to reconstruct the parent grains from a child microstructure is made available in the repository of Niessen et al. (2021).
Via an approach similar to that outlined in Section 4.1, the object job is constructed from the parentGrainReconstructor class and the OR is initialized as the Burgers OR (Burgers, 1934), as shown in Section 2 when summarizing the theory of parent grain reconstruction:  The reconstructed parent grain microstructure after applying the cleaning steps in Code 11. The scale bar is 25 mm.

Figure 10
The reconstructed parent EBSD data with the parent grain boundaries in black. The scale bar is 25 mm. The rotation axes ofboundary misorientation pairs are plotted in Fig. 11(b), along with the six ideal Burgers OR variant pairs shown as white circles. The misorientation axes of boundary pairs are colour coded according to their disorientation to the Burgers OR. Theboundary pairs have low disorientation values and their misorientation axes are close to those of the ideal Burgers OR. The few data points with high disorientation and/or different misorientation axes probably conform to a different OR and/or belong to prior boundaries. This overall low disorientation means that the grain boundary misorientations conform very well with the ideal Burgers OR and that therefore no refinement of the OR is needed. Since the number of variants is small and distinctly defined, and the grain morphology contains a large density of triple points, a triple-point parent reconstruction strategy may be applied, ð1Þ job:calcTPVotesð 0 numFit 0 ; 2Þ ð2Þ job:calcParentFromVoteð 0 strict 0 ; 0 minFit 0 ; 2:5 Ã degree; 0 maxFit 0 ; 5 Ã degree; 0 minVotes 0 ; 2Þ ðCode 13Þ The nucleation method calcTPVotes (see Section 3.2) is applied to identify triple points and determine the first-and second-best fits for a parent orientation between three grains (Code 13.1). The above method is similar to the method calcGBVotes used in the growth algorithm of the previous example. Following this, the method calcParentFromVote is applied to reconstruct all grain clusters at triple junctions that have (i) at least two votes for the same parent orientation, (ii) a fit of <2.5 to the best fitting common parent orientation and (iii) a fit of >5 to the next best fitting common parent  orientation (Code 13.2). The method returns the reconstructed microstructure in Fig. 11(c). A single iteration of the growth algorithm (Code 10) and reconstruction of the parent EBSD data yield the final parent grain microstructure shown in Fig. 11(d).
4.2.1. a 0 0 0 -to-" " "-to-c reconstruction in a twinning and transformation-induced plasticity steel. The EBSD map data used in this example are courtesy of Pramanik et al. (2018). The script used to reconstruct the parent " and grains is made available in the repository of Niessen et al. (2021). As shown in Fig. 12(a), the initial microstructure consists of 56% f.c.c. parent , 26% h.c.p. " and 18% b.c.c. 0 . Phases " and 0 formed during quenching after prior hot rolling, as well as from the partial transformation of to ", to 0 and " to 0 via the Shoji-Nishiyama, K-S and Burgers ORs, respectively, during subsequent cold rolling to 10% thickness reduction. The Shoji-Nishiyama OR, ð111Þ jj ð0001Þ " , ½110 jj ½1120 " , can transform into four unique variants of ", and the Burgers OR, ð0001Þ " jj ð110Þ 0 , ½1120 " jj ½110 0 , can transform each of these " variants to up to six unique 0 variants. The overall transformation from to 0 thus produces up to 24 variants and is equivalent to the direct transformation of to 0 by the K-S OR (Sato et al., 1982). The orientations of each phase and the computed grain boundaries are shown in Figs. 12(c)-12(e). The modular setup of the MTEX parent grain reconstruction algorithm allows for the complete reconstruction of parent via a two-step process in a single workflow.
Since sufficient parent-child boundaries are present for both martensite transformations, the ORTools function peakFitORs is used to determine the ORs between and " and " and 0 by fitting the parent-child boundary misorientation angle distribution [ Fig. 12(b)]. The workflow is the  same as that described in Section 4.1 for the parent grain reconstruction of lath martensite and comprises the sequential application of clustering, reconstruction, reversion of bad fits, growth, cleaning and calculation of EBSD data. The workflow is first applied to reconstruct all 0 grains to " [Fig. 12( f)] and subsequently to reconstruct all " grains to [ Fig. 12(g)]. Throughout the entire workflow, the identification numbers of the child grains are stored in the object parentGrainReconstructor. In this way, an advanced transformation graph over two transformations is constructed by linking the grain identification numbers of all child grains to their parent grain(s). Thus, an 0 grain transformed from an intermediate " grain is uniquely identified and linked together. Concurrently, both grains are also linked to the single reconstructed parent grain from which they transformed. Since the grain identification number links all parent grains to their child grains, it also enables second-order variant analysis.

Highlights of the MTEX implementation
The examples of parent grain reconstruction in Section 4 demonstrate the versatility of the newly integrated functionalities for parent grain reconstruction in MTEX. The main advantage of the present approach lies in the modularization of the reconstruction process as defined by the class parentGrainReconstructor, which contains the essential methods and properties for parent grain reconstruction (see Section 3). This approach enables the creation of individual workflows and reconstruction strategies for different types of transformation microstructures. Additional ancillary methods such as the local reversion of reconstruction and the merging of similar grains round off the core functionality. Therefore, the above approach is an ideal trade-off between automation and versatility.

Computational performance
The code has been optimized for speed by using efficient vectorized expressions in MATLAB. The 0 -to-transformation in Section 4.1 was timed as follows. The EBSD map contains 486 Â 707 pixels and 7002 martensitic grains were reconstructed. The example was calculated on a contemporary office laptop on a single Intel Core i7-8650U processor with a 1.9 GHz processor base frequency. The refinement of the OR by the method calcParent2Child took 14 s. The execution of the methods calcGraph, clusterGraph and calcParentFromGraph for the first part of the parent reconstruction took 37 s. Three loops of the growth algorithm (Code 10) took a further 2 s.
In the -totransformation in Section 4.2, the map comprised 384 Â 512 pixels and 49 666 grains were recon- An example of variant analysis on the reconstructed lath martensite steel microstructure from Section 4.1 using the add-on function library ORTools . took just under 5 s and a single iteration of the growth algorithm (Code 10) took an additional 1 s on the same computer setup.

Orientation variant analysis
Reconstructing the parent grain microstructure and parent EBSD data is a prerequisite for in-depth orientation variant analysis. The tools to compute orientation variant and packet identities are implemented in the method calcVariants. With a few additional lines of MTEX code, plots associated with variant analysis can be produced. However, the add-on ORTools  already features several pre-written functions to create publication-ready plots associated with variant analysis. Fig. 13 is an example of variant analysis using ORTools on the reconstructed parent microstructure in Section 4.1. By default, MTEX assigns the convention for packet and variant numbering established by Morito et al. (2003) whenever a transformation between two cubic symmetries is detected. In Fig. 13(a), the EBSD data of lath martensite are coloured according to packet identification numbers that delineate martensitic variants formed from the same habit plane. In this example, the four habit planes are (111) , ð111Þ , ð111Þ and ð111Þ . ORTools enables the investigation of individual reconstructed parent grains using an interactive function, grainClick. Some of the obtained plots are shown in Figs. 13(b)-13( f). The variant map in Fig. 13(b) shows the variant identification numbers of the EBSD data and the martensite grain boundaries. It is evident that most martensite grains, which represent martensitic blocks, contain pairs of two different variants. The pairing is according to the common Bain groups within a packet and is commonly observed in lath martensitic steel (Morito et al., 2003;Stormvinter et al., 2012). For instance, for packet 1, the pairing is of types V1-V4, V2-V5 and V3-V6. Equivalent pairing may also be noted for the other three packets. It was suggested that self-accommodation is not responsible for such pairing and that further research was needed to clarify the pairing tendencies (Morito et al.,   2003). Fig. 13(c) is the (001) pole figure of the theoretically predicted martensite variant orientations based on the parent mean grain orientation and the OR. Fig. 13(d) shows excellent agreement between the predicted and observed variant orientations. Finally,Figs. 13(e) and 13( f) show the distributions of the variant and packet identification numbers within the parent grain, respectively.

Reconstruction of austenite annealing twins in martensitic steel
While the present study highlights the versatility of the new framework for parent grain reconstruction in MTEX, it is also appropriate to discuss how the new methods approach the common problem of reconstructing annealing twins in parent austenite from child martensite grains in steel microstructures (Miyamoto et al., 2010).
The problem is demonstrated in Fig. 14 via a specific example of interest from Fig. 4. Fig. 14(a) shows martensite grains with their boundaries in black and the clusters for parent grain reconstruction using Code 8 outlined in red. Fig. 14(b) shows that parent grain reconstruction of these clusters results in a parent austenite grain containing an annealing twin. To investigate whether the annealing twin was reconstructed correctly, the fit of the variants of all 0 orientation pixels with either the mean orientation or the mean twinned orientation was determined. The best fit was used to recalculate the correct variant for each pixel and resulted in the orientation map in Fig. 14(c). The plot reveals that the annealing twin from Fig. 14(b) extends even further and that a second large annealing twin was not detected during parent grain reconstruction at all.
In Figs. 14(d) and 14(e), the (001) pole figures of the two orientations and their 0 variants according to the K-S and refined ORs are used to reveal the origin of the incomplete reconstruction. The K-S OR dictates that the variants constituting a single martensite packet must satisfy the following conditions: (i) The f011g 0 planes of all variants in a packet must lie parallel to the same {111} planes.
Since the misorientation describing the relationship between and twinned is defined by a 60 rotation about a h111i axis, the above two conditions can also be satisfied by a single packet of the twinned . This packet is hereafter referred to as the 'shared packet'. The 0 variants of the shared packet are shown by green markers in Fig. 14(d). Fortunately, as demonstrated in Section 4.1.1, the experimental OR in lath martensitic steels is irrational. The pole figure in Fig. 14(e) shows that, in this case, the variants of the shared packet have a misorientation angle of 2.8 . With sufficiently accurate data and a representative refined irrational OR determined from EBSD map data, it should be possible to separate twinned orientations during reconstruction.
The reason for the inaccurate reconstruction of the annealing twins in this example can be found early on in the procedure. Fig. 14(a) shows that the initial reconstruction of 0 grains with a threshold value of 3 does not separate the variants of the shared packets. Instead, it merges the variants into groups that are known as blocks. It is evident that the unidentified annealing twin in Fig. 14(d) intersects a large block of 0 variants. Therefore, there is no chance of reconstructing this annealing twin immediately following the grain reconstruction stage, regardless of which grain-level parent grain reconstruction approach is chosen. This is a generic shortcoming of all parent grain reconstruction algorithms. The only available avenues for a more accurate reconstruction of annealing twins could be either a more accurate reconstruction of the 0 variants or a refinement step on the pixel orientation level, as demonstrated in Fig. 14(c). These avenues will be explored in depth in future work.

Conclusions
This study demonstrates (i) the implementation of a versatile generic framework, involving a new class parentGrainReconstructor, for parent grain reconstruction from fully or partially transformed child microstructures in the open-source crystallographic toolbox MTEX (version 5.6 or higher), and (ii) the extension of traditional parent grain reconstruction, phase transformation and variant analysis to all parent-child crystal symmetry combinations.
Three examples of parent grain reconstruction in different transformation microstructures are provided, namely (i) 0 to in a lath martensitic steel, (ii) to in a Ti alloy, and (iii) a two-step parent grain reconstruction from 0 to " to in a twinning and transformation-induced plasticity steel. The examples showcase the inherent versatility of the universally applicable parent grain reconstruction methods, and the ability to conduct in-depth variant analysis via example workflows that can be programmatically modified by users to suit their specific applications. The latter is significantly simplified by the add-on function library ORTools.
Lastly, for the specific case of austenite annealing twins in martensitic steel, the method to extend the current grain-level parent grain reconstruction approach to pixel orientation level refinement is detailed.