mtex icon indicating copy to clipboard operation
mtex copied to clipboard

inconsistent grains from calcGrains(EBSD(ebsd)) and calcGrains(ebsd.gridify)

Open vtvivian opened this issue 10 months ago • 1 comments

The current implementation of calcGrains produces different behaviour depending on whether ebsd isa @EBSDSquare/Hex vs @EBSD, which the user may not be expecting, esp if not keeping track of the EBSD map type.

It looks like because calcGrains calls spatialDecompositionAlpha for gridded EBSD data instead of spatialDecomposition (which doesn't use alpha shapes). Another related issue is that spatialDecompositionAlpha doesn't check for the 'unitcell' flag, so if you use gridified EBSD data it automatically goes to the voronoi method.

Can we change this so that alpha shapes are used only with an explicit flag?

What do you want to do? reconstruct grains from ebsd map using calcGrains

What code do you use? Please provide minimalist code with code in the following form

mtexdata twins
ebsd = ebsd.gridify;

grainsSquare = calcGrains(ebsd)
grainsScatter = calcGrains(EBSD(ebsd))


% plot a pole figure
plotPDF(ebsd,Miller(1,0,0,ebsd.CS)

What result do you get

grainsSquare = grain2d
 
 Phase  Grains  Pixels    Mineral  Symmetry  Crystal reference frame
     1     121   22833  Magnesium     6/mmm       X||a*, Y||b, Z||c*
 
 boundary segments: 3826 (1149 µm)
 inner boundary segments: 4 (1.2 µm)
 triple points: 114
 
 Properties: meanRotation, GOS
 
>> grainsScatter
 
grainsScatter = grain2d
 
 Phase  Grains  Pixels     Mineral  Symmetry  Crystal reference frame
     0       7      46  notIndexed                                   
     1     121   22833   Magnesium     6/mmm       X||a*, Y||b, Z||c*
 
 boundary segments: 4480 (1170 µm)
 inner boundary segments: 4 (1.2 µm)
 triple points: 125

What result do you expect grainsScatter and grainsSquare should be identical

What MTEX version do you use? MTEX 6.0.0

vtvivian avatar Jan 16 '25 17:01 vtvivian