class_docstr: A tool for image augmentation.
  
  For operations with inplace=True, the returned value is the ImageTool
  instance self, which is for chaining multiple operations; Otherwise, the
  preprocessed images would be returned.
  
  For operations that has countable pre-processing cases, argument num_case
  could be set to decide the number of pre-processing cases to apply.
  Typically, it is set to 1 for training phases and to the max for test
  phases.
class_docstr_tok: ["A","tool","for","image","augmentation",".","For","operations","with","inplace=True",",","the","returned","value","is","the","ImageTool","instance","self",",","which","is","for","chaining","multiple","operations",";","Otherwise",",","the","preprocessed","images","would","be","returned",".","For","operations","that","has","countable","pre-processing","cases",",","argument","num_case","could","be","set","to","decide","the","number","of","pre-processing","cases","to","apply",".","Typically",",","it","is","set","to","1","for","training","phases","and","to","the","max","for","test","phases","."]
docstr: Crop a max square patch of the input image at given position and
  scale it into given size.
  
  According to img size, crop position could be either
  (left, center, right) or (top, middle, bottom).
  
  Args:
      patch(tuple): the width and height the output image
      num_case: num of cases, must be in [1,3]
      inplace: inplace imgs or not ( return new_imgs)
code: def crop3(self, patch, num_case=1, inplace=True):
      """Crop a max square patch of the input image at given position and
      scale it into given size.
  
      According to img size, crop position could be either
      (left, center, right) or (top, middle, bottom).
  
      Args:
          patch(tuple): the width and height the output image
          num_case: num of cases, must be in [1,3]
          inplace: inplace imgs or not ( return new_imgs)
      """
      if not patch[0] == patch[1]:
          raise Exception("patch must be a square")
      new_imgs = []
      if num_case > 3 or num_case < 1:
          raise Exception("num_case must be in [1,3]")
      positions_horizental = ["left", "center", "right"]
      positions_vertical = ["top", "middle", "bottom"]
      for img in self.imgs:
          size = img.size
          if size[0] > size[1]:
              if num_case < 3:
                  positions = get_list_sample(
                      positions_horizental, num_case
                  )
              else:
                  positions = positions_horizental
          else:
              if num_case < 3:
                  positions = get_list_sample(
                      positions_vertical, num_case
                  )
              else:
                  positions = positions_vertical
  
          for position in positions:
              new_img = crop_and_resize(img, patch, position)
              new_imgs.append(new_img)
  
      if inplace:
          self.imgs = new_imgs
          return self
      else:
          return new_imgs
  
imports: from __future__ import division
  from builtins import range
  from builtins import object
  import random
  import numpy
  from PIL import Image, ImageEnhance
  import math
label_desc: Use image node_id 16 for calling the ImageTool obj's underlying member method code with example usage: obj.crop3(patch, num_case, inplace) and returns: self, new_imgs