Longitudinal metrics workflow Fix #200#297
Closed
jpillai00 wants to merge 10 commits into
Closed
Conversation
4f4555a to
e1e80a1
Compare
e1e80a1 to
af17925
Compare
8 tasks
Contributor
|
Thanks @jpillai00 — reusing Closed as part of #301 Stage 0. |
nx10
added a commit
that referenced
this pull request
Apr 16, 2026
Implement rbc longitudinal metrics: resolve per-regressor regressed_bold/cleaned_bold + brain mask from space-longitudinal functional derivatives, read TR from NIfTI header, and call single_session_metrics unchanged. Reuse cross-sectional export_metrics for BIDS output naming. Co-authored-by: Janhavi Pillai <janhavipillai3@gmail.com>
5 tasks
nx10
added a commit
that referenced
this pull request
Apr 17, 2026
) * Add longitudinal metrics orchestration (port from #297) Resolve per-regressor regressed/cleaned BOLD and brain mask from space-longitudinal derivatives, read TR from NIfTI header, call single_session_metrics unchanged. Reuse cross-sectional export_metrics for BIDS naming. Co-authored-by: Janhavi Pillai <janhavipillai3@gmail.com> * Add longitudinal QC, all pipeline, and full_pipeline tests QC: Dice/Jaccard between anat and BOLD brain masks in longitudinal space, pass threshold Dice >= 0.85. Viz tracked in #303/#304. All pipeline: template -> anat -> func -> metrics -> qc. Template writes to disk cross-session; per-session stages hand off func outputs in-memory. process_anat/process_func now return workflow outputs. CLI: Add --regressor and --task to `rbc longitudinal all`. Tests: Tier-4 full_pipeline tests for metrics, QC, and all-vs-sequential equivalence under tests/full_pipeline/longitudinal/. * Fix anat groupby dropping mask rows in longitudinal resolve T1w suffix filter in run() excluded masks from the DataFrame passed to process_anat, so resolve_longitudinal_anat couldn't find them. Drop the filter. Pre-existing Stage 4 bug exposed by new tests. * Add --regressor to longitudinal metrics CLI Replace DataFrame-based discovery (queried a non-existent 'reg' column) with explicit --regressor, matching cross-sectional. * Fix longitudinal all test fixture missing --session-label Fixture ran cross-sectional func only for ses-test but invoked `rbc longitudinal all` without --session-label, so it iterated ses-retest (no func derivatives) and crashed on an empty BOLD DataFrame. * Apply only participant filter to template discovery in all pipeline Template needs all sessions to find multi-session subjects. Session/task filters apply only to per-session stages, not discover_template_inputs. * Clean up tech debt: TR validation, FS auth, QC load_table TR: Promote resolve_tr/warn_implausible_tr to public API. Replace _read_header_tr with _read_derivative_tr that pipes through resolve_tr for validation and plausibility warnings. Add --tr override to longitudinal metrics CLI. FS auth: Rename _setup_freesurfer_auth -> setup_freesurfer_auth, export from template.py, import at module level in all.py. QC: Replace manual concat of session.anat + session.func + tpl_df with load_table, matching cross-sectional qc.py. --------- Co-authored-by: Janhavi Pillai <janhavi.pillai@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
draft for now.. need to test this! & this is based off #282
Extends the longitudinal pipeline to compute derivative metrics (ALFF, fALFF, ReHo, smoothing, z-scoring, and atlas-based timeseries extraction) on longitudinal-space BOLD, mirroring the existing cross-sectional metrics workflow.
Key changes:
bids/longitudinal.pyLongitudinalMetricsInputsTypedDict,resolve_longitudinal_metrics(resolves per-regressor regressed/cleaned BOLD and brain mask from longitudinal derivatives), andexport_longitudinal_metrics(delegates to existing export_metrics)orchestration/longitudinal.pyprocess_metricswhich resolves inputs, reads TR from nifti header, runssingle_session_metrics, and exports outputs; added metrics andatlas_filesparameters torun()cli/longitudinal.py--metricsflag and--atlasargument (defaulting to schaefer_200); TR and FWHM are not exposed as CLI params and use hardcoded defaults (read from header and 6mm respectively) to match cross-sectional behaviorNo changes to
workflows/metrics.py- single_session_metrics already works generically for both cross-sectional and longitudinal space.