## stats

stats — Two-dimensional statistical functions

## Synopsis

    #include <libprocess/gwyprocess.h>

    gdouble             gwy_data_field_get_max              (GwyDataField *data_field);
    gdouble             gwy_data_field_get_min              (GwyDataField *data_field);
    void                gwy_data_field_get_min_max          (GwyDataField *data_field,
                                                             gdouble *min,
                                                             gdouble *max);
    gdouble             gwy_data_field_get_avg              (GwyDataField *data_field);
    gdouble             gwy_data_field_get_rms              (GwyDataField *data_field);
    gdouble             gwy_data_field_get_sum              (GwyDataField *data_field);
    gdouble             gwy_data_field_get_median           (GwyDataField *data_field);
    gdouble             gwy_data_field_get_surface_area     (GwyDataField *data_field);
    gdouble             gwy_data_field_area_get_max         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);
    gdouble             gwy_data_field_area_get_min         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);
    void                gwy_data_field_area_get_min_max     (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble *min,
                                                             gdouble *max);
    gdouble             gwy_data_field_area_get_avg         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);
    gdouble             gwy_data_field_area_get_rms         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);
    gdouble             gwy_data_field_area_get_sum         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);
    gdouble             gwy_data_field_area_get_median      (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);
    gdouble             gwy_data_field_area_get_surface_area
                                                            (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);
    gdouble             gwy_data_field_area_get_volume      (GwyDataField *data_field,
                                                             GwyDataField *basis,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);
    void                gwy_data_field_get_autorange        (GwyDataField *data_field,
                                                             gdouble *from,
                                                             gdouble *to);
    void                gwy_data_field_get_stats            (GwyDataField *data_field,
                                                             gdouble *avg,
                                                             gdouble *ra,
                                                             gdouble *rms,
                                                             gdouble *skew,
                                                             gdouble *kurtosis);
    void                gwy_data_field_area_get_stats       (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble *avg,
                                                             gdouble *ra,
                                                             gdouble *rms,
                                                             gdouble *skew,
                                                             gdouble *kurtosis);
    void                gwy_data_field_area_count_in_range  (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble below,
                                                             gdouble above,
                                                             gint *nbelow,
                                                             gint *nabove);
    void                gwy_data_field_area_dh              (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);
    void                gwy_data_field_dh                   (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);
    void                gwy_data_field_area_cdh             (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);
    void                gwy_data_field_cdh                  (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);
    void                gwy_data_field_area_da              (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             gint nstats);
    void                gwy_data_field_da                   (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             gint nstats);
    void                gwy_data_field_area_cda             (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             gint nstats);
    void                gwy_data_field_cda                  (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             gint nstats);
    void                gwy_data_field_area_acf             (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             gint nstats);
    void                gwy_data_field_acf                  (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             gint nstats);
    void                gwy_data_field_area_hhcf            (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             gint nstats);
    void                gwy_data_field_hhcf                 (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             gint nstats);
    void                gwy_data_field_area_psdf            (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             GwyWindowingType windowing,
                                                             gint nstats);
    void                gwy_data_field_psdf                 (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             GwyWindowingType windowing,
                                                             gint nstats);
    void                gwy_data_field_area_rpsdf           (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyInterpolationType interpolation,
                                                             GwyWindowingType windowing,
                                                             gint nstats);
    void                gwy_data_field_rpsdf                (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyInterpolationType interpolation,
                                                             GwyWindowingType windowing,
                                                             gint nstats);
    void                gwy_data_field_area_2dacf           (GwyDataField *data_field,
                                                             GwyDataField *target_field,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint xrange,
                                                             gint yrange);
    void                gwy_data_field_2dacf                (GwyDataField *data_field,
                                                             GwyDataField *target_field);
    void                gwy_data_field_area_minkowski_volume
                                                            (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);
    void                gwy_data_field_minkowski_volume     (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);
    void                gwy_data_field_area_minkowski_boundary
                                                            (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);
    void                gwy_data_field_minkowski_boundary   (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);
    void                gwy_data_field_area_minkowski_euler (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);
    void                gwy_data_field_minkowski_euler      (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);
    void                gwy_data_field_slope_distribution   (GwyDataField *data_field,
                                                             GwyDataLine *derdist,
                                                             gint kernel_size);
    void                gwy_data_field_get_normal_coeffs    (GwyDataField *data_field,
                                                             gdouble *nx,
                                                             gdouble *ny,
                                                             gdouble *nz,
                                                             gboolean normalize1);
    void                gwy_data_field_area_get_normal_coeffs
                                                            (GwyDataField *data_field,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble *nx,
                                                             gdouble *ny,
                                                             gdouble *nz,
                                                             gboolean normalize1);
    void                gwy_data_field_area_get_inclination (GwyDataField *data_field,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble *theta,
                                                             gdouble *phi);
    void                gwy_data_field_get_inclination      (GwyDataField *data_field,
                                                             gdouble *theta,
                                                             gdouble *phi);
    void                gwy_data_field_area_get_line_stats  (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyLineStatQuantity quantity,
                                                             GwyOrientation orientation);
    void                gwy_data_field_get_line_stats       (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyLineStatQuantity quantity,
                                                             GwyOrientation orientation);

