Skip to content

Commit

Permalink
some pollishing
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfHielscher committed Oct 7, 2014
1 parent 9109de2 commit 39ac1b6
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 559 deletions.
95 changes: 0 additions & 95 deletions EBSDAnalysis/@grainBoundary/calcKAM2.m

This file was deleted.

93 changes: 93 additions & 0 deletions examples/GrainReconstructionDemo.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
%%


%% Import some EBSD data

mtexdata forsterite
plotx2east

plot(ebsd)

%% First attempt on grain reconstruction

[grains,ebsd.grainId] = calcGrains(ebsd,'angle',5*degree);

plot(grains)


%%
% The resulting grains contain a lot of holes and one pixel grains due to
% misindexing. A good measure for regions where indexing went wrong is the
% band contrast

plot(ebsd,ebsd.bc)

%%
% We see its quite low at the grain boundaries and, e.g., in the top left
% rectangle. Lets set the phase of measurements with bandcontrast
% smaller then a certain threshold to notIndexed

condition = ebsd.bc < 80;

% setting the phase to zero means notIndexed
ebsd(condition).phase = 0
plot(ebsd)


%%

[grains,ebsd.grainId] = calcGrains(ebsd,'angle',5*degree);

plot(grains)


%%

plot(grains,log(grains.grainSize ./ grains.boundarySize))
colorbar

%%
% remove

ind = ~grains.isIndexed & log(grains.grainSize ./ grains.boundarySize) < -0.4;

plot(ebsd)
hold on
plot(grains(ind),'faceColor',[0 0 0],'DisplayName','fill this')
hold off

% remove marked measurements
ebsd(grains(ind)) = []

%%

[grains,ebsd.grainId] = calcGrains(ebsd,'angle',5*degree);

plot(grains)

%%
% fill grains that are to small

ind = grains.grainSize < 5;

hold on
plot(grains(ind),'faceColor',[0 0 0],'DisplayName','fill this')
hold off

% remove marked measurements
ebsd(grains(ind)) = []

%%
%

[grains,ebsd.grainId] = calcGrains(ebsd,'angle',5*degree);

plot(grains)



%% Smooth grains

grains = smooth(grains,2);

plot(grains)
4 changes: 2 additions & 2 deletions geometry/@DelaunaySO3/display.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function display(DSO3)

disp([' size: ' size2str(DSO3)]);
disp([' tetrahegons: ',int2str(size(DSO3.tetra,1))]);
disp([' ' char(DSO3.CS,'verbose'));
disp([' ' char(DSO3.SS,'verbose'));
disp([' ' char(DSO3.CS,'verbose')]);
disp([' ' char(DSO3.SS,'verbose')]);

if length(DSO3) < 30 && ~isempty(o), Euler(DSO3);end

Expand Down
50 changes: 0 additions & 50 deletions geometry/@symmetry/plotFundamentalRegion.m

This file was deleted.

2 changes: 1 addition & 1 deletion help/doc/UsersGuide/EBSDAnalysis/EBSDSpatialPlots.m
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
% Suppose the mode of the ODF somewhere in our spatial distribution of
% grains (the orientation map).

mode =
mode = idquaternion

%%
% The definition of colors for certain orientations is carried out similarly as
Expand Down
77 changes: 0 additions & 77 deletions help/doc/UsersGuide/EBSDAnalysis/GrainReconstruction.m
Original file line number Diff line number Diff line change
Expand Up @@ -331,80 +331,3 @@
% stop overide mode
hold off

%% ------------------------------------------------------
%% this has to be reworked

%% Correcting poor grains
% Sometimes measurements belonging to grains with very few measurements can
% be regarded as inaccurate. This time, we explicitely keep the not
% indexed measurements by the flag |keepNotIndexed|

mtexdata forsterite

[grains,ebsd.grainId] = calcGrains(ebsd,'angle',5*degree);

close all
plot(grains)

%%
% The number of measurements per grain can be accessed by the command
% <GrainSet.grainSize.html GrainSize>. Let us determine the number of
% grains with less then 10 measurements

nnz(grains.grainSize < 5)

% or the percentage of those grains relative to the total number of grains
100 * nnz(grains.grainSize < 10) / length(grains)

%%
% We see that almost 92 percent of all grains consist of less then ten
% measurement points. Next, we compute the percentage of small grains for
% the individuell phases

p = 100*[nnz(grains('notIndexed').grainSize < 10); ...
nnz(grains('forsterite').grainSize < 10); ...
nnz(grains('enstatite').grainSize < 10); ...
nnz(grains('diopside').grainSize < 10)]./length(grains)

%%
% We see that almost all small grains are acually not indexed. In order to
% allow filling in those holes we remove these small not indexed grains
% completely from the data set

condition = grains.grainSize >=10 | grains.phase > 0;

grains(condition)

%%
% If we now perform grain reconstruction a second time these small holes
% will be assigned to the neighbouring grains

grains = calcGrains(ebsd(grains(condition)),'keepNotIndexed')

plot(grains)

%%
% We see that all small unindexed regions has been filled. Another way for
% correcting EBSD data is to filter them accoring to quality measures like
% MAD or band contrast. Lets plot the band contrast of our measurements

plot(ebsd,ebsd.bc)

colorbar

%%
% We see that there is a rectangular region in top left corner which low
% band contrast. In order to filter out all measurements with low band
% contrast we can do

condition = ebsd.bc > 80;

plot(ebsd(condition))

%%
% Although this filtering has cleared out large regions. The grain
% reconstruction algorithm works still well.

grains = calcGrains(ebsd(condition))

plot(grains)
Loading

0 comments on commit 39ac1b6

Please sign in to comment.