Skip to content

Commit 967038f

Browse files
committed
Merge branch 'enh/eddy' of https://github.com/mgxd/nipype into enh/eddy
2 parents 388259b + 5ee9170 commit 967038f

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

nipype/interfaces/fsl/epi.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,20 @@ class EddyInputSpec(FSLCommandInputSpec):
432432
desc='Detect and replace outlier slices')
433433
num_threads = traits.Int(1, usedefault=True, nohash=True,
434434
desc="Number of openmp threads to use")
435+
is_shelled = traits.Bool(False, argstr='--data_is_shelled',
436+
desc="Override internal check to ensure that "
437+
"date are acquired on a set of b-value "
438+
"shells")
439+
field = traits.Str(argstr='--field=%s',
440+
desc="NonTOPUP fieldmap scaled in Hz - filename has "
441+
"to be provided without an extension. TOPUP is "
442+
"strongly recommended")
443+
field_mat = File(exists=True, argstr='--field_mat=%s',
444+
desc="Matrix that specifies the relative locations of "
445+
"the field specified by --field and first volume "
446+
"in file --imain")
447+
use_gpu = traits.Str(desc="Run eddy using gpu, possible values are "
448+
"[openmp] or [cuda]")
435449

436450

437451
class EddyOutputSpec(TraitedSpec):
@@ -478,7 +492,8 @@ class Eddy(FSLCommand):
478492
def __init__(self, **inputs):
479493
super(Eddy, self).__init__(**inputs)
480494
self.inputs.on_trait_change(self._num_threads_update, 'num_threads')
481-
495+
if isdefined(self.inputs.use_gpu):
496+
self._use_gpu()
482497
if not isdefined(self.inputs.num_threads):
483498
self.inputs.num_threads = self._num_threads
484499
else:
@@ -493,6 +508,14 @@ def _num_threads_update(self):
493508
self.inputs.environ['OMP_NUM_THREADS'] = str(
494509
self.inputs.num_threads)
495510

511+
def _use_gpu(self):
512+
if self.inputs.use_gpu.lower().startswith('cuda'):
513+
_cmd = 'eddy_cuda'
514+
elif self.inputs.use_gpu.lower().startswith('openmp'):
515+
_cmd = 'eddy_openmp'
516+
else:
517+
_cmd = 'eddy'
518+
496519
def _format_arg(self, name, spec, value):
497520
if name == 'in_topup_fieldcoef':
498521
return spec.argstr % value.split('_fieldcoef')[0]

0 commit comments

Comments
 (0)