## Description

## Details

### gwy_data_field_get_max ()

    gdouble             gwy_data_field_get_max              (GwyDataField *data_field);

Finds the maximum value of a data field.

This quantity is cached.

`data_field` : | A data field.
Returns : | The maximum value.

### gwy_data_field_get_min ()

    gdouble             gwy_data_field_get_min              (GwyDataField *data_field);

Finds the minimum value of a data field.

This quantity is cached.

`data_field` : | A data field.
Returns : | The minimum value.

### gwy_data_field_get_min_max ()

    void                gwy_data_field_get_min_max          (GwyDataField *data_field,
                                                             gdouble *min,
                                                             gdouble *max);

Finds minimum and maximum values of a data field.

`data_field` : | A data field.
`min` : | Location to store minimum to.
`max` : | Location to store maximum to.

### gwy_data_field_get_avg ()

    gdouble             gwy_data_field_get_avg              (GwyDataField *data_field);

Computes average value of a data field.

This quantity is cached.

`data_field` : | A data field
Returns : | The average value.

### gwy_data_field_get_rms ()

    gdouble             gwy_data_field_get_rms              (GwyDataField *data_field);

Computes root mean square value of a data field.

This quantity is cached.

`data_field` : | A data field.
Returns : | The root mean square value.

### gwy_data_field_get_sum ()

    gdouble             gwy_data_field_get_sum              (GwyDataField *data_field);

Sums all values in a data field.

This quantity is cached.

`data_field` : | A data field.
Returns : | The sum of all values.

### gwy_data_field_get_median ()

    gdouble             gwy_data_field_get_median           (GwyDataField *data_field);

Computes median value of a data field.

This quantity is cached.

`data_field` : | A data field.
Returns : | The median value.

### gwy_data_field_get_surface_area ()

    gdouble             gwy_data_field_get_surface_area     (GwyDataField *data_field);

Computes surface area of a data field.

This quantity is cached.

`data_field` : | A data field.
Returns : | surface area

### gwy_data_field_area_get_max ()

    gdouble             gwy_data_field_area_get_max         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);

Finds the maximum value in a rectangular part of a data field.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
Returns : | The maximum value. When the number of samples to calculate maximum of is zero, -`G_MAXDOUBLE` is returned.

### gwy_data_field_area_get_min ()

    gdouble             gwy_data_field_area_get_min         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);

Finds the minimum value in a rectangular part of a data field.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
Returns : | The minimum value. When the number of samples to calculate minimum of is zero, -`G_MAXDOUBLE` is returned.

### gwy_data_field_area_get_min_max ()

    void                gwy_data_field_area_get_min_max     (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble *min,
                                                             gdouble *max);

Finds minimum and maximum values in a rectangular part of a data field.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
`min` : | Location to store minimum to.
`max` : | Location to store maximum to.

### gwy_data_field_area_get_avg ()

    gdouble             gwy_data_field_area_get_avg         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);

Computes average value of a rectangular part of a data field.

`data_field` : | A data field
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
Returns : | The average value.

### gwy_data_field_area_get_rms ()

    gdouble             gwy_data_field_area_get_rms         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);

