Skip to content

Commit 3375d03

Browse files
committed
DOC: Clean up notebooks
Some notebooks made assumptions about environment or had old debug information. Remove debug and ensure we always install the correct version of itkwidgets.
1 parent 10cc3ee commit 3375d03

12 files changed

+67
-361
lines changed

examples/Hello3DWorld.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"source": [
1010
"import sys\n",
1111
"\n",
12-
"!{sys.executable} -m pip install --pre itkwidgets imageio"
12+
"!{sys.executable} -m pip install -q \"itkwidgets>=1.0a5\" imageio"
1313
]
1414
},
1515
{

examples/NumPyArrayPointSet.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"outputs": [],
99
"source": [
1010
"import sys\n",
11-
"!{sys.executable} -m pip install -q --pre itkwidgets"
11+
"\n",
12+
"!{sys.executable} -m pip install -q \"itkwidgets>=1.0a5\""
1213
]
1314
},
1415
{

examples/integrations/MONAI/transform_visualization.ipynb

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"# Install dependencies for this example\n",
1111
"import sys\n",
1212
"\n",
13-
"!{sys.executable} -m pip install -q \"monai-weekly[nibabel, matplotlib]\" itkwidgets"
13+
"!{sys.executable} -m pip install -q \"monai-weekly[nibabel, matplotlib]\" \"itkwidgets>=1.0a5\""
1414
]
1515
},
1616
{
@@ -52,13 +52,21 @@
5252
},
5353
{
5454
"cell_type": "code",
55-
"execution_count": null,
56-
"id": "c5e68150-c129-45d9-93bf-cf955451da3a",
55+
"execution_count": 3,
56+
"id": "205efb9f-f41b-4df2-8c48-5636b637856b",
5757
"metadata": {},
58-
"outputs": [],
58+
"outputs": [
59+
{
60+
"name": "stdout",
61+
"output_type": "stream",
62+
"text": [
63+
"/tmp/tmp8obmuhkg\n"
64+
]
65+
}
66+
],
5967
"source": [
6068
"directory = os.environ.get(\"MONAI_DATA_DIRECTORY\")\n",
61-
"root_dir = '/home/local/KHQ/brianna.major/tensorboard_logs/newest_logs/spleen'\n",
69+
"root_dir = tempfile.mkdtemp() if directory is None else directory\n",
6270
"print(root_dir)"
6371
]
6472
},
@@ -150,9 +158,7 @@
150158
"id": "98caa02e-a37a-46a1-a33e-86e65452a186",
151159
"metadata": {},
152160
"outputs": [],
153-
"source": [
154-
"isinstance(data[\"image\"][0, 0, :, :, :] * 255, torch.Tensor)"
155-
]
161+
"source": []
156162
}
157163
],
158164
"metadata": {

examples/integrations/PyImageJ/ImageJImgLib2.ipynb

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,34 +81,18 @@
8181
"view(image)"
8282
]
8383
},
84-
{
85-
"cell_type": "code",
86-
"execution_count": null,
87-
"id": "08da7bd9-3160-47a1-8e54-a8e77bbb2ff1",
88-
"metadata": {},
89-
"outputs": [],
90-
"source": [
91-
"print(type(image))"
92-
]
93-
},
9484
{
9585
"cell_type": "code",
9686
"execution_count": null,
9787
"id": "48b151f6-cfc4-4522-aa02-04c8301d3667",
9888
"metadata": {},
9989
"outputs": [],
10090
"source": [
91+
"print(type(image))\n",
92+
"\n",
10193
"image_arr = itk.array_view_from_image(image)\n",
102-
"print(type(image_arr))"
103-
]
104-
},
105-
{
106-
"cell_type": "code",
107-
"execution_count": null,
108-
"id": "0560854d-735f-436f-a52d-2fe133350c84",
109-
"metadata": {},
110-
"outputs": [],
111-
"source": [
94+
"print(type(image_arr))\n",
95+
"\n",
11296
"image_java = ij.py.to_java(image_arr)\n",
11397
"print(type(image_java))"
11498
]

examples/integrations/PyVista/LiDAR.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"source": [
1010
"# Install dependencies for this example\n",
1111
"import sys\n",
12-
"!{sys.executable} -m pip install -q pyvista"
12+
"\n",
13+
"!{sys.executable} -m pip install -q pyvista \"itkwidgets>=1.0a5\""
1314
]
1415
},
1516
{

examples/integrations/PyVista/UniformGrid.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"source": [
1010
"# Install dependencies for this example\n",
1111
"import sys\n",
12-
"!{sys.executable} -m pip install -q pyvista --pre itkwidgets"
12+
"\n",
13+
"!{sys.executable} -m pip install -q pyvista \"itkwidgets>=1.0a5\""
1314
]
1415
},
1516
{
@@ -43,7 +44,7 @@
4344
"metadata": {},
4445
"outputs": [],
4546
"source": [
46-
"viewer = view(image_from_array)"
47+
"view(dataset)"
4748
]
4849
},
4950
{

examples/integrations/dask/DaskArray.ipynb

Lines changed: 7 additions & 271 deletions
Large diffs are not rendered by default.

examples/integrations/itk/3DImage.ipynb

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"outputs": [],
88
"source": [
99
"# Install dependencies for this example\n",
10-
"# Note: This does not include itkwidgets, itself\n",
1110
"import sys\n",
12-
"!{sys.executable} -m pip install --upgrade --pre itk-io"
11+
"\n",
12+
"!{sys.executable} -m pip install -q --upgrade --pre itk-io \"itkwidgets>=1.0a5\""
1313
]
1414
},
1515
{
@@ -41,44 +41,9 @@
4141
},
4242
{
4343
"cell_type": "code",
44-
"execution_count": 5,
44+
"execution_count": null,
4545
"metadata": {},
46-
"outputs": [
47-
{
48-
"data": {
49-
"application/javascript": [
50-
"window.connectPlugin && window.connectPlugin(\"0ffcf0d9-b868-44f6-b374-72bc714717e7\")"
51-
],
52-
"text/plain": [
53-
"<IPython.core.display.Javascript object>"
54-
]
55-
},
56-
"metadata": {},
57-
"output_type": "display_data"
58-
},
59-
{
60-
"data": {
61-
"text/html": [
62-
"<div id=\"074b5aed-86a7-4ae0-aa36-0f77e4d47ec3\"></div>"
63-
],
64-
"text/plain": [
65-
"<IPython.core.display.HTML object>"
66-
]
67-
},
68-
"metadata": {},
69-
"output_type": "display_data"
70-
},
71-
{
72-
"data": {
73-
"text/plain": [
74-
"<itkwidgets.viewer.Viewer at 0x7fe59b004250>"
75-
]
76-
},
77-
"execution_count": 5,
78-
"metadata": {},
79-
"output_type": "execute_result"
80-
}
81-
],
46+
"outputs": [],
8247
"source": [
8348
"image = itk.imread(file_name)\n",
8449
"view(image, rotate=True, gradient_opacity=0.4)"

examples/integrations/vtk/vtkImageData.ipynb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"# Install dependencies for this example\n",
1111
"import sys\n",
1212
"\n",
13-
"!{sys.executable} -m pip install --pre itkwidgets vtk"
13+
"!{sys.executable} -m pip install -q \"itkwidgets>=1.0a5\" vtk"
1414
]
1515
},
1616
{
@@ -62,19 +62,7 @@
6262
"metadata": {},
6363
"outputs": [],
6464
"source": [
65-
"viewer = view(vtk_image)"
66-
]
67-
},
68-
{
69-
"cell_type": "code",
70-
"execution_count": null,
71-
"id": "12679972-1886-4e58-b9cc-f2f35050a6b2",
72-
"metadata": {},
73-
"outputs": [],
74-
"source": [
75-
"from vtk.util.numpy_support import vtk_to_numpy\n",
76-
"array = vtk_to_numpy(vtk_image.GetPointData().GetScalars())\n",
77-
"array.shape"
65+
"view(vtk_image)"
7866
]
7967
},
8068
{

examples/integrations/vtk/vtkPolyDataPointSet.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"# Install dependencies for this example\n",
1111
"import sys\n",
1212
"\n",
13-
"!{sys.executable} -m pip install --pre itkwidgets vtk"
13+
"!{sys.executable} -m pip install -q \"itkwidgets>=1.0a5\" vtk"
1414
]
1515
},
1616
{
@@ -62,7 +62,7 @@
6262
"metadata": {},
6363
"outputs": [],
6464
"source": [
65-
"viewer = view(point_sets=vtk_poly)"
65+
"view(point_sets=vtk_poly)"
6666
]
6767
},
6868
{

0 commit comments

Comments
 (0)