diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml index ce33186..241341b 100644 --- a/.github/workflows/test_and_deploy.yml +++ b/.github/workflows/test_and_deploy.yml @@ -1,18 +1,18 @@ -name: Test (and Deploy on tag) +name: tests on: push: branches: - - main + - '*' tags: - '*' pull_request: jobs: linting: - runs-on: ubuntu-latest - steps: - - uses: neuroinformatics-unit/actions/lint@v2 + runs-on: ubuntu-latest + steps: + - uses: neuroinformatics-unit/actions/lint@v2 manifest: name: Check Manifest @@ -21,43 +21,39 @@ jobs: - uses: neuroinformatics-unit/actions/check_manifest@v2 test: + needs: [linting, manifest] name: ${{ matrix.os }} py${{ matrix.python-version }} - needs: [linting,manifest] runs-on: ${{ matrix.os }} strategy: - fail-fast: false matrix: - # Run across a mixture of Python versions and operating systems + # Run all supported Python versions on linux + python-version: ["3.9", "3.10", "3.11"] + os: [ubuntu-latest] + # Include one windows and macos run include: - - os: ubuntu-latest - python-version: "3.11" - os: macos-latest python-version: "3.10" - os: windows-latest - python-version: "3.9" - - os: ubuntu-latest - python-version: "3.8" + python-version: "3.10" steps: - # these libraries enable testing on Qt on linux - - uses: tlambert03/setup-qt-libs@v1 # Run tests - uses: neuroinformatics-unit/actions/test@v2 with: python-version: ${{ matrix.python-version }} - build_sdist_wheel: - name: Build source distribution and wheel + build_sdist_wheels: + name: Build source distribution needs: [test] if: github.event_name == 'push' && github.ref_type == 'tag' runs-on: ubuntu-latest steps: - - uses: neuroinformatics-unit/actions/build_sdist_wheels@v2 + - uses: neuroinformatics-unit/actions/build_sdist_wheels@v2 + upload_all: name: Publish build distributions - needs: [build_sdist_wheel] - if: github.event_name == 'push' && github.ref_type == 'tag' + needs: [build_sdist_wheels] runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v3 diff --git a/.gitignore b/.gitignore index 3b6aba7..aedc8d7 100644 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,6 @@ nosetests.xml coverage.xml *,cover .hypothesis/ -.napari_cache # Translations *.mo @@ -66,6 +65,11 @@ docs/_build/ # PyBuilder target/ +# Pycharm and VSCode +.idea/ +venv/ +.vscode/ + # IPython Notebook .ipynb_checkpoints @@ -76,6 +80,4 @@ target/ .DS_Store # written by setuptools_scm -*/_version.py - -.idea/ +**/_version.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ec9daa9..4dafeb1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,6 @@ repos: rev: v4.5.0 hooks: - id: check-docstring-first - - id: check-executables-have-shebangs - id: check-merge-conflict - id: check-toml - id: end-of-file-fixer @@ -16,7 +15,7 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.6 + rev: v0.1.7 hooks: - id: ruff - repo: https://github.com/psf/black @@ -29,3 +28,9 @@ repos: - id: mypy additional_dependencies: - types-setuptools + - repo: https://github.com/mgedmin/check-manifest + rev: "0.49" + hooks: + - id: check-manifest + args: [--no-build-isolation] + additional_dependencies: [setuptools-scm] diff --git a/MANIFEST.in b/MANIFEST.in index 17595ff..2c30521 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,10 +1,11 @@ include LICENSE include README.md exclude tox.ini - +exclude .pre-commit-config.yaml exclude *.yml exclude *.yaml +recursive-exclude tests * recursive-exclude brainglobe_napari_io *.xml include brainglobe_napari_io/napari.yaml diff --git a/brainglobe_napari_io/__init__.py b/brainglobe_napari_io/__init__.py index a9ff7c4..a60684d 100644 --- a/brainglobe_napari_io/__init__.py +++ b/brainglobe_napari_io/__init__.py @@ -1,5 +1,7 @@ -from importlib_metadata import version +from importlib.metadata import PackageNotFoundError, version -__version__ = version("brainglobe-napari-io") -__author__ = "Adam Tyson" -__license__ = "BSD-3-Clause" +try: + __version__ = version("brainglobe-napari-io") +except PackageNotFoundError: + # package is not installed + pass diff --git a/brainglobe_napari_io/cellfinder/utils.py b/brainglobe_napari_io/cellfinder/utils.py index f5aa5c4..d729831 100644 --- a/brainglobe_napari_io/cellfinder/utils.py +++ b/brainglobe_napari_io/cellfinder/utils.py @@ -20,13 +20,6 @@ def cells_df_as_np( return cells -def cells_to_array(cells) -> Tuple[np.ndarray, np.ndarray]: - df = pd.DataFrame([c.to_dict() for c in cells]) - points = cells_df_as_np(df[df["type"] == Cell.CELL]) - rejected = cells_df_as_np(df[df["type"] == Cell.UNKNOWN]) - return points, rejected - - def get_cell_arrays(cells_file: os.PathLike) -> Tuple[np.ndarray, np.ndarray]: df = cells_xml_to_df(str(cells_file)) diff --git a/brainglobe_napari_io/napari.yaml b/brainglobe_napari_io/napari.yaml index a82474a..3ec292e 100644 --- a/brainglobe_napari_io/napari.yaml +++ b/brainglobe_napari_io/napari.yaml @@ -10,9 +10,9 @@ contributions: title: Brainreg Read Directory Atlas Space python_name: brainglobe_napari_io.brainreg.reader_dir_atlas_space:brainreg_read_dir_atlas_space - - id: brainglobe-napari-io.cellfinder_read_dir - title: Cellfinder Read Directory - python_name: brainglobe_napari_io.cellfinder.reader_dir:cellfinder_read_dir + - id: brainglobe-napari-io.workflows_wholebrain_cell_read_dir + title: Workflows Whole Brain Cell Detection Read Directory + python_name: brainglobe_napari_io.workflows.wholebrain_cell_reader_dir:wholebrain_cell_read_dir - id: brainglobe-napari-io.cellfinder_read_xml title: Cellfinder Read XML @@ -34,7 +34,7 @@ contributions: - '*.tiff' accepts_directories: true - - command: brainglobe-napari-io.cellfinder_read_dir + - command: brainglobe-napari-io.workflows_wholebrain_cell_read_dir filename_patterns: - '*.tif' accepts_directories: true diff --git a/brainglobe_napari_io/tests/data/cell_classification.xml b/brainglobe_napari_io/tests/data/cell_classification.xml deleted file mode 100644 index ac7b5b7..0000000 --- a/brainglobe_napari_io/tests/data/cell_classification.xml +++ /dev/null @@ -1,292 +0,0 @@ - - - - placeholder.tif - - - 1 - - 2 - - 132 - 308 - 10 - - - 216 - 492 - 14 - - - 223 - 133 - 14 - - - 195 - 209 - 14 - - - 240 - 253 - 14 - - - 159 - 318 - 14 - - - 208 - 338 - 14 - - - 317 - 125 - 12 - - - 119 - 165 - 12 - - - 205 - 244 - 12 - - - 125 - 264 - 12 - - - 274 - 310 - 12 - - - 122 - 338 - 12 - - - 630 - 359 - 12 - - - 163 - 403 - 12 - - - 185 - 296 - 12 - - - 171 - 297 - 12 - - - 103 - 303 - 12 - - - 187 - 153 - 13 - - - 207 - 443 - 13 - - - 156 - 400 - 13 - - - 128 - 421 - 13 - - - 142 - 159 - 13 - - - 196 - 462 - 13 - - - 319 - 211 - 11 - - - 49 - 482 - 11 - - - 304 - 110 - 11 - - - 141 - 159 - 11 - - - 236 - 212 - 15 - - - 223 - 269 - 15 - - - 165 - 293 - 15 - - - 138 - 296 - 15 - - - 188 - 333 - 15 - - - 214 - 352 - 15 - - - 236 - 358 - 15 - - - 214 - 462 - 15 - - - 234 - 233 - 15 - - - 189 - 252 - 15 - - - 145 - 272 - 15 - - - 57 - 296 - 15 - - - 142 - 421 - 15 - - - 98 - 343 - 15 - - - 213 - 277 - 17 - - - 597 - 254 - 17 - - - 415 - 143 - 17 - - - 198 - 331 - 17 - - - 129 - 422 - 17 - - - 165 - 305 - 19 - - - 183 - 424 - 16 - - - 203 - 381 - 16 - - - 278 - 237 - 16 - - - 187 - 295 - 16 - - - 158 - 400 - 16 - - - 99 - 342 - 18 - - - 198 - 429 - 18 - - - 240 - 468 - 18 - - - - diff --git a/brainglobe_napari_io/tests/test_brainglobe_napari_io.py b/brainglobe_napari_io/tests/test_brainglobe_napari_io.py deleted file mode 100644 index 3ada1ee..0000000 --- a/brainglobe_napari_io/tests/test_brainglobe_napari_io.py +++ /dev/null @@ -1,2 +0,0 @@ -def test_placeholder(): - assert True diff --git a/brainglobe_napari_io/tests/test_cellfinder_writer.py b/brainglobe_napari_io/tests/test_cellfinder_writer.py deleted file mode 100644 index eb88a4f..0000000 --- a/brainglobe_napari_io/tests/test_cellfinder_writer.py +++ /dev/null @@ -1,19 +0,0 @@ -import pathlib - -from brainglobe_napari_io.cellfinder import reader_xml, writer_xml - -test_data_dir = pathlib.Path(__file__) / ".." / "data" - - -def test_xml_roundrip(tmpdir): - # Check that a read in XML file can also be written back out - xml_file = test_data_dir / "cell_classification.xml" - layers = reader_xml.xml_reader(xml_file) - assert len(layers) == 2 - - paths = writer_xml.write_multiple_points_to_xml( - str(tmpdir / "multiple.xml"), layers - ) - assert len(paths) == 1 - assert isinstance(paths[0], str) - assert reader_xml.is_cellfinder_xml(paths[0]) diff --git a/brainglobe_napari_io/tests/__init__.py b/brainglobe_napari_io/workflows/__init__.py similarity index 100% rename from brainglobe_napari_io/tests/__init__.py rename to brainglobe_napari_io/workflows/__init__.py diff --git a/brainglobe_napari_io/cellfinder/reader_dir.py b/brainglobe_napari_io/workflows/wholebrain_cell_reader_dir.py similarity index 88% rename from brainglobe_napari_io/cellfinder/reader_dir.py rename to brainglobe_napari_io/workflows/wholebrain_cell_reader_dir.py index fb30625..8aa4605 100644 --- a/brainglobe_napari_io/cellfinder/reader_dir.py +++ b/brainglobe_napari_io/workflows/wholebrain_cell_reader_dir.py @@ -1,14 +1,3 @@ -""" -This module is an example of a barebones numpy reader plugin for napari. - -It implements the ``napari_get_reader`` hook specification, (to create -a reader plugin) but your plugin may choose to implement any of the hook -specifications offered by napari. -see: https://napari.org/docs/plugins/hook_specifications.html - -Replace code below accordingly. For complete documentation see: -https://napari.org/docs/plugins/for_plugin_developers.html -""" import json import os from pathlib import Path @@ -17,15 +6,18 @@ import bg_space as bgs from napari.types import LayerDataTuple -from ..brainreg.reader_dir import reader_function as brainreg_reader -from .utils import load_cells +from brainglobe_napari_io.brainreg.reader_dir import ( + reader_function as brainreg_reader, +) +from brainglobe_napari_io.cellfinder.utils import load_cells PathOrPaths = Union[List[os.PathLike], os.PathLike] -def is_cellfinder_dir(path: os.PathLike) -> bool: +def is_wholebrain_cell_dir(path: os.PathLike) -> bool: """ - Determines whether a path is to a cellfinder output directory. + Determines whether a path is to a BrainGlobe workflows whole brain + cell detection (previously cellfinder) output directory. """ path = os.path.abspath(path) if os.path.isdir(path): @@ -37,7 +29,7 @@ def is_cellfinder_dir(path: os.PathLike) -> bool: return False -def cellfinder_read_dir(path: PathOrPaths) -> Optional[Callable]: +def wholebrain_cell_read_dir(path: PathOrPaths) -> Optional[Callable]: """A basic implementation of the napari_get_reader hook specification. Parameters @@ -51,7 +43,7 @@ def cellfinder_read_dir(path: PathOrPaths) -> Optional[Callable]: If the path is a recognized format, return a function that accepts the same path or list of paths, and returns a list of layer data tuples. """ - if isinstance(path, str) and is_cellfinder_dir(path): + if isinstance(path, str) and is_wholebrain_cell_dir(path): return reader_function else: return None @@ -86,7 +78,7 @@ def reader_function( layer_type=="image" if not provided """ - print("Loading cellfinder directory") + print("Loading whole brain cell detection directory") path = Path(os.path.abspath(path)) with open(path / "cellfinder.json") as json_file: metadata = json.load(json_file) diff --git a/pyproject.toml b/pyproject.toml index 6f4b53d..b3eeb68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,23 +1,24 @@ [project] name = "brainglobe-napari-io" -description = "Read and write files from the BrainGlobe neuroanatomy suite" +authors = [{name = "Adam Tyson", email= "hello@brainglobe.info"}] +description = "Read and write files from the BrainGlobe computational neuroanatomy suite into napari" readme = "README.md" -authors = [{ name = "Adam Tyson", email = "code@adamltyson.com" }] +requires-python = ">=3.9.0" +dynamic = ["version"] + +license = {text = "BSD-3-Clause"} classifiers = [ "Development Status :: 4 - Beta", "Framework :: napari", - "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Topic :: Scientific/Engineering :: Image Recognition", ] -requires-python = ">=3.8" dependencies = [ "bg-atlasapi", "bg_space", @@ -27,8 +28,6 @@ dependencies = [ "numpy", "pandas", ] -license = { text = "BSD-3-Clause" } -dynamic = ['version'] [project.urls] Homepage = "https://brainglobe.info" @@ -39,14 +38,29 @@ Documentation = "https://docs.brainglobe.info" Twitter = "https://twitter.com/brain_globe" [project.optional-dependencies] -dev = ["black", "pre-commit", "pytest", "pytest-cov"] +dev = [ + "pytest", + "pytest-cov", + "coverage", + "tox", + "black", + "mypy", + "pre-commit", + "ruff", + "setuptools_scm", +] + [project.entry-points."napari.manifest"] brainglobe-napari-io = "brainglobe_napari_io:napari.yaml" [build-system] -requires = ["setuptools>=45", "wheel", "setuptools_scm[toml]>=6.2"] +requires = [ + "setuptools>=45", + "wheel", + "setuptools_scm[toml]>=6.2", +] build-backend = "setuptools.build_meta" [tool.setuptools] @@ -54,19 +68,48 @@ include-package-data = true [tool.setuptools.packages.find] include = ["brainglobe_napari_io*"] - -[tool.setuptools_scm] +exclude = ["tests*"] [tool.pytest.ini_options] -filterwarnings = ["error"] +addopts = "--cov=brainglobe_napari_io" [tool.black] -target-version = ['py38', 'py39', 'py310', 'py311'] +target-version = ['py39', 'py310', 'py311'] skip-string-normalization = false line-length = 79 +[tool.setuptools_scm] + +[tool.check-manifest] +ignore = [ + ".yaml", + "tox.ini", + "tests/", + "tests/test_unit/", + "tests/test_integration/", +] + [tool.ruff] line-length = 79 -exclude = ["__init__.py", "build", ".eggs"] +exclude = ["__init__.py","build",".eggs"] select = ["I", "E", "F"] fix = true + +[tool.tox] +legacy_tox_ini = """ +[tox] +envlist = py{39,310,311} +isolated_build = True + +[gh-actions] +python = + 3.9: py39 + 3.10: py310 + 3.11: py311 + +[testenv] +extras = + dev +commands = + pytest -v --color=yes --cov=brainglobe_napari_io --cov-report=xml +""" diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/data/wholebrain_cell_output/cellfinder.json b/tests/data/wholebrain_cell_output/cellfinder.json new file mode 100755 index 0000000..5c6e671 --- /dev/null +++ b/tests/data/wholebrain_cell_output/cellfinder.json @@ -0,0 +1 @@ +{"signal_planes_paths": ["2"], "background_planes_path": ["4"], "output_dir": "output", "signal_ch_ids": null, "background_ch_id": null, "registration_config": "cellfinder.conf.custom", "voxel_sizes": ["5", "2.31", "2.31"], "network_voxel_sizes": [5, 1, 1], "no_detection": false, "no_classification": false, "no_register": false, "no_analyse": false, "no_figures": false, "start_plane": 0, "end_plane": -1, "save_planes": false, "outlier_keep": false, "artifact_keep": false, "max_cluster_size": 100000, "soma_diameter": 16, "ball_xy_size": 6, "ball_z_size": 15, "ball_overlap_fraction": 0.6, "log_sigma_size": 0.2, "n_sds_above_mean_thresh": 10, "soma_spread_factor": 1.4, "trained_model": "model.h5", "model_weights": null, "network_depth": "50", "batch_size": 64, "cube_width": 50, "cube_height": 50, "cube_depth": 20, "save_empty_cubes": false, "n_free_cpus": 8, "max_ram": null, "save_csv": false, "debug": false, "sort_input_file": false, "no_models": false, "model": "resnet50_tv", "heatmap_smooth": 100, "mask_figures": true, "install_path": ".cellfinder", "download_path": "tmp", "no_amend_config": false, "atlas": "allen_mouse_100um", "orientation": "prs", "backend": "niftyreg", "affine_n_steps": 6, "affine_use_n_steps": 5, "freeform_n_steps": 6, "freeform_use_n_steps": 4, "bending_energy_weight": 0.95, "grid_spacing": -10, "smoothing_sigma_reference": -1.0, "smoothing_sigma_floating": -1.0, "histogram_n_bins_floating": 128, "histogram_n_bins_reference": 128, "paths": {"output_dir": "output_dir", "registration_output_folder": "output_dir/brainreg_output", "metadata_path": "output/cellfinder.json", "registration_metadata_path": "output_dir/brainreg_output/brainreg.json"}} diff --git a/tests/data/wholebrain_cell_output/points/cell_classification.xml b/tests/data/wholebrain_cell_output/points/cell_classification.xml new file mode 100644 index 0000000..efdc23b --- /dev/null +++ b/tests/data/wholebrain_cell_output/points/cell_classification.xml @@ -0,0 +1,640 @@ + + + + placeholder.tif + + + 1 + + 1 + + 3422 + 2089 + 11 + + + 3407 + 2580 + 11 + + + 1229 + 2570 + 11 + + + 1265 + 1055 + 11 + + + 942 + 1133 + 11 + + + 901 + 1235 + 11 + + + 2771 + 1245 + 11 + + + 2194 + 1252 + 11 + + + 1351 + 1259 + 11 + + + 1715 + 1324 + 11 + + + 2842 + 1341 + 11 + + + 1533 + 1372 + 11 + + + 1336 + 2135 + 2540 + + + 1336 + 3066 + 2540 + + + 1280 + 3221 + 2540 + + + 1556 + 2034 + 2540 + + + 1121 + 2114 + 2540 + + + 2028 + 2137 + 2540 + + + 1923 + 2386 + 2540 + + + 2057 + 2731 + 2540 + + + 1860 + 2739 + 2540 + + + 1399 + 3301 + 2540 + + + + 2 + + 1674 + 2441 + 20 + + + 2194 + 2810 + 120 + + + 1634 + 1891 + 122 + + + 3363 + 2528 + 183 + + + 2158 + 2763 + 187 + + + 1661 + 3150 + 200 + + + 2393 + 1830 + 224 + + + 1236 + 2647 + 238 + + + 1833 + 2733 + 314 + + + 2012 + 1735 + 315 + + + 2520 + 3135 + 318 + + + 2479 + 2402 + 333 + + + 977 + 3615 + 339 + + + 985 + 3616 + 339 + + + 1323 + 3061 + 368 + + + 616 + 1843 + 388 + + + 1252 + 3608 + 408 + + + 1242 + 3608 + 411 + + + 1343 + 3908 + 419 + + + 1273 + 3639 + 419 + + + 1421 + 3977 + 417 + + + 1361 + 3927 + 417 + + + 1358 + 3930 + 421 + + + 1417 + 3980 + 421 + + + 1211 + 3800 + 422 + + + 1263 + 3814 + 422 + + + 1330 + 3749 + 425 + + + 1348 + 3871 + 427 + + + 1385 + 3982 + 431 + + + 3360 + 2122 + 434 + + + 1548 + 4018 + 433 + + + 1049 + 3573 + 435 + + + 1385 + 3908 + 435 + + + 1437 + 3966 + 435 + + + 1468 + 3960 + 436 + + + 2081 + 4073 + 439 + + + 1524 + 3970 + 441 + + + 1415 + 4013 + 441 + + + 1354 + 3769 + 438 + + + 1418 + 4012 + 438 + + + 3367 + 2125 + 438 + + + 1478 + 3891 + 440 + + + 2127 + 4025 + 442 + + + 1244 + 3898 + 443 + + + 1478 + 4015 + 446 + + + 1393 + 3717 + 446 + + + 1468 + 3950 + 446 + + + 1468 + 3948 + 447 + + + 1239 + 3488 + 445 + + + 1486 + 3986 + 448 + + + 1417 + 3697 + 449 + + + 1382 + 3941 + 449 + + + 1433 + 3807 + 451 + + + 1416 + 3887 + 451 + + + 1379 + 3944 + 452 + + + 1460 + 3894 + 453 + + + 1461 + 3793 + 453 + + + 1520 + 3957 + 455 + + + 998 + 3647 + 455 + + + 1417 + 3708 + 460 + + + 1468 + 3944 + 459 + + + 1432 + 3803 + 457 + + + 1526 + 4033 + 456 + + + 1040 + 3718 + 458 + + + 1438 + 3688 + 458 + + + 1432 + 3802 + 458 + + + 1458 + 3884 + 464 + + + 1581 + 4079 + 464 + + + 1408 + 3735 + 465 + + + 1442 + 3686 + 465 + + + 1043 + 3745 + 465 + + + 1435 + 3853 + 465 + + + 1435 + 3682 + 465 + + + 1134 + 3455 + 466 + + + 1742 + 4005 + 467 + + + 1005 + 3697 + 467 + + + 1395 + 3693 + 467 + + + 2269 + 4185 + 467 + + + 1392 + 3695 + 470 + + + 1579 + 3983 + 469 + + + 1572 + 3974 + 473 + + + 1123 + 3423 + 471 + + + 2243 + 3863 + 474 + + + 1420 + 3713 + 475 + + + 1198 + 3691 + 475 + + + 1530 + 3751 + 475 + + + 2518 + 4054 + 477 + + + 1406 + 3754 + 479 + + + 1109 + 3806 + 479 + + + 1154 + 3637 + 482 + + + 1438 + 3725 + 482 + + + 1584 + 3983 + 485 + + + 636 + 2486 + 484 + + + 1346 + 3539 + 486 + + + 670 + 2735 + 486 + + + 1593 + 4069 + 488 + + + 1484 + 3983 + 489 + + + 897 + 3542 + 490 + + + 1505 + 3676 + 490 + + + 1437 + 3635 + 492 + + + 904 + 1256 + 493 + + + 887 + 3337 + 493 + + + 1996 + 3220 + 2529 + + + + diff --git a/tests/data/wholebrain_cell_output/registration/boundaries.tiff b/tests/data/wholebrain_cell_output/registration/boundaries.tiff new file mode 100644 index 0000000..9f8b5ff Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/boundaries.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/brainreg.json b/tests/data/wholebrain_cell_output/registration/brainreg.json new file mode 100755 index 0000000..120ef72 --- /dev/null +++ b/tests/data/wholebrain_cell_output/registration/brainreg.json @@ -0,0 +1 @@ +{"image_paths": "/img.tiff", "backend": "niftyreg", "voxel_sizes": ["10.0", "10.0", "10.0"], "orientation": "asr", "data_orientation": "asr", "brain_geometry": "geometry_keys.Full brain", "save_original_orientation": "False", "atlas": "allen_mouse_100um", "atlas_key": "atlas_key.allen_mouse_50um", "registration_output_folder": "/brainreg_output", "affine_n_steps": "6", "affine_use_n_steps": "5", "freeform_n_steps": "6", "freeform_use_n_steps": "4", "bending_energy_weight": "0.95", "grid_spacing": "10", "smoothing_sigma_reference": "1", "smoothing_sigma_floating": "1.0", "histogram_n_bins_floating": "128.0", "histogram_n_bins_reference": "128.0", "debug": "False"} diff --git a/tests/data/wholebrain_cell_output/registration/deformation_field_0.tiff b/tests/data/wholebrain_cell_output/registration/deformation_field_0.tiff new file mode 100644 index 0000000..19e0798 Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/deformation_field_0.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/deformation_field_1.tiff b/tests/data/wholebrain_cell_output/registration/deformation_field_1.tiff new file mode 100644 index 0000000..4a1dc81 Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/deformation_field_1.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/deformation_field_2.tiff b/tests/data/wholebrain_cell_output/registration/deformation_field_2.tiff new file mode 100644 index 0000000..c129e2f Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/deformation_field_2.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/downsampled.tiff b/tests/data/wholebrain_cell_output/registration/downsampled.tiff new file mode 100644 index 0000000..e240c8e Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/downsampled.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/downsampled_brain.tiff b/tests/data/wholebrain_cell_output/registration/downsampled_brain.tiff new file mode 100644 index 0000000..47f3ff9 Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/downsampled_brain.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/downsampled_standard.tiff b/tests/data/wholebrain_cell_output/registration/downsampled_standard.tiff new file mode 100644 index 0000000..db3ac0c Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/downsampled_standard.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/downsampled_standard_brain.tiff b/tests/data/wholebrain_cell_output/registration/downsampled_standard_brain.tiff new file mode 100644 index 0000000..db3ac0c Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/downsampled_standard_brain.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/registered_atlas.tiff b/tests/data/wholebrain_cell_output/registration/registered_atlas.tiff new file mode 100644 index 0000000..365382e Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/registered_atlas.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/registered_hemispheres.tiff b/tests/data/wholebrain_cell_output/registration/registered_hemispheres.tiff new file mode 100644 index 0000000..95cef0e Binary files /dev/null and b/tests/data/wholebrain_cell_output/registration/registered_hemispheres.tiff differ diff --git a/tests/data/wholebrain_cell_output/registration/volumes.csv b/tests/data/wholebrain_cell_output/registration/volumes.csv new file mode 100644 index 0000000..dd4d5f1 --- /dev/null +++ b/tests/data/wholebrain_cell_output/registration/volumes.csv @@ -0,0 +1,664 @@ +structure_name,left_volume_mm3,right_volume_mm3,total_volume_mm3 +"Tuberomammillary nucleus, ventral part",0.054,0.051000000000000004,0.10500000000000001 +"Primary somatosensory area, mouth, layer 6b",0.06,0.059000000000000004,0.119 +internal capsule,1.037,1.027,2.064 +Principal sensory nucleus of the trigeminal,0.592,0.548,1.1400000000000001 +"Primary somatosensory area, trunk, layer 6a",0.128,0.114,0.242 +"Superior colliculus, motor related, intermediate gray layer",0.9570000000000001,1.022,1.979 +Interfascicular nucleus raphe,0.033,0.058,0.091 +Parataenial nucleus,0.122,0.123,0.245 +"Superior colliculus, motor related, intermediate white layer",0.977,1.053,2.03 +Induseum griseum,0.032,0.064,0.096 +"Entorhinal area, lateral part, layer 2",0.808,0.787,1.5950000000000002 +Anterior amygdalar area,0.234,0.291,0.525 +"Superior colliculus, motor related, deep gray layer",0.559,0.612,1.171 +Intergeniculate leaflet of the lateral geniculate complex,0.035,0.035,0.07 +"Entorhinal area, lateral part, layer 6a",0.538,0.517,1.0550000000000002 +"Primary visual area, layer 6a",0.543,0.519,1.062 +Oculomotor nucleus,0.011,0.015,0.026 +"Gustatory areas, layer 1",0.10400000000000001,0.097,0.201 +Paraventricular hypothalamic nucleus,0.094,0.10400000000000001,0.198 +"posteromedial visual area, layer 2/3",0.137,0.14200000000000002,0.279 +"Superior colliculus, motor related, deep white layer",0.158,0.156,0.314 +Precommissural nucleus,0.1,0.1,0.2 +"Entorhinal area, lateral part, layer 3",0.684,0.641,1.3250000000000002 +medial forebrain bundle,0.034,0.024,0.058 +Nucleus accumbens,2.25,2.201,4.4510000000000005 +Medial terminal nucleus of the accessory optic tract,0.029,0.024,0.053000000000000005 +Intermediodorsal nucleus of the thalamus,0.045,0.133,0.178 +medial longitudinal fascicle,0.044,0.044,0.088 +"Paraventricular hypothalamic nucleus, descending division",0.073,0.064,0.137 +Anterodorsal nucleus,0.079,0.07200000000000001,0.15100000000000002 +Lateral terminal nucleus of the accessory optic tract,0.008,0.009000000000000001,0.017 +Interstitial nucleus of Cajal,0.05,0.041,0.091 +"Frontal pole, layer 1",0.113,0.10400000000000001,0.21700000000000003 +Anterodorsal preoptic nucleus,0.051000000000000004,0.044,0.095 +"Lateral visual area, layer 6a",0.101,0.1,0.201 +Dorsal terminal nucleus of the accessory optic tract,0.005,0.008,0.013000000000000001 +middle cerebellar peduncle,0.505,0.523,1.028 +lateral ventricle,0.997,1.039,2.036 +Inferior olivary complex,0.242,0.23700000000000002,0.479 +"Prelimbic area, layer 6a",0.23,0.222,0.452 +Anterior hypothalamic nucleus,0.392,0.329,0.7210000000000001 +Interposed nucleus,0.429,0.41500000000000004,0.8440000000000001 +motor root of the trigeminal nerve,0.03,0.031,0.061 +Dorsal cochlear nucleus,0.304,0.323,0.627 +"Temporal association areas, layer 1",0.253,0.249,0.502 +subependymal zone,0.056,0.069,0.125 +Interpeduncular nucleus,0.002,0.004,0.006 +Ventral cochlear nucleus,0.536,0.537,1.073 +nigrostriatal tract,0.052000000000000005,0.062,0.114 +"Superior olivary complex, medial part",0.106,0.101,0.20700000000000002 +Inferior salivatory nucleus,0.005,0.005,0.01 +choroid plexus,0.637,0.77,1.407 +"Primary somatosensory area, lower limb, layer 2/3",0.337,0.28600000000000003,0.623 +"Superior olivary complex, lateral part",0.171,0.17300000000000001,0.34400000000000003 +Trochlear nucleus,0.003,0.003,0.006 +optic chiasm,0.14200000000000002,0.166,0.30800000000000005 +"Periventricular hypothalamic nucleus, intermediate part",0.027,0.124,0.151 +"Agranular insular area, posterior part, layer 1",0.211,0.218,0.429 +"Lateral visual area, layer 6b",0.018000000000000002,0.019,0.037000000000000005 +"Superior olivary complex, periolivary region",0.198,0.192,0.39 +Koelliker-Fuse subnucleus,0.091,0.092,0.183 +optic tract,0.343,0.376,0.7190000000000001 +"Periventricular hypothalamic nucleus, posterior part",0.057,0.054,0.111 +Midbrain reticular nucleus,2.638,2.5100000000000002,5.148 +third ventricle,0.244,0.78,1.024 +Lateral amygdalar nucleus,0.426,0.419,0.845 +"Prelimbic area, layer 6b",0.013000000000000001,0.006,0.019000000000000003 +"Periventricular hypothalamic nucleus, preoptic part",0.023,0.1,0.123 +Intermediate reticular nucleus,1.42,1.374,2.794 +"Entorhinal area, lateral part, layer 5",0.714,0.707,1.4209999999999998 +cerebral aqueduct,0.127,0.255,0.382 +"Nucleus ambiguus, ventral division",0.008,0.008,0.016 +fourth ventricle,0.21,0.28,0.49 +Pontine reticular nucleus,1.196,1.18,2.376 +Locus ceruleus,0.009000000000000001,0.005,0.014000000000000002 +"Gustatory areas, layer 4",0.07200000000000001,0.066,0.138 +Paraventricular nucleus of the thalamus,0.178,0.28500000000000003,0.463 +lateral recess,0.226,0.23600000000000002,0.462 +Lateral dorsal nucleus of thalamus,0.486,0.486,0.972 +"Dorsal auditory area, layer 6a",0.106,0.083,0.189 +posterior commissure,0.017,0.03,0.047 +Anterior olfactory nucleus,2.403,2.465,4.868 +Laterodorsal tegmental nucleus,0.1,0.10200000000000001,0.202 +"Agranular insular area, posterior part, layer 2/3",0.401,0.40800000000000003,0.809 +Nucleus prepositus,0.1,0.114,0.21400000000000002 +"Prelimbic area, layer 1",0.203,0.334,0.537 +Retrochiasmatic area,0.07100000000000001,0.077,0.14800000000000002 +Nucleus of Roller,0.011,0.019,0.03 +Ventral part of the lateral geniculate complex,0.20600000000000002,0.194,0.4 +"Gustatory areas, layer 2/3",0.209,0.20500000000000002,0.41400000000000003 +Nucleus of reuniens,0.19,0.228,0.41800000000000004 +Lateral habenula,0.156,0.17,0.326 +"Gustatory areas, layer 5",0.266,0.268,0.534 +"Accessory olfactory bulb, glomerular layer",0.07200000000000001,0.082,0.15400000000000003 +Rhomboid nucleus,0.028,0.051000000000000004,0.079 +pyramid,0.294,0.28300000000000003,0.577 +Lateral hypothalamic area,1.094,1.067,2.161 +"Accessory olfactory bulb, granular layer",0.10200000000000001,0.111,0.21300000000000002 +Rostral linear nucleus raphe,0.011,0.046,0.056999999999999995 +pyramidal decussation,0.018000000000000002,0.041,0.059000000000000004 +"Primary somatosensory area, barrel field, layer 2/3",0.741,0.6950000000000001,1.436 +Medial vestibular nucleus,0.916,0.9380000000000001,1.854 +Linear nucleus of the medulla,0.032,0.04,0.07200000000000001 +"Accessory olfactory bulb, mitral layer",0.128,0.146,0.274 +Area postrema,0.018000000000000002,0.033,0.051000000000000004 +Lateral vestibular nucleus,0.134,0.145,0.279 +Lateral mammillary nucleus,0.035,0.034,0.069 +"Anterior cingulate area, dorsal part, layer 2/3",0.228,0.227,0.455 +Red nucleus,0.355,0.425,0.78 +Anterior pretectal nucleus,0.633,0.63,1.263 +Superior vestibular nucleus,0.17500000000000002,0.167,0.342 +Lateral posterior nucleus of the thalamus,0.594,0.613,1.2069999999999999 +Arcuate hypothalamic nucleus,0.14200000000000002,0.157,0.29900000000000004 +Spinal vestibular nucleus,0.406,0.388,0.794 +Lateral preoptic area,0.226,0.28,0.506 +sensory root of the trigeminal nerve,0.326,0.361,0.687 +Anterior tegmental nucleus,0.016,0.019,0.035 +"Anterolateral visual area, layer 5",0.106,0.095,0.201 +"Temporal association areas, layer 4",0.155,0.152,0.307 +solitary tract,0.007,0.006,0.013000000000000001 +Nucleus raphe pontis,0.034,0.045,0.079 +"Dorsal auditory area, layer 6b",0.013000000000000001,0.014,0.027000000000000003 +"Midbrain reticular nucleus, retrorubral area",0.073,0.057,0.13 +"Posterior auditory area, layer 6a",0.039,0.037,0.076 +"Lateral septal nucleus, caudal (caudodorsal) part",0.306,0.28300000000000003,0.589 +"Primary auditory area, layer 2/3",0.23800000000000002,0.231,0.46900000000000003 +"Dorsal auditory area, layer 5",0.18,0.154,0.33399999999999996 +Anteroventral nucleus of thalamus,0.192,0.209,0.401 +"posteromedial visual area, layer 6a",0.065,0.07,0.135 +"Lateral septal nucleus, rostral (rostroventral) part",0.906,0.918,1.824 +"Nucleus of the lateral olfactory tract, molecular layer",0.05,0.049,0.099 +Reticular nucleus of the thalamus,0.6980000000000001,0.722,1.42 +Anteroventral preoptic nucleus,0.03,0.052000000000000005,0.082 +"Lateral septal nucleus, ventral part",0.29,0.3,0.59 +"Nucleus of the lateral olfactory tract, pyramidal layer",0.079,0.075,0.154 +"Posterolateral visual area, layer 2/3",0.095,0.111,0.20600000000000002 +Nucleus sagulum,0.039,0.058,0.097 +Anteroventral periventricular nucleus,0.077,0.098,0.175 +"Retrosplenial area, dorsal part, layer 6a",0.372,0.375,0.747 +"Retrosplenial area, lateral agranular part, layer 6b",0.017,0.017,0.034 +Barrington's nucleus,0.009000000000000001,0.007,0.016 +"Anteromedial visual area, layer 1",0.074,0.075,0.149 +Suprachiasmatic nucleus,0.033,0.032,0.065 +Bed nucleus of the anterior commissure,0.004,0.005,0.009000000000000001 +"Orbital area, ventrolateral part, layer 2/3",0.224,0.254,0.478 +"Temporal association areas, layer 5",0.47600000000000003,0.47200000000000003,0.9480000000000001 +Bed nucleus of the accessory olfactory tract,0.013000000000000001,0.012,0.025 +"Anterior cingulate area, ventral part, layer 2/3",0.202,0.197,0.399 +Magnocellular nucleus,0.146,0.155,0.301 +stria terminalis,0.139,0.14200000000000002,0.281 +"Basolateral amygdalar nucleus, anterior part",0.396,0.356,0.752 +"Prelimbic area, layer 2/3",0.178,0.17300000000000001,0.351 +"Primary visual area, layer 6b",0.088,0.095,0.183 +Magnocellular reticular nucleus,0.28600000000000003,0.269,0.555 +Septofimbrial nucleus,0.215,0.255,0.47 +"Basolateral amygdalar nucleus, posterior part",0.366,0.374,0.74 +Midbrain,3.203,3.412,6.615 +"Agranular insular area, posterior part, layer 6a",0.21,0.2,0.41000000000000003 +Supragenual nucleus,0.007,0.008,0.015 +"Primary motor area, Layer 1",0.652,0.641,1.2930000000000001 +Subgeniculate nucleus,0.011,0.013000000000000001,0.024 +Suprageniculate nucleus,0.097,0.091,0.188 +superior cerebelar peduncles,0.20800000000000002,0.203,0.41100000000000003 +"Basomedial amygdalar nucleus, anterior part",0.41100000000000003,0.383,0.794 +"Agranular insular area, dorsal part, layer 2/3",0.452,0.466,0.918 +"Retrosplenial area, dorsal part, layer 6b",0.018000000000000002,0.02,0.038000000000000006 +Accessory supraoptic group,0.001,0.002,0.003 +Septohippocampal nucleus,0.017,0.016,0.033 +"Basomedial amygdalar nucleus, posterior part",0.341,0.371,0.712 +"Perirhinal area, layer 6a",0.026000000000000002,0.036000000000000004,0.062000000000000006 +superior colliculus commissure,0.015,0.021,0.036000000000000004 +Subfornical organ,0.007,0.016,0.023 +Substantia innominata,1.551,1.5090000000000001,3.06 +"Agranular insular area, posterior part, layer 5",0.378,0.386,0.764 +Subparaventricular zone,0.076,0.046,0.122 +supraoptic commissures,0.017,0.016,0.033 +Subceruleus nucleus,0.014,0.015,0.028999999999999998 +Bed nuclei of the stria terminalis,0.6910000000000001,0.671,1.362 +Medulla,2.545,2.781,5.3260000000000005 +"Agranular insular area, posterior part, layer 6b",0.01,0.009000000000000001,0.019000000000000003 +Preparasubthalamic nucleus,0.007,0.011,0.018 +Sublaterodorsal nucleus,0.019,0.024,0.043 +Mediodorsal nucleus of thalamus,0.6940000000000001,0.675,1.3690000000000002 +"Prelimbic area, layer 5",0.503,0.47800000000000004,0.9810000000000001 +Parasubthalamic nucleus,0.067,0.08600000000000001,0.15300000000000002 +Submedial nucleus of the thalamus,0.135,0.161,0.29600000000000004 +"Perirhinal area, layer 6b",0.009000000000000001,0.008,0.017 +Infracerebellar nucleus,0.026000000000000002,0.025,0.051000000000000004 +"Substantia nigra, compact part",0.10200000000000001,0.095,0.197 +"Posterolateral visual area, layer 6a",0.042,0.041,0.083 +cuneate fascicle,0.007,0.01,0.017 +"Substantia nigra, reticular part",0.768,0.6950000000000001,1.463 +Field CA1,5.064,5.034,10.097999999999999 +Supraoptic nucleus,0.019,0.022,0.040999999999999995 +"Posterolateral visual area, layer 6b",0.004,0.003,0.007 +ventral tegmental decussation,0.019,0.034,0.053000000000000005 +"Anteromedial visual area, layer 4",0.032,0.028,0.06 +Medial amygdalar nucleus,1.058,1.0230000000000001,2.0810000000000004 +"Orbital area, lateral part, layer 2/3",0.292,0.27,0.562 +vestibular nerve,0.115,0.12,0.235 +"Subparafascicular nucleus, magnocellular part",0.039,0.033,0.07200000000000001 +"Lateral visual area, layer 1",0.096,0.08600000000000001,0.182 +"Subparafascicular nucleus, parvicellular part",0.073,0.06,0.133 +Field CA2,0.214,0.218,0.432 +Ectorhinal area/Layer 2/3,0.23900000000000002,0.224,0.463 +medial corticohypothalamic tract,0.005,0.005,0.01 +"Spinal nucleus of the trigeminal, caudal part",0.8150000000000001,0.861,1.6760000000000002 +"Retrosplenial area, ventral part, layer 2/3",0.521,0.511,1.032 +"Anteromedial visual area, layer 5",0.114,0.105,0.219 +"Retrosplenial area, dorsal part, layer 2/3",0.47500000000000003,0.46900000000000003,0.9440000000000001 +columns of the fornix,0.14300000000000002,0.147,0.29000000000000004 +"Spinal nucleus of the trigeminal, interpolar part",0.985,0.931,1.916 +"Orbital area, lateral part, layer 6a",0.217,0.23700000000000002,0.454 +"Anteromedial visual area, layer 6b",0.014,0.015,0.028999999999999998 +"Retrosplenial area, dorsal part, layer 1",0.397,0.41000000000000003,0.807 +dorsal hippocampal commissure,0.47000000000000003,0.48,0.95 +"Spinal nucleus of the trigeminal, oral part",0.515,0.535,1.05 +"Orbital area, lateral part, layer 1",0.184,0.163,0.347 +ventral hippocampal commissure,0.029,0.04,0.069 +"Primary somatosensory area, upper limb, layer 1",0.246,0.249,0.495 +"Basolateral amygdalar nucleus, ventral part",0.201,0.22,0.42100000000000004 +Median preoptic nucleus,0.002,0.03,0.032 +"Posterior auditory area, layer 6b",0.007,0.007,0.014 +Midbrain trigeminal nucleus,0.006,0.007,0.013000000000000001 +"Primary somatosensory area, trunk, layer 6b",0.021,0.021,0.042 +Field CA3,3.109,3.031,6.140000000000001 +alveus,0.679,0.6900000000000001,1.3690000000000002 +"posteromedial visual area, layer 6b",0.018000000000000002,0.019,0.037000000000000005 +Subthalamic nucleus,0.107,0.112,0.219 +Striatum,1.33,1.4060000000000001,2.736 +"Primary somatosensory area, lower limb, layer 6a",0.31,0.251,0.5609999999999999 +brachium of the inferior colliculus,0.11900000000000001,0.122,0.241 +Medial habenula,0.145,0.135,0.28 +"Orbital area, medial part, layer 1",0.166,0.267,0.43300000000000005 +"Orbital area, lateral part, layer 6b",0.017,0.021,0.038000000000000006 +"posteromedial visual area, layer 4",0.041,0.042,0.083 +Subiculum,1.092,1.0130000000000001,2.1050000000000004 +dorsal acoustic stria,0.006,0.007,0.013000000000000001 +Main olfactory bulb,3.569,3.8080000000000003,7.377000000000001 +"Primary somatosensory area, lower limb, layer 6b",0.022,0.019,0.040999999999999995 +Cerebellum,0.41100000000000003,0.395,0.806 +Medial preoptic nucleus,0.227,0.218,0.445 +"Ventral auditory area, layer 6a",0.14100000000000001,0.14,0.281 +Medial preoptic area,0.257,0.28400000000000003,0.541 +Supramammillary nucleus,0.127,0.14100000000000001,0.268 +"Entorhinal area, medial part, dorsal zone, layer 1",0.615,0.624,1.2389999999999999 +"Dorsal auditory area, layer 1",0.073,0.095,0.16799999999999998 +dorsal fornix,0.015,0.024,0.039 +Medial pretectal area,0.024,0.021,0.045 +Supratrigeminal nucleus,0.137,0.10200000000000001,0.23900000000000002 +dorsal limb,0.076,0.078,0.154 +"Perirhinal area, layer 1",0.116,0.111,0.227 +"Retrosplenial area, ventral part, layer 1",0.332,0.551,0.883 +"Entorhinal area, medial part, dorsal zone, layer 2",0.651,0.639,1.29 +"Central amygdalar nucleus, capsular part",0.138,0.177,0.315 +Thalamus,0.436,0.42,0.856 +"Central amygdalar nucleus, lateral part",0.132,0.138,0.27 +dorsal spinocerebellar tract,0.075,0.077,0.152 +"Infralimbic area, layer 2/3",0.079,0.07,0.14900000000000002 +"Primary somatosensory area, nose, layer 1",0.20600000000000002,0.20700000000000002,0.41300000000000003 +"Central amygdalar nucleus, medial part",0.354,0.392,0.746 +Medial septal nucleus,0.122,0.28400000000000003,0.406 +"posteromedial visual area, layer 5",0.125,0.152,0.277 +Postpiriform transition area,0.705,0.66,1.365 +"Lateral visual area, layer 4",0.095,0.083,0.178 +Tegmental reticular nucleus,0.34600000000000003,0.337,0.683 +Central lateral nucleus of the thalamus,0.168,0.182,0.35 +Accessory facial motor nucleus,0.002,0.003,0.005 +"Primary somatosensory area, upper limb, layer 4",0.228,0.255,0.483 +external capsule,0.442,0.447,0.889 +Nucleus of the brachium of the inferior colliculus,0.043000000000000003,0.04,0.083 +Triangular nucleus of septum,0.151,0.194,0.345 +"Orbital area, medial part, layer 2/3",0.154,0.148,0.302 +Claustrum,0.278,0.267,0.545 +Nucleus of Darkschewitsch,0.057,0.063,0.12 +"Anterior cingulate area, ventral part, layer 1",0.179,0.324,0.503 +"Retrosplenial area, ventral part, layer 6a",0.302,0.319,0.621 +Central linear nucleus raphe,0.037,0.061,0.098 +"Primary visual area, layer 1",0.625,0.587,1.212 +fasciculus retroflexus,0.084,0.081,0.165 +Diagonal band nucleus,0.343,0.387,0.73 +"Taenia tecta, dorsal part",0.333,0.389,0.722 +"Ventral auditory area, layer 6b",0.017,0.026000000000000002,0.043000000000000003 +Central medial nucleus of the thalamus,0.098,0.151,0.249 +"Dorsal auditory area, layer 2/3",0.15,0.145,0.295 +"Anterolateral visual area, layer 6a",0.062,0.05,0.112 +fimbria,0.761,0.726,1.487 +Nucleus incertus,0.043000000000000003,0.067,0.11000000000000001 +"Taenia tecta, ventral part",0.343,0.355,0.698 +"Orbital area, ventrolateral part, layer 6a",0.116,0.096,0.21200000000000002 +Subparafascicular area,0.053,0.088,0.141 +"Retrosplenial area, dorsal part, layer 5",0.586,0.585,1.1709999999999998 +habenular commissure,0.016,0.023,0.039 +Nucleus of the lateral lemniscus,0.383,0.375,0.758 +"Lateral visual area, layer 5",0.166,0.15,0.316 +Tuberal nucleus,0.271,0.275,0.546 +Cuneiform nucleus,0.277,0.28400000000000003,0.561 +"Orbital area, medial part, layer 5",0.222,0.232,0.454 +Motor nucleus of trigeminal,0.185,0.181,0.366 +"Retrosplenial area, ventral part, layer 6b",0.018000000000000002,0.031,0.049 +"Primary somatosensory area, upper limb, layer 5",0.338,0.358,0.696 +Nucleus of the optic tract,0.09,0.108,0.198 +Ventral anterior-lateral complex of the thalamus,0.392,0.392,0.784 +"Orbital area, lateral part, layer 5",0.56,0.555,1.1150000000000002 +"Dentate gyrus, granule cell layer",0.8130000000000001,0.776,1.589 +inferior colliculus commissure,0.009000000000000001,0.011,0.02 +Nucleus of the posterior commissure,0.147,0.151,0.298 +"Gustatory areas, layer 6a",0.21,0.22,0.43 +"Cortical amygdalar area, anterior part",0.381,0.398,0.779 +Nucleus of the trapezoid body,0.08,0.08,0.16 +"Posterior auditory area, layer 2/3",0.075,0.061,0.136 +"Primary motor area, Layer 5",1.414,1.554,2.968 +"Anterolateral visual area, layer 6b",0.02,0.017,0.037000000000000005 +Nucleus of the solitary tract,0.41200000000000003,0.442,0.8540000000000001 +Abducens nucleus,0.021,0.02,0.041 +"Primary somatosensory area, nose, layer 4",0.272,0.271,0.543 +"Cortical amygdalar area, posterior part, lateral zone",0.619,0.616,1.2349999999999999 +"Secondary motor area, layer 1",1.1420000000000001,1.182,2.324 +"Primary somatosensory area, mouth, layer 2/3",0.744,0.727,1.471 +lateral lemniscus,0.429,0.418,0.847 +Facial motor nucleus,0.467,0.461,0.928 +"Gustatory areas, layer 6b",0.024,0.02,0.044 +"Cortical amygdalar area, posterior part, medial zone",0.6960000000000001,0.655,1.351 +"Entorhinal area, medial part, dorsal zone, layer 3",0.503,0.497,1.0 +"lateral olfactory tract, body",0.48,0.456,0.9359999999999999 +"Frontal pole, layer 2/3",0.131,0.101,0.232 +"Primary somatosensory area, trunk, layer 2/3",0.18,0.20600000000000002,0.386 +"Retrosplenial area, lateral agranular part, layer 1",0.228,0.243,0.471 +Caudoputamen,12.790000000000001,12.685,25.475 +mammillary peduncle,0.017,0.014,0.031 +"Agranular insular area, ventral part, layer 6a",0.09,0.092,0.182 +"Dorsal auditory area, layer 4",0.065,0.055,0.12 +Superior central nucleus raphe,0.277,0.35000000000000003,0.627 +"Orbital area, ventrolateral part, layer 6b",0.003,0.003,0.006 +mammillotegmental tract,0.033,0.029,0.062 +Ventral medial nucleus of the thalamus,0.47700000000000004,0.468,0.9450000000000001 +"Retrosplenial area, ventral part, layer 5",0.786,0.8320000000000001,1.618 +Ventrolateral preoptic nucleus,0.038,0.03,0.068 +mammillothalamic tract,0.06,0.063,0.123 +"Perirhinal area, layer 5",0.082,0.077,0.159 +Ventromedial hypothalamic nucleus,0.28700000000000003,0.292,0.579 +"Agranular insular area, ventral part, layer 2/3",0.28500000000000003,0.3,0.585 +"Posterior auditory area, layer 1",0.05,0.05,0.1 +medial lemniscus,0.343,0.321,0.664 +Olfactory areas,1.425,1.435,2.8600000000000003 +"Agranular insular area, ventral part, layer 6b",0.001,0.001,0.002 +"Primary somatosensory area, nose, layer 5",0.309,0.28,0.589 +Cortical subplate,0.184,0.194,0.378 +"Agranular insular area, ventral part, layer 1",0.124,0.124,0.248 +Olivary pretectal nucleus,0.03,0.029,0.059 +"Infralimbic area, layer 1",0.048,0.1,0.14800000000000002 +Cuneate nucleus,0.149,0.17300000000000001,0.322 +Ventral posterolateral nucleus of the thalamus,0.42,0.443,0.863 +"Primary visual area, layer 4",0.507,0.482,0.989 +"Ventral posterolateral nucleus of the thalamus, parvicellular part",0.053,0.051000000000000004,0.10400000000000001 +"Entorhinal area, medial part, dorsal zone, layer 5",0.467,0.46,0.927 +arbor vitae,3.307,3.459,6.766 +"Temporal association areas, layer 6a",0.261,0.254,0.515 +"Medial mammillary nucleus, median part",0.023,0.045,0.068 +Ventral posteromedial nucleus of the thalamus,0.807,0.854,1.661 +"Primary auditory area, layer 1",0.189,0.177,0.366 +"Ventral posteromedial nucleus of the thalamus, parvicellular part",0.11900000000000001,0.129,0.248 +"Entorhinal area, medial part, dorsal zone, layer 6",0.334,0.321,0.655 +cerebellar commissure,0.022,0.037,0.059 +Ventral tegmental area,0.234,0.223,0.457 +"Posterolateral visual area, layer 1",0.094,0.11,0.20400000000000001 +principal mammillary tract,0.02,0.021,0.041 +Olfactory tubercle,1.98,1.958,3.9379999999999997 +"Ventral auditory area, layer 2/3",0.20500000000000002,0.20600000000000002,0.41100000000000003 +Ventral tegmental nucleus,0.017,0.017,0.034 +"Posterior auditory area, layer 4",0.043000000000000003,0.038,0.081 +Nucleus x,0.031,0.027,0.057999999999999996 +"Secondary motor area, layer 5",2.337,2.093,4.43 +Pons,1.737,1.95,3.6870000000000003 +"Anterior cingulate area, ventral part, layer 5",0.525,0.506,1.0310000000000001 +Hypoglossal nucleus,0.11900000000000001,0.14100000000000001,0.26 +"Retrosplenial area, lateral agranular part, layer 5",0.352,0.36,0.712 +"Primary visual area, layer 5",0.771,0.768,1.5390000000000001 +Posterior amygdalar nucleus,0.482,0.504,0.986 +Nucleus y,0.011,0.011,0.022 +"Agranular insular area, dorsal part, layer 6a",0.388,0.392,0.78 +corticospinal tract,0.047,0.049,0.096 +"Temporal association areas, layer 6b",0.046,0.033,0.079 +Piriform-amygdalar area,0.626,0.636,1.262 +"Posterior auditory area, layer 5",0.092,0.08600000000000001,0.178 +spinal tract of the trigeminal nerve,0.849,0.838,1.6869999999999998 +Periaqueductal gray,1.924,2.092,4.016 +Zona incerta,0.802,0.749,1.5510000000000002 +facial nerve,0.04,0.028,0.068 +"Agranular insular area, ventral part, layer 5",0.34900000000000003,0.358,0.7070000000000001 +stria medullaris,0.135,0.129,0.264 +Pallidum,0.586,0.5740000000000001,1.1600000000000001 +Fields of Forel,0.132,0.124,0.256 +"posteromedial visual area, layer 1",0.085,0.076,0.161 +"Supplemental somatosensory area, layer 2/3",1.05,1.0170000000000001,2.067 +"Anterior cingulate area, ventral part, 6a",0.183,0.17400000000000002,0.357 +"Inferior colliculus, central nucleus",0.518,0.5670000000000001,1.085 +superior cerebellar peduncle decussation,0.013000000000000001,0.029,0.042 +Dorsal peduncular area,0.241,0.244,0.485 +"Primary auditory area, layer 4",0.115,0.111,0.226 +"Anterior cingulate area, ventral part, 6b",0.027,0.029,0.056 +"Inferior colliculus, dorsal nucleus",0.627,0.649,1.276 +"Primary visual area, layer 2/3",0.981,0.9430000000000001,1.924 +"Infralimbic area, layer 5",0.14100000000000001,0.134,0.275 +"Inferior colliculus, external nucleus",0.993,0.989,1.982 +Dorsomedial nucleus of the hypothalamus,0.20400000000000001,0.189,0.393 +"Agranular insular area, dorsal part, layer 6b",0.023,0.023,0.046 +oculomotor nerve,0.005,0.004,0.009000000000000001 +"Superior colliculus, zonal layer",0.139,0.166,0.30500000000000005 +Ectorhinal area/Layer 1,0.129,0.149,0.278 +"Primary somatosensory area, nose, layer 2/3",0.309,0.306,0.615 +Dorsal motor nucleus of the vagus nerve,0.074,0.09,0.16399999999999998 +trapezoid body,0.156,0.183,0.33899999999999997 +"Superior colliculus, superficial gray layer",0.5630000000000001,0.559,1.122 +Parasubiculum,0.47900000000000004,0.451,0.93 +"Primary motor area, Layer 6a",1.438,1.389,2.827 +Dentate nucleus,0.176,0.151,0.32699999999999996 +"Primary auditory area, layer 5",0.319,0.326,0.645 +optic nerve,0.034,0.045,0.079 +"Visceral area, layer 6b",0.024,0.016,0.04 +uncinate fascicle,0.042,0.049,0.091 +"Superior colliculus, optic layer",0.297,0.326,0.623 +Parvicellular reticular nucleus,1.208,1.186,2.394 +"Primary somatosensory area, upper limb, layer 2/3",0.511,0.461,0.972 +"Visceral area, layer 6a",0.267,0.258,0.525 +Parasolitary nucleus,0.015,0.013000000000000001,0.028 +"Supplemental somatosensory area, layer 6a",1.02,0.985,2.005 +rubrospinal tract,0.295,0.28500000000000003,0.5800000000000001 +ventral spinocerebellar tract,0.156,0.154,0.31 +Parabrachial nucleus,0.458,0.47900000000000004,0.937 +"Posterolateral visual area, layer 4",0.013000000000000001,0.012,0.025 +Dorsal nucleus raphe,0.031,0.116,0.14700000000000002 +"Supplemental somatosensory area, layer 1",0.655,0.626,1.2810000000000001 +Parabigeminal nucleus,0.02,0.025,0.045 +"Primary somatosensory area, mouth, layer 1",0.373,0.372,0.745 +Dorsal tegmental nucleus,0.055,0.043000000000000003,0.098 +"Primary motor area, Layer 6b",0.10400000000000001,0.101,0.20500000000000002 +amygdalar capsule,0.083,0.092,0.175 +"Perirhinal area, layer 2/3",0.165,0.154,0.319 +"Primary somatosensory area, nose, layer 6a",0.424,0.386,0.81 +"Supplemental somatosensory area, layer 6b",0.101,0.093,0.194 +"Visceral area, layer 1",0.164,0.146,0.31 +Pontine central gray,0.267,0.23500000000000001,0.502 +"anterior commissure, olfactory limb",0.38,0.41000000000000003,0.79 +"Posterolateral visual area, layer 5",0.105,0.106,0.211 +External cuneate nucleus,0.10300000000000001,0.106,0.20900000000000002 +"Anterolateral visual area, layer 2/3",0.093,0.1,0.193 +"Retrosplenial area, lateral agranular part, layer 6a",0.20400000000000001,0.20500000000000002,0.40900000000000003 +Paracentral nucleus,0.111,0.107,0.218 +"anterior commissure, temporal limb",0.117,0.106,0.223 +"Orbital area, medial part, layer 6a",0.091,0.082,0.173 +trochlear nerve,0.004,0.005,0.009000000000000001 +Lingula (I),0.042,0.069,0.11100000000000002 +Posterodorsal preoptic nucleus,0.003,0.005,0.008 +brachium of the superior colliculus,0.08700000000000001,0.088,0.175 +"Anterior cingulate area, dorsal part, layer 6a",0.34400000000000003,0.368,0.712 +cerebal peduncle,0.465,0.494,0.9590000000000001 +"Anterior cingulate area, dorsal part, layer 6b",0.014,0.012,0.026000000000000002 +"Primary somatosensory area, nose, layer 6b",0.023,0.028,0.051000000000000004 +Parafascicular nucleus,0.23800000000000002,0.26,0.498 +Pontine gray,0.507,0.486,0.993 +"Anterior cingulate area, dorsal part, layer 1",0.213,0.36,0.573 +Declive (VI),1.571,1.614,3.185 +"Nucleus ambiguus, dorsal division",0.013000000000000001,0.015,0.028 +cingulum bundle,0.638,0.612,1.25 +"Primary motor area, Layer 2/3",1.9180000000000001,1.766,3.684 +Folium-tuber vermis (VII),0.547,0.5,1.0470000000000002 +"Primary somatosensory area, upper limb, layer 6a",0.512,0.434,0.946 +Posterior hypothalamic nucleus,0.32,0.342,0.662 +vomeronasal nerve,0.005,0.01,0.015 +"Primary somatosensory area, mouth, layer 4",0.426,0.456,0.882 +Pyramus (VIII),0.553,0.639,1.1920000000000002 +"Endopiriform nucleus, dorsal part",0.912,0.886,1.798 +"Primary auditory area, layer 6a",0.126,0.133,0.259 +"Lateral reticular nucleus, magnocellular part",0.276,0.262,0.538 +"corpus callosum, anterior forceps",0.438,0.422,0.86 +Uvula (IX),0.982,1.168,2.15 +"Ventral auditory area, layer 1",0.139,0.134,0.273 +Piriform area,5.811,5.809,11.620000000000001 +"Secondary motor area, layer 2/3",1.924,1.827,3.751 +"Lateral reticular nucleus, parvicellular part",0.033,0.032,0.065 +"corpus callosum, extreme capsule",0.057,0.048,0.10500000000000001 +"Retrosplenial area, lateral agranular part, layer 2/3",0.295,0.308,0.603 +"Endopiriform nucleus, ventral part",0.491,0.486,0.977 +Nodulus (X),0.665,0.798,1.463 +"Orbital area, ventrolateral part, layer 1",0.178,0.194,0.372 +"Paragigantocellular reticular nucleus, dorsal part",0.11800000000000001,0.105,0.223 +"corpus callosum, posterior forceps",0.681,0.661,1.342 +"Lateral visual area, layer 2/3",0.16,0.133,0.29300000000000004 +"Primary somatosensory area, mouth, layer 5",0.601,0.5710000000000001,1.1720000000000002 +Lobule II,0.553,0.71,1.263 +Ectorhinal area/Layer 6a,0.20400000000000001,0.184,0.388 +"Paragigantocellular reticular nucleus, lateral part",0.381,0.357,0.738 +Dorsal premammillary nucleus,0.065,0.062,0.127 +"Primary somatosensory area, barrel field, layer 1",0.393,0.39,0.783 +Fasciola cinerea,0.028,0.031,0.059 +Lobule III,1.219,1.441,2.66 +"corpus callosum, splenium",0.337,0.328,0.665 +Ectorhinal area/Layer 5,0.269,0.242,0.511 +Fastigial nucleus,0.242,0.258,0.5 +"Ventral auditory area, layer 4",0.111,0.10300000000000001,0.21400000000000002 +"Agranular insular area, dorsal part, layer 1",0.226,0.224,0.45 +root,1.661,1.8780000000000001,3.539 +Fundus of striatum,0.23600000000000002,0.20700000000000002,0.44300000000000006 +Ventral premammillary nucleus,0.10300000000000001,0.10200000000000001,0.20500000000000002 +"Primary auditory area, layer 6b",0.023,0.025,0.048 +"Primary somatosensory area, trunk, layer 1",0.089,0.089,0.178 +Simple lobule,2.822,2.6350000000000002,5.457000000000001 +fiber tracts,0.773,0.797,1.57 +"Visceral area, layer 4",0.096,0.089,0.185 +"Anterior cingulate area, dorsal part, layer 5",0.537,0.582,1.119 +olfactory nerve layer of main olfactory bulb,0.459,0.496,0.9550000000000001 +Posterior complex of the thalamus,0.653,0.618,1.271 +"Secondary motor area, layer 6a",0.998,1.176,2.174 +"Globus pallidus, external segment",0.803,0.772,1.5750000000000002 +"Ventral auditory area, layer 5",0.303,0.3,0.603 +Paramedian lobule,2.474,2.4090000000000003,4.883000000000001 +"Primary somatosensory area, upper limb, layer 6b",0.043000000000000003,0.043000000000000003,0.08600000000000001 +Posterior limiting nucleus of the thalamus,0.098,0.095,0.193 +"Primary somatosensory area, lower limb, layer 1",0.168,0.147,0.315 +"Globus pallidus, internal segment",0.20400000000000001,0.17300000000000001,0.377 +Copula pyramidis,1.223,1.075,2.298 +"Supplemental somatosensory area, layer 4",0.5760000000000001,0.5710000000000001,1.1470000000000002 +Postsubiculum,0.537,0.523,1.06 +"Primary somatosensory area, barrel field, layer 6a",0.598,0.62,1.218 +Gracile nucleus,0.038,0.042,0.08 +Paraflocculus,2.898,2.839,5.737 +crossed tectospinal pathway,0.25,0.252,0.502 +Peripeduncular nucleus,0.036000000000000004,0.036000000000000004,0.07200000000000001 +Ectorhinal area/Layer 6b,0.031,0.022,0.053 +"Anteromedial visual area, layer 6a",0.061,0.058,0.119 +"Primary somatosensory area, barrel field, layer 4",0.67,0.614,1.284 +Gigantocellular reticular nucleus,1.276,1.31,2.5860000000000003 +Flocculus,0.663,0.675,1.338 +Pedunculopontine nucleus,0.47900000000000004,0.388,0.867 +"Infralimbic area, layer 6a",0.101,0.093,0.194 +Crus 1,2.844,2.818,5.662 +"Visceral area, layer 5",0.357,0.328,0.685 +doral tegmental decussation,0.001,0.002,0.003 +Posterior pretectal nucleus,0.07100000000000001,0.07,0.14100000000000001 +"Primary somatosensory area, barrel field, layer 6b",0.056,0.07,0.126 +Crus 2,2.503,2.561,5.064 +"Anteromedial visual area, layer 2/3",0.114,0.099,0.21300000000000002 +Parapyramidal nucleus,0.055,0.052000000000000005,0.10700000000000001 +"Primary somatosensory area, barrel field, layer 5",0.612,0.5730000000000001,1.185 +"Medial geniculate complex, dorsal part",0.083,0.081,0.164 +"Anterolateral visual area, layer 1",0.05,0.066,0.116 +Perireunensis nucleus,0.079,0.081,0.16 +"Medial geniculate complex, ventral part",0.128,0.125,0.253 +"Infralimbic area, layer 6b",0.004,0.005,0.009000000000000001 +Presubiculum,0.463,0.45,0.913 +"Secondary motor area, layer 6b",0.037,0.039,0.076 +"Primary somatosensory area, trunk, layer 4",0.066,0.07100000000000001,0.137 +"Medial geniculate complex, medial part",0.117,0.112,0.229 +Hippocampal formation,0.20400000000000001,0.213,0.41700000000000004 +"Supplemental somatosensory area, layer 5",1.041,1.057,2.098 +Lobules IV-V,3.1950000000000003,3.388,6.583 +external medullary lamina of the thalamus,0.048,0.054,0.10200000000000001 +"Pontine reticular nucleus, caudal part",1.198,1.214,2.412 +"Primary somatosensory area, lower limb, layer 4",0.109,0.14100000000000001,0.25 +"Anteromedial nucleus, dorsal part",0.13,0.12,0.25 +Hypothalamus,1.358,1.399,2.757 +"Medullary reticular nucleus, dorsal part",0.509,0.528,1.037 +"Agranular insular area, dorsal part, layer 5",0.742,0.755,1.4969999999999999 +"Primary somatosensory area, mouth, layer 6a",0.874,0.775,1.649 +"Anteromedial nucleus, ventral part",0.097,0.075,0.172 +Intercalated amygdalar nucleus,0.10300000000000001,0.08700000000000001,0.19 +"Visceral area, layer 2/3",0.263,0.248,0.511 +"Medullary reticular nucleus, ventral part",0.434,0.467,0.901 +genu of corpus callosum,0.41300000000000003,0.439,0.8520000000000001 +Parastrial nucleus,0.058,0.046,0.10400000000000001 +"Primary somatosensory area, trunk, layer 5",0.189,0.17,0.359 +Interanterodorsal nucleus of the thalamus,0.058,0.067,0.125 +"Anterolateral visual area, layer 4",0.059000000000000004,0.051000000000000004,0.11000000000000001 +genu of the facial nerve,0.018000000000000002,0.009000000000000001,0.027000000000000003 +Interanteromedial nucleus of the thalamus,0.024,0.026000000000000002,0.05 +"Entorhinal area, lateral part, layer 1",0.496,0.49,0.986 +inferior cerebellar peduncle,0.38,0.37,0.75 +"Orbital area, ventrolateral part, layer 5",0.28500000000000003,0.3,0.585 +"Tuberomammillary nucleus, dorsal part",0.02,0.022,0.041999999999999996 +"Temporal association areas, layer 2/3",0.372,0.352,0.724 +"Primary somatosensory area, lower limb, layer 5",0.23,0.292,0.522 +"Nucleus of the lateral olfactory tract, layer 3",0.035,0.029,0.064 +Median eminence,0.032,0.055,0.087 +"Dentate gyrus, molecular layer",2.215,2.094,4.308999999999999 +"Dentate gyrus, polymorph layer",0.324,0.305,0.629 +"Primary somatosensory area, unassigned, layer 1",0.08600000000000001,0.068,0.15400000000000003 +"Primary somatosensory area, unassigned, layer 2/3",0.153,0.166,0.319 +"Primary somatosensory area, unassigned, layer 4",0.08,0.084,0.164 +"Primary somatosensory area, unassigned, layer 5",0.128,0.11900000000000001,0.247 +"Primary somatosensory area, unassigned, layer 6a",0.167,0.145,0.312 +"Primary somatosensory area, unassigned, layer 6b",0.014,0.014,0.028 +"Anterior area, layer 1",0.1,0.12,0.22 +"Anterior area, layer 2/3",0.221,0.215,0.436 +"Anterior area, layer 4",0.08700000000000001,0.074,0.161 +"Anterior area, layer 5",0.21,0.169,0.379 +"Anterior area, layer 6a",0.11,0.10200000000000001,0.21200000000000002 +"Anterior area, layer 6b",0.022,0.021,0.043 +"Laterointermediate area, layer 1",0.038,0.033,0.07100000000000001 +"Laterointermediate area, layer 2/3",0.067,0.055,0.122 +"Laterointermediate area, layer 4",0.029,0.029,0.058 +"Laterointermediate area, layer 5",0.078,0.07100000000000001,0.14900000000000002 +"Laterointermediate area, layer 6a",0.041,0.031,0.07200000000000001 +"Laterointermediate area, layer 6b",0.008,0.009000000000000001,0.017 +"Rostrolateral area, layer 1",0.09,0.081,0.17099999999999999 +"Rostrolateral area, layer 2/3",0.14300000000000002,0.133,0.276 +"Rostrolateral area, layer 4",0.069,0.069,0.138 +"Rostrolateral area, layer 5",0.11,0.12,0.22999999999999998 +"Rostrolateral area, layer 6a",0.076,0.079,0.155 +"Rostrolateral area, layer 6b",0.008,0.014,0.022 +"Postrhinal area, layer 1",0.115,0.11800000000000001,0.233 +"Postrhinal area, layer 2/3",0.179,0.165,0.344 +"Postrhinal area, layer 4",0.031,0.031,0.062 +"Postrhinal area, layer 5",0.177,0.191,0.368 +"Postrhinal area, layer 6a",0.083,0.093,0.176 +"Postrhinal area, layer 6b",0.019,0.019,0.038 +Prosubiculum,0.5760000000000001,0.5680000000000001,1.1440000000000001 +Area prostriata,0.183,0.17300000000000001,0.356 +supra-callosal cerebral white matter,0.548,0.51,1.058 +"corpus callosum, body",1.421,1.356,2.777 +optic radiation,0.865,0.872,1.737 +auditory radiation,0.213,0.217,0.43 +commissural branch of stria terminalis,0.018000000000000002,0.019,0.037000000000000005 +"Dorsal part of the lateral geniculate complex, shell",0.105,0.1,0.20500000000000002 +"Dorsal part of the lateral geniculate complex, core",0.209,0.20500000000000002,0.41400000000000003 +"Dorsal part of the lateral geniculate complex, ipsilateral zone",0.044,0.042,0.086 +"Frontal pole, layer 5",0.189,0.161,0.35 +"Frontal pole, layer 6a",0.047,0.056,0.10300000000000001 +"Frontal pole, layer 6b",0.001,0.001,0.002 +"Orbital area, medial part, layer 6b",0.004,0.001,0.005 +Retroparafascicular nucleus,0.029,0.029,0.058 +Medial accesory oculomotor nucleus,0.01,0.01,0.02 +Peritrigeminal zone,0.17500000000000002,0.155,0.33 +Accessory trigeminal nucleus,0.006,0.009000000000000001,0.015000000000000001 +Parvicellular motor 5 nucleus,0.033,0.031,0.064 +Intertrigeminal nucleus,0.024,0.029,0.053000000000000005 +Ethmoid nucleus of the thalamus,0.125,0.113,0.238 +Xiphoid thalamic nucleus,0.007,0.07200000000000001,0.07900000000000001 +Posterior intralaminar thalamic nucleus,0.095,0.084,0.179 +Posterior triangular thalamic nucleus,0.135,0.136,0.271 +Intermediate geniculate nucleus,0.011,0.009000000000000001,0.02 +Ventromedial preoptic nucleus,0.023,0.022,0.045 +Perifornical nucleus,0.117,0.098,0.21500000000000002 +Hippocampo-amygdalar transition area,0.198,0.194,0.392 +Paratrigeminal nucleus,0.055,0.051000000000000004,0.10600000000000001 +Vestibulocerebellar nucleus,0.041,0.046,0.087 +Subcommissural organ,0.002,0.009000000000000001,0.011000000000000001 +Posterodorsal tegmental nucleus,0.019,0.014,0.033 +"Medial mammillary nucleus, lateral part",0.108,0.112,0.22 +"Medial mammillary nucleus, medial part",0.069,0.069,0.138 +"Medial mammillary nucleus, posterior part",0.012,0.022,0.034 +"Medial mammillary nucleus, dorsal part",0.032,0.041,0.07300000000000001 +Paratrochlear nucleus,0.011,0.01,0.020999999999999998 +Paranigral nucleus,0.012,0.011,0.023 +"Interpeduncular nucleus, rostral",0.029,0.051000000000000004,0.08 +"Interpeduncular nucleus, caudal",0.02,0.042,0.062 +"Interpeduncular nucleus, apical",0.005,0.014,0.019 +"Interpeduncular nucleus, lateral",0.027,0.028,0.055 +"Interpeduncular nucleus, intermediate",0.017,0.022,0.039 +"Interpeduncular nucleus, dorsomedial",0.011,0.011,0.022 +"Interpeduncular nucleus, dorsolateral",0.017,0.015,0.032 +"Interpeduncular nucleus, rostrolateral",0.009000000000000001,0.009000000000000001,0.018000000000000002 +Supraoculomotor periaqueductal gray,0.017,0.016,0.033 diff --git a/tests/data/xml/broken.xml b/tests/data/xml/broken.xml new file mode 100644 index 0000000..81c545e --- /dev/null +++ b/tests/data/xml/broken.xml @@ -0,0 +1 @@ +1234 diff --git a/tests/data/xml/cell_classification.xml b/tests/data/xml/cell_classification.xml new file mode 100644 index 0000000..efdc23b --- /dev/null +++ b/tests/data/xml/cell_classification.xml @@ -0,0 +1,640 @@ + + + + placeholder.tif + + + 1 + + 1 + + 3422 + 2089 + 11 + + + 3407 + 2580 + 11 + + + 1229 + 2570 + 11 + + + 1265 + 1055 + 11 + + + 942 + 1133 + 11 + + + 901 + 1235 + 11 + + + 2771 + 1245 + 11 + + + 2194 + 1252 + 11 + + + 1351 + 1259 + 11 + + + 1715 + 1324 + 11 + + + 2842 + 1341 + 11 + + + 1533 + 1372 + 11 + + + 1336 + 2135 + 2540 + + + 1336 + 3066 + 2540 + + + 1280 + 3221 + 2540 + + + 1556 + 2034 + 2540 + + + 1121 + 2114 + 2540 + + + 2028 + 2137 + 2540 + + + 1923 + 2386 + 2540 + + + 2057 + 2731 + 2540 + + + 1860 + 2739 + 2540 + + + 1399 + 3301 + 2540 + + + + 2 + + 1674 + 2441 + 20 + + + 2194 + 2810 + 120 + + + 1634 + 1891 + 122 + + + 3363 + 2528 + 183 + + + 2158 + 2763 + 187 + + + 1661 + 3150 + 200 + + + 2393 + 1830 + 224 + + + 1236 + 2647 + 238 + + + 1833 + 2733 + 314 + + + 2012 + 1735 + 315 + + + 2520 + 3135 + 318 + + + 2479 + 2402 + 333 + + + 977 + 3615 + 339 + + + 985 + 3616 + 339 + + + 1323 + 3061 + 368 + + + 616 + 1843 + 388 + + + 1252 + 3608 + 408 + + + 1242 + 3608 + 411 + + + 1343 + 3908 + 419 + + + 1273 + 3639 + 419 + + + 1421 + 3977 + 417 + + + 1361 + 3927 + 417 + + + 1358 + 3930 + 421 + + + 1417 + 3980 + 421 + + + 1211 + 3800 + 422 + + + 1263 + 3814 + 422 + + + 1330 + 3749 + 425 + + + 1348 + 3871 + 427 + + + 1385 + 3982 + 431 + + + 3360 + 2122 + 434 + + + 1548 + 4018 + 433 + + + 1049 + 3573 + 435 + + + 1385 + 3908 + 435 + + + 1437 + 3966 + 435 + + + 1468 + 3960 + 436 + + + 2081 + 4073 + 439 + + + 1524 + 3970 + 441 + + + 1415 + 4013 + 441 + + + 1354 + 3769 + 438 + + + 1418 + 4012 + 438 + + + 3367 + 2125 + 438 + + + 1478 + 3891 + 440 + + + 2127 + 4025 + 442 + + + 1244 + 3898 + 443 + + + 1478 + 4015 + 446 + + + 1393 + 3717 + 446 + + + 1468 + 3950 + 446 + + + 1468 + 3948 + 447 + + + 1239 + 3488 + 445 + + + 1486 + 3986 + 448 + + + 1417 + 3697 + 449 + + + 1382 + 3941 + 449 + + + 1433 + 3807 + 451 + + + 1416 + 3887 + 451 + + + 1379 + 3944 + 452 + + + 1460 + 3894 + 453 + + + 1461 + 3793 + 453 + + + 1520 + 3957 + 455 + + + 998 + 3647 + 455 + + + 1417 + 3708 + 460 + + + 1468 + 3944 + 459 + + + 1432 + 3803 + 457 + + + 1526 + 4033 + 456 + + + 1040 + 3718 + 458 + + + 1438 + 3688 + 458 + + + 1432 + 3802 + 458 + + + 1458 + 3884 + 464 + + + 1581 + 4079 + 464 + + + 1408 + 3735 + 465 + + + 1442 + 3686 + 465 + + + 1043 + 3745 + 465 + + + 1435 + 3853 + 465 + + + 1435 + 3682 + 465 + + + 1134 + 3455 + 466 + + + 1742 + 4005 + 467 + + + 1005 + 3697 + 467 + + + 1395 + 3693 + 467 + + + 2269 + 4185 + 467 + + + 1392 + 3695 + 470 + + + 1579 + 3983 + 469 + + + 1572 + 3974 + 473 + + + 1123 + 3423 + 471 + + + 2243 + 3863 + 474 + + + 1420 + 3713 + 475 + + + 1198 + 3691 + 475 + + + 1530 + 3751 + 475 + + + 2518 + 4054 + 477 + + + 1406 + 3754 + 479 + + + 1109 + 3806 + 479 + + + 1154 + 3637 + 482 + + + 1438 + 3725 + 482 + + + 1584 + 3983 + 485 + + + 636 + 2486 + 484 + + + 1346 + 3539 + 486 + + + 670 + 2735 + 486 + + + 1593 + 4069 + 488 + + + 1484 + 3983 + 489 + + + 897 + 3542 + 490 + + + 1505 + 3676 + 490 + + + 1437 + 3635 + 492 + + + 904 + 1256 + 493 + + + 887 + 3337 + 493 + + + 1996 + 3220 + 2529 + + + + diff --git a/tests/data/xml/incorrect_tag.xml b/tests/data/xml/incorrect_tag.xml new file mode 100644 index 0000000..1d5bc6d --- /dev/null +++ b/tests/data/xml/incorrect_tag.xml @@ -0,0 +1,25 @@ + + + + placeholder.tif + + + 1 + + 1 + + 1 + 2 + 3 + + + + 2 + + 4 + 5 + 6 + + + + diff --git a/tests/tests/__init__.py b/tests/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/tests/test_integration/__init__.py b/tests/tests/test_integration/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/tests/test_integration/test_brainreg_reader.py b/tests/tests/test_integration/test_brainreg_reader.py new file mode 100644 index 0000000..027ab48 --- /dev/null +++ b/tests/tests/test_integration/test_brainreg_reader.py @@ -0,0 +1,38 @@ +import pathlib + +from brainglobe_napari_io.brainreg import reader_dir + +brainreg_dir = ( + pathlib.Path(__file__).parent.parent.parent + / "data" + / "wholebrain_cell_output" + / "registration" +) + + +def test_brainreg_read_dir(): + assert ( + reader_dir.brainreg_read_dir(str(brainreg_dir)) + == reader_dir.reader_function + ) + assert reader_dir.brainreg_read_dir(brainreg_dir) is None + assert reader_dir.brainreg_read_dir(str(brainreg_dir.parent)) is None + + +def test_load_brainreg_dir(): + layers = reader_dir.reader_function(brainreg_dir) + assert len(layers) == 5 + + layer_names = [ + "brain (downsampled)", + "Registered image", + "Hemispheres", + "allen_mouse_100um", + "Boundaries", + ] + + layer_types = ["image", "image", "labels", "labels", "image"] + for idx, layer in enumerate(layers): + assert layer[1]["name"] == layer_names[idx] + assert layer[2] == layer_types[idx] + assert layer[0].shape == (135, 77, 108) diff --git a/tests/tests/test_integration/test_brainreg_reader_atlas_space.py b/tests/tests/test_integration/test_brainreg_reader_atlas_space.py new file mode 100644 index 0000000..eae241d --- /dev/null +++ b/tests/tests/test_integration/test_brainreg_reader_atlas_space.py @@ -0,0 +1,44 @@ +import pathlib + +from brainglobe_napari_io.brainreg import reader_dir_atlas_space + +brainreg_dir = ( + pathlib.Path(__file__).parent.parent.parent + / "data" + / "wholebrain_cell_output" + / "registration" +) + + +def test_brainreg_read_dir_atlas_space(): + assert ( + reader_dir_atlas_space.brainreg_read_dir_atlas_space(str(brainreg_dir)) + == reader_dir_atlas_space.reader_function + ) + assert ( + reader_dir_atlas_space.brainreg_read_dir_atlas_space(brainreg_dir) + is None + ) + assert ( + reader_dir_atlas_space.brainreg_read_dir_atlas_space( + str(brainreg_dir.parent) + ) + is None + ) + + +def test_load_brainreg_dir(): + layers = reader_dir_atlas_space.reader_function(brainreg_dir) + assert len(layers) == 3 + + layer_names = [ + "brain (downsampled)", + "Registered image", + "allen_mouse_100um", + ] + + layer_types = ["image", "image", "labels"] + for idx, layer in enumerate(layers): + assert layer[1]["name"] == layer_names[idx] + assert layer[2] == layer_types[idx] + assert layer[0].shape == (132, 80, 114) diff --git a/brainglobe_napari_io/tests/test_cellfinder_reader.py b/tests/tests/test_integration/test_cellfinder_reader.py similarity index 56% rename from brainglobe_napari_io/tests/test_cellfinder_reader.py rename to tests/tests/test_integration/test_cellfinder_reader.py index d7a265f..32db220 100644 --- a/brainglobe_napari_io/tests/test_cellfinder_reader.py +++ b/tests/tests/test_integration/test_cellfinder_reader.py @@ -4,17 +4,25 @@ from brainglobe_napari_io.cellfinder import reader_xml -test_data_dir = pathlib.Path(__file__) / ".." / "data" +xml_dir = pathlib.Path(__file__).parent.parent.parent / "data" / "xml" +xml_file = xml_dir / "cell_classification.xml" +broken_xml = xml_dir / "broken_xml.xml" +xml_with_incorrect_root_tag = xml_dir / "incorrect_tag.xml" -def test_reader_xml(): - # Basic smoke tests for the XML reader - xml_file = test_data_dir / "cell_classification.xml" +def test_is_cellfinder_xml(): assert reader_xml.is_cellfinder_xml(xml_file) assert not reader_xml.is_cellfinder_xml(__file__) + assert not reader_xml.is_cellfinder_xml(broken_xml) + assert not reader_xml.is_cellfinder_xml(xml_with_incorrect_root_tag) + + +def test_reader_xml(): assert reader_xml.cellfinder_read_xml(str(xml_file.resolve())) is not None layers = reader_xml.xml_reader(xml_file) + assert len(layers) == 2 + for layer in layers: assert len(layer) == 3 assert isinstance(layer[0], np.ndarray) diff --git a/tests/tests/test_integration/test_cellfinder_writer.py b/tests/tests/test_integration/test_cellfinder_writer.py new file mode 100644 index 0000000..cda350c --- /dev/null +++ b/tests/tests/test_integration/test_cellfinder_writer.py @@ -0,0 +1,68 @@ +import pathlib + +import numpy as np +from brainglobe_utils.cells.cells import Cell +from brainglobe_utils.IO.cells import get_cells + +from brainglobe_napari_io.cellfinder import reader_xml, writer_xml + +xml_dir = pathlib.Path(__file__).parent.parent.parent / "data" / "xml" + + +def test_xml_roundrip(tmp_path): + # Check that a read in XML file can also be written back out + validate_xml_file = xml_dir / "cell_classification.xml" + layers = reader_xml.xml_reader(validate_xml_file) + assert len(layers) == 2 + + test_xml_path = str(tmp_path / "points.xml") + paths = writer_xml.write_multiple_points_to_xml(test_xml_path, layers) + assert len(paths) == 1 + assert isinstance(paths[0], str) + assert reader_xml.is_cellfinder_xml(paths[0]) + + cells_validate = get_cells(str(validate_xml_file)) + cells_test = get_cells(test_xml_path) + assert len(cells_test) == len(cells_validate) + assert cells_test[0] == cells_validate[0] + assert cells_test[-1] == cells_validate[-1] + + +def test_xml_write_no_metadata(tmp_path): + xml_path = str(tmp_path / "points.xml") + rng = np.random.default_rng() + points = ( + rng.random((10, 3)), + { + "name": "test", + "size": 1, + "n_dimensional": True, + "opacity": 1, + "symbol": "ring", + "face_color": "lightskyblue", + "metadata": {}, + }, + "points", + ) + writer_xml.write_multiple_points_to_xml(xml_path, [points]) + cells = get_cells(xml_path) + assert len(cells) == 10 + assert cells[0].type == Cell.UNKNOWN + + +def test_xml_write_no_points(tmp_path): + xml_path = str(tmp_path / "points.xml") + points = ( + np.array([]), + { + "name": "test", + "size": 1, + "n_dimensional": True, + "opacity": 1, + "symbol": "ring", + "face_color": "lightskyblue", + "metadata": {}, + }, + "points", + ) + assert writer_xml.write_multiple_points_to_xml(xml_path, [points]) == [] diff --git a/tests/tests/test_integration/test_wholebrain_cell_reader.py b/tests/tests/test_integration/test_wholebrain_cell_reader.py new file mode 100644 index 0000000..4cd6084 --- /dev/null +++ b/tests/tests/test_integration/test_wholebrain_cell_reader.py @@ -0,0 +1,83 @@ +import json +import pathlib + +import pytest + +from brainglobe_napari_io.workflows import wholebrain_cell_reader_dir + +wholebrain_cell_dir = ( + pathlib.Path(__file__).parent.parent.parent + / "data" + / "wholebrain_cell_output" +) +registration_dir = wholebrain_cell_dir / "registration" + +DOWNSAMPLED_IMAGE_SIZE = (135, 108, 77) + + +@pytest.fixture +def metadata(): + with open(wholebrain_cell_dir / "cellfinder.json") as json_file: + metadata = json.load(json_file) + return metadata + + +def test_is_wholebrain_cell_dir(): + assert wholebrain_cell_reader_dir.is_wholebrain_cell_dir( + wholebrain_cell_dir + ) + assert not wholebrain_cell_reader_dir.is_wholebrain_cell_dir( + wholebrain_cell_dir.parent + ) + assert not wholebrain_cell_reader_dir.is_wholebrain_cell_dir(__file__) + + +def test_wholebrain_cell_read_dir(): + assert ( + wholebrain_cell_reader_dir.wholebrain_cell_read_dir( + str(wholebrain_cell_dir) + ) + == wholebrain_cell_reader_dir.reader_function + ) + assert ( + wholebrain_cell_reader_dir.wholebrain_cell_read_dir( + wholebrain_cell_dir + ) + is None + ) + assert ( + wholebrain_cell_reader_dir.wholebrain_cell_read_dir( + str(wholebrain_cell_dir.parent) + ) + is None + ) + + +def test_load_wholebrain_cell_dir(): + layers = wholebrain_cell_reader_dir.reader_function(wholebrain_cell_dir) + assert len(layers) == 4 + + layer_names = ["allen_mouse_100um", "Boundaries", "Non cells", "Cells"] + layer_types = ["labels", "image", "points", "points"] + layer_shapes = [ + DOWNSAMPLED_IMAGE_SIZE, + DOWNSAMPLED_IMAGE_SIZE, + (22, 3), + (103, 3), + ] + for idx, layer in enumerate(layers): + assert layer[1]["name"] == layer_names[idx] + assert layer[2] == layer_types[idx] + assert layer[0].shape == layer_shapes[idx] + + +def test_load_registration(metadata): + layers = wholebrain_cell_reader_dir.load_registration( + [], registration_dir, metadata + ) + assert len(layers) == 2 + assert layers[0][0].shape == DOWNSAMPLED_IMAGE_SIZE + assert layers[1][0].shape == DOWNSAMPLED_IMAGE_SIZE + + assert layers[0][1]["name"] == "allen_mouse_100um" + assert layers[1][1]["name"] == "Boundaries" diff --git a/tests/tests/test_unit/__init__.py b/tests/tests/test_unit/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/tests/test_unit/test_brainreg_utils.py b/tests/tests/test_unit/test_brainreg_utils.py new file mode 100644 index 0000000..96756c6 --- /dev/null +++ b/tests/tests/test_unit/test_brainreg_utils.py @@ -0,0 +1,22 @@ +import pathlib + +from brainglobe_napari_io.brainreg import utils + +brainreg_dir = ( + pathlib.Path(__file__).parent.parent.parent + / "data" + / "wholebrain_cell_output" + / "registration" +) + + +def test_is_brainreg(): + assert utils.is_brainreg_dir(brainreg_dir) + assert not utils.is_brainreg_dir(__file__) + assert not utils.is_brainreg_dir(brainreg_dir.parent) + + +def test_load_additional_downsampled_channels(): + layers = utils.load_additional_downsampled_channels(brainreg_dir, []) + assert len(layers) == 1 + assert layers[0][1]["name"] == "brain (downsampled)" diff --git a/tests/tests/test_unit/test_cellfinder_utils.py b/tests/tests/test_unit/test_cellfinder_utils.py new file mode 100644 index 0000000..b92ccd3 --- /dev/null +++ b/tests/tests/test_unit/test_cellfinder_utils.py @@ -0,0 +1,78 @@ +import pathlib + +import numpy as np +import pytest +from brainglobe_utils.cells.cells import Cell + +from brainglobe_napari_io.cellfinder import utils + +xml_dir = pathlib.Path(__file__).parent.parent.parent / "data" / "xml" +xml_file = xml_dir / "cell_classification.xml" + + +@pytest.fixture +def cell_layers(): + layers = utils.load_cells( + [], + xml_file, + 1, + 1, + "disk", + "lightgoldenrodyellow", + "lightskyblue", + ) + return layers + + +@pytest.fixture +def cell_layers_channel_6(): + layers = utils.load_cells( + [], + xml_file, + 1, + 1, + "disk", + "lightgoldenrodyellow", + "lightskyblue", + channel=6, + ) + return layers + + +def test_load_cells(cell_layers): + assert len(cell_layers) == 2 + + for layer in cell_layers: + assert len(layer) == 3 + assert isinstance(layer[0], np.ndarray) + assert isinstance(layer[1], dict) + assert isinstance(layer[2], str) + + assert layer[2] == "points" + + assert cell_layers[0][1]["name"] == "Non cells" + assert cell_layers[1][1]["name"] == "Cells" + + assert cell_layers[0][1]["metadata"]["point_type"] == Cell.UNKNOWN + assert cell_layers[1][1]["metadata"]["point_type"] == Cell.CELL + + assert len(cell_layers[0][0]) == 22 + assert len(cell_layers[1][0]) == 103 + + +def test_load_cells_with_channel(cell_layers_channel_6): + assert len(cell_layers_channel_6) == 2 + assert cell_layers_channel_6[0][1]["name"] == "channel_6: Non cells" + assert cell_layers_channel_6[1][1]["name"] == "channel_6: Cells" + + +def test_convert_layer_to_cells(cell_layers): + cells = utils.convert_layer_to_cells(cell_layers[0][0]) + assert len(cells) == 22 + assert isinstance(cells[0], Cell) + assert cells[0].type == Cell.CELL + + cells = utils.convert_layer_to_cells(cell_layers[0][0], cells=False) + assert len(cells) == 22 + assert isinstance(cells[0], Cell) + assert cells[0].type == Cell.UNKNOWN diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 7009bc1..0000000 --- a/tox.ini +++ /dev/null @@ -1,16 +0,0 @@ -[tox] -envlist = py{38,39,310,311} -isolated_build = True - -[gh-actions] -python = - 3.8: py38 - 3.9: py39 - 3.10: py310 - 3.11: py311 - -[testenv] -extras = - dev -commands = - pytest -v --color=yes --cov=brainglobe_napari_io --cov-report=xml