Module gwy :: Class Brick
[hide private]
[frames] | no frames]

Class Brick

source code

Three-dimensional data representation

Brick represents 3D data arrays in Gwyddion. It is typically useful for different volume data obtained from SPMs, like in force volume measurements.

Instance Methods [hide private]
 
__init__(xres, yres, zres, xreal, yreal, zreal, nullme)
Creates a new data brick.
source code
 
check_compatibility(brick2, check)
Checks whether two data bricks are compatible.
source code
 
new_alike(nullme)
Creates a new data brick similar to an existing one.
source code
 
new_part(xpos, ypos, zpos, xres, yres, zres, keep_offsets)
Creates a new data brick as a part of existing one.
source code
 
data_changed()
Emits signal "data_changed" on a data brick.
source code
 
copy(dest, nondata_too)
Copies the contents of an already allocated brick to a brick of the same size.
source code
 
resample(xres, yres, zres, interpolation)
Resamples a data brick.
source code
 
get_xres()
Gets the x resolution of a data brick.
source code
 
get_yres()
Gets the y resolution of a data brick.
source code
 
get_zres()
Gets the z resolution of a data brick.
source code
 
get_xreal()
Gets the physical size of a data brick in the x direction.
source code
 
get_yreal()
Gets the physical size of a data brick in the y direction.
source code
 
get_zreal()
Gets the physical size of a data brick in the z direction.
source code
 
get_xoffset()
Gets the offset of data brick origin in x direction.
source code
 
get_yoffset()
Gets the offset of data brick origin in y direction.
source code
 
get_zoffset()
Gets the offset of data brick origin in z direction.
source code
 
set_xreal(xreal)
Sets the real x dimension of a brick.
source code
 
set_yreal(yreal)
Sets the real y dimension of a brick.
source code
 
set_zreal(zreal)
Sets the real z dimension of a brick.
source code
 
set_xoffset(xoffset)
Sets the offset of a data brick origin in the x direction.
source code
 
set_yoffset(yoffset)
Sets the offset of a data brick origin in the y direction.
source code
 
set_zoffset(zoffset)
Sets the offset of a data brick origin in the z direction.
source code
 
get_dx()
Gets the horizontal (X) voxel size of a brick in real units.
source code
 
get_dy()
Gets the vertical (Y) voxel size of a brick in real units.
source code
 
get_dz()
Gets the level-wise (Z) voxel size of a brick in real units.
source code
 
get_si_unit_x()
Returns x direction SI unit of a data brick.
source code
 
get_si_unit_y()
Returns y direction SI unit of a data brick.
source code
 
get_si_unit_z()
Returns z direction SI unit of a data brick.
source code
 
get_si_unit_w()
Returns value SI unit of a data brick.
source code
 
set_si_unit_x(si_unit)
Sets the SI unit corresponding to the lateral (X) dimension of a data brick.
source code
 
set_si_unit_y(si_unit)
Sets the SI unit corresponding to the lateral (Y) dimension of a data brick.
source code
 
set_si_unit_z(si_unit)
Sets the SI unit corresponding to the "height" (Z) dimension of a data brick.
source code
 
set_si_unit_w(si_unit)
Sets the SI unit corresponding to the "value" of a data brick.
source code
 
get_min()
Find the minimum value in a data brick.
source code
 
get_max()
Find the maximum value in a data brick.
source code
 
copy_units(target)
Sets lateral and value units of a data brick to match another data brick.
source code
 
get_value_format_x(style)
Finds value format good for displaying coordinates of a data brick.
source code
 
get_value_format_y(style)
Finds value format good for displaying values of a data brick.
source code
 
get_value_format_z(style)
Finds value format good for displaying values of a data brick.
source code
 
get_value_format_w(style)
Finds value format good for displaying values of a data brick.
source code
 
itor(pixpos)
Transforms pixel coordinate to real (physical) coordinate in x direction.
source code
 
rtoi(realpos)
Transforms real (physical) coordinate to pixel coordinate in x axis.
source code
 
jtor(pixpos)
Transforms pixel coordinate to real (physical) coordinate in y direction.
source code
 
rtoj(realpos)
Transforms real (physical) coordinate to pixel coordinate in y axis.
source code
 
ktor(pixpos)
Transforms pixel coordinate to real (physical) coordinate in z direction.
source code
 
rtok(realpos)
Transforms real (physical) coordinate to pixel coordinate in z axis.
source code
 
ktor_cal(pixpos)
Transforms pixel coordinate to real (physical) coordinate in z direction, taking into account calibration.
source code
 
rtok_cal(realpos)
Transforms real (physical) coordinate to pixel coordinate in z axis, taking into account calibration.
source code
 
get_val(col, row, lev)
Gets value at given position in a data brick.
source code
 
set_val(col, row, lev, value)
Sets value at given position in a data brick.
source code
 
get_val_real(x, y, z)
Gets value at given position in a data brick, in real coordinates.
source code
 
set_val_real(x, y, z, value)
Sets value at given position in a data brick.
source code
 
get_dval(x, y, z, interpolation)
Gets interpolated value at arbitrary data brick point indexed by pixel coordinates.
source code
 
