Skip to documentation
PREPARE MY DATA

LMBC User Guide

0.1.0.dev0Development documentation

Quality control

Quality control combines execution records, numerical measurements, and visual assessment. LMBC provides input checks, logs, manifests, and phenotype sidecars. The infant workflow additionally generates an HTML report for image review.

Database summary command

After adult HCP/LMBC processing, regenerate one database report or combine multiple databases:

lmbc-qc /results/DatabaseA
lmbc-qc /results/DatabaseA /results/DatabaseB --output-dir /results/QC_all

lmbc qc forwards to the same command. The container wrapper accepts qc. dataset.json, written by database execution or its dry-run, identifies the BIDS root, demographic table, and database. Both source metadata and processing outputs must be accessible when QC runs. Existing unregistered outputs can be inspected with:

lmbc-qc /results/DatabaseA --bids-dir /data/DatabaseA/bids \
  --dataset DatabaseA --demographics /data/DatabaseA/demographics.csv

Every expected participant/session remains represented, including unprocessed subjects and missing images. QC flags use 1 = pass/present, 0 = fail/absent. Empty flags mean unavailable, pending, or not applicable; the corresponding status column supplies the reason. Successful CSV generation is not an overall scientific QC pass.

The current report does not reproduce the historical MRIQC-derived fields or run MRIQC. Those measurements require a separately validated integration; their absence must not be interpreted as a pass. Execution/product flags and infant visual panels do not replace MRIQC image-quality measurements.

Files

File Contents
qc-summary.csv One row per DatasetID + SubID + SesID
qc-runs.csv One row per BOLD acquisition, including task acquisitions and every resting-state run
qc-anatomical.csv T1w acquisition/sidecar details
qc-report.json Input registrations, counts, thresholds, and flag semantics
visual-review-template.csv Session-level structural and run-level functional review keys; existing templates are preserved

All QC tables restrict demographic fields to SubID, SesID, Age, Sex, SiteID. Age is in years; Sex=0 is Female and Sex=1 is Male. Race, PI, country, and other source-table demographic columns are excluded. DatasetID and acquisition/processing fields are operational identifiers and QC measurements.

Checks and thresholds

Fields Definition
S1_Flag_Delete_DueToSiteAgeSex 1 when scan Age, Sex, and SiteID are valid; 0 otherwise. The historical field name is retained; 1 means retain/pass
S2_withT1w, withT2w, S2_withFunc Presence of corresponding NIfTI images; a JSON sidecar alone does not count
S4_Pipeline Nonempty HCP MNINonLinear/fsaverage_LR32k/*.spec output exists
HCP_fMRIVolume, HCP_fMRISurface Required volume/CIFTI products exist for every mapped BOLD run
S4_Pipeline_fMRI Completed resting-state manifest, nonempty FD, bilateral fsLR32k/fsaverage4 GIFTIs, and all listed FC/graph products for every resting-state run
EulerNumber 2 − (left holes + right holes) from the last orig.nofix record in FreeSurfer recon-all.log
S5_EulerNumber EulerNumber ≥ −217
MeanFD, Rate05, Rate03 Mean Power FD and proportions of frames strictly above 0.5 mm / 0.3 mm
S7_HeadMotion MeanFD ≤ 0.5 mm and Rate05 ≤ 0.2
S6_VisualQC_sMRI, S6_VisualQC_fMRI Explicit imported human decisions; blank until reviewed

QCNotes also reports the adult anatomical phenotype/MIND manifest status and unavailable MIND atlases. The structural S4 flag describes HCP preprocessing products; it does not assert that every atlas has a valid MIND matrix. Missing manual visual decisions remain pending. An unreadable phenotype manifest is reported explicitly.

Historical stage identifiers are retained for compatibility. The former duplicated Euler flag is not emitted; the fixed Euler threshold has a single column. Thresholds follow the supplied laboratory QC scripts and are recorded in qc-report.json.

FD is read from each run's LMBC *_desc-powerfd_timeseries.tsv[.gz]. If it is absent, QC computes FD from HCP Movement_Regressors.txt using the existing LMBC convention (translations in mm, rotations in degrees converted to radians, 50 mm radius, first FD zero). Nonfinite, negative, or frame-count-inconsistent FD values are invalid. Mapping from BIDS acquisitions to BOLD_N uses the preparation manifest; missing mapping is reported rather than guessed from filenames.

For a structural-only run on a visit that also has BOLD, the QC table records the acquisition and marks its motion and functional review as not_requested.

The session MeanFD, Rate05, and Rate03 columns contain the maximum across runs. A session passes motion QC only if every BOLD run passes. If any required motion result is missing, session metrics remain blank; a known failed run still produces a failed session flag. Use qc-runs.csv to choose individual usable runs. Task-only sessions have no resting-state postprocessing flag.

ExecutionStatus is reported separately from output-existence checks. Existing files, successful execution, acceptable images, and model compatibility are different findings.

Record visual review

Copy visual-review-template.csv to a review file. In rows with empty BIDSFile, enter S6_VisualQC_sMRI as 0 or 1. In BOLD rows, enter S6_VisualQC_fMRI. Leave unreviewed cells empty. Preserve the exact keys:

lmbc-qc /results/DatabaseA /results/DatabaseB --output-dir /results/QC_reviewed \
  --visual-review /results/review.csv

Duplicate keys, unknown acquisitions, and decisions other than 0/1 are rejected. The review input is not overwritten. For an expanded cohort, use a fresh QC output directory to generate a complete new template, then transfer existing decisions by the full database/subject/session/acquisition key.

Review sequence

Review level Inspect Decision supported
Inputs and acquisition Image integrity, acquisition metadata, coverage, and reconstruction pairing Whether the selected processing workflow is appropriate
Execution Stage status, error logs, artifact existence, dimensions, and completeness Whether the expected processing products were generated
Images and phenotypes Tissue boundaries, surface reconstruction, registration, motion, signal coverage, and ROI validity Which runs and measurements can be retained for analysis
Model applicability Scan age, phenotype definition, atlas, processing recipe, and site handling Whether a measurement matches the intended model specification

Record the outcome and reasons for each reviewed run or measurement. A processing failure, an image-quality exclusion, and a model incompatibility represent different findings and should remain distinguishable.

Infant visual reports

Open Results_Infant/sub-*/[ses-*]/QC/index.html after processing. Brackets denote an optional session directory. Keep the accompanying report assets with the HTML file.

