def test_dtifit2(): filelist, outdir, cwd = create_files_in_directory() dti = fsl.DTIFit() # make sure command gets called yield assert_equal, dti.cmd, 'dtifit' # test raising error with mandatory args absent yield assert_raises, ValueError, dti.run # .inputs based parameters setting dti.inputs.dwi = filelist[0] dti.inputs.base_name = 'foo.dti.nii' dti.inputs.mask = filelist[1] dti.inputs.bvecs = filelist[0] dti.inputs.bvals = filelist[1] dti.inputs.min_z = 10 dti.inputs.max_z = 50 yield assert_equal, dti.cmdline, \ 'dtifit -k %s -o foo.dti.nii -m %s -r %s -b %s -Z 50 -z 10'%(filelist[0], filelist[1], filelist[0], filelist[1]) clean_directory(outdir, cwd)
def test_dtifit2(create_files_in_directory): filelist, outdir = create_files_in_directory dti = fsl.DTIFit() # make sure command gets called assert dti.cmd == "dtifit" # test raising error with mandatory args absent with pytest.raises(ValueError): dti.run() # .inputs based parameters setting dti.inputs.dwi = filelist[0] dti.inputs.base_name = "foo.dti.nii" dti.inputs.mask = filelist[1] dti.inputs.bvecs = filelist[0] dti.inputs.bvals = filelist[1] dti.inputs.min_z = 10 dti.inputs.max_z = 50 assert (dti.cmdline == "dtifit -k %s -o foo.dti.nii -m %s -r %s -b %s -Z 50 -z 10" % (filelist[0], filelist[1], filelist[0], filelist[1]))
def test_dtifit1(): input_map = dict( args=dict(argstr='%s', ), base_name=dict(argstr='-o %s', ), bvals=dict( argstr='-b %s', mandatory=True, ), bvecs=dict( argstr='-r %s', mandatory=True, ), cni=dict(argstr='-cni %s', ), dwi=dict( argstr='-k %s', mandatory=True, ), environ=dict(), little_bit=dict(argstr='--littlebit', ), mask=dict( argstr='-m %s', mandatory=True, ), max_x=dict(argstr='-X %d', ), max_y=dict(argstr='-Y %d', ), max_z=dict(argstr='-Z %d', ), min_x=dict(argstr='-x %d', ), min_y=dict(argstr='-y %d', ), min_z=dict(argstr='-z %d', ), output_type=dict(), save_tensor=dict(argstr='--save_tensor', ), sse=dict(argstr='--sse', ), ) instance = fsl.DTIFit() for key, metadata in input_map.items(): for metakey, value in metadata.items(): yield assert_equal, getattr(instance.inputs.traits()[key], metakey), value