class_docstr: Interface for 2 or 3D arrays representing images
  of raw luminance values, RGB values or HSV values.
class_docstr_tok: ["Interface","for","2","or","3D","arrays","representing","images","of","raw","luminance","values",",","RGB","values","or","HSV","values","."]
code: def init(cls, eltype, data, kdims, vdims):
      if kdims is None:
          kdims = eltype.kdims
      if vdims is None:
          vdims = eltype.vdims
  
      kwargs = {}
      dimensions = [dimension_name(d) for d in kdims + vdims]
      if isinstance(data, tuple):
          data = dict(zip(dimensions, data))
      if isinstance(data, dict):
          xs, ys = np.asarray(data[kdims[0].name]), np.asarray(
              data[kdims[1].name]
          )
          xvalid = util.validate_regular_sampling(
              xs, eltype.rtol or util.config.image_rtol
          )
          yvalid = util.validate_regular_sampling(
              ys, eltype.rtol or util.config.image_rtol
          )
          if not xvalid or not yvalid:
              raise ValueError(
                  "ImageInterface only supports regularly sampled coordinates"
              )
          l, r, xdensity, invertx = util.bound_range(
              xs, None, eltype._time_unit
          )
          b, t, ydensity, inverty = util.bound_range(
              ys, None, eltype._time_unit
          )
          kwargs["bounds"] = BoundingBox(points=((l, b), (r, t)))
          if len(vdims) == 1:
              data = np.flipud(np.asarray(data[vdims[0].name]))
          else:
              data = np.dstack(
                  [np.flipud(data[vd.name]) for vd in vdims]
              )
          if invertx:
              data = data[:, ::-1]
          if inverty:
              data = data[::-1, :]
          expected = (len(ys), len(xs))
          shape = data.shape[:2]
          error = (
              DataError
              if len(shape) > 1 and not eltype._binned
              else ValueError
          )
          if shape != expected and not (not expected and shape == (1,)):
              raise error(
                  f"Key dimension values and value array {vdims[0]} "
                  f"shapes do not match. Expected shape {expected}, "
                  f"actual shape: {shape}",
                  cls,
              )
  
      if not isinstance(data, np.ndarray) or data.ndim not in [2, 3]:
          raise ValueError("ImageInterface expects a 2D array.")
      elif not issubclass(eltype, SheetCoordinateSystem):
          raise ValueError(
              "ImageInterface may only be used on elements "
              "that subclass SheetCoordinateSystem."
          )
  
      return data, {"kdims": kdims, "vdims": vdims}, kwargs
  
imports: import numpy
  from ..None import util
  from ..boundingregion import BoundingBox
  from ..dimension import dimension_name
  from ..element import Element
  from ..ndmapping import NdMapping, item_check
  from ..sheetcoords import SheetCoordinateSystem, Slice
  from .grid import GridInterface
  from .interface import DataError, Interface
  from .util import finite_range
label_desc: Use image node_id 1 for calling the ImageInterface obj's underlying member method code with example usage: obj.init(cls, eltype, data, kdims, vdims) and returns: data,  dict,  kwargs