Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added option "minPixel" not to need to do Option 1.
Option 2. just skips the generation of grains object so slight speed up. (performs the same tesselation first run as second)
Option 3 and 4 perform first modified tesselation/graincalculation first run - either as scalar ebsd map (spatialDecomposition.m) or unit cell, and they produce the same grain map. - "major speed up".
Please try
e = ebsd;
e= e.gridify;
e1 = e;
Option 1:
tic
[g,e.grainId] = calcGrains(e);
e(g(g.grainSize<5)) = [];
e=e.gridify;
g=calcGrains(e);
toc
Option 2:
tic
g1 = calcGrains(e1,'minPixel',5);
toc
Option 3:
tic
g2 = calcGrains(e1,'minPixel',5,'byScalar');
toc
Option 4:
tic
g3 = calcGrains(e1,'minPixel',5,'byUnitCell');
toc
% Elapsed time is 29.616039 seconds.
% Elapsed time is 28.059836 seconds.
% Elapsed time is 19.381225 seconds.
% Elapsed time is 17.654077 seconds.
%
% Phase Grains Pixels Mineral Symmetry Crystal reference frame
% 1 3401 635157 Copper m-3m
% g1 = grain2d
%
% Phase Grains Pixels Mineral Symmetry Crystal reference frame
% 1 3401 635157 Copper m-3m
%
% g2 = grain2d
%
% Phase Grains Pixels Mineral Symmetry Crystal reference frame
% 1 3347 634138 Copper m-3m
% g3 = grain2d
%
% Phase Grains Pixels Mineral Symmetry Crystal reference frame
% 1 3347 634138 Copper m-3m