Reads a binary mask image from disk and returns a logical vector
of length prod(img_dims) in column-major order, the format
the rest of the package expects. White / light pixels (above
threshold) become TRUE, dark pixels become FALSE. Use this
for image-based masks created with
webmorphR::mask_oval(),
painted in GIMP, drawn with PowerPoint shapes, or any other tool
that produces a binary PNG/JPEG.
Companion to make_face_mask() (parametric oval). Either
function returns the same logical-vector shape.
Arguments
- path
Path to a PNG or JPEG mask image.
- threshold
Numeric in
[0, 1]. Pixels with luminance above this becomeTRUE. Default0.5(mid-gray).- invert
If
TRUE, the mask is inverted (useful for black-on-white masks). DefaultFALSE.- expected_dims
Optional integer
c(nrow, ncol). When set, aborts if the loaded image's dimensions do not match. Useful for catching a wrong-resolution mask before it silently corrupts a downstream computation.
See also
make_face_mask() for the parametric oval / sub-region
constructor. Mask consumers: infoval(), pixel_t_test(),
agreement_map_test(), rel_cluster_test(), rel_icc(),
rel_split_half(), rel_loo(), rel_dissimilarity(),
run_reliability(), run_discriminability(),
run_discriminability_pairwise(), plot_agreement_map(),
plot_ci_overlay(). Plot helpers: plot_face_mask(),
plot_mask_overlay().