Skip to content

Commit b7077c0

Browse files
authored
Use continuous TPM-based procedure to calculate aCompCor masks (#3589)
Cloes #3587. ## Changes proposed in this pull request - Assume that anatomical TPMs come from FAST and not Freesurfer's aseg output, since sMRIPrep always uses FAST. This means setting `freesurfer` to False in `init_bold_confs_wf`. - Update boilerplate in `init_bold_confs_wf` to reflect changes and what is actually happening.
2 parents bf7d4c4 + 5431fc7 commit b7077c0

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

fmriprep/interfaces/confounds.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def _run_interface(self, runtime):
8383
from ..utils.confounds import acompcor_masks
8484

8585
self._results['out_masks'] = acompcor_masks(
86-
self.inputs.in_vfs,
87-
self.inputs.is_aseg,
88-
self.inputs.bold_zooms,
86+
in_files=self.inputs.in_vfs,
87+
is_aseg=self.inputs.is_aseg,
88+
zooms=self.inputs.bold_zooms,
8989
)
9090
return runtime
9191

fmriprep/utils/confounds.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ def acompcor_masks(in_files, is_aseg=False, zooms=None):
9494
9595
* the masks are prepared in high-resolution, anatomical space and then
9696
projected into BOLD space; and,
97-
* instead of using binary erosion, a dilated GM map is generated -- thresholding
98-
the corresponding PV map at 0.05 (i.e., pixels containing at least 5% of GM tissue)
97+
* instead of using binary erosion, a dilated GM map is generated after thresholding
98+
the corresponding PV map at >0.05 (i.e., pixels containing more than 5% of GM tissue)
9999
and then subtracting that map from the CSF, WM and CSF+WM (combined) masks.
100100
This should be equivalent to eroding the masks, except that the erosion
101101
only happens at direct interfaces with GM.

fmriprep/workflows/bold/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ def init_bold_wf(
775775
bold_confounds_wf = init_bold_confs_wf(
776776
mem_gb=mem_gb['largemem'],
777777
metadata=all_metadata[0],
778-
freesurfer=config.workflow.run_reconall,
778+
freesurfer=False, # sMRIPrep always uses FAST for TPMs
779779
regressors_all_comps=config.workflow.regressors_all_comps,
780780
regressors_fd_th=config.workflow.regressors_fd_th,
781781
regressors_dvars_th=config.workflow.regressors_dvars_th,

fmriprep/workflows/bold/confounds.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def init_bold_confs_wf(
116116
freesurfer : :obj:`bool`
117117
Set to ``True`` if the input volume fractions for the anatomical
118118
component-based noise correction maps come from FreeSurfer's ``aseg``.
119+
sMRIPrep always uses FAST for tissue probability maps, so we always set this to False.
119120
name : :obj:`str`
120121
Name of workflow (default: ``bold_confs_wf``)
121122
@@ -171,7 +172,10 @@ def init_bold_confs_wf(
171172
gm_desc = (
172173
"dilating a GM mask extracted from the FreeSurfer's *aseg* segmentation"
173174
if freesurfer
174-
else 'thresholding the corresponding partial volume map at 0.05'
175+
else (
176+
'thresholding the corresponding partial volume map at 0.05 and then '
177+
'dilating the mask by 3 voxels'
178+
)
175179
)
176180

177181
workflow = Workflow(name=name)
@@ -196,10 +200,10 @@ def init_bold_confs_wf(
196200
voxels within the brain mask.
197201
For aCompCor, three probabilistic masks (CSF, WM and combined CSF+WM)
198202
are generated in anatomical space.
199-
The implementation differs from that of Behzadi et al. in that instead
203+
The implementation differs from that of Behzadi et al. in that, instead
200204
of eroding the masks by 2 pixels on BOLD space, a mask of pixels that
201205
likely contain a volume fraction of GM is subtracted from the aCompCor masks.
202-
This mask is obtained by {gm_desc}, and it ensures components are not extracted
206+
This mask is obtained by {gm_desc}, and it ensures that components are not extracted
203207
from voxels containing a minimal fraction of GM.
204208
Finally, these masks are resampled into BOLD space and binarized by
205209
thresholding at 0.99 (as in the original implementation).

0 commit comments

Comments
 (0)