get_dval_real(x, y, z, interpolation)
Gets interpolated value at arbitrary data brick point indexed by pixel coordinates.
source code
 
clear()
Fills a data brick with zeroes.
source code
 
fill(value)
Fills a data brick with specified value.
source code
 
multiply(value)
Multiplies all values in a data brick with a specified value.
source code
 
add(value)
Adds a specified value to all values in a data brick.
source code
 
extract_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)
Extracts a plane from a data brick.
source code
 
extract_xy_plane(target, lev)
Extracts one full XY plane of a data brick to a data field.
source code
 
sum_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)
Sums planes in certain direction
source code
 
sum_xy_plane(target)
Sums all z-profiles of a data brick to a data field.
source code
 
min_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)
Finds minima of profiles in certain direction.
source code
 
min_xy_plane(target)
Computes the minima along z-axis of a data brick to a data field.
source code
 
max_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)
Finds minima of profiles in certain direction.
source code
 
max_xy_plane(target)
Computes the maxima along z-axis of a data brick to a data field.
source code
 
minpos_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)
Finds minima coordinates in profiles in certain direction.
source code
 
minpos_xy_plane(target)
Computes the location of minima along z-axis of a data brick to a data field.
source code
 
maxpos_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)
Finds maxima coordinates of profiles in certain direction.
source code
 
maxpos_xy_plane(target)
Computes the location of maxima along z-axis of a data brick to a data field.
source code
 
mean_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)
Finds mean of planes in certain direction.
source code
 
mean_xy_plane(target)
Calculates mean values of all z-profiles of a data brick to a data field.
source code
 
rms_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)
Finds rms of planes in certain direction and extract the result (DataField).
source code
 
rms_xy_plane(target)
Calculates rms values of all z-profiles of a data brick to a data field.
source code
 
extract_line(target, istart, jstart, kstart, iend, jend, kend, keep_offsets)
Extracts a line (DataLine) from the brick.
source code
 
extract_z_line(target, i, j)
Extracts one full Z profile of a data brick to a data line.
source code
 
get_zcalibration()
Gets the z-axis non-linear calibration of a data brick.
source code
 
set_zcalibration(calibration)
Sets the z-axis non-linear calibration of a data brick.
source code
 
copy_zcalibration(target)
Copies non-linear z-axis calibration between two data bricks.
source code
 
transpose(target, type, xflipped, yflipped, zflipped)
Transposes a data brick, exchanging and/or flipping axes.
source code
 
invert(xflipped, yflipped, zflipped, wflipped)
Reflects and/or inverts a data brick in place.
source code
 
set_plane(plane, istart, jstart, kstart, width, height, depth)
Fill a single plane in the brick by a two-dimensional data (DataField).
source code
 
set_xy_plane(plane, lev)
Sets one full single XY plane in a data brick from data field values.
source code
 
add_to_xy_planes(plane)
Adds a data field to all brick XY planes.
source code
 
add_to_z_lines(line)
Adds a data line to all brick Z lines.
source code
 
get_data()
Extract the data of a data brick.
source code
 
set_data(data)
Sets the entire contents of a data brick.
source code
 
duplicate()
Convenience macro doing gwy_serializable_duplicate() with all the necessary typecasting.
source code
 
get_data_pointer()
Gets pointer to data which the brick contains.
source code
Method Details [hide private]

__init__(xres, yres, zres, xreal, yreal, zreal, nullme)
(Constructor)

source code 

Creates a new data brick.

Parameters:
  • xres - X resolution, i.e., the number of samples in x direction (int)
  • yres - Y resolution, i.e., the number of samples in y direction (int)
  • zres - Z resolution, i.e., the number of samples in z direction (int)
  • xreal - Real physical dimension in x direction. (float)
  • yreal - Real physical dimension in y direction. (float)
  • zreal - Real physical dimension in z direction. (float)
  • nullme - Whether the data brick should be initialized to zeroes. If False, the data will not be initialized. (bool)
Returns:
A newly created data brick. (Brick)

Since: 2.31

check_compatibility(brick2, check)

source code 

Checks whether two data bricks are compatible.

Real dimensions are checked without regard to calibration. Calibrations are considered compatible if either both exist and are identical or none exists.

Parameters:
  • brick2 - Another data brick. (Brick)
  • check - The compatibility tests to perform. Expected values: DATA_COMPATIBILITY_RES, DATA_COMPATIBILITY_REAL, DATA_COMPATIBILITY_MEASURE, DATA_COMPATIBILITY_LATERAL, DATA_COMPATIBILITY_VALUE, DATA_COMPATIBILITY_AXISCAL, DATA_COMPATIBILITY_NCURVES, DATA_COMPATIBILITY_CURVELEN, DATA_COMPATIBILITY_ALL. (DataCompatibilityFlags)
Returns:
Zero if all tested properties are compatible. Flags corresponding to failed tests if bricks are not compatible. (DataCompatibilityFlags)

Since: 2.51

new_alike(nullme)

source code 

Creates a new data brick similar to an existing one.

Use Brick.duplicate() if you want to copy a data brick including data.

Parameters:
  • nullme - Whether the data brick should be initialized to zeroes. If False, the data will not be initialized. (bool)
