Skip to content

Commit 0afbb81

Browse files
committed
[FIX] Set length to 1 when np.squeeze returns a 0D array
1 parent bc456dd commit 0afbb81

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

nipype/algorithms/misc.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,11 @@ def merge_rois(in_files, in_idxs, in_ref, dtype=None, out_file=None):
14951495
for d, fname in enumerate(nii):
14961496
data = np.asanyarray(nb.load(fname).dataobj).reshape(-1)
14971497
cdata = nb.load(cname).dataobj[..., d].reshape(-1)
1498-
nels = len(idxs)
1498+
try:
1499+
nels = len(idxs)
1500+
except TypeError:
1501+
nels = 1
1502+
14991503
idata = (idxs,)
15001504
data[idata] = cdata[0:nels]
15011505
nb.Nifti1Image(data.reshape(rsh[:3]), aff, hdr).to_filename(fname)

0 commit comments

Comments
 (0)