src/falseColorMapping.js
function getRestoreImageMethod (image) {
  if (image.restore) {
    return image.restore;
  }

  const color = image.color;
  const rgba = image.rgba;
  const cachedLut = image.cachedLut;
  const slope = image.slope;
  const windowWidth = image.windowWidth;
  const windowCenter = image.windowCenter;
  const minPixelValue = image.minPixelValue;
  const maxPixelValue = image.maxPixelValue;

  return function () {
    image.color = color;
    image.rgba = rgba;
    image.cachedLut = cachedLut;
    image.slope = slope;
    image.windowWidth = windowWidth;
    image.windowCenter = windowCenter;
    image.minPixelValue = minPixelValue;
    image.maxPixelValue = maxPixelValue;

    if (image.origPixelData) {
      const pixelData = image.origPixelData;

      image.getPixelData = () => pixelData;
    }

    // Remove some attributes added by false color mapping
    image.origPixelData = undefined;
    image.colormapId = undefined;
    image.falseColor = undefined;
  };
}
function getRestoreImageMethod (image) {
  if (image.restore) {
    return image.restore;
  }

  const color = image.color;
  const rgba = image.rgba;
  const cachedLut = image.cachedLut;
  const slope = image.slope;
  const windowWidth = image.windowWidth;
  const windowCenter = image.windowCenter;
  const minPixelValue = image.minPixelValue;
  const maxPixelValue = image.maxPixelValue;

  return function () {
    image.color = color;
    image.rgba = rgba;
    image.cachedLut = cachedLut;
    image.slope = slope;
    image.windowWidth = windowWidth;
    image.windowCenter = windowCenter;
    image.minPixelValue = minPixelValue;
    image.maxPixelValue = maxPixelValue;

    if (image.origPixelData) {
      const pixelData = image.origPixelData;

      image.getPixelData = () => pixelData;
    }

    // Remove some attributes added by false color mapping
    image.origPixelData = undefined;
    image.colormapId = undefined;
    image.falseColor = undefined;
  };
}
function getRestoreImageMethod ( image ) { if ( image . restore ) { return image . restore ; } const color = image . color ; const rgba = image . rgba ; const cachedLut = image . cachedLut ; const slope = image . slope ; const windowWidth = image . windowWidth ; const windowCenter = image . windowCenter ; const minPixelValue = image . minPixelValue ; const maxPixelValue = image . maxPixelValue ; return function ( ) { image . color = color ; image . rgba = rgba ; image . cachedLut = cachedLut ; image . slope = slope ; image . windowWidth = windowWidth ; image . windowCenter = windowCenter ; image . minPixelValue = minPixelValue ; image . maxPixelValue = maxPixelValue ; if ( image . origPixelData ) { const pixelData = image . origPixelData ; image . getPixelData = ( ) => pixelData ; } // Remove some attributes added by false color mapping image . origPixelData = undefined ; image . colormapId = undefined ; image . falseColor = undefined ; } ; }
Retrieve a function that will allow an image object to be reset to its original form
after a false color mapping transformation

@param {Image} image A Cornerstone Image Object

@return {Function} A function for resetting an Image Object to its original form
Retrieve a function that will allow an image object to be reset to its original form after a false color mapping transformation