Skip to contents

The pixel values returned by read_cis() contain the shared base image plus a (typically scaled) noise contribution. Reliability computations must operate on the noise alone, otherwise the shared base inflates inter-participant correlations. This function reads the base image, converts to grayscale if needed, validates dimensions, and returns cis - base column-wise.

Usage

extract_signal(cis, base_image_path, acknowledge_scaling = FALSE)

Arguments

cis

A numeric matrix from read_cis() (pixels x participants).

base_image_path

Path to the base face image. PNG or JPEG.

acknowledge_scaling

Set to TRUE to silence the once-per-session warning. See read_cis().

Value

A numeric matrix the same shape as cis, base-subtracted.

Reading the result

Numeric matrix the same shape as cis. Column names propagate. The img_dims attribute is preserved (or filled in from the base image if missing). Tagged with attr(., "source") = "rendered" because the input came from PNGs.

Common mistakes

  • Passing a base image with different dimensions; aborts with a clear pixel-count mismatch.

  • Treating the result as the raw mask. The output is scaling(mask) if the input PNGs were rendered with any scaling. See Raw vs. rendered CIs below.

Raw vs. rendered CIs

PNG pixel values are necessarily what was rendered to disk: base + scaling(mask). Subtracting the base in extract_signal() therefore yields scaling(mask), not the raw mask. Variance-based reliability metrics (rel_icc(), Euclidean half of rel_dissimilarity(), pixel_t_test(), rel_cluster_test()) are sensitive to the scaling transform; only correlation-based metrics (rel_split_half(), rel_loo()) survive a single uniform linear scaling unmodified, and even those break under per-CI "matched"-style scaling. The standard 2IFC infoVal path (rcicr::computeInfoVal2IFC()) extracts the raw $ci internally from the rcicr CI-list and is not affected; hand-rolled infoVal implementations (Brief-RC, custom code) are, and should be fed the raw mask. Prefer ci_from_responses_2ifc() / ci_from_responses_briefrc() when raw responses are available; both return the raw mask.

Examples

if (FALSE) { # \dontrun{
cis    <- read_cis("data/cis_condition_A/")
signal <- extract_signal(cis, base_image_path = "data/base.jpg")
rel_split_half(signal, n_permutations = 200L, seed = 1)
} # }