示例#1
0
def test_fetch_atlas_talairach(tmp_path, request_mocker):
    request_mocker.url_mapping["*talairach.nii"] = _get_small_fake_talairach()
    level_values = np.ones((81, 3)) * [0, 1, 2]
    talairach = atlas.fetch_atlas_talairach('hemisphere', data_dir=tmp_path)
    assert_array_equal(
        get_data(talairach.maps).ravel(), level_values.T.ravel())
    assert_array_equal(talairach.labels, ['Background', 'b', 'a'])
    talairach = atlas.fetch_atlas_talairach('ba', data_dir=tmp_path)
    assert_array_equal(get_data(talairach.maps).ravel(), level_values.ravel())
    pytest.raises(ValueError, atlas.fetch_atlas_talairach, 'bad_level')
示例#2
0
def test_fetch_atlas_talairach(data_dir=tst.tmpdir):
    atlas._fetch_files = _mock_talairach_fetch_files
    level_values = np.ones((81, 3)) * [0, 1, 2]
    talairach = atlas.fetch_atlas_talairach('hemisphere', data_dir=tst.tmpdir)
    assert_array_equal(talairach.maps.get_data().ravel(),
                       level_values.T.ravel())
    assert_array_equal(talairach.labels, ['Background', 'b', 'a'])
    talairach = atlas.fetch_atlas_talairach('ba', data_dir=tst.tmpdir)
    assert_array_equal(talairach.maps.get_data().ravel(), level_values.ravel())
    assert_raises(ValueError, atlas.fetch_atlas_talairach, 'bad_level')
示例#3
0
def test_fetch_atlas_talairach(data_dir=tst.tmpdir):
    atlas._fetch_files = _mock_talairach_fetch_files
    level_values = np.ones((81, 3)) * [0, 1, 2]
    talairach = atlas.fetch_atlas_talairach('hemisphere', data_dir=tst.tmpdir)
    assert_array_equal(talairach.maps.get_data().ravel(),
                       level_values.T.ravel())
    assert_array_equal(talairach.labels, ['Background', 'b', 'a'])
    talairach = atlas.fetch_atlas_talairach('ba', data_dir=tst.tmpdir)
    assert_array_equal(talairach.maps.get_data().ravel(),
                       level_values.ravel())
    assert_raises(ValueError, atlas.fetch_atlas_talairach, 'bad_level')