code: def _min_max_to_constant_mode(dtype, mode, cval):
      """Replace 'max' and 'min' with appropriate 'cval' and 'constant' mode."""
      if mode == "max":
          mode = "constant"
          if np.issubdtype(dtype, bool):
              cval = True
          elif np.issubdtype(dtype, np.integer):
              cval = np.iinfo(dtype).max
          else:
              cval = np.inf
      elif mode == "min":
          mode = "constant"
          if np.issubdtype(dtype, bool):
              cval = False
          elif np.issubdtype(dtype, np.integer):
              cval = np.iinfo(dtype).min
          else:
              cval = -np.inf
      return mode, cval
  
file_path: scikit-image/skimage/morphology/gray.py
imports: import warnings
  import numpy
  from scipy import ndimage
  from .footprints import _footprint_is_sequence, mirror_footprint, pad_footprint
  from .misc import default_footprint
  from .._shared.utils import DEPRECATED
label_desc: Use image node_id 4 for calling a global function with example usage: _min_max_to_constant_mode(dtype, mode, cval) and returns: mode,  cval