code: def make_affine_from_sitk(sitk_img):
      """Get affine transform in LPS"""
      if sitk_img.GetDepth() <= 0:
          return np.eye(4)
  
      rot = [
          sitk_img.TransformContinuousIndexToPhysicalPoint(p)
          for p in ((1, 0, 0), (0, 1, 0), (0, 0, 1), (0, 0, 0))
      ]
      rot = np.array(rot)
      affine = np.concatenate(
          [
              np.concatenate([rot[0:3] - rot[3:], rot[3:]], axis=0),
              [[0.0], [0.0], [0.0], [1.0]],
          ],
          axis=1,
      )
      affine = np.transpose(affine)
      # convert to RAS to match nibabel
      affine = np.matmul(np.diag([-1.0, -1.0, 1.0, 1.0]), affine)
      return affine
  
file_path: NiftyNet/niftynet/io/image_loader.py
imports: from collections import OrderedDict
  import nibabel
  import numpy
  import tensorflow
  from niftynet.utilities.util_import import require_module
label_desc: Use image node_id 10 for calling a global function with example usage: make_affine_from_sitk(sitk_img) and returns: affine, np