Graphical artefacts outside of map when plotting grain boundaries as a function of misorientation threshold

68 views
Skip to first unread message

Omero Felipe Orlandini

unread,
Jun 6, 2018, 11:41:54 AM6/6/18
to MTEX
Hello, all! I have an odd case of a grain boundary being drawn outside of my data set as a function of my misorientation threshold for calcgrains. This has occurred sporadically for me over several datasets over several version of MTEX, but never in a version of calculated grains that I actually cared about so I just sort of ignored it. This time, I need this version of my grains and need to try and fix this weirdness. In the attached files, the 'O2M140A grains' version was calculated with a 15 degree threshold and has the artefact, the 'O2M140A subgrains' was calculated with a 2 degree threshold with no artefact. The 'W1099A1 grains_smoothed' file was calculated from a totally different map at 5 degrees threshold, and gives a slightly different version of what seems to be the same artefact. No error message is produced by MTEX when this happens. These maps were collected using Oxford Instruments Channel 5 Flamenco, and are imported from .cpr+.crc file pairs, which I am happy to make available if someone thinks they need them to address this. 

Full code to get the two O2M140A images below:

clear 
close all

%
%% 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('-1', [8.1796 12.8747 14.172], [93.13,115.89,91.24]*degree, 'X||a*', 'Z||c', 'mineral', 'Anorthite', 'color', 'blue'),...
  crystalSymmetry('321', [4.913 4.913 5.504], 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Quartz-new', 'color', 'light blue'),...
  crystalSymmetry('m-3m', [11.531 11.531 11.531], 'mineral', 'Almandine', 'color', 'red'),...
  crystalSymmetry('12/m1', [9.794 8.906 5.319], [90,105.9,90]*degree, 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Clinopyroxene', 'color', 'green'),...
  crystalSymmetry('mmm', [18.316 8.907 5.218], 'mineral', 'Orthopyroxene', 'color', 'magenta'),...
  crystalSymmetry('12/m1', [9.967 18.269 5.347], [90,104.97,90]*degree, 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Hastingsite', 'color', 'yellow'),...
  crystalSymmetry('m-3m', [8.3958 8.3958 8.3958], 'mineral', 'Magnetite', 'color', 'cyan'),...
  crystalSymmetry('-3', [5.1412 5.1412 14.225], 'X||a*', 'Y||b', 'Z||c', 'mineral', 'Ilmenite', 'color', 'light red')};

% plotting convention
setMTEXpref('xAxisDirection','east');
setMTEXpref('zAxisDirection','IntoPlane');

%% Specify File Names

% path to files
pname = 'C:\Users\Mahanaxar\Documents\MATLAB\Samples\Cora Lake shear zone\02M-140a\Prior Protocol';

% which files to be imported
fname = [pname '\02M140A_Prior_map.cpr'];

%% Import the Data

% create an EBSD variable containing the data
ebsd = loadEBSD(fname,CS,'interface','crc',...
  'convertEuler2SpatialReferenceFrame');
%% Make some general cosmetic changes

%minimum number of pixels per grain, check step size of map to determine
%best number here

minimum_grainsize = 3

% Manually define phase colors so that all maps match each other

ebsd('Anorthite').color = [65/255 105/255 225/255];
%ebsd('Albite - mon').color = [65/255 105/255 225/255];
ebsd('Clinopyroxene').color = [0/255 128/255 0/255];
ebsd('Orthopyroxene').color = [238/255 130/255 238/255];
ebsd('Almandine').color = [255/255 0/255 0/255];
ebsd('Ilmenite').color = [192/255 192/255 192/255];
ebsd('Magnetite').color = [128/255 128/255 128/255];
ebsd('Quartz-new').color = [255/255 255/255 0/255];
%ebsd('Quartz').color = [255/255 255/255 0/255];
ebsd('Hastingsite').color = [128/255 128/255 0/255];
%ebsd('Diopside').color = [0/255 128/255 0/255];
%ebsd('Pyrope').color = [255/255 0/255 0/255];
%ebsd('Sillimanite').color = [0/255 255/255 0/255];
%ebsd('Biotite').color = [218/255 165/255 32/255];
%ebsd('Orthoclase').color = [128/255 0/255 128/255];
%ebsd('Muscovite').color = [255/255 0/255 255/255];


diary('O2M140A_WSPP raw EBSD map properties.txt')
ebsd
diary off

save('O2M140A_WSPP_ebsd','ebsd');

setMTEXpref('defaultColorMap',hot)

%  15 degree boundaries
%

%load 'O2M140A_WSPP_ebsd.mat'

F = splineFilter;

% smooth the data
ebsd_smoothed = smooth(ebsd,F);
save('O2M140A_WSPP_ebsd_smoothed','ebsd_smoothed');

oM = ipdfHSVOrientationMapping(ebsd_smoothed('Anorthite'));

% the smoothing parameter determined during smoothing is
F.alpha
%
minimum_grainsize = 3;

% Let's remove the unindexed stuff and then reconstruct the grains
% perform grain reconstruction
[grains, ebsd_smoothed.grainId] = calcGrains(ebsd_smoothed,'angle',15*degree,'boundary','tight');
%then reassign the unindexed areas to not be filled in
notIndexed = grains('notIndexed');
% the "not indexed grains" we want to remove
toRemove = notIndexed(notIndexed.grainSize ./ notIndexed.boundarySize<0.8);
% now we remove the corresponding EBSD measurements
ebsd_smoothed(toRemove) = [];
% Then get rid of those pissant little grains that are probably just errors
% remove all grains with less than 3 measurements
large_grains = grains(grains.grainSize >= minimum_grainsize);
%// perform new grain reconstruction
ebsd_cleaned = ebsd_smoothed(large_grains);
[grains_cleaned, ebsd_cleaned.grainId, ebsd_cleaned.mis2mean] = calcGrains(ebsd_cleaned,'angle',15*degree,'boundary','tight');
% And now we can get rid of some of that nasty staircasing effect on the grain boundaries
grains_smoothed = smooth(grains_cleaned);
save('O2M140A_WSPP_grains_smoothed','grains_smoothed');
save('O2M140A_WSPP_ebsd_cleaned','ebsd_cleaned');


%
clear
minimum_grainsize = 3;

load('O2M140A_WSPP_ebsd_smoothed','ebsd_smoothed');

% Let's remove the unindexed stuff and then reconstruct the grains
% perform grain reconstruction
[subgrains, ebsd_smoothed.grainId] = calcGrains(ebsd_smoothed,'angle',2*degree,'boundary','tight');
%then reassign the unindexed areas to not be filled in
notIndexed = subgrains('notIndexed');
% the "not indexed grains" we want to remove
toRemove = notIndexed(notIndexed.grainSize ./ notIndexed.boundarySize<0.8);
% now we remove the corresponding EBSD measurements
ebsd_smoothed(toRemove) = [];
% Then get rid of those pissant little grains that are probably just errors
% remove all grains with less than 3 measurements
large_subgrains = subgrains(subgrains.grainSize >= minimum_grainsize);
%// perform new grain reconstruction
ebsd_subgrains_cleaned = ebsd_smoothed(large_subgrains);
[subgrains_cleaned, ebsd_subgrains_cleaned.grainId, ebsd_subgrains_cleaned.mis2mean] = calcGrains(ebsd_subgrains_cleaned,'angle',2*degree,'boundary','tight');
% And now we can get rid of some of that nasty staircasing effect on the grain boundaries
subgrains_smoothed = smooth(subgrains_cleaned);%%
close all
%small_subgrains = subgrains(subgrains.grainSize <= 10);
save('O2M140A_WSPP_subgrains','subgrains_smoothed');



% Figures

load('O2M140A_WSPP_grains_smoothed','grains_smoothed');
load('O2M140A_WSPP_ebsd_cleaned','ebsd_cleaned');

figure
plot(subgrains_smoothed('Anorthite'),'micronbar','off')
export_fig 'O2M140A_WSPP Anorthite subgrains.jpg' -m1 

figure
plot(grains_smoothed('Anorthite'),'micronbar','off')
export_fig 'O2M140A_WSPP Anorthite grains.jpg' -m1 

figure
plot(ebsd_cleaned('Anorthite'),'micronbar','off')
hold on
plot(subgrains_smoothed('Anorthite').boundary,'linecolor','r','linewidth',1)
plot(grains_smoothed('Anorthite').boundary,'linewidth',2)

export_fig 'O2M140A_WSPP Anorthite grains and subgrains.jpg' -m1 


Any and all feedback on this would be very welcome! The grains/subgrains thought process shown here is definitely a work in progress if anyone feels compelled to comment on that, too. Thank you all for your time!

Best,

Phil
O2M140A_WSPP Anorthite grains.jpg
O2M140A_WSPP Anorthite subgrains.jpg
W1099A1WSPP grains_smoothed_pl5.png

ruediger Kilian

unread,
Jun 6, 2018, 2:22:36 PM6/6/18
to mtex...@googlegroups.com
Hi Phil,
what are the coordinates of the maps with the "outliers"? Maybe you can find if there's a pixel out there causing this?
Another thought: Are your maps really large and do your get a warning (overflow of a 24bit ID field....) from qhull during calcGrains?

Cheers,
Rüdiger


Omero Felipe Orlandini

unread,
Jun 6, 2018, 5:10:05 PM6/6/18
to MTEX
Hello, Rüdiger! 

There is no warning in matlab at any point when running calcgrains, and I think that my maps are generally on the small side (140k - 400k pixels) for what anyone working with a modern EBSD detector would be putting through MTEX.

I'm not sure I know what you mean about the coordinates - when I look at the .ctf file for the raw data there is no pixel entry with scrambled coordinates. Is there a way to get MTEX to list all of the pixels with their coordinates?

Thank you!

Phil

Ralf Hielscher

unread,
Jun 6, 2018, 5:25:03 PM6/6/18
to mtex...@googlegroups.com
sure,

ebsd.x

ebsd.y

Ralf.

********************************************************************
Ralf Hielscher                   Tel: +371-531-38556
Fakultät für Mathematik               +371-531-22200 (Sekr.)
Technische Universität Chemnitz  Fax: +371-531-22109
Reichenhainer Str. 39            E-mail: ralf.hi...@mathematik.tu-chemnitz.de
D-09126 Chemnitz                 http://www.tu-chemnitz.de/~rahi
********************************************************************

--
If you want to reduce the number of emails you get through this forum login to https://groups.google.com/forum/?fromgroups=#!forum/mtexmail, click "My membership" and select "Don't send me email updates". You can still get emails on selected topics by staring them.
---
You received this message because you are subscribed to the Google Groups "MTEX" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mtexmail+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/mtexmail.
For more options, visit https://groups.google.com/d/optout.

Ralf Hielscher

unread,
Jun 6, 2018, 5:27:11 PM6/6/18
to mtex...@googlegroups.com
plot(ebsd)

should already show if there are problems with the coordinates.

grains = calcGrains(ebsd,'unitCell')

is a bit more stable then the default approach.

Ralf.





********************************************************************
Ralf Hielscher                   Tel: +371-531-38556
Fakultät für Mathematik               +371-531-22200 (Sekr.)
Technische Universität Chemnitz  Fax: +371-531-22109
Reichenhainer Str. 39            E-mail: ralf.hi...@mathematik.tu-chemnitz.de
D-09126 Chemnitz                 http://www.tu-chemnitz.de/~rahi
********************************************************************

Rüdiger Kilian

unread,
Jun 6, 2018, 5:28:49 PM6/6/18
to mtex...@googlegroups.com
And for grains,
for grains, grains.V stores the coordinates of all the vertices of grains and grains.poly is a cell which stores the indices of grains.V for each grain; so e.g.
[grains.V(grains.poly{1},1) grains.V(grains.poly{1},2)] should be the coordinates of the first grain.

Cheers,
Rüdiger

Omero Felipe Orlandini

unread,
Jun 7, 2018, 10:34:58 AM6/7/18
to MTEX
Thank you both for your responses! Using 'unitCell' in calcgrains solved the problem for me. I'm sorry that I was unable to find a better explanation for why the problem occurred, though.

Best,

Phil
Reply all
Reply to author
Forward
0 new messages