Skip to content

Commit

Permalink
Make install
Browse files Browse the repository at this point in the history
  • Loading branch information
gauzias committed Nov 30, 2022
1 parent 0172d83 commit 575b52c
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 25 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"\n\n===================================\nExample of Spectral Analysis of Gyrification (SPANGY) decomposition\nD. Germanaud*, J. Lefevre*,R. Toro, C. Fischer, J.Dubois, L. Hertz-Pannier,\nJ.F. Mangin, Larger is twistier:Spectral Analysis of Gyrification (SPANGY)\napplied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.\n===================================\n"
"\n\n# Example of Spectral Analysis of Gyrification (SPANGY) decomposition\n"
]
},
{
Expand All @@ -26,7 +26,7 @@
},
"outputs": [],
"source": [
"import slam.io as sio\nimport numpy as np\nimport slam.differential_geometry as sdg\nimport slam.curvature as scurv\nfrom scipy.sparse.linalg import eigsh\nimport time\nimport slam.plot as splt\nimport matplotlib.pyplot as plt\nimport slam.spangy as spgy\n\n## LOAD MESH\nmesh = sio.load_mesh(\"../examples/data/example_mesh.gii\")\nN = 1500\n# Compute eigenpairs and mass matrix\neigVal, eigVects, lap_b = spgy.eigenpairs(mesh,N)\n\n## CURVATURE\nPrincipalCurvatures, PrincipalDir1, PrincipalDir2 = \\\n scurv.curvatures_and_derivatives(mesh)\nmean_curv = 0.5 * (PrincipalCurvatures[0, :] + PrincipalCurvatures[1, :])\n\n# Plot of mean curvature on the mesh\nvisb_sc = splt.visbrain_plot(mesh=mesh, tex=mean_curv, caption='Mean Curvature', cmap='jet')\nvisb_sc.preview()\n\n## WHOLE BRAIN SPECTRUM\ngrouped_spectrum,group_indices,coefficients = spgy.spectrum(mean_curv, lap_b, eigVects, eigVal)\nlevels=len(group_indices)\n\n# a. Whole brain parameters\nmL_in_MM3=1000\nCM2_in_MM2=100\nvolume = mesh.volume\nsurface_area = mesh.area\nafp=np.sum(grouped_spectrum[1:])\nprint('** a. Whole brain parameters **')\nprint('Volume = %d mL, Area = %d cm^2, Analyze Folding Power = %f,' % (np.floor(volume/mL_in_MM3),np.floor(surface_area/CM2_in_MM2),afp))\n\n# b. Band number of parcels\nprint('** b. Band number of parcels **')\nprint('B4 = %f, B5 = %f, B6 = %f' % (0,0,0))\n\n# c. Band power\nprint('** c. Band power **')\nprint('B4 = %f, B5 = %f, B6 = %f' % (grouped_spectrum[4],grouped_spectrum[5],grouped_spectrum[6]))\n\n# d. Band relative power\nprint('** d. Band relative power **')\nprint('B4 = %0.5f, B5 = %0.5f , B6 = %0.5f' % (grouped_spectrum[4]/afp,grouped_spectrum[5]/afp,grouped_spectrum[6]/afp))\n\n# Create two subplots\nfig, (ax1, ax2) = plt.subplots(1, 2)\n# Plot the sqrt of the eigVals divided by 2*np.pi against the coefficients in the first subplot\nax1.plot(np.sqrt(eigVal[1:])/(2*np.pi),coefficients[1:])\nax1.set_xlabel('Frequency (m^{-1})')\nax1.set_ylabel('Coefficients')\n\n# Barplot for the nlevels and grouped spectrum in the second subplot\n# Barplot in ax2 between nlevels and grouped spectrum\nprint(grouped_spectrum)\nax2.bar(np.arange(0,levels),grouped_spectrum.squeeze())\nax2.set_xlabel('Spangy Frequency Bands')\nax2.set_ylabel('Power Spectrum')\n\nplt.show()\n\n## LOCAL SPECTRAL BANDS\nloc_dom_band, frecomposed = spgy.local_dominance_map(coefficients,mean_curv,levels,group_indices,eigVects)\n\n# Plot of spectral dominant bands on the mesh\nvisb_sc = splt.visbrain_plot(mesh=mesh, tex=loc_dom_band, caption='Local Dominant Band', cmap='jet')\nvisb_sc.preview()"
"import slam.io as sio\nimport numpy as np\nimport slam.differential_geometry as sdg\nimport slam.curvature as scurv\nfrom scipy.sparse.linalg import eigsh\nimport time\nimport slam.plot as splt\nimport matplotlib.pyplot as plt\nimport slam.spangy as spgy\n\n## D. Germanaud*, J. Lefevre*,R. Toro, C. Fischer, J.Dubois, L. Hertz-Pannier,\n## J.F. Mangin, Larger is twistier:Spectral Analysis of Gyrification (SPANGY)\n## applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.\n\n\n## LOAD MESH\nmesh = sio.load_mesh(\"../examples/data/example_mesh.gii\")\nN = 1500\n# Compute eigenpairs and mass matrix\neigVal, eigVects, lap_b = spgy.eigenpairs(mesh,N)\n\n## CURVATURE\nPrincipalCurvatures, PrincipalDir1, PrincipalDir2 = \\\n scurv.curvatures_and_derivatives(mesh)\nmean_curv = 0.5 * (PrincipalCurvatures[0, :] + PrincipalCurvatures[1, :])\n\n# Plot of mean curvature on the mesh\nvisb_sc = splt.visbrain_plot(mesh=mesh, tex=mean_curv, caption='Mean Curvature', cmap='jet')\nvisb_sc.preview()\n\n## WHOLE BRAIN SPECTRUM\ngrouped_spectrum,group_indices,coefficients = spgy.spectrum(mean_curv, lap_b, eigVects, eigVal)\nlevels=len(group_indices)\n\n# a. Whole brain parameters\nmL_in_MM3=1000\nCM2_in_MM2=100\nvolume = mesh.volume\nsurface_area = mesh.area\nafp=np.sum(grouped_spectrum[1:])\nprint('** a. Whole brain parameters **')\nprint('Volume = %d mL, Area = %d cm^2, Analyze Folding Power = %f,' % (np.floor(volume/mL_in_MM3),np.floor(surface_area/CM2_in_MM2),afp))\n\n# b. Band number of parcels\nprint('** b. Band number of parcels **')\nprint('B4 = %f, B5 = %f, B6 = %f' % (0,0,0))\n\n# c. Band power\nprint('** c. Band power **')\nprint('B4 = %f, B5 = %f, B6 = %f' % (grouped_spectrum[4],grouped_spectrum[5],grouped_spectrum[6]))\n\n# d. Band relative power\nprint('** d. Band relative power **')\nprint('B4 = %0.5f, B5 = %0.5f , B6 = %0.5f' % (grouped_spectrum[4]/afp,grouped_spectrum[5]/afp,grouped_spectrum[6]/afp))\n\n# Create two subplots\nfig, (ax1, ax2) = plt.subplots(1, 2)\n# Plot the sqrt of the eigVals divided by 2*np.pi against the coefficients in the first subplot\nax1.plot(np.sqrt(eigVal[1:])/(2*np.pi),coefficients[1:])\nax1.set_xlabel('Frequency (m^{-1})')\nax1.set_ylabel('Coefficients')\n\n# Barplot for the nlevels and grouped spectrum in the second subplot\n# Barplot in ax2 between nlevels and grouped spectrum\nprint(grouped_spectrum)\nax2.bar(np.arange(0,levels),grouped_spectrum.squeeze())\nax2.set_xlabel('Spangy Frequency Bands')\nax2.set_ylabel('Power Spectrum')\n\nplt.show()\n\n## LOCAL SPECTRAL BANDS\nloc_dom_band, frecomposed = spgy.local_dominance_map(coefficients,mean_curv,levels,group_indices,eigVects)\n\n# Plot of spectral dominant bands on the mesh\nvisb_sc = splt.visbrain_plot(mesh=mesh, tex=loc_dom_band, caption='Local Dominant Band', cmap='jet')\nvisb_sc.preview()"
]
}
],
Expand Down
8 changes: 5 additions & 3 deletions _downloads/c7a379ff1b73b7b2972fd8542e5e55ef/example_spangy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
===================================
Example of Spectral Analysis of Gyrification (SPANGY) decomposition
D. Germanaud*, J. Lefevre*,R. Toro, C. Fischer, J.Dubois, L. Hertz-Pannier,
J.F. Mangin, Larger is twistier:Spectral Analysis of Gyrification (SPANGY)
applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.
===================================
"""
import slam.io as sio
Expand All @@ -18,6 +15,11 @@
import matplotlib.pyplot as plt
import slam.spangy as spgy

## D. Germanaud*, J. Lefevre*,R. Toro, C. Fischer, J.Dubois, L. Hertz-Pannier,
## J.F. Mangin, Larger is twistier:Spectral Analysis of Gyrification (SPANGY)
## applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.


## LOAD MESH
mesh = sio.load_mesh("../examples/data/example_mesh.gii")
N = 1500
Expand Down
12 changes: 7 additions & 5 deletions _sources/auto_examples/example_spangy.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@

===================================
Example of Spectral Analysis of Gyrification (SPANGY) decomposition
D. Germanaud*, J. Lefevre*,R. Toro, C. Fischer, J.Dubois, L. Hertz-Pannier,
J.F. Mangin, Larger is twistier:Spectral Analysis of Gyrification (SPANGY)
applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.
===================================

.. GENERATED FROM PYTHON SOURCE LINES 11-84
.. GENERATED FROM PYTHON SOURCE LINES 8-86
Expand Down Expand Up @@ -107,6 +104,11 @@ applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.
import matplotlib.pyplot as plt
import slam.spangy as spgy
## D. Germanaud*, J. Lefevre*,R. Toro, C. Fischer, J.Dubois, L. Hertz-Pannier,
## J.F. Mangin, Larger is twistier:Spectral Analysis of Gyrification (SPANGY)
## applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.
## LOAD MESH
mesh = sio.load_mesh("../examples/data/example_mesh.gii")
N = 1500
Expand Down Expand Up @@ -174,7 +176,7 @@ applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.
.. rst-class:: sphx-glr-timing

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


.. _sphx_glr_download_auto_examples_example_spangy.py:
Expand Down
6 changes: 3 additions & 3 deletions _sources/auto_examples/sg_execution_times.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

Computation times
=================
**00:00.171** total execution time for **auto_examples** files:
**00:32.380** total execution time for **auto_examples** files:

+---------------------------------------------------------------------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_auto_examples_example_surface_profiling.py` (``example_surface_profiling.py``) | 00:00.171 | 0.0 MB |
| :ref:`sphx_glr_auto_examples_example_spangy.py` (``example_spangy.py``) | 00:32.380 | 0.0 MB |
+---------------------------------------------------------------------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_auto_examples_example_basics.py` (``example_basics.py``) | 00:00.000 | 0.0 MB |
+---------------------------------------------------------------------------------------------------------------------+-----------+--------+
Expand Down Expand Up @@ -38,7 +38,7 @@ Computation times
+---------------------------------------------------------------------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_auto_examples_example_remeshing.py` (``example_remeshing.py``) | 00:00.000 | 0.0 MB |
+---------------------------------------------------------------------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_auto_examples_example_spangy.py` (``example_spangy.py``) | 00:00.000 | 0.0 MB |
| :ref:`sphx_glr_auto_examples_example_surface_profiling.py` (``example_surface_profiling.py``) | 00:00.000 | 0.0 MB |
+---------------------------------------------------------------------------------------------------------------------+-----------+--------+
| :ref:`sphx_glr_auto_examples_example_texture.py` (``example_texture.py``) | 00:00.000 | 0.0 MB |
+---------------------------------------------------------------------------------------------------------------------+-----------+--------+
Expand Down
18 changes: 12 additions & 6 deletions auto_examples/example_spangy.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>&lt;no title&gt; &#8212; slam 0.0.1 documentation</title>
<title>Example of Spectral Analysis of Gyrification (SPANGY) decomposition &#8212; slam 0.0.1 documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/bootstrap-sphinx.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/gallery.css" />
Expand Down Expand Up @@ -70,7 +70,8 @@
href="#">Page <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul class="simple">
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">Example of Spectral Analysis of Gyrification (SPANGY) decomposition</a></li>
</ul>
</ul>
</li>
Expand Down Expand Up @@ -111,9 +112,8 @@
<p>Click <a class="reference internal" href="#sphx-glr-download-auto-examples-example-spangy-py"><span class="std std-ref">here</span></a>
to download the full example code</p>
</div>
<p class="sphx-glr-example-title">J.F. Mangin, Larger is twistier:Spectral Analysis of Gyrification (SPANGY)
applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.
===================================</p>
<div class="sphx-glr-example-title section" id="example-of-spectral-analysis-of-gyrification-spangy-decomposition">
<span id="example-spangy"></span><span id="sphx-glr-auto-examples-example-spangy-py"></span><h1>Example of Spectral Analysis of Gyrification (SPANGY) decomposition<a class="headerlink" href="#example-of-spectral-analysis-of-gyrification-spangy-decomposition" title="Permalink to this headline"></a></h1>
<ul class="sphx-glr-horizontal">
<li><img alt="example spangy" class="sphx-glr-multi-img" src="../_images/sphx_glr_example_spangy_001.png" />
</li>
Expand Down Expand Up @@ -166,6 +166,11 @@
<span class="kn">import</span> <span class="nn">matplotlib.pyplot</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="kn">import</span> <span class="nn">slam.spangy</span> <span class="k">as</span> <span class="nn">spgy</span>

<span class="c1">## D. Germanaud*, J. Lefevre*,R. Toro, C. Fischer, J.Dubois, L. Hertz-Pannier,</span>
<span class="c1">## J.F. Mangin, Larger is twistier:Spectral Analysis of Gyrification (SPANGY)</span>
<span class="c1">## applied to adult brain size polymorphism,Neuroimage, 63 (3), 1257-1272, 2012.</span>


<span class="c1">## LOAD MESH</span>
<span class="n">mesh</span> <span class="o">=</span> <span class="n">sio</span><span class="o">.</span><span class="n">load_mesh</span><span class="p">(</span><span class="s2">&quot;../examples/data/example_mesh.gii&quot;</span><span class="p">)</span>
<a href="https://docs.python.org/3/library/functions.html#int" title="builtins.int" class="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance"><span class="n">N</span></a> <span class="o">=</span> <span class="mi">1500</span>
Expand Down Expand Up @@ -230,7 +235,7 @@
<span class="n">visb_sc</span><span class="o">.</span><span class="n">preview</span><span class="p">()</span>
</pre></div>
</div>
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 31.582 seconds)</p>
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 32.380 seconds)</p>
<div class="sphx-glr-footer class sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-example-spangy-py">
<div class="sphx-glr-download sphx-glr-download-python docutils container">
<p><a class="reference download internal" download="" href="../_downloads/c7a379ff1b73b7b2972fd8542e5e55ef/example_spangy.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">example_spangy.py</span></code></a></p>
Expand All @@ -240,6 +245,7 @@
</div>
</div>
<p class="sphx-glr-signature"><a class="reference external" href="https://sphinx-gallery.github.io">Gallery generated by Sphinx-Gallery</a></p>
</div>


</div>
Expand Down
2 changes: 1 addition & 1 deletion auto_examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
</div>
<div class="sphx-glr-thumbcontainer" tooltip="Example of Spectral Analysis of Gyrification (SPANGY) decomposition"><div class="figure align-default" id="id15">
<img alt="Example of Spectral Analysis of Gyrification (SPANGY) decomposition" src="../_images/sphx_glr_example_spangy_thumb.png" />
<p class="caption"><span class="caption-text"><span class="xref std std-ref">sphx_glr_auto_examples_example_spangy.py</span></span><a class="headerlink" href="#id15" title="Permalink to this image"></a></p>
<p class="caption"><span class="caption-text"><a class="reference internal" href="example_spangy.html#sphx-glr-auto-examples-example-spangy-py"><span class="std std-ref">Example of Spectral Analysis of Gyrification (SPANGY) decomposition</span></a></span><a class="headerlink" href="#id15" title="Permalink to this image"></a></p>
</div>
</div><div class="toctree-wrapper compound">
</div>
Expand Down
8 changes: 4 additions & 4 deletions auto_examples/sg_execution_times.html
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@

<div class="section" id="computation-times">
<span id="sphx-glr-auto-examples-sg-execution-times"></span><h1>Computation times<a class="headerlink" href="#computation-times" title="Permalink to this headline"></a></h1>
<p><strong>00:00.171</strong> total execution time for <strong>auto_examples</strong> files:</p>
<p><strong>00:32.380</strong> total execution time for <strong>auto_examples</strong> files:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 86%" />
<col style="width: 8%" />
<col style="width: 6%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="example_surface_profiling.html#sphx-glr-auto-examples-example-surface-profiling-py"><span class="std std-ref">example of surface profiling in slam</span></a> (<code class="docutils literal notranslate"><span class="pre">example_surface_profiling.py</span></code>)</p></td>
<td><p>00:00.171</p></td>
<tr class="row-odd"><td><p><a class="reference internal" href="example_spangy.html#sphx-glr-auto-examples-example-spangy-py"><span class="std std-ref">Example of Spectral Analysis of Gyrification (SPANGY) decomposition</span></a> (<code class="docutils literal notranslate"><span class="pre">example_spangy.py</span></code>)</p></td>
<td><p>00:32.380</p></td>
<td><p>0.0 MB</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="example_basics.html#sphx-glr-auto-examples-example-basics-py"><span class="std std-ref">Show basic use of slam</span></a> (<code class="docutils literal notranslate"><span class="pre">example_basics.py</span></code>)</p></td>
Expand Down Expand Up @@ -177,7 +177,7 @@
<td><p>00:00.000</p></td>
<td><p>0.0 MB</p></td>
</tr>
<tr class="row-even"><td><p><span class="xref std std-ref">sphx_glr_auto_examples_example_spangy.py</span> (<code class="docutils literal notranslate"><span class="pre">example_spangy.py</span></code>)</p></td>
<tr class="row-even"><td><p><a class="reference internal" href="example_surface_profiling.html#sphx-glr-auto-examples-example-surface-profiling-py"><span class="std std-ref">example of surface profiling in slam</span></a> (<code class="docutils literal notranslate"><span class="pre">example_surface_profiling.py</span></code>)</p></td>
<td><p>00:00.000</p></td>
<td><p>0.0 MB</p></td>
</tr>
Expand Down
Binary file modified objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 575b52c

Please sign in to comment.