Skip to content

Commit 90aba48

Browse files
authored
Merge pull request #391 from BiAPoL/add-surface-sample-data
Add surface sample data
2 parents db85cf0 + 92561bb commit 90aba48

File tree

8 files changed

+47083
-5
lines changed

8 files changed

+47083
-5
lines changed

src/napari_clusters_plotter/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
DimensionalityReductionWidget,
66
)
77
from ._new_plotter_widget import PlotterWidget
8-
from ._sample_data import bbbc_1_dataset
8+
from ._sample_data import bbbc_1_dataset, cells3d_curvatures
99

1010
__all__ = [
1111
"PlotterWidget",
1212
"DimensionalityReductionWidget",
1313
"ClusteringWidget",
1414
"bbbc_1_dataset",
15+
"cells3d_curvatures",
1516
]

src/napari_clusters_plotter/_sample_data.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,38 @@ def bbbc_1_dataset() -> List["LayerData"]: # noqa: F821
5858
labels_layers.append(ldtuple_labels)
5959

6060
return image_layers + labels_layers
61+
62+
63+
def cells3d_curvatures() -> List["LayerData"]: # noqa: F821
64+
import numpy as np
65+
import pandas as pd
66+
from skimage import io
67+
68+
path = Path(__file__).parent / "sample_data" / "cells3d"
69+
70+
# load data
71+
vertices = np.loadtxt(path / "vertices.txt")
72+
faces = np.loadtxt(path / "faces.txt").astype(int)
73+
hks = pd.read_csv(path / "signature.csv")
74+
nuclei = io.imread(path / "nucleus.tif")
75+
76+
# create layer data tuples
77+
layer_data_surface = [
78+
(vertices, faces),
79+
{
80+
"name": "cells_3d_heat_kernel_signature",
81+
"features": hks,
82+
},
83+
"surface",
84+
]
85+
86+
layer_data_nuclei = (
87+
nuclei,
88+
{
89+
"name": "cells_3d_nucleus",
90+
"colormap": "gray",
91+
},
92+
"image",
93+
)
94+
95+
return [layer_data_nuclei, layer_data_surface]

src/napari_clusters_plotter/_tests/test_sample_data.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
def test_sample_data(make_napari_viewer):
2-
from napari.layers import Layer
1+
import pytest
2+
3+
from napari_clusters_plotter._sample_data import (
4+
bbbc_1_dataset,
5+
cells3d_curvatures,
6+
)
37

4-
import napari_clusters_plotter as ncp
8+
9+
@pytest.mark.parametrize(
10+
"sample_data_function",
11+
[
12+
bbbc_1_dataset,
13+
cells3d_curvatures,
14+
],
15+
)
16+
def test_bbbc_1_sample_data(make_napari_viewer, sample_data_function):
17+
from napari.layers import Layer
518

619
viewer = make_napari_viewer()
720

8-
sample_dataset = ncp.bbbc_1_dataset()
21+
sample_dataset = sample_data_function()
922
for sample in sample_dataset:
1023
layer = Layer.create(sample[0], sample[1], sample[2])
1124
viewer.add_layer(layer)

src/napari_clusters_plotter/napari.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ contributions:
1717
- id: napari-clusters-plotter.bbbc_sample_data
1818
python_name: napari_clusters_plotter:bbbc_1_dataset
1919
title: Load bbbc sample data
20+
- id: napari-clusters-plotter.cells3d_curvatures
21+
python_name: napari_clusters_plotter:cells3d_curvatures
22+
title: Load cells3d mitotic nucleus surface curvatures
2023

2124
menus:
2225
napari/layers/visualize:
@@ -44,3 +47,6 @@ contributions:
4447
- command: napari-clusters-plotter.bbbc_sample_data
4548
key: bbbc1
4649
display_name: BBBC 1 dataset & segmentations
50+
- command: napari-clusters-plotter.cells3d_curvatures
51+
key: cells3d_curvatures
52+
display_name: Cells3D mitotic nucleus surface curvatures

src/napari_clusters_plotter/sample_data/cells3d/faces.txt

Lines changed: 23562 additions & 0 deletions
Large diffs are not rendered by default.
361 KB
Binary file not shown.

src/napari_clusters_plotter/sample_data/cells3d/signature.csv

Lines changed: 11731 additions & 0 deletions
Large diffs are not rendered by default.

src/napari_clusters_plotter/sample_data/cells3d/vertices.txt

Lines changed: 11730 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)