Skip to content

Commit cf5929e

Browse files
committed
Update deprecated and removed API for skimage 0.19
Renamed circle to disk in v0.17 [1], using footprint in favor of selem since v0.19 [2], therefore update the minimal requirement. [1] https://github.com/scikit-image/scikit-image/blob/main/doc/release/release_0.17.rst [2] https://github.com/scikit-image/scikit-image/releases/tag/v0.19.0
1 parent 4f8bffa commit cf5929e

5 files changed

+13
-13
lines changed

lectures/00_images_are_arrays.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,13 @@
511511
"green = np.zeros((300, 300))\n",
512512
"blue = np.zeros((300, 300))\n",
513513
"\n",
514-
"r, c = draw.circle(100, 100, 100)\n",
514+
"r, c = draw.disk(center=(100, 100), radius=100)\n",
515515
"red[r, c] = 1\n",
516516
"\n",
517-
"r, c = draw.circle(100, 200, 100)\n",
517+
"r, c = draw.disk(center=(100, 200), radius=100)\n",
518518
"green[r, c] = 1\n",
519519
"\n",
520-
"r, c = draw.circle(200, 150, 100)\n",
520+
"r, c = draw.disk(center=(200, 150), radius=100)\n",
521521
"blue[r, c] = 1\n",
522522
"\n",
523523
"f, axes = plt.subplots(1, 3)\n",

lectures/5_tophat_filters.ipynb

+5-5
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
}
174174
],
175175
"source": [
176-
"image_show(morph.closing(text, selem=morph.rectangle(3,3)))"
176+
"image_show(morph.closing(text, footprint=morph.rectangle(3,3)))"
177177
]
178178
},
179179
{
@@ -218,7 +218,7 @@
218218
}
219219
],
220220
"source": [
221-
"image_show(morph.closing(text, selem=morph.rectangle(31,31)))"
221+
"image_show(morph.closing(text, footprint=morph.rectangle(31,31)))"
222222
]
223223
},
224224
{
@@ -263,7 +263,7 @@
263263
}
264264
],
265265
"source": [
266-
"bth = morph.black_tophat(text, selem=morph.rectangle(31,31))\n",
266+
"bth = morph.black_tophat(text, footprint=morph.rectangle(31,31))\n",
267267
"image_show(bth)"
268268
]
269269
},
@@ -366,7 +366,7 @@
366366
"elapsed = list()\n",
367367
"for sz in [3, 11, 31]:\n",
368368
" tic=time.perf_counter()\n",
369-
" a = morph.closing(text, selem=morph.rectangle(sz,sz))\n",
369+
" a = morph.closing(text, footprint=morph.rectangle(sz,sz))\n",
370370
" elapsed.append(time.perf_counter()-tic)\n",
371371
"\n",
372372
"print(elapsed)"
@@ -392,7 +392,7 @@
392392
"elapsed = list()\n",
393393
"for sz in [3, 11, 31]:\n",
394394
" tic=time.perf_counter()\n",
395-
" a = morph.closing(text, selem=morph.disk(sz))\n",
395+
" a = morph.closing(text, footprint=morph.disk(sz))\n",
396396
" elapsed.append(time.perf_counter()-tic)\n",
397397
"\n",
398398
"print(elapsed)\n",

lectures/6_watershed_tricks.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
"peak_mask = np.zeros_like(smoothed, dtype=bool)\n",
175175
"peak_mask[tuple(peak_idx.T)] = True\n",
176176
"# dilate them and label\n",
177-
"peak_mask = skimage.morphology.dilation(peak_mask, selem=skimage.morphology.square(11))\n",
177+
"peak_mask = skimage.morphology.dilation(peak_mask, footprint=skimage.morphology.square(11))\n",
178178
"# display\n",
179179
"peak_overlay = skimage.color.label2rgb(peak_mask, image=smoothed, bg_label=0)\n",
180180
"a=image_show(peak_overlay)"

lectures/solutions/00_images_are_arrays.ipynb

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@
133133
"green = np.zeros((300, 300))\n",
134134
"blue = np.zeros((300, 300))\n",
135135
"\n",
136-
"r, c = draw.circle(100, 100, 100)\n",
136+
"r, c = draw.disk(center=(100, 100), radius=100)\n",
137137
"red[r, c] = 1\n",
138138
"\n",
139-
"r, c = draw.circle(100, 200, 100)\n",
139+
"r, c = draw.disk(center=(100, 200), radius=100)\n",
140140
"green[r, c] = 1\n",
141141
"\n",
142-
"r, c = draw.circle(200, 150, 100)\n",
142+
"r, c = draw.disk(center=(200, 150), radius=100)\n",
143143
"blue[r, c] = 1\n",
144144
"\n",
145145
"f, axes = plt.subplots(1, 3)\n",

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scikit-image[data] >= 0.18
1+
scikit-image[data] >= 0.19
22
numpy >= 1.12
33
scipy >= 1.0
44
matplotlib >= 2.1

0 commit comments

Comments
 (0)