Closed RicCNR closed 9 years ago
Sorry, I meant MTEX 3.5.0 on Matlab R2011b (version 7.13)
Thank you
Is there any chance to switch to MTEX 4.0. In this case I could provide a solution:
% reconstruct grains
grains = calcGrains(ebsd('indexed'),'angle',2*degree)
% consider only phaseName to phaseName grain boundaries
gBph2ph = grains.boundary('phaseName','phaseName');
% restrict to twin boundaries with threshold 2 degree
isTwinning = angle(gBph2ph.misorientation,CSL(3)) < 2*degree;
twinBoundary = gBph2ph(isTwinning)
% plot the twinning boundaries
plot(ebsd,ebsd.orientations)
hold on
plot(twinBoundary,'linecolor','b','linewidth',2,'displayName','twin boundary')
hold off
% merge twins along twin boundaries
[mergedGrains,parentIds] = merge(grains,twinBoundary)
% plot the merged grains
plot(ebsd,ebsd.orientations)
hold on
plot(mergedGrains.boundary,'linecolor','b','linewidth',1.5,'linestyle','-',...
'displayName','merged grains')
hold off
% remove boundary grains
% this gives the boundary ids that are cutted
boundaryIds = mergedGrains.boundary.hasPhaseId(0);
% the corresponding grain ids are
grainId = unique(mergedGrains.boundary(boundaryIds).grainId(:,2))
% remove those grains from the list
mergedGrains(grainId) = []
% output
plot(mergedGrains)
Maybe this looks a bit complicated, but look more closely we attempted to make it more logical.
Ralf.
Hi Ric,
this is not a bug. What you see is a phase plot - the new default in MTEX 4.0. For a single phase data set this makes not so much sense. To plot the orientations do
plot(ebsd,ebsd.orientations)
more details can be found here: http://mtex-toolbox.github.io/files/doc/EBSDSpatialPlots.html Thank you for asking these questions.
Ralf.
Dear Ralf, thank you again for your indications. You had right about "plot(ebsd,ebsd.orientations)". About my case, some problem remains. I am using your useful indication about the recontruction and merge grains. The starting file.txt (with a single phase 1 denoting by a corresponding column) is loaded but with an addictional pass in Crystal Symmetry respect to the previous MTEX version, indeed a "not indexed" phase0 is present, after the aforesaid indexed phase 1 (in my case named 'Iron'):
The most important messages are (step by step):
1) Immediatily before to finish the importing wizard: phase 1 (Iron): symmetry 432, 196608 orientations phase 0 (not Indexed): not indexed, 0 orientations
After to finish the wizard procedure and to load the obtained file.m:
2) plot(ebsd,ebsd.orientations)
3) grains = calcGrains(ebsd('Iron'),'angle',2*degree)
grains = grain2d (show methods, plot)
Phase Grains Mineral Symmetry Crystal reference frame Phase
1 1890 Iron 432
Properties: GOS, meanRotation
4) gBph2ph = grains.boundary('Iron','Iron');
Error using | Inputs must have the same size. Error in grainBoundary/hasPhase/convert2Id (line 133) ph = ~cellfun('isempty',regexpi(gB.mineralList(:),['^' ph])) | ...
So I try to write:
5) gBph2ph = grains.boundary
gBph2ph = grainBoundary (show methods, plot) Segments mineral 1 mineral 2 29031 Iron Iron 1792 Iron not indexed
So follows: 6) isTwinning = angle(gBph2ph.misorientation,CSL(3)) < 2*degree;
Error using phaseList/checkSinglePhase (line 258) This operatorion is only permitted for a single phase! Please see modify EBSD data for how to restrict EBSD data to a single phase.
So, I don't know because It does not seems to see correctly my one phase (if this is the real issue). Are you an idea about that? Can you help me?
I am very sorry, and maybe I am disturbing you, but this can be very important for me (and, also for other users, I hope..)
Thank you again
Ric
Hi Ric,
would it be somehow possible to attache the data file? That
grains.boundary('Iron','Iron')
gives an error is a bug and I would like to check this. That the line
isTwinning = angle(gBph2ph.misorientation,CSL(3)) < 2*degree;
gives an error is due to the fact, that you have also outer grain boundaries, i.e., where is no neighboring grain and clearly for those not misorientation can be assigned.
Maybe, I should make the error message a bit more exhaustive.
Ralf
Hi Ralf, I can attach the file if it can be useful. At this moment I cannot to do it, but as soon as possible (about one week) ) I am going to attach it. Meanwhile, I would comment you useful indication about "isTwinning": by MTEX 3.5.0, by the same file that I am working and that I will send to you, the CSL (3) boundaries recognition and the following merging operation was maked by easy way, for instance without issues that you you have indicated: do you think that it is possible "to traslate" this easiness (or simply solve) on new version MTEX? I hope that my file will be useful for you about that.
Thank you again.
Ric
Dear Ralf, I have just send to you (by your mail address) the file with the data issue that you I asked. I hope that it can be useful. Meanwhile, I have just installed the MTEX version 4.0.5 and about the CSL(3) recognition real improvements are present. So, about your aforesaid indications, the boundaries CSL (3) are found correcly, but at the following command, correpsonding to the fundamental merge operation
% merge twins along twin boundaries
[mergedGrains,parentIds] = merge(grains,twinBoundary)
it show that:
Error using setdiff (line 51)
A and B must be vectors or 'rows' must be specified.
Error in grain2d/merge (line 30)
[keepId,keepInd] = setdiff(grains.id,mergeId);
What is the meaning?
And, in addiction, about the CSL(5), CSL(7) and CSL(11) recognition, that was present in MTEX 3.5.0, it is possibile to make something? Indeed, writing for instance:
isTwinning2 = angle(gBph2ph.misorientation,CSL(5))<2*degree;
we have:
Also in this cases, sorry for my questions, but I think useful them for all users.
Thank you again
RicCNR
Hi RicCNR,
thank you for the data. The reason for the error message above is that CSL(5) is not only one misorientation but a list of misorientations and, hence, you want to check that the minimum distance to one of these misorientations is less then 2 degree. Since the corresponding syntax is not that simple I decided to provide an extra function
gB.isTwinning(CSL(5),2*degree)
that returns a list of true/false depending whether the a boundary segment is a close to one of the misorientations in the list or not.
The full code reads as follows
% import the data
CS = crystalSymmetry('cubic','mineral','iron')
ebsd = loadEBSD(fullfile(mtexDataPath,'EBSD','CNR.txt'),CS,...
'ColumnNames',{'phase','x','y','phi1','Phi','phi2','IQ','CI','error'})
% compute grains
[grains,ebsd.grainId] = calcGrains(ebsd('indexed'));
% consider only iron - iron grain boundaries
gB = grains.boundary('iron','iron')
% select grain boundaries by misorientation
gB3 = gB(gB.isTwinning(CSL(3),5*degree));
gB5 = gB(gB.isTwinning(CSL(5),5*degree));
gB7 = gB(gB.isTwinning(CSL(7),5*degree));
gB11 = gB(gB.isTwinning(CSL(11),5*degree));
The variables gB1
to gB11
now contain lists of boundary segments that have the requested misorientation. Note that one can easily ask for the relative amount of the segments by
length(gB1) / length(gB)
In order to visualize the you can do
% some background
plot(ebsd,ebsd.prop.iq)
mtexColorMap black2white
hold on % start override mode
plot(grains.boundary) % plot all boundaries
plot(gB3,'lineColor','g','linewidth',2,'DisplayName','CSL 3')
plot(gB5,'lineColor','b','linewidth',2,'DisplayName','CSL 5')
plot(gB7,'lineColor','r','linewidth',2,'DisplayName','CSL 7')
plot(gB11,'lineColor','m','linewidth',2,'DisplayName','CSL 11')
hold off % stop override mode
The result will be
Note, that is not yet present in MTEX 4.0.5. So, please remark on these functions and after you like them I will upload a new version MTEX 4.0.6.
Ralf
Dear Ralf, I am observing your new function about CSL boundaries and I think that it is very good improvement, especially because it makes more immediate and direct to process these special boudaries. It can be very useful for a developed MTEX 4.0. version. At this point, about the issue and the merging processes, I ask: the right command should be, for instance
[mergedGrains,parentIds] = merge(grains,gb3);
Is it correct and working?
(I remember to you that it did not seem to work by merge(grains,twinBoundary)
, like I showed in a aforesaid comment)
And, about my specific issue, will be preserve the right of the procedure about the cutted outer grains removing? (I ask that because I remember that by MTEX 3.5.0, after merging process, the select_full_grains
function did not seem to work).
Thank you very much for everything Ralf.
Regards RicCNR
Hi RiCNR,
you are absolutely right [mergedGrains,parentIds] = merge(grains,gb3);
is the correct syntax for mergin grains. How to remove boundary grains in MTEX 4.0 is explain here http://mtex-toolbox.github.io/files/doc/GrainStatistics.html.
I would be very happy if you could help me writing some example usage of this functionality, i.e., detection of twin boundaries, statistical evaluation, merging of grains .... As I'm not a material scientist I do not really know what is important and what are the right questions. I'l try to upload MTEX 4.0.6 as soon as possible, so that you can test the new function.
Ralf.
Hi Ralf, I can certainly help you by some indication,simple example or procedure steps, about the materials science for instance, if it can be useful. Only one goodwill: i must ask you about research privacy , i.e., to not show in free comments the figures of the file that I sent to you,. A part of that, I can absoultely help .you. I remain waiting for MTEX 4.0.6, as soon as possible I will inform you about its functionality.
Thank you again
RicCNR
Hi Ralf, I am testing you new function gb.isTwinning by MTEX 4.0.6 on Matlab2011 R2011b (version 7.13). Unfortunately it is not working and I do not understand the reason, also because I saw the image that you meked with the file that I sent to you. I followed every pass that you indicated, on the same aforesaid file, until the error message:
CS = crystalSymmetry('cubic','mineral','iron') ebsd = loadEBSD(fullfile(mtexDataPath,'EBSD','CNR.txt'),CS,... 'ColumnNames',{'phase','x','y','phi1','Phi','phi2','IQ','CI','error'})
[grains,ebsd.grainId] = calcGrains(ebsd('indexed'));
gB = grains.boundary('iron','iron')
And then this is the error step:
gB1 = gB(gB.isTwinning(CSL(1),5*degree)); Error using grainBoundary/isTwinning Error: File: isTwinning.m Line: 24 Column: 6 Expression or statement is incomplete or incorrect. Error in grainBoundary/subsref (line 32) [varargout{1:nargout}] = builtin('subsref',gB,s);
gB3 = gB(gB.isTwinning(CSL(3),5*degree)); Error using grainBoundary/isTwinning Error: File: isTwinning.m Line: 24 Column: 6 Expression or statement is incomplete or incorrect. Error in grainBoundary/subsref (line 32) [varargout{1:nargout}] = builtin('subsref',gB,s);
Let me know Thank you very much
RicCNR
Hi RicCNR,
sorry this was my mistake. Could you check out mtex-4.0.7?
Thank you very much, Ralf.
Hi Ralf, now the isTwinning function works by MTEX 4.0.7. It is OK. About the issue, the problem about the merging operation remains, indeed, after the individuation of CSL boundary by the aforesaid steps, if I write:
[mergedGrains,parentIds] = merge(grains,gB3);
This is the error:
Error using setdiff (line 51) A and B must be vectors or 'rows' must be specified.
Error in grain2d/merge (line 30) [keepId,keepInd] = setdiff(grains.id,mergeId);
that was already present from MTEX 4.0.0, while it worked in MTEX 3.5.0.
Let me know, also because this is a very important step for me, but also for other users. Indeed, once solved that, and followed the removing step of the truncated grains by the map boundaries, an actual statistic study on the grains is possible,
Thank you very much for all
RicCNR
Hi RicCNR,
thank you very much for all your reports. I've corrected the mentioned bug in MTEX 4.0.8.
Ralf
Hi Ralf, MTEX 4.0.8 works very good about the aforesaid issues. About me two bugs seem to remain, but I prefer open a new discussion, to not write too comments into one and to not confuse.
Thank you
RicCNR
Hi RicCNR,
would you mind if I use your data for documentation in MTEX? If you want to keep you data secret do you have some similar data to demonstrate CSL boundaries?
Thank you,
Ralf.
Hi Ralf, thank you for your consideration and sorry for my delay on the answer. Unfortunately the data that I worked (and that you have seen) are secret data about a public demonstration or publication, for now at least. However, I will try to find to you opportune data, similar to that aforesaid (about the same argument), as soon as possible.
Regards
RicCNR
----Messaggio originale----
Da: notifications@github.com
Data: 20/02/2015 17.28
A: "mtex-toolbox/mtex"mtex@noreply.github.com
Cc: "RicCNR"rickyd5@libero.it
Ogg: Re: [mtex] Removing "merged" grains truncated by the map boundaries (#7)
Hi RicCNR,
would you mind if I use your data for documentation in MTEX? If you want to keep you data secret do you have some similar data to demonstrate CSL boundaries?
Thank you,
Ralf.
— Reply to this email directly or view it on GitHub.
Hi, thank you very much for your MTEX. I am determining the grain size from EBSD maps, removing the grains near the edge of map that are truncated by the map boundary. I am working by MEX 3.5.0 with Matlab 11 (because of the present limits of my PC). About this, I have seen that you developed the very useful function "select_full_grains.m". In my case, before to apply it, I should merge my grains with CSL(3) boundaries in a new grains object. But, after that, the function does not work (while it works very well on the original grain object without merging). These are the steps (error message included):
The resolution is very important for me: could you help me about this my issue, or give some indication where to find the relevant answers?
Thank you very much again Best regards
Riccardo Researcher at the National Research Council of Italy, Milan