Learn R Programming

fsbrain (version 0.8.0)

draw.segments.on.image: Draw contour segments onto a magick image.

Description

Draws a set of line segments (as returned by mesh.slice.intersection) onto a magick image. Individual mesh triangles produce small segments, which collectively trace the contour boundary when drawn together.

Usage

draw.segments.on.image(
  img,
  segments,
  slice_axis,
  row_axis,
  col_axis,
  color = "#FF0000",
  lwd = 1,
  coord_scale = 1L
)

Value

the modified magick image (invisibly).

Arguments

img

a magick image instance (a single 2D slice image).

segments

list of 2×2 matrices, each a line segment in 0-based CRS coordinates on the two orthogonal axes.

slice_axis

integer, the axis (1,2,3) perpendicular to the slice plane.

row_axis

integer, which CRS axis (1, 2, or 3) maps to the image row dimension.

col_axis

integer, which CRS axis (1, 2, or 3) maps to the image column dimension.

color

character string, the color for the contour lines.

lwd

numeric, line width passed to segments. Defaults to 1.

coord_scale

positive integer, the factor by which the CRS coordinates must be multiplied to map them to image pixel coordinates. Defaults to 1L, which maps coordinates 1:1 to pixels (as is the case when the image is at native resolution). Use larger values when drawing onto a scaled-up image or overlay.