## gwyprocessenums

gwyprocessenums — Common enumerations

## Synopsis

    #include <libprocess/gwyprocess.h>

    enum                GwyMergeType;
    enum                GwyWatershedStateType;
    enum                GwyPlaneSymmetry;
    enum                Gwy2DCWTWaveletType;
    enum                GwyOrientation;
    enum                GwyTransformDirection;
    enum                GwyDataFieldCached;
    enum                GwyComputationStateType;
    enum                GwyDWTType;
    enum                GwyDWTDenoiseType;
    enum                GwyInterpolationType;
    enum                GwyPlaneFitQuantity;
    enum                GwyWindowingType;
    enum                GwyTipType;
    enum                GwyCorrelationType;
    enum                GwyGrainQuantity;
    enum                GwyDataCompatibilityFlags;
    enum                GwyLineStatQuantity;
    enum                GwyExteriorType;
    const GwyEnum*      gwy_merge_type_get_enum             (void);
    const GwyEnum*      gwy_plane_symmetry_get_enum         (void);
    const GwyEnum*      gwy_2d_cwt_wavelet_type_get_enum    (void);
    const GwyEnum*      gwy_orientation_get_enum            (void);
    const GwyEnum*      gwy_dwt_type_get_enum               (void);
    const GwyEnum*      gwy_dwt_denoise_type_get_enum       (void);
    const GwyEnum*      gwy_interpolation_type_get_enum     (void);
    const GwyEnum*      gwy_windowing_type_get_enum         (void);
    const GwyEnum*      gwy_correlation_type_get_enum       (void);
                        GwyComputationState;

## Description

## Details

### enum GwyMergeType

    typedef enum {
        GWY_MERGE_UNION,
        GWY_MERGE_INTERSECTION
    } GwyMergeType;

Mask merge type (namely used in grain processing).

`GWY_MERGE_UNION` | Union (logical or) merging.
`GWY_MERGE_INTERSECTION` | Intersection (logical and) merging.

### enum GwyWatershedStateType

    typedef enum {
        GWY_WATERSHED_STATE_INIT,
        GWY_WATERSHED_STATE_LOCATE,
        GWY_WATERSHED_STATE_MIN,
        GWY_WATERSHED_STATE_WATERSHED,
        GWY_WATERSHED_STATE_MARK,
        GWY_WATERSHED_STATE_FINISHED
    } GwyWatershedStateType;

### enum GwyPlaneSymmetry

    typedef enum {
        GWY_SYMMETRY_AUTO,
        GWY_SYMMETRY_PARALLEL,
        GWY_SYMMETRY_TRIANGULAR,
        GWY_SYMMETRY_SQUARE,
        GWY_SYMMETRY_RHOMBIC,
        GWY_SYMMETRY_HEXAGONAL,
        GWY_SYMMETRY_LAST
    } GwyPlaneSymmetry;

Plane symmetry types for rotation correction.

`GWY_SYMMETRY_AUTO` | Automatic symmetry selection.
`GWY_SYMMETRY_PARALLEL` | Parallel symmetry, there is one prevalent direction (bilateral).
`GWY_SYMMETRY_TRIANGULAR` | Triangular symmetry, there are three prevalent directions (unilateral) by 120 degrees.
`GWY_SYMMETRY_SQUARE` | Square symmetry, two prevalent directions (bilateral) oriented approximately along image sides.
`GWY_SYMMETRY_RHOMBIC` | Rhombic symmetry, two prevalent directions (bilateral) oriented approximately along diagonals.
`GWY_SYMMETRY_HEXAGONAL` | Hexagonal symmetry, three prevalent directions (bilateral) by 120 degrees.
`GWY_SYMMETRY_LAST` | The number of symmetries.

### enum Gwy2DCWTWaveletType

    typedef enum { /*< lowercase_name=gwy_2d_cwt_wavelet_type >*/
        GWY_2DCWT_GAUSS,
        GWY_2DCWT_HAT
    } Gwy2DCWTWaveletType;

### enum GwyOrientation

    typedef enum {
        GWY_ORIENTATION_HORIZONTAL,
        GWY_ORIENTATION_VERTICAL
    } GwyOrientation;

Orientation type.

