code: function generateNonLinearVOILUT (voiLUT) {
    // We don't trust the voiLUT.numBitsPerEntry, mainly thanks to Agfa!
    const bitsPerEntry = Math.max(...voiLUT.lut).toString(2).length;
    const shift = bitsPerEntry - 8;
    const minValue = voiLUT.lut[0] >> shift;
    const maxValue = voiLUT.lut[voiLUT.lut.length - 1] >> shift;
    const maxValueMapped = voiLUT.firstValueMapped + voiLUT.lut.length - 1;
  
    return function (modalityLutValue) {
      if (modalityLutValue < voiLUT.firstValueMapped) {
        return minValue;
      } else if (modalityLutValue >= maxValueMapped) {
        return maxValue;
      }
  
      return voiLUT.lut[modalityLutValue - voiLUT.firstValueMapped] >> shift;
    };
  }
docs: Generate a non-linear volume of interest lookup table
  
  @param {LUT} voiLUT Volume of Interest Lookup Table Object
  
  @returns {VOILUTFunction} VOI LUT mapping function
  @memberof VOILUT