Skip to content

Commit 985d4e3

Browse files
committed
remove intermediate image save, fix var name
1 parent 323aa8f commit 985d4e3

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

nipype/algorithms/confounds.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,6 @@ def compute_dvars(in_file, in_mask, remove_zerovariance=False):
323323
np.percentile(func, 25, axis=3)) / 1.349
324324
func_sd[mask <= 0] = 0
325325

326-
# ar1_img = np.zeros_like(func_sd)
327-
# ar1_img[idx] = diff_SDhat
328-
nb.Nifti1Image(func_sd, nb.load(in_mask).get_affine()).to_filename('func_sd.nii.gz')
329-
330-
331326
if remove_zerovariance:
332327
# Remove zero-variance voxels across time axis
333328
mask = zero_variance(func, mask)
@@ -342,8 +337,8 @@ def compute_dvars(in_file, in_mask, remove_zerovariance=False):
342337
ar1 = np.apply_along_axis(AR_est_YW, 1, mfunc, 1)[:, 0]
343338

344339
# Compute (predicted) standard deviation of temporal difference time series
345-
diff_SDhat = np.squeeze(np.sqrt(((1 - ar1) * 2).tolist())) * func_sd[mask > 0].reshape(-1)
346-
diff_sd_mean = diff_SDhat.mean()
340+
diff_sdhat = np.squeeze(np.sqrt(((1 - ar1) * 2).tolist())) * func_sd[mask > 0].reshape(-1)
341+
diff_sd_mean = diff_sdhat.mean()
347342

348343
# Compute temporal difference time series
349344
func_diff = np.diff(mfunc, axis=1)
@@ -355,7 +350,7 @@ def compute_dvars(in_file, in_mask, remove_zerovariance=False):
355350
dvars_stdz = dvars_nstd / diff_sd_mean
356351

357352
# voxelwise standardization
358-
diff_vx_stdz = func_diff / np.array([diff_SDhat] * func_diff.shape[-1]).T
353+
diff_vx_stdz = func_diff / np.array([diff_sdhat] * func_diff.shape[-1]).T
359354
dvars_vx_stdz = diff_vx_stdz.std(axis=0, ddof=1)
360355

361356
return (dvars_stdz, dvars_nstd, dvars_vx_stdz)

0 commit comments

Comments
 (0)