Export volume source estimate as a nifti object. Parameters ---------- src : instance of SourceSpaces The source spaces (should all be of type volume, or part of a mixed source space). dest : ``'mri'`` | ``'surf'`` If ``'mri'`` the
(
self,
src,
dest="mri",
mri_resolution=False,
format="nifti1", # noqa: A002
)
| 2576 | nib.save(img, fname) |
| 2577 | |
| 2578 | def as_volume( |
| 2579 | self, |
| 2580 | src, |
| 2581 | dest="mri", |
| 2582 | mri_resolution=False, |
| 2583 | format="nifti1", # noqa: A002 |
| 2584 | ): |
| 2585 | """Export volume source estimate as a nifti object. |
| 2586 | |
| 2587 | Parameters |
| 2588 | ---------- |
| 2589 | src : instance of SourceSpaces |
| 2590 | The source spaces (should all be of type volume, or part of a |
| 2591 | mixed source space). |
| 2592 | dest : ``'mri'`` | ``'surf'`` |
| 2593 | If ``'mri'`` the volume is defined in the coordinate system of |
| 2594 | the original T1 image. If 'surf' the coordinate system |
| 2595 | of the FreeSurfer surface is used (Surface RAS). |
| 2596 | mri_resolution : bool |
| 2597 | It True the image is saved in MRI resolution. |
| 2598 | |
| 2599 | .. warning: If you have many time points the file produced can be |
| 2600 | huge. The default is ``mri_resolution=False``. |
| 2601 | format : str |
| 2602 | Either 'nifti1' (default) or 'nifti2'. |
| 2603 | |
| 2604 | Returns |
| 2605 | ------- |
| 2606 | img : instance of Nifti1Image |
| 2607 | The image object. |
| 2608 | |
| 2609 | Notes |
| 2610 | ----- |
| 2611 | .. versionadded:: 0.9.0 |
| 2612 | """ |
| 2613 | from .morph import _interpolate_data |
| 2614 | |
| 2615 | data = self.magnitude() if self._data_ndim == 3 else self |
| 2616 | return _interpolate_data( |
| 2617 | data, src, mri_resolution=mri_resolution, mri_space=True, output=format |
| 2618 | ) |
| 2619 | |
| 2620 | |
| 2621 | @fill_doc |