diff --git a/changelog.md b/changelog.md index e3031726a7..b15bc46bc7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## [v0.32.6](https://github.com/ivmartel/dwv/releases/tag/v0.32.6) - 17/04/2024 + +### Fixed + +- Fix npm publish [#1656](https://github.com/ivmartel/dwv/issues/1656) + ## [v0.32.5](https://github.com/ivmartel/dwv/releases/tag/v0.32.5) - 17/04/2024 ### Fixed diff --git a/dist/dwv.min.js b/dist/dwv.min.js index 1efde92aea..1d8ff38ed8 100644 --- a/dist/dwv.min.js +++ b/dist/dwv.min.js @@ -1,2 +1,2 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("konva"),require("jszip"),require("magic-wand-tool")):"function"==typeof define&&define.amd?define(["konva","jszip","konmagic-wand-tool"],t):"object"==typeof exports?exports.dwv=t(require("konva"),require("jszip"),require("magic-wand-tool")):e.dwv=t(e.Konva,e.JSZip,e.MagicWand)}(this,(function(e,t,n){return function(){"use strict";var i={626:function(e){e.exports=t},436:function(t){t.exports=e},812:function(e){e.exports=n}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e](n,n.exports,o),n.exports}o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,{a:t}),t},o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return function(){o.r(a),o.d(a,{App:function(){return Vn},AppOptions:function(){return Nn},ColourMap:function(){return S},DataElement:function(){return oe},DicomParser:function(){return Ce},DicomWriter:function(){return _n},DrawLayer:function(){return Tt},Geometry:function(){return xe},Image:function(){return Ye},Index:function(){return e},LayerGroup:function(){return Pt},Matrix33:function(){return v},Point:function(){return w},Point2D:function(){return P},Point3D:function(){return O},RescaleLut:function(){return n},RescaleSlopeAndIntercept:function(){return Oe},Size:function(){return we},Spacing:function(){return Ae},Tag:function(){return Q},TagValueExtractor:function(){return qe},ToolConfig:function(){return Bn},ToolboxController:function(){return Qt},Vector3D:function(){return D},View:function(){return Ze},ViewConfig:function(){return Mn},ViewController:function(){return et},ViewLayer:function(){return at},WindowCenterAndWidth:function(){return r},WindowLut:function(){return s},WriterRule:function(){return Hn},addTagsToDictionary:function(){return x},buildMultipart:function(){return re},createImage:function(){return We},createMaskImage:function(){return ze},createView:function(){return _e},customUI:function(){return nt},decoderScripts:function(){return zt},defaultPresets:function(){return i},getDwvVersion:function(){return ae},getElementsFromJSONTags:function(){return Jn},getOrientationName:function(){return de},getPixelDataTag:function(){return G},getReverseOrientation:function(){return ue},getTagFromKey:function(){return M},getTypedArray:function(){return De},getUID:function(){return Wn},hasDicomPrefix:function(){return se},i18n:function(){return ln},logger:function(){return g},luts:function(){return h},precisionRound:function(){return J}});class e{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create index with no values.");if(0===e.length)throw new Error("Cannot create index with empty values.");if(!e.every((function(e){return!isNaN(e)})))throw new Error("Cannot create index with non number values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return"("+this.#e.toString()+")"}getValues(){return this.#e.slice()}canCompare(e){return!!e&&this.length()===e.length()}equals(e){if(!this.canCompare(e))return!1;for(let t=0,n=this.length();t=this.length())throw new Error("Non valid dimension for toStringId.");let t="";for(let n=0;nr&&(r=i);if(0===r)throw new Error("No dimension found in point stringId");const o=new Array(r);o.fill(0);for(let e=0;ethis.#S?this.#u:e*this.#h+this.#g}equals(e){return null!==e&&this.getCenter()===e.getCenter()&&this.getWidth()===e.getWidth()}toString(){return this.getCenter()+", "+this.getWidth()}}class s{#m;#p;#n=null;#f=null;#i=!1;#D=0;constructor(e,t){this.#m=e,this.#p=t}getWindowLevel(){return this.#f}isSigned(){return this.#p}getRescaleLut(){return this.#m}isReady(){return this.#i}setWindowLevel(e){if(this.#f=e,this.#D=0,this.#f.setSignedOffset(0),this.#p){const e=this.#m.getLength();this.#D=e/2,this.#f.setSignedOffset(this.#m.getRSI().getSlope()*this.#D)}this.#i=!1}update(){if(this.#i)return;this.#m.isReady()||this.#m.initialise();const e=this.#m.getLength();this.#n||(this.#n=new Uint8ClampedArray(e));for(let t=0;t255?255:t})),green:c((function(e){const t=l/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n})),blue:c((function(e){const t=l/3;let n=0;return e>=2*t&&(n=3*(e-2*t),n>255)?255:n}))},hot_iron:{red:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,255],blue:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,255]},pet:{red:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,128,126,124,122,120,118,116,114,112,110,108,106,104,102,100,98,96,94,92,90,88,86,84,82,80,78,76,74,72,70,68,66,64,63,61,59,57,55,53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11,9,7,5,3,1,0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,255],blue:[0,1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,252,248,244,240,236,232,228,224,220,216,212,208,204,200,196,192,188,184,180,176,172,168,164,160,156,152,148,144,140,136,132,128,124,120,116,112,108,104,100,96,92,88,84,80,76,72,68,64,60,56,52,48,44,40,36,32,28,24,20,16,12,8,4,0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,170,174,178,182,186,190,194,198,202,206,210,214,218,222,226,230,234,238,242,246,250,255]},hot_metal_blue:{red:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,26,29,32,35,38,41,44,47,50,52,55,57,59,62,64,66,69,71,74,76,78,81,83,85,88,90,93,96,99,102,105,108,111,114,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,166,169,172,175,178,181,184,187,190,194,198,201,205,209,213,217,221,224,228,232,236,240,244,247,251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,9,11,13,15,17,19,21,23,24,26,28,30,32,34,36,38,40,41,43,45,47,49,51,53,55,56,58,60,62,64,66,68,70,72,73,75,77,79,81,83,85,87,88,90,92,94,96,98,100,102,104,105,107,109,111,113,115,117,119,120,122,124,126,128,130,132,134,136,137,139,141,143,145,147,149,151,152,154,156,158,160,162,164,166,168,169,171,173,175,177,179,181,183,184,186,188,190,192,194,196,198,200,201,203,205,207,209,211,213,215,216,218,220,222,224,226,228,229,231,233,235,237,239,240,242,244,246,248,250,251,253,255],blue:[0,2,4,6,8,10,12,14,16,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,77,79,81,83,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,184,186,188,190,192,194,196,198,200,197,194,191,188,185,182,179,176,174,171,168,165,162,159,156,153,150,144,138,132,126,121,115,109,103,97,91,85,79,74,68,62,56,50,47,44,41,38,35,32,29,26,24,21,18,15,12,9,6,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,6,9,12,15,18,21,24,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,76,79,82,85,88,91,94,97,100,103,106,109,112,115,118,121,124,126,129,132,135,138,141,144,147,150,153,156,159,162,165,168,171,174,176,179,182,185,188,191,194,197,200,203,206,210,213,216,219,223,226,229,232,236,239,242,245,249,252,255]},pet_20step:{red:[0,0,0,0,0,0,0,0,0,0,0,0,0,96,96,96,96,96,96,96,96,96,96,96,96,96,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,64,64,64,64,64,64,64,64,64,64,64,64,224,224,224,224,224,224,224,224,224,224,224,224,224,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,192,192,192,192,192,192,192,192,192,192,192,192,192,176,176,176,176,176,176,176,176,176,176,176,176,176,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255],green:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,96,96,96,96,96,96,96,96,96,96,96,96,96,144,144,144,144,144,144,144,144,144,144,144,144,144,192,192,192,192,192,192,192,192,192,192,192,192,192,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,208,208,208,208,208,208,208,208,208,208,208,208,208,176,176,176,176,176,176,176,176,176,176,176,176,176,144,144,144,144,144,144,144,144,144,144,144,144,96,96,96,96,96,96,96,96,96,96,96,96,96,48,48,48,48,48,48,48,48,48,48,48,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255],blue:[0,0,0,0,0,0,0,0,0,0,0,0,0,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,80,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,128,176,176,176,176,176,176,176,176,176,176,176,176,176,192,192,192,192,192,192,192,192,192,192,192,192,192,224,224,224,224,224,224,224,224,224,224,224,224,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,80,80,80,80,80,80,80,80,80,80,80,80,80,64,64,64,64,64,64,64,64,64,64,64,64,80,80,80,80,80,80,80,80,80,80,80,80,80,96,96,96,96,96,96,96,96,96,96,96,96,96,64,64,64,64,64,64,64,64,64,64,64,64,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255]}},g={levels:{TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},level:3,trace:function(e){this.level<=this.levels.TRACE&&console.trace(e)},debug:function(e){this.level<=this.levels.DEBUG&&console.debug(e)},info:function(e){this.level<=this.levels.INFO&&console.info(e)},warn:function(e){this.level<=this.levels.WARN&&console.warn(e)},error:function(e){this.level<=this.levels.ERROR&&console.error(e)}};function m(e){return function(e){return n=e,.001172549*(t={r:parseInt(n.substring(1,3),16),g:parseInt(n.substring(3,5),16),b:parseInt(n.substring(5,7),16)}).r+.002301961*t.g+447059e-9*t.b<.5;var t,n}(e)?"#fff":"#000"}const p={x:95.0489,y:100,z:108.884};function f(e){const t={Yellow:"#ffff00",Red:"#ff0000",White:"#ffffff",Green:"#008000",Blue:"#0000ff",Lime:"#00ff00",Fuchsia:"#ff00ff",Black:"#000000"};let n="#ffff00";return void 0!==t[e]&&(n=t[e]),n}class D{#y;#C;#v;constructor(e,t,n){this.#y=e,this.#C=t,this.#v=n}getX(){return this.#y}getY(){return this.#C}getZ(){return this.#v}equals(e){return null!==e&&this.getX()===e.getX()&&this.getY()===e.getY()&&this.getZ()===e.getZ()}toString(){return"("+this.getX()+", "+this.getY()+", "+this.getZ()+")"}norm(){return Math.sqrt(this.getX()*this.getX()+this.getY()*this.getY()+this.getZ()*this.getZ())}crossProduct(e){return new D(this.getY()*e.getZ()-e.getY()*this.getZ(),this.getZ()*e.getX()-e.getZ()*this.getX(),this.getX()*e.getY()-e.getX()*this.getY())}dotProduct(e){return this.getX()*e.getX()+this.getY()*e.getY()+this.getZ()*e.getZ()}}const y=1e4*Number.EPSILON;function C(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)0?1:-1;for(let t=0;t<3;++t)t===n.index?e.push(1*i):e.push(0)}return new v(e)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}}function T(){return new v([1,0,0,0,1,0,0,0,1])}function I(){return new v([1,0,0,0,0,1,0,-1,0])}function L(e){let t=null;return"axial"===e?t=T():"coronal"===e?t=I():"sagittal"===e&&(t=new v([0,0,-1,1,0,0,0,-1,0])),t}class P{#y;#C;constructor(e,t){this.#y=e,this.#C=t}getX(){return this.#y}getY(){return this.#C}equals(e){return null!==e&&this.getX()===e.getX()&&this.getY()===e.getY()}toString(){return"("+this.getX()+", "+this.getY()+")"}getDistance(e){return Math.sqrt((this.getX()-e.getX())*(this.getX()-e.getX())+(this.getY()-e.getY())*(this.getY()-e.getY()))}getRound(){return new P(Math.round(this.getX()),Math.round(this.getY()))}}class O{#y;#C;#v;constructor(e,t,n){this.#y=e,this.#C=t,this.#v=n}getX(){return this.#y}getY(){return this.#C}getZ(){return this.#v}equals(e){return null!==e&&this.getX()===e.getX()&&this.getY()===e.getY()&&this.getZ()===e.getZ()}isSimilar(e,t){return null!==e&&C(this.getX(),e.getX(),t)&&C(this.getY(),e.getY(),t)&&C(this.getZ(),e.getZ(),t)}toString(){return"("+this.getX()+", "+this.getY()+", "+this.getZ()+")"}getDistance(e){return Math.sqrt((this.getX()-e.getX())*(this.getX()-e.getX())+(this.getY()-e.getY())*(this.getY()-e.getY())+(this.getZ()-e.getZ())*(this.getZ()-e.getZ()))}minus(e){return new D(this.getX()-e.getX(),this.getY()-e.getY(),this.getZ()-e.getZ())}}class w{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create point with no values.");if(0===e.length)throw new Error("Cannot create point with empty values.");if(!e.every((function(e){return!isNaN(e)})))throw new Error("Cannot create point with non number values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return"("+this.#e.toString()+")"}getValues(){return this.#e.slice()}canCompare(e){return!!e&&this.length()===e.length()}equals(e){if(!this.canCompare(e))return!1;for(let t=0,n=this.length();to;t--,o++)r=n[o],n[o]=n[t],n[t]=r}class z{#P;#O=!0;#w=function(){return new Int8Array(new Int16Array([1]).buffer)[0]>0}();#A;#x;constructor(e,t){this.#P=e,void 0!==t&&(this.#O=t),this.#A=this.#O!==this.#w,this.#x=new DataView(e)}readUint16(e){return this.#x.getUint16(e,this.#O)}readInt16(e){return this.#x.getInt16(e,this.#O)}readUint32(e){return this.#x.getUint32(e,this.#O)}readBigUint64(e){return this.#x.getBigUint64(e,this.#O)}readInt32(e){return this.#x.getInt32(e,this.#O)}readBigInt64(e){return this.#x.getBigInt64(e,this.#O)}readFloat32(e){return this.#x.getFloat32(e,this.#O)}readFloat64(e){return this.#x.getFloat64(e,this.#O)}readBinaryArray(e,t){const n=new Uint8Array(this.#P,e,t),i=8*n.length,r=new Uint8Array(i);let o=0,a=0;for(let e=0;e0?0|n:0;return e.substring(i,i+t.length)===t}function X(e,t){return null!=e&&null!=t&&e.substring(e.length-t.length)===t}function j(e){const t=[];if(null==e)return t;const n=/{(\w+)}/g;let i=n.exec(e);for(;i;)t.push(i[1]),i=n.exec(e);return t}function _(e,t){let n="";if(null==e)return n;if(n=e,null==t)return n;const i=j(e);for(let e=0;e=e.length)&&(n=0),(void 0===i||i<=n||i>e.length)&&(i=e.length);for(let r=n;r2^"+e+").")}}return i}function ye(e,t){return t?8:R(e)?12:8}class Ce{#b={};#F;#R=new ce;#E=this.#R;#q(e){return this.#R.decode(e)}#U(e){return this.#E.decode(e)}getDefaultCharacterSet(){return this.#F}setDefaultCharacterSet(e){this.#F=e}setDecoderCharacterSet(e){this.#E=new TextDecoder(e)}getDicomElements(){return this.#b}#Q(e,t){const n=e.readHex(t);t+=Uint16Array.BYTES_PER_ELEMENT;const i=e.readHex(t);return t+=Uint16Array.BYTES_PER_ELEMENT,{tag:new Q(n,i),endOffset:t}}#M(e,t,n){const i={};let r=this.#B(e,t,n);if(t=r.endOffset,V(r.tag))return{data:i,endOffset:r.endOffset,isSeqDelim:!0};if(i[r.tag.getKey()]={tag:r.tag,vr:"NONE",vl:r.vl,undefinedLength:r.undefinedLength},r.undefinedLength){let o=!1;for(;!o;)r=this.#B(e,t,n),t=r.endOffset,o="FFFEE00D"===r.tag.getKey(),o||(i[r.tag.getKey()]=r)}else{const o=t;for(t-=r.vl;t8&&"OB"===a&&g.warn("Reading DICOM pixel data with bitsAllocated>8 and OB VR."),l=[],1===i)l.push(t.readBinaryArray(s,o));else if(8===i)0===n?l.push(t.readUint8Array(s,o)):l.push(t.readInt8Array(s,o));else{if(16!==i)throw new Error("Unsupported bits allocated: "+i);0===n?l.push(t.readUint16Array(s,o)):l.push(t.readInt16Array(s,o))}else if(void 0!==c)if("Uint8"===c)l=t.readUint8Array(s,o);else if("Uint16"===c)l=t.readUint16Array(s,o),"O"!==a[0]&&(l=Array.from(l));else if("Uint32"===c)l=t.readUint32Array(s,o),"O"!==a[0]&&(l=Array.from(l));else if("Uint64"===c)l=t.readUint64Array(s,o);else if("Int16"===c)l=Array.from(t.readInt16Array(s,o));else if("Int32"===c)l=Array.from(t.readInt32Array(s,o));else if("Int64"===c)l=t.readInt64Array(s,o);else if("Float32"===c)l=Array.from(t.readFloat32Array(s,o));else if("Float64"===c)l=Array.from(t.readFloat64Array(s,o));else{if("string"!==c)throw Error("Unknown VR type: "+c);{const e=t.readUint8Array(s,o);l=q(a)?this.#U(e):this.#q(e),l=function(e){let t=e;const n=e.length-1;return e[n]===le&&(t=e.substring(0,n)),t=t.trim(),t}(l).split("\\")}}else if("xx"===a)l=Array.from(t.readUint16Array(s,o));else if("ox"===a)l=8===i?Array.from(t.readUint8Array(s,o)):Array.from(t.readUint16Array(s,o));else if("xs"===a)l=0===n?Array.from(t.readUint16Array(s,o)):Array.from(t.readInt16Array(s,o));else if("AT"===a){const e=t.readUint16Array(s,o);l=[];for(let t=0,n=e.length;t=65&&r<=90&&o>=65&&o<=90);let s=null;if(n===t)s=a?"1.2.840.10008.1.2":"1.2.840.10008.1.2.1";else{if(a)throw new Error("Not a valid DICOM file (no magic DICM word foundand implicit VR big endian detected)");s="1.2.840.10008.1.2.2"}const l=new oe("UI");return l.tag=new Q("0002","0010"),l.value=[s+" "],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(i);this.#b[e.tag.getKey()]=e,n=e.value[0],t=0}if(!function(e){return"1.2.840.10008.1.2"===e||"1.2.840.10008.1.2.1"===e||"1.2.840.10008.1.2.2"===e||ge(e)||me(e)||pe(e)||fe(e)}(n))throw new Error("Unsupported DICOM transfer syntax: '"+n+"' ("+function(e){let t="Unknown";return"1.2.840.10008.1.2"===e?t="Little Endian Implicit":"1.2.840.10008.1.2.1"===e?t="Little Endian Explicit":"1.2.840.10008.1.2.1.99"===e?t="Little Endian Deflated Explicit":"1.2.840.10008.1.2.2"===e?t="Big Endian Explicit":ge(e)?t="1.2.840.10008.1.2.4.50"===e?"JPEG Baseline":"JPEG Extended, Process 2+4":me(e)?t="1.2.840.10008.1.2.4.57"===e?"JPEG Lossless, Nonhierarchical (Processes 14)":"JPEG Lossless, Non-hierarchical, 1st Order Prediction":function(e){return null!==e.match(/1.2.840.10008.1.2.4.5/)&&!ge(e)&&!me(e)||null!==e.match(/1.2.840.10008.1.2.4.6/)}(e)?t="Retired JPEG":function(e){return null!==e.match(/1.2.840.10008.1.2.4.8/)}(e)?t="JPEG-LS":pe(e)?t="1.2.840.10008.1.2.4.91"===e?"JPEG 2000 (Lossless or Lossy)":"JPEG 2000 (Lossless only)":"1.2.840.10008.1.2.4.100"===e?t="MPEG2":fe(e)&&(t="RLE"),t}(n)+")");let s=!1;for(Se(n)&&(s=!0),he(n)&&(o=new z(e,!1));t1&&t.length>e){const n=t.length/e,r=[];let o=0;for(let i=0;i{if(void 0===this.#k[e.type])return;const t=this.#k[e.type].slice();for(let n=0;n2?e:0})));let c=o.indexToOffset(l);void 0===i&&(i=!1);let u=null;u=i?function(e){return t.getRescaledValueAtOffset(e)}:function(e){return t.getValueAtOffset(e)};const d=o.get(0),S=o.get(1),h=o.get(2);let g=o.getDimSize(2);const m=t.getNumberOfComponents(),p=1===t.getPlanarConfiguration(),f=function(e,t,n,i,r,o,a,s){return 1===m?Te(e,t,n,i,r,o,a,s):3===m?function(e,t,n,i,r,o,a,s,l){const c=[];return l?(c.push(Te(e,t,n,i,r,o,a,s)),c.push(Te(e,t+n*i,n,i,r,o,a,s)),c.push(Te(e,t+2*n*i,n,i,r,o,a,s))):(i*=3,o*=3,c.push(Te(e,t,n,i,r,o,a,s)),c.push(Te(e,t+1,n,i,r,o,a,s)),c.push(Te(e,t+2,n,i,r,o,a,s))),{next:function(){const e=c[0].next(),t=c[1].next(),n=c[2].next();return e.done?{done:!0,index:n.index}:{value:[e.value,t.value,n.value],done:!1,index:[e.index,t.index,n.index]}}}}(e,3*t,n,i,r,o,a,s,p):void 0};let D=null;if(r&&void 0!==r){const e=r.getColAbsMax(0),t=r.getColAbsMax(2),n=!1,i=!1;let o=null;if(2===t.index)o=d*S,D=0===e.index?f(u,c,o,1,d,d,n,i):f(u,c,o,d,S,1,n,i);else if(0===t.index)o=h*S,D=1===e.index?f(u,c,o,d,S,g,n,i):f(u,c,o,g,h,d,n,i);else{if(1!==t.index)throw new Error("Unknown direction: "+t.index);o=h*d,D=0===e.index?f(u,c,o,1,d,g,n,i):f(u,c,o,g,h,1,n,i)}}else if(1===t.getNumberOfComponents())D=function(e,t,n,i){void 0===i&&(i=1);let r=t;return{next:function(){if(r=e[i+1].index&&++i;const t={value:e[i].colour,done:!1,index:n};return++n,t}return{done:!0,index:t}}}}class Oe{#h;#H;constructor(e,t){this.#h=e,this.#H=t}getSlope(){return this.#h}getIntercept(){return this.#H}apply(e){return e*this.#h+this.#H}equals(e){return null!==e&&this.getSlope()===e.getSlope()&&this.getIntercept()===e.getIntercept()}toString(){return this.getSlope()+", "+this.getIntercept()}isID(){return 1===this.getSlope()&&0===this.getIntercept()}}class we{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create size with no values.");if(0===e.length)throw new Error("Cannot create size with empty values.");if(!e.every((function(e){return!isNaN(e)&&0!==e})))throw new Error("Cannot create size with non number or zero values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return"("+this.#e.toString()+")"}getValues(){return this.#e.slice()}moreThanOne(e){return this.length()>=e+1&&1!==this.get(e)}canScroll3D(e){let t=2;return void 0!==e&&(t=e.getThirdColMajorDirection()),this.moreThanOne(t)}canScroll(e){let t=this.canScroll3D(e);for(let e=3;ethis.length())return null;if(void 0===t)t=0;else if(t<0||t>e)throw new Error("Invalid start value for getDimSize");let n=1;for(let i=t;in-1)throw new Error("Wrong input dir value: "+t[e]);for(let n=0;n=0&&ithis.length()-1)throw new Error("Invalid start value for indexToOffset");let n=0;for(let i=t;i0;--e)r=this.getDimSize(e),n[e]=Math.floor(i/r),i-=n[e]*r;return n[0]=i,new e(n)}get2D(){return{x:this.get(0),y:this.get(1)}}}class Ae{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create spacing with no values.");if(0===e.length)throw new Error("Cannot create spacing with empty values.");if(!e.every((function(e){return!isNaN(e)&&0!==e})))throw new Error("Cannot create spacing with non number or zero values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return"("+this.#e.toString()+")"}getValues(){return this.#e.slice()}equals(e){if(!e)return!1;const t=this.length();if(t!==e.length())return!1;for(let n=0;n0?i+1:i}appendOrigin(e,t,n){if(void 0!==n&&this.#X[n].splice(t,0,e),void 0===n||n===this.#j){this.#Z=!0,this.#W.splice(t,0,e);const n=this.#z.getValues();n[2]+=1,this.#z=new we(n)}}appendFrame(e,t){this.#X[t]=[e];const n=this.#z.getValues(),i=this.#Y.getValues();4===n.length?n[3]+=1:(n.push(2),i.push(1)),this.#z=new we(n),this.#Y=new Ae(i)}toString(){return"Origin: "+this.getOrigin()+", Size: "+this.getSize()+", Spacing: "+this.getSpacing()+", Orientation: "+this.getOrientation()}equals(e){return null!==e&&this.getOrigin().equals(e.getOrigin())&&this.getSize().equals(e.getSize())&&this.getSpacing().equals(e.getSpacing())}isInBounds(e){return this.isIndexInBounds(this.worldToIndex(e))}isIndexInBounds(e,t){return this.getSize().isInBounds(e,t)}indexToWorld(e){const t=this.getSpacing(),n=new O(e.get(0)*t.get(0),e.get(1)*t.get(1),e.get(2)*t.get(2)),i=this.getOrientation().multiplyPoint3D(n),r=e.getValues(),o=this.getOrigin();return r[0]=o.getX()+i.getX(),r[1]=o.getY()+i.getY(),r[2]=o.getZ()+i.getZ(),new w(r)}pointToWorld(e){const t=this.getSpacing(),n=new O(e.getX()*t.get(0),e.getY()*t.get(1),e.getZ()*t.get(2)),i=this.getOrientation().multiplyPoint3D(n),r=this.getOrigin();return new O(r.getX()+i.getX(),r.getY()+i.getY(),r.getZ()+i.getZ())}worldToIndex(t){const n=this.getOrigin(),i=new O(t.get(0)-n.getX(),t.get(1)-n.getY(),t.get(2)-n.getZ()),r=this.getOrientation().getInverse().multiplyPoint3D(i),o=t.getValues(),a=this.getSpacing();return o[0]=Math.round(r.getX()/a.get(0)),o[1]=Math.round(r.getY()/a.get(1)),o[2]=Math.round(r.getZ()/a.get(2)),new e(o)}worldToPoint(e){const t=this.getOrigin(),n=new O(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),i=this.getOrientation().getInverse().multiplyPoint3D(n),r=e.getValues(),o=this.getSpacing();return r[0]=i.getX()/o.get(0),r[1]=i.getY()/o.get(1),r[2]=i.getZ()/o.get(2),new O(r[0],r[1],r[2])}}function be(e,t){return t.getInverse().multiplyArray3D(e)}function Fe(e,t){return t.multiplyArray3D(e)}function Re(e,t,n){if(void 0===n&&(n=!0),e.length<=1)return;const i=t.getInverse();let r=i.multiplyVector3D(e[0]),o=i.multiplyVector3D(e[1]),a=Math.abs(r.getZ()-o.getZ());const s=[];for(let t=0;t1e-4&&g.warn("Varying slice spacing, mean delta: "+t.toFixed(3)+" ("+s.length+" case(s))")}return a}function Ee(e){const t=e["00280010"];if(void 0===t)throw new Error("Missing DICOM image number of rows");if(0===t.value.length)throw new Error("Empty DICOM image number of rows");const n=e["00280011"];if(void 0===n)throw new Error("Missing DICOM image number of columns");if(0===n.value.length)throw new Error("Empty DICOM image number of columns");return[n.value[0],t.value[0]]}class qe{getTime(e){}}class Ue{checkElements(e){Ee(e)}create(e,t,n){const i=Ee(e),o=[i[0],i[1],1],a=e["00280008"];a&&o.push(a.value[0]);const s=new we(o),l=function(e){let t=1,n=1;const i=["00280030","00181164","00182010","00280034"];for(let r=0;r>8};r=t.value.map(e),o=n.value.map(e),a=i.value.map(e)}}else if(8===s.value[2]){g.info("Scaling 16bits color lut since the lut descriptor is 8.");let e=t.value.slice(0);r=new Uint8Array(e.buffer),e=n.value.slice(0),o=new Uint8Array(e.buffer),e=i.value.slice(0),a=new Uint8Array(e.buffer)}M.paletteLut={red:r,green:o,blue:a}}const Z=e["00082144"];return void 0!==Z&&(M.RecommendedDisplayFrameRate=parseInt(Z.value[0],10)),x.setMeta(M),x}}function Qe(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Me(e,t){const n=e[t.tag];if(1===t.type||2===t.type){if(void 0===n)throw new Error("Missing or empty "+t.name)}else if(void 0===n)return;let i,r=!1;if(i=1===n.value.length?n.value[0]:n.value,Array.isArray(i))for(let e=0;e.206896552?Math.pow(e,3):.128418549*e-.017712903,t}const n=p,i=(e.l+16)/116;return{x:n.x*t(i+e.a/500),y:n.y*t(i),z:n.z*t(i-e.b/200)}}(e))}({l:.001525902*(n={l:i[0],a:i[1],b:i[2]}).l,a:.003891051*n.a-128,b:.003891051*n.b-128});t.displayValue=r}var n;if(void 0===e["00620003"])throw Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=Ne(e["00620003"].value[0]),void 0===e["0062000F"])throw Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=Ne(e["0062000F"].value[0]),void 0!==e["00620020"]&&(t.trackingId=e["00620020"].value[0],t.trackingUid=e["00620021"].value[0]),t}function Ge(e){if(void 0===e["00280030"])return null;const t=e["00280030"],n=[parseFloat(t.value[0]),parseFloat(t.value[1])];return void 0!==e["00180050"]?n.push(parseFloat(e["00180050"].value[0])):void 0!==e["00180088"]&&n.push(parseFloat(e["00180088"].value[0])),new Ae(n)}function ke(e){const t=[];if(void 0!==e["00089124"]){const n=e["00089124"].value;for(let e=0;e1e-4;return t&&(t=e>.001,t?(t=e>.01,t||g.warn("Using larger+ real world epsilon in SEG pos pat adding")):g.warn("Using larger real world epsilon in SEG pos pat adding")),t},U=[];U.push(T[0]);let Q=0;for(let t=1;ta)throw new Error("Test distance is increasing when adding intermediate pos pats");U.push(T[t])}const M=U.length,B=new xe(x[0],r,b,w),N=[0];for(let e=1;e=this.#ae.numberOfFiles?g.warn("Ignoring frame at index "+t+" (size: "+this.#ae.numberOfFiles+")"):(this.#P.set(e,i*t),this.appendFrame(t,new O(0,0,0)))}appendFrame(e,t){this.#J.appendFrame(t,e),this.#ge({type:"appendframe"})}getDataRange(){return this.#se||(this.#se=this.calculateDataRange()),this.#se}getRescaledDataRange(){return this.#le||(this.#le=this.calculateRescaledDataRange()),this.#le}getHistogram(){if(!this.#ce){const e=this.calculateHistogram();this.#se=e.dataRange,this.#le=e.rescaledDataRange,this.#ce=e.histogram}return this.#ce}addEventListener(e,t){this.#ue.add(e,t)}removeEventListener(e,t){this.#ue.remove(e,t)}#ge=e=>{this.#ue.fireEvent(e)};setAtOffsets(e,t){let n;for(let i=0,r=e.length;i=3&&(r=i.getDimSize(3));for(let i=0;it&&(t=n),nn?t:n}}{let e=this.getRescaledValueAtOffset(0),t=e,n=0;const i=this.getGeometry().getSize();let r=i.getTotalSize();3===i.length()&&(r=i.getDimSize(3));for(let i=0;it&&(t=n),ni&&(i=r),ra&&(a=s),s{const t=this.getCurrentIndex();if(3===t.length()){const n=t.getValues();n.push(0),this.setCurrentIndex(new e(n))}}))}getImage(){return this.#me}setImage(e){this.#me=e}getOrientation(){return this.#_}setOrientation(e){this.#_=e}init(){this.setInitialIndex()}setInitialIndex(){const t=this.#me.getGeometry().getSize(),n=new Array(t.length());n.fill(0),n[0]=Math.floor(t.get(0)/2),n[1]=Math.floor(t.get(1)/2),n[2]=Math.floor(t.get(2)/2),this.setCurrentIndex(new e(n),!0)}getPlaybackMilliseconds(e){return e||(e=10),Math.round(1e3/e)}#Te=function(e,t){return 255};getAlphaFunction(){return this.#Te}setAlphaFunction(e){this.#Te=e,this.#ge({type:"alphafuncchange"})}getCurrentWindowLut(e){this.getCurrentIndex()||this.setInitialIndex();const t=this.getCurrentIndex();void 0===e&&(e=this.#me.getRescaleSlopeAndIntercept(t));let i=null;if(this.#De&&void 0!==this.#fe[this.#De]&&void 0!==this.#fe[this.#De].perslice&&!0===this.#fe[this.#De].perslice){const e=this.#me.getSecondaryOffset(t);i=this.#fe[this.#De].wl[e]}i||(this.#ye||this.setWindowLevelPresetById(0,!0),i=this.#ye);let r=this.#pe[e.toString()];if(void 0===r){const e=new n(this.#me.getRescaleSlopeAndIntercept(),this.#me.getMeta().BitsStored),t=new s(e,this.#me.getMeta().IsSigned);this.addWindowLut(t),r=t}const o=r.getWindowLevel();return i.equals(o)||(r.setWindowLevel(i),r.update(),o&&o.getWidth()===i.getWidth()&&o.getCenter()===i.getCenter()||this.#ge({type:"wlchange",value:[i.getCenter(),i.getWidth()],wc:i.getCenter(),ww:i.getWidth(),skipGenerate:!0})),r}addWindowLut(e){const t=e.getRescaleLut().getRSI();this.#pe[t.toString()]=e}getWindowPresets(){return this.#fe}getWindowPresetsNames(){return Object.keys(this.#fe)}setWindowPresets(e){this.#fe=e}setDefaultColourMap(e){this.#Ce=e}addWindowPresets(e){const t=Object.keys(e);let n=null;for(let i=0;i{this.#ue.fireEvent(e)};getWindowLevelMinMax(){const e=this.getImage().getRescaledDataRange(),t=e.min;let n=e.max-t;return n<1&&(g.warn("Zero or negative window width, defaulting to one."),n=1),new r(t+n/2,n)}setWindowLevelMinMax(){const e=this.getWindowLevelMinMax();this.setWindowLevel(e.getCenter(),e.getWidth(),"minmax")}generateImageData(e,t){void 0===t&&(this.getCurrentIndex()||this.setInitialIndex(),t=this.getCurrentIndex());const n=this.getImage(),i=Le(n,t,!1,this.getOrientation()),r=n.getPhotometricInterpretation();switch(r){case"MONOCHROME1":case"MONOCHROME2":!function(e,t,n,i,r){let o=0,a=0,s=t.next();for(;!s.done;)a=i.getValue(s.value),e.data[o]=r.red[a],e.data[o+1]=r.green[a],e.data[o+2]=r.blue[a],e.data[o+3]=n(s.value,s.index),o+=4,s=t.next()}(e,i,this.getAlphaFunction(),this.getCurrentWindowLut(),this.getColourMap());break;case"PALETTE COLOR":!function(e,t,n,i,r){const o=function(e){return e>>8};r&&g.info("Scaling 16bits data to 8bits.");let a=0,s=0,l=t.next();for(;!l.done;)s=l.value,r?(e.data[a]=o(i.red[s]),e.data[a+1]=o(i.green[s]),e.data[a+2]=o(i.blue[s])):(e.data[a]=i.red[s],e.data[a+1]=i.green[s],e.data[a+2]=i.blue[s]),e.data[a+3]=n(s,l.index),a+=4,l=t.next()}(e,i,this.getAlphaFunction(),this.getColourMap(),16===n.getMeta().BitsStored);break;case"RGB":!function(e,t,n){let i=0,r=t.next();for(;!r.done;)e.data[i]=r.value[0],e.data[i+1]=r.value[1],e.data[i+2]=r.value[2],e.data[i+3]=n(r.value,r.index),i+=4,r=t.next()}(e,i,this.getAlphaFunction());break;case"YBR_FULL":!function(e,t,n){let i=0,r=null,o=t.next();for(;!o.done;)a=o.value[0],s=o.value[1],r={r:a+1.402*((l=o.value[2])-128),g:a-.34414*(s-128)-.71414*(l-128),b:a+1.772*(s-128)},e.data[i]=r.r,e.data[i+1]=r.g,e.data[i+2]=r.b,e.data[i+3]=n(o.value,o.index),i+=4,o=t.next();var a,s,l}(e,i,this.getAlphaFunction());break;default:throw new Error("Unsupported photometric interpretation: "+r)}}incrementIndex(t,n){const i=this.getCurrentIndex(),r=new Array(i.length());r.fill(0),t