grains

grains — Grain detection and processing

Synopsis




            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_local_maxima
                                            (GwyDataField *data_field,
                                             GwyDataField *grain_field);
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);

Description

Details

GwyWatershedStatus

typedef struct {
    GwyWatershedStateType state;
    gint internal_i;
    GwyDataField *min;
    GwyDataField *water;
    GwyDataField *mark_dfield;
    gint fraction;
    GString *description;
} GwyWatershedStatus;


gwy_data_field_grains_mark_curvature ()

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.

gwy_data_field_grains_mark_watershed ()

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.

gwy_data_field_grains_remove_grain ()

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).

gwy_data_field_grains_extract_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).

gwy_data_field_grains_remove_by_size ()

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.

gwy_data_field_grains_remove_by_height ()

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.

gwy_data_field_grains_watershed_iteration ()

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.

gwy_data_field_grains_mark_local_maxima ()

void        gwy_data_field_grains_mark_local_maxima
                                            (GwyDataField *data_field,
                                             GwyDataField *grain_field);

data_field :
grain_field :

gwy_data_field_grains_mark_height ()

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.

gwy_data_field_grains_mark_slope ()

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.

gwy_data_field_grains_get_distribution ()

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.

gwy_data_field_grains_add ()

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.

gwy_data_field_grains_intersect ()

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).