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 x 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
 Scan unit : um
 X x Y x Z : [33000, 36000] x [4500, 7500] x [0, 0]
 Normal vector: (0,0,1)
 
 
grains = grain2d (y↑→x)
 
 Phase  Grains  Pixels     Mineral  Symmetry         Color
     1      12    1936  Forsterite       mmm  LightSkyBlue
     2       4     284   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       2        9     (73°,36°,353°)    0.013
  2       1       14   (128°,146°,231°)   0.0071
  3       1      149   (177°,111°,285°)    0.011
  4       1        8   (168°,101°,264°)   0.0062
  5       1      123   (179°,128°,261°)    0.024
  6       2       36    (125°,62°,331°)   0.0084
  7       1      526     (19°,85°,256°)    0.038
  8       1       38    (167°,97°,261°)     0.01
  9       1       38    (155°,53°,302°)    0.059
 10       2        1    (164°,35°,295°)        0
 11       3       53    (142°,81°,317°)     0.02
 12       3      148    (32°,148°,241°)    0.023
 13       1      874   (162°,102°,268°)     0.13
 14       3       29    (155°,47°,299°)   0.0072
 15       1       93    (176°,93°,246°)    0.042
 16       1       15     (56°,68°,280°)    0.033
 17       1       22    (174°,82°,282°)   0.0098
 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
     1      12    1936  Forsterite       mmm  LightSkyBlue
     2       4     284   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       2        9     (73°,36°,353°)    0.013
  2       1       14   (128°,146°,231°)   0.0071
  3       1      149   (177°,111°,285°)    0.011
  4       1        8   (168°,101°,264°)   0.0062
  5       1      123   (179°,128°,261°)    0.024
  6       2       36    (125°,62°,331°)   0.0084
  7       1      526     (19°,85°,256°)    0.038
  8       1       38    (167°,97°,261°)     0.01
  9       1       38    (155°,53°,302°)    0.059
 10       2        1    (164°,35°,295°)        0
 11       3       53    (142°,81°,317°)     0.02
 12       1      874   (162°,102°,268°)     0.13
 13       1       93    (176°,93°,246°)    0.042
 14       1       15     (56°,68°,280°)    0.033
 15       1       22    (174°,82°,282°)   0.0098
 16       2      238    (164°,35°,295°)   0.0075
 17       1       36    (167°,98°,260°)   0.0083
 18       3      177   (NaN°,NaN°,NaN°)      NaN
 
parentId =
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    18
    12
    18
    13
    14
    15
    16
    17