예제 #1
0
def test_RetroTS_basic(data, vol_tr, python_interpreter):
    seedval = 31416

    kwargs_log = {
        "append_to_ignored": ["Clock time", "but max simulated alpha="]
    }

    out_prefix = data.outdir / f"reg.01.a.{vol_tr}"
    cmd = """
    RetroTS.py
        -c {data.ECG_epiRTslt_scan_4}
        -r {data.Resp_epiRTslt_scan_4}
        -v {vol_tr}
        -p 50
        -n 30
        -prefix {out_prefix}
    """

    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(
        data,
        cmd,
        python_interpreter=python_interpreter,
        kwargs_1d={"all_close_kwargs": {
            "rtol": 0.15
        }},
        # kwargs_log=kwargs_log,
        # add_env_vars=add_env_vars,
    )
    differ.run(timeout=None)
예제 #2
0
def test_3dSliceNDice(data, ptaylor_env):
    opref = data.outdir / "o.3dSliceNDice"
    # make masks first
    cmd = f"""
        3dcalc
            -echo_edu
            -a {data.SOME_ICA_NETS_in_DWI}'[0]'
            -b {data.mask_DWI}
            -expr 'step(b)*(step(a-3)+step(-3-a))'
            -prefix {opref}_preA.nii.gz;
        3dcalc
            -echo_edu
            -a {data.SOME_ICA_NETS_in_DWI}'[1]'
            -b {data.mask_DWI}
            -expr 'step(b)*(step(a-3)+step(-3-a))'
            -prefix {opref}_preB.nii.gz;

        3dSliceNDice
            -echo_edu
            -out_domain all
            -insetA {opref}_preA.nii.gz
            -insetB {opref}_preB.nii.gz
            -prefix {opref}
        """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(
        data,
        cmd,
    )
    differ.run(timeout=60)
예제 #3
0
def test_3dClustSim_basic(data, add_env_vars):
    seedval = 31416

    kwargs_log = {
        "append_to_ignored": ["Clock time", "but max simulated alpha="]
    }

    outfile_prefix = data.outdir / "clust_sim_out"
    cmd = """
    3dClustSim
        -nxyz 16 8 4
        -dxyz 3 3 3
        -BALL
        -acf 0.7 3 3
        -LOTS
        -seed {seedval}
        -prefix {outfile_prefix}
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(
        data,
        cmd,
        kwargs_1d={"all_close_kwargs": {
            "rtol": 0.15
        }},
        kwargs_log=kwargs_log,
        add_env_vars=add_env_vars,
    )
    differ.run(timeout=60)
예제 #4
0
def test_RetroTS_bids_custom_slice_order(data, vol_tr, python_interpreter):
    seedval = 31416

    kwargs_log = {
        "append_to_ignored": ["Clock time", "but max simulated alpha="]
    }

    out_prefix = data.outdir / f"reg.02.a.{vol_tr}"
    cmd = """
    RetroTS.py
        -phys_file {data.epiRTslt_scan_4_bids}
        -v {vol_tr}
        -n 1
        -p 50
        -slice_order custom
        -slice_offset [1000]
        -prefix {out_prefix}
    """

    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(
        data,
        cmd,
        python_interpreter=python_interpreter,
        kwargs_1d={"all_close_kwargs": {
            "rtol": 0.15
        }},
        # kwargs_log=kwargs_log,
        # add_env_vars=add_env_vars,
    )
    differ.run(timeout=None)
예제 #5
0
def test_3dAllineate_basic(data, python_interpreter):
    outname = "aligned"
    if OMP:
        outname += "_with_omp"
    outfile = data.outdir / (outname + ".nii.gz")
    out_1d = outfile.parent / (outfile.stem.split(".")[0] + ".1D")

    cmd = """
    3dAllineate
        -base {data.anat1}
        -source {data.epi}'[0]'
        -prefix {outfile}
        -1Dparam_save {out_1d}
        -maxrot 2
        -maxshf 1
        -nmatch 20
        -conv 2
        -cost lpc
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(
        data,
        cmd,
        python_interpreter=python_interpreter,
        kwargs_log={
            "append_to_ignored": [
                "Output dataset",
                "++ Wrote -1Dparam_save",
                "total CPU time",
            ]
        },
    )
    differ.run()
