xcp_d.utils.write_save module
Utilities to read and write nifiti and cifti data.
- xcp_d.utils.write_save.get_cifti_intents()[source]
Return a dictionary of CIFTI extensions and associated intents.
Copied from https://www.nitrc.org/projects/cifti/ PDF.
- xcp_d.utils.write_save.read_ndata(datafile, maskfile=None)[source]
Read nifti or cifti file.
- Parameters:
- Outputs:
data ((TxS)
numpy.ndarray
) – Vertices or voxels by timepoints.
- xcp_d.utils.write_save.write_gii(datat, template, filename, hemi)[source]
Use nibabel to write surface file.
- 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: