A classification algorithm to segment & color code bainite and polygonal ferrite fractions #5
-
The developed Matlab®code uses the MTEX toolbox [33] to define first the grain boundaries according to the selected grain tolerance angle and afterwards calculate the KAM of each pixel. The program classifies grains as granular bainite if one pixel exceeds a misorientation of 3°; otherwise it is categorized as polygonal ferrite. Subsequently, the classification algorithm color-codes the classified grains according to their determined phase and calculates the measured granular bainite and polygonal fraction.I can calculate the KAM value for each pixel, but then the classification algorithm color codes the classified grains based on the determined phase and calculates the measured grain bainitic and polygonal fractions I don't know how to do that with code.As shown in the figure below, the left is what I can achieve currently, and the right is the drawing I want to achieve.I would appreciate it if you could help me. %% Import Script for EBSD Data
%
% This script was automatically created by the import wizard. You should
% run the whoole script or parts of it in order to import your data. There
% is no problem in making any changes to this script.
%% Specify Crystal and Specimen Symmetries
% crystal symmetry
CS = {...
'notIndexed',...
crystalSymmetry('m-3m', [2.9 2.9 2.9], 'mineral', 'Iron bcc (old)', 'color', [0.53 0.81 0.98]),...
crystalSymmetry('m-3m', [3.7 3.7 3.7], 'mineral', 'Iron fcc', 'color', [0.56 0.74 0.56])};
% plotting convention
setMTEXpref('xAxisDirection','east');
setMTEXpref('zAxisDirection','intoPlane');
%% Specify File Names
% path to files
pname = 'D:\桌面\B钢数据\B-750\B钢\B钢EBSD\B750';
% which files to be imported
fname = [pname '\B750-1.crc'];
%% Import the Data
% create an EBSD variable containing the data
ebsd = EBSD.load(fname,CS,'interface','crc',...
'convertEuler2SpatialReferenceFrame');
% The second parameter that is involved in grain reconstruction is the threshold misorientation angle indicating a grain boundary.
grains = calcGrains(ebsd,'angle',5*degree)
[grains,ebsd.grainId] = calcGrains(ebsd('indexed'));
% remove one-three pixel grains
ebsd(grains(grains.grainSize <= 3)) = [];
[grains,ebsd.grainId] = calcGrains(ebsd('indexed'));
grains = smooth(grains,5);
plot(ebsd('indexed'),ebsd('indexed').orientations)
hold on
plot(grains.boundary,'lineWidth',1.5)
hold off
ebsd = ebsd.gridify;
kam = ebsd.KAM / degree;
% lets plot it
plot(ebsd,kam,'micronbar','off')
caxis([0,15])
mtexColorbar
mtexColorMap LaboTeX
hold on
plot(grains.boundary,'lineWidth',1.5)
hold off
plot(ebsd,ebsd.KAM('threshold',2.5*degree) ./ degree,'micronbar','off')
caxis([0,5])
mtexColorbar
mtexColorMap LaboTeX
hold on
plot(grains.boundary,'lineWidth',1.5)
hold off
% chose a denoising filter
F = halfQuadraticFilter;
F.alpha = 0.5;
% denoise the orientation map
ebsdS = smooth(ebsd,F,'fill',grains);
% plot the first order KAM
plot(ebsdS,ebsdS.KAM('threshold',2.5*degree) ./ degree,'micronbar','off')
caxis([0,5])
mtexColorbar
mtexColorMap LaboTeX
hold on
plot(grains.boundary,'lineWidth',1.5)
hold off Best wishes |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @Mikewangkang, Thank you for sharing your script. There are a few issues that I'd like to clarify first:
Have you applied either of these two methods to your map(s)?
Warm regards, |
Beta Was this translation helpful? Give feedback.
Hi @Mikewangkang,
Thank you for pointing out the limitation of the original ferrite quantifier. I have added a second script to the folder that deals specifically with multi-phase maps. I have also added a example map of duplex steel so that you can run the script and see how it works without making any changes. If this resolves your issue, please mark this message as your answer.
I would be grateful if you could please send me a link to the article you are citing that uses the KAM value.
Warm regards,
Azdi