the grains of a map: a table of ids, phases, pixel counts, mean orientations and properties, with the boundary, the inner boundary and the polygon of every grain; MATLAB’s grain2d
Syntax
grains = calcGrains(ebsd)
The grains of a map.
grains = grain2d(grains.id, grains.phaseId, grains.CSList, grains.numPixel, grains.meanRotation, grains.GOS, grains.frame, boundary=grains.boundary)
A table from its columns.
grains['Forsterite']
The grains of one phase.
grains[grains.numPixel > 10]
The grains of a condition.
grains.selectByGrainId([1, 2, 3])
The grains of these ids.
Description
Grains are made by calcGrains, which segments a map; the constructor takes the columns of the table and the boundaries of a segmentation. The polygon of a grain is the loops of the boundary segments that carry its id, traced from the boundary when no loops are given, so grains without a boundary have no polygon and no shape. A property given in prop, or assigned as grains.name = values, is one value per grain and follows every selection.
MATLAB builds grains also from vertices and polygons, grain2d(V, poly, ori, CSList); here grains come from a segmentation alone.
Input
id |
integer array, the id of every grain |
phaseId |
integer array, the position of every grain’s phase in CSList |
CSList |
phaseList, the frames of the phases |
numPixel |
integer array, the number of pixels of every grain |
meanRotation |
rotation, the mean orientation of every grain as a rotation from the crystal to the specimen |
GOS |
array, the grain orientation spread of every grain in radians |
frame |
specimenFrame, the frame the grains lie in |
Keywords
| keyword | default | description |
|---|---|---|
prop |
dict of further properties, one value per grain, read as grains.name or grains.prop[‘name’] | |
boundary |
grainBoundary, the segments between the grains and to the outside of the map | |
innerBoundary |
grainBoundary, the segments inside the grains, the low angle boundaries of a segmentation with two thresholds | |
loops |
the polygon of every grain as loops of boundary segments; traced from boundary when not given | |
phaseMap |
the phase number of the file for every entry of CSList |
Output
grains |
grain2d |
Properties
id |
grain ids; these need not equal positions in a selected grain list |
phaseId |
phase-list index of each grain |
meanOrientation |
mean orientations for a single-phase grain selection |
numPixel |
number of measurements assigned to each grain |
GOS |
grain orientation spread in radians |
boundary |
grainBoundary segments separating grains or bordering the map |
innerBoundary |
low-angle segments within grains, when reconstructed |
area |
area enclosed by each polygon, in squared spatial units |
centroid |
geometric centroid of each grain outline |
prop |
additional data with one value per grain |
frame |
specimenFrame in which the geometry is expressed |
See also
calcGrains, grain2d.merge, grain2d.selectByGrainId, grainBoundary, GrainReconstruction, SelectingGrains, GrainSpatialPlots, ShapeParameters
Members
| allV | the vertices of the boundary as framed points of the specimen |
| area | the area an outline covers, its holes taken off |
| aspectRatio | the ratio of the two half axes, one for a circle |
| boundarySize | the number of vertices on the loops of an outline, the holes included |
| calcTraces | the traces of subregions of a map or of sets of grains, the direction their lamellae run along |
| caliper | the caliper, the Feret diameter, of every outline: its width across a direction, or the longest or the shortest width as a framed axis of that length |
| cat | the grains of several parts of one segmentation, MATLAB’s [grains1, grains2]: the parts share its phases, frame and boundary vertices |
| centroid | the centroid of the area, holes taken off, as a framed point |
| checkInside | whether points lie inside the outlines: within the outer loop and outside the holes, as a (points, outlines) matrix |
| copy | a copy of the grains with their own table and properties, the boundaries shared |
| cs2phaseId | the phase id of a frame, a mineral name or a number, MATLAB’s cs2phaseId |
| CS | the crystal frame of the one indexed phase of the grains, an error where there are several |
| diameter | the largest distance between two vertices of the outer loop, which two of its hull vertices span |
| equivalentPerimeter | the perimeter of the disc of the same area, 2 pi times the equivalent radius |
| equivalentRadius | the radius of the disc of the same area, sqrt(area / pi) |
| findByLocation | the positions of the outlines a point lies in the position of the outline holding each point, -1 for a point in none |
| findByOrientation | select grains whose mean orientation is close to a reference orientation or fibre |
| fitEllipse | describe each outline by the ellipse with the same central second area moments |
| grain2d | the grains of a map: a table of ids, phases, pixel counts, mean orientations and properties, with the boundary, the inner boundary and the polygon of every grain |
| grainSize | the number of pixels of every grain, grains.numPixel |
| hasHole | whether an outline has holes, one entry per outline |
| hist | histogram(grains), histogram(grains, prop, bins): the area weighted distribution of a grain property as one histogram per indexed phase, drawn over each other, or with grouped=True side by side (MATLAB’s hist) |
| histogram | histogram(grains), histogram(grains, prop, bins): the area weighted distribution of a grain property as one histogram per indexed phase, drawn over each other, or with grouped=True side by side (MATLAB’s hist) |
| how2plot | the plotting convention of the specimen frame the grains are written in |
| hull | the grains with their convex hulls for polygons: the hull edges form the boundary, with nothing on the other side, and there is no inner boundary |
| id2ind | the positions of grain ids in this list the positions of grain ids in the list, in the shape of the ids: one for a number, a pair per boundary segment for gB.grainId |
| inclusionHost | the id of the grain whose hole the grain lies in, 0 for none: every grain bordering a hole of another, MATLAB’s second output of isInclusion |
| indexedPhaseId | the ids of the indexed phases present among the grains |
| inpolygon | the mask of the outlines whose centroid lies inside a rectangle [xmin, ymin, dx, dy] or a polygon (N, 2), edges included, as MATLAB’s |
| isBoundary | a grain that touches the border of the map |
| isInclusion | a grain that sits inside the hole of another one: where the grain lies, not what it touches |
| isIndexed | whether each grain belongs to an indexed phase |
| longAxis | the long half axis of the ellipse of every outline, the larger principal component |
| meanOrientation | the mean orientations of the grains of the one indexed phase present |
| merge | the grains joined into one along given boundaries, by pairs of ids, by a label per grain, below a misorientation angle, or every inclusion into the grain around it |
| mineral | the mineral name of the one indexed phase of the grains |
| mineralList | the mineral names of the phases of the phase list |
| N | the normal of the plane the map lies in, as a direction of the specimen |
| neighbors | the pairs of ids of grains sharing a boundary, both in the selection, or either with full |
| numNeighbors | the number of grains every grain shares a boundary with, the neighbours outside the selection included |
| paris | measure how strongly an outline is indented relative to its convex hull |
| paror | the cumulative particle projection function of the outlines (Panozzo 1983) |
| perimeter | the length of the outer loop of an outline, as MATLAB’s default |
| phase | the phase number of every grain as the file numbered it |
| plane | the plane the map lies in, a mapPlane |
| plot | the grains of a map as polygons, coloured by phase, by a value or by orientation, with their boundaries on top |
| principalComponents | the two half axes of the ellipse with the same second area moments as every outline, the long one first, as antipodal vectors of the specimen frame |
| quiver | arrows: tangent vectors at directions, a vector or axis field on the sphere, arrows at orientations in the sections of the current figure, or directions on a map or a volume |
| reduceBoundary | the grains with every n-th vertex of their boundary kept along each chain, whatever the shape, the inner boundary kept on it |
| refineBoundary | the grains with their boundary and inner boundary refined, every segment split into pieces of about length delta |
| rotate | rotate(x, rot) is x.rotate(rot), or rot * x for an object without that method |
| scanUnit | the unit of the map the grains were reconstructed from, as their boundary carries it |
| selectByGrainId | the grains named by id, in the order asked for |
| shape | the shape of the list of grains, (size,) |
| shapeFactor | compare an outline’s perimeter with that of a circle of equal area |
| sharedVertices | the vertices both boundaries walk over: a vertex where an inner boundary ends on the outer one has degree two to either and would be dissolved, leaving the other hanging off a vertex its walk no longer reaches |
| shortAxis | the short half axis of the ellipse of every outline, the smaller principal component |
| simplifyBoundary | the grains with the vertices of their boundary that carry no shape dropped, those whose removal moves the boundary by less than epsilon, the inner boundary kept on it |
| size | the number of grains |
| smoothBoundary | the grains with the pixel staircase of their boundaries turned into smooth curves |
| subBoundaryLength | the length of the subgrain boundaries inside every grain, of the inner boundary segments sel selects if given |
| subBoundarySize | the inner boundary of every grain: how many segments of the subgrain boundaries lie in it |
| subsref | |
| text | text at directions on the sphere, at the measurements or grains of a map, or at a point of the current axes |
| triplePoints | the triple points of the grain boundary |
| update | the grains with the phase of every boundary segment read off the grain it borders, as it has to be after the grains changed phase (MATLAB grains.update) |
| V | the vertices of the boundary in the coordinates of the map plane, (n, 2) |
MATLAB’s grain2d_index
source
Citing this page.
This page is part of the documentation of
MTEX, a free and open
source MATLAB toolbox for analyzing and modeling crystallographic textures.
It was written by The MTEX Developers and is published at
https://mtex-toolbox.github.io/grain2d_index_py.html.
If you use MTEX, or reuse text or figures from this page, in your research,
please cite
F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63
BibTeX
@article{bachmann2010mtex,
author = {F. Bachmann and R. Hielscher and H. Schaeben},
title = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
journal = {Solid State Phenomena},
volume = {160},
pages = {63-68},
year = {2010},
doi = {10.4028/www.scientific.net/SSP.160.63},
url = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}
Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.