Returns:
A newly created data brick. (Brick)

Since: 2.31

new_part(xpos, ypos, zpos, xres, yres, zres, keep_offsets)

source code 

Creates a new data brick as a part of existing one.

Use Brick.duplicate() if you want to copy a whole data brick.

Parameters:
  • xpos - x position where to start from (int)
  • ypos - y position where to start from (int)
  • zpos - z position where to start from (int)
  • xres - x resolution (width) to be extracted (int)
  • yres - y resolution (height) to be extracted (int)
  • zres - z resolution (depth) to be extracted (int)
  • keep_offsets - keep offsets of data during extraction (bool)
Returns:
A newly created data brick. (Brick)

Since: 2.32

data_changed()

source code 

Emits signal "data_changed" on a data brick.

Since: 2.31

copy(dest, nondata_too)

source code 

Copies the contents of an already allocated brick to a brick of the same size.

Parameters:
  • dest - Destination brick. (Brick)
  • nondata_too - Whether non-data (units) should be copied too. (bool)

resample(xres, yres, zres, interpolation)

source code 

Resamples a data brick.

In other words changes the size of three dimensional field related with data brick. The original values are used for resampling using a requested interpolation alorithm.

Parameters:
  • xres - Desired x resolution. (int)
  • yres - Desired y resolution. (int)
  • zres - Desired z resolution. (int)
  • interpolation - Interpolation method to use. Expected values: INTERPOLATION_NONE, INTERPOLATION_ROUND, INTERPOLATION_LINEAR, INTERPOLATION_BILINEAR, INTERPOLATION_KEY, INTERPOLATION_BSPLINE, INTERPOLATION_OMOMS, INTERPOLATION_NNA, INTERPOLATION_SCHAUM. (InterpolationType)

Since: 2.31

get_xres()

source code 

Gets the x resolution of a data brick.

Returns:
Resolution (number of data points). (int)

Since: 2.31

get_yres()

source code 

Gets the y resolution of a data brick.

Returns:
Resolution (number of data points). (int)

Since: 2.31

get_zres()

source code 

Gets the z resolution of a data brick.

Returns:
Resolution (number of data points). (int)

Since: 2.31

get_xreal()

source code 

Gets the physical size of a data brick in the x direction.

Returns:
Real size of a data brick the x direction. (float)

Since: 2.31

get_yreal()

source code 

Gets the physical size of a data brick in the y direction.

Returns:
Real size of a data brick the y direction. (float)

Since: 2.31

get_zreal()

source code 

Gets the physical size of a data brick in the z direction.

Returns:
Real size of a data brick the z direction. (float)

Since: 2.31

get_xoffset()

source code 

Gets the offset of data brick origin in x direction.

Returns:
Offset value. (float)

Since: 2.31

get_yoffset()

source code 

Gets the offset of data brick origin in y direction.

Returns:
Offset value. (float)

Since: 2.31

get_zoffset()

source code 

Gets the offset of data brick origin in z direction.

Returns:
Offset value. (float)

Since: 2.31

set_xreal(xreal)

source code 

Sets the real x dimension of a brick.

Parameters:
  • xreal - New real x dimensions value (float)

Since: 2.31

set_yreal(yreal)

source code 

Sets the real y dimension of a brick.

Parameters:
  • yreal - New real y dimensions value (float)

Since: 2.31

set_zreal(zreal)

source code 

Sets the real z dimension of a brick.

Parameters:
  • zreal - New real z dimensions value (float)

Since: 2.31

set_xoffset(xoffset)

source code 

Sets the offset of a data brick origin in the x direction.

Note offsets don't affect any calculation, nor functions like Brick.rtoi().

Parameters:
  • xoffset - New offset value. (float)

Since: 2.31

set_yoffset(yoffset)

source code 

Sets the offset of a data brick origin in the y direction.

Note offsets don't affect any calculation, nor functions like Brick.rtoi().

Parameters:
  • yoffset - New offset value. (float)

Since: 2.31

set_zoffset(zoffset)

source code 

Sets the offset of a data brick origin in the z direction.

Note offsets don't affect any calculation, nor functions like Brick.rtoi().

Parameters:
  • zoffset - New offset value. (float)

Since: 2.31

get_dx()

source code 

Gets the horizontal (X) voxel size of a brick in real units.

The result is the same as Brick.get_xreal(brick)/Brick.get_xres(brick).

Returns:
Horizontal voxel size. (float)

Since: 2.52

get_dy()

source code 

Gets the vertical (Y) voxel size of a brick in real units.

The result is the same as Brick.get_yreal(brick)/Brick.get_yres(brick).

Returns:
Vertical voxel size. (float)

Since: 2.52

get_dz()

source code 

Gets the level-wise (Z) voxel size of a brick in real units.

The result is the same as Brick.get_zreal(brick)/Brick.get_zres(brick).

Note that it cannot -- and hence does not -- take into account any attached Z calibration.

Returns:
Level-wise voxel size. (float)

Since: 2.52

get_si_unit_x()

source code 

Returns x direction SI unit of a data brick.

Returns:
SI unit corresponding to the lateral (X) dimension of the data brick. Its reference count is not incremented. (SIUnit)