예제 #6
0
def test_3dTproject_basic(data, add_env_vars):
    kwargs_log = {"append_to_ignored": ["clock time", "OpenMP"]}
    kwargs_scans = {"data_kwargs": {"atol": 0.0001}}

    outfile = data.outdir / "out.nii.gz"
    cmd = """
    3dTproject
        -input {data.epi}
        -prefix {outfile}
        -polort 2
        -passband 0.01 0.1
        -automask
        -dt 2.0
        -blur 2.0
        -norm
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(
        data,
        cmd,
        kwargs_log=kwargs_log,
        kwargs_scans=kwargs_scans,
        add_env_vars=add_env_vars,
    )
    differ.run()
예제 #7
0
def test_3dDWUncert(data, ptaylor_env):
    opref = data.outdir / "o.3dDWUncert"
    cmd = f"""
    3dDWUncert
        -echo_edu
        -inset {data.AVEB0_DWI}
        -mask {data.mask_DWI}
        -pt_choose_seed 5
        -prefix {opref}
        -input {data.tests_data_dir / fatdir2}/DT
        -bmatrix_FULL {data.grad_BMAT}
        -iters 10

    """
    cmd = " ".join(cmd.split())

    differ = tools.OutputDiffer(
        data,
        cmd,
        kwargs_log={
            "append_to_ignored": [" min", "Nvox progress proxy count"]
        },
    )

    differ.run(timeout=60)
예제 #8
0
파일: test_3dcopy.py 프로젝트: pab2163/afni
def test_3dcopy_basic(data):
    outfile = data.outdir / "copied.nii.gz"
    cmd = """
    3dcopy {data.anatomical} {outfile}
    """
    cmd = " ".join(cmd.format(**locals()).split())
    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #9
0
def test_3dSkullStrip_basic(data, dset_name):
    ifile = getattr(data, dset_name)
    ofile = data.outdir / "out_ss.nii.gz"
    cmd = """3dSkullStrip -prefix {ofile} -input {ifile}"""
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #10
0
def test_3dCM_basic(data):
    cmd = """
    3dCM
        {data.anat}
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #11
0
def test_3dAutomask_basic(data):

    outfile_prefix = data.outdir / ("masked_image.nii.gz")
    cmd = """
    3dAutomask -prefix {outfile_prefix} {data.anat}
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #12
0
def test_3dcalc_basic(data):
    outfile = data.outdir / "outside_brain.nii.gz"
    cmd = """
    3dcalc -a {data.anatomical} -b {data.no_skull} -expr 'a*not(b)' -prefix {outfile}
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(
        data, cmd, kwargs_log={"append_to_ignored": ["Output dataset"]})
    differ.run()
