GwyDataField — Two-dimensional data representation
void | data-changed | Run First |
#define | gwy_data_field_get_xmeasure |
#define | gwy_data_field_get_ymeasure |
struct | GwyDataField |
struct | GwyDataFieldClass |
GObject ╰── GwyDataField
GwyDataField implements GwySerializable.
#include <libprocess/gwyprocess.h>
GwyDataField is an object that is used for representation of all two-dimensional data matrices. Most of the basic data handling and processing functions in Gwyddion are declared here as they are connected with GwyDataField.
void
gwy_data_field_invalidate (GwyDataField *data_field
);
Invalidates cached data field stats.
User code should rarely need this macro, as all GwyDataField methods do proper invalidation when they change data,
as well as gwy_data_field_get_data()
does.
However, if you get raw data with gwy_data_field_get_data()
and then mix direct changes to it with calls to methods
like gwy_data_field_get_max()
, you may need to explicitely invalidate cached values to let gwy_data_field_get_max()
know it has to recompute the maximum.
data_field |
A data field to invalidate. |
#define gwy_data_field_duplicate(data_field)
Convenience macro doing gwy_serializable_duplicate()
with all the necessary typecasting.
Use gwy_data_field_new_alike()
if you don't want to copy data, only resolutions and units.
data_field |
A data field to duplicate. |
#define gwy_data_field_assign(dest, source)
Convenience macro making one data field identical to another.
This is just a gwy_serializable_clone()
wrapper with all the necessary typecasting.
dest |
Target data field. |
|
source |
Source data field. |
Since: 2.52
GwyDataField * gwy_data_field_new (gint xres
,gint yres
,gdouble xreal
,gdouble yreal
,gboolean nullme
);
Creates a new data field.
xres |
X-resolution, i.e., the number of columns. |
|
yres |
Y-resolution, i.e., the number of rows. |
|
xreal |
Real horizontal physical dimension. |
|
yreal |
Real vertical physical dimension. |
|
nullme |
Whether the data field should be initialized to zeroes. If |
A newly created data field.
GwyDataField * gwy_data_field_new_alike (GwyDataField *model
,gboolean nullme
);
Creates a new data field similar to an existing one.
Use gwy_data_field_duplicate()
if you want to copy a data field including data.
model |
A data field to take resolutions and units from. |
|
nullme |
Whether the data field should be initialized to zeroes. If |
A newly created data field.
void
gwy_data_field_data_changed (GwyDataField *data_field
);
Emits signal "data-changed" on a data field.
data_field |
A data field. |
GwyDataField * gwy_data_field_new_resampled (GwyDataField *data_field
,gint xres
,gint yres
,GwyInterpolationType interpolation
);
Creates a new data field by resampling an existing one.
This method is equivalent to gwy_data_field_duplicate()
followed by gwy_data_field_resample()
, but it is more
efficient.
data_field |
A data field. |
|
xres |
Desired X resolution. |
|
yres |
Desired Y resolution. |
|
interpolation |
Interpolation method to use. |
A newly created data field.
void gwy_data_field_resample (GwyDataField *data_field
,gint xres
,gint yres
,GwyInterpolationType interpolation
);
Resamples a data field using given interpolation method
This method may invalidate raw data buffer returned by gwy_data_field_get_data()
.
data_field |
A data field to be resampled. |
|
xres |
Desired X resolution. |
|
yres |
Desired Y resolution. |
|
interpolation |
Interpolation method to use. |
void gwy_data_field_bin (GwyDataField *data_field
,GwyDataField *target
,gint binw
,gint binh
,gint xoff
,gint yoff
,gint trimlowest
,gint trimhighest
);
Bins a data field into another data field.
See gwy_data_field_new_binned()
for a detailed description.
data_field |
A data field. |
|
target |
Target data field. It will be resized as necessary. |
|
binw |
Bin height (in pixels). |
|
binh |
Bin width (in pixels). |
|
xoff |
Horizontal offset of bins (in pixels). |
|
yoff |
Vertical offset of bins (in pixels). |
|
trimlowest |
Number of lowest values to discard. |
|
trimhighest |
Number of highest values to discard. |
Since: 2.55
GwyDataField * gwy_data_field_new_binned (GwyDataField *data_field
,gint binw
,gint binh
,gint xoff
,gint yoff
,gint trimlowest
,gint trimhighest
);
Creates a new data field by binning an existing one.
The data field is divided into rectangles of dimensions binw
×binh
, offset by (xoff
, yoff
). The values in each
complete rectangle are averaged and the average becomes the pixel value in the newly created, smaller data field.
Note that the result is the average – not sum – of the individual values. Multiply the returned data field with
binw
×binh
if you want sum.
By giving non-zero trimlowest
and trimhighest
you can change the plain average to a trimmed one (even turning it
to median in the extreme case). It must always hold that trimlowest
+ trimhighest
is smaller than binw
×binh
.
data_field |
A data field. |
|
binw |
Bin height (in pixels). |
|
binh |
Bin width (in pixels). |
|
xoff |
Horizontal offset of bins (in pixels). |
|
yoff |
Vertical offset of bins (in pixels). |
|
trimlowest |
Number of lowest values to discard. |
|
trimhighest |
Number of highest values to discard. |
A newly created data field.
Since: 2.50
void gwy_data_field_resize (GwyDataField *data_field
,gint ulcol
,gint ulrow
,gint brcol
,gint brrow
);
Resizes (crops) a data field.
Crops a data field to a rectangle between upper-left and bottom-right points, recomputing real size.
This method may invalidate raw data buffer returned by gwy_data_field_get_data()
.
data_field |
A data field to be resized |
|
ulcol |
Upper-left column coordinate. |
|
ulrow |
Upper-left row coordinate. |
|
brcol |
Bottom-right column coordinate + 1. |
|
brrow |
Bottom-right row coordinate + 1. |
GwyDataField * gwy_data_field_area_extract (GwyDataField *data_field
,gint col
,gint row
,gint width
,gint height
);
Extracts a rectangular part of a data field to a new data field.
data_field |
A data field to be resized |
|
row |
Upper-left row coordinate. |
|
col |
Upper-left column coordinate. |
|
width |
Area width (number of columns). |
|
height |
Area height (number of rows). |
The extracted area as a newly created data field.
void gwy_data_field_copy (GwyDataField *src
,GwyDataField *dest
,gboolean nondata_too
);
Copies the contents of an already allocated data field to a data field of the same size.
src |
Source data field. |
|
dest |
Destination data field. |
|
nondata_too |
Whether non-data (units) should be copied too. |
void gwy_data_field_area_copy (GwyDataField *src
,GwyDataField *dest
,gint col
,gint row
,gint width
,gint height
,gint destcol
,gint destrow
);
Copies a rectangular area from one data field to another.
The area starts at (col
, row
) in src
and its dimension is width
*height
. It is copied to dest
starting from
(destcol
, destrow
).
The source area has to be completely contained in src
. No assumptions are made about destination position,
however, parts of the source area sticking out the destination data field dest
are cut off.
If src
is equal to dest
, the areas may not overlap.
src |
Source data field. |
|
dest |
Destination data field. |
|
col |
Area upper-left column coordinate in |
|
row |
Area upper-left row coordinate |
|
width |
Area width (number of columns), pass -1 for full |
|
height |
Area height (number of rows), pass -1 for full |
|
destcol |
Destination column in |
|
destrow |
Destination row in |
gdouble *
gwy_data_field_get_data (GwyDataField *data_field
);
Gets the raw data buffer of a data field.
The returned buffer is not guaranteed to be valid through whole data field life time. Some function may change it,
most notably gwy_data_field_resize()
and gwy_data_field_resample()
.
This function invalidates any cached information, use gwy_data_field_get_data_const()
if you are not going to
change the data.
See gwy_data_field_invalidate()
for some discussion.
data_field |
A data field |
The data field as a pointer to an array of gwy_data_field_get_xres()
*gwy_data_field_get_yres() gdouble's,
ordered by lines. I.e., they are to be accessed as data[row*xres + column].
const gdouble *
gwy_data_field_get_data_const (GwyDataField *data_field
);
Gets the raw data buffer of a data field, read-only.
The returned buffer is not guaranteed to be valid through whole data field life time. Some function may change it,
most notably gwy_data_field_resize()
and gwy_data_field_resample()
.
Use gwy_data_field_get_data()
if you want to change the data.
See gwy_data_field_invalidate()
for some discussion.
data_field |
A data field. |
The data field as a pointer to an array of gwy_data_field_get_xres()
*gwy_data_field_get_yres() gdouble's,
ordered by lines. I.e., they are to be accessed as data[row*xres + column].
gint
gwy_data_field_get_xres (GwyDataField *data_field
);
Gets X resolution (number of columns) of a data field.
data_field |
A data field. |
X resolution.
gint
gwy_data_field_get_yres (GwyDataField *data_field
);
Gets Y resolution (number of rows) of the field.
data_field |
A data field. |
Y resolution.
gdouble
gwy_data_field_get_xreal (GwyDataField *data_field
);
Gets the X real (physical) size of a data field.
data_field |
A data field. |
X real size value.
gdouble
gwy_data_field_get_yreal (GwyDataField *data_field
);
Gets the Y real (physical) size of a data field.
data_field |
A data field |
Y real size value.
void gwy_data_field_set_xreal (GwyDataField *data_field
,gdouble xreal
);
Sets X real (physical) size value of a data field.
data_field |
A data field. |
|
xreal |
New X real size value. |
void gwy_data_field_set_yreal (GwyDataField *data_field
,gdouble yreal
);
Sets Y real (physical) size value of a data field.
data_field |
A data field. |
|
yreal |
New Y real size value. |
gdouble
gwy_data_field_get_dx (GwyDataField *data_field
);
Gets the horizontal pixel size of a data field in real units.
The result is the same as gwy_data_field_get_xreal(data_field)/gwy_data_field_get_xres(data_field).
data_field |
A data field. |
Horizontal pixel size.
Since: 2.52
gdouble
gwy_data_field_get_dy (GwyDataField *data_field
);
Gets the vertical pixel size of a data field in real units.
The result is the same as gwy_data_field_get_yreal(data_field)/gwy_data_field_get_yres(data_field).
data_field |
A data field. |
Vertical pixel size.
Since: 2.52
gdouble
gwy_data_field_get_xoffset (GwyDataField *data_field
);
Gets the X offset of data field origin.
data_field |
A data field. |
X offset value.
gdouble
gwy_data_field_get_yoffset (GwyDataField *data_field
);
Gets the Y offset of data field origin.
data_field |
A data field |
Y offset value.
void gwy_data_field_set_xoffset (GwyDataField *data_field
,gdouble xoff
);
Sets the X offset of a data field origin.
Note offsets don't affect any calculation, nor functions like gwy_data_field_rtoj()
.
data_field |
A data field. |
|
xoff |
New X offset value. |
void gwy_data_field_set_yoffset (GwyDataField *data_field
,gdouble yoff
);
Sets the Y offset of a data field origin.
Note offsets don't affect any calculation, nor functions like gwy_data_field_rtoi()
.
data_field |
A data field. |
|
yoff |
New Y offset value. |
GwySIUnit *
gwy_data_field_get_si_unit_xy (GwyDataField *data_field
);
Returns lateral SI unit of a data field.
data_field |
A data field. |
SI unit corresponding to the lateral (XY) dimensions of the data field. Its reference count is not incremented.
GwySIUnit *
gwy_data_field_get_si_unit_z (GwyDataField *data_field
);
Returns value SI unit of a data field.
data_field |
A data field. |
SI unit corresponding to the "height" (Z) dimension of the data field. Its reference count is not incremented.
void gwy_data_field_set_si_unit_xy (GwyDataField *data_field
,GwySIUnit *si_unit
);
Sets the SI unit corresponding to the lateral (XY) dimensions of a data field.
It does not assume a reference on si_unit
, instead it adds its own reference.
data_field |
A data field. |
|
si_unit |
SI unit to be set. |
void gwy_data_field_set_si_unit_z (GwyDataField *data_field
,GwySIUnit *si_unit
);
Sets the SI unit corresponding to the "height" (Z) dimension of a data field.
It does not assume a reference on si_unit
, instead it adds its own reference.
data_field |
A data field. |
|
si_unit |
SI unit to be set. |
GwySIValueFormat * gwy_data_field_get_value_format_xy (GwyDataField *data_field
,GwySIUnitFormatStyle style
,GwySIValueFormat *format
);
Finds value format good for displaying coordinates of a data field.
data_field |
A data field. |
|
style |
Unit format style. |
|
format |
A SI value format to modify, or |
The value format. If format
is NULL
, a newly allocated format is returned, otherwise (modified) format
itself is returned.
GwySIValueFormat * gwy_data_field_get_value_format_z (GwyDataField *data_field
,GwySIUnitFormatStyle style
,GwySIValueFormat *format
);
Finds value format good for displaying values of a data field.
data_field |
A data field. |
|
style |
Unit format style. |
|
format |
A SI value format to modify, or |
The value format. If format
is NULL
, a newly allocated format is returned, otherwise (modified) format
itself is returned.
void gwy_data_field_copy_units (GwyDataField *data_field
,GwyDataField *target
);
Sets lateral and value units of a data field to match another data field.
data_field |
A data field. |
|
target |
Target data field. |
Since: 2.49
void gwy_data_field_copy_units_to_data_line (GwyDataField *data_field
,GwyDataLine *data_line
);
Sets lateral and value units of a data line to match a data field.
data_field |
A data field to get units from. |
|
data_line |
A data line to set units of. |
void gwy_data_line_copy_units_to_data_field (GwyDataLine *data_line
,GwyDataField *data_field
);
Sets lateral and value units of a data field to match a data line.
data_line |
A data line to get units from. |
|
data_field |
A data field to set units of. |
gdouble gwy_data_field_itor (GwyDataField *data_field
,gdouble row
);
Transforms vertical pixel coordinate to real (physical) Y coordinate.
That is it maps range [0..y-resolution] to range [0..real-y-size]. It is not suitable for conversion of matrix
indices to physical coordinates, you have to use gwy_data_field_itor(data_field
, row
+ 0.5) for that.
data_field |
A data field. |
|
row |
Vertical pixel coordinate. |
Real Y coordinate.
gdouble gwy_data_field_jtor (GwyDataField *data_field
,gdouble col
);
Transforms horizontal pixel coordinate to real (physical) X coordinate.
That is it maps range [0..x-resolution] to range [0..real-x-size]. It is not suitable for conversion of matrix
indices to physical coordinates, you have to use gwy_data_field_jtor(data_field
, col
+ 0.5) for that.
data_field |
A data field. |
|
col |
Horizontal pixel coordinate. |
Real X coordinate.
gdouble gwy_data_field_rtoi (GwyDataField *data_field
,gdouble realy
);
Transforms real (physical) Y coordinate to row.
That is it maps range [0..real-y-size] to range [0..y-resolution].
data_field |
A data field. |
|
realy |
Real (physical) Y coordinate. |
Vertical pixel coodinate.
gdouble gwy_data_field_rtoj (GwyDataField *data_field
,gdouble realx
);
Transforms real (physical) X coordinate to column.
That is it maps range [0..real-x-size] to range [0..x-resolution].
data_field |
A data field. |
|
realx |
Real (physical) X coodinate. |
Horizontal pixel coordinate.
gdouble gwy_data_field_get_val (GwyDataField *data_field
,gint col
,gint row
);
Gets value at given position in a data field.
Do not access data with this function inside inner loops, it's slow. Get the raw data buffer with
gwy_data_field_get_data_const()
and access it directly instead.
data_field |
A data field. |
|
col |
Column index. |
|
row |
Row index. |
Value at (col
, row
).
void gwy_data_field_set_val (GwyDataField *data_field
,gint col
,gint row
,gdouble value
);
Sets value at given position in a data field.
Do not set data with this function inside inner loops, it's slow. Get the raw data buffer with
gwy_data_field_get_data()
and write to it directly instead.
data_field |
A data field. |
|
col |
Column index. |
|
row |
Row index. |
|
value |
Value to set. |
gdouble gwy_data_field_get_dval (GwyDataField *data_field
,gdouble x
,gdouble y
,GwyInterpolationType interpolation
);
Gets interpolated value at arbitrary data field point indexed by pixel coordinates.
Note pixel values are centered in pixels, so to get the same value as gwy_data_field_get_val(data_field
, j
, i
)
returns, it's necessary to add 0.5: gwy_data_field_get_dval(data_field
, j
+0.5, i
+0.5, interpolation
).
See also gwy_data_field_get_dval_real()
that does the same, but takes real coordinates.
data_field |
A data field |
|
x |
Horizontal position in pixel units, in range [0, x-resolution]. |
|
y |
Vertical postition in pixel units, in range [0, y-resolution]. |
|
interpolation |
Interpolation method to be used. |
Interpolated value at position (x
,y
).
gdouble gwy_data_field_get_dval_real (GwyDataField *data_field
,gdouble x
,gdouble y
,GwyInterpolationType interpolation
);
Gets interpolated value at arbitrary data field point indexed by real coordinates.
See also gwy_data_field_get_dval()
that does the same, but takes pixel coordinates.
data_field |
A data field. |
|
x |
X postion in real coordinates. |
|
y |
Y postition in real coordinates. |
|
interpolation |
Interpolation method to use. |
Value at position (x
,y
).
void gwy_data_field_rotate (GwyDataField *data_field
,gdouble angle
,GwyInterpolationType interpolation
);
Rotates a data field by a given angle.
This function is mostly obsolete. See gwy_data_field_new_rotated()
and gwy_data_field_new_rotated_90()
.
Values that get outside of data field by the rotation are lost. Undefined values from outside of data field that get inside are set to data field minimum value.
The rotation is performed in pixel space, i.e. it can be in fact a more general affine transform in the real coordinates when pixels are not square.
data_field |
A data field. |
|
angle |
Rotation angle (in radians). |
|
interpolation |
Interpolation method to use. |
GwyDataField * gwy_data_field_new_rotated (GwyDataField *dfield
,GwyDataField *exterior_mask
,gdouble angle
,GwyInterpolationType interp
,GwyRotateResizeType resize
);
Creates a new data field by rotating a data field by an atribtrary angle.
The returned data field can have pixel corresponding to exterior in dfield
(unless resize
is
GWY_ROTATE_RESIZE_CUT
). They are filled with a neutral value; pass exterior_mask
and replace them as you wish if
you need more control.
The rotation is performed in real space, i.e. it is a more general affine transform in the pixel space for data
field with non-square pixels. See gwy_data_field_rotate()
which rotates in the pixel space.
The returned data field has always square pixels. If you want to rotate by a multiple of G_PI
/2 while preserving
non-square pixels, you must use explicitly a function such as gwy_data_field_new_rotated_90()
.
dfield |
A data field. |
|
exterior_mask |
Optional data field where pixels corresponding to exterior will be set to 1. It will be resized to match the returned field. |
|
angle |
Rotation angle (in radians). |
|
interp |
Interpolation type to use. |
|
resize |
Controls how the result size is determined. |
A newly created data field.
Since: 2.46
GwyDataField * gwy_data_field_new_rotated_90 (GwyDataField *data_field
,gboolean clockwise
);
Creates a new data field by rotating a data field by 90 degrees.
data_field |
A data field. |
|
clockwise |
A newly created data field.
Since: 2.46
void gwy_data_field_invert (GwyDataField *data_field
,gboolean yflipped
,gboolean xflipped
,gboolean zflipped
);
Reflects and/or inverts a data field.
In the case of value (Z) reflection, it's inverted about the mean value.
Note the unusual axis argument order, with Y and X swapped. It is because historically the arguments were called X and Y, but had a somewhat idiosyncratic interpretation, doing the opposite of one might expect intuitively.
data_field |
A data field. |
|
yflipped |
|
|
xflipped |
|
|
zflipped |
|
void gwy_data_field_flip_xy (GwyDataField *src
,GwyDataField *dest
,gboolean minor
);
Copies data from one data field to another with transposition.
The destination data field is resized as necessary, its real dimensions set to transposed src
dimensions and its
offsets are reset. Units are not updated.
src |
Source data field. |
|
dest |
Destination data field. |
|
minor |
|
Since: 2.49
void gwy_data_field_area_flip_xy (GwyDataField *src
,gint col
,gint row
,gint width
,gint height
,GwyDataField *dest
,gboolean minor
);
Copies data from a rectangular part of one data field to another with transposition.
The destination data field is resized as necessary, its real dimensions set to transposed src
area dimensions and
its offsets are reset. Units are not updated.
src |
Source data field. |
|
col |
Upper-left column coordinate in |
|
row |
Upper-left row coordinate in |
|
width |
Area width (number of columns) in |
|
height |
Area height (number of rows) in |
|
dest |
Destination data field. |
|
minor |
|
Since: 2.49
void gwy_data_field_fill (GwyDataField *data_field
,gdouble value
);
Fills a data field with given value.
data_field |
A data field. |
|
value |
Value to be entered. |
void
gwy_data_field_clear (GwyDataField *data_field
);
Fills a data field with zeroes.
data_field |
A data field. |
void gwy_data_field_multiply (GwyDataField *data_field
,gdouble value
);
Multiplies all values in a data field by given value.
data_field |
A data field. |
|
value |
Value to multiply |
void gwy_data_field_add (GwyDataField *data_field
,gdouble value
);
Adds given value to all values in a data field.
data_field |
A data field. |
|
value |
Value to be added to data field values. |
void
gwy_data_field_abs (GwyDataField *data_field
);
Takes absolute value of all values in a data field.
data_field |
A data field. |
Since: 2.52
void gwy_data_field_area_fill (GwyDataField *data_field
,gint col
,gint row
,gint width
,gint height
,gdouble value
);
Fills a rectangular part of a data field with given value.
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). |
|
value |
Value to be entered |
void gwy_data_field_area_fill_mask (GwyDataField *data_field
,GwyDataField *mask
,GwyMaskingType mode
,gint col
,gint row
,gint width
,gint height
,gdouble value
);
Fills a masked rectangular part of a data field with given value.
data_field |
A data field. |
|
mask |
Mask specifying which values to take into account/exclude, or |
|
mode |
Masking mode to use. See the introduction for description of masking modes. |
|
col |
Upper-left column coordinate. |
|
row |
Upper-left row coordinate. |
|
width |
Area width (number of columns). |
|
height |
Area height (number of rows). |
|
value |
Value to be entered |
Since: 2.44
void gwy_data_field_area_clear (GwyDataField *data_field
,gint col
,gint row
,gint width
,gint height
);
Fills a rectangular part of a data field with zeroes.
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). |
void gwy_data_field_area_multiply (GwyDataField *data_field
,gint col
,gint row
,gint width
,gint height
,gdouble value
);
Multiplies values in a rectangular part of a data field by given value
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). |
|
value |
Value to multiply area with. |
void gwy_data_field_area_add (GwyDataField *data_field
,gint col
,gint row
,gint width
,gint height
,gdouble value
);
Adds given value to all values in a rectangular part 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). |
|
value |
Value to be added to area values. |
void gwy_data_field_area_abs (GwyDataField *data_field
,gint col
,gint row
,gint width
,gint height
);
Takes absolute value of values in a rectangular part 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). |
Since: 2.52
GwyDataLine * gwy_data_field_get_profile (GwyDataField *data_field
,GwyDataLine *data_line
,gint scol
,gint srow
,gint ecol
,gint erow
,gint res
,gint thickness
,GwyInterpolationType interpolation
);
Extracts a possibly averaged profile from data field to a data line.
data_field |
A data field. |
|
data_line |
A data line. It will be resized to |
|
scol |
The column the line starts at (inclusive). |
|
srow |
The row the line starts at (inclusive). |
|
ecol |
The column the line ends at (inclusive). |
|
erow |
The row the line ends at (inclusive). |
|
res |
Requested resolution of data line (the number of samples to take). If nonpositive, data line resolution is
chosen to match |
|
thickness |
Thickness of line to be averaged. |
|
interpolation |
Interpolation type to use. |
data_line
itself if it was not NULL
, otherwise a newly created data line.
GwyXY * gwy_data_field_get_profile_mask (GwyDataField *data_field
,gint *ndata
,GwyDataField *mask
,GwyMaskingType masking
,gdouble xfrom
,gdouble yfrom
,gdouble xto
,gdouble yto
,gint res
,gint thickness
,GwyInterpolationType interpolation
);
Extracts a possibly averaged profile from data field, with masking.
The extracted profile can contain holes due to masking. It can also contain no points at all if the all data
values along the profile were excluded due to masking – in this case NULL
is returned.
Unlike gwy_data_field_get_profile()
, this function takes real coordinates (without offsets), not row and column
indices.
data_field |
A data field. |
|
ndata |
Location where to store the actual number of extracted points, which may differ from |
|
mask |
Mask specifying which values to take into account/exclude, or |
|
masking |
Masking mode to use. |
|
xfrom |
The real |
|
yfrom |
The real |
|
xto |
The real |
|
yto |
The real |
|
res |
Requested resolution, i.e. the number of samples to take. If nonpositive, sampling is chosen to match
|
|
thickness |
Thickness of line to be averaged. |
|
interpolation |
Interpolation type to use. |
A newly allocated array of GwyXY coordinare pairs, or NULL
. The caller must free the returned array with
g_free()
.
Since: 2.49
void gwy_data_field_get_row (GwyDataField *data_field
,GwyDataLine *data_line
,gint row
);
Extracts a data field row into a data line.
data_field |
A data field. |
|
data_line |
A data line. It will be resized to width ot |
|
row |
Row index. |
void gwy_data_field_get_column (GwyDataField *data_field
,GwyDataLine *data_line
,gint col
);
Extracts a data field column into a data line.
data_field |
A data field |
|
data_line |
A data line. It will be resized to height of |
|
col |
Column index. |
void gwy_data_field_set_row (GwyDataField *data_field
,GwyDataLine *data_line
,gint row
);
Sets a row in the data field to values of a data line.
Data line length must be equal to width of data field.
data_field |
A data field. |
|
data_line |
A data line. |
|
row |
Row index. |
void gwy_data_field_set_column (GwyDataField *data_field
,GwyDataLine *data_line
,gint col
);
Sets a column in the data field to values of a data line.
Data line length must be equal to height of data field.
data_field |
A data field. |
|
data_line |
A data line. |
|
col |
Column index. |
void gwy_data_field_get_row_part (GwyDataField *data_field
,GwyDataLine *data_line
,gint row
,gint from
,gint to
);
Extracts part of a data field row into a data line.
data_field |
A data field. |
|
data_line |
A data line. It will be resized to the row part width. |
|
row |
Row index. |
|
from |
Start column index. |
|
to |
End column index + 1. |
void gwy_data_field_get_column_part (GwyDataField *data_field
,GwyDataLine *data_line
,gint col
,gint from
,gint to
);
Extracts part of a data field column into a data line.
data_field |
A data field. |
|
data_line |
A data line. It will be resized to the column part height. |
|
col |
Column index. |
|
from |
Start row index. |
|
to |
End row index + 1. |
void gwy_data_field_set_row_part (GwyDataField *data_field
,GwyDataLine *data_line
,gint row
,gint from
,gint to
);
Puts a data line into a data field row.
If data line length differs from to
-from
, it is resampled to this length.
data_field |
A data field. |
|
data_line |
A data line. |
|
row |
Row index. |
|
from |
Start row index. |
|
to |
End row index + 1. |
void gwy_data_field_set_column_part (GwyDataField *data_field
,GwyDataLine *data_line
,gint col
,gint from
,gint to
);
Puts a data line into data field column.
If data line length differs from to
-from
, it is resampled to this length.
data_field |
A data field. |
|
data_line |
A data line. |
|
col |
Column index. |
|
from |
Start row index. |
|
to |
End row index + 1. |
gdouble gwy_data_field_get_xder (GwyDataField *data_field
,gint col
,gint row
);
Computes central derivative in X direction.
On border points, one-side derivative is returned.
data_field |
A data field. |
|
col |
Column index. |
|
row |
Row index. |
Derivative in X direction.
gdouble gwy_data_field_get_yder (GwyDataField *data_field
,gint col
,gint row
);
Computes central derivative in Y direction.
On border points, one-side derivative is returned.
Note the derivative is for legacy reasons calulcated for the opposite y direction than is usual elsewhere in Gwyddion, i.e. if values increase with increasing row number, the returned value is negative.
data_field |
A data field. |
|
col |
Column index. |
|
row |
Row index. |
Derivative in Y direction
gdouble gwy_data_field_get_angder (GwyDataField *data_field
,gint col
,gint row
,gdouble theta
);
Computes derivative in direction specified by given angle.
data_field |
A data field. |
|
col |
Column index. |
|
row |
Row index. |
|
theta |
Angle defining the direction (in radians, counterclockwise). |
Derivative in direction given by angle theta
.
void gwy_data_field_average_xyz (GwyDataField *data_field
,GwyDataField *density_map
,const GwyXYZ *points
,gint npoints
);
Fills a data field with regularised XYZ data using a simple method.
The real dimensions and offsets of field
determine the rectangle in the XY plane that will be regularised. The
regularisation method is fast but simple and there are no absolute guarantees of quality, even though the result
will be usually quite acceptable.
This especially applies to reasonable views of the XYZ data. Unreasonable views can be rendered unreasonably. In
particular if the rectangle does not contain any point from points
(either due to high zoom to an empty region or
by just being completely off) data_field
will be filled entirely with the value of the closest point or something
similar.
data_field |
A data field to fill with regularised XYZ data. |
|
density_map |
Optional data field to fill with XYZ point density map. It can be |
|
points |
Array of XYZ points. Coordinates X and Y represent positions in the plane; the Z-coordinate represents values. |
|
npoints |
Number of points. |
Since: 2.44
#define gwy_data_field_get_xmeasure gwy_data_field_get_dx
Alias for gwy_data_field_get_dx()
.
data_field |
A data field. |
#define gwy_data_field_get_ymeasure gwy_data_field_get_dy
Alias for gwy_data_field_get_dy()
.
data_field |
A data field. |
struct GwyDataField;
The GwyDataField struct contains private data only and should be accessed using the functions below.
struct GwyDataFieldClass { GObjectClass parent_class; void (*data_changed)(GwyDataField *data_field); };
“data-changed”
signalvoid user_function (GwyDataField *gwydatafield, gpointer user_data)
The ::data-changed signal is never emitted by data field itself. It is intended as a means to notify others data field users they should update themselves.
gwydatafield |
The GwyDataField which received the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run First