Since: 2.31

get_si_unit_y()

source code 

Returns y direction SI unit of a data brick.

Returns:
SI unit corresponding to the lateral (Y) dimension of the data brick. Its reference count is not incremented. (SIUnit)

Since: 2.31

get_si_unit_z()

source code 

Returns z direction SI unit of a data brick.

Returns:
SI unit corresponding to the "height" (Z) dimension of the data brick. Its reference count is not incremented. (SIUnit)

Since: 2.31

get_si_unit_w()

source code 

Returns value SI unit of a data brick.

Returns:
SI unit corresponding to the "value" of the data brick. Its reference count is not incremented. (SIUnit)

Since: 2.31

set_si_unit_x(si_unit)

source code 

Sets the SI unit corresponding to the lateral (X) dimension of a data brick.

It does not assume a reference on si_unit, instead it adds its own reference.

Parameters:
  • si_unit - SI unit to be set. (SIUnit)

Since: 2.31

set_si_unit_y(si_unit)

source code 

Sets the SI unit corresponding to the lateral (Y) dimension of a data brick.

It does not assume a reference on si_unit, instead it adds its own reference.

Parameters:
  • si_unit - SI unit to be set. (SIUnit)

Since: 2.31

set_si_unit_z(si_unit)

source code 

Sets the SI unit corresponding to the "height" (Z) dimension of a data brick.

It does not assume a reference on si_unit, instead it adds its own reference.

Parameters:
  • si_unit - SI unit to be set. (SIUnit)

Since: 2.31

set_si_unit_w(si_unit)

source code 

Sets the SI unit corresponding to the "value" of a data brick.

It does not assume a reference on si_unit, instead it adds its own reference.

Parameters:
  • si_unit - SI unit to be set. (SIUnit)

Since: 2.31

get_min()

source code 

Find the minimum value in a data brick.

Returns:
The minimum value within the brick. (float)

Since: 2.31

get_max()

source code 

Find the maximum value in a data brick.

Returns:
The maximum value within the brick. (float)

Since: 2.31

copy_units(target)

source code 

Sets lateral and value units of a data brick to match another data brick.

Parameters:
  • target - Target data brick. (Brick)

Since: 2.49

get_value_format_x(style)

source code 

Finds value format good for displaying coordinates of a data brick.

Parameters:
  • style - Unit format style. Expected values: SI_UNIT_FORMAT_NONE, SI_UNIT_FORMAT_PLAIN, SI_UNIT_FORMAT_MARKUP, SI_UNIT_FORMAT_VFMARKUP, SI_UNIT_FORMAT_TEX, SI_UNIT_FORMAT_VFTEX, SI_UNIT_FORMAT_UNICODE, SI_UNIT_FORMAT_VFUNICODE. (SIUnitFormatStyle)
Returns:
Tuple consisting of 2 values (value, format). ((SIValueFormat), (SkipArg))

Since: 2.31

get_value_format_y(style)

source code 

Finds value format good for displaying values of a data brick.

Parameters:
  • style - Unit format style. Expected values: SI_UNIT_FORMAT_NONE, SI_UNIT_FORMAT_PLAIN, SI_UNIT_FORMAT_MARKUP, SI_UNIT_FORMAT_VFMARKUP, SI_UNIT_FORMAT_TEX, SI_UNIT_FORMAT_VFTEX, SI_UNIT_FORMAT_UNICODE, SI_UNIT_FORMAT_VFUNICODE. (SIUnitFormatStyle)
Returns:
Tuple consisting of 2 values (value, format). ((SIValueFormat), (SkipArg))

Since: 2.31

get_value_format_z(style)

source code 

Finds value format good for displaying values of a data brick.

Parameters:
  • style - Unit format style. Expected values: SI_UNIT_FORMAT_NONE, SI_UNIT_FORMAT_PLAIN, SI_UNIT_FORMAT_MARKUP, SI_UNIT_FORMAT_VFMARKUP, SI_UNIT_FORMAT_TEX, SI_UNIT_FORMAT_VFTEX, SI_UNIT_FORMAT_UNICODE, SI_UNIT_FORMAT_VFUNICODE. (SIUnitFormatStyle)
Returns:
Tuple consisting of 2 values (value, format). ((SIValueFormat), (SkipArg))

Since: 2.31

get_value_format_w(style)

source code 

Finds value format good for displaying values of a data brick.

Note this functions searches for minimum and maximum value in brick, therefore it's relatively slow.

Parameters:
  • style - Unit format style. Expected values: SI_UNIT_FORMAT_NONE, SI_UNIT_FORMAT_PLAIN, SI_UNIT_FORMAT_MARKUP, SI_UNIT_FORMAT_VFMARKUP, SI_UNIT_FORMAT_TEX, SI_UNIT_FORMAT_VFTEX, SI_UNIT_FORMAT_UNICODE, SI_UNIT_FORMAT_VFUNICODE. (SIUnitFormatStyle)
Returns:
Tuple consisting of 2 values (value, format). ((SIValueFormat), (SkipArg))

Since: 2.31

itor(pixpos)

source code 

Transforms pixel coordinate to real (physical) coordinate in x direction.

