@@ -50,6 +50,11 @@ class ComputeDVARSInputSpec(BaseInterfaceInputSpec):
50
50
remove_zerovariance = traits .Bool (
51
51
True , usedefault = True , desc = "remove voxels with zero variance"
52
52
)
53
+ variance_tol = traits .Float (
54
+ 1e-7 ,
55
+ usedefault = True ,
56
+ desc = "maximum variance to consider \" close to\" zero for the purposes of removal" ,
57
+ )
53
58
save_std = traits .Bool (True , usedefault = True , desc = "save standardized DVARS" )
54
59
save_nstd = traits .Bool (False , usedefault = True , desc = "save non-standardized DVARS" )
55
60
save_vxstd = traits .Bool (
@@ -167,6 +172,7 @@ def _run_interface(self, runtime):
167
172
self .inputs .in_file ,
168
173
self .inputs .in_mask ,
169
174
remove_zerovariance = self .inputs .remove_zerovariance ,
175
+ variance_tol = self .inputs .variance_tol ,
170
176
intensity_normalization = self .inputs .intensity_normalization ,
171
177
)
172
178
@@ -995,7 +1001,11 @@ def _list_outputs(self):
995
1001
996
1002
997
1003
def compute_dvars (
998
- in_file , in_mask , remove_zerovariance = False , intensity_normalization = 1000
1004
+ in_file ,
1005
+ in_mask ,
1006
+ remove_zerovariance = False ,
1007
+ variance_tol = 0.0 ,
1008
+ intensity_normalization = 1000 ,
999
1009
):
1000
1010
"""
1001
1011
Compute the :abbr:`DVARS (D referring to temporal
@@ -1050,8 +1060,9 @@ def compute_dvars(
1050
1060
) / 1.349
1051
1061
1052
1062
if remove_zerovariance :
1053
- mfunc = mfunc [func_sd != 0 , :]
1054
- func_sd = func_sd [func_sd != 0 ]
1063
+ zero_variance_voxels = func_sd > self .inputs .variance_tol
1064
+ mfunc = mfunc [zero_variance_voxels , :]
1065
+ func_sd = func_sd [zero_variance_voxels ]
1055
1066
1056
1067
# Compute (non-robust) estimate of lag-1 autocorrelation
1057
1068
ar1 = np .apply_along_axis (
0 commit comments