Skip to content

Add optional smoothing Fix #212#310

Open
jpillai00 wants to merge 13 commits into
mainfrom
add/smoothing
Open

Add optional smoothing Fix #212#310
jpillai00 wants to merge 13 commits into
mainfrom
add/smoothing

Conversation

@jpillai00
Copy link
Copy Markdown
Contributor

@jpillai00 jpillai00 commented Apr 14, 2026

Adds --smooth FWHM flag to rbc metrics, rbc functional, rbc all, rbc longitudinal metrics, rbc longitudinal functional, and rbc longitudinal all to control smoothing of derivative outputs and cleaned BOLD.

Changes:

  • Smoothing is now optional - raw maps and z-scored raw maps (desc-zstd) are always produced. When --smooth FWHM is set, the following are additionally exported:
    • Derivative maps: smoothed (desc-sm{fwhm}) and z-scored smoothed (desc-sm{fwhm}Zstd)
    • Cleaned BOLD: smoothed (desc-sm{fwhm}preproc), export-only, applied post-regression and bandpass filtering
  • FWHM label formatting handles both whole numbers (6.0 -> sm6) and non-integer values (0.1 -> sm0p1) for BIDS compliance
  • Moved smooth from rbc.core.metrics.smoothing to rbc.core.common
    • verified via 3dBlurToFWHM that it correctly handles both 3D derivative maps and 4D BOLD timeseries
  • Added tests for smoothed BOLD and map exports

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

Coverage

Tests Skipped Failures Errors Time
786 0 💤 0 ❌ 0 🔥 11.525s ⏱️

@jpillai00 jpillai00 marked this pull request as ready for review April 16, 2026 19:10
Copilot AI review requested due to automatic review settings April 16, 2026 19:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an optional --smooth FWHM parameter across rbc metrics, rbc functional, and rbc all so that smoothing is no longer always performed; raw + z-scored raw derivatives are always produced, and smoothed variants are emitted only when requested.

Changes:

  • Replace required/default smoothing (fwhm=6.0) with optional smooth: float | None throughout CLI args, orchestration, and workflows.
  • Update metrics workflow outputs to always include raw + z-scored raw maps, and optionally include smoothed + z-scored smoothed maps.
  • Extend export + test coverage for conditional smoothed outputs and correct BIDS desc- label construction.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/unit/orchestration/test_functional.py Updates orchestration test to use smooth instead of fwhm.
tests/unit/cli/test_metrics.py Updates metrics CLI tests for --smooth default/validation and parser wiring.
tests/unit/cli/test_functional.py Adds smooth to functional CLI namespace fixture.
tests/unit/cli/test_all.py Updates all CLI tests for --smooth default/validation and parser wiring.
tests/unit/bids/test_exports.py Updates export fixtures/count assertions; adds tests for conditional smoothed exports and desc labels.
tests/full_pipeline/test_metrics.py Adjusts pipeline test to tolerate optional (None) outputs.
src/rbc/workflows/metrics.py Makes smoothing optional; always computes z-scored raw maps; adds optional smoothed + z-scored smoothed outputs.
src/rbc/workflows/functional.py Adds optional smoothing path for cleaned BOLD export.
src/rbc/orchestration/metrics.py Threads smooth through orchestration and passes it into exports.
src/rbc/orchestration/functional.py Threads smooth through functional orchestration and exports.
src/rbc/orchestration/all.py Threads smooth through the combined pipeline for metrics exporting.
src/rbc/cli/metrics.py Renames --fwhm to --smooth, makes it optional, and updates validation/args.
src/rbc/cli/functional.py Adds optional --smooth to functional CLI and passes through to orchestration.
src/rbc/cli/all.py Renames --fwhm to --smooth, makes it optional, and updates validation/args.
src/rbc/bids/metrics.py Exports raw + z-scored raw always; conditionally exports smoothed variants when smooth is set.
src/rbc/bids/functional.py Conditionally exports smoothed cleaned BOLD when requested.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rbc/bids/metrics.py
Comment thread src/rbc/bids/metrics.py Outdated
Comment thread src/rbc/bids/functional.py Outdated
Comment thread src/rbc/workflows/functional.py
Comment thread src/rbc/workflows/functional.py Outdated
@jpillai00 jpillai00 marked this pull request as draft April 16, 2026 20:12
@jpillai00 jpillai00 marked this pull request as ready for review April 17, 2026 20:08
@nx10
Copy link
Copy Markdown
Contributor

nx10 commented May 11, 2026

There is a missing period in mm (e.g. --smooth 6.0) copy pasted 6 times.
Otherwise it looks good to merge! - could you rebase so the CI runs over this again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants