Skip to content

Commit

Permalink
Minor bugfix for mask flag in NeuroDock (#169)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
TheJaeger authored Feb 26, 2020
1 parent fb28cf5 commit 3e998d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion designer/preprocessing/mrpreproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -412,14 +413,15 @@ 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 '
'for errors')
# 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):
Expand Down

0 comments on commit 3e998d0

Please sign in to comment.