code: def create_table_neighbour_code_to_surface_area(
      spacing_mm, device=None
  ):
      """
      Returns an array mapping neighbourhood code to the surface elements area.
      Adapted from https://github.com/deepmind/surface-distance
  
      Note that the normals encode the initial surface area. This function computes
      the area corresponding to the given `spacing`.
  
      Args:
          spacing_mm: a sequence of 3 numbers. Voxel spacing along the first 3 spatial axes.
          device: device to put the table on.
  
      Returns:
          An array of size 256, mapping neighbourhood code to the surface area.
          ENCODING_KERNEL[3] which is the kernel used to compute the neighbourhood code.
      """
      spacing_mm = ensure_tuple_rep(spacing_mm, 3)
      # compute the area for all 256 possible surface elements given a 2x2x2 neighbourhood according to the spacing_mm
      c = _get_neighbour_code_to_normals_table(device)
      s = torch.as_tensor(
          [
              [
                  [
                      spacing_mm[1] * spacing_mm[2],
                      spacing_mm[0] * spacing_mm[2],
                      spacing_mm[0] * spacing_mm[1],
                  ]
              ]
          ],
          device=device,
          dtype=c.dtype,
      )
      norm = torch.linalg.norm(c * s, dim=-1)
      neighbour_code_to_surface_area = norm.sum(-1)
      return neighbour_code_to_surface_area, torch.as_tensor(
          [[ENCODING_KERNEL[3]]], device=device
      )
  
imports: from __future__ import annotations
  import warnings
  from functools import lru_cache, partial
  from types import ModuleType
  from typing import Any, Iterable, Sequence
  import numpy
  import torch
  from monai.config import NdarrayOrTensor, NdarrayTensor
  from monai.transforms.croppad.dictionary import CropForegroundD
  from monai.transforms.utils import distance_transform_edt
  from monai.utils import MetricReduction, convert_to_cupy, convert_to_dst_type, convert_to_numpy, convert_to_tensor, deprecated_arg, deprecated_arg_default, ensure_tuple_rep, look_up_option, optional_import
label_desc: Use image node_id 10 for calling a global function with example usage: create_table_neighbour_code_to_surface_area(spacing_mm, device) and returns: neighbour_code_to_surface_area,  torch