diff --git a/brainstat/context/histology.py b/brainstat/context/histology.py index aa6f61d0..b7d13511 100644 --- a/brainstat/context/histology.py +++ b/brainstat/context/histology.py @@ -156,7 +156,10 @@ def read_histology_profile( ) with h5py.File(histology_file, "r") as h5_file: - profiles = h5_file.get(template)[...] + if template == "fslr32k": + profiles = h5_file.get("fs_LR_64k")[...] + else: + profiles = h5_file.get(template)[...] if civet_template: fsaverage_surface = fetch_template_surface("fsaverage") civet_surface = fetch_template_surface(civet_template) @@ -191,7 +194,10 @@ def download_histology_profiles( data_dir = Path(data_dir) if data_dir else data_directories["BIGBRAIN_DATA_DIR"] data_dir.mkdir(parents=True, exist_ok=True) - output_file = data_dir / ("histology_" + template + ".h5") + if template == "fslr32k": + output_file = data_dir / "histology_fslr32k.h5" + else: + output_file = data_dir / ("histology_" + template + ".h5") url = read_data_fetcher_json()["bigbrain_profiles"][template]["url"] diff --git a/brainstat/tests/test_histology.py b/brainstat/tests/test_histology.py index d0cd1f29..2e0ccc9f 100644 --- a/brainstat/tests/test_histology.py +++ b/brainstat/tests/test_histology.py @@ -1,9 +1,10 @@ """Unit tests for the histology module.""" import pytest import requests +import numpy as np from brainstat._utils import read_data_fetcher_json - +from brainstat.context.histology import read_histology_profile parametrize = pytest.mark.parametrize json = read_data_fetcher_json() @@ -19,3 +20,10 @@ def test_urls(template): """ r = requests.head(json["bigbrain_profiles"][template]["url"]) assert r.status_code == 200 + + +def test_histology_profiles_is_ndarray(): + histology_profiles = read_histology_profile(template="fslr32k") + + # Assert that histology_profiles is an ndarray + assert isinstance(histology_profiles, np.ndarray), "histology_profiles should be a NumPy ndarray" diff --git a/brainstat/tests/test_mesh_edges.py b/brainstat/tests/test_mesh_edges.py index 8684a74b..788f3537 100755 --- a/brainstat/tests/test_mesh_edges.py +++ b/brainstat/tests/test_mesh_edges.py @@ -81,4 +81,4 @@ def test_nifti_input(): edg = mesh_edges(nifti) assert edg.shape[1] == 2 - assert np.amax(edg) <= nifti.get_data().sum() - 1 + assert np.amax(edg) <= nifti.get_fdata().sum() - 1