Infant iBEAT processing¶
The infant workflow processes MRI from participants aged 0–24 months using completed iBEAT reconstructions. Inputs comprise raw images and the corresponding iBEAT volumes and VTK surfaces. The workflow imports these reconstruction products; iBEAT must be run separately.
The default DiscardVolumes=0 retains all acquired BOLD volumes. Both supplied BCP example batches use this setting. Earlier 410-frame comparisons used an explicitly selected ten-volume discard and do not define the current default.
Input requirements¶
Put the raw scans and their matching reconstruction under one Input directory. Paths in the tab-separated batch TXT are relative to this directory. Use one row per functional run, with consistent anatomy and reconstruction paths across the same session.
Input/
sub-761141_01/
ses-baseline/
anat/
T1w.nii.gz
T2w.nii.gz
ibeat/
reference.nii.gz
tissue.nii.gz
brainmask.nii.gz
surf/
*lh.InnerSurf.PhysicalSpace.vtk
*lh.OuterSurf.PhysicalSpace.vtk
*lh.MiddleSurf.PhysicalSpace.vtk
*rh.InnerSurf.PhysicalSpace.vtk
*rh.OuterSurf.PhysicalSpace.vtk
*rh.MiddleSurf.PhysicalSpace.vtk
func/
task-rest_run-AP_bold.nii.gz
task-rest_run-AP_bold.json
task-rest_run-AP_sbref.nii.gz # Optional
task-rest_run-AP_sbref.json # Optional
fmap/ # Optional
dir-AP_epi.nii.gz
dir-AP_epi.json
dir-PA_epi.nii.gz
dir-PA_epi.json
Raw scan filenames may differ: the batch selects the actual files. Inside IbeatDir, the volume names must be reference.nii.gz, tissue.nii.gz and brainmask.nii.gz; links to the matching source files are supported. At least one raw T1w or T2w image is required. The iBEAT reference, tissue segmentation and brain mask must be the actual physical-space volumes associated with the VTK surfaces, with matching grids and affines. A raw image renamed as the reference does not establish this correspondence. Tissue labels are 0=background, 1=CSF, 2=GM, 3=WM.
Provide exactly one unambiguous bilateral set of Inner, Outer and Middle surfaces. The importer accepts legacy ASCII triangular VTK POLYDATA in physical millimetres, with consistent topology and vertex order across each hemisphere's surfaces. Inner surfaces must contain finite named thickness PointData. One-component SCALARS and optional three-component NORMALS are supported; normals are validated but not used as phenotype values. Duplicate scalar names, incomplete blocks, binary VTK, unsupported sections, conflicting reconstructions, invalid topology and mismatched volume geometry fail validation. Duplicate packed RGB annotation IDs also fail rather than merging parcels.
import-qc.json separates repaired-mesh topology (euler, required to equal 2)
from original_hole_qc. The latter is available only with explicit orig.nofix
records in reconstruction logs. Its legacy covariate is 2 - left_holes - right_holes;
absent or conflicting logs yield null, never a replacement based on repaired-mesh Euler.
Anatomical phenotype failures are recorded per atlas in anat/infant-phenotypes.json.
An atlas with a missing native parcel is omitted; valid atlases continue. If regional
morphology is valid but MIND cannot be estimated, morphology remains available and
MIND is marked failed. No missing values are fabricated. Previous products are
preserved under the native session's history/ folder before recomputation, and
only current successful outputs appear in the manifest. Partial success propagates
as completed_with_warnings to the run summary and is disclosed in QC; failure of
every atlas fails the anatomical run.
Resting-state BOLD must be a readable 4D image with at least 80 retained volumes after initial discard, before motion-related exclusions. For example, 84 acquired volumes with 5 discarded leaves 79 and fails preflight. Other supported BOLD tasks retain their separate minimum of 31 volumes. Required acquisition metadata come from applicable BIDS JSON sidecars first, then batch fields when absent from JSON. Invalid JSON does not silently fall back to a batch override. If neither source supplies required information, validation reports the fields that the user must complete in the batch TXT. The NIfTI TR is checked for consistency; it is not a silent replacement for missing acquisition metadata.
| Batch field | Requirement |
|---|---|
| Participant, Session | Subject and session identifiers; prefixes are optional |
| AgeMonths, AgeSource, Sex | Age at scan and its source; Sex is required: 0=Female, 1=Male |
| T1w, T2w, IbeatDir | Raw anatomy and matching iBEAT reconstruction directory |
| Task, Run, Bold | Explicit identification and path of each BOLD run |
| RepetitionTime | Seconds; sub-761141_01 uses 0.72, sub-11228_09 uses 0.8 |
| AcquisitionType / MultibandAccelerationFactor | Confirmed singleband or multiband; do not infer from TR |
| SliceTiming, SliceEncodingDirection | Required timing/axis information for singleband slice correction |
| SliceOrder | One-based JSON array alternative when actual SliceTiming is unavailable; assumes uniform timing |
| DiscardVolumes | Defaults to 0; the final BCP examples retain all 420 volumes |
| SBRef | Optional raw singleband reference explicitly paired to this run |
| FmapType, Fmap1, Fmap2 | Optional paired fieldmaps: topup reverse-PE EPIs, or phasediff magnitude and phase difference |
| PhaseEncodingDirection, TotalReadoutTime | Required for TOPUP; NIfTI axis/sign and seconds, or validated echo-spacing conversion |
| Fmap1_ / Fmap2_ / SBRef_ metadata | Acquisition-specific metadata when absent from each image's JSON |
| VolumeRecipe | Default hcp; sequential is available for explicit comparisons and the GRE route |
| EPIRegistration | Default rigid (6DOF); bbr is an optional candidate requiring infant-specific visual review |
Optional branches¶
- No SBRef binding: skip the acquired-SBRef branch and use the first retained BOLD volume as the motion scout.
- No Fmap1 and no Fmap2 binding: skip susceptibility distortion correction.
FmapStatusis optional descriptive information, not a requirement for this case. - A configured SBRef can be used without fieldmaps; fieldmaps can be used without an acquired SBRef.
- Files are not automatically paired merely because they are present somewhere in Input. Bind them explicitly in the batch.
- A configured missing file, a half-configured fieldmap pair or invalid acquisition metadata is an error. This prevents a mistyped path from silently disabling an intended correction.
- TOPUP requires a valid reverse-PE pair and matching readout parameters across the HCP BOLD/scout/fieldmap branch. GRE requires validated phase scaling, echo times, dwell time and unwarp direction, and uses the sequential adapter.
- Singleband BOLD receives slice timing correction before motion estimation in the default HCP recipe. The sequential recipe applies motion and susceptibility correction before slice timing correction. Multiband BOLD skips slice timing correction. An acquired SBRef does not make the BOLD acquisition singleband. Singleband outputs from these recipes should not be assumed interchangeable.
Processing order¶
| Stage | Processing and output |
|---|---|
| Import | Validate raw data, metadata, iBEAT volume geometry, surface topology and resource availability |
| Native structure | Convert VTK to native FreeSurfer/GIFTI geometry; retain iBEAT thickness; compute native curvature, sulcal depth and surface measures |
| Surface registration | FreeSurfer smooth/inflate/sphere and mris_register to the age-selected UNC folding template; compose the BCP12 bridge and common-space sphere mappings |
| Parcellations and structure phenotypes | Transfer the supplied atlases, resample metrics/masks to fsLR32k and fsaverage4, calculate regional morphology and MIND |
| BOLD preparation | Retain all frames by default; apply singleband-only slice timing correction |
| Motion and optional distortion correction | MCFLIRT directly to the acquired SBRef or first BOLD scout; run installed HCP TOPUP when a valid pair is configured |
| Anatomical alignment | Register the corrected scout to the matched iBEAT anatomy with 6DOF FLIRT; inspect tissue and cortical boundary alignment |
| Final volume sampling | Compose motion, susceptibility and anatomical transforms for one BOLD spatial resampling in the HCP branch; apply Jacobian modulation when applicable; intersect brain and acquisition coverage masks |
| Surface mapping | Compute tissue signals, local CoV and good-voxel masks; ribbon-constrained mapping, 10 mm surface dilation and cortex masking; resample to fsLR32k |
| Functional cleanup | Regress Friston24 motion, intercept, linear trend, WM and CSF, plus GS when configured; band-pass 0.01–0.08 Hz; identify FD >0.5 mm with one preceding and two following frames and interpolate flagged samples |
| Functional phenotypes | Compute ROI correlations from cleaned, unsmoothed fsLR32k series; separately smooth 6 mm and resample to fsaverage4 for individual systems and graph measures |
| QC | Render structural, registration, volume/surface functional and phenotype panels in processing order |
Interpolation of motion-flagged samples preserves the retained time axis. It does not remove the first ten frames. FD currently uses a 50 mm radius, inherited from the existing LMBC implementation.
Surface registration uses mris_register. The BCP12 atlas name denotes the 12-month atlas. Files named *.roi.164k.shape.gii are cortex/medial-wall masks, not parcellations. The documented DK318 undefined label was corrected to unknown in the source annotation and label GIFTI; no special vertex repair runs during processing.
The HCP branch reuses the installed HCP TOPUP script and FSL/Workbench commands. The selected 6DOF alignment performed better than the tested FSL BBR candidate for sub-761141_01. That subject-specific observation does not establish a universally superior infant registration method.
Runtime and minimal resources¶
Use lmbc:infant or a configured runtime containing FreeSurfer, FSL, HCP scripts, Connectome Workbench and the Python dependencies declared by this repository. The QuNex-derived container supplies these neuroimaging tools; no separate host FreeSurfer installation is required. AFNI is used by the sequential/GRE adapter. Workbench supports offscreen QC rendering.
examples/infant/BCP/Resources/resources.json binds seven resource roles: unc, msn, masks, mesh, functional, roi and schaefer400. The packaged minimal assets include age-selected folding templates and bridges, BCP12 parcellations, cortical masks, fsLR32k/fsaverage4 meshes, individual-system age priors, graph resources, ROI annotations and the native Workbench scene. Resource manifests retain source paths and hashes. A dry run checks the actual files required by the selected sessions and stages.
Run the BCP example¶
This example requires the BCP source images, matched iBEAT reconstructions, packaged resources, and the base lmbc:qunex-0.93.6 image described in Installation. It is a dataset-specific example, not an automatic data download. From the repository root:
docker build --platform linux/amd64 -f containers/Dockerfile.infant -t lmbc:infant .
python3 examples/infant/BCP/prepare_sbref_input.py
bash examples/infant/BCP/run_sbref.sh --dry-run
OUTPUT_DIR="$PWD/examples/infant/BCP/Output_AllFrames" \
bash examples/infant/BCP/run_sbref.sh
The preparation utility preserves an existing batch file. Check DiscardVolumes=0 in any older local batch before starting. The supplied SBRef batch pairs sub-761141_01 AP and PA BOLD with their acquired references and fieldmaps, with TR 0.72 s and MB factor 8. The wrapper defaults to Output_SBRef; setting OUTPUT_DIR avoids mixing a fresh run with historical comparisons.
For another dataset, use its own batch and resource configuration:
lmbc-infant /path/to/Input /path/to/Output \
--batch /path/to/database_batch.txt \
--resources /path/to/resources.json \
--stage all --dry-run
lmbc-infant /path/to/Input /path/to/Output \
--batch /path/to/database_batch.txt \
--resources /path/to/resources.json \
--stage all
Stages are import, structure, functional, qc and all. A fresh functional run builds its structural prerequisites. Repeat the command to skip an identical completed visit. Changed inputs, demographics, parameters or toolchain start a fresh attempt. Use --overwrite for an intentional repeat or to replace an unverifiable historical result. On failure, read the terminal message and infant-error.txt in the output directory when available.
Manual QC writes a separate report to QC_Infant/sub-<id>/ses-<visit>/index.html. Automatic QC for the published run remains available under Results_Infant/sub-<id>/ses-<visit>/QC/index.html. Refresh only QC for the completed all-frame AP demonstration:
BATCH_TXT="$PWD/examples/infant/BCP/BCP_SBRef_batch.txt" \
OUTPUT_DIR="$PWD/examples/infant/BCP/Output_Final_20260923" \
bash examples/infant/BCP/run_qc.sh
Output contract¶
Output/
infant-plan.json
infant-run.json # Public staged execution status
Results_Infant/sub-*/ses-*/
surf/ # Individual surface geometry and metrics
registration/ # Spheres, resampled surfaces and masks
label/ # Individual parcellations
func/task-*_run-*/
preprocessing.json # Recipe, frames, discard, TR, correction metadata
ribbon/ # Native and fsLR32k surface time series
... # Volumes, transforms, motion and tissue signals
QC/
index.html
report.json
qc-status.json
snapshots/
scenes/
assets/
logs/
Results_PostPre/sub-*/ses-*/
anat/ # Regional morphology and MIND
func/
timeseries/
parcellation/ # Individualized 7/18-system assignments
connectivity/ # ROI matrices
qc/ # FD and other numerical outputs
*_desc-infant_postprocessing.json
Completion manifests and output sidecars identify the acquisition and processing choices. Tabular products use TSV/TSV.gz with JSON sidecars; large graph products can use NPZ. A rendered HTML report alone is not evidence that every processing stage completed.
- fsLR32k contains 32,492 vertices per hemisphere. Schaefer200 FC is a symmetric 200×200 Pearson matrix with missing entries for unusable parcels, with rows/columns 1–100 left and 101–200 right. Its sidecar records
Space=fsLR32kandSmoothingFWHMmm=0. - Individual 7/18-system assignments contain 5,124 vertices in fsaverage4, 2,562 per hemisphere. These use the existing LMBC individual-system method and age priors. Their calculation space is fsaverage4; the QC labels are resampled to fsLR32k only for display.
- Functional sidecars record the number of volumes, discard setting, TR and GSR choice. A zero discard setting retains all 420 volumes in this example.
- Surface morphology follows the infant definitions. Vertex volume uses thickness multiplied by mean white/pial vertex area; it is not asserted to reproduce every adult FreeSurfer statistic.
QC reading order¶
- Structure: anatomy/tissue/surface overlays, individual native sulcal depth and cortical thickness, with numerical color bars.
- Surface registration and parcellation: DK68, HCP360 and Schaefer200 on the individual's surface. Thin light-gray polylines mark actual parcel boundaries over the existing fills.
- Functional volume and mapping: correction/registration, coverage, motion, DVARS, carpet, tSNR, tissue signals and mapping exclusions, as available. Native mean BOLD and surface tSNR show a numerical color bar for each hemisphere.
- fsLR32k mean BOLD: pre-regression ribbon-mapped signal on the individual's resampled white surfaces, with the native mean-BOLD black–red–yellow palette, one shared bilateral intensity range and numerical color bars.
- Individual 7-system and 18-system atlases: categorical assignments with distinct legends and boundaries, before ROI connectivity.
- Schaefer200 connectivity: the stored matrix only in its original parcel order, left 1–100 then right 101–200. The color bar spans Pearson r from −1 to +1.
The matrix caption records GSR. Modular appearance is a qualitative check, not a numerical QC pass. When functional phenotypes have not completed, the report explicitly marks the corresponding panels unavailable. Inconsistent frame counts or processing metadata raise an error. Schaefer400 remains an analysis atlas but is excluded from QC.
Completed all-frame demonstration and limits¶
Output_Final_20260923 contains the sub-761141_01 AP all-frame demonstration: 420 volumes, zero initial discard, completed functional preprocessing, surface mapping, functional phenotypes and 19 QC images. Supplied structural surfaces/registration/parcellations were held fixed. The unchanged TOPUP estimation was reused after checking the underlying SBRef/fieldmap data and geometry. This demonstrates a complete AP functional chain; it does not claim a new structural or PA run in that directory.
The workflow does not generate missing gradient-coil coefficients, receive-bias fields, MNI transforms, infant FreeSurfer aseg/eTIV, myelin maps, or subcortical CIFTI outputs. ALFF is not implemented in this module. Infant tissue contrast, cortical masks, age priors, FD radius and nonfinite fixed-graph nodes still require scientific review before joint lifespan analysis. NormativeEligible=false remains explicit.
For implementation traceability, the repository retains source correspondence in tmp_readme.md and dated validation records in docs/migration/infant-audit/. These historical records should be interpreted alongside the current processing defaults described above.
Demographic coding¶
The database batch Sex field is required: 0 = Female, 1 = Male. Explicit F/Female and M/Male values are normalized to the same codes. Zero is a valid value and is preserved in phenotype sidecars. Conflicting sex or age values across runs within the same session are rejected. Infant AgeMonths remains in months; the adult demographic table uses years.