fn encode_nifti(
volumes: &[&[f64]],
dims: (usize, usize, usize),
voxel_size: (f64, f64, f64),
affine: &[f64; 16],
four_d: bool,
) -> Result<Vec<u8>, String>Expand description
Encode volumes (each nx*ny*nz values, x fastest) as an uncompressed NIfTI-1 file, 3D
(four_d = false, exactly one volume) or 4D (dim[4] = volumes.len()). Both writers share this, so they cannot disagree
on the header: float32 data, unit scaling, sform plus a matching qform where one exists, and
NIFTI_XYZT_UNITS.