code: def _compute_direction_matrix(
      image,
  ) -> tuple[torch.Tensor, torch.Tensor]:
      ndim = image.ndim
      direction = itk.array_from_matrix(image.GetDirection())
      direction_matrix = torch.eye(ndim + 1, dtype=torch.float64)
      direction_matrix[:ndim, :ndim] = torch.tensor(
          direction, dtype=torch.float64
      )
      inverse_direction = itk.array_from_matrix(
          image.GetInverseDirection()
      )
      inverse_direction_matrix = torch.eye(
          ndim + 1, dtype=torch.float64
      )
      inverse_direction_matrix[:ndim, :ndim] = torch.tensor(
          inverse_direction, dtype=torch.float64
      )
  
      return direction_matrix, inverse_direction_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 9 for calling a global function with example usage: _compute_direction_matrix(image) and returns: direction_matrix,  inverse_direction_matrix