`GWY_ORIENTATION_HORIZONTAL` | Horizontal orientation.
`GWY_ORIENTATION_VERTICAL` | Vertical orientation.

### enum GwyTransformDirection

    typedef enum {
        GWY_TRANSFORM_DIRECTION_BACKWARD = -1,
        GWY_TRANSFORM_DIRECTION_FORWARD = 1
    } GwyTransformDirection;

Transform (namely integral transform) direction.

In FFT, it is equal to sign of the exponent, that is backward transform uses -1, forward transform +1.

`GWY_TRANSFORM_DIRECTION_BACKWARD` | Backward (inverse) transform.
`GWY_TRANSFORM_DIRECTION_FORWARD` | Forward (direct) transform.

### enum GwyDataFieldCached

    typedef enum {
        GWY_DATA_FIELD_CACHE_MIN = 0,
        GWY_DATA_FIELD_CACHE_MAX,
        GWY_DATA_FIELD_CACHE_SUM,
        GWY_DATA_FIELD_CACHE_RMS,
        GWY_DATA_FIELD_CACHE_MED,
        GWY_DATA_FIELD_CACHE_ARF,
        GWY_DATA_FIELD_CACHE_ART,
        GWY_DATA_FIELD_CACHE_ARE,
        GWY_DATA_FIELD_CACHE_SIZE = 30
    } GwyDataFieldCached;

Cached data field quantity type.

There should be little need to this enum directly except in libgwyprocess methods.

`GWY_DATA_FIELD_CACHE_MIN` | Overall minimum.
`GWY_DATA_FIELD_CACHE_MAX` | Overall maximum.
`GWY_DATA_FIELD_CACHE_SUM` | Sum of all values.
`GWY_DATA_FIELD_CACHE_RMS` | Root mean square.
`GWY_DATA_FIELD_CACHE_MED` | Median.
`GWY_DATA_FIELD_CACHE_ARF` | Auto-range from.
`GWY_DATA_FIELD_CACHE_ART` | Auto-range to.
`GWY_DATA_FIELD_CACHE_ARE` | Surface area.
`GWY_DATA_FIELD_CACHE_SIZE` | The size of statistics cache.

### enum GwyComputationStateType

    typedef enum {
        GWY_COMPUTATION_STATE_INIT,
        GWY_COMPUTATION_STATE_ITERATE,
        GWY_COMPUTATION_STATE_FINISHED
    } GwyComputationStateType;

Common iterative computation iterator state type.

`GWY_COMPUTATION_STATE_INIT` | Iterator was set up, the next step will actually create temporary data structures and precalculate values.
`GWY_COMPUTATION_STATE_ITERATE` | Iteration is in progress, the `fraction` field of state struct holds the fraction completed.
`GWY_COMPUTATION_STATE_FINISHED` | Calculation has been finished, further calls to the iterator will be no-op.

### enum GwyDWTType

    typedef enum {
        GWY_DWT_HAAR,
        GWY_DWT_DAUB4,
        GWY_DWT_DAUB6,
        GWY_DWT_DAUB8,
        GWY_DWT_DAUB12,
        GWY_DWT_DAUB20
    } GwyDWTType;

### enum GwyDWTDenoiseType

    typedef enum {
        GWY_DWT_DENOISE_UNIVERSAL,
        GWY_DWT_DENOISE_SCALE_ADAPTIVE,
        GWY_DWT_DENOISE_SPACE_ADAPTIVE
    } GwyDWTDenoiseType;

### enum GwyInterpolationType

    typedef enum {
        GWY_INTERPOLATION_NONE      = 0,
        GWY_INTERPOLATION_ROUND     = 1,
        GWY_INTERPOLATION_LINEAR    = 2,
        GWY_INTERPOLATION_BILINEAR  = GWY_INTERPOLATION_LINEAR,
        GWY_INTERPOLATION_KEY       = 3,
        GWY_INTERPOLATION_BSPLINE   = 4,
        GWY_INTERPOLATION_OMOMS     = 5,
        GWY_INTERPOLATION_NNA       = 6,
        GWY_INTERPOLATION_SCHAUM    = 7
    } GwyInterpolationType;

Interpolation types.

