Skip to content

Commit c19143e

Browse files
Update dcm2nii.py
1 parent 682abac commit c19143e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

nipype/interfaces/dcm2nii.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def _parse_files(self, filenames):
469469

470470
for filename in filenames:
471471
# search for relevant files, and sort accordingly
472-
for fl in search_files(filename, outtypes):
472+
for fl in search_files(filename, outtypes, self.inputs.crop):
473473
if (
474474
fl.endswith(".nii")
475475
or fl.endswith(".gz")
@@ -502,7 +502,13 @@ def _list_outputs(self):
502502

503503

504504
# https://stackoverflow.com/a/4829130
505-
def search_files(prefix, outtypes):
506-
return it.chain.from_iterable(
505+
def search_files(prefix, outtypes, search_crop):
506+
found = it.chain.from_iterable(
507507
iglob(glob.escape(prefix + outtype)) for outtype in outtypes
508508
)
509+
if search_crop:
510+
found = it.chain(
511+
it.chain.from_iterable(iglob(glob.escape(prefix) + "_Crop_*" + outtype) for outtype in outtypes),
512+
found
513+
)
514+
return found

0 commit comments

Comments
 (0)