code: def array_freqhist_bins(self, n_bins=100):
      "A numpy based function to split the range of pixel values into groups, such that each group has around the same number of pixels"
      imsd = np.sort(self.flatten())
      t = np.array([0.001])
      t = np.append(t, np.arange(n_bins) / n_bins + (1 / 2 / n_bins))
      t = np.append(t, 0.999)
      t = (len(imsd) * t + 0.5).astype(int)
      return np.unique(imsd[t])
  
imports: from __future__ import annotations
  from ..basics import *
  from ..vision.all import *
  from ..data.transforms import *
  import pydicom, kornia, skimage
  from pydicom.dataset import Dataset
  from pydicom.tag import BaseTag
  from pydicom.multival import MultiValue
  from PIL import Image
label_desc: Use image node_id 6 for calling a global function with example usage: array_freqhist_bins(n_bins) and returns: np