Bilateral / anisotropic filtering of gradient field
Source:R/RcppExports.R
smooth_field_edges_cpp.RdGradient fields are smoothed using bilateral filtering, in which the smoothed gradient of each edge is computed as the weighted average of the neighboring edges' gradients, considering both distance in space and also similarity in gradients.
Usage
smooth_field_edges_cpp(
from_pt,
to_pt,
field,
edges_svd,
coords,
adj_idx,
distance,
similarity
)Arguments
- from_pt, to_pt
A pair of
E-length vectors indicating the start and end points of each edge (0-indexed).- field
A
2xDxEarray in column-major ordering containing the spatial gradient in expression for each ofDlatent variables at every edge.- edges_svd
A list with elements
u(2x2xE),s(2xE), andv(Dx2xE) containing the left singular vectors, singular values, and right singular vectors for each edge.- coords
A
Nx2matrix of cell coordinates.- adj_idx
A
NxNsparse adjacency matrix in dgCMatrix format, containing the mapping from cells to edges. In particular,adj_idx@xshould store the 1-indexed edge indices corresponding to each cell-cell pair. The adjacency matrix is assumed to be symmetric and have zeros on the diagonal. Importantly, note that the stored edge indices are 1-indexed (not 0-indexed here) in order to avoid problems with R's sparse matrix representation.- distance
Method for computing distance score in weighted average. See description for details. Defaults to
'euclidean'.- similarity
Method for computing similarity score in weighted average. See description for details. Defaults to
'euclidean'.