|
27 | 27 | "# Setup Google Colab\n", |
28 | 28 | "\n", |
29 | 29 | "In this script, we setup a Google Colab environment. This script will only work\n", |
30 | | - "when run from [Google Colab](https://colab.research.google.com/)). You can\n", |
| 30 | + "when run from `Google Colab <https://colab.research.google.com/>`_). You can\n", |
31 | 31 | "skip it if you run the tutorials on your machine.\n" |
32 | 32 | ] |
33 | 33 | }, |
|
77 | 77 | "#!apt-key adv --recv-keys --keyserver hkps://keyserver.ubuntu.com 0xA5D32F012649A5A9 > /dev/null\n", |
78 | 78 | "#!apt-get -qq update > /dev/null\n", |
79 | 79 | "#!apt-get install -qq inkscape git-annex-standalone > /dev/null\n", |
80 | | - "#!pip install -q voxelwise_tutorials\n", |
81 | | - "#![ -f \"ngrok-stable-linux-amd64.zip\" ] || wget -q https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip\n", |
82 | | - "#![ -f \"ngrok\" ] || unzip ngrok-stable-linux-amd64.zip" |
| 80 | + "#!pip install -q voxelwise_tutorials" |
83 | 81 | ] |
84 | 82 | }, |
85 | 83 | { |
|
98 | 96 | }, |
99 | 97 | "outputs": [], |
100 | 98 | "source": [ |
101 | | - "# - Set up an email and user name to use git, git-annex, and datalad (required to download the data)\n", |
| 99 | + "# - Set up an email and username to use git, git-annex, and datalad (required to download the data)\n", |
102 | 100 | "# - Add NeuroDebian to the package sources\n", |
103 | 101 | "# - Update the gpg keys to use NeuroDebian\n", |
104 | 102 | "# - Update the list of available packages\n", |
105 | 103 | "# - Install Inkscape to use more features from Pycortex, and install git-annex to download the data\n", |
106 | | - "# - Install the tutorial helper package, and all the required dependencies\n", |
107 | | - "# - Download ngrok to create a tunnel for pycortex 3D brain viewer\n", |
108 | | - "# - Extract the ngrok archive" |
| 104 | + "# - Install the tutorial helper package, and all the required dependencies" |
109 | 105 | ] |
110 | 106 | }, |
111 | 107 | { |
|
458 | 454 | "## Map to subject flatmap\n", |
459 | 455 | "\n", |
460 | 456 | "To better understand the distribution of explainable variance, we map the\n", |
461 | | - "values to the subject brain. This can be done with [pycortex](https://gallantlab.github.io/pycortex/), which can create interactive 3D\n", |
| 457 | + "values to the subject brain. This can be done with `pycortex\n", |
| 458 | + "<https://gallantlab.github.io/pycortex/>`_, which can create interactive 3D\n", |
462 | 459 | "viewers to be displayed in any modern browser. ``pycortex`` can also display\n", |
463 | 460 | "flattened maps of the cortical surface to visualize the entire cortical\n", |
464 | 461 | "surface at once.\n", |
|
497 | 494 | "source": [ |
498 | 495 | "This figure is a flattened map of the cortical surface. A number of regions\n", |
499 | 496 | "of interest (ROIs) have been labeled to ease interpretation. If you have\n", |
500 | | - "never seen such a flatmap, we recommend taking a look at a [pycortex brain\n", |
501 | | - "viewer](https://www.gallantlab.org/brainviewer/Deniz2019), which displays\n", |
| 497 | + "never seen such a flatmap, we recommend taking a look at a `pycortex brain\n", |
| 498 | + "viewer <https://www.gallantlab.org/brainviewer/Deniz2019>`_, which displays\n", |
502 | 499 | "the brain in 3D. In this viewer, press \"I\" to inflate the brain, \"F\" to\n", |
503 | 500 | "flatten the surface, and \"R\" to reset the view (or use the ``surface/unfold``\n", |
504 | 501 | "cursor on the right menu). Press \"H\" for a list of all keyboard shortcuts.\n", |
|
603 | 600 | "metadata": {}, |
604 | 601 | "source": [ |
605 | 602 | "To start an interactive 3D viewer in the browser, we can use the ``webshow``\n", |
606 | | - "function in pycortex. If you are running the notebook on Colab, you first\n", |
607 | | - "need to tunnel the pycortex application out of Colab. To do so, use the\n", |
608 | | - "following cell to start a tunnel with ``ngrok`` and to get an address where\n", |
609 | | - "the pycortex viewer will be made accessible.\n", |
610 | | - "\n" |
611 | | - ] |
612 | | - }, |
613 | | - { |
614 | | - "cell_type": "code", |
615 | | - "execution_count": null, |
616 | | - "metadata": { |
617 | | - "collapsed": false |
618 | | - }, |
619 | | - "outputs": [], |
620 | | - "source": [ |
621 | | - "try:\n", |
622 | | - " import google.colab # noqa\n", |
623 | | - " in_colab = True\n", |
624 | | - "except ImportError:\n", |
625 | | - " in_colab = False\n", |
626 | | - "print(in_colab)\n", |
627 | | - "\n", |
628 | | - "if in_colab:\n", |
629 | | - " from IPython import get_ipython\n", |
630 | | - " get_ipython().system_raw('./ngrok http 8050 &')\n", |
631 | | - " plt.pause(1)\n", |
632 | | - "\n", |
633 | | - " command = \"\"\"\n", |
634 | | - " curl -s http://localhost:4040/api/tunnels | python3 -c \\\n", |
635 | | - " \"import sys, json; print(json.load(sys.stdin)['tunnels'][0]['public_url'])\"\n", |
636 | | - " \"\"\"\n", |
637 | | - " result = get_ipython().getoutput(command, split=True)\n", |
638 | | - " print(\"Use the following address to connect to the brain viewer:\\n\"\n", |
639 | | - " f\"{result}\\n\"\n", |
640 | | - " \"and not the one proposed by pycortex ('Open viewer: ...')\\n\")" |
641 | | - ] |
642 | | - }, |
643 | | - { |
644 | | - "cell_type": "markdown", |
645 | | - "metadata": {}, |
646 | | - "source": [ |
647 | | - "Now you can start an interactive 3D viewer by changing ``run_webshow`` to\n", |
648 | | - "``True`` and running the following cell. If you are using Colab, remember to\n", |
649 | | - "use the address returned by ngrok in the cell above rather than the address\n", |
650 | | - "returned by this cell.\n", |
| 603 | + "function in pycortex. (Note that this method works only if you are running the\n", |
| 604 | + "notebooks locally.) You can start an interactive 3D viewer by changing\n", |
| 605 | + "``run_webshow`` to ``True`` and running the following cell.\n", |
651 | 606 | "\n" |
652 | 607 | ] |
653 | 608 | }, |
|
4287 | 4242 | "name": "python", |
4288 | 4243 | "nbconvert_exporter": "python", |
4289 | 4244 | "pygments_lexer": "ipython3", |
4290 | | - "version": "3.10.9" |
| 4245 | + "version": "3.8.3" |
4291 | 4246 | }, |
4292 | 4247 | "name": "_merged" |
4293 | 4248 | }, |
|
0 commit comments