Adult structural and functional processing¶
For the four standard adult routes and scoring CSVs, start with the Docker run guide. This chapter covers the lower-level QuNex commands, parallel workers and restart options.
The adult workflow prepares a QuNex study from BIDS data, executes HCP anatomical and functional stages, and derives structural and resting-state phenotypes. Before proceeding, configure the neuroimaging runtime, atlas resources, and FreeSurfer license described in Installation, and validate the input dataset.
The commands below run in the configured LMBC neuroimaging environment. Use a separate output root for each database. The database name is recorded in dataset.json; it does not introduce another directory below the output root.
Current acquisition defaults differ from the supplied historical site recipe.
An acquisition-matched SBRef enables USE (the historical template used NONE);
target resolution follows the largest source voxel spacing, such as 4.375 mm,
unless --bold-resolution 4 is explicitly selected. Multiband auto-STC policy
is a recorded choice, not proof of equivalent singleband timing behavior or
scientific superiority. The pinned QuNex runtime is 0.93.6; agreement with results
produced by 0.93.2 has not been established merely by retaining HCP command names.
Preserve runtime/tool hashes and recipe metadata when comparing historical results.
1. Prepare a database¶
Prepare the required demographics and BIDS files. Validate the entire roster before launching workers:
lmbc-qunex-run /data/DatabaseA/bids /results/DatabaseA \
--dataset DatabaseA --n-cpus 16 --jobs 4 --dry-run
The cohort dry-run checks demographics, CPU allocation, selected anatomy, BOLD length, acquisition metadata and fieldmap pairing, then writes logs/dataset/<uuid>/plan.json and preflight.csv. Open the CSV for the visit, file, failed check and correction details. The same intake checks run before workers start. Installation, atlas and external tool checks also apply during execution. To inspect detailed acquisition preparation for one session:
lmbc-qunex-prepare /data/DatabaseA/bids /results/DatabaseA \
--participant-label 001 --session-label baseline
2. Execute the database¶
Process every participant/session in DatabaseA with four simultaneous workers, each receiving four CPU threads:
lmbc-qunex-run /data/DatabaseA/bids /results/DatabaseA \
--dataset DatabaseA --n-cpus 16 --jobs 4
--n-cpus is the total CPU budget per invocation; --jobs controls concurrent participant/session processes. Each worker receives floor(n-cpus / active-jobs) threads. Defaults are one CPU and one worker. Use --n-cpus 1 --jobs 1 for serial execution on one core, or --n-cpus 8 --jobs 1 for serial subjects with eight threads available to each. Memory must also fit the chosen concurrency; this interface does not allocate memory automatically.
Worker environments limit OpenMP, BLAS, ITK, and HCP FreeSurfer threads; QuNex session/run concurrency is one inside each worker. The pinned HCP FreeSurfer version reads NSLOTS to set its -openmp argument. See the HCP source and QuNex parallel-processing documentation. CPU settings are thread budgets; scheduler/container quotas provide operating-system resource enforcement.
Omitting --participant-label selects the full database. To select a subset, use --participant-label 001 002 003; use --session-label baseline followup to select visits. Each subject/session has its own output paths and execution lock. Runtime failures are recorded and other workers continue; the invocation exits nonzero if any worker fails. Per-invocation execution.csv, worker logs, and run-summary.json are retained under logs/dataset/<uuid>/. A failed global cohort preflight launches no workers.
For an external table, append --demographics /data/DatabaseA/scan-demographics.csv. After unsharded execution, LMBC writes a database QC snapshot under QC/, even when workers failed. Regenerate and combine reports using the independent command in step 5.
Containers¶
Rebuild the LMBC image after updating the source, then mount inputs read-only and give the container enough CPU and memory:
docker run --rm --platform linux/amd64 --cpus 16 \
--mount type=bind,src=/data/DatabaseA/bids,dst=/data,readonly \
--mount type=bind,src=/results/DatabaseA,dst=/output \
lmbc:qunex-0.93.6 run-qunex /data /output \
--dataset DatabaseA --n-cpus 16 --jobs 4
Mount external demographic tables and resource directories explicitly. dataset.json records paths visible in the execution environment. Run QC with the same mounts, or supply --bids-dir, --demographics, and --dataset for a single relocated dataset. For multi-database QC, all registered paths must be accessible in the QC environment; identical host/container mount paths simplify this.
SLURM¶
Within one allocated node, use the same database command with --n-cpus "$SLURM_CPUS_PER_TASK". Across nodes, use deterministic shards in an array job:
#!/usr/bin/env bash
#SBATCH --job-name=lmbc-DatabaseA
#SBATCH --array=0-4
#SBATCH --cpus-per-task=16
#SBATCH --mem=64G
#SBATCH --time=48:00:00
set -euo pipefail
# Activate the configured LMBC runtime before the command below.
lmbc-qunex-run /data/DatabaseA/bids /results/DatabaseA \
--dataset DatabaseA --n-cpus "$SLURM_CPUS_PER_TASK" --jobs 2 \
--shard-count 5 --shard-index "$SLURM_ARRAY_TASK_ID"
Adapt memory/time and the runtime setup to your cluster. All array tasks must use the same frozen input roster, filters, shard count, and output root. The sorted participant/session list is divided by index modulo shard count; no session is assigned twice. The CPU budget applies to each array task (up to 80 CPUs across the five tasks above). Empty shards exit successfully. Sharded invocations retain separate execution records and defer the shared QC table to a standalone command after all array tasks finish, including failed tasks. LMBC does not submit scheduler jobs itself.
3. Processing branches¶
T1w enables HCP anatomy and structural phenotypes. BOLD enables HCP volume/surface processing; only resting-state runs enter the current FC postprocessing recipe. Task data do not automatically receive resting-state phenotypes.
The default --functional-recipe legacy-gretna-v1 uses nuisance regression, the supplied GRETNA FFT filter (0.01–0.08 Hz and its 3/5/15 padding rule), and FD-based linear interpolation. Uninterpolatable boundary frames and all-zero frames are removed with explicit frame accounting before spatial processing. ROI FC uses an additional 6 mm smoothed fsLR32k series; graph and individualized-atlas products use the smoothed fsaverage4 branch. Graph SD uses ddof=1; nodal within-system means include the zero diagonal, with the historical -100 sentinel when within-connectivity is zero. Unknown network labels are excluded consistently.
The earlier Butterworth/constant-edge/unsmoothed-ROI method remains selectable as --functional-recipe python-v1. Both recipes record their identity, regressors, filter, smoothing and retained frames. A recipe change requires functional recomputation. Neither recipe is automatically certified for a trained normative model. Infant temporal processing retains its existing Python recipe.
4. Resume¶
Repeat the original command to check the visit. LMBC verifies the input record and completed products. Identical, intact visits are skipped. Changing the selected imaging, scan table, method, resources or runtime creates a fresh run for that visit. For a deliberate repeat with unchanged inputs, add --overwrite. A failed or interrupted attempt with the same inputs, a damaged output, or an older output without verified provenance also requires --overwrite. Read the reported log and correct the cause first. Earlier attempts stay in the results directory. See the repeat and error guide.
Disabling GSR with --no-global-signal-regression marks outputs ineligible for the current normative setup. Enabling GSR alone does not establish full compatibility.
5. Aggregate QC and review¶
Generate one database report or combine several databases:
lmbc-qc /results/DatabaseA
lmbc-qc /results/DatabaseA /results/DatabaseB --output-dir /results/QC_all
The first command writes /results/DatabaseA/QC/qc-summary.csv. The second creates /results/QC_all/qc-summary.csv with one row per database/participant/session. Run-level detail is in qc-runs.csv; DatasetID keeps identically named participants from different databases distinct. QC reads existing processing outputs and does not repeat preprocessing. See Quality control for thresholds, missing-state semantics, and manual-review import.
Inspect Results_PostPre/sub-*/[ses-*]/logs/run-summary.json, anatomical and functional manifests, generated images, and phenotype sidecars. Brackets indicate optional session directories. Confirm that the expected stages completed and investigate any skipped measurements or warnings.
Check reconstruction and registration quality before retaining phenotypes. Preserve the atlas, axis ordering, units, transformations, and GSR setting with the numerical outputs. Continue with Quality control and Results and troubleshooting.
Slice timing and acquisition identity¶
With automatic order, BIDS SliceTiming is retained in seconds rather than reduced
to a permutation. LMBC corrects singleband BOLD to mid-TR using FSL signed shifts,
respects SliceEncodingDirection, and records normalized timings and NIfTI geometry
in the preparation manifest. Multiband defaults to no slice-timing correction.
Named/custom order overrides assume uniform timing; non-k-axis overrides require
exact BIDS timings. TOPUP requires a validated opposing PE pair on matched grids,
consistent readouts, and matching IntendedFor/B0FieldSource declarations when supplied.