Skip to content

Commit

Permalink
Update notebooks
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
uschmidt83 committed Apr 23, 2024
1 parent 370d99b commit d9869d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion examples/other2D/bioimageio.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"text": [
"Help on function export_bioimageio in module stardist.bioimageio_utils:\n",
"\n",
"export_bioimageio(model, outpath, test_input, test_input_axes=None, test_input_norm_axes='ZYX', name=None, mode='tensorflow_saved_model_bundle', min_percentile=1.0, max_percentile=99.8, overwrite_spec_kwargs=None)\n",
"export_bioimageio(model, outpath, test_input, test_input_axes=None, test_input_norm_axes='ZYX', name=None, mode='tensorflow_saved_model_bundle', min_percentile=1.0, max_percentile=99.8, overwrite_spec_kwargs=None, generate_default_deps=False)\n",
" Export stardist model into bioimage.io format, https://github.com/bioimage-io/spec-bioimage-io.\n",
" \n",
" Parameters\n",
Expand Down Expand Up @@ -186,6 +186,10 @@
" max percentile to be used for image normalization (default: 99.8)\n",
" overwrite_spec_kwargs: dict or None\n",
" spec keywords that should be overloaded (default: None)\n",
" generate_default_deps: bool\n",
" not required for bioimage.io, i.e. StarDist models don't need a dependencies field in rdf.yaml (default: False)\n",
" if True, generate an environment.yaml file recording the python, bioimageio.core, stardist and tensorflow requirements\n",
" from which a conda environment can be recreated to run this export\n",
"\n"
]
}
Expand Down
6 changes: 3 additions & 3 deletions examples/other2D/multiclass.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"# generate synthetic samples of 2D images, label masks, and class dicts \n",
"\n",
"def generate_sample(n=256):\n",
" from scipy.ndimage.morphology import distance_transform_edt\n",
" from scipy.ndimage import distance_transform_edt\n",
" from skimage.segmentation import watershed, relabel_sequential \n",
" from skimage.morphology import disk, binary_erosion, binary_closing\n",
" from scipy import ndimage as ndi\n",
Expand All @@ -128,13 +128,13 @@
" m1 = np.isin(y,c1)\n",
" m2 = np.isin(y,c2) \n",
" \n",
" x = ndi.filters.gaussian_filter((y>0).astype(np.float32),2)\n",
" x = ndi.gaussian_filter((y>0).astype(np.float32),2)\n",
" \n",
" noise1 = ndi.zoom(np.random.uniform(0,1,(n//4,n//4)), (4,4), order=3)\n",
" noise2 = ndi.zoom(np.random.uniform(0,1,(n//16,n//16)), (16,16), order=3)\n",
" x[m1] = .2*(1+np.sin(y[m1]))+noise1[m1]\n",
" x[m2] = .2*(1+np.sin(y[m2]))+noise2[m2]\n",
" x = ndi.filters.gaussian_filter(x,1)+2*ndi.filters.gaussian_filter(x,20)\n",
" x = ndi.gaussian_filter(x,1)+2*ndi.gaussian_filter(x,20)\n",
" gain = 100 \n",
" x = np.random.poisson((1+gain*x).astype(int))/gain\n",
" x += .08*np.random.normal(0,1,x.shape)\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/other2D/predict_big_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"%matplotlib inline\n",
"%config InlineBackend.figure_format = 'retina'\n",
"\n",
"from tifffile import imread, imsave\n",
"from tifffile import imread, imwrite as imsave\n",
"from csbdeep.utils import Path, normalize\n",
"from csbdeep.utils.tf import keras_import\n",
"keras = keras_import()\n",
Expand Down Expand Up @@ -453,7 +453,7 @@
"source": [
"from zipfile import ZIP_DEFLATED\n",
"\n",
"imsave(str(datadir/'labels.tif'), labels, compress=ZIP_DEFLATED)\n",
"imsave(str(datadir/'labels.tif'), labels, compression=ZIP_DEFLATED)\n",
"export_imagej_rois(str(datadir/'labels_roi.zip'), polys['coord'], compression=ZIP_DEFLATED)"
]
},
Expand Down

0 comments on commit d9869d5

Please sign in to comment.