grain2d.merge edit page

merge grains along special grain boundaries

Whenever two grains share a grain boundary that is in the list gB both grains are merged and the common grain boundary is removed. All the properties of the unmerged grains are removed in the merged grains, since there is no common convention for a mean. In case of merging allong small angle grain boundaries one can force MTEX to compute a new meanOrientation using the option calcMeanOrientation.

Syntax

[grainsMerged,parentId] = merge(grains,gB)
% compute new meanOrientations for the grains
[grainsMerged,parentId] = merge(grains,gB,'calcMeanOrientation')
[grainsMerged,parentId] = merge(grains,M)
[grainsMerged,parentId] = merge(grains,tpList)
% merge by a list of pairs of grainIds
[grainsMerged,parentId] = merge(grains,gid)
% merge grains with small misorientation angle
[grainsMerged,parentId] = merge(grains,'threshold',delta)
% merge all inclusions with a maximum pixel size
[grainsMerged,parentId] = merge(grains,'inclusions','maxSize',5)

Input

grains grain2d
boundary grainBoundary
M merge matrix M(i,j)==1 indicates the grains to be merged
tpList triplePointList
gid n × 2 list of grainIds

Output

grainsMerged grain2d
parentId a list of the same size as grains containing the ids of the merged grains

Options

threshold maximum misorientation angle to be merged as similar
maxArea
maxPixel
maxSize maximum number of pixels to be merged as an inclusion

Example

mtexdata small
grains = smooth(calcGrains(ebsd,'minPixel',5))
ebsd = EBSD (y↓→x)
 
 Phase  Orientations     Mineral         Color  Symmetry  Crystal reference frame
     0    1197 (32%)  notIndexed          none                                   
     1    1952 (52%)  Forsterite  LightSkyBlue       mmm                         
     2    290 (7.8%)   Enstatite  DarkSeaGreen       mmm                         
     3    282 (7.6%)    Diopside     Goldenrod     12/m1        X||a*, Y||b, Z||c
 
 Properties: bands, bc, bs, error, mad, oldId
 Scan unit : um
 X × Y × Z : [33000 → 36000] × [4500 → 7500] × [0 → 0]
 Normal vector: (0,0,1)
 
Warning: grains.smooth has been renamed to grains.smoothBoundary, which
additionally removes the pixel staircase before smoothing it. You are
getting the old behaviour - see the help of grain2d/smooth. 
 
grains = grain2d (y↓→x)
 
 Phase  Grains  Pixels     Mineral  Symmetry         Color
     0       1       1  notIndexed                    none
     1      12    1936  Forsterite       mmm  LightSkyBlue
     2       3     283   Enstatite       mmm  DarkSeaGreen
     3       3     230    Diopside     12/m1     Goldenrod
 
 boundary segments: 731 (35913 µm)
 inner boundary segments: 22 (1029 µm)
 triple points: 15
 
 Id   Phase   Pixels       meanRotation      GOS
  1       3       29    (155°,47°,299°)   0.0072
  2       3      148    (32°,148°,241°)    0.023
  3       1      149   (177°,111°,285°)    0.011
  4       3       53    (142°,81°,317°)     0.02
  5       2        9     (73°,36°,353°)    0.013
  6       1       93    (176°,93°,246°)    0.042
  7       1       15     (56°,68°,280°)    0.033
  8       1        8   (168°,101°,264°)   0.0062
  9       1      526     (19°,85°,256°)    0.038
 10       1      874   (162°,102°,268°)     0.13
 11       1       38    (155°,53°,302°)    0.059
 12       1       22    (174°,82°,282°)   0.0098
 13       1       14   (128°,146°,231°)   0.0071
 14       2       36    (125°,62°,331°)   0.0084
 15       1      123   (179°,128°,261°)    0.024
 16       1       38    (167°,97°,261°)     0.01
 17       0        1    (164°,35°,295°)        0
 18       2      238    (164°,35°,295°)   0.0075
 19       1       36    (167°,98°,260°)   0.0083

merge all neighboring Diopside grains

gB = grains.boundary('Diopside','Diopside')
[grains_m,parentId] = merge(grains,gB)
gB = grainBoundary (y↓→x)
 
 Segments  length  mineral 1  mineral 2
        7  283 µm   Diopside   Diopside
 
grains_m = grain2d (y↓→x)
 
 Phase  Grains  Pixels     Mineral  Symmetry         Color
     0       1       1  notIndexed                    none
     1      12    1936  Forsterite       mmm  LightSkyBlue
     2       3     283   Enstatite       mmm  DarkSeaGreen
     3       2     230    Diopside     12/m1     Goldenrod
 
 boundary segments: 724 (35630 µm)
 inner boundary segments: 22 (1029 µm)
 triple points: 14
 
 Id   Phase   Pixels       meanRotation      GOS
  1       1      149   (177°,111°,285°)    0.011
  2       3       53    (142°,81°,317°)     0.02
  3       2        9     (73°,36°,353°)    0.013
  4       1       93    (176°,93°,246°)    0.042
  5       1       15     (56°,68°,280°)    0.033
  6       1        8   (168°,101°,264°)   0.0062
  7       1      526     (19°,85°,256°)    0.038
  8       1      874   (162°,102°,268°)     0.13
  9       1       38    (155°,53°,302°)    0.059
 10       1       22    (174°,82°,282°)   0.0098
 11       1       14   (128°,146°,231°)   0.0071
 12       2       36    (125°,62°,331°)   0.0084
 13       1      123   (179°,128°,261°)    0.024
 14       1       38    (167°,97°,261°)     0.01
 15       0        1    (164°,35°,295°)        0
 16       2      238    (164°,35°,295°)   0.0075
 17       1       36    (167°,98°,260°)   0.0083
 18       3      177   (NaN°,NaN°,NaN°)      NaN
 
parentId =
    18
    18
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17

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/grain2d.merge.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.