That is it maps range [0..x resolution] to range [0..x real-size]. It is not suitable for conversion of matrix indices to physical coordinates, you have to use Brick.itor(brick, pixpos + 0.5) for that.

Parameters:
  • pixpos - Pixel coordinate. (float)
Returns:
pixpos in real coordinates. (float)

Since: 2.31

rtoi(realpos)

source code 

Transforms real (physical) coordinate to pixel coordinate in x axis.

That is it maps range [0..x real-size] to range [0..x resolution].

Parameters:
  • realpos - Real coordinate. (float)
Returns:
realpos in pixel coordinates. (float)

Since: 2.31

jtor(pixpos)

source code 

Transforms pixel coordinate to real (physical) coordinate in y direction.

That is it maps range [0..y resolution] to range [0..y real-size]. It is not suitable for conversion of matrix indices to physical coordinates, you have to use Brick.itor(brick, pixpos + 0.5) for that.

Parameters:
  • pixpos - Pixel coordinate. (float)
Returns:
pixpos in real coordinates. (float)

Since: 2.31

rtoj(realpos)

source code 

Transforms real (physical) coordinate to pixel coordinate in y axis.

That is it maps range [0..y real-size] to range [0..y resolution].

Parameters:
  • realpos - Real coordinate. (float)
Returns:
realpos in pixel coordinates. (float)

Since: 2.31

ktor(pixpos)

source code 

Transforms pixel coordinate to real (physical) coordinate in z direction.

That is it maps range [0..z resolution] to range [0..z real-size]. It is not suitable for conversion of matrix indices to physical coordinates, you have to use Brick.itor(brick, pixpos + 0.5) for that.

Parameters:
  • pixpos - Pixel coordinate. (float)
Returns:
pixpos in real coordinates. (float)

Since: 2.31

rtok(realpos)

source code 

Transforms real (physical) coordinate to pixel coordinate in z axis.

That is it maps range [0..z real-size] to range [0..z resolution].

Parameters:
  • realpos - Real coordinate. (float)
Returns:
realpos in pixel coordinates. (float)

Since: 2.31

ktor_cal(pixpos)

source code 

Transforms pixel coordinate to real (physical) coordinate in z direction, taking into account calibration.

Unlike Brick.ktor(), this function takes into account the z calibration and, if calibration is not present, the z axis offset. Since the calibration is available only for discrete pixel coordinates, the values are interpolated between and clamped if outside the range.

The values in the calibration are assumed to correspond to pixel centres. This convention is also kept when no calibration is present.

Parameters:
  • pixpos - Pixel coordinate. (float)
Returns:
pixpos in real coordinates. (float)

Since: 2.42

rtok_cal(realpos)

source code 

Transforms real (physical) coordinate to pixel coordinate in z axis, taking into account calibration.

Unlike Brick.rtok(), this function takes into account the z calibration and, if calibration is not present, the z axis offset. Since the calibration is available only for discrete pixel coordinates, the values are interpolated between and clamped if outside the range.

The values in the calibration are assumed to correspond to pixel centres. This convention is also kept when no calibration is present.

Parameters:
  • realpos - Real coordinate. (float)
Returns:
realpos in pixel coordinates. (float)

Since: 2.42

get_val(col, row, lev)

source code 

Gets value at given position in a data brick.

Do not access data with this function inside inner loops, it's slow. Get raw data buffer with Brick.get_data_const() and access it directly instead.

Parameters:
  • col - Position in the brick (column index). (int)
  • row - Position in the brick (row index). (int)
  • lev - Position in the brick (level index). (int)
Returns:
Value at given index. (float)

Since: 2.31

set_val(col, row, lev, value)

source code 

Sets value at given position in a data brick.

Do not access data with this function inside inner loops, it's slow. Get raw data buffer with Brick.get_data_const() and access it directly instead.

Parameters:
  • col - Position in the brick (column index). (int)
  • row - Position in the brick (row index). (int)
  • lev - Position in the brick (level index). (int)
  • value - Value to be set. (float)

Since: 2.31

get_val_real(x, y, z)

source code 

Gets value at given position in a data brick, in real coordinates.

Do not access data with this function inside inner loops, it's slow. Get raw data buffer with Brick.get_data_const() and access it directly instead.

Parameters:
  • x - Position in the brick (x direction). (float)
  • y - Position in the brick (y direction). (float)
  • z - Position in the brick (z direction). (float)
Returns:
Value at given index. (float)

Since: 2.31

set_val_real(x, y, z, value)

source code 

Sets value at given position in a data brick.

Do not access data with this function inside inner loops, it's slow. Get raw data buffer with Brick.get_data_const() and access it directly instead.

Parameters:
  • x - Position in the brick (x direction). (float)
  • y - Position in the brick (y direction). (float)
  • z - Position in the brick (z direction). (float)
  • value - Value to be set. (float)

Since: 2.31

get_dval(x, y, z, interpolation)

source code 

Gets interpolated value at arbitrary data brick point indexed by pixel coordinates.

Note pixel values are centered in intervals [i, i+1]. See also Brick.get_dval_real() that does the same, but takes real coordinates.

