From 3e998d0ccfa0a89237a66f7d7f073f87b96729d4 Mon Sep 17 00:00:00 2001 From: Siddhartha Dhiman Date: Wed, 26 Feb 2020 15:19:30 -0500 Subject: [PATCH] Minor bugfix for mask flag in NeuroDock (#169) * Update all Docker scripts (#161) * Disable generation of segmented brain Using the `-n` flag someone broke `bet` in Docker probably due to a virtual mount. This flag for `bet` has been removed and replaced by an `os.remove` to manually delete this segmented brain. --- designer/preprocessing/mrpreproc.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/designer/preprocessing/mrpreproc.py b/designer/preprocessing/mrpreproc.py index 20d187e9..a6e9de10 100644 --- a/designer/preprocessing/mrpreproc.py +++ b/designer/preprocessing/mrpreproc.py @@ -384,6 +384,7 @@ def brainmask(input, output, thresh=0.25, nthreads=None, force=False, B0_mean = op.join(outdir, 'B0_mean.nii') B0_nan = op.join(outdir, 'B0.nii') mask = op.join(outdir, 'brain') + tmp_brain = op.join(outdir, 'brain.nii') # Extract B0 from DWI arg_b0_all = ['dwiextract'] if force: @@ -412,7 +413,7 @@ def brainmask(input, output, thresh=0.25, nthreads=None, force=False, raise Exception('Unable to remove NaN from B0 for the ' 'computation of brain mask. See above for errors.') # Compute brain mask from - arg_mask = ['bet', B0_nan, mask, '-n', '-m', '-f', str(thresh)] + arg_mask = ['bet', B0_nan, mask, '-m', '-f', str(thresh)] completion = subprocess.run(arg_mask) if completion.returncode != 0: raise Exception('Unable to compute brain mask from B0. See above ' @@ -420,6 +421,7 @@ def brainmask(input, output, thresh=0.25, nthreads=None, force=False, # Remove intermediary file os.remove(B0_all) os.remove(B0_mean) + os.remove(tmp_brain) os.rename(op.join(outdir, mask + '_mask.nii'), output) def smooth(input, output, fwhm=1.25):