The report follows processing order:

  1. Native anatomy and surfaces: inspect tissue segmentation, cortical boundaries, sulcal depth, and thickness.
  2. Registration and parcellation: inspect the spatial correspondence of DK68, HCP360, and Schaefer200 labels on the individual surface.
  3. Functional volumes and mapping: inspect BOLD-to-anatomy alignment, coverage, motion, DVARS, carpet plots, tSNR, tissue signals, and mapping exclusions where available.
  4. Surface signal: inspect pre-regression fsLR32k mean BOLD using the shared bilateral intensity range and hemisphere color bars.
  5. Individualized systems: inspect the 7-system and 18-system assignments and their categorical legends. Calculations use fsaverage4; labels are resampled to fsLR32k for display.
  6. ROI connectivity: inspect the Schaefer200 Pearson correlation matrix in its stored parcel order, with the GSR setting recorded in the caption.

Unavailable phenotype panels are explicitly identified when their processing stages have not completed. Matrix appearance alone is insufficient to accept a run. Refer to the infant workflow for the current report contents and interpretation limits.

Execution status and review outcome

qc-status.json records report-rendering status. Successful rendering indicates that report generation completed; it does not assign an anatomical or scientific pass. Similarly, a run marked completed_with_warnings requires inspection of the affected stages and skipped measurements.

Adult processing combines database CSV checks with run summaries, manifests, native tool outputs, and direct image review. The database CSV interface evaluates the adult HCP output layout; infant image reports retain their dedicated interface below.

Provenance to retain

Retain the original inputs and metadata, processing command, resolved settings, LMBC version or commit, container digest, reference-resource versions and hashes, logs, and output sidecars. Preserve the original axis labels and missing-value information with each measurement.

When comparing runs across environments, define numerical tolerances and inspect scientifically relevant differences. Unit tests and successful command execution do not replace image-level or external-cohort validation. See Implementation and validation status.

From QC records to website input

Assign the website's QC_Passed field after reviewing the images and the intended measurement. Do not convert a successful execution status, a present-output flag, or an empty visual-review field into Yes automatically. The website does not inspect the source MRI to confirm that decision.

The scoring CSV uses Female/Male, while the database QC tables use 0/1. Its FC covariate meanFD must describe the measurement being scored; the session QC summary instead stores the maximum across runs. Website HC calibration requires meanFD strictly below 0.5 mm, whereas the pipeline motion flag uses a mean-FD bound of at most 0.5 mm together with Rate05 at most 0.2. See Prepare a scoring CSV for the complete field mapping and calibration requirements.

Report provenance and interrupted execution

qc-report.json schema 1.1 records the LMBC version, implementation hashes and CSV column schemas. qc-input-diagnostics.csv lists malformed directory names; valid subjects remain in the report and their QC notes point to these diagnostics. The processing entry point still rejects malformed directory names.

A running execution journal is checked only against a process on the same host, including its start identity to avoid PID reuse. A missing/replaced process is reported as interrupted. Foreign-host or older journals lacking identity are running_unverified; QC does not assume that a local PID describes a remote job. Module logs are separated by run UUID and prior summaries remain in log history.