{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Interactive Surface Visualization Demo Notebook\n", "\n", " developed by Murat Bilgel, Benjamin Ely, Melanie Ganz, Krisanne Litinas, and Andrea Shafer\n", " Heavily indebted to Satra Ghosh, Chris Holdgraf, Anisha Keshavan, and Tal Yarkoni\n", " Builds on niwidgets\n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "%load_ext autoreload\n", "%autoreload 2\n", "import os\n", "import sys\n", "from niwidgets import niwidget_surface\n", "from niwidgets.exampledata import examplesurface, exampleoverlays\n", "from pathlib import Path" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "4546a2e205324411baac3eb08f7bf06e", "version_major": 2, "version_minor": 0 }, "text/html": [ "
Failed to display Jupyter Widget of type interactive.
\n", " If you're reading this message in Jupyter Notebook or JupyterLab, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "
\n", "\n", " If you're reading this message in another notebook frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "
\n" ], "text/plain": [ "interactive(children=(IntSlider(value=0, description='frame', max=3), Dropdown(description='colormap', index=74, options=('viridis', 'Accent', 'Blues', 'BrBG', 'BuGn', 'BuPu', 'CMRmap', 'Dark2', 'GnBu', 'Greens', 'Greys', 'OrRd', 'Oranges', 'PRGn', 'Paired', 'Pastel1', 'Pastel2', 'PiYG', 'PuBu', 'PuBuGn', 'PuOr', 'PuRd', 'Purples', 'RdBu', 'RdGy', 'RdPu', 'RdYlBu', 'RdYlGn', 'Reds', 'Set1', 'Set2', 'Set3', 'Spectral', 'Vega10', 'Vega20', 'Vega20b', 'Vega20c', 'Wistia', 'YlGn', 'YlGnBu', 'YlOrBr', 'YlOrRd', 'afmhot', 'autumn', 'binary', 'bone', 'brg', 'bwr', 'cool', 'coolwarm', 'copper', 'cubehelix', 'flag', 'gist_earth', 'gist_gray', 'gist_heat', 'gist_ncar', 'gist_rainbow', 'gist_stern', 'gist_yarg', 'gnuplot', 'gnuplot2', 'gray', 'hot', 'hsv', 'jet', 'nipy_spectral', 'ocean', 'pink', 'prism', 'rainbow', 'seismic', 'spectral', 'spring', 'summer', 'tab10', 'tab20', 'tab20b', 'tab20c', 'terrain', 'winter'), value='summer'), Output()), _dom_classes=('widget-interact',))" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "fddb214fc89b4e7dad8bbdc5e855d0c2", "version_major": 2, "version_minor": 0 }, "text/html": [ "Failed to display Jupyter Widget of type Figure.
\n", " If you're reading this message in Jupyter Notebook or JupyterLab, it may mean\n", " that the widgets JavaScript is still loading. If this message persists, it\n", " likely means that the widgets JavaScript library is either not installed or\n", " not enabled. See the Jupyter\n", " Widgets Documentation for setup instructions.\n", "
\n", "\n", " If you're reading this message in another notebook frontend (for example, a static\n", " rendering on GitHub or NBViewer),\n", " it may mean that your frontend doesn't currently support widgets.\n", "
\n" ], "text/plain": [ "Figure(camera_center=[0.0, 0.0, 0.0], camera_fov=1.0, height=600, matrix_projection=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], matrix_world=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], meshes=[Mesh(color=array([[ 0. , 0.5, 0.4],\n", " [ 0. , 0.5, 0.4],\n", " [ 0. , 0.5, 0.4],\n", " ..., \n", " [ 0. , 0.5, 0.4],\n", " [ 0. , 0.5, 0.4],\n", " [ 0. , 0.5, 0.4]]), texture=None, triangles=array([[ 0, 1, 3],\n", " [ 4, 3, 1],\n", " [ 0, 91, 1],\n", " ..., \n", " [123307, 123906, 123895],\n", " [123906, 123907, 123895],\n", " [123885, 124986, 124987]], dtype=uint32), x=array([ 18.7413578 , 18.37849426, 19.00789833, ..., 17.78539658,\n", " 17.8218174 , 17.95105362]), y=array([-127.09669495, -127.08947754, -127.14855194, ..., 96.06409454,\n", " 96.46263123, 96.3392868 ]), z=array([-48.42454529, -48.42292786, -48.9959259 , ..., 44.24810028,\n", " 44.08300781, 44.18468475]))], style={'axes': {'color': 'black', 'label': {'color': 'black'}, 'ticklabel': {'color': 'black'}, 'visible': False}, 'background-color': 'white', 'box': {'visible': False}}, tf=None, width=600, xlim=[-100.0, 100.0], ylim=[-127.3917007446289, 127.3917007446289], zlim=[-100.0, 100.0])" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "my_widget = niwidget_surface.SurfaceWidget(examplesurface, exampleoverlays)\n", "\n", "my_widget.surface_plotter(showZeroes=True)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 2 }