class_docstr: Extractor to generate patches with or without padding.
  Turn on debug mode to see how it is done.
  
  Args:
      x         : input image, should be of shape HWC
      patch_size  : a tuple of (h, w)
      step_size : a tuple of (h, w)
  Return:
      a list of sub patches, each patch has dtype same as x
  
  Examples:
      >>> xtractor = PatchExtractor((450, 450), (120, 120))
      >>> img = np.full([1200, 1200, 3], 255, np.uint8)
      >>> patches = xtractor.extract(img, 'mirror')
docstr: Extracted patches with mirror padding the boundary such that the
  central region of each patch is always within the orginal (non-padded)
  image while all patches' central region cover the whole orginal image.
  
  Args:
      x         : input image, should be of shape HWC
      patch_size  : a tuple of (h, w)
      step_size : a tuple of (h, w)
  Return:
      a list of sub patches, each patch is same dtype as x
docstr_tok: ["Extracted","patches","with","mirror","padding","the","boundary","such","that","the","central","region","of","each","patch","is","always","within","the","orginal","(","non-padded",")","image","while","all","patches","'","central","region","cover","the","whole","orginal","image",".","Args",":","x",":","input","image",",","should","be","of","shape","HWC","patch_size",":","a","tuple","of","(","h",",","w",")","step_size",":","a","tuple","of","(","h",",","w",")","Return",":","a","list","of","sub","patches",",","each","patch","is","same","dtype","as","x"]
code: def __extract_mirror(self, x):
      """Extracted patches with mirror padding the boundary such that the
      central region of each patch is always within the orginal (non-padded)
      image while all patches' central region cover the whole orginal image.
  
      Args:
          x         : input image, should be of shape HWC
          patch_size  : a tuple of (h, w)
          step_size : a tuple of (h, w)
      Return:
          a list of sub patches, each patch is same dtype as x
  
      """
      diff_h = self.patch_size[0] - self.step_size[0]
      padt = diff_h // 2
      padb = diff_h - padt
  
      diff_w = self.patch_size[1] - self.step_size[1]
      padl = diff_w // 2
      padr = diff_w - padl
  
      pad_type = "reflect"
      x = np.lib.pad(x, ((padt, padb), (padl, padr), (0, 0)), pad_type)
      sub_patches = self.__extract_valid(x)
      return sub_patches
  
imports: import math
  import numpy
label_desc: Use image node_id 4 for calling the PatchExtractor obj's underlying member method code with example usage: obj.__extract_mirror(x) and returns: sub_patches