Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 1ac5307

Browse files
author
Adam Richie-Halford
committed
Use get_n_slices() instead of get_dim_info().
1 parent 367a57d commit 1ac5307

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

dmriprep/run.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ def num_outliers(scan, outliers):
407407
return len([d for d in outliers if d['scan'] == scan])
408408

409409
if 0 < threshold < 1:
410-
threshold *= nib.load(dwi_file).shape[2]
410+
img = nib.load(dwi_file)
411+
threshold *= img.shape[img.header.get_n_slices()]
411412

412413
drop_scans = np.array([
413414
s for s in scans
@@ -488,7 +489,9 @@ def drop_outliers_fn(in_file, in_bval, in_bvec, drop_scans):
488489

489490
img = nib.load(op.abspath(in_file))
490491
img_data = img.get_fdata()
491-
img_data_thinned = np.delete(img_data, drop_scans, axis=3)
492+
img_data_thinned = np.delete(img_data,
493+
drop_scans,
494+
axis=3)
492495
if isinstance(img, nib.nifti1.Nifti1Image):
493496
img_thinned = nib.Nifti1Image(img_data_thinned.astype(np.float64),
494497
img.affine,

0 commit comments

Comments
 (0)