Computes root mean square value of a rectangular part of a data field.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
Returns : | The root mean square value.

### gwy_data_field_area_get_sum ()

    gdouble             gwy_data_field_area_get_sum         (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);

Sums values of a rectangular part of a data field.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
Returns : | The sum of all values inside area.

### gwy_data_field_area_get_median ()

    gdouble             gwy_data_field_area_get_median      (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);

Computes median value of a data field area.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
Returns : | The median value.

### gwy_data_field_area_get_surface_area ()

    gdouble             gwy_data_field_area_get_surface_area
                                                            (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);

Computes surface area of a rectangular part of a data field.

This quantity makes sense only if the lateral dimensions and values of `data_field` are the same physical quantities.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
Returns : | The surface area.

### gwy_data_field_area_get_volume ()

    gdouble             gwy_data_field_area_get_volume      (GwyDataField *data_field,
                                                             GwyDataField *basis,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height);

Computes volume of a rectangular part of a data field.

`data_field` : | A data field.
`basis` : | The basis or background for volume calculation if not `NULL`. The height of each vertex is then the difference between `data_field` value and `basis` value. Value `NULL` is the same as passing all zeroes for the basis.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
Returns : | The volume.

Since 2.3

### gwy_data_field_get_autorange ()

    void                gwy_data_field_get_autorange        (GwyDataField *data_field,
                                                             gdouble *from,
                                                             gdouble *to);

Computes value range with outliers cut-off.

The purpose of this function is to find a range is suitable for false color mapping. The precise method how it is calculated is unspecified and may be subject to changes.

However, it is guaranteed minimum <= `from` <= `to` <= maximum.

This quantity is cached.

`data_field` : | A data field.
`from` : | Location to store range start.
`to` : | Location to store range end.

### gwy_data_field_get_stats ()

    void                gwy_data_field_get_stats            (GwyDataField *data_field,
                                                             gdouble *avg,
                                                             gdouble *ra,
                                                             gdouble *rms,
                                                             gdouble *skew,
                                                             gdouble *kurtosis);

Computes basic statistical quantities of a data field.

`data_field` : | A data field.
`avg` : | Where average height value of the surface should be stored, or `NULL`.
`ra` : | Where average value of irregularities should be stored, or `NULL`.
`rms` : | Where root mean square value of irregularities (Rq) should be stored, or `NULL`.
`skew` : | Where skew (symmetry of height distribution) should be stored, or `NULL`.
`kurtosis` : | Where kurtosis (peakedness of height ditribution) should be stored, or `NULL`.

### gwy_data_field_area_get_stats ()

    void                gwy_data_field_area_get_stats       (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble *avg,
                                                             gdouble *ra,
                                                             gdouble *rms,
                                                             gdouble *skew,
                                                             gdouble *kurtosis);

Computes basic statistical quantities of a rectangular part of a data field.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
`avg` : | Where average height value of the surface should be stored, or `NULL`.
`ra` : | Where average value of irregularities should be stored, or `NULL`.
`rms` : | Where root mean square value of irregularities (Rq) should be stored, or `NULL`.
`skew` : | Where skew (symmetry of height distribution) should be stored, or `NULL`.
`kurtosis` : | Where kurtosis (peakedness of height ditribution) should be stored, or `NULL`.

### gwy_data_field_area_count_in_range ()

    void                gwy_data_field_area_count_in_range  (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble below,
                                                             gdouble above,
                                                             gint *nbelow,
                                                             gint *nabove);

Counts data samples in given range.

No assertion is made about the values of `above` and `below`, in other words `above` may be larger than `below`. To count samples in an open interval instead of a closed interval, exchange `below` and `above` and then subtract the `nabove` and `nbelow` from `width`*`height` to get the complementary counts.

With this trick the common task of counting positive values can be realized:

    gwy_data_field_area_count_in_range(data_field, NULL,
                                       col, row, width, height,
                                       0.0, 0.0, &count, NULL);
    count = width*height - count;

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
`below` : | Upper bound to compare data to. The number of samples less than or equal to `below` is stored in `nbelow`.
`above` : | Lower bound to compare data to. The number of samples greater than or equal to `above` is stored in `nabove`.
`nbelow` : | Location to store the number of samples less than or equal to `below`, or `NULL`.
`nabove` : | Location to store the number of samples greater than or equal to `above`, or `NULL`.

