From e17b4e67e9c4c7073cb3d2812649ef40efa97bf3 Mon Sep 17 00:00:00 2001 From: Michael Hanke Date: Fri, 6 Nov 2015 14:05:19 +0100 Subject: [PATCH] Adjust expected bvecs/bvals filenames for the Philips DWI case dcm2nii removes a DWI volume and prefixes with 'x' accordingly. --- nipype/interfaces/dcm2nii.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index 2e604af121..b78d925517 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -124,6 +124,13 @@ def _parse_stdout(self, stdout): base, filename, ext = split_filename(last_added_file) bvecs.append(os.path.join(base, filename + ".bvec")) bvals.append(os.path.join(base, filename + ".bval")) + elif line.startswith("Removed DWI from DTI scan"): + # such line can only follow the 'diffusion' case handled + # just above + for l in (bvecs, bvals): + l[-1] = os.path.join( + os.path.dirname(l[-1]), + 'x%s' % (os.path.basename(l[-1]),)) elif re.search('.*->(.*)', line): val = re.search('.*->(.*)', line) val = val.groups()[0]