`GWY_INTERPOLATION_NONE` | No interpolation at all, resulting values are not defined, it must not be used for interpolation. It can be used in resize operations discarding original data.
`GWY_INTERPOLATION_ROUND` | Round interpolation (more precisely symmetric nearest neighbour interpolation).
`GWY_INTERPOLATION_LINEAR` | Linear interpolation.
`GWY_INTERPOLATION_BILINEAR` | Old name for `GWY_INTERPOLATION_LINEAR`. This is a misnomer because it in fact denotes linear interpolation of arbitrary dimension. Use `GWY_INTERPOLATION_LINEAR` instead.
`GWY_INTERPOLATION_KEY` | Cubic Key's interpolation (with a=-1/2).
`GWY_INTERPOLATION_BSPLINE` | B-spline interpolation.
`GWY_INTERPOLATION_OMOMS` | Omoms interpolation.
`GWY_INTERPOLATION_NNA` | Nearest neighbour approximation.
`GWY_INTERPOLATION_SCHAUM` | Cubic Schaum interpolation.

### enum GwyPlaneFitQuantity

    typedef enum {
        GWY_PLANE_FIT_A = 1,
        GWY_PLANE_FIT_BX,
        GWY_PLANE_FIT_BY,
        GWY_PLANE_FIT_ANGLE,
        GWY_PLANE_FIT_SLOPE,
        GWY_PLANE_FIT_S0,
        GWY_PLANE_FIT_S0_REDUCED
    } GwyPlaneFitQuantity;

Local plane fitting quantity to request from `gwy_data_field_area_fit_local_planes()` and similar functions.

`GWY_PLANE_FIT_A` | Constant coefficient (mean value).
`GWY_PLANE_FIT_BX` | Linear coefficient in x, if x in in pixel coordinates.
`GWY_PLANE_FIT_BY` | Linear coefficient in y, if y is in pixel coordinates.
`GWY_PLANE_FIT_ANGLE` | Slope orientation in (x,y) plane (in radians).
`GWY_PLANE_FIT_SLOPE` | Absolute slope value (that is sqrt(bx*bx + by*by)).
`GWY_PLANE_FIT_S0` | Residual sum of squares.
`GWY_PLANE_FIT_S0_REDUCED` | Slope-reduced residual sum of squares.

### enum GwyWindowingType

    typedef enum {
        GWY_WINDOWING_NONE       = 0,
        GWY_WINDOWING_HANN       = 1,
        GWY_WINDOWING_HAMMING    = 2,
        GWY_WINDOWING_BLACKMANN  = 3,
        GWY_WINDOWING_LANCZOS    = 4,
        GWY_WINDOWING_WELCH      = 5,
        GWY_WINDOWING_RECT       = 6,
        GWY_WINDOWING_NUTTALL    = 7,
        GWY_WINDOWING_FLAT_TOP   = 8,
        GWY_WINDOWING_KAISER25   = 9
    } GwyWindowingType;

Frequency windowing type.

`GWY_WINDOWING_NONE` | No windowing is applied.
`GWY_WINDOWING_HANN` | Hann window.
`GWY_WINDOWING_HAMMING` | Hamming window.
`GWY_WINDOWING_BLACKMANN` | Blackmann window.
`GWY_WINDOWING_LANCZOS` | Lanczos window.
`GWY_WINDOWING_WELCH` | Welch window.
`GWY_WINDOWING_RECT` | Rectangular window.
`GWY_WINDOWING_NUTTALL` | Nuttall window (Since: 2.7).
`GWY_WINDOWING_FLAT_TOP` | Flat-top window (Since: 2.7).
`GWY_WINDOWING_KAISER25` | Kaiser window with β=2.5 (Since: 2.7).

### enum GwyTipType

    typedef enum {
        GWY_TIP_PYRAMIDE       = 0,
        GWY_TIP_CONTACT        = 1,
        GWY_TIP_NONCONTACT     = 2,
        GWY_TIP_DELTA          = 3
    } GwyTipType;

### enum GwyCorrelationType

    typedef enum {
        GWY_CORRELATION_NORMAL  = 0,
        GWY_CORRELATION_FFT     = 1,
        GWY_CORRELATION_POC     = 2
    } GwyCorrelationType;

