download as script · edit page

A grain boundary is stored as a list of short segments. Each segment lies between two neighbouring measurements that belong to different grains. Selecting boundaries therefore means indexing this list, and every selection returns another grainBoundary list.

This page assumes that the map has already been divided into grains as in Grain Reconstruction. The Grain Boundaries overview explains how these segments represent an interface in a two-dimensional section.

import numpy as np
from mtex import *
# import the data
plottingConvention.default('y↑→x')
ebsd = mtexdata('forsterite')

# restrict it to a subregion of interest
ebsd = ebsd[inpolygon(ebsd, np.array([5, 2, 10, 5]) * 1000)]

# reconstruct and smooth the grains
grains = calcGrains(ebsd, minPixel=5, alpha=10)
grains = smoothBoundary(grains, 4)

# extract and plot the complete boundary list
gB = grains.boundary
plot(ebsd)
hold(True)
plot(gB, lineWidth=2)
hold(False)

The black network contains every boundary segment in the cropped map. It includes boundaries between grains of one phase, boundaries between phases, and the outer rim of the scan.

What the list contains

Displaying gB reports the number and total length of the segments for every pair of phases that meets in the map.

gB
grainBoundary (y↑→x)
  size: 2954 segments, 252 chains
  segments    length   mineral 1   mineral 2
       559  27508 µm  notIndexed  Forsterite
        32   1586 µm  notIndexed   Enstatite
        29   1392 µm  notIndexed    Diopside
      1174  54734 µm  Forsterite  Forsterite
       552  26018 µm  Forsterite   Enstatite
       436  20159 µm  Forsterite    Diopside
        27   1278 µm   Enstatite   Enstatite
       123   5705 µm   Enstatite    Diopside
        22    930 µm    Diopside    Diopside

The rows involving notIndexed combine two situations. Some segments border a connected notIndexed area, whose diffraction patterns could not be indexed. Others lie on the outer rim, where a grain is cut off by the scan and has no neighbour on the other side. Selecting Grains shows how to identify grains at that rim.

By the phases on either side

Two phase names select segments between those phases. The first selection contains forsterite to forsterite boundaries, which separate differently oriented grains of the dominant phase.

gB_FoFo = gB['Fo', 'Fo']

plot(ebsd)
hold(True)
plot(gB_FoFo, lineColor='blue', micronbar='off', lineWidth=4)
hold(False)

The thick blue segments occur within the forsterite part of the phase map. They do not include its contacts with the other minerals.

The next selection contains forsterite to enstatite boundaries. A phase boundary is not a separate object in MTEX. It is a grain boundary whose two neighbouring grains happen to differ in phase.

gB_FoEn = gB['Fo', 'En']

plot(ebsd)
hold(True)
plot(gB_FoEn, lineColor='darkgreen', micronbar='off', lineWidth=4)
hold(False)

The green segments follow only contacts between the forsterite and enstatite regions. They are two different crystals meeting, rather than two orientations of the same phase.

Why phase order matters

The order of the phase names matters for more than readability. A misorientation is a rotation from one crystal to another, so reversing the names gives inverse misorientations. A misorientation axis expressed in crystal coordinates therefore refers to whichever crystal was named first.

mori = gB['Fo', 'En'].misorientation[0]
mori
misorientation (Forsterite → Enstatite)
  Bunge Euler angles in degree
  phi1   Phi  phi2
  25.3  50.4   260

inv(mori)
misorientation (Enstatite → Forsterite)
  Bunge Euler angles in degree
  phi1   Phi  phi2
   280  50.4   155

The two phase orders select the same physical segments, but reversing the sides also reverses the walk along every boundary chain. The segments are consequently not returned in the same row order. Corresponding segments have exactly inverse misorientations, but gB['En', 'Fo'].misorientation[0] is a different segment from the first one selected above.

By grain

A boundary list is also available from the grains it belongs to. This is how to ask for the boundary of one grain or of a grain selection. Here grains[70] means the 71st grain in the current list, not necessarily a grain whose ID is 71; Selecting Grains explains the distinction between list position and grain ID.

