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

fliplr and flipud have no effect #142

Closed jhiscocks closed 8 years ago

jhiscocks commented 8 years ago

After loading my ebsd map (named ebsd_H10), I attemted to use the fliplr and flipud functions on the ebsd map as follows;

flipud(ebsd_H10) which gave the output;

ans = EBSD (show methods, plot)

Phase Orientations Mineral Color Symmetry Crystal reference frame 0 562 (9.2%) notIndexed
1 5547 (91%) Magnesium light blue 6/mmm X||a*, Y||b, Z||c

Properties: bands, bc, bs, error, mad, x, y Scan unit : um

However plotting the map using plot(ebsd_H10 ('Magnesium'),ebsd_H10('Magnesium').orientations) showed no difference in the map. I also attempted to use the command on a pole figure as follows;

odf = calcODF(ebsd_H10('Magnesium').orientations,'halfwidth',3*degree);plotPDF (odf, h, 'upper', 'fliplr','minmax', 'contourf',0.5:4) ;

also to no affect as the pole figure was identical to the original version. It is possible I am using this command incorrectly, although there are no errors indicated. What is the correct way to use this function?

Regards, J.Hiscocks

zmichels commented 8 years ago

Hello,

Unfortunately, I don't think you can use flipud and fliplr with the datatypes you are trying to rotate. I believe you will need to apply a rotation to the data using the rotate() function.

The help documentation is useful for explaining how rotations are defined in the mtex platform... the following is copied from the documentation and gives examples of multiple different ways to define a 3D rotation:

rot = rotation('Euler',phi1,Phi,phi2) rot = rotation('Euler',alpha,beta,gamma,'ZYZ') rot = rotation('axis,v,'angle',omega) rot = rotation('matrix',A) rot = rotation('map',u1,v1) rot = rotation('map',u1,v1,u2,v2) rot = rotation('fibre',u1,v1,'resolution',5*degree) rot = rotation('quaternion',a,b,c,d) rot = rotation(q)

You can either first define a rotation and then use the variable to which it assigned to apply it to your data... or you can do it in the call to the rotation() command. The following snippet is from the documentation on rotating an EBSD dataset:

% roate the whoole data set about the z-axis by 90_degree ebsd = rotate(ebsd,10_degree) % rotate about the x-axis ebsd = rotate(ebsd,rotation('axis',xvector,'angle',180_degree)) % roate only the spatial data ebsd = rotate(ebsd,180_degree,'keepEuler')

I hope this helps o get you started.

best, Z

zmichels commented 8 years ago

Also, to rotate an ODF... you can use the same function series I mentioned above.

For example... lets say you want to 'flip' your ODF 180º about the x-axis (like flipud)... you could try the following:

% assuming ODF variable named 'odf' odf_rotated = rotate(odf, rotation('axis', xvector, 'angle', 180*degree));

jhiscocks commented 8 years ago

I didn't realise EBSD maps and pole figures didn't work with the flip commands. Surprisingly, there was no error message, just a lack of effect. I did manage to use the rotate command, but thank you for the added detail on the odf.

Regards, Jessica

zmichels commented 8 years ago

You make a good point that there was no error message. Perhaps it does actually reorder the data structure. The reason it does not result in a change of the way an ebsd map plots is because each orientation is directly tied to a specific x-y point. Such that any reordering of the data does not actually change how it plots whet showing the data at their x-y locations.

jhiscocks commented 8 years ago

Even though I can use rotate to deal with my data, I decided to try plotting a pole figure using plotPDF(ebsd('Magnesium').orientations,h,'upper','eangle','points','all', 'MarkerSize',1);

flipping the data using

flipud(ebsd);

and then replotting the pole figure (which would reveal orientation changes). Even though the flipud(ebsd) command had what looked like valid output, the pole figure was unchanged, so it looks like neither the spatial layout nor the orientation is updated. fliplr also had no effect, nor did the odf plotting. Axes locations as shown by

annotate([xvector, yvector, zvector], 'label', {'x','y', 'z'}, 'BackgroundColor', 'w');

were also unchanged. It looks like this is an empty command of some sort, or it's doing something that is really not obvious.