### enum GwyGrainQuantity

    typedef enum {
        GWY_GRAIN_VALUE_PROJECTED_AREA       = 0,
        GWY_GRAIN_VALUE_EQUIV_SQUARE_SIDE    = 1,
        GWY_GRAIN_VALUE_EQUIV_DISC_RADIUS    = 2,
        GWY_GRAIN_VALUE_SURFACE_AREA         = 3,
        GWY_GRAIN_VALUE_MAXIMUM              = 4,
        GWY_GRAIN_VALUE_MINIMUM              = 5,
        GWY_GRAIN_VALUE_MEAN                 = 6,
        GWY_GRAIN_VALUE_MEDIAN               = 7,
        GWY_GRAIN_VALUE_HALF_HEIGHT_AREA     = 9,
        GWY_GRAIN_VALUE_FLAT_BOUNDARY_LENGTH = 10,
        GWY_GRAIN_VALUE_MINIMUM_BOUND_SIZE   = 12,
        GWY_GRAIN_VALUE_MINIMUM_BOUND_ANGLE  = 13,
        GWY_GRAIN_VALUE_MAXIMUM_BOUND_SIZE   = 14,
        GWY_GRAIN_VALUE_MAXIMUM_BOUND_ANGLE  = 15,
        GWY_GRAIN_VALUE_CENTER_X             = 16,
        GWY_GRAIN_VALUE_CENTER_Y             = 17,
        GWY_GRAIN_VALUE_VOLUME_0             = 18,
        GWY_GRAIN_VALUE_VOLUME_MIN           = 19,
        GWY_GRAIN_VALUE_VOLUME_LAPLACE       = 20,
        GWY_GRAIN_VALUE_SLOPE_THETA          = 23,
        GWY_GRAIN_VALUE_SLOPE_PHI            = 24,
    } GwyGrainQuantity;

Grain quantity to request from `gwy_data_field_grains_get_distribution()` and similar functions.

`GWY_GRAIN_VALUE_PROJECTED_AREA` | Projected (flat) grain area.
`GWY_GRAIN_VALUE_EQUIV_SQUARE_SIDE` | Side of a square with the same area as the grain. Future changes: This quantity can be trivially calculated from `GWY_GRAIN_VALUE_PROJECTED_AREA` and will be likely removed in 3.0.
`GWY_GRAIN_VALUE_EQUIV_DISC_RADIUS` | Radius of a disc with the same area as the grain. Future changes: This quantity can be trivially calculated from `GWY_GRAIN_VALUE_PROJECTED_AREA` and will be likely removed in 3.0.
`GWY_GRAIN_VALUE_SURFACE_AREA` | Surface area.
`GWY_GRAIN_VALUE_MAXIMUM` | Minimum value.
`GWY_GRAIN_VALUE_MINIMUM` | Maximum value.
`GWY_GRAIN_VALUE_MEAN` | Mean value.
`GWY_GRAIN_VALUE_MEDIAN` | Median value.
`GWY_GRAIN_VALUE_HALF_HEIGHT_AREA` | Projected area of the part of grain that is above the half-height, i.e. the height between the minimum and maximum (Since: 2.8).
`GWY_GRAIN_VALUE_FLAT_BOUNDARY_LENGTH` | Length of projected grain boundary. Note for grains not topologically equivalent to disc, only the length of the outer boundary is calculated.
`GWY_GRAIN_VALUE_MINIMUM_BOUND_SIZE` | Minimum lateral bounding size, in other words the minimum length of grain projection to any line in the horizontal plane.
`GWY_GRAIN_VALUE_MINIMUM_BOUND_ANGLE` | Direction of the minimum lateral bounding size (arbitrary one if the minimum is not unique).
`GWY_GRAIN_VALUE_MAXIMUM_BOUND_SIZE` | Maximum lateral bounding size, in other words the maximum length of grain projection to any line in the horizontal plane.
`GWY_GRAIN_VALUE_MAXIMUM_BOUND_ANGLE` | Direction of the maximum lateral bounding size (arbitrary one if the maximum is not unique).
`GWY_GRAIN_VALUE_CENTER_X` | Grain centre horizontal position, i.e. the mean value of its pixel x-coordinates. (Since: 2.7)
`GWY_GRAIN_VALUE_CENTER_Y` | Grain centre vertical position, i.e. the mean value of its pixel y-coordinates. (Since: 2.7)
`GWY_GRAIN_VALUE_VOLUME_0` | Grain volume calculated with grain basis at z=0 (therefore it is just an integral it can be negative). (Since: 2.3)
`GWY_GRAIN_VALUE_VOLUME_MIN` | Grain volume calculated with grain basis at grain minimum value. This value is a lower bound. (Since: 2.3) Future changes: This quantity can be trivially calculated from `GWY_GRAIN_VALUE_VOLUME_0`, `GWY_GRAIN_VALUE_PROJECTED_AREA` and `GWY_GRAIN_VALUE_MINIMUM` and will be likely removed in 3.0.
`GWY_GRAIN_VALUE_VOLUME_LAPLACE` | Grain volume calculated with grain basis calculated by laplacian interpolation of surrounding values. (Since: 2.3)
`GWY_GRAIN_VALUE_SLOPE_THETA` | Spherical angle theta of grain normal (0 is upwards). (Since: 2.7)
`GWY_GRAIN_VALUE_SLOPE_PHI` | Spherical angle phi of grain normal (0 is in positive x direction). (Since: 2.7)

