cmind.utils.nifti_utils¶
NIFTI Handling Utilities A series of utilities for working with NIFTI files
cmind_save_nii_mod_header
Functions
cmind_save_nii_mod_header (old_nii, data, ...) |
save data to out_name.nii.gz, reusing the nifti header from old_nii with |
round_affine_to_axial (nii_filename) |
Resets the affine to axial (preserving sign) |
-
cmind.utils.nifti_utils.
cmind_save_nii_mod_header
(old_nii, data, out_name, nii_type=None, cal_range=None)[source]¶ - save data to out_name.nii.gz, reusing the nifti header from old_nii with
- appropriate modifications to image dimensions
Parameters: old_nii : Nifti1Image
Nifti-1 image as read in by nibabel
data : ndarray
array of image data to write to out_name
out_name : str
filename for the output image. File type will be determined by the extension given here (e.g. myfile.nii.gz would write a gzipped Nifti-1 image)
nii_type : str, optional
data type for the output image. if unspecified, will be whatever was in old_nii
cal_range : list or tuple
two-element list of the intensities to store in the cal_min and cal_max fields of the nifti file
Notes
Write out an image file containing the data in data with header information copied from old_nii. If old_nii is 3D, but data is 4D, the image dimensions will be updated accordingly. Whether the output is NIFTI or NIFTI-GZ will be determined by the extension of out_name