Skip to content

FIX: Restrict carpet plot crown mask to BOLD coverage - #3642

Merged
effigies merged 1 commit into
nipreps:masterfrom
lobennett:fix/crown-coverage-clip
May 13, 2026
Merged

FIX: Restrict carpet plot crown mask to BOLD coverage#3642
effigies merged 1 commit into
nipreps:masterfrom
lobennett:fix/crown-coverage-clip

Conversation

@lobennett

@lobennett lobennett commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Closes #3359.

Changes proposed in this pull request

  • Add _clip_mask_to_coverage helper in fmriprep/workflows/bold/confounds.py that
    restricts a mask to voxels with non-zero BOLD variance.
  • Add crown_clip Function node to init_bold_confs_wf and route it between
    subtract_mask and the three downstream consumers (outputnode.crown_mask,
    crowncompcor.mask_files, mrg_compcor.in3).

Why

When the brain mask is dilated past the BOLD coverage region, the resulting
crown includes voxels with no time-series content. These zero-variance rows are
grouped together by the carpet plot's row-sort and surface as a flat gray band:

diagnostic

Before After
orig fix

This is a visualization-only change; edge_comp_* columns in
desc-confounds_timeseries.tsv are unaffected (zero-variance voxels contribute
nothing to PCA). See the issue thread for the verification.

@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 15.38462% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.41%. Comparing base (acdb0fd) to head (1b82ebc).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
fmriprep/workflows/bold/confounds.py 15.38% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3642      +/-   ##
==========================================
- Coverage   74.57%   74.41%   -0.16%     
==========================================
  Files          62       62              
  Lines        4975     4988      +13     
  Branches      637      637              
==========================================
+ Hits         3710     3712       +2     
- Misses       1131     1142      +11     
  Partials      134      134              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lobennett
lobennett force-pushed the fix/crown-coverage-clip branch from 4234079 to d5a0c10 Compare April 30, 2026 01:00
@lobennett
lobennett force-pushed the fix/crown-coverage-clip branch from d5a0c10 to 1b82ebc Compare April 30, 2026 02:45

@effigies effigies left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks.

@effigies
effigies merged commit 034f626 into nipreps:master May 13, 2026
21 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gray band in edge region of carpet plot

2 participants