class_docstr: Analyzer to compute intensity histogram.
  
  Args:
      image_key: the key to find image data in the callable function input (data)
      hist_bins: list of positive integers (one for each channel) for setting the number of bins used to
          compute the histogram. Defaults to [100].
      hist_range: list of lists of two floats (one for each channel) setting the intensity range to
          compute the histogram. Defaults to [-500, 500].
  
  Examples:
  
  .. code-block:: python
  
      import numpy as np
      from monai.auto3dseg.analyzer import ImageHistogram
  
      input = {}
      input['image'] = np.random.rand(1,30,30,30)
      input['label'] = np.ones([30,30,30])
      analyzer = ImageHistogram(image_key='image')
      print(analyzer(input))
class_docstr_tok: ["Analyzer","to","compute","intensity","histogram",".","Args",":","image_key",":","the","key","to","find","image","data","in","the","callable","function","input","(","data",")","hist_bins",":","list","of","positive","integers","(","one","for","each","channel",")","for","setting","the","number","of","bins","used","to","compute","the","histogram",".","Defaults","to","[","100","]",".","hist_range",":","list","of","lists","of","two","floats","(","one","for","each","channel",")","setting","the","intensity","range","to","compute","the","histogram",".","Defaults","to","[","-500",",","500","]",".","Examples",":","..","code-block",":",":","python","import","numpy","as","np","from","monai.auto3dseg.analyzer","import","ImageHistogram","input","=","{","}","input","[","'image","'","]","=","np.random.rand","(","1,30,30,30",")","input","[","'label","'","]","=","np.ones","(","[","30,30,30","]",")","analyzer","=","ImageHistogram","(","image_key='image","'",")","print","(","analyzer","(","input",")",")"]
code: def __init__(
      self,
      image_key: str,
      stats_name: str = DataStatsKeys.IMAGE_HISTOGRAM,
      hist_bins: list[int] | int | None = None,
      hist_range: list | None = None,
  ):
      self.image_key = image_key
  
      # set defaults
      self.hist_bins: list[int] = (
          [100]
          if hist_bins is None
          else hist_bins
          if isinstance(hist_bins, list)
          else [hist_bins]
      )
      self.hist_range: list = (
          [-500, 500] if hist_range is None else hist_range
      )
  
      report_format = {"counts": None, "bin_edges": None}
  
      super().__init__(stats_name, report_format)
      self.update_ops(ImageStatsKeys.HISTOGRAM, SampleOperations())
  
      # check histogram configurations for each channel in list
      if not all(isinstance(hr, list) for hr in self.hist_range):
          self.hist_range = [self.hist_range]
      if len(self.hist_bins) != len(self.hist_range):
          raise ValueError(
              f"Number of histogram bins ({len(self.hist_bins)}) and "
              f"histogram ranges ({len(self.hist_range)}) need to be the same!"
          )
      for i, hist_params in enumerate(
          zip(self.hist_bins, self.hist_range)
      ):
          _hist_bins, _hist_range = hist_params
          if not isinstance(_hist_bins, int) or _hist_bins < 0:
              raise ValueError(
                  f"Expected {i+1}. hist_bins value to be positive integer but got {_hist_bins}"
              )
          if not isinstance(_hist_range, list) or len(_hist_range) != 2:
              raise ValueError(
                  f"Expected {i+1}. hist_range values to be list of length 2 but received {_hist_range}"
              )
  
imports: from __future__ import annotations
  import time
  from abc import ABC, abstractmethod
  from collections.abc import Hashable, Mapping
  from copy import deepcopy
  from typing import Any
  import numpy
  import torch
  from monai.apps.utils import get_logger
  from monai.auto3dseg.operations import Operations, SampleOperations, SummaryOperations
  from monai.auto3dseg.utils import concat_multikeys_to_dict, concat_val_to_np, get_foreground_image, get_foreground_label, get_label_ccp, verify_report_format
  from monai.bundle.config_parser import ConfigParser
  from monai.bundle.utils import ID_SEP_KEY
  from monai.data import MetaTensor, affine_to_spacing
  from monai.transforms.transform import MapTransform
  from monai.transforms.utils_pytorch_numpy_unification import sum, unique
  from monai.utils import convert_to_numpy
  from monai.utils.enums import DataStatsKeys, ImageStatsKeys, LabelStatsKeys
  from monai.utils.misc import ImageMetaKey, label_union
label_desc: Use image node_id 1 to create a new ImageHistogram object from inherited base classes: Analyzer with example: obj = ImageHistogram(image_key, stats_name, hist_bins, hist_range)