diff --git a/pyproject.toml b/pyproject.toml index 2f6f73b..e6e447d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,20 +29,20 @@ requires-python = ">=3.10" # or any other Qt bindings directly (e.g. PyQt5, PySide2). # See best practices: https://napari.org/stable/plugins/building_a_plugin/best_practices.html dependencies = [ - "bioio", - "bioio-imageio", - "bioio-ome-tiff", + "pooch", + "ndevio>=0.5.2", + # "bioio", + # "bioio-imageio", + # "bioio-ome-tiff", ] -[project.optional-dependencies] -# Allow easily installation with the full, default napari installation -# (including Qt backend) using ndev-sampledata[all]. -all = ["napari[all]"] -testing = [ - "napari", - "tox", - "pytest", # https://docs.pytest.org/en/latest/contents.html - "pytest-cov", # https://pytest-cov.readthedocs.io/en/latest/ +[dependency-groups] +dev = [ + "tox-uv", + "pytest", + "pytest-cov", + "pre-commit", + "napari[pyqt6]", ] [project.entry-points."napari.manifest"] diff --git a/src/ndev_sampledata/_sample_data.py b/src/ndev_sampledata/_sample_data.py index 39a84b8..1d5dd13 100644 --- a/src/ndev_sampledata/_sample_data.py +++ b/src/ndev_sampledata/_sample_data.py @@ -12,7 +12,11 @@ from pathlib import Path from typing import TYPE_CHECKING +import pooch from bioio import BioImage +from bioio_imageio import Reader as ImageIOReader +from bioio_ome_tiff import Reader as OmeTiffReader +from ndevio._napari_reader import napari_reader_function if TYPE_CHECKING: from napari.types import LayerDataTuple @@ -21,7 +25,7 @@ def ndev_logo() -> list[LayerDataTuple]: - img = BioImage(sample_dir / "ndev-logo.png") + img = BioImage(sample_dir / "ndev-logo.png", reader=ImageIOReader) data = img.data.squeeze() metadata = { "name": "ndev logo", @@ -32,7 +36,10 @@ def ndev_logo() -> list[LayerDataTuple]: def neuron_2d_4ch() -> list[LayerDataTuple]: - img = BioImage(sample_dir / "neuron-4Ch.tiff") + img = BioImage( + sample_dir / "neuron-4Ch-crop.tiff", + reader=OmeTiffReader, + ) scale = (img.physical_pixel_sizes.Y, img.physical_pixel_sizes.X) ch0 = ( img.get_image_data("YX", C=0), @@ -74,7 +81,10 @@ def neuron_2d_4ch() -> list[LayerDataTuple]: def scratch_assay() -> list[LayerDataTuple]: - img = BioImage(sample_dir / "scratch-assay-labeled-10T-2Ch.tiff") + img = BioImage( + sample_dir / "scratch-assay-labeled-10T-2Ch.tiff", + reader=OmeTiffReader, + ) scale = (img.physical_pixel_sizes.Y, img.physical_pixel_sizes.X) ch0 = ( img.get_image_data("TYX", C=0), @@ -121,7 +131,10 @@ def scratch_assay() -> list[LayerDataTuple]: def neocortex() -> list[LayerDataTuple]: - img = BioImage(sample_dir / "neocortex-3Ch.tiff") + img = BioImage( + sample_dir / "neocortex-3Ch-crop.tiff", + reader=OmeTiffReader, + ) scale = (img.physical_pixel_sizes.Y, img.physical_pixel_sizes.X) ch0 = ( img.get_image_data("YX", C=0), @@ -151,3 +164,38 @@ def neocortex() -> list[LayerDataTuple]: }, ) return [ch0, ch1, ch2] + + +def neuron_raw() -> list[LayerDataTuple]: + # use pooch to get the download from remote URL if not present locally + neuron_raw_path = pooch.retrieve( + url="doi:10.5281/zenodo.17836129/neuron-4Ch_raw.tiff", + known_hash="md5:5d3e42bca2085e8588b6f23cf89ba87c", + fname="neuron-4Ch_raw.tiff", + path=sample_dir, + ) + + return napari_reader_function( + path=neuron_raw_path, + reader=OmeTiffReader, + in_memory=True, + layer_type="image", + ) + + +def neuron_labels() -> list[LayerDataTuple]: + return napari_reader_function( + path=sample_dir / "neuron-4Ch_labels.tiff", + reader=OmeTiffReader, + in_memory=True, + layer_type="labels", + ) + + +def neuron_labels_processed() -> list[LayerDataTuple]: + return napari_reader_function( + path=sample_dir / "neuron-4Ch_labels_processed.tiff", + reader=OmeTiffReader, + in_memory=True, + layer_type="labels", + ) diff --git a/src/ndev_sampledata/napari.yaml b/src/ndev_sampledata/napari.yaml index 257f3c3..9a3d0a5 100644 --- a/src/ndev_sampledata/napari.yaml +++ b/src/ndev_sampledata/napari.yaml @@ -18,12 +18,21 @@ contributions: - id : ndev-sampledata.make_neocortex python_name: ndev_sampledata._sample_data:neocortex title: Load neocortex data + - id: ndev-sampledata.make_neuron_raw + python_name: ndev_sampledata._sample_data:neuron_raw + title: Load raw neuron data + - id: ndev-sampledata.make_neuron_labels + python_name: ndev_sampledata._sample_data:neuron_labels + title: Load neuron labels data + - id: ndev-sampledata.make_neuron_labels_processed + python_name: ndev_sampledata._sample_data:neuron_labels_processed + title: Load processed neuron labels data sample_data: - command: ndev-sampledata.make_ndev_logo display_name: ndev logo key: unique_id.0 - command: ndev-sampledata.make_neuron_2d_4ch - display_name: Neuron (2D+4Ch) + display_name: Neuron Cropped (2D+4Ch) key: unique_id.1 - command: ndev-sampledata.make_scratch_assay display_name: Scratch Assay Labeled (10T+2Ch) @@ -31,3 +40,12 @@ contributions: - command: ndev-sampledata.make_neocortex display_name: Neocortex (3Ch) key: unique_id.3 + - command: ndev-sampledata.make_neuron_raw + display_name: Neuron Raw (2D+4Ch) (32MB) + key: unique_id.4 + - command: ndev-sampledata.make_neuron_labels + display_name: Neuron Labels (2D+4Ch) + key: unique_id.5 + - command: ndev-sampledata.make_neuron_labels_processed + display_name: Neuron Labels Processed (2D+4Ch) + key: unique_id.6 diff --git a/src/ndev_sampledata/samples/neuron-4Ch.tiff b/src/ndev_sampledata/samples/neuron-4Ch-crop.tiff similarity index 100% rename from src/ndev_sampledata/samples/neuron-4Ch.tiff rename to src/ndev_sampledata/samples/neuron-4Ch-crop.tiff diff --git a/src/ndev_sampledata/samples/neuron-4Ch_labels.tiff b/src/ndev_sampledata/samples/neuron-4Ch_labels.tiff new file mode 100644 index 0000000..57f53bd Binary files /dev/null and b/src/ndev_sampledata/samples/neuron-4Ch_labels.tiff differ diff --git a/src/ndev_sampledata/samples/neuron-4Ch_labels_processed.tiff b/src/ndev_sampledata/samples/neuron-4Ch_labels_processed.tiff new file mode 100644 index 0000000..55e377d Binary files /dev/null and b/src/ndev_sampledata/samples/neuron-4Ch_labels_processed.tiff differ