class_docstr: Basic MONAILabel Client to invoke infer/train APIs over http/https
class_docstr_tok: ["Basic","MONAILabel","Client","to","invoke","infer\/train","APIs","over","http\/https"]
docstr: Upload New Image to MONAILabel Datastore
  
  :param image_in: Image File Path
  :param image_id: Force Image ID;  If not provided then Server it auto generate new Image ID
  :param params: Additional JSON params
  :return: json response which contains image id and other details
docstr_tok: ["Upload","New","Image","to","MONAILabel","Datastore",":","param","image_in",":","Image","File","Path",":","param","image_id",":","Force","Image","ID",";","If","not","provided","then","Server","it","auto","generate","new","Image","ID",":","param","params",":","Additional","JSON","params",":","return",":","json","response","which","contains","image","id","and","other","details"]
code: def upload_image(self, image_in, image_id=None, params=None):
      """
      Upload New Image to MONAILabel Datastore
  
      :param image_in: Image File Path
      :param image_id: Force Image ID;  If not provided then Server it auto generate new Image ID
      :param params: Additional JSON params
      :return: json response which contains image id and other details
      """
      selector = f"/datastore/?image={MONAILabelUtils.urllib_quote_plus(image_id)}"
  
      files = {"file": image_in}
      params = self._update_client_id(params)
      fields = {"params": json.dumps(params) if params else "{}"}
  
      status, response, _, _ = MONAILabelUtils.http_multipart(
          "PUT",
          self._server_url,
          selector,
          fields,
          files,
          headers=self._headers,
      )
      if status != 200:
          raise MONAILabelClientException(
              MONAILabelError.SERVER_ERROR,
              f"Status: {status}; Response: {bytes_to_str(response)}",
          )
  
      response = bytes_to_str(response)
      logging.debug(f"Response: {response}")
      return json.loads(response)
  
imports: import cgi
  import http.client
  import json
  import logging
  import mimetypes
  import os
  import re
  import ssl
  import tempfile
  from pathlib import Path
  from urllib.parse import quote_plus, unquote, urlencode, urlparse
  import requests
label_desc: Use image node_id 14 for calling the MONAILabelClient obj's underlying member method code with example usage: obj.upload_image(image_in, image_id, params) and returns: json