Top | ![]() |
![]() |
![]() |
![]() |
void | (*GwyCoordTransform2DFunc) () |
void | gwy_data_field_laplace_solve () |
void | gwy_data_field_correct_laplace_iteration () |
void | gwy_data_field_correct_average () |
void | gwy_data_field_correct_average_unmasked () |
void | gwy_data_field_mask_outliers () |
void | gwy_data_field_mask_outliers2 () |
void | gwy_data_field_distort () |
void | gwy_data_field_sample_distorted () |
void | gwy_data_field_affine () |
gboolean | gwy_data_line_correct_laplace () |
void | gwy_data_field_mark_scars () |
GwyPlaneSymmetry | gwy_data_field_unrotate_find_corrections () |
void (*GwyCoordTransform2DFunc) (gdouble x
,gdouble y
,gdouble *px
,gdouble *py
,gpointer user_data
);
The type of two-dimensional coordinate transform function.
x |
Old x coordinate. |
|
y |
Old y coordinate. |
|
px |
Location to store new x coordinate. |
|
py |
Location to store new y coordinate. |
|
user_data |
User data passed to the caller function. |
Since: 2.5
void gwy_data_field_laplace_solve (GwyDataField *field
,GwyDataField *mask
,gint grain_id
,gdouble qprec
);
Replaces masked areas by the solution of Laplace equation.
The boundary conditions on mask boundaries are Dirichlet with values given
by pixels on the outer boundary of the masked area. Boundary conditions at
field edges are Neumann conditions ∂z/∂n=0 where n denotes the normal to the
edge. If entire area of field
is to be replaced the problem is
underspecified; field
will be filled with zeroes.
For the default value of qprec
the the result should be good enough for any
image processing purposes with the typical local error of order 10⁻⁵ for
very large grains and possibly much smaller for small grains. You can lower
qprec
down to about 0.3 or even 0.2 if speed is crucial and some precision
can be sacrificed. Below that the result just starts becoming somewhat
worse for not much speed increase. Conversely, you may wish to increase
qprec
up to 3 or even 5 if accuracy is important and you can afford the
increased computation time.
field |
A two-dimensional data field. |
|
mask |
A two-dimensional data field containing mask defining the areas to interpolate. |
|
grain_id |
The id number of the grain to replace with the solution of
Laplace equation, from 1 to |
|
qprec |
Speed-accuracy tuning parameter. Pass 1.0 for the default that is fast and sufficiently precise. |
Since: 2.47
void gwy_data_field_correct_laplace_iteration (GwyDataField *data_field
,GwyDataField *mask_field
,GwyDataField *buffer_field
,gdouble corrfactor
,gdouble *error
);
Performs one interation of Laplace data correction.
Tries to remove all the points in mask off the data by using iterative method similar to solving heat flux equation.
Use this function repeatedly until reasonable error
is reached.
gwy_data_field_laplace_solve()
which is simultaneously much
faster and more accurate.void gwy_data_field_correct_average (GwyDataField *data_field
,GwyDataField *mask_field
);
Fills data under mask with the average value.
This function simply puts average value of all the data_field
values (both
masked and unmasked) into points in data_field
lying under points where
mask_field
values are nonzero.
In most cases you probably want to use
gwy_data_field_correct_average_unmasked()
instead.
void gwy_data_field_correct_average_unmasked (GwyDataField *data_field
,GwyDataField *mask_field
);
Fills data under mask with the average value of unmasked data.
This function calculates the average value of all unmasked pixels in
data_field
and then fills all the masked pixels with this average value.
It is useful as the first rough step of correction of data under the mask.
If all data are masked the field is filled with zeroes.
Since: 2.44
void gwy_data_field_mask_outliers (GwyDataField *data_field
,GwyDataField *mask_field
,gdouble thresh
);
Creates mask of data that are above or below thresh
*sigma from average
height.
Sigma denotes root-mean square deviation of heights. This criterium
corresponds to the usual Gaussian distribution outliers detection if
thresh
is 3.
void gwy_data_field_mask_outliers2 (GwyDataField *data_field
,GwyDataField *mask_field
,gdouble thresh_low
,gdouble thresh_high
);
Creates mask of data that are above or below multiples of rms from average height.
Data that are below mean
-thresh_low
*sigma
or above
mean
+thresh_high
*sigma
are marked as outliers, where sigma
denotes the
root-mean square deviation of heights.
data_field |
A data field. |
|
mask_field |
A data field to be filled with mask. |
|
thresh_low |
Lower threshold value. |
|
thresh_high |
Upper threshold value. |
Since: 2.26
void gwy_data_field_distort (GwyDataField *source
,GwyDataField *dest
,GwyCoordTransform2DFunc invtrans
,gpointer user_data
,GwyInterpolationType interp
,GwyExteriorType exterior
,gdouble fill_value
);
Distorts a data field in the horizontal plane.
Note the transform function invtrans
is the inverse transform, in other
words it calculates the old coordinates from the new coordinates (the
transform would not be uniquely defined the other way round).
source |
Source data field. |
|
dest |
Destination data field. |
|
invtrans |
Inverse transform function, that is the transformation from
new coordinates to old coordinates. It gets
( |
|
user_data |
Pointer passed as |
|
interp |
Interpolation type to use. |
|
exterior |
Exterior pixels handling. |
|
fill_value |
The value to use with |
Since: 2.5
void gwy_data_field_sample_distorted (GwyDataField *source
,GwyDataField *dest
,const GwyXY *coords
,GwyInterpolationType interp
,GwyExteriorType exterior
,gdouble fill_value
);
Resamples a data field in an arbitrarily distorted manner.
Each item in coords
corresponds to one pixel in dest
and gives the
coordinates in source
defining the value to set in this pixel.
source |
Source data field. |
|
dest |
Destination data field. |
|
coords |
Array of |
|
interp |
Interpolation type to use. |
|
exterior |
Exterior pixels handling. |
|
fill_value |
The value to use with |
Since: 2.45
void gwy_data_field_affine (GwyDataField *source
,GwyDataField *dest
,const gdouble *invtrans
,GwyInterpolationType interp
,GwyExteriorType exterior
,gdouble fill_value
);
Performs an affine transformation of a data field in the horizontal plane.
Note the transform invtrans
is the inverse transform, in other
words it calculates the old coordinates from the new coordinates. This
way even degenerate (non-invertible) transforms can be meaningfully used.
Also note that the (column, row) coordinate system is left-handed.
source |
Source data field. |
|
dest |
Destination data field. |
|
invtrans |
Inverse transform, that is the transformation from
new pixel coordinates to old pixel coordinates, represented as
( |
|
interp |
Interpolation type to use. |
|
exterior |
Exterior pixels handling. |
|
fill_value |
The value to use with |
Since: 2.34
gboolean gwy_data_line_correct_laplace (GwyDataLine *data_line
,GwyDataLine *mask_line
);
Fills missing values in a data line using Laplace data correction.
Both data lines must have the same number of values.
For one-dimensional data the missing data interpolation is explicit. Interior missing segments are filled with linear dependence between the edge points. Missing segments with one end open are filled with the edge value.
TRUE
if the line contained any data at all. If there are no data
the FALSE
is returned and data_line
is filled with zeros.
Since: 2.45
void gwy_data_field_mark_scars (GwyDataField *data_field
,GwyDataField *result
,gdouble threshold_high
,gdouble threshold_low
,gdouble min_scar_len
,gdouble max_scar_width
,gboolean negative
);
Find and marks scars in a data field.
Scars are linear horizontal defects, consisting of shifted values.
Zero or negative values in result
siginify normal data, positive
values siginify samples that are part of a scar.
data_field |
A data field to find scars in. |
|
result |
A data field to store the result to (it is resized to match
|
|
threshold_high |
Miminum relative step for scar marking, must be positive. |
|
threshold_low |
Definite relative step for scar marking, must be at least
equal to |
|
min_scar_len |
Minimum length of a scar, shorter ones are discarded (must be at least one). |
|
max_scar_width |
Maximum width of a scar, must be at least one. |
|
negative |
Since: 2.46
GwyPlaneSymmetry gwy_data_field_unrotate_find_corrections (GwyDataLine *derdist
,gdouble *correction
);
Finds rotation corrections.
Rotation correction is computed for for all symmetry types. In addition an estimate is made about the prevalent one.
derdist |
Angular derivation distribution (normally obrained from
|
|
correction |
Corrections for particular symmetry types will be stored
here (indexed by GwyPlaneSymmetry). |