code: def _compute_spacing_matrix(
      image,
  ) -> tuple[torch.Tensor, torch.Tensor]:
      ndim = image.ndim
      spacing = np.asarray(image.GetSpacing(), dtype=np.float64)
      spacing_matrix = torch.eye(ndim + 1, dtype=torch.float64)
      inverse_spacing_matrix = torch.eye(ndim + 1, dtype=torch.float64)
      for i, e in enumerate(spacing):
          spacing_matrix[i, i] = e
          inverse_spacing_matrix[i, i] = 1 / e
  
      return spacing_matrix, inverse_spacing_matrix
  
imports: from __future__ import annotations
  from typing import TYPE_CHECKING, cast
  import numpy
  import torch
  from monai.config.type_definitions import DtypeLike
  from monai.data import ITKReader, ITKWriter
  from monai.data.meta_tensor import MetaTensor
  from monai.data.utils import orientation_ras_lps
  from monai.transforms import EnsureChannelFirst
  from monai.utils import MetaKeys, SpaceKeys, convert_to_dst_type, optional_import
label_desc: Use image node_id 8 for calling a global function with example usage: _compute_spacing_matrix(image) and returns: spacing_matrix,  inverse_spacing_matrix