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

Extract ebsd data from grains with MTEX 4.1.4 #119

Closed MarcoWitte1 closed 8 years ago

MarcoWitte1 commented 8 years ago

Hi Ralf,

how can I extract the original ebsd data from a single grain or a grain set with MTEX 4.1.4? For example, grains(1) and ebsd(grains(1)) does not work properly, the resulting number of pixels are not the same. Also with the grainId I can not get the correct ebsd pixels.

All the best, Marco

ralfHielscher commented 8 years ago

Hi Marco,

the following should work

[grains,ebsd.grainId] = calcGrains(ebsd)
ebsd(grains(1))

Ralf.

MarcoWitte1 commented 8 years ago

Hallo Ralf,

but this causes another problem with the grain ID's when I want to merge the grains:

Index exceeds matrix dimensions.
Error in grain2d/merge (line 62)
grains_merged.poly(newInd) = grains.poly(keepInd); 

Marco

ralfHielscher commented 8 years ago

Hi Marco,

I'm afraid this is way to short for me to understand what you want to do.

Ralf.

MarcoWitte1 commented 8 years ago

Hi,

sorry, that was really not very datailed. When I use

[grains,ebsd.grainId] = calcGrains(ebsd)

and then merge these grains like this:

gb= grains.boundary('1','1');
ind = angle(gb.misorientation,ori)<5*degree;
[grains_merge, grains_merge_id] = merge(grains,gb(ind));

I get the error

Index exceeds matrix dimensions.

Error in grain2d/merge (line 62)
grains_merged.poly(newInd) = grains.poly(keepInd);

I don't get any error when I just use

grains = calcGrains(ebsd)

to calculate the grains, but then the grain ID's are not correct.

Marco

ralfHielscher commented 8 years ago

Could you please share your data set and also post what is ori. With out data sets I can not reproduce this bug.

Ralf.

MarcoWitte1 commented 8 years ago

Hi,

actually there is no bug! I just forgot to update the grain boundary indexing

gb= grains.boundary('1','1');
ind = angle(gb.misorientation,ori)<5*degree;

after calculating the grain ID's... Now everything works fine!

Thank you very much! Marco