code: def concat_val_to_np(
      data_list: list[dict],
      fixed_keys: list[str | int],
      ragged: bool | None = False,
      allow_missing: bool | None = False,
      **kwargs: Any,
  ) -> np.ndarray:
      """
      Get the nested value in a list of dictionary that shares the same structure.
  
      Args:
         data_list: a list of dictionary {key1: {key2: np.ndarray}}.
         fixed_keys: a list of keys that records to path to the value in the dict elements.
         ragged: if True, numbers can be in list of lists or ragged format so concat mode needs change.
         allow_missing: if True, it will return a None if the value cannot be found.
  
      Returns:
          nd.array of concatenated array.
  
      """
  
      np_list: list[np.ndarray | None] = []
      for data in data_list:
          parser = ConfigParser(data)
          for i, key in enumerate(fixed_keys):
              fixed_keys[i] = str(key)
  
          val: Any
          val = parser.get(ID_SEP_KEY.join(fixed_keys))  # type: ignore
  
          if val is None:
              if allow_missing:
                  np_list.append(None)
              else:
                  raise AttributeError(
                      f"{fixed_keys} is not nested in the dictionary"
                  )
          elif isinstance(val, list):
              np_list.append(np.array(val))
          elif isinstance(val, (torch.Tensor, MetaTensor)):
              np_list.append(val.cpu().numpy())
          elif isinstance(val, np.ndarray):
              np_list.append(val)
          elif isinstance(val, Number):
              np_list.append(np.array(val))
          else:
              raise NotImplementedError(
                  f"{val.__class__} concat is not supported."
              )
  
      if allow_missing:
          np_list = [x for x in np_list if x is not None]
  
      if len(np_list) == 0:
          return np.array([0])
      elif ragged:
          return np.concatenate(np_list, **kwargs)  # type: ignore
      else:
          return np.concatenate([np_list], **kwargs)
  
imports: from __future__ import annotations
  import logging
  import os
  import pickle
  import subprocess
  import sys
  from copy import deepcopy
  from numbers import Number
  from typing import Any, cast
  import numpy
  import torch
  from monai.auto3dseg import Algo
  from monai.bundle.config_parser import ConfigParser
  from monai.bundle.utils import ID_SEP_KEY
  from monai.config import PathLike
  from monai.data.meta_tensor import MetaTensor
  from monai.transforms import CropForeground, ToCupy
  from monai.utils import min_version, optional_import, run_cmd
label_desc: Use image node_id 4 for calling a global function with example usage: concat_val_to_np(data_list, fixed_keys, ragged, allow_missing) and returns: np, np, np