Skip to content

Commit 9262993

Browse files
committed
DOC: Example use urllib.request import urlretrieve
Assumes Python 3; we are only supporting Python 3 now. Make a note that VTK-based examples do not work in MyBinder due to the VTK wheel.
1 parent 529ce56 commit 9262993

28 files changed

+922
-524
lines changed

examples/2DImage.ipynb

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
"metadata": {},
1919
"outputs": [],
2020
"source": [
21-
"try:\n",
22-
" from urllib.request import urlretrieve\n",
23-
"except ImportError:\n",
24-
" from urllib import urlretrieve\n",
21+
"from urllib.request import urlretrieve\n",
2522
"import os\n",
2623
"\n",
2724
"import itk\n",
@@ -50,27 +47,12 @@
5047
{
5148
"data": {
5249
"application/vnd.jupyter.widget-view+json": {
53-
"model_id": "5cd80ad0009c484fa13efdc01518b414",
50+
"model_id": "e276ebbbb0d0453f912d6211ca340e7d",
5451
"version_major": 2,
5552
"version_minor": 0
5653
},
57-
"text/html": [
58-
"<p>Failed to display Jupyter Widget of type <code>Viewer</code>.</p>\n",
59-
"<p>\n",
60-
" If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n",
61-
" that the widgets JavaScript is still loading. If this message persists, it\n",
62-
" likely means that the widgets JavaScript library is either not installed or\n",
63-
" not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n",
64-
" Widgets Documentation</a> for setup instructions.\n",
65-
"</p>\n",
66-
"<p>\n",
67-
" If you're reading this message in another frontend (for example, a static\n",
68-
" rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n",
69-
" it may mean that your frontend doesn't currently support widgets.\n",
70-
"</p>\n"
71-
],
7254
"text/plain": [
73-
"Viewer(image=<itkImagePython.itkImageUC2; proxy of <Swig Object of type 'itkImageUC2 *' at 0x7ff04954d720> >)"
55+
"Viewer(geometries=[], gradient_opacity=0.22, point_sets=[], rendered_image=<itkImagePython.itkImageUC2; proxy "
7456
]
7557
},
7658
"metadata": {},
@@ -81,34 +63,27 @@
8163
"image = itk.imread(file_name)\n",
8264
"view(image)"
8365
]
84-
},
85-
{
86-
"cell_type": "code",
87-
"execution_count": null,
88-
"metadata": {},
89-
"outputs": [],
90-
"source": []
9166
}
9267
],
9368
"metadata": {
9469
"kernelspec": {
95-
"display_name": "Python 2",
70+
"display_name": "Python 3",
9671
"language": "python",
97-
"name": "python2"
72+
"name": "python3"
9873
},
9974
"language_info": {
10075
"codemirror_mode": {
10176
"name": "ipython",
102-
"version": 2
77+
"version": 3
10378
},
10479
"file_extension": ".py",
10580
"mimetype": "text/x-python",
10681
"name": "python",
10782
"nbconvert_exporter": "python",
108-
"pygments_lexer": "ipython2",
109-
"version": "2.7.13"
83+
"pygments_lexer": "ipython3",
84+
"version": "3.7.5"
11085
}
11186
},
11287
"nbformat": 4,
113-
"nbformat_minor": 2
88+
"nbformat_minor": 4
11489
}

examples/Checkerboard.ipynb

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@
1818
"metadata": {},
1919
"outputs": [],
2020
"source": [
21-
"try:\n",
22-
" from urllib.request import urlretrieve\n",
23-
"except ImportError:\n",
24-
" from urllib import urlretrieve\n",
21+
"from urllib.request import urlretrieve\n",
2522
"import os\n",
2623
"\n",
2724
"import itk\n",
@@ -64,7 +61,7 @@
6461
{
6562
"data": {
6663
"application/vnd.jupyter.widget-view+json": {
67-
"model_id": "51f99684be064f0eb09b0ab1ee44d3e8",
64+
"model_id": "2517d2aa6bd34771a51d0a02da3da685",
6865
"version_major": 2,
6966
"version_minor": 0
7067
},
@@ -83,9 +80,9 @@
8380
],
8481
"metadata": {
8582
"kernelspec": {
86-
"display_name": "Python 2",
83+
"display_name": "Python 3",
8784
"language": "python",
88-
"name": "python2"
85+
"name": "python3"
8986
},
9087
"language_info": {
9188
"codemirror_mode": {
@@ -97,9 +94,9 @@
9794
"name": "python",
9895
"nbconvert_exporter": "python",
9996
"pygments_lexer": "ipython3",
100-
"version": "3.6.6"
97+
"version": "3.7.5"
10198
}
10299
},
103100
"nbformat": 4,
104-
"nbformat_minor": 2
101+
"nbformat_minor": 4
105102
}

0 commit comments

Comments
 (0)