fMRI-based prediction of eye gaze during naturalistic movie viewing reveals eye-movement-related brain activity.
The 2 matches
- [1] § Materials and methods › Gaze prediction from pretrained DeepMReye ↔ 02_prediction_extraction.R, lines 1–34 · score 0.73 · zero shot, fine tuning, DeepMReye, 1to6, official, pretrained
- [2] § Materials and methods › Eye-tracking preprocessing ↔ 01_tracking_preprocessing.R, lines 43–152 · score 0.51 · volume triggers, fMRI, preprocessed, tracking, gaze
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 216 lines · 5.4 KB · no license · 1 match
- ## ============================================================
- ## Format DeepMReye zero-shot prediction outputs
- ## Zero-shot gaze prediction was performed using the official
- ## DeepMReye implementation with the pretrained
- ## datasets_1to6.h5 model, without fine-tuning.
- ## https://github.com/DeepMReye/DeepMReye/blob/main/notebooks/deepmreye_example_usage_pretrained_weights.ipynb
- ## ============================================================
- library(reticulate)
- library(stringr)
- library(dplyr)
- library(reshape2)
- np <- import("numpy")
- clinical_path <- "data/clinical/Clinical_all.csv"
- prediction_dir <- "data/prediction"
- output_dir <- file.path("processed_data", "hbn")
- dir.create(output_dir, recursive = TRUE, showWarnings = FALSE)
- TR <- 0.8
- subTR_per_TR <- 10
- dataset_name <- "HBN"
- clinical_df <- read.csv(clinical_path)
- clinical_hbn <- clinical_df %>%
- filter(Dataset == dataset_name)
- hbn_ids <- as.character(clinical_hbn$EID)
- message("Number of HBN subjects in clinical table: ", length(hbn_ids))
- extract_subject_id <- function(run_name, task_lower) {
- prefix <- paste0("./processed_data_", task_lower, "/")
- subject_id <- run_name %>%
- str_remove_all(fixed(prefix)) %>%
- str_remove("\\.npz$")
- return(subject_id)
- }
- format_prediction_one_run <- function(data_df, subject_id, task_lower) {
- pred_x <- data_df$pred_y[, , 1]
- pred_y <- data_df$pred_y[, , 2]
- euc <- data_df$euc_pred
- if (!all(dim(pred_x) == dim(pred_y)) || !all(dim(pred_x) == dim(euc))) {
- stop("Dimension mismatch in prediction arrays for subject: ", subject_id)
- }
- n_tr <- nrow(pred_x)
- n_subtr <- ncol(pred_x)
- if (n_subtr != subTR_per_TR) {
- warning(
- "Unexpected number of subTR samples for subject ",
- subject_id,
- ": expected ", subTR_per_TR,
- ", got ", n_subtr
- )
- }
- ## -----------------------------
- ## subTR-level output
- ## -----------------------------
- df_x <- reshape2::melt(pred_x)
- df_y <- reshape2::melt(pred_y)
- df_euc <- reshape2::melt(euc)
- colnames(df_x) <- c("TR_index", "subTR_index", "x")
- colnames(df_y) <- c("TR_index", "subTR_index", "y")
- colnames(df_euc) <- c("TR_index", "subTR_index", "euc")
- df_sub <- df_x %>%
- left_join(df_y, by = c("TR_index", "subTR_index")) %>%
- left_join(df_euc, by = c("TR_index", "subTR_index")) %>%
- mutate(
- subject = subject_id,
- task = task_lower,
- time = ((TR_index - 1) + (subTR_index - 1) / subTR_per_TR) * TR
- ) %>%
- arrange(time) %>%
- select(subject, task, TR_index, subTR_index, time, x, y, euc)
- ## -----------------------------
- ## TR-averaged output
- ## -----------------------------
- df_mean <- data.frame(
- subject = subject_id,
- task = task_lower,
- TR_index = seq_len(n_tr),
- time = seq_len(n_tr) * TR,
- x = rowMeans(pred_x, na.rm = TRUE),
- y = rowMeans(pred_y, na.rm = TRUE),
- euc = rowMeans(euc, na.rm = TRUE)
- )
- ## -----------------------------
- ## Write files
- ## -----------------------------
- subtr_file <- file.path(
- output_dir,
- paste0(subject_id, "_", task_lower, "_subTR.csv")
- )
- mean_file <- file.path(
- output_dir,
- paste0(subject_id, "_", task_lower, "_mean.csv")
- )
- write.csv(df_sub, subtr_file, row.names = FALSE, quote = FALSE)
- write.csv(df_mean, mean_file, row.names = FALSE, quote = FALSE)
- return(
- data.frame(
- subject = subject_id,
- task = task_lower,
- n_TR = n_tr,
- n_subTR_per_TR = n_subtr,
- subTR_file = subtr_file,
- mean_file = mean_file
- )
- )
- }
- process_prediction_files <- function(task_upper, task_lower) {
- prediction_files <- dir(
- path = prediction_dir,
- pattern = paste0(".*", task_upper, ".*\\.npz$"),
- full.names = TRUE
- )
- if (length(prediction_files) == 0) {
- warning("No prediction files found for task: ", task_upper)
- return(data.frame())
- }
- message("Processing task: ", task_upper)
- message("Number of prediction files: ", length(prediction_files))
- summary_all <- data.frame()
- for (file_i in prediction_files) {
- message("Reading: ", file_i)
- data_npz <- np$load(file = file_i, allow_pickle = TRUE)
- prediction_dict <- data_npz[[1]]
- runs <- names(prediction_dict)
- subject_ids <- sapply(runs, extract_subject_id, task_lower = task_lower)
- keep_idx <- subject_ids %in% hbn_ids
- runs_keep <- runs[keep_idx]
- subject_ids_keep <- subject_ids[keep_idx]
- message("Matched HBN runs in this file: ", length(runs_keep))
- for (j in seq_along(runs_keep)) {
- run_name <- runs_keep[j]
- subject_id <- subject_ids_keep[j]
- data_df <- prediction_dict[[which(names(prediction_dict) == run_name)]]
- run_summary <- format_prediction_one_run(
- data_df = data_df,
- subject_id = subject_id,
- task_lower = task_lower
- )
- summary_all <- bind_rows(summary_all, run_summary)
- }
- }
- return(summary_all)
- }
- ## ============================================================
- ## Run DM and TP
- ## ============================================================
- summary_dm <- process_prediction_files(
- task_upper = "DM",
- task_lower = "dm"
- )
- summary_tp <- process_prediction_files(
- task_upper = "TP",
- task_lower = "tp"
- )
- summary_all <- bind_rows(summary_dm, summary_tp)
- summary_file <- file.path(output_dir, "HBN_prediction_formatting_summary.csv")
- write.csv(
- summary_all,
- summary_file,
- row.names = FALSE
- )
02_prediction_extraction.R, no license · at the source
Overview
- Department of Computer Science, New Jersey Institute of Technology, University Heights, Newark, NJ 07102, United States
- Department of Biomedical Engineering, New Jersey Institute of Technology, University Heights, Newark, NJ 07102, United States
Abstract
Background: Eye gaze provides crucial insights into perceptual and cognitive processes during naturalistic movie viewing, yet concurrent eye tracking is often unavailable in functional MRI (fMRI) research. While deep learning models can estimate gaze directly from fMRI eyeball signals, their out-of-the-box generalizability across heterogeneous datasets requires empirical evaluation.
Methods: We applied a specific pre-trained model from the DeepMReye framework in a zero-shot setting (without dataset-specific fine-tuning) to estimate gaze during movie watching across three independent fMRI datasets. Model accuracy was evaluated against camera-based eye-tracking data and via inter-subject correlations. Furthermore, we derived eye-movement-related time series from the predicted gaze signals to map their associated brain activation.
Results: At the individual level, predicted gaze showed modest correspondence with measured ground-truth data (r ≈ 0.24–0.37), yielding brain activation maps largely restricted to the visual cortex. In contrast, group-averaged gaze predictions exhibited substantially higher reliability (r ≈ 0.73–0.84). First-level general linear models (GLMs) derived from group-averaged predictions successfully revealed widespread activation across established oculomotor control regions, including the frontal and parietal eye fields. Exploratory analyses of age-related effects on gaze prediction and brain activity yielded inconsistent results across datasets.
Conclusions: Under a zero-shot implementation, the pre-trained model exhibits limitations for individual-level inference, likely reflecting the absence of dataset-specific training. However, group-averaged fMRI-based gaze estimates successfully capture shared viewing behaviors and robustly support the investigation of eye-movement-related brain activity. These findings inform the appropriate use of fMRI-based gaze decoding for naturalistic neuroimaging datasets lacking ground-truth eye-tracking logs.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 2 matches between paragraphs and lines of code.
OSF chgpx
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
7 files
- 01_tracking_preprocessin
g.R , R, 278 lines, 1 match - 02_prediction_extraction
.R , R, 216 lines, 1 match - 03_validation_correlatio
n.R , R, 406 lines - 04_first_level_GLM.m, MATLAB, 93 lines
- 05_model_estimation.m, MATLAB, 19 lines
- 06_group_age_effect.m, MATLAB, 58 lines
- 07_ROI_beta_regression.m
, MATLAB, 200 lines
The paper's code and data availability statement is in the Data section.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 7 scripts, each with its path and the digest of its content;
- 2 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- openneuro:ds000228, at OpenNeuro; found in “Data and code availability”
Data and code availability
MRI and eye-tracking data were obtained from publicly available sources: the NV dataset (https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, pages, dates, 4 authors, 5 keywords, 2 funders, 29 references.
Cite
This paper
Gao, L., Wei, Z., Biswal, B. B., & Di, X. (2026). fMRI-based prediction of eye gaze during naturalistic movie viewing reveals eye-movement-related brain activity. Psychoradiology, 6, kkag026. https://
BibTeX
@article{gao2026fmri,
author = {Gao, Le and Wei, Zhi and Biswal, Bharat B and Di, Xin},
title = {{fMRI-based prediction of eye gaze during naturalistic movie viewing reveals eye-movement-related brain activity}},
journal = {Psychoradiology},
year = {2026},
month = jun,
volume = {6},
pages = {kkag026},
publisher = {Oxford University Press},
issn = {2634-4416},
doi = {10.1093/
url = {https://
pmid = {42534530},
pmcid = {PMC13421079}
}
RIS
TY - JOUR
AU - Gao, Le
AU - Wei, Zhi
AU - Biswal, Bharat B
AU - Di, Xin
TI - fMRI-based prediction of eye gaze during naturalistic movie viewing reveals eye-movement-related brain activity
T2 - Psychoradiology
J2 - Psychoradiology
PY - 2026
DA - 2026/
VL - 6
SP - kkag026
SN - 2634-4416
PB - Oxford University Press
DO - 10.1093/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1093/
"type": "article-journal",
"title": "fMRI-based prediction of eye gaze during naturalistic movie viewing reveals eye-movement-related brain activity",
"container-title": "Psychoradiology",
"author": [
{
"family": "Gao",
"given": "Le"
},
{
"family": "Wei",
"given": "Zhi"
},
{
"family": "Biswal",
"given": "Bharat B"
},
{
"family": "Di",
"given": "Xin"
}
],
"container-title-short":
"volume": "6",
"page": "kkag026",
"DOI": "10.1093/
"PMID": "42534530",
"PMCID": "PMC13421079",
"ISSN": "2634-4416",
"publisher": "Oxford University Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
26
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1162/imag.a.1331 [code]
- Beyond the canonical HRF: Flexible temporal modeling reveals unconstrained BOLD profiles during naturalistic viewing.Journal: Imaging neuroscience (Cambridge, Mass.)In common: OpenNeuro ds000228, fMRI, 4 references, author Xin Di
- [2] doi:10.1162/imag.a.1347 [code]
- Neural and behavioural correlates of theory of mind reasoning in five-year-old children born preterm.Journal: Imaging neuroscience (Cambridge, Mass.)In common: reshape2, patchwork, ggplot2, 1 other tool, OpenNeuro ds000228, fMRI, 3 references
- [3] doi:10.1002/hbm.70605 [code]
- BrainEnrich: Revealing Biological Insights for Imaging-Derived Phenotypes Through Transcriptomic Enrichment.Journal: Human brain mappingIn common: reticulate, SPM, cowplot, 5 other tools
- [4] doi:10.1038/s41467-026-74331-2 [code]
- Trial-by-trial fMRI-neurofeedback dissociates fusiform and occipital contributions to face detection and recognition.Journal: Nature communicationsIn common: SPM, cowplot, Image Processing Toolbox, 4 other tools, fMRI
- [5] doi:10.1016/j.dcn.2026.101765 [code]
- Fusiform face area development correlates with development in higher-order social brain regions.Journal: Developmental cognitive neuroscienceIn common: reshape2, patchwork, tidyverse, OpenNeuro ds000228, fMRI
- [6] doi:10.1038/s42003-026-10957-8 [code]
- Brain defence by the extracellular matrix protein Cochlin.Journal: Communications biologyIn common: reticulate, SPM, reshape2, 4 other tools
- [7] doi:10.1038/s41467-026-74565-0 [code]
- The functional neurobiology of dispositions towards negative emotions.Journal: Nature communicationsIn common: SPM, cowplot, reshape2, 4 other tools
- [8] doi:10.1038/s41586-026-10490-y [code]
- Lineage and organ signals sequentially build organ intrinsic nervous systems.Journal: NatureIn common: cowplot, reshape2, Image Processing Toolbox, 4 other tools
- [9] doi:10.1162/imag.a.1330 [code]
- Human risk taking and metabolic state: No credible evidence for desacyl-ghrelin modulation of neural or behavioural effects.Journal: Imaging neuroscience (Cambridge, Mass.)In common: SPM, cowplot, reshape2, 3 other tools, fMRI
- [10] doi:10.1038/s41467-026-76939-w [code]
- HIPPIE: a generative model for electrophysiological analysis across species, technologies, and modalities.Journal: Nature communicationsIn common: reticulate, cowplot, reshape2, 3 other tools
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 7 scripts, and 2 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:8975935404c2862b…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[.
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
