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
278 stars 183 forks source link

BUG when adding phases to an EBSD map #1929

Closed AzdiarGazder closed 11 months ago

AzdiarGazder commented 1 year ago

What do you want to do? Segment an ebsd map containing 1 phase (say ferrite) into multiple similar phases (like acicular ferrite, bainite, polygonal ferrite etc).

What data do you have? Using the mtex default dataset "ferrite".

What code do you use?

% clear variables
clc; clear all; clear hidden; close all;
% start Mtex
startup_mtex;
% load mtex example data
mtexdata ferrite
ebsd.phaseMap = [0; 1]; % over-writing the strange numbers in the MTEX dataset

CS = ebsd.CS;
CS1 = CS;
CS1.mineral = 'Bainite';
CS1.color = [1 0 0];

% add the new phases to the EBSD data set
ebsd.CSList{end+1} = CS1;
% based on the EBSD map, give this new symmetry a phase number
ebsd.phaseMap(end+1) = max(ebsd.phaseMap) + 1;
% change the phase number of the microconstituent to the new phase number
ebsd(ismember(ebsd.grainId,grains_bainite.id)).phase = 2;

What result do you get The mineral name for ebsd.CS, CS and CS1 ALL change (erroneously) to 'Bainite'. Furthermore, other properties, like color, number etc are also getting erroneously changed for other phases. This leads to errors when ebsd data is being re-assigned to new phases.

What result do you expect Only the mineral name (and other properties) for CS1 to change. Also, to enable an error free re-assignment of ebsd data to the new phases.

Error Message NO error message.

What MTEX version do you use? MTEX Developer 5.9.0

AzdiarGazder commented 11 months ago

Hi everyone,

Here is Ralf's suggested solution to this issue: To create multiple phases in an EBSD map, go to: ~\mtex\geometry\@symmetry\symmetry.m ...and replace the first line with the following line: classdef symmetry < matlab.mixin.Copyable

Following that, here are the commands to help you segment a map fraction as a new phase:

% define the crystal symmetry of the new phase(s)
CS_newPhase = copy(CS);

% assign a phase name to the new crystal symmetry
CS_newPhase.mineral = 'newPhase';

% assign a color to the new crystal symmetry
CS_newPhase.color = [1 0 0];

% add the new symmetry to the EBSD data set
ebsd.CSList{end+1} = CS_newPhase;

% assign phase numbers to the new symmetry
% in this example, the phase number is assumed to be 2
ebsd.phaseMap(end+1) = max(ebsd.phaseMap) + 1;

% change a map fraction to the new phase number
ebsd(ismember(ebsd.grainId, grains_newPhase.id)).phase = 2;

Hope this helps.

Warm regards, Azdi