
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples\implants\plot_implants_cortical.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_implants_plot_implants_cortical.py>`
        to download the full example code.

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_implants_plot_implants_cortical.py:


===============================================================================
Cortical implant gallery
===============================================================================

pulse2percept supports the following cortical implants:

Orion Prosthesis System (Cortigent Inc.)
----------------------------------------
:py:class:`~pulse2percept.implants.cortex.Orion` contains 60 electrodes in a 
hex shaped grid inspired by Argus II.

.. GENERATED FROM PYTHON SOURCE LINES 13-24

.. code-block:: Python


    import matplotlib.pyplot as plt
    from pulse2percept.implants.cortex import *
    import pulse2percept as p2p
    import warnings
    warnings.filterwarnings("ignore") # ignore matplotlib warnings

    orion = Orion()
    orion.plot(annotate=True)
    plt.show()




.. image-sg:: /examples/implants/images/sphx_glr_plot_implants_cortical_001.png
   :alt: plot implants cortical
   :srcset: /examples/implants/images/sphx_glr_plot_implants_cortical_001.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 25-30

Cortivis Prosthesis System (Biomedical Technologies)
----------------------------------------------------

:py:class:`~pulse2percept.implants.cortex.Cortivis` is an implant with 96 
electrodes in a square shaped grid.

.. GENERATED FROM PYTHON SOURCE LINES 30-35

.. code-block:: Python


    cortivis = Cortivis()
    cortivis.plot(annotate=True)
    plt.show()




.. image-sg:: /examples/implants/images/sphx_glr_plot_implants_cortical_002.png
   :alt: plot implants cortical
   :srcset: /examples/implants/images/sphx_glr_plot_implants_cortical_002.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 36-42

ICVP Prosthesis System (Sigenics Inc.)
--------------------------------------

:py:class:`~pulse2percept.implants.cortex.ICVP` is an implant with 16 
primary electrodes in a hex shaped grid, along with 2 additional "reference" 
and "counter" electrodes.

.. GENERATED FROM PYTHON SOURCE LINES 42-47

.. code-block:: Python


    icvp = ICVP()
    icvp.plot(annotate=True)
    plt.show()




.. image-sg:: /examples/implants/images/sphx_glr_plot_implants_cortical_003.png
   :alt: plot implants cortical
   :srcset: /examples/implants/images/sphx_glr_plot_implants_cortical_003.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 48-60

Neuralink Threads (Neuralink)
--------------------------------------

:py:class:`~pulse2percept.implants.cortex.Neuralink` is an implant consisting 
of one or more :py:class:`~pulse2percept.implants.cortex.NeuralinkThread`s. 
The simplest one is :py:class:`~pulse2percept.implants.cortex.LinearEdgeThread`,
consisting of 32 electrodes.

These threads are designed to be 3D, and can be plotted in both 3D and 2D space,
which will show the x-y projection of the points. Here are some examples
showing the 1) a close up of the thread, 2) a 3D plot of two threads, and 3) the
2D projection of the two threads.

.. GENERATED FROM PYTHON SOURCE LINES 60-77

.. code-block:: Python

    fig = plt.figure(figsize=(10, 4))
    thread1 = LinearEdgeThread()
    thread2 = LinearEdgeThread(500, 500, orient=[1, 1, 1])
    ax0 = fig.add_subplot(131, projection='3d')
    thread1.plot3D(ax=ax0)
    ax0.set_xlim(-100, 100)
    ax0.set_ylim(-100, 100)
    ax0.set_zlim(10, 200)
    ax1 = fig.add_subplot(132, projection='3d')
    thread1.plot3D(ax=ax1)
    thread2.plot3D(ax=ax1)
    ax2 = fig.add_subplot(133)
    thread1.plot(ax=ax2)
    thread2.plot(ax=ax2)
    plt.axis('equal')
    plt.show()




.. image-sg:: /examples/implants/images/sphx_glr_plot_implants_cortical_004.png
   :alt: plot implants cortical
   :srcset: /examples/implants/images/sphx_glr_plot_implants_cortical_004.png
   :class: sphx-glr-single-img





.. GENERATED FROM PYTHON SOURCE LINES 78-97

Neuralink implants can be created from a NeuropythyMap
enabling easy placement of implants across the cortical surface.

.. code-block:: python

    nmap = p2p.topography.NeuropythyMap(subject='fsaverage', regions=['v1'])
    model = p2p.models.cortex.ScoreboardModel(
        rho=500, xrange=(-6, 0), yrange=(-5, 5), step=.25, vfmap=nmap
    ).build()
    nlink = Neuralink.from_neuropythy(
        nmap, xrange=model.xrange, yrange=model.yrange, step=2, rand_insertion_angle=0
    )
    print(len(nlink.implants), " total threads")
    fig = plt.figure(figsize=(10, 4))
    ax1 = fig.add_subplot(121, projection='3d')
    model.plot3D(ax=ax1, style='cell'); nlink.plot3D(ax=ax1)
    ax2 = fig.add_subplot(122)
    model.plot(style='cell', ax=ax2); nlink.plot(ax=ax2)
    plt.show()


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.825 seconds)


.. _sphx_glr_download_examples_implants_plot_implants_cortical.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: plot_implants_cortical.ipynb <plot_implants_cortical.ipynb>`

    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: plot_implants_cortical.py <plot_implants_cortical.py>`

    .. container:: sphx-glr-download sphx-glr-download-zip

      :download:`Download zipped: plot_implants_cortical.zip <plot_implants_cortical.zip>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
