extracting the orientations along a merged grain boundary

25 views
Skip to first unread message

grandr...@gmail.com

unread,
Jan 24, 2017, 11:43:30 PM1/24/17
to MTEX
Hello all, starting with a dataset that includes merged grains, I want to collect the id number of all ebsd orientations along the boundary of a selected merged grain and the adjacent ones.  I then intend to only keep those points in the adjacent grains, find the corresponding orientation and perform some analysis on them.  My code is below, but I think I may have misunderstood the data in the mergedGrains(TwinNum).boundary.ebsdId variable, because when I plot the x y coordinates it's all over the place and not along the boundary.  Any idea where I went wrong?

Regards, Jessica



%define a merged grain to analyze
TwinNum=2412;
%get a list of all grains in the merged grain, used to eliminate ebsd orientations from list
[a]=find(parentId==mergedGrains(TwinNum).id);


%create an output array of appropriate length
bindex=numel(mergedGrains(TwinNum).boundary.ebsdId);
out=zeros(bindex,1);

%For each point on either side of the boundary test if it's inside the
%merged Grain or not.  Each boundary point has 2 ebsd data points

for i=1:bindex
%take one ebsd point
test=mergedGrains(TwinNum).boundary.ebsdId(i);
%find the grain it's within
match=ebsd(test).grainId;
%determine if match contains a grainID listed in [a]
%if data is not within the TwinNum, add it to the list
 if any(match==a)
out(i)=1;
else out(i)=1;
end

end

grandr...@gmail.com

unread,
Jan 25, 2017, 5:22:31 PM1/25/17
to MTEX
Solved the problem in an ugly brute-force way by using spatialProfile and then eliminating all internal boundary points.  Here's what I came up with;

%% Solution using spatialProfile
%note that the variable radius in function spatialProfile was edited (doubled) to solve an issue with
%line thickness


TwinNum=2412;
%get a list of all grains in the merged grain, used to eliminate ebsd orientations from list
%first put list of rows (which equal id # from grains variable) into an array
[a]=find(parentId==mergedGrains(TwinNum).id);

%use midpoint of boundary x,y and spatial profile to get point list
out=spatialProfile(ebsd('magnesium'),mergedGrains(TwinNum).boundary.midPoint)

%remove all duplicate ebsd data points (this is a lot of them)
out1=unique(out.id);

%remove all tiny grains <8 px
N=grains(ebsd(out1).grainId).grainSize;
Nlg=N>8;
%remove the ids that correspond to these grains
out2=out1(Nlg);

%now we have a list of EBSD orientations, both within and without the
%TwinNum.  We must eliminate all within the matrix [a]
test=false(length(out2),1);

%now for each data point,
for i=1:length(out2)
%we want to keep it if it isn't in the list, so 1- logical
test(i)=1-any(ebsd(out2(i)).grainId==a);


end

%use this logical to remove values from the list of ebsd ids
out3=out2(test);


%this can be visualised as follows
%figure;plot(ebsd(out3),ebsd(out3).grainId)
Reply all
Reply to author
Forward
0 new messages