### enum GwyDataCompatibilityFlags

    typedef enum {
        GWY_DATA_COMPATIBILITY_RES     = 1 << 0,
        GWY_DATA_COMPATIBILITY_REAL    = 1 << 1,
        GWY_DATA_COMPATIBILITY_MEASURE = 1 << 2,
        GWY_DATA_COMPATIBILITY_LATERAL = 1 << 3,
        GWY_DATA_COMPATIBILITY_VALUE   = 1 << 4,
        GWY_DATA_COMPATIBILITY_ALL     = 0x001f
    } GwyDataCompatibilityFlags;

Data line and field compatibility flags.

`GWY_DATA_COMPATIBILITY_RES` | Pixel sizes.
`GWY_DATA_COMPATIBILITY_REAL` | Real (physical) dimensions.
`GWY_DATA_COMPATIBILITY_MEASURE` | Real to pixel ratios.
`GWY_DATA_COMPATIBILITY_LATERAL` | Units of lateral dimensions.
`GWY_DATA_COMPATIBILITY_VALUE` | Units of values.
`GWY_DATA_COMPATIBILITY_ALL` | Mask of all defined flags.

### enum GwyLineStatQuantity

    typedef enum {
        GWY_LINE_STAT_MEAN,
        GWY_LINE_STAT_MEDIAN,
        GWY_LINE_STAT_MINIMUM,
        GWY_LINE_STAT_MAXIMUM,
        GWY_LINE_STAT_RMS,
        GWY_LINE_STAT_LENGTH,
        GWY_LINE_STAT_SLOPE,
        GWY_LINE_STAT_TAN_BETA0
    } GwyLineStatQuantity;

Line statistical quantities to be requested with `gwy_data_field_area_get_line_stats()`.

`GWY_LINE_STAT_MEAN` | Mean value.
`GWY_LINE_STAT_MEDIAN` | Median.
`GWY_LINE_STAT_MINIMUM` | Minimum value.
`GWY_LINE_STAT_MAXIMUM` | Maximum value.
`GWY_LINE_STAT_RMS` | Root mean square of deviations from the mean value.
`GWY_LINE_STAT_LENGTH` | Line length.
`GWY_LINE_STAT_SLOPE` | Overall line slope.
`GWY_LINE_STAT_TAN_BETA0` | Root mean square slope.

Since 2.2

### enum GwyExteriorType

    typedef enum {
        GWY_EXTERIOR_UNDEFINED,
        GWY_EXTERIOR_BORDER_EXTEND,
        GWY_EXTERIOR_MIRROR_EXTEND,
        GWY_EXTERIOR_PERIODIC,
        GWY_EXTERIOR_FIXED_VALUE
    } GwyExteriorType;

Methods to handle pixels outside data.

Many methods currently use a fixed metod of handling of exterior pixels, for example area calculation uses extension (border and mirror coincide), convolution uses mirror extension, rotation fills exterior with a fixed value.

