def save_3D_nparray_nifti(np_matrix_3d, output_image, fname_atlas):
    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)
    # copy geometric information
    sct.run('fslcpgeom '+fname_atlas+' '+output_image, verbose=0)
    return None


#=======================================================================================================================
# Get tracts 
#=======================================================================================================================
Save 3d numpy matrix to niftii image
dataset/ETHPy150Open neuropoly/spinalcordtoolbox/dev/atlas/validate_atlas/generate_phantom.py/save_3D_nparray_nifti