

def save_3D_nparray_nifti(np_matrix_3d, output_image, fname_atlas):
    '\n    Save 3d numpy matrix to niftii image\n    :param np_matrix_3d: 3d numpy array\n    :param output_image:  name of the created nifti file. e.g.; 3d_matrix.nii.gz\n    :param fname_atlas: name of the file to copy nifti header from\n    :return: nonw\n    '
    img = nib.Nifti1Image(np_matrix_3d, np.eye(4))
    affine = img.get_affine()
    np_matrix_3d_nii = nib.Nifti1Image(np_matrix_3d, affine)
    nib.save(np_matrix_3d_nii, output_image)
    sct.run(((('fslcpgeom ' + fname_atlas) + ' ') + output_image), verbose=0)
    return None

dataset/ETHPy150Open neuropoly/spinalcordtoolbox/dev/atlas/validate_atlas/generate_phantom.py save_3D_nparray_nifti/original