Utilities
Edge detection
The function extract_edges
complements imfilter
from Images.jl
and can be used to extract edges from an image on CPU and GPU.
CorrelationFunctions.Utilities.extract_edges
— Functionextract_edges(array, filter, mode)
Perform edge extraction in the same way as in surfsurf
and surfvoid
functions from Map
and Directional
modules. array
may be a CUDA array or an ordinary array. filter
is a value of AbstractKernel
type which selects an edge extraction algorithm. Boundary conditions are affected by mode
. Periodic boundary conditions are assumed if mode
is Periodic()
and reflection from the boundaries is used if mode
is NonPeriodic()
.
NB: We use reflection instead of zero-padding with NonPeriodic()
to ensure that $F_{ss}^{(0)} == F_{ss}^{(1)}$ for two-phase media.
See also: AbstractKernel
, AbstractMode
.
CorrelationFunctions.Utilities.AbstractKernel
— TypeCorrelationFunctions.Utilities.ConvKernel
— TypeConvKernel(n)
Convolution kernel of width n
used in edge detection. Values 5
and 7
are possible values for n
. Using n = 7
works best for the most cases (lowfreq_energy_ratio(array) > 0.97
).
See also: AbstractKernel
, extract_edges
.
CorrelationFunctions.Utilities.ErosionKernel
— TypeErosionKernel(n)
Erosion kernel of width n
used in edge detection. Used in three-point surface correlation functions.
See also: AbstractKernel
, extract_edges
.
Patterns for three-point functions
These patterns can be used to generate array-like objects which can be used as ps1
and ps2
arguments to the functions based on three-point statistics.
CorrelationFunctions.Utilities.right_triangles
— Functionright_triangles(array, plane)
Make a set of points for calculation of correlation functions based on three-point statistics. The created set is based of a right triangle with varying lengths of catheti. The second argument defines alignment of the pattern with one of the planes.
See also: AbstractPlane
, PlaneXY
, PlaneXZ
, PlaneYZ
.
CorrelationFunctions.Utilities.PlaneXY
— TypePlaneXY()
A designator for a plane defined by vectors [1, 0]
and [0, 1]
(2D case) or [1, 0, 0]
and [0, 1, 0]
(3D case).
See also: AbstractPlane
.
CorrelationFunctions.Utilities.PlaneYZ
— TypePlaneYZ()
A designator for a plane defined by vectors [0, 1, 0]
and [0, 0, 1]
.
See also: AbstractPlane
.
CorrelationFunctions.Utilities.PlaneXZ
— TypePlaneXZ()
A designator for a plane defined by vectors [1, 0, 0]
and [0, 0, 1]
.
See also: AbstractPlane
.
CorrelationFunctions.Utilities.AbstractPlane
— TypeAbstractPlane
Subtypes of AbstractPlane
serve as a plane designators for three-point correlation functions.
Misc
Some miscellaneous functions and helpers.
CorrelationFunctions.Utilities.read_cuboid
— Functionread_cuboid(datapath :: String, side, dim)
Read 3D array from a disk. The data on the disk must be in binary format, one octet per sample. Totally, there must be $side^{dim}$ octets which are read into $side \times side \times \dots \times side$ array.
CorrelationFunctions.Utilities.lowfreq_energy_ratio
— Functionlowfreq_energy_ratio(array, fraction = 0.5)
Calculate a ratio $E_a/E$ where $E$ is a total energy of a signal array
and $E_a$ is the energy concentrated in frequencies $[0, af/2]$ where $f$ is the sampling rate and $a$ is set via parameter fraction
. mean(array)
is subtracted from the array before calculations.
This function can be helpful in estimating if array
is suitable for calculating surface-surface or surface-void function. An empirical criterion is that if this function returns a value greater than 0.97
, the array is good.