def test_integration_three_echo(skip_integration): """ Integration test of the full tedana workflow using three-echo test data """ if skip_integration: pytest.skip('Skipping three-echo integration test') out_dir = '/tmp/data/three-echo/TED.three-echo' out_dir2 = '/tmp/data/three-echo/TED.three-echo-rerun' if os.path.exists(out_dir): shutil.rmtree(out_dir) # download data and run the test download_test_data('https://osf.io/rqhfc/download', os.path.dirname(out_dir)) tedana_cli.tedana_workflow( data='/tmp/data/three-echo/three_echo_Cornell_zcat.nii.gz', tes=[14.5, 38.5, 62.5], out_dir=out_dir, low_mem=True, tedpca='mdl') # Test re-running, but use the CLI args = ([ '-d', '/tmp/data/three-echo/three_echo_Cornell_zcat.nii.gz', '-e', '14.5', '38.5', '62.5', '--out-dir', out_dir2, '--debug', '--verbose', '--ctab', os.path.join(out_dir, 'ica_decomposition.json'), '--mix', os.path.join(out_dir, 'ica_mixing.tsv') ]) tedana_cli._main(args) # compare the generated output files fn = resource_filename('tedana', 'tests/data/cornell_three_echo_outputs.txt') check_integration_outputs(fn, out_dir)
def test_integration_five_echo(skip_integration): """Integration test of the full tedana workflow using five-echo test data""" if skip_integration: pytest.skip("Skipping five-echo integration test") out_dir = "/tmp/data/five-echo/TED.five-echo" if os.path.exists(out_dir): shutil.rmtree(out_dir) # download data and run the test download_test_data("https://osf.io/9c42e/download", os.path.dirname(out_dir)) prepend = "/tmp/data/five-echo/p06.SBJ01_S09_Task11_e" suffix = ".sm.nii.gz" datalist = [prepend + str(i + 1) + suffix for i in range(5)] echo_times = [15.4, 29.7, 44.0, 58.3, 72.6] tedana_cli.tedana_workflow( data=datalist, tes=echo_times, out_dir=out_dir, tedpca=0.95, fittype="curvefit", fixed_seed=49, tedort=True, verbose=True, ) # Just a check on the component table pending a unit test of load_comptable comptable = os.path.join(out_dir, "desc-tedana_metrics.tsv") df = pd.read_table(comptable) assert isinstance(df, pd.DataFrame) # Test re-running, but use the CLI out_dir2 = "/tmp/data/five-echo/TED.five-echo-manual" acc_comps = df.loc[df["classification"] == "accepted"].index.values acc_comps = [str(c) for c in acc_comps] mixing = os.path.join(out_dir, "desc-ICA_mixing.tsv") t2smap = os.path.join(out_dir, "T2starmap.nii.gz") args = (["-d"] + datalist + ["-e"] + [str(te) for te in echo_times] + [ "--out-dir", out_dir2, "--debug", "--verbose", "--manacc", *acc_comps, "--ctab", comptable, "--mix", mixing, "--t2smap", t2smap, ]) tedana_cli._main(args) # compare the generated output files fn = resource_filename("tedana", "tests/data/nih_five_echo_outputs_verbose.txt") check_integration_outputs(fn, out_dir)
def test_integration_three_echo(skip_integration): """Integration test of the full tedana workflow using three-echo test data""" if skip_integration: pytest.skip("Skipping three-echo integration test") out_dir = "/tmp/data/three-echo/TED.three-echo" out_dir_manual = "/tmp/data/three-echo/TED.three-echo-rerun" if os.path.exists(out_dir): shutil.rmtree(out_dir) if os.path.exists(out_dir_manual): shutil.rmtree(out_dir_manual) # download data and run the test download_test_data("https://osf.io/rqhfc/download", os.path.dirname(out_dir)) tedana_cli.tedana_workflow( data="/tmp/data/three-echo/three_echo_Cornell_zcat.nii.gz", tes=[14.5, 38.5, 62.5], out_dir=out_dir, low_mem=True, tedpca="aic", ) # Test re-running, but use the CLI args = [ "-d", "/tmp/data/three-echo/three_echo_Cornell_zcat.nii.gz", "-e", "14.5", "38.5", "62.5", "--out-dir", out_dir_manual, "--debug", "--verbose", "--ctab", os.path.join(out_dir, "desc-tedana_metrics.tsv"), "--mix", os.path.join(out_dir, "desc-ICA_mixing.tsv"), ] tedana_cli._main(args) # compare the generated output files fn = resource_filename("tedana", "tests/data/cornell_three_echo_outputs.txt") check_integration_outputs(fn, out_dir)
def test_integration_five_echo(skip_integration): """ Integration test of the full tedana workflow using five-echo test data """ if skip_integration: pytest.skip('Skipping five-echo integration test') out_dir = '/tmp/data/five-echo/TED.five-echo' if os.path.exists(out_dir): shutil.rmtree(out_dir) # download data and run the test download_test_data('https://osf.io/9c42e/download', os.path.dirname(out_dir)) prepend = '/tmp/data/five-echo/p06.SBJ01_S09_Task11_e' suffix = '.sm.nii.gz' datalist = [prepend + str(i + 1) + suffix for i in range(5)] echo_times = [15.4, 29.7, 44.0, 58.3, 72.6] tedana_cli.tedana_workflow(data=datalist, tes=echo_times, out_dir=out_dir, tedpca=0.95, fittype='curvefit', fixed_seed=49, tedort=True, verbose=True) # Just a check on the component table pending a unit test of load_comptable comptable = os.path.join(out_dir, 'desc-tedana_metrics.tsv') df = pd.read_table(comptable) assert isinstance(df, pd.DataFrame) # Test re-running, but use the CLI out_dir2 = '/tmp/data/five-echo/TED.five-echo-manual' acc_comps = df.loc[df['classification'] == 'accepted'].index.values acc_comps = [str(c) for c in acc_comps] mixing = os.path.join(out_dir, 'desc-ICA_mixing.tsv') t2smap = os.path.join(out_dir, 'T2starmap.nii.gz') args = (['-d'] + datalist + ['-e'] + [str(te) for te in echo_times] + [ '--out-dir', out_dir2, '--debug', '--verbose', '--manacc', *acc_comps, '--ctab', comptable, '--mix', mixing, '--t2smap', t2smap ]) tedana_cli._main(args) # compare the generated output files fn = resource_filename('tedana', 'tests/data/nih_five_echo_outputs_verbose.txt') check_integration_outputs(fn, out_dir)