Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
56 changes: 52 additions & 4 deletions src/ndev_sampledata/_sample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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",
Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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",
)
20 changes: 19 additions & 1 deletion src/ndev_sampledata/napari.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,34 @@ 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)
key: unique_id.2
- 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
Binary file not shown.
Binary file not shown.
Loading