class_docstr: Base for image providers: handle pathname and filename & URLs
class_docstr_tok: ["Base","for","image","providers",":","handle","pathname","and","filename","&","URLs"]
docstr: Compute the MD5 hash of the underlying file or use cached value
  
  measurements - backup for case where MD5 is calculated on image data
                 directly retrieved from URL
docstr_tok: ["Compute","the","MD5","hash","of","the","underlying","file","or","use","cached","value","measurements","-","backup","for","case","where","MD5","is","calculated","on","image","data","directly","retrieved","from","URL"]
code: def get_md5_hash(self, measurements):
      """Compute the MD5 hash of the underlying file or use cached value
  
      measurements - backup for case where MD5 is calculated on image data
                     directly retrieved from URL
      """
      #
      # Cache the MD5 hash on the image reader
      #
      if is_matlab_file(self.__filename) or is_numpy_file(
          self.__filename
      ):
          rdr = None
      else:
          rdr = self.get_reader()
  
      if rdr is None or not hasattr(rdr, "md5_hash"):
          hasher = hashlib.md5()
          path = self.get_full_name()
          if not os.path.isfile(path):
              # No file here - hash the image
              image = self.provide_image(measurements)
              hasher.update(image.pixel_data.tostring())
          else:
              with open(self.get_full_name(), "rb") as fd:
                  while True:
                      buf = fd.read(65536)
                      if len(buf) == 0:
                          break
                      hasher.update(buf)
          if rdr is None:
              return hasher.hexdigest()
          rdr.md5_hash = hasher.hexdigest()
      return rdr.md5_hash
  
imports: import atexit
  import hashlib
  import logging
  import os
  import tempfile
  import urllib.parse
  import urllib.request
  import weakref
  import numpy
  import cellprofiler_core.preferences
  from .._abstract_image import AbstractImage
  from ..._image import Image
  from ....reader import get_image_reader, get_image_reader_class
  from ....utilities.image import is_numpy_file, download_to_temp_file
  from ....utilities.image import is_matlab_file
  from ....utilities.image import loadmat
  from ....utilities.image import load_data_file
  from ....utilities.image import generate_presigned_url
  from ....constants.image import FILE_SCHEME, PASSTHROUGH_SCHEMES
  from ....utilities.pathname import pathname2url, url2pathname
label_desc: Use image node_id 17 for calling the FileImage obj's underlying member method code with example usage: obj.get_md5_hash(measurements) and returns: rdr, hasher