.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/simple_surface_rendering/plot_dscalar.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_simple_surface_rendering_plot_dscalar.py: ================ Add scalar layer ================ This demo adds a dscalar.nii surface map as a colored layer .. GENERATED FROM PYTHON SOURCE LINES 7-24 .. image-sg:: /auto_examples/simple_surface_rendering/images/sphx_glr_plot_dscalar_001.png :alt: plot dscalar :srcset: /auto_examples/simple_surface_rendering/images/sphx_glr_plot_dscalar_001.png :class: sphx-glr-single-img .. code-block:: default from cerebro import cerebro_brain_utils as cbu from cerebro import cerebro_brain_viewer as cbv import matplotlib.pyplot as plt my_brain_viewer = cbv.Cerebro_brain_viewer(offscreen=True) surface_model = my_brain_viewer.load_template_GIFTI_cortical_surface_models('pial') cifti_space = my_brain_viewer.visualize_cifti_space() dscalar_file = cbu.get_data_file(f'templates/HCP/dscalars/S1200.curvature_MSMAll.32k_fs_LR.dscalar.nii') my_brain_viewer.add_cifti_dscalar_layer(dscalar_file=dscalar_file, colormap=plt.cm.inferno, opacity=1) fig, ax = plt.subplots(figsize=(10,10)) ax.axis('off') my_brain_viewer.offscreen_draw_to_matplotlib_axes(ax) # Clear this viewer my_brain_viewer.viewer.window.destroy() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 2.965 seconds) .. _sphx_glr_download_auto_examples_simple_surface_rendering_plot_dscalar.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_dscalar.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dscalar.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_