Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions nipype/interfaces/dcm2nii.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def _parse_files(self, filenames):

for filename in filenames:
# search for relevant files, and sort accordingly
for fl in search_files(filename, outtypes):
for fl in search_files(filename, outtypes, self.inputs.crop):
if (
fl.endswith(".nii")
or fl.endswith(".gz")
Expand Down Expand Up @@ -503,7 +503,15 @@ def _list_outputs(self):


# https://stackoverflow.com/a/4829130
def search_files(prefix, outtypes):
return it.chain.from_iterable(
def search_files(prefix, outtypes, search_crop):
found = it.chain.from_iterable(
iglob(glob.escape(prefix + outtype)) for outtype in outtypes
)
if search_crop:
found = it.chain(
it.chain.from_iterable(
iglob(glob.escape(prefix) + "_Crop_*" + outtype) for outtype in outtypes
),
found,
)
return found