code: def calc_slice_and_overlap_params(
      resolution: str, height: int, width: int, orientation: str
  ) -> Tuple[int, int, int, int]:
      """
      This function calculate according to image resolution slice and overlap params.
      Args:
          resolution: str
          height: int
          width: int
          orientation: str
  
      Returns:
          x_overlap, y_overlap, slice_width, slice_height
      """
  
      if resolution == "medium":
          (
              split_row,
              split_col,
              overlap_height_ratio,
              overlap_width_ratio,
          ) = calc_ratio_and_slice(orientation, slide=1, ratio=0.8)
  
      elif resolution == "high":
          (
              split_row,
              split_col,
              overlap_height_ratio,
              overlap_width_ratio,
          ) = calc_ratio_and_slice(orientation, slide=2, ratio=0.4)
  
      elif resolution == "ultra-high":
          (
              split_row,
              split_col,
              overlap_height_ratio,
              overlap_width_ratio,
          ) = calc_ratio_and_slice(orientation, slide=4, ratio=0.4)
      else:  # low condition
          split_col = 1
          split_row = 1
          overlap_width_ratio = 1
          overlap_height_ratio = 1
  
      slice_height = height // split_col
      slice_width = width // split_row
  
      x_overlap = int(slice_width * overlap_width_ratio)
      y_overlap = int(slice_height * overlap_height_ratio)
  
      return x_overlap, y_overlap, slice_width, slice_height
  
imports: import concurrent.futures
  import logging
  import os
  import time
  from pathlib import Path
  from typing import Dict, List, Optional, Sequence, Tuple, Union
  import numpy
  from PIL import Image
  from shapely.errors import TopologicalError
  from tqdm import tqdm
  from sahi.annotation import BoundingBox, Mask
  from sahi.utils.coco import Coco, CocoAnnotation, CocoImage, create_coco_dict
  from sahi.utils.cv import IMAGE_EXTENSIONS_LOSSLESS, IMAGE_EXTENSIONS_LOSSY, read_image_as_pil
  from sahi.utils.file import load_json, save_json
label_desc: Use image node_id 9 for calling a global function with example usage: calc_slice_and_overlap_params(resolution, height, width, orientation) and returns: x_overlap,  y_overlap,  slice_width,  slice_height