1) no fill, no grains, all pixels
mtexdata small
[ grains , ebsd . grainId , ebsd . mis2mean ] = calcGrains ( ebsd );
ebsd ( grains ( grains . grainSize <= 3 )) = [];
[ grains , ebsd . grainId , ebsd . mis2mean ] = calcGrains ( ebsd );
F = splineFilter ;
ebsd = smooth ( ebsd , F );
[ grains , ebsd . grainId , ebsd . mis2mean ] = calcGrains ( ebsd );
plot ( ebsd )
hold on
plot ( grains . boundary , 'lineColor' ,[ 1 0 0 ], 'linewidth' , 2 )
hold off
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 1197 (32%) notIndexed
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, x, y
Scan unit : um
2) no fill, no grains, indexed pixels
mtexdata small
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
ebsd ( grains ( grains . grainSize <= 3 )) = [];
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
F = splineFilter ;
ebsd = smooth ( ebsd ( 'indexed' ), F );
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
nextAxis
plot ( ebsd )
hold on
plot ( grains . boundary , 'lineColor' ,[ 1 0 0 ], 'linewidth' , 2 )
hold off
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 1197 (32%) notIndexed
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, x, y
Scan unit : um
3) fill, no grains, all pixels
mtexdata small
[ grains , ebsd . grainId ] = calcGrains ( ebsd );
ebsd ( grains ( grains . grainSize <= 3 )) = [];
[ grains , ebsd . grainId ] = calcGrains ( ebsd );
F = splineFilter ;
ebsd = smooth ( ebsd , F , 'fill' );
[ grains , ebsd . grainId ] = calcGrains ( ebsd );
nextAxis
plot ( ebsd )
hold on
plot ( grains . boundary , 'lineColor' ,[ 1 0 0 ], 'linewidth' , 2 )
hold off
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 1197 (32%) notIndexed
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, x, y
Scan unit : um
4) fill, no grains, indexed pixels
mtexdata small
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
ebsd ( grains ( grains . grainSize <= 3 )) = [];
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
F = splineFilter ;
ebsd = smooth ( ebsd ( 'indexed' ), F , 'fill' );
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
nextAxis
plot ( ebsd )
hold on
plot ( grains . boundary , 'lineColor' ,[ 1 0 0 ], 'linewidth' , 2 )
hold off
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 1197 (32%) notIndexed
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, x, y
Scan unit : um
5) fill, grains, indexed pixels
mtexdata small
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
ebsd ( grains ( grains . grainSize <= 3 )) = [];
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
F = splineFilter ;
ebsd = smooth ( ebsd ( 'indexed' ), F , 'fill' , grains );
[ grains , ebsd ( 'indexed' ) . grainId ] = calcGrains ( ebsd ( 'indexed' ));
nextAxis
plot ( ebsd )
hold on
plot ( grains . boundary , 'lineColor' ,[ 1 0 0 ], 'linewidth' , 2 )
hold off
drawNow ( gcm )
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 1197 (32%) notIndexed
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, x, y
Scan unit : um
6) Multiscale clustering method
mtexdata small
grains = calcGrains ( ebsd ( 'indexed' ), 'FMC' , 1 )
nextAxis
plot ( ebsd )
hold on
plot ( grains . boundary , 'lineColor' ,[ 1 0 0 ], 'linewidth' , 2 )
hold off
drawNow ( gcm )
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 1197 (32%) notIndexed
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, x, y
Scan unit : um
grains = grain2d
Phase Grains Pixels Mineral Symmetry Crystal reference frame
1 23 1952 Forsterite mmm
2 7 290 Enstatite mmm
3 38 282 Diopside 12/m1 X||a*, Y||b*, Z||c
boundary segments: 999 (53837 µm)
inner boundary segments: 0 (0 µm)
triple points: 60
Properties: meanRotation, GOS
Multiscale clustering method When analyzing grains with gradual and subtle boundaries the threshold based method may not lead to the desired result.
Let us consider the following example
mtexdata single
colorKey = axisAngleColorKey ( ebsd );
colorKey . oriRef = mean ( ebsd . orientations );
plot ( ebsd , colorKey . orientation2color ( ebsd . orientations ))
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
1 10201 (100%) Al LightSkyBlue m-3m
Properties: x, y
Scan unit : um
We obeserve that the are no rapid changes in the orientation which would allow for applying the threshold based algorithm. Setting the threshold angle to a very small value would include many irrelevant or false regions.
grains_high = calcGrains ( ebsd , 'angle' , 1 * degree );
grains_low = calcGrains ( ebsd , 'angle' , 0.5 * degree );
figure
plot ( ebsd , colorKey . orientation2color ( ebsd . orientations ))
hold on
plot ( grains_high . boundary )
hold off
figure
plot ( ebsd , colorKey . orientation2color ( ebsd . orientations ))
hold on
plot ( grains_low . boundary )
hold off
As an alternative MTEX includes the fast multi-scale clustering method (FMC method) which constructs clusters in a hierarchical manner from single pixels using fuzzy logic to account for local, as well as global information.
Analogous with the threshold angle, a single parameter, C_Maha controls the sensitivity of the segmentation. A C_Maha value of 3.5 properly identifies the sub-grain features. A C_Maha value of 3 captures more general features, while a value of 4 identifies finer features but is slightly oversegmented.
grains_FMC = calcGrains ( ebsd ( 'indexed' ), 'FMC' , 3.8 )
grains = calcGrains ( ebsd ( 'indexed' ))
% smooth grains to remove staircase effect
grains_FMC = smooth ( grains_FMC );
grains_FMC = grain2d
Phase Grains Pixels Mineral Symmetry Crystal reference frame
1 17 10201 Al m-3m
boundary segments: 1552 (156 µm)
inner boundary segments: 0 (0 µm)
triple points: 14
Id Phase Pixels phi1 Phi phi2 GOS
1 1 7 317 128 159 0.0084358
2 1 1120 239 74 319 0.0251134
3 1 517 238 75 320 0.0100267
4 1 1783 56 103 40 0.0220658
5 1 11 57 104 220 0.00744635
6 1 2 237 79 322 0.00276888
7 1 7 343 43 249 0.00797851
8 1 989 236 79 322 0.0126827
9 1 1060 239 75 320 0.0197615
10 1 76 238 75 320 0.00793592
11 1 1556 238 77 320 0.0219626
12 1 349 237 77 320 0.011464
13 1 401 342 41 251 0.0103684
14 1 402 238 77 320 0.0121174
15 1 184 237 77 319 0.0128468
16 1 957 316 129 74 0.0176069
17 1 780 238 78 321 0.0123911
grains = grain2d
Phase Grains Pixels Mineral Symmetry Crystal reference frame
1 1 10201 Al m-3m
boundary segments: 404 (41 µm)
inner boundary segments: 0 (0 µm)
triple points: 0
Id Phase Pixels phi1 Phi phi2 GOS
1 1 10201 237 77 320 0.0344809
We observe how this method nicely splits the measurements into clusters of similar orientation
%plot(ebsd,oM.orientation2color(ebsd.orientations))
plot ( ebsd , colorKey . orientation2color ( ebsd . orientations ))
% start override mode
hold on
plot ( grains_FMC . boundary , 'linewidth' , 1.5 )
% stop override mode
hold off
Markovian Clustering Algorithm
F = halfQuadraticFilter
F . alpha = 0.5
ebsd = smooth ( ebsd , F )
F =
halfQuadraticFilter with properties:
l1DataFit: 1
l1TV: 1
alpha: 1
iterMax: 1000
tol: 3.4907e-04
eps: 1.0000e-03
threshold: 0.2618
isHex: 0
F =
halfQuadraticFilter with properties:
l1DataFit: 1
l1TV: 1
alpha: 0.5000
iterMax: 1000
tol: 3.4907e-04
eps: 1.0000e-03
threshold: 0.2618
isHex: 0
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
1 10201 (100%) Al LightSkyBlue m-3m
Properties: x, y, oldId, quality
Scan unit : um
grains = calcGrains ( ebsd , 'mcl' ,[ 1.24 50 ], 'soft' ,[ 0.2 0.3 ] * degree )
grains = smooth ( grains , 5 )
plot ( ebsd , colorKey . orientation2color ( ebsd . orientations ))
hold on ; plot ( grains . boundary , 'linewidth' , 2 ); hold off
%
%
%<html>
% <div class="note">
% <b>ok<*NASGU>
%</b>
% <text/>
% </div>
%</html>
%
%
%<html>
% <div class="note">
% <b>ok<*ASGLU>
%</b>
% <text/>
% </div>
%</html>
%
grains = grain2d
Phase Grains Pixels Mineral Symmetry Crystal reference frame
1 285 10201 Al m-3m
boundary segments: 3722 (374 µm)
inner boundary segments: 16502 (1657 µm)
triple points: 423
Properties: meanRotation, GOS
grains = grain2d
Phase Grains Pixels Mineral Symmetry Crystal reference frame
1 285 10201 Al m-3m
boundary segments: 3722 (372 µm)
inner boundary segments: 16502 (1651 µm)
triple points: 423
Properties: meanRotation, GOS