Exemplo n.º 1
0
def test_fitmsparams(create_files_in_directory):
    filelist, outdir = create_files_in_directory

    fit = freesurfer.FitMSParams()

    # make sure command gets called
    assert fit.cmd == "mri_ms_fitparms"

    # test raising error with mandatory args absent
    with pytest.raises(ValueError):
        fit.run()

    # .inputs based parameters setting
    fit.inputs.in_files = filelist
    fit.inputs.out_dir = outdir
    assert fit.cmdline == "mri_ms_fitparms  %s %s %s" % (
        filelist[0],
        filelist[1],
        outdir,
    )

    # constructor based parameter setting
    fit2 = freesurfer.FitMSParams(in_files=filelist,
                                  te_list=[1.5, 3.5],
                                  flip_list=[20, 30],
                                  out_dir=outdir)
    assert fit2.cmdline == (
        "mri_ms_fitparms  -te %.3f -fa %.1f %s -te %.3f -fa %.1f %s %s" %
        (1.500, 20.0, filelist[0], 3.500, 30.0, filelist[1], outdir))
Exemplo n.º 2
0
def test_fitmsparams():
    filelist, outdir, cwd = create_files_in_directory()

    fit = freesurfer.FitMSParams()

    # make sure command gets called
    yield assert_equal, fit.cmd, 'mri_ms_fitparms'

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

    # .inputs based parameters setting
    fit.inputs.in_files = filelist
    fit.inputs.out_dir = outdir
    yield assert_equal, fit.cmdline, 'mri_ms_fitparms  %s %s %s' % (
        filelist[0], filelist[1], outdir)

    # constructor based parameter setting
    fit2 = freesurfer.FitMSParams(in_files=filelist,
                                  te_list=[1.5, 3.5],
                                  flip_list=[20, 30],
                                  out_dir=outdir)
    yield assert_equal, fit2.cmdline, (
        'mri_ms_fitparms  -te %.3f -fa %.1f %s -te %.3f -fa %.1f %s %s' %
        (1.500, 20.0, filelist[0], 3.500, 30.0, filelist[1], outdir))

    clean_directory(outdir, cwd)