.. _sphx_glr_auto_examples_plot_export_nifti.py: ============================= Convert and save nifti file ============================= This example converts a brain object into a nifti and saves it. .. rst-class:: sphx-glr-horizontal * .. image:: /auto_examples/images/sphx_glr_plot_export_nifti_001.png :scale: 47 * .. image:: /auto_examples/images/sphx_glr_plot_export_nifti_002.png :scale: 47 .. code-block:: python # Code source: Lucy Owen & Andrew Heusser # License: MIT # import import supereeg as se # load example data to convert to nifti bo = se.load('example_data') # convert to nifti two ways: # if no parameters are passed default uses gray matter masked brain downsampled to 6 mm resolution # 1: convert with to_nii() method nii_bo1 = bo.to_nii(template='gray', vox_size=20) nii_bo1.plot_glass_brain() # 2: pass to initialize nifti nii_bo2 = se.Nifti(bo, template='gray', vox_size=20) nii_bo2.plot_glass_brain() # save nifti #nii_bo.save('/path/to/save/nifti') **Total running time of the script:** ( 0 minutes 1.610 seconds) .. only :: html .. container:: sphx-glr-footer .. container:: sphx-glr-download :download:`Download Python source code: plot_export_nifti.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: plot_export_nifti.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_