![]() |
![]() |
Gwyddion Data Processing Library Reference Manual | ![]() |
---|
grainsgrains — Grain detection and processing |
GwyWatershedStatus; void gwy_data_field_grains_mark_curvature (GwyDataField *data_field, GwyDataField *grain_field, gdouble threshval, gboolean below); void gwy_data_field_grains_mark_watershed (GwyDataField *data_field, GwyDataField *grain_field, gint locate_steps, gint locate_thresh, gdouble locate_dropsize, gint wshed_steps, gdouble wshed_dropsize, gboolean prefilter, gboolean below); gboolean gwy_data_field_grains_remove_grain (GwyDataField *grain_field, gint col, gint row); gboolean gwy_data_field_grains_extract_grain (GwyDataField *grain_field, gint col, gint row); void gwy_data_field_grains_remove_by_size (GwyDataField *grain_field, gint size); void gwy_data_field_grains_remove_by_height (GwyDataField *data_field, GwyDataField *grain_field, gdouble threshval, gboolean below); void gwy_data_field_grains_watershed_iteration (GwyDataField *data_field, GwyDataField *grain_field, GwyWatershedStatus *status, gint locate_steps, gint locate_thresh, gdouble locate_dropsize, gint wshed_steps, gdouble wshed_dropsize, gboolean prefilter, gboolean below); void gwy_data_field_grains_mark_height (GwyDataField *data_field, GwyDataField *grain_field, gdouble threshval, gboolean below); void gwy_data_field_grains_mark_slope (GwyDataField *data_field, GwyDataField *grain_field, gdouble threshval, gboolean below); void gwy_data_field_grains_get_distribution (GwyDataField *grain_field, GwyDataLine *distribution); void gwy_data_field_grains_add (GwyDataField *grain_field, GwyDataField *add_field); void gwy_data_field_grains_intersect (GwyDataField *grain_field, GwyDataField *intersect_field); void gwy_data_field_area_grains_tgnd (GwyDataField *data_field, GwyDataLine *target_line, gint col, gint row, gint width, gint height, gboolean below, gint nstats); gdouble gwy_data_field_grains_get_grain_value (GwyDataField *data_field, GwyDataField *grain_field, gint col, gint row, GwyGrainValueType type);
typedef struct { GwyWatershedStateType state; gint internal_i; GwyDataField *min; GwyDataField *water; GwyDataField *mark_dfield; gint fraction; GString *description; } GwyWatershedStatus;
void gwy_data_field_grains_mark_curvature (GwyDataField *data_field, GwyDataField *grain_field, gdouble threshval, gboolean below);
Marks data that are above/below curvature threshold.
data_field : | Data to be used for marking. |
grain_field : | Data field to store the resulting mask to. |
threshval : | Relative curvature threshold, in percents. |
below : | If TRUE, data below threshold are marked, otherwise data above threshold are marked. |
void gwy_data_field_grains_mark_watershed (GwyDataField *data_field, GwyDataField *grain_field, gint locate_steps, gint locate_thresh, gdouble locate_dropsize, gint wshed_steps, gdouble wshed_dropsize, gboolean prefilter, gboolean below);
Performs watershed algorithm.
data_field : | Data to be used for marking. |
grain_field : | Result of marking (mask). |
locate_steps : | Locating algorithm steps. |
locate_thresh : | Locating algorithm threshold. |
locate_dropsize : | Locating drop size. |
wshed_steps : | Watershed steps. |
wshed_dropsize : | Watershed drop size. |
prefilter : | Use prefiltering. |
below : | If TRUE, valleys are marked, otherwise mountains are marked. |
gboolean gwy_data_field_grains_remove_grain (GwyDataField *grain_field, gint col, gint row);
Removes one grain at given position.
grain_field : | Field of marked grains (mask). |
col : | Column inside a grain. |
row : | Row inside a grain. |
Returns : | TRUE if a grain was actually removed (i.e., (col,row) was inside a grain). |
gboolean gwy_data_field_grains_extract_grain (GwyDataField *grain_field, gint col, gint row);
Removes all grains except that one at given position.
If there is no grain at (col, row), all grains are removed.
grain_field : | Field of marked grains (mask). |
col : | Column inside a grain. |
row : | Row inside a grain. |
Returns : | TRUE if a grain remained (i.e., (col,row) was inside a grain). |
void gwy_data_field_grains_remove_by_size (GwyDataField *grain_field, gint size);
Removes all grain below specified area.
grain_field : | Field of marked grains (mask). |
size : | Grain area threshold, in square pixels. |
void gwy_data_field_grains_remove_by_height (GwyDataField *data_field, GwyDataField *grain_field, gdouble threshval, gboolean below);
Removes grains that are higher/lower than given threshold value.
data_field : | Data to be used for marking |
grain_field : | Field of marked grains (mask) |
threshval : | Relative height threshold, in percents. |
below : | If TRUE, grains below threshold are removed, otherwise grains above threshold are removed. |
void gwy_data_field_grains_watershed_iteration (GwyDataField *data_field, GwyDataField *grain_field, GwyWatershedStatus *status, gint locate_steps, gint locate_thresh, gdouble locate_dropsize, gint wshed_steps, gdouble wshed_dropsize, gboolean prefilter, gboolean below);
Performs one iteration of the watershed algorithm.
data_field : | Data to be used for marking. |
grain_field : | Result of marking (mask). |
status : | current status of the algorithm. |
locate_steps : | Locating algorithm steps. |
locate_thresh : | Locating algorithm threshold. |
locate_dropsize : | Locating drop size. |
wshed_steps : | Watershed steps. |
wshed_dropsize : | Watershed drop size. |
prefilter : | Use prefiltering. |
below : | If TRUE, valleys are marked, otherwise mountains are marked. |
void gwy_data_field_grains_mark_height (GwyDataField *data_field, GwyDataField *grain_field, gdouble threshval, gboolean below);
Marks data that are above/below height threshold.
data_field : | Data to be used for marking. |
grain_field : | Data field to store the resulting mask to. |
threshval : | Relative height threshold, in percents. |
below : | If TRUE, data below threshold are marked, otherwise data above threshold are marked. |
void gwy_data_field_grains_mark_slope (GwyDataField *data_field, GwyDataField *grain_field, gdouble threshval, gboolean below);
Marks data that are above/below slope threshold.
data_field : | Data to be used for marking. |
grain_field : | Data field to store the resulting mask to. |
threshval : | Relative slope threshold, in percents. |
below : | If TRUE, data below threshold are marked, otherwise data above threshold are marked. |
void gwy_data_field_grains_get_distribution (GwyDataField *grain_field, GwyDataLine *distribution);
Computes grain size distribution.
Puts number of grains vs. grain size (in real units) data into distribution. Grain size means grain side if it was square.
grain_field : | Data field of marked grains (mask). |
distribution : | Grain size distribution. |
void gwy_data_field_grains_add (GwyDataField *grain_field, GwyDataField *add_field);
Adds add_field grains to grain_field.
grain_field : | Field of marked grains (mask). |
add_field : | Field of marked grains (mask) to be added. |
void gwy_data_field_grains_intersect (GwyDataField *grain_field, GwyDataField *intersect_field);
Performs intersection betweet two grain fields, result is stored in grain_field.
grain_field : | field of marked grains (mask). |
intersect_field : | Field of marked grains (mask). |
void gwy_data_field_area_grains_tgnd (GwyDataField *data_field, GwyDataLine *target_line, gint col, gint row, gint width, gint height, gboolean below, gint nstats);
Calculates threshold grain number distribution.
This is the number of grains for each of nstats equidistant height threshold levels. For large nstats this function is much faster than the equivalent number of gwy_data_field_grains_mark_height().
data_field : | A data field. |
target_line : | A data line to store the distribution to. It will be resampled to requested width. |
col : | Upper-left column coordinate. |
row : | Upper-left row coordinate. |
width : | Area width (number of columns). |
height : | Area height (number of rows). |
below : | If TRUE, valleys are marked, otherwise mountains are marked. |
nstats : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically. |
gdouble gwy_data_field_grains_get_grain_value (GwyDataField *data_field, GwyDataField *grain_field, gint col, gint row, GwyGrainValueType type);
data_field : | |
grain_field : | |
col : | |
row : | |
type : | |
Returns : |
<< fractals | inttrans >> |