grains[70].boundary
grainBoundary (y↑→x)
  size: 30 segments, 1 chains
  segments   length   mineral 1  mineral 2
        23  1077 µm  Forsterite   Diopside
         7   311 µm   Enstatite   Diopside

plot(ebsd)
hold(True)
plot(grains[70].boundary, lineWidth=4, lineColor='DarkBlue')
hold(False)

The dark-blue outline includes every phase pair on the boundary of this grain. The displayed boundary summary names the phases on its far side.

Boundaries inside a grain

grains.innerBoundary stores segments between two measurements of the same grain. They arise when the segmentation criterion separates two neighbouring pixels, but another path through the map still connects them into one phase-homogeneous grain. An orientation gradient that comes back around can produce exactly this situation.

grains.innerBoundary
grainBoundary (y↑→x)
  size: 11 segments, 1 chains
  segments  length   mineral 1   mineral 2
        11  477 µm  Forsterite  Forsterite

plot(ebsd)
hold(True)
plot(grains.innerBoundary, lineColor='red', lineWidth=4)
hold(False)

The display reports 11 inner-boundary segments in this barely deformed rock. The red segments sit inside connected grains rather than tracing complete grain outlines. Deformed material may contain many more, and Subgrain Boundaries explains how a two-threshold reconstruction preserves a systematic low-angle population.

By misorientation or another property

Every segment carries its misorientation. A logical condition on the misorientation angle therefore selects segments in the same way as any NumPy logical index. Here the eligible set is first restricted to forsterite to forsterite boundaries, so every angle has one consistent pair of crystal symmetries.

isHighAngle = gB_FoFo.misorientation.angle() > 60 * degree
gB_high = gB_FoFo[isHighAngle]
gB_high
grainBoundary (y↑→x)
  size: 471 segments, 37 chains
  segments    length   mineral 1   mineral 2
       471  21925 µm  Forsterite  Forsterite

plot(ebsd)
hold(True)
plot(gB_FoFo, lineColor='lightgray', lineWidth=2)
plot(gB_high, lineColor='red', lineWidth=4)
hold(False)

The grey segments are all eligible forsterite boundaries, while red marks only those above the chosen angle. The same pattern works with a condition on position, direction, length, or any other per-segment property; see Grain Boundary Properties.

More specialised misorientation selections compare an axis, a complete rotation, or a coincidence site lattice relationship. They are developed in Twist and Tilt, Twinning, and CSL.

Next

Boundary Plots shows how to colour the selected segments by scalar, directional, and full-misorientation data. Grain Boundary Properties then develops the per-segment values from which more selections can be built.

Further reading

Technical Details

A pair of phase names in brackets selects segments, MATLAB’s gB('Fo','Fo'), and a boolean array selects them the same way. calcGrains returns the grains alone and writes the grain of every measurement into the map it was given, so MATLAB’s [grains, ebsd] = calcGrains(ebsd, ...) is one assignment here; as there, a not indexed measurement inside a grain takes its phase without an orientation. The grains are numbered along x first where MATLAB numbers them along y first, so MATLAB’s grains(47), the diopside grain with 23 forsterite and 7 enstatite segments, is grains[70] here.

Citing this page. This page is part of the documentation of MTEX, a free and open source MATLAB toolbox for analyzing and modeling crystallographic textures. It was written by The MTEX Developers and is published at https://mtex-toolbox.github.io/BoundarySelect_py.html. If you use MTEX, or reuse text or figures from this page, in your research, please cite

F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63

BibTeX
@article{bachmann2010mtex,
  author  = {F. Bachmann and R. Hielscher and H. Schaeben},
  title   = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
  journal = {Solid State Phenomena},
  volume  = {160},
  pages   = {63-68},
  year    = {2010},
  doi     = {10.4028/www.scientific.net/SSP.160.63},
  url     = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}

Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.