UNPKG

13 kBSource Map (JSON)View Raw
1{"version":3,"sources":["webpack://[name]/webpack/universalModuleDefinition","webpack://[name]/webpack/bootstrap","webpack://[name]/./externalModules.js","webpack://[name]/./loadImage.js","webpack://[name]/./createImage.js","webpack://[name]/./arrayBufferToImage.js","webpack://[name]/./registerLoaders.js","webpack://[name]/./index.js"],"names":["root","factory","exports","module","define","amd","window","installedModules","__webpack_require__","moduleId","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","configurable","enumerable","get","r","value","n","__esModule","object","property","prototype","hasOwnProperty","p","s","_registerLoaders","cornerstone","external","cs","_registerLoaders2","default","loadImage","imageId","_externalModules","xhr","XMLHttpRequest","open","responseType","options","beforeSend","onprogress","oProgress","lengthComputable","loaded","total","percentComplete","Math","round","eventData","triggerEvent","events","promise","Promise","resolve","reject","onload","_arrayBufferToImage2","this","response","then","image","imageObject","_createImage2","send","cancelFn","abort","configure","opts","rows","naturalHeight","columns","naturalWidth","minPixelValue","maxPixelValue","slope","intercept","windowCenter","windowWidth","render","renderWebImage","getPixelData","context","lastImageIdDrawn","canvas","getContext","height","width","drawImage","getImageData","data","getCanvas","getImage","color","rgba","columnPixelSpacing","undefined","rowPixelSpacing","invert","sizeInBytes","document","createElement","arrayBuffer","Image","arrayBufferView","Uint8Array","blob","Blob","urlCreator","URL","webkitURL","imageUrl","createObjectURL","src","revokeObjectURL","onerror","error","registerImageLoader","_loadImage","cornerstoneWebImageLoader","arrayBufferToImage","createImage"],"mappings":";CAAA,SAAAA,EAAAC,GACA,iBAAAC,SAAA,iBAAAC,OACAA,OAAAD,QAAAD,IACA,mBAAAG,eAAAC,IACAD,OAAA,+BAAAH,GACA,iBAAAC,QACAA,QAAA,0BAAAD,IAEAD,EAAA,0BAAAC,IARA,CASCK,OAAA,WACD,mBCTA,IAAAC,KAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAP,QAGA,IAAAC,EAAAI,EAAAE,IACAC,EAAAD,EACA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SAASC,cAAc,UAClClB,kGCGW,SAAUmB,GACvB,OAAO,IAAIjD,QAAQ,SAACC,EAASC,GAC3B,IAAMM,EAAQ,IAAI0C,MACZC,EAAkB,IAAIC,WAAWH,GACjCI,EAAO,IAAIC,MAAMH,IACjBI,EAAa/G,OAAOgH,KAAOhH,OAAOiH,UAClCC,EAAWH,EAAWI,gBAAgBN,GAE5C7C,EAAMoD,IAAMF,EACZlD,EAAML,OAAS,WACbF,EAAQO,GACR+C,EAAWM,gBAAgBH,IAG7BlD,EAAMsD,QAAU,SAACC,GACfR,EAAWM,gBAAgBH,GAC3BxD,EAAO6D,gGCpBE,SAAUzF,GAEvBA,EAAY0F,oBAAoB,OAAhCC,EAAAtF,WACAL,EAAY0F,oBAAoB,QAAhCC,EAAAtF,YALF,IAAAsF,EAAAvH,EAAA,+JCAA,QAAAA,EAAA,QACAA,EAAA,IACAuH,EAAAvH,EAAA,GACAmC,EAAAnC,EAAA,sDAEA,IAAMwH,GACJC,6BACAC,sBACAzF,sBACAmC,sBACAvC,uBAIA4F,+BACAC,wBACAzF,wBACAmC,wBACAvC,8BAGa2F","file":"cornerstoneWebImageLoader.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"cornerstoneWebImageLoader\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"cornerstoneWebImageLoader\"] = factory();\n\telse\n\t\troot[\"cornerstoneWebImageLoader\"] = factory();\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n","import registerLoaders from './registerLoaders.js';\n\nlet cornerstone;\n\nconst external = {\n set cornerstone (cs) {\n cornerstone = cs;\n\n registerLoaders(cornerstone);\n },\n get cornerstone () {\n return cornerstone;\n }\n};\n\nexport { external };\n","import { external } from './externalModules.js';\nimport arrayBufferToImage from './arrayBufferToImage.js';\nimport createImage from './createImage.js';\n\n//\n// This is a cornerstone image loader for web images such as PNG and JPEG\n//\nlet options = {\n // callback allowing customization of the xhr (e.g. adding custom auth headers, cors, etc)\n beforeSend (/* xhr */) {}\n};\n\n\n// Loads an image given a url to an image\nexport function loadImage (imageId) {\n const cornerstone = external.cornerstone;\n\n const xhr = new XMLHttpRequest();\n\n xhr.open('GET', imageId, true);\n xhr.responseType = 'arraybuffer';\n options.beforeSend(xhr);\n\n xhr.onprogress = function (oProgress) {\n if (oProgress.lengthComputable) {\n // evt.loaded the bytes browser receive\n // evt.total the total bytes set by the header\n const loaded = oProgress.loaded;\n const total = oProgress.total;\n const percentComplete = Math.round((loaded / total) * 100);\n\n const eventData = {\n imageId,\n loaded,\n total,\n percentComplete\n };\n\n cornerstone.triggerEvent(cornerstone.events, 'cornerstoneimageloadprogress', eventData);\n }\n };\n\n const promise = new Promise((resolve, reject) => {\n xhr.onload = function () {\n const imagePromise = arrayBufferToImage(this.response);\n\n imagePromise.then((image) => {\n const imageObject = createImage(image, imageId);\n\n resolve(imageObject);\n }, reject);\n };\n\n xhr.send();\n });\n\n const cancelFn = () => {\n xhr.abort();\n };\n\n return {\n promise,\n cancelFn\n };\n}\n\nexport function configure (opts) {\n options = opts;\n}\n","import { external } from './externalModules.js';\n\nconst canvas = document.createElement('canvas');\nlet lastImageIdDrawn;\n\n/**\n * creates a cornerstone Image object for the specified Image and imageId\n *\n * @param image - An Image\n * @param imageId - the imageId for this image\n * @returns Cornerstone Image Object\n */\nexport default function (image, imageId) {\n // extract the attributes we need\n const rows = image.naturalHeight;\n const columns = image.naturalWidth;\n\n function getPixelData () {\n const imageData = getImageData();\n\n\n return imageData.data;\n }\n\n function getImageData () {\n let context;\n\n if (lastImageIdDrawn === imageId) {\n context = canvas.getContext('2d');\n } else {\n canvas.height = image.naturalHeight;\n canvas.width = image.naturalWidth;\n context = canvas.getContext('2d');\n context.drawImage(image, 0, 0);\n lastImageIdDrawn = imageId;\n }\n\n return context.getImageData(0, 0, image.naturalWidth, image.naturalHeight);\n }\n\n function getCanvas () {\n if (lastImageIdDrawn === imageId) {\n return canvas;\n }\n\n canvas.height = image.naturalHeight;\n canvas.width = image.naturalWidth;\n const context = canvas.getContext('2d');\n\n context.drawImage(image, 0, 0);\n lastImageIdDrawn = imageId;\n\n return canvas;\n }\n\n // Extract the various attributes we need\n return {\n imageId,\n minPixelValue: 0,\n maxPixelValue: 255,\n slope: 1,\n intercept: 0,\n windowCenter: 128,\n windowWidth: 255,\n render: external.cornerstone.renderWebImage,\n getPixelData,\n getCanvas,\n getImage: () => image,\n rows,\n columns,\n height: rows,\n width: columns,\n color: true,\n rgba: false,\n columnPixelSpacing: undefined,\n rowPixelSpacing: undefined,\n invert: false,\n sizeInBytes: rows * columns * 4\n };\n}\n","/**\n * Convert array buffer to image. Returns a promise that resolves to an Image object for the bytes in arrayBuffer\n *\n * @param arrayBuffer - arrayBuffer with bytes for a web image (e.g. JPEG, PNG, etc)\n * @returns {Promise} Promise that resolves to an Image object\n */\nexport default function (arrayBuffer) {\n return new Promise((resolve, reject) => {\n const image = new Image();\n const arrayBufferView = new Uint8Array(arrayBuffer);\n const blob = new Blob([arrayBufferView]);\n const urlCreator = window.URL || window.webkitURL;\n const imageUrl = urlCreator.createObjectURL(blob);\n\n image.src = imageUrl;\n image.onload = () => {\n resolve(image);\n urlCreator.revokeObjectURL(imageUrl);\n };\n\n image.onerror = (error) => {\n urlCreator.revokeObjectURL(imageUrl);\n reject(error);\n };\n });\n}\n","import { loadImage } from './loadImage.js';\n\nexport default function (cornerstone) {\n // Register the http and https prefixes so we can use standard web urls directly\n cornerstone.registerImageLoader('http', loadImage);\n cornerstone.registerImageLoader('https', loadImage);\n}\n","import arrayBufferToImage from './arrayBufferToImage.js';\nimport createImage from './createImage.js';\nimport { loadImage, configure } from './loadImage.js';\nimport { external } from './externalModules.js';\n\nconst cornerstoneWebImageLoader = {\n arrayBufferToImage,\n createImage,\n loadImage,\n configure,\n external\n};\n\nexport {\n arrayBufferToImage,\n createImage,\n loadImage,\n configure,\n external\n};\n\nexport default cornerstoneWebImageLoader;\n"],"sourceRoot":""}
\No newline at end of file