From b480baa81128c861e7f8a34fd938e919d03547a4 Mon Sep 17 00:00:00 2001 From: Siddhartha Dhiman Date: Fri, 18 Oct 2019 19:25:30 -0400 Subject: [PATCH] Expands reason for concatenation failure --- designer/preprocessing/util.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/designer/preprocessing/util.py b/designer/preprocessing/util.py index 5300c02f..d6d4ddc5 100644 --- a/designer/preprocessing/util.py +++ b/designer/preprocessing/util.py @@ -434,10 +434,13 @@ def cat(self, path, ext='.nii' ,verbose=False, force=False): cmd = ' '.join(str(e) for e in convert_args) completion = subprocess.run(cmd, shell=True) if completion.returncode != 0: - raise Exception('Conversion to ' + ext + ' failed. Please ' - 'ensure that your input NifTi files have ' - 'the same phase encoding directions, and ' - 'are accompanied by valid .bval, .bvec, ' + for i, fname in enumerate(miflist): + os.remove(fname) + os.remove(op.join(path, 'raw_dwi' + ext)) + raise Exception('Concatenation to ' + str(ext) + 'failed. ' + 'Please ensure that your input NifTi files ' + 'have the same phase encoding directions, ' + 'and are accompanied by valid .bval, .bvec, ' 'and .json. If this is not possible, ' 'please provide manually concatenated ' 'DWIs or run with single series input.')