-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from neurodata/tathey1-voxelclass
Tathey1 voxelclass
- Loading branch information
Showing
3 changed files
with
588 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import napari\n", | ||
"from skimage import io, measure\n", | ||
"import h5py\n", | ||
"from napari_animation import AnimationWidget\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"im = io.imread(\"/Users/thomasathey/Documents/mimlab/mouselight/input/images/first10_quantitative/images/2018-08-01_1_first10_quantitative.tif\")\n", | ||
"\n", | ||
"f = h5py.File(\"/Users/thomasathey/Documents/mimlab/mouselight/input/images/first10_quantitative/2018-08-01_1_first10_quantitative_Probabilities.h5\", 'r')\n", | ||
"pred = f.get('exported_data')\n", | ||
"pred = pred[:,:,:,1]\n", | ||
"probs = pred\n", | ||
"\n", | ||
"thresh = 0.5\n", | ||
"mask = probs > thresh\n", | ||
"labs = measure.label(mask)\n", | ||
"\n", | ||
"res = [0.3,0.3,1]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"/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", | ||
" self.setStyleSheet(template(qss_template, **get_theme(theme_name)))\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"viewer = napari.Viewer(ndisplay=3)\n", | ||
"viewer.add_image(im, scale=res)\n", | ||
"viewer.add_labels(mask, scale=res)\n", | ||
"viewer.add_labels(labs, scale=res)\n", | ||
"animation_widget = AnimationWidget(viewer)\n", | ||
"viewer.window.add_dock_widget(animation_widget, area=\"right\")\n", | ||
"viewer.camera.angles = [90, 90, 0]\n", | ||
"viewer.scale_bar.visible = True\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"interpreter": { | ||
"hash": "5dc00d68ff54f8375e99934614da4863299fb9e10af4294c095b7f517546ff26" | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3.8.10 64-bit ('docs_env': venv)", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.10" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters