extract_GB_traces


Download program files. program.
Download sample data. data
Download sample output segments. output
Download images of the segments. here


This program extracts grain boundary line segments from 2D orientation maps. For example, it will read *.ang files and produce a list of line segments (specified by the coordinates of the end points) and the Euler angles of the grain on each side of the boundary


The basic function of the program is illustrated in the figure below. On the left is an orientation map. Each filled circle is the location of an orientation point, colored by orientation. Each open circle marks a grain boundary node. The right hand side is the same map, after processing by extract_GB_traces. The black lines are straight line segments that approximate the grain boundary position. The endpoints of each line are written to a text file (see example below). The red circles on top of the black lines mark triple points. The blue circles on top of the black lines mark places where a line was divided to better match the path of the GB.



Updated April 26th 2023.


The image below shows the first few lines of output from the program. Each line contains the information for one grain boundary trace. The first three numbers are the Euler angles of the grain on one side of the boundary. The next three numbers are the three Euler angles for the grain on the other side of the boundary. These Euler angles are taken from the *.ang file. The next two numbers are the x and y coordinates of one end point of the grain boundary trace and the last two numbers are the x and y coordinates of the other end point. The grain boundary trace is the line defined by these two points. This file format can be interpreted by other programs, such as calc_discrete_distributions.



The program has a number of conditions/limitations:
- All pixels in the same grain must have identical Euler angles. Files of this type can be created by assigning the average grain orientation to each pixel in a grain. This can be accomplished in Dream.3D or in the OIM software.
- Pixels with 0.0 0.0 0.0 Euler angles are assigned grain ID zero, and boundaries between grains and fields with grain ID = 0 are ignored.
- The following limits can be overcome by editing and recompiling the program:
fewer than 10,000 grains
fewer than 30,000 trinodes
fewer than 100,000 boundary nodes
- Boundaries are not drawn in the following cases:
Boundaries of length less than or equal to two pixels
Peninsular grains that have thicknesses less than or equal to two pixels are misrepresented
If a boundary has an odd number of nodes greater than three, it is skipped. There are few such boundaries.
If a boundary has a single node, it is skipped.


Program capabilities:
- Accepts hexagonal and square point grids
- It will process up to 1000 maps in a single run
- It can produce maps (in postscript format) showing the traces on the orientation map and grain ID numbers
- The target line segment length (distance over which the boundary is approximated as a straight line) and max deviations of the line from the true boundary are both variable.


Example:
As an example to show how the program works, we will process 30 EBSD maps of high purity Ni.
Start by downloading the *.ang files from the Grain Boundary Data Archive at the following link.
The data comes in the .zip form, so you might need to unzip it before use.
The folder should contain 30 text files named Mod_Mod1_0NN.ang, where NN are integers from 00 to 29.
The 30 files in this folder need to be moved to the folder extract_gb_traces.
The next step is to configure the parameters in input.txt for the run. These parameters are described in the lower part of the input.txt file. View the input.txt file.
The version of input.txt saved on this site is configured to run the files available at the link above, so do not change anything for this example.
Next, open a terminal window in the extract_GB_traces folder. From here, you simply compile and run the program, as follows:
(base) gr20macmin:extract_GB_traces gr20$ make clean
rm -f main.o sub.o sub2.o symmetry.o
(base) gr20macmin:extract_GB_traces gr20$ make
gfortran -O3 -c -ffixed-line-length-none main.f
gfortran -O3 -c -ffixed-line-length-none sub.f
gfortran -O3 -c -ffixed-line-length-none sub2.f
gfortran -O3 -c -ffixed-line-length-none symmetry.f
gfortran main.o sub.o sub2.o symmetry.o -o gb_trace
(base) gr20macmin:extract_GB_traces gr20$ gb_trace
=================================================
PROGRAM TO EXTRACT GB TRACES FROM EBSD MAPS

rohrer@cmu.edu
version 04/12/2022
=================================================
File Mod_Mod1_000.ang has 183848 lines.
finding grains ...
There are : 543 grains
finding tri-nodes ...
There are : 1104 nodes
finding grain boundary nodes ...
There are : 24604 grain boundary nodes
finding related boundary nodes ...
There are : 1483 grain boundaries
finding grain boundary trace segments ...
There are : 4004 grain boundary trace segments
0 failed searches
The number of traces subdivided = 114

...
notifications from files 001 to 028 deleted
...

File Mod_Mod1_029.ang has 183848 lines.
finding grains ...
There are : 416 grains
finding tri-nodes ...
There are : 846 nodes
finding grain boundary nodes ...
There are : 17470 grain boundary nodes
finding related boundary nodes ...
There are : 1012 grain boundaries
finding grain boundary trace segments ...
There are : 2921 grain boundary trace segments
2 failed searches
The number of traces subdivided = 80
Program complete


First, there are many notifications written to the screen. These are for development and troubleshooting and not discussed further here.

Second, the main output from the program is a set of 30 text files. Each file is a list of line segments. They are named segments_Ni_0NN.txt where NN are integers from 00 to 29. These are used for the next step of the processing. The output is saved here, if you want to check that you get the same thing.

Third, the program has also written 30 images of the data in postscript format. These have names map_Mod_Mod1_0NN.ps where NN are integers from 00 to 29. These are images such as the one shown in the right hand panel at the top of the page. You need to check these at least once to make sure the program is working as intended. However, they are very large so you probably do not want to keep them or output them when you know things are working. You can suppress their output using the control character at line 20 of input.txt. The images are saved here, so you can check to make sure you get the same thing.



Return To Main Page