code: def random_shapes(
      input_region: List[int],
      size: Tuple[int, int],
      max_shapes: int,
      shape: str = "rectangle",
  ) -> np.ndarray:
      """Generate image with random shape.
  
      Args:
          input_region (List[int]): Coordinates of the input region. [x1, y1, x2, y2]
          size (Tuple[int, int]): Size of the input image
          max_shapes (int): Maximum number of shapes of a certain kind to draw
          shape (str): Name of the shape. Defaults to rectangle
      Returns:
          np.ndarray: Image containing the shape
      """
      shape_fn: Tuple[List[int], List[int]]
      if shape == "rectangle":
          shape_fn = rectangle
      elif shape == "triangle":
          shape_fn = triangle
      elif shape == "hexagon":
          shape_fn = hexagon
      elif shape == "star":
          shape_fn = star
      else:
          raise ValueError(f"Shape function {shape} not supported!")
  
      shape_image: np.ndarray = np.full(
          (*size, 3), fill_value=255, dtype=np.uint8
      )
      for _ in range(max_shapes):
          image = np.full((*size, 3), fill_value=255, dtype=np.uint8)
          patch_region = random_square_patch(input_region)
          xx, yy = shape_fn(patch_region)
          # assign random colour
          image[yy, xx, :] = (
              np.random.randint(0, 255),
              np.random.randint(0, 255),
              np.random.randint(0, 255),
          )
          shape_image = np.minimum(
              image, shape_image
          )  # since 255 is max
  
      return shape_image
  
file_path: anomalib/tests/helpers/shapes.py
imports: from typing import List, Tuple
  import numpy
  from skimage.draw import polygon
label_desc: Use image node_id 6 for calling a global function with example usage: random_shapes(input_region, size, max_shapes, shape) and returns: shape_image