### gwy_data_field_area_dh ()

    void                gwy_data_field_area_dh              (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);

Calculates distribution of heights in a rectangular part of data field.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`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).
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_dh ()

    void                gwy_data_field_dh                   (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);

Calculates distribution of heights in a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_area_cdh ()

    void                gwy_data_field_area_cdh             (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);

Calculates cumulative distribution of heights in a rectangular part of data field.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Values equal to 0.0 and below cause corresponding `data_field` samples to be ignored, values equal to 1.0 and above cause inclusion of corresponding `data_field` samples. The behaviour for values inside (0.0, 1.0) is undefined (it may be specified in the future).
`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).
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_cdh ()

    void                gwy_data_field_cdh                  (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);

Calculates cumulative distribution of heights in a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_area_da ()

    void                gwy_data_field_area_da              (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             gint nstats);

Calculates distribution of slopes in a rectangular part of data field.

`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).
`orientation` : | Orientation to compute the slope distribution in.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_da ()

    void                gwy_data_field_da                   (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             gint nstats);

Calculates distribution of slopes in a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`orientation` : | Orientation to compute the slope distribution in.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_area_cda ()

    void                gwy_data_field_area_cda             (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             gint nstats);

Calculates cumulative distribution of slopes in a rectangular part of data field.

`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).
`orientation` : | Orientation to compute the slope distribution in.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_cda ()

    void                gwy_data_field_cda                  (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             gint nstats);

Calculates cumulative distribution of slopes in a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`orientation` : | Orientation to compute the slope distribution in.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_area_acf ()

    void                gwy_data_field_area_acf             (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             gint nstats);

Calculates one-dimensional autocorrelation function of a rectangular part of a data field.

`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).
`orientation` : | Orientation of lines (ACF is simply averaged over the other orientation).
`interpolation` : | Interpolation to use when `nstats` is given and requires resampling.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, `width` (`height`) is used.

### gwy_data_field_acf ()

    void                gwy_data_field_acf                  (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             gint nstats);

Calculates one-dimensional autocorrelation function of a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`orientation` : | Orientation of lines (ACF is simply averaged over the other orientation).
`interpolation` : | Interpolation to use when `nstats` is given and requires resampling.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, data field width (height) is used.

### gwy_data_field_area_hhcf ()

    void                gwy_data_field_area_hhcf            (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             gint nstats);

Calculates one-dimensional autocorrelation function of a rectangular part of a data field.

`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).
`orientation` : | Orientation of lines (HHCF is simply averaged over the other orientation).
`interpolation` : | Interpolation to use when `nstats` is given and requires resampling.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, `width` (`height`) is used.

### gwy_data_field_hhcf ()

    void                gwy_data_field_hhcf                 (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             gint nstats);

Calculates one-dimensional autocorrelation function of a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`orientation` : | Orientation of lines (HHCF is simply averaged over the other orientation).
`interpolation` : | Interpolation to use when `nstats` is given and requires resampling.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, data field width (height) is used.

### gwy_data_field_area_psdf ()

    void                gwy_data_field_area_psdf            (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             GwyWindowingType windowing,
                                                             gint nstats);

Calculates one-dimensional power spectrum density function of a rectangular part of a data field.

`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).
`orientation` : | Orientation of lines (PSDF is simply averaged over the other orientation).
`interpolation` : | Interpolation to use when `nstats` is given and requires resampling (and possibly in FFT too).
`windowing` : | Windowing type to use.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, data field width (height) is used.

### gwy_data_field_psdf ()

    void                gwy_data_field_psdf                 (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyOrientation orientation,
                                                             GwyInterpolationType interpolation,
                                                             GwyWindowingType windowing,
                                                             gint nstats);

Calculates one-dimensional power spectrum density function of a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`orientation` : | Orientation of lines (PSDF is simply averaged over the other orientation).
`interpolation` : | Interpolation to use when `nstats` is given and requires resampling (and possibly in FFT too).
`windowing` : | Windowing type to use.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, data field width (height) is used.

### gwy_data_field_area_rpsdf ()

    void                gwy_data_field_area_rpsdf           (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyInterpolationType interpolation,
                                                             GwyWindowingType windowing,
                                                             gint nstats);

Calculates radial power spectrum density function of a rectangular part of a data field.

`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).
`interpolation` : | Interpolation to use when `nstats` is given and requires resampling (and possibly in FFT too).
`windowing` : | Windowing type to use.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, data field width (height) is used.

