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
274 stars 182 forks source link

Different size outputs (between 5.10.2 and 5.11.2) when indexing from "gridified" EBSD data #2128

Open zmichels opened 2 months ago

zmichels commented 2 months ago

What do you want to do? I want to use code that worked with v5.10.2 with v5.11.2

What data do you have? mtexdata forsterite

What code do you use? I am trying to setup a sliding-window style analysis that works in 5.10.2, but does not work in 5.11.2.

Please provide minimalist code with code in the following form

% load data
mtexdata forsterite

% gridify
egrid = ebsd('indexed').gridify;

% ebsd ids in grid/matrix
ids = egrid.id;

% size of matrix
[a1,b1] = size(ids);

% window width
w = 3;

% indices/ids of center points
row = 2:1:max(a1)-1;
col = 2:1:max(b1)-1;

inds = ids(2:a1-1,2:b1-1);
eId = inds(:);

phases = unique(egrid.phase);

%% initialize window
num = length(eId);

win1 = zeros(num,w*w);

for s = 1:num
    % s = 1;
    c = inds(s);

    win1(s,:) =   [   c-a1-1     c-1    c+a1-1    c-a1       c      c+a1  c-a1+1     c+1    c+a1+1   ];

end

%% assign rotations

% phase IDs
pID = egrid(win1).phase;

size(pID)

What result do you get with 5.10.2, the resultant size of variable 'pID' is 243820 x 9

with 5.11.2, the resultant size of variable 'pID' is 2194380 x 1

What result do you expect I expect indexing to work the same such that the size of returned variables matches with previous versions of MTEX


**What MTEX version do you use?**
5.11.2 and 5.10.2
zmichels commented 2 months ago
mtexdata forsterite
p = ebsd.gridify.phase;

with MTEX 5.10.2,

size(p)

returns: ans =

336 732

With 5.11.2, it returns: ans =

  245952           1
ralfHielscher commented 1 month ago

Hi Zach, is this still a big issue for you? I can confirm, that ebsd.phase has changed its shape from M x N to MN x 1. Unfortunately, I do not recall why I did this. It is marked as a bug fix. After all you can always do

reshape(ebsd.phase,size(ebsd))

Ralf.