| Top |
| gboolean | gwy_grain_quantity_needs_same_units () |
| GwyUnit * | gwy_grain_quantity_get_units () |
| gdouble * | gwy_nield_grain_quantity () |
| void | gwy_nield_grain_quantities () |
| gint * | gwy_nield_convex_hulls () |
| gint * | gwy_nield_bounding_boxes () |
| gint * | gwy_nield_bounding_boxes_periodic () |
| gint * | gwy_nield_inscribed_boxes () |
| gint * | gwy_nield_boundary_pixels () |
gboolean
gwy_grain_quantity_needs_same_units (GwyGrainQuantity quantity);
Tests whether a grain quantity is defined only when lateral and value units match.
GwyUnit * gwy_grain_quantity_get_units (GwyGrainQuantity quantity,GwyUnit *unitxy,GwyUnit *unitz,GwyUnit *result);
Calculates the units of a grain quantity.
gdouble * gwy_nield_grain_quantity (GwyNield *nield,GwyField *field,GwyGrainQuantity quantity,gint *maxgno);
Calculates a single characteristics of grains in a number field.
Some quantities are currently calculated incorrectly for non-contiguous grains. In particular those related to the grain boundary. Others may be technically correct for non-contiguous grains, but not really meaningful.
This function can be inefficient. When multiple related quantities are evaluated, gwy_nield_grain_quantities()
avoids doing the same work twice. See also gwy_nield_grain_values() for the evaluation of non-builtin grain
values.
The zeroth item in the returned array does not correspond to any grain and does not generally contain any useful
information. Although the function fills some placeholder values for empty grains, it is recommended to apply
gwy_nield_compactify().
nield |
A number field. |
|
field |
Data field used for height data. For some quantities its values are not used, but its dimensions determine the real dimensions of a pixel. |
|
quantity |
The quantity to calculate. |
|
maxgno |
Location to store the maximum grain number. Possibly |
[out][nullable] |
void gwy_nield_grain_quantities (GwyNield *nield,GwyField *field,const GwyGrainQuantity *quantities,guint nquantities,gdouble **results);
Calculates multiple characteristics of grains in a number field simultaneously.
See gwy_nield_grain_quantity() for some discussion. This function can a lot more efficient than repeated
gwy_nield_grain_quantity() if several related grain quantities need to be calculated since
gwy_nield_grain_values() must do lot of repeated work in such case.
Some quantities are meaningful for marked regions of any shape, others really only for comtiguous grains, although the functions always computes something even for non-contiguous grains. Grain boundaries and borders are lines separating a grain from anything that is not this grain, whether it is the unmarked area or a different grain (when grains are touching).
nield |
A number field. |
|
field |
Data field used for height data. For some quantities its values are not used, but its dimensions determine the real dimensions of a pixel. |
|
quantities |
Array of |
[array length=nquantities][transfer none] |
nquantities |
The number of requested different grain values. |
|
results |
Array of length |
gint * gwy_nield_convex_hulls (GwyNield *nield,guint *cindex);
Finds convex hulls of all grains in a number field.
Use gwy_nield_max() to obtain maxgno
and allocate correct cindex
.
The returned array contains pairs (col,row) of pixel vertices of the convex hull, concatenated all one after another. In each block, the vertices are enumerated in the anti-clockwise order.
The column and row coordinates come from the intervals [0,xres
] and [0,yres
]. Note that these interval are
inclusive on both ends. The convex hull covers the full pixels as little rectangles (not just their centres or
other selected points).
The block for grain with number i
starts at position cindex
[i
] and ends one before position cindex
[i
+1] where
the next block starts. The end is also stored for the last block, which does not have any next block, and gives the
total size of the returned array.
The convex hull of the no-grain area (non-positive values) is not computed. Therefore, the first two elements of
cindex
will be always zeros.
gint * gwy_nield_bounding_boxes (GwyNield *nield,gint *maxgno);
Finds bounding boxes of all grains in a number field.
The zeroth element of the returned array does not correspond to any grain; grain numbers start from 1.
The rectangles are stored as quadruples of indices: (column, row, width, height). Empty grains, which can occur when grain numbers have holes, have negative bounding box width and height.
The function works for non-contiguous numbered regions and gives the overall bounding boxes for all the pieces.
gint * gwy_nield_bounding_boxes_periodic (GwyNield *nield,gint *maxgno);
Find bounding boxes of all grains in a number field with periodic boundary conditions.
The zeroth element of bboxes
does not correspond to any grain; grain numbers start from 1. The rectangles are
stored as quadruples of indices: (column, row, width, height).
The row and column always lie inside the the image. However, width and height may specify an area which sticks outside. In this case periodicity needs to be taken into account.
gint * gwy_nield_inscribed_boxes (GwyNield *nield,gint *maxgno);
Find maximum-area inscribed boxes of all grains in a number field.
The zeroth element of the returned array does not correspond to any grain and does not contain useful information; grain numbers start from 1. The rectangles are stored as quadruples of indices: (column, row, width, height). Empty grains, which can occur when grain numbers have holes, have negative bounding box width and height.
The function works for non-contiguous numbered regions. One of the pieces will contain the maximum rectangle.
gint * gwy_nield_boundary_pixels (GwyNield *nield,guint *bindex,gboolean from_border);
Enumerates boundary pixels of all grains in a number field.
Use gwy_nield_max() to obtain maxgno
and allocate correct bindex
.
The returned array contains pixel indices of grain boundaries, concatenated all one after another. In each block, the indices are enumerated in ascending order.
The block for grain with number i
starts at position bindex
[i
] and ends one before position bindex
[i
+1] where
the next block starts. The end is also stored for the last block, which does not have any next block, and gives the
total size of the returned array.
Boundary pixels are considered in the usual 4-connected metric.
The boundary of the no-grain area (non-positive values) is not computed. Therefore, the first two elements of
bindex
will be always zeros.
Grain quantity to request from gwy_nield_grain_quantity() and similar functions.
|
Projected (flat) grain area. |
||
|
Grain number, always a whole number. It is not particlarly useful, except when you want to handle the grain number generically as a grain quantity. |
||
|
Radius of a disc with the same area as the grain. |
||
|
Surface area. |
||
|
Minimum value. |
||
|
Maximum value. |
||
|
Mean value. |
||
|
Median value. |
||
|
Flat grain area measured in pixels. This value is redundant but it is useful for filtering. It is always a whole number. |
||
|
Projected area of the part of grain that is strictly above the half-height, i.e. the height between the minimum and maximum. |
||
|
Length of grain boundary projected to the horizontal plane. |
||
|
Standard deviation of grain values. |
||
|
The minimum size of grain projection to any line in the horizontal plane. It is also known as the minimum Feret diameter. |
||
|
Direction of the minimum projection (any of them if the minimum is not unique). |
||
|
The maximum size of grain projection to any line in the horizontal plane. It is also known as the maximum Feret diameter. |
||
|
Direction of the maximum projection (any of them if the maximum is not unique). |
||
|
Grain centre horizontal position, i.e. the mean value of its physical x-coordinates. |
||
|
Grain centre vertical position, i.e. the mean value of its physical y-coordinates. |
||
|
Grain volume calculated with grain basis at |
||
|
Grain volume calculated with grain basis at grain minimum value. This value is a lower bound of the volume. |
||
|
Grain volume calculated with grain basis calculated by Laplacian interpolation of
surrounding values (as with |
||
|
Size of particle projection to the direction perpendicular to the minimum Feret diameter,
i.e. perpendicular to |
||
|
Spherical angle theta of grain normal (0 is upwards). |
||
|
Spherical angle phi of grain normal (0 is in positive x direction). |
||
|
Maximum value in the grain inner boundary (image edges are not considered grain boundaries). |
||
|
Minimum value on the grain inner boundary (image edges are not considered grain boundaries). |
||
|
Grain curvature centre horizontal position. For too small or flat grains it reduces to the horizontal position of geometrical centre. |
||
|
Grain curvature centre vertical position. For too small or flat grains it reduces to the vertical position of geometrical centre. |
||
|
The value at curvature centre. Note this is the value in the origin of the fitted quadratic surface, not at the real surface. |
||
|
Smaller grain curvature. |
||
|
Larger grain curvature. |
||
|
Direction of the smaller grain curvature radius. If the grain is flat or too small the angle is reported as 0. |
||
|
Direction of the larger grain curvature radius. If the grain is flat or too small the angle is reported as π/2. |
||
|
Radius of maximum disc that fits inside the grain |
||
|
Real X-coordinate of the centre of the maximum inscribed disc. |
||
|
Real Y-coordinate of the centre of the maximum inscribed disc. |
||
|
Projected (flat) area of grain convex hull. |
||
|
Radius of minimum circle containing the grain. |
||
|
Real X-coordinate of the centre of the minimum circumcircle. |
||
|
Real Y-coordinate of the centre of the minimum circumcircle. |
||
|
Mean distance from boundary to the grain centre as defined by |
||
|
Length of major semiaxis of equivalent ellipse. |
||
|
Length of minor semiaxis of equivalent ellipse. |
||
|
Orientation of the major axis of equivalent ellipse. |
||
|
Minimum value of Martin diameter. |
||
|
Direction corresponding to minimum Martin diameter. |
||
|
Maximum value of Martin diameter. |
||
|
Direction corresponding to maximum Martin diameter. |