code: def get_render_layers_from_exr(filename) -> Dict[str, np.ndarray]:
      exr = OpenEXR.InputFile(str(filename))
      layer_names = set()
      for n, _ in exr.header()["channels"].items():
          layer_name, _, _ = n.partition(".")
          layer_names.add(layer_name)
  
      output = {}
      if "Image" in layer_names:
          # Image is in RGBA format with range [0, inf]
          output["linear_rgba"] = read_channels_from_exr(
              exr, ["Image.R", "Image.G", "Image.B", "Image.A"]
          )
      if "Depth" in layer_names:
          # range [0, 10000000000.0]  # the value 1e10 is used for background / infinity
          output["depth"] = read_channels_from_exr(exr, ["Depth.V"])
      if "Vector" in layer_names:
          flow = read_channels_from_exr(
              exr, ["Vector.R", "Vector.G", "Vector.B", "Vector.A"]
          )
          # Blender exports forward and backward flow in a single image,
          # and uses (-delta_col, delta_row) format, but we prefer (delta_row, delta_col)
          output["backward_flow"] = np.zeros_like(flow[..., :2])
          output["backward_flow"][..., 0] = flow[..., 1]
          output["backward_flow"][..., 1] = -flow[..., 0]
  
          output["forward_flow"] = np.zeros_like(flow[..., 2:])
          output["forward_flow"][..., 0] = flow[..., 3]
          output["forward_flow"][..., 1] = -flow[..., 2]
  
      if "Normal" in layer_names:
          # range: [-1, 1]
          output["normal"] = read_channels_from_exr(
              exr, ["Normal.X", "Normal.Y", "Normal.Z"]
          )
  
      if "UV" in layer_names:
          # range [0, 1]
          output["uv"] = read_channels_from_exr(
              exr, ["UV.X", "UV.Y", "UV.Z"]
          )
  
      if "CryptoObject00" in layer_names:
          # CryptoMatte stores the segmentation of Objects using two kinds of channels:
          #  - index channels (uint32) specify the object index for a pixel
          #  - alpha channels (float32) specify the corresponding mask value
          # there may be many cryptomatte layers, which allows encoding a pixel as belonging to multiple
          # objects at once (up to a maximum of # of layers many objects per pixel)
          # In the EXR this is stored with 2 layers per RGBA image  (CryptoObject00, CryptoObject01, ...)
          # with RG being the first layer and BA being the second
          # So the R and B channels are uint32 and the G and A channels are float32.
          crypto_layers = [
              n for n in layer_names if n.startswith("CryptoObject")
          ]
          index_channels = [
              n + "." + c for n in crypto_layers for c in "RB"
          ]
          idxs = read_channels_from_exr(exr, index_channels)
          idxs.dtype = np.uint32
          output["segmentation_indices"] = idxs
          alpha_channels = [
              n + "." + c for n in crypto_layers for c in "GA"
          ]
          alphas = read_channels_from_exr(exr, alpha_channels)
          output["segmentation_alphas"] = alphas
      if "ObjectCoordinates" in layer_names:
          output["object_coordinates"] = read_channels_from_exr(
              exr,
              [
                  "ObjectCoordinates.R",
                  "ObjectCoordinates.G",
                  "ObjectCoordinates.B",
              ],
          )
      return output
  
imports: import contextlib
  import copy
  import functools
  import sys
  from typing import Dict, Sequence, Tuple, Union
  import numpy
  import OpenEXR
  import Imath
  import sklearn.utils
  import trimesh
  from kubric import core
  from kubric.kubric_typing import AddAssetFunction, ArrayLike
  from kubric.redirect_io import RedirectStream
  from kubric.safeimport.bpy import bpy
label_desc: Use image node_id 7 for calling a global function with example usage: get_render_layers_from_exr(filename) and returns: output