code: def fetch_annotations(args, tiles=None):
      total_start_time = time.time()
  
      location = [args.analysis_roi[0], args.analysis_roi[1]]
      size = [args.analysis_roi[2], args.analysis_roi[3]]
  
      start_time = time.time()
      logging.info(
          f"Run MONAILabel Task... and collect the annotations: {location} => {size}"
      )
      logging.info(
          f"For Server Logs click/open:  {args.server.rstrip('/')}/logs/?refresh=3"
      )
  
      client = MONAILabelClient(server_url=args.server)
      image = Path(os.path.basename(args.inputImageFile)).stem
      tile_size = [
          int(args.analysis_tile_size),
          int(args.analysis_tile_size),
      ]
      min_poly_area = args.min_poly_area
      output = "dsa"
      body = {
          "level": args.analysis_level,
          "location": location,
          "size": size,
          "tile_size": tile_size,
          "min_poly_area": min_poly_area,
          "output": output,
          "girder_api_url": args.girderApiUrl,
          "girder_token": args.girderToken,
      }
      extra_params = json.loads(args.extra_params)
      body["params"] = {
          "wsi_tiles": tiles,
          **extra_params,
      }
  
      _, res = client.wsi_infer(
          model=args.model_name,
          image_in=image,
          body=body,
          output=output,
      )
      logging.info(
          f"Annotation Detection Time = {round(time.time() - start_time, 2)}"
      )
  
      res = str(res, encoding="utf-8")
      with open(args.outputAnnotationFile, "w") as fp:
          fp.write(res)
  
      # print last but one line of result (description)
      try:
          d = json.loads(
              json.loads(
                  res[-5000:]
                  .split("\n")[-2:][0]
                  .replace('"description": ', "")
              )
          )
          logging.info(f"\n{json.dumps(d, indent=2)}")
      except Exception:
          pass
  
      total_time_taken = time.time() - total_start_time
      logging.info(
          f"Total Annotation Fetch time = {round(total_time_taken, 2)}"
      )
  
file_path: MONAILabel/plugins/dsa/cli/MONAILabelAnnotation/MONAILabelAnnotation.py
imports: import json
  import logging
  import os
  import time
  from pathlib import Path
  from cli.client import MONAILabelClient
  from histomicstk.cli.utils import CLIArgumentParser
label_desc: Use image node_id 1 for calling a global function with example usage: fetch_annotations(args, tiles) without return types