mask_with_boundary_surf: Apply Mask With Boundary To Mesh

View source: R/utils_surf.R

mask_with_boundary_surfR Documentation

Apply Mask With Boundary To Mesh

Description

Make a boundary around a mask with two levels of decimation, and apply to a mask.

Usage

mask_with_boundary_surf(
  vertices,
  faces,
  mask,
  width1 = 4,
  k1 = 2,
  width2 = 6,
  k2 = 3
)

Arguments

vertices

A V \times 3 matrix, where each row contains the Euclidean coordinates at which a given vertex in the mesh is located. V is the number of vertices in the mesh

faces

An F \times 3 matrix, where each row contains the vertex indices for a given triangular face in the mesh. F is the number of faces in the mesh.

mask

A length V logical vector indicating if each vertex is within the input mask.

width1, width2

the width of the middle/outer region. All vertices in the middle/outer region are between 1 and width1 edges away from the closest vertex in mask/middle region.

k1, k2

roughly, the triangle size multiplier. Every k1/k2 vertex within every k1/k2 layer (beginning with the innermost layer) will be retained; the rest will be discarded. If the mesh originally has triangles of regular size, the sides of the triangles in the middle/outer region will be about k1/k2 as long.

Details

The boundary consists of a width1-vertex-wide middle region and a width2-vertex-wide outer region, for a total of width1 + width2 layers of vertices surrounding the input mask. In the first layer, every k1 vertex within every k1 layer (beginning with the innermost layer) is retained; the rest are discarded. In the second layer, every k2 vertex within every k2 layer (beginning with the innermost layer) is retained; the rest are discarded. It is recommended to make width1 a multiple of k1 and width2 a multiple of k2.

Default boundary: a 4-vertex wide middle region with triangles twice as long, and a 6-vertex wide outer region with triangles three times as long.

Value

A new mesh (list with components vertices and faces)


mandymejia/ciftiTools documentation built on Feb. 28, 2024, 11:20 a.m.