Пример #1
0
def test_bedpostx2():
    filelist, outdir, cwd = create_files_in_directory()
    bpx = fsl.BEDPOSTX()

    # make sure command gets called
    yield assert_equal, bpx.cmd, 'bedpostx'

    # test raising error with mandatory args absent
    yield assert_raises, ValueError, bpx.run

    # .inputs based parameters setting
    bpx2 = fsl.BEDPOSTX()
    bpx2.inputs.mask = example_data('mask.nii')
    bpx2.inputs.dwi = example_data('diffusion.nii')
    bpx2.inputs.bvals = example_data('bvals')
    bpx2.inputs.bvecs = example_data('bvecs')
    bpx2.inputs.fibres = 2
    bpx2.inputs.weight = 0.3
    bpx2.inputs.burn_period = 200
    bpx2.inputs.jumps = 500
    bpx2.inputs.sampling = 20
    actualCmdline = sorted(bpx2.cmdline.split())
    cmd = 'bedpostx bedpostx -b 200 -n 2 -j 500 -s 20 -w 0.30'
    desiredCmdline = sorted(cmd.split())
    yield assert_equal, actualCmdline, desiredCmdline
Пример #2
0
def test_bedpostx1():
    input_map = dict(args = dict(argstr='%s',),
                     bpx_directory = dict(argstr='%s',),
                     burn_period = dict(argstr='-b %d',),
                     bvals = dict(mandatory=True,),
                     bvecs = dict(mandatory=True,),
                     dwi = dict(mandatory=True,),
                     environ = dict(),
                     fibres = dict(argstr='-n %d',),
                     jumps = dict(argstr='-j %d',),
                     mask = dict(mandatory=True,),
                     output_type = dict(),
                     sampling = dict(argstr='-s %d',),
                     weight = dict(argstr='-w %.2f',),
                     )
    instance = fsl.BEDPOSTX()
    for key, metadata in input_map.items():
        for metakey, value in metadata.items():
            yield assert_equal, getattr(instance.inputs.traits()[key], metakey), value