class_docstr: Dictionary-based wrapper of :py:class:`monai.data.PatchIter`.
  Return a patch generator for dictionary data and the coordinate, Typically used
  with :py:class:`monai.data.GridPatchDataset`.
  Suppose all the expected fields specified by `keys` have same shape.
  
  Args:
      keys: keys of the corresponding items to iterate patches.
      patch_size: size of patches to generate slices for, 0/None selects whole dimension
      start_pos: starting position in the array, default is 0 for each dimension
      mode: available modes: (Numpy) {``"constant"``, ``"edge"``, ``"linear_ramp"``, ``"maximum"``,
          ``"mean"``, ``"median"``, ``"minimum"``, ``"reflect"``, ``"symmetric"``, ``"wrap"``, ``"empty"``}
          (PyTorch) {``"constant"``, ``"reflect"``, ``"replicate"``, ``"circular"``}.
          One of the listed string values or a user supplied function.
          If None, no wrapping is performed. Defaults to ``"wrap"``.
          See also: https://numpy.org/doc/stable/reference/generated/numpy.pad.html
          https://pytorch.org/docs/stable/generated/torch.nn.functional.pad.html
          requires pytorch >= 1.10 for best compatibility.
      pad_opts: other arguments for the `np.pad` function.
          note that `np.pad` treats channel dimension as the first dimension.
class_docstr_tok: ["Dictionary-based","wrapper","of",":","py",":","class",":","`","monai.data.PatchIter","`",".","Return","a","patch","generator","for","dictionary","data","and","the","coordinate",",","Typically","used","with",":","py",":","class",":","`","monai.data.GridPatchDataset","`",".","Suppose","all","the","expected","fields","specified","by","`","keys","`","have","same","shape",".","Args",":","keys",":","keys","of","the","corresponding","items","to","iterate","patches",".","patch_size",":","size","of","patches","to","generate","slices","for",",","0\/None","selects","whole","dimension","start_pos",":","starting","position","in","the","array",",","default","is","0","for","each","dimension","mode",":","available","modes",":","(","Numpy",")","{","``","``","constant","''","``",",","``","``","edge","''","``",",","``","``","linear_ramp","''","``",",","``","``","maximum","''","``",",","``","``","mean","''","``",",","``","``","median","''","``",",","``","``","minimum","''","``",",","``","``","reflect","''","``",",","``","``","symmetric","''","``",",","``","``","wrap","''","``",",","``","``","empty","''","``","}","(","PyTorch",")","{","``","``","constant","''","``",",","``","``","reflect","''","``",",","``","``","replicate","''","``",",","``","``","circular","''","``","}",".","One","of","the","listed","string","values","or","a","user","supplied","function",".","If","None",",","no","wrapping","is","performed",".","Defaults","to","``","``","wrap","''","``",".","See","also",":","https",":","\/\/numpy.org\/doc\/stable\/reference\/generated\/numpy.pad.html","https",":","\/\/pytorch.org\/docs\/stable\/generated\/torch.nn.functional.pad.html","requires","pytorch",">","=","1.10","for","best","compatibility",".","pad_opts",":","other","arguments","for","the","`","np.pad","`","function",".","note","that","`","np.pad","`","treats","channel","dimension","as","the","first","dimension","."]
code: def __call__(
      self, data: Mapping[Hashable, NdarrayTensor]
  ) -> Generator[
      tuple[Mapping[Hashable, NdarrayTensor], np.ndarray], None, None
  ]:
      d = dict(data)
      original_spatial_shape = d[first(self.keys)].shape[1:]
  
      for patch in zip(*[self.patch_iter(d[key]) for key in self.keys]):
          coords = patch[0][1]  # use the coordinate of the first item
          ret = {k: v[0] for k, v in zip(self.keys, patch)}
          # fill in the extra keys with unmodified data
          for k in set(d.keys()).difference(set(self.keys)):
              ret[k] = deepcopy(d[k])
          # also store the `coordinate`, `spatial shape of original image`, `start position` in the dictionary
          ret[self.coords_key] = coords
          ret[self.original_spatial_shape_key] = original_spatial_shape
          ret[self.start_pos_key] = self.patch_iter.start_pos
          yield ret, coords
  
imports: from __future__ import annotations
  import sys
  import warnings
  from collections.abc import Callable, Generator, Hashable, Iterable, Iterator, Mapping, Sequence
  from copy import deepcopy
  from multiprocessing.managers import ListProxy
  from multiprocessing.pool import ThreadPool
  from typing import TYPE_CHECKING
  import numpy
  import torch
  from monai.config import KeysCollection
  from monai.config.type_definitions import NdarrayTensor
  from monai.data.iterable_dataset import IterableDataset
  from monai.data.utils import iter_patch, pickle_hashing
  from monai.transforms import Compose, RandomizableTrait, Transform, apply_transform, convert_to_contiguous
  from monai.utils import NumpyPadMode, ensure_tuple, first, min_version, optional_import
label_desc: Use image node_id 2 for calling the PatchIterd obj's underlying member method code with example usage: obj.__call__(data) without return types