Combining/merging multiple EBSD maps

1,303 views
Skip to first unread message

Hagen Bender

unread,
Jun 10, 2016, 7:47:12 AM6/10/16
to MTEX
Dear all,

I am using MTEX 4.3.1. My script is attached.

I would like to merge multiple EBSD maps that were collected with 10% overlap. Unfortunately the individual maps need to be scaled. I scale the second map by modifying the unit cell with a scaling factor and shifting distance, which I found by trial-an-error until the overlapping parts of the maps match. 

I stitch the individual maps by concatenating the maps:
ebsd =[ebsd1 ebsd2];

The ebsd.id was somewhat messed up and I fixed it like this:

l = length(ebsd.phaseId);


% create matrix to replace the false ebsd.id

A = 1:l;

newId = reshape(A,[l,1]);


ebsd.id = newId;


When I reconstruct the grains from the concatenated ebsd data,

[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',segAngle,'unitCell');


the grains for the right half of the map (former ebsd2) do not reach across rows. Here is a zoom-in of contoured quartz grain boundaries:



Can you think of a solution to fix this issue? Is there a better way to combine multiple maps that need to be scaled? 

Many thanks in advance,
Hagen
Fig01.tif
mergeEBSD.m

Thomas Simm

unread,
Jun 12, 2016, 6:53:57 PM6/12/16
to MTEX
Hi,

Difficult to get a feel for what is causing the problem, have you tried breaking it down into parts?
What do you get if you do calcgrains for ebsd2 (i.e. get rid of joining issue)? 
Or combine ebsd with itself using your joining method (i.e. get rid of issue with diff in step size)?

Hagen Bender

unread,
Jun 13, 2016, 4:11:31 AM6/13/16
to MTEX
Hi Thomas,

Thanks for your reply.

Difficult to get a feel for what is causing the problem, have you tried breaking it down into parts?
Yes, I did. I have two problems with this: 1) Duplicate data in the overlapping parts of the maps. 2) I'd like to treat all maps (in total 5) as a single dataset. 

What do you get if you do calcgrains for ebsd2 (i.e. get rid of joining issue)? 
It works fine with the scaled ebsd2. But I get following problem after cropping the overlapping area with ebsd1:

% region is a rectangle comprising the data to keep

condition = inpolygon(ebsd2,region);

Error message:
Error using EBSD/set.grainId (line 139)
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);
I cannot figure out how grainId is build by MTEX. This could be a solution to the problem.

Or combine ebsd with itself using your joining method (i.e. get rid of issue with diff in step size)?

What do you mean by this? Joining the maps after importing is problematic because 1) both maps begin with coordinates x,y = 0,0 and 2) have different scales. So I need to shift and scale.

Best,
Hagen

Thomas Simm

unread,
Jun 13, 2016, 4:57:49 AM6/13/16
to MTEX
Hi,

My feeling is the code may only work for shifts in the y-direction (i.e. the ebsd data is stacked with increasing y-values)? That is why I suggested trying combining ebsd1 and ebsd1+shift so that you get just the same map repeated in the x-direction.
 
If this doesn't work you should try using gridify or otherwise modifying the ebsd data so it goes like this:
x: 0 1 2 3 4 ..... 0 1 2 3 4
y: 0 0 0 0 0 ..... 1 1 1 1 1

All I could find on merging/combining maps- presumably what you are referring to:

https://groups.google.com/forum/#!topic/mtexmail/UXTqSjcM8gI


Tom

Hagen Bender

unread,
Jun 14, 2016, 9:30:28 AM6/14/16
to MTEX
Hi Tom,

I solved the problem by letting calcGrains perform the a Voronoi decomposition after I cropped the overlapping area from ebsd2. Using unit cell decomposition (with two different grid spacings for ebsd1 and ebsd2) is what caused the problem. Your suggestions gave me the right hint what to look for. Thank you!

This is what works for me now:

% find shifting parameters dx&dy by trial and error

max_ebsd1 = max(ebsd1.x);

ebsd2s = shift(ebsd2imp,[(max_ebsd1-dx), dy]);


% find scaling parameter sc by trial and error

ebsd2 = ebsd2s;


ebsd2.y = ebsd2s.y*sc;

ebsd2.unitCell = calcUnitCell([ebsd2.prop.x(:),ebsd2.prop.y(:)]);


% combine ebsd data

ebsd=[ebsd1 ebsd2];


% remove overlapping part of ebsd2

condition = ebsd2.x>max_ebsd1;

ebsd = [ebsd1 ebsd2(condition)];


% fix ebsd.id

l = length(ebsd.phaseId);

A = 1:l;

newId = reshape(A,[l,1]);

ebsd.id = newId;


% reconstruct grains

[grains,ebsd.grainId,ebsd.mis2mean] = calcGrains(ebsd,'angle',segAngle);


There are some weird grains but they can be easily removed.


Hagen

Thomas Simm

unread,
Jun 14, 2016, 5:08:58 PM6/14/16
to MTEX
Hi Hagen,

Thanks for this, sure it'll be of benefit for MTEX users, I know I'll return to this when I have to do similar.

Tom
Reply all
Reply to author
Forward
0 new messages