Skip to content

Conversation

@tsalo
Copy link
Member

@tsalo tsalo commented Jan 5, 2026

Closes #1268.

Changes proposed in this pull request:

  • Retain variance and covariance estimates from nonlinear curve fit when --fittype curvefit and --verbose.
  • Generate figures for these new maps.
  • Restructure fit_decay:
    1. Estimate t2s_full and s0_full, but not t2s_limited and s0_limited, in fit_decay/fit_decay_ts.
    2. Create new function to create the limited maps from the full maps and apply the ceilings and floors.
    3. Use masked arrays in fit_decay/fit_decay_ts instead of masking internally.
    4. Delete more variables when we're done using them to hopefully free up memory.

@tsalo tsalo added enhancement issues describing possible enhancements to the project T2*/S0 estimation issues related to the estimation of T2* and S0 labels Jan 5, 2026
@tsalo
Copy link
Member Author

tsalo commented Jan 6, 2026

Before I fix up all of the unit tests, I want to verify that we (1) want this and (2) like the configuration I've set up. The new variance/covariance files are only generated if --fittype curvefit and --verbose, and they'll be named like this:

<prefix>_stat-covariance_desc-t2star+s0_statmap.nii.gz
<prefix>_stat-variance_desc-s0_statmap.nii.gz
<prefix>_stat-variance_desc-t2star_statmap.nii.gz

I could also create figures for them as well, if that would be useful.

tsalo added 14 commits January 7, 2026 11:56
1. Estimate t2s_full and s0_full, but not t2s_limited and s0_limited, in fit_decay/fit_decay_ts.
2. Create new function to create the limited maps from the full maps and apply the ceilings and floors.
3. Use masked arrays in fit_decay/fit_decay_ts instead of masking internally.
4. Delete more variables when we're done using them to hopefully free up memory.
@tsalo tsalo marked this pull request as ready for review January 7, 2026 18:41
@tsalo tsalo requested review from eurunuela and handwerkerd January 7, 2026 18:41
@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 95.38462% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.70%. Comparing base (4c4c99d) to head (39dfe70).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
tedana/workflows/t2smap.py 81.81% 3 Missing and 1 partial ⚠️
tedana/decay.py 98.50% 0 Missing and 1 partial ⚠️
tedana/workflows/tedana.py 95.23% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1290      +/-   ##
==========================================
- Coverage   89.70%   89.70%   -0.01%     
==========================================
  Files          29       29              
  Lines        4441     4489      +48     
  Branches      740      744       +4     
==========================================
+ Hits         3984     4027      +43     
- Misses        302      305       +3     
- Partials      155      157       +2     

☔ 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.

@tsalo
Copy link
Member Author

tsalo commented Jan 7, 2026

I ran tedana locally (happy to share more details) and take a look at these variance/covariance plots!

T2* variance

image

S0 variance

image

T2*-S0 covariance

image

@eurunuela
Copy link
Collaborator

I ran tedana locally (happy to share more details) and take a look at these variance/covariance plots!

Why do you have squares on the brain on some of the slices?

@tsalo
Copy link
Member Author

tsalo commented Jan 7, 2026

I don't know. They're very odd. I was thinking maybe they might be related to EPI high variance lines based on this video @handwerkerd sent me before the holidays: https://youtu.be/rl9vYLbCq34?si=NzTkyFExy_wLrY8_&t=950.

EDIT: Never mind. I looked at them with fsleyes and they look fine, so I think it's just a bug in plot_stat_map.

@tsalo
Copy link
Member Author

tsalo commented Jan 8, 2026

Okay here are better versions (I changed the resampling interpolation from linear to nearest neighbors):

T2* variance

t2s

S0 variance

s0

T2*-S0 covariance

covariance

@eurunuela
Copy link
Collaborator

These look great!

@tsalo tsalo merged commit d0c71ef into ME-ICA:main Jan 8, 2026
22 checks passed
eurunuela pushed a commit to eurunuela/tedana that referenced this pull request Jan 8, 2026
@tsalo tsalo deleted the t2star-variance branch January 8, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement issues describing possible enhancements to the project T2*/S0 estimation issues related to the estimation of T2* and S0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track and write out S0 and T2* estimate variance (and maybe covariance?) maps

2 participants