Parameters:
  • x - Position in data brick in range [0, x resolution]. If the value is outside this range, the nearest border value is returned. (float)
  • y - Position in data brick in range [0, y resolution]. If the value is outside this range, the nearest border value is returned. (float)
  • z - Position in data brick in range [0, z resolution]. If the value is outside this range, the nearest border value is returned. (float)
  • interpolation - Interpolation method to use. (int)
Returns:
Value interpolated in the data brick. (float)

Since: 2.31

get_dval_real(x, y, z, interpolation)

source code 

Gets interpolated value at arbitrary data brick point indexed by pixel coordinates.

Note pixel values are centered in intervals [j, j+1]. See also Brick.get_dval() that does the same, but takes pixel coordinates.

Parameters:
  • x - Position in data brick in range [0, x resolution]. If the value is outside this range, the nearest border value is returned. (float)
  • y - Position in data brick in range [0, y resolution]. If the value is outside this range, the nearest border value is returned. (float)
  • z - Position in data brick in range [0, z resolution]. If the value is outside this range, the nearest border value is returned. (float)
  • interpolation - Interpolation method to use. (int)
Returns:
Value interpolated in the data brick. (float)

Since: 2.31

clear()

source code 

Fills a data brick with zeroes.

Since: 2.31

fill(value)

source code 

Fills a data brick with specified value.

Parameters:
  • value - Value to fill data brick with. (float)

Since: 2.31

multiply(value)

source code 

Multiplies all values in a data brick with a specified value.

Parameters:
  • value - Value to multiply data brick with. (float)

Since: 2.31

add(value)

source code 

Adds a specified value to all values in a data brick.

Parameters:
  • value - Value to be added. (float)

Since: 2.31

extract_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)

source code 

Extracts a plane from a data brick.

One value of set (width, height, depth) needs to be -1, determining the plane orientation.

Use Brick.extract_xy_plane() to simply extract one entire XY plane.

Parameters:
  • target - Datafield to be filled by extracted plane. It will be resized if necessary. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of extracted plane. If width is -1, the yz plane will be extracted. (int)
  • height - Pixel height of extracted plane. If height is -1, the xz plane will be extracted (int)
  • depth - Pixel depth of extracted plane. If depth is -1, the xy plane will be extracted (int)
  • keep_offsets - Keep the physical offsets in extracted field. (bool)

Since: 2.31

extract_xy_plane(target, lev)

source code 

Extracts one full XY plane of a data brick to a data field.

Parameters:
  • target - Datafield to be filled by extracted plane. It will be resized if necessary. (DataField)
  • lev - Position in the brick (level index). (int)

Since: 2.52

sum_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)

source code 

Sums planes in certain direction

One value of set (width, height, depth) needs to be -1, determining the plane orientation. In contrast to Brick.extract_plane, the appropriate start coordinate (e.g. istart if width = -1) is not used for single plane extraction, but the planes are accumulated in whole range (0..xres for given example).

Parameters:
  • target - Datafield to be filled by summed plane. It will be resized if necessary. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of summed plane. If width is -1, the yz planes will be summed. (int)
  • height - Pixel height of summed plane. If height is -1, the xz planes will be summed (int)
  • depth - Pixel depth of summed plane. If depth is -1, the xy planes will be summed (int)
  • keep_offsets - Keep the physical offsets in extracted field. (bool)

Since: 2.31

sum_xy_plane(target)

source code 

Sums all z-profiles of a data brick to a data field.

The result is an xy plane and can be alternatively imagined as the sum of all xy planes.

Parameters:
  • target - Datafield to be filled by the summary data. It will be resized if necessary. (DataField)

Since: 2.52

min_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)

source code 

Finds minima of profiles in certain direction.

One value of set (width, height, depth) needs to be -1, determining the plane orientation. In contrast to Brick.extract_plane, the appropriate start coordinate (e.g. istart if width = -1) is not used for single plane extraction, but the planes are accumulated in whole range (0..xres for given example).

Parameters:
  • target - Datafield to be filled by the minima plane. It will be resized if necessary. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of summarized plane. If width is -1, the yz planes will be summarized. (int)
  • height - Pixel height of summarized plane. If height is -1, the xz planes will be summarized. (int)
  • depth - Pixel depth of summarized plane. If depth is -1, the xy planes will be summarized (int)
  • keep_offsets - Keep the physical offsets in extracted field. (bool)

Since: 2.32

min_xy_plane(target)

source code 

Computes the minima along z-axis of a data brick to a data field.

The result is an xy plane.

Parameters:
  • target - Datafield to be filled by the summary data. It will be resized if necessary. (DataField)

Since: 2.52

max_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)

source code 

Finds minima of profiles in certain direction.

One value of set (width, height, depth) needs to be -1, determining the plane orientation. In contrast to Brick.extract_plane, the appropriate start coordinate (e.g. istart if width = -1) is not used for single plane extraction, but the planes are accumulated in whole range (0..xres for given example).

Parameters:
  • target - Datafield to be filled by the maxima plane. It will be resized if necessary. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of summarized plane. If width is -1, the yz planes will be summarized. (int)
  • height - Pixel height of summarized plane. If height is -1, the xz planes will be summarized. (int)
  • depth - Pixel depth of extracted plane. If depth is -1, the xy planes will be summarized (int)
  • keep_offsets - Keep the physical offsets in extracted field. (bool)

