class_docstr: Dictionary-based wrapper of :py:class:`monai.transforms.LoadImage`,
  It can load both image data and metadata. When loading a list of files in one key,
  the arrays will be stacked and a new dimension will be added as the first dimension
  In this case, the metadata of the first image will be used to represent the stacked result.
  The affine transform of all the stacked images should be same.
  The output metadata field will be created as ``meta_keys`` or ``key_{meta_key_postfix}``.
  
  If reader is not specified, this class automatically chooses readers
  based on the supported suffixes and in the following order:
  
      - User-specified reader at runtime when calling this loader.
      - User-specified reader in the constructor of `LoadImage`.
      - Readers from the last to the first in the registered list.
      - Current default readers: (nii, nii.gz -> NibabelReader), (png, jpg, bmp -> PILReader),
        (npz, npy -> NumpyReader), (dcm, DICOM series and others -> ITKReader).
  
  Please note that for png, jpg, bmp, and other 2D formats, readers by default swap axis 0 and 1 after
  loading the array with ``reverse_indexing`` set to ``True`` because the spatial axes definition
  for non-medical specific file formats is different from other common medical packages.
  
  Note:
  
      - If `reader` is specified, the loader will attempt to use the specified readers and the default supported
        readers. This might introduce overheads when handling the exceptions of trying the incompatible loaders.
        In this case, it is therefore recommended setting the most appropriate reader as
        the last item of the `reader` parameter.
  
  See also:
  
      - tutorial: https://github.com/Project-MONAI/tutorials/blob/master/modules/load_medical_images.ipynb
class_docstr_tok: ["Dictionary-based","wrapper","of",":","py",":","class",":","`","monai.transforms.LoadImage","`",",","It","can","load","both","image","data","and","metadata",".","When","loading","a","list","of","files","in","one","key",",","the","arrays","will","be","stacked","and","a","new","dimension","will","be","added","as","the","first","dimension","In","this","case",",","the","metadata","of","the","first","image","will","be","used","to","represent","the","stacked","result",".","The","affine","transform","of","all","the","stacked","images","should","be","same",".","The","output","metadata","field","will","be","created","as","``","meta_keys","``","or","``","key_","{","meta_key_postfix","}","``",".","If","reader","is","not","specified",",","this","class","automatically","chooses","readers","based","on","the","supported","suffixes","and","in","the","following","order",":","-","User-specified","reader","at","runtime","when","calling","this","loader",".","-","User-specified","reader","in","the","constructor","of","`","LoadImage","`",".","-","Readers","from","the","last","to","the","first","in","the","registered","list",".","-","Current","default","readers",":","(","nii",",","nii.gz","-",">","NibabelReader",")",",","(","png",",","jpg",",","bmp","-",">","PILReader",")",",","(","npz",",","npy","-",">","NumpyReader",")",",","(","dcm",",","DICOM","series","and","others","-",">","ITKReader",")",".","Please","note","that","for","png",",","jpg",",","bmp",",","and","other","2D","formats",",","readers","by","default","swap","axis","0","and","1","after","loading","the","array","with","``","reverse_indexing","``","set","to","``","True","``","because","the","spatial","axes","definition","for","non-medical","specific","file","formats","is","different","from","other","common","medical","packages",".","Note",":","-","If","`","reader","`","is","specified",",","the","loader","will","attempt","to","use","the","specified","readers","and","the","default","supported","readers",".","This","might","introduce","overheads","when","handling","the","exceptions","of","trying","the","incompatible","loaders",".","In","this","case",",","it","is","therefore","recommended","setting","the","most","appropriate","reader","as","the","last","item","of","the","`","reader","`","parameter",".","See","also",":","-","tutorial",":","https",":","\/\/github.com\/Project-MONAI\/tutorials\/blob\/master\/modules\/load_medical_images.ipynb"]
docstr: Raises:
      KeyError: When not ``self.overwriting`` and key already exists in ``data``.
docstr_tok: ["Raises",":","KeyError",":","When","not","``","self.overwriting","``","and","key","already","exists","in","``","data","``","."]
code: def __call__(self, data, reader: ImageReader | None = None):
      """
      Raises:
          KeyError: When not ``self.overwriting`` and key already exists in ``data``.
  
      """
      d = dict(data)
      for key, meta_key, meta_key_postfix in self.key_iterator(
          d, self.meta_keys, self.meta_key_postfix
      ):
          data = self._loader(d[key], reader)
          if self._loader.image_only:
              d[key] = data
          else:
              if not isinstance(data, (tuple, list)):
                  raise ValueError(
                      f"loader must return a tuple or list (because image_only=False was used), got {type(data)}."
                  )
              d[key] = data[0]
              if not isinstance(data[1], dict):
                  raise ValueError(
                      f"metadata must be a dict, got {type(data[1])}."
                  )
              meta_key = meta_key or f"{key}_{meta_key_postfix}"
              if meta_key in d and not self.overwriting:
                  raise KeyError(
                      f"Metadata with key {meta_key} already exists and overwriting=False."
                  )
              d[meta_key] = data[1]
      return d
  
imports: from __future__ import annotations
  from pathlib import Path
  from typing import Callable
  import numpy
  import monai
  from monai.config import DtypeLike, KeysCollection
  from monai.data import image_writer
  from monai.data.image_reader import ImageReader
  from monai.transforms.io.array import LoadImage, SaveImage
  from monai.transforms.transform import MapTransform, Transform
  from monai.utils import GridSamplePadMode, ensure_tuple, ensure_tuple_rep
  from monai.utils.enums import PostFix
label_desc: Use image node_id 3 for calling the LoadImaged obj's underlying member method code with example usage: obj.__call__(data, reader) and returns: d