class_docstr: Creates ShapelyAnnotation (as shapely MultiPolygon).
  Can convert this instance annotation to various formats.
docstr: Accepts shapely polygon object and returns the intersection in ShapelyAnnotation format
docstr_tok: ["Accepts","shapely","polygon","object","and","returns","the","intersection","in","ShapelyAnnotation","format"]
code: def get_intersection(self, polygon: Polygon):
      """
      Accepts shapely polygon object and returns the intersection in ShapelyAnnotation format
      """
      # convert intersection polygon to list of tuples
      intersection = self.multipolygon.intersection(polygon)
      # if polygon is box then set slice_box property
      if (
          len(polygon.exterior.xy[0]) == 5
          and polygon.exterior.xy[0][0] == polygon.exterior.xy[0][1]
          and polygon.exterior.xy[0][2] == polygon.exterior.xy[0][3]
      ):
          coco_bbox, voc_bbox = get_bbox_from_shapely(polygon)
          slice_bbox = coco_bbox
      else:
          slice_bbox = None
      # convert intersection to multipolygon
      if intersection.geom_type == "Polygon":
          intersection_multipolygon = MultiPolygon([intersection])
      elif intersection.geom_type == "MultiPolygon":
          intersection_multipolygon = intersection
      else:
          intersection_multipolygon = MultiPolygon([])
      # create shapely annotation from intersection multipolygon
      intersection_shapely_annotation = ShapelyAnnotation(
          intersection_multipolygon, slice_bbox
      )
  
      return intersection_shapely_annotation
  
imports: from typing import List
  from shapely.geometry import CAP_STYLE, JOIN_STYLE, MultiPolygon, Polygon, box
label_desc: Use image node_id 17 for calling the ShapelyAnnotation obj's underlying member method code with example usage: obj.get_intersection(polygon) and returns: intersection_shapely_annotation