Since: 2.32

max_xy_plane(target)

source code 

Computes the maxima along z-axis of a data brick to a data field.

The result is an xy plane.

Parameters:
  • target - Datafield to be filled by the summary data. It will be resized if necessary. (DataField)

Since: 2.52

minpos_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)

source code 

Finds minima coordinates in profiles in certain direction.

One value of set (width, height, depth) needs to be -1, determining the plane orientation. In contrast to Brick.extract_plane, the appropriate start coordinate (e.g. istart if width = -1) is not used for single plane extraction, but the planes are accumulated in whole range (0..xres for given example)

Parameters:
  • target - Datafield to be filled by the minima positions plane. It will be resized if necessary. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of summarized plane. If width is -1, the yz planes will be summarized. (int)
  • height - Pixel height of summarized plane. If height is -1, the xz planes will be summarized. (int)
  • depth - Pixel depth of summarized plane. If depth is -1, the xy planes will be summarized (int)
  • keep_offsets - Keep the physical offsets in summarized field. (bool)

Since: 2.32

minpos_xy_plane(target)

source code 

Computes the location of minima along z-axis of a data brick to a data field.

The result is an xy plane.

Parameters:
  • target - Datafield to be filled by the summary data. It will be resized if necessary. (DataField)

Since: 2.52

maxpos_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)

source code 

Finds maxima coordinates of profiles in certain direction.

One value of set (width, height, depth) needs to be -1, determining the plane orientation. In contrast to Brick.extract_plane, the appropriate start coordinate (e.g. istart if width = -1) is not used for single plane extraction, but the planes are accumulated in whole range (0..xres for given example).

Parameters:
  • target - Datafield to be filled by the maxima positions plane. It will be resized if necessary. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of summarized plane. If width is -1, the yz planes will be summarized. (int)
  • height - Pixel height of summarized plane. If height is -1, the xz planes will be summarized (int)
  • depth - Pixel depth of summarized plane. If depth is -1, the xy planes will be summarized (int)
  • keep_offsets - Keep the physical offsets in summarized field. Not implemented. (bool)

Since: 2.32

maxpos_xy_plane(target)

source code 

Computes the location of maxima along z-axis of a data brick to a data field.

The result is an xy plane.

Parameters:
  • target - Datafield to be filled by the summary data. It will be resized if necessary. (DataField)

Since: 2.52

mean_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)

source code 

Finds mean of planes in certain direction.

One value of set (width, height, depth) needs to be -1, determining the plane orientation. In contrast to Brick.extract_plane, the appropriate start coordinate (e.g. istart if width = -1) is not used for single plane extraction, but the planes are accumulated in whole range (0..xres for given example).

Parameters:
  • target - Datafield to be filled by the mean plane. It will be resized if necessary. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of summarized plane. If width is -1, the yz planes will be summarized. (int)
  • height - Pixel height of summarized plane. If height is -1, the xz planes will be summarized. (int)
  • depth - Pixel depth of summarized plane. If depth is -1, the xy planes will be summarized. (int)
  • keep_offsets - Keep the physical offsets in summarized field. (bool)

Since: 2.32

mean_xy_plane(target)

source code 

Calculates mean values of all z-profiles of a data brick to a data field.

The result is an xy plane and can be alternatively imagined as the average of all xy planes.

Parameters:
  • target - Datafield to be filled by the summary data. It will be resized if necessary. (DataField)

Since: 2.52

rms_plane(target, istart, jstart, kstart, width, height, depth, keep_offsets)

source code 

Finds rms of planes in certain direction and extract the result (DataField). One value of set (width, height, depth) needs to be -1, determining the plane orientation. In contrast to Brick.extract_plane, the appropriate start coordinate (e.g. istart if width = -1) is not used for single plane extraction, but the planes are accumulated in whole range (0..xres for given example)

Parameters:
  • target - Datafield to be filled by the rms plane. It will be resized if necessary. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of summarized plane. If width is -1, the yz planes will be summarized. (int)
  • height - Pixel height of summarized plane. If height is -1, the xz planes will be summarized. (int)
  • depth - Pixel depth of summarized plane. If depth is -1, the xy planes will be summarized. (int)
  • keep_offsets - Keep the physical offsets in extracted field. (bool)

Since: 2.32

rms_xy_plane(target)

source code 

Calculates rms values of all z-profiles of a data brick to a data field.

The result is an xy plane and can be alternatively imagined as the variation among xy planes.

Parameters:
  • target - Datafield to be filled by the summary data. It will be resized if necessary. (DataField)

Since: 2.52

extract_line(target, istart, jstart, kstart, iend, jend, kend, keep_offsets)

source code 

Extracts a line (DataLine) from the brick.

Only line orientations parallel to coordinate axes are supported now, i.e. two of the start coordinates need to be same as end ones.

Parameters:
  • target - Dataline to be filled by extracted line. It will be resized if necessary. (DataLine)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • iend - Column where to end, exclusive (pixel coordinates). (int)
  • jend - Row where to end, exclusive (pixel coordinates). (int)
  • kend - Level where to end, exclusive (pixel coordinates). (int)
  • keep_offsets - Keep physical offsets in extracted line. (bool)