Since 2.7

### gwy_data_field_rpsdf ()

    void                gwy_data_field_rpsdf                (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyInterpolationType interpolation,
                                                             GwyWindowingType windowing,
                                                             gint nstats);

Calculates radial power spectrum density function of a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`interpolation` : | Interpolation to use when `nstats` is given and requires resampling (and possibly in FFT too).
`windowing` : | Windowing type to use.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, data field width (height) is used.

Since 2.7

### gwy_data_field_area_2dacf ()

    void                gwy_data_field_area_2dacf           (GwyDataField *data_field,
                                                             GwyDataField *target_field,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint xrange,
                                                             gint yrange);

Calculates two-dimensional autocorrelation function of a data field area.

The resulting data field has the correlation corresponding to (0,0) in the centre.

The maximum possible values of `xrange` and `yrange` are `data_field` width and height, respectively. However, as the values for longer distances are calculated from smaller number of data points they become increasingly bogus, therefore the default range is half of the size.

`data_field` : | A data field.
`target_field` : | A data field to store the result to. It will be resampled to (2`xrange`-1)x(2`yrange`-1).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
`xrange` : | Horizontal correlation range. Non-positive value means the default range of half of `data_field` width will be used.
`yrange` : | Vertical correlation range. Non-positive value means the default range of half of `data_field` height will be used.

Since 2.7

### gwy_data_field_2dacf ()

    void                gwy_data_field_2dacf                (GwyDataField *data_field,
                                                             GwyDataField *target_field);

Calculates two-dimensional autocorrelation function of a data field.

See `gwy_data_field_area_2dacf()` for details. Parameters missing (not adjustable) in this function are set to their default values.

`data_field` : | A data field.
`target_field` : | A data field to store the result to.

Since 2.7

### gwy_data_field_area_minkowski_volume ()

    void                gwy_data_field_area_minkowski_volume
                                                            (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);

Calculates Minkowski volume functional of a rectangular part of a data field.

Volume functional is calculated as the number of values above each threshold value (,white pixels`) divided by the total number of samples in the area. Is it's equivalent to 1-CDH.

`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).
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_minkowski_volume ()

    void                gwy_data_field_minkowski_volume     (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);

Calculates Minkowski volume functional of a data field.

See `gwy_data_field_area_minkowski_volume()` for details.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_area_minkowski_boundary ()

    void                gwy_data_field_area_minkowski_boundary
                                                            (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);

Calculates Minkowski boundary functional of a rectangular part of a data field.

Boundary functional is calculated as the number of boundaries for each threshold value (the number of pixel sides where of neighouring pixels is ,white` and the other ,black`) divided by the total number of samples in the area.

`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).
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_minkowski_boundary ()

    void                gwy_data_field_minkowski_boundary   (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);

Calculates Minkowski boundary functional of a data field.

See `gwy_data_field_area_minkowski_boundary()` for details.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_area_minkowski_euler ()

    void                gwy_data_field_area_minkowski_euler (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gint nstats);

Calculates Minkowski connectivity functional (Euler characteristics) of a rectangular part of a data field.

Connectivity functional is calculated as the number connected areas of pixels above threhsold (,white`) minus the number of connected areas of pixels below threhsold (,black`) for each threshold value, divided by the total number of samples in the area.

`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).
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_minkowski_euler ()

    void                gwy_data_field_minkowski_euler      (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             gint nstats);

Calculates Minkowski connectivity functional (Euler characteristics) of a data field.

See `gwy_data_field_area_minkowski_euler()` for details.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to requested width.
`nstats` : | The number of samples to take on the distribution function. If nonpositive, a suitable resolution is determined automatically.

### gwy_data_field_slope_distribution ()

    void                gwy_data_field_slope_distribution   (GwyDataField *data_field,
                                                             GwyDataLine *derdist,
                                                             gint kernel_size);

