mtex-toolbox / mtex

MTEX is a free Matlab toolbox for quantitative texture analysis. Homepage:
http://mtex-toolbox.github.io/
GNU General Public License v2.0
281 stars 185 forks source link

Updating grain boundaries after removing 'small' grains with less than 10 indexed points #99

Closed DavidMainprice closed 8 years ago

DavidMainprice commented 8 years ago

Dear Ralf,

I have wondered for some time why there were grain boundary segments in some grains when they should have been removed. Starting with small submap of the mtexdata forsterite

map_ebsd_subregion_manuel_selection_map (GitHub cannot handle pdfs, so I use png)

I using the script below, I did the usual calcGrains .... [grains,ebsd_subregion.grainId,ebsd_subregion.mis2mean] = calcGrains(ebsd_subregion('indexed'),'angle',15*degree) This worked fine. Then I plotted mis2mean map with grain boundaries

map_ebsd_mis2mean_with_gbs_map_all_phases

You can see 2 grains (one 'of' and one 'di') with one indexed point.

map_ebsd_in_grains_with_gbs_map_all_phases

Then I remove grains with less than 10 indexed points. selected_grains = grains(grains.grainSize > 10);

I made a new plot mis2mean with grain boundaries

map_ebsd_mis2mean_with_gbs_map_all_phases_after_small_grain_removed

The ebsd indexed points have been removed, but the grain boundaries is not updated.

I tried to re-calculated with the ebsd points in the grains, minus the grains that should have been removed.

ebsd2 = ebsd_subregion(selected_grains) [grains,ebsd_subregion.grainId,ebsd_subregion.mis2mean] = calcGrains(ebsd2('indexed'),'angle',15*degree)

this gives an error, but I do not see another way to update the grain boundaries.

Error using EBSD/set.grainId (line 118) The list of grainId has to have the same size as the list of ebsd data.

Error in dynProp/subsasgn (line 125) dp = builtin('subsasgn',dp,s,value);

Error in EBSD/subsasgn (line 43) ebsd = subsasgn@dynProp(ebsd,s,b);

all the best David

GitHub cannot handle a file like Test_Fo_Map_small_grain_removal.m

zmichels commented 8 years ago

David, I think the problem is the output in your second attempt to calculate grains doesn't modify the ebsd dataset you input (ebsd2)... instead it is trying to modify the variable "ebsd_subregion", which already has grain ID's from the first calculations you did.

Does it work if you do this instead?

[grains,ebsd2.grainId,ebsd2.mis2mean] = calcGrains(ebsd2('indexed'),'angle',15*degree)
DavidMainprice commented 8 years ago

Dear Zachary,

Thanks for point that out, yes it does work now.

all the best David

Le 29 sept. 2015 à 18:43, Zachary Michels notifications@github.com a écrit :

David, I think the problem is the output in your second attempt to calculate grains doesn't modify the ebsd dataset you input (ebsd2)... instead it is trying to modify the variable "ebsd_subregion", which already has grain ID's from the first calculations you did.

Does it work if you do this instead?

[grains,ebsd2.grainId,ebsd2.mis2mean] = calcGrains(ebsd2('indexed'),'angle',15*degree)

— Reply to this email directly or view it on GitHub https://github.com/mtex-toolbox/mtex/issues/99#issuecomment-144115387.