This script demonstrates the tools MTEX offers to reconstruct a parent austenite phase from a measured martensite phase. The methods are described in more detail in the publications

- The variant graph approach to improved parent grain reconstruction, arXiv, 2022,
- Parent grain reconstruction from partially or fully transformed microstructures in MTEX, J. Appl. Cryst. 55, 2022.

We shall use the following sample data set.

## Setting up the parent grain reconstructor

Grain reconstruction is guided in MTEX by a variable of type `parentGrainReconstructor`

. During the reconstruction process this class keeps track about the relationship between the measured child grains and the recovered parent grains.

The `parentGrainReconstructor`

guesses from the EBSD data what is the parent and what is the child phase. If this guess is not correct it might be specified explicitely by defining an initial guess for the parent to child orientation relationship first and passing it as a third argument to `parentGrainReconstructor`

. Here we define this initial guess seperately as the Kurdjumov Sachs orientation relationship

The output of the variable `job`

tells us the amount of parent and child grains as well as the percentage of already recovered parent grains. Furthermore, it displays how well the current guess of the parent to child orientation relationship fits the child to child misorientations within our data. In our sample data set this fit is described by the 4 quintiles 2.5°, 3.5°, 4.5° and 5.5°.

## Optimizing the parent child orientation relationship

It is well known that the phase transformation from austenite to martensite is not described by a fixed orientation relationship. In fact, the actual orientation relationship needs to be determined for each sample individualy. Here, we used the iterative method proposed by Tuomo Nyyssönen and implemented in the function `calcParent2Child`

that starts at our initial guess of the orientation relation ship and iterates towards a more optimal orientation relationship.

We observe that the optimized parent to child orientation relationship is 2.3° off the initial Kurdjumov Sachs orientation relationship and reduced the first quintil of the misfit with the child to child misorientations to 1.5°. These misfits are stored by the command `calcParent2Child`

in the variable `job.fit`

. In fact, the algorithm assumes that the majority of all boundary misorientations are child to child misorientations and finds the parent to child orientations relationship by minimizing this misfit. The following histogram displays the distribution of the misfit over all grain to grain misorientations.

We may explicitely compute the misfit for all child to child boundaries using the command `calcGBFit`

. Beside the list `fit`

it returns also the list of grain pairs for which these fits have been computed. Using th command `selectByGrainId`

we can find the corresponding boundary segments and colorize them according to this misfit. In the code below we go one step further and adjust the transparency as a function of the misfit.

## Variant Graph based parent grain reconstruction

Next we set up the variant graph where the nodes are the potential parent orientations of each child grain and the edges describe neighbouring grains that have compatible potential parent orientations. This graph is computed by the function `calcVariantGraph`

. The edge weights are computed from the misfit between the potential parent orientations using a cumulative Gaussian distribution with the mean value `'threshold'`

which describes the misfit at which the probability is exactly 50 percent and the standard deviation `'tolerance'`

.

For large maps it can be useful to perform the segmentation in a two step process, where in the in the first step similarly oriented variants are reconstructed as one variants and only seperated in a second step. This can be accomplished by the commands

The next step is to cluster the variant graph into components. This is done by the command `clusterVariantGraph`

.

As a result a table of votes `job.votes`

is generated. More specificaly, `job.votes.prob`

is a matrix that contains in row `job.votes.prob(i,:)`

the probabilities of the i-th child grain to have a specific parent orientation. Accordingly, we can plot the probability of the best fit for each grain by

We observe many child grains where the algorithm is sure about the parent orientation and some child grains where the probability is close to 50 percent. This is an indication that there are a least two potential parent orientations which are similarly likely. In many cases these potential parent orientations are in a twinning relationship.

Lets reconstruct all parent orientations where the probability is above 50 percent.

From here we have different possibilities to continue. One possibility is to reconstruct the remaining parent orientations manually. To this end one can use the the command `job.selectInteractive`

. This allow to click any grain and to change its parent orientation into one of the potential parent orientations.

A second way would be to rerun the variant graph approach above a second time but with relaxed settings, i.e., with a lower probability. A third way is to use the command `job.calcGBVotes`

to compute votes for potential parent orientations from the surrounding already reconstructed parent grains.

## Merge similar grains and inclusions

After the above reconstruction steps most of the child grains have been reverted into parent grains. However, instead of a few big parent grains we still have many small, but similarly oriented parent grains. These can be merged into big parent grains using the command `mergeSimilar`

We may be still a bit unsatisfied with the result as the large parent grains contain many poorly indexed inclusions where we failed to assign to a parent orientation. We may use the command `mergeInclusions`

to merge all inclusions with fever pixels then a certain threshold into the surrounding parent grains.

## Compute Child Variants

Knowing the parent grain orientations we may compute the variants and packets of each child grain using the command `calcVariants`

. The values are stored with the properties `job.transformedGrains.variantId`

and `job.transformedGrains.packetId`

. The `packetId`

is defined as the closest {111} plane in austenite to the (011) plane in martensite.

We can also directly identify the child grains belonging to the selected parent grains. Remeber that the initial grains are stored in `job.grainsPrior`

and that the vector `job.mergeId`

stores for every initial grain the `id`

of the corresponding parent grain. Combining these two information we do

In order to check our parent grain reconstruction we chose the single parent grain outlined in the above map and plot all child variants of its reconstructed parent orientation together with the actually measured child orientations inside the parent grain. In order to compute the `variantId`

and `packetId`

we use the command `calcVariantId`

.

## Parent EBSD reconstruction

So far our analysis was at the grain level. However, once parent grain orientations have been computed we may also use them to compute parent orientations of each pixel in our original EBSD map. This is done by the command `calcParentEBSD`

We obtain even a measure `parentEBSD.fit`

for the corespondence between the parent orientation reconstructed from the single pixel and the parent orientation of the grain. Lets visualize this fit

## Denoise the parent map

Finaly we may apply filtering to the parent map to fill non indexed or not reconstructed pixels. To this end we first run grain reconstruction on the parent map

and then use the command `smooth`

to fill the holes in the reconstructed parent map