| Top |
| const GwyEnum * | gwy_distance_transform_type_get_enum () |
| void | gwy_nield_distance_transform () |
| void | gwy_nield_shrink () |
| void | gwy_nield_grow () |
| void | gwy_nield_thin () |
const GwyEnum *
gwy_distance_transform_type_get_enum (void);
Returns GwyEnum for GwyDistanceTransformType enum type.
void gwy_nield_distance_transform (GwyNield *nield,GwyField *distances,GwyDistanceTransformType dtype,gboolean merged,gboolean from_border);
Performs a distance transform of a number field.
For each non-zero value, a distance to the grain boundary is calculated, measured in pixels. For unmarked pixels in
nield
, the distance is set to zero.
If merged
is TRUE, there is no boundary between touching grains. The distance is calculated from unmarked area
(and possibly from image edges). If merged
is TRUE, regions filled with different numbers in nield
are
considered individually, creating boundaries also where different grains touch.
If the entire nield
is marked, from_border
is FALSE and either merged
is TRUE or nield
is filled with the
same value, there are no boundaries to calculate the distance from. In such case distances
is filled with a huge
positive value (like G_MAXDOUBLE).
nield |
A number field with zeros in empty space and nonzeros in marked areas. |
|
distances |
Output data field which will be resized and filled with the distances. |
|
dtype |
Type of simple distance to use. |
|
merged |
|
|
from_border |
|
void gwy_nield_shrink (GwyNield *nield,gdouble amount,GwyDistanceTransformType dtype,gboolean merged,gboolean from_border);
Erodes a number field containing mask by specified amount using a distance measure.
Non-zero pixels in nield
will be replaced with zeros if they are not farther than amount
from the grain
boundary as defined by dtype
.
nield |
A number field with zeros in empty space and nonzeros in grains. |
|
amount |
How much the grains should be reduced, in pixels. It is inclusive, i.e. pixels that are |
|
dtype |
Type of simple distance to use. |
|
merged |
|
|
from_border |
|
void gwy_nield_grow (GwyNield *nield,gdouble amount,GwyDistanceTransformType dtype,gboolean prevent_touching);
Dilates a number field containing mask by specified amount using a distance measure.
Non-positive pixels in field
will be replaced with ones if they are not farther than amount
from the grain
boundary as defined by dtype
.
nield |
A number field with zeros in empty space and nonzeros in grains. |
|
amount |
How much the grains should be expanded, in pixels. It is inclusive, i.e. exterior pixels that are |
|
dtype |
Type of simple distance to use. |
|
prevent_touching |
|
void
gwy_nield_thin (GwyNield *nield);
Performs thinning of a data field containing mask.
The result of thinning is a ‘skeleton’ mask consisting of single-pixel thin lines.
Type of distance transform.
|
City-block distance (sum of horizontal and vertical distances). |
||
|
Four-connectivity distance; another name for city-block distance. |
||
|
Chessboard distance (maximum of horizontal and vertical distance). |
||
|
Eight-connectivity distance; another name for chessboard distance. |
||
|
Octagonal distance beginning from city-block. |
||
|
Octagonal distance beginning from chess. |
||
|
Average octagonal distance, i.e. the mean of the 48 and 84 distances. |
||
|
True Euclidean distance. |