Skip to content

Commit

Permalink
Manually save and display pyvista HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
eigenvivek committed Dec 7, 2023
1 parent 6f472a2 commit 9a08ae8
Showing 1 changed file with 36 additions and 47 deletions.
83 changes: 36 additions & 47 deletions notebooks/tutorials/visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,7 @@
"execution_count": null,
"id": "06c4fe21-2f1b-41c2-bfa4-e6c438e2f55a",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "1ceb05067e1540949d174ff84607d96d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Widget(value='<iframe src=\"http://localhost:54160/index.html?ui=P_0x14d947100_0&reconnect=auto\" class=\"pyvista…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"# Make a mesh from the CT volume\n",
"ct = drr_to_mesh(drr, \"surface_nets\", threshold=1150, verbose=False)\n",
Expand All @@ -120,18 +105,49 @@
"plotter.add_mesh(principal_ray, color=\"lime\", line_width=3)\n",
"plotter.add_mesh(detector, texture=texture)\n",
"\n",
"# Render the plot\n",
"plotter.add_axes()\n",
"plotter.add_bounding_box()\n",
"plotter.show(\"html\")"
"\n",
"# plotter.show() # If running Jupyter locally\n",
"# plotter.show(jupyter_backend=\"server\") # If running Jupyter remotely\n",
"plotter.export_html(\"render.html\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a4355ecf-fa86-43be-9e0e-f42d144a09bd",
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"749\"\n",
" height=\"500\"\n",
" src=\"render.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame>"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from IPython.display import IFrame\n",
"\n",
"IFrame(\"render.html\", height=500, width=749)"
]
}
],
"metadata": {
Expand All @@ -142,34 +158,7 @@
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {
"0d41bdaf905b42eca109cbb193bb0828": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "2.0.0",
"model_name": "LayoutModel",
"state": {}
},
"1ceb05067e1540949d174ff84607d96d": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "2.0.0",
"model_name": "HTMLModel",
"state": {
"layout": "IPY_MODEL_0d41bdaf905b42eca109cbb193bb0828",
"style": "IPY_MODEL_f6be4d1c67254361abd71d230c887c79",
"value": "<iframe src=\"http://localhost:54160/index.html?ui=P_0x14d947100_0&reconnect=auto\" class=\"pyvista\" style=\"width: 99%; height: 600px; border: 1px solid rgb(221,221,221);\"></iframe>"
}
},
"f6be4d1c67254361abd71d230c887c79": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "2.0.0",
"model_name": "HTMLStyleModel",
"state": {
"description_width": "",
"font_size": null,
"text_color": null
}
}
},
"state": {},
"version_major": 2,
"version_minor": 0
}
Expand Down

0 comments on commit 9a08ae8

Please sign in to comment.