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 aggregate(cls, dataset, kdims, function, **kwargs):
      kdims = [dimension_name(kd) for kd in kdims]
      axes = tuple(
          dataset.ndims - dataset.get_dimension_index(kdim) - 1
          for kdim in dataset.kdims
          if kdim not in kdims
      )
  
      data = np.atleast_1d(function(dataset.data, axis=axes, **kwargs))
      if not kdims:
          if len(dataset.vdims) == 1:
              return (data if np.isscalar(data) else data[0], [])
          else:
              return (
                  {
                      vd.name: np.array([v])
                      for vd, v in zip(dataset.vdims, data)
                  },
                  [],
              )
      elif len(axes) == 1:
          return (
              {
                  kdims[0]: cls.values(
                      dataset, axes[0], expanded=False
                  ),
                  dataset.vdims[0].name: data[::-1]
                  if axes[0]
                  else data,
              },
              [],
          )
  
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 17 for calling the ImageInterface obj's underlying member method code with example usage: obj.aggregate(cls, dataset, kdims, function) and returns: unknown,  list, unknown,  list, dict,  list