`GWY_EXTERIOR_UNDEFINED` | The values corresponding to or calculated from exterior data values are undefined, they may be left unset or set to bogus values. The caller must handle them itself afterwards, for instance by resizing the result to consist of valid data only.
`GWY_EXTERIOR_BORDER_EXTEND` | Values of exterior pixels are considered to be equal to the values of the nearest interior pixels.
`GWY_EXTERIOR_MIRROR_EXTEND` | The data is considered to be periodically repeated, with odd instances reflected (the total period is thus twice the size of the data).
`GWY_EXTERIOR_PERIODIC` | The data is considered to be periodically repeated.
`GWY_EXTERIOR_FIXED_VALUE` | Values of exterior pixels are considered to be all equal to a user-specified value.

Since 2.2

### gwy_merge_type_get_enum ()

    const GwyEnum*      gwy_merge_type_get_enum             (void);

Returns GwyEnum for GwyMergeType enum type.

Returns : | `NULL`-terminated GwyEnum which must not be modified nor freed.

### gwy_plane_symmetry_get_enum ()

    const GwyEnum*      gwy_plane_symmetry_get_enum         (void);

Returns GwyEnum for GwyPlaneSymmetry enum type.

Returns : | `NULL`-terminated GwyEnum which must not be modified nor freed.

### gwy_2d_cwt_wavelet_type_get_enum ()

    const GwyEnum*      gwy_2d_cwt_wavelet_type_get_enum    (void);

Returns GwyEnum for Gwy2DCWTWaveletType enum type.

Returns : | `NULL`-terminated GwyEnum which must not be modified nor freed.

### gwy_orientation_get_enum ()

    const GwyEnum*      gwy_orientation_get_enum            (void);

Returns GwyEnum for GwyOrientation enum type.

Returns : | `NULL`-terminated GwyEnum which must not be modified nor freed.

### gwy_dwt_type_get_enum ()

    const GwyEnum*      gwy_dwt_type_get_enum               (void);

Returns GwyEnum for GwyDWTType enum type.

Returns : | `NULL`-terminated GwyEnum which must not be modified nor freed.

### gwy_dwt_denoise_type_get_enum ()

    const GwyEnum*      gwy_dwt_denoise_type_get_enum       (void);

Returns GwyEnum for GwyDWTDenoiseType enum type.

Returns : | `NULL`-terminated GwyEnum which must not be modified nor freed.

### gwy_interpolation_type_get_enum ()

    const GwyEnum*      gwy_interpolation_type_get_enum     (void);

Returns GwyEnum for GwyInterpolationType enum type.

Returns : | `NULL`-terminated GwyEnum which must not be modified nor freed.

### gwy_windowing_type_get_enum ()

    const GwyEnum*      gwy_windowing_type_get_enum         (void);

Returns GwyEnum for GwyWindowingType enum type.

Returns : | `NULL`-terminated GwyEnum which must not be modified nor freed.

### gwy_correlation_type_get_enum ()

    const GwyEnum*      gwy_correlation_type_get_enum       (void);

Returns : |

### GwyComputationState

    typedef struct {
        guint state;
        gdouble fraction;
    } GwyComputationState;

State of iterative computation.

Iterators usually append their own private state data, therefore it must not be assumed the public fields `state` and `fraction` are the only fields.

A typical iteration, assuming an iterative computation `foo' with the default GwyComputationStateType state could be:

    GwyComputationStateType *state;

    state = gwy_data_field_foo_init(GwyDataField *data_field, ...);
    do {
        gwy_data_field_foo_iteration(state);
        /* Update progress using state->fraction,
            let Gtk+ main loop run, check for abort, ... */
        if (aborted) {
            gwy_data_field_foo_finalize(state);
            return FALSE;
        }
    } while (state->state != GWY_COMPUTATION_STATE_FINISHED);
    gwy_data_field_foo_finalize(state);
    return TRUE;

guint `state`; | Current computation state, usually of GwyComputationStateType, but particular iterators can define their own types.
gdouble `fraction`; | Fraction of computation completed. For staged algorithms, the fraction refers to the current stage only.