Since: 2.31

extract_z_line(target, i, j)

source code 

Extracts one full Z profile of a data brick to a data line.

Parameters:
  • target - Dataline to be filled by extracted line. It will be resized if necessary. (DataLine)
  • i - Column index. (int)
  • j - Row index. (int)

Since: 2.52

get_zcalibration()

source code 

Gets the z-axis non-linear calibration of a data brick.

Returns:
Z Calibration (non-linear Z-axis values as ordinates). (DataLine)

Since: 2.32

set_zcalibration(calibration)

source code 

Sets the z-axis non-linear calibration of a data brick.

Parameters:
  • calibration - DataLine pointer with z-axis non-linear calibration of a data brick (values are stored as ordinates). It can also be None to unset the calibration. (DataLine)

Since: 2.32

copy_zcalibration(target)

source code 

Copies non-linear z-axis calibration between two data bricks.

Both bricks must have the same Z resolution. For a meaningful usage, they should also have the same Z real sizes and units (uncalibrated).

If brick has no z-axis calibration, existing targets' calibration is deleted.

Parameters:
  • target - Target data brick. (Brick)

Since: 2.52

transpose(target, type, xflipped, yflipped, zflipped)

source code 

Transposes a data brick, exchanging and/or flipping axes.

Real dimensions and units are updated. Since real sizes cannot go backward, flipping an axis results in the corresponding offset being reset (the real dimension stays positive). If the Z axis is preserved its calibration is copied to the target; otherwise the target will have no Z axis calibration.

Parameters:
  • target - Destination data brick. It will be resized as needed. (Brick)
  • type - Basic transposition type (which axes are swapped). Expected values: BRICK_TRANSPOSE_XYZ, BRICK_TRANSPOSE_XZY, BRICK_TRANSPOSE_YXZ, BRICK_TRANSPOSE_YZX, BRICK_TRANSPOSE_ZXY, BRICK_TRANSPOSE_ZYX. (BrickTransposeType)
  • xflipped - True to reflect X, i.e. rows within XY planes. (bool)
  • yflipped - True to reflect Y, i.e. columns within XY planes. (bool)
  • zflipped - True to reflect Z, i.e. the XY plane order. (bool)

Since: 2.51

invert(xflipped, yflipped, zflipped, wflipped)

source code 

Reflects and/or inverts a data brick in place.

In the case of value reflection, it's inverted about the mean value.

Since real sizes cannot go backward, flipping an axis results in the corresponding offset being reset (the real dimension stays positive).

Note that the axis parameter convention is different from the confusing one of DataField.invert(). Here parameters simply correspond to directions that should be flipped.

Parameters:
  • xflipped - True to reflect X, i.e. rows within XY planes. (bool)
  • yflipped - True to reflect Y, i.e. columns within XY planes. (bool)
  • zflipped - True to reflect Z, i.e. the XY plane order. (bool)
  • wflipped - True to invert values. (bool)

Since: 2.59

set_plane(plane, istart, jstart, kstart, width, height, depth)

source code 

Fill a single plane in the brick by a two-dimensional data (DataField).

One value of set (width, height, depth) needs to be -1, determining the plane orientation.

Parameters:
  • plane - Datafield to be inserted into brick. It must have the appropriate size. (DataField)
  • istart - Column where to start (pixel coordinates). (int)
  • jstart - Row where to start (pixel coordinates). (int)
  • kstart - Level where to start (pixel coordinates). (int)
  • width - Pixel width of the inserted plane. If width is -1, the yz plane will be filled. (int)
  • height - Pixel height of insered plane. If height is -1, the xz plane will be filled. (int)
  • depth - Pixel depth of inserted plane. If depth is -1, the xy plane will be filled. (int)

Since: 2.51

set_xy_plane(plane, lev)

source code 

Sets one full single XY plane in a data brick from data field values.

Parameters:
  • plane - Datafield to be inserted into brick. It must have dimensions xres by yres. (DataField)
  • lev - Position in the brick (level index). (int)

Since: 2.52

add_to_xy_planes(plane)

source code 

Adds a data field to all brick XY planes.

Parameters:
  • plane - Datafield to be added to all brick XY planes. It must have dimensions xres by yres. (DataField)

Since: 2.55

add_to_z_lines(line)

source code 

Adds a data line to all brick Z lines.

Parameters:
  • line - Data line to add to each Z lines. It must have dimension zres. (DataLine)

Since: 2.55

get_data()

source code 

Extract the data of a data brick.

The returned list contains a copy of the data. Changing its contents does not change the data brick's data.

Returns:
List containing extracted data brick data. (list)

set_data(data)

source code 

Sets the entire contents of a data brick.

The length of data must be equal to the number of elements of the data brick.

Parameters:
  • data - Sequence of floating point values. (list)

duplicate()

source code 

Convenience macro doing gwy_serializable_duplicate() with all the necessary typecasting.

Returns:
(Brick)

Since: 2.31

get_data_pointer()

source code 

Gets pointer to data which the brick contains.

Returns:
integer pointing to the raw data of the brick (long)