xcp_d.utils.write_save.write_ndata

xcp_d.utils.write_save.write_ndata(data_matrix, template, filename, mask=None, TR=1)[source]

Save numpy array to a nifti or cifti file.

Parameters:
  • data matrix ((SxT) numpy.ndarray) – The array to save to a file.

  • template (str) – Path to a template image, from which header and affine information will be used.

  • filename (str) – Name of the output file to be written.

  • mask (str or None, optional) – The path to a binary mask file. The mask is only used for nifti files- masking is not supported in ciftis. Default is None.

  • TR (float) – Repetition time of the BOLD run, in seconds.

Returns:

filename – The name of the generated output file. Same as the “filename” input.

Return type:

str