#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import get_testing_files_dict, fetch_data, get_home # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys='surface_vtk_fib.zip') tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_flip_volume.py', '--help') assert ret.success def test_execution_surface_vtk_fib(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_fa = os.path.join(get_home(), 'surface_vtk_fib', 'fa.nii.gz') ret = script_runner.run('scil_flip_volume.py', in_fa, 'fa_flip.nii.gz', 'x') assert ret.success
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import fetch_data, get_home, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['tracking.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_add_tracking_mask_to_pft_maps.py', '--help') assert ret.success def test_execution_tracking(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_include = os.path.join(get_home(), 'tracking', 'map_include.nii.gz') in_exclude = os.path.join(get_home(), 'tracking', 'map_exclude.nii.gz') in_mask = os.path.join(get_home(), 'tracking', 'seeding_mask.nii.gz') ret = script_runner.run('scil_add_tracking_mask_to_pft_maps.py', in_include, in_exclude, in_mask, 'map_include_corr.nii.gz', 'map_exclude_corr.nii.gz') assert ret.success
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import get_testing_files_dict, fetch_data, get_home # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['tractometry.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_assign_color_to_trk.py', '--help') assert ret.success def test_execution_tractometry(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_bundle = os.path.join(get_home(), 'tractometry', 'IFGWM.trk') ret = script_runner.run('scil_assign_color_to_trk.py', in_bundle, 'IFGWM_color.trk', '0x000000') assert ret.success
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import fetch_data, get_home, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['MT.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_compute_MT_maps.py', '--help') assert ret.success def test_execution_MT_no_option(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_mask = os.path.join(get_home(), 'MT', 'mask.nii.gz') in_e1_mtoff = os.path.join(get_home(), 'MT', 'echo-1_acq-mtoff_mtsat.nii.gz') in_e2_mtoff = os.path.join(get_home(), 'MT', 'echo-2_acq-mtoff_mtsat.nii.gz') in_e3_mtoff = os.path.join(get_home(), 'MT', 'echo-3_acq-mtoff_mtsat.nii.gz') in_e4_mtoff = os.path.join(get_home(), 'MT', 'echo-4_acq-mtoff_mtsat.nii.gz')
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import fetch_data, get_home, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['processing.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_compute_mean_frf.py', '--help') assert ret.success def test_execution_processing(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_frf = os.path.join(get_home(), 'processing', 'frf.txt') ret = script_runner.run('scil_compute_mean_frf.py', in_frf, 'mfrf.txt') assert ret.success
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import get_testing_files_dict, fetch_data, get_home # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['others.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_resample_volume.py', '--help') assert ret.success def test_execution_others(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_img = os.path.join(get_home(), 'others', 'fa.nii.gz') ret = script_runner.run('scil_resample_volume.py', in_img, 'fa_resample.nii.gz', '--voxel_size', '2') assert ret.success
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import get_testing_files_dict, fetch_data, get_home # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['bundles.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_remove_invalid_streamlines.py', '--help') assert ret.success def test_execution_bundles(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_tractogram = os.path.join(get_home(), 'bundles', 'bundle_all_1mm.trk') ret = script_runner.run('scil_remove_invalid_streamlines.py', in_tractogram, 'bundle_all_1mm.trk', '--cut', '--remove_overlapping', '--remove_single', '-f') assert ret.success
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import get_testing_files_dict, fetch_data, get_home # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['connectivity.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_compare_connectivity.py', '--help') assert ret.success def test_execution_connectivity(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_1 = os.path.join(get_home(), 'connectivity', 'sc.npy') in_2 = os.path.join(get_home(), 'connectivity', 'sc_norm.npy') in_mask = os.path.join(get_home(), 'connectivity', 'mask.npy') ret = script_runner.run('scil_compare_connectivity.py', 'pval.npy', '--in_g1', in_1, '--in_g2', in_2, '--filtering_mask', in_mask) assert ret.success
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import fetch_data, get_home, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['commit_amico.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_run_commit.py', '--help') assert ret.success def test_execution_commit_amico(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_tracking = os.path.join(get_home(), 'commit_amico', 'tracking.trk') in_dwi = os.path.join(get_home(), 'commit_amico', 'dwi.nii.gz') in_bval = os.path.join(get_home(), 'commit_amico', 'dwi.bval') in_bvec = os.path.join(get_home(), 'commit_amico', 'dwi.bvec') in_mask = os.path.join(get_home(), 'commit_amico', 'mask.nii.gz') in_peaks = os.path.join(get_home(), 'commit_amico', 'peaks.nii.gz') ret = script_runner.run('scil_run_commit.py', in_tracking, in_dwi, in_bval, in_bvec, 'results_bzs/', '--b_thr', '30', '--nbr_dir', '500', '--nbr_iter', '500', '--in_peaks', in_peaks, '--in_tracking_mask', in_mask, '--para_diff', '1.7E-3', '--perp_diff',
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import get_testing_files_dict, fetch_data, get_home # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['filtering.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_verify_space_attributes_compatibility.py', '--help') assert ret.success def test_execution_filtering(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_bundle = os.path.join(get_home(), 'filtering', 'bundle_all_1mm.trk') in_roi = os.path.join(get_home(), 'filtering', 'mask.nii.gz') ret = script_runner.run('scil_verify_space_attributes_compatibility.py', in_bundle, in_roi) assert ret.success
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy.io.fetcher import get_testing_files_dict, fetch_data, get_home # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['anatomical_filtering.zip']) tmp_dir = tempfile.TemporaryDirectory() def test_help_option(script_runner): ret = script_runner.run('scil_filter_tractogram_anatomically.py', '--help') assert ret.success def test_execution_filtering(script_runner): os.chdir(os.path.expanduser(tmp_dir.name)) in_tractogram = os.path.join(get_home(), 'anatomical_filtering', 'tractogram_filter_ana.trk') in_wmparc = os.path.join(get_home(), 'anatomical_filtering', 'wmparc_filter_ana.nii.gz') ret = script_runner.run('scil_filter_tractogram_anatomically.py', in_tractogram, in_wmparc, os.path.expanduser(tmp_dir.name), '--minL', '40', '--maxL', '200', '-a', '300') assert ret.success