tedana.utils.utils.filewrite

filewrite(data, filename, ref_img, gzip=False, copy_header=True, copy_meta=False)[source]

Writes data to filename in format of ref_img

If ref_img dtype is GIFTI, then data is assumed to be stacked L/R hemispheric and will be split and saved as two files

Parameters:
  • data ((S [x T]) array_like) – Data to be saved
  • filename (str) – Filepath where data should be saved to
  • ref_img (str or img_like) – Reference image
  • gzip (bool, optional) – Whether to gzip output (if not specified in filename). Only applies if output dtype is NIFTI. Default: False
  • copy_header (bool, optional) – Whether to copy header from ref_img to new image. Default: True
  • copy_meta (bool, optional) – Whether to copy meta from ref_img to new image. Only applies if output dtype is GIFTI. Default: False
Returns:

name – Path of saved image (with added extensions, as appropriate)

Return type:

str