Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Dilate BOLD mask by 2 voxels to prevent over-aggressive masking degrading T2* map estimation #2986

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

effigies
Copy link
Member

Changes proposed in this pull request

Dilates BOLD mask by two voxels before passing to tedana's t2smap command. This accounts for BOLD masking sometimes being overly aggressive. Tedana is tolerant of a relaxed mask, so this is cheaper than attempting to rework mask generation to cover more cases without becoming worse in others.

Could consider dilating by more voxels to reduce the odds of clipping further.

Documentation that should be reviewed

@effigies effigies requested review from tsalo and madisoth April 10, 2023 15:32
@effigies effigies changed the title FIX: Dilate BOLD mask by 2 voxels to allow for over-aggressive masking FIX: Dilate BOLD mask by 2 voxels to prevent over-aggressive masking degrading T2* map estimation Apr 11, 2023
@effigies
Copy link
Member Author

Just to pull the conversation from Mattermost (@'ing folks for due credit; feel free to unsubscribe if you don't want to participate in this conversation further):


@effigies: Here's a question: How sensitive is t2smap to the BOLD mask? We're running into issues with over-aggressive masking on some BOLD files, and our options are either to create an ever-more-baroque masking algorithm or just accept that masks might be a bit aggressive and dilate them before passing to the T2* workflow. I see it's optional, so I'm hopeful it's just a matter of efficiency to relax the mask.

@tsalo: Having a mask ahead of time reduces the problem, but the adaptive masking procedure can be really wonky. It can definitely be over-aggressive, but no one has been able to come up with a reasonable alternative.

@effigies: Just to make sure I'm understanding... the over-aggressive mask I'm talking about is pre-tedana. Would it be safe to use a dilated mask without changing the behavior of tedana, or would that require us to use tedana's adaptive masking?

@tsalo: Oh... I thought you were referring to how tedana creates its adaptive mask. There's no way to disable adaptive masking, so there's always a chance that the mask that you feed into tedana will be over-aggressively reduced by the adaptive masking process, in which case you'll end up with an over-aggressively masked optimally combined file. Feeding a dilated mask into t2smap sounds like a reasonable workaround to me, but there's no guarantee that the adaptive mask won't still reduce the mask more than you want, unfortunately.

@handwerkerd: I think our automasking can be aggressive and a bit quirky, but the adaptive masking is not. I can double check, but the adaptive masking will only remove voxels with a large magnitude drop for later echoes. Also t2smap should include all voxels with at least 1 good echo, which would be all voxels in the originally supplied mask. You can confirm this by supplying a mask and then looking at the t2smap and the adaptive mask. Any value in the supplied mask should be at least a 1 in the adaptive mask and also have data in the t2smap.

@effigies: Thanks, Dan. Does that mean that providing a dilated mask will produce spurious results outside the "true" mask? Would it be better not to provide a mask at all?

@handwerkerd I think that depends on what else you are doing with the data. The ICA denoising part of tedana really needs a reasonably accurate brain main since out-of-brain noisy voxels can mess up out ICA separates the data into components. If you just care about the t2smap and the "optimally combined" image then you'll just have data outside of the brain, and noisy out-of-brain voxels will just continue to be noisy out-of-brain voxels.


We generally avoid applying masks to derivatives, instead just calculating them and using them internally when needed. So noisy out-of-brain voxels in the fMRIPrep outputs are fine from the fMRIPrep perspective, but I don't really understand the tedana use-case enough to be sure that this won't cause some problem somewhere.

cc @madisoth

@effigies effigies merged commit 5d36a6f into nipreps:master Apr 26, 2023
@effigies effigies deleted the enh/dilate-pre-tedana branch April 26, 2023 18:16
@handwerkerd
Copy link

To answer your last question, the critical need for a mask in tedana is to only run ICA on voxels with good data. ICA can give problematic components if a significant portion of the total variance is from voxels with out-of-brain artifacts. The denoising step is a simple linear regression of the ICA component time series so that regression could be applied to fully unmasked data.

effigies added a commit that referenced this pull request Jun 12, 2023
23.1.0 (June 12, 2023)

New feature release in the 23.1.x series.

This release substantially reworks the resampling to fsLR grayordinate space,
better accounting for partial volumes and high variance voxels. If you are
resampling using ``--project-goodvoxels``, we strongly recommend upgrading.

Fieldmap handling is improved, with better preference given to single-band
references in both PEPolar and SyN-SDC schemes. Additionally, fMRIPrep will
no longer estimate fieldmaps that are not intended to be used to correct BOLD
series, reducing unneeded processing.

This release removes ICA-AROMA from the fMRIPrep workflow. To use ICA-AROMA,
set ``MNI152NLin6Asym:res-2`` as a target output space. MELODIC and ICA-AROMA
can be run on the resulting images in a separate pipeline. For further
information on the reasoning behind this change, see
`GitHub issue #2936 <https://github.com/nipreps/fmriprep/issues/2936>`__.

This release increments the versions of ANTs and FSL bundled in the Docker
image.

With thanks to Eilidh MacNicol, Basille Pinsard and Taylor Salo for contributions
in fMRIPrep and SDCflows.

* FIX: Raise RuntimeError at build if echos have mismatched shapes (#3028)
* FIX: Inconsistent fmapless estimation when ignoring fieldmaps (#2994)
* FIX: Dilate BOLD mask by 2 voxels to prevent over-aggressive masking degrading T2* map estimation (#2986)
* FIX: Estimate free memory with "available", not "free" (#2985)
* ENH: Add ``--me-t2s-fit-method`` parameter (#3030)
* ENH: Resample BOLD to fsLR directly, dropping fsaverage intermediate (#3011)
* ENH: Allow SBref+EPI PEPolar fieldmaps to correct BOLD series (#3008)
* ENH: Remove ICA-AROMA from workflow and docs (#2966)
* RF: Filter fieldmaps based on whether they will be used to correct a BOLD series (#3025)
* MNT: Update ANTs pin in Docker image (#3016)
* MNT: Update governance docs (#2992)
* MNT: Refactor Docker build process (#2982)
* MNT: Pin conda environment more strictly (#2853)
* MNT: Require niworkflows ~1.3.6 (#2740)
* CI: Use registry for layer caching (#3012)
* CI: Upgrade docker orb (#2865)
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