Commit 748d17e
committed
fix(compcor): refactor of CompCor masks
This commit revises the implementation of CompCor masks
in an attempt to make it closer to the original proposal
and at the same time address some recurring problems of
*fMRIPrep*'s tCompCor implementation.
Finally, with the more careful resampling of prior knowledge
from the anatomical scan, this refactor should also make
the aCompCor components more run-to-run repeatable.
aCompCor
--------
The massaging of CompCor masks is now done in anatomical
space where it is more precise, and a careful resampling
to BOLD space follows.
The implementation deviates from Behzadi et al.
Their original implementation thresholded the CSF and the WM partial-volume
masks at 0.99 (i.e., 99% of the voxel volume is filled with a particular tissue),
and then binary eroded that 2 voxels:
> Anatomical data were segmented into gray matter, white matter,
> and CSF partial volume maps using the FAST algorithm available
> in the FSL software package (Smith et al., 2004). Tissue partial
> volume maps were linearly interpolated to the resolution of the
> functional data series using AFNI (Cox, 1996). In order to form
> white matter ROIs, the white matter partial volume maps were
> thresholded at a partial volume fraction of 0.99 and then eroded by
> two voxels in each direction to further minimize partial voluming
> with gray matter. CSF voxels were determined by first thresholding
> the CSF partial volume maps at 0.99 and then applying a threedimensional
> nearest neighbor criteria to minimize multiple tissue
> partial voluming. Since CSF regions are typically small compared
> to white matter regions mask, erosion was not applied.
This particular procedure is not generalizable to BOLD data with different voxel zooms
as the mathematical morphology operations will be scaled by those.
Also, from reading the excerpt above and the tCompCor description, I (@oesteban)
believe that they always operated slice-wise given the large slice-thickness of
their functional data.
Instead, *fMRIPrep*'s implementation deviates from Behzadi's implementation on two
aspects:
* the masks are prepared in high-resolution, anatomical space and then
projected into BOLD space; and,
* instead of using binary erosion, a dilated GM map is generated -- thresholding
the corresponding PV map at 0.05 (i.e., pixels containing at least 5% of GM tissue)
and then subtracting that map from the CSF, WM and CSF+WM (combined) masks.
This should be equivalent to eroding the masks, except that the erosion
only happens at direct interfaces with GM.
When the probseg maps provene from FreeSurfer's ``recon-all`` (i.e., they are
discrete), binary maps are *transformed* into some sort of partial volume maps
by means of a Gaussian smoothing filter with sigma adjusted by the size of the
BOLD data.
tCompCor
--------
In the case of *tCompCor*, this commit removes the heavy erosion of the brain
mask because 1) that wasn't part of the original proposal by Behzadi et al.,
and 2) the erosion was the potential source of errors from numpy complaining
that it can't take from an empty axis of an array.
> Based on these results, we chose a 2% threshold
> (∼20–30 voxels per slice) as a reasonable empirical
> threshold that effectively identified voxels with
> the highest fractional variance of physiological noise.
Although they do the calculation slice-wise, this commit rolls tCompCor back to
calculate the 2% threshold on the whole brain mask.
Resolves: #2129.
References: #2052.1 parent 8480eab commit 748d17e
File tree
4 files changed
+241
-118
lines changed- fmriprep
- interfaces
- utils
- workflows/bold
4 files changed
+241
-118
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
27 | 56 | | |
28 | 57 | | |
29 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
350 | 351 | | |
351 | 352 | | |
352 | 353 | | |
| |||
0 commit comments