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","."]
docstr: Allows selecting data by the slices, sets and scalar values
  along a particular dimension. The indices should be supplied as
  keywords mapping between the selected dimension and
  value. Additionally selection_specs (taking the form of a list
  of type.group.label strings, types or functions) may be
  supplied, which will ensure the selection is only applied if the
  specs match the selected object.
docstr_tok: ["Allows","selecting","data","by","the","slices",",","sets","and","scalar","values","along","a","particular","dimension",".","The","indices","should","be","supplied","as","keywords","mapping","between","the","selected","dimension","and","value",".","Additionally","selection_specs","(","taking","the","form","of","a","list","of","type.group.label","strings",",","types","or","functions",")","may","be","supplied",",","which","will","ensure","the","selection","is","only","applied","if","the","specs","match","the","selected","object","."]
code: def select(self, selection_specs=None, **selection):
      """
      Allows selecting data by the slices, sets and scalar values
      along a particular dimension. The indices should be supplied as
      keywords mapping between the selected dimension and
      value. Additionally selection_specs (taking the form of a list
      of type.group.label strings, types or functions) may be
      supplied, which will ensure the selection is only applied if the
      specs match the selected object.
      """
      if selection_specs and not any(
          self.matches(sp) for sp in selection_specs
      ):
          return self
  
      selection = {
          self.get_dimension(k).name: slice(*sel)
          if isinstance(sel, tuple)
          else sel
          for k, sel in selection.items()
          if k in self.kdims
      }
      coords = tuple(
          selection[kd.name] if kd.name in selection else slice(None)
          for kd in self.kdims
      )
  
      shape = self.interface.shape(self, gridded=True)
      if any([isinstance(el, slice) for el in coords]):
          bounds = compute_slice_bounds(coords, self, shape[:2])
  
          xdim, ydim = self.kdims
          l, b, r, t = bounds.lbrt()
  
          # Situate resampled region into overall slice
          y0, y1, x0, x1 = Slice(bounds, self)
          y0, y1 = shape[0] - y1, shape[0] - y0
          selection = (slice(y0, y1), slice(x0, x1))
          sliced = True
      else:
          y, x = self.sheet2matrixidx(coords[0], coords[1])
          y = shape[0] - y - 1
          selection = (y, x)
          sliced = False
  
      datatype = list(
          util.unique_iterator(
              [self.interface.datatype] + self.datatype
          )
      )
      data = self.interface.ndloc(self, selection)
      if not sliced:
          if np.isscalar(data):
              return data
          elif isinstance(data, tuple):
              data = data[self.ndims :]
          return self.clone(
              data, kdims=[], new_type=Dataset, datatype=datatype
          )
      else:
          return self.clone(
              data,
              xdensity=self.xdensity,
              datatype=datatype,
              ydensity=self.ydensity,
              bounds=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 5 for calling the Image obj's underlying member method code with example usage: obj.select(selection_specs) and returns: self, self, self, data