class_docstr: Image represents a regularly sampled 2D grid of an underlying
  continuous space of intensity values, which will be colormapped on
  plotting. The grid of intensity values may be specified as a NxM
  sized array of values along with a bounds, but it may also be
  defined through explicit and regularly spaced x/y-coordinate
  arrays of shape M and N respectively. The two most basic supported
  constructors of an Image therefore include:
  
      Image((X, Y, Z))
  
  where X is a 1D array of shape M, Y is a 1D array of shape N and
  Z is a 2D array of shape NxM, or equivalently:
  
      Image(Z, bounds=(x0, y0, x1, y1))
  
  where Z is a 2D array of shape NxM defining the intensity values
  and the bounds define the (left, bottom, top, right) edges of four
  corners of the grid. Other gridded formats which support declaring
  of explicit x/y-coordinate arrays such as xarray are also
  supported.
  
  Note that the interpretation of the orientation of the array
  changes depending on whether bounds or explicit coordinates are
  used.
class_docstr_tok: ["Image","represents","a","regularly","sampled","2D","grid","of","an","underlying","continuous","space","of","intensity","values",",","which","will","be","colormapped","on","plotting",".","The","grid","of","intensity","values","may","be","specified","as","a","NxM","sized","array","of","values","along","with","a","bounds",",","but","it","may","also","be","defined","through","explicit","and","regularly","spaced","x\/y-coordinate","arrays","of","shape","M","and","N","respectively",".","The","two","most","basic","supported","constructors","of","an","Image","therefore","include",":","Image","(","(","X",",","Y",",","Z",")",")","where","X","is","a","1D","array","of","shape","M",",","Y","is","a","1D","array","of","shape","N","and","Z","is","a","2D","array","of","shape","NxM",",","or","equivalently",":","Image","(","Z",",","bounds=","(","x0",",","y0",",","x1",",","y1",")",")","where","Z","is","a","2D","array","of","shape","NxM","defining","the","intensity","values","and","the","bounds","define","the","(","left",",","bottom",",","top",",","right",")","edges","of","four","corners","of","the","grid",".","Other","gridded","formats","which","support","declaring","of","explicit","x\/y-coordinate","arrays","such","as","xarray","are","also","supported",".","Note","that","the","interpretation","of","the","orientation","of","the","array","changes","depending","on","whether","bounds","or","explicit","coordinates","are","used","."]
code: def __init__(
      self,
      data,
      kdims=None,
      vdims=None,
      bounds=None,
      extents=None,
      xdensity=None,
      ydensity=None,
      rtol=None,
      **params,
  ):
      supplied_bounds = bounds
      if isinstance(data, Image):
          bounds = bounds or data.bounds
          xdensity = xdensity or data.xdensity
          ydensity = ydensity or data.ydensity
          if rtol is None:
              rtol = data.rtol
  
      extents = extents if extents else (None, None, None, None)
      if (
          data is None
          or (isinstance(data, (list, tuple)) and not data)
          or (isinstance(data, np.ndarray) and data.size == 0)
      ):
          data = (
              data
              if isinstance(data, np.ndarray) and data.ndim == 2
              else np.zeros((0, 0))
          )
          bounds = 0
          if not xdensity:
              xdensity = 1
          if not ydensity:
              ydensity = 1
      elif isinstance(data, np.ndarray) and data.ndim < self._ndim:
          raise ValueError(
              "%s type expects %d-D array received %d-D "
              "array." % (type(self).__name__, self._ndim, data.ndim)
          )
  
      if rtol is not None:
          params["rtol"] = rtol
      else:
          params["rtol"] = config.image_rtol
  
      Dataset.__init__(
          self,
          data,
          kdims=kdims,
          vdims=vdims,
          extents=extents,
          **params,
      )
      if not self.interface.gridded:
          raise DataError(
              "{} type expects gridded data, {} is columnar. "
              "To display columnar data as gridded use the HeatMap "
              "element or aggregate the data (e.g. using rasterize "
              "or np.histogram2d).".format(
                  type(self).__name__, self.interface.__name__
              )
          )
  
      dim2, dim1 = self.interface.shape(self, gridded=True)[:2]
      if bounds is None:
          xvals = self.dimension_values(0, False)
          l, r, xdensity, _ = util.bound_range(
              xvals, xdensity, self._time_unit
          )
          yvals = self.dimension_values(1, False)
          b, t, ydensity, _ = util.bound_range(
              yvals, ydensity, self._time_unit
          )
          bounds = BoundingBox(points=((l, b), (r, t)))
      elif np.isscalar(bounds):
          bounds = BoundingBox(radius=bounds)
      elif isinstance(bounds, (tuple, list, np.ndarray)):
          l, b, r, t = bounds
          bounds = BoundingBox(points=((l, b), (r, t)))
  
      data_bounds = None
      if self.interface is ImageInterface and not isinstance(
          data, (np.ndarray, Image)
      ):
          data_bounds = self.bounds.lbrt()
  
      non_finite = all(not util.isfinite(v) for v in bounds.lbrt())
      if non_finite:
          bounds = BoundingBox(points=((0, 0), (0, 0)))
          xdensity = (
              xdensity if xdensity and util.isfinite(xdensity) else 1
          )
          ydensity = (
              ydensity if ydensity and util.isfinite(ydensity) else 1
          )
      else:
          l, b, r, t = bounds.lbrt()
          xdensity = (
              xdensity
              if xdensity
              else util.compute_density(l, r, dim1, self._time_unit)
          )
          ydensity = (
              ydensity
              if ydensity
              else util.compute_density(b, t, dim2, self._time_unit)
          )
      SheetCoordinateSystem.__init__(self, bounds, xdensity, ydensity)
      if non_finite:
          self.bounds = BoundingBox(
              points=((np.nan, np.nan), (np.nan, np.nan))
          )
      self._validate(data_bounds, supplied_bounds)
  
imports: import colorsys
  from copy import deepcopy
  from operator import itemgetter
  import numpy
  import param
  from ..core import Dataset, Dimension, Element2D, Overlay, config, util
  from ..core.boundingregion import BoundingBox, BoundingRegion
  from ..core.data import ImageInterface
  from ..core.data.interface import DataError
  from ..core.dimension import dimension_name
  from ..core.sheetcoords import SheetCoordinateSystem, Slice
  from .chart import Curve
  from .geom import Selection2DExpr
  from .graphs import TriMesh
  from .tabular import Table
  from .util import categorical_aggregate2d, compute_slice_bounds
label_desc: Use image node_id 1 to create a new Image object from inherited base classes: Selection2DExpr, Dataset, Raster, SheetCoordinateSystem with example: obj = Image(data, kdims, vdims, bounds, extents, xdensity, ydensity, rtol)