This repository contains MATLAB scripts and data files supporting the following publication:
How much is “enough”? Considerations for functional connectivity reliability in pediatric naturalistic fMRI Author: Shefali Rai; doi: https://doi.org/10.1162/IMAG.a.117
Our work examined how much fMRI data is needed to obtain reliable functional connectivity (FC) estimates in children and adults using naturalistic precision fMRI. Scripts in this repository cover the full analysis pipeline: preprocessing, parcellation, network assignment, test-retest reliability estimation, and visualization.
PreciseKids/
├── scripts/ # MATLAB analysis scripts (.m files)
├── data/ # Video database used for naturalistic stimuli
└── ReadMe_NetworksPK.md
- MATLAB R2021b or later
- The following must be downloaded and added to your MATLAB path:
cifti-matlab(for reading/writing CIFTI files)gifti-1.6(for GIFTI surface files)- Brain Connectivity Toolbox (BCT) — specifically
threshold_proportional.m infomap(for network community detection)- Connectome Workbench (
wb_view,wb_command) for visualization
Functional and structural preprocessing is handled by custom Python scripts (not included here). Functional data is censored based on a framewise displacement (FD) threshold of 0.15 mm.
Meancenter_Parcellate_dtseries.m— parcellates dense timeseries into ROI timeseriesTimeseries_143DWROIs_Child.m/Timeseries_143DWROIs_Parent.m— extracts timeseries for 143 ROIs for children and parents respectivelyOpenandcensor_dtseries.m— opens and censors timeseries data
Corr_Parcelled_pconn.m— computes FC matrices from parcellated timeseriesAveragedFC_143ROIs_EachNetwork.m— averages FC across ROIs within each networkFC_Connectomes_142DWROIs_MachineLearningMatrices.m— prepares FC matrices for machine learningFisherTransform.m— applies Fisher r-to-z transformation
Create_Consensus_Networks.m— builds consensus network assignments across participantsCreatenetwork_connectomes.m— creates network-level connectomesNetworkConsensus_IndividualParticipant_TemplateMatchingMaps.m— assigns individual participants to consensus networks via template matchingMSCtemplates_GroupAvgSystemsMaps.m/MSCtemplates_GroupAvgSystemsMaps_Vertexwise.m— uses MSC templates for group-average network maps
TestretestReliability_FullCurves.m— computes reliability curves across data amountsGEDev_FCTRCReliability.m/GEDev_FCTRCReliability_2runs.m— reliability for GE scanner dataGE_multiecho_reliability.m/GE_singleecho_reliability.m— multi-echo vs single-echo reliability comparisonICC_FCTRC_Plots.m— ICC and FC-TRC reliability plotsTestretest_ICC_Reliability_SurfaceMaps.m— surface-level ICC maps
MeanFD_ChildandParent.m— computes mean FD for children and parentsLowHighMotion_LinearModel.m— linear model comparing low and high motion groupsLowHighMotion_UncensoredVolumesCalculation.m— calculates usable volumes after censoringPKtotaldata_aftercensoring.m— summarizes total data retained after censoring
If you encounter an error like Invalid MEX-file ... xml_findstr.mexmaci64, rebuild the MEX file from terminal:
cd /path/to/gifti/@xmltree/private
/Applications/MATLAB_R2021b.app/bin/mex -compatibleArrayDims xml_findstr.cThen verify with:
otool -L xml_findstr.mexmaci64If you use these scripts, please cite:
Shefali Rai, Kate J. Godfrey, Kirk Graff, Ryann Tansey, Daria Merrikh, Shelly Yin, Matthew Feigelis, Damion V. Demeter, Tamara Vanderwal, Deanna J. Greene, Signe Bray; How much is “enough”? Considerations for functional connectivity reliability in pediatric naturalistic fMRI. Imaging Neuroscience 2025; 3 IMAG.a.117. doi: https://doi.org/10.1162/IMAG.a.117