View source: R/mris-curvature.R
| mris_curvature | R Documentation |
Estimates, at every vertex of a closed triangular mesh, the local mean curvature, Gaussian curvature, and the two principal curvatures, by fitting an osculating quadratic surface to each vertex's neighborhood.
mris_curvature(mesh, verbose = FALSE)
mesh |
triangular mesh of class |
verbose |
logical; print progress messages. Default |
For each vertex, the function:
builds an orthonormal tangent frame (e_1, e_2, n), where
n is the vertex's (already-computed) unit normal;
expresses each neighbor's offset from the vertex in this frame as
tangential coordinates (u, w) and a height h above the
tangent plane along n;
fits, by least squares over the vertex's 2-ring neighborhood, the
osculating paraboloid h = a u^2 + b u w + c w^2;
derives the mean curvature H = a + c, the Gaussian curvature
K = 4ac - b^2, and the principal curvatures
k_{1,2} = H \pm \sqrt{\max(H^2 - K,\ 0)}.
Because the tangent frame is orthonormal and the paraboloid is fitted with
zero gradient at the vertex (by construction, since n is the fitted
normal direction), these are exactly the eigenvalues of the second
fundamental form, i.e. the principal curvatures.
The sign of the result follows the orientation of the per-vertex outward
normal: a locally convex ('gyrus-like') patch, where neighbors lie
toward the surface's interior relative to the outward normal, has negative
mean curvature, while a locally concave ('sulcus-like') patch has
positive mean curvature. For example, a sphere of radius r with outward-pointing
normals has uniform curvature H = -1/r and K = 1/r^2 everywhere.
Vertices whose 2-ring neighborhood is degenerate (fewer than three
neighbors, or neighbor offsets that do not span the tangent plane, e.g.
nearly collinear) are reported with all four curvature values set to zero.
A named list of four numeric vectors, each of length
ncol(mesh$vb) (one entry per vertex, in vertex order):
meanMean curvature H = (k_1 + k_2)/2.
gaussianGaussian curvature K = k_1 k_2.
k1First principal curvature (k_1 \geq k_2).
k2Second principal curvature.
Cortical surface-based analysis II: Inflation, flattening, and a surface-based coordinate system. NeuroImage, 9(2), 195-207 (1999).
if (is_not_cran()) {
data("left_hippocampus_mask")
mesh <- vcg_isosurface(left_hippocampus_mask)
plot(mesh)
# Fix defects
mesh <- vcg_fix_defects(mesh, verbose = TRUE)
# Smooth
smoothed <- mris_smooth(mesh, verbose = TRUE)
res <- mris_curvature(smoothed)
range(res$k1)
col <- color_ramp_continuous(
res$k1, clim = c(-1, 1), alpha = TRUE,
cmap = c("black", "gray", "red"))
plot(smoothed, col = list(col),
eye = c(-100, 100, 0), up = c(0, 0, 1))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.