Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #85 from dstansby/sample-data
Browse files Browse the repository at this point in the history
Add sample data as plugin
  • Loading branch information
paddyroddy authored Mar 29, 2022
2 parents bd0fd90 + 2ac36a8 commit 963cabe
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cellfinder_napari/napari.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ contributions:
- id: cellfinder-napari.CurationWidget
title: Create Curation
python_name: cellfinder_napari.plugins:CurationWidget
- id: cellfinder-napari.SampleData
title: Sample data
python_name: cellfinder_napari.sample_data:load_sample

widgets:
- command: cellfinder-napari.detect
display_name: Cell detection
- command: cellfinder-napari.train
display_name: Train network
- command: cellfinder-napari.CurationWidget
display_name: Curation

sample_data:
- key: sample
display_name: Sample data
command: cellfinder-napari.SampleData
23 changes: 23 additions & 0 deletions cellfinder_napari/sample_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from typing import List

import numpy as np
import pooch
from napari.types import LayerData
from skimage.io import imread

base_url = "https://raw.githubusercontent.com/brainglobe/cellfinder/master/tests/data/integration/detection/crop_planes"


def load_sample() -> List[LayerData]:
layers = []
for ch, name in zip([0, 1], ["Signal", "Background"]):
data = []
for i in range(30):
url = f"{base_url}/ch{ch}/ch{ch}{str(i).zfill(4)}.tif"
file = pooch.retrieve(url=url, known_hash=None)
data.append(imread(file))

data = np.stack(data, axis=0)
layers.append((data, {"name": name}))

return layers
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"napari-ndtiffs",
"brainglobe-napari-io",
"cellfinder-core>=0.2.4",
"pooch>=1", # For downloading sample data
]

setup(
Expand Down

0 comments on commit 963cabe

Please sign in to comment.