예제 #13
0
def test_3dTcat_basic(data):

    outfile = data.outdir / "out.nii.gz"

    cmd = """
    3dTcat -prefix {outfile} {data.epi}'[150..$]'
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #14
0
def test_3dRSFC(data, ptaylor_env):
    opref = data.outdir / "o.3dRSFC"
    cmd = f"""
    3dRSFC
        -echo_edu
        -input {data.mini_REST_proc_unfilt}
        -prefix {opref}
        -band 0.01 0.1
    """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #15
0
def test_3dEigsToDT(data, ptaylor_env):
    opref = data.outdir / "o.3dEigsToDT"
    cmd = f"""
    3dEigsToDT
    -echo_edu
    -eig_vals '{data.tests_data_dir / fatdir2}/DT_L*'
    -eig_vecs '{data.tests_data_dir / fatdir2}/DT_V*'
    -prefix {opref}
    """
    cmd = " ".join(cmd.split())

    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #16
0
def test_3dReHo(data, ptaylor_env):
    opref = data.outdir / "o.3dReHo"

    cmd = f"""
    3dReHo
        -echo_edu
        -inset {data.mini_REST_proc_unfilt}'[0..45]'
        -nneigh 7
        -prefix {opref}
    """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #17
0
def test_3dLombScargle(data, ptaylor_env):
    olsamp = data.outdir / "o.3dLombScargle"
    cmd = f"""
    3dLombScargle
        -echo_edu
        -nifti
        -inset {data.mini_REST_proc_unfilt}
        -prefix {olsamp}
        -censor_str '[0..3,5,6..18,22..34,36..47,49,51..60,63..84,86..88,90,92..$]'
    """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #18
0
def test_3dTORTOISEtoHere(data, ptaylor_env):
    opref = data.outdir / "o.3dTORTOISEtoHere"

    cmd = f"""
    3dTORTOISEtoHere
        -echo_edu
        -dt_tort {data.odtT}
        -prefix {opref}
    """
    cmd = " ".join(cmd.split())

    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #19
0
def test_1dDW_Grad_o_Mat_plus_plus_colvec(data, ptaylor_env):
    outfile = data.outdir / "o.1dDW_Grad_o_Mat++_cvec_n-1.txt"
    cmd = f"""
    1dDW_Grad_o_Mat++
        -echo_edu
        -in_row_vec {data.bvec}'[3..32]'
        -flip_y
        -out_col_vec {outfile}

    """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #20
0
def test_3dZipperZapper(data, ptaylor_env):
    opref = data.outdir / "o.3dZipperZapper"
    cmd = f"""
    3dZipperZapper
        -echo_edu
        -input {data.AVEB0_DWI}'[0..10]'
        -mask {data.mask_minisphere_dwi}
        -prefix {opref}
        -do_out_slice_param
    """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #21
0
def test_3dVecRGB_to_HSL(data, ptaylor_env):
    opref = data.outdir / "o.3dVecRGB_to_HSL"
    cmd = f"""
    3dVecRGB_to_HSL
        -echo_edu
        -in_vec {data.DT_V1}
        -in_scal {data.DT_FA}
        -mask {data.mask_DWI}
        -prefix {opref}
    """
    cmd = " ".join(cmd.split())

    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #22
0
def test_3dAmpToRSFC(data, ptaylor_env):

    opref = data.outdir / "o.3dAmpToRSFC"
    cmd = f"""
    3dAmpToRSFC
        -nifti
        -band 0.01 0.1
        -mask {data.mask_DWI}
        -in_amp {data.OLSAMP}
        -prefix {opref}
    """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #23
0
def test_3ddot_beta(data, ptaylor_env):
    opref = data.outdir / "o.3ddot_beta"
    cmd = f"""
    3ddot_beta
        -echo_edu
        -input {data.SOME_ICA_NETS_in_DWI}
        -mask {data.mask_DWI}
        -doeta2
        -prefix {opref}
    """
    cmd = " ".join(cmd.split())

    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #24
0
def test_3dmaskdump_basic(data):

    outfile_path = data.outdir / ("Vrel_tstats.txt")
    cmd = """
    3dmaskdump
        -noijk
        -mask {data.mask} {data.epi}
        > {outfile_path}
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #25
0
def test_3dmaskave_basic(data):

    outfile_prefix = data.outdir / ("anat_roi_resam.nii.gz")
    out_1d = data.outdir / ("epi_avg.1D")
    cmd = """
    3dmaskave
        -mask {data.mask}
        -quiet {data.epi}
        > {out_1d}
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #26
0
def test_3dNetCorr(data, ptaylor_env):
    opref = data.outdir / "o.3dNetCorr"
    cmd = f"""
    3dNetCorr
        -echo_edu
        -inset {data.REST_in_DWI}'[5..50]'
        -in_rois {data.ROI_ICMAP_GM}
        -prefix {opref}
        -fish_z
        -ts_wb_Z
        -nifti
        -ts_out
    """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(data, cmd)
    differ.run(timeout=60)
예제 #27
0
def test_1dDW_Grad_o_Mat__plus____plus___basic(data):

    outfile = data.outdir / "GRADS_30.dat"

    cmd = """
    1dDW_Grad_o_Mat++ 
    -in_row_vec {data.bvec}'[2..32]' 
    -flip_y  
    -out_col_vec {outfile}
    """

    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #28
0
def test_3dTstat_basic(data, statistic):
    outfile = data.outdir / "stat.nii.gz"
    cmd = """
    3dTstat
        -prefix {outfile}
        -{statistic}
        {data.epi}
    """
    cmd = " ".join(cmd.format(**locals()).split())

    # If this is known to cause difficulties, reduce the rtol
    kwargs_scans = {"data_kwargs": {}, "header_kwargs": {}}

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd, kwargs_scans=kwargs_scans)
    differ.run(timeout=60)
예제 #29
0
def test_1d_tool(data):

    outfile = data.outdir / "1d_tool_output.1d"

    cmd = """
    1d_tool.py
    -set_run_lengths 150 150 150
    -index_to_run_tr 324
    > {outfile}
    """

    cmd = " ".join(cmd.format(**locals()).split())

    # Run command and test all outputs match
    differ = tools.OutputDiffer(data, cmd)
    differ.run()
예제 #30
0
def test_3dMatch(data, ptaylor_env):
    opref = data.outdir / "o.3dMatch"
    cmd = f"""
    3dMatch
        -echo_edu
        -only_dice_thr
        -inset {data.SOME_ICA_NETS_in_DWI}
        -refset {data.MULTISITE_in_DWI}
        -mask {data.mask_DWI}
        -in_min 1.0
        -ref_min 3
        -prefix {opref}
    """
    cmd = " ".join(cmd.split())
    differ = tools.OutputDiffer(data, cmd)
    differ.run()