Computes angular slope distribution.

`data_field` : | A data field.
`derdist` : | A data line to fill with angular slope distribution. Its resolution determines resolution of the distribution.
`kernel_size` : | If positive, local plane fitting will be used for slope computation; if nonpositive, plain central derivations will be used.

### gwy_data_field_get_normal_coeffs ()

    void                gwy_data_field_get_normal_coeffs    (GwyDataField *data_field,
                                                             gdouble *nx,
                                                             gdouble *ny,
                                                             gdouble *nz,
                                                             gboolean normalize1);

Computes average normal vector of a data field.

`data_field` : | A data field.
`nx` : | Where x-component of average normal vector should be stored, or `NULL`.
`ny` : | Where y-component of average normal vector should be stored, or `NULL`.
`nz` : | Where z-component of average normal vector should be stored, or `NULL`.
`normalize1` : | true to normalize the normal vector to 1, false to normalize the vector so that z-component is 1.

### gwy_data_field_area_get_normal_coeffs ()

    void                gwy_data_field_area_get_normal_coeffs
                                                            (GwyDataField *data_field,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble *nx,
                                                             gdouble *ny,
                                                             gdouble *nz,
                                                             gboolean normalize1);

Computes average normal vector of an area of a data field.

`data_field` : | A data field.
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
`nx` : | Where x-component of average normal vector should be stored, or `NULL`.
`ny` : | Where y-component of average normal vector should be stored, or `NULL`.
`nz` : | Where z-component of average normal vector should be stored, or `NULL`.
`normalize1` : | true to normalize the normal vector to 1, false to normalize the vector so that z-component is 1.

### gwy_data_field_area_get_inclination ()

    void                gwy_data_field_area_get_inclination (GwyDataField *data_field,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             gdouble *theta,
                                                             gdouble *phi);

Calculates the inclination of the image (polar and azimuth angle).

`data_field` : | A data field.
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
`theta` : | Where theta angle (in radians) should be stored, or `NULL`.
`phi` : | Where phi angle (in radians) should be stored, or `NULL`.

### gwy_data_field_get_inclination ()

    void                gwy_data_field_get_inclination      (GwyDataField *data_field,
                                                             gdouble *theta,
                                                             gdouble *phi);

Calculates the inclination of the image (polar and azimuth angle).

`data_field` : | A data field.
`theta` : | Where theta angle (in radians) should be stored, or `NULL`.
`phi` : | Where phi angle (in radians) should be stored, or `NULL`.

### gwy_data_field_area_get_line_stats ()

    void                gwy_data_field_area_get_line_stats  (GwyDataField *data_field,
                                                             GwyDataField *mask,
                                                             GwyDataLine *target_line,
                                                             gint col,
                                                             gint row,
                                                             gint width,
                                                             gint height,
                                                             GwyLineStatQuantity quantity,
                                                             GwyOrientation orientation);

Calculates a line quantity for each row or column in a data field area.

`data_field` : | A data field.
`mask` : | Mask of values to take values into account, or `NULL` for full `data_field`. Masking is currently unimplemented.
`target_line` : | A data line to store the distribution to. It will be resampled to the number of rows (columns).
`col` : | Upper-left column coordinate.
`row` : | Upper-left row coordinate.
`width` : | Area width (number of columns).
`height` : | Area height (number of rows).
`quantity` : | The line quantity to calulate for each row (column).
`orientation` : | Line orientation. For `GWY_ORIENTATION_HORIZONTAL` each `target_line` point corresponds to a row of the area, for `GWY_ORIENTATION_VERTICAL` each `target_line` point corresponds to a column of the area.

Since 2.2

### gwy_data_field_get_line_stats ()

    void                gwy_data_field_get_line_stats       (GwyDataField *data_field,
                                                             GwyDataLine *target_line,
                                                             GwyLineStatQuantity quantity,
                                                             GwyOrientation orientation);

Calculates a line quantity for each row or column of a data field.

`data_field` : | A data field.
`target_line` : | A data line to store the distribution to. It will be resampled to `data_field` height (width).
`quantity` : | The line quantity to calulate for each row (column).
`orientation` : | Line orientation. See `gwy_data_field_area_get_line_stats()`.

Since 2.2