Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

35 building documentation #37

Closed
wants to merge 8 commits into from
1 change: 1 addition & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
cd docs
conda env create -f environment.yml
source activate ipyniivue_docs
python -m ipykernel install --user --name=ipyniivue_docs
make html

- name: Deploy
Expand Down
2 changes: 1 addition & 1 deletion dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ dependencies:
- jupyter
- jupyterlab>=0.34
- notebook>=5.3
- jupyter_ui_poll
- jupyter-ui-poll
5 changes: 4 additions & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ dependencies:
- sphinx
- pydata-sphinx-theme
- nbsphinx
- nbsphinx-link
- nbsphinx-link
- jupyter-ui-poll
- ipykernel

2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:
- pip
- ipyevents
- ipywidgets
- jupyter_ui_poll
- jupyter-ui-poll
- traitlets
- pip:
- ipyniivue==1.1.0
88 changes: 72 additions & 16 deletions examples/tractography.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,31 @@
"metadata": {},
"source": [
"### Installation\n",
"This notebook can be run on a local server or on a virtualized environement like Google Colab."
"This notebook can be run on a local server or on a virtualized environement like Google Colab.\n",
"\n",
"\n",
"##### Current limitations:\n",
"This notebook runs through `jupyter notebook` or `jupyter lab` but gets unresponsive when using JupyterLite (e.g., notebooks ran through VS Code or Google Colab)."
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "e8c48085-2e35-4d32-87dc-5d552482b994",
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33mDEPRECATION: pyodbc 4.0.0-unsupported has a non-standard version number. pip 23.3 will enforce this behaviour change. A possible replacement is to upgrade to a newer version of pyodbc or contact the author to suggest that they release a version with a conforming version number. Discussion can be found at https://github.com/pypa/pip/issues/12063\u001b[0m\u001b[33m\n",
"\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.2.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.1\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"source": [
"#run if using Google Colab or not building from source\n",
"try:\n",
Expand All @@ -45,13 +61,15 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"id": "14ca07b7-2838-45e8-a802-a0c96ac59ce9",
"metadata": {},
"outputs": [],
"source": [
"from ipyniivue import Niivue\n",
"import ipywidgets as widgets"
"import ipywidgets as widgets\n",
"from time import sleep, time\n",
"from jupyter_ui_poll import ui_events"
]
},
{
Expand All @@ -65,7 +83,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 3,
"id": "a2651106-3f99-4bb0-afd3-9e68a4be021d",
"metadata": {
"tags": []
Expand Down Expand Up @@ -135,10 +153,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "bd63fe41-444b-4ce7-a652-8d098a15eeff",
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d7cf5330ead0420d967e7138f82e13d6",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(VBox(children=(IntSlider(value=3, description='Length', max=80, min=1), FloatSlider(value=1.0, …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Creating a NiiVue object\n",
"nv = Niivue(back_color=[0.8, 0.8, 1, 1], show_3D_crosshair=True)\n",
Expand All @@ -157,7 +190,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"id": "ad7e5f38-9208-4845-b24a-84ffca1ff31c",
"metadata": {
"tags": []
Expand All @@ -178,7 +211,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"id": "34864ab3-a459-4e51-b27c-3c7df293aedf",
"metadata": {
"tags": []
Expand All @@ -198,16 +231,39 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "68574d16-54fc-4a81-9729-8df3f6045295",
"metadata": {
"tags": []
},
"execution_count": 7,
"id": "797e35b7",
"metadata": {},
"outputs": [],
"source": [
"################\n",
"# This block of code is currently necessary to avoid nv.meshes[0] being accessed before the\n",
"# mesh becomes accessible, in which case the notebook crashes with an IndexError.\n",
"# This error is triggered for example when the used hit \"cell -> Run all\"\n",
"################\n",
"timeout = 60\n",
"start = time()\n",
"i = 1\n",
"with ui_events() as poll:\n",
" while True:\n",
" poll(1)\n",
" if len(nv.meshes):\n",
" break\n",
" if time() > start + timeout:\n",
" raise TimeoutError\n",
"################\n",
" \n",
"nv.set_mesh_property(nv.meshes[0].id, \"colormap\", \"blue\")\n",
"nv.set_clip_plane([-0.1, 270, 0])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8eb0a3b0",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -226,7 +282,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.9.7"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
Loading