Skip to content

Commit 670152e

Browse files
authored
Merge pull request #336 from neurodata/tathey1-voxelclass
Tathey1 voxelclass
2 parents f08906d + d1a8d07 commit 670152e

File tree

3 files changed

+588
-8
lines changed

3 files changed

+588
-8
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import napari\n",
10+
"from skimage import io, measure\n",
11+
"import h5py\n",
12+
"from napari_animation import AnimationWidget\n"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 2,
18+
"metadata": {},
19+
"outputs": [],
20+
"source": [
21+
"im = io.imread(\"/Users/thomasathey/Documents/mimlab/mouselight/input/images/first10_quantitative/images/2018-08-01_1_first10_quantitative.tif\")\n",
22+
"\n",
23+
"f = h5py.File(\"/Users/thomasathey/Documents/mimlab/mouselight/input/images/first10_quantitative/2018-08-01_1_first10_quantitative_Probabilities.h5\", 'r')\n",
24+
"pred = f.get('exported_data')\n",
25+
"pred = pred[:,:,:,1]\n",
26+
"probs = pred\n",
27+
"\n",
28+
"thresh = 0.5\n",
29+
"mask = probs > thresh\n",
30+
"labs = measure.label(mask)\n",
31+
"\n",
32+
"res = [0.3,0.3,1]"
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": 3,
38+
"metadata": {},
39+
"outputs": [
40+
{
41+
"name": "stderr",
42+
"output_type": "stream",
43+
"text": [
44+
"/Users/thomasathey/Documents/mimlab/mouselight/docs_env/lib/python3.8/site-packages/napari_animation/_qt/keyframeslist_widget.py:156: FutureWarning: Themes were changed to use evented model with Pydantic's color type rather than the `rgb(x, y, z)`. You can get the old color by calling `color.as_rgb()`. The `as_dict=True` option will be removed in 0.X.X\n",
45+
" self.setStyleSheet(template(qss_template, **get_theme(theme_name)))\n"
46+
]
47+
}
48+
],
49+
"source": [
50+
"viewer = napari.Viewer(ndisplay=3)\n",
51+
"viewer.add_image(im, scale=res)\n",
52+
"viewer.add_labels(mask, scale=res)\n",
53+
"viewer.add_labels(labs, scale=res)\n",
54+
"animation_widget = AnimationWidget(viewer)\n",
55+
"viewer.window.add_dock_widget(animation_widget, area=\"right\")\n",
56+
"viewer.camera.angles = [90, 90, 0]\n",
57+
"viewer.scale_bar.visible = True\n"
58+
]
59+
},
60+
{
61+
"cell_type": "code",
62+
"execution_count": null,
63+
"metadata": {},
64+
"outputs": [],
65+
"source": []
66+
}
67+
],
68+
"metadata": {
69+
"interpreter": {
70+
"hash": "5dc00d68ff54f8375e99934614da4863299fb9e10af4294c095b7f517546ff26"
71+
},
72+
"kernelspec": {
73+
"display_name": "Python 3.8.10 64-bit ('docs_env': venv)",
74+
"language": "python",
75+
"name": "python3"
76+
},
77+
"language_info": {
78+
"codemirror_mode": {
79+
"name": "ipython",
80+
"version": 3
81+
},
82+
"file_extension": ".py",
83+
"mimetype": "text/x-python",
84+
"name": "python",
85+
"nbconvert_exporter": "python",
86+
"pygments_lexer": "ipython3",
87+
"version": "3.8.10"
88+
},
89+
"orig_nbformat": 4
90+
},
91+
"nbformat": 4,
92+
"nbformat_minor": 2
93+
}

experiments/ViterBrain/notebooks/fig3-voxels.ipynb

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

experiments/ViterBrain/notebooks/results_plots.ipynb renamed to experiments/ViterBrain/notebooks/fig7-results.ipynb

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 4,
5+
"execution_count": 2,
66
"metadata": {},
77
"outputs": [
88
{
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 5,
53+
"execution_count": 3,
5454
"metadata": {},
5555
"outputs": [
5656
{
@@ -89,24 +89,31 @@
8989
},
9090
{
9191
"cell_type": "code",
92-
"execution_count": 7,
92+
"execution_count": 10,
9393
"metadata": {},
9494
"outputs": [
9595
{
9696
"name": "stdout",
9797
"output_type": "stream",
9898
"text": [
99-
"Viterbrain vs App2: 5.491012510881023e-09\n",
100-
"APP2 vs Advantra: 0.039425832629443\n"
99+
"P values for 2 Proportion Z Tests\n",
100+
"Viterbrain vs App2: 0.041448687457663176\n",
101+
"Viterbrain vs Snake: 0.041397618661288514\n",
102+
"APP2 vs Advantra: 0.039425832629443\n",
103+
"APP2 vs GTree: 0.393153437674003\n",
104+
"APP2 vs Snake: 0.26272224684071965\n"
101105
]
102106
}
103107
],
104108
"source": [
105109
"from statsmodels.stats.proportion import proportions_ztest\n",
106110
"\n",
107-
"print(f\"Viterbrain vs App2: {proportions_ztest(count=[data[0][0], data[1][0]], nobs=[10, 35])[1]}\")\n",
108-
"\n",
109-
"print(f\"APP2 vs Advantra: {proportions_ztest(count=[data[1][0], data[3][0]], nobs=[35, 35])[1]}\")"
111+
"print(\"P values for 2 Proportion Z Tests\")\n",
112+
"print(f\"Viterbrain vs App2: {proportions_ztest(count=[data[0][0], data[1][0]], nobs=[35, 35])[1]}\")\n",
113+
"print(f\"Viterbrain vs Snake: {proportions_ztest(count=[data[0][0], data[4][0]], nobs=[35, 10])[1]}\")\n",
114+
"print(f\"APP2 vs Advantra: {proportions_ztest(count=[data[1][0], data[3][0]], nobs=[35, 35])[1]}\")\n",
115+
"print(f\"APP2 vs GTree: {proportions_ztest(count=[data[1][0], data[2][0]], nobs=[35, 35])[1]}\")\n",
116+
"print(f\"APP2 vs Snake: {proportions_ztest(count=[data[1][0], data[4][0]], nobs=[35, 10])[1]}\")"
110117
]
111118
},
112119
{

0 commit comments

Comments
 (0)