code: def apply(self, images, random_state, parents, hooks, func):
      input_was_array = ia.is_np_array(images)
      rss = random_state.duplicate(3)
  
      # normalize images
      # (H, W, 1)      will be used directly in AllChannelsCLAHE
      # (H, W, 3)      will be converted to target colorspace in the next
      #                block
      # (H, W, 4)      will be reduced to (H, W, 3) (remove 4th channel) and
      #                converted to target colorspace in next block
      # (H, W, <else>) will raise a warning and be treated channelwise by
      #                AllChannelsCLAHE
      images_normalized = []
      images_change_cs = []
      images_change_cs_indices = []
      for i, image in enumerate(images):
          nb_channels = image.shape[2]
          if nb_channels == 1:
              images_normalized.append(image)
          elif nb_channels == 3:
              images_normalized.append(None)
              images_change_cs.append(image)
              images_change_cs_indices.append(i)
          elif nb_channels == 4:
              # assume that 4th channel is an alpha channel, e.g. in RGBA
              images_normalized.append(None)
              images_change_cs.append(image[..., 0:3])
              images_change_cs_indices.append(i)
          else:
              ia.warn(
                  "Got image with %d channels in "
                  "_IntensityChannelBasedApplier (parents: %s), "
                  "expected 0, 1, 3 or 4 channels."
                  % (
                      nb_channels,
                      ", ".join(parent.name for parent in parents),
                  )
              )
              images_normalized.append(image)
  
      # convert colorspaces of normalized 3-channel images
      images_after_color_conversion = [None] * len(images_normalized)
      if len(images_change_cs) > 0:
          images_new_cs = color_lib.change_colorspaces_(
              images_change_cs,
              to_colorspaces=self.to_colorspace,
              from_colorspaces=self.from_colorspace,
          )
  
          for image_new_cs, target_idx in zip(
              images_new_cs, images_change_cs_indices
          ):
              chan_idx = self._CHANNEL_MAPPING[self.to_colorspace]
              images_normalized[target_idx] = image_new_cs[
                  ..., chan_idx : chan_idx + 1
              ]
              images_after_color_conversion[target_idx] = image_new_cs
  
      # apply function channelwise
      images_aug = func(images_normalized, rss[1])
  
      # denormalize
      result = []
      images_change_cs = []
      images_change_cs_indices = []
      gen = enumerate(
          zip(images, images_after_color_conversion, images_aug)
      )
      for i, (image, image_conv, image_aug) in gen:
          nb_channels = image.shape[2]
          if nb_channels in [3, 4]:
              chan_idx = self._CHANNEL_MAPPING[self.to_colorspace]
              image_tmp = image_conv
              image_tmp[..., chan_idx : chan_idx + 1] = image_aug
  
              result.append(
                  None if nb_channels == 3 else image[..., 3:4]
              )
              images_change_cs.append(image_tmp)
              images_change_cs_indices.append(i)
          else:
              result.append(image_aug)
  
      # invert colorspace conversion
      if len(images_change_cs) > 0:
          images_new_cs = color_lib.change_colorspaces_(
              images_change_cs,
              to_colorspaces=self.from_colorspace,
              from_colorspaces=self.to_colorspace,
          )
          for image_new_cs, target_idx in zip(
              images_new_cs, images_change_cs_indices
          ):
              if result[target_idx] is None:
                  result[target_idx] = image_new_cs
              else:
                  # input image had four channels, 4th channel is already
                  # in result
                  result[target_idx] = np.dstack(
                      (image_new_cs, result[target_idx])
                  )
  
      # convert to array if necessary
      if input_was_array:
          result = np.array(result, dtype=result[0].dtype)
  
      return result
  
imports: from __future__ import print_function, division, absolute_import
  import numpy
  import six.moves
  import skimage.exposure
  import cv2
  import imgaug
  from imgaug.imgaug import _normalize_cv2_input_arr_
  from .None import meta
  from .None import color
  from ..None import parameters
  from ..None import dtypes
  from ..augmentables.batches import _BatchInAugmentation
label_desc: Use image node_id 2 for calling the _IntensityChannelBasedApplier obj's underlying member method code with example usage: obj.apply(images, random_state, parents, hooks, func) and returns: result