예제 #1
0
def test_fetch_surf_fsaverage(mesh, tmp_path, request_mocker):
    # Define attribute list that nilearn meshs should contain
    # (each attribute should eventually map to a _.gii.gz file
    # named after the attribute)
    mesh_attributes = {
        "{}_{}".format(part, side)
        for part in
        ["area", "curv", "infl", "pial", "sphere", "sulc", "thick", "white"]
        for side in ["left", "right"]
    }

    # Mock fsaverage3, 4, 6, 7 download (with actual url)
    fs_urls = [
        "https://osf.io/asvjk/download",
        "https://osf.io/x2j49/download",
        "https://osf.io/um5ag/download",
        "https://osf.io/q7a5k/download",
    ]
    for fs_url in fs_urls:
        request_mocker.url_mapping[fs_url] = list_to_archive(
            ["{}.gii.gz".format(name) for name in mesh_attributes])

    dataset = struct.fetch_surf_fsaverage(mesh, data_dir=str(tmp_path))
    assert mesh_attributes.issubset(set(dataset.keys()))
    assert dataset.description != ''
예제 #2
0
def test_fetch_surf_fsaverage5_sphere(tmp_path, request_mocker):
    for mesh in ['fsaverage5_sphere']:

        dataset = struct.fetch_surf_fsaverage(mesh, data_dir=str(tmp_path))

        keys = {'sphere_left', 'sphere_right'}

        assert keys.issubset(set(dataset.keys()))
        assert dataset.description != ''
예제 #3
0
def test_fetch_surf_fsaverage5_sphere():
    for mesh in ['fsaverage5_sphere']:

        dataset = struct.fetch_surf_fsaverage(mesh, data_dir=tst.tmpdir)

        keys = {'sphere_left', 'sphere_right'}

        assert keys.issubset(set(dataset.keys()))
        assert_not_equal(dataset.description, '')
예제 #4
0
def test_fetch_surf_fsaverage5_sphere():
    for mesh in ['fsaverage5_sphere']:

        dataset = struct.fetch_surf_fsaverage(
            mesh, data_dir=tst.tmpdir)

        keys = {'sphere_left', 'sphere_right'}

        assert keys.issubset(set(dataset.keys()))
        assert_not_equal(dataset.description, '')
예제 #5
0
def test_fetch_surf_fsaverage5_sphere(tmp_path, request_mocker):
    request_mocker.url_mapping["*b79fy*"] = list_to_archive(
        ["sphere_right.gii", "sphere_left.gii"])
    for mesh in ['fsaverage5_sphere']:

        dataset = struct.fetch_surf_fsaverage(mesh, data_dir=str(tmp_path))

        keys = {'sphere_left', 'sphere_right'}

        assert keys.issubset(set(dataset.keys()))
        assert dataset.description != ''
예제 #6
0
def test_fetch_surf_fsaverage():
    # for mesh in ['fsaverage5', 'fsaverage']:
    for mesh in ['fsaverage']:

        dataset = struct.fetch_surf_fsaverage(
            mesh, data_dir=tst.tmpdir)

        keys = {'pial_left', 'pial_right', 'infl_left', 'infl_right',
                'sulc_left', 'sulc_right'}

        assert keys.issubset(set(dataset.keys()))
        assert_not_equal(dataset.description, '')
예제 #7
0
def test_fetch_surf_fsaverage(tmp_path, request_mocker):
    # for mesh in ['fsaverage5', 'fsaverage']:
    for mesh in ['fsaverage']:

        dataset = struct.fetch_surf_fsaverage(
            mesh, data_dir=str(tmp_path))

        keys = {'pial_left', 'pial_right', 'infl_left', 'infl_right',
                'sulc_left', 'sulc_right'}

        assert keys.issubset(set(dataset.keys()))
        assert dataset.description != ''
예제 #8
0
def test_fetch_surf_fsaverage(mesh, tmp_path, request_mocker):
    keys = {
        'pial_left', 'pial_right', 'infl_left', 'infl_right', 'sulc_left',
        'sulc_right', 'white_left', 'white_right'
    }
    request_mocker.url_mapping["*fsaverage.tar.gz"] = list_to_archive([
        Path("fsaverage") / "{}.gii".format(k.replace("infl", "inflated"))
        for k in keys
    ])
    dataset = struct.fetch_surf_fsaverage(mesh, data_dir=str(tmp_path))
    assert keys.issubset(set(dataset.keys()))
    assert dataset.description != ''
예제 #9
0
def test_fetch_surf_fsaverage():
    # for mesh in ['fsaverage5', 'fsaverage']:
    for mesh in ['fsaverage']:

        dataset = struct.fetch_surf_fsaverage(mesh, data_dir=tst.tmpdir)

        keys = {
            'pial_left', 'pial_right', 'infl_left', 'infl_right', 'sulc_left',
            'sulc_right'
        }

        assert keys.issubset(set(dataset.keys()))
        assert_not_equal(dataset.description, '')