dwv 0.37.0-beta.2 → 0.37.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{default as e}from"konva";import{default as t}from"magic-wand-tool";import{default as n}from"jszip";var i={m:{},d:(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u:e=>"assets/workers/"+{112:"jpegloss.worker",201:"resampling.worker",326:"rle.worker",391:"labeling.worker",557:"jpeg2000.worker",968:"jpegbaseline.worker"}[e]+".min.js",o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};(()=>{var e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),i.b=new URL("./",import.meta.url);class o{#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<n;++t)if(this.get(t)!==e.get(t))return!1;return!0}compare(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)this.get(n)!==e.get(n)&&t.push(n);return t}add(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)t.push(this.get(n)+e.get(n));return new o(t)}#t(e,t){const n=this.#e.slice();return e<n.length?n[e]+=t:console.warn("Cannot add to given dimension: ",e,n.length),new o(n)}next(e){return this.#t(e,1)}previous(e){return this.#t(e,-1)}getWithNew2D(e,t){const n=[e,t];for(let e=2,t=this.length();e<t;++e)n.push(this.get(e));return new o(n)}}class r{#n;#i;#o;#r;constructor(e,t){if(this.#n=e,this.#i=e.isID(),this.#o=Math.pow(2,t),!this.#i){this.#r=new Float32Array(this.#o);for(let e=0;e<this.#o;++e)this.#r[e]=this.#n.apply(e)}}getRSI(){return this.#n}getLength(){return this.#o}getValue(e){return this.#i?e:this.#r[e]}}class a{#a;#s;#r;#l=0;#c=!0;constructor(e,t,n){if(this.#a=e,t){const e=this.#a.getLength();this.#l=e/2}else this.#l=0;this.#c=n}getVoiLut(){return this.#s}getModalityLut(){return this.#a}setVoiLut(e){if(this.#s=e,this.#s.setSignedOffset(this.#a.getRSI().getSlope()*this.#l),this.#c){const e=this.#a.getLength();this.#r=new Uint8ClampedArray(e);for(let t=0;t<e;++t)this.#r[t]=this.#s.apply(this.#a.getValue(t))}}getValue(e){return this.#c?this.#r[e+this.#l]:Math.floor(this.#s.apply(e+this.#l))}}function s(e){const t=[];for(let n=0;n<256;++n)t.push(e(n));return t}function l(e){return e}function c(e){return 255-e}class u{red;green;blue;constructor(e,t,n){this.red=e,this.green=t,this.blue=n}}const d={plain:{red:s(l),green:s(l),blue:s(l)},invPlain:{red:s(c),green:s(c),blue:s(c)},rainbow:{blue:[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,247,239,231,223,215,207,199,191,183,175,167,159,151,143,135,127,119,111,103,95,87,79,71,63,55,47,39,31,23,15,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],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,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,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,253,251,249,247,245,243,241,239,237,235,233,231,229,227,225,223,221,219,217,215,213,211,209,207,205,203,201,199,197,195,193,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3],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,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,12,10,8,6,4,2,0,0,0,0,0,0,0,0,0,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,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]},hot:{red:s((function(e){const t=3*e;return t>255?255:t})),green:s((function(e){const t=256/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n})),blue:s((function(e){const t=256/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]}},h={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)}},g={linear:"LINEAR",linear_exact:"LINEAR_EXACT",sigmoid:"SIGMOID"};class S{#u;#d;#h=0;#g=255;#S;#p;constructor(e,t,n){void 0===n&&(n=!1);let i=e,o=t;n||(i-=.5,o-=1),this.#u=i-o/2,this.#d=i+o/2,this.#S=(this.#g-this.#h)/o,this.#p=(-i/o+.5)*(this.#g-this.#h)+this.#h}getY(e){let t;return t=e<=this.#u?this.#h:e>this.#d?this.#g:e*this.#S+this.#p,t}}class p{#h=0;#g=255;#m;#f;constructor(e,t){this.#m=e,this.#f=t}getY(e){return(this.#g-this.#h)/(1+Math.exp(-4*(e-this.#m)/this.#f))+this.#h}}class m{#v;#D=0;#y;#C=g.linear;constructor(e,t){if(this.#v=e,void 0!==t){const e=[];for(const t in g)e.push(g[t]);e.includes(t)?this.#C=t:h.debug("Unknown VOI LUT function: "+t)}this.#I()}getWindowLevel(){return this.#v}#I(){const e=this.#v.center,t=this.#v.width,n=e+this.#D;this.#C===g.linear_exact?this.#y=new S(n,t,!0):this.#C===g.sigmoid?this.#y=new p(n,t):this.#y=new S(n,t)}setSignedOffset(e){this.#D=e,this.#I()}apply(e){return this.#y.getY(e)}}class f{center;width;constructor(e,t){this.center=e,this.width=t}}function v(e,t){return null!=e&&null!=t&&e.center===t.center&&e.width===t.width}function D(e,t,n){if(void 0===e)return;let i=e.center;i=Math.min(i,t.max),i=Math.max(i,t.min);let o=1;void 0===n||n!==g.linear_exact&&n!==g.sigmoid||(o=0);let r=e.width;return r=Math.max(r,o),r=Math.min(r,t.max-t.min),new f(i,r)}class y{r;g;b;constructor(e,t,n){this.r=e,this.g=t,this.b=n}}function C(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&e.r===t.r&&e.g===t.g&&e.b===t.b}function I(e){return{r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)}}function T(e){return"#"+((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)}function L(e){return{l:655.35*e.l,a:257*e.a+32896,b:257*e.b+32896}}const w={x:95.0489,y:100,z:108.884};function P(e){return function(e){function t(e){let t;return t=e>.008856452?Math.pow(e,.333333333):7.787037037*e+.137931034,t}const n=w,i=t(e.y/n.y);return{l:116*i-16,a:500*(t(e.x/n.x)-i),b:200*(i-t(e.z/n.z))}}(function(e){function t(e){let t;return t=e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4),t}const n=t(e.r/255),i=t(e.g/255),o=t(e.b/255);return{x:100*(.4124*n+.3576*i+.1805*o),y:100*(.2126*n+.7152*i+.0722*o),z:100*(.0193*n+.1192*i+.9505*o)}}(e))}function A(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}const O={wlPresets:void 0,labelTexts:void 0,privateBValueRules:void 0,openRoiDialog:void 0,getVolumeIdTagValue:void 0,getPostLoadVolumeIdTagValue:void 0,getTagPixelUnit:void 0},b={CT:{mediastinum:new f(40,400),lung:new f(-500,1500),bone:new f(500,2e3),brain:new f(40,80),head:new f(90,350)}};class x{create(e,t){const n=new Z(t);"MONOCHROME1"===t.getPhotometricInterpretation()&&n.setColourMap("invPlain");let i={};void 0!==t.getMeta().windowPresets&&(i=t.getMeta().windowPresets),i.minmax={name:"minmax"};const o=t.getMeta().Modality;let r;r=void 0!==O.wlPresets&&void 0!==O.wlPresets[o]?O.wlPresets[o]:b[o];for(const e in r){const t=r[e];i[e]={wl:[new f(t.center,t.width)],name:e}}return n.setWindowPresets(i),n}}class R{#T;#L;#w;constructor(e,t,n){this.#T=e,this.#L=t,this.#w=n}getX(){return this.#T}getY(){return this.#L}getZ(){return this.#w}equals(e){return null!==e&&this.#T===e.getX()&&this.#L===e.getY()&&this.#w===e.getZ()}toString(){return"("+this.#T+", "+this.#L+", "+this.#w+")"}norm(){return Math.sqrt(this.#T*this.#T+this.#L*this.#L+this.#w*this.#w)}crossProduct(e){return new R(this.#L*e.getZ()-e.getY()*this.#w,this.#w*e.getX()-e.getZ()*this.#T,this.#T*e.getY()-e.getX()*this.#L)}dotProduct(e){return this.#T*e.getX()+this.#L*e.getY()+this.#w*e.getZ()}isCodirectional(e){return this.dotProduct(e)>0}}class E{#T;#L;constructor(e,t){this.#T=e,this.#L=t}getX(){return this.#T}getY(){return this.#L}getValues(){return[this.#T,this.#L]}getCentroid(){return this}equals(e){return null!=e&&this.#T===e.getX()&&this.#L===e.getY()}toString(){return"("+this.#T+", "+this.#L+")"}getDistance(e){const t=this.#T-e.getX(),n=this.#L-e.getY();return Math.sqrt(t*t+n*n)}}class F{#T;#L;#w;constructor(e,t,n){this.#T=e,this.#L=t,this.#w=n}getX(){return this.#T}getY(){return this.#L}getZ(){return this.#w}getValues(){return[this.#T,this.#L,this.#w]}equals(e){return null!==e&&this.#T===e.getX()&&this.#L===e.getY()&&this.#w===e.getZ()}isSimilar(e,t){return null!==e&&U(this.#T,e.getX(),t)&&U(this.#L,e.getY(),t)&&U(this.#w,e.getZ(),t)}toString(){return"("+this.#T+", "+this.#L+", "+this.#w+")"}getDistance(e){return Math.sqrt(this.#P(e))}#P(e){const t=this.#T-e.getX(),n=this.#L-e.getY(),i=this.#w-e.getZ();return t*t+n*n+i*i}getClosest(e){let t=0,n=this.#P(e[t]);for(let i=0;i<e.length;++i){const o=this.#P(e[i]);o<n&&(t=i,n=o)}return t}minus(e){return new R(this.#T-e.getX(),this.#L-e.getY(),this.#w-e.getZ())}}class q{#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();t<n;++t)if(this.get(t)!==e.get(t))return!1;return!0}compare(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)this.get(n)!==e.get(n)&&t.push(n);return t}get3D(){return new F(this.get(0),this.get(1),this.get(2))}add(e){if(!this.canCompare(e))return null;const t=[],n=this.getValues(),i=e.getValues();for(let e=0;e<n.length;++e)t.push(n[e]+i[e]);return new q(t)}mergeWith3D(e){const t=this.getValues();return t[0]=e.getX(),t[1]=e.getY(),t[2]=e.getZ(),new q(t)}}Number.EPSILON;const M=1e-4;function U(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)<n}class Q{#e;#A;constructor(e){this.#e=e}get(e,t){return this.#e[3*e+t]}getInverse(){return void 0===this.#A&&(this.#A=function(e){const t=e.get(0,0),n=e.get(0,1),i=e.get(0,2),o=e.get(1,0),r=e.get(1,1),a=e.get(1,2),s=e.get(2,0),l=e.get(2,1),c=e.get(2,2),u=r*c-a*l,d=a*s-o*c,g=o*l-r*s;let S=t*u+n*d+i*g;if(0!==S)return S=1/S,new Q([S*u,S*(i*l-n*c),S*(n*a-i*r),S*d,S*(t*c-i*s),S*(i*o-t*a),S*g,S*(n*s-t*l),S*(t*r-n*o)]);h.warn("Cannot invert 3*3 matrix with zero determinant.")}(this)),this.#A}equals(e){for(let t=0;t<3;++t)for(let n=0;n<3;++n)if(this.get(t,n)!==e.get(t,n))return!1;return!0}isSimilar(e,t){for(let n=0;n<3;++n)for(let i=0;i<3;++i)if(!U(this.get(n,i),e.get(n,i),t))return!1;return!0}toString(){let e="[";for(let t=0;t<3;++t){0!==t&&(e+=", \n ");for(let n=0;n<3;++n)0!==n&&(e+=", "),e+=this.get(t,n)}return e+="]",e}multiply(e){const t=[];for(let n=0;n<3;++n)for(let i=0;i<3;++i){let o=0;for(let t=0;t<3;++t)o+=this.get(n,t)*e.get(t,i);t.push(o)}return new Q(t)}getAbs(){const e=[];for(let t=0;t<3;++t)for(let n=0;n<3;++n)e.push(Math.abs(this.get(t,n)));return new Q(e)}multiplyArray3D(e){if(3!==e.length)throw new Error("Cannot multiply 3x3 matrix with non 3D array: "+e.length);const t=e[0],n=e[1],i=e[2],o=new Array(3);return o[0]=this.#e[0]*t+this.#e[1]*n+this.#e[2]*i,o[1]=this.#e[3]*t+this.#e[4]*n+this.#e[5]*i,o[2]=this.#e[6]*t+this.#e[7]*n+this.#e[8]*i,o}multiplyTypedArray3D(e,t){const n=e[0],i=e[1],o=e[2];t[0]=this.#e[0]*n+this.#e[1]*i+this.#e[2]*o,t[1]=this.#e[3]*n+this.#e[4]*i+this.#e[5]*o,t[2]=this.#e[6]*n+this.#e[7]*i+this.#e[8]*o}multiplyVector3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new R(t[0],t[1],t[2])}multiplyPoint3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new F(t[0],t[1],t[2])}multiplyIndex3D(e){const t=this.multiplyArray3D(e.getValues());return new o(t)}getRowAbsMax(e){const t=[Math.abs(this.get(e,0)),Math.abs(this.get(e,1)),Math.abs(this.get(e,2))],n=Math.max.apply(null,t),i=t.indexOf(n);return{value:this.get(e,i),index:i}}getColAbsMax(e){const t=[Math.abs(this.get(0,e)),Math.abs(this.get(1,e)),Math.abs(this.get(2,e))],n=Math.max.apply(null,t),i=t.indexOf(n);return{value:this.get(i,e),index:i}}asOneAndZeros(){const e=[];for(let t=0;t<3;++t){const n=this.getRowAbsMax(t),i=n.value>0?1:-1;for(let t=0;t<3;++t)t===n.index?e.push(1*i):e.push(0)}return new Q(e)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}getValues(){return this.#e.slice()}}function V(){return new Q([1,0,0,0,1,0,0,0,1])}function N(e){return e.equals(V())}function B(e,t,n,i,o,r,a,s){void 0===a&&(a=!1),void 0===s&&(s=!1);let l=t;a?(r*=-1,s?l-=(o-1)*i:i*=-1):s&&(l+=(o-1)*i,i*=-1);const c=r-o*i;let u=0,d=0;return{next:function(){if(u<n){const t={value:e(l),done:!1,index:l};return l+=i,++u,++d,d===o&&(d=0,l+=c),t}return{done:!0,index:l}}}}function k(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function G(e,t,n,i){const r=e.getGeometry().getSize();let a=2;i&&void 0!==i&&(a=i.getColAbsMax(2).index);const s=t.getValues(),l=new o(s.map((function(e,t){return t===a||t>2?e:0})));let c,u=r.indexToOffset(l);void 0===n&&(n=!1),c=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const d=r.get(0),h=r.get(1),g=r.get(2);let S=r.getDimSize(2);const p=e.getNumberOfComponents(),m=1===e.getPlanarConfiguration(),f=function(e,t,n,i,o,r,a,s){return 1===p?B(e,t,n,i,o,r,a,s):3===p?function(e,t,n,i,o,r,a,s,l){const c=[];return l?(c.push(B(e,t,n,i,o,r,a,s)),c.push(B(e,t+n*i,n,i,o,r,a,s)),c.push(B(e,t+2*n*i,n,i,o,r,a,s))):(i*=3,r*=3,c.push(B(e,t,n,i,o,r,a,s)),c.push(B(e,t+1,n,i,o,r,a,s)),c.push(B(e,t+2,n,i,o,r,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,o,r,a,s,m):void 0};let v;if(i&&void 0!==i){const e=i.getColAbsMax(0),t=i.getColAbsMax(2),n=!1,o=!1;if(2===t.index){const t=d*h;v=0===e.index?f(c,u,t,1,d,d,n,o):f(c,u,t,d,h,1,n,o)}else if(0===t.index){const t=g*h;v=1===e.index?f(c,u,t,d,h,S,n,o):f(c,u,t,S,g,d,n,o)}else{if(1!==t.index)throw new Error("Unknown direction: "+t.index);{const t=g*d;v=0===e.index?f(c,u,t,1,d,S,n,o):f(c,u,t,S,g,1,n,o)}}}else if(1===e.getNumberOfComponents())v=function(e,t,n,i){void 0===i&&(i=1);let o=t;return{next:function(){if(o<n){const t={value:e(o),done:!1,index:o};return o+=i,t}return{done:!0,index:n}}}}(c,u,u+S);else{if(3!==e.getNumberOfComponents())throw new Error("Unsupported number of components: "+e.getNumberOfComponents());u*=3,S*=3,v=function(e,t,n,i,o){void 0===i&&(i=1),void 0===o&&(o=!1);let r=t,a=1;o?a=(n-t)/3:i*=3;let s=r+a,l=r+2*a;return{next:function(){if(r<n){const t={value:[e(r),e(s),e(l)],done:!1,index:[r,s,l]};return r+=i,s+=i,l+=i,t}return{done:!0,index:[n]}}}}(c,u,u+S,1,m)}return v}function H(e,t){let n=0,i=0;return{next:function(){if(n<t){i+1<e.length&&n>=e[i+1].index&&++i;const t={value:e[i].value,done:!1,index:n};return++n,t}return{done:!0,index:t}}}}class z{#O={};add(e,t){void 0===this.#O[e]&&(this.#O[e]=[]),this.#O[e].push(t)}remove(e,t){if(void 0===this.#O[e])return;let n=0;for(let i=0;i<this.#O[e].length;++i)this.#O[e][i]===t&&(++n,this.#O[e].splice(i,1));0===n&&h.debug("No callback found on remove listener for type "+e)}fireEvent=e=>{if(void 0===this.#O[e.type])return;const t=this.#O[e.type].slice();for(let n=0;n<t.length;++n)t[n](e)}}class Y{#S;#p;constructor(e,t){this.#S=e,this.#p=t}getSlope(){return this.#S}getIntercept(){return this.#p}apply(e){return e*this.#S+this.#p}equals(e){return null!=e&&this.getSlope()===e.getSlope()&&this.getIntercept()===e.getIntercept()}isID(){return 1===this.getSlope()&&0===this.getIntercept()}}class X{#b=[];#x(e){return this.#b.indexOf(e)}isHidden(e){return-1!==this.#x(e)}addToHidden(e){this.isHidden(e)?h.warn("Not hidding segment, it is allready in the hidden list: "+e):this.#b.push(e)}removeFromHidden(e){const t=this.#x(e);-1!==t?this.#b.splice(t,1):h.warn("Cannot remove segment, it is not in the hidden list: "+e)}}const W=["wlchange","wlpresetadd","colourmapchange","positionchange","opacitychange","alphafuncchange","maskviewchange"];function j(e,t){return(new x).create(e,t)}class Z{#R;#E;#F;#q={minmax:{name:"minmax"}};#M;#U;#Q="plain";#V;#N;#B=.33;#k=1;#G;#H=function(e,t){return 255};#z=(e,t)=>0===e||this.#Y.isHidden(e)?0:0!==this.getContourThickness()&&this.#R.getContourDistance(t,this.getOrientation())<=this.getContourThickness()?255:255*this.getFillOpacity();#Y;#X=new z;constructor(e){this.setImage(e)}getImage(){return this.#R}setImage(e){this.#R=e,void 0===this.getCurrentPosition()&&this.setCurrentIndex(this.#W(),!0),this.isMask()?(this.#Y=new X,this.#G=this.#z):(this.#G=this.#H,this.#R.addEventListener("appendframe",(()=>{const e=this.getCurrentIndex();if(3===e.length()){const t=e.getValues();t.push(0),this.setCurrentIndex(new o(t),!0)}})))}isMask(){return"SEG"===this.#R.getMeta().Modality}setMaskViewHelper(e){this.#Y=e,this.#j({type:"alphafuncchange"})}getOrientation(){return this.#N}setOrientation(e){this.#N=e}getFillOpacity(){return this.#B}setFillOpacity(e){this.#B=e>1?1:e<0?0:e,this.#j({type:"maskviewchange",value:[this.#B,this.#k]})}getContourThickness(){return this.#k}setContourThickness(e){this.#k=e<0?0:e>10?10:e,this.#j({type:"maskviewchange",value:[this.#B,this.#k]})}#W(){const e=this.#R.getGeometry().getSize(),t=new Array(e.length());return t.fill(0),t[0]=Math.floor(e.get(0)/2),t[1]=Math.floor(e.get(1)/2),t[2]=Math.floor(e.get(2)/2),e.normaliseIndex(new o(t))}getPlaybackMilliseconds(e){return e||(e=10),Math.round(1e3/e)}getAlphaFunction(){return this.#G}setAlphaFunction(e){this.#G=e,this.#j({type:"alphafuncchange"})}#Z(){if(void 0!==this.#M&&void 0!==this.#q[this.#M]&&void 0!==this.#q[this.#M].perslice&&!0===this.#q[this.#M].perslice&&!this.#R.isResampled()){const e=this.getCurrentIndex();if(void 0===e)throw new Error("Cannot get window lut with no current index");const t=this.#R.getSecondaryOffset(e),n=this.#q[this.#M].wl[t];void 0!==n&&this.setWindowLevel(n,this.#M,!0)}if(void 0===this.#U&&this.setWindowLevelPresetById(0,!0),void 0===this.#F||this.#R.isConstantRSI()!==this.#F){let e,t;this.#F=this.#R.isConstantRSI(),this.#F?(e=this.#R.getRescaleSlopeAndIntercept(),t=!0):(e=new Y(1,0),t=!1);const n=new r(e,this.#R.getMeta().BitsStored);this.#E=new a(n,1===this.#R.getMeta().PixelRepresentation,t)}const e=this.#E.getVoiLut();let t;if(void 0!==e&&(t=e.getWindowLevel()),void 0===e||!v(this.#U,t)){const e=new m(this.#U,this.#R.getMeta().VOILUTFunction);this.#E.setVoiLut(e)}return this.#E}getWindowPresets(){return this.#q}getWindowPresetsNames(){return Object.keys(this.#q)}setWindowPresets(e){this.#q=e}addWindowPresets(e){const t=Object.keys(e);for(const n of t)if(void 0!==this.#q[n]){if(void 0!==this.#q[n].perslice&&!0===this.#q[n].perslice)throw new Error("Cannot add perslice preset");this.#q[n]=e[n]}else this.#q[n]=e[n],this.#j({type:"wlpresetadd",name:n})}getCurrentWindowPresetName(){return this.#M}getColourMap(){return this.#Q}#_(){return d[this.#Q]}setColourMap(e){if(!d[e])throw new Error("Unknown colour map: '"+e+"'");this.#Q=e,this.#j({type:"colourmapchange",value:[e]})}getCurrentPosition(){return this.#V}getCurrentIndex(){const e=this.getCurrentPosition();if(void 0!==e)return this.getImage().getGeometry().worldToIndex(e)}getCurrentImageUid(){return this.#R.getImageUid(this.getCurrentIndex())}getOriginForImageUid(e){return this.#R.getOriginForImageUid(e)}includesImageUid(e){return this.#R.includesImageUid(e)}isPositionInBounds(e){void 0===e&&(e=this.#V);const t=this.#R.getGeometry(),n=t.worldToIndex(e),i=[this.getScrollDimIndex()];return 4===n.length()&&i.push(3),t.isIndexInBounds(n,i)}getOrigin(e){const t=this.#R.getGeometry();let n=0;return void 0!==e&&(n=t.worldToIndex(e).get(2)),t.getOrigins()[n]}setCurrentIndex(e,t){const n=this.#R.getGeometry().indexToWorld(e);return this.setCurrentPosition(n,t)}setCurrentPosition(e,t){void 0===t&&(t=!1);const n=this.#R.getGeometry(),i=n.getSize().normalisePoint(e,this.#V),o=n.worldToIndex(i),r=[this.getScrollDimIndex()];if(4===o.length()&&r.push(3),!n.isIndexInBounds(o,r))return this.#V=i,t||this.#j({type:"positionchange",value:[o.getValues(),e.getValues()],valid:!1}),!1;let a=[];const s=this.getCurrentIndex();if(void 0!==s)if(s.canCompare(o))a=s.compare(o);else{const e=Math.min(s.length(),o.length());for(let t=0;t<e;++t)s.get(t)!==o.get(t)&&a.push(t);const t=Math.max(s.length(),o.length());for(let n=e;n<t;++n)a.push(n)}else for(let e=0;e<o.length();++e)a.push(e);if(this.#V=i,!t){const t={type:"positionchange",value:[o.getValues(),e.getValues()],diffDims:a,data:{imageUid:this.#R.getImageUid(o)}};if(this.#R.canQuantify()){const e=this.#R.getRescaledValueAtIndex(o);t.value.push(e)}this.#j(t)}return!0}setWindowLevel(e,t,n){if(void 0===t&&(t="manual"),"manual"!==t&&void 0===this.#q[t])throw new Error("Unknown window level preset: '"+t+"'");void 0===n&&(n=!1);const i=D(e,this.#R.getRescaledDataRange(),this.#R.getMeta().VOILUTFunction),o=!v(i,this.#U),r=this.#M!==t;(o||r)&&(this.#U=i,this.#M=t,"manual"===t&&(void 0!==this.#q[t]?this.#q[t].wl[0]=i:this.addWindowPresets({manual:{wl:[i],name:"manual"}})),this.#j({type:"wlchange",value:[i.center,i.width,t],wc:i.center,ww:i.width,skipGenerate:n}))}getWindowLevel(){return this.#Z().getVoiLut().getWindowLevel()}setWindowLevelPreset(e,t){const n=this.getWindowPresets()[e];if(void 0===n)throw new Error("Unknown window level preset: '"+e+"'");"minmax"===e&&void 0===n.wl&&(n.wl=[this.getWindowLevelMinMax()]);let i=n.wl[0];if(void 0!==n.perslice&&!0===n.perslice&&!this.#R.isResampled()){const e=this.#R.getSecondaryOffset(this.getCurrentIndex());i=n.wl[e]}void 0!==i&&this.setWindowLevel(i,e,t)}setWindowLevelPresetById(e,t){const n=Object.keys(this.getWindowPresets());this.setWindowLevelPreset(n[e],t)}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)};getWindowLevelMinMax(){const e=this.getImage().getRescaledDataRange(),t=e.max-e.min,n=e.min+t/2;return D(new f(n,t),e,this.#R.getMeta().VOILUTFunction)}setWindowLevelMinMax(){const e=this.getWindowLevelMinMax();this.setWindowLevel(e,"minmax")}generateImageData(e,t){if(void 0===t&&void 0===(t=this.getCurrentIndex()))throw new Error("Cannot generate image data with no current index");const n=this.getImage(),i=!n.isConstantRSI(),o=G(n,t,i,this.getOrientation()),r=n.getPhotometricInterpretation();switch(r){case"MONOCHROME1":case"MONOCHROME2":!function(e,t,n,i,o){let r,a=0,s=t.next();for(;!s.done;)r=i.getValue(s.value),e.data[a]=o.red[r],e.data[a+1]=o.green[r],e.data[a+2]=o.blue[r],e.data[a+3]=n(s.value,s.index),a+=4,s=t.next()}(e,o,this.getAlphaFunction(),this.#Z(),this.#_());break;case"PALETTE COLOR":!function(e,t,n,i,o){const r=function(e){return e>>8};o&&h.info("Scaling 16bits data to 8bits.");let a,s=0,l=t.next();for(;!l.done;)a=l.value,o?(e.data[s]=r(i.red[a]),e.data[s+1]=r(i.green[a]),e.data[s+2]=r(i.blue[a])):(e.data[s]=i.red[a],e.data[s+1]=i.green[a],e.data[s+2]=i.blue[a]),e.data[s+3]=n(a,l.index),s+=4,l=t.next()}(e,o,this.getAlphaFunction(),n.getPaletteColourMap(),16===n.getMeta().BitsStored);break;case"RGB":!function(e,t,n){let i=0,o=t.next();for(;!o.done;)e.data[i]=o.value[0],e.data[i+1]=o.value[1],e.data[i+2]=o.value[2],e.data[i+3]=n(o.value,o.index),i+=4,o=t.next()}(e,o,this.getAlphaFunction());break;case"YBR_FULL":!function(e,t,n){let i,o=0,r=t.next();for(;!r.done;)a=r.value[0],s=r.value[1],i={r:a+1.402*((l=r.value[2])-128),g:a-.34414*(s-128)-.71414*(l-128),b:a+1.772*(s-128)},e.data[o]=i.r,e.data[o+1]=i.g,e.data[o+2]=i.b,e.data[o+3]=n(r.value,r.index),o+=4,r=t.next();var a,s,l}(e,o,this.getAlphaFunction());break;default:throw new Error("Unsupported photometric interpretation: "+r)}}getScrollDimIndex(){let e=2;const t=this.getOrientation();return void 0!==t&&(e=t.getThirdColMajorDirection()),e}isAquisitionOrientation(){return N(this.#N)}}const _={t(e){let t=e;const n=e.split(".");return 2===n.length&&"unit"===n[0]&&(t={mm:"mm",cm2:"cm²",ml:"ml",degree:"°",pixel:"pixels"}[n[1]]),t}};function K(e,t,n){if(null==e||null==t)return!1;const i=n>0?0|n:0;return e.substring(i,i+t.length)===t}function J(e,t){return null!=e&&null!=t&&e.substring(e.length-t.length)===t}function $(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 ee(e){let t=null;if(null!=e&&"."!==e[0]){const n=e.toLowerCase().split(".");1!==n.length&&(t=n.pop(),/[a-z]/.test(t)&&!t.includes("/")||(t=null))}return t}function te(e){const t=new Uint8Array(e.length);for(let n=0,i=e.length;n<i;n++)t[n]=e.charCodeAt(n);return t}function ne(e,t){const n=Math.pow(10,t),i=.01/n;return Math.round(e*n+i)/n}function ie(e,t){if(void 0===t){t=[];for(let n=0;n<e.length;++n)t.push(n)}for(let n=0;n<t.length;++n)if(t[n]>=e.length)throw new Error("Non valid dimension for toStringId");let n="";for(let i=0;i<t.length;++i)0!==i&&(n+="_"),n+="#"+t[i]+"-"+e[t[i]];return n}function oe(e,t,n){let i=e.map(((e,i)=>function(e,t,n){return void 0===e?t:void 0===t?e:n(e,t)}(e,t[i],n)));return t.length>e.length&&(i=i.concat(t.slice(e.length))),i}function re(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&ae(e.slice().sort(),t.slice().sort())}function ae(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&e.length===t.length&&e.every((function(e,n){return e===t[n]}))}function se(e){return String.fromCharCode.apply(String,e)}function le(e,t,n,i){(void 0===n||n<0||n>=e.length)&&(n=0),(void 0===i||i<=n||i>e.length)&&(i=e.length);for(let o=n;o<i;++o)if(t(e[o],o,e))return o}function ce(e){return function(t,n,i){for(let t=0;t<e.length;++t)if(i[n+t]!==e[t])return!1;return!0}}function ue(e,t){const n="\r\n";let i=0;const o=[];for(let r=0;r<e.length;++r){let a="";0!==r&&(a+=n),a+="--"+t+n;const s=Object.keys(e[r]);for(let t=0;t<s.length;++t){const i=s[t];"data"!==i&&(a+=i+": "+e[r][i]+n)}a+=n;const l=te(a);o.push(l),i+=l.byteLength+e[r].data.byteLength}const r=te("\r\n--"+t+"--"+n),a=new Uint8Array(i+r.byteLength);let s=0;for(let t=0;t<e.length;++t)a.set(o[t],s),s+=o[t].byteLength,a.set(new Uint8Array(e[t].data),s),s+=e[t].data.byteLength;return a.set(r,s),a}const de={"0000":{"0000":["UL","1","CommandGroupLength"],"0001":["UL","1","CommandLengthToEnd"],"0002":["UI","1","AffectedSOPClassUID"],"0003":["UI","1","RequestedSOPClassUID"],"0010":["SH","1","CommandRecognitionCode"],"0100":["US","1","CommandField"],"0110":["US","1","MessageID"],"0120":["US","1","MessageIDBeingRespondedTo"],"0200":["AE","1","Initiator"],"0300":["AE","1","Receiver"],"0400":["AE","1","FindLocation"],"0600":["AE","1","MoveDestination"],"0700":["US","1","Priority"],"0800":["US","1","CommandDataSetType"],"0850":["US","1","NumberOfMatches"],"0860":["US","1","ResponseSequenceNumber"],"0900":["US","1","Status"],"0901":["AT","1-n","OffendingElement"],"0902":["LO","1","ErrorComment"],"0903":["US","1","ErrorID"],1e3:["UI","1","AffectedSOPInstanceUID"],1001:["UI","1","RequestedSOPInstanceUID"],1002:["US","1","EventTypeID"],1005:["AT","1-n","AttributeIdentifierList"],1008:["US","1","ActionTypeID"],1020:["US","1","NumberOfRemainingSuboperations"],1021:["US","1","NumberOfCompletedSuboperations"],1022:["US","1","NumberOfFailedSuboperations"],1023:["US","1","NumberOfWarningSuboperations"],1030:["AE","1","MoveOriginatorApplicationEntityTitle"],1031:["US","1","MoveOriginatorMessageID"],4e3:["LT","1","DialogReceiver"],4010:["LT","1","TerminalType"],5010:["SH","1","MessageSetID"],5020:["SH","1","EndMessageID"],5110:["LT","1","DisplayFormat"],5120:["LT","1","PagePositionID"],5130:["CS","1","TextFormatID"],5140:["CS","1","NormalReverse"],5150:["CS","1","AddGrayScale"],5160:["CS","1","Borders"],5170:["IS","1","Copies"],5180:["CS","1","CommandMagnificationType"],5190:["CS","1","Erase"],"51A0":["CS","1","Print"],"51B0":["US","1-n","Overlays"]},"0002":{"0000":["UL","1","FileMetaInformationGroupLength"],"0001":["OB","1","FileMetaInformationVersion"],"0002":["UI","1","MediaStorageSOPClassUID"],"0003":["UI","1","MediaStorageSOPInstanceUID"],"0010":["UI","1","TransferSyntaxUID"],"0012":["UI","1","ImplementationClassUID"],"0013":["SH","1","ImplementationVersionName"],"0016":["AE","1","SourceApplicationEntityTitle"],"0017":["AE","1","SendingApplicationEntityTitle"],"0018":["AE","1","ReceivingApplicationEntityTitle"],"0026":["UR","1","SourcePresentationAddress"],"0027":["UR","1","SendingPresentationAddress"],"0028":["UR","1","ReceivingPresentationAddress"],"0031":["OB","1","RTVMetaInformationVersion"],"0032":["UI","1","RTVCommunicationSOPClassUID"],"0033":["UI","1","RTVCommunicationSOPInstanceUID"],"0035":["OB","1","RTVSourceIdentifier"],"0036":["OB","1","RTVFlowIdentifier"],"0037":["UL","1","RTVFlowRTPSamplingRate"],"0038":["FD","1","RTVFlowActualFrameDuration"],"0100":["UI","1","PrivateInformationCreatorUID"],"0102":["OB","1","PrivateInformation"]},"0004":{"0000":["UL","1","GenericGroupLength"],1130:["CS","1","FileSetID"],1141:["CS","1-8","FileSetDescriptorFileID"],1142:["CS","1","SpecificCharacterSetOfFileSetDescriptorFile"],1200:["UL","1","OffsetOfTheFirstDirectoryRecordOfTheRootDirectoryEntity"],1202:["UL","1","OffsetOfTheLastDirectoryRecordOfTheRootDirectoryEntity"],1212:["US","1","FileSetConsistencyFlag"],1220:["SQ","1","DirectoryRecordSequence"],1400:["UL","1","OffsetOfTheNextDirectoryRecord"],1410:["US","1","RecordInUseFlag"],1420:["UL","1","OffsetOfReferencedLowerLevelDirectoryEntity"],1430:["CS","1","DirectoryRecordType"],1432:["UI","1","PrivateRecordUID"],1500:["CS","1-8","ReferencedFileID"],1504:["UL","1","MRDRDirectoryRecordOffset"],1510:["UI","1","ReferencedSOPClassUIDInFile"],1511:["UI","1","ReferencedSOPInstanceUIDInFile"],1512:["UI","1","ReferencedTransferSyntaxUIDInFile"],"151A":["UI","1-n","ReferencedRelatedGeneralSOPClassUIDInFile"],1600:["UL","1","NumberOfReferences"]},"0008":{"0000":["UL","1","GenericGroupLength"],"0001":["UL","1","LengthToEnd"],"0005":["CS","1-n","SpecificCharacterSet"],"0006":["SQ","1","LanguageCodeSequence"],"0008":["CS","2-n","ImageType"],"0010":["SH","1","RecognitionCode"],"0012":["DA","1","InstanceCreationDate"],"0013":["TM","1","InstanceCreationTime"],"0014":["UI","1","InstanceCreatorUID"],"0015":["DT","1","InstanceCoercionDateTime"],"0016":["UI","1","SOPClassUID"],"0018":["UI","1","SOPInstanceUID"],"001A":["UI","1-n","RelatedGeneralSOPClassUID"],"001B":["UI","1","OriginalSpecializedSOPClassUID"],"0020":["DA","1","StudyDate"],"0021":["DA","1","SeriesDate"],"0022":["DA","1","AcquisitionDate"],"0023":["DA","1","ContentDate"],"0024":["DA","1","OverlayDate"],"0025":["DA","1","CurveDate"],"002A":["DT","1","AcquisitionDateTime"],"0030":["TM","1","StudyTime"],"0031":["TM","1","SeriesTime"],"0032":["TM","1","AcquisitionTime"],"0033":["TM","1","ContentTime"],"0034":["TM","1","OverlayTime"],"0035":["TM","1","CurveTime"],"0040":["US","1","DataSetType"],"0041":["LO","1","DataSetSubtype"],"0042":["CS","1","NuclearMedicineSeriesType"],"0050":["SH","1","AccessionNumber"],"0051":["SQ","1","IssuerOfAccessionNumberSequence"],"0052":["CS","1","QueryRetrieveLevel"],"0053":["CS","1","QueryRetrieveView"],"0054":["AE","1-n","RetrieveAETitle"],"0055":["AE","1","StationAETitle"],"0056":["CS","1","InstanceAvailability"],"0058":["UI","1-n","FailedSOPInstanceUIDList"],"0060":["CS","1","Modality"],"0061":["CS","1-n","ModalitiesInStudy"],"0062":["UI","1-n","SOPClassesInStudy"],"0063":["SQ","1","AnatomicRegionsInStudyCodeSequence"],"0064":["CS","1","ConversionType"],"0068":["CS","1","PresentationIntentType"],"0070":["LO","1","Manufacturer"],"0080":["LO","1","InstitutionName"],"0081":["ST","1","InstitutionAddress"],"0082":["SQ","1","InstitutionCodeSequence"],"0090":["PN","1","ReferringPhysicianName"],"0092":["ST","1","ReferringPhysicianAddress"],"0094":["SH","1-n","ReferringPhysicianTelephoneNumbers"],"0096":["SQ","1","ReferringPhysicianIdentificationSequence"],"009C":["PN","1-n","ConsultingPhysicianName"],"009D":["SQ","1","ConsultingPhysicianIdentificationSequence"],"0100":["SH","1","CodeValue"],"0101":["LO","1","ExtendedCodeValue"],"0102":["SH","1","CodingSchemeDesignator"],"0103":["SH","1","CodingSchemeVersion"],"0104":["LO","1","CodeMeaning"],"0105":["CS","1","MappingResource"],"0106":["DT","1","ContextGroupVersion"],"0107":["DT","1","ContextGroupLocalVersion"],"0108":["LT","1","ExtendedCodeMeaning"],"0109":["SQ","1","CodingSchemeResourcesSequence"],"010A":["CS","1","CodingSchemeURLType"],"010B":["CS","1","ContextGroupExtensionFlag"],"010C":["UI","1","CodingSchemeUID"],"010D":["UI","1","ContextGroupExtensionCreatorUID"],"010E":["UR","1","CodingSchemeURL"],"010F":["CS","1","ContextIdentifier"],"0110":["SQ","1","CodingSchemeIdentificationSequence"],"0112":["LO","1","CodingSchemeRegistry"],"0114":["ST","1","CodingSchemeExternalID"],"0115":["ST","1","CodingSchemeName"],"0116":["ST","1","CodingSchemeResponsibleOrganization"],"0117":["UI","1","ContextUID"],"0118":["UI","1","MappingResourceUID"],"0119":["UC","1","LongCodeValue"],"0120":["UR","1","URNCodeValue"],"0121":["SQ","1","EquivalentCodeSequence"],"0122":["LO","1","MappingResourceName"],"0123":["SQ","1","ContextGroupIdentificationSequence"],"0124":["SQ","1","MappingResourceIdentificationSequence"],"0201":["SH","1","TimezoneOffsetFromUTC"],"0202":["","",""],"0220":["SQ","1","ResponsibleGroupCodeSequence"],"0221":["CS","1","EquipmentModality"],"0222":["LO","1","ManufacturerRelatedModelGroup"],"0300":["SQ","1","PrivateDataElementCharacteristicsSequence"],"0301":["US","1","PrivateGroupReference"],"0302":["LO","1","PrivateCreatorReference"],"0303":["CS","1","BlockIdentifyingInformationStatus"],"0304":["US","1-n","NonidentifyingPrivateElements"],"0305":["SQ","1","DeidentificationActionSequence"],"0306":["US","1-n","IdentifyingPrivateElements"],"0307":["CS","1","DeidentificationAction"],"0308":["US","1","PrivateDataElement"],"0309":["UL","1-3","PrivateDataElementValueMultiplicity"],"030A":["CS","1","PrivateDataElementValueRepresentation"],"030B":["UL","1-2","PrivateDataElementNumberOfItems"],"030C":["UC","1","PrivateDataElementName"],"030D":["UC","1","PrivateDataElementKeyword"],"030E":["UT","1","PrivateDataElementDescription"],"030F":["UT","1","PrivateDataElementEncoding"],"0310":["SQ","1","PrivateDataElementDefinitionSequence"],1e3:["AE","1","NetworkID"],1010:["SH","1","StationName"],1030:["LO","1","StudyDescription"],1032:["SQ","1","ProcedureCodeSequence"],"103E":["LO","1","SeriesDescription"],"103F":["SQ","1","SeriesDescriptionCodeSequence"],1040:["LO","1","InstitutionalDepartmentName"],1041:["SQ","1","InstitutionalDepartmentTypeCodeSequence"],1048:["PN","1-n","PhysiciansOfRecord"],1049:["SQ","1","PhysiciansOfRecordIdentificationSequence"],1050:["PN","1-n","PerformingPhysicianName"],1052:["SQ","1","PerformingPhysicianIdentificationSequence"],1060:["PN","1-n","NameOfPhysiciansReadingStudy"],1062:["SQ","1","PhysiciansReadingStudyIdentificationSequence"],1070:["PN","1-n","OperatorsName"],1072:["SQ","1","OperatorIdentificationSequence"],1080:["LO","1-n","AdmittingDiagnosesDescription"],1084:["SQ","1","AdmittingDiagnosesCodeSequence"],1090:["LO","1","ManufacturerModelName"],1100:["SQ","1","ReferencedResultsSequence"],1110:["SQ","1","ReferencedStudySequence"],1111:["SQ","1","ReferencedPerformedProcedureStepSequence"],1115:["SQ","1","ReferencedSeriesSequence"],1120:["SQ","1","ReferencedPatientSequence"],1125:["SQ","1","ReferencedVisitSequence"],1130:["SQ","1","ReferencedOverlaySequence"],1134:["SQ","1","ReferencedStereometricInstanceSequence"],"113A":["SQ","1","ReferencedWaveformSequence"],1140:["SQ","1","ReferencedImageSequence"],1145:["SQ","1","ReferencedCurveSequence"],"114A":["SQ","1","ReferencedInstanceSequence"],"114B":["SQ","1","ReferencedRealWorldValueMappingInstanceSequence"],1150:["UI","1","ReferencedSOPClassUID"],1155:["UI","1","ReferencedSOPInstanceUID"],1156:["SQ","1","DefinitionSourceSequence"],"115A":["UI","1-n","SOPClassesSupported"],1160:["IS","1-n","ReferencedFrameNumber"],1161:["UL","1-n","SimpleFrameList"],1162:["UL","3-3n","CalculatedFrameList"],1163:["FD","2","TimeRange"],1164:["SQ","1","FrameExtractionSequence"],1167:["UI","1","MultiFrameSourceSOPInstanceUID"],1190:["UR","1","RetrieveURL"],1195:["UI","1","TransactionUID"],1196:["US","1","WarningReason"],1197:["US","1","FailureReason"],1198:["SQ","1","FailedSOPSequence"],1199:["SQ","1","ReferencedSOPSequence"],"119A":["SQ","1","OtherFailuresSequence"],1200:["SQ","1","StudiesContainingOtherReferencedInstancesSequence"],1250:["SQ","1","RelatedSeriesSequence"],2110:["CS","1","LossyImageCompressionRetired"],2111:["ST","1","DerivationDescription"],2112:["SQ","1","SourceImageSequence"],2120:["SH","1","StageName"],2122:["IS","1","StageNumber"],2124:["IS","1","NumberOfStages"],2127:["SH","1","ViewName"],2128:["IS","1","ViewNumber"],2129:["IS","1","NumberOfEventTimers"],"212A":["IS","1","NumberOfViewsInStage"],2130:["DS","1-n","EventElapsedTimes"],2132:["LO","1-n","EventTimerNames"],2133:["SQ","1","EventTimerSequence"],2134:["FD","1","EventTimeOffset"],2135:["SQ","1","EventCodeSequence"],2142:["IS","1","StartTrim"],2143:["IS","1","StopTrim"],2144:["IS","1","RecommendedDisplayFrameRate"],2200:["CS","1","TransducerPosition"],2204:["CS","1","TransducerOrientation"],2208:["CS","1","AnatomicStructure"],2218:["SQ","1","AnatomicRegionSequence"],2220:["SQ","1","AnatomicRegionModifierSequence"],2228:["SQ","1","PrimaryAnatomicStructureSequence"],2229:["SQ","1","AnatomicStructureSpaceOrRegionSequence"],2230:["SQ","1","PrimaryAnatomicStructureModifierSequence"],2240:["SQ","1","TransducerPositionSequence"],2242:["SQ","1","TransducerPositionModifierSequence"],2244:["SQ","1","TransducerOrientationSequence"],2246:["SQ","1","TransducerOrientationModifierSequence"],2251:["SQ","1","AnatomicStructureSpaceOrRegionCodeSequenceTrial"],2253:["SQ","1","AnatomicPortalOfEntranceCodeSequenceTrial"],2255:["SQ","1","AnatomicApproachDirectionCodeSequenceTrial"],2256:["ST","1","AnatomicPerspectiveDescriptionTrial"],2257:["SQ","1","AnatomicPerspectiveCodeSequenceTrial"],2258:["ST","1","AnatomicLocationOfExaminingInstrumentDescriptionTrial"],2259:["SQ","1","AnatomicLocationOfExaminingInstrumentCodeSequenceTrial"],"225A":["SQ","1","AnatomicStructureSpaceOrRegionModifierCodeSequenceTrial"],"225C":["SQ","1","OnAxisBackgroundAnatomicStructureCodeSequenceTrial"],3001:["SQ","1","AlternateRepresentationSequence"],3002:["UI","1-n","AvailableTransferSyntaxUID"],3010:["UI","1-n","IrradiationEventUID"],3011:["SQ","1","SourceIrradiationEventSequence"],3012:["UI","1","RadiopharmaceuticalAdministrationEventUID"],4e3:["LT","1","IdentifyingComments"],9007:["CS","4","FrameType"],9092:["SQ","1","ReferencedImageEvidenceSequence"],9121:["SQ","1","ReferencedRawDataSequence"],9123:["UI","1","CreatorVersionUID"],9124:["SQ","1","DerivationImageSequence"],9154:["SQ","1","SourceImageEvidenceSequence"],9205:["CS","1","PixelPresentation"],9206:["CS","1","VolumetricProperties"],9207:["CS","1","VolumeBasedCalculationTechnique"],9208:["CS","1","ComplexImageComponent"],9209:["CS","1","AcquisitionContrast"],9215:["SQ","1","DerivationCodeSequence"],9237:["SQ","1","ReferencedPresentationStateSequence"],9410:["SQ","1","ReferencedOtherPlaneSequence"],9458:["SQ","1","FrameDisplaySequence"],9459:["FL","1","RecommendedDisplayFrameRateInFloat"],9460:["CS","1","SkipFrameRangeFlag"]},"0010":{"0000":["UL","1","GenericGroupLength"],"0010":["PN","1","PatientName"],"0020":["LO","1","PatientID"],"0021":["LO","1","IssuerOfPatientID"],"0022":["CS","1","TypeOfPatientID"],"0024":["SQ","1","IssuerOfPatientIDQualifiersSequence"],"0026":["SQ","1","SourcePatientGroupIdentificationSequence"],"0027":["SQ","1","GroupOfPatientsIdentificationSequence"],"0028":["US","3","SubjectRelativePositionInImage"],"0030":["DA","1","PatientBirthDate"],"0032":["TM","1","PatientBirthTime"],"0033":["LO","1","PatientBirthDateInAlternativeCalendar"],"0034":["LO","1","PatientDeathDateInAlternativeCalendar"],"0035":["CS","1","PatientAlternativeCalendar"],"0040":["CS","1","PatientSex"],"0050":["SQ","1","PatientInsurancePlanCodeSequence"],"0101":["SQ","1","PatientPrimaryLanguageCodeSequence"],"0102":["SQ","1","PatientPrimaryLanguageModifierCodeSequence"],"0200":["CS","1","QualityControlSubject"],"0201":["SQ","1","QualityControlSubjectTypeCodeSequence"],"0212":["UC","1","StrainDescription"],"0213":["LO","1","StrainNomenclature"],"0214":["LO","1","StrainStockNumber"],"0215":["SQ","1","StrainSourceRegistryCodeSequence"],"0216":["SQ","1","StrainStockSequence"],"0217":["LO","1","StrainSource"],"0218":["UT","1","StrainAdditionalInformation"],"0219":["SQ","1","StrainCodeSequence"],"0221":["SQ","1","GeneticModificationsSequence"],"0222":["UC","1","GeneticModificationsDescription"],"0223":["LO","1","GeneticModificationsNomenclature"],"0229":["SQ","1","GeneticModificationsCodeSequence"],1e3:["LO","1-n","OtherPatientIDs"],1001:["PN","1-n","OtherPatientNames"],1002:["SQ","1","OtherPatientIDsSequence"],1005:["PN","1","PatientBirthName"],1010:["AS","1","PatientAge"],1020:["DS","1","PatientSize"],1021:["SQ","1","PatientSizeCodeSequence"],1022:["DS","1","PatientBodyMassIndex"],1023:["DS","1","MeasuredAPDimension"],1024:["DS","1","MeasuredLateralDimension"],1030:["DS","1","PatientWeight"],1040:["LO","1","PatientAddress"],1050:["LO","1-n","InsurancePlanIdentification"],1060:["PN","1","PatientMotherBirthName"],1080:["LO","1","MilitaryRank"],1081:["LO","1","BranchOfService"],1090:["LO","1","MedicalRecordLocator"],1100:["SQ","1","ReferencedPatientPhotoSequence"],2e3:["LO","1-n","MedicalAlerts"],2110:["LO","1-n","Allergies"],2150:["LO","1","CountryOfResidence"],2152:["LO","1","RegionOfResidence"],2154:["SH","1-n","PatientTelephoneNumbers"],2155:["LT","1","PatientTelecomInformation"],2160:["SH","1","EthnicGroup"],2180:["SH","1","Occupation"],"21A0":["CS","1","SmokingStatus"],"21B0":["LT","1","AdditionalPatientHistory"],"21C0":["US","1","PregnancyStatus"],"21D0":["DA","1","LastMenstrualDate"],"21F0":["LO","1","PatientReligiousPreference"],2201:["LO","1","PatientSpeciesDescription"],2202:["SQ","1","PatientSpeciesCodeSequence"],2203:["CS","1","PatientSexNeutered"],2210:["CS","1","AnatomicalOrientationType"],2292:["LO","1","PatientBreedDescription"],2293:["SQ","1","PatientBreedCodeSequence"],2294:["SQ","1","BreedRegistrationSequence"],2295:["LO","1","BreedRegistrationNumber"],2296:["SQ","1","BreedRegistryCodeSequence"],2297:["PN","1","ResponsiblePerson"],2298:["CS","1","ResponsiblePersonRole"],2299:["LO","1","ResponsibleOrganization"],4e3:["LT","1","PatientComments"],9431:["FL","1","ExaminedBodyThickness"]},"0012":{"0000":["UL","1","GenericGroupLength"],"0010":["LO","1","ClinicalTrialSponsorName"],"0020":["LO","1","ClinicalTrialProtocolID"],"0021":["LO","1","ClinicalTrialProtocolName"],"0030":["LO","1","ClinicalTrialSiteID"],"0031":["LO","1","ClinicalTrialSiteName"],"0040":["LO","1","ClinicalTrialSubjectID"],"0042":["LO","1","ClinicalTrialSubjectReadingID"],"0050":["LO","1","ClinicalTrialTimePointID"],"0051":["ST","1","ClinicalTrialTimePointDescription"],"0052":["FD","1","LongitudinalTemporalOffsetFromEvent"],"0053":["CS","1","LongitudinalTemporalEventType"],"0060":["LO","1","ClinicalTrialCoordinatingCenterName"],"0062":["CS","1","PatientIdentityRemoved"],"0063":["LO","1-n","DeidentificationMethod"],"0064":["SQ","1","DeidentificationMethodCodeSequence"],"0071":["LO","1","ClinicalTrialSeriesID"],"0072":["LO","1","ClinicalTrialSeriesDescription"],"0081":["LO","1","ClinicalTrialProtocolEthicsCommitteeName"],"0082":["LO","1","ClinicalTrialProtocolEthicsCommitteeApprovalNumber"],"0083":["SQ","1","ConsentForClinicalTrialUseSequence"],"0084":["CS","1","DistributionType"],"0085":["CS","1","ConsentForDistributionFlag"],"0086":["DA","1","EthicsCommitteeApprovalEffectivenessStartDate"],"0087":["DA","1","EthicsCommitteeApprovalEffectivenessEndDate"]},"0014":{"0000":["UL","1","GenericGroupLength"],"0023":["ST","1","CADFileFormat"],"0024":["ST","1","ComponentReferenceSystem"],"0025":["ST","1","ComponentManufacturingProcedure"],"0028":["ST","1","ComponentManufacturer"],"0030":["DS","1-n","MaterialThickness"],"0032":["DS","1-n","MaterialPipeDiameter"],"0034":["DS","1-n","MaterialIsolationDiameter"],"0042":["ST","1","MaterialGrade"],"0044":["ST","1","MaterialPropertiesDescription"],"0045":["ST","1","MaterialPropertiesFileFormatRetired"],"0046":["LT","1","MaterialNotes"],"0050":["CS","1","ComponentShape"],"0052":["CS","1","CurvatureType"],"0054":["DS","1","OuterDiameter"],"0056":["DS","1","InnerDiameter"],"0100":["LO","1-n","ComponentWelderIDs"],"0101":["CS","1","SecondaryApprovalStatus"],"0102":["DA","1","SecondaryReviewDate"],"0103":["TM","1","SecondaryReviewTime"],"0104":["PN","1","SecondaryReviewerName"],"0105":["ST","1","RepairID"],"0106":["SQ","1","MultipleComponentApprovalSequence"],"0107":["CS","1-n","OtherApprovalStatus"],"0108":["CS","1-n","OtherSecondaryApprovalStatus"],1010:["ST","1","ActualEnvironmentalConditions"],1020:["DA","1","ExpiryDate"],1040:["ST","1","EnvironmentalConditions"],2002:["SQ","1","EvaluatorSequence"],2004:["IS","1","EvaluatorNumber"],2006:["PN","1","EvaluatorName"],2008:["IS","1","EvaluationAttempt"],2012:["SQ","1","IndicationSequence"],2014:["IS","1","IndicationNumber"],2016:["SH","1","IndicationLabel"],2018:["ST","1","IndicationDescription"],"201A":["CS","1-n","IndicationType"],"201C":["CS","1","IndicationDisposition"],"201E":["SQ","1","IndicationROISequence"],2030:["SQ","1","IndicationPhysicalPropertySequence"],2032:["SH","1","PropertyLabel"],2202:["IS","1","CoordinateSystemNumberOfAxes"],2204:["SQ","1","CoordinateSystemAxesSequence"],2206:["ST","1","CoordinateSystemAxisDescription"],2208:["CS","1","CoordinateSystemDataSetMapping"],"220A":["IS","1","CoordinateSystemAxisNumber"],"220C":["CS","1","CoordinateSystemAxisType"],"220E":["CS","1","CoordinateSystemAxisUnits"],2210:["OB","1","CoordinateSystemAxisValues"],2220:["SQ","1","CoordinateSystemTransformSequence"],2222:["ST","1","TransformDescription"],2224:["IS","1","TransformNumberOfAxes"],2226:["IS","1-n","TransformOrderOfAxes"],2228:["CS","1","TransformedAxisUnits"],"222A":["DS","1-n","CoordinateSystemTransformRotationAndScaleMatrix"],"222C":["DS","1-n","CoordinateSystemTransformTranslationMatrix"],3011:["DS","1","InternalDetectorFrameTime"],3012:["DS","1","NumberOfFramesIntegrated"],3020:["SQ","1","DetectorTemperatureSequence"],3022:["ST","1","SensorName"],3024:["DS","1","HorizontalOffsetOfSensor"],3026:["DS","1","VerticalOffsetOfSensor"],3028:["DS","1","SensorTemperature"],3040:["SQ","1","DarkCurrentSequence"],3050:["ox","1","DarkCurrentCounts"],3060:["SQ","1","GainCorrectionReferenceSequence"],3070:["ox","1","AirCounts"],3071:["DS","1","KVUsedInGainCalibration"],3072:["DS","1","MAUsedInGainCalibration"],3073:["DS","1","NumberOfFramesUsedForIntegration"],3074:["LO","1","FilterMaterialUsedInGainCalibration"],3075:["DS","1","FilterThicknessUsedInGainCalibration"],3076:["DA","1","DateOfGainCalibration"],3077:["TM","1","TimeOfGainCalibration"],3080:["OB","1","BadPixelImage"],3099:["LT","1","CalibrationNotes"],3100:["LT","1","LinearityCorrectionTechnique"],3101:["LT","1","BeamHardeningCorrectionTechnique"],4002:["SQ","1","PulserEquipmentSequence"],4004:["CS","1","PulserType"],4006:["LT","1","PulserNotes"],4008:["SQ","1","ReceiverEquipmentSequence"],"400A":["CS","1","AmplifierType"],"400C":["LT","1","ReceiverNotes"],"400E":["SQ","1","PreAmplifierEquipmentSequence"],"400F":["LT","1","PreAmplifierNotes"],4010:["SQ","1","TransmitTransducerSequence"],4011:["SQ","1","ReceiveTransducerSequence"],4012:["US","1","NumberOfElements"],4013:["CS","1","ElementShape"],4014:["DS","1","ElementDimensionA"],4015:["DS","1","ElementDimensionB"],4016:["DS","1","ElementPitchA"],4017:["DS","1","MeasuredBeamDimensionA"],4018:["DS","1","MeasuredBeamDimensionB"],4019:["DS","1","LocationOfMeasuredBeamDiameter"],"401A":["DS","1","NominalFrequency"],"401B":["DS","1","MeasuredCenterFrequency"],"401C":["DS","1","MeasuredBandwidth"],"401D":["DS","1","ElementPitchB"],4020:["SQ","1","PulserSettingsSequence"],4022:["DS","1","PulseWidth"],4024:["DS","1","ExcitationFrequency"],4026:["CS","1","ModulationType"],4028:["DS","1","Damping"],4030:["SQ","1","ReceiverSettingsSequence"],4031:["DS","1","AcquiredSoundpathLength"],4032:["CS","1","AcquisitionCompressionType"],4033:["IS","1","AcquisitionSampleSize"],4034:["DS","1","RectifierSmoothing"],4035:["SQ","1","DACSequence"],4036:["CS","1","DACType"],4038:["DS","1-n","DACGainPoints"],"403A":["DS","1-n","DACTimePoints"],"403C":["DS","1-n","DACAmplitude"],4040:["SQ","1","PreAmplifierSettingsSequence"],4050:["SQ","1","TransmitTransducerSettingsSequence"],4051:["SQ","1","ReceiveTransducerSettingsSequence"],4052:["DS","1","IncidentAngle"],4054:["ST","1","CouplingTechnique"],4056:["ST","1","CouplingMedium"],4057:["DS","1","CouplingVelocity"],4058:["DS","1","ProbeCenterLocationX"],4059:["DS","1","ProbeCenterLocationZ"],"405A":["DS","1","SoundPathLength"],"405C":["ST","1","DelayLawIdentifier"],4060:["SQ","1","GateSettingsSequence"],4062:["DS","1","GateThreshold"],4064:["DS","1","VelocityOfSound"],4070:["SQ","1","CalibrationSettingsSequence"],4072:["ST","1","CalibrationProcedure"],4074:["SH","1","ProcedureVersion"],4076:["DA","1","ProcedureCreationDate"],4078:["DA","1","ProcedureExpirationDate"],"407A":["DA","1","ProcedureLastModifiedDate"],"407C":["TM","1-n","CalibrationTime"],"407E":["DA","1-n","CalibrationDate"],4080:["SQ","1","ProbeDriveEquipmentSequence"],4081:["CS","1","DriveType"],4082:["LT","1","ProbeDriveNotes"],4083:["SQ","1","DriveProbeSequence"],4084:["DS","1","ProbeInductance"],4085:["DS","1","ProbeResistance"],4086:["SQ","1","ReceiveProbeSequence"],4087:["SQ","1","ProbeDriveSettingsSequence"],4088:["DS","1","BridgeResistors"],4089:["DS","1","ProbeOrientationAngle"],"408B":["DS","1","UserSelectedGainY"],"408C":["DS","1","UserSelectedPhase"],"408D":["DS","1","UserSelectedOffsetX"],"408E":["DS","1","UserSelectedOffsetY"],4091:["SQ","1","ChannelSettingsSequence"],4092:["DS","1","ChannelThreshold"],"409A":["SQ","1","ScannerSettingsSequence"],"409B":["ST","1","ScanProcedure"],"409C":["DS","1","TranslationRateX"],"409D":["DS","1","TranslationRateY"],"409F":["DS","1","ChannelOverlap"],"40A0":["LO","1-n","ImageQualityIndicatorType"],"40A1":["LO","1-n","ImageQualityIndicatorMaterial"],"40A2":["LO","1-n","ImageQualityIndicatorSize"],5002:["IS","1","LINACEnergy"],5004:["IS","1","LINACOutput"],5100:["US","1","ActiveAperture"],5101:["DS","1","TotalAperture"],5102:["DS","1","ApertureElevation"],5103:["DS","1","MainLobeAngle"],5104:["DS","1","MainRoofAngle"],5105:["CS","1","ConnectorType"],5106:["SH","1","WedgeModelNumber"],5107:["DS","1","WedgeAngleFloat"],5108:["DS","1","WedgeRoofAngle"],5109:["CS","1","WedgeElement1Position"],"510A":["DS","1","WedgeMaterialVelocity"],"510B":["SH","1","WedgeMaterial"],"510C":["DS","1","WedgeOffsetZ"],"510D":["DS","1","WedgeOriginOffsetX"],"510E":["DS","1","WedgeTimeDelay"],"510F":["SH","1","WedgeName"],5110:["SH","1","WedgeManufacturerName"],5111:["LO","1","WedgeDescription"],5112:["DS","1","NominalBeamAngle"],5113:["DS","1","WedgeOffsetX"],5114:["DS","1","WedgeOffsetY"],5115:["DS","1","WedgeTotalLength"],5116:["DS","1","WedgeInContactLength"],5117:["DS","1","WedgeFrontGap"],5118:["DS","1","WedgeTotalHeight"],5119:["DS","1","WedgeFrontHeight"],"511A":["DS","1","WedgeRearHeight"],"511B":["DS","1","WedgeTotalWidth"],"511C":["DS","1","WedgeInContactWidth"],"511D":["DS","1","WedgeChamferHeight"],"511E":["CS","1","WedgeCurve"],"511F":["DS","1","RadiusAlongWedge"]},"0016":{"0000":["UL","1","GenericGroupLength"],"0001":["DS","1","WhitePoint"],"0002":["DS","3","PrimaryChromaticities"],"0003":["UT","1","BatteryLevel"],"0004":["DS","1","ExposureTimeInSeconds"],"0005":["DS","1","FNumber"],"0006":["IS","1","OECFRows"],"0007":["IS","1","OECFColumns"],"0008":["UC","1-n","OECFColumnNames"],"0009":["DS","1-n","OECFValues"],"000A":["IS","1","SpatialFrequencyResponseRows"],"000B":["IS","1","SpatialFrequencyResponseColumns"],"000C":["UC","1-n","SpatialFrequencyResponseColumnNames"],"000D":["DS","1-n","SpatialFrequencyResponseValues"],"000E":["IS","1","ColorFilterArrayPatternRows"],"000F":["IS","1","ColorFilterArrayPatternColumns"],"0010":["DS","1-n","ColorFilterArrayPatternValues"],"0011":["US","1","FlashFiringStatus"],"0012":["US","1","FlashReturnStatus"],"0013":["US","1","FlashMode"],"0014":["US","1","FlashFunctionPresent"],"0015":["US","1","FlashRedEyeMode"],"0016":["US","1","ExposureProgram"],"0017":["UT","1","SpectralSensitivity"],"0018":["IS","1","PhotographicSensitivity"],"0019":["IS","1","SelfTimerMode"],"001A":["US","1","SensitivityType"],"001B":["IS","1","StandardOutputSensitivity"],"001C":["IS","1","RecommendedExposureIndex"],"001D":["IS","1","ISOSpeed"],"001E":["IS","1","ISOSpeedLatitudeyyy"],"001F":["IS","1","ISOSpeedLatitudezzz"],"0020":["UT","1","EXIFVersion"],"0021":["DS","1","ShutterSpeedValue"],"0022":["DS","1","ApertureValue"],"0023":["DS","1","BrightnessValue"],"0024":["DS","1","ExposureBiasValue"],"0025":["DS","1","MaxApertureValue"],"0026":["DS","1","SubjectDistance"],"0027":["US","1","MeteringMode"],"0028":["US","1","LightSource"],"0029":["DS","1","FocalLength"],"002A":["IS","2-4","SubjectArea"],"002B":["OB","1","MakerNote"],"0030":["DS","1","Temperature"],"0031":["DS","1","Humidity"],"0032":["DS","1","Pressure"],"0033":["DS","1","WaterDepth"],"0034":["DS","1","Acceleration"],"0035":["DS","1","CameraElevationAngle"],"0036":["DS","1-2","FlashEnergy"],"0037":["IS","2","SubjectLocation"],"0038":["DS","1","PhotographicExposureIndex"],"0039":["US","1","SensingMethod"],"003A":["US","1","FileSource"],"003B":["US","1","SceneType"],"0041":["US","1","CustomRendered"],"0042":["US","1","ExposureMode"],"0043":["US","1","WhiteBalance"],"0044":["DS","1","DigitalZoomRatio"],"0045":["IS","1","FocalLengthIn35mmFilm"],"0046":["US","1","SceneCaptureType"],"0047":["US","1","GainControl"],"0048":["US","1","Contrast"],"0049":["US","1","Saturation"],"004A":["US","1","Sharpness"],"004B":["OB","1","DeviceSettingDescription"],"004C":["US","1","SubjectDistanceRange"],"004D":["UT","1","CameraOwnerName"],"004E":["DS","4","LensSpecification"],"004F":["UT","1","LensMake"],"0050":["UT","1","LensModel"],"0051":["UT","1","LensSerialNumber"],"0061":["CS","1","InteroperabilityIndex"],"0062":["OB","1","InteroperabilityVersion"],"0070":["OB","1","GPSVersionID"],"0071":["CS","1","GPSLatitudeRef"],"0072":["DS","3","GPSLatitude"],"0073":["CS","1","GPSLongitudeRef"],"0074":["DS","3","GPSLongitude"],"0075":["US","1","GPSAltitudeRef"],"0076":["DS","1","GPSAltitude"],"0077":["DT","1","GPSTimeStamp"],"0078":["UT","1","GPSSatellites"],"0079":["CS","1","GPSStatus"],"007A":["CS","1","GPSMeasureMode"],"007B":["DS","1","GPSDOP"],"007C":["CS","1","GPSSpeedRef"],"007D":["DS","1","GPSSpeed"],"007E":["CS","1","GPSTrackRef"],"007F":["DS","1","GPSTrack"],"0080":["CS","1","GPSImgDirectionRef"],"0081":["DS","1","GPSImgDirection"],"0082":["UT","1","GPSMapDatum"],"0083":["CS","1","GPSDestLatitudeRef"],"0084":["DS","3","GPSDestLatitude"],"0085":["CS","1","GPSDestLongitudeRef"],"0086":["DS","3","GPSDestLongitude"],"0087":["CS","1","GPSDestBearingRef"],"0088":["DS","1","GPSDestBearing"],"0089":["CS","1","GPSDestDistanceRef"],"008A":["DS","1","GPSDestDistance"],"008B":["OB","1","GPSProcessingMethod"],"008C":["OB","1","GPSAreaInformation"],"008D":["DT","1","GPSDateStamp"],"008E":["IS","1","GPSDifferential"],1001:["CS","1","LightSourcePolarization"],1002:["DS","1","EmitterColorTemperature"],1003:["CS","1","ContactMethod"],1004:["CS","1-n","ImmersionMedia"],1005:["DS","1","OpticalMagnificationFactor"]},"0018":{"0000":["UL","1","GenericGroupLength"],"0010":["LO","1","ContrastBolusAgent"],"0012":["SQ","1","ContrastBolusAgentSequence"],"0013":["FL","1","ContrastBolusT1Relaxivity"],"0014":["SQ","1","ContrastBolusAdministrationRouteSequence"],"0015":["CS","1","BodyPartExamined"],"0020":["CS","1-n","ScanningSequence"],"0021":["CS","1-n","SequenceVariant"],"0022":["CS","1-n","ScanOptions"],"0023":["CS","1","MRAcquisitionType"],"0024":["SH","1","SequenceName"],"0025":["CS","1","AngioFlag"],"0026":["SQ","1","InterventionDrugInformationSequence"],"0027":["TM","1","InterventionDrugStopTime"],"0028":["DS","1","InterventionDrugDose"],"0029":["SQ","1","InterventionDrugCodeSequence"],"002A":["SQ","1","AdditionalDrugSequence"],"0030":["LO","1-n","Radionuclide"],"0031":["LO","1","Radiopharmaceutical"],"0032":["DS","1","EnergyWindowCenterline"],"0033":["DS","1-n","EnergyWindowTotalWidth"],"0034":["LO","1","InterventionDrugName"],"0035":["TM","1","InterventionDrugStartTime"],"0036":["SQ","1","InterventionSequence"],"0037":["CS","1","TherapyType"],"0038":["CS","1","InterventionStatus"],"0039":["CS","1","TherapyDescription"],"003A":["ST","1","InterventionDescription"],"0040":["IS","1","CineRate"],"0042":["CS","1","InitialCineRunState"],"0050":["DS","1","SliceThickness"],"0060":["DS","1","KVP"],"0061":["DS","1",""],"0070":["IS","1","CountsAccumulated"],"0071":["CS","1","AcquisitionTerminationCondition"],"0072":["DS","1","EffectiveDuration"],"0073":["CS","1","AcquisitionStartCondition"],"0074":["IS","1","AcquisitionStartConditionData"],"0075":["IS","1","AcquisitionTerminationConditionData"],"0080":["DS","1","RepetitionTime"],"0081":["DS","1","EchoTime"],"0082":["DS","1","InversionTime"],"0083":["DS","1","NumberOfAverages"],"0084":["DS","1","ImagingFrequency"],"0085":["SH","1","ImagedNucleus"],"0086":["IS","1-n","EchoNumbers"],"0087":["DS","1","MagneticFieldStrength"],"0088":["DS","1","SpacingBetweenSlices"],"0089":["IS","1","NumberOfPhaseEncodingSteps"],"0090":["DS","1","DataCollectionDiameter"],"0091":["IS","1","EchoTrainLength"],"0093":["DS","1","PercentSampling"],"0094":["DS","1","PercentPhaseFieldOfView"],"0095":["DS","1","PixelBandwidth"],1e3:["LO","1","DeviceSerialNumber"],1002:["UI","1","DeviceUID"],1003:["LO","1","DeviceID"],1004:["LO","1","PlateID"],1005:["LO","1","GeneratorID"],1006:["LO","1","GridID"],1007:["LO","1","CassetteID"],1008:["LO","1","GantryID"],1009:["UT","1","UniqueDeviceIdentifier"],"100A":["SQ","1","UDISequence"],"100B":["UI","1-n","ManufacturerDeviceClassUID"],1010:["LO","1","SecondaryCaptureDeviceID"],1011:["LO","1","HardcopyCreationDeviceID"],1012:["DA","1","DateOfSecondaryCapture"],1014:["TM","1","TimeOfSecondaryCapture"],1016:["LO","1","SecondaryCaptureDeviceManufacturer"],1017:["LO","1","HardcopyDeviceManufacturer"],1018:["LO","1","SecondaryCaptureDeviceManufacturerModelName"],1019:["LO","1-n","SecondaryCaptureDeviceSoftwareVersions"],"101A":["LO","1-n","HardcopyDeviceSoftwareVersion"],"101B":["LO","1","HardcopyDeviceManufacturerModelName"],1020:["LO","1-n","SoftwareVersions"],1022:["SH","1","VideoImageFormatAcquired"],1023:["LO","1","DigitalImageFormatAcquired"],1030:["LO","1","ProtocolName"],1040:["LO","1","ContrastBolusRoute"],1041:["DS","1","ContrastBolusVolume"],1042:["TM","1","ContrastBolusStartTime"],1043:["TM","1","ContrastBolusStopTime"],1044:["DS","1","ContrastBolusTotalDose"],1045:["IS","1","SyringeCounts"],1046:["DS","1-n","ContrastFlowRate"],1047:["DS","1-n","ContrastFlowDuration"],1048:["CS","1","ContrastBolusIngredient"],1049:["DS","1","ContrastBolusIngredientConcentration"],1050:["DS","1","SpatialResolution"],1060:["DS","1","TriggerTime"],1061:["LO","1","TriggerSourceOrType"],1062:["IS","1","NominalInterval"],1063:["DS","1","FrameTime"],1064:["LO","1","CardiacFramingType"],1065:["DS","1-n","FrameTimeVector"],1066:["DS","1","FrameDelay"],1067:["DS","1","ImageTriggerDelay"],1068:["DS","1","MultiplexGroupTimeOffset"],1069:["DS","1","TriggerTimeOffset"],"106A":["CS","1","SynchronizationTrigger"],"106C":["US","2","SynchronizationChannel"],"106E":["UL","1","TriggerSamplePosition"],1070:["LO","1","RadiopharmaceuticalRoute"],1071:["DS","1","RadiopharmaceuticalVolume"],1072:["TM","1","RadiopharmaceuticalStartTime"],1073:["TM","1","RadiopharmaceuticalStopTime"],1074:["DS","1","RadionuclideTotalDose"],1075:["DS","1","RadionuclideHalfLife"],1076:["DS","1","RadionuclidePositronFraction"],1077:["DS","1","RadiopharmaceuticalSpecificActivity"],1078:["DT","1","RadiopharmaceuticalStartDateTime"],1079:["DT","1","RadiopharmaceuticalStopDateTime"],1080:["CS","1","BeatRejectionFlag"],1081:["IS","1","LowRRValue"],1082:["IS","1","HighRRValue"],1083:["IS","1","IntervalsAcquired"],1084:["IS","1","IntervalsRejected"],1085:["LO","1","PVCRejection"],1086:["IS","1","SkipBeats"],1088:["IS","1","HeartRate"],1090:["IS","1","CardiacNumberOfImages"],1094:["IS","1","TriggerWindow"],1100:["DS","1","ReconstructionDiameter"],1110:["DS","1","DistanceSourceToDetector"],1111:["DS","1","DistanceSourceToPatient"],1114:["DS","1","EstimatedRadiographicMagnificationFactor"],1120:["DS","1","GantryDetectorTilt"],1121:["DS","1","GantryDetectorSlew"],1130:["DS","1","TableHeight"],1131:["DS","1","TableTraverse"],1134:["CS","1","TableMotion"],1135:["DS","1-n","TableVerticalIncrement"],1136:["DS","1-n","TableLateralIncrement"],1137:["DS","1-n","TableLongitudinalIncrement"],1138:["DS","1","TableAngle"],"113A":["CS","1","TableType"],1140:["CS","1","RotationDirection"],1141:["DS","1","AngularPosition"],1142:["DS","1-n","RadialPosition"],1143:["DS","1","ScanArc"],1144:["DS","1","AngularStep"],1145:["DS","1","CenterOfRotationOffset"],1146:["DS","1-n","RotationOffset"],1147:["CS","1","FieldOfViewShape"],1149:["IS","1-2","FieldOfViewDimensions"],1150:["IS","1","ExposureTime"],1151:["IS","1","XRayTubeCurrent"],1152:["IS","1","Exposure"],1153:["IS","1","ExposureInuAs"],1154:["DS","1","AveragePulseWidth"],1155:["CS","1","RadiationSetting"],1156:["CS","1","RectificationType"],"115A":["CS","1","RadiationMode"],"115E":["DS","1","ImageAndFluoroscopyAreaDoseProduct"],1160:["SH","1","FilterType"],1161:["LO","1-n","TypeOfFilters"],1162:["DS","1","IntensifierSize"],1164:["DS","2","ImagerPixelSpacing"],1166:["CS","1-n","Grid"],1170:["IS","1","GeneratorPower"],1180:["SH","1","CollimatorGridName"],1181:["CS","1","CollimatorType"],1182:["IS","1-2","FocalDistance"],1183:["DS","1-2","XFocusCenter"],1184:["DS","1-2","YFocusCenter"],1190:["DS","1-n","FocalSpots"],1191:["CS","1","AnodeTargetMaterial"],"11A0":["DS","1","BodyPartThickness"],"11A2":["DS","1","CompressionForce"],"11A3":["DS","1","CompressionPressure"],"11A4":["LO","1","PaddleDescription"],"11A5":["DS","1","CompressionContactArea"],"11B0":["LO","1","AcquisitionMode"],"11B1":["LO","1","DoseModeName"],"11B2":["CS","1","AcquiredSubtractionMaskFlag"],"11B3":["CS","1","FluoroscopyPersistenceFlag"],"11B4":["CS","1","FluoroscopyLastImageHoldPersistenceFlag"],"11B5":["IS","1","UpperLimitNumberOfPersistentFluoroscopyFrames"],"11B6":["CS","1","ContrastBolusAutoInjectionTriggerFlag"],"11B7":["FD","1","ContrastBolusInjectionDelay"],"11B8":["SQ","1","XAAcquisitionPhaseDetailsSequence"],"11B9":["FD","1","XAAcquisitionFrameRate"],"11BA":["SQ","1","XAPlaneDetailsSequence"],"11BB":["LO","1","AcquisitionFieldOfViewLabel"],"11BC":["SQ","1","XRayFilterDetailsSequence"],"11BD":["FD","1","XAAcquisitionDuration"],"11BE":["CS","1","ReconstructionPipelineType"],"11BF":["SQ","1","ImageFilterDetailsSequence"],"11C0":["CS","1","AppliedMaskSubtractionFlag"],"11C1":["SQ","1","RequestedSeriesDescriptionCodeSequence"],1200:["DA","1-n","DateOfLastCalibration"],1201:["TM","1-n","TimeOfLastCalibration"],1202:["DT","1","DateTimeOfLastCalibration"],1203:["DT","1","CalibrationDateTime"],1210:["SH","1-n","ConvolutionKernel"],1240:["IS","1-n","UpperLowerPixelValues"],1242:["IS","1","ActualFrameDuration"],1243:["IS","1","CountRate"],1244:["US","1","PreferredPlaybackSequencing"],1250:["SH","1","ReceiveCoilName"],1251:["SH","1","TransmitCoilName"],1260:["SH","1","PlateType"],1261:["LO","1","PhosphorType"],1271:["FD","1","WaterEquivalentDiameter"],1272:["SQ","1","WaterEquivalentDiameterCalculationMethodCodeSequence"],1300:["DS","1","ScanVelocity"],1301:["CS","1-n","WholeBodyTechnique"],1302:["IS","1","ScanLength"],1310:["US","4","AcquisitionMatrix"],1312:["CS","1","InPlanePhaseEncodingDirection"],1314:["DS","1","FlipAngle"],1315:["CS","1","VariableFlipAngleFlag"],1316:["DS","1","SAR"],1318:["DS","1","dBdt"],1320:["FL","1","B1rms"],1400:["LO","1","AcquisitionDeviceProcessingDescription"],1401:["LO","1","AcquisitionDeviceProcessingCode"],1402:["CS","1","CassetteOrientation"],1403:["CS","1","CassetteSize"],1404:["US","1","ExposuresOnPlate"],1405:["IS","1","RelativeXRayExposure"],1411:["DS","1","ExposureIndex"],1412:["DS","1","TargetExposureIndex"],1413:["DS","1","DeviationIndex"],1450:["DS","1","ColumnAngulation"],1460:["DS","1","TomoLayerHeight"],1470:["DS","1","TomoAngle"],1480:["DS","1","TomoTime"],1490:["CS","1","TomoType"],1491:["CS","1","TomoClass"],1495:["IS","1","NumberOfTomosynthesisSourceImages"],1500:["CS","1","PositionerMotion"],1508:["CS","1","PositionerType"],1510:["DS","1","PositionerPrimaryAngle"],1511:["DS","1","PositionerSecondaryAngle"],1520:["DS","1-n","PositionerPrimaryAngleIncrement"],1521:["DS","1-n","PositionerSecondaryAngleIncrement"],1530:["DS","1","DetectorPrimaryAngle"],1531:["DS","1","DetectorSecondaryAngle"],1600:["CS","1-3","ShutterShape"],1602:["IS","1","ShutterLeftVerticalEdge"],1604:["IS","1","ShutterRightVerticalEdge"],1606:["IS","1","ShutterUpperHorizontalEdge"],1608:["IS","1","ShutterLowerHorizontalEdge"],1610:["IS","2","CenterOfCircularShutter"],1612:["IS","1","RadiusOfCircularShutter"],1620:["IS","2-2n","VerticesOfThePolygonalShutter"],1622:["US","1","ShutterPresentationValue"],1623:["US","1","ShutterOverlayGroup"],1624:["US","3","ShutterPresentationColorCIELabValue"],1630:["CS","1","OutlineShapeType"],1631:["FD","1","OutlineLeftVerticalEdge"],1632:["FD","1","OutlineRightVerticalEdge"],1633:["FD","1","OutlineUpperHorizontalEdge"],1634:["FD","1","OutlineLowerHorizontalEdge"],1635:["FD","2","CenterOfCircularOutline"],1636:["FD","1","DiameterOfCircularOutline"],1637:["UL","1","NumberOfPolygonalVertices"],1638:["OF","1","VerticesOfThePolygonalOutline"],1700:["CS","1-3","CollimatorShape"],1702:["IS","1","CollimatorLeftVerticalEdge"],1704:["IS","1","CollimatorRightVerticalEdge"],1706:["IS","1","CollimatorUpperHorizontalEdge"],1708:["IS","1","CollimatorLowerHorizontalEdge"],1710:["IS","2","CenterOfCircularCollimator"],1712:["IS","1","RadiusOfCircularCollimator"],1720:["IS","2-2n","VerticesOfThePolygonalCollimator"],1800:["CS","1","AcquisitionTimeSynchronized"],1801:["SH","1","TimeSource"],1802:["CS","1","TimeDistributionProtocol"],1803:["LO","1","NTPSourceAddress"],2001:["IS","1-n","PageNumberVector"],2002:["SH","1-n","FrameLabelVector"],2003:["DS","1-n","FramePrimaryAngleVector"],2004:["DS","1-n","FrameSecondaryAngleVector"],2005:["DS","1-n","SliceLocationVector"],2006:["SH","1-n","DisplayWindowLabelVector"],2010:["DS","2","NominalScannedPixelSpacing"],2020:["CS","1","DigitizingDeviceTransportDirection"],2030:["DS","1","RotationOfScannedFilm"],2041:["SQ","1","BiopsyTargetSequence"],2042:["UI","1","TargetUID"],2043:["FL","2","LocalizingCursorPosition"],2044:["FL","3","CalculatedTargetPosition"],2045:["SH","1","TargetLabel"],2046:["FL","1","DisplayedZValue"],3100:["CS","1","IVUSAcquisition"],3101:["DS","1","IVUSPullbackRate"],3102:["DS","1","IVUSGatedRate"],3103:["IS","1","IVUSPullbackStartFrameNumber"],3104:["IS","1","IVUSPullbackStopFrameNumber"],3105:["IS","1-n","LesionNumber"],4e3:["LT","1","AcquisitionComments"],5e3:["SH","1-n","OutputPower"],5010:["LO","1-n","TransducerData"],5011:["SQ","1","TransducerIdentificationSequence"],5012:["DS","1","FocusDepth"],5020:["LO","1","ProcessingFunction"],5021:["LO","1","PostprocessingFunction"],5022:["DS","1","MechanicalIndex"],5024:["DS","1","BoneThermalIndex"],5026:["DS","1","CranialThermalIndex"],5027:["DS","1","SoftTissueThermalIndex"],5028:["DS","1","SoftTissueFocusThermalIndex"],5029:["DS","1","SoftTissueSurfaceThermalIndex"],5030:["DS","1","DynamicRange"],5040:["DS","1","TotalGain"],5050:["IS","1","DepthOfScanField"],5100:["CS","1","PatientPosition"],5101:["CS","1","ViewPosition"],5104:["SQ","1","ProjectionEponymousNameCodeSequence"],5210:["DS","6","ImageTransformationMatrix"],5212:["DS","3","ImageTranslationVector"],6e3:["DS","1","Sensitivity"],6011:["SQ","1","SequenceOfUltrasoundRegions"],6012:["US","1","RegionSpatialFormat"],6014:["US","1","RegionDataType"],6016:["UL","1","RegionFlags"],6018:["UL","1","RegionLocationMinX0"],"601A":["UL","1","RegionLocationMinY0"],"601C":["UL","1","RegionLocationMaxX1"],"601E":["UL","1","RegionLocationMaxY1"],6020:["SL","1","ReferencePixelX0"],6022:["SL","1","ReferencePixelY0"],6024:["US","1","PhysicalUnitsXDirection"],6026:["US","1","PhysicalUnitsYDirection"],6028:["FD","1","ReferencePixelPhysicalValueX"],"602A":["FD","1","ReferencePixelPhysicalValueY"],"602C":["FD","1","PhysicalDeltaX"],"602E":["FD","1","PhysicalDeltaY"],6030:["UL","1","TransducerFrequency"],6031:["CS","1","TransducerType"],6032:["UL","1","PulseRepetitionFrequency"],6034:["FD","1","DopplerCorrectionAngle"],6036:["FD","1","SteeringAngle"],6038:["UL","1","DopplerSampleVolumeXPositionRetired"],6039:["SL","1","DopplerSampleVolumeXPosition"],"603A":["UL","1","DopplerSampleVolumeYPositionRetired"],"603B":["SL","1","DopplerSampleVolumeYPosition"],"603C":["UL","1","TMLinePositionX0Retired"],"603D":["SL","1","TMLinePositionX0"],"603E":["UL","1","TMLinePositionY0Retired"],"603F":["SL","1","TMLinePositionY0"],6040:["UL","1","TMLinePositionX1Retired"],6041:["SL","1","TMLinePositionX1"],6042:["UL","1","TMLinePositionY1Retired"],6043:["SL","1","TMLinePositionY1"],6044:["US","1","PixelComponentOrganization"],6046:["UL","1","PixelComponentMask"],6048:["UL","1","PixelComponentRangeStart"],"604A":["UL","1","PixelComponentRangeStop"],"604C":["US","1","PixelComponentPhysicalUnits"],"604E":["US","1","PixelComponentDataType"],6050:["UL","1","NumberOfTableBreakPoints"],6052:["UL","1-n","TableOfXBreakPoints"],6054:["FD","1-n","TableOfYBreakPoints"],6056:["UL","1","NumberOfTableEntries"],6058:["UL","1-n","TableOfPixelValues"],"605A":["FL","1-n","TableOfParameterValues"],6060:["FL","1-n","RWaveTimeVector"],6070:["US","1","ActiveImageAreaOverlayGroup"],7e3:["CS","1","DetectorConditionsNominalFlag"],7001:["DS","1","DetectorTemperature"],7004:["CS","1","DetectorType"],7005:["CS","1","DetectorConfiguration"],7006:["LT","1","DetectorDescription"],7008:["LT","1","DetectorMode"],"700A":["SH","1","DetectorID"],"700C":["DA","1","DateOfLastDetectorCalibration"],"700E":["TM","1","TimeOfLastDetectorCalibration"],7010:["IS","1","ExposuresOnDetectorSinceLastCalibration"],7011:["IS","1","ExposuresOnDetectorSinceManufactured"],7012:["DS","1","DetectorTimeSinceLastExposure"],7014:["DS","1","DetectorActiveTime"],7016:["DS","1","DetectorActivationOffsetFromExposure"],"701A":["DS","2","DetectorBinning"],7020:["DS","2","DetectorElementPhysicalSize"],7022:["DS","2","DetectorElementSpacing"],7024:["CS","1","DetectorActiveShape"],7026:["DS","1-2","DetectorActiveDimensions"],7028:["DS","2","DetectorActiveOrigin"],"702A":["LO","1","DetectorManufacturerName"],"702B":["LO","1","DetectorManufacturerModelName"],7030:["DS","2","FieldOfViewOrigin"],7032:["DS","1","FieldOfViewRotation"],7034:["CS","1","FieldOfViewHorizontalFlip"],7036:["FL","2","PixelDataAreaOriginRelativeToFOV"],7038:["FL","1","PixelDataAreaRotationAngleRelativeToFOV"],7040:["LT","1","GridAbsorbingMaterial"],7041:["LT","1","GridSpacingMaterial"],7042:["DS","1","GridThickness"],7044:["DS","1","GridPitch"],7046:["IS","2","GridAspectRatio"],7048:["DS","1","GridPeriod"],"704C":["DS","1","GridFocalDistance"],7050:["CS","1-n","FilterMaterial"],7052:["DS","1-n","FilterThicknessMinimum"],7054:["DS","1-n","FilterThicknessMaximum"],7056:["FL","1-n","FilterBeamPathLengthMinimum"],7058:["FL","1-n","FilterBeamPathLengthMaximum"],7060:["CS","1","ExposureControlMode"],7062:["LT","1","ExposureControlModeDescription"],7064:["CS","1","ExposureStatus"],7065:["DS","1","PhototimerSetting"],8150:["DS","1","ExposureTimeInuS"],8151:["DS","1","XRayTubeCurrentInuA"],9004:["CS","1","ContentQualification"],9005:["SH","1","PulseSequenceName"],9006:["SQ","1","MRImagingModifierSequence"],9008:["CS","1","EchoPulseSequence"],9009:["CS","1","InversionRecovery"],9010:["CS","1","FlowCompensation"],9011:["CS","1","MultipleSpinEcho"],9012:["CS","1","MultiPlanarExcitation"],9014:["CS","1","PhaseContrast"],9015:["CS","1","TimeOfFlightContrast"],9016:["CS","1","Spoiling"],9017:["CS","1","SteadyStatePulseSequence"],9018:["CS","1","EchoPlanarPulseSequence"],9019:["FD","1","TagAngleFirstAxis"],9020:["CS","1","MagnetizationTransfer"],9021:["CS","1","T2Preparation"],9022:["CS","1","BloodSignalNulling"],9024:["CS","1","SaturationRecovery"],9025:["CS","1","SpectrallySelectedSuppression"],9026:["CS","1","SpectrallySelectedExcitation"],9027:["CS","1","SpatialPresaturation"],9028:["CS","1","Tagging"],9029:["CS","1","OversamplingPhase"],9030:["FD","1","TagSpacingFirstDimension"],9032:["CS","1","GeometryOfKSpaceTraversal"],9033:["CS","1","SegmentedKSpaceTraversal"],9034:["CS","1","RectilinearPhaseEncodeReordering"],9035:["FD","1","TagThickness"],9036:["CS","1","PartialFourierDirection"],9037:["CS","1","CardiacSynchronizationTechnique"],9041:["LO","1","ReceiveCoilManufacturerName"],9042:["SQ","1","MRReceiveCoilSequence"],9043:["CS","1","ReceiveCoilType"],9044:["CS","1","QuadratureReceiveCoil"],9045:["SQ","1","MultiCoilDefinitionSequence"],9046:["LO","1","MultiCoilConfiguration"],9047:["SH","1","MultiCoilElementName"],9048:["CS","1","MultiCoilElementUsed"],9049:["SQ","1","MRTransmitCoilSequence"],9050:["LO","1","TransmitCoilManufacturerName"],9051:["CS","1","TransmitCoilType"],9052:["FD","1-2","SpectralWidth"],9053:["FD","1-2","ChemicalShiftReference"],9054:["CS","1","VolumeLocalizationTechnique"],9058:["US","1","MRAcquisitionFrequencyEncodingSteps"],9059:["CS","1","Decoupling"],9060:["CS","1-2","DecoupledNucleus"],9061:["FD","1-2","DecouplingFrequency"],9062:["CS","1","DecouplingMethod"],9063:["FD","1-2","DecouplingChemicalShiftReference"],9064:["CS","1","KSpaceFiltering"],9065:["CS","1-2","TimeDomainFiltering"],9066:["US","1-2","NumberOfZeroFills"],9067:["CS","1","BaselineCorrection"],9069:["FD","1","ParallelReductionFactorInPlane"],9070:["FD","1","CardiacRRIntervalSpecified"],9073:["FD","1","AcquisitionDuration"],9074:["DT","1","FrameAcquisitionDateTime"],9075:["CS","1","DiffusionDirectionality"],9076:["SQ","1","DiffusionGradientDirectionSequence"],9077:["CS","1","ParallelAcquisition"],9078:["CS","1","ParallelAcquisitionTechnique"],9079:["FD","1-n","InversionTimes"],9080:["ST","1","MetaboliteMapDescription"],9081:["CS","1","PartialFourier"],9082:["FD","1","EffectiveEchoTime"],9083:["SQ","1","MetaboliteMapCodeSequence"],9084:["SQ","1","ChemicalShiftSequence"],9085:["CS","1","CardiacSignalSource"],9087:["FD","1","DiffusionBValue"],9089:["FD","3","DiffusionGradientOrientation"],9090:["FD","3","VelocityEncodingDirection"],9091:["FD","1","VelocityEncodingMinimumValue"],9092:["SQ","1","VelocityEncodingAcquisitionSequence"],9093:["US","1","NumberOfKSpaceTrajectories"],9094:["CS","1","CoverageOfKSpace"],9095:["UL","1","SpectroscopyAcquisitionPhaseRows"],9096:["FD","1","ParallelReductionFactorInPlaneRetired"],9098:["FD","1-2","TransmitterFrequency"],9100:["CS","1-2","ResonantNucleus"],9101:["CS","1","FrequencyCorrection"],9103:["SQ","1","MRSpectroscopyFOVGeometrySequence"],9104:["FD","1","SlabThickness"],9105:["FD","3","SlabOrientation"],9106:["FD","3","MidSlabPosition"],9107:["SQ","1","MRSpatialSaturationSequence"],9112:["SQ","1","MRTimingAndRelatedParametersSequence"],9114:["SQ","1","MREchoSequence"],9115:["SQ","1","MRModifierSequence"],9117:["SQ","1","MRDiffusionSequence"],9118:["SQ","1","CardiacSynchronizationSequence"],9119:["SQ","1","MRAveragesSequence"],9125:["SQ","1","MRFOVGeometrySequence"],9126:["SQ","1","VolumeLocalizationSequence"],9127:["UL","1","SpectroscopyAcquisitionDataColumns"],9147:["CS","1","DiffusionAnisotropyType"],9151:["DT","1","FrameReferenceDateTime"],9152:["SQ","1","MRMetaboliteMapSequence"],9155:["FD","1","ParallelReductionFactorOutOfPlane"],9159:["UL","1","SpectroscopyAcquisitionOutOfPlanePhaseSteps"],9166:["CS","1","BulkMotionStatus"],9168:["FD","1","ParallelReductionFactorSecondInPlane"],9169:["CS","1","CardiacBeatRejectionTechnique"],9170:["CS","1","RespiratoryMotionCompensationTechnique"],9171:["CS","1","RespiratorySignalSource"],9172:["CS","1","BulkMotionCompensationTechnique"],9173:["CS","1","BulkMotionSignalSource"],9174:["CS","1","ApplicableSafetyStandardAgency"],9175:["LO","1","ApplicableSafetyStandardDescription"],9176:["SQ","1","OperatingModeSequence"],9177:["CS","1","OperatingModeType"],9178:["CS","1","OperatingMode"],9179:["CS","1","SpecificAbsorptionRateDefinition"],9180:["CS","1","GradientOutputType"],9181:["FD","1","SpecificAbsorptionRateValue"],9182:["FD","1","GradientOutput"],9183:["CS","1","FlowCompensationDirection"],9184:["FD","1","TaggingDelay"],9185:["ST","1","RespiratoryMotionCompensationTechniqueDescription"],9186:["SH","1","RespiratorySignalSourceID"],9195:["FD","1","ChemicalShiftMinimumIntegrationLimitInHz"],9196:["FD","1","ChemicalShiftMaximumIntegrationLimitInHz"],9197:["SQ","1","MRVelocityEncodingSequence"],9198:["CS","1","FirstOrderPhaseCorrection"],9199:["CS","1","WaterReferencedPhaseCorrection"],9200:["CS","1","MRSpectroscopyAcquisitionType"],9214:["CS","1","RespiratoryCyclePosition"],9217:["FD","1","VelocityEncodingMaximumValue"],9218:["FD","1","TagSpacingSecondDimension"],9219:["SS","1","TagAngleSecondAxis"],9220:["FD","1","FrameAcquisitionDuration"],9226:["SQ","1","MRImageFrameTypeSequence"],9227:["SQ","1","MRSpectroscopyFrameTypeSequence"],9231:["US","1","MRAcquisitionPhaseEncodingStepsInPlane"],9232:["US","1","MRAcquisitionPhaseEncodingStepsOutOfPlane"],9234:["UL","1","SpectroscopyAcquisitionPhaseColumns"],9236:["CS","1","CardiacCyclePosition"],9239:["SQ","1","SpecificAbsorptionRateSequence"],9240:["US","1","RFEchoTrainLength"],9241:["US","1","GradientEchoTrainLength"],9250:["CS","1","ArterialSpinLabelingContrast"],9251:["SQ","1","MRArterialSpinLabelingSequence"],9252:["LO","1","ASLTechniqueDescription"],9253:["US","1","ASLSlabNumber"],9254:["FD","1","ASLSlabThickness"],9255:["FD","3","ASLSlabOrientation"],9256:["FD","3","ASLMidSlabPosition"],9257:["CS","1","ASLContext"],9258:["UL","1","ASLPulseTrainDuration"],9259:["CS","1","ASLCrusherFlag"],"925A":["FD","1","ASLCrusherFlowLimit"],"925B":["LO","1","ASLCrusherDescription"],"925C":["CS","1","ASLBolusCutoffFlag"],"925D":["SQ","1","ASLBolusCutoffTimingSequence"],"925E":["LO","1","ASLBolusCutoffTechnique"],"925F":["UL","1","ASLBolusCutoffDelayTime"],9260:["SQ","1","ASLSlabSequence"],9295:["FD","1","ChemicalShiftMinimumIntegrationLimitInppm"],9296:["FD","1","ChemicalShiftMaximumIntegrationLimitInppm"],9297:["CS","1","WaterReferenceAcquisition"],9298:["IS","1","EchoPeakPosition"],9301:["SQ","1","CTAcquisitionTypeSequence"],9302:["CS","1","AcquisitionType"],9303:["FD","1","TubeAngle"],9304:["SQ","1","CTAcquisitionDetailsSequence"],9305:["FD","1","RevolutionTime"],9306:["FD","1","SingleCollimationWidth"],9307:["FD","1","TotalCollimationWidth"],9308:["SQ","1","CTTableDynamicsSequence"],9309:["FD","1","TableSpeed"],9310:["FD","1","TableFeedPerRotation"],9311:["FD","1","SpiralPitchFactor"],9312:["SQ","1","CTGeometrySequence"],9313:["FD","3","DataCollectionCenterPatient"],9314:["SQ","1","CTReconstructionSequence"],9315:["CS","1","ReconstructionAlgorithm"],9316:["CS","1","ConvolutionKernelGroup"],9317:["FD","2","ReconstructionFieldOfView"],9318:["FD","3","ReconstructionTargetCenterPatient"],9319:["FD","1","ReconstructionAngle"],9320:["SH","1","ImageFilter"],9321:["SQ","1","CTExposureSequence"],9322:["FD","2","ReconstructionPixelSpacing"],9323:["CS","1-n","ExposureModulationType"],9324:["FD","1","EstimatedDoseSaving"],9325:["SQ","1","CTXRayDetailsSequence"],9326:["SQ","1","CTPositionSequence"],9327:["FD","1","TablePosition"],9328:["FD","1","ExposureTimeInms"],9329:["SQ","1","CTImageFrameTypeSequence"],9330:["FD","1","XRayTubeCurrentInmA"],9332:["FD","1","ExposureInmAs"],9333:["CS","1","ConstantVolumeFlag"],9334:["CS","1","FluoroscopyFlag"],9335:["FD","1","DistanceSourceToDataCollectionCenter"],9337:["US","1","ContrastBolusAgentNumber"],9338:["SQ","1","ContrastBolusIngredientCodeSequence"],9340:["SQ","1","ContrastAdministrationProfileSequence"],9341:["SQ","1","ContrastBolusUsageSequence"],9342:["CS","1","ContrastBolusAgentAdministered"],9343:["CS","1","ContrastBolusAgentDetected"],9344:["CS","1","ContrastBolusAgentPhase"],9345:["FD","1","CTDIvol"],9346:["SQ","1","CTDIPhantomTypeCodeSequence"],9351:["FL","1","CalciumScoringMassFactorPatient"],9352:["FL","3","CalciumScoringMassFactorDevice"],9353:["FL","1","EnergyWeightingFactor"],9360:["SQ","1","CTAdditionalXRaySourceSequence"],9361:["CS","1","MultienergyCTAcquisition"],9362:["SQ","1","MultienergyCTAcquisitionSequence"],9363:["SQ","1","MultienergyCTProcessingSequence"],9364:["SQ","1","MultienergyCTCharacteristicsSequence"],9365:["SQ","1","MultienergyCTXRaySourceSequence"],9366:["US","1","XRaySourceIndex"],9367:["UC","1","XRaySourceID"],9368:["CS","1","MultienergySourceTechnique"],9369:["DT","1","SourceStartDateTime"],"936A":["DT","1","SourceEndDateTime"],"936B":["US","1","SwitchingPhaseNumber"],"936C":["DS","1","SwitchingPhaseNominalDuration"],"936D":["DS","1","SwitchingPhaseTransitionDuration"],"936E":["DS","1","EffectiveBinEnergy"],"936F":["SQ","1","MultienergyCTXRayDetectorSequence"],9370:["US","1","XRayDetectorIndex"],9371:["UC","1","XRayDetectorID"],9372:["CS","1","MultienergyDetectorType"],9373:["ST","1","XRayDetectorLabel"],9374:["DS","1","NominalMaxEnergy"],9375:["DS","1","NominalMinEnergy"],9376:["US","1-n","ReferencedXRayDetectorIndex"],9377:["US","1-n","ReferencedXRaySourceIndex"],9378:["US","1-n","ReferencedPathIndex"],9379:["SQ","1","MultienergyCTPathSequence"],"937A":["US","1","MultienergyCTPathIndex"],"937B":["UT","1","MultienergyAcquisitionDescription"],"937C":["FD","1","MonoenergeticEnergyEquivalent"],"937D":["SQ","1","MaterialCodeSequence"],"937E":["CS","1","DecompositionMethod"],"937F":["UT","1","DecompositionDescription"],9380:["SQ","1","DecompositionAlgorithmIdentificationSequence"],9381:["SQ","1","DecompositionMaterialSequence"],9382:["SQ","1","MaterialAttenuationSequence"],9383:["DS","1","PhotonEnergy"],9384:["DS","1","XRayMassAttenuationCoefficient"],9401:["SQ","1","ProjectionPixelCalibrationSequence"],9402:["FL","1","DistanceSourceToIsocenter"],9403:["FL","1","DistanceObjectToTableTop"],9404:["FL","2","ObjectPixelSpacingInCenterOfBeam"],9405:["SQ","1","PositionerPositionSequence"],9406:["SQ","1","TablePositionSequence"],9407:["SQ","1","CollimatorShapeSequence"],9410:["CS","1","PlanesInAcquisition"],9412:["SQ","1","XAXRFFrameCharacteristicsSequence"],9417:["SQ","1","FrameAcquisitionSequence"],9420:["CS","1","XRayReceptorType"],9423:["LO","1","AcquisitionProtocolName"],9424:["LT","1","AcquisitionProtocolDescription"],9425:["CS","1","ContrastBolusIngredientOpaque"],9426:["FL","1","DistanceReceptorPlaneToDetectorHousing"],9427:["CS","1","IntensifierActiveShape"],9428:["FL","1-2","IntensifierActiveDimensions"],9429:["FL","2","PhysicalDetectorSize"],9430:["FL","2","PositionOfIsocenterProjection"],9432:["SQ","1","FieldOfViewSequence"],9433:["LO","1","FieldOfViewDescription"],9434:["SQ","1","ExposureControlSensingRegionsSequence"],9435:["CS","1","ExposureControlSensingRegionShape"],9436:["SS","1","ExposureControlSensingRegionLeftVerticalEdge"],9437:["SS","1","ExposureControlSensingRegionRightVerticalEdge"],9438:["SS","1","ExposureControlSensingRegionUpperHorizontalEdge"],9439:["SS","1","ExposureControlSensingRegionLowerHorizontalEdge"],9440:["SS","2","CenterOfCircularExposureControlSensingRegion"],9441:["US","1","RadiusOfCircularExposureControlSensingRegion"],9442:["SS","2-n","VerticesOfThePolygonalExposureControlSensingRegion"],9445:["","",""],9447:["FL","1","ColumnAngulationPatient"],9449:["FL","1","BeamAngle"],9451:["SQ","1","FrameDetectorParametersSequence"],9452:["FL","1","CalculatedAnatomyThickness"],9455:["SQ","1","CalibrationSequence"],9456:["SQ","1","ObjectThicknessSequence"],9457:["CS","1","PlaneIdentification"],9461:["FL","1-2","FieldOfViewDimensionsInFloat"],9462:["SQ","1","IsocenterReferenceSystemSequence"],9463:["FL","1","PositionerIsocenterPrimaryAngle"],9464:["FL","1","PositionerIsocenterSecondaryAngle"],9465:["FL","1","PositionerIsocenterDetectorRotationAngle"],9466:["FL","1","TableXPositionToIsocenter"],9467:["FL","1","TableYPositionToIsocenter"],9468:["FL","1","TableZPositionToIsocenter"],9469:["FL","1","TableHorizontalRotationAngle"],9470:["FL","1","TableHeadTiltAngle"],9471:["FL","1","TableCradleTiltAngle"],9472:["SQ","1","FrameDisplayShutterSequence"],9473:["FL","1","AcquiredImageAreaDoseProduct"],9474:["CS","1","CArmPositionerTabletopRelationship"],9476:["SQ","1","XRayGeometrySequence"],9477:["SQ","1","IrradiationEventIdentificationSequence"],9504:["SQ","1","XRay3DFrameTypeSequence"],9506:["SQ","1","ContributingSourcesSequence"],9507:["SQ","1","XRay3DAcquisitionSequence"],9508:["FL","1","PrimaryPositionerScanArc"],9509:["FL","1","SecondaryPositionerScanArc"],9510:["FL","1","PrimaryPositionerScanStartAngle"],9511:["FL","1","SecondaryPositionerScanStartAngle"],9514:["FL","1","PrimaryPositionerIncrement"],9515:["FL","1","SecondaryPositionerIncrement"],9516:["DT","1","StartAcquisitionDateTime"],9517:["DT","1","EndAcquisitionDateTime"],9518:["SS","1","PrimaryPositionerIncrementSign"],9519:["SS","1","SecondaryPositionerIncrementSign"],9524:["LO","1","ApplicationName"],9525:["LO","1","ApplicationVersion"],9526:["LO","1","ApplicationManufacturer"],9527:["CS","1","AlgorithmType"],9528:["LO","1","AlgorithmDescription"],9530:["SQ","1","XRay3DReconstructionSequence"],9531:["LO","1","ReconstructionDescription"],9538:["SQ","1","PerProjectionAcquisitionSequence"],9541:["SQ","1","DetectorPositionSequence"],9542:["SQ","1","XRayAcquisitionDoseSequence"],9543:["FD","1","XRaySourceIsocenterPrimaryAngle"],9544:["FD","1","XRaySourceIsocenterSecondaryAngle"],9545:["FD","1","BreastSupportIsocenterPrimaryAngle"],9546:["FD","1","BreastSupportIsocenterSecondaryAngle"],9547:["FD","1","BreastSupportXPositionToIsocenter"],9548:["FD","1","BreastSupportYPositionToIsocenter"],9549:["FD","1","BreastSupportZPositionToIsocenter"],9550:["FD","1","DetectorIsocenterPrimaryAngle"],9551:["FD","1","DetectorIsocenterSecondaryAngle"],9552:["FD","1","DetectorXPositionToIsocenter"],9553:["FD","1","DetectorYPositionToIsocenter"],9554:["FD","1","DetectorZPositionToIsocenter"],9555:["SQ","1","XRayGridSequence"],9556:["SQ","1","XRayFilterSequence"],9557:["FD","3","DetectorActiveAreaTLHCPosition"],9558:["FD","6","DetectorActiveAreaOrientation"],9559:["CS","1","PositionerPrimaryAngleDirection"],9601:["SQ","1","DiffusionBMatrixSequence"],9602:["FD","1","DiffusionBValueXX"],9603:["FD","1","DiffusionBValueXY"],9604:["FD","1","DiffusionBValueXZ"],9605:["FD","1","DiffusionBValueYY"],9606:["FD","1","DiffusionBValueYZ"],9607:["FD","1","DiffusionBValueZZ"],9621:["SQ","1","FunctionalMRSequence"],9622:["CS","1","FunctionalSettlingPhaseFramesPresent"],9623:["DT","1","FunctionalSyncPulse"],9624:["CS","1","SettlingPhaseFrame"],9701:["DT","1","DecayCorrectionDateTime"],9715:["FD","1","StartDensityThreshold"],9716:["FD","1","StartRelativeDensityDifferenceThreshold"],9717:["FD","1","StartCardiacTriggerCountThreshold"],9718:["FD","1","StartRespiratoryTriggerCountThreshold"],9719:["FD","1","TerminationCountsThreshold"],9720:["FD","1","TerminationDensityThreshold"],9721:["FD","1","TerminationRelativeDensityThreshold"],9722:["FD","1","TerminationTimeThreshold"],9723:["FD","1","TerminationCardiacTriggerCountThreshold"],9724:["FD","1","TerminationRespiratoryTriggerCountThreshold"],9725:["CS","1","DetectorGeometry"],9726:["FD","1","TransverseDetectorSeparation"],9727:["FD","1","AxialDetectorDimension"],9729:["US","1","RadiopharmaceuticalAgentNumber"],9732:["SQ","1","PETFrameAcquisitionSequence"],9733:["SQ","1","PETDetectorMotionDetailsSequence"],9734:["SQ","1","PETTableDynamicsSequence"],9735:["SQ","1","PETPositionSequence"],9736:["SQ","1","PETFrameCorrectionFactorsSequence"],9737:["SQ","1","RadiopharmaceuticalUsageSequence"],9738:["CS","1","AttenuationCorrectionSource"],9739:["US","1","NumberOfIterations"],9740:["US","1","NumberOfSubsets"],9749:["SQ","1","PETReconstructionSequence"],9751:["SQ","1","PETFrameTypeSequence"],9755:["CS","1","TimeOfFlightInformationUsed"],9756:["CS","1","ReconstructionType"],9758:["CS","1","DecayCorrected"],9759:["CS","1","AttenuationCorrected"],9760:["CS","1","ScatterCorrected"],9761:["CS","1","DeadTimeCorrected"],9762:["CS","1","GantryMotionCorrected"],9763:["CS","1","PatientMotionCorrected"],9764:["CS","1","CountLossNormalizationCorrected"],9765:["CS","1","RandomsCorrected"],9766:["CS","1","NonUniformRadialSamplingCorrected"],9767:["CS","1","SensitivityCalibrated"],9768:["CS","1","DetectorNormalizationCorrection"],9769:["CS","1","IterativeReconstructionMethod"],9770:["CS","1","AttenuationCorrectionTemporalRelationship"],9771:["SQ","1","PatientPhysiologicalStateSequence"],9772:["SQ","1","PatientPhysiologicalStateCodeSequence"],9801:["FD","1-n","DepthsOfFocus"],9803:["SQ","1","ExcludedIntervalsSequence"],9804:["DT","1","ExclusionStartDateTime"],9805:["FD","1","ExclusionDuration"],9806:["SQ","1","USImageDescriptionSequence"],9807:["SQ","1","ImageDataTypeSequence"],9808:["CS","1","DataType"],9809:["SQ","1","TransducerScanPatternCodeSequence"],"980B":["CS","1","AliasedDataType"],"980C":["CS","1","PositionMeasuringDeviceUsed"],"980D":["SQ","1","TransducerGeometryCodeSequence"],"980E":["SQ","1","TransducerBeamSteeringCodeSequence"],"980F":["SQ","1","TransducerApplicationCodeSequence"],9810:["xs","1","ZeroVelocityPixelValue"],9900:["LO","1","ReferenceLocationLabel"],9901:["UT","1","ReferenceLocationDescription"],9902:["SQ","1","ReferenceBasisCodeSequence"],9903:["SQ","1","ReferenceGeometryCodeSequence"],9904:["DS","1","OffsetDistance"],9905:["CS","1","OffsetDirection"],9906:["SQ","1","PotentialScheduledProtocolCodeSequence"],9907:["SQ","1","PotentialRequestedProcedureCodeSequence"],9908:["UC","1-n","PotentialReasonsForProcedure"],9909:["SQ","1","PotentialReasonsForProcedureCodeSequence"],"990A":["UC","1-n","PotentialDiagnosticTasks"],"990B":["SQ","1","ContraindicationsCodeSequence"],"990C":["SQ","1","ReferencedDefinedProtocolSequence"],"990D":["SQ","1","ReferencedPerformedProtocolSequence"],"990E":["SQ","1","PredecessorProtocolSequence"],"990F":["UT","1","ProtocolPlanningInformation"],9910:["UT","1","ProtocolDesignRationale"],9911:["SQ","1","PatientSpecificationSequence"],9912:["SQ","1","ModelSpecificationSequence"],9913:["SQ","1","ParametersSpecificationSequence"],9914:["SQ","1","InstructionSequence"],9915:["US","1","InstructionIndex"],9916:["LO","1","InstructionText"],9917:["UT","1","InstructionDescription"],9918:["CS","1","InstructionPerformedFlag"],9919:["DT","1","InstructionPerformedDateTime"],"991A":["UT","1","InstructionPerformanceComment"],"991B":["SQ","1","PatientPositioningInstructionSequence"],"991C":["SQ","1","PositioningMethodCodeSequence"],"991D":["SQ","1","PositioningLandmarkSequence"],"991E":["UI","1","TargetFrameOfReferenceUID"],"991F":["SQ","1","AcquisitionProtocolElementSpecificationSequence"],9920:["SQ","1","AcquisitionProtocolElementSequence"],9921:["US","1","ProtocolElementNumber"],9922:["LO","1","ProtocolElementName"],9923:["UT","1","ProtocolElementCharacteristicsSummary"],9924:["UT","1","ProtocolElementPurpose"],9930:["CS","1","AcquisitionMotion"],9931:["SQ","1","AcquisitionStartLocationSequence"],9932:["SQ","1","AcquisitionEndLocationSequence"],9933:["SQ","1","ReconstructionProtocolElementSpecificationSequence"],9934:["SQ","1","ReconstructionProtocolElementSequence"],9935:["SQ","1","StorageProtocolElementSpecificationSequence"],9936:["SQ","1","StorageProtocolElementSequence"],9937:["LO","1","RequestedSeriesDescription"],9938:["US","1-n","SourceAcquisitionProtocolElementNumber"],9939:["US","1-n","SourceAcquisitionBeamNumber"],"993A":["US","1-n","SourceReconstructionProtocolElementNumber"],"993B":["SQ","1","ReconstructionStartLocationSequence"],"993C":["SQ","1","ReconstructionEndLocationSequence"],"993D":["SQ","1","ReconstructionAlgorithmSequence"],"993E":["SQ","1","ReconstructionTargetCenterLocationSequence"],9941:["UT","1","ImageFilterDescription"],9942:["FD","1","CTDIvolNotificationTrigger"],9943:["FD","1","DLPNotificationTrigger"],9944:["CS","1","AutoKVPSelectionType"],9945:["FD","1","AutoKVPUpperBound"],9946:["FD","1","AutoKVPLowerBound"],9947:["CS","1","ProtocolDefinedPatientPosition"],A001:["SQ","1","ContributingEquipmentSequence"],A002:["DT","1","ContributionDateTime"],A003:["ST","1","ContributionDescription"]},"0020":{"0000":["UL","1","GenericGroupLength"],"000D":["UI","1","StudyInstanceUID"],"000E":["UI","1","SeriesInstanceUID"],"0010":["SH","1","StudyID"],"0011":["IS","1","SeriesNumber"],"0012":["IS","1","AcquisitionNumber"],"0013":["IS","1","InstanceNumber"],"0014":["IS","1","IsotopeNumber"],"0015":["IS","1","PhaseNumber"],"0016":["IS","1","IntervalNumber"],"0017":["IS","1","TimeSlotNumber"],"0018":["IS","1","AngleNumber"],"0019":["IS","1","ItemNumber"],"0020":["CS","2","PatientOrientation"],"0022":["IS","1","OverlayNumber"],"0024":["IS","1","CurveNumber"],"0026":["IS","1","LUTNumber"],"0030":["DS","3","ImagePosition"],"0032":["DS","3","ImagePositionPatient"],"0035":["DS","6","ImageOrientation"],"0037":["DS","6","ImageOrientationPatient"],"0050":["DS","1","Location"],"0052":["UI","1","FrameOfReferenceUID"],"0060":["CS","1","Laterality"],"0062":["CS","1","ImageLaterality"],"0070":["LO","1","ImageGeometryType"],"0080":["CS","1-n","MaskingImage"],"00AA":["IS","1","ReportNumber"],"0100":["IS","1","TemporalPositionIdentifier"],"0105":["IS","1","NumberOfTemporalPositions"],"0110":["DS","1","TemporalResolution"],"0200":["UI","1","SynchronizationFrameOfReferenceUID"],"0242":["UI","1","SOPInstanceUIDOfConcatenationSource"],1e3:["IS","1","SeriesInStudy"],1001:["IS","1","AcquisitionsInSeries"],1002:["IS","1","ImagesInAcquisition"],1003:["IS","1","ImagesInSeries"],1004:["IS","1","AcquisitionsInStudy"],1005:["IS","1","ImagesInStudy"],1020:["LO","1-n","Reference"],"103F":["LO","1","TargetPositionReferenceIndicator"],1040:["LO","1","PositionReferenceIndicator"],1041:["DS","1","SliceLocation"],1070:["IS","1-n","OtherStudyNumbers"],1200:["IS","1","NumberOfPatientRelatedStudies"],1202:["IS","1","NumberOfPatientRelatedSeries"],1204:["IS","1","NumberOfPatientRelatedInstances"],1206:["IS","1","NumberOfStudyRelatedSeries"],1208:["IS","1","NumberOfStudyRelatedInstances"],1209:["IS","1","NumberOfSeriesRelatedInstances"],3100:["CS","1-n","SourceImageIDs"],3401:["CS","1","ModifyingDeviceID"],3402:["CS","1","ModifiedImageID"],3403:["DA","1","ModifiedImageDate"],3404:["LO","1","ModifyingDeviceManufacturer"],3405:["TM","1","ModifiedImageTime"],3406:["LO","1","ModifiedImageDescription"],4e3:["LT","1","ImageComments"],5e3:["AT","1-n","OriginalImageIdentification"],5002:["LO","1-n","OriginalImageIdentificationNomenclature"],9056:["SH","1","StackID"],9057:["UL","1","InStackPositionNumber"],9071:["SQ","1","FrameAnatomySequence"],9072:["CS","1","FrameLaterality"],9111:["SQ","1","FrameContentSequence"],9113:["SQ","1","PlanePositionSequence"],9116:["SQ","1","PlaneOrientationSequence"],9128:["UL","1","TemporalPositionIndex"],9153:["FD","1","NominalCardiacTriggerDelayTime"],9154:["FL","1","NominalCardiacTriggerTimePriorToRPeak"],9155:["FL","1","ActualCardiacTriggerTimePriorToRPeak"],9156:["US","1","FrameAcquisitionNumber"],9157:["UL","1-n","DimensionIndexValues"],9158:["LT","1","FrameComments"],9161:["UI","1","ConcatenationUID"],9162:["US","1","InConcatenationNumber"],9163:["US","1","InConcatenationTotalNumber"],9164:["UI","1","DimensionOrganizationUID"],9165:["AT","1","DimensionIndexPointer"],9167:["AT","1","FunctionalGroupPointer"],9170:["SQ","1","UnassignedSharedConvertedAttributesSequence"],9171:["SQ","1","UnassignedPerFrameConvertedAttributesSequence"],9172:["SQ","1","ConversionSourceAttributesSequence"],9213:["LO","1","DimensionIndexPrivateCreator"],9221:["SQ","1","DimensionOrganizationSequence"],9222:["SQ","1","DimensionIndexSequence"],9228:["UL","1","ConcatenationFrameOffsetNumber"],9238:["LO","1","FunctionalGroupPrivateCreator"],9241:["FL","1","NominalPercentageOfCardiacPhase"],9245:["FL","1","NominalPercentageOfRespiratoryPhase"],9246:["FL","1","StartingRespiratoryAmplitude"],9247:["CS","1","StartingRespiratoryPhase"],9248:["FL","1","EndingRespiratoryAmplitude"],9249:["CS","1","EndingRespiratoryPhase"],9250:["CS","1","RespiratoryTriggerType"],9251:["FD","1","RRIntervalTimeNominal"],9252:["FD","1","ActualCardiacTriggerDelayTime"],9253:["SQ","1","RespiratorySynchronizationSequence"],9254:["FD","1","RespiratoryIntervalTime"],9255:["FD","1","NominalRespiratoryTriggerDelayTime"],9256:["FD","1","RespiratoryTriggerDelayThreshold"],9257:["FD","1","ActualRespiratoryTriggerDelayTime"],9301:["FD","3","ImagePositionVolume"],9302:["FD","6","ImageOrientationVolume"],9307:["CS","1","UltrasoundAcquisitionGeometry"],9308:["FD","3","ApexPosition"],9309:["FD","16","VolumeToTransducerMappingMatrix"],"930A":["FD","16","VolumeToTableMappingMatrix"],"930B":["CS","1","VolumeToTransducerRelationship"],"930C":["CS","1","PatientFrameOfReferenceSource"],"930D":["FD","1","TemporalPositionTimeOffset"],"930E":["SQ","1","PlanePositionVolumeSequence"],"930F":["SQ","1","PlaneOrientationVolumeSequence"],9310:["SQ","1","TemporalPositionSequence"],9311:["CS","1","DimensionOrganizationType"],9312:["UI","1","VolumeFrameOfReferenceUID"],9313:["UI","1","TableFrameOfReferenceUID"],9421:["LO","1","DimensionDescriptionLabel"],9450:["SQ","1","PatientOrientationInFrameSequence"],9453:["LO","1","FrameLabel"],9518:["US","1-n","AcquisitionIndex"],9529:["SQ","1","ContributingSOPInstancesReferenceSequence"],9536:["US","1","ReconstructionIndex"]},"0022":{"0000":["UL","1","GenericGroupLength"],"0001":["US","1","LightPathFilterPassThroughWavelength"],"0002":["US","2","LightPathFilterPassBand"],"0003":["US","1","ImagePathFilterPassThroughWavelength"],"0004":["US","2","ImagePathFilterPassBand"],"0005":["CS","1","PatientEyeMovementCommanded"],"0006":["SQ","1","PatientEyeMovementCommandCodeSequence"],"0007":["FL","1","SphericalLensPower"],"0008":["FL","1","CylinderLensPower"],"0009":["FL","1","CylinderAxis"],"000A":["FL","1","EmmetropicMagnification"],"000B":["FL","1","IntraOcularPressure"],"000C":["FL","1","HorizontalFieldOfView"],"000D":["CS","1","PupilDilated"],"000E":["FL","1","DegreeOfDilation"],"0010":["FL","1","StereoBaselineAngle"],"0011":["FL","1","StereoBaselineDisplacement"],"0012":["FL","1","StereoHorizontalPixelOffset"],"0013":["FL","1","StereoVerticalPixelOffset"],"0014":["FL","1","StereoRotation"],"0015":["SQ","1","AcquisitionDeviceTypeCodeSequence"],"0016":["SQ","1","IlluminationTypeCodeSequence"],"0017":["SQ","1","LightPathFilterTypeStackCodeSequence"],"0018":["SQ","1","ImagePathFilterTypeStackCodeSequence"],"0019":["SQ","1","LensesCodeSequence"],"001A":["SQ","1","ChannelDescriptionCodeSequence"],"001B":["SQ","1","RefractiveStateSequence"],"001C":["SQ","1","MydriaticAgentCodeSequence"],"001D":["SQ","1","RelativeImagePositionCodeSequence"],"001E":["FL","1","CameraAngleOfView"],"0020":["SQ","1","StereoPairsSequence"],"0021":["SQ","1","LeftImageSequence"],"0022":["SQ","1","RightImageSequence"],"0028":["CS","1","StereoPairsPresent"],"0030":["FL","1","AxialLengthOfTheEye"],"0031":["SQ","1","OphthalmicFrameLocationSequence"],"0032":["FL","2-2n","ReferenceCoordinates"],"0035":["FL","1","DepthSpatialResolution"],"0036":["FL","1","MaximumDepthDistortion"],"0037":["FL","1","AlongScanSpatialResolution"],"0038":["FL","1","MaximumAlongScanDistortion"],"0039":["CS","1","OphthalmicImageOrientation"],"0041":["FL","1","DepthOfTransverseImage"],"0042":["SQ","1","MydriaticAgentConcentrationUnitsSequence"],"0048":["FL","1","AcrossScanSpatialResolution"],"0049":["FL","1","MaximumAcrossScanDistortion"],"004E":["DS","1","MydriaticAgentConcentration"],"0055":["FL","1","IlluminationWaveLength"],"0056":["FL","1","IlluminationPower"],"0057":["FL","1","IlluminationBandwidth"],"0058":["SQ","1","MydriaticAgentSequence"],1007:["SQ","1","OphthalmicAxialMeasurementsRightEyeSequence"],1008:["SQ","1","OphthalmicAxialMeasurementsLeftEyeSequence"],1009:["CS","1","OphthalmicAxialMeasurementsDeviceType"],1010:["CS","1","OphthalmicAxialLengthMeasurementsType"],1012:["SQ","1","OphthalmicAxialLengthSequence"],1019:["FL","1","OphthalmicAxialLength"],1024:["SQ","1","LensStatusCodeSequence"],1025:["SQ","1","VitreousStatusCodeSequence"],1028:["SQ","1","IOLFormulaCodeSequence"],1029:["LO","1","IOLFormulaDetail"],1033:["FL","1","KeratometerIndex"],1035:["SQ","1","SourceOfOphthalmicAxialLengthCodeSequence"],1036:["SQ","1","SourceOfCornealSizeDataCodeSequence"],1037:["FL","1","TargetRefraction"],1039:["CS","1","RefractiveProcedureOccurred"],1040:["SQ","1","RefractiveSurgeryTypeCodeSequence"],1044:["SQ","1","OphthalmicUltrasoundMethodCodeSequence"],1045:["SQ","1","SurgicallyInducedAstigmatismSequence"],1046:["CS","1","TypeOfOpticalCorrection"],1047:["SQ","1","ToricIOLPowerSequence"],1048:["SQ","1","PredictedToricErrorSequence"],1049:["CS","1","PreSelectedForImplantation"],"104A":["SQ","1","ToricIOLPowerForExactEmmetropiaSequence"],"104B":["SQ","1","ToricIOLPowerForExactTargetRefractionSequence"],1050:["SQ","1","OphthalmicAxialLengthMeasurementsSequence"],1053:["FL","1","IOLPower"],1054:["FL","1","PredictedRefractiveError"],1059:["FL","1","OphthalmicAxialLengthVelocity"],1065:["LO","1","LensStatusDescription"],1066:["LO","1","VitreousStatusDescription"],1090:["SQ","1","IOLPowerSequence"],1092:["SQ","1","LensConstantSequence"],1093:["LO","1","IOLManufacturer"],1094:["LO","1","LensConstantDescription"],1095:["LO","1","ImplantName"],1096:["SQ","1","KeratometryMeasurementTypeCodeSequence"],1097:["LO","1","ImplantPartNumber"],1100:["SQ","1","ReferencedOphthalmicAxialMeasurementsSequence"],1101:["SQ","1","OphthalmicAxialLengthMeasurementsSegmentNameCodeSequence"],1103:["SQ","1","RefractiveErrorBeforeRefractiveSurgeryCodeSequence"],1121:["FL","1","IOLPowerForExactEmmetropia"],1122:["FL","1","IOLPowerForExactTargetRefraction"],1125:["SQ","1","AnteriorChamberDepthDefinitionCodeSequence"],1127:["SQ","1","LensThicknessSequence"],1128:["SQ","1","AnteriorChamberDepthSequence"],"112A":["SQ","1","CalculationCommentSequence"],"112B":["CS","1","CalculationCommentType"],"112C":["LT","1","CalculationComment"],1130:["FL","1","LensThickness"],1131:["FL","1","AnteriorChamberDepth"],1132:["SQ","1","SourceOfLensThicknessDataCodeSequence"],1133:["SQ","1","SourceOfAnteriorChamberDepthDataCodeSequence"],1134:["SQ","1","SourceOfRefractiveMeasurementsSequence"],1135:["SQ","1","SourceOfRefractiveMeasurementsCodeSequence"],1140:["CS","1","OphthalmicAxialLengthMeasurementModified"],1150:["SQ","1","OphthalmicAxialLengthDataSourceCodeSequence"],1153:["SQ","1","OphthalmicAxialLengthAcquisitionMethodCodeSequence"],1155:["FL","1","SignalToNoiseRatio"],1159:["LO","1","OphthalmicAxialLengthDataSourceDescription"],1210:["SQ","1","OphthalmicAxialLengthMeasurementsTotalLengthSequence"],1211:["SQ","1","OphthalmicAxialLengthMeasurementsSegmentalLengthSequence"],1212:["SQ","1","OphthalmicAxialLengthMeasurementsLengthSummationSequence"],1220:["SQ","1","UltrasoundOphthalmicAxialLengthMeasurementsSequence"],1225:["SQ","1","OpticalOphthalmicAxialLengthMeasurementsSequence"],1230:["SQ","1","UltrasoundSelectedOphthalmicAxialLengthSequence"],1250:["SQ","1","OphthalmicAxialLengthSelectionMethodCodeSequence"],1255:["SQ","1","OpticalSelectedOphthalmicAxialLengthSequence"],1257:["SQ","1","SelectedSegmentalOphthalmicAxialLengthSequence"],1260:["SQ","1","SelectedTotalOphthalmicAxialLengthSequence"],1262:["SQ","1","OphthalmicAxialLengthQualityMetricSequence"],1265:["SQ","1","OphthalmicAxialLengthQualityMetricTypeCodeSequence"],1273:["LO","1","OphthalmicAxialLengthQualityMetricTypeDescription"],1300:["SQ","1","IntraocularLensCalculationsRightEyeSequence"],1310:["SQ","1","IntraocularLensCalculationsLeftEyeSequence"],1330:["SQ","1","ReferencedOphthalmicAxialLengthMeasurementQCImageSequence"],1415:["CS","1","OphthalmicMappingDeviceType"],1420:["SQ","1","AcquisitionMethodCodeSequence"],1423:["SQ","1","AcquisitionMethodAlgorithmSequence"],1436:["SQ","1","OphthalmicThicknessMapTypeCodeSequence"],1443:["SQ","1","OphthalmicThicknessMappingNormalsSequence"],1445:["SQ","1","RetinalThicknessDefinitionCodeSequence"],1450:["SQ","1","PixelValueMappingToCodedConceptSequence"],1452:["xs","1","MappedPixelValue"],1454:["LO","1","PixelValueMappingExplanation"],1458:["SQ","1","OphthalmicThicknessMapQualityThresholdSequence"],1460:["FL","1","OphthalmicThicknessMapThresholdQualityRating"],1463:["FL","2","AnatomicStructureReferencePoint"],1465:["SQ","1","RegistrationToLocalizerSequence"],1466:["CS","1","RegisteredLocalizerUnits"],1467:["FL","2","RegisteredLocalizerTopLeftHandCorner"],1468:["FL","2","RegisteredLocalizerBottomRightHandCorner"],1470:["SQ","1","OphthalmicThicknessMapQualityRatingSequence"],1472:["SQ","1","RelevantOPTAttributesSequence"],1512:["SQ","1","TransformationMethodCodeSequence"],1513:["SQ","1","TransformationAlgorithmSequence"],1515:["CS","1","OphthalmicAxialLengthMethod"],1517:["FL","1","OphthalmicFOV"],1518:["SQ","1","TwoDimensionalToThreeDimensionalMapSequence"],1525:["SQ","1","WideFieldOphthalmicPhotographyQualityRatingSequence"],1526:["SQ","1","WideFieldOphthalmicPhotographyQualityThresholdSequence"],1527:["FL","1","WideFieldOphthalmicPhotographyThresholdQualityRating"],1528:["FL","1","XCoordinatesCenterPixelViewAngle"],1529:["FL","1","YCoordinatesCenterPixelViewAngle"],1530:["UL","1","NumberOfMapPoints"],1531:["OF","1","TwoDimensionalToThreeDimensionalMapData"],1612:["SQ","1","DerivationAlgorithmSequence"],1615:["SQ","1","OphthalmicImageTypeCodeSequence"],1616:["LO","1","OphthalmicImageTypeDescription"],1618:["SQ","1","ScanPatternTypeCodeSequence"],1620:["SQ","1","ReferencedSurfaceMeshIdentificationSequence"],1622:["CS","1","OphthalmicVolumetricPropertiesFlag"],1624:["FL","1","OphthalmicAnatomicReferencePointXCoordinate"],1626:["FL","1","OphthalmicAnatomicReferencePointYCoordinate"],1628:["SQ","1","OphthalmicEnFaceImageQualityRatingSequence"],1630:["DS","1","QualityThreshold"],1640:["SQ","1","OCTBscanAnalysisAcquisitionParametersSequence"],1642:["UL","1","NumberOfBscansPerFrame"],1643:["FL","1","BscanSlabThickness"],1644:["FL","1","DistanceBetweenBscanSlabs"],1645:["FL","1","BscanCycleTime"],1646:["FL","1-n","BscanCycleTimeVector"],1649:["FL","1","AscanRate"],1650:["FL","1","BscanRate"],1658:["UL","1","SurfaceMeshZPixelOffset"]},"0024":{"0000":["UL","1","GenericGroupLength"],"0010":["FL","1","VisualFieldHorizontalExtent"],"0011":["FL","1","VisualFieldVerticalExtent"],"0012":["CS","1","VisualFieldShape"],"0016":["SQ","1","ScreeningTestModeCodeSequence"],"0018":["FL","1","MaximumStimulusLuminance"],"0020":["FL","1","BackgroundLuminance"],"0021":["SQ","1","StimulusColorCodeSequence"],"0024":["SQ","1","BackgroundIlluminationColorCodeSequence"],"0025":["FL","1","StimulusArea"],"0028":["FL","1","StimulusPresentationTime"],"0032":["SQ","1","FixationSequence"],"0033":["SQ","1","FixationMonitoringCodeSequence"],"0034":["SQ","1","VisualFieldCatchTrialSequence"],"0035":["US","1","FixationCheckedQuantity"],"0036":["US","1","PatientNotProperlyFixatedQuantity"],"0037":["CS","1","PresentedVisualStimuliDataFlag"],"0038":["US","1","NumberOfVisualStimuli"],"0039":["CS","1","ExcessiveFixationLossesDataFlag"],"0040":["CS","1","ExcessiveFixationLosses"],"0042":["US","1","StimuliRetestingQuantity"],"0044":["LT","1","CommentsOnPatientPerformanceOfVisualField"],"0045":["CS","1","FalseNegativesEstimateFlag"],"0046":["FL","1","FalseNegativesEstimate"],"0048":["US","1","NegativeCatchTrialsQuantity"],"0050":["US","1","FalseNegativesQuantity"],"0051":["CS","1","ExcessiveFalseNegativesDataFlag"],"0052":["CS","1","ExcessiveFalseNegatives"],"0053":["CS","1","FalsePositivesEstimateFlag"],"0054":["FL","1","FalsePositivesEstimate"],"0055":["CS","1","CatchTrialsDataFlag"],"0056":["US","1","PositiveCatchTrialsQuantity"],"0057":["CS","1","TestPointNormalsDataFlag"],"0058":["SQ","1","TestPointNormalsSequence"],"0059":["CS","1","GlobalDeviationProbabilityNormalsFlag"],"0060":["US","1","FalsePositivesQuantity"],"0061":["CS","1","ExcessiveFalsePositivesDataFlag"],"0062":["CS","1","ExcessiveFalsePositives"],"0063":["CS","1","VisualFieldTestNormalsFlag"],"0064":["SQ","1","ResultsNormalsSequence"],"0065":["SQ","1","AgeCorrectedSensitivityDeviationAlgorithmSequence"],"0066":["FL","1","GlobalDeviationFromNormal"],"0067":["SQ","1","GeneralizedDefectSensitivityDeviationAlgorithmSequence"],"0068":["FL","1","LocalizedDeviationFromNormal"],"0069":["LO","1","PatientReliabilityIndicator"],"0070":["FL","1","VisualFieldMeanSensitivity"],"0071":["FL","1","GlobalDeviationProbability"],"0072":["CS","1","LocalDeviationProbabilityNormalsFlag"],"0073":["FL","1","LocalizedDeviationProbability"],"0074":["CS","1","ShortTermFluctuationCalculated"],"0075":["FL","1","ShortTermFluctuation"],"0076":["CS","1","ShortTermFluctuationProbabilityCalculated"],"0077":["FL","1","ShortTermFluctuationProbability"],"0078":["CS","1","CorrectedLocalizedDeviationFromNormalCalculated"],"0079":["FL","1","CorrectedLocalizedDeviationFromNormal"],"0080":["CS","1","CorrectedLocalizedDeviationFromNormalProbabilityCalculated"],"0081":["FL","1","CorrectedLocalizedDeviationFromNormalProbability"],"0083":["SQ","1","GlobalDeviationProbabilitySequence"],"0085":["SQ","1","LocalizedDeviationProbabilitySequence"],"0086":["CS","1","FovealSensitivityMeasured"],"0087":["FL","1","FovealSensitivity"],"0088":["FL","1","VisualFieldTestDuration"],"0089":["SQ","1","VisualFieldTestPointSequence"],"0090":["FL","1","VisualFieldTestPointXCoordinate"],"0091":["FL","1","VisualFieldTestPointYCoordinate"],"0092":["FL","1","AgeCorrectedSensitivityDeviationValue"],"0093":["CS","1","StimulusResults"],"0094":["FL","1","SensitivityValue"],"0095":["CS","1","RetestStimulusSeen"],"0096":["FL","1","RetestSensitivityValue"],"0097":["SQ","1","VisualFieldTestPointNormalsSequence"],"0098":["FL","1","QuantifiedDefect"],"0100":["FL","1","AgeCorrectedSensitivityDeviationProbabilityValue"],"0102":["CS","1","GeneralizedDefectCorrectedSensitivityDeviationFlag"],"0103":["FL","1","GeneralizedDefectCorrectedSensitivityDeviationValue"],"0104":["FL","1","GeneralizedDefectCorrectedSensitivityDeviationProbabilityValue"],"0105":["FL","1","MinimumSensitivityValue"],"0106":["CS","1","BlindSpotLocalized"],"0107":["FL","1","BlindSpotXCoordinate"],"0108":["FL","1","BlindSpotYCoordinate"],"0110":["SQ","1","VisualAcuityMeasurementSequence"],"0112":["SQ","1","RefractiveParametersUsedOnPatientSequence"],"0113":["CS","1","MeasurementLaterality"],"0114":["SQ","1","OphthalmicPatientClinicalInformationLeftEyeSequence"],"0115":["SQ","1","OphthalmicPatientClinicalInformationRightEyeSequence"],"0117":["CS","1","FovealPointNormativeDataFlag"],"0118":["FL","1","FovealPointProbabilityValue"],"0120":["CS","1","ScreeningBaselineMeasured"],"0122":["SQ","1","ScreeningBaselineMeasuredSequence"],"0124":["CS","1","ScreeningBaselineType"],"0126":["FL","1","ScreeningBaselineValue"],"0202":["LO","1","AlgorithmSource"],"0306":["LO","1","DataSetName"],"0307":["LO","1","DataSetVersion"],"0308":["LO","1","DataSetSource"],"0309":["LO","1","DataSetDescription"],"0317":["SQ","1","VisualFieldTestReliabilityGlobalIndexSequence"],"0320":["SQ","1","VisualFieldGlobalResultsIndexSequence"],"0325":["SQ","1","DataObservationSequence"],"0338":["CS","1","IndexNormalsFlag"],"0341":["FL","1","IndexProbability"],"0344":["SQ","1","IndexProbabilitySequence"]},"0028":{"0000":["UL","1","GenericGroupLength"],"0002":["US","1","SamplesPerPixel"],"0003":["US","1","SamplesPerPixelUsed"],"0004":["CS","1","PhotometricInterpretation"],"0005":["US","1","ImageDimensions"],"0006":["US","1","PlanarConfiguration"],"0008":["IS","1","NumberOfFrames"],"0009":["AT","1-n","FrameIncrementPointer"],"000A":["AT","1-n","FrameDimensionPointer"],"0010":["US","1","Rows"],"0011":["US","1","Columns"],"0012":["US","1","Planes"],"0014":["US","1","UltrasoundColorDataPresent"],"0020":["","",""],"0030":["DS","2","PixelSpacing"],"0031":["DS","2","ZoomFactor"],"0032":["DS","2","ZoomCenter"],"0034":["IS","2","PixelAspectRatio"],"0040":["CS","1","ImageFormat"],"0050":["LO","1-n","ManipulatedImage"],"0051":["CS","1-n","CorrectedImage"],"005F":["LO","1","CompressionRecognitionCode"],"0060":["CS","1","CompressionCode"],"0061":["SH","1","CompressionOriginator"],"0062":["LO","1","CompressionLabel"],"0063":["SH","1","CompressionDescription"],"0065":["CS","1-n","CompressionSequence"],"0066":["AT","1-n","CompressionStepPointers"],"0068":["US","1","RepeatInterval"],"0069":["US","1","BitsGrouped"],"0070":["US","1-n","PerimeterTable"],"0071":["xs","1","PerimeterValue"],"0080":["US","1","PredictorRows"],"0081":["US","1","PredictorColumns"],"0082":["US","1-n","PredictorConstants"],"0090":["CS","1","BlockedPixels"],"0091":["US","1","BlockRows"],"0092":["US","1","BlockColumns"],"0093":["US","1","RowOverlap"],"0094":["US","1","ColumnOverlap"],"0100":["US","1","BitsAllocated"],"0101":["US","1","BitsStored"],"0102":["US","1","HighBit"],"0103":["US","1","PixelRepresentation"],"0104":["xs","1","SmallestValidPixelValue"],"0105":["xs","1","LargestValidPixelValue"],"0106":["xs","1","SmallestImagePixelValue"],"0107":["xs","1","LargestImagePixelValue"],"0108":["xs","1","SmallestPixelValueInSeries"],"0109":["xs","1","LargestPixelValueInSeries"],"0110":["xs","1","SmallestImagePixelValueInPlane"],"0111":["xs","1","LargestImagePixelValueInPlane"],"0120":["xs","1","PixelPaddingValue"],"0121":["xs","1","PixelPaddingRangeLimit"],"0122":["FL","1","FloatPixelPaddingValue"],"0123":["FD","1","DoubleFloatPixelPaddingValue"],"0124":["FL","1","FloatPixelPaddingRangeLimit"],"0125":["FD","1","DoubleFloatPixelPaddingRangeLimit"],"0200":["US","1","ImageLocation"],"0300":["CS","1","QualityControlImage"],"0301":["CS","1","BurnedInAnnotation"],"0302":["CS","1","RecognizableVisualFeatures"],"0303":["CS","1","LongitudinalTemporalInformationModified"],"0304":["UI","1","ReferencedColorPaletteInstanceUID"],"0400":["LO","1","TransformLabel"],"0401":["LO","1","TransformVersionNumber"],"0402":["US","1","NumberOfTransformSteps"],"0403":["LO","1-n","SequenceOfCompressedData"],"0404":["AT","1-n","DetailsOfCoefficients"],"04x0":["US","1","RowsForNthOrderCoefficients"],"04x1":["US","1","ColumnsForNthOrderCoefficients"],"04x2":["LO","1-n","CoefficientCoding"],"04x3":["AT","1-n","CoefficientCodingPointers"],"0700":["LO","1","DCTLabel"],"0701":["CS","1-n","DataBlockDescription"],"0702":["AT","1-n","DataBlock"],"0710":["US","1","NormalizationFactorFormat"],"0720":["US","1","ZonalMapNumberFormat"],"0721":["AT","1-n","ZonalMapLocation"],"0722":["US","1","ZonalMapFormat"],"0730":["US","1","AdaptiveMapFormat"],"0740":["US","1","CodeNumberFormat"],"08x0":["CS","1-n","CodeLabel"],"08x2":["US","1","NumberOfTables"],"08x3":["AT","1-n","CodeTableLocation"],"08x4":["US","1","BitsForCodeWord"],"08x8":["AT","1-n","ImageDataLocation"],"0A02":["CS","1","PixelSpacingCalibrationType"],"0A04":["LO","1","PixelSpacingCalibrationDescription"],1040:["CS","1","PixelIntensityRelationship"],1041:["SS","1","PixelIntensityRelationshipSign"],1050:["DS","1-n","WindowCenter"],1051:["DS","1-n","WindowWidth"],1052:["DS","1","RescaleIntercept"],1053:["DS","1","RescaleSlope"],1054:["LO","1","RescaleType"],1055:["LO","1-n","WindowCenterWidthExplanation"],1056:["CS","1","VOILUTFunction"],1080:["CS","1","GrayScale"],1090:["CS","1","RecommendedViewingMode"],1100:["xs","3","GrayLookupTableDescriptor"],1101:["xs","3","RedPaletteColorLookupTableDescriptor"],1102:["xs","3","GreenPaletteColorLookupTableDescriptor"],1103:["xs","3","BluePaletteColorLookupTableDescriptor"],1104:["US","3","AlphaPaletteColorLookupTableDescriptor"],1111:["xs","4","LargeRedPaletteColorLookupTableDescriptor"],1112:["xs","4","LargeGreenPaletteColorLookupTableDescriptor"],1113:["xs","4","LargeBluePaletteColorLookupTableDescriptor"],1199:["UI","1","PaletteColorLookupTableUID"],1200:["xs","1-n or 1","GrayLookupTableData"],1201:["OW","1","RedPaletteColorLookupTableData"],1202:["OW","1","GreenPaletteColorLookupTableData"],1203:["OW","1","BluePaletteColorLookupTableData"],1204:["OW","1","AlphaPaletteColorLookupTableData"],1211:["OW","1","LargeRedPaletteColorLookupTableData"],1212:["OW","1","LargeGreenPaletteColorLookupTableData"],1213:["OW","1","LargeBluePaletteColorLookupTableData"],1214:["UI","1","LargePaletteColorLookupTableUID"],1221:["OW","1","SegmentedRedPaletteColorLookupTableData"],1222:["OW","1","SegmentedGreenPaletteColorLookupTableData"],1223:["OW","1","SegmentedBluePaletteColorLookupTableData"],1224:["OW","1","SegmentedAlphaPaletteColorLookupTableData"],1230:["SQ","1","StoredValueColorRangeSequence"],1231:["FD","1","MinimumStoredValueMapped"],1232:["FD","1","MaximumStoredValueMapped"],1300:["CS","1","BreastImplantPresent"],1350:["CS","1","PartialView"],1351:["ST","1","PartialViewDescription"],1352:["SQ","1","PartialViewCodeSequence"],"135A":["CS","1","SpatialLocationsPreserved"],1401:["SQ","1","DataFrameAssignmentSequence"],1402:["CS","1","DataPathAssignment"],1403:["US","1","BitsMappedToColorLookupTable"],1404:["SQ","1","BlendingLUT1Sequence"],1405:["CS","1","BlendingLUT1TransferFunction"],1406:["FD","1","BlendingWeightConstant"],1407:["US","3","BlendingLookupTableDescriptor"],1408:["OW","1","BlendingLookupTableData"],"140B":["SQ","1","EnhancedPaletteColorLookupTableSequence"],"140C":["SQ","1","BlendingLUT2Sequence"],"140D":["CS","1","BlendingLUT2TransferFunction"],"140E":["CS","1","DataPathID"],"140F":["CS","1","RGBLUTTransferFunction"],1410:["CS","1","AlphaLUTTransferFunction"],2e3:["OB","1","ICCProfile"],2002:["CS","1","ColorSpace"],2110:["CS","1","LossyImageCompression"],2112:["DS","1-n","LossyImageCompressionRatio"],2114:["CS","1-n","LossyImageCompressionMethod"],3e3:["SQ","1","ModalityLUTSequence"],3002:["xs","3","LUTDescriptor"],3003:["LO","1","LUTExplanation"],3004:["LO","1","ModalityLUTType"],3006:["xx","1-n or 1","LUTData"],3010:["SQ","1","VOILUTSequence"],3110:["SQ","1","SoftcopyVOILUTSequence"],4e3:["LT","1","ImagePresentationComments"],5e3:["SQ","1","BiPlaneAcquisitionSequence"],6010:["US","1","RepresentativeFrameNumber"],6020:["US","1-n","FrameNumbersOfInterest"],6022:["LO","1-n","FrameOfInterestDescription"],6023:["CS","1-n","FrameOfInterestType"],6030:["US","1-n","MaskPointers"],6040:["US","1-n","RWavePointer"],6100:["SQ","1","MaskSubtractionSequence"],6101:["CS","1","MaskOperation"],6102:["US","2-2n","ApplicableFrameRange"],6110:["US","1-n","MaskFrameNumbers"],6112:["US","1","ContrastFrameAveraging"],6114:["FL","2","MaskSubPixelShift"],6120:["SS","1","TIDOffset"],6190:["ST","1","MaskOperationExplanation"],7e3:["SQ","1","EquipmentAdministratorSequence"],7001:["US","1","NumberOfDisplaySubsystems"],7002:["US","1","CurrentConfigurationID"],7003:["US","1","DisplaySubsystemID"],7004:["SH","1","DisplaySubsystemName"],7005:["LO","1","DisplaySubsystemDescription"],7006:["CS","1","SystemStatus"],7007:["LO","1","SystemStatusComment"],7008:["SQ","1","TargetLuminanceCharacteristicsSequence"],7009:["US","1","LuminanceCharacteristicsID"],"700A":["SQ","1","DisplaySubsystemConfigurationSequence"],"700B":["US","1","ConfigurationID"],"700C":["SH","1","ConfigurationName"],"700D":["LO","1","ConfigurationDescription"],"700E":["US","1","ReferencedTargetLuminanceCharacteristicsID"],"700F":["SQ","1","QAResultsSequence"],7010:["SQ","1","DisplaySubsystemQAResultsSequence"],7011:["SQ","1","ConfigurationQAResultsSequence"],7012:["SQ","1","MeasurementEquipmentSequence"],7013:["CS","1-n","MeasurementFunctions"],7014:["CS","1","MeasurementEquipmentType"],7015:["SQ","1","VisualEvaluationResultSequence"],7016:["SQ","1","DisplayCalibrationResultSequence"],7017:["US","1","DDLValue"],7018:["FL","2","CIExyWhitePoint"],7019:["CS","1","DisplayFunctionType"],"701A":["FL","1","GammaValue"],"701B":["US","1","NumberOfLuminancePoints"],"701C":["SQ","1","LuminanceResponseSequence"],"701D":["FL","1","TargetMinimumLuminance"],"701E":["FL","1","TargetMaximumLuminance"],"701F":["FL","1","LuminanceValue"],7020:["LO","1","LuminanceResponseDescription"],7021:["CS","1","WhitePointFlag"],7022:["SQ","1","DisplayDeviceTypeCodeSequence"],7023:["SQ","1","DisplaySubsystemSequence"],7024:["SQ","1","LuminanceResultSequence"],7025:["CS","1","AmbientLightValueSource"],7026:["CS","1-n","MeasuredCharacteristics"],7027:["SQ","1","LuminanceUniformityResultSequence"],7028:["SQ","1","VisualEvaluationTestSequence"],7029:["CS","1","TestResult"],"702A":["LO","1","TestResultComment"],"702B":["CS","1","TestImageValidation"],"702C":["SQ","1","TestPatternCodeSequence"],"702D":["SQ","1","MeasurementPatternCodeSequence"],"702E":["SQ","1","VisualEvaluationMethodCodeSequence"],"7FE0":["UR","1","PixelDataProviderURL"],9001:["UL","1","DataPointRows"],9002:["UL","1","DataPointColumns"],9003:["CS","1","SignalDomainColumns"],9099:["US","1","LargestMonochromePixelValue"],9108:["CS","1","DataRepresentation"],9110:["SQ","1","PixelMeasuresSequence"],9132:["SQ","1","FrameVOILUTSequence"],9145:["SQ","1","PixelValueTransformationSequence"],9235:["CS","1","SignalDomainRows"],9411:["FL","1","DisplayFilterPercentage"],9415:["SQ","1","FramePixelShiftSequence"],9416:["US","1","SubtractionItemID"],9422:["SQ","1","PixelIntensityRelationshipLUTSequence"],9443:["SQ","1","FramePixelDataPropertiesSequence"],9444:["CS","1","GeometricalProperties"],9445:["FL","1","GeometricMaximumDistortion"],9446:["CS","1-n","ImageProcessingApplied"],9454:["CS","1","MaskSelectionMode"],9474:["CS","1","LUTFunction"],9478:["FL","1","MaskVisibilityPercentage"],9501:["SQ","1","PixelShiftSequence"],9502:["SQ","1","RegionPixelShiftSequence"],9503:["SS","2-2n","VerticesOfTheRegion"],9505:["SQ","1","MultiFramePresentationSequence"],9506:["US","2-2n","PixelShiftFrameRange"],9507:["US","2-2n","LUTFrameRange"],9520:["DS","16","ImageToEquipmentMappingMatrix"],9537:["CS","1","EquipmentCoordinateSystemIdentification"]},"0032":{"0000":["UL","1","GenericGroupLength"],"000A":["CS","1","StudyStatusID"],"000C":["CS","1","StudyPriorityID"],"0012":["LO","1","StudyIDIssuer"],"0032":["DA","1","StudyVerifiedDate"],"0033":["TM","1","StudyVerifiedTime"],"0034":["DA","1","StudyReadDate"],"0035":["TM","1","StudyReadTime"],1e3:["DA","1","ScheduledStudyStartDate"],1001:["TM","1","ScheduledStudyStartTime"],1010:["DA","1","ScheduledStudyStopDate"],1011:["TM","1","ScheduledStudyStopTime"],1020:["LO","1","ScheduledStudyLocation"],1021:["AE","1-n","ScheduledStudyLocationAETitle"],1030:["LO","1","ReasonForStudy"],1031:["SQ","1","RequestingPhysicianIdentificationSequence"],1032:["PN","1","RequestingPhysician"],1033:["LO","1","RequestingService"],1034:["SQ","1","RequestingServiceCodeSequence"],1040:["DA","1","StudyArrivalDate"],1041:["TM","1","StudyArrivalTime"],1050:["DA","1","StudyCompletionDate"],1051:["TM","1","StudyCompletionTime"],1055:["CS","1","StudyComponentStatusID"],1060:["LO","1","RequestedProcedureDescription"],1064:["SQ","1","RequestedProcedureCodeSequence"],1065:["SQ","1","RequestedLateralityCodeSequence"],1066:["UT","1","ReasonForVisit"],1067:["SQ","1","ReasonForVisitCodeSequence"],1070:["LO","1","RequestedContrastAgent"],4e3:["LT","1","StudyComments"]},"0034":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","FlowIdentifierSequence"],"0002":["OB","1","FlowIdentifier"],"0003":["UI","1","FlowTransferSyntaxUID"],"0004":["UL","1","FlowRTPSamplingRate"],"0005":["OB","1","SourceIdentifier"],"0007":["OB","1","FrameOriginTimestamp"],"0008":["CS","1","IncludesImagingSubject"],"0009":["SQ","1","FrameUsefulnessGroupSequence"],"000A":["SQ","1","RealTimeBulkDataFlowSequence"],"000B":["SQ","1","CameraPositionGroupSequence"],"000C":["CS","1","IncludesInformation"],"000D":["SQ","1","TimeOfFrameGroupSequence"]},"0038":{"0000":["UL","1","GenericGroupLength"],"0004":["SQ","1","ReferencedPatientAliasSequence"],"0008":["CS","1","VisitStatusID"],"0010":["LO","1","AdmissionID"],"0011":["LO","1","IssuerOfAdmissionID"],"0014":["SQ","1","IssuerOfAdmissionIDSequence"],"0016":["LO","1","RouteOfAdmissions"],"001A":["DA","1","ScheduledAdmissionDate"],"001B":["TM","1","ScheduledAdmissionTime"],"001C":["DA","1","ScheduledDischargeDate"],"001D":["TM","1","ScheduledDischargeTime"],"001E":["LO","1","ScheduledPatientInstitutionResidence"],"0020":["DA","1","AdmittingDate"],"0021":["TM","1","AdmittingTime"],"0030":["DA","1","DischargeDate"],"0032":["TM","1","DischargeTime"],"0040":["LO","1","DischargeDiagnosisDescription"],"0044":["SQ","1","DischargeDiagnosisCodeSequence"],"0050":["LO","1","SpecialNeeds"],"0060":["LO","1","ServiceEpisodeID"],"0061":["LO","1","IssuerOfServiceEpisodeID"],"0062":["LO","1","ServiceEpisodeDescription"],"0064":["SQ","1","IssuerOfServiceEpisodeIDSequence"],"0100":["SQ","1","PertinentDocumentsSequence"],"0101":["SQ","1","PertinentResourcesSequence"],"0102":["LO","1","ResourceDescription"],"0300":["LO","1","CurrentPatientLocation"],"0400":["LO","1","PatientInstitutionResidence"],"0500":["LO","1","PatientState"],"0502":["SQ","1","PatientClinicalTrialParticipationSequence"],4e3:["LT","1","VisitComments"]},"003A":{"0000":["UL","1","GenericGroupLength"],"0004":["CS","1","WaveformOriginality"],"0005":["US","1","NumberOfWaveformChannels"],"0010":["UL","1","NumberOfWaveformSamples"],"001A":["DS","1","SamplingFrequency"],"0020":["SH","1","MultiplexGroupLabel"],"0200":["SQ","1","ChannelDefinitionSequence"],"0202":["IS","1","WaveformChannelNumber"],"0203":["SH","1","ChannelLabel"],"0205":["CS","1-n","ChannelStatus"],"0208":["SQ","1","ChannelSourceSequence"],"0209":["SQ","1","ChannelSourceModifiersSequence"],"020A":["SQ","1","SourceWaveformSequence"],"020C":["LO","1","ChannelDerivationDescription"],"0210":["DS","1","ChannelSensitivity"],"0211":["SQ","1","ChannelSensitivityUnitsSequence"],"0212":["DS","1","ChannelSensitivityCorrectionFactor"],"0213":["DS","1","ChannelBaseline"],"0214":["DS","1","ChannelTimeSkew"],"0215":["DS","1","ChannelSampleSkew"],"0218":["DS","1","ChannelOffset"],"021A":["US","1","WaveformBitsStored"],"0220":["DS","1","FilterLowFrequency"],"0221":["DS","1","FilterHighFrequency"],"0222":["DS","1","NotchFilterFrequency"],"0223":["DS","1","NotchFilterBandwidth"],"0230":["FL","1","WaveformDataDisplayScale"],"0231":["US","3","WaveformDisplayBackgroundCIELabValue"],"0240":["SQ","1","WaveformPresentationGroupSequence"],"0241":["US","1","PresentationGroupNumber"],"0242":["SQ","1","ChannelDisplaySequence"],"0244":["US","3","ChannelRecommendedDisplayCIELabValue"],"0245":["FL","1","ChannelPosition"],"0246":["CS","1","DisplayShadingFlag"],"0247":["FL","1","FractionalChannelDisplayScale"],"0248":["FL","1","AbsoluteChannelDisplayScale"],"0300":["SQ","1","MultiplexedAudioChannelsDescriptionCodeSequence"],"0301":["IS","1","ChannelIdentificationCode"],"0302":["CS","1","ChannelMode"],"0310":["UI","1","MultiplexGroupUID"],"0311":["DS","1","PowerlineFrequency"],"0312":["SQ","1","ChannelImpedanceSequence"],"0313":["DS","1","ImpedanceValue"],"0314":["DT","1","ImpedanceMeasurementDateTime"],"0315":["DS","1","ImpedanceMeasurementFrequency"],"0316":["CS","1","ImpedanceMeasurementCurrentType"]},"0040":{"0000":["UL","1","GenericGroupLength"],"0001":["AE","1-n","ScheduledStationAETitle"],"0002":["DA","1","ScheduledProcedureStepStartDate"],"0003":["TM","1","ScheduledProcedureStepStartTime"],"0004":["DA","1","ScheduledProcedureStepEndDate"],"0005":["TM","1","ScheduledProcedureStepEndTime"],"0006":["PN","1","ScheduledPerformingPhysicianName"],"0007":["LO","1","ScheduledProcedureStepDescription"],"0008":["SQ","1","ScheduledProtocolCodeSequence"],"0009":["SH","1","ScheduledProcedureStepID"],"000A":["SQ","1","StageCodeSequence"],"000B":["SQ","1","ScheduledPerformingPhysicianIdentificationSequence"],"0010":["SH","1-n","ScheduledStationName"],"0011":["SH","1","ScheduledProcedureStepLocation"],"0012":["LO","1","PreMedication"],"0020":["CS","1","ScheduledProcedureStepStatus"],"0026":["SQ","1","OrderPlacerIdentifierSequence"],"0027":["SQ","1","OrderFillerIdentifierSequence"],"0031":["UT","1","LocalNamespaceEntityID"],"0032":["UT","1","UniversalEntityID"],"0033":["CS","1","UniversalEntityIDType"],"0035":["CS","1","IdentifierTypeCode"],"0036":["SQ","1","AssigningFacilitySequence"],"0039":["SQ","1","AssigningJurisdictionCodeSequence"],"003A":["SQ","1","AssigningAgencyOrDepartmentCodeSequence"],"0100":["SQ","1","ScheduledProcedureStepSequence"],"0220":["SQ","1","ReferencedNonImageCompositeSOPInstanceSequence"],"0241":["AE","1","PerformedStationAETitle"],"0242":["SH","1","PerformedStationName"],"0243":["SH","1","PerformedLocation"],"0244":["DA","1","PerformedProcedureStepStartDate"],"0245":["TM","1","PerformedProcedureStepStartTime"],"0250":["DA","1","PerformedProcedureStepEndDate"],"0251":["TM","1","PerformedProcedureStepEndTime"],"0252":["CS","1","PerformedProcedureStepStatus"],"0253":["SH","1","PerformedProcedureStepID"],"0254":["LO","1","PerformedProcedureStepDescription"],"0255":["LO","1","PerformedProcedureTypeDescription"],"0260":["SQ","1","PerformedProtocolCodeSequence"],"0261":["CS","1","PerformedProtocolType"],"0270":["SQ","1","ScheduledStepAttributesSequence"],"0275":["SQ","1","RequestAttributesSequence"],"0280":["ST","1","CommentsOnThePerformedProcedureStep"],"0281":["SQ","1","PerformedProcedureStepDiscontinuationReasonCodeSequence"],"0293":["SQ","1","QuantitySequence"],"0294":["DS","1","Quantity"],"0295":["SQ","1","MeasuringUnitsSequence"],"0296":["SQ","1","BillingItemSequence"],"0300":["US","1","TotalTimeOfFluoroscopy"],"0301":["US","1","TotalNumberOfExposures"],"0302":["US","1","EntranceDose"],"0303":["US","1-2","ExposedArea"],"0306":["DS","1","DistanceSourceToEntrance"],"0307":["DS","1","DistanceSourceToSupport"],"030E":["SQ","1","ExposureDoseSequence"],"0310":["ST","1","CommentsOnRadiationDose"],"0312":["DS","1","XRayOutput"],"0314":["DS","1","HalfValueLayer"],"0316":["DS","1","OrganDose"],"0318":["CS","1","OrganExposed"],"0320":["SQ","1","BillingProcedureStepSequence"],"0321":["SQ","1","FilmConsumptionSequence"],"0324":["SQ","1","BillingSuppliesAndDevicesSequence"],"0330":["SQ","1","ReferencedProcedureStepSequence"],"0340":["SQ","1","PerformedSeriesSequence"],"0400":["LT","1","CommentsOnTheScheduledProcedureStep"],"0440":["SQ","1","ProtocolContextSequence"],"0441":["SQ","1","ContentItemModifierSequence"],"0500":["SQ","1","ScheduledSpecimenSequence"],"050A":["LO","1","SpecimenAccessionNumber"],"0512":["LO","1","ContainerIdentifier"],"0513":["SQ","1","IssuerOfTheContainerIdentifierSequence"],"0515":["SQ","1","AlternateContainerIdentifierSequence"],"0518":["SQ","1","ContainerTypeCodeSequence"],"051A":["LO","1","ContainerDescription"],"0520":["SQ","1","ContainerComponentSequence"],"0550":["SQ","1","SpecimenSequence"],"0551":["LO","1","SpecimenIdentifier"],"0552":["SQ","1","SpecimenDescriptionSequenceTrial"],"0553":["ST","1","SpecimenDescriptionTrial"],"0554":["UI","1","SpecimenUID"],"0555":["SQ","1","AcquisitionContextSequence"],"0556":["ST","1","AcquisitionContextDescription"],"0560":["SQ","1","SpecimenDescriptionSequence"],"0562":["SQ","1","IssuerOfTheSpecimenIdentifierSequence"],"059A":["SQ","1","SpecimenTypeCodeSequence"],"0600":["LO","1","SpecimenShortDescription"],"0602":["UT","1","SpecimenDetailedDescription"],"0610":["SQ","1","SpecimenPreparationSequence"],"0612":["SQ","1","SpecimenPreparationStepContentItemSequence"],"0620":["SQ","1","SpecimenLocalizationContentItemSequence"],"06FA":["LO","1","SlideIdentifier"],"0710":["SQ","1","WholeSlideMicroscopyImageFrameTypeSequence"],"071A":["SQ","1","ImageCenterPointCoordinatesSequence"],"072A":["DS","1","XOffsetInSlideCoordinateSystem"],"073A":["DS","1","YOffsetInSlideCoordinateSystem"],"074A":["DS","1","ZOffsetInSlideCoordinateSystem"],"08D8":["SQ","1","PixelSpacingSequence"],"08DA":["SQ","1","CoordinateSystemAxisCodeSequence"],"08EA":["SQ","1","MeasurementUnitsCodeSequence"],"09F8":["SQ","1","VitalStainCodeSequenceTrial"],1001:["SH","1","RequestedProcedureID"],1002:["LO","1","ReasonForTheRequestedProcedure"],1003:["SH","1","RequestedProcedurePriority"],1004:["LO","1","PatientTransportArrangements"],1005:["LO","1","RequestedProcedureLocation"],1006:["SH","1","PlacerOrderNumberProcedure"],1007:["SH","1","FillerOrderNumberProcedure"],1008:["LO","1","ConfidentialityCode"],1009:["SH","1","ReportingPriority"],"100A":["SQ","1","ReasonForRequestedProcedureCodeSequence"],1010:["PN","1-n","NamesOfIntendedRecipientsOfResults"],1011:["SQ","1","IntendedRecipientsOfResultsIdentificationSequence"],1012:["SQ","1","ReasonForPerformedProcedureCodeSequence"],1060:["LO","1","RequestedProcedureDescriptionTrial"],1101:["SQ","1","PersonIdentificationCodeSequence"],1102:["ST","1","PersonAddress"],1103:["LO","1-n","PersonTelephoneNumbers"],1104:["LT","1","PersonTelecomInformation"],1400:["LT","1","RequestedProcedureComments"],2001:["LO","1","ReasonForTheImagingServiceRequest"],2004:["DA","1","IssueDateOfImagingServiceRequest"],2005:["TM","1","IssueTimeOfImagingServiceRequest"],2006:["SH","1","PlacerOrderNumberImagingServiceRequestRetired"],2007:["SH","1","FillerOrderNumberImagingServiceRequestRetired"],2008:["PN","1","OrderEnteredBy"],2009:["SH","1","OrderEntererLocation"],2010:["SH","1","OrderCallbackPhoneNumber"],2011:["LT","1","OrderCallbackTelecomInformation"],2016:["LO","1","PlacerOrderNumberImagingServiceRequest"],2017:["LO","1","FillerOrderNumberImagingServiceRequest"],2400:["LT","1","ImagingServiceRequestComments"],3001:["LO","1","ConfidentialityConstraintOnPatientDataDescription"],4001:["CS","1","GeneralPurposeScheduledProcedureStepStatus"],4002:["CS","1","GeneralPurposePerformedProcedureStepStatus"],4003:["CS","1","GeneralPurposeScheduledProcedureStepPriority"],4004:["SQ","1","ScheduledProcessingApplicationsCodeSequence"],4005:["DT","1","ScheduledProcedureStepStartDateTime"],4006:["CS","1","MultipleCopiesFlag"],4007:["SQ","1","PerformedProcessingApplicationsCodeSequence"],4008:["DT","1","ScheduledProcedureStepExpirationDateTime"],4009:["SQ","1","HumanPerformerCodeSequence"],4010:["DT","1","ScheduledProcedureStepModificationDateTime"],4011:["DT","1","ExpectedCompletionDateTime"],4015:["SQ","1","ResultingGeneralPurposePerformedProcedureStepsSequence"],4016:["SQ","1","ReferencedGeneralPurposeScheduledProcedureStepSequence"],4018:["SQ","1","ScheduledWorkitemCodeSequence"],4019:["SQ","1","PerformedWorkitemCodeSequence"],4020:["CS","1","InputAvailabilityFlag"],4021:["SQ","1","InputInformationSequence"],4022:["SQ","1","RelevantInformationSequence"],4023:["UI","1","ReferencedGeneralPurposeScheduledProcedureStepTransactionUID"],4025:["SQ","1","ScheduledStationNameCodeSequence"],4026:["SQ","1","ScheduledStationClassCodeSequence"],4027:["SQ","1","ScheduledStationGeographicLocationCodeSequence"],4028:["SQ","1","PerformedStationNameCodeSequence"],4029:["SQ","1","PerformedStationClassCodeSequence"],4030:["SQ","1","PerformedStationGeographicLocationCodeSequence"],4031:["SQ","1","RequestedSubsequentWorkitemCodeSequence"],4032:["SQ","1","NonDICOMOutputCodeSequence"],4033:["SQ","1","OutputInformationSequence"],4034:["SQ","1","ScheduledHumanPerformersSequence"],4035:["SQ","1","ActualHumanPerformersSequence"],4036:["LO","1","HumanPerformerOrganization"],4037:["PN","1","HumanPerformerName"],4040:["CS","1","RawDataHandling"],4041:["CS","1","InputReadinessState"],4050:["DT","1","PerformedProcedureStepStartDateTime"],4051:["DT","1","PerformedProcedureStepEndDateTime"],4052:["DT","1","ProcedureStepCancellationDateTime"],4070:["SQ","1","OutputDestinationSequence"],4071:["SQ","1","DICOMStorageSequence"],4072:["SQ","1","STOWRSStorageSequence"],4073:["UR","1","StorageURL"],4074:["SQ","1","XDSStorageSequence"],8302:["DS","1","EntranceDoseInmGy"],8303:["CS","1","EntranceDoseDerivation"],9092:["SQ","1","ParametricMapFrameTypeSequence"],9094:["SQ","1","ReferencedImageRealWorldValueMappingSequence"],9096:["SQ","1","RealWorldValueMappingSequence"],9098:["SQ","1","PixelValueMappingCodeSequence"],9210:["SH","1","LUTLabel"],9211:["xs","1","RealWorldValueLastValueMapped"],9212:["FD","1-n","RealWorldValueLUTData"],9213:["FD","1","DoubleFloatRealWorldValueLastValueMapped"],9214:["FD","1","DoubleFloatRealWorldValueFirstValueMapped"],9216:["xs","1","RealWorldValueFirstValueMapped"],9220:["SQ","1","QuantityDefinitionSequence"],9224:["FD","1","RealWorldValueIntercept"],9225:["FD","1","RealWorldValueSlope"],A007:["CS","1","FindingsFlagTrial"],A010:["CS","1","RelationshipType"],A020:["SQ","1","FindingsSequenceTrial"],A021:["UI","1","FindingsGroupUIDTrial"],A022:["UI","1","ReferencedFindingsGroupUIDTrial"],A023:["DA","1","FindingsGroupRecordingDateTrial"],A024:["TM","1","FindingsGroupRecordingTimeTrial"],A026:["SQ","1","FindingsSourceCategoryCodeSequenceTrial"],A027:["LO","1","VerifyingOrganization"],A028:["SQ","1","DocumentingOrganizationIdentifierCodeSequenceTrial"],A030:["DT","1","VerificationDateTime"],A032:["DT","1","ObservationDateTime"],A033:["DT","1","ObservationStartDateTime"],A040:["CS","1","ValueType"],A043:["SQ","1","ConceptNameCodeSequence"],A047:["LO","1","MeasurementPrecisionDescriptionTrial"],A050:["CS","1","ContinuityOfContent"],A057:["CS","1-n","UrgencyOrPriorityAlertsTrial"],A060:["LO","1","SequencingIndicatorTrial"],A066:["SQ","1","DocumentIdentifierCodeSequenceTrial"],A067:["PN","1","DocumentAuthorTrial"],A068:["SQ","1","DocumentAuthorIdentifierCodeSequenceTrial"],A070:["SQ","1","IdentifierCodeSequenceTrial"],A073:["SQ","1","VerifyingObserverSequence"],A074:["OB","1","ObjectBinaryIdentifierTrial"],A075:["PN","1","VerifyingObserverName"],A076:["SQ","1","DocumentingObserverIdentifierCodeSequenceTrial"],A078:["SQ","1","AuthorObserverSequence"],A07A:["SQ","1","ParticipantSequence"],A07C:["SQ","1","CustodialOrganizationSequence"],A080:["CS","1","ParticipationType"],A082:["DT","1","ParticipationDateTime"],A084:["CS","1","ObserverType"],A085:["SQ","1","ProcedureIdentifierCodeSequenceTrial"],A088:["SQ","1","VerifyingObserverIdentificationCodeSequence"],A089:["OB","1","ObjectDirectoryBinaryIdentifierTrial"],A090:["SQ","1","EquivalentCDADocumentSequence"],A0B0:["US","2-2n","ReferencedWaveformChannels"],A110:["DA","1","DateOfDocumentOrVerbalTransactionTrial"],A112:["TM","1","TimeOfDocumentCreationOrVerbalTransactionTrial"],A120:["DT","1","DateTime"],A121:["DA","1","Date"],A122:["TM","1","Time"],A123:["PN","1","PersonName"],A124:["UI","1","UID"],A125:["CS","2","ReportStatusIDTrial"],A130:["CS","1","TemporalRangeType"],A132:["UL","1-n","ReferencedSamplePositions"],A136:["US","1-n","ReferencedFrameNumbers"],A138:["DS","1-n","ReferencedTimeOffsets"],A13A:["DT","1-n","ReferencedDateTime"],A160:["UT","1","TextValue"],A161:["FD","1-n","FloatingPointValue"],A162:["SL","1-n","RationalNumeratorValue"],A163:["UL","1-n","RationalDenominatorValue"],A167:["SQ","1","ObservationCategoryCodeSequenceTrial"],A168:["SQ","1","ConceptCodeSequence"],A16A:["ST","1","BibliographicCitationTrial"],A170:["SQ","1","PurposeOfReferenceCodeSequence"],A171:["UI","1","ObservationUID"],A172:["UI","1","ReferencedObservationUIDTrial"],A173:["CS","1","ReferencedObservationClassTrial"],A174:["CS","1","ReferencedObjectObservationClassTrial"],A180:["US","1","AnnotationGroupNumber"],A192:["DA","1","ObservationDateTrial"],A193:["TM","1","ObservationTimeTrial"],A194:["CS","1","MeasurementAutomationTrial"],A195:["SQ","1","ModifierCodeSequence"],A224:["ST","1","IdentificationDescriptionTrial"],A290:["CS","1","CoordinatesSetGeometricTypeTrial"],A296:["SQ","1","AlgorithmCodeSequenceTrial"],A297:["ST","1","AlgorithmDescriptionTrial"],A29A:["SL","2-2n","PixelCoordinatesSetTrial"],A300:["SQ","1","MeasuredValueSequence"],A301:["SQ","1","NumericValueQualifierCodeSequence"],A307:["PN","1","CurrentObserverTrial"],A30A:["DS","1-n","NumericValue"],A313:["SQ","1","ReferencedAccessionSequenceTrial"],A33A:["ST","1","ReportStatusCommentTrial"],A340:["SQ","1","ProcedureContextSequenceTrial"],A352:["PN","1","VerbalSourceTrial"],A353:["ST","1","AddressTrial"],A354:["LO","1","TelephoneNumberTrial"],A358:["SQ","1","VerbalSourceIdentifierCodeSequenceTrial"],A360:["SQ","1","PredecessorDocumentsSequence"],A370:["SQ","1","ReferencedRequestSequence"],A372:["SQ","1","PerformedProcedureCodeSequence"],A375:["SQ","1","CurrentRequestedProcedureEvidenceSequence"],A380:["SQ","1","ReportDetailSequenceTrial"],A385:["SQ","1","PertinentOtherEvidenceSequence"],A390:["SQ","1","HL7StructuredDocumentReferenceSequence"],A402:["UI","1","ObservationSubjectUIDTrial"],A403:["CS","1","ObservationSubjectClassTrial"],A404:["SQ","1","ObservationSubjectTypeCodeSequenceTrial"],A491:["CS","1","CompletionFlag"],A492:["LO","1","CompletionFlagDescription"],A493:["CS","1","VerificationFlag"],A494:["CS","1","ArchiveRequested"],A496:["CS","1","PreliminaryFlag"],A504:["SQ","1","ContentTemplateSequence"],A525:["SQ","1","IdenticalDocumentsSequence"],A600:["CS","1","ObservationSubjectContextFlagTrial"],A601:["CS","1","ObserverContextFlagTrial"],A603:["CS","1","ProcedureContextFlagTrial"],A730:["SQ","1","ContentSequence"],A731:["SQ","1","RelationshipSequenceTrial"],A732:["SQ","1","RelationshipTypeCodeSequenceTrial"],A744:["SQ","1","LanguageCodeSequenceTrial"],A801:["SQ","1","TabulatedValuesSequence"],A802:["UL","1","NumberOfTableRows"],A803:["UL","1","NumberOfTableColumns"],A804:["UL","1","TableRowNumber"],A805:["UL","1","TableColumnNumber"],A806:["SQ","1","TableRowDefinitionSequence"],A807:["SQ","1","TableColumnDefinitionSequence"],A808:["SQ","1","CellValuesSequence"],A992:["ST","1","UniformResourceLocatorTrial"],B020:["SQ","1","WaveformAnnotationSequence"],DB00:["CS","1","TemplateIdentifier"],DB06:["DT","1","TemplateVersion"],DB07:["DT","1","TemplateLocalVersion"],DB0B:["CS","1","TemplateExtensionFlag"],DB0C:["UI","1","TemplateExtensionOrganizationUID"],DB0D:["UI","1","TemplateExtensionCreatorUID"],DB73:["UL","1-n","ReferencedContentItemIdentifier"],E001:["ST","1","HL7InstanceIdentifier"],E004:["DT","1","HL7DocumentEffectiveTime"],E006:["SQ","1","HL7DocumentTypeCodeSequence"],E008:["SQ","1","DocumentClassCodeSequence"],E010:["UR","1","RetrieveURI"],E011:["UI","1","RetrieveLocationUID"],E020:["CS","1","TypeOfInstances"],E021:["SQ","1","DICOMRetrievalSequence"],E022:["SQ","1","DICOMMediaRetrievalSequence"],E023:["SQ","1","WADORetrievalSequence"],E024:["SQ","1","XDSRetrievalSequence"],E025:["SQ","1","WADORSRetrievalSequence"],E030:["UI","1","RepositoryUniqueID"],E031:["UI","1","HomeCommunityID"]},"0042":{"0000":["UL","1","GenericGroupLength"],"0010":["ST","1","DocumentTitle"],"0011":["OB","1","EncapsulatedDocument"],"0012":["LO","1","MIMETypeOfEncapsulatedDocument"],"0013":["SQ","1","SourceInstanceSequence"],"0014":["LO","1-n","ListOfMIMETypes"],"0015":["UL","1","EncapsulatedDocumentLength"]},"0044":{"0000":["UL","1","GenericGroupLength"],"0001":["ST","1","ProductPackageIdentifier"],"0002":["CS","1","SubstanceAdministrationApproval"],"0003":["LT","1","ApprovalStatusFurtherDescription"],"0004":["DT","1","ApprovalStatusDateTime"],"0007":["SQ","1","ProductTypeCodeSequence"],"0008":["LO","1-n","ProductName"],"0009":["LT","1","ProductDescription"],"000A":["LO","1","ProductLotIdentifier"],"000B":["DT","1","ProductExpirationDateTime"],"0010":["DT","1","SubstanceAdministrationDateTime"],"0011":["LO","1","SubstanceAdministrationNotes"],"0012":["LO","1","SubstanceAdministrationDeviceID"],"0013":["SQ","1","ProductParameterSequence"],"0019":["SQ","1","SubstanceAdministrationParameterSequence"],"0100":["SQ","1","ApprovalSequence"],"0101":["SQ","1","AssertionCodeSequence"],"0102":["UI","1","AssertionUID"],"0103":["SQ","1","AsserterIdentificationSequence"],"0104":["DT","1","AssertionDateTime"],"0105":["DT","1","AssertionExpirationDateTime"],"0106":["UT","1","AssertionComments"],"0107":["SQ","1","RelatedAssertionSequence"],"0108":["UI","1","ReferencedAssertionUID"],"0109":["SQ","1","ApprovalSubjectSequence"],"010A":["SQ","1","OrganizationalRoleCodeSequence"]},"0046":{"0000":["UL","1","GenericGroupLength"],"0012":["LO","1","LensDescription"],"0014":["SQ","1","RightLensSequence"],"0015":["SQ","1","LeftLensSequence"],"0016":["SQ","1","UnspecifiedLateralityLensSequence"],"0018":["SQ","1","CylinderSequence"],"0028":["SQ","1","PrismSequence"],"0030":["FD","1","HorizontalPrismPower"],"0032":["CS","1","HorizontalPrismBase"],"0034":["FD","1","VerticalPrismPower"],"0036":["CS","1","VerticalPrismBase"],"0038":["CS","1","LensSegmentType"],"0040":["FD","1","OpticalTransmittance"],"0042":["FD","1","ChannelWidth"],"0044":["FD","1","PupilSize"],"0046":["FD","1","CornealSize"],"0047":["SQ","1","CornealSizeSequence"],"0050":["SQ","1","AutorefractionRightEyeSequence"],"0052":["SQ","1","AutorefractionLeftEyeSequence"],"0060":["FD","1","DistancePupillaryDistance"],"0062":["FD","1","NearPupillaryDistance"],"0063":["FD","1","IntermediatePupillaryDistance"],"0064":["FD","1","OtherPupillaryDistance"],"0070":["SQ","1","KeratometryRightEyeSequence"],"0071":["SQ","1","KeratometryLeftEyeSequence"],"0074":["SQ","1","SteepKeratometricAxisSequence"],"0075":["FD","1","RadiusOfCurvature"],"0076":["FD","1","KeratometricPower"],"0077":["FD","1","KeratometricAxis"],"0080":["SQ","1","FlatKeratometricAxisSequence"],"0092":["CS","1","BackgroundColor"],"0094":["CS","1","Optotype"],"0095":["CS","1","OptotypePresentation"],"0097":["SQ","1","SubjectiveRefractionRightEyeSequence"],"0098":["SQ","1","SubjectiveRefractionLeftEyeSequence"],"0100":["SQ","1","AddNearSequence"],"0101":["SQ","1","AddIntermediateSequence"],"0102":["SQ","1","AddOtherSequence"],"0104":["FD","1","AddPower"],"0106":["FD","1","ViewingDistance"],"0110":["SQ","1","CorneaMeasurementsSequence"],"0111":["SQ","1","SourceOfCorneaMeasurementDataCodeSequence"],"0112":["SQ","1","SteepCornealAxisSequence"],"0113":["SQ","1","FlatCornealAxisSequence"],"0114":["FD","1","CornealPower"],"0115":["FD","1","CornealAxis"],"0116":["SQ","1","CorneaMeasurementMethodCodeSequence"],"0117":["FL","1","RefractiveIndexOfCornea"],"0118":["FL","1","RefractiveIndexOfAqueousHumor"],"0121":["SQ","1","VisualAcuityTypeCodeSequence"],"0122":["SQ","1","VisualAcuityRightEyeSequence"],"0123":["SQ","1","VisualAcuityLeftEyeSequence"],"0124":["SQ","1","VisualAcuityBothEyesOpenSequence"],"0125":["CS","1","ViewingDistanceType"],"0135":["SS","2","VisualAcuityModifiers"],"0137":["FD","1","DecimalVisualAcuity"],"0139":["LO","1","OptotypeDetailedDefinition"],"0145":["SQ","1","ReferencedRefractiveMeasurementsSequence"],"0146":["FD","1","SpherePower"],"0147":["FD","1","CylinderPower"],"0201":["CS","1","CornealTopographySurface"],"0202":["FL","2","CornealVertexLocation"],"0203":["FL","1","PupilCentroidXCoordinate"],"0204":["FL","1","PupilCentroidYCoordinate"],"0205":["FL","1","EquivalentPupilRadius"],"0207":["SQ","1","CornealTopographyMapTypeCodeSequence"],"0208":["IS","2-2n","VerticesOfTheOutlineOfPupil"],"0210":["SQ","1","CornealTopographyMappingNormalsSequence"],"0211":["SQ","1","MaximumCornealCurvatureSequence"],"0212":["FL","1","MaximumCornealCurvature"],"0213":["FL","2","MaximumCornealCurvatureLocation"],"0215":["SQ","1","MinimumKeratometricSequence"],"0218":["SQ","1","SimulatedKeratometricCylinderSequence"],"0220":["FL","1","AverageCornealPower"],"0224":["FL","1","CornealISValue"],"0227":["FL","1","AnalyzedArea"],"0230":["FL","1","SurfaceRegularityIndex"],"0232":["FL","1","SurfaceAsymmetryIndex"],"0234":["FL","1","CornealEccentricityIndex"],"0236":["FL","1","KeratoconusPredictionIndex"],"0238":["FL","1","DecimalPotentialVisualAcuity"],"0242":["CS","1","CornealTopographyMapQualityEvaluation"],"0244":["SQ","1","SourceImageCornealProcessedDataSequence"],"0247":["FL","3","CornealPointLocation"],"0248":["CS","1","CornealPointEstimated"],"0249":["FL","1","AxialPower"],"0250":["FL","1","TangentialPower"],"0251":["FL","1","RefractivePower"],"0252":["FL","1","RelativeElevation"],"0253":["FL","1","CornealWavefront"]},"0048":{"0000":["UL","1","GenericGroupLength"],"0001":["FL","1","ImagedVolumeWidth"],"0002":["FL","1","ImagedVolumeHeight"],"0003":["FL","1","ImagedVolumeDepth"],"0006":["UL","1","TotalPixelMatrixColumns"],"0007":["UL","1","TotalPixelMatrixRows"],"0008":["SQ","1","TotalPixelMatrixOriginSequence"],"0010":["CS","1","SpecimenLabelInImage"],"0011":["CS","1","FocusMethod"],"0012":["CS","1","ExtendedDepthOfField"],"0013":["US","1","NumberOfFocalPlanes"],"0014":["FL","1","DistanceBetweenFocalPlanes"],"0015":["US","3","RecommendedAbsentPixelCIELabValue"],"0100":["SQ","1","IlluminatorTypeCodeSequence"],"0102":["DS","6","ImageOrientationSlide"],"0105":["SQ","1","OpticalPathSequence"],"0106":["SH","1","OpticalPathIdentifier"],"0107":["ST","1","OpticalPathDescription"],"0108":["SQ","1","IlluminationColorCodeSequence"],"0110":["SQ","1","SpecimenReferenceSequence"],"0111":["DS","1","CondenserLensPower"],"0112":["DS","1","ObjectiveLensPower"],"0113":["DS","1","ObjectiveLensNumericalAperture"],"0120":["SQ","1","PaletteColorLookupTableSequence"],"0200":["SQ","1","ReferencedImageNavigationSequence"],"0201":["US","2","TopLeftHandCornerOfLocalizerArea"],"0202":["US","2","BottomRightHandCornerOfLocalizerArea"],"0207":["SQ","1","OpticalPathIdentificationSequence"],"021A":["SQ","1","PlanePositionSlideSequence"],"021E":["SL","1","ColumnPositionInTotalImagePixelMatrix"],"021F":["SL","1","RowPositionInTotalImagePixelMatrix"],"0301":["CS","1","PixelOriginInterpretation"],"0302":["UL","1","NumberOfOpticalPaths"],"0303":["UL","1","TotalPixelMatrixFocalPlanes"]},"0050":{"0000":["UL","1","GenericGroupLength"],"0004":["CS","1","CalibrationImage"],"0010":["SQ","1","DeviceSequence"],"0012":["SQ","1","ContainerComponentTypeCodeSequence"],"0013":["FD","1","ContainerComponentThickness"],"0014":["DS","1","DeviceLength"],"0015":["FD","1","ContainerComponentWidth"],"0016":["DS","1","DeviceDiameter"],"0017":["CS","1","DeviceDiameterUnits"],"0018":["DS","1","DeviceVolume"],"0019":["DS","1","InterMarkerDistance"],"001A":["CS","1","ContainerComponentMaterial"],"001B":["LO","1","ContainerComponentID"],"001C":["FD","1","ContainerComponentLength"],"001D":["FD","1","ContainerComponentDiameter"],"001E":["LO","1","ContainerComponentDescription"],"0020":["LO","1","DeviceDescription"],"0021":["ST","1","LongDeviceDescription"]},"0052":{"0000":["UL","1","GenericGroupLength"],"0001":["FL","1","ContrastBolusIngredientPercentByVolume"],"0002":["FD","1","OCTFocalDistance"],"0003":["FD","1","BeamSpotSize"],"0004":["FD","1","EffectiveRefractiveIndex"],"0006":["CS","1","OCTAcquisitionDomain"],"0007":["FD","1","OCTOpticalCenterWavelength"],"0008":["FD","1","AxialResolution"],"0009":["FD","1","RangingDepth"],"0011":["FD","1","ALineRate"],"0012":["US","1","ALinesPerFrame"],"0013":["FD","1","CatheterRotationalRate"],"0014":["FD","1","ALinePixelSpacing"],"0016":["SQ","1","ModeOfPercutaneousAccessSequence"],"0025":["SQ","1","IntravascularOCTFrameTypeSequence"],"0026":["CS","1","OCTZOffsetApplied"],"0027":["SQ","1","IntravascularFrameContentSequence"],"0028":["FD","1","IntravascularLongitudinalDistance"],"0029":["SQ","1","IntravascularOCTFrameContentSequence"],"0030":["SS","1","OCTZOffsetCorrection"],"0031":["CS","1","CatheterDirectionOfRotation"],"0033":["FD","1","SeamLineLocation"],"0034":["FD","1","FirstALineLocation"],"0036":["US","1","SeamLineIndex"],"0038":["US","1","NumberOfPaddedALines"],"0039":["CS","1","InterpolationType"],"003A":["CS","1","RefractiveIndexApplied"]},"0054":{"0000":["UL","1","GenericGroupLength"],"0010":["US","1-n","EnergyWindowVector"],"0011":["US","1","NumberOfEnergyWindows"],"0012":["SQ","1","EnergyWindowInformationSequence"],"0013":["SQ","1","EnergyWindowRangeSequence"],"0014":["DS","1","EnergyWindowLowerLimit"],"0015":["DS","1","EnergyWindowUpperLimit"],"0016":["SQ","1","RadiopharmaceuticalInformationSequence"],"0017":["IS","1","ResidualSyringeCounts"],"0018":["SH","1","EnergyWindowName"],"0020":["US","1-n","DetectorVector"],"0021":["US","1","NumberOfDetectors"],"0022":["SQ","1","DetectorInformationSequence"],"0030":["US","1-n","PhaseVector"],"0031":["US","1","NumberOfPhases"],"0032":["SQ","1","PhaseInformationSequence"],"0033":["US","1","NumberOfFramesInPhase"],"0036":["IS","1","PhaseDelay"],"0038":["IS","1","PauseBetweenFrames"],"0039":["CS","1","PhaseDescription"],"0050":["US","1-n","RotationVector"],"0051":["US","1","NumberOfRotations"],"0052":["SQ","1","RotationInformationSequence"],"0053":["US","1","NumberOfFramesInRotation"],"0060":["US","1-n","RRIntervalVector"],"0061":["US","1","NumberOfRRIntervals"],"0062":["SQ","1","GatedInformationSequence"],"0063":["SQ","1","DataInformationSequence"],"0070":["US","1-n","TimeSlotVector"],"0071":["US","1","NumberOfTimeSlots"],"0072":["SQ","1","TimeSlotInformationSequence"],"0073":["DS","1","TimeSlotTime"],"0080":["US","1-n","SliceVector"],"0081":["US","1","NumberOfSlices"],"0090":["US","1-n","AngularViewVector"],"0100":["US","1-n","TimeSliceVector"],"0101":["US","1","NumberOfTimeSlices"],"0200":["DS","1","StartAngle"],"0202":["CS","1","TypeOfDetectorMotion"],"0210":["IS","1-n","TriggerVector"],"0211":["US","1","NumberOfTriggersInPhase"],"0220":["SQ","1","ViewCodeSequence"],"0222":["SQ","1","ViewModifierCodeSequence"],"0300":["SQ","1","RadionuclideCodeSequence"],"0302":["SQ","1","AdministrationRouteCodeSequence"],"0304":["SQ","1","RadiopharmaceuticalCodeSequence"],"0306":["SQ","1","CalibrationDataSequence"],"0308":["US","1","EnergyWindowNumber"],"0400":["SH","1","ImageID"],"0410":["SQ","1","PatientOrientationCodeSequence"],"0412":["SQ","1","PatientOrientationModifierCodeSequence"],"0414":["SQ","1","PatientGantryRelationshipCodeSequence"],"0500":["CS","1","SliceProgressionDirection"],"0501":["CS","1","ScanProgressionDirection"],1e3:["CS","2","SeriesType"],1001:["CS","1","Units"],1002:["CS","1","CountsSource"],1004:["CS","1","ReprojectionMethod"],1006:["CS","1","SUVType"],1100:["CS","1","RandomsCorrectionMethod"],1101:["LO","1","AttenuationCorrectionMethod"],1102:["CS","1","DecayCorrection"],1103:["LO","1","ReconstructionMethod"],1104:["LO","1","DetectorLinesOfResponseUsed"],1105:["LO","1","ScatterCorrectionMethod"],1200:["DS","1","AxialAcceptance"],1201:["IS","2","AxialMash"],1202:["IS","1","TransverseMash"],1203:["DS","2","DetectorElementSize"],1210:["DS","1","CoincidenceWindowWidth"],1220:["CS","1-n","SecondaryCountsType"],1300:["DS","1","FrameReferenceTime"],1310:["IS","1","PrimaryPromptsCountsAccumulated"],1311:["IS","1-n","SecondaryCountsAccumulated"],1320:["DS","1","SliceSensitivityFactor"],1321:["DS","1","DecayFactor"],1322:["DS","1","DoseCalibrationFactor"],1323:["DS","1","ScatterFractionFactor"],1324:["DS","1","DeadTimeFactor"],1330:["US","1","ImageIndex"],1400:["CS","1-n","CountsIncluded"],1401:["CS","1","DeadTimeCorrectionFlag"]},"0060":{"0000":["UL","1","GenericGroupLength"],3e3:["SQ","1","HistogramSequence"],3002:["US","1","HistogramNumberOfBins"],3004:["xs","1","HistogramFirstBinValue"],3006:["xs","1","HistogramLastBinValue"],3008:["US","1","HistogramBinWidth"],3010:["LO","1","HistogramExplanation"],3020:["UL","1-n","HistogramData"]},"0062":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","SegmentationType"],"0002":["SQ","1","SegmentSequence"],"0003":["SQ","1","SegmentedPropertyCategoryCodeSequence"],"0004":["US","1","SegmentNumber"],"0005":["LO","1","SegmentLabel"],"0006":["ST","1","SegmentDescription"],"0007":["SQ","1","SegmentationAlgorithmIdentificationSequence"],"0008":["CS","1","SegmentAlgorithmType"],"0009":["LO","1-n","SegmentAlgorithmName"],"000A":["SQ","1","SegmentIdentificationSequence"],"000B":["US","1-n","ReferencedSegmentNumber"],"000C":["US","1","RecommendedDisplayGrayscaleValue"],"000D":["US","3","RecommendedDisplayCIELabValue"],"000E":["US","1","MaximumFractionalValue"],"000F":["SQ","1","SegmentedPropertyTypeCodeSequence"],"0010":["CS","1","SegmentationFractionalType"],"0011":["SQ","1","SegmentedPropertyTypeModifierCodeSequence"],"0012":["SQ","1","UsedSegmentsSequence"],"0013":["CS","1","SegmentsOverlap"],"0020":["UT","1","TrackingID"],"0021":["UI","1","TrackingUID"]},"0064":{"0000":["UL","1","GenericGroupLength"],"0002":["SQ","1","DeformableRegistrationSequence"],"0003":["UI","1","SourceFrameOfReferenceUID"],"0005":["SQ","1","DeformableRegistrationGridSequence"],"0007":["UL","3","GridDimensions"],"0008":["FD","3","GridResolution"],"0009":["OF","1","VectorGridData"],"000F":["SQ","1","PreDeformationMatrixRegistrationSequence"],"0010":["SQ","1","PostDeformationMatrixRegistrationSequence"]},"0066":{"0000":["UL","1","GenericGroupLength"],"0001":["UL","1","NumberOfSurfaces"],"0002":["SQ","1","SurfaceSequence"],"0003":["UL","1","SurfaceNumber"],"0004":["LT","1","SurfaceComments"],"0009":["CS","1","SurfaceProcessing"],"000A":["FL","1","SurfaceProcessingRatio"],"000B":["LO","1","SurfaceProcessingDescription"],"000C":["FL","1","RecommendedPresentationOpacity"],"000D":["CS","1","RecommendedPresentationType"],"000E":["CS","1","FiniteVolume"],"0010":["CS","1","Manifold"],"0011":["SQ","1","SurfacePointsSequence"],"0012":["SQ","1","SurfacePointsNormalsSequence"],"0013":["SQ","1","SurfaceMeshPrimitivesSequence"],"0015":["UL","1","NumberOfSurfacePoints"],"0016":["OF","1","PointCoordinatesData"],"0017":["FL","3","PointPositionAccuracy"],"0018":["FL","1","MeanPointDistance"],"0019":["FL","1","MaximumPointDistance"],"001A":["FL","6","PointsBoundingBoxCoordinates"],"001B":["FL","3","AxisOfRotation"],"001C":["FL","3","CenterOfRotation"],"001E":["UL","1","NumberOfVectors"],"001F":["US","1","VectorDimensionality"],"0020":["FL","1-n","VectorAccuracy"],"0021":["OF","1","VectorCoordinateData"],"0022":["OD","1","DoublePointCoordinatesData"],"0023":["OW","1","TrianglePointIndexList"],"0024":["OW","1","EdgePointIndexList"],"0025":["OW","1","VertexPointIndexList"],"0026":["SQ","1","TriangleStripSequence"],"0027":["SQ","1","TriangleFanSequence"],"0028":["SQ","1","LineSequence"],"0029":["OW","1","PrimitivePointIndexList"],"002A":["UL","1","SurfaceCount"],"002B":["SQ","1","ReferencedSurfaceSequence"],"002C":["UL","1","ReferencedSurfaceNumber"],"002D":["SQ","1","SegmentSurfaceGenerationAlgorithmIdentificationSequence"],"002E":["SQ","1","SegmentSurfaceSourceInstanceSequence"],"002F":["SQ","1","AlgorithmFamilyCodeSequence"],"0030":["SQ","1","AlgorithmNameCodeSequence"],"0031":["LO","1","AlgorithmVersion"],"0032":["LT","1","AlgorithmParameters"],"0034":["SQ","1","FacetSequence"],"0035":["SQ","1","SurfaceProcessingAlgorithmIdentificationSequence"],"0036":["LO","1","AlgorithmName"],"0037":["FL","1","RecommendedPointRadius"],"0038":["FL","1","RecommendedLineThickness"],"0040":["OL","1","LongPrimitivePointIndexList"],"0041":["OL","1","LongTrianglePointIndexList"],"0042":["OL","1","LongEdgePointIndexList"],"0043":["OL","1","LongVertexPointIndexList"],"0101":["SQ","1","TrackSetSequence"],"0102":["SQ","1","TrackSequence"],"0103":["OW","1","RecommendedDisplayCIELabValueList"],"0104":["SQ","1","TrackingAlgorithmIdentificationSequence"],"0105":["UL","1","TrackSetNumber"],"0106":["LO","1","TrackSetLabel"],"0107":["UT","1","TrackSetDescription"],"0108":["SQ","1","TrackSetAnatomicalTypeCodeSequence"],"0121":["SQ","1","MeasurementsSequence"],"0124":["SQ","1","TrackSetStatisticsSequence"],"0125":["OF","1","FloatingPointValues"],"0129":["OL","1","TrackPointIndexList"],"0130":["SQ","1","TrackStatisticsSequence"],"0132":["SQ","1","MeasurementValuesSequence"],"0133":["SQ","1","DiffusionAcquisitionCodeSequence"],"0134":["SQ","1","DiffusionModelCodeSequence"]},"0068":{"0000":["UL","1","GenericGroupLength"],6210:["LO","1","ImplantSize"],6221:["LO","1","ImplantTemplateVersion"],6222:["SQ","1","ReplacedImplantTemplateSequence"],6223:["CS","1","ImplantType"],6224:["SQ","1","DerivationImplantTemplateSequence"],6225:["SQ","1","OriginalImplantTemplateSequence"],6226:["DT","1","EffectiveDateTime"],6230:["SQ","1","ImplantTargetAnatomySequence"],6260:["SQ","1","InformationFromManufacturerSequence"],6265:["SQ","1","NotificationFromManufacturerSequence"],6270:["DT","1","InformationIssueDateTime"],6280:["ST","1","InformationSummary"],"62A0":["SQ","1","ImplantRegulatoryDisapprovalCodeSequence"],"62A5":["FD","1","OverallTemplateSpatialTolerance"],"62C0":["SQ","1","HPGLDocumentSequence"],"62D0":["US","1","HPGLDocumentID"],"62D5":["LO","1","HPGLDocumentLabel"],"62E0":["SQ","1","ViewOrientationCodeSequence"],"62F0":["SQ","1","ViewOrientationModifierCodeSequence"],"62F2":["FD","1","HPGLDocumentScaling"],6300:["OB","1","HPGLDocument"],6310:["US","1","HPGLContourPenNumber"],6320:["SQ","1","HPGLPenSequence"],6330:["US","1","HPGLPenNumber"],6340:["LO","1","HPGLPenLabel"],6345:["ST","1","HPGLPenDescription"],6346:["FD","2","RecommendedRotationPoint"],6347:["FD","4","BoundingRectangle"],6350:["US","1-n","ImplantTemplate3DModelSurfaceNumber"],6360:["SQ","1","SurfaceModelDescriptionSequence"],6380:["LO","1","SurfaceModelLabel"],6390:["FD","1","SurfaceModelScalingFactor"],"63A0":["SQ","1","MaterialsCodeSequence"],"63A4":["SQ","1","CoatingMaterialsCodeSequence"],"63A8":["SQ","1","ImplantTypeCodeSequence"],"63AC":["SQ","1","FixationMethodCodeSequence"],"63B0":["SQ","1","MatingFeatureSetsSequence"],"63C0":["US","1","MatingFeatureSetID"],"63D0":["LO","1","MatingFeatureSetLabel"],"63E0":["SQ","1","MatingFeatureSequence"],"63F0":["US","1","MatingFeatureID"],6400:["SQ","1","MatingFeatureDegreeOfFreedomSequence"],6410:["US","1","DegreeOfFreedomID"],6420:["CS","1","DegreeOfFreedomType"],6430:["SQ","1","TwoDMatingFeatureCoordinatesSequence"],6440:["US","1","ReferencedHPGLDocumentID"],6450:["FD","2","TwoDMatingPoint"],6460:["FD","4","TwoDMatingAxes"],6470:["SQ","1","TwoDDegreeOfFreedomSequence"],6490:["FD","3","ThreeDDegreeOfFreedomAxis"],"64A0":["FD","2","RangeOfFreedom"],"64C0":["FD","3","ThreeDMatingPoint"],"64D0":["FD","9","ThreeDMatingAxes"],"64F0":["FD","3","TwoDDegreeOfFreedomAxis"],6500:["SQ","1","PlanningLandmarkPointSequence"],6510:["SQ","1","PlanningLandmarkLineSequence"],6520:["SQ","1","PlanningLandmarkPlaneSequence"],6530:["US","1","PlanningLandmarkID"],6540:["LO","1","PlanningLandmarkDescription"],6545:["SQ","1","PlanningLandmarkIdentificationCodeSequence"],6550:["SQ","1","TwoDPointCoordinatesSequence"],6560:["FD","2","TwoDPointCoordinates"],6590:["FD","3","ThreeDPointCoordinates"],"65A0":["SQ","1","TwoDLineCoordinatesSequence"],"65B0":["FD","4","TwoDLineCoordinates"],"65D0":["FD","6","ThreeDLineCoordinates"],"65E0":["SQ","1","TwoDPlaneCoordinatesSequence"],"65F0":["FD","4","TwoDPlaneIntersection"],6610:["FD","3","ThreeDPlaneOrigin"],6620:["FD","3","ThreeDPlaneNormal"],7001:["CS","1","ModelModification"],7002:["CS","1","ModelMirroring"],7003:["SQ","1","ModelUsageCodeSequence"],7004:["UI","1","ModelGroupUID"],7005:["UR","1","RelativeURIReferenceWithinEncapsulatedDocument"]},"006A":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","AnnotationCoordinateType"],"0002":["SQ","1","AnnotationGroupSequence"],"0003":["UI","1","AnnotationGroupUID"],"0005":["LO","1","AnnotationGroupLabel"],"0006":["UT","1","AnnotationGroupDescription"],"0007":["CS","1","AnnotationGroupGenerationType"],"0008":["SQ","1","AnnotationGroupAlgorithmIdentificationSequence"],"0009":["SQ","1","AnnotationPropertyCategoryCodeSequence"],"000A":["SQ","1","AnnotationPropertyTypeCodeSequence"],"000B":["SQ","1","AnnotationPropertyTypeModifierCodeSequence"],"000C":["UL","1","NumberOfAnnotations"],"000D":["CS","1","AnnotationAppliesToAllOpticalPaths"],"000E":["SH","1-n","ReferencedOpticalPathIdentifier"],"000F":["CS","1","AnnotationAppliesToAllZPlanes"],"0010":["FD","1-n","CommonZCoordinateValue"],"0011":["OL","1","AnnotationIndexList"]},"0070":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","GraphicAnnotationSequence"],"0002":["CS","1","GraphicLayer"],"0003":["CS","1","BoundingBoxAnnotationUnits"],"0004":["CS","1","AnchorPointAnnotationUnits"],"0005":["CS","1","GraphicAnnotationUnits"],"0006":["ST","1","UnformattedTextValue"],"0008":["SQ","1","TextObjectSequence"],"0009":["SQ","1","GraphicObjectSequence"],"0010":["FL","2","BoundingBoxTopLeftHandCorner"],"0011":["FL","2","BoundingBoxBottomRightHandCorner"],"0012":["CS","1","BoundingBoxTextHorizontalJustification"],"0014":["FL","2","AnchorPoint"],"0015":["CS","1","AnchorPointVisibility"],"0020":["US","1","GraphicDimensions"],"0021":["US","1","NumberOfGraphicPoints"],"0022":["FL","2-n","GraphicData"],"0023":["CS","1","GraphicType"],"0024":["CS","1","GraphicFilled"],"0040":["IS","1","ImageRotationRetired"],"0041":["CS","1","ImageHorizontalFlip"],"0042":["US","1","ImageRotation"],"0050":["US","2","DisplayedAreaTopLeftHandCornerTrial"],"0051":["US","2","DisplayedAreaBottomRightHandCornerTrial"],"0052":["SL","2","DisplayedAreaTopLeftHandCorner"],"0053":["SL","2","DisplayedAreaBottomRightHandCorner"],"005A":["SQ","1","DisplayedAreaSelectionSequence"],"0060":["SQ","1","GraphicLayerSequence"],"0062":["IS","1","GraphicLayerOrder"],"0066":["US","1","GraphicLayerRecommendedDisplayGrayscaleValue"],"0067":["US","3","GraphicLayerRecommendedDisplayRGBValue"],"0068":["LO","1","GraphicLayerDescription"],"0080":["CS","1","ContentLabel"],"0081":["LO","1","ContentDescription"],"0082":["DA","1","PresentationCreationDate"],"0083":["TM","1","PresentationCreationTime"],"0084":["PN","1","ContentCreatorName"],"0086":["SQ","1","ContentCreatorIdentificationCodeSequence"],"0087":["SQ","1","AlternateContentDescriptionSequence"],"0100":["CS","1","PresentationSizeMode"],"0101":["DS","2","PresentationPixelSpacing"],"0102":["IS","2","PresentationPixelAspectRatio"],"0103":["FL","1","PresentationPixelMagnificationRatio"],"0207":["LO","1","GraphicGroupLabel"],"0208":["ST","1","GraphicGroupDescription"],"0209":["SQ","1","CompoundGraphicSequence"],"0226":["UL","1","CompoundGraphicInstanceID"],"0227":["LO","1","FontName"],"0228":["CS","1","FontNameType"],"0229":["LO","1","CSSFontName"],"0230":["FD","1","RotationAngle"],"0231":["SQ","1","TextStyleSequence"],"0232":["SQ","1","LineStyleSequence"],"0233":["SQ","1","FillStyleSequence"],"0234":["SQ","1","GraphicGroupSequence"],"0241":["US","3","TextColorCIELabValue"],"0242":["CS","1","HorizontalAlignment"],"0243":["CS","1","VerticalAlignment"],"0244":["CS","1","ShadowStyle"],"0245":["FL","1","ShadowOffsetX"],"0246":["FL","1","ShadowOffsetY"],"0247":["US","3","ShadowColorCIELabValue"],"0248":["CS","1","Underlined"],"0249":["CS","1","Bold"],"0250":["CS","1","Italic"],"0251":["US","3","PatternOnColorCIELabValue"],"0252":["US","3","PatternOffColorCIELabValue"],"0253":["FL","1","LineThickness"],"0254":["CS","1","LineDashingStyle"],"0255":["UL","1","LinePattern"],"0256":["OB","1","FillPattern"],"0257":["CS","1","FillMode"],"0258":["FL","1","ShadowOpacity"],"0261":["FL","1","GapLength"],"0262":["FL","1","DiameterOfVisibility"],"0273":["FL","2","RotationPoint"],"0274":["CS","1","TickAlignment"],"0278":["CS","1","ShowTickLabel"],"0279":["CS","1","TickLabelAlignment"],"0282":["CS","1","CompoundGraphicUnits"],"0284":["FL","1","PatternOnOpacity"],"0285":["FL","1","PatternOffOpacity"],"0287":["SQ","1","MajorTicksSequence"],"0288":["FL","1","TickPosition"],"0289":["SH","1","TickLabel"],"0294":["CS","1","CompoundGraphicType"],"0295":["UL","1","GraphicGroupID"],"0306":["CS","1","ShapeType"],"0308":["SQ","1","RegistrationSequence"],"0309":["SQ","1","MatrixRegistrationSequence"],"030A":["SQ","1","MatrixSequence"],"030B":["FD","16","FrameOfReferenceToDisplayedCoordinateSystemTransformationMatrix"],"030C":["CS","1","FrameOfReferenceTransformationMatrixType"],"030D":["SQ","1","RegistrationTypeCodeSequence"],"030F":["ST","1","FiducialDescription"],"0310":["SH","1","FiducialIdentifier"],"0311":["SQ","1","FiducialIdentifierCodeSequence"],"0312":["FD","1","ContourUncertaintyRadius"],"0314":["SQ","1","UsedFiducialsSequence"],"0318":["SQ","1","GraphicCoordinatesDataSequence"],"031A":["UI","1","FiducialUID"],"031B":["UI","1","ReferencedFiducialUID"],"031C":["SQ","1","FiducialSetSequence"],"031E":["SQ","1","FiducialSequence"],"031F":["SQ","1","FiducialsPropertyCategoryCodeSequence"],"0401":["US","3","GraphicLayerRecommendedDisplayCIELabValue"],"0402":["SQ","1","BlendingSequence"],"0403":["FL","1","RelativeOpacity"],"0404":["SQ","1","ReferencedSpatialRegistrationSequence"],"0405":["CS","1","BlendingPosition"],1101:["UI","1","PresentationDisplayCollectionUID"],1102:["UI","1","PresentationSequenceCollectionUID"],1103:["US","1","PresentationSequencePositionIndex"],1104:["SQ","1","RenderedImageReferenceSequence"],1201:["SQ","1","VolumetricPresentationStateInputSequence"],1202:["CS","1","PresentationInputType"],1203:["US","1","InputSequencePositionIndex"],1204:["CS","1","Crop"],1205:["US","1-n","CroppingSpecificationIndex"],1206:["CS","1","CompositingMethod"],1207:["US","1","VolumetricPresentationInputNumber"],1208:["CS","1","ImageVolumeGeometry"],1209:["UI","1","VolumetricPresentationInputSetUID"],"120A":["SQ","1","VolumetricPresentationInputSetSequence"],"120B":["CS","1","GlobalCrop"],"120C":["US","1-n","GlobalCroppingSpecificationIndex"],"120D":["CS","1","RenderingMethod"],1301:["SQ","1","VolumeCroppingSequence"],1302:["CS","1","VolumeCroppingMethod"],1303:["FD","6","BoundingBoxCrop"],1304:["SQ","1","ObliqueCroppingPlaneSequence"],1305:["FD","4","Plane"],1306:["FD","3","PlaneNormal"],1309:["US","1","CroppingSpecificationNumber"],1501:["CS","1","MultiPlanarReconstructionStyle"],1502:["CS","1","MPRThicknessType"],1503:["FD","1","MPRSlabThickness"],1505:["FD","3","MPRTopLeftHandCorner"],1507:["FD","3","MPRViewWidthDirection"],1508:["FD","1","MPRViewWidth"],"150C":["UL","1","NumberOfVolumetricCurvePoints"],"150D":["OD","1","VolumetricCurvePoints"],1511:["FD","3","MPRViewHeightDirection"],1512:["FD","1","MPRViewHeight"],1602:["CS","1","RenderProjection"],1603:["FD","3","ViewpointPosition"],1604:["FD","3","ViewpointLookAtPoint"],1605:["FD","3","ViewpointUpDirection"],1606:["FD","6","RenderFieldOfView"],1607:["FD","1","SamplingStepSize"],1701:["CS","1","ShadingStyle"],1702:["FD","1","AmbientReflectionIntensity"],1703:["FD","3","LightDirection"],1704:["FD","1","DiffuseReflectionIntensity"],1705:["FD","1","SpecularReflectionIntensity"],1706:["FD","1","Shininess"],1801:["SQ","1","PresentationStateClassificationComponentSequence"],1802:["CS","1","ComponentType"],1803:["SQ","1","ComponentInputSequence"],1804:["US","1","VolumetricPresentationInputIndex"],1805:["SQ","1","PresentationStateCompositorComponentSequence"],1806:["SQ","1","WeightingTransferFunctionSequence"],1807:["US","3","WeightingLookupTableDescriptor"],1808:["OB","1","WeightingLookupTableData"],1901:["SQ","1","VolumetricAnnotationSequence"],1903:["SQ","1","ReferencedStructuredContextSequence"],1904:["UI","1","ReferencedContentItem"],1905:["SQ","1","VolumetricPresentationInputAnnotationSequence"],1907:["CS","1","AnnotationClipping"],"1A01":["CS","1","PresentationAnimationStyle"],"1A03":["FD","1","RecommendedAnimationRate"],"1A04":["SQ","1","AnimationCurveSequence"],"1A05":["FD","1","AnimationStepSize"],"1A06":["FD","1","SwivelRange"],"1A07":["OD","1","VolumetricCurveUpDirections"],"1A08":["SQ","1","VolumeStreamSequence"],"1A09":["LO","1","RGBATransferFunctionDescription"],"1B01":["SQ","1","AdvancedBlendingSequence"],"1B02":["US","1","BlendingInputNumber"],"1B03":["SQ","1","BlendingDisplayInputSequence"],"1B04":["SQ","1","BlendingDisplaySequence"],"1B06":["CS","1","BlendingMode"],"1B07":["CS","1","TimeSeriesBlending"],"1B08":["CS","1","GeometryForDisplay"],"1B11":["SQ","1","ThresholdSequence"],"1B12":["SQ","1","ThresholdValueSequence"],"1B13":["CS","1","ThresholdType"],"1B14":["FD","1","ThresholdValue"]},"0072":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","HangingProtocolName"],"0004":["LO","1","HangingProtocolDescription"],"0006":["CS","1","HangingProtocolLevel"],"0008":["LO","1","HangingProtocolCreator"],"000A":["DT","1","HangingProtocolCreationDateTime"],"000C":["SQ","1","HangingProtocolDefinitionSequence"],"000E":["SQ","1","HangingProtocolUserIdentificationCodeSequence"],"0010":["LO","1","HangingProtocolUserGroupName"],"0012":["SQ","1","SourceHangingProtocolSequence"],"0014":["US","1","NumberOfPriorsReferenced"],"0020":["SQ","1","ImageSetsSequence"],"0022":["SQ","1","ImageSetSelectorSequence"],"0024":["CS","1","ImageSetSelectorUsageFlag"],"0026":["AT","1","SelectorAttribute"],"0028":["US","1","SelectorValueNumber"],"0030":["SQ","1","TimeBasedImageSetsSequence"],"0032":["US","1","ImageSetNumber"],"0034":["CS","1","ImageSetSelectorCategory"],"0038":["US","2","RelativeTime"],"003A":["CS","1","RelativeTimeUnits"],"003C":["SS","2","AbstractPriorValue"],"003E":["SQ","1","AbstractPriorCodeSequence"],"0040":["LO","1","ImageSetLabel"],"0050":["CS","1","SelectorAttributeVR"],"0052":["AT","1-n","SelectorSequencePointer"],"0054":["LO","1-n","SelectorSequencePointerPrivateCreator"],"0056":["LO","1","SelectorAttributePrivateCreator"],"005E":["AE","1-n","SelectorAEValue"],"005F":["AS","1-n","SelectorASValue"],"0060":["AT","1-n","SelectorATValue"],"0061":["DA","1-n","SelectorDAValue"],"0062":["CS","1-n","SelectorCSValue"],"0063":["DT","1-n","SelectorDTValue"],"0064":["IS","1-n","SelectorISValue"],"0065":["OB","1","SelectorOBValue"],"0066":["LO","1-n","SelectorLOValue"],"0067":["OF","1","SelectorOFValue"],"0068":["LT","1","SelectorLTValue"],"0069":["OW","1","SelectorOWValue"],"006A":["PN","1-n","SelectorPNValue"],"006B":["TM","1-n","SelectorTMValue"],"006C":["SH","1-n","SelectorSHValue"],"006D":["UN","1","SelectorUNValue"],"006E":["ST","1","SelectorSTValue"],"006F":["UC","1-n","SelectorUCValue"],"0070":["UT","1","SelectorUTValue"],"0071":["UR","1","SelectorURValue"],"0072":["DS","1-n","SelectorDSValue"],"0073":["OD","1","SelectorODValue"],"0074":["FD","1-n","SelectorFDValue"],"0075":["OL","1","SelectorOLValue"],"0076":["FL","1-n","SelectorFLValue"],"0078":["UL","1-n","SelectorULValue"],"007A":["US","1-n","SelectorUSValue"],"007C":["SL","1-n","SelectorSLValue"],"007E":["SS","1-n","SelectorSSValue"],"007F":["UI","1-n","SelectorUIValue"],"0080":["SQ","1","SelectorCodeSequenceValue"],"0081":["OV","1","SelectorOVValue"],"0082":["SV","1-n","SelectorSVValue"],"0083":["UV","1-n","SelectorUVValue"],"0100":["US","1","NumberOfScreens"],"0102":["SQ","1","NominalScreenDefinitionSequence"],"0104":["US","1","NumberOfVerticalPixels"],"0106":["US","1","NumberOfHorizontalPixels"],"0108":["FD","4","DisplayEnvironmentSpatialPosition"],"010A":["US","1","ScreenMinimumGrayscaleBitDepth"],"010C":["US","1","ScreenMinimumColorBitDepth"],"010E":["US","1","ApplicationMaximumRepaintTime"],"0200":["SQ","1","DisplaySetsSequence"],"0202":["US","1","DisplaySetNumber"],"0203":["LO","1","DisplaySetLabel"],"0204":["US","1","DisplaySetPresentationGroup"],"0206":["LO","1","DisplaySetPresentationGroupDescription"],"0208":["CS","1","PartialDataDisplayHandling"],"0210":["SQ","1","SynchronizedScrollingSequence"],"0212":["US","2-n","DisplaySetScrollingGroup"],"0214":["SQ","1","NavigationIndicatorSequence"],"0216":["US","1","NavigationDisplaySet"],"0218":["US","1-n","ReferenceDisplaySets"],"0300":["SQ","1","ImageBoxesSequence"],"0302":["US","1","ImageBoxNumber"],"0304":["CS","1","ImageBoxLayoutType"],"0306":["US","1","ImageBoxTileHorizontalDimension"],"0308":["US","1","ImageBoxTileVerticalDimension"],"0310":["CS","1","ImageBoxScrollDirection"],"0312":["CS","1","ImageBoxSmallScrollType"],"0314":["US","1","ImageBoxSmallScrollAmount"],"0316":["CS","1","ImageBoxLargeScrollType"],"0318":["US","1","ImageBoxLargeScrollAmount"],"0320":["US","1","ImageBoxOverlapPriority"],"0330":["FD","1","CineRelativeToRealTime"],"0400":["SQ","1","FilterOperationsSequence"],"0402":["CS","1","FilterByCategory"],"0404":["CS","1","FilterByAttributePresence"],"0406":["CS","1","FilterByOperator"],"0420":["US","3","StructuredDisplayBackgroundCIELabValue"],"0421":["US","3","EmptyImageBoxCIELabValue"],"0422":["SQ","1","StructuredDisplayImageBoxSequence"],"0424":["SQ","1","StructuredDisplayTextBoxSequence"],"0427":["SQ","1","ReferencedFirstFrameSequence"],"0430":["SQ","1","ImageBoxSynchronizationSequence"],"0432":["US","2-n","SynchronizedImageBoxList"],"0434":["CS","1","TypeOfSynchronization"],"0500":["CS","1","BlendingOperationType"],"0510":["CS","1","ReformattingOperationType"],"0512":["FD","1","ReformattingThickness"],"0514":["FD","1","ReformattingInterval"],"0516":["CS","1","ReformattingOperationInitialViewDirection"],"0520":["CS","1-n","ThreeDRenderingType"],"0600":["SQ","1","SortingOperationsSequence"],"0602":["CS","1","SortByCategory"],"0604":["CS","1","SortingDirection"],"0700":["CS","2","DisplaySetPatientOrientation"],"0702":["CS","1","VOIType"],"0704":["CS","1","PseudoColorType"],"0705":["SQ","1","PseudoColorPaletteInstanceReferenceSequence"],"0706":["CS","1","ShowGrayscaleInverted"],"0710":["CS","1","ShowImageTrueSizeFlag"],"0712":["CS","1","ShowGraphicAnnotationFlag"],"0714":["CS","1","ShowPatientDemographicsFlag"],"0716":["CS","1","ShowAcquisitionTechniquesFlag"],"0717":["CS","1","DisplaySetHorizontalJustification"],"0718":["CS","1","DisplaySetVerticalJustification"]},"0074":{"0000":["UL","1","GenericGroupLength"],"0120":["FD","1","ContinuationStartMeterset"],"0121":["FD","1","ContinuationEndMeterset"],1e3:["CS","1","ProcedureStepState"],1002:["SQ","1","ProcedureStepProgressInformationSequence"],1004:["DS","1","ProcedureStepProgress"],1006:["ST","1","ProcedureStepProgressDescription"],1007:["SQ","1","ProcedureStepProgressParametersSequence"],1008:["SQ","1","ProcedureStepCommunicationsURISequence"],"100A":["UR","1","ContactURI"],"100C":["LO","1","ContactDisplayName"],"100E":["SQ","1","ProcedureStepDiscontinuationReasonCodeSequence"],1020:["SQ","1","BeamTaskSequence"],1022:["CS","1","BeamTaskType"],1024:["IS","1","BeamOrderIndexTrial"],1025:["CS","1","AutosequenceFlag"],1026:["FD","1","TableTopVerticalAdjustedPosition"],1027:["FD","1","TableTopLongitudinalAdjustedPosition"],1028:["FD","1","TableTopLateralAdjustedPosition"],"102A":["FD","1","PatientSupportAdjustedAngle"],"102B":["FD","1","TableTopEccentricAdjustedAngle"],"102C":["FD","1","TableTopPitchAdjustedAngle"],"102D":["FD","1","TableTopRollAdjustedAngle"],1030:["SQ","1","DeliveryVerificationImageSequence"],1032:["CS","1","VerificationImageTiming"],1034:["CS","1","DoubleExposureFlag"],1036:["CS","1","DoubleExposureOrdering"],1038:["DS","1","DoubleExposureMetersetTrial"],"103A":["DS","4","DoubleExposureFieldDeltaTrial"],1040:["SQ","1","RelatedReferenceRTImageSequence"],1042:["SQ","1","GeneralMachineVerificationSequence"],1044:["SQ","1","ConventionalMachineVerificationSequence"],1046:["SQ","1","IonMachineVerificationSequence"],1048:["SQ","1","FailedAttributesSequence"],"104A":["SQ","1","OverriddenAttributesSequence"],"104C":["SQ","1","ConventionalControlPointVerificationSequence"],"104E":["SQ","1","IonControlPointVerificationSequence"],1050:["SQ","1","AttributeOccurrenceSequence"],1052:["AT","1","AttributeOccurrencePointer"],1054:["UL","1","AttributeItemSelector"],1056:["LO","1","AttributeOccurrencePrivateCreator"],1057:["IS","1-n","SelectorSequencePointerItems"],1200:["CS","1","ScheduledProcedureStepPriority"],1202:["LO","1","WorklistLabel"],1204:["LO","1","ProcedureStepLabel"],1210:["SQ","1","ScheduledProcessingParametersSequence"],1212:["SQ","1","PerformedProcessingParametersSequence"],1216:["SQ","1","UnifiedProcedureStepPerformedProcedureSequence"],1220:["SQ","1","RelatedProcedureStepSequence"],1222:["LO","1","ProcedureStepRelationshipType"],1224:["SQ","1","ReplacedProcedureStepSequence"],1230:["LO","1","DeletionLock"],1234:["AE","1","ReceivingAE"],1236:["AE","1","RequestingAE"],1238:["LT","1","ReasonForCancellation"],1242:["CS","1","SCPStatus"],1244:["CS","1","SubscriptionListStatus"],1246:["CS","1","UnifiedProcedureStepListStatus"],1324:["UL","1","BeamOrderIndex"],1338:["FD","1","DoubleExposureMeterset"],"133A":["FD","4","DoubleExposureFieldDelta"],1401:["SQ","1","BrachyTaskSequence"],1402:["DS","1","ContinuationStartTotalReferenceAirKerma"],1403:["DS","1","ContinuationEndTotalReferenceAirKerma"],1404:["IS","1","ContinuationPulseNumber"],1405:["SQ","1","ChannelDeliveryOrderSequence"],1406:["IS","1","ReferencedChannelNumber"],1407:["DS","1","StartCumulativeTimeWeight"],1408:["DS","1","EndCumulativeTimeWeight"],1409:["SQ","1","OmittedChannelSequence"],"140A":["CS","1","ReasonForChannelOmission"],"140B":["LO","1","ReasonForChannelOmissionDescription"],"140C":["IS","1","ChannelDeliveryOrderIndex"],"140D":["SQ","1","ChannelDeliveryContinuationSequence"],"140E":["SQ","1","OmittedApplicationSetupSequence"]},"0076":{"0000":["UL","1","GenericGroupLength"],"0001":["LO","1","ImplantAssemblyTemplateName"],"0003":["LO","1","ImplantAssemblyTemplateIssuer"],"0006":["LO","1","ImplantAssemblyTemplateVersion"],"0008":["SQ","1","ReplacedImplantAssemblyTemplateSequence"],"000A":["CS","1","ImplantAssemblyTemplateType"],"000C":["SQ","1","OriginalImplantAssemblyTemplateSequence"],"000E":["SQ","1","DerivationImplantAssemblyTemplateSequence"],"0010":["SQ","1","ImplantAssemblyTemplateTargetAnatomySequence"],"0020":["SQ","1","ProcedureTypeCodeSequence"],"0030":["LO","1","SurgicalTechnique"],"0032":["SQ","1","ComponentTypesSequence"],"0034":["SQ","1","ComponentTypeCodeSequence"],"0036":["CS","1","ExclusiveComponentType"],"0038":["CS","1","MandatoryComponentType"],"0040":["SQ","1","ComponentSequence"],"0055":["US","1","ComponentID"],"0060":["SQ","1","ComponentAssemblySequence"],"0070":["US","1","Component1ReferencedID"],"0080":["US","1","Component1ReferencedMatingFeatureSetID"],"0090":["US","1","Component1ReferencedMatingFeatureID"],"00A0":["US","1","Component2ReferencedID"],"00B0":["US","1","Component2ReferencedMatingFeatureSetID"],"00C0":["US","1","Component2ReferencedMatingFeatureID"]},"0078":{"0000":["UL","1","GenericGroupLength"],"0001":["LO","1","ImplantTemplateGroupName"],"0010":["ST","1","ImplantTemplateGroupDescription"],"0020":["LO","1","ImplantTemplateGroupIssuer"],"0024":["LO","1","ImplantTemplateGroupVersion"],"0026":["SQ","1","ReplacedImplantTemplateGroupSequence"],"0028":["SQ","1","ImplantTemplateGroupTargetAnatomySequence"],"002A":["SQ","1","ImplantTemplateGroupMembersSequence"],"002E":["US","1","ImplantTemplateGroupMemberID"],"0050":["FD","3","ThreeDImplantTemplateGroupMemberMatchingPoint"],"0060":["FD","9","ThreeDImplantTemplateGroupMemberMatchingAxes"],"0070":["SQ","1","ImplantTemplateGroupMemberMatching2DCoordinatesSequence"],"0090":["FD","2","TwoDImplantTemplateGroupMemberMatchingPoint"],"00A0":["FD","4","TwoDImplantTemplateGroupMemberMatchingAxes"],"00B0":["SQ","1","ImplantTemplateGroupVariationDimensionSequence"],"00B2":["LO","1","ImplantTemplateGroupVariationDimensionName"],"00B4":["SQ","1","ImplantTemplateGroupVariationDimensionRankSequence"],"00B6":["US","1","ReferencedImplantTemplateGroupMemberID"],"00B8":["US","1","ImplantTemplateGroupVariationDimensionRank"]},"0080":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","SurfaceScanAcquisitionTypeCodeSequence"],"0002":["SQ","1","SurfaceScanModeCodeSequence"],"0003":["SQ","1","RegistrationMethodCodeSequence"],"0004":["FD","1","ShotDurationTime"],"0005":["FD","1","ShotOffsetTime"],"0006":["US","1-n","SurfacePointPresentationValueData"],"0007":["US","3-3n","SurfacePointColorCIELabValueData"],"0008":["SQ","1","UVMappingSequence"],"0009":["SH","1","TextureLabel"],"0010":["OF","1","UValueData"],"0011":["OF","1","VValueData"],"0012":["SQ","1","ReferencedTextureSequence"],"0013":["SQ","1","ReferencedSurfaceDataSequence"]},"0082":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","AssessmentSummary"],"0003":["UT","1","AssessmentSummaryDescription"],"0004":["SQ","1","AssessedSOPInstanceSequence"],"0005":["SQ","1","ReferencedComparisonSOPInstanceSequence"],"0006":["UL","1","NumberOfAssessmentObservations"],"0007":["SQ","1","AssessmentObservationsSequence"],"0008":["CS","1","ObservationSignificance"],"000A":["UT","1","ObservationDescription"],"000C":["SQ","1","StructuredConstraintObservationSequence"],"0010":["SQ","1","AssessedAttributeValueSequence"],"0016":["LO","1","AssessmentSetID"],"0017":["SQ","1","AssessmentRequesterSequence"],"0018":["LO","1","SelectorAttributeName"],"0019":["LO","1","SelectorAttributeKeyword"],"0021":["SQ","1","AssessmentTypeCodeSequence"],"0022":["SQ","1","ObservationBasisCodeSequence"],"0023":["LO","1","AssessmentLabel"],"0032":["CS","1","ConstraintType"],"0033":["UT","1","SpecificationSelectionGuidance"],"0034":["SQ","1","ConstraintValueSequence"],"0035":["SQ","1","RecommendedDefaultValueSequence"],"0036":["CS","1","ConstraintViolationSignificance"],"0037":["UT","1","ConstraintViolationCondition"],"0038":["CS","1","ModifiableConstraintFlag"]},"0088":{"0000":["UL","1","GenericGroupLength"],"0130":["SH","1","StorageMediaFileSetID"],"0140":["UI","1","StorageMediaFileSetUID"],"0200":["SQ","1","IconImageSequence"],"0904":["LO","1","TopicTitle"],"0906":["ST","1","TopicSubject"],"0910":["LO","1","TopicAuthor"],"0912":["LO","1-32","TopicKeywords"]},"0100":{"0000":["UL","1","GenericGroupLength"],"0410":["CS","1","SOPInstanceStatus"],"0420":["DT","1","SOPAuthorizationDateTime"],"0424":["LT","1","SOPAuthorizationComment"],"0426":["LO","1","AuthorizationEquipmentCertificationNumber"]},"0400":{"0000":["UL","1","GenericGroupLength"],"0005":["US","1","MACIDNumber"],"0010":["UI","1","MACCalculationTransferSyntaxUID"],"0015":["CS","1","MACAlgorithm"],"0020":["AT","1-n","DataElementsSigned"],"0100":["UI","1","DigitalSignatureUID"],"0105":["DT","1","DigitalSignatureDateTime"],"0110":["CS","1","CertificateType"],"0115":["OB","1","CertificateOfSigner"],"0120":["OB","1","Signature"],"0305":["CS","1","CertifiedTimestampType"],"0310":["OB","1","CertifiedTimestamp"],"0315":["FL","1",""],"0401":["SQ","1","DigitalSignaturePurposeCodeSequence"],"0402":["SQ","1","ReferencedDigitalSignatureSequence"],"0403":["SQ","1","ReferencedSOPInstanceMACSequence"],"0404":["OB","1","MAC"],"0500":["SQ","1","EncryptedAttributesSequence"],"0510":["UI","1","EncryptedContentTransferSyntaxUID"],"0520":["OB","1","EncryptedContent"],"0550":["SQ","1","ModifiedAttributesSequence"],"0551":["SQ","1","NonconformingModifiedAttributesSequence"],"0552":["OB","1","NonconformingDataElementValue"],"0561":["SQ","1","OriginalAttributesSequence"],"0562":["DT","1","AttributeModificationDateTime"],"0563":["LO","1","ModifyingSystem"],"0564":["LO","1","SourceOfPreviousValues"],"0565":["CS","1","ReasonForTheAttributeModification"],"0600":["CS","1","InstanceOriginStatus"]},1e3:{"0000":["UL","1","GenericGroupLength"],"0010":["US","3","EscapeTriplet"],"0011":["US","3","RunLengthTriplet"],"0012":["US","1","HuffmanTableSize"],"0013":["US","3","HuffmanTableTriplet"],"0014":["US","1","ShiftTableSize"],"0015":["US","3","ShiftTableTriplet"]},1010:{"0000":["UL","1","GenericGroupLength"],"0004":["US","1-n","ZonalMap"]},2e3:{"0000":["UL","1","GenericGroupLength"],"0010":["IS","1","NumberOfCopies"],"001E":["SQ","1","PrinterConfigurationSequence"],"0020":["CS","1","PrintPriority"],"0030":["CS","1","MediumType"],"0040":["CS","1","FilmDestination"],"0050":["LO","1","FilmSessionLabel"],"0060":["IS","1","MemoryAllocation"],"0061":["IS","1","MaximumMemoryAllocation"],"0062":["CS","1","ColorImagePrintingFlag"],"0063":["CS","1","CollationFlag"],"0065":["CS","1","AnnotationFlag"],"0067":["CS","1","ImageOverlayFlag"],"0069":["CS","1","PresentationLUTFlag"],"006A":["CS","1","ImageBoxPresentationLUTFlag"],"00A0":["US","1","MemoryBitDepth"],"00A1":["US","1","PrintingBitDepth"],"00A2":["SQ","1","MediaInstalledSequence"],"00A4":["SQ","1","OtherMediaAvailableSequence"],"00A8":["SQ","1","SupportedImageDisplayFormatsSequence"],"0500":["SQ","1","ReferencedFilmBoxSequence"],"0510":["SQ","1","ReferencedStoredPrintSequence"]},2010:{"0000":["UL","1","GenericGroupLength"],"0010":["ST","1","ImageDisplayFormat"],"0030":["CS","1","AnnotationDisplayFormatID"],"0040":["CS","1","FilmOrientation"],"0050":["CS","1","FilmSizeID"],"0052":["CS","1","PrinterResolutionID"],"0054":["CS","1","DefaultPrinterResolutionID"],"0060":["CS","1","MagnificationType"],"0080":["CS","1","SmoothingType"],"00A6":["CS","1","DefaultMagnificationType"],"00A7":["CS","1-n","OtherMagnificationTypesAvailable"],"00A8":["CS","1","DefaultSmoothingType"],"00A9":["CS","1-n","OtherSmoothingTypesAvailable"],"0100":["CS","1","BorderDensity"],"0110":["CS","1","EmptyImageDensity"],"0120":["US","1","MinDensity"],"0130":["US","1","MaxDensity"],"0140":["CS","1","Trim"],"0150":["ST","1","ConfigurationInformation"],"0152":["LT","1","ConfigurationInformationDescription"],"0154":["IS","1","MaximumCollatedFilms"],"015E":["US","1","Illumination"],"0160":["US","1","ReflectedAmbientLight"],"0376":["DS","2","PrinterPixelSpacing"],"0500":["SQ","1","ReferencedFilmSessionSequence"],"0510":["SQ","1","ReferencedImageBoxSequence"],"0520":["SQ","1","ReferencedBasicAnnotationBoxSequence"]},2020:{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","ImageBoxPosition"],"0020":["CS","1","Polarity"],"0030":["DS","1","RequestedImageSize"],"0040":["CS","1","RequestedDecimateCropBehavior"],"0050":["CS","1","RequestedResolutionID"],"00A0":["CS","1","RequestedImageSizeFlag"],"00A2":["CS","1","DecimateCropResult"],"0110":["SQ","1","BasicGrayscaleImageSequence"],"0111":["SQ","1","BasicColorImageSequence"],"0130":["SQ","1","ReferencedImageOverlayBoxSequence"],"0140":["SQ","1","ReferencedVOILUTBoxSequence"]},2030:{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","AnnotationPosition"],"0020":["LO","1","TextString"]},2040:{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","ReferencedOverlayPlaneSequence"],"0011":["US","1-99","ReferencedOverlayPlaneGroups"],"0020":["SQ","1","OverlayPixelDataSequence"],"0060":["CS","1","OverlayMagnificationType"],"0070":["CS","1","OverlaySmoothingType"],"0072":["CS","1","OverlayOrImageMagnification"],"0074":["US","1","MagnifyToNumberOfColumns"],"0080":["CS","1","OverlayForegroundDensity"],"0082":["CS","1","OverlayBackgroundDensity"],"0090":["CS","1","OverlayMode"],"0100":["CS","1","ThresholdDensity"],"0500":["SQ","1","ReferencedImageBoxSequenceRetired"]},2050:{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","PresentationLUTSequence"],"0020":["CS","1","PresentationLUTShape"],"0500":["SQ","1","ReferencedPresentationLUTSequence"]},2100:{"0000":["UL","1","GenericGroupLength"],"0010":["SH","1","PrintJobID"],"0020":["CS","1","ExecutionStatus"],"0030":["CS","1","ExecutionStatusInfo"],"0040":["DA","1","CreationDate"],"0050":["TM","1","CreationTime"],"0070":["AE","1","Originator"],"0140":["AE","1","DestinationAE"],"0160":["SH","1","OwnerID"],"0170":["IS","1","NumberOfFilms"],"0500":["SQ","1","ReferencedPrintJobSequencePullStoredPrint"]},2110:{"0000":["UL","1","GenericGroupLength"],"0010":["CS","1","PrinterStatus"],"0020":["CS","1","PrinterStatusInfo"],"0030":["LO","1","PrinterName"],"0099":["SH","1","PrintQueueID"]},2120:{"0000":["UL","1","GenericGroupLength"],"0010":["CS","1","QueueStatus"],"0050":["SQ","1","PrintJobDescriptionSequence"],"0070":["SQ","1","ReferencedPrintJobSequence"]},2130:{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","PrintManagementCapabilitiesSequence"],"0015":["SQ","1","PrinterCharacteristicsSequence"],"0030":["SQ","1","FilmBoxContentSequence"],"0040":["SQ","1","ImageBoxContentSequence"],"0050":["SQ","1","AnnotationContentSequence"],"0060":["SQ","1","ImageOverlayBoxContentSequence"],"0080":["SQ","1","PresentationLUTContentSequence"],"00A0":["SQ","1","ProposedStudySequence"],"00C0":["SQ","1","OriginalImageSequence"]},2200:{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","LabelUsingInformationExtractedFromInstances"],"0002":["UT","1","LabelText"],"0003":["CS","1","LabelStyleSelection"],"0004":["LT","1","MediaDisposition"],"0005":["LT","1","BarcodeValue"],"0006":["CS","1","BarcodeSymbology"],"0007":["CS","1","AllowMediaSplitting"],"0008":["CS","1","IncludeNonDICOMObjects"],"0009":["CS","1","IncludeDisplayApplication"],"000A":["CS","1","PreserveCompositeInstancesAfterMediaCreation"],"000B":["US","1","TotalNumberOfPiecesOfMediaCreated"],"000C":["LO","1","RequestedMediaApplicationProfile"],"000D":["SQ","1","ReferencedStorageMediaSequence"],"000E":["AT","1-n","FailureAttributes"],"000F":["CS","1","AllowLossyCompression"],"0020":["CS","1","RequestPriority"]},3002:{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","RTImageLabel"],"0003":["LO","1","RTImageName"],"0004":["ST","1","RTImageDescription"],"000A":["CS","1","ReportedValuesOrigin"],"000C":["CS","1","RTImagePlane"],"000D":["DS","3","XRayImageReceptorTranslation"],"000E":["DS","1","XRayImageReceptorAngle"],"0010":["DS","6","RTImageOrientation"],"0011":["DS","2","ImagePlanePixelSpacing"],"0012":["DS","2","RTImagePosition"],"0020":["SH","1","RadiationMachineName"],"0022":["DS","1","RadiationMachineSAD"],"0024":["DS","1","RadiationMachineSSD"],"0026":["DS","1","RTImageSID"],"0028":["DS","1","SourceToReferenceObjectDistance"],"0029":["IS","1","FractionNumber"],"0030":["SQ","1","ExposureSequence"],"0032":["DS","1","MetersetExposure"],"0034":["DS","4","DiaphragmPosition"],"0040":["SQ","1","FluenceMapSequence"],"0041":["CS","1","FluenceDataSource"],"0042":["DS","1","FluenceDataScale"],"0050":["SQ","1","PrimaryFluenceModeSequence"],"0051":["CS","1","FluenceMode"],"0052":["SH","1","FluenceModeID"]},3004:{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","DVHType"],"0002":["CS","1","DoseUnits"],"0004":["CS","1","DoseType"],"0005":["CS","1","SpatialTransformOfDose"],"0006":["LO","1","DoseComment"],"0008":["DS","3","NormalizationPoint"],"000A":["CS","1","DoseSummationType"],"000C":["DS","2-n","GridFrameOffsetVector"],"000E":["DS","1","DoseGridScaling"],"0010":["SQ","1","RTDoseROISequence"],"0012":["DS","1","DoseValue"],"0014":["CS","1-3","TissueHeterogeneityCorrection"],"0040":["DS","3","DVHNormalizationPoint"],"0042":["DS","1","DVHNormalizationDoseValue"],"0050":["SQ","1","DVHSequence"],"0052":["DS","1","DVHDoseScaling"],"0054":["CS","1","DVHVolumeUnits"],"0056":["IS","1","DVHNumberOfBins"],"0058":["DS","2-2n","DVHData"],"0060":["SQ","1","DVHReferencedROISequence"],"0062":["CS","1","DVHROIContributionType"],"0070":["DS","1","DVHMinimumDose"],"0072":["DS","1","DVHMaximumDose"],"0074":["DS","1","DVHMeanDose"]},3006:{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","StructureSetLabel"],"0004":["LO","1","StructureSetName"],"0006":["ST","1","StructureSetDescription"],"0008":["DA","1","StructureSetDate"],"0009":["TM","1","StructureSetTime"],"0010":["SQ","1","ReferencedFrameOfReferenceSequence"],"0012":["SQ","1","RTReferencedStudySequence"],"0014":["SQ","1","RTReferencedSeriesSequence"],"0016":["SQ","1","ContourImageSequence"],"0018":["SQ","1","PredecessorStructureSetSequence"],"0020":["SQ","1","StructureSetROISequence"],"0022":["IS","1","ROINumber"],"0024":["UI","1","ReferencedFrameOfReferenceUID"],"0026":["LO","1","ROIName"],"0028":["ST","1","ROIDescription"],"002A":["IS","3","ROIDisplayColor"],"002C":["DS","1","ROIVolume"],"0030":["SQ","1","RTRelatedROISequence"],"0033":["CS","1","RTROIRelationship"],"0036":["CS","1","ROIGenerationAlgorithm"],"0037":["SQ","1","ROIDerivationAlgorithmIdentificationSequence"],"0038":["LO","1","ROIGenerationDescription"],"0039":["SQ","1","ROIContourSequence"],"0040":["SQ","1","ContourSequence"],"0042":["CS","1","ContourGeometricType"],"0044":["DS","1","ContourSlabThickness"],"0045":["DS","3","ContourOffsetVector"],"0046":["IS","1","NumberOfContourPoints"],"0048":["IS","1","ContourNumber"],"0049":["IS","1-n","AttachedContours"],"004A":["SQ","1","SourcePixelPlanesCharacteristicsSequence"],"0050":["DS","3-3n","ContourData"],"0080":["SQ","1","RTROIObservationsSequence"],"0082":["IS","1","ObservationNumber"],"0084":["IS","1","ReferencedROINumber"],"0085":["SH","1","ROIObservationLabel"],"0086":["SQ","1","RTROIIdentificationCodeSequence"],"0088":["ST","1","ROIObservationDescription"],"00A0":["SQ","1","RelatedRTROIObservationsSequence"],"00A4":["CS","1","RTROIInterpretedType"],"00A6":["PN","1","ROIInterpreter"],"00B0":["SQ","1","ROIPhysicalPropertiesSequence"],"00B2":["CS","1","ROIPhysicalProperty"],"00B4":["DS","1","ROIPhysicalPropertyValue"],"00B6":["SQ","1","ROIElementalCompositionSequence"],"00B7":["US","1","ROIElementalCompositionAtomicNumber"],"00B8":["FL","1","ROIElementalCompositionAtomicMassFraction"],"00B9":["SQ","1","AdditionalRTROIIdentificationCodeSequence"],"00C0":["SQ","1","FrameOfReferenceRelationshipSequence"],"00C2":["UI","1","RelatedFrameOfReferenceUID"],"00C4":["CS","1","FrameOfReferenceTransformationType"],"00C6":["DS","16","FrameOfReferenceTransformationMatrix"],"00C8":["LO","1","FrameOfReferenceTransformationComment"],"00C9":["SQ","1","PatientLocationCoordinatesSequence"],"00CA":["SQ","1","PatientLocationCoordinatesCodeSequence"],"00CB":["SQ","1","PatientSupportPositionSequence"]},3008:{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","MeasuredDoseReferenceSequence"],"0012":["ST","1","MeasuredDoseDescription"],"0014":["CS","1","MeasuredDoseType"],"0016":["DS","1","MeasuredDoseValue"],"0020":["SQ","1","TreatmentSessionBeamSequence"],"0021":["SQ","1","TreatmentSessionIonBeamSequence"],"0022":["IS","1","CurrentFractionNumber"],"0024":["DA","1","TreatmentControlPointDate"],"0025":["TM","1","TreatmentControlPointTime"],"002A":["CS","1","TreatmentTerminationStatus"],"002B":["SH","1","TreatmentTerminationCode"],"002C":["CS","1","TreatmentVerificationStatus"],"0030":["SQ","1","ReferencedTreatmentRecordSequence"],"0032":["DS","1","SpecifiedPrimaryMeterset"],"0033":["DS","1","SpecifiedSecondaryMeterset"],"0036":["DS","1","DeliveredPrimaryMeterset"],"0037":["DS","1","DeliveredSecondaryMeterset"],"003A":["DS","1","SpecifiedTreatmentTime"],"003B":["DS","1","DeliveredTreatmentTime"],"0040":["SQ","1","ControlPointDeliverySequence"],"0041":["SQ","1","IonControlPointDeliverySequence"],"0042":["DS","1","SpecifiedMeterset"],"0044":["DS","1","DeliveredMeterset"],"0045":["FL","1","MetersetRateSet"],"0046":["FL","1","MetersetRateDelivered"],"0047":["FL","1-n","ScanSpotMetersetsDelivered"],"0048":["DS","1","DoseRateDelivered"],"0050":["SQ","1","TreatmentSummaryCalculatedDoseReferenceSequence"],"0052":["DS","1","CumulativeDoseToDoseReference"],"0054":["DA","1","FirstTreatmentDate"],"0056":["DA","1","MostRecentTreatmentDate"],"005A":["IS","1","NumberOfFractionsDelivered"],"0060":["SQ","1","OverrideSequence"],"0061":["AT","1","ParameterSequencePointer"],"0062":["AT","1","OverrideParameterPointer"],"0063":["IS","1","ParameterItemIndex"],"0064":["IS","1","MeasuredDoseReferenceNumber"],"0065":["AT","1","ParameterPointer"],"0066":["ST","1","OverrideReason"],"0067":["US","1","ParameterValueNumber"],"0068":["SQ","1","CorrectedParameterSequence"],"006A":["FL","1","CorrectionValue"],"0070":["SQ","1","CalculatedDoseReferenceSequence"],"0072":["IS","1","CalculatedDoseReferenceNumber"],"0074":["ST","1","CalculatedDoseReferenceDescription"],"0076":["DS","1","CalculatedDoseReferenceDoseValue"],"0078":["DS","1","StartMeterset"],"007A":["DS","1","EndMeterset"],"0080":["SQ","1","ReferencedMeasuredDoseReferenceSequence"],"0082":["IS","1","ReferencedMeasuredDoseReferenceNumber"],"0090":["SQ","1","ReferencedCalculatedDoseReferenceSequence"],"0092":["IS","1","ReferencedCalculatedDoseReferenceNumber"],"00A0":["SQ","1","BeamLimitingDeviceLeafPairsSequence"],"00B0":["SQ","1","RecordedWedgeSequence"],"00C0":["SQ","1","RecordedCompensatorSequence"],"00D0":["SQ","1","RecordedBlockSequence"],"00D1":["SQ","1","RecordedBlockSlabSequence"],"00E0":["SQ","1","TreatmentSummaryMeasuredDoseReferenceSequence"],"00F0":["SQ","1","RecordedSnoutSequence"],"00F2":["SQ","1","RecordedRangeShifterSequence"],"00F4":["SQ","1","RecordedLateralSpreadingDeviceSequence"],"00F6":["SQ","1","RecordedRangeModulatorSequence"],"0100":["SQ","1","RecordedSourceSequence"],"0105":["LO","1","SourceSerialNumber"],"0110":["SQ","1","TreatmentSessionApplicationSetupSequence"],"0116":["CS","1","ApplicationSetupCheck"],"0120":["SQ","1","RecordedBrachyAccessoryDeviceSequence"],"0122":["IS","1","ReferencedBrachyAccessoryDeviceNumber"],"0130":["SQ","1","RecordedChannelSequence"],"0132":["DS","1","SpecifiedChannelTotalTime"],"0134":["DS","1","DeliveredChannelTotalTime"],"0136":["IS","1","SpecifiedNumberOfPulses"],"0138":["IS","1","DeliveredNumberOfPulses"],"013A":["DS","1","SpecifiedPulseRepetitionInterval"],"013C":["DS","1","DeliveredPulseRepetitionInterval"],"0140":["SQ","1","RecordedSourceApplicatorSequence"],"0142":["IS","1","ReferencedSourceApplicatorNumber"],"0150":["SQ","1","RecordedChannelShieldSequence"],"0152":["IS","1","ReferencedChannelShieldNumber"],"0160":["SQ","1","BrachyControlPointDeliveredSequence"],"0162":["DA","1","SafePositionExitDate"],"0164":["TM","1","SafePositionExitTime"],"0166":["DA","1","SafePositionReturnDate"],"0168":["TM","1","SafePositionReturnTime"],"0171":["SQ","1","PulseSpecificBrachyControlPointDeliveredSequence"],"0172":["US","1","PulseNumber"],"0173":["SQ","1","BrachyPulseControlPointDeliveredSequence"],"0200":["CS","1","CurrentTreatmentStatus"],"0202":["ST","1","TreatmentStatusComment"],"0220":["SQ","1","FractionGroupSummarySequence"],"0223":["IS","1","ReferencedFractionNumber"],"0224":["CS","1","FractionGroupType"],"0230":["CS","1","BeamStopperPosition"],"0240":["SQ","1","FractionStatusSummarySequence"],"0250":["DA","1","TreatmentDate"],"0251":["TM","1","TreatmentTime"]},"300A":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","RTPlanLabel"],"0003":["LO","1","RTPlanName"],"0004":["ST","1","RTPlanDescription"],"0006":["DA","1","RTPlanDate"],"0007":["TM","1","RTPlanTime"],"0009":["LO","1-n","TreatmentProtocols"],"000A":["CS","1","PlanIntent"],"000B":["LO","1-n","TreatmentSites"],"000C":["CS","1","RTPlanGeometry"],"000E":["ST","1","PrescriptionDescription"],"0010":["SQ","1","DoseReferenceSequence"],"0012":["IS","1","DoseReferenceNumber"],"0013":["UI","1","DoseReferenceUID"],"0014":["CS","1","DoseReferenceStructureType"],"0015":["CS","1","NominalBeamEnergyUnit"],"0016":["LO","1","DoseReferenceDescription"],"0018":["DS","3","DoseReferencePointCoordinates"],"001A":["DS","1","NominalPriorDose"],"0020":["CS","1","DoseReferenceType"],"0021":["DS","1","ConstraintWeight"],"0022":["DS","1","DeliveryWarningDose"],"0023":["DS","1","DeliveryMaximumDose"],"0025":["DS","1","TargetMinimumDose"],"0026":["DS","1","TargetPrescriptionDose"],"0027":["DS","1","TargetMaximumDose"],"0028":["DS","1","TargetUnderdoseVolumeFraction"],"002A":["DS","1","OrganAtRiskFullVolumeDose"],"002B":["DS","1","OrganAtRiskLimitDose"],"002C":["DS","1","OrganAtRiskMaximumDose"],"002D":["DS","1","OrganAtRiskOverdoseVolumeFraction"],"0040":["SQ","1","ToleranceTableSequence"],"0042":["IS","1","ToleranceTableNumber"],"0043":["SH","1","ToleranceTableLabel"],"0044":["DS","1","GantryAngleTolerance"],"0046":["DS","1","BeamLimitingDeviceAngleTolerance"],"0048":["SQ","1","BeamLimitingDeviceToleranceSequence"],"004A":["DS","1","BeamLimitingDevicePositionTolerance"],"004B":["FL","1","SnoutPositionTolerance"],"004C":["DS","1","PatientSupportAngleTolerance"],"004E":["DS","1","TableTopEccentricAngleTolerance"],"004F":["FL","1","TableTopPitchAngleTolerance"],"0050":["FL","1","TableTopRollAngleTolerance"],"0051":["DS","1","TableTopVerticalPositionTolerance"],"0052":["DS","1","TableTopLongitudinalPositionTolerance"],"0053":["DS","1","TableTopLateralPositionTolerance"],"0055":["CS","1","RTPlanRelationship"],"0070":["SQ","1","FractionGroupSequence"],"0071":["IS","1","FractionGroupNumber"],"0072":["LO","1","FractionGroupDescription"],"0078":["IS","1","NumberOfFractionsPlanned"],"0079":["IS","1","NumberOfFractionPatternDigitsPerDay"],"007A":["IS","1","RepeatFractionCycleLength"],"007B":["LT","1","FractionPattern"],"0080":["IS","1","NumberOfBeams"],"0082":["DS","3","BeamDoseSpecificationPoint"],"0083":["UI","1","ReferencedDoseReferenceUID"],"0084":["DS","1","BeamDose"],"0086":["DS","1","BeamMeterset"],"0088":["FL","1","BeamDosePointDepth"],"0089":["FL","1","BeamDosePointEquivalentDepth"],"008A":["FL","1","BeamDosePointSSD"],"008B":["CS","1","BeamDoseMeaning"],"008C":["SQ","1","BeamDoseVerificationControlPointSequence"],"008D":["FL","1","AverageBeamDosePointDepth"],"008E":["FL","1","AverageBeamDosePointEquivalentDepth"],"008F":["FL","1","AverageBeamDosePointSSD"],"0090":["CS","1","BeamDoseType"],"0091":["DS","1","AlternateBeamDose"],"0092":["CS","1","AlternateBeamDoseType"],"0093":["CS","1","DepthValueAveragingFlag"],"0094":["DS","1","BeamDosePointSourceToExternalContourDistance"],"00A0":["IS","1","NumberOfBrachyApplicationSetups"],"00A2":["DS","3","BrachyApplicationSetupDoseSpecificationPoint"],"00A4":["DS","1","BrachyApplicationSetupDose"],"00B0":["SQ","1","BeamSequence"],"00B2":["SH","1","TreatmentMachineName"],"00B3":["CS","1","PrimaryDosimeterUnit"],"00B4":["DS","1","SourceAxisDistance"],"00B6":["SQ","1","BeamLimitingDeviceSequence"],"00B8":["CS","1","RTBeamLimitingDeviceType"],"00BA":["DS","1","SourceToBeamLimitingDeviceDistance"],"00BB":["FL","1","IsocenterToBeamLimitingDeviceDistance"],"00BC":["IS","1","NumberOfLeafJawPairs"],"00BE":["DS","3-n","LeafPositionBoundaries"],"00C0":["IS","1","BeamNumber"],"00C2":["LO","1","BeamName"],"00C3":["ST","1","BeamDescription"],"00C4":["CS","1","BeamType"],"00C5":["FD","1","BeamDeliveryDurationLimit"],"00C6":["CS","1","RadiationType"],"00C7":["CS","1","HighDoseTechniqueType"],"00C8":["IS","1","ReferenceImageNumber"],"00CA":["SQ","1","PlannedVerificationImageSequence"],"00CC":["LO","1-n","ImagingDeviceSpecificAcquisitionParameters"],"00CE":["CS","1","TreatmentDeliveryType"],"00D0":["IS","1","NumberOfWedges"],"00D1":["SQ","1","WedgeSequence"],"00D2":["IS","1","WedgeNumber"],"00D3":["CS","1","WedgeType"],"00D4":["SH","1","WedgeID"],"00D5":["IS","1","WedgeAngle"],"00D6":["DS","1","WedgeFactor"],"00D7":["FL","1","TotalWedgeTrayWaterEquivalentThickness"],"00D8":["DS","1","WedgeOrientation"],"00D9":["FL","1","IsocenterToWedgeTrayDistance"],"00DA":["DS","1","SourceToWedgeTrayDistance"],"00DB":["FL","1","WedgeThinEdgePosition"],"00DC":["SH","1","BolusID"],"00DD":["ST","1","BolusDescription"],"00DE":["DS","1","EffectiveWedgeAngle"],"00E0":["IS","1","NumberOfCompensators"],"00E1":["SH","1","MaterialID"],"00E2":["DS","1","TotalCompensatorTrayFactor"],"00E3":["SQ","1","CompensatorSequence"],"00E4":["IS","1","CompensatorNumber"],"00E5":["SH","1","CompensatorID"],"00E6":["DS","1","SourceToCompensatorTrayDistance"],"00E7":["IS","1","CompensatorRows"],"00E8":["IS","1","CompensatorColumns"],"00E9":["DS","2","CompensatorPixelSpacing"],"00EA":["DS","2","CompensatorPosition"],"00EB":["DS","1-n","CompensatorTransmissionData"],"00EC":["DS","1-n","CompensatorThicknessData"],"00ED":["IS","1","NumberOfBoli"],"00EE":["CS","1","CompensatorType"],"00EF":["SH","1","CompensatorTrayID"],"00F0":["IS","1","NumberOfBlocks"],"00F2":["DS","1","TotalBlockTrayFactor"],"00F3":["FL","1","TotalBlockTrayWaterEquivalentThickness"],"00F4":["SQ","1","BlockSequence"],"00F5":["SH","1","BlockTrayID"],"00F6":["DS","1","SourceToBlockTrayDistance"],"00F7":["FL","1","IsocenterToBlockTrayDistance"],"00F8":["CS","1","BlockType"],"00F9":["LO","1","AccessoryCode"],"00FA":["CS","1","BlockDivergence"],"00FB":["CS","1","BlockMountingPosition"],"00FC":["IS","1","BlockNumber"],"00FE":["LO","1","BlockName"],"0100":["DS","1","BlockThickness"],"0102":["DS","1","BlockTransmission"],"0104":["IS","1","BlockNumberOfPoints"],"0106":["DS","2-2n","BlockData"],"0107":["SQ","1","ApplicatorSequence"],"0108":["SH","1","ApplicatorID"],"0109":["CS","1","ApplicatorType"],"010A":["LO","1","ApplicatorDescription"],"010C":["DS","1","CumulativeDoseReferenceCoefficient"],"010E":["DS","1","FinalCumulativeMetersetWeight"],"0110":["IS","1","NumberOfControlPoints"],"0111":["SQ","1","ControlPointSequence"],"0112":["IS","1","ControlPointIndex"],"0114":["DS","1","NominalBeamEnergy"],"0115":["DS","1","DoseRateSet"],"0116":["SQ","1","WedgePositionSequence"],"0118":["CS","1","WedgePosition"],"011A":["SQ","1","BeamLimitingDevicePositionSequence"],"011C":["DS","2-2n","LeafJawPositions"],"011E":["DS","1","GantryAngle"],"011F":["CS","1","GantryRotationDirection"],"0120":["DS","1","BeamLimitingDeviceAngle"],"0121":["CS","1","BeamLimitingDeviceRotationDirection"],"0122":["DS","1","PatientSupportAngle"],"0123":["CS","1","PatientSupportRotationDirection"],"0124":["DS","1","TableTopEccentricAxisDistance"],"0125":["DS","1","TableTopEccentricAngle"],"0126":["CS","1","TableTopEccentricRotationDirection"],"0128":["DS","1","TableTopVerticalPosition"],"0129":["DS","1","TableTopLongitudinalPosition"],"012A":["DS","1","TableTopLateralPosition"],"012C":["DS","3","IsocenterPosition"],"012E":["DS","3","SurfaceEntryPoint"],"0130":["DS","1","SourceToSurfaceDistance"],"0131":["FL","1","AverageBeamDosePointSourceToExternalContourDistance"],"0132":["FL","1","SourceToExternalContourDistance"],"0133":["FL","3","ExternalContourEntryPoint"],"0134":["DS","1","CumulativeMetersetWeight"],"0140":["FL","1","TableTopPitchAngle"],"0142":["CS","1","TableTopPitchRotationDirection"],"0144":["FL","1","TableTopRollAngle"],"0146":["CS","1","TableTopRollRotationDirection"],"0148":["FL","1","HeadFixationAngle"],"014A":["FL","1","GantryPitchAngle"],"014C":["CS","1","GantryPitchRotationDirection"],"014E":["FL","1","GantryPitchAngleTolerance"],"0150":["CS","1","FixationEye"],"0151":["DS","1","ChairHeadFramePosition"],"0152":["DS","1","HeadFixationAngleTolerance"],"0153":["DS","1","ChairHeadFramePositionTolerance"],"0154":["DS","1","FixationLightAzimuthalAngleTolerance"],"0155":["DS","1","FixationLightPolarAngleTolerance"],"0180":["SQ","1","PatientSetupSequence"],"0182":["IS","1","PatientSetupNumber"],"0183":["LO","1","PatientSetupLabel"],"0184":["LO","1","PatientAdditionalPosition"],"0190":["SQ","1","FixationDeviceSequence"],"0192":["CS","1","FixationDeviceType"],"0194":["SH","1","FixationDeviceLabel"],"0196":["ST","1","FixationDeviceDescription"],"0198":["SH","1","FixationDevicePosition"],"0199":["FL","1","FixationDevicePitchAngle"],"019A":["FL","1","FixationDeviceRollAngle"],"01A0":["SQ","1","ShieldingDeviceSequence"],"01A2":["CS","1","ShieldingDeviceType"],"01A4":["SH","1","ShieldingDeviceLabel"],"01A6":["ST","1","ShieldingDeviceDescription"],"01A8":["SH","1","ShieldingDevicePosition"],"01B0":["CS","1","SetupTechnique"],"01B2":["ST","1","SetupTechniqueDescription"],"01B4":["SQ","1","SetupDeviceSequence"],"01B6":["CS","1","SetupDeviceType"],"01B8":["SH","1","SetupDeviceLabel"],"01BA":["ST","1","SetupDeviceDescription"],"01BC":["DS","1","SetupDeviceParameter"],"01D0":["ST","1","SetupReferenceDescription"],"01D2":["DS","1","TableTopVerticalSetupDisplacement"],"01D4":["DS","1","TableTopLongitudinalSetupDisplacement"],"01D6":["DS","1","TableTopLateralSetupDisplacement"],"0200":["CS","1","BrachyTreatmentTechnique"],"0202":["CS","1","BrachyTreatmentType"],"0206":["SQ","1","TreatmentMachineSequence"],"0210":["SQ","1","SourceSequence"],"0212":["IS","1","SourceNumber"],"0214":["CS","1","SourceType"],"0216":["LO","1","SourceManufacturer"],"0218":["DS","1","ActiveSourceDiameter"],"021A":["DS","1","ActiveSourceLength"],"021B":["SH","1","SourceModelID"],"021C":["LO","1","SourceDescription"],"0222":["DS","1","SourceEncapsulationNominalThickness"],"0224":["DS","1","SourceEncapsulationNominalTransmission"],"0226":["LO","1","SourceIsotopeName"],"0228":["DS","1","SourceIsotopeHalfLife"],"0229":["CS","1","SourceStrengthUnits"],"022A":["DS","1","ReferenceAirKermaRate"],"022B":["DS","1","SourceStrength"],"022C":["DA","1","SourceStrengthReferenceDate"],"022E":["TM","1","SourceStrengthReferenceTime"],"0230":["SQ","1","ApplicationSetupSequence"],"0232":["CS","1","ApplicationSetupType"],"0234":["IS","1","ApplicationSetupNumber"],"0236":["LO","1","ApplicationSetupName"],"0238":["LO","1","ApplicationSetupManufacturer"],"0240":["IS","1","TemplateNumber"],"0242":["SH","1","TemplateType"],"0244":["LO","1","TemplateName"],"0250":["DS","1","TotalReferenceAirKerma"],"0260":["SQ","1","BrachyAccessoryDeviceSequence"],"0262":["IS","1","BrachyAccessoryDeviceNumber"],"0263":["SH","1","BrachyAccessoryDeviceID"],"0264":["CS","1","BrachyAccessoryDeviceType"],"0266":["LO","1","BrachyAccessoryDeviceName"],"026A":["DS","1","BrachyAccessoryDeviceNominalThickness"],"026C":["DS","1","BrachyAccessoryDeviceNominalTransmission"],"0271":["DS","1","ChannelEffectiveLength"],"0272":["DS","1","ChannelInnerLength"],"0273":["SH","1","AfterloaderChannelID"],"0274":["DS","1","SourceApplicatorTipLength"],"0280":["SQ","1","ChannelSequence"],"0282":["IS","1","ChannelNumber"],"0284":["DS","1","ChannelLength"],"0286":["DS","1","ChannelTotalTime"],"0288":["CS","1","SourceMovementType"],"028A":["IS","1","NumberOfPulses"],"028C":["DS","1","PulseRepetitionInterval"],"0290":["IS","1","SourceApplicatorNumber"],"0291":["SH","1","SourceApplicatorID"],"0292":["CS","1","SourceApplicatorType"],"0294":["LO","1","SourceApplicatorName"],"0296":["DS","1","SourceApplicatorLength"],"0298":["LO","1","SourceApplicatorManufacturer"],"029C":["DS","1","SourceApplicatorWallNominalThickness"],"029E":["DS","1","SourceApplicatorWallNominalTransmission"],"02A0":["DS","1","SourceApplicatorStepSize"],"02A1":["IS","1","ApplicatorShapeReferencedROINumber"],"02A2":["IS","1","TransferTubeNumber"],"02A4":["DS","1","TransferTubeLength"],"02B0":["SQ","1","ChannelShieldSequence"],"02B2":["IS","1","ChannelShieldNumber"],"02B3":["SH","1","ChannelShieldID"],"02B4":["LO","1","ChannelShieldName"],"02B8":["DS","1","ChannelShieldNominalThickness"],"02BA":["DS","1","ChannelShieldNominalTransmission"],"02C8":["DS","1","FinalCumulativeTimeWeight"],"02D0":["SQ","1","BrachyControlPointSequence"],"02D2":["DS","1","ControlPointRelativePosition"],"02D4":["DS","3","ControlPoint3DPosition"],"02D6":["DS","1","CumulativeTimeWeight"],"02E0":["CS","1","CompensatorDivergence"],"02E1":["CS","1","CompensatorMountingPosition"],"02E2":["DS","1-n","SourceToCompensatorDistance"],"02E3":["FL","1","TotalCompensatorTrayWaterEquivalentThickness"],"02E4":["FL","1","IsocenterToCompensatorTrayDistance"],"02E5":["FL","1","CompensatorColumnOffset"],"02E6":["FL","1-n","IsocenterToCompensatorDistances"],"02E7":["FL","1","CompensatorRelativeStoppingPowerRatio"],"02E8":["FL","1","CompensatorMillingToolDiameter"],"02EA":["SQ","1","IonRangeCompensatorSequence"],"02EB":["LT","1","CompensatorDescription"],"0302":["IS","1","RadiationMassNumber"],"0304":["IS","1","RadiationAtomicNumber"],"0306":["SS","1","RadiationChargeState"],"0308":["CS","1","ScanMode"],"0309":["CS","1","ModulatedScanModeType"],"030A":["FL","2","VirtualSourceAxisDistances"],"030C":["SQ","1","SnoutSequence"],"030D":["FL","1","SnoutPosition"],"030F":["SH","1","SnoutID"],"0312":["IS","1","NumberOfRangeShifters"],"0314":["SQ","1","RangeShifterSequence"],"0316":["IS","1","RangeShifterNumber"],"0318":["SH","1","RangeShifterID"],"0320":["CS","1","RangeShifterType"],"0322":["LO","1","RangeShifterDescription"],"0330":["IS","1","NumberOfLateralSpreadingDevices"],"0332":["SQ","1","LateralSpreadingDeviceSequence"],"0334":["IS","1","LateralSpreadingDeviceNumber"],"0336":["SH","1","LateralSpreadingDeviceID"],"0338":["CS","1","LateralSpreadingDeviceType"],"033A":["LO","1","LateralSpreadingDeviceDescription"],"033C":["FL","1","LateralSpreadingDeviceWaterEquivalentThickness"],"0340":["IS","1","NumberOfRangeModulators"],"0342":["SQ","1","RangeModulatorSequence"],"0344":["IS","1","RangeModulatorNumber"],"0346":["SH","1","RangeModulatorID"],"0348":["CS","1","RangeModulatorType"],"034A":["LO","1","RangeModulatorDescription"],"034C":["SH","1","BeamCurrentModulationID"],"0350":["CS","1","PatientSupportType"],"0352":["SH","1","PatientSupportID"],"0354":["LO","1","PatientSupportAccessoryCode"],"0355":["LO","1","TrayAccessoryCode"],"0356":["FL","1","FixationLightAzimuthalAngle"],"0358":["FL","1","FixationLightPolarAngle"],"035A":["FL","1","MetersetRate"],"0360":["SQ","1","RangeShifterSettingsSequence"],"0362":["LO","1","RangeShifterSetting"],"0364":["FL","1","IsocenterToRangeShifterDistance"],"0366":["FL","1","RangeShifterWaterEquivalentThickness"],"0370":["SQ","1","LateralSpreadingDeviceSettingsSequence"],"0372":["LO","1","LateralSpreadingDeviceSetting"],"0374":["FL","1","IsocenterToLateralSpreadingDeviceDistance"],"0380":["SQ","1","RangeModulatorSettingsSequence"],"0382":["FL","1","RangeModulatorGatingStartValue"],"0384":["FL","1","RangeModulatorGatingStopValue"],"0386":["FL","1","RangeModulatorGatingStartWaterEquivalentThickness"],"0388":["FL","1","RangeModulatorGatingStopWaterEquivalentThickness"],"038A":["FL","1","IsocenterToRangeModulatorDistance"],"038F":["FL","1-n","ScanSpotTimeOffset"],"0390":["SH","1","ScanSpotTuneID"],"0391":["IS","1-n","ScanSpotPrescribedIndices"],"0392":["IS","1","NumberOfScanSpotPositions"],"0393":["CS","1","ScanSpotReordered"],"0394":["FL","1-n","ScanSpotPositionMap"],"0395":["CS","1","ScanSpotReorderingAllowed"],"0396":["FL","1-n","ScanSpotMetersetWeights"],"0398":["FL","2","ScanningSpotSize"],"0399":["FL","2-2n","ScanSpotSizesDelivered"],"039A":["IS","1","NumberOfPaintings"],"03A0":["SQ","1","IonToleranceTableSequence"],"03A2":["SQ","1","IonBeamSequence"],"03A4":["SQ","1","IonBeamLimitingDeviceSequence"],"03A6":["SQ","1","IonBlockSequence"],"03A8":["SQ","1","IonControlPointSequence"],"03AA":["SQ","1","IonWedgeSequence"],"03AC":["SQ","1","IonWedgePositionSequence"],"0401":["SQ","1","ReferencedSetupImageSequence"],"0402":["ST","1","SetupImageComment"],"0410":["SQ","1","MotionSynchronizationSequence"],"0412":["FL","3","ControlPointOrientation"],"0420":["SQ","1","GeneralAccessorySequence"],"0421":["SH","1","GeneralAccessoryID"],"0422":["ST","1","GeneralAccessoryDescription"],"0423":["CS","1","GeneralAccessoryType"],"0424":["IS","1","GeneralAccessoryNumber"],"0425":["FL","1","SourceToGeneralAccessoryDistance"],"0426":["DS","1","IsocenterToGeneralAccessoryDistance"],"0431":["SQ","1","ApplicatorGeometrySequence"],"0432":["CS","1","ApplicatorApertureShape"],"0433":["FL","1","ApplicatorOpening"],"0434":["FL","1","ApplicatorOpeningX"],"0435":["FL","1","ApplicatorOpeningY"],"0436":["FL","1","SourceToApplicatorMountingPositionDistance"],"0440":["IS","1","NumberOfBlockSlabItems"],"0441":["SQ","1","BlockSlabSequence"],"0442":["DS","1","BlockSlabThickness"],"0443":["US","1","BlockSlabNumber"],"0450":["SQ","1","DeviceMotionControlSequence"],"0451":["CS","1","DeviceMotionExecutionMode"],"0452":["CS","1","DeviceMotionObservationMode"],"0453":["SQ","1","DeviceMotionParameterCodeSequence"],"0501":["FL","1","DistalDepthFraction"],"0502":["FL","1","DistalDepth"],"0503":["FL","2","NominalRangeModulationFractions"],"0504":["FL","2","NominalRangeModulatedRegionDepths"],"0505":["SQ","1","DepthDoseParametersSequence"],"0506":["SQ","1","DeliveredDepthDoseParametersSequence"],"0507":["FL","1","DeliveredDistalDepthFraction"],"0508":["FL","1","DeliveredDistalDepth"],"0509":["FL","2","DeliveredNominalRangeModulationFractions"],"0510":["FL","2","DeliveredNominalRangeModulatedRegionDepths"],"0511":["CS","1","DeliveredReferenceDoseDefinition"],"0512":["CS","1","ReferenceDoseDefinition"],"0600":["US","1","RTControlPointIndex"],"0601":["US","1","RadiationGenerationModeIndex"],"0602":["US","1","ReferencedDefinedDeviceIndex"],"0603":["US","1","RadiationDoseIdentificationIndex"],"0604":["US","1","NumberOfRTControlPoints"],"0605":["US","1","ReferencedRadiationGenerationModeIndex"],"0606":["US","1","TreatmentPositionIndex"],"0607":["US","1","ReferencedDeviceIndex"],"0608":["LO","1","TreatmentPositionGroupLabel"],"0609":["UI","1","TreatmentPositionGroupUID"],"060A":["SQ","1","TreatmentPositionGroupSequence"],"060B":["US","1","ReferencedTreatmentPositionIndex"],"060C":["US","1","ReferencedRadiationDoseIdentificationIndex"],"060D":["FD","1","RTAccessoryHolderWaterEquivalentThickness"],"060E":["US","1","ReferencedRTAccessoryHolderDeviceIndex"],"060F":["CS","1","RTAccessoryHolderSlotExistenceFlag"],"0610":["SQ","1","RTAccessoryHolderSlotSequence"],"0611":["LO","1","RTAccessoryHolderSlotID"],"0612":["FD","1","RTAccessoryHolderSlotDistance"],"0613":["FD","1","RTAccessorySlotDistance"],"0614":["SQ","1","RTAccessoryHolderDefinitionSequence"],"0615":["LO","1","RTAccessoryDeviceSlotID"],"0616":["SQ","1","RTRadiationSequence"],"0617":["SQ","1","RadiationDoseSequence"],"0618":["SQ","1","RadiationDoseIdentificationSequence"],"0619":["LO","1","RadiationDoseIdentificationLabel"],"061A":["CS","1","ReferenceDoseType"],"061B":["CS","1","PrimaryDoseValueIndicator"],"061C":["SQ","1","DoseValuesSequence"],"061D":["CS","1-n","DoseValuePurpose"],"061E":["FD","3","ReferenceDosePointCoordinates"],"061F":["SQ","1","RadiationDoseValuesParametersSequence"],"0620":["SQ","1","MetersetToDoseMappingSequence"],"0621":["SQ","1","ExpectedInVivoMeasurementValuesSequence"],"0622":["US","1","ExpectedInVivoMeasurementValueIndex"],"0623":["LO","1","RadiationDoseInVivoMeasurementLabel"],"0624":["FD","2","RadiationDoseCentralAxisDisplacement"],"0625":["FD","1","RadiationDoseValue"],"0626":["FD","1","RadiationDoseSourceToSkinDistance"],"0627":["FD","3","RadiationDoseMeasurementPointCoordinates"],"0628":["FD","1","RadiationDoseSourceToExternalContourDistance"],"0629":["SQ","1","RTToleranceSetSequence"],"062A":["LO","1","RTToleranceSetLabel"],"062B":["SQ","1","AttributeToleranceValuesSequence"],"062C":["FD","1","ToleranceValue"],"062D":["SQ","1","PatientSupportPositionToleranceSequence"],"062E":["FD","1","TreatmentTimeLimit"],"062F":["SQ","1","CArmPhotonElectronControlPointSequence"],"0630":["SQ","1","ReferencedRTRadiationSequence"],"0631":["SQ","1","ReferencedRTInstanceSequence"],"0632":["SQ","1","ReferencedRTPatientSetupSequence"],"0634":["FD","1","SourceToPatientSurfaceDistance"],"0635":["SQ","1","TreatmentMachineSpecialModeCodeSequence"],"0636":["US","1","IntendedNumberOfFractions"],"0637":["CS","1","RTRadiationSetIntent"],"0638":["CS","1","RTRadiationPhysicalAndGeometricContentDetailFlag"],"0639":["CS","1","RTRecordFlag"],"063A":["SQ","1","TreatmentDeviceIdentificationSequence"],"063B":["SQ","1","ReferencedRTPhysicianIntentSequence"],"063C":["FD","1","CumulativeMeterset"],"063D":["FD","1","DeliveryRate"],"063E":["SQ","1","DeliveryRateUnitSequence"],"063F":["SQ","1","TreatmentPositionSequence"],"0640":["FD","1","RadiationSourceAxisDistance"],"0641":["US","1","NumberOfRTBeamLimitingDevices"],"0642":["FD","1","RTBeamLimitingDeviceProximalDistance"],"0643":["FD","1","RTBeamLimitingDeviceDistalDistance"],"0644":["SQ","1","ParallelRTBeamDelimiterDeviceOrientationLabelCodeSequence"],"0645":["FD","1","BeamModifierOrientationAngle"],"0646":["SQ","1","FixedRTBeamDelimiterDeviceSequence"],"0647":["SQ","1","ParallelRTBeamDelimiterDeviceSequence"],"0648":["US","1","NumberOfParallelRTBeamDelimiters"],"0649":["FD","2-n","ParallelRTBeamDelimiterBoundaries"],"064A":["FD","2-n","ParallelRTBeamDelimiterPositions"],"064B":["FD","2","RTBeamLimitingDeviceOffset"],"064C":["SQ","1","RTBeamDelimiterGeometrySequence"],"064D":["SQ","1","RTBeamLimitingDeviceDefinitionSequence"],"064E":["CS","1","ParallelRTBeamDelimiterOpeningMode"],"064F":["CS","1-n","ParallelRTBeamDelimiterLeafMountingSide"],"0650":["UI","1","PatientSetupUID"],"0651":["SQ","1","WedgeDefinitionSequence"],"0652":["FD","1","RadiationBeamWedgeAngle"],"0653":["FD","1","RadiationBeamWedgeThinEdgeDistance"],"0654":["FD","1","RadiationBeamEffectiveWedgeAngle"],"0655":["US","1","NumberOfWedgePositions"],"0656":["SQ","1","RTBeamLimitingDeviceOpeningSequence"],"0657":["US","1","NumberOfRTBeamLimitingDeviceOpenings"],"0658":["SQ","1","RadiationDosimeterUnitSequence"],"0659":["SQ","1","RTDeviceDistanceReferenceLocationCodeSequence"],"065A":["SQ","1","RadiationDeviceConfigurationAndCommissioningKeySequence"],"065B":["SQ","1","PatientSupportPositionParameterSequence"],"065C":["CS","1","PatientSupportPositionSpecificationMethod"],"065D":["SQ","1","PatientSupportPositionDeviceParameterSequence"],"065E":["US","1","DeviceOrderIndex"],"065F":["US","1","PatientSupportPositionParameterOrderIndex"],"0660":["SQ","1","PatientSupportPositionDeviceToleranceSequence"],"0661":["US","1","PatientSupportPositionToleranceOrderIndex"],"0662":["SQ","1","CompensatorDefinitionSequence"],"0663":["CS","1","CompensatorMapOrientation"],"0664":["OF","1","CompensatorProximalThicknessMap"],"0665":["OF","1","CompensatorDistalThicknessMap"],"0666":["FD","1","CompensatorBasePlaneOffset"],"0667":["SQ","1","CompensatorShapeFabricationCodeSequence"],"0668":["SQ","1","CompensatorShapeSequence"],"0669":["FD","1","RadiationBeamCompensatorMillingToolDiameter"],"066A":["SQ","1","BlockDefinitionSequence"],"066B":["OF","1","BlockEdgeData"],"066C":["CS","1","BlockOrientation"],"066D":["FD","1","RadiationBeamBlockThickness"],"066E":["FD","1","RadiationBeamBlockSlabThickness"],"066F":["SQ","1","BlockEdgeDataSequence"],"0670":["US","1","NumberOfRTAccessoryHolders"],"0671":["SQ","1","GeneralAccessoryDefinitionSequence"],"0672":["US","1","NumberOfGeneralAccessories"],"0673":["SQ","1","BolusDefinitionSequence"],"0674":["US","1","NumberOfBoluses"],"0675":["UI","1","EquipmentFrameOfReferenceUID"],"0676":["ST","1","EquipmentFrameOfReferenceDescription"],"0677":["SQ","1","EquipmentReferencePointCoordinatesSequence"],"0678":["SQ","1","EquipmentReferencePointCodeSequence"],"0679":["FD","1","RTBeamLimitingDeviceAngle"],"067A":["FD","1","SourceRollAngle"],"067B":["SQ","1","RadiationGenerationModeSequence"],"067C":["SH","1","RadiationGenerationModeLabel"],"067D":["ST","1","RadiationGenerationModeDescription"],"067E":["SQ","1","RadiationGenerationModeMachineCodeSequence"],"067F":["SQ","1","RadiationTypeCodeSequence"],"0680":["DS","1","NominalEnergy"],"0681":["DS","1","MinimumNominalEnergy"],"0682":["DS","1","MaximumNominalEnergy"],"0683":["SQ","1","RadiationFluenceModifierCodeSequence"],"0684":["SQ","1","EnergyUnitCodeSequence"],"0685":["US","1","NumberOfRadiationGenerationModes"],"0686":["SQ","1","PatientSupportDevicesSequence"],"0687":["US","1","NumberOfPatientSupportDevices"],"0688":["FD","1","RTBeamModifierDefinitionDistance"],"0689":["SQ","1","BeamAreaLimitSequence"],"068A":["SQ","1","ReferencedRTPrescriptionSequence"],"0700":["UI","1","TreatmentSessionUID"],"0701":["CS","1","RTRadiationUsage"],"0702":["SQ","1","ReferencedRTRadiationSetSequence"],"0703":["SQ","1","ReferencedRTRadiationRecordSequence"],"0704":["US","1","RTRadiationSetDeliveryNumber"],"0705":["US","1","ClinicalFractionNumber"],"0706":["CS","1","RTTreatmentFractionCompletionStatus"],"0707":["CS","1","RTRadiationSetUsage"],"0708":["CS","1","TreatmentDeliveryContinuationFlag"],"0709":["CS","1","TreatmentRecordContentOrigin"],"0714":["CS","1","RTTreatmentTerminationStatus"],"0715":["SQ","1","RTTreatmentTerminationReasonCodeSequence"],"0716":["SQ","1","MachineSpecificTreatmentTerminationCodeSequence"],"0722":["SQ","1","RTRadiationSalvageRecordControlPointSequence"],"0723":["CS","1","StartingMetersetValueKnownFlag"],"0730":["ST","1","TreatmentTerminationDescription"],"0731":["SQ","1","TreatmentToleranceViolationSequence"],"0732":["CS","1","TreatmentToleranceViolationCategory"],"0733":["SQ","1","TreatmentToleranceViolationAttributeSequence"],"0734":["ST","1","TreatmentToleranceViolationDescription"],"0735":["ST","1","TreatmentToleranceViolationIdentification"],"0736":["DT","1","TreatmentToleranceViolationDateTime"],"073A":["DT","1","RecordedRTControlPointDateTime"],"073B":["US","1","ReferencedRadiationRTControlPointIndex"],"073E":["SQ","1","AlternateValueSequence"],"073F":["SQ","1","ConfirmationSequence"],"0740":["SQ","1","InterlockSequence"],"0741":["DT","1","InterlockDateTime"],"0742":["ST","1","InterlockDescription"],"0743":["SQ","1","InterlockOriginatingDeviceSequence"],"0744":["SQ","1","InterlockCodeSequence"],"0745":["SQ","1","InterlockResolutionCodeSequence"],"0746":["SQ","1","InterlockResolutionUserSequence"],"0760":["DT","1","OverrideDateTime"],"0761":["SQ","1","TreatmentToleranceViolationTypeCodeSequence"],"0762":["SQ","1","TreatmentToleranceViolationCauseCodeSequence"],"0772":["SQ","1","MeasuredMetersetToDoseMappingSequence"],"0773":["US","1","ReferencedExpectedInVivoMeasurementValueIndex"],"0774":["SQ","1","DoseMeasurementDeviceCodeSequence"],"0780":["SQ","1","AdditionalParameterRecordingInstanceSequence"],"0782":["US","1",""],"0783":["ST","1","InterlockOriginDescription"],"0784":["SQ","1","RTPatientPositionScopeSequence"],"0785":["UI","1","ReferencedTreatmentPositionGroupUID"],"0786":["US","1","RadiationOrderIndex"],"0787":["SQ","1","OmittedRadiationSequence"],"0788":["SQ","1","ReasonForOmissionCodeSequence"],"0789":["SQ","1","RTDeliveryStartPatientPositionSequence"],"078A":["SQ","1","RTTreatmentPreparationPatientPositionSequence"],"078B":["SQ","1","ReferencedRTTreatmentPreparationSequence"],"078C":["SQ","1","ReferencedPatientSetupPhotoSequence"],"078D":["SQ","1","PatientTreatmentPreparationMethodCodeSequence"],"078E":["LT","1","PatientTreatmentPreparationProcedureParameterDescription"],"078F":["SQ","1","PatientTreatmentPreparationDeviceSequence"],"0790":["SQ","1","PatientTreatmentPreparationProcedureSequence"],"0791":["SQ","1","PatientTreatmentPreparationProcedureCodeSequence"],"0792":["LT","1","PatientTreatmentPreparationMethodDescription"],"0793":["SQ","1","PatientTreatmentPreparationProcedureParameterSequence"],"0794":["LT","1","PatientSetupPhotoDescription"],"0795":["US","1","PatientTreatmentPreparationProcedureIndex"],"0796":["US","1","ReferencedPatientSetupProcedureIndex"],"0797":["SQ","1","RTRadiationTaskSequence"],"0798":["SQ","1","RTPatientPositionDisplacementSequence"],"0799":["SQ","1","RTPatientPositionSequence"],"079A":["LO","1","DisplacementReferenceLabel"],"079B":["FD","16","DisplacementMatrix"],"079C":["SQ","1","PatientSupportDisplacementSequence"],"079D":["SQ","1","DisplacementReferenceLocationCodeSequence"],"079E":["CS","1","RTRadiationSetDeliveryUsage"]},"300C":{"0000":["UL","1","GenericGroupLength"],"0002":["SQ","1","ReferencedRTPlanSequence"],"0004":["SQ","1","ReferencedBeamSequence"],"0006":["IS","1","ReferencedBeamNumber"],"0007":["IS","1","ReferencedReferenceImageNumber"],"0008":["DS","1","StartCumulativeMetersetWeight"],"0009":["DS","1","EndCumulativeMetersetWeight"],"000A":["SQ","1","ReferencedBrachyApplicationSetupSequence"],"000C":["IS","1","ReferencedBrachyApplicationSetupNumber"],"000E":["IS","1","ReferencedSourceNumber"],"0020":["SQ","1","ReferencedFractionGroupSequence"],"0022":["IS","1","ReferencedFractionGroupNumber"],"0040":["SQ","1","ReferencedVerificationImageSequence"],"0042":["SQ","1","ReferencedReferenceImageSequence"],"0050":["SQ","1","ReferencedDoseReferenceSequence"],"0051":["IS","1","ReferencedDoseReferenceNumber"],"0055":["SQ","1","BrachyReferencedDoseReferenceSequence"],"0060":["SQ","1","ReferencedStructureSetSequence"],"006A":["IS","1","ReferencedPatientSetupNumber"],"0080":["SQ","1","ReferencedDoseSequence"],"00A0":["IS","1","ReferencedToleranceTableNumber"],"00B0":["SQ","1","ReferencedBolusSequence"],"00C0":["IS","1","ReferencedWedgeNumber"],"00D0":["IS","1","ReferencedCompensatorNumber"],"00E0":["IS","1","ReferencedBlockNumber"],"00F0":["IS","1","ReferencedControlPointIndex"],"00F2":["SQ","1","ReferencedControlPointSequence"],"00F4":["IS","1","ReferencedStartControlPointIndex"],"00F6":["IS","1","ReferencedStopControlPointIndex"],"0100":["IS","1","ReferencedRangeShifterNumber"],"0102":["IS","1","ReferencedLateralSpreadingDeviceNumber"],"0104":["IS","1","ReferencedRangeModulatorNumber"],"0111":["SQ","1","OmittedBeamTaskSequence"],"0112":["CS","1","ReasonForOmission"],"0113":["LO","1","ReasonForOmissionDescription"],"0114":["SQ","1","PrescriptionOverviewSequence"],"0115":["FL","1","TotalPrescriptionDose"],"0116":["SQ","1","PlanOverviewSequence"],"0117":["US","1","PlanOverviewIndex"],"0118":["US","1","ReferencedPlanOverviewIndex"],"0119":["US","1","NumberOfFractionsIncluded"],"0120":["SQ","1","DoseCalibrationConditionsSequence"],"0121":["FD","1","AbsorbedDoseToMetersetRatio"],"0122":["FD","2","DelineatedRadiationFieldSize"],"0123":["CS","1","DoseCalibrationConditionsVerifiedFlag"],"0124":["FD","1","CalibrationReferencePointDepth"],"0125":["SQ","1","GatingBeamHoldTransitionSequence"],"0126":["CS","1","BeamHoldTransition"],"0127":["DT","1","BeamHoldTransitionDateTime"],"0128":["SQ","1","BeamHoldOriginatingDeviceSequence"]},"300E":{"0000":["UL","1","GenericGroupLength"],"0002":["CS","1","ApprovalStatus"],"0004":["DA","1","ReviewDate"],"0005":["TM","1","ReviewTime"],"0008":["PN","1","ReviewerName"]},3010:{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","RadiobiologicalDoseEffectSequence"],"0002":["CS","1","RadiobiologicalDoseEffectFlag"],"0003":["SQ","1","EffectiveDoseCalculationMethodCategoryCodeSequence"],"0004":["SQ","1","EffectiveDoseCalculationMethodCodeSequence"],"0005":["LO","1","EffectiveDoseCalculationMethodDescription"],"0006":["UI","1","ConceptualVolumeUID"],"0007":["SQ","1","OriginatingSOPInstanceReferenceSequence"],"0008":["SQ","1","ConceptualVolumeConstituentSequence"],"0009":["SQ","1","EquivalentConceptualVolumeInstanceReferenceSequence"],"000A":["SQ","1","EquivalentConceptualVolumesSequence"],"000B":["UI","1","ReferencedConceptualVolumeUID"],"000C":["UT","1","ConceptualVolumeCombinationExpression"],"000D":["US","1","ConceptualVolumeConstituentIndex"],"000E":["CS","1","ConceptualVolumeCombinationFlag"],"000F":["ST","1","ConceptualVolumeCombinationDescription"],"0010":["CS","1","ConceptualVolumeSegmentationDefinedFlag"],"0011":["SQ","1","ConceptualVolumeSegmentationReferenceSequence"],"0012":["SQ","1","ConceptualVolumeConstituentSegmentationReferenceSequence"],"0013":["UI","1","ConstituentConceptualVolumeUID"],"0014":["SQ","1","DerivationConceptualVolumeSequence"],"0015":["UI","1","SourceConceptualVolumeUID"],"0016":["SQ","1","ConceptualVolumeDerivationAlgorithmSequence"],"0017":["ST","1","ConceptualVolumeDescription"],"0018":["SQ","1","SourceConceptualVolumeSequence"],"0019":["SQ","1","AuthorIdentificationSequence"],"001A":["LO","1","ManufacturerModelVersion"],"001B":["UC","1","DeviceAlternateIdentifier"],"001C":["CS","1","DeviceAlternateIdentifierType"],"001D":["LT","1","DeviceAlternateIdentifierFormat"],"001E":["LO","1","SegmentationCreationTemplateLabel"],"001F":["UI","1","SegmentationTemplateUID"],"0020":["US","1","ReferencedSegmentReferenceIndex"],"0021":["SQ","1","SegmentReferenceSequence"],"0022":["US","1","SegmentReferenceIndex"],"0023":["SQ","1","DirectSegmentReferenceSequence"],"0024":["SQ","1","CombinationSegmentReferenceSequence"],"0025":["SQ","1","ConceptualVolumeSequence"],"0026":["SQ","1","SegmentedRTAccessoryDeviceSequence"],"0027":["SQ","1","SegmentCharacteristicsSequence"],"0028":["SQ","1","RelatedSegmentCharacteristicsSequence"],"0029":["US","1","SegmentCharacteristicsPrecedence"],"002A":["SQ","1","RTSegmentAnnotationSequence"],"002B":["SQ","1","SegmentAnnotationCategoryCodeSequence"],"002C":["SQ","1","SegmentAnnotationTypeCodeSequence"],"002D":["LO","1","DeviceLabel"],"002E":["SQ","1","DeviceTypeCodeSequence"],"002F":["SQ","1","SegmentAnnotationTypeModifierCodeSequence"],"0030":["SQ","1","PatientEquipmentRelationshipCodeSequence"],"0031":["UI","1","ReferencedFiducialsUID"],"0032":["SQ","1","PatientTreatmentOrientationSequence"],"0033":["SH","1","UserContentLabel"],"0034":["LO","1","UserContentLongLabel"],"0035":["SH","1","EntityLabel"],"0036":["LO","1","EntityName"],"0037":["ST","1","EntityDescription"],"0038":["LO","1","EntityLongLabel"],"0039":["US","1","DeviceIndex"],"003A":["US","1","RTTreatmentPhaseIndex"],"003B":["UI","1","RTTreatmentPhaseUID"],"003C":["US","1","RTPrescriptionIndex"],"003D":["US","1","RTSegmentAnnotationIndex"],"003E":["US","1","BasisRTTreatmentPhaseIndex"],"003F":["US","1","RelatedRTTreatmentPhaseIndex"],"0040":["US","1","ReferencedRTTreatmentPhaseIndex"],"0041":["US","1","ReferencedRTPrescriptionIndex"],"0042":["US","1","ReferencedParentRTPrescriptionIndex"],"0043":["ST","1","ManufacturerDeviceIdentifier"],"0044":["SQ","1","InstanceLevelReferencedPerformedProcedureStepSequence"],"0045":["CS","1","RTTreatmentPhaseIntentPresenceFlag"],"0046":["CS","1","RadiotherapyTreatmentType"],"0047":["CS","1-n","TeletherapyRadiationType"],"0048":["CS","1-n","BrachytherapySourceType"],"0049":["SQ","1","ReferencedRTTreatmentPhaseSequence"],"004A":["SQ","1","ReferencedDirectSegmentInstanceSequence"],"004B":["SQ","1","IntendedRTTreatmentPhaseSequence"],"004C":["DA","1","IntendedPhaseStartDate"],"004D":["DA","1","IntendedPhaseEndDate"],"004E":["SQ","1","RTTreatmentPhaseIntervalSequence"],"004F":["CS","1","TemporalRelationshipIntervalAnchor"],"0050":["FD","1","MinimumNumberOfIntervalDays"],"0051":["FD","1","MaximumNumberOfIntervalDays"],"0052":["UI","1-n","PertinentSOPClassesInStudy"],"0053":["UI","1-n","PertinentSOPClassesInSeries"],"0054":["LO","1","RTPrescriptionLabel"],"0055":["SQ","1","RTPhysicianIntentPredecessorSequence"],"0056":["LO","1","RTTreatmentApproachLabel"],"0057":["SQ","1","RTPhysicianIntentSequence"],"0058":["US","1","RTPhysicianIntentIndex"],"0059":["CS","1","RTTreatmentIntentType"],"005A":["UT","1","RTPhysicianIntentNarrative"],"005B":["SQ","1","RTProtocolCodeSequence"],"005C":["ST","1","ReasonForSuperseding"],"005D":["SQ","1","RTDiagnosisCodeSequence"],"005E":["US","1","ReferencedRTPhysicianIntentIndex"],"005F":["SQ","1","RTPhysicianIntentInputInstanceSequence"],"0060":["SQ","1","RTAnatomicPrescriptionSequence"],"0061":["UT","1","PriorTreatmentDoseDescription"],"0062":["SQ","1","PriorTreatmentReferenceSequence"],"0063":["CS","1","DosimetricObjectiveEvaluationScope"],"0064":["SQ","1","TherapeuticRoleCategoryCodeSequence"],"0065":["SQ","1","TherapeuticRoleTypeCodeSequence"],"0066":["US","1","ConceptualVolumeOptimizationPrecedence"],"0067":["SQ","1","ConceptualVolumeCategoryCodeSequence"],"0068":["CS","1","ConceptualVolumeBlockingConstraint"],"0069":["SQ","1","ConceptualVolumeTypeCodeSequence"],"006A":["SQ","1","ConceptualVolumeTypeModifierCodeSequence"],"006B":["SQ","1","RTPrescriptionSequence"],"006C":["SQ","1","DosimetricObjectiveSequence"],"006D":["SQ","1","DosimetricObjectiveTypeCodeSequence"],"006E":["UI","1","DosimetricObjectiveUID"],"006F":["UI","1","ReferencedDosimetricObjectiveUID"],"0070":["SQ","1","DosimetricObjectiveParameterSequence"],"0071":["SQ","1","ReferencedDosimetricObjectivesSequence"],"0073":["CS","1","AbsoluteDosimetricObjectiveFlag"],"0074":["FD","1","DosimetricObjectiveWeight"],"0075":["CS","1","DosimetricObjectivePurpose"],"0076":["SQ","1","PlanningInputInformationSequence"],"0077":["LO","1","TreatmentSite"],"0078":["SQ","1","TreatmentSiteCodeSequence"],"0079":["SQ","1","FractionPatternSequence"],"007A":["UT","1","TreatmentTechniqueNotes"],"007B":["UT","1","PrescriptionNotes"],"007C":["IS","1","NumberOfIntervalFractions"],"007D":["US","1","NumberOfFractions"],"007E":["US","1","IntendedDeliveryDuration"],"007F":["UT","1","FractionationNotes"],"0080":["SQ","1","RTTreatmentTechniqueCodeSequence"],"0081":["SQ","1","PrescriptionNotesSequence"],"0082":["SQ","1","FractionBasedRelationshipSequence"],"0083":["CS","1","FractionBasedRelationshipIntervalAnchor"],"0084":["FD","1","MinimumHoursBetweenFractions"],"0085":["TM","1-n","IntendedFractionStartTime"],"0086":["LT","1","IntendedStartDayOfWeek"],"0087":["SQ","1","WeekdayFractionPatternSequence"],"0088":["SQ","1","DeliveryTimeStructureCodeSequence"],"0089":["SQ","1","TreatmentSiteModifierCodeSequence"],"0090":["CS","1","RoboticBaseLocationIndicator"],"0091":["SQ","1","RoboticPathNodeSetCodeSequence"],"0092":["UL","1","RoboticNodeIdentifier"],"0093":["FD","3","RTTreatmentSourceCoordinates"],"0094":["FD","1","RadiationSourceCoordinateSystemYawAngle"],"0095":["FD","1","RadiationSourceCoordinateSystemRollAngle"],"0096":["FD","1","RadiationSourceCoordinateSystemPitchAngle"],"0097":["SQ","1","RoboticPathControlPointSequence"],"0098":["SQ","1","TomotherapeuticControlPointSequence"],"0099":["FD","1-n","TomotherapeuticLeafOpenDurations"],"009A":["FD","1-n","TomotherapeuticLeafInitialClosedDurations"]},4e3:{"0000":["UL","1","GenericGroupLength"],"0010":["LT","1","Arbitrary"],4e3:["LT","1","TextComments"]},4008:{"0000":["UL","1","GenericGroupLength"],"0040":["SH","1","ResultsID"],"0042":["LO","1","ResultsIDIssuer"],"0050":["SQ","1","ReferencedInterpretationSequence"],"00FF":["CS","1","ReportProductionStatusTrial"],"0100":["DA","1","InterpretationRecordedDate"],"0101":["TM","1","InterpretationRecordedTime"],"0102":["PN","1","InterpretationRecorder"],"0103":["LO","1","ReferenceToRecordedSound"],"0108":["DA","1","InterpretationTranscriptionDate"],"0109":["TM","1","InterpretationTranscriptionTime"],"010A":["PN","1","InterpretationTranscriber"],"010B":["ST","1","InterpretationText"],"010C":["PN","1","InterpretationAuthor"],"0111":["SQ","1","InterpretationApproverSequence"],"0112":["DA","1","InterpretationApprovalDate"],"0113":["TM","1","InterpretationApprovalTime"],"0114":["PN","1","PhysicianApprovingInterpretation"],"0115":["LT","1","InterpretationDiagnosisDescription"],"0117":["SQ","1","InterpretationDiagnosisCodeSequence"],"0118":["SQ","1","ResultsDistributionListSequence"],"0119":["PN","1","DistributionName"],"011A":["LO","1","DistributionAddress"],"0200":["SH","1","InterpretationID"],"0202":["LO","1","InterpretationIDIssuer"],"0210":["CS","1","InterpretationTypeID"],"0212":["CS","1","InterpretationStatusID"],"0300":["ST","1","Impressions"],4e3:["ST","1","ResultsComments"]},4010:{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","LowEnergyDetectors"],"0002":["CS","1","HighEnergyDetectors"],"0004":["SQ","1","DetectorGeometrySequence"],1001:["SQ","1","ThreatROIVoxelSequence"],1004:["FL","3","ThreatROIBase"],1005:["FL","3","ThreatROIExtents"],1006:["OB","1","ThreatROIBitmap"],1007:["SH","1","RouteSegmentID"],1008:["CS","1","GantryType"],1009:["CS","1","OOIOwnerType"],"100A":["SQ","1","RouteSegmentSequence"],1010:["US","1","PotentialThreatObjectID"],1011:["SQ","1","ThreatSequence"],1012:["CS","1","ThreatCategory"],1013:["LT","1","ThreatCategoryDescription"],1014:["CS","1","ATDAbilityAssessment"],1015:["CS","1","ATDAssessmentFlag"],1016:["FL","1","ATDAssessmentProbability"],1017:["FL","1","Mass"],1018:["FL","1","Density"],1019:["FL","1","ZEffective"],"101A":["SH","1","BoardingPassID"],"101B":["FL","3","CenterOfMass"],"101C":["FL","3","CenterOfPTO"],"101D":["FL","6-n","BoundingPolygon"],"101E":["SH","1","RouteSegmentStartLocationID"],"101F":["SH","1","RouteSegmentEndLocationID"],1020:["CS","1","RouteSegmentLocationIDType"],1021:["CS","1-n","AbortReason"],1023:["FL","1","VolumeOfPTO"],1024:["CS","1","AbortFlag"],1025:["DT","1","RouteSegmentStartTime"],1026:["DT","1","RouteSegmentEndTime"],1027:["CS","1","TDRType"],1028:["CS","1","InternationalRouteSegment"],1029:["LO","1-n","ThreatDetectionAlgorithmAndVersion"],"102A":["SH","1","AssignedLocation"],"102B":["DT","1","AlarmDecisionTime"],1031:["CS","1","AlarmDecision"],1033:["US","1","NumberOfTotalObjects"],1034:["US","1","NumberOfAlarmObjects"],1037:["SQ","1","PTORepresentationSequence"],1038:["SQ","1","ATDAssessmentSequence"],1039:["CS","1","TIPType"],"103A":["CS","1","DICOSVersion"],1041:["DT","1","OOIOwnerCreationTime"],1042:["CS","1","OOIType"],1043:["FL","3","OOISize"],1044:["CS","1","AcquisitionStatus"],1045:["SQ","1","BasisMaterialsCodeSequence"],1046:["CS","1","PhantomType"],1047:["SQ","1","OOIOwnerSequence"],1048:["CS","1","ScanType"],1051:["LO","1","ItineraryID"],1052:["SH","1","ItineraryIDType"],1053:["LO","1","ItineraryIDAssigningAuthority"],1054:["SH","1","RouteID"],1055:["SH","1","RouteIDAssigningAuthority"],1056:["CS","1","InboundArrivalType"],1058:["SH","1","CarrierID"],1059:["CS","1","CarrierIDAssigningAuthority"],1060:["FL","3","SourceOrientation"],1061:["FL","3","SourcePosition"],1062:["FL","1","BeltHeight"],1064:["SQ","1","AlgorithmRoutingCodeSequence"],1067:["CS","1","TransportClassification"],1068:["LT","1","OOITypeDescriptor"],1069:["FL","1","TotalProcessingTime"],"106C":["OB","1","DetectorCalibrationData"],"106D":["CS","1","AdditionalScreeningPerformed"],"106E":["CS","1","AdditionalInspectionSelectionCriteria"],"106F":["SQ","1","AdditionalInspectionMethodSequence"],1070:["CS","1","AITDeviceType"],1071:["SQ","1","QRMeasurementsSequence"],1072:["SQ","1","TargetMaterialSequence"],1073:["FD","1","SNRThreshold"],1075:["DS","1","ImageScaleRepresentation"],1076:["SQ","1","ReferencedPTOSequence"],1077:["SQ","1","ReferencedTDRInstanceSequence"],1078:["ST","1","PTOLocationDescription"],1079:["SQ","1","AnomalyLocatorIndicatorSequence"],"107A":["FL","3","AnomalyLocatorIndicator"],"107B":["SQ","1","PTORegionSequence"],"107C":["CS","1","InspectionSelectionCriteria"],"107D":["SQ","1","SecondaryInspectionMethodSequence"],"107E":["DS","6","PRCSToRCSOrientation"]},"4FFE":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","MACParametersSequence"]},5e3:{"0000":["UL","1","GenericGroupLength"],"0005":["US","1","CurveDimensions"],"0010":["US","1","NumberOfPoints"],"0020":["CS","1","TypeOfData"],"0022":["LO","1","CurveDescription"],"0030":["SH","1-n","AxisUnits"],"0040":["SH","1-n","AxisLabels"],"0103":["US","1","DataValueRepresentation"],"0104":["US","1-n","MinimumCoordinateValue"],"0105":["US","1-n","MaximumCoordinateValue"],"0106":["SH","1-n","CurveRange"],"0110":["US","1-n","CurveDataDescriptor"],"0112":["US","1-n","CoordinateStartValue"],"0114":["US","1-n","CoordinateStepValue"],1001:["CS","1","CurveActivationLayer"],2e3:["US","1","AudioType"],2002:["US","1","AudioSampleFormat"],2004:["US","1","NumberOfChannels"],2006:["UL","1","NumberOfSamples"],2008:["UL","1","SampleRate"],"200A":["UL","1","TotalTime"],"200C":["ox","1","AudioSampleData"],"200E":["LT","1","AudioComments"],2500:["LO","1","CurveLabel"],2600:["SQ","1","CurveReferencedOverlaySequence"],2610:["US","1","CurveReferencedOverlayGroup"],3e3:["ox","1","CurveData"]},5200:{"0000":["UL","1","GenericGroupLength"],9229:["SQ","1","SharedFunctionalGroupsSequence"],9230:["SQ","1","PerFrameFunctionalGroupsSequence"]},5400:{"0000":["UL","1","GenericGroupLength"],"0100":["SQ","1","WaveformSequence"],"0110":["ox","1","ChannelMinimumValue"],"0112":["ox","1","ChannelMaximumValue"],1004:["US","1","WaveformBitsAllocated"],1006:["CS","1","WaveformSampleInterpretation"],"100A":["ox","1","WaveformPaddingValue"],1010:["ox","1","WaveformData"]},5600:{"0000":["UL","1","GenericGroupLength"],"0010":["OF","1","FirstOrderPhaseCorrectionAngle"],"0020":["OF","1","SpectroscopyData"]},6e3:{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","OverlayRows"],"0011":["US","1","OverlayColumns"],"0012":["US","1","OverlayPlanes"],"0015":["IS","1","NumberOfFramesInOverlay"],"0022":["LO","1","OverlayDescription"],"0040":["CS","1","OverlayType"],"0045":["LO","1","OverlaySubtype"],"0050":["SS","2","OverlayOrigin"],"0051":["US","1","ImageFrameOrigin"],"0052":["US","1","OverlayPlaneOrigin"],"0060":["CS","1","OverlayCompressionCode"],"0061":["SH","1","OverlayCompressionOriginator"],"0062":["SH","1","OverlayCompressionLabel"],"0063":["CS","1","OverlayCompressionDescription"],"0066":["AT","1-n","OverlayCompressionStepPointers"],"0068":["US","1","OverlayRepeatInterval"],"0069":["US","1","OverlayBitsGrouped"],"0100":["US","1","OverlayBitsAllocated"],"0102":["US","1","OverlayBitPosition"],"0110":["CS","1","OverlayFormat"],"0200":["US","1","OverlayLocation"],"0800":["CS","1-n","OverlayCodeLabel"],"0802":["US","1","OverlayNumberOfTables"],"0803":["AT","1-n","OverlayCodeTableLocation"],"0804":["US","1","OverlayBitsForCodeWord"],1001:["CS","1","OverlayActivationLayer"],1100:["US","1","OverlayDescriptorGray"],1101:["US","1","OverlayDescriptorRed"],1102:["US","1","OverlayDescriptorGreen"],1103:["US","1","OverlayDescriptorBlue"],1200:["US","1-n","OverlaysGray"],1201:["US","1-n","OverlaysRed"],1202:["US","1-n","OverlaysGreen"],1203:["US","1-n","OverlaysBlue"],1301:["IS","1","ROIArea"],1302:["DS","1","ROIMean"],1303:["DS","1","ROIStandardDeviation"],1500:["LO","1","OverlayLabel"],3e3:["ox","1","OverlayData"],4e3:["LT","1","OverlayComments"]},"7F00":{"0000":["UL","1","GenericGroupLength"],"0010":["ox","1","VariablePixelData"],"0011":["US","1","VariableNextDataGroup"],"0020":["OW","1","VariableCoefficientsSDVN"],"0030":["OW","1","VariableCoefficientsSDHN"],"0040":["OW","1","VariableCoefficientsSDDN"]},"7FE0":{"0000":["UL","1","GenericGroupLength"],"0001":["OV","1","ExtendedOffsetTable"],"0002":["OV","1","ExtendedOffsetTableLengths"],"0008":["OF","1","FloatPixelData"],"0009":["OD","1","DoubleFloatPixelData"],"0010":["ox","1","PixelData"],"0020":["OW","1","CoefficientsSDVN"],"0030":["OW","1","CoefficientsSDHN"],"0040":["OW","1","CoefficientsSDDN"]},FFFA:{"0000":["UL","1","GenericGroupLength"],FFFA:["SQ","1","DigitalSignaturesSequence"]},FFFC:{"0000":["UL","1","GenericGroupLength"],FFFC:["OB","1","DataSetTrailingPadding"]},FFFE:{"0000":["UL","1","GenericGroupLength"],E000:["NONE","1","Item"],E00D:["NONE","1","ItemDelimitationItem"],E0DD:["NONE","1","SequenceDelimitationItem"]}};function he(e,t){de[e]=t}const ge={"0000":"Command","0002":"Meta Element","0004":"File Set","0008":"Identifying","0009":"SPI Identifying","0010":"Patient","0012":"Clinical Trial","0018":"Acquisition","0019":"SPI Acquisition","0020":"Image","0021":"SPI Image","0022":"Ophtalmology","0028":"Image Presentation","0032":"Study","0038":"Visit","003A":"Waveform","0040":"Procedure","0042":"Encapsulated Document","0050":"Device Informations","0054":"Nuclear Medicine","0060":"Histogram","0070":"Presentation State","0072":"Hanging Protocol","0088":"Storage","0100":"Authorization","0400":"Digital Signature",1e3:"Code Table",1010:"Zonal Map",2e3:"Film Session",2010:"Film Box",2020:"Image Box",2030:"Annotation",2040:"Overlay Box",2050:"Presentation LUT",2100:"Print Job",2110:"Printer",2120:"Queue",2130:"Print Content",2200:"Media Creation",3002:"RT Image",3004:"RT Dose",3006:"RT StructureSet",3008:"RT Treatment","300A":"RT Plan","300C":"RT Relationship","300E":"RT Approval",4e3:"Text",4008:"Results","4FFE":"MAC Parameters",5e3:"Curve",5002:"Curve",5004:"Curve",5006:"Curve",5008:"Curve","500A":"Curve","500C":"Curve","500E":"Curve",5400:"Waveform Data",6e3:"Overlays",6002:"Overlays",6004:"Overlays",6008:"Overlays","600A":"Overlays","600C":"Overlays","600E":"Overlays",FFFC:"Generic","7FE0":"Pixel Data",FFFF:"Unknown"},Se={OB:!0,OD:!0,OF:!0,OL:!0,OV:!0,OW:!0,SQ:!0,SV:!0,UC:!0,UN:!0,UR:!0,UT:!0,UV:!0,ox:!0};function pe(e){return void 0!==Se[e]}const me={SH:!0,LO:!0,UC:!0,ST:!0,LT:!0,UT:!0,PN:!0};function fe(e){return void 0!==me[e]}const ve={AE:"string",AS:"string",AT:void 0,CS:"string",DA:"string",DS:"string",DT:"string",FL:"Float32",FD:"Float64",IS:"string",LO:"string",LT:"string",OB:"Uint8",OD:"Uint64",OF:"Uint32",OL:"Uint32",OV:"Uint64",OW:"Uint16",PN:"string",SH:"string",SL:"Int32",SQ:void 0,SS:"Int16",ST:"string",SV:"Int64",TM:"string",UC:"string",UI:"string",UL:"Uint32",UN:"Uint8",UR:"string",US:"Uint16",UT:"string",UV:"Uint64"},De={"1.2.840.10008.1.2":"Implicit VR Little Endian","1.2.840.10008.1.2.1":"Explicit VR Little Endian","1.2.840.10008.1.2.1.98":"Encapsulated Uncompressed Explicit VR Little Endian","1.2.840.10008.1.2.1.99":"Deflated Explicit VR Little Endian","1.2.840.10008.1.2.2":"Explicit VR Big Endian (Retired)","1.2.840.10008.1.2.4.50":"JPEG Baseline (Process 1)","1.2.840.10008.1.2.4.51":"JPEG Extended (Process 2 & 4)","1.2.840.10008.1.2.4.52":"JPEG Extended (Process 3 & 5) (Retired)","1.2.840.10008.1.2.4.53":"JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8) (Retired)","1.2.840.10008.1.2.4.54":"JPEG Spectral Selection, Non-Hierarchical (Process 7 & 9) (Retired)","1.2.840.10008.1.2.4.55":"JPEG Full Progression, Non-Hierarchical (Process 10 & 12) (Retired)","1.2.840.10008.1.2.4.56":"JPEG Full Progression, Non-Hierarchical (Process 11 & 13) (Retired)","1.2.840.10008.1.2.4.57":"JPEG Lossless, Non-Hierarchical (Process 14)","1.2.840.10008.1.2.4.58":"JPEG Lossless, Non-Hierarchical (Process 15) (Retired)","1.2.840.10008.1.2.4.59":"JPEG Extended, Hierarchical (Process 16 & 18) (Retired)","1.2.840.10008.1.2.4.60":"JPEG Extended, Hierarchical (Process 17 & 19) (Retired)","1.2.840.10008.1.2.4.61":"JPEG Spectral Selection, Hierarchical (Process 20 & 22) (Retired)","1.2.840.10008.1.2.4.62":"JPEG Spectral Selection, Hierarchical (Process 21 & 23) (Retired)","1.2.840.10008.1.2.4.63":"JPEG Full Progression, Hierarchical (Process 24 & 26) (Retired)","1.2.840.10008.1.2.4.64":"JPEG Full Progression, Hierarchical (Process 25 & 27) (Retired)","1.2.840.10008.1.2.4.65":"JPEG Lossless, Hierarchical (Process 28) (Retired)","1.2.840.10008.1.2.4.66":"JPEG Lossless, Hierarchical (Process 29) (Retired)","1.2.840.10008.1.2.4.70":"JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])","1.2.840.10008.1.2.4.80":"JPEG-LS Lossless Image Compression","1.2.840.10008.1.2.4.81":"JPEG-LS Lossy (Near-Lossless) Image Compression","1.2.840.10008.1.2.4.90":"JPEG 2000 Image Compression (Lossless Only)","1.2.840.10008.1.2.4.91":"JPEG 2000 Image Compression","1.2.840.10008.1.2.4.92":"JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)","1.2.840.10008.1.2.4.93":"JPEG 2000 Part 2 Multi-component Image Compression","1.2.840.10008.1.2.4.94":"JPIP Referenced","1.2.840.10008.1.2.4.95":"JPIP Referenced Deflate","1.2.840.10008.1.2.4.100":"MPEG2 Main Profile / Main Level","1.2.840.10008.1.2.4.101":"MPEG2 Main Profile / High Level","1.2.840.10008.1.2.4.102":"MPEG-4 AVC/H.264 High Profile / Level 4.1","1.2.840.10008.1.2.4.103":"MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1","1.2.840.10008.1.2.4.104":"MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video","1.2.840.10008.1.2.4.105":"MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video","1.2.840.10008.1.2.4.106":"MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2","1.2.840.10008.1.2.4.107":"HEVC/H.265 Main Profile / Level 5.1","1.2.840.10008.1.2.4.108":"HEVC/H.265 Main 10 Profile / Level 5.1","1.2.840.10008.1.2.5":"RLE Lossless","1.2.840.10008.1.2.6.1":"RFC 2557 MIME encapsulation (Retired)","1.2.840.10008.1.2.6.2":"XML Encoding (Retired)","1.2.840.10008.1.2.7.1":"SMPTE ST 2110-20 Uncompressed Progressive Active Video","1.2.840.10008.1.2.7.2":"SMPTE ST 2110-20 Uncompressed Interlaced Active Video","1.2.840.10008.1.2.7.3":"SMPTE ST 2110-30 PCM Digital Audio","1.2.840.10008.1.20":"Papyrus 3 Implicit VR Little Endian (Retired)"},ye="1.2.840.10008.1.2",Ce="1.2.840.10008.1.2.1",Ie="1.2.840.10008.1.2.2";class Te{#K;#J;constructor(e,t){if(!e||void 0===e)throw new Error("Cannot create tag with no group.");if(4!==e.length)throw new Error("Cannot create tag with badly sized group: "+e);if(!t||void 0===t)throw new Error("Cannot create tag with no element.");if(4!==t.length)throw new Error("Cannot create tag with badly sized element: "+t);this.#K=e,this.#J=t}getGroup(){return this.#K}getElement(){return this.#J}toString(){return this.getKey()+": "+this.getNameFromDictionary()}equals(e){return null!=e&&this.#K===e.getGroup()&&this.#J===e.getElement()}getKey(){return this.#K+this.#J}getGroupName(){return ge[this.#K]}isWithVR(){return!("FFFE"===this.#K&&("E000"===this.#J||"E00D"===this.#J||"E0DD"===this.#J))}isPrivate(){return parseInt(this.#K,16)%2==1}#$(){let e;return void 0!==de[this.#K]&&void 0!==de[this.#K][this.#J]&&(e=de[this.#K][this.#J]),e}getVrFromDictionary(){let e;const t=this.#$();return void 0!==t&&(e=t[0]),e}getMultiplicityFromDictionary(){let e;const t=this.#$();return void 0!==t&&(e=parseInt(t[1],10)),e}getNameFromDictionary(){let e;const t=this.#$();return void 0!==t&&(e=t[2]),e}}function Le(e,t){let n=parseInt(e.getGroup(),16)-parseInt(t.getGroup(),16);return 0===n&&(n=parseInt(e.getElement(),16)-parseInt(t.getElement(),16)),n}function we(e){if(!e||void 0===e)throw new Error("Cannot create tag with no key.");if(8!==e.length)throw new Error("Cannot create tag with badly sized key: "+e);return new Te(e.substring(0,4),e.substring(4,8))}function Pe(){return new Te("FFFE","E000")}function Ae(e){return"FFFEE000"===e.getKey()}function Oe(e){return"FFFEE00D"===e.getKey()}function be(e){return"FFFEE0DD"===e.getKey()}function xe(){return new Te("7FE0","0010")}function Re(e){return["7FE00010","7FE00009","7FE00008"].includes(e.getKey())}function Ee(e){const t=["7FE00010","7FE00009","7FE00008"];let n;for(const i of t)if(void 0!==e[i]){n=e[i];break}return n}function Fe(e){return void 0!==Ee(e)}function qe(e){if(null==e)return null;let t=null,n=null;const i=de,o=Object.keys(i);let r,a,s=!1;for(let a=0,l=o.length;a<l;++a){t=o[a],r=Object.keys(i[t]);for(let o=0,a=r.length;o<a;++o)if(n=r[o],i[t][n][2]===e){s=!0;break}if(s)break}return s&&(a=new Te(t,n)),a}function Me(e){return function(t,n){const i=we(n);let o=i.getNameFromDictionary();void 0===o&&(o="x"+i.getKey());const r=e[n];for(const e in r)void 0===r[e]&&delete r[e];let a;if("SQ"===r.vr){a={value:[]};for(let e=0;e<r.value.length;++e){const t=r.value[e];a.value.push(Object.keys(t).reduce(Me(t),{}))}}else a=1===r.value.length?r.value[0]:r.value;return t[o]=a,t}}function Ue(e){const t=structuredClone(e);return Object.keys(t).reduce(Me(t),{})}class Qe{vr;value;tag;vl;undefinedLength;startOffset;endOffset;items;constructor(e){this.vr=e}}function Ve(e){return void 0!==e&&void 0!==e.value&&0!==e.value.length}function Ne(e,t){let n;return Ve(e[t])&&(n=e[t].value[0]),n}function Be(e,t){let n;return Ve(e[t])&&(n=e[t].value),n}function ke(e,t,n){let i="";if(void 0===e)i+=" "+t+" is undefined,";else if(void 0===e.value)i+=" "+t+" has undefined value,";else if(0===e.value.length)i+=" "+t+" is empty,";else if(void 0!==n)for(let o=0;o<n.length;++o)e.value.includes(n[o])||(i+=" "+t+" does not contain "+n[o]+" (value: "+e.value+"),");return i}function Ge(e){const t=e.byteLength,n=new Uint8Array(e.buffer,e.byteOffset,t),i=e.BYTES_PER_ELEMENT;let o;for(let e=0;e<t;e+=i)for(let t=e+i-1,r=e;t>r;t--,r++)o=n[r],n[r]=n[t],n[t]=o}class He{#ee;#te=!0;#ne=function(){return new Int8Array(new Int16Array([1]).buffer)[0]>0}();#ie;#oe;constructor(e,t){this.#ee=e,void 0!==t&&(this.#te=t),this.#ie=this.#te!==this.#ne,this.#oe=new DataView(e)}readUint16(e){return this.#oe.getUint16(e,this.#te)}readInt16(e){return this.#oe.getInt16(e,this.#te)}readUint32(e){return this.#oe.getUint32(e,this.#te)}readBigUint64(e){return this.#oe.getBigUint64(e,this.#te)}readInt32(e){return this.#oe.getInt32(e,this.#te)}readBigInt64(e){return this.#oe.getBigInt64(e,this.#te)}readFloat32(e){return this.#oe.getFloat32(e,this.#te)}readFloat64(e){return this.#oe.getFloat64(e,this.#te)}readBinaryArray(e,t,n){const i=new Uint8Array(this.#ee,e,t);let o;o=void 0!==n?n:8*i.length;const r=new Uint8Array(o);let a,s;for(let e=0;e<o;++e)a=e%8,s=Math.floor(e/8),r[e]=255*!!(i[s]&1<<a);return r}readUint8Array(e,t){return new Uint8Array(this.#ee,e,t)}readInt8Array(e,t){return new Int8Array(this.#ee,e,t)}readUint16Array(e,t){const n=Uint16Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new Uint16Array(this.#ee,e,i),this.#ie&&Ge(o);else{o=new Uint16Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readUint16(t),t+=n}return o}readInt16Array(e,t){const n=Int16Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new Int16Array(this.#ee,e,i),this.#ie&&Ge(o);else{o=new Int16Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readInt16(t),t+=n}return o}readUint32Array(e,t){const n=Uint32Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new Uint32Array(this.#ee,e,i),this.#ie&&Ge(o);else{o=new Uint32Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readUint32(t),t+=n}return o}readUint64Array(e,t){const n=BigUint64Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new BigUint64Array(this.#ee,e,i),this.#ie&&Ge(o);else{o=new BigUint64Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readBigUint64(t),t+=n}return o}readInt32Array(e,t){const n=Int32Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new Int32Array(this.#ee,e,i),this.#ie&&Ge(o);else{o=new Int32Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readInt32(t),t+=n}return o}readInt64Array(e,t){const n=BigInt64Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new BigInt64Array(this.#ee,e,i),this.#ie&&Ge(o);else{o=new BigInt64Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readBigInt64(t),t+=n}return o}readFloat32Array(e,t){const n=Float32Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new Float32Array(this.#ee,e,i),this.#ie&&Ge(o);else{o=new Float32Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readFloat32(t),t+=n}return o}readFloat64Array(e,t){const n=Float64Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new Float64Array(this.#ee,e,i),this.#ie&&Ge(o);else{o=new Float64Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readFloat64(t),t+=n}return o}readHex(e){const t=this.readUint16(e).toString(16);return"0000".substring(0,4-t.length)+t.toUpperCase()}}function ze(){return"0.37.0-beta.2"}function Ye(e){const t=e.split("-");let n=[];for(const e of t)n=n.concat(e.split("."));return n}function Xe(e,t){let n=0;const i=Ye(e),o=Ye(t);for(let e=0;e<3&&(n=parseInt(i[e],10)-parseInt(o[e],10),0===n);++e);if(0===n){const e=4,t=i[e],r=o[e];n=void 0===t&&void 0===r?0:void 0===t&&void 0!==r?1:void 0!==t&&void 0===r?-1:parseInt(t,10)-parseInt(r,10)}return n}function We(e){return!(e.byteLength<132)&&"DICM"===new Uint8Array(e,128,4).reduce((function(e,t){return e+String.fromCharCode(t)}),"")}const je=String.fromCharCode("u200B");class Ze{decode(e){let t="";for(let n=0,i=e.length;n<i;++n)t+=String.fromCharCode(e[n]);return t}}function _e(e){if(!e)return null;const t={L:"R",R:"L",A:"P",P:"A",H:"F",F:"H"};let n="";for(let i=0;i<e.length;i++){const o=t[e.substring(i,i+1)];o&&(n+=o)}return n}function Ke(e){return e===ye}function Je(e){return e===Ie}function $e(e){return"1.2.840.10008.1.2.4.50"===e||"1.2.840.10008.1.2.4.51"===e}function et(e){return"1.2.840.10008.1.2.4.57"===e||"1.2.840.10008.1.2.4.70"===e}function tt(e){return null!==e.match(/1.2.840.10008.1.2.4.9/)}function nt(e){return"1.2.840.10008.1.2.5"===e}function it(e,t,n){let i=null;try{1===e||8===e?i=0===t?new Uint8Array(n):new Int8Array(n):16===e?i=0===t?new Uint16Array(n):new Int16Array(n):32===e&&(i=0===t?new Uint32Array(n):new Int32Array(n))}catch(e){if(e instanceof RangeError){const e=Math.floor(Math.log(n)/Math.log(2));h.error("Cannot allocate array of size: "+n+" (>2^"+e+").")}}return i}function ot(e,t){return t?8:pe(e)?12:8}const rt="00280100",at="00280103";class st{#re={};#ae;#se=new Ze;#le=this.#se;#ce(e){return this.#se.decode(e)}#ue(e){return this.#le.decode(e)}getDefaultCharacterSet(){return this.#ae}setDefaultCharacterSet(e){this.#ae=e}setDecoderCharacterSet(e){this.#le=new TextDecoder(e)}getDicomElements(){return this.#re}safeGet(e){return Ne(this.#re,e)}#de(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 Te(n,i),endOffset:t}}#he(e,t,n){const i={};let o=this.#ge(e,t,n);if(t=o.endOffset,be(o.tag))return{data:i,endOffset:o.endOffset,isSeqDelim:!0};if(i[o.tag.getKey()]={tag:o.tag,vr:"NONE",vl:o.vl,undefinedLength:o.undefinedLength},o.undefinedLength){let r=!1;for(;!r;)o=this.#ge(e,t,n),t=o.endOffset,r=Oe(o.tag),r||(i[o.tag.getKey()]=o)}else{const r=t;for(t-=o.vl;t<r;)o=this.#ge(e,t,n),t=o.endOffset,i[o.tag.getKey()]=o}return{data:i,endOffset:t,isSeqDelim:!1}}#Se(e,t,n){const i=[];let o=this.#ge(e,t,n);const r=o.vl;t=o.endOffset;let a=!1;for(;!a;)o=this.#ge(e,t,n),t=o.endOffset,a=be(o.tag),a||(o.vr="OB",i.push(o));return{data:i,endOffset:t,offsetTableVl:r}}#ge(e,t,n,i){const o=this.#de(e,t),r=o.tag;if(void 0!==i&&r.equals(i)){const e=new Qe("");return e.tag=r,e}t=o.endOffset;let a,s="NONE",l=!0;r.isWithVR()&&(n?(s=r.getVrFromDictionary(),void 0===s&&(s="UN"),l=!0):(s=this.#ce(e.readUint8Array(t,2)),t+=2*Uint8Array.BYTES_PER_ELEMENT,l=pe(s),l&&(t+=2*Uint8Array.BYTES_PER_ELEMENT))),function(e){return Object.keys(ve).concat(["NONE","ox","xx","xs"]).includes(e)}(s)||(h.warn("Unknown VR: "+s+" (for tag "+r.getKey()+"), treating as 'UN'"),s="UN"),l?(a=e.readUint32(t),t+=Uint32Array.BYTES_PER_ELEMENT):(a=e.readUint16(t),t+=Uint16Array.BYTES_PER_ELEMENT);let c=!1;4294967295===a&&(c=!0,a=0),r.isPrivate()&&"UN"===s&&0===a&&(s="SQ");let u,d=t,g=d+a;if(Re(r)&&c){const i=this.#Se(e,t,n);t=i.endOffset,d+=i.offsetTableVl,u=i.data,g=t,a=t-d}else if("SQ"===s){let i;if(u=[],c){let o=!1;for(;!o;)i=this.#he(e,t,n),o=i.isSeqDelim,t=i.endOffset,o||u.push(i.data);g=t,a=t-d}else if(0!==a){const o=t+a;for(;t<o;)i=this.#he(e,t,n),u.push(i.data),t=i.endOffset;g=t,a=t-d}}const S=new Qe(s);return S.tag=r,S.vl=a,S.startOffset=d,S.endOffset=g,c&&(S.undefinedLength=c),u&&(S.items=u),S}#pe(e,t,n){const i=e.tag,o=e.vl,r=e.vr,a=e.startOffset;let s,l,c;void 0!==n&&(s=n.bitsAllocated,l=n.pixelRepresentation);const u=ve[r];if(Re(i))if(e.undefinedLength){c=[];for(let i=0;i<e.items.length;++i)c.push(this.#pe(e.items[i],t,n));delete e.items}else if(s>8&&"OB"===r&&(h.warn("Reading DICOM pixel data with bitsAllocated>8 and OB VR, treating as OW"),e.vr="OW"),c=[],1===s)c.push(t.readBinaryArray(a,o,n.imageBufferSize));else if(8===s)0===l?c.push(t.readUint8Array(a,o)):c.push(t.readInt8Array(a,o));else if(16===s)0===l?c.push(t.readUint16Array(a,o)):c.push(t.readInt16Array(a,o));else if(32===s)c.push(t.readFloat32Array(a,o));else{if(64!==s)throw new Error("Unsupported bits allocated: "+s);c.push(t.readFloat64Array(a,o))}else if(void 0!==u)if("Uint8"===u)c=t.readUint8Array(a,o);else if("Uint16"===u)c=t.readUint16Array(a,o),"O"!==r[0]&&(c=Array.from(c));else if("Uint32"===u)c=t.readUint32Array(a,o),"O"!==r[0]&&(c=Array.from(c));else if("Uint64"===u)c=t.readUint64Array(a,o);else if("Int16"===u)c=Array.from(t.readInt16Array(a,o));else if("Int32"===u)c=Array.from(t.readInt32Array(a,o));else if("Int64"===u)c=t.readInt64Array(a,o);else if("Float32"===u)c=Array.from(t.readFloat32Array(a,o));else if("Float64"===u)c=Array.from(t.readFloat64Array(a,o));else{if("string"!==u)throw new Error("Unknown VR type: "+u);{const e=t.readUint8Array(a,o);c=fe(r)?this.#ue(e):this.#ce(e),c=function(e){let t=e;const n=e.length-1;return e[n]===je&&(t=e.substring(0,n)),t=t.trim(),t}(c).split("\\")}}else if("xx"===r)c=Array.from(t.readUint16Array(a,o));else if("ox"===r)c=8===s?0===l?Array.from(t.readUint8Array(a,o)):Array.from(t.readInt8Array(a,o)):0===l?Array.from(t.readUint16Array(a,o)):Array.from(t.readInt16Array(a,o));else if("xs"===r)c=0===l?Array.from(t.readUint16Array(a,o)):Array.from(t.readInt16Array(a,o));else if("AT"===r){const e=t.readUint16Array(a,o);c=[];for(let t=0,n=e.length;t<n;t+=2){const n=e[t].toString(16),i=e[t+1].toString(16);let o="(";o+="0000".substring(0,4-n.length)+n.toUpperCase(),o+=",",o+="0000".substring(0,4-i.length)+i.toUpperCase(),o+=")",c.push(o)}}else if("SQ"===r){c=[];for(let n=0;n<e.items.length;++n){const i=e.items[n],o={},r=Object.keys(i);let a=s,u=l;for(let e=0;e<r.length;++e){let n=i[rt];void 0!==n&&void 0!==n.value&&(a=n.value[0]),n=i[at],void 0!==n&&void 0!==n.value&&(u=n.value[0]);const s={bitsAllocated:a,pixelRepresentation:u},l=i[r[e]];l.value=this.#pe(l,t,s),delete l.tag,delete l.vl,delete l.startOffset,delete l.endOffset,o[r[e]]=l}c.push(o)}delete e.items}else"NONE"===r||h.warn("Unknown VR: "+r+" (for tag "+e.tag.getKey()+")"),c=[];return c}#me(e,t,n){const i=Object.keys(e);for(let o=0;o<i.length;++o){const r=e[i[o]];void 0===r.value&&(r.value=this.#pe(r,t,n)),delete r.tag,delete r.vl,delete r.startOffset,delete r.endOffset}}parse(e,t){let n,i,o;const r=new He(e);let a=new He(e);n=128;const s=this.#ce(r.readUint8Array(n,4));if(n+=4*Uint8Array.BYTES_PER_ELEMENT,"DICM"===s){o=this.#ge(r,n,!1),o.value=this.#pe(o,r),n=o.endOffset,this.#re[o.tag.getKey()]=o;const e=n+o.value[0];for(;n<e;)o=this.#ge(r,n,!1),n=o.endOffset,this.#re[o.tag.getKey()]=o;if(o=this.#re["00020010"],void 0===o)throw new Error("Not a valid DICOM file (no TransferSyntaxUID found)");o.value=this.#pe(o,r),i=o.value[0]}else{h.warn("Invalid DICM prefix ("+s+"), trying to guess tansfer syntax."),o=this.#ge(a,0,!1);const e=function(e){const t="0008",n=e.tag.getGroup();if("0800"!==n&&n!==t)throw new Error("Not a valid DICOM file (invalid DICM word found and first element not in 0008 group)");const i=e.vr,o=i.charCodeAt(0),r=i.charCodeAt(1),a=!(o>=65&&o<=90&&r>=65&&r<=90);let s;if(n===t)s=a?ye:Ce;else{if(a)throw new Error("Not a valid DICOM file (no magic DICM word foundand implicit VR big endian detected)");s=Ie}const l=new Qe("UI");return l.tag=new Te("0002","0010"),l.value=[s],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(o);this.#re[e.tag.getKey()]=e,i=e.value[0],n=0}if(!function(e){return e===ye||e===Ce||e===Ie||$e(e)||et(e)||tt(e)||nt(e)}(i))throw new Error("Unsupported DICOM transfer syntax: '"+i+"' ("+function(e){let t="Unknown";return void 0!==De[e]&&(t=De[e]),t}(i)+")");let l=!1;Ke(i)&&(l=!0),Je(i)&&(a=new He(e,!1));let c,u=!1;for(;n<e.byteLength;){if(o=this.#ge(a,n,l,t),void 0!==t&&o.tag.equals(t)){u=!0;break}n=o.endOffset;const e=o.tag.getKey();void 0===this.#re[e]?this.#re[e]=o:h.warn("Not saving duplicate tag: "+e)}if(isNaN(n))throw new Error("Problem while parsing, bad offset");if(u||e.byteLength===n||h.warn("Did not reach the end of the buffer: "+n+" != "+e.byteLength),Fe(this.#re)){let e=0;o=this.#re[at],void 0!==o?(o.value=this.#pe(o,a),e=o.value[0]):h.warn("Reading DICOM pixel data with default pixelRepresentation.");let t=16;o=this.#re[rt],void 0!==o?(o.value=this.#pe(o,a),t=o.value[0]):h.warn("Reading DICOM pixel data with default bitsAllocated.");let n,i,r=1;o=this.#re["00280008"],void 0!==o&&(o.value=this.#pe(o,a),r=parseInt(o.value[0],10)),c={pixelRepresentation:e,bitsAllocated:t,numberOfFrames:r},o=this.#re["00280010"],void 0!==o&&(o.value=this.#pe(o,a),n=parseInt(o.value[0],10)),o=this.#re["00280011"],void 0!==o&&(o.value=this.#pe(o,a),i=parseInt(o.value[0],10)),void 0!==n&&void 0!==i&&(c.imageBufferSize=n*i*r)}if(void 0!==this.#ae&&this.setDecoderCharacterSet(this.#ae),o=this.#re["00080005"],void 0!==o){let e;o.value=this.#pe(o,a),1===o.value.length?e=o.value[0]:(e=o.value[1],h.warn("Unsupported character set with code extensions: '"+e+"'.")),this.setDecoderCharacterSet(function(e){let t="utf-8";return"ISO_IR 100"===e?t="iso-8859-1":"ISO_IR 101"===e?t="iso-8859-2":"ISO_IR 109"===e?t="iso-8859-3":"ISO_IR 110"===e?t="iso-8859-4":"ISO_IR 144"===e?t="iso-8859-5":"ISO_IR 127"===e?t="iso-8859-6":"ISO_IR 126"===e?t="iso-8859-7":"ISO_IR 138"===e?t="iso-8859-8":"ISO_IR 148"===e?t="iso-8859-9":"ISO_IR 13"===e?t="shift-jis":"ISO_IR 166"===e?t="iso-8859-11":"ISO 2022 IR 87"===e?t="iso-2022-jp":"ISO 2022 IR 149"===e||"ISO 2022 IR 58"===e||("ISO_IR 192"===e?t="utf-8":"GB18030"===e?t="gb18030":"GB2312"===e?t="gb2312":"GBK"===e&&(t="chinese")),t}(e))}if(this.#me(this.#re,a,c),o=this.#re["7FE00010"],void 0!==o&&o.undefinedLength){const e=c.numberOfFrames,t=o.value;if(t.length>1&&t.length>e){const n=t.length/e,i=[];let r;for(let o=0;o<e;++o){r=o*n;let e=0;for(let i=0;i<n;++i)e+=t[r+i].length;const a=new t[0].constructor(e);let s=0;for(let e=0;e<n;++e)a.set(t[r+e],s),s+=t[r+e].length;i[o]=a}o.value=i}}}}class lt{#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;e<this.length();++e)t=t||this.moreThanOne(e);return t}getDimSize(e,t){if(e>this.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;i<e;++i)n*=this.get(i);return n}getTotalSize(e){return this.getDimSize(this.length(),e)}equals(e){if(!e)return!1;const t=this.length();if(t!==e.length())return!1;for(let n=0;n<t;++n)if(this.get(n)!==e.get(n))return!1;return!0}isInBounds(e,t){if(!e)return!1;const n=this.length();if(n!==e.length())return!1;if(void 0===t){t=[];for(let e=0;e<n;++e)t.push(e)}else for(let e=0;e<n;++e)if(t[e]>n-1)throw new Error("Wrong input dir value: "+t[e]);for(let n=0;n<t.length;++n)if(i=e.get(t[n]),o=this.get(t[n]),!(i>=0&&i<o))return!1;var i,o;return!0}indexToOffset(e,t){if(e.length()>this.length())throw new Error("Incompatible index and size length");if(void 0===t)t=0;else if(t<0||t>this.length()-1)throw new Error("Invalid start value for indexToOffset");let n=0;for(let i=t;i<e.length();++i){const o=this.get(i),r=e.get(i);if(r>=o||r<0)return-1;n+=r*this.getDimSize(i,t)}return n}offsetToIndex(e){const t=new Array(this.length());let n,i=e;for(let e=this.length()-1;e>0;--e)n=this.getDimSize(e),t[e]=Math.floor(i/n),i-=t[e]*n;return t[0]=i,new o(t)}get2D(){return{x:this.get(0),y:this.get(1)}}#fe(e,t){const n=e.slice(0,this.length());for(let i=e.length;i<this.length();++i)void 0!==t&&void 0!==t[i]?n.push(t[i]):n.push(0);return n}normalisePoint(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#fe(e.getValues(),n);return new q(i)}normaliseIndex(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#fe(e.getValues(),n);return new o(i)}}class ct{#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;n<t;++n)if(this.get(n)!==e.get(n))return!1;return!0}get2D(){return{x:this.get(0),y:this.get(1)}}}class ut{min;max;mean;stdDev;median;p25;p75;constructor(e,t,n,i){this.min=e,this.max=t,this.mean=n,this.stdDev=i}}function dt(e,t){return function(e){return null!=e&&(e.includes("median")||e.includes("p25")||e.includes("p75"))}(t)?function(e){const t=ht(e);return e.sort((function(e,t){return e-t})),t.median=gt(e,.5),t.p25=gt(e,.25),t.p75=gt(e,.75),t}(e):ht(e)}function ht(e){let t=e[0],n=t,i=0,o=0;for(const r of e)r<t?t=r:r>n&&(n=r),i+=r,o+=r*r;const r=e.length,a=i/r;let s=o/r-a*a;s<0&&(s=0);const l=Math.sqrt(s);return new ut(t,n,a,l)}function gt(e,t){if(0===e.length)throw new Error("Empty array provided for percentile calculation.");if(t<0||t>1)throw new Error("Invalid ratio provided for percentile calculation: "+t);if(0===t)return e[0];if(1===t)return e[e.length-1];const n=(e.length-1)*t,i=Math.floor(n),o=e[i];return o+(e[i+1]-o)*(n-i)}class St{min;max;constructor(e,t){this.min=e,this.max=t}}class pt{success;message;constructor(e){this.success=e}}class mt{#ve;#De;#ye;#Ce={};#Ie;#N=V();constructor(e,t,n,i,o){this.#ve=e,this.#De=t,this.#ye=n,void 0!==o&&(this.#Ie=o,this.#Ce[o]=e.slice()),void 0!==i&&(this.#N=i)}clone(){return new mt(this.#ve.slice(),new lt(this.#De.getValues()),new ct(this.#ye.getValues()),new Q(this.#N.getValues()),this.#Ie)}getInitialTime(){return this.#Ie}setInitialTime(e){void 0!==this.#Ce[this.#Ie]&&delete this.#Ce[this.#Ie],this.#Ie=e,this.#Ce[e]=this.#ve.slice()}getCurrentTotalNumberOfSlices(){const e=Object.keys(this.#Ce);if(0===e.length)return this.#ve.length;let t=0;for(let n=0;n<e.length;++n)t+=this.#Ce[e[n]].length;return t}hasSlicesAtTime(e){return void 0!==this.#Ce[e]}getCurrentNumberOfSlicesBeforeTime(e){const t=Object.keys(this.#Ce);if(0===t.length)return;let n=0;for(let i=0;i<t.length;++i){const o=t[i];if(parseInt(o,10)===e)break;n+=this.#Ce[o].length}return n}getOrigin(){return this.#ve[0]}getOrigins(){return this.#ve}includesOrigin(e,t){for(let n=0;n<this.#ve.length;++n)if(this.#ve[n].isSimilar(e,t))return!0;return!1}getSize(e){let t=this.#De;if(e&&void 0!==e){let n=ft([this.#De.get(0),this.#De.get(1),this.#De.get(2)],e);n=n.map(Math.abs),t=new lt(n.concat(this.#De.getValues().slice(3)))}return t}updateSliceSpacing(){const e=function(e){if(e.length<=1)return;const t=[];for(let n=0;n<e.length-1;++n){const i=e[n],o=e[n+1],r=i.getDistance(o);if(0===r)throw new Error("Zero slice spacing "+i.toString()+" "+o.toString());t.push(r)}const n=ht(t),i=ne(n.mean,4);return n.stdDev>M&&h.warn("Varying slice spacing, value: "+i+" (mean: "+n.mean+", min: "+n.min+", max: "+n.max+", stdDev: "+n.stdDev+")"),i}(this.#ve);if(void 0!==e){1!==this.#ye.get(2)&&this.#ye.get(2)!==e&&h.debug("Using geometric spacing "+e+" instead of tag spacing "+this.#ye.get(2));const t=this.#ye.getValues();t[2]=e,this.#ye=new ct(t)}}getSpacing(e){let t=this.#ye;if(e&&void 0!==e){let n=ft([this.#ye.get(0),this.#ye.get(1),this.#ye.get(2)],e);n=n.map(Math.abs),t=new ct(n)}return t}getRealSpacing(){return this.getSpacing(this.#N.getInverse().asOneAndZeros())}getOrientation(){return this.#N}getSliceIndex(e,t){let n=this.#ve;void 0!==t&&(n=this.#Ce[t]);const i=e.getClosest(n),o=n[i],r=e.minus(o);return new R(this.#N.get(0,2),this.#N.get(1,2),this.#N.get(2,2)).isCodirectional(r)?i+1:i}canAppend(e){const t=e.getSize();if(1!==t.get(2))return{success:!1,message:"Cannot append more than one slice"};const n=this.getSize();if(n.get(0)!==t.get(0))return{success:!1,message:"Cannot append a slice with different number of columns"};if(n.get(1)!==t.get(1))return{success:!1,message:"Cannot append a slice with different number of rows"};if(!this.getOrientation().isSimilar(e.getOrientation(),M))return{success:!1,message:"Cannot append a slice with different orientation"};const i=this.canAppendOrigin(e.getOrigin(),e.getInitialTime());return i.success?new pt(!0):i}canAppendOrigin(e,t){const n=function(t){return t.equals(e)};if(void 0!==t&&t!==this.#Ie){if(void 0!==this.#Ce[t]&&void 0!==this.#Ce[t].find(n))return{success:!1,message:"Cannot append same time origin twice"}}else if(void 0!==this.#ve.find(n))return{success:!1,message:"Cannot append same origin twice"};return new pt(!0)}appendOrigin(e,t,n){const i=this.canAppendOrigin(e,n);if(!i.success)throw new Error(i.message);if(void 0!==n&&this.#Ce[n].splice(t,0,e),void 0===n||n===this.#Ie){this.#ve.splice(t,0,e);const n=this.#De.getValues();n[2]+=1,this.#De=new lt(n)}}appendFrame(e,t){this.#Ce[t]=[e];const n=this.#De.getValues(),i=this.#ye.getValues();4===n.length?n[3]+=1:(n.push(2),i.push(1)),this.#De=new lt(n),this.#ye=new ct(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())&&this.getOrientation().equals(e.getOrientation())}isInBounds(e){return this.isIndexInBounds(this.worldToIndex(e))}isIndexInBounds(e,t){return this.getSize().isInBounds(e,t)}getRange(){const e=this.getSize().length(),t=new Array(e);t.fill(0);const n=new o(t),i=new o(this.getSize().getValues());return[this.indexToWorld(n),this.indexToWorld(i)]}indexToWorld(e){const t=this.getSpacing(),n=new F(e.get(0)*t.get(0),e.get(1)*t.get(1),e.get(2)*t.get(2)),i=this.getOrientation().multiplyPoint3D(n),o=e.getValues(),r=this.getOrigin();return o[0]=r.getX()+i.getX(),o[1]=r.getY()+i.getY(),o[2]=r.getZ()+i.getZ(),new q(o)}pointToWorld(e){const t=this.getSpacing(),n=new F(e.getX()*t.get(0),e.getY()*t.get(1),e.getZ()*t.get(2)),i=this.getOrientation().multiplyPoint3D(n),o=this.getOrigin();return new F(o.getX()+i.getX(),o.getY()+i.getY(),o.getZ()+i.getZ())}worldToIndex(e){const t=this.getOrigin(),n=new F(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),i=this.getOrientation().getInverse().multiplyPoint3D(n),r=e.getValues(),a=this.getSpacing();return r[0]=Math.floor(ne(i.getX()/a.get(0),5)),r[1]=Math.floor(ne(i.getY()/a.get(1),5)),r[2]=Math.floor(ne(i.getZ()/a.get(2),5)),new o(r)}worldToPoint(e){const t=this.getOrigin(),n=new F(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),i=this.getOrientation().getInverse().multiplyPoint3D(n),o=e.getValues(),r=this.getSpacing();return o[0]=i.getX()/r.get(0),o[1]=i.getY()/r.get(1),o[2]=i.getZ()/r.get(2),new F(o[0],o[1],o[2])}}function ft(e,t){return t.getInverse().multiplyArray3D(e)}function vt(e,t){return t.multiplyArray3D(e)}function Dt(){return new Q([1,0,0,0,0,1,0,-1,0])}const yt={Axial:"axial",Coronal:"coronal",Sagittal:"sagittal"};function Ct(e){let t;return e===yt.Axial?t=V():e===yt.Coronal?t=Dt():e===yt.Sagittal&&(t=new Q([0,0,-1,1,0,0,0,-1,0])),t}function It(e){const t=new R(e.get(0,0),e.get(1,0),e.get(2,0)),n=new R(e.get(0,1),e.get(1,1),e.get(2,1)),i=new R(e.get(0,2),e.get(1,2),e.get(2,2));return Tt(t)+Tt(n)+Tt(i)}function Tt(e){let t=new R(Math.abs(e.getX()),Math.abs(e.getY()),Math.abs(e.getZ())),n="";const i=e.getX()<0?"R":"L",o=e.getY()<0?"A":"P",r=e.getZ()<0?"I":"S",a=1e-4;for(let e=0;e<3;e++)if(t.getX()>a&&t.getX()>t.getY()&&t.getX()>t.getZ())n+=i,t=new R(0,t.getY(),t.getZ());else if(t.getY()>a&&t.getY()>t.getX()&&t.getY()>t.getZ())n+=o,t=new R(t.getX(),0,t.getZ());else{if(!(t.getZ()>a&&t.getZ()>t.getX()&&t.getZ()>t.getY()))break;n+=r,t=new R(t.getX(),t.getY(),0)}return n}function Lt(e){let t;const n=wt(e);return void 0!==n&&(t=function(e){let t;return["LPS","LAI","RPI","RAS","ALS","ARI","PLI","PRS"].includes(e)?t=yt.Axial:["LSA","LIP","RSP","RIA","ILA","IRP","SLP","SRA"].includes(e)?t=yt.Coronal:["PSL","PIR","ASR","AIL","IAR","IPL","SAL","SPR"].includes(e)&&(t=yt.Sagittal),t}(It(n.asOneAndZeros()))),t}function wt(e){let t;if(void 0!==e&&6===e.length){const n=new R(e[0],e[1],e[2]),i=new R(e[3],e[4],e[5]),o=n.crossProduct(i);t=new Q([n.getX(),i.getX(),o.getX(),n.getY(),i.getY(),o.getY(),n.getZ(),i.getZ(),o.getZ()])}return t}function Pt(e,t){let n=V();return void 0!==t&&(n=e.asOneAndZeros().getInverse().multiply(t)),n.getAbs()}const At={TransferSyntax:"00020010",SOPClassUID:"00080016",Modality:"00080060",ReferencedSeriesSequence:"00081115",SeriesInstanceUID:"0020000E",Rows:"00280010",Columns:"00280011",PixelSpacing:"00280030",ImagerPixelSpacing:"00181164",NominalScannedPixelSpacing:"00182010",DistanceSourceToDetector:"00181110",DistanceSourceToPatient:"00181111",EstimatedRadiographicMagnificationFactor:"00181114",PixelAspectRatio:"00280034",SpacingBetweenSlices:"00180088",RescaleType:"00281054",Units:"00541001",ImageOrientationPatient:"00200037",PhotometricInterpretation:"00280004",SamplesPerPixel:"00280002",PixelMeasuresSequence:"00289110",SharedFunctionalGroupsSequence:"52009229",PerFrameFunctionalGroupsSequence:"52009230"};function Ot(e){let t;const n=Ne(e,At.Rows),i=Ne(e,At.Columns);return void 0!==n&&void 0!==i&&(t=[i,n]),t}function bt(e,t){let n;const i=Be(e,t);return void 0!==i&&2===i.length&&(n=[parseFloat(i[1]),parseFloat(i[0])]),n}function xt(e){let t;const n=Be(e,At.PixelMeasuresSequence);return void 0!==n&&(t=bt(n[0],At.PixelSpacing)),t}function Rt(e){const t=bt(e,At.PixelSpacing);if(void 0===t)return;const n=Ne(e,At.SpacingBetweenSlices);return void 0!==n&&t.push(parseFloat(n)),new ct(t)}function Et(e){const t=Ne(e,At.PhotometricInterpretation),n=Ne(e,At.TransferSyntax);if(void 0!==t&&void 0!==n){let i=t.toUpperCase();(tt(n)||$e(n)||et(n))&&!Ft(i)&&(i="RGB");let o=Ne(e,At.SamplesPerPixel);return void 0===o&&(o=1),"RGB"===i&&1===o&&(i="PALETTE COLOR"),i}}function Ft(e){return void 0!==e&&null!==e.match(/MONOCHROME/)}function qt(e){let t;const n=Be(e,At.ReferencedSeriesSequence);return void 0!==n&&(t=Ne(n[0],At.SeriesInstanceUID)),t}const Mt={GE:"ge",SIEMENS:"siemens",PHILIPS:"philips",HITASHI:"hitashi"};function Ut(e){return Ne(e,"00080070")}function Qt(e){let t;const n=Ut(e);return void 0!==n&&(t=n.toUpperCase().startsWith("SIEMENS")?Mt.SIEMENS:n.startsWith("GE")?Mt.GE:n.startsWith("Philips")?Mt.PHILIPS:n.toLowerCase()),t}const Vt="00080016",Nt="52009230",Bt="00189087",kt=[{manufacturer:Mt.SIEMENS,key:"0019100C"},{manufacturer:Mt.GE,key:"00431039"},{manufacturer:Mt.HITASHI,key:"00291030"}],Gt="1.2.840.10008.5.1.4.1.1.4",Ht="1.2.840.10008.5.1.4.1.1.4.1",zt="1.2.840.10008.5.1.4.1.1.4.2",Yt="1.2.840.10008.5.1.4.1.1.4.3";function Xt(e){let t;const n=Be(e,"00189117");return void 0!==n&&(t=Ne(n[0],Bt)),t}function Wt(e){let t;const n=Be(e,"52009229");if(void 0!==n&&(t=Xt(n[0])),void 0===t){const n=Be(e,Nt);if(void 0!==n)for(const e of n)if(t=Xt(e),void 0!==t)break}return t}function jt(e){let t;const n=Ne(e,Vt);return n===Ht||n===zt||n===Yt?(t=Wt(e),void 0===t&&(t=function(e){let t;const n=Qt(e);return void 0!==n&&n===Mt.PHILIPS&&(t=function(e){let t,n=!1;const i=Be(e,"00209222");if(void 0!==i)for(const e of i){const t=Ne(e,"00209165");if(void 0!==t&&"(0018,9087)"===t){n=!0;break}}if(n){const n=Be(e,Nt);if(void 0!==n){const e=Be(n[0],"00209111");if(void 0!==e){const n=Be(e[0],"00209157");void 0!==n&&(t=n[2])}}}return t}(e)),t}(e),void 0!==t&&console.log("got b-value for enhanced MR from non standard tag"))):n===Gt&&(t=function(e){let t;if(void 0===t){const n=Qt(e),i=Ne(e,"00080018");let o;o=void 0!==O.privateBValueRules?O.privateBValueRules:kt;for(const r of o)if((void 0!==r.uidPrefix&&void 0!==i&&i.startsWith(r.uidPrefix)||void 0!==r.manufacturer&&void 0!==n&&r.manufacturer===n)&&(t=Ne(e,r.key)),void 0!==t&&!isNaN(parseInt(t,10)))break}return void 0===t&&(t=Ne(e,Bt)),t}(e),void 0===t&&void 0===t&&(t=Wt(e))),void 0!==t&&(t=parseInt(t,10)),t}function Zt(e){let t;if(void 0!==O.getVolumeIdTagValue)t=O.getVolumeIdTagValue(e);else{const n=function(e){let t;const n=Ne(e,Vt);if(n===Gt||n===Ht||n===zt||n===Yt){const n=jt(e);void 0!==n&&(t=n)}return t}(e);void 0!==n&&(t=n)}return t}function _t(e){let t;if(void 0!==O.getPostLoadVolumeIdTagValue)t=O.getPostLoadVolumeIdTagValue(e);else{const n=Ne(e,"00080032");void 0!==n&&(t=parseFloat(n))}return t}function Kt(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0];let n=4,i=6;return 10===t.length&&(n=5,i=8),{year:parseInt(t.substring(0,4),10),monthIndex:t.length>=n+2?parseInt(t.substring(n,n+2),10)-1:0,day:t.length===i+2?parseInt(t.substring(i,i+2),10):0}}function Jt(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0],n=parseInt(t.substring(0,2),10),i=t.length>=4?parseInt(t.substring(2,4),10):0,o=t.length>=6?parseInt(t.substring(4,6),10):0,r=t.length>=8?t.substring(7,10):0;return{hours:n,minutes:i,seconds:o,milliseconds:0===r?0:parseInt(r,10)*Math.pow(10,3-r.length)}}function $t(e,t){let n;if(void 0!==e){let i=0,o=0,r=0,a=0;void 0!==t&&(void 0!==t.hours&&(i=t.hours),void 0!==t.minutes&&(o=t.minutes),void 0!==t.seconds&&(r=t.seconds),void 0!==t.milliseconds&&(a=t.milliseconds)),n=new Date(e.year,e.monthIndex,e.day,i,o,r,a)}return n}function en(e){let t;return void 0!==e&&(t={year:e.getFullYear(),monthIndex:e.getMonth(),day:e.getDate()}),t}function tn(e){let t;return void 0!==e&&(t={hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}),t}function nn(e){let t;return void 0!==e&&(t=e.year.toString()+(e.monthIndex+1).toString().padStart(2,"0")+e.day.toString().padStart(2,"0")),t}function on(e){let t;return void 0!==e&&(t=e.hours.toString().padStart(2,"0")+e.minutes.toString().padStart(2,"0")+e.seconds.toString().padStart(2,"0")),t}const rn="00080016",an="00080060",sn="00280002",ln="00280100",cn={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyTime:"00080030",StudyInstanceUID:"0020000D",StudyID:"00200010",StudyDescription:"00081030",ReferringPhysicianName:"00080090",SeriesDate:"00080021",SeriesTime:"00080031",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052",Manufacturer:"00080070",ManufacturerModelName:"00081090",DeviceSerialNumber:"00181000",SoftwareVersions:"00181020",LossyImageCompression:"00282110"};class un{#Te;#Le;getWarning(){return this.#Te}checkElements(e){if(this.#Te=void 0,void 0===Ot(e))throw new Error("No image rows or columns in DICOM file");if(!Fe(e))throw new Error("No pixel data in DICOM file");const t=Ne(e,an);if(void 0!==t&&"PT"===t){const t=Et(e);if(void 0!==(n=Ne(e,rn))&&/^1\.2\.840\.10008\.5\.1\.4\.1\.1\.7/.test(n)||!Ft(t))return this.#Te;const i=function(e){let t="";const n={};let i;t+=ke(e["00280051"],"Corrected Image (00280051)",["ATTN","DECY"]),t+=ke(e["00541102"],"Decay Correction (00541102)",["START"]),t+=ke(e["00541001"],"Units (00541001)",["BQML"]);const o=e["00101030"],r=ke(o," PatientWeight (00101030)");if(0===r.length){const e=parseFloat(o.value[0]);isNaN(e)?t+=" PatientWeight is not a number":i=e}else t+=r;const a=function(e){let t,n="";const i=Kt(e["00080021"]);let o,r,a;const s=e["00540016"];if(n+=ke(s,"RadiopharmaceuticalInformationSequence (00540016)"),void 0!==s){1!==s.value.length&&h.warn("Found more than 1 istopes in RadiopharmaceuticalInformation Sequence.");const e="RadionuclideTotalDose (00181074)",l=s.value[0]["00181074"];if(t=ke(l,e),0===t.length){const e=parseFloat(l.value[0]);isNaN(e)?n+=" TotalDose is not a number":o=e}else n+=t;const c="RadionuclideHalfLife (00181075)",u=s.value[0]["00181075"];if(t=ke(u,c),0===t.length){const e=parseFloat(u.value[0]);isNaN(e)?n+=" HalfLife is not a number":r=e}else n+=t;const d=s.value[0]["00181078"];let g,S;if(void 0===d)g=i,S=Jt(s.value[0]["00181072"]);else{const e=function(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0].split("&")[0],n=new Qe("DA");n.value=[t.substring(0,8)];const i=Kt(n),o=new Qe("TM");return o.value=[t.substring(8)],{date:i,time:t.length>=9?Jt(o):void 0}}(d);g=e.date,S=e.time}a=$t(g,S)}let l=$t(i,Jt(e["00080031"]));const c=e["00080022"],u=e["00080032"];if(void 0!==c&&void 0!==u){const t=Kt(c),i=Jt(u),o=$t(t,i);if(l>o){const a="Series date/time is after Aquisition date/time (diff="+(l.getTime()-o.getTime()).toString()+"ms) ";h.debug(a);let s=0;const c="FrameReferenceTime (00541300)",u=e["00541300"];n+=ke(u,c),void 0!==u&&(s=u.value[0]);let d=0;const g="ActualFrameDuration (00181242)",S=e["00181242"];if(n+=ke(S,g),void 0!==S&&(d=S.value[0]),s>0&&d>0){d/=1e3,s/=1e3;const e=Math.log(2)/r,n=e*d,o=1/e*Math.log(n/(1-Math.exp(-n)))-s;l=new Date(t.year,t.monthIndex,t.day,i.hours,i.minutes,i.seconds+o,i.milliseconds)}}}let d;if(void 0!==l&&void 0!==a&&void 0!==o&&void 0!==r){const e=(l.getTime()-a.getTime())/1e3;d=o*Math.pow(2,-e/r)}return{value:d,warning:n}}(e);return t+=a.warning,0!==t.length?n.warning="Cannot calculate PET SUV:"+t:n.value=1e3*i/a.value,n}(e);this.#Le=i.value,this.#Te=i.warning}var n;return this.#Te}create(e,t,n){const i=function(t){return Ne(e,t)},o=Ot(e),r=[o[0],o[1],1],a=i("00280008");if(void 0!==a){const e=parseInt(a,10);e>1&&r.push(e)}const s=new lt(r);let l=[1,1,1];const c=function(e){let t=bt(e,At.PixelSpacing);return void 0===t&&(t=function(e){let t=bt(e,At.ImagerPixelSpacing);if(void 0!==t){let n;const i=parseFloat(Ne(e,At.EstimatedRadiographicMagnificationFactor));if(isNaN(i)){const t=parseFloat(Ne(e,At.DistanceSourceToDetector)),i=parseFloat(Ne(e,At.DistanceSourceToPatient));isNaN(t)||isNaN(i)||0===i||(n=t/i)}else n=i;void 0!==n?(t=t.map((e=>e/n)),h.warn("Got pixel spacing from corrected ImagerPixelSpacing tag")):h.warn("Got pixel spacing from raw ImagerPixelSpacing tag")}return t}(e)),void 0===t&&(t=function(e){const t=bt(e,At.NominalScannedPixelSpacing);return void 0!==t&&h.warn("Got pixel spacing from NominalScannedPixelSpacing tag"),t}(e)),void 0===t&&(t=function(e){let t;const n=Be(e,At.SharedFunctionalGroupsSequence);if(void 0!==n&&(t=xt(n[0])),void 0===t){const n=Be(e,At.PerFrameFunctionalGroupsSequence);void 0!==n&&(t=xt(n[0]))}return t}(e)),t}(e);if(void 0!==c)l=[c[0],c[1],1];else{const t=bt(e,At.PixelAspectRatio);void 0!==t&&(l=[t[0],t[1],1],h.warn("Use pixel aspect ratio as spacing"))}const d=new ct(l),g=Be(e,"00200032");let S=new Array(0,0,0);void 0!==g&&(S=[parseFloat(g[0]),parseFloat(g[1]),parseFloat(g[2])]);const p=function(e){const t=Be(e,At.ImageOrientationPatient);let n;return void 0!==t&&(n=wt(t.map((e=>parseFloat(e))))),n}(e),m=new F(S[0],S[1],S[2]),v=Zt(e),D=new mt([m],s,d,p,v),y=i("00080018");let C=i(sn);void 0===C&&(C=1);const I=s.getTotalSize()*C;if(I!==t.length){if(h.warn("Badly sized pixel buffer: "+t.length+" != "+I),!(I<t.length))throw new Error("Underestimated buffer size, can't fix it...");t=t.slice(0,s.getTotalSize())}const T=new _i(D,t,[y]),L=Et(e);void 0!==L&&T.setPhotometricInterpretation(L);const w=i("00280006");void 0!==w&&T.setPlanarConfiguration(w);let P=1;const A=i("00281053");if(void 0!==A){const e=parseFloat(A);isNaN(e)||(P=e)}let b=0;const x=i("00281052");if(void 0!==x){const e=parseFloat(x);isNaN(e)||(b=e)}let R=!1,E=1;void 0!==this.#Le&&(R=!0,E=this.#Le,h.info("Applying PET SUV calibration: "+E),P*=E,b*=E);const q=new Y(P,b);if(T.setRescaleSlopeAndIntercept(q),"PALETTE COLOR"===T.getPhotometricInterpretation()){const t=function(e){let t;const n=Be(e,"00281101");if(void 0!==n&&3===n.length){let i,o,r;const a=e["00281201"],s=e["00281202"],l=e["00281203"];if(16===n[2]){let t=!1,c=n[0];0===c&&(c=65536);const u=a.vl;if(u!==2*c&&(t=!0,h.info("16bits lut but size is not double. desc: "+c+" vl: "+u)),8===parseInt(Ne(e,ln),10)&&(t=!0,h.info("Scaling 16bits color lut since bits allocated is 8.")),t){const e=function(e){return e>>8};i=a.value.map(e),o=s.value.map(e),r=l.value.map(e)}}else if(8===n[2]){h.info("Scaling 16bits color lut since the lut descriptor is 8.");let e=a.value.slice(0);i=Array.from(new Uint8Array(e.buffer)),e=s.value.slice(0),o=Array.from(new Uint8Array(e.buffer)),e=l.value.slice(0),r=Array.from(new Uint8Array(e.buffer))}t=new u(i,o,r)}return t}(e);void 0!==t&&T.setPaletteColourMap(t)}const M={numberOfFiles:n};M.TransferSyntaxUID=i("00020010"),M.MediaStorageSOPClassUID=i("00020002"),M.SOPClassUID=i(rn),M.Modality=i(an),M.ImageType=i("00080008"),M.SamplesPerPixel=i(sn),M.PhotometricInterpretation=i("00280004"),M.PixelRepresentation=i("00280103"),M.BitsAllocated=i(ln),M.BitsStored=i("00280101"),M.HighBit=i("00280102");const U=Object.keys(cn);for(const e of U)M[e]=i(cn[e]);if(R)M.pixelUnit="SUV";else{const t=(Q=e,void 0!==O.getTagPixelUnit?O.getTagPixelUnit(Q):function(e){let t;const n=["RescaleType","Units"];for(const i of n)if(t=Ne(e,At[i]),void 0!==t)break;if(void 0===t){const n=Ne(e,At.Modality);void 0!==n&&"CT"===n&&(t="HU")}return t}(Q));void 0!==t&&(M.pixelUnit=t)}var Q;M.lengthUnit=void 0===c?"unit.pixel":"unit.mm";const V=function(e,t){let n;const i=Be(e,"00281050"),o=Be(e,"00281051");if(void 0!==i&&void 0!==o){n={};const r=Be(e,"00281055");let a;for(let e=0;e<i.length;++e){const s=parseFloat(i[e]);let l=parseFloat(o[e]);s&&l&&0!==l&&(a="",void 0!==r&&(a=r[e]),""===a&&(a="Default"+e),l*=t,l<1&&(l=1),n[a]={wl:[new f(s*t,l)],name:a}),0===l&&h.warn("Zero window width found in DICOM.")}}return n}(e,E);return void 0!==V&&(M.windowPresets=V),M.VOILUTFunction=i("00281056"),T.setMeta(M),T}}class dn{#te=!0;#oe;constructor(e,t){void 0!==t&&(this.#te=t),this.#oe=new DataView(e)}writeUint8(e,t){return this.#oe.setUint8(e,t),e+Uint8Array.BYTES_PER_ELEMENT}writeInt8(e,t){return this.#oe.setInt8(e,t),e+Int8Array.BYTES_PER_ELEMENT}writeUint16(e,t){return this.#oe.setUint16(e,t,this.#te),e+Uint16Array.BYTES_PER_ELEMENT}writeInt16(e,t){return this.#oe.setInt16(e,t,this.#te),e+Int16Array.BYTES_PER_ELEMENT}writeUint32(e,t){return this.#oe.setUint32(e,t,this.#te),e+Uint32Array.BYTES_PER_ELEMENT}writeUint64(e,t){return this.#oe.setBigUint64(e,t,this.#te),e+BigUint64Array.BYTES_PER_ELEMENT}writeInt32(e,t){return this.#oe.setInt32(e,t,this.#te),e+Int32Array.BYTES_PER_ELEMENT}writeInt64(e,t){return this.#oe.setBigInt64(e,t,this.#te),e+BigInt64Array.BYTES_PER_ELEMENT}writeFloat32(e,t){return this.#oe.setFloat32(e,t,this.#te),e+Float32Array.BYTES_PER_ELEMENT}writeFloat64(e,t){return this.#oe.setFloat64(e,t,this.#te),e+Float64Array.BYTES_PER_ELEMENT}writeHex(e,t){const n=parseInt(t,16);return this.#oe.setUint16(e,n,this.#te),e+Uint16Array.BYTES_PER_ELEMENT}writeBinaryArray(e,t){if(t.length%8!=0)throw new Error("Cannot write boolean array as binary.");let n,i;for(let o=0,r=t.length;o<r;o+=8){n=0;for(let e=0;e<8;++e)i=0===t[o+e]?0:1,n+=i<<e;e=this.writeUint8(e,n)}return e}writeUint8Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint8(e,t[n]);return e}writeInt8Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt8(e,t[n]);return e}writeUint16Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint16(e,t[n]);return e}writeInt16Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt16(e,t[n]);return e}writeUint32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint32(e,t[n]);return e}writeUint64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint64(e,t[n]);return e}writeInt32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt32(e,t[n]);return e}writeInt64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt64(e,t[n]);return e}writeFloat32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeFloat32(e,t[n]);return e}writeFloat64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeFloat64(e,t[n]);return e}}let hn=0;class gn{action;value;constructor(e){this.action=e}}const Sn={copy:function(e){return e},remove:function(){return null},clear:function(e){return e.value=[],e},replace:function(e,t){return e.value=[t],e}};function pn(e){const t="."+(new Date).toISOString().replace(/\D/g,"").substring(0,14);hn+=1;const n="."+hn;let i="1.2.826.0.1.3680043.9.7278.1.";const o=29+n.length+t.length,r=Math.min(e.length,64-o);if(r>1){let t="";for(let n=0;n<r;++n)t+=e.charCodeAt(n);i+=t.substring(0,r)}return i+=t+n,i}function mn(e){return e%2==0}function fn(e){const t=ve[e];return void 0!==t&&"string"===t}function vn(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}class Dn{encode(e){const t=new Uint8Array(e.length);for(let n=0,i=e.length;n<i;++n)t[n]=e.charCodeAt(n);return t}}const yn="00080005",Cn="00280100";class In{#we=!1;#Pe=!0;#Ae={default:{action:"copy",value:null}};#Oe=this.#Ae;#be=[];#xe=new Dn;#Re=this.#xe;setUseUnVrForPrivateSq(e){this.#we=e}setFixUnknownVR(e){this.#Pe=e}setRules(e,t){if(this.#Oe=e,this.#be=[],t){const t=Object.keys(e);for(const n of t){const t=e[n];if("replace"===t.action&&void 0!==t.value&&null!==t.value){let e,t=!1;if(8===n.length&&(t=void 0!==we(n).getNameFromDictionary()),t)e=n;else{const t=qe(n);void 0!==t&&(e=t.getKey())}void 0!==e&&this.#be.push(e)}}}}#Ee(e){return this.#xe.encode(e)}#Fe(e){return this.#Re.encode(e)}useSpecialTextEncoder(){this.#Re=new TextEncoder}getElementToWrite(e){const t=e.tag.getGroupName(),n=e.tag.getNameFromDictionary();let i;return i=void 0!==this.#Oe[e.tag.getKey()]?this.#Oe[e.tag.getKey()]:void 0!==n&&void 0!==this.#Oe[n]?this.#Oe[n]:void 0!==this.#Oe[t]?this.#Oe[t]:this.#Oe.default,Sn[i.action](e,i.value)}#qe(e,t,n,i,o){const r=function(e){return Ae(e.tag)&&"NONE"===e.vr};for(const a of n){if(0===a.length)continue;let n=!1;const s=a.find((e=>r(e)));void 0!==s&&void 0!==s.undefinedLength&&(n=s.undefinedLength);const l=new Qe("NONE");l.vl=n?4294967295:s.vl,l.tag=Pe(),l.value=[],t=this.#Me(e,l,t,i);for(const n of a)r(n)||Oe(n.tag)||(t=this.#Me(e,n,t,i,o));if(n){const n=new Qe("NONE");n.vl=0,n.tag=new Te("FFFE","E00D"),n.value=[],t=this.#Me(e,n,t,i)}}return t}#Ue(e,t,n,i,o,r){const a=n;if("NONE"===t.vr);else if(i instanceof Uint8Array)if(void 0!==r&&1===r){if(i.length%8!=0){h.debug("Padding binary pixel data");const e=8*Math.ceil(i.length/8),t=new Array(e-i.length);t.fill(0),i=vn(i,t)}n=e.writeBinaryArray(n,i)}else n=e.writeUint8Array(n,i);else if(i instanceof Int8Array)n=e.writeInt8Array(n,i);else if(i instanceof Uint16Array)n=e.writeUint16Array(n,i);else if(i instanceof Int16Array)n=e.writeInt16Array(n,i);else if(i instanceof Uint32Array)n=e.writeUint32Array(n,i);else if(i instanceof Int32Array)n=e.writeInt32Array(n,i);else if(i instanceof BigUint64Array)n=e.writeUint64Array(n,i);else if(i instanceof BigInt64Array)n=e.writeInt64Array(n,i);else{const r=ve[t.vr];if(void 0!==r)if("Uint8"===r)n=e.writeUint8Array(n,i);else if("Uint16"===r)n=e.writeUint16Array(n,i);else if("Int16"===r)n=e.writeInt16Array(n,i);else if("Uint32"===r)n=e.writeUint32Array(n,i);else if("Int32"===r)n=e.writeInt32Array(n,i);else if("Uint64"===r)n=e.writeUint64Array(n,i);else if("Int64"===r)n=e.writeInt64Array(n,i);else if("Float32"===r)n=e.writeFloat32Array(n,i);else if("Float64"===r)n=e.writeFloat64Array(n,i);else{if("string"!==r)throw new Error("Unknown VR type: "+r);n=e.writeUint8Array(n,i)}else if("SQ"===t.vr)n=this.#qe(e,n,i,o);else if("AT"===t.vr)for(const t of i){const i=t+"",o=i.substring(1,5),r=i.substring(6,10),a=[parseInt(o,16),parseInt(r,16)];n=e.writeUint16Array(n,a)}else"xs"===t.vr?n=i instanceof Int16Array?e.writeInt16Array(n,i):e.writeUint16Array(n,i):h.warn("Unknown VR: "+t.vr)}if("SQ"!==t.vr&&"NONE"!==t.vr){const e=n-a;if(e!==t.vl){let n="Offset difference and VL are not equal: "+e+" != "+t.vl;n+=" (",void 0!==t.tag&&(n+=t.tag+", "),n+="vr:"+t.vr+")",h.warn(n)}}return n}#Qe(e,t,n,i,o,r){let a=!1;if(void 0!==t.undefinedLength&&(a=t.undefinedLength),a){const a=[];a.push({tag:Pe(),vr:"NONE",vl:0,value:[]});for(const e of i)a.push({tag:Pe(),vr:t.vr,vl:e.length,value:e});n=this.#qe(e,n,[a],o,r)}else{let a=i[0];i.length>1&&(a=function(e){if(void 0===e[0].length)return e;let t=0;for(const n of e)t+=n.length;const n=new e[0].constructor(t);let i=0;for(const t of e)n.set(t,i),i+=t.length;return n}(i)),n=this.#Ue(e,t,n,a,o,r)}return n}#Me(e,t,n,i,o){const r=t.tag.isWithVR(),a=!(!i&&r)||pe(t.vr);n=e.writeHex(n,t.tag.getGroup()),n=e.writeHex(n,t.tag.getElement());let s=t.vr;this.#we&&t.tag.isPrivate()&&"SQ"===s&&(h.warn("Write element using VR=UN for private sequence."),s="UN"),r&&!i&&(n=e.writeUint8Array(n,this.#Ee(s)),a&&(n+=2));let l=!1;("SQ"===t.vr||Re(t.tag))&&void 0!==t.undefinedLength&&(l=t.undefinedLength);let c=!1;Ae(t.tag)&&void 0!==t.undefinedLength&&(c=t.undefinedLength);let u=t.vl;(l||c)&&(u=4294967295),n=a?e.writeUint32(n,u):e.writeUint16(n,u);let d=t.value;if(void 0===d&&(d=[]),n=Re(t.tag)?this.#Qe(e,t,n,d,i,o):this.#Ue(e,t,n,d,i),l){const t=new Qe("NONE");t.vl=0,t.tag=new Te("FFFE","E0DD"),t.value=[],n=this.#Me(e,t,n,i)}return n}getBuffer(e){const t=e["00020010"].value[0],n=Ke(t),i=Je(t);if(void 0!==e[yn]){const t=e[yn].value[0];void 0!==t&&"ISO-IR 6"!==t&&(h.debug("Change charset to UTF, was: "+t),this.useSpecialTextEncoder(),e[yn].value=["ISO_IR 192"])}let o;void 0!==e[Cn]&&(o=e[Cn].value[0]);let r,a=132;const s=[],l=[];let c,u,d=0;const g=new Te("0002","0000"),S=new Te("0002","0001"),p=new Te("0002","0012"),m=new Te("0002","0013"),f=this.#be.slice(),v=Object.keys(e);for(const t of v){const h=e[t];if(h.tag=we(t),c=this.getElementToWrite(h),!(null===c||g.equals(c.tag)||S.equals(c.tag)||p.equals(c.tag)||m.equals(c.tag))){r=0;const e=f.indexOf(c.tag.getKey());-1!==e&&f.splice(e,1),this.#Pe&&Tn(c,!i),this.#Ve(c,c.value,n,o),u=c.tag.getGroupName(),r+=ot(c.vr,"Meta Element"!==u&&n),r+=c.vl,"Meta Element"===u?(s.push(c),d+=r):l.push(c),a+=r}}for(const e of f){const t=we(e),i=new Qe(t.getVrFromDictionary());let o;if(i.tag=t,void 0!==this.#Oe[e])o=this.#Oe[e].value;else{const e=t.getNameFromDictionary();o=this.#Oe[e].value}let r=ot(i.vr,n);r+=this.#Ve(i,[o],n),l.push(i),a+=r}const D=Ln("FileMetaInformationVersion");let y=ot(D.vr,!1);y+=this.#Ve(D,[0,1],!1),s.push(D),d+=y,a+=y;const C=Ln("ImplementationClassUID");let I=ot(C.vr,!1);const T="1.2.826.0.1.3680043.9.7278.1."+"0.37.0-beta.2".replace("-beta",".99");I+=this.#Ve(C,[T],!1),s.push(C),d+=I,a+=I;const L=Ln("ImplementationVersionName");let w=ot(L.vr,!1);w+=this.#Ve(L,["DWV_0.37.0-beta.2"],!1),s.push(L),d+=w,a+=w;const P=function(e,t){return Le(e.tag,t.tag)};s.sort(P),l.sort(P);const A=Ln("FileMetaInformationGroupLength");let O=ot(A.vr,!1);O+=this.#Ve(A,new Uint32Array([d]),!1),a+=O;const b=new ArrayBuffer(a),x=new dn(b),R=new dn(b,!i);let E=128;E=x.writeUint8Array(E,this.#Ee("DICM")),E=this.#Me(x,A,E,!1);for(const e of s)E=this.#Me(x,e,E,!1);const F=132+O+d;E!==F&&h.warn("Bad size calculation... meta offset: "+E+", calculated size:"+F+" (diff:"+(E-F)+")");for(const e of l)E=this.#Me(R,e,E,n,o);return E!==a&&h.warn("Bad size calculation... final offset: "+E+", calculated size:"+a+" (diff:"+(E-a)+")"),b}#Ve(e,t,n,i){let o=0;if("SQ"===e.vr){if(null!==t&&0!==t){const r=[];let a=!1;void 0!==e.undefinedLength&&(a=e.undefinedLength,delete e.undefinedLength);for(const e of t){const t=e,s=[];let l=0;if(null===t||0===t)continue;let c=i;const u=t[Cn];void 0!==u&&void 0!==u.value&&(c=u.value[0]);const d=Object.keys(t);for(const e of d){const i=t[e];i.tag=we(e),Ae(i.tag)||(l+=this.#Ve(i,i.value,n,c),s.push(i),l+=ot(i.vr,n))}const h={tag:Pe(),vr:"NONE",vl:l,value:[]};a&&(h.undefinedLength=a),s.push(h),l+=ot(h.vr,n),a&&(l+=ot("NONE",n));const g=function(e,t){return Le(e.tag,t.tag)};s.sort(g),o+=l,r.push(s)}a&&(o+=ot("NONE",n)),e.value=r,e.vl=o,a&&(e.undefinedLength=a)}}else{if(fn(r=e.vr)||"OB"===r){const n=function(e){let t="";return fn(e)&&(t="UI"===e?"\0":" "),t}(e.vr);if(fn(e.vr)){let i;fe(e.vr)?(t=this.#Fe(t.join("\\")),i=this.#Fe(n)):(t=this.#Ee(t.join("\\")),i=this.#Ee(n)),mn(t.length)||(t=vn(t,i))}else"OB"===e.vr&&(t=function(e){if(null==e||void 0===e.length)throw new Error("Cannot pad undefined or null OB value.");if(0!==e.length&&void 0!==e[0].length){let t=0;for(const n of e)t+=n.length;mn(t)||(e[e.length-1]=vn(e[e.length-1],[0]))}else mn(e.length)||(e=vn(e,[0]));return e}(t))}if("AT"===e.vr)o=4*t.length;else if("xs"===e.vr)o=t.length*Uint16Array.BYTES_PER_ELEMENT;else if(function(e){const t=ve[e];return void 0!==t&&"string"!==t}(e.vr)||"ox"===e.vr){if(Re(e.tag)&&Array.isArray(t)){o=0;for(const e of t)o+=e.length}else o=t.length;const r=ve[e.vr];if(Re(e.tag)||"ox"===e.vr)if(e.undefinedLength){const e=ot("NONE",n);o+=e,o+=e*t.length,o+=e}else void 0!==i&&(1===i?o=Math.ceil(o/8):16===i&&(o*=Uint16Array.BYTES_PER_ELEMENT));else{if(void 0===r)throw new Error("Unsupported element: "+e.vr);{const e=function(e){let t;return"Uint8"===e?t=Uint8Array.BYTES_PER_ELEMENT:"Uint16"===e?t=Uint16Array.BYTES_PER_ELEMENT:"Int16"===e?t=Int16Array.BYTES_PER_ELEMENT:"Uint32"===e?t=Uint32Array.BYTES_PER_ELEMENT:"Int32"===e?t=Int32Array.BYTES_PER_ELEMENT:"Float32"===e?t=Float32Array.BYTES_PER_ELEMENT:"Float64"===e?t=Float64Array.BYTES_PER_ELEMENT:"Uint64"===e?t=BigUint64Array.BYTES_PER_ELEMENT:"Int64"===e&&(t=BigInt64Array.BYTES_PER_ELEMENT),t}(r);if(void 0===e)throw new Error("Unknown bytes per element for VR type: "+r);o*=e}}}else o=t.length;e.value=t,e.vl=o}var r;return o}}function Tn(e,t){if("UN"===e.vr){const n=e.tag.getVrFromDictionary();if(void 0!==n&&e.vr!==n){e.vr=n;const i=ve[e.vr];if(void 0!==i&&"Uint8"!==i&&"string"!==i){const n=function(e,t,n){let i;if(void 0===e.buffer)return i;const o=new He(e.buffer,n),r=e.byteOffset,a=e.length,s=ve[t];return"Uint16"===s?i=o.readUint16Array(r,a):"Uint32"===s?i=o.readUint32Array(r,a):"Uint64"===s?i=o.readUint64Array(r,a):"Int16"===s?i=Array.from(o.readInt16Array(r,a)):"Int32"===s?i=Array.from(o.readInt32Array(r,a)):"Int64"===s?i=o.readInt64Array(r,a):"Float32"===s?i=Array.from(o.readFloat32Array(r,a)):"Float64"===s&&(i=Array.from(o.readFloat64Array(r,a))),i}(e.value,e.vr,t);void 0!==n&&(e.value=n)}h.info("Element "+e.tag.getGroup()+" "+e.tag.getElement()+" VR changed from UN to "+e.vr)}}}function Ln(e){const t=qe(e),n=new Qe(t.getVrFromDictionary());return n.tag=t,n}function wn(e){const t=Object.keys(e),n={};for(const i of t){const t=qe(i);if(void 0===t)continue;const o=t.getVrFromDictionary();let r,a=!1;const s=e[i];if("SQ"===o){const e=[];if(void 0!==s.undefinedLength&&(a=s.undefinedLength),Array.isArray(s.value))for(const t of s.value)e.push(wn(t));else h.debug("Non array simpleTag SQ value");r=e}else r=Array.isArray(s)?s:[s];const l=new Qe(o);l.tag=t,l.value=r,a&&(l.undefinedLength=a),n[t.getKey()]=l}return n}const Pn="00080100",An="00080102",On="00080119",bn="00080120";class xn{meaning;value;longValue;urnValue;schemeDesignator;constructor(e){this.meaning=e}toString(){return"("+this.value+", "+this.schemeDesignator+", '"+this.meaning+"')"}}function Rn(e,t){return void 0!==e&&void 0!==t&&e.schemeDesignator===t.schemeDesignator&&e.value===t.value}function En(e){const t=new xn(e["00080104"].value[0]);if(void 0!==e[Pn])t.value=e[Pn].value[0];else if(void 0!==e[On])t.longValue=e[On].value[0];else{if(void 0===e[bn])throw new Error("Invalid code with no value, no long value and no urn value.");t.urnValue=e[bn].value[0]}if(void 0!==t.value||void 0!==t.longValue){if(void 0===e[An])throw new Error("No coding sheme designator when code value or long value is present");t.schemeDesignator=e[An].value[0]}return t}function Fn(e){const t={};return void 0!==e.value?t.CodeValue=e.value:void 0!==e.longValue?t.LongCodeValue=e.longValue:void 0!==e.urnValue&&(t.URNCodeValue=e.urnValue),void 0!==e.schemeDesignator&&(t.CodingSchemeDesignator=e.schemeDesignator),t.CodeMeaning=e.meaning,t}const qn={value:"111017",meaning:"CAD Processing and Findings Summary"},Mn={value:"111030",meaning:"Image Region"},Un={value:"111059",meaning:"Single Image Finding"},Qn={value:"111099",meaning:"Selected region"},Vn={value:"111242",meaning:"All algorithms succeeded; with findings"},Nn={value:"112000",meaning:"Chest CAD Report"},Bn={value:"112020",meaning:"Response Evaluation"},kn={value:"112021",meaning:"Response Evaluation Method"},Gn={value:"112022",meaning:"RECIST"},Hn={value:"112039",meaning:"Tracking Identifier"},zn={value:"112051",meaning:"Measurement of Response"},Yn={value:"112040",meaning:"Tracking Unique Identifier"},Xn={value:"112048",meaning:"Current Response"},Wn={value:"113076",meaning:"Segmentation"},jn={value:"121055",meaning:"Path"},Zn={value:"121106",meaning:"Comment"},_n={value:"121322",meaning:"Source image for image processing operation"},Kn={value:"121324",meaning:"Source Image"},Jn={value:"122438",meaning:"Reference Points"},$n={value:"125007",meaning:"Measurement Group"},ei={value:"125309",meaning:"Short Label"},ti={value:"126000",meaning:"Imaging Measurement Report"},ni={value:"126010",meaning:"Imaging Measurements"},ii={value:"128773",meaning:"Reference Geometry"},oi={1483009:"Angle",42798e3:"Area",103355008:"Width",103339001:"Long axis",103340004:"Short axis",131190003:"Radius",261665006:"Unknown",410668003:"Length",718499004:"Color"},ri={1:"No units",mm:"Millimeter",deg:"Degree - plane angle",cm2:"Square centimeter","cm2/ml":"Square centimeter per milliliter","/cm":"Per centimeter","g/ml":"Gram per milliliter","g/ml{SUVbw}":"Standardized Uptake Value body weight","mg/ml":"Milligram per milliliter","umol/ml":"Micromole per milliliter","Bq/ml":"Becquerels per milliliter","mg/min/ml":"Milligrams per minute per milliliter","umol/min/ml":"Micromole per minute per milliliter","ml/min/g":"Milliliter per minute per gram","ml/g":"Milliliter per gram","ml/min/ml":"Milliliter per minute per milliliter","ml/ml":"Milliliter per milliliter","%":"Percentage","[hnsf'U]":"Hounsfield unit","10*23/ml":"Electron density","{counts}":"Counts","{counts}/s":"Counts per second","{propcounts}":"Proportional to counts","{propcounts}/s":"Proportional to counts per second"};function ai(e){const t=new xn(e.meaning);return t.schemeDesignator="DCM",t.value=e.value,t}function si(e,t){let n,i;return"SCT"===t?n=oi[e]:"UCUM"===t&&(n=ri[e]),void 0!==n&&(i=new xn(n),i.schemeDesignator=t,i.value=e),i}function li(){return ai(Wn)}function ci(){return si("718499004","SCT")}const ui={angle:{key:"1483009",scheme:"SCT"},length:{key:"410668003",scheme:"SCT"},surface:{key:"42798000",scheme:"SCT"},height:{key:"121207",scheme:"DCM"},width:{key:"103355008",scheme:"SCT"},radius:{key:"131190003",scheme:"SCT"},a:{key:"103339001",scheme:"SCT"},b:{key:"103340004",scheme:"SCT"},min:{key:"113051",scheme:"DCM"},max:{key:"113048",scheme:"DCM"},mean:{key:"113049",scheme:"DCM"},stddev:{key:"113061",scheme:"DCM"}},di={"unit.mm":"mm","unit.cm2":"cm2","unit.degree":"deg",HU:"[hnsf'U]",MGML:"mg/ml",ED:"10*23/ml",PCT:"%",CNTS:"{counts}",NONE:"1",CM2:"cm2",CM2ML:"cm2/ml",PCNT:"%",CPS:"{counts}/s",BQML:"Bq/ml",MGMINML:"mg/min/ml",UMOLMINML:"umol/min/ml",MLMING:"ml/min/g",MLG:"ml/g","1CM":"/cm",UMOLML:"umol/ml",PROPCNTS:"{propcounts}",PROPCPS:"{propcounts}/s",MLMINML:"ml/min/ml",MLML:"ml/ml",GML:"g/ml",SUV:"g/ml{SUVbw}"};function hi(e){const t=di[e];let n;return void 0!==t?n=si(t,"UCUM"):void 0===t&&(n=si("1","UCUM")),n}const gi="00620005",Si="00620009",pi="0062000C",mi="0062000D",fi="00620003",vi="0062000F",Di="00620020";class yi{number;label;algorithmType;algorithmName;displayValue;displayRGBValue;propertyTypeCode;propertyCategoryCode;trackingUid;trackingId;constructor(e,t,n){this.number=e,this.label=t,this.algorithmType=n}}function Ci(e){const t=new yi(e["00620004"].value[0],e[gi]?e[gi].value[0]:"n/a",e["00620008"].value[0]);if(void 0!==e[Si]&&(t.algorithmName=e[Si].value[0]),void 0!==e[pi])t.displayValue=e[pi].value[0];else if(void 0!==e[mi]){const i=e[mi].value,o=function(e){return function(e){function t(e){let t;return t=e<=.0031308?12.92*e:1.055*Math.pow(e,.416666667)-.055,Math.min(1,Math.max(0,t))}const n=e.x/100,i=e.y/100,o=e.z/100;return{r:Math.round(255*t(3.2406*n-1.5372*i-.4986*o)),g:Math.round(255*t(-.9689*n+1.8758*i+.0415*o)),b:Math.round(255*t(.0557*n-.204*i+1.057*o))}}(function(e){function t(e){let t;return t=e>.206896552?Math.pow(e,3):.128418549*e-.017712903,t}const n=w,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.displayRGBValue=o}else h.warn("No recommended colour for segment, using default"),t.displayRGBValue=function(e){const t=[new y(0,0,0),new y(255,0,0),new y(0,255,0),new y(0,0,255),new y(255,255,0),new y(0,255,255),new y(255,0,255),new y(255,239,213),new y(0,0,205),new y(205,133,63),new y(210,180,140),new y(102,205,170),new y(0,0,128),new y(0,139,139),new y(46,139,87),new y(255,228,225)];let n;return n=e<t.length?t[e]:new y(255*Math.random(),255*Math.random(),255*Math.random()),n}(t.number);var n;if(void 0===e[fi])throw new Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=En(e[fi].value[0]),void 0===e[vi])throw new Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=En(e[vi].value[0]),void 0!==e[Di]&&(t.trackingId=e[Di].value[0],t.trackingUid=e["00620021"].value[0]),t}function Ii(e){let t=e.algorithmType;void 0===t&&(t="MANUAL");const n={SegmentNumber:e.number,SegmentLabel:e.label,SegmentAlgorithmType:t};if("MANUAL"!==t&&void 0!==e.algorithmName&&(n.SegmentAlgorithmName=e.algorithmName),e.displayRGBValue){const t=L(P(e.displayRGBValue));n.RecommendedDisplayCIELabValue=[Math.round(t.l),Math.round(t.a),Math.round(t.b)]}else n.RecommendedDisplayGrayscaleValue=e.displayValue;return e.propertyCategoryCode&&(n.SegmentedPropertyCategoryCodeSequence={value:[Fn(e.propertyCategoryCode)]}),e.propertyTypeCode&&(n.SegmentedPropertyTypeCodeSequence={value:[Fn(e.propertyTypeCode)]}),e.trackingId&&(n.TrackingID=e.trackingId,n.TrackingUID=e.trackingUid),n}const Ti="00089124",Li="00082112",wi="00081150",Pi="00081155",Ai="00209116",Oi="00289110";class bi{dimIndex;imagePosPat;derivationImages;refSegmentNumber;imageOrientationPatient;spacing;constructor(e,t,n,i){this.dimIndex=e,this.imagePosPat=t,this.derivationImages=n,this.refSegmentNumber=i}}function xi(e){const t=[];if(void 0!==e[Ti]){const n=e[Ti].value;for(let e=0;e<n.length;++e){const i=[];if(void 0!==n[e][Li]){const t=n[e][Li].value;for(let e=0;e<t.length;++e){const n={};void 0!==t[e][wi]&&(n.referencedSOPClassUID=t[e][wi].value[0]),void 0!==t[e][Pi]&&(n.referencedSOPInstanceUID=t[e][Pi].value[0]),i.push(n)}}t.push({sourceImages:i})}}const n=e["00209111"].value[0]["00209157"].value,i=e["0062000A"].value,o=parseInt(i[0]["0062000B"].value[0],0),r=e["00209113"].value[0]["00200032"].value;for(let e=0;e<r.length;++e)r[e]=parseFloat(r[e]);const a=new bi(n,r,t,o);if(void 0!==e[Ai]){const t=e[Ai];if(0!==t.value.length){const e=t.value[0]["00200037"].value;void 0!==e&&(a.imageOrientationPatient=e)}}if(void 0!==e[Oi]){const t=e[Oi];if(0!==t.value.length){const e=Rt(t.value[0]);void 0!==e&&(a.spacing=e)}else h.warn("No shared functional group pixel measure sequence items.")}return a}function Ri(e){const t={FrameContentSequence:{value:[{DimensionIndexValues:e.dimIndex}]},PlanePositionSequence:{value:[{ImagePositionPatient:e.imagePosPat}]},SegmentIdentificationSequence:{value:[{ReferencedSegmentNumber:e.refSegmentNumber}]}};if(void 0!==e.derivationImages){const n=Fn(ai(_n)),i=Fn(ai(Wn)),o=[];for(const t of e.derivationImages){const e=[];for(const i of t.sourceImages)e.push({PurposeOfReferenceCodeSequence:{value:[n]},ReferencedSOPClassUID:i.referencedSOPClassUID,ReferencedSOPInstanceUID:i.referencedSOPInstanceUID});o.push({DerivationCodeSequence:{value:[i]},SourceImageSequence:{value:e}})}t.DerivationImageSequence={value:o}}return t}const Ei="00209116",Fi="00289110",qi={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyTime:"00080030",StudyInstanceUID:"0020000D",StudyID:"00200010",ReferringPhysicianName:"00080090",SeriesDate:"00080021",SeriesTime:"00080031",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052",Manufacturer:"00080070",ManufacturerModelName:"00081090",DeviceSerialNumber:"00181000",SoftwareVersions:"00181020",LossyImageCompression:"00282110"};function Mi(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,o=!1;if(i=1===n.value.length?n.value[0]:n.value,Array.isArray(i))for(let e=0;e<t.enum.length;++e){if(!Array.isArray(t.enum[e]))throw new Error("Cannot compare array and non array tag value.");if(re(t.enum[e],i)){o=!0;break}}else o=t.enum.includes(i);if(!o)throw new Error("Unsupported "+t.name+" value: "+i)}function Ui(e,t,n){const i=e.getGeometry().getSize().getDimSize(2),o={};for(let r=0;r<i;++r){const a=n+r,s=e.getValueAtOffset(a);for(const e of t){const t=e.number-1;s===e.number&&(void 0===o[t]&&(o[t]=new Uint8Array(i)),o[t][r]=1)}}return o}const Qi=[{name:"TransferSyntaxUID",tag:"00020010",type:"1",enum:[ye,Ce,Ie]},{name:"MediaStorageSOPClassUID",tag:"00020002",type:"1",enum:["1.2.840.10008.5.1.4.1.1.66.4"]},{name:"SOPClassUID",tag:"00020002",type:"1",enum:["1.2.840.10008.5.1.4.1.1.66.4"]},{name:"Modality",tag:"00080060",type:"1",enum:["SEG"]},{name:"SegmentationType",tag:"00620001",type:"1",enum:["BINARY"]},{name:"DimensionOrganizationType",tag:"00209311",type:"3",enum:["3D"]},{name:"ImageType",tag:"00080008",type:"1",enum:[["DERIVED","PRIMARY"]]},{name:"SamplesPerPixel",tag:"00280002",type:"1",enum:[1]},{name:"PhotometricInterpretation",tag:"00280004",type:"1",enum:["MONOCHROME2"]},{name:"PixelRepresentation",tag:"00280103",type:"1",enum:[0]},{name:"BitsAllocated",tag:"00280100",type:"1",enum:[1]},{name:"BitsStored",tag:"00280101",type:"1",enum:[1]},{name:"HighBit",tag:"00280102",type:"1",enum:[0]}];function Vi(){const e={};for(const t of Qi)e[t.name]=t.enum[0];return e}class Ni{#Te;getWarning(){return this.#Te}checkElements(e){}create(e,t,n){const i=function(t){return Ne(e,t)},o=function(t){return Be(e,t)};for(const t of Qi)Mi(e,t);const r=Ot(e),a=new lt([r[0],r[1],1]),s=a.getTotalSize();let l=i("00280008");if(l=void 0!==l?parseInt(l,10):1,l!==t.length/s)throw new Error("Buffer and numberOfFrames meta are not equal "+l+" "+t.length/s);const c=function(e){const t=e["00209221"];if(void 0===t||1!==t.value.length)throw new Error("Unsupported dimension organization sequence length");const n=t.value[0]["00209164"].value[0],i=[],o=e["00209222"];if(void 0!==o){const e=o.value;if(2!==e.length)throw new Error("Unsupported dimension index sequence length");let t;for(let o=0;o<e.length;++o){const r=e[o]["00209164"].value[0];if(r!==n)throw new Error("Dimension Index Sequence contains a unknown Dimension Organization");t=e[o]["00209165"].value[0];const a={DimensionOrganizationUID:r,DimensionIndexPointer:t};void 0!==e[o]["00209421"]&&(a.DimensionDescriptionLabel=e[o]["00209421"].value[0]),i.push(a)}if("(0020,0032)"!==t)throw new Error("Unsupported non image position as last index")}return{organizations:{value:[{DimensionOrganizationUID:n}]},indices:{value:i}}}(e),d=o("00620002");if(void 0===d)throw new Error("Missing or empty segmentation sequence");const g=[],S=[0],p=[0],m=[0];for(let e=0;e<d.length;++e){const t=Ci(d[e]);void 0!==t.displayRGBValue&&(S[t.number]=t.displayRGBValue.r,p[t.number]=t.displayRGBValue.g,m[t.number]=t.displayRGBValue.b),g.push(t)}let f,v,D,y=!1;S.length>1&&(y=!0,f=new u(S,p,m));const C=o("52009229");if(void 0!==C){const e=C[0];if(void 0!==e[Ei]){const t=e[Ei];0!==t.value.length?D=t.value[0]["00200037"].value:h.warn("No shared functional group plane orientation sequence items.")}if(void 0!==e[Fi]){const t=e[Fi];0!==t.value.length?v=Rt(t.value[0]):h.warn("No shared functional group pixel measure sequence items.")}}const I=function(e,t){return e.some((function(e){return n=t,i=e,JSON.stringify(n)===JSON.stringify(i);var n,i}))},T=function(e,t){return e.findIndex((function(e){return t.equals(e)}))},L=o("52009230");if(void 0===L)throw new Error("Missing or empty per frame functional sequence");if(l!==L.length)throw new Error("perFrameFuncGroupSequence meta and numberOfFrames are not equal.");const w=[];for(let e=0;e<L.length;++e)w.push(xi(L[e]));const P=[];for(let e=0;e<w.length;++e){if(I(P,w[e].imagePosPat)||P.push(w[e].imagePosPat),void 0!==w[e].imageOrientationPatient)if(void 0===D)D=w[e].imageOrientationPatient;else if(!re(D,w[e].imageOrientationPatient))throw new Error("Unsupported multi orientation dicom seg.");if(void 0!==w[e].spacing)if(void 0===v)v=w[e].spacing;else if(!v.equals(w[e].spacing))throw new Error("Unsupported multi resolution dicom seg.")}if(void 0===v)throw new Error("No spacing found for DICOM SEG");if(3!==v.length())throw new Error("Incomplete spacing found for DICOM SEG");if(void 0===D)throw new Error("No imageOrientationPatient found for DICOM SEG");const A=wt(D.map((e=>parseFloat(e))));if(void 0===A)throw new Error("Invalid imageOrientationPatient found for DICOM SEG");P.sort(function(e){const t=e.getInverse();return function(e,n){const i=t.multiplyArray3D(e),o=t.multiplyArray3D(n);return i[2]-o[2]}}(A));const O=function(e){return new F(e[0],e[1],e[2])},b=[];for(const e of P)b.push(O(e));let x;x=void 0!==n?this.#Ne(b,a,v,A,n.getGeometry().getOrigins()):this.#Be(b,a,v,A);const R=x.getSize().get(2),E=function(e){return function(t){return t.number===e}},q=new t.constructor(s*R);q.fill(0);const M=x.getOrigins();let U,Q,V;for(let e=0;e<w.length;++e){if(U=T(M,O(w[e].imagePosPat)),-1===U)throw new Error("Cannot find frame origin in mask origins");Q=s*e,V=s*U;const n=g.find(E(w[e].refSegmentNumber));for(let e=0;e<s;++e)if(0!==t[Q+e]){q[V+e]=y?n.number:n.displayValue}}const N=[];for(let e=0;e<R;++e)N.push(e.toString());const B=new _i(x,q,N);y&&(B.setPhotometricInterpretation("PALETTE COLOR"),B.setPaletteColourMap(f));const k=Vi(),G=Object.keys(qi);for(const e of G)k[e]=i(qi[e]);return k.DimensionOrganizationSequence=c.organizations,k.DimensionIndexSequence=c.indices,k.custom={segments:g,frameInfos:w,SOPInstanceUID:i("00080018")},k.lengthUnit=n.getMeta().lengthUnit,k.numberOfFiles=R,B.setMeta(k),B}#Ne(e,t,n,i,o){const r=function(e,t){return e.findIndex((function(e){return t.isSimilar(e,1e-4)}))},a=[];a.push(e[0]);let s=r(o,e[0]);if(-1===s)throw new Error("No index for first frame origin");for(let t=1;t<e.length;++t){const n=e[t],i=r(o,n);if(-1===i)throw new Error("No index for frame origin "+t);if(i!==s+1)for(let e=s+1;e<i;++e)a.push(o[e]);a.push(n),s=i}const l=new mt([e[0]],t,n,i);for(let e=1;e<a.length;++e)l.appendOrigin(a[e],e);return l}#Be(e,t,n,i){h.warn("Guessing image geometry for DICOM SEG");const r=new mt([e[0]],t,n,i),a=function(e){let t=e>M;return t&&(t=e>.001,t?(t=e>.01,t||h.warn("Using larger+ real world epsilon in SEG pos pat adding")):h.warn("Using larger real world epsilon in SEG pos pat adding")),t},s=[];s.push(e[0]);let l=0;for(let t=1;t<e.length;++t){++l;let n=new o([0,0,l]),i=r.indexToWorld(n).get3D();const c=e[t];let u=c.getDistance(i);const d=u;for(;a(u);)if(h.debug("Adding intermediate pos pats for DICOM seg at "+i.toString()),s.push(i),++l,n=new o([0,0,l]),i=r.indexToWorld(n).get3D(),u=c.getDistance(i),u>d)throw new Error("Test distance is increasing when adding intermediate pos pats");s.push(c)}const c=new mt([e[0]],t,n,i);for(let e=1;e<s.length;++e)c.appendOrigin(s[e],e);return c}toDicom(e,t,n,i){const o=e.getMeta();void 0===t&&(t=o.segments);const r=e.getGeometry(),a=r.getSize();o.Rows=a.get(1),o.Columns=a.get(0);const s=new Date;o.ContentDate=nn(en(s)),o.ContentTime=on(tn(s)),void 0!==n&&(o.StudyInstanceUID=n.getMeta().StudyInstanceUID);const l=[];for(const e of t)l.push(Ii(e));var c,u;o.SegmentSequence={value:l},o.SharedFunctionalGroupsSequence={value:[{PlaneOrientationSequence:{value:[(u=r.getOrientation(),{ImageOrientationPatient:[u.get(0,0),u.get(1,0),u.get(2,0),u.get(0,1),u.get(1,1),u.get(2,1)]})]},PixelMeasuresSequence:{value:[(c=r.getSpacing(),{SpacingBetweenSlices:c.get(2),PixelSpacing:[c.get(1),c.get(0)]})]}}]};const d=function(e,t){const n=e.getGeometry().getSize(),i=n.getDimSize(2),o={};for(let r=0;r<n.get(2);++r){const n=Ui(e,t,r*i),a=Object.keys(n);for(const e of a)void 0===o[e]&&(o[e]={}),o[e][r]=n[e]}return o}(e,t),g=[],S=[],p=[];for(const i of t){const t=i.number,o=t-1;if(void 0===d[o])continue;const r=Object.keys(d[o]);for(let i=r.length-1;i>=0;--i){const a=Number.parseInt(r[i],10);S.push(d[o][a]);const s=e.getGeometry().getOrigins()[a],l=[s.getX(),s.getY(),s.getZ()],c={dimIndex:[t,r.length-i],imagePosPat:l,refSegmentNumber:t};if(void 0!==n){const e=n.getGeometry().worldToIndex(new q([s.getX(),s.getY(),s.getZ()]));c.derivationImages=[{sourceImages:[{referencedSOPInstanceUID:n.getImageUid(e),referencedSOPClassUID:n.getMeta().SOPClassUID}]}],p.push({ReferencedSOPInstanceUID:n.getImageUid(e),ReferencedSOPClassUID:n.getMeta().SOPClassUID})}g.push(c)}}o.NumberOfFrames=S.length.toString();const m=[];for(const e of g)m.push(Ri(e));if(o.PerFrameFunctionalGroupsSequence={value:m},void 0!==n){const e=[];e.push({ReferencedInstanceSequence:{value:p},SeriesInstanceUID:n.getMeta().SeriesInstanceUID}),o.ReferencedSeriesSequence={value:e}}void 0!==i&&function(e,t){const n=Object.keys(t);for(const i of n)void 0!==e[i]&&h.debug("Overwritting tag: "+i),e[i]=t[i]}(o,i);const f=wn(o),v=a.getDimSize(2),D=S.length*v/8,y=new Qe("OB");return y.tag=new Te("7FE0","0010"),y.vl=D,y.value=S,f["7FE00010"]=y,f}}class Bi{poolSize;taskQueue;freeThreads;runningThreads;constructor(e){this.poolSize=e,this.taskQueue=[],this.freeThreads=[];for(let t=0;t<e;++t)this.freeThreads.push(new ki(this));this.runningThreads=[]}addWorkerTask(e){if(this.freeThreads.length===this.poolSize&&this.onworkstart({type:"work-start"}),this.freeThreads.length>0){const t=this.freeThreads.shift();this.runningThreads.push(t),t.run(e)}else this.taskQueue.push(e)}abort(){this.#ke(),this.onabort({type:"work-abort"}),this.onworkend({type:"work-end"})}onTaskEnd(e){if(this.taskQueue.length>0){const t=this.taskQueue.shift();e.run(t)}else{e.stop(),this.freeThreads.push(e);for(let t=0;t<this.runningThreads.length;++t)this.runningThreads[t].getId()===e.getId()&&this.runningThreads.splice(t,1);this.freeThreads.length===this.poolSize&&(this.onwork({type:"work"}),this.onworkend({type:"work-end"}))}}handleWorkerError=e=>{this.#ke(),this.onerror({error:e}),this.onworkend({type:"work-end"})};#ke(){this.taskQueue=[];for(let e=0;e<this.runningThreads.length;++e)this.runningThreads[e].stop();this.runningThreads=[]}onworkstart(e){}onworkitem(e){}onwork(e){}onworkend(e){}onerror(e){}onabort(e){}}class ki{parentPool;id;runningTask;worker;constructor(e){this.parentPool=e,this.id=Math.random().toString(36).substring(2,15)}getId(){return this.id}run(e){this.runningTask=e,void 0===this.worker&&(this.worker=this.runningTask.getWorker(),this.worker.onmessage=this.onmessage,this.worker.onerror=this.onerror),this.worker.postMessage(this.runningTask.startMessage)}stop(){void 0!==this.worker&&(this.worker.terminate(),this.worker=void 0)}onmessage=e=>{e.itemNumber=this.runningTask.info.itemNumber,e.numberOfItems=this.runningTask.info.numberOfItems,e.index=this.runningTask.info.index,e.indexOrigin=this.runningTask.info.indexOrigin,this.parentPool.onworkitem(e),this.parentPool.onTaskEnd(this)};onerror=e=>{e.itemNumber=this.runningTask.info.itemNumber,e.numberOfItems=this.runningTask.info.numberOfItems,e.index=this.runningTask.info.index,e.indexOrigin=this.runningTask.info.indexOrigin,this.parentPool.handleWorkerError(e),this.stop()}}class Gi{constructor(e,t){this.startMessage=e,this.info=t}getWorker(){}}class Hi extends Gi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./"+i.u(391),i.b),{name:"labeling.worker",type:"module"})}}class zi{#Ge=new Bi(1);constructor(){this.#Ge.onerror=e=>{console.error("Labeling failed!",e.error)}}run(e,t){this.#Ge.onworkitem=this.ondone;const n=new Hi(function(e,t){const n=t.getSize(),i=t.getSpacing(),o=n.length(),r=Array(o).fill(0);for(let e=0;e<o;e++)r[e]=n.getDimSize(e);const a=Array(o).fill(0);for(let e=0;e<o;e++)a[e]=n.get(e);const s=n.getTotalSize();return{imageBuffer:e,unitVectors:r,sizes:a,spacing:i.getValues(),totalSize:s}}(e,t),{});this.#Ge.addWorkerTask(n)}ondone(e){}}class Yi extends Gi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./"+i.u(201),i.b),{name:"resampling.worker",type:"module"})}}class Xi{#Ge=new Bi(5);constructor(){this.#Ge.onerror=e=>{console.error("Resampling failed!",e.error)}}run(e,t,n,i,o,r=void 0){const a=Date.now()+""+Math.random(),s=function(e,t,n){const i=e.getOrientation(),o=t.getInverse().multiply(i),r=e.getSize(),a=e.getSpacing(),s=a.getValues(),l=[0,0,0],c=[0,0,0];for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)for(let n=0;n<=1;n++){const i=new F(s[0]*e,s[1]*t,s[2]*n),r=o.multiplyPoint3D(i);l[0]=Math.max(l[0],r.getX()),l[1]=Math.max(l[1],r.getY()),l[2]=Math.max(l[2],r.getZ()),c[0]=Math.min(c[0],r.getX()),c[1]=Math.min(c[1],r.getY()),c[2]=Math.min(c[2],r.getZ())}const u=[Math.abs(l[0]-c[0]),Math.abs(l[1]-c[1]),Math.abs(l[2]-c[2])],d=u[0]*u[1]*u[2],h=s[0]*s[1]*s[2],g=Math.cbrt(h/d),S=[u[0]*g,u[1]*g,u[2]*g],p=a.length();for(let e=3;e<p;e++)S.push(a.get(e));const m=new ct(S),f=[r.get(0)/2*a.get(0),r.get(1)/2*a.get(1),r.get(2)/2*a.get(2)];let v=!0;const D=[0,0,0],y=[0,0,0];for(let e=-1;e<=1;e+=2)for(let t=-1;t<=1;t+=2)for(let n=-1;n<=1;n+=2){const i=new F(f[0]*e,f[1]*t,f[2]*n),r=o.multiplyPoint3D(i);v?(D[0]=r.getX(),D[1]=r.getY(),D[2]=r.getZ(),y[0]=r.getX(),y[1]=r.getY(),y[2]=r.getZ(),v=!1):(D[0]=Math.max(D[0],r.getX()),D[1]=Math.max(D[1],r.getY()),D[2]=Math.max(D[2],r.getZ()),y[0]=Math.min(y[0],r.getX()),y[1]=Math.min(y[1],r.getY()),y[2]=Math.min(y[2],r.getZ()))}const C=[Math.round(Math.abs((D[0]-y[0])/m.get(0))),Math.round(Math.abs((D[1]-y[1])/m.get(1))),Math.round(Math.abs((D[2]-y[2])/m.get(2)))],I=r.length();for(let e=3;e<I;e++)C.push(r.get(e));const T=new lt(C),L=void 0===n?new F(r.get(0)/2,r.get(1)/2,r.get(2)/2):e.worldToPoint(n),w=[0,0,0];if(void 0===n)w[0]=T.get(0)/2,w[1]=T.get(1)/2,w[2]=T.get(2)/2;else{const e=[(L.getX()-r.get(0)/2)*a.get(0),(L.getY()-r.get(1)/2)*a.get(1),(L.getZ()-r.get(2)/2)*a.get(2)],t=o.multiplyArray3D(e);w[0]=t[0]/m.get(0)+T.get(0)/2,w[1]=t[1]/m.get(1)+T.get(1)/2,w[2]=t[2]/m.get(2)+T.get(2)/2}const P=new F(w[0]*m.get(0),w[1]*m.get(1),w[2]*m.get(2)),A=t.multiplyPoint3D(P),O=e.pointToWorld(L),b=new F(O.getX()-A.getX(),O.getY()-A.getY(),O.getZ()-A.getZ()),x=[0,0,m.get(2)],R=t.multiplyArray3D(x),E=[];for(let e=0;e<T.get(2);e++)E.push(new F(b.getX()+R[0]*e,b.getY()+R[1]*e,b.getZ()+R[2]*e));return new mt(E,T,m,t)}(t,i,r),l=function(e,t,n){const i=it(8*e.BYTES_PER_ELEMENT,t,n.getTotalSize());if(null===i)throw new Error("Cannot reallocate data for image resampling.");return i.fill(0),i}(e,n,s.getSize()),c=function(e,t,n,i,o,r){const a=t.getSize(),s=a.length(),l=n.getSize(),c=l.length(),u=Array(s).fill(0);for(let e=0;e<s;e++)u[e]=a.getDimSize(e);const d=Array(c).fill(0);for(let e=0;e<c;e++)d[e]=l.getDimSize(e);const h=a.getTotalSize(),g=l.getTotalSize(),S=(a,s,l)=>({sourceImageBuffer:e,sourceOrigin:t.getOrigin().getValues(),sourceSize:t.getSize().getValues(),sourceSpacing:t.getSpacing().getValues(),sourceOrientation:t.getOrientation().getValues(),sourceUnitVectors:u,sourceTotalSize:h,targetOrigin:n.getOrigin().getValues(),targetSize:n.getSize().getValues(),targetSpacing:n.getSpacing().getValues(),targetOrientation:n.getOrientation().getValues(),targetUnitVectors:d,targetTotalSize:g,pixelRepresentation:i,interpolate:o,sourceStartOffset:a,targetStartOffset:s,jobId:r,frame:l});if(c<=3)return[S(0,0,0)];{const e=l.get(3),t=a.getDimSize(3),n=l.getDimSize(3),i=[];for(let o=0;o<e;o++){const e=t*o,r=n*o;i.push(S(e,r,o))}return i}}(e,t,s,n,o,a);return this.#Ge.onworkitem=this.ondoneframe,this.#Ge.onworkend=this.ondone,c.forEach((e=>{const t=new Yi(e,{});this.#Ge.addWorkerTask(t)})),{buffer:l,geometry:s,jobId:a}}ondoneframe(e){}ondone(e){}}const Wi=["imagecontentchange","imagegeometrychange","imageresamplingstart","imageresamplingcomplete","imageresampled","labelingstart","labelschanged"];function ji(e){return(new un).create(e,e["7FE00010"].value[0],1)}function Zi(e){return(new Ni).create(e,e["7FE00010"].value[0])}class _i{#He;#ee;#ze;#Ye;#Xe;#We;#je;#Ze;#n=new Y(1,0);#_e=null;#Ke=!0;#F=!0;#Je="MONOCHROME2";#$e;#et=0;#tt;#nt={};#it=null;#ot=null;#rt=null;#X=new z;#at;#st;#lt=!1;constructor(e,t,n){this.#He=e,this.#ee=t,this.#Ye=!1,this.#Xe="0",this.#We=null,this.#je=null,this.#ze=null,this.#Ze=n,this.#at=null,this.#st=null,this.#tt=this.#ee.length/this.#He.getSize().getTotalSize()}setComplete(e){this.#lt=e,e&&this.#He.updateSliceSpacing()}getComplete(){return this.#lt}getImageUid(e){let t=this.#Ze[0];return 1!==this.#Ze.length&&void 0!==e&&(t=this.#Ze[this.getSecondaryOffset(e)]),t}getOriginForImageUid(e){let t;const n=this.#Ze.indexOf(e);return-1!==n&&(t=this.getGeometry().getOrigins()[n]),t}includesImageUid(e){return this.#Ze.includes(e)}containsImageUids(e){return function(e,t){if(null===e||null===t||void 0===e||void 0===t)return!1;if(0===e.length||0===t.length||t.length>e.length)return!1;for(const n of t)if(!e.includes(n))return!1;return!0}(this.#Ze,e)}getGeometry(){return this.#He}getBuffer(){return this.#ee}canQuantify(){return 1===this.getNumberOfComponents()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return Ft(this.getPhotometricInterpretation())}canScroll(e){const t=this.getGeometry().getSize();let n=1;return void 0!==this.#nt.numberOfFiles&&(n=this.#nt.numberOfFiles),t.canScroll(e)||1!==n}#ct(){return this.#He.getSize().getTotalSize(2)}getSecondaryOffset(e){return this.#He.getSize().indexToOffset(e,2)}getRescaleSlopeAndIntercept(e){let t=this.#n;if(!this.isConstantRSI()){if(void 0===e)throw new Error("Cannot get non constant RSI with empty slice index.");const n=this.getSecondaryOffset(e);void 0!==this.#_e[n]?t=this.#_e[n]:h.warn("undefined non constant rsi at "+n)}return t}#ut(e){return this.#_e[e]}setRescaleSlopeAndIntercept(e,t){if(this.#Ke=this.#Ke&&e.isID(),this.#F){if(!this.#n.equals(e))if(void 0===t)this.#n=e;else{this.#F=!1,this.#_e=[];for(let e=0,t=this.#ct();e<t;++e)this.#_e.push(this.#n);this.#n=null,this.#_e.splice(t,0,e)}}else{if(void 0===t)throw new Error("Cannot store non constant RSI with empty slice index.");this.#_e.splice(t,0,e)}}isIdentityRSI(){return this.#Ke}isConstantRSI(){return this.#F}getPhotometricInterpretation(){return this.#Je}setPhotometricInterpretation(e){this.#Je=e}setPaletteColourMap(e){this.#$e=e,this.#j({type:"imagecontentchange"})}getPaletteColourMap(){return this.#$e}updatePaletteColourMap(e,t){this.#$e.red[e]=t.r,this.#$e.green[e]=t.g,this.#$e.blue[e]=t.b,this.#j({type:"imagecontentchange"})}getPlanarConfiguration(){return this.#et}setPlanarConfiguration(e){this.#et=e}getNumberOfComponents(){return this.#tt}getMeta(){return this.#nt}setMeta(e){this.#nt=e}getValueAtOffset(e){return this.#ee[e]}getOffsets(e){let t;if("number"==typeof e){if(1!==this.#tt)throw new Error("Number of components is not 1 for getting single value.");t=[e]}else if(void 0!==e.r&&void 0!==e.g&&void 0!==e.b){if(3!==this.#tt)throw new Error("Number of components is not 3 for getting RGB value.");t=[e.r,e.g,e.b]}const n=[];let i;for(let e=0;e<this.#ee.length;e+=this.#tt){i=!0;for(let n=0;n<this.#tt;++n)if(this.#ee[e+n]!==t[n]){i=!1;break}i&&n.push(e)}return n}hasValues(e){if(void 0===e||0===e.length)return[];const t=[];for(let n=0;n<e.length;++n)1===this.#tt?t.push([e[n]]):3===this.#tt&&t.push([e[n].r,e[n].g,e[n].b]);let n;1===this.#tt?n=function(e,t){return e[0]===t[0]}:3===this.#tt&&(n=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]});const i=function(e){return function(t){return n(t,e)}},o=new Array(e.length);o.fill(!1);const r=t.slice();let a,s;for(let e=0,n=this.#ee.length;e<n;e+=this.#tt){s=[];for(let n=0;n<r.length;++n){a=!0;for(let t=0;t<this.#tt;++t)if(this.#ee[e+t]!==r[n][t]){a=!1;break}a&&(o[t.findIndex(i(r[n]))]=!0,s.push(n))}for(let e=0;e<s.length;++e)r.splice(s[e],1);if(0===r.length)break}return o}clone(){const e=this.#ee.slice(0),t=new _i(this.getGeometry().clone(),e,this.#Ze);if(this.isConstantRSI())t.setRescaleSlopeAndIntercept(this.getRescaleSlopeAndIntercept());else for(let e=0;e<this.#ct();++e)t.setRescaleSlopeAndIntercept(this.#ut(e),e);return t.setPhotometricInterpretation(this.getPhotometricInterpretation()),t.setPlanarConfiguration(this.getPlanarConfiguration()),t.setPaletteColourMap(structuredClone(this.#$e)),t.setMeta(structuredClone(this.getMeta())),t}#dt(e){let t=this.#ee;if(this.#ee=it(8*this.#ee.BYTES_PER_ELEMENT,this.#nt.PixelRepresentation,e),null===this.#ee)throw new Error("Cannot reallocate data for image.");this.#ee.set(t),t=null}#ht(e){let t=this.#ze;this.#ze=new Uint8Array(e),this.#ze.set(t),t=null}canAppend(e){if(null===e)return{success:!1,message:"Cannot append null slice"};const t=this.#He.canAppend(e.getGeometry());if(!t.success)return t;if(this.#Je!==e.getPhotometricInterpretation())return{success:!1,message:"Cannot append a slice with different photometric interpretation"};for(const t in this.#nt)if("windowPresets"!==t&&"numberOfFiles"!==t&&"custom"!==t&&this.#nt[t]!==e.getMeta()[t])return{success:!1,message:"Cannot append a slice with different "+t+": "+this.#nt[t]+" != "+e.getMeta()[t]};return new pt(!0)}appendSlice(e){const t=this.canAppend(e);if(!t.success)throw new Error(t.message);const n=e.getDataRange(),i=this.getDataRange();this.#it={min:Math.min(n.min,i.min),max:Math.max(n.max,i.max)};const r=e.getRescaledDataRange(),a=this.getRescaledDataRange();this.#ot={min:Math.min(r.min,a.min),max:Math.max(r.max,a.max)};let s=this.getGeometry().getSize();const l=e.getGeometry().getInitialTime();let c=!1;void 0===l||this.#He.hasSlicesAtTime(l)||(this.appendFrame(l,e.getGeometry().getOrigin()),s=this.#He.getSize(),c=!0);const u=function(e,t){const n=t.getInitialTime(),i=[];return i.push(0),i.push(0),i.push(e.getSliceIndex(t.getOrigin(),n)),void 0!==n&&i.push(n),new o(i)}(this.#He,e.getGeometry()),d=this.#tt*s.getDimSize(2);if(void 0===this.#nt.numberOfFiles)throw new Error("Missing number of files for buffer manipulation.");const h=d*this.#nt.numberOfFiles;if(this.#ee.length!==h&&(this.#dt(h),null!==this.#ze)){const e=3*s.getDimSize(2)*this.#nt.numberOfFiles;this.#ht(e)}const g=u.get(2);let S=g;void 0!==l&&(S+=this.#He.getCurrentNumberOfSlicesBeforeTime(l));const p=S*d,m=this.#He.getCurrentTotalNumberOfSlices(),f=m*d;if(p<f&&(this.#ee.set(this.#ee.subarray(p,f),p+d),null!==this.#ze)){const e=3*s.getDimSize(2),t=S*e,n=m*e;this.#ze.set(this.#ze.subarray(t,n),t+e)}this.#ee.set(e.getBuffer(),p),c||this.#He.appendOrigin(e.getGeometry().getOrigin(),g,l),this.setRescaleSlopeAndIntercept(e.getRescaleSlopeAndIntercept(),S);const D=this.#Ze.length;if(this.#Ze.splice(S,0,e.getImageUid()),void 0!==this.#nt.windowPresets){const t=this.#nt.windowPresets,n=e.getMeta().windowPresets,i=Object.keys(n);let o;for(let e=0;e<i.length;++e){o=i[e];const r=n[o],a=t[o];if(void 0!==a){if((void 0===a.perslice||!1===a.perslice)&&!v(a.wl[0],r.wl[0])){a.perslice=!0;for(let e=0;e<D-1;++e)a.wl.push(a.wl[0])}void 0!==a.perslice&&!0===a.perslice&&t[o].wl.splice(S,0,r.wl[0])}else t[o]=n[o]}}this.#j({type:"imagegeometrychange"})}appendFrameBuffer(e,t){const n=this.#He.getSize(),i=this.#tt*n.getDimSize(2);if(void 0===this.#nt.numberOfFiles)throw new Error("Missing number of files for frame buffer manipulation.");const o=i*this.#nt.numberOfFiles;if(this.#ee.length!==o&&(this.#dt(o),null!==this.#ze)){const e=3*n.getDimSize(2)*this.#nt.numberOfFiles;this.#ht(e)}t>=this.#nt.numberOfFiles?h.warn("Ignoring frame at index "+t+" (size: "+this.#nt.numberOfFiles+")"):(this.#ee.set(e,i*t),this.appendFrame(t,new F(0,0,0)))}appendFrame(e,t){this.#He.appendFrame(t,e),this.#j({type:"appendframe"})}getDataRange(){return this.#it||(this.#it=this.calculateDataRange()),this.#it}getRescaledDataRange(){return this.#ot||(this.#ot=this.calculateRescaledDataRange()),this.#ot}getHistogram(){if(!this.#rt){const e=this.calculateHistogram();this.#it=e.dataRange,this.#ot=e.rescaledDataRange,this.#rt=e.histogram}return this.#rt}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)};setAtOffsets(e,t){let n,i;if("number"==typeof t){if(1!==this.#tt)throw new Error("Number of components is not 1 for setting single value.");n=[t]}else if(void 0!==t.r&&void 0!==t.g&&void 0!==t.b){if(3!==this.#tt)throw new Error("Number of components is not 3 for setting RGB value.");n=[t.r,t.g,t.b]}for(let t=0,o=e.length;t<o;++t){i=e[t];for(let e=0;e<this.#tt;++e)this.#ee[i+e]=n[e]}this.#j({type:"imagecontentchange"})}#gt(e){null!==this.#ze&&(this.#ze[3*e]=0,this.#ze[3*e+1]=0,this.#ze[3*e+2]=0)}#St(e){this.#gt(e);const t=this.#He.getSize(),n=t.getDimSize(0),i=t.getDimSize(1),o=t.getDimSize(2);for(let t=-5;t<5;t++)for(let r=-5;r<5;r++)for(let a=-5;a<5;a++){const s=e+n*t+i*r+o*a;s>=0&&s<this.#ee.length&&this.#gt(s)}}setAtOffsetsAndGetOriginals(e,t){const n=[];for(let i=0;i<e.length;++i){const o=e[i];let r=o[0],a=this.#ee[r];const s=[];s.push({index:0,value:a});for(let e=0;e<o.length;++e){r=o[e];const n=this.#ee[r];a!==n&&(s.push({index:e,value:n}),a=n),this.#ee[r]=t,this.#St(r)}n.push(s)}return this.#j({type:"imagecontentchange"}),n}setAtOffsetsWithIterator(e,t){const n=Array.isArray(t);for(let i=0;i<e.length;++i){const o=e[i];let r;r=H(n?t[i]:[{index:0,value:t}],o.length);let a=r.next();for(;!a.done;){const e=o[a.index];this.#ee[e]=a.value,this.#St(e),a=r.next()}}this.#j({type:"imagecontentchange"})}getValue(e,t,n,i){const r=[e,t,n];void 0!==i&&r.push(i);const a=new o(r);return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(a))}getValueAtIndex(e){return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValue(e,t,n,i){let r=this.getValue(e,t,n,i);if(!this.isIdentityRSI())if(this.isConstantRSI())r=this.getRescaleSlopeAndIntercept().apply(r);else{const a=[e,t,n];void 0!==i&&a.push(i);const s=new o(a);r=this.getRescaleSlopeAndIntercept(s).apply(r)}return r}getRescaledValueAtIndex(e){return this.getRescaledValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValueAtOffset(e){let t=this.getValueAtOffset(e);if(!this.isIdentityRSI())if(this.isConstantRSI())t=this.getRescaleSlopeAndIntercept().apply(t);else{const n=this.getGeometry().getSize().offsetToIndex(e);t=this.getRescaleSlopeAndIntercept(n).apply(t)}return t}calculateDataRange(){let e,t=this.getValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();i.length()>=3&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateRescaledDataRange(){if(this.isIdentityRSI())return this.getDataRange();if(this.isConstantRSI()){const e=this.getDataRange(),t=this.getRescaleSlopeAndIntercept().apply(e.min),n=this.getRescaleSlopeAndIntercept().apply(e.max);return{min:t<n?t:n,max:t>n?t:n}}{let e,t=this.getRescaledValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();3===i.length()&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getRescaledValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}}calculateHistogram(){const e=this.getGeometry().getSize(),t=[];let n,i,o=this.getValueAtOffset(0),r=o,a=this.getRescaledValueAtOffset(0),s=a;for(let l=0,c=e.getTotalSize();l<c;++l)n=this.getValueAtOffset(l),n>r&&(r=n),n<o&&(o=n),i=this.getRescaledValueAtOffset(l),i>s&&(s=i),i<a&&(a=i),t[i]=(t[i]||0)+1;const l={min:o,max:r},c={min:a,max:s},u=[];for(let e=a;e<=s;++e)u.push([e,t[e]||0]);return{dataRange:l,rescaledDataRange:c,histogram:u}}convolute2D(e){if(9!==e.length)throw new Error("The convolution matrix does not have a length of 9; it has "+e.length);const t=this.clone(),n=t.getBuffer(),i=this.getGeometry().getSize(),o=i.getDimSize(2)*this.getNumberOfComponents();for(let t=0;t<i.get(2);++t)this.convoluteBuffer(e,n,t*o);return t}convoluteBuffer(e,t,n){const i=this.getGeometry().getSize(),o=i.get(0),r=i.get(1),a=this.getNumberOfComponents();let s=1,l=1;3===a&&(0===this.getPlanarConfiguration()?s=3:l=i.getDimSize(2));const c=[];c[0]=(-o-1)*s,c[1]=-o*s,c[2]=(1-o)*s,c[3]=-s,c[4]=0,c[5]=1*s,c[6]=(o-1)*s,c[7]=o*s,c[8]=(o+1)*s;const u=[];u[0]=c[4],u[1]=c[4],u[2]=c[5],u[3]=c[4],u[4]=c[4],u[5]=c[5],u[6]=c[7],u[7]=c[7],u[8]=c[8];const d=[];d[0]=c[1],d[1]=c[1],d[2]=c[2],d[3]=c[4],d[4]=c[4],d[5]=c[5],d[6]=c[7],d[7]=c[7],d[8]=c[8];const h=[];h[0]=c[1],h[1]=c[1],h[2]=c[2],h[3]=c[4],h[4]=c[4],h[5]=c[5],h[6]=c[4],h[7]=c[4],h[8]=c[5];const g=[];g[0]=c[3],g[1]=c[4],g[2]=c[5],g[3]=c[3],g[4]=c[4],g[5]=c[5],g[6]=c[6],g[7]=c[7],g[8]=c[8];const S=[];S[0]=c[0],S[1]=c[1],S[2]=c[2],S[3]=c[3],S[4]=c[4],S[5]=c[5],S[6]=c[3],S[7]=c[4],S[8]=c[5];const p=[];p[0]=c[3],p[1]=c[4],p[2]=c[4],p[3]=c[3],p[4]=c[4],p[5]=c[4],p[6]=c[6],p[7]=c[7],p[8]=c[7];const m=[];m[0]=c[0],m[1]=c[1],m[2]=c[1],m[3]=c[3],m[4]=c[4],m[5]=c[4],m[6]=c[6],m[7]=c[7],m[8]=c[7];const f=[];f[0]=c[0],f[1]=c[1],f[2]=c[1],f[3]=c[3],f[4]=c[4],f[5]=c[4],f[6]=c[3],f[7]=c[4],f[8]=c[4];let v,D,y=n;for(let n=0;n<a;++n){y+=n*l;for(let n=0;n<r;++n)for(let i=0;i<o;++i){D=c,0===i&&0===n?D=u:0===i&&n===r-1?D=h:i===o-1&&0===n?D=p:i===o-1&&n===r-1?D=f:0===i&&n!==r-1&&0!==n?D=d:i===o-1&&n!==r-1&&0!==n?D=m:0!==i&&i!==o-1&&0===n?D=g:0!==i&&i!==o-1&&n===r-1&&(D=S),v=0;for(let t=0;t<9;++t)v+=this.getValueAtOffset(y+D[t])*e[t];t[y]=v,y+=s}}}transform(e){const t=this.clone(),n=t.getBuffer();for(let i=0,o=n.length;i<o;++i)n[i]=e(t.getValueAtOffset(i));return t}compose(e,t){const n=this.clone(),i=n.getBuffer();for(let n=0,o=i.length;n<o;++n)i[n]=Math.floor(t(this.getValueAtOffset(n),e.getValueAtOffset(n)));return n}initializeContour(){this.#ze=new Uint8Array(3*this.#ee.length)}countourIsInitialized(){return null!==this.#ze}#pt(e,t,n,i,o,r){return()=>{const a=t+n,s=e+1,l=this.#He.getSize(),c=l.offsetToIndex(a);return a>=this.#ee.length||a<0||0===c.get(i)||c.get(i)===l.get(i)-1||255===s?s:s>10?255:this.#ee[a]!==o?s:(r.push(this.#pt(s,a,n,i,o,r)),0)}}#mt(e,t,n,i,o,r,a,s){return()=>{const l=t+n,c=e+1,u=this.#He.getSize(),d=u.offsetToIndex(l);return l>=this.#ee.length||l<0||0===d.get(o)||d.get(o)===u.get(o)-1||255===c?c:c>10?255:this.#ee[l]!==a?c:(s.push(this.#pt(c,l,i,r,a,s)),s.push(this.#pt(c,l,-i,r,a,s)),s.push(this.#mt(c,l,n,i,o,r,a,s)),0)}}getContourDistance(e,t){if(null===this.#ze)return 0;const n=t.getThirdColMajorDirection(),i=(n+1)%3,o=(n+2)%3,r=3*e+n,a=this.#ze[r];if(a>0)return a;const s=this.#ee[e],l=[],c=this.#He.getSize(),u=c.getDimSize(o),d=c.getDimSize(i);l.push(this.#mt(0,e,u,d,o,i,s,l)),l.push(this.#pt(0,e,d,i,s,l)),l.push(this.#pt(0,e,-d,i,s,l)),l.push(this.#mt(0,e,-u,d,o,i,s,l));let h=0;const g=Math.pow(10,2);for(;l.length>0;){if(h++,h>g)return this.#ze[r]=255,255;const e=l.shift()();if(e>0)return this.#ze[r]=e,e}return 1/0}recalculateLabels(){if(null===this.#at){this.#at=new zi;const e=this.#He.getSpacing(),t=this.getMeta().lengthUnit;let n=1,i="unit.pixel";"unit.mm"===t&&(n=e.get(0)*e.get(1)*e.get(2)*.001,i="unit.ml"),this.#at.ondone=e=>{const r=e.data.labels;for(const e of r){let r,a;e.centroid=this.#He.indexToWorld(new o(e.centroidIndex)),e.volume={value:e.count*n,unit:i},void 0!==e.diameters&&(void 0!==e.diameters.major&&(r=e.diameters.major.diameter),void 0!==e.diameters.minor&&(a=e.diameters.minor.diameter)),e.diameters={major:{diameter:{value:r,unit:t}},minor:{diameter:{value:a,unit:t}}},e.height={value:e.height,unit:t}}const a=r.sort(((e,t)=>t.volume.value-e.volume.value)).sort(((e,t)=>e.id-t.id));this.#j({type:"labelschanged",labels:a}),e.data.buffer&&(this.#ee=e.data.buffer,this.#j({type:"imagecontentchange"}))}}this.#j({type:"labelingstart"}),this.#at.run(this.#ee,this.#He)}isResampled(){return this.#Ye}resample(e,t=void 0,n=void 0){null===this.#st&&(this.#st=new Xi,this.#st.ondoneframe=e=>{const t=e.data;this.#Xe===t.jobId&&(this.#ee.set(t.targetImageBuffer,t.startOffset),this.#j({type:"imageresampled",frame:t.frame}))},this.#st.ondone=e=>{this.#j({type:"imageresamplingcomplete"})});const i=this.#Ye&&this.#je&&this.#We?{buffer:this.#je,geometry:this.#We}:{buffer:this.#ee,geometry:this.#He};this.#j({type:"imageresamplingstart"});const o=this.#st.run(i.buffer,i.geometry,this.#nt.PixelRepresentation,e,void 0===t||t,n);this.#Ye||(this.#Ye=!0,this.#je=this.#ee,this.#We=this.#He),this.#ee=o.buffer,this.#He=o.geometry,this.#Xe=o.jobId,this.#j({type:"imagecontentchange"}),this.#j({type:"imagegeometrychange"})}revert(){this.#Ye&&(this.#j({type:"imageresamplingstart"}),this.#Ye=!1,this.#ee=this.#je,this.#He=this.#We,this.#je=null,this.#We=null,this.#j({type:"imagecontentchange"}),this.#j({type:"imagegeometrychange"}),this.#j({type:"imageresampled"}))}}const Ki=["annotationgroupeditablechange","annotationadd","annotationupdate","annotationremove"];class Ji{#ft;#nt={};#X=new z;#vt;#Dt;constructor(e){this.#ft=void 0!==e?e:[],this.#vt=!0}getList(){return this.#ft}getLength(){return this.#ft.length}isEditable(){return this.#vt}setEditable(e){this.#vt=e,this.#j({type:"annotationgroupeditablechange",data:e})}getColour(){return this.#Dt}setColour(e){this.#Dt=e}add(e,t){this.#ft.push(e),this.#j({type:"annotationadd",data:e,propagate:t})}update(e,t,n){const i=this.#ft.findIndex((t=>t.trackingUid===e.trackingUid));-1!==i?((t.includes("mathShape")||t.includes("textExpr"))&&e.updateQuantification(),this.#ft[i]=e,this.#j({type:"annotationupdate",data:e,keys:t,propagate:n})):h.warn("Cannot find annotation to update")}remove(e,t){const n=this.#ft.findIndex((t=>t.trackingUid===e));if(-1!==n){const e=this.#ft.splice(n,1)[0];this.#j({type:"annotationremove",data:e,propagate:t})}else h.warn("Cannot find annotation to remove")}setViewController(e){for(const t of this.#ft)t.setViewController(e),t.updateQuantification()}find(e){return this.#ft.find((t=>t.trackingUid===e))}getMeta(){return this.#nt}hasMeta(e){return void 0!==this.#nt[e]}getMetaValue(e){return this.#nt[e]}setMetaValue(e,t){this.#nt[e]=t}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)}}const $i="0040A30A",eo="0040A161",to="0040A162",no="0040A163",io="004008EA";class oo{numericValue;floatingPointValue;rationalNumeratorValue;rationalDenominatorValue;measurementUnitsCode;toString(){return this.numericValue+" "+this.measurementUnitsCode.toString()}}function ro(e){const t={};return void 0!==e.measurementUnitsCode&&(t.MeasurementUnitsCodeSequence={value:[Fn(e.measurementUnitsCode)]}),void 0!==e.floatingPointValue&&(t.FloatingPointValue=e.floatingPointValue),void 0!==e.rationalNumeratorValue&&(t.RationalNumeratorValue=e.rationalNumeratorValue),void 0!==e.rationalDenominatorValue&&(t.RationalDenominatorValue=e.rationalDenominatorValue),void 0!==e.numericValue&&(t.NumericValue=e.numericValue),t}const ao="0040A300",so="0040A301";class lo{measuredValue;numericValueQualifierCode;toString(){let e="";return void 0!==this.measuredValue&&(e+=this.measuredValue.toString()),void 0!==this.numericValueQualifierCode&&(e+=" "+this.numericValueQualifierCode.toString()),e}}function co(e){const t={};return void 0!==e.measuredValue&&(t.MeasuredValueSequence={value:[ro(e.measuredValue)]}),void 0!==e.numericValueQualifierCode&&(t.NumericValueQualifierCodeSequence={value:[Fn(e.numericValueQualifierCode)]}),t}const uo="00081150",ho="00081155";class go{referencedSOPClassUID;referencedSOPInstanceUID;toString(){return this.referencedSOPInstanceUID+" (class: "+this.referencedSOPClassUID+")"}}function So(e){const t=new go;return void 0!==e[uo]&&(t.referencedSOPClassUID=e[uo].value[0]),void 0!==e[ho]&&(t.referencedSOPInstanceUID=e[ho].value[0]),t}function po(e){const t={};return void 0!==e.referencedSOPClassUID&&(t.ReferencedSOPClassUID=e.referencedSOPClassUID),void 0!==e.referencedSOPInstanceUID&&(t.ReferencedSOPInstanceUID=e.referencedSOPInstanceUID),t}const mo="00081160",fo="00081199",vo="0062000B";class Do{referencedSOPSequence;referencedFrameNumber;referencedSegmentNumber;toString(){let e=this.referencedSOPSequence.toString();return void 0!==this.referencedFrameNumber&&(e+=", frame: "+this.referencedFrameNumber),e}}function yo(e){const t={};return void 0!==e.referencedFrameNumber&&(t.ReferencedFrameNumber=e.referencedFrameNumber),void 0!==e.referencedSOPSequence&&(t.ReferencedSOPSequence={value:[po(e.referencedSOPSequence)]}),void 0!==e.referencedSegmentNumber&&(t.ReferencedSegmentNumber=e.referencedSegmentNumber),t}class Co{#yt;#Ct;constructor(e,t){this.#yt=e,this.#Ct=t}getBegin(){return this.#yt}getEnd(){return this.#Ct}equals(e){return null!==e&&this.getBegin().equals(e.getBegin())&&this.getEnd().equals(e.getEnd())}getDeltaX(){return this.getEnd().getX()-this.getBegin().getX()}getDeltaY(){return this.getEnd().getY()-this.getBegin().getY()}getLength(){return Math.sqrt(this.getDeltaX()*this.getDeltaX()+this.getDeltaY()*this.getDeltaY())}getWorldLength(e){let t=null;if(null!==e){const n=this.getDeltaX()*e.x,i=this.getDeltaY()*e.y;t=Math.sqrt(n*n+i*i)}return t}getMidpoint(){return this.getCentroid()}getCentroid(){return new E((this.getBegin().getX()+this.getEnd().getX())/2,(this.getBegin().getY()+this.getEnd().getY())/2)}getSlope(){return this.getDeltaY()/this.getDeltaX()}getIntercept(){return(this.getEnd().getX()*this.getBegin().getY()-this.getBegin().getX()*this.getEnd().getY())/this.getDeltaX()}getInclination(){return 180-180*Math.atan2(this.getDeltaY(),this.getDeltaX())/Math.PI}getFlipped(){return new Co(this.#Ct,this.#yt)}quantify(e){const t=e.get2DSpacing(),n=this.getWorldLength(t);let i;return null!==n&&(i={value:n,unit:e.getLengthUnit()}),{length:i}}}function Io(e,t){const n=e.getDeltaX(),i=e.getDeltaY(),o=t.getDeltaX(),r=t.getDeltaY(),a=n*o+i*r,s=n*r-i*o;return 360-(180-180*Math.atan2(s,a)/Math.PI)}function To(e,t){const n=e.getDeltaX(),i=e.getDeltaY();return n*t.getDeltaX()+i*t.getDeltaY()==0}function Lo(e,t,n,i){void 0===i&&(i={x:1,y:1});const o=-i.x*i.x/(i.y*i.y*e.getSlope());return Po(o,t.getY()-o*t.getX(),t,n,i)}function wo(e,t,n,i){const o=Po(e.getSlope(),e.getIntercept(),e.getBegin(),t,i);let r;return r=function(e,t){const n=Math.min(t.getBegin().getX(),t.getEnd().getX()),i=Math.max(t.getBegin().getX(),t.getEnd().getX()),o=Math.min(t.getBegin().getY(),t.getEnd().getY()),r=Math.max(t.getBegin().getY(),t.getEnd().getY());return e.getX()>=n&&e.getX()<=i&&e.getY()>=o&&e.getY()<=r}(o.getBegin(),e)?o.getBegin():o.getEnd(),Lo(e,r,n,i)}function Po(e,t,n,i,o){let r,a,s,l;if(void 0===o&&(o={x:1,y:1}),U(e,0,M))r=n.getX()-i/(2*o.x),a=n.getY(),s=n.getX()+i/(2*o.x),l=n.getY();else if(Math.abs(e)>1e6)r=n.getX(),a=n.getY()-i/(2*o.y),s=n.getX(),l=n.getY()+i/(2*o.y);else{const c=o.x*o.x,u=o.y*o.y,d=i/(2*Math.sqrt(c+u*e*e));r=n.getX()-d,a=e*r+t,s=n.getX()+d,l=e*s+t}return new Co(new E(r,a),new E(s,l))}class Ao{#It;constructor(e){if(e.length>3)throw new Error("Too many points for a protractor");this.#It=e.slice(0,3)}getPoint(e){return this.#It[e]}getLength(){return this.#It.length}getCentroid(){return this.#It[1]}quantify(e,t){let n;if(3===this.#It.length){let e=Io(new Co(this.#It[0],this.#It[1]),new Co(this.#It[1],this.#It[2]));e>180&&(e=360-e),n={value:e,unit:"unit.degree"}}return{angle:n}}}class Oo{#It=[];constructor(e){void 0!==e&&(this.#It=e)}getPoint(e){return this.#It[e]}getPoints(){return this.#It}getLength(){return this.#It.length}addPoint(e){this.#It.push(e)}addPoints(e){this.#It=this.#It.concat(e)}getCentroid(){let e,t=0,n=0,i=0;for(let e=0;e<this.#It.length;++e){const o=this.#It[e];let r;r=e===this.#It.length-1?this.#It[0]:this.#It[e+1];const a=o.getX()*r.getY()-r.getX()*o.getY();t+=a,n+=(o.getX()+r.getX())*a,i+=(o.getY()+r.getY())*a}if(0!==t){const o=1/(3*t);e=new E(o*n,o*i)}return e}}class bo{#Tt;#Lt;constructor(e,t){this.#Tt=e,this.#Lt=t}getCenter(){return this.#Tt}getCentroid(){return this.#Tt}getRadius(){return this.#Lt}equals(e){return null!==e&&this.getCenter().equals(e.getCenter())&&this.getRadius()===e.getRadius()}getSurface(){return Math.PI*this.getRadius()*this.getRadius()}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRound(){const e=this.getCenter().getX(),t=this.getCenter().getY(),n=this.getRadius(),i=Math.pow(n,2),o=t+n,r=[];for(let a=t-n;a<o;++a){const n=i-Math.pow(a-t,2);if(Math.abs(n)<1e-7)continue;const o=Math.sqrt(n);o<.5||r.push([[Math.round(e-o),Math.round(a)],[Math.round(e+o),Math.round(a)]])}return r}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r={value:this.getRadius()*i.x,unit:o},a=this.getWorldSurface(i);let s;null!==a&&(s="unit.mm"===o?{value:a/100,unit:"unit.cm2"}:{value:a,unit:o});const l={radius:r,surface:s};if(e.canQuantifyImage()){const i=this.getRound();if(0!==i.length){const o=e.getImageVariableRegionValues(i,t),r=e.getPixelUnit(),a=dt(o,n);l.min={value:a.min,unit:r},l.max={value:a.max,unit:r},l.mean={value:a.mean,unit:r},l.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(l.median={value:a.median,unit:r}),void 0!==a.p25&&(l.p25={value:a.p25,unit:r}),void 0!==a.p75&&(l.p75={value:a.p75,unit:r})}}return l}}class xo{#Tt;#wt;#Pt;constructor(e,t,n){this.#Tt=e,this.#wt=t,this.#Pt=n}getCenter(){return this.#Tt}getCentroid(){return this.#Tt}getA(){return this.#wt}getB(){return this.#Pt}equals(e){return null!==e&&this.getCenter().equals(e.getCenter())&&this.getA()===e.getA()&&this.getB()===e.getB()}getSurface(){return Math.PI*this.getA()*this.getB()}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRound(){const e=this.getCenter().getX(),t=this.getCenter().getY(),n=this.getA(),i=this.getB(),o=n/i,r=Math.pow(i,2),a=t+i,s=[];for(let n=t-i;n<a;++n){const i=r-Math.pow(n-t,2);if(Math.abs(i)<1e-7)continue;const a=o*Math.sqrt(i);a<.5||s.push([[Math.round(e-a),Math.round(n)],[Math.round(e+a),Math.round(n)]])}return s}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r={value:this.getA()*i.x,unit:o},a={value:this.getB()*i.y,unit:o},s=this.getWorldSurface(i);let l;null!==s&&(l="unit.mm"===o?{value:s/100,unit:"unit.cm2"}:{value:s,unit:o});const c={a:r,b:a,surface:l};if(e.canQuantifyImage()){const i=this.getRound();if(0!==i.length){const o=e.getImageVariableRegionValues(i,t),r=e.getPixelUnit(),a=dt(o,n);c.min={value:a.min,unit:r},c.max={value:a.max,unit:r},c.mean={value:a.mean,unit:r},c.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(c.median={value:a.median,unit:r}),void 0!==a.p25&&(c.p25={value:a.p25,unit:r}),void 0!==a.p75&&(c.p75={value:a.p75,unit:r})}}return c}}function Ro(e,t,n){const i=e.getValues(),r=i.slice(),a=[],s=t[0],l=t[1],c=s/l,u=Math.pow(l,2),d=n[0],h=n[1];for(let e=0;e<l;++e){const t=Math.round(c*Math.sqrt(u-Math.pow(e,2))),n=i[h]+e,s=i[h]-e;for(let e=0;e<t;++e){const t=i[d]+e,l=i[d]-e;r[d]=t,r[h]=n,a.push(new o(r.slice())),s!==n&&(r[h]=s,a.push(new o(r.slice()))),l!==t&&(r[d]=l,r[h]=n,a.push(new o(r.slice())),s!==n&&(r[h]=s,a.push(new o(r.slice()))))}}return a}class Eo{#yt;#Ct;constructor(e,t){this.#yt=new E(Math.min(e.getX(),t.getX()),Math.min(e.getY(),t.getY())),this.#Ct=new E(Math.max(e.getX(),t.getX()),Math.max(e.getY(),t.getY()))}getBegin(){return this.#yt}getEnd(){return this.#Ct}equals(e){return null!==e&&this.getBegin().equals(e.getBegin())&&this.getEnd().equals(e.getEnd())}getSurface(){const e=this.getBegin(),t=this.getEnd();return Math.abs(t.getX()-e.getX())*Math.abs(t.getY()-e.getY())}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRealWidth(){return this.getEnd().getX()-this.getBegin().getX()}getRealHeight(){return this.getEnd().getY()-this.getBegin().getY()}getWidth(){return Math.abs(this.getRealWidth())}getHeight(){return Math.abs(this.getRealHeight())}getRound(){return{min:new E(Math.round(this.getBegin().getX()),Math.round(this.getBegin().getY())),max:new E(Math.round(this.getEnd().getX()),Math.round(this.getEnd().getY()))}}getCentroid(){return new E(this.getBegin().getX()+this.getWidth()/2,this.getBegin().getY()+this.getHeight()/2)}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r={value:this.getWidth()*i.x,unit:o},a={value:this.getHeight()*i.y,unit:o},s=this.getWorldSurface(i);let l;null!==s&&(l="unit.mm"===o?{value:s/100,unit:"unit.cm2"}:{value:s,unit:o});const c={width:r,height:a,surface:l};if(e.canQuantifyImage()){const i=this.getRound(),o=e.getImageRegionValues(i.min,i.max,t),r=e.getPixelUnit(),a=dt(o,n);c.min={value:a.min,unit:r},c.max={value:a.max,unit:r},c.mean={value:a.mean,unit:r},c.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(c.median={value:a.median,unit:r}),void 0!==a.p25&&(c.p25={value:a.p25,unit:r}),void 0!==a.p75&&(c.p75={value:a.p75,unit:r})}return c}}function Fo(e,t,n){const i=e.getValues(),r=i.slice(),a=[],s=t[0],l=Math.floor(s/2),c=t[1],u=Math.floor(c/2),d=n[0],h=n[1];for(let e=0;e<c;++e){r[h]=i[h]-u+e;for(let e=0;e<s;++e)r[d]=i[d]-l+e,a.push(new o(r.slice()))}return a}class qo{#yt;#Ct;shortAxisLength;shortAxisCenter;shortAxisL1;shortAxisL2;shortAxisT;constructor(e,t){this.#yt=e,this.#Ct=t,this.shortAxisCenter=void 0,this.shortAxisT=void 0,this.shortAxisL1=void 0,this.shortAxisL2=void 0,this.shortAxisLength=void 0,this.hasShortAxisInteraction=!1}getBegin(){return this.#yt}getEnd(){return this.#Ct}getCentroid(){return new E((this.#yt.getX()+this.#Ct.getX())/2,(this.#yt.getY()+this.#Ct.getY())/2)}getLength(){const e=this.getDeltaX(),t=this.getDeltaY();return Math.hypot(e,t)}getSlope(){const e=this.getDeltaX(),t=this.getDeltaY();return 0===e?1/0:t/e}getDeltaX(){return this.#Ct.getX()-this.#yt.getX()}getDeltaY(){return this.#Ct.getY()-this.#yt.getY()}quantify(e){const t=e.get2DSpacing?.()??{x:1,y:1},n=new Co(this.#yt,this.#Ct).getWorldLength(t);let i=null;if("number"==typeof this.shortAxisLength&&!Number.isNaN(this.shortAxisLength)){const e=this.getDeltaX(),n=this.getDeltaY(),o=this.getLength();if(o>0){const r="number"==typeof this.shortAxisT?this.shortAxisT:.5,a=this.#yt.getX()+e*r,s=this.#yt.getY()+n*r,l=new E(a,s),c=-n/o,u=e/o,d="number"==typeof this.shortAxisL1?this.shortAxisL1:this.shortAxisLength/2,h="number"==typeof this.shortAxisL2?this.shortAxisL2:this.shortAxisLength/2,g=new E(l.getX()+c*d,l.getY()+u*d),S=new E(l.getX()-c*h,l.getY()-u*h);i=new Co(g,S).getWorldLength(t),this.shortAxisCenter=l}}const o="number"==typeof i&&!Number.isNaN(i);let r;return null!==n&&(r={longAxis:{value:o?Math.max(n,i):n,unit:e.getLengthUnit()},shortAxis:{value:o?Math.min(n,i):null,unit:e.getLengthUnit()}}),r}static restorePropertiesFromQuantification(e,t,n){if("number"==typeof n.shortAxisLength&&(t.shortAxisLength=n.shortAxisLength),"number"==typeof n.shortAxisT&&(t.shortAxisT=n.shortAxisT),e.mathShape=t,"function"==typeof e.getFactory&&"function"==typeof e.getFactory().getShortAxisEndpoints){const n=e.getFactory(),[i,o]=n.getShortAxisEndpoints(e);if(i&&o){const n=t.getBegin(),r=t.getEnd(),a=(i.getX()+o.getX())/2,s=(i.getY()+o.getY())/2;e.mathShape.shortAxisCenter={x:a,y:s};const l=r.getX()-n.getX(),c=r.getY()-n.getY(),u=Math.sqrt(l*l+c*c);let d=.5;if(u>0){const e=l/u,t=c/u,i=a-n.getX(),o=s-n.getY();d=Math.max(0,Math.min(1,(i*e+o*t)/u))}e.mathShape.shortAxisT=d;const h=Math.sqrt(Math.pow(i.getX()-a,2)+Math.pow(i.getY()-s,2)),g=Math.sqrt(Math.pow(o.getX()-a,2)+Math.pow(o.getY()-s,2));e.mathShape.shortAxisL1=h,e.mathShape.shortAxisL2=g,e.mathShape.shortAxisLength=h+g}}}}const Mo="00480301",Uo="00700022",Qo="00700023",Vo="0070031A",No="POINT",Bo="MULTIPOINT",ko="POLYLINE",Go="CIRCLE",Ho="ELLIPSE";class zo{graphicData;graphicType;pixelOriginInterpretation;fiducialUID;toString(){return this.graphicType+" {"+this.graphicData+"}"}}function Yo(e){const t={};return void 0!==e.pixelOriginInterpretation&&(t.PixelOriginInterpretation=e.pixelOriginInterpretation),void 0!==e.graphicData&&(t.GraphicData=e.graphicData),void 0!==e.graphicType&&(t.GraphicType=e.graphicType),void 0!==e.fiducialUID&&(t.FiducialUID=e.fiducialUID),t}function Xo(e){const t=new zo;if(e instanceof E)t.graphicData=[e.getX().toString(),e.getY().toString()],t.graphicType=No;else if(e instanceof Co)t.graphicData=[e.getBegin().getX().toString(),e.getBegin().getY().toString(),e.getEnd().getX().toString(),e.getEnd().getY().toString()],t.graphicType=ko;else if(e instanceof Ao){t.graphicData=[];for(let n=0;n<3;++n)t.graphicData.push(e.getPoint(n).getX().toString()),t.graphicData.push(e.getPoint(n).getY().toString());t.graphicType=ko}else if(e instanceof Oo){t.graphicData=[];for(let n=0;n<e.getLength();++n)t.graphicData.push(e.getPoint(n).getX().toString()),t.graphicData.push(e.getPoint(n).getY().toString());const n=e.getPoint(0);t.graphicData.push(n.getX().toString()),t.graphicData.push(n.getY().toString()),t.graphicType=ko}else if(e instanceof bo){const n=e.getCenter(),i=new E(n.getX()+e.getRadius(),n.getY());t.graphicData=[n.getX().toString(),n.getY().toString(),i.getX().toString(),i.getY().toString()],t.graphicType=Go}else if(e instanceof xo){const n=e.getCenter(),i=e.getA(),o=e.getB();t.graphicData=[(n.getX()-i).toString(),n.getY().toString(),(n.getX()+i).toString(),n.getY().toString(),n.getX().toString(),(n.getY()-o).toString(),n.getX().toString(),(n.getY()+o).toString()],t.graphicType=Ho}else if(e instanceof Eo){const n=e.getBegin(),i=e.getEnd();t.graphicData=[n.getX().toString(),n.getY().toString(),n.getX().toString(),i.getY().toString(),i.getX().toString(),i.getY().toString(),i.getX().toString(),n.getY().toString(),n.getX().toString(),n.getY().toString()],t.graphicType=ko}else if(e instanceof qo){let n=0,i=0;const o=e.getBegin(),r=e.getEnd(),a=e.shortAxisCenter instanceof E?e.shortAxisCenter:e.getCentroid(),s=r.getX()-o.getX(),l=r.getY()-o.getY(),c=Math.sqrt(s*s+l*l);0!==c&&(n=-l/c,i=s/c);const u=e.shortAxisL1??e.shortAxisLength/2,d=e.shortAxisL2??e.shortAxisLength/2,h=new E(a.getX()+n*u,a.getY()+i*u),g=new E(a.getX()-n*d,a.getY()-i*d);t.graphicData=[o.getX().toString(),o.getY().toString(),r.getX().toString(),r.getY().toString(),h.getX().toString(),h.getY().toString(),g.getX().toString(),g.getY().toString()],t.graphicType=ko}return t}function Wo(e){if(void 0===e.graphicData)return;const t=e.graphicData.length;if(0===t)throw new Error("No coordinates in scoord data");if(t%2!=0)throw new Error("Expecting even number of coordinates in scoord data");const n=[];for(let i=0;i<t;i+=2)n.push(new E(parseFloat(e.graphicData[i]),parseFloat(e.graphicData[i+1])));let i=!1;const o=n.length;if(o>2){const e=n[0],t=n[o-1];i=e.equals(t)}let r;if(e.graphicType===No)n.length>1&&h.warn("Expecting 1 point for point, got "+o),r=n[0];else if(e.graphicType===Go){if(n.length<2)throw new Error("Expecting 2 points for circles, got "+o);n.length>2&&h.warn("Expecting 2 points for circles, got "+o);const e=n[0],t=n[1].getDistance(e);r=new bo(e,t)}else if(e.graphicType===Ho){if(n.length<4)throw new Error("Expecting 4 points for ellipses, got "+o);n.length>4&&h.warn("Expecting 4 points for ellipses, got "+o);const e=n[0].getDistance(n[1])/2,t=n[2].getDistance(n[3])/2,i=new E(n[0].getX()+e,n[0].getY());r=new xo(i,e,t)}else if(e.graphicType===ko)if(i)if(5===n.length){const e=new Co(n[0],n[1]),t=new Co(n[1],n[2]),i=new Co(n[2],n[3]),o=new Co(n[3],n[4]);r=To(e,t)&&To(t,i)&&To(i,o)?new Eo(n[0],n[2]):new Oo(n.slice(0,-1))}else r=new Oo(n.slice(0,-1));else if(2===n.length)r=new Co(n[0],n[1]);else if(3===n.length)r=new Ao([n[0],n[1],n[2]]);else if(4===n.length){const e=n[0],t=n[1],i=n[2],o=n[3];let a=.5;r=new qo(e,t);const s=(i.getX()+o.getX())/2,l=(i.getY()+o.getY())/2,c=i.getX()-s,u=i.getY()-l,d=s-o.getX(),h=l-o.getY(),g=Math.sqrt(c*c+u*u),S=Math.sqrt(d*d+h*h),p=g+S,m=t.getX()-e.getX(),f=t.getY()-e.getY(),v=Math.sqrt(m*m+f*f);let D=.5;if(v>0){const t=s-e.getX(),n=l-e.getY(),i=v*v;0!==i&&(a=(t*m+n*f)/i),D=Math.max(0,Math.min(1,a))}r.shortAxisLength=p,r.shortAxisT=D,r.shortAxisL1=g,r.shortAxisL2=S,r.shortAxisCenter=new E(s,l),r.hasShortAxisInteraction=!0}return r}const jo="00700022",Zo="00700023",_o="30060024",Ko="0070031A";class Jo{graphicData;graphicType;referencedFrameofReferenceUID;fiducialUID;toString(){return this.graphicType+" {"+this.graphicData+"}"}}function $o(e){const t={};return void 0!==e.graphicData&&(t.GraphicData=e.graphicData),void 0!==e.graphicType&&(t.GraphicType=e.graphicType),void 0!==e.referencedFrameofReferenceUID&&(t.ReferencedFrameofReferenceUID=e.referencedFrameofReferenceUID),void 0!==e.fiducialUID&&(t.FiducialUID=e.fiducialUID),t}const er={ReferencedSOPSequence:"00081199",RelationshipType:"0040A010",ValueType:"0040A040",ConceptNameCodeSequence:"0040A043",ConceptCodeSequence:"0040A168",ContentSequence:"0040A730",DateTime:"0040A120",Date:"0040A121",Time:"0040A122",UID:"0040A124",PersonName:"0040A123",TextValue:"0040A160",ContinuityOfContent:"0040A050",ContentTemplateSequence:"0040A504",MappingResource:"00080105",TemplateIdentifier:"0040DB00"},tr="CONTAINS",nr="HAS PROPERTIES",ir="HAS OBS CONTEXT",or="INFERRED FROM",rr="SELECTED FROM",ar="HAS CONCEPT MOD",sr="TEXT",lr="NUM",cr="CODE",ur="UIDREF",dr="COMPOSITE",hr="IMAGE",gr="SCOORD",Sr="SCOORD3D",pr="CONTAINER",mr="SEPARATE",fr={TEXT:"TextValue",DATE:"Date",TIME:"Time",DATETIME:"DateTime",UIDREF:"UID",PNAME:"PersonName",CONTAINER:"ContinuityOfContent"};function vr(e){let t;const n=Ne(e,er.ContentTemplateSequence);if(void 0!==n){const e=Ne(n,er.MappingResource),i=Ne(n,er.TemplateIdentifier);void 0!==e&&void 0!==i&&(t=e+"-"+i)}return t}class Dr{valueType;conceptNameCode;relationshipType;contentSequence=[];value;constructor(e){this.valueType=e}toString(e){void 0===e&&(e="");let t="";void 0!==this.relationshipType&&(t+="("+this.relationshipType+") "),t+=this.valueType+": ",void 0!==this.conceptNameCode&&(t+=this.conceptNameCode.toString()),t+=" = "+this.value.toString();for(const n of this.contentSequence)t+="\n"+e+"- "+n.toString(e+" ");return t}hasHeader(e,t,n){return this.valueType===e&&Rn(this.conceptNameCode,t)&&this.relationshipType===n}}function yr(e){let t=Ne(e,er.ValueType);void 0===t&&(t="");const n=new Dr(t);n.relationshipType=Ne(e,er.RelationshipType);const i=Ne(e,er.ConceptNameCodeSequence);if(void 0!==i&&(n.conceptNameCode=En(i)),t===cr)n.value=En(Ne(e,er.ConceptCodeSequence));else if(t===lr)n.value=function(e){const t=new lo;return void 0!==e[ao]&&(t.measuredValue=function(e){const t=new oo;return void 0!==e[$i]&&(t.numericValue=parseFloat(e[$i].value[0])),void 0!==e[eo]&&(t.floatingPointValue=parseFloat(e[eo].value[0])),void 0!==e[to]&&(t.rationalNumeratorValue=parseInt(e[to].value[0],10)),void 0!==e[no]&&(t.rationalDenominatorValue=parseInt(e[no].value[0],10)),void 0!==e[io]&&(t.measurementUnitsCode=En(e[io].value[0])),t}(e[ao].value[0])),void 0!==e[so]&&(t.numericValueQualifierCode=En(e[so].value[0])),t}(e);else if(t===hr)n.value=function(e){const t=new Do;return void 0!==e[mo]&&(t.referencedFrameNumber=e[mo].value[0]),void 0!==e[fo]&&(t.referencedSOPSequence=So(e[fo].value[0])),void 0!==e[vo]&&(t.referencedSegmentNumber=e[vo].value[0]),t}(e);else if(t===dr)n.value=So(Ne(e,er.ReferencedSOPSequence));else if(t===gr)n.value=function(e){const t=new zo;return void 0!==e[Uo]&&(t.graphicData=e[Uo].value),void 0!==e[Qo]&&(t.graphicType=e[Qo].value[0]),void 0!==e[Mo]&&(t.pixelOriginInterpretation=e[Mo].value[0]),void 0!==e[Vo]&&(t.fiducialUID=e[Vo].value[0]),t}(e);else if(t===Sr)n.value=function(e){const t=new Jo;return void 0!==e[jo]&&(t.graphicData=e[jo].value),void 0!==e[Zo]&&(t.graphicType=e[Zo].value[0]),void 0!==e[_o]&&(t.referencedFrameofReferenceUID=e[_o].value[0]),void 0!==e[Ko]&&(t.fiducialUID=e[Ko].value[0]),t}(e);else{const i=fr[t];void 0!==i?n.value=Ne(e,er[i]):console.warn("Unsupported input ValueType: "+t)}const o=Be(e,er.ContentSequence);if(void 0!==o)for(const e of o)n.contentSequence.push(yr(e));return n}function Cr(e){let t={};if(void 0!==e.relationshipType&&(t.RelationshipType=e.relationshipType),void 0!==e.valueType&&(t.ValueType=e.valueType),void 0!==e.conceptNameCode&&(t.ConceptNameCodeSequence={value:[Fn(e.conceptNameCode)]}),"CODE"===e.valueType)t.ConceptCodeSequence={value:[Fn(e.value)]};else if(e.valueType===lr)t={...t,...co(e.value)};else if(e.valueType===hr)t={...t,...yo(e.value)};else if(e.valueType===dr)t={...t,...po(e.value)};else if(e.valueType===gr)t={...t,...Yo(e.value)};else if(e.valueType===Sr)t={...t,...$o(e.value)};else{const n=fr[e.valueType];void 0!==n?t[n]=e.value:console.warn("Unsupported output ValueType: "+e.valueType)}if(0!==e.contentSequence.length){t.ContentSequence={value:[]};for(const n of e.contentSequence)t.ContentSequence.value.push(Cr(n))}return t}function Ir(e,t,n,i){const o=function(e){let t=e;"longAxis"===e?t="a":"shortAxis"===e&&(t="b");const n=ui[t];let i;return void 0!==n&&(i=si(n.key,n.scheme)),i}(e);if(void 0===o)return;let r=tr;void 0!==i&&(r=i);const a=new Dr(lr);a.relationshipType=r,a.conceptNameCode=o;const s=new oo;s.numericValue=t,s.measurementUnitsCode=hi(n);const l=new lo;return l.measuredValue=s,a.value=l,a}class Tr{#At;#ye;#Ot;#bt;#xt;constructor(e,t){this.#At=e,this.#ye=e.getRealSpacing(),this.#Ot=e.getOrientation(),this.#bt=t,this.#xt=function(e,t){let n=e.asOneAndZeros().multiply(t);return e.asOneAndZeros().getAbs().isSimilar(Dt().getAbs())&&(n=n.getAbs()),n}(this.#Ot,t)}getViewOrientation(){return this.#bt}getTargetOrientation(){return this.#xt}getOffset3DFromPlaneOffset(e){const t=new R(e.x,e.y,0),n=this.getTargetDeOrientedVector3D(t);return new R(n.getX()*this.#ye.get(0),n.getY()*this.#ye.get(1),n.getZ()*this.#ye.get(2))}getPlaneOffsetFromOffset3D(e){const t=new R(e.x/this.#ye.get(0),e.y/this.#ye.get(1),e.z/this.#ye.get(2)),n=this.getTargetOrientedVector3D(t);return{x:n.getX(),y:n.getY()}}getTargetOrientedVector3D(e){let t=e;return void 0!==this.#xt&&(t=this.#xt.getInverse().multiplyVector3D(e)),t}getTargetDeOrientedVector3D(e){let t=e;return void 0!==this.#xt&&(t=this.#xt.multiplyVector3D(e)),t}getTargetDeOrientedPoint3D(e){let t=e;return void 0!==this.#xt&&(t=this.#xt.multiplyPoint3D(e)),t}getImageOrientedVector3D(e){let t=e;if(void 0!==this.#bt){const n=vt([e.getX(),e.getY(),e.getZ()],this.#bt);t=new R(n[0],n[1],n[2])}return t}getImageOrientedPoint3D(e){let t=e;if(void 0!==this.#bt){const n=vt([e.getX(),e.getY(),e.getZ()],this.#bt);t=new F(n[0],n[1],n[2])}return t}getImageDeOrientedVector3D(e){let t=e;if(void 0!==this.#bt){const n=ft([e.getX(),e.getY(),e.getZ()],this.#bt);t=new R(n[0],n[1],n[2])}return t}getImageDeOrientedPoint3D(e){let t=e;if(void 0!==this.#bt){const n=ft([e.getX(),e.getY(),e.getZ()],this.#bt);t=new F(n[0],n[1],n[2])}return t}getPositionFromPlanePoint(e,t){const n=new F(e.getX(),e.getY(),t),i=this.getImageOrientedPoint3D(n);return this.#At.pointToWorld(i)}getPlanePointFromPosition(e){const t=this.#At.worldToPoint(e);return this.getImageDeOrientedPoint3D(t)}getCosines(){return[(e=this.#xt).get(0,0),e.get(1,0),e.get(2,0),e.get(0,1),e.get(1,1),e.get(2,1)];var e}getPlanePoints(e){const t=this.worldToIndex(e),n=this.indexToWorld(t),i=this.getPlanePointFromPosition(n),o=this.getPositionFromPlanePoint(new E(0,0),i.getZ()),r=this.#At.getOrigins(),a=r[o.getClosest(r)],s=o.getValues(),l=a.getValues(),c=this.getNativeScrollDimIndex();s[c]=l[c];const u=this.getCosines();return[new F(s[0],s[1],s[2]),new F(u[0],u[1],u[2]),new F(u[3],u[4],u[5])]}worldToIndex(e){return this.#At.worldToIndex(e)}indexToWorld(e){return this.#At.indexToWorld(e)}isAquisitionOrientation(){return N(this.#bt)}getTargetOrientedPositiveXYZ(e){const t=ft([e.x,e.y,e.z],this.#xt);return{x:t[0],y:t[1],z:t[2]}}getScrollDimIndex(){let e;return e=void 0!==this.#bt?this.#bt.getThirdColMajorDirection():2,e}getNativeScrollDimIndex(){let e;return e=void 0!==this.#Ot?this.#Ot.getThirdColMajorDirection():2,e}}class Lr{#oe;constructor(e){this.#oe=e}getCurrentPosition(){return this.#oe.getCurrentPosition()}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(n=this.#oe.setCurrentPosition(e,t)),n}}class wr{#Rt;#He;#V;#Et;constructor(e){this.#Rt=new Lr(e),this.#He=e.getImage().getGeometry(),this.#V=e.getCurrentPosition(),this.#Et=e.getScrollDimIndex()}getGeometry(){return this.#He}getScrollDimIndex(){return this.#Et}getMaximumDimValue(e){return this.#He.getSize().get(e)-1}getMaximumScrollValue(){return this.getMaximumDimValue(this.#Et)}getCurrentPosition(){return this.#He.getSize().normalisePoint(this.#Rt.getCurrentPosition(),this.#V)}getCurrentPositionDimValue(e){return this.getCurrentIndex().get(e)}getCurrentPositionScrollValue(){return this.getCurrentPositionDimValue(this.#Et)}getCurrentPositionAtDimValue(e,t){const n=this.getCurrentIndex().getValues();return n[e]=t,this.#He.indexToWorld(new o(n))}getCurrentPositionAtScrollValue(e){return this.getCurrentPositionAtDimValue(this.#Et,e)}getCurrentIndex(){return this.#He.worldToIndex(this.getCurrentPosition())}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(this.#V=this.#He.getSize().normalisePoint(e,this.#V),n=this.#Rt.setCurrentPosition(e,t)),n}setCurrentPositionSafe(e,t){let n=!1;return this.isPositionInBounds(e)&&(n=this.setCurrentPosition(e,t)),n}merge(e){if(this.#Et!==e.getScrollDimIndex())throw new Error("Cannot merge helper of a view with different orientation");this.#He=function(e,t){const n=e.getOrientation();if(!n.isSimilar(t.getOrientation(),M))throw new Error("Cannot merge geometries with different orientation");const i=n.getInverse(),o=function(e,t){return oe(e,t,Math.min)},r=function(e,t){return oe(e,t,Math.max)},a=new ct(o(e.getSpacing().getValues(),t.getSpacing().getValues())),s=function(e){return i.multiplyPoint3D(e.get3D())},l=e.getRange().map(s),c=t.getRange().map(s),u=o(l[0].getValues(),c[0].getValues()),d=r(l[1].getValues(),c[1].getValues());let h=[];for(let e=0;e<u.length;++e)h.push(Math.round(Math.abs(d[e]-u[e])/a.get(e)));const g=r(e.getSize().getValues(),t.getSize().getValues());h=h.concat(g.slice(3));const S=new lt(h),p=[];for(let e=0;e<S.get(2);++e){const t=u.slice();t[2]=u[2]+e*a.get(2);const i=new F(t[0],t[1],t[2]);p.push(n.multiplyPoint3D(i))}return new mt(p,S,a,n)}(this.#He,e.getGeometry()),this.#V=this.#He.getSize().normalisePoint(this.#V,e.getCurrentPosition())}isPositionInBounds(e){const t=this.#He.worldToIndex(e),n=[this.#Et];return 4===t.length()&&n.push(3),this.#He.isIndexInBounds(t,n)}getIncrementPosition(e){const t=this.getCurrentIndex().next(e);return this.#He.indexToWorld(t)}getDecrementPosition(e){const t=this.getCurrentIndex().previous(e);return this.#He.indexToWorld(t)}incrementPosition(e){return this.setCurrentPositionSafe(this.getIncrementPosition(e))}decrementPosition(e){return this.setCurrentPositionSafe(this.getDecrementPosition(e))}incrementPositionAlongScroll(){return this.incrementPosition(this.#Et)}decrementPositionAlongScroll(){return this.decrementPosition(this.#Et)}}class Pr{#oe;#Ft;#qt;constructor(e){if(void 0===e.getImage())throw new Error("View does not have an image, cannot setup controller");this.#oe=e,this.#Ft=new Tr(e.getImage().getGeometry(),e.getOrientation())}getPlaneHelper(){return this.#Ft}updatePlaneHelper(){this.#Ft=new Tr(this.#oe.getImage().getGeometry(),this.#oe.getOrientation())}isMask(){return this.#oe.isMask()}initialise(){this.resetWindowLevel(),this.resetPosition()}resetWindowLevel(){this.setWindowLevelPresetById(0)}resetPosition(){this.setCurrentPosition(this.getPositionFromPlanePoint(new E(0,0)))}getModality(){return this.#oe.getImage().getMeta().Modality}getSopClassUid(){return this.#oe.getImage().getMeta().SOPClassUID}getWindowLevelPresetsNames(){return this.#oe.getWindowPresetsNames()}addWindowLevelPresets(e){return this.#oe.addWindowPresets(e)}setWindowLevelPreset(e){this.#oe.setWindowLevelPreset(e)}setWindowLevelPresetById(e){this.#oe.setWindowLevelPresetById(e)}isPlaying(){return void 0!==this.#qt}getPositionHelper(){return new wr(this.#oe)}getCurrentPosition(){return this.#oe.getCurrentPosition()}getCurrentIndex(){return this.#oe.getCurrentIndex()}getCurrentImageUid(){return this.#oe.getCurrentImageUid()}getOriginForImageUid(e){return this.#oe.getOriginForImageUid(e)}includesImageUid(e){return this.#oe.includesImageUid(e)}getCurrentOrientedIndex(){let e=this.getCurrentIndex();if(void 0!==this.#oe.getOrientation()){const t=this.#Ft.getImageDeOrientedVector3D(new R(e.get(0),e.get(1),e.get(2)));e=new o([t.getX(),t.getY(),t.getZ()])}return e}getScrollDimIndex(){return this.#oe.getScrollDimIndex()}getCurrentIndexScrollValue(){return this.getCurrentIndex().get(this.#oe.getScrollDimIndex())}getOrigin(e){return this.#oe.getOrigin(e)}isAquisitionOrientation(){return this.#oe.isAquisitionOrientation()}getPlanePoints(e){return this.#Ft.getPlanePoints(e)}getCurrentScrollPosition(){const e=this.#oe.getScrollDimIndex();return this.#oe.getCurrentPosition().get(e)}generateImageData(e,t){this.#oe.generateImageData(e,t)}setImage(e){const t=this.#oe.getImage().getGeometry(),n=e.getGeometry();this.#oe.setImage(e),t.equals(n)||this.updatePlaneHelper()}get2DSpacing(){return this.#oe.getImage().getGeometry().getSpacing(this.#oe.getOrientation()).get2D()}getRescaledImageValue(e){const t=this.#oe.getImage();if(!t.canQuantify())return;const n=t.getGeometry(),i=n.worldToIndex(e);let o;return n.isIndexInBounds(i)&&(o=t.getRescaledValueAtIndex(i)),o}getPixelUnit(){return this.#oe.getImage().getMeta().pixelUnit}getLengthUnit(){return this.#oe.getImage().getMeta().lengthUnit}#Mt(e,t,n,i){const o=k(G(e,t,n,i)),r=e.getGeometry().getSize(i).getValues();r[2]=1;const a=new lt(r),s=e.getGeometry().getSpacing(i).getValues();s[2]=1;const l=new ct(s),c=new F(0,0,0),u=new mt([c],a,l);return new _i(u,o)}getImageRegionValues(e,t,n){let i=this.#oe.getImage();const r=this.#oe.getOrientation();let a=n,s=!0;N(r)||(i=this.#Mt(i,a,s,r),a=new o([0,0,0]),s=!1);const l=function(e,t,n,i,o){if(1!==e.getNumberOfComponents())throw new Error("Unsupported number of components for region iterator: "+e.getNumberOfComponents());let r;void 0===n&&(n=!1),r=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const a=e.getGeometry().getSize();void 0===i&&(i=new E(0,0)),void 0===o&&(o=new E(a.get(0)-1,a.get(1)));const s=a.indexToOffset(t.getWithNew2D(i.getX(),i.getY())),l=a.indexToOffset(t.getWithNew2D(o.getX(),o.getY()-1)),c=Math.max(1,o.getX()-i.getX());return function(e,t,n,i,o,r){let a=t,s=0;return{next:function(){if(a<n){const t={value:e(a),done:!1,index:a};return s+=1,a+=1,s===o&&(s=0,a+=r),t}return{done:!0,index:n}}}}(r,s,l+1,0,c,a.get(0)-c)}(i,a,s,e,t);let c=[];return l&&(c=k(l)),c}getImageVariableRegionValues(e,t){let n=this.#oe.getImage();const i=this.#oe.getOrientation();let r=t,a=!0;N(i)||(n=this.#Mt(n,r,a,i),r=new o([0,0,0]),a=!1);const s=function(e,t,n,i){if(1!==e.getNumberOfComponents())throw new Error("Unsupported number of components for region iterator: "+e.getNumberOfComponents());let o;void 0===n&&(n=!1),o=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const r=e.getGeometry().getSize(),a=[];let s,l=null,c=null,u=null;for(let e=0;e<i.length;++e){s=i[e];const t=s[1][0]-s[0][0];0!==t&&(u=e,l||(l=s[0]),a.push([s[0][0],t,r.get(0)-s[1][0]]))}if(null!==u&&(c=i[u][1]),0!==a.length)return function(e,t,n,i,o){let r=t,a=0,s=0;return{next:function(){if(r<n){const t={value:e(r),done:!1,index:r};return s+=1,r+=1,s===o[a][1]&&(s=0,r+=o[a][2],a+=1,a<o.length&&(r+=o[a][0])),t}return{done:!0,index:n}}}}(o,r.indexToOffset(t.getWithNew2D(l[0],l[1])),r.indexToOffset(t.getWithNew2D(c[0],c[1]))+1,0,a)}(n,r,a,e);let l=[];return s&&(l=k(s)),l}canQuantifyImage(){return this.#oe.getImage().canQuantify()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return this.#oe.getImage().isMonochrome()}canScroll(){return this.#oe.getImage().canScroll(this.#oe.getOrientation())}getImageSize(){return this.#oe.getImage().getGeometry().getSize(this.#oe.getOrientation())}getImageSpacing(){return this.#oe.getImage().getGeometry().getSpacing(this.#oe.getOrientation())}moreThanOne(e){return this.getImageSize().moreThanOne(e)}getImageWorldSize(){const e=this.#oe.getImage().getGeometry(),t=e.getSize(this.#oe.getOrientation()).get2D(),n=e.getSpacing(this.#oe.getOrientation()).get2D();return{x:t.x*n.x,y:t.y*n.y}}getImageRescaledDataRange(){return this.#oe.getImage().getRescaledDataRange()}equalImageMeta(e){const t=this.#oe.getImage().getMeta(),n=Object.keys(e);for(let i=0;i<n.length;++i){const o=n[i];if(void 0===t[o])return!1;if(t[o]!==e[o])return!1}return!0}isPositionInBounds(e){return this.#oe.isPositionInBounds(e)}setCurrentPosition(e,t){return this.#oe.setCurrentPosition(e,t)}getPositionFromPlanePoint(e,t){void 0===t&&(t=this.getCurrentIndexScrollValue());const n=new F(e.getX(),e.getY(),t),i=this.#Ft.getImageOrientedPoint3D(n),o=this.#oe.getImage().getGeometry().pointToWorld(i);return this.getCurrentPosition().mergeWith3D(o)}validatePlanePoint(e){const t=this.getPositionFromPlanePoint(e);return this.#oe.getImage().getGeometry().isInBounds(t)}getPlanePositionFromPosition(e){const t=this.#oe.getImage().getGeometry().worldToPoint(e),n=this.#Ft.getImageDeOrientedPoint3D(t);return new E(n.getX(),n.getY())}getIndexFromPosition(e){return this.#oe.getImage().getGeometry().worldToIndex(e)}setCurrentIndex(e,t){return this.#oe.setCurrentIndex(e,t)}getPlanePositionFromPlanePoint(e){const t=this.getCurrentIndexScrollValue(),n=new F(e.getX(),e.getY(),t),i=this.#Ft.getTargetDeOrientedPoint3D(n),o=this.#oe.getImage().getGeometry().getRealSpacing();return new F(i.getX()*o.get(0),i.getY()*o.get(1),i.getZ()*o.get(2))}getOffset3DFromPlaneOffset(e){return this.#Ft.getOffset3DFromPlaneOffset(e)}play(){if(this.canScroll())if(void 0===this.#qt){const e=this.#oe.getImage(),t=e.getMeta().RecommendedDisplayFrameRate,n=this.#oe.getPlaybackMilliseconds(t),i=e.getGeometry().getSize().canScroll3D(),r=this.getPositionHelper();this.#qt=window.setInterval((()=>{let e;if(e=i?r.incrementPositionAlongScroll():r.incrementPosition(3),!e){const e=this.getCurrentIndex().getValues(),t=this.#oe.getOrientation();i?e[t.getThirdColMajorDirection()]=0:e[3]=0;const n=new o(e),r=this.#oe.getImage().getGeometry();this.setCurrentPosition(r.indexToWorld(n))}}),n)}else this.stop()}stop(){void 0!==this.#qt&&(clearInterval(this.#qt),this.#qt=void 0)}getWindowLevel(){return this.#oe.getWindowLevel()}getCurrentWindowPresetName(){return this.#oe.getCurrentWindowPresetName()}setWindowLevel(e){this.#oe.setWindowLevel(e)}getColourMap(){return this.#oe.getColourMap()}setColourMap(e){this.#oe.setColourMap(e)}setViewAlphaFunction(e){this.#oe.setAlphaFunction(e)}setMaskViewHelper(e){this.#oe.setMaskViewHelper(e)}getFillOpacity(){return this.#oe.getFillOpacity()}setFillOpacity(e){this.#oe.setFillOpacity(e)}getContourThickness(){return this.#oe.getContourThickness()}setContourThickness(e){this.#oe.setContourThickness(e)}bindImageAndLayer(e){const t=this.#oe.getImage();t.addEventListener("imagecontentchange",e.onimagecontentchange),t.addEventListener("imagegeometrychange",e.onimagegeometrychange),t.addEventListener("imageresampled",e.onimageresampled)}unbindImageAndLayer(e){const t=this.#oe.getImage();t.removeEventListener("imagecontentchange",e.onimagecontentchange),t.removeEventListener("imagegeometrychange",e.onimagegeometrychange),t.removeEventListener("imageresampled",e.onimageresampled)}}const Ar=["mousedown","mousemove","mouseup","mouseout","wheel","dblclick","touchstart","touchmove","touchend"];function Or(e){let t=0,n=0;if(0!==e.length&&void 0!==e[0].target){let i=e[0].target.offsetParent;for(;i;)isNaN(i.offsetLeft)||(t+=i.offsetLeft),isNaN(i.offsetTop)||(n+=i.offsetTop),i=i.offsetParent}else h.debug("No touch target offset parent.");const i=[];for(let o=0;o<e.length;++o)i.push(new E(e[o].pageX-t,e[o].pageY-n));return i}function br(e){let t=[];return void 0!==e.targetTouches&&0!==e.targetTouches.length?t=Or(e.targetTouches):void 0!==e.changedTouches&&0!==e.changedTouches.length&&(t=Or(e.changedTouches)),t}function xr(e){return new E(e.offsetX,e.offsetY)}function Rr(e,t){const n=document.createElement("canvas");n.width=e,n.height=t;const i=document.createElement("canvas");i.width=1,i.height=1;const o=n.getContext("2d"),r=i.getContext("2d");return o&&(o.fillRect(e-1,t-1,1,1),r.drawImage(n,e-1,t-1,1,1,0,0,1,1)),r&&0!==r.getImageData(0,0,1,1).data[3]}class Er{#Ut;#Qt=null;#Vt=null;#Nt=null;#Bt=null;#kt=!0;#Gt=null;#Ht;#zt;#Yt=1;#Xt={x:1,y:1};#Wt={x:1,y:1};#jt={x:1,y:1,z:1};#Zt={x:1,y:1};#_t=1;#Kt={x:1,y:1};#Jt={x:0,y:0};#$t={x:0,y:0};#en={x:0,y:0};#tn={x:0,y:0};#nn={x:0,y:0};#in={x:0,y:0};#on=null;#rn;#X=new z;#an=!1;#sn;#ln;constructor(e){this.#Ut=e,this.#Ut.className+=" viewLayer"}getDataId(){return this.#rn}getScale(){return this.#Xt}getAbsoluteZoomOffset(){return{x:this.#tn.x*this.#Wt.x,y:this.#tn.y*this.#Wt.y}}setImageSmoothing(e){this.#an=e}setView(e,t){this.#rn=t,e.addEventListener("wlchange",this.#cn),e.addEventListener("colourmapchange",this.#un),e.addEventListener("positionchange",this.#dn),e.addEventListener("alphafuncchange",this.#hn),e.addEventListener("maskviewchange",this.#gn);for(const t of W)e.addEventListener(t,this.#j);this.#Qt=new Pr(e),this.bindImage()}getViewController(){return this.#Qt}getImageData(){return this.#Gt}onimageset=e=>{this.#rn===e.dataid&&(this.#Qt.setImage(e.value[0]),this.#Sn(this.#Qt.getImageSize().get2D()),this.#on=!0)};bindImage(){this.#Qt&&this.#Qt.bindImageAndLayer(this)}unbindImage(){this.#Qt&&this.#Qt.unbindImageAndLayer(this)}onimagecontentchange=e=>{this.#rn===e.dataid&&(this.#kt=this.#Qt.isPositionInBounds(),this.#on=!0,this.draw())};onimagegeometrychange=e=>{if(this.#rn===e.dataid){const e=this.#Qt.getImageSize().get2D(),t=this.#Qt.getImageSpacing().get2D(),n=this.#Ht.x!==e.x||this.#Ht.y!==e.y,i=this.#zt.x!==t.x||this.#zt.y!==t.y;if(i&&(this.#Qt.updatePlaneHelper(),this.#pn(t)),n){if(void 0!==this.#sn&&void 0!==this.#ln){const e=this.#Qt.getOrigin(),t=this.#ln.minus(e),n=this.#Qt.getOrigin(this.#Qt.getCurrentPosition());if(void 0!==n){const e=this.#sn.minus(n);this.setBaseOffset(t,e)}}this.#Sn(e)}(i||n)&&(this.#on=!0,this.draw())}};onimageresampled=e=>{const t=this.#Qt.getCurrentIndex().get(3),n=void 0===t||t===e.frame;this.#rn===e.dataid&&n&&(this.#on=!0,this.draw())};getId(){return this.#Ut.id}removeFromDOM(){this.#Ut.remove()}getBaseSize(){return this.#Ht}getImageWorldSize(){return this.#Qt.getImageWorldSize()}getOpacity(){return this.#Yt}setOpacity(e){if(e===this.#Yt)return;this.#Yt=Math.min(Math.max(e,0),1);const t={type:"opacitychange",value:[this.#Yt]};this.#j(t)}getFillOpacity(){return this.#Qt.getFillOpacity()}setFillOpacity(e){this.#Qt.setFillOpacity(e)}getContourThickness(){return this.#Qt.getContourThickness()}setContourThickness(e){this.#Qt.setContourThickness(e)}addFlipOffsetX(){this.#in.x+=this.#Vt.width/this.#Xt.x,this.#Jt.x+=this.#in.x}addFlipOffsetY(){this.#in.y+=this.#Vt.height/this.#Xt.y,this.#Jt.y+=this.#in.y}flipScaleX(){this.#jt.x*=-1}flipScaleY(){this.#jt.y*=-1}flipScaleZ(){this.#jt.z*=-1}setScale(e,t){const n=this.#Qt.getPlaneHelper(),i=n.getTargetOrientedPositiveXYZ({x:e.x*this.#jt.x,y:e.y*this.#jt.y,z:e.z*this.#jt.z}),o={x:this.#Wt.x*i.x,y:this.#Wt.y*i.y};if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:this.#Jt.x-this.#tn.x,y:this.#Jt.y-this.#tn.y};this.#tn={x:0,y:0},this.#Jt=e}else if(void 0!==t){let e=n.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#$t.x,y:e.y+this.#$t.y};const i=na(this.#Jt,this.#Xt,o,e),r={x:this.#tn.x+i.x-this.#Jt.x,y:this.#tn.y+i.y-this.#Jt.y};this.#tn=r,this.#Jt=i}this.#Xt=o}initScale(e,t){const n=this.#Qt.getPlaneHelper().getTargetOrientedPositiveXYZ({x:e.x*this.#jt.x,y:e.y*this.#jt.y,z:e.z*this.#jt.z}),i={x:this.#Wt.x*n.x,y:this.#Wt.y*n.y};this.#Xt=i,this.#tn={x:t.x/this.#Wt.x,y:t.y/this.#Wt.y},this.#Jt={x:this.#Jt.x+this.#tn.x,y:this.#Jt.y+this.#tn.y}}setBaseOffset(e,t,n,i){const o=this.#Qt.getPlaneHelper(),r=o.getNativeScrollDimIndex(),a=o.getPlaneOffsetFromOffset3D({x:0===r?e.getX():t.getX(),y:1===r?e.getY():t.getY(),z:2===r?e.getZ():t.getZ()}),s=this.#$t.x!==a.x||this.#$t.y!==a.y;return void 0!==n&&void 0!==i&&(this.#sn=n,this.#ln=i),s&&(this.#Jt={x:this.#Jt.x-this.#$t.x+a.x,y:this.#Jt.y-this.#$t.y+a.y},this.#$t=a),s}setOffset(e){const t=this.#Qt.getPlaneHelper().getPlaneOffsetFromOffset3D(e);this.#Jt={x:this.#Jt.x-this.#nn.x+t.x,y:this.#Jt.y-this.#nn.y+t.y},this.#nn=t}displayToPlaneIndex(e){const t=this.displayToPlanePos(e);return new o([Math.floor(t.getX()),Math.floor(t.getY())])}displayToPlaneScale(e){return new E(e.getX()/this.#Xt.x,e.getY()/this.#Xt.y)}displayToPlanePos(e){const t=this.displayToPlaneScale(e);return new E(t.getX()+this.#Jt.x,t.getY()+this.#Jt.y)}planePosToDisplay(e){let t=(e.getX()-this.#Jt.x+this.#$t.x)*this.#Xt.x,n=(e.getY()-this.#Jt.y+this.#$t.y)*this.#Xt.y;return(t<0||t>=this.#Vt.width)&&(t=void 0),(n<0||n>=this.#Vt.height)&&(n=void 0),new E(t,n)}displayToMainPlanePos(e){const t=this.displayToPlanePos(e);return new E(t.getX()-this.#$t.x,t.getY()-this.#$t.y)}display(e){this.#Ut.style.display=e?"":"none"}isVisible(){return""===this.#Ut.style.display}draw(){if(!this.#kt)return;let e={type:"renderstart",layerid:this.getId(),dataid:this.getDataId()};this.#j(e),this.#on&&this.#mn(),this.#Bt.globalAlpha=this.#Yt,this.clear(),this.#Bt.setTransform(this.#Xt.x,0,0,this.#Xt.y,-1*this.#Jt.x*this.#Xt.x,-1*this.#Jt.y*this.#Xt.y),this.#Bt.imageSmoothingEnabled=this.#an,this.#Bt.drawImage(this.#Nt,0,0),e={type:"renderend",layerid:this.getId(),dataid:this.getDataId()},this.#j(e)}initialise(e,t,n){this.#zt=t,this.#Yt=Math.min(Math.max(n,0),1),this.#Vt=document.createElement("canvas"),this.#Ut.appendChild(this.#Vt),this.#Vt.getContext?(this.#Bt=this.#Vt.getContext("2d"),this.#Bt?(this.#Nt=document.createElement("canvas"),this.#Sn(e),this.#on=!0):alert("Error: failed to get the 2D context.")):alert("Error: no canvas.getContext method.")}#Sn(e){if(!Rr(e.x,e.y))throw new Error("Cannot create canvas with size "+e.x+", "+e.y);this.#Ht=e,this.#Nt.width=this.#Ht.x,this.#Nt.height=this.#Ht.y,this.#Bt.clearRect(0,0,this.#Ht.x,this.#Ht.y),this.#Gt=this.#Bt.createImageData(this.#Ht.x,this.#Ht.y)}#pn(e){this.#zt=e,this.fitToContainer(this.#Zt,this.#_t,this.#Kt)}fitToContainer(e,t,n){let i=!1;const o={x:t*this.#zt.x,y:t*this.#zt.y},r=o.x/this.#Wt.x,a=o.y/this.#Wt.y,s=e.x/(this.#Vt.width*r),l=e.y/(this.#Vt.height*a);if(this.#Vt.width!==e.x||this.#Vt.height!==e.y){if(!Rr(e.x,e.y))throw new Error("Cannot resize canvas "+e.x+", "+e.y);this.#Vt.width=e.x,this.#Vt.height=e.y,i=!0}const c={x:this.#Xt.x*r,y:this.#Xt.y*a};this.#Xt.x===c.x&&this.#Xt.y===c.y||(this.#Wt=o,this.#Xt=c,i=!0);const u={x:n.x/o.x,y:n.y/o.y},d={x:e.x/o.x,y:e.y/o.y},h={x:0!==this.#in.x?d.x:0,y:0!==this.#in.y?d.y:0};if(this.#en.x!==u.x||this.#en.y!==u.y||this.#in.x!==h.x||this.#in.y!==h.y){const e={x:this.#tn.x*s,y:this.#tn.y*l};this.#Jt={x:this.#Jt.x+u.x-this.#en.x+h.x-this.#in.x+e.x-this.#tn.x,y:this.#Jt.y+u.y-this.#en.y+h.y-this.#in.y+e.y-this.#tn.y},this.#in=h,this.#en=u,this.#tn=e,i=!0}this.#Zt=e,this.#_t=t,this.#Kt=n,i&&this.draw()}bindInteraction(){this.#Ut.style.pointerEvents="auto";const e=Ar;for(let t=0;t<e.length;++t){const n=e[t],i="wheel"!==n;this.#Ut.addEventListener(n,this.#j,{passive:i})}}unbindInteraction(){this.#Ut.style.pointerEvents="none";const e=Ar;for(let t=0;t<e.length;++t)this.#Ut.removeEventListener(e[t],this.#j)}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{e.srclayerid=this.getId(),e.dataid=this.#rn,this.#X.fireEvent(e)};#mn(){this.#Qt.generateImageData(this.#Gt),this.#Nt.getContext("2d").putImageData(this.#Gt,0,0),this.#on=!1}#cn=e=>{void 0!==e.skipGenerate&&!0===e.skipGenerate||(this.#on=!0,this.draw())};#un=e=>{void 0!==e.skipGenerate&&!0===e.skipGenerate||(this.#on=!0,this.draw())};#dn=e=>{if(void 0===e.skipGenerate||!0!==e.skipGenerate){let t=!0;if(void 0!==e.valid&&(t=e.valid),t){const t=[0,1,2],n=t.indexOf(this.#Qt.getScrollDimIndex());t.splice(n,1),0===e.diffDims.filter((function(e){return-1===t.indexOf(e)})).length&&this.#kt||(this.#kt=!0,this.#on=!0,this.draw())}else this.#kt&&(this.#kt=!1,this.clear())}};isValidPosition(){return this.#kt}#hn=e=>{void 0!==e.skipGenerate&&!0===e.skipGenerate||(this.#on=!0,this.draw())};#gn=e=>{void 0!==e.skipGenerate&&!0===e.skipGenerate||(this.#on=!0,this.draw())};setCurrentPosition(e,t){return this.#Qt.setCurrentPosition(e)}clear(){this.#Bt.save(),this.#Bt.setTransform(1,0,0,1,0,0),this.#Bt.clearRect(0,0,this.#Vt.width,this.#Vt.height),this.#Bt.restore()}}class Fr{getName(){return""}execute(){}undo(){}}class qr extends EventTarget{#fn=[];#vn=0;getStackSize(){return this.#fn.length}getCurrentStackIndex(){return this.#vn}getCurrentCommand(){return this.#fn[this.#vn-1]}add(e){this.#fn=this.#fn.slice(0,this.#vn),this.#fn.push(e),++this.#vn,this.dispatchEvent(new Event("undoadd"))}remove(e){let t=!1;const n=this.#fn.findIndex((function(t){return t.getName()===e}));return-1!==n&&(t=!0,this.dispatchEvent(new CustomEvent("undoremove",{detail:{commandName:e}})),this.#fn.splice(n,1),--this.#vn),t}undo(){this.#vn>0&&(this.dispatchEvent(new Event("undo")),--this.#vn,this.#fn[this.#vn].undo())}redo(){this.#vn<this.#fn.length&&(this.#fn[this.#vn].execute(),++this.#vn,this.dispatchEvent(new Event("redo")))}}class Mr extends Fr{#Dn;#yn;constructor(e,t){super(),this.#Dn=e,this.#yn=t}getName(){return"AddAnnotation-"+this.#Dn.trackingUid}execute(){this.#yn.addAnnotation(this.#Dn)}undo(){this.#yn.removeAnnotation(this.#Dn.trackingUid)}}class Ur extends Fr{#Dn;#yn;constructor(e,t){super(),this.#Dn=e,this.#yn=t}getName(){return"RemoveAnnotation-"+this.#Dn.trackingUid}execute(){this.#yn.removeAnnotation(this.#Dn.trackingUid)}undo(){this.#yn.addAnnotation(this.#Dn)}}class Qr extends Fr{#Dn;#yn;#Cn;#In;constructor(e,t,n,i){super(),this.#Dn=e,this.#yn=i,this.#Cn=t,this.#In=n}getName(){return"UpdateAnnotation-"+this.#Dn.trackingUid}execute(){const e=Object.keys(this.#In);for(const t of e)this.#Dn[t]=this.#In[t];this.#yn.updateAnnotation(this.#Dn,e)}undo(){const e=Object.keys(this.#Cn);for(const t of e)this.#Dn[t]=this.#Cn[t];this.#yn.updateAnnotation(this.#Dn,e)}}class Vr{#Tn;getAnnotation(e){return this.#Tn.find(e)}getAnnotationGroup(){return this.#Tn}isAnnotationGroupEditable(){return this.#Tn.isEditable()}setAnnotationGroupEditable(e){this.#Tn.setEditable(e)}addAnnotation(e){this.#Tn.add(e)}updateAnnotation(e,t,n){this.#Tn.update(e,t,n)}removeAnnotation(e){this.#Tn.remove(e)}removeAnnotationWithCommand(e,t){const n=this.getAnnotation(e);if(void 0===n)return void h.warn("Cannot create remove command for undefined annotation: "+e);const i=new Ur(n,this);t(i),i.execute()}updateAnnotationWithCommand(e,t,n,i){const o=this.getAnnotation(e);if(void 0===o)return void h.warn("Cannot create update command for undefined annotation: "+e);const r=new Qr(o,t,n,this);i(r),r.execute()}removeAllAnnotationsWithCommand(e){for(const t of this.#Tn.getList())this.removeAnnotationWithCommand(t.trackingUid,e)}constructor(e){this.#Tn=void 0!==e?e:new Ji}hasAnnotationMeta(e){return this.#Tn.hasMeta(e)}setAnnotationMeta(e,t){this.#Tn.setMetaValue(e,t)}}const Nr={arrow:{"*":""},circle:{"*":"{surface}"},ellipse:{"*":"{surface}"},protractor:{"*":"{angle}"},rectangle:{"*":"{surface}"},roi:{"*":""},ruler:{"*":"{length}"},bidimensional:{"*":"{longAxis} x {shortAxis}"},bidimensionalDrawing:{"*":"{longAxis}"}};function Br(e){return"label"===e.name()}function kr(e){return"shape"===e.name()}function Gr(e){return"position-group"===e.name()}function Hr(t){const n=t.getChildren(kr)[0];if(n instanceof e.Line)return n}function zr(t,n){const i=t.getChildren((function(e){return e.id()==="anchor"+n}))[0];if(i instanceof e.Ellipse)return i}function Yr(e){return function(t){return t.id()===e}}function Xr(t,n,i,o){const r=o.applyZoomScale(6),a={x:Math.abs(r.x),y:Math.abs(r.y)};return new e.Ellipse({x:t,y:n,stroke:"#999",fill:"rgba(100,100,100,0.7",strokeWidth:o.getStrokeWidth(),strokeScaleEnabled:!1,radius:a,radiusX:a.x,radiusY:a.y,name:"anchor",id:i.toString(),dragOnTop:!1,draggable:!0,visible:!1})}function Wr(e){return parseInt(e.substring(6),10)}class jr{#Ln=10;#wn="Verdana";#Pn="#fff";#An="#ffff80";#On={x:1,y:1};#bn={x:1,y:1};#xn=2;#Rn={x:.25,y:.25};#En=.2;#Fn=3;getFontFamily(){return this.#wn}getFontSize(){return this.#Ln}getStrokeWidth(){return this.#xn}getTextColour(){return this.#Pn}getLineColour(){return this.#An}setLineColour(e){this.#An=e}setBaseScale(e){this.#On=e}setZoomScale(e){this.#bn=e}getBaseScale(){return this.#On}getZoomScale(){return this.#bn}scale(e){return e/this.#On.x}applyZoomScale(e){return{x:e/this.#bn.x,y:e/this.#bn.y}}applyZoomRatio(e){return e*this.#bn.x/this.#bn.y}getShadowOffset(){return this.#Rn}getTagOpacity(){return this.#En}getTextPadding(){return this.#Fn}getFontStr(){return"normal "+this.getFontSize()+"px sans-serif"}getLineHeight(){return this.getFontSize()+this.getFontSize()/5}getScaledFontSize(){return this.scale(this.getFontSize())}getScaledStrokeWidth(){return this.scale(this.getStrokeWidth())}getShadowLineColour(){return function(e){return.001172549*(t=I(e)).r+.002301961*t.g+447059e-9*t.b<.5;var t}(this.getLineColour())?"#fff":"#000"}}class Zr{#Ut;#qn=null;#Ht;#zt;#Wt={x:1,y:1};#jt={x:1,y:1,z:1};#$t={x:0,y:0};#en={x:0,y:0};#tn={x:0,y:0};#nn={x:0,y:0};#in={x:0,y:0};#yn;#Ft;#rn;#Mn;#Un;#Qn;#Vn=!0;constructor(e){this.#Ut=e,this.#Ut.className+=" drawLayer"}setShapeHandler(e){this.#Qn=e}getDataId(){return this.#rn}getReferenceLayerId(){return this.#Mn}#X=new z;getKonvaStage(){return this.#qn}getKonvaLayer(){return this.#qn.getLayers()[0]}getDrawController(){return this.#yn}setPlaneHelper(e){this.#Ft=e}getId(){return this.#Ut.id}removeFromDOM(){this.#Ut.remove()}getBaseSize(){return this.#Ht}getOpacity(){return this.#qn.opacity()}setOpacity(e){this.#qn.opacity(Math.min(Math.max(e,0),1))}addFlipOffsetX(){const e=this.#qn.scale(),t=this.#qn.size();this.#in.x+=t.width/e.x;const n=this.#qn.offset();n.x+=this.#in.x,this.#qn.offset(n)}addFlipOffsetY(){const e=this.#qn.scale(),t=this.#qn.size();this.#in.y+=t.height/e.y;const n=this.#qn.offset();n.y+=this.#in.y,this.#qn.offset(n)}flipScaleX(){this.#jt.x*=-1}flipScaleY(){this.#jt.y*=-1}flipScaleZ(){this.#jt.z*=-1}setScale(e,t){const n=this.#Ft.getTargetOrientedPositiveXYZ({x:e.x*this.#jt.x,y:e.y*this.#jt.y,z:e.z*this.#jt.z}),i={x:this.#Wt.x*n.x,y:this.#Wt.y*n.y},o=this.#qn.offset();if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:o.x-this.#tn.x,y:o.y-this.#tn.y};this.#tn={x:0,y:0},this.#qn.offset(e)}else if(void 0!==t){let e=this.#Ft.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#$t.x,y:e.y+this.#$t.y};const n=na(o,this.#qn.scale(),i,e),r={x:this.#tn.x+n.x-o.x,y:this.#tn.y+n.y-o.y};this.#tn=r,this.#qn.offset(n)}this.#qn.scale(i),this.#Nn(i)}initScale(e,t){const n=this.#Ft.getTargetOrientedPositiveXYZ({x:e.x*this.#jt.x,y:e.y*this.#jt.y,z:e.z*this.#jt.z}),i={x:this.#Wt.x*n.x,y:this.#Wt.y*n.y};this.#qn.scale(i),this.#tn={x:t.x/this.#Wt.x,y:t.y/this.#Wt.y};const o=this.#qn.offset();this.#qn.offset({x:o.x+this.#tn.x,y:o.y+this.#tn.y})}setOffset(e){const t=this.#Ft.getPlaneOffsetFromOffset3D(e),n=this.#qn.offset();this.#qn.offset({x:n.x-this.#nn.x+t.x,y:n.y-this.#nn.y+t.y}),this.#nn=t}setBaseOffset(e,t){const n=this.#Ft.getNativeScrollDimIndex(),i=this.#Ft.getPlaneOffsetFromOffset3D({x:0===n?e.getX():t.getX(),y:1===n?e.getY():t.getY(),z:2===n?e.getZ():t.getZ()}),o=this.#$t.x!==i.x||this.#$t.y!==i.y;if(o){const e=this.#qn.offset();this.#qn.offset({x:e.x-this.#$t.x+i.x,y:e.y-this.#$t.y+i.y}),this.#$t=i}return o}display(e){this.#Ut.style.display=e?"":"none"}isVisible(){return""===this.#Ut.style.display}draw(){this.#qn.draw()}initialise(t,n,i){this.#Ht=t,this.#zt=n,this.#Mn=i,this.#qn=new e.Stage({container:this.#Ut,width:this.#Ht.x,height:this.#Ht.y,listening:!1}),this.#qn.getContent().setAttribute("style","");const o=new e.Layer({listening:!1,visible:!0});this.#qn.add(o)}setAnnotationGroup(e,t,n){if(this.#rn=t,e.addEventListener("annotationadd",(e=>{this.#Bn(e.data,!0),this.getKonvaLayer().draw()})),e.addEventListener("annotationupdate",(e=>{this.#kn(e.data),this.getKonvaLayer().draw()})),e.addEventListener("annotationremove",(e=>{this.#Gn(e.data),this.getKonvaLayer().draw()})),e.addEventListener("annotationgroupeditablechange",(e=>{this.activateCurrentPositionShapes(e.data)})),this.#yn=new Vr(e),0!==e.getLength())for(const t of e.getList())this.#Bn(t,!1),n(new Mr(t,this.getDrawController()))}activateCurrentPositionShapes(t){const n=this.getKonvaLayer();if(this.#qn.listening(!1),void 0!==this.#Qn){this.#Qn.disableAndResetEditor();const t=n.getChildren();for(const n of t)n instanceof e.Group&&n.getChildren().forEach((t=>{t instanceof e.Group&&this.#Qn.removeShapeListeners(t)}))}const i=this.getDrawController();if(t&&i.getAnnotationGroup().isEditable()){this.#qn.listening(!0);const t=this.#Hn().getChildren();0!==t.length&&n.listening(!0),void 0!==this.#Qn&&t.forEach((t=>{if(t instanceof e.Group){const e=i.getAnnotation(t.id());this.#Qn.addShapeGroupListeners(t,e,this)}}))}n.draw()}#zn(e){let t,n;return void 0!==e.planePoints?t=e.planePoints:void 0!==e.planeOrigin&&(t=[e.planeOrigin]),void 0!==t&&(n=this.#Yn(t,e.referencedFrameNumber)),n}#Yn(e,t){let n="";for(const t of e)0!==n.length&&(n+="-"),n+=ie([ne(t.getX(),2),ne(t.getY(),2),ne(t.getZ(),2)]);return void 0!==t&&(n+="-"+t),n}#Xn(t){let n;const i=this.#zn(t),o=this.getKonvaLayer().getChildren(Yr(i));if(0!==o.length){const i=o[0];if(!(i instanceof e.Group))return;const r=i.getChildren(Yr(t.trackingUid));0!==r.length&&r[0]instanceof e.Group&&(n=r[0])}return n}#Bn(t,n){if(!t.canView()||!t.isCompatibleView(this.#Ft))return;const i=this.#zn(t);let o=this.getKonvaLayer().getChildren(Yr(i))[0];if(void 0===o&&(o=new e.Group({id:i,name:"position-group",visible:n}),this.getKonvaLayer().add(o)),!(o instanceof e.Group))return;const r=new jr,a=this.getKonvaStage();r.setZoomScale(a.scale());const s=t.getFactory();if(void 0===s)throw new Error("Cannot add an annotation draw without factory");const l=s.createShapeGroup(t,r);o.add(l),n&&void 0!==this.#Qn&&this.#Qn.addShapeGroupListeners(l,t,this),this.setLabelVisibility(l)}#Gn(t){const n=this.#Xn(t);return n instanceof e.Group?(n.remove(),!0):(h.debug("No shape group to remove"),!1)}#kn(e){this.#Gn(e)&&this.#Bn(e,!0)}fitToContainer(e,t,n){const i={x:t*this.#zt.x,y:t*this.#zt.y},o=i.x/this.#Wt.x,r=i.y/this.#Wt.y,a=e.x/(this.#qn.width()*o),s=e.y/(this.#qn.height()*r);this.#qn.width()===e.x&&this.#qn.height()===e.y||(this.#qn.width(e.x),this.#qn.height(e.y));const l={x:this.#qn.scale().x*o,y:this.#qn.scale().y*r};this.#qn.scale().x===l.x&&this.#qn.scale().y===l.y||(this.#Wt=i,this.#qn.scale(l),this.#Nn(l));const c={x:n.x/i.x,y:n.y/i.y},u={x:e.x/i.x,y:e.y/i.y},d={x:0!==this.#in.x?u.x:0,y:0!==this.#in.y?u.y:0};if(this.#en.x!==c.x||this.#en.y!==c.y||this.#in.x!==d.x||this.#in.y!==d.y){const e={x:this.#tn.x*a,y:this.#tn.y*s};this.#qn.offset({x:this.#qn.offset().x+c.x-this.#en.x+d.x-this.#in.x+e.x-this.#tn.x,y:this.#qn.offset().y+c.y-this.#en.y+d.y-this.#in.y+e.y-this.#tn.y}),this.#in=d,this.#en=c,this.#tn=e}}isAnnotationVisible(e){const t=this.#Wn(e);return void 0!==t&&t.isVisible()}setAnnotationVisibility(e,t){const n=this.#Wn(e);return void 0!==n&&(void 0===t&&(t=!n.isVisible()),n.visible(t),this.draw(),!0)}setLabelsVisibility(t){this.#Vn=t;const n=this.getKonvaLayer().getChildren();for(const i of n)if(i instanceof e.Group){const n=i.getChildren();for(const i of n)i instanceof e.Group&&this.#jn(i,t)}}#jn(t,n){const i=t.getChildren(Br)[0];if(i instanceof e.Label&&(void 0===n&&(n=!i.isVisible()),void 0!==i.getText()&&0!==i.getText().text().length)){i.visible(n);const e=t.getChildren((e=>"Line"===e.className&&"connector"===e.name()))[0];e&&e.visible(n)}}setLabelVisibility(e){this.#jn(e,this.#Vn)}deleteDraw(e,t){}deleteDraws(e){}getNumberOfDraws(){const t=this.getKonvaLayer().getChildren();let n=0;for(const i of t)i instanceof e.Group&&(n+=i.getChildren().length);return n}bindInteraction(){this.#qn.listening(!0),this.#Ut.style.pointerEvents="auto";const e=Ar;for(let t=0;t<e.length;++t)this.#Ut.addEventListener(e[t],this.#j)}unbindInteraction(){this.#qn.listening(!1),this.#Ut.style.pointerEvents="none";const e=Ar;for(let t=0;t<e.length;++t)this.#Ut.removeEventListener(e[t],this.#j)}setCurrentPosition(e,t){void 0===t&&(t=this.#Ft.worldToIndex(e));const n=this.#Ft.getPlanePoints(e);let i,o;i=this.#Ft.isAquisitionOrientation()?[n[0]]:n,e.length()>3&&(o=e.get(3));const r=this.#Yn(i,o);return this.#Zn(r),this.#j({type:"positionchange",value:[t.getValues(),e.getValues()],valid:!0}),!0}#Zn(e){this.#Un=e;const t=this.getKonvaLayer().getChildren(Gr);let n;for(let i=0,o=t.length;i<o;++i)n=!1,void 0!==e&&t[i].id()===e&&(n=!0),t[i].visible(n);this.getKonvaLayer().draw()}#Hn(){if(void 0===this.#Un)return;const t=this.getKonvaLayer().getChildren((e=>e.id()===this.#Un));let n;return 1===t.length?t[0]instanceof e.Group&&(n=t[0]):0===t.length?(n=new e.Group,n.name("position-group"),n.id(this.#Un),n.visible(!0),this.getKonvaLayer().add(n)):h.warn("Unexpected number of draw position groups"),n}#Wn(e){return this.getKonvaLayer().findOne("#"+e)}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{e.srclayerid=this.getId(),e.dataid=this.#rn,this.#X.fireEvent(e)};#Nn(e){const t=2/e.x,n=2/e.y,i=this.#qn.find("Label");for(let e=0;e<i.length;++e)i[e].scale({x:t,y:n})}}function _r(e){const t=[0,0,0],n=e.split("#");for(const e of n){const n=e.split("-");t[n[0]]=n[1]}return t}function Kr(e){return"info-"+e}function Jr(e){let t;t=void 0!==e.tags?e.tags.join(""):e.event;let n=encodeURIComponent(e.format.toLowerCase());return n=n.replace(/%[0-9A-F]{2}/gi,""),Kr(e.pos)+"-"+t+"-"+n}class $r{#_n=!1;#Ut;constructor(e){this.#Ut=e}onDataChange=e=>{if(void 0!==e.data){if(void 0!==e.srclayerid){const n=ea(e.srclayerid),i={groupDivId:(t=this.#Ut.id).substring(0,t.length-10)};if(n.groupDivId!==i.groupDivId)return}var t;this.#_n||this.#Kn(e.data),this.#Jn(e.data)}};#Kn(e){const t=[];for(const n of e){const e=n.pos;t.includes(e)||t.push(e)}for(const n of t){const t=document.createElement("ul");for(const i of e)if(i.pos===n){const e=document.createElement("li");e.id=Jr(i),void 0!==i.tags&&e.appendChild(document.createTextNode(i.value)),t.appendChild(e)}const i=document.createElement("div");i.id=Kr(n),i.className="info-"+n+" info",i.appendChild(t),this.#Ut.appendChild(i)}this.#_n=!0}#Jn(e){for(const t of e){const e="#"+Jr(t),n=this.#Ut.querySelector(e),i=t.value;i&&n&&n.replaceChildren(document.createTextNode(i))}}}function ea(e){const t=e.split("-layer-");return 2!==t.length&&h.warn("Not the expected layer div id format..."),{groupDivId:t[0],layerIndex:t[1],layerId:e}}function ta(e){let t=null;const n=e.target.closest(".layer");return n&&void 0!==n.id&&(t=ea(n.id)),t}function na(e,t,n,i){const o=(i.x-e.x)*t.x,r=(i.y-e.y)*t.y;return{x:i.x-o/n.x,y:i.y-r/n.y}}class ia{#Ut;#$n=[];#Xt={x:1,y:1,z:1};#On={x:1,y:1,z:1};#Jt={x:0,y:0,z:0};#ei=void 0;#X=new z;#ti=!1;#ni=[];#ii;#an=!1;#oi;#ri;#ai=[];#si;getPositionHelper(){if(void 0===this.#oi)for(const e of this.#$n)if(e instanceof Er){const t=e.getViewController().getPositionHelper();void 0===this.#oi?this.#oi=t:this.#oi.merge(t)}return this.#oi}constructor(e,t){if(this.#Ut=e,void 0!==t&&!0===t){const t=document.createElement("div");t.id=e.id+"-infolayer",t.className="infoLayer",e.appendChild(t),this.#ri=new $r(t)}}getShowCrosshair(){return this.#ti}setShowCrosshair(e){this.#ti=e,e?(this.addEventListener("offsetchange",this.#li),this.addEventListener("zoomchange",this.#li),this.#ci()):(this.removeEventListener("offsetchange",this.#li),this.removeEventListener("zoomchange",this.#li),this.#ui())}setImageSmoothing(e){this.#an=e;for(const t of this.#$n)t instanceof Er&&t.setImageSmoothing(e)}#li=e=>{this.#ci()};getDivId(){let e;return null!==this.#Ut&&(e=this.#Ut.id),e}getScale(){return this.#Xt}getBaseScale(){return this.#On}getAddedScale(){return{x:this.#Xt.x/this.#On.x,y:this.#Xt.y/this.#On.y,z:this.#Xt.z/this.#On.z}}getOffset(){return this.#Jt}getNumberOfLayers(){let e=0;return this.#$n.forEach((t=>{void 0!==t&&e++})),e}includes(e){if(void 0===e)return!1;for(const t of this.#$n)if(void 0!==t&&t.getId()===e)return!0;return!1}getViewLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#$n)n instanceof Er&&e(n)&&t.push(n);return t}getViewLayersFromActive(e){void 0===e&&(e=function(){return!0});let t=0;void 0!==this.#ei&&(t=this.#ei);const n=[];for(let e=t;e>=0;e--)n.push(e);for(let e=this.#$n.length-1;e>t;e--)n.push(e);const i=[];for(const t of n){const n=this.#$n[t];n instanceof Er&&e(n)&&i.push(n)}return i}someViewLayer(e){let t=!1;for(const n of this.#$n)if(n instanceof Er&&e(n)){t=!0;break}return t}getDrawLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#$n)n instanceof Zr&&e(n)&&t.push(n);return t}getNumberOfViewLayers(){let e=0;return this.#$n.forEach((t=>{void 0!==t&&t instanceof Er&&e++})),e}getActiveLayer(){let e;return void 0!==this.#ei&&(e=this.#$n[this.#ei]),e}getActiveViewLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof Er&&(e=t),e}getBaseViewLayer(){let e;for(const t of this.#$n)if(t instanceof Er){e=t;break}return e}getViewLayerById(e){const t=this.getViewLayers((function(t){return t.getId()===e}));let n;return 1===t.length&&(n=t[0]),n}getViewLayersByDataId(e){return this.getViewLayers((function(t){return t.getDataId()===e}))}searchViewLayers(e){const t=structuredClone(e);let n;void 0!==t.SOPInstanceUID&&(n=t.SOPInstanceUID,delete t.SOPInstanceUID);const i=void 0!==n,o=0!==Object.keys(t).length,r=[];for(const e of this.#$n)if(e instanceof Er){let a=!1;o&&(a=e.getViewController().equalImageMeta(t));let s=!1;i&&(s=e.getViewController().includesImageUid(n));let l=!1;o&&i?l=a&&s:o?l=a:i&&(l=s),l&&r.push(e)}return r}getViewDataIndices(){const e=[];for(const t of this.#$n)t instanceof Er&&e.push(t.getDataId());return e}getActiveDrawLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof Zr&&(e=t),e}getDrawLayerById(e){const t=this.getDrawLayers((function(t){return t.getId()===e}));let n;return 1===t.length&&(n=t[0]),n}getDrawLayersByDataId(e){return this.getDrawLayers((function(t){return t.getDataId()===e}))}setActiveLayer(e){this.#ei=e;const t=this.#$n[e];if(void 0!==this.#ri){this.unbindInfoData();const e=t.getDataId();this.bindInfoData(e)}this.#j({type:"activelayerchange",value:[this.#$n[e]]})}setActiveLayerById(e){let t;for(let n=0;n<this.#$n.length;++n)if(void 0!==this.#$n[n]&&this.#$n[n].getId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):h.warn("No layer to set as active with id: "+e)}setActiveLayerByDataId(e){let t;for(let n=0;n<this.#$n.length;++n)if(void 0!==this.#$n[n]&&this.#$n[n].getDataId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):h.warn("No layer to set as active with dataId: "+e)}addViewLayer(){const e=this.#$n.length,t=this.#di();this.#Ut.append(t);const n=new Er(t);return n.setImageSmoothing(this.#an),this.#$n.push(n),this.setActiveLayer(e),this.#hi(n),this.#oi=void 0,n}addDrawLayer(){this.#ei=this.#$n.length;const e=this.#di();this.#Ut.append(e);const t=new Zr(e);return this.#$n.push(t),this.#gi(t),t}#hi(e){e.addEventListener("positionchange",this.updateLayersToPositionChange);for(const t of W)e.addEventListener(t,this.#j);e.addEventListener("renderstart",this.#j),e.addEventListener("renderend",this.#j)}#Si(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange);for(const t of W)e.removeEventListener(t,this.#j);e.removeEventListener("renderstart",this.#j),e.removeEventListener("renderend",this.#j),e.unbindImage()}#gi(e){e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#j)}#pi(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#j)}addInfoData(e,t){this.#ai[t]=e}bindInfoData(e){if(void 0!==this.#si)return;const t=this.#ai[e];void 0!==t&&t.addEventListener("valuechange",this.#ri.onDataChange),this.#si=e}unbindInfoData(){const e=this.#ai[this.#si];void 0!==e&&e.removeEventListener("valuechange",this.#ri.onDataChange),this.#si=void 0}#di(){const e=document.createElement("div");return e.id=this.getDivId()+"-layer-"+this.#$n.length,e.className="layer",e.style.pointerEvents="none",e}empty(){for(const e of this.#$n)void 0!==e&&this.removeLayer(e);this.#$n=[],this.#ui()}removeLayersByDataId(e){for(const t of this.#$n)void 0!==t&&t.getDataId()===e&&this.removeLayer(t)}removeLayer(e){const t=this.#$n.findIndex((t=>t===e));if(-1===t)throw new Error("Cannot find layer to remove");this.#ei===t&&(this.#ei=void 0),e instanceof Er?this.#Si(e):this.#pi(e),this.#$n[t]=void 0,this.#oi=void 0,e.removeFromDOM(),this.#j({type:"layerremove",layerid:e.getId(),layergroupid:this.getDivId()})}#ci(){let e;this.#ui();for(const t of this.#$n)if(t instanceof Er){e=t;break}if(void 0===e)return void h.warn("No layer to show crosshair");if(this.#mi(e))return void h.warn("Not enabling crosshair for secondary capture");const t=e.getViewController(),n=t.getCurrentPosition(),i=t.getPlanePositionFromPosition(n),o=e.planePosToDisplay(i);if(void 0!==o.getY()){const e=document.createElement("hr");e.id=this.getDivId()+"-scroll-crosshair-horizontal",e.className="horizontal",e.style.width=this.#Ut.offsetWidth+"px",e.style.left="0px",e.style.top=o.getY()+"px",this.#ni.push(e),this.#Ut.appendChild(e)}if(void 0!==o.getX()){const e=document.createElement("hr");e.id=this.getDivId()+"-scroll-crosshair-vertical",e.className="vertical",e.style.width=this.#Ut.offsetHeight+"px",e.style.left=o.getX()+"px",e.style.top="0px",this.#ni.push(e),this.#Ut.appendChild(e)}}#ui(){for(const e of this.#ni)e.remove();this.#ni=[]}showTooltip(e){this.removeTooltipDiv();const t=this.getBaseViewLayer(),n=t.getViewController(),i=t.displayToPlanePos(e),o=n.getPositionFromPlanePoint(i),r=n.getRescaledImageValue(o);if(void 0!==r){const t=document.createElement("span");t.id="scroll-tooltip",t.style.left=e.getX()+10+"px",t.style.top=e.getY()+10+"px";let i=ne(r,3).toString();void 0!==n.getPixelUnit()&&(i+=" "+n.getPixelUnit()),t.appendChild(document.createTextNode(i)),this.#ii=t,this.#Ut.appendChild(t)}}removeTooltipDiv(){void 0!==this.#ii&&(this.#ii.remove(),this.#ii=void 0)}isPositionInBounds(e){return this.someViewLayer((function(t){return t.getViewController().isPositionInBounds(e)}))}canScroll(){return this.someViewLayer((function(e){return e.getViewController().canScroll()}))}#mi(e){let t=!1;const n=e.getViewController().getSopClassUid();return void 0!==n&&(t=n.startsWith("1.2.840.10008.5.1.4.1.1.7")),t}shouldBind(){const e=this.getBaseViewLayer();return void 0!==e&&!this.#mi(e)}moreThanOne(e){return this.someViewLayer((function(t){return t.getViewController().moreThanOne(e)}))}hasAnyLayerWithValidPosition(){return this.someViewLayer((function(e){return e.isValidPosition()}))}#fi=e=>{const t=this.#ai[e.dataid];void 0!==t&&t.onSliceChange(e)};updateLayersToPositionChange=e=>{for(const e of this.#$n)void 0!==e&&(e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#j),e.addEventListener("positionchange",this.#fi));const t=new o(e.value[0]),n=new q(e.value[1]),i={};let r,a;for(const o of this.#$n){if(void 0===o)continue;let s=!1;if(o instanceof Er){const e=o.getViewController(),t=e.getOrigin(),l=e.getOrigin(n);let c,u;if(void 0===a)r=t,a=l,c=new R(0,0,0),u=new R(0,0,0);else if(e.isPositionInBounds(n)&&void 0!==l){const e=r.minus(t);c=new R(e.getX(),e.getY(),e.getZ());const n=a.minus(l);u=new R(n.getX(),n.getY(),n.getZ())}void 0!==c&&void 0!==u&&(s=o.setBaseOffset(c,u,a,r),i[o.getId()]={scroll:c,plane:u})}if(o instanceof Zr){const e=i[o.getReferenceLayerId()];void 0!==e&&(s=o.setBaseOffset(e.scroll,e.plane))}let l=!1;o.getId()!==e.srclayerid&&(l=o.setCurrentPosition(n,t)),!l&&s&&o.draw()}const s=this.hasAnyLayerWithValidPosition();this.#j({type:"outofrange",layergroupid:this.getDivId(),value:[!s]}),this.#ti&&this.#ci();for(const e of this.#$n)void 0!==e&&(e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#j),e.removeEventListener("positionchange",this.#fi))};getDivToWorldSizeRatio(){if(0===this.#Ut.offsetWidth&&0===this.#Ut.offsetHeight)throw new Error("Cannot fit to zero sized container with id '"+this.#Ut.id+"'.");const e=this.getMaxWorldSize();if(void 0!==e){if(0===this.#Ut.offsetHeight){const t=this.#Ut.offsetWidth/e.x,n=e.y*t;this.#Ut.style.height=n+"px"}return Math.min(this.#Ut.offsetWidth/e.x,this.#Ut.offsetHeight/e.y)}}fitToContainer(e){const t=this.getMaxWorldSize();if(void 0===t)return;const n={x:this.#Ut.offsetWidth,y:this.#Ut.offsetHeight},i={x:-.5*(n.x-Math.floor(t.x*e)),y:-.5*(n.y-Math.floor(t.y*e))};for(const t of this.#$n)void 0!==t&&t.fitToContainer(n,e,i);this.#ti&&this.#ci()}getMaxWorldSize(){let e={x:0,y:0};for(const t of this.#$n)if(t instanceof Er){const n=t.getImageWorldSize();n.x>e.x&&(e.x=n.x),n.y>e.y&&(e.y=n.y)}return 0===e.x&&0===e.y&&(e=void 0),e}flipScaleZ(){this.#On.z*=-1,this.setScale(this.#On)}addScale(e,t){const n={x:this.#Xt.x*(1+e),y:this.#Xt.y*(1+e),z:this.#Xt.z*(1+e)};this.setScale(n,t)}setScale(e,t){this.#Xt=e;for(const e of this.#$n)void 0!==e&&e.setScale(this.#Xt,t);const n=[e.x,e.y,e.z];void 0!==t&&(n.push(t.getX()),n.push(t.getY()),n.push(t.getZ())),this.#j({type:"zoomchange",value:n})}addTranslation(e){this.setOffset({x:this.#Jt.x-e.x,y:this.#Jt.y-e.y,z:this.#Jt.z-e.z})}setOffset(e){this.#Jt=e;for(const e of this.#$n)void 0!==e&&e.setOffset(this.#Jt);this.#j({type:"offsetchange",value:[this.#Jt.x,this.#Jt.y,this.#Jt.z]})}reset(){this.setScale(this.#On),this.setOffset({x:0,y:0,z:0})}resetZoomPan(){this.setScale(this.#On),this.setOffset({x:0,y:0,z:0})}resetViews(){let e=!0;for(const t of this.#$n)if(void 0!==t&&t instanceof Er){const n=t.getViewController();e&&(n.resetPosition(),e=!1),n.resetWindowLevel()}}draw(){for(const e of this.#$n)void 0!==e&&e.draw()}display(e){for(const t of this.#$n)void 0!==t&&t.display(e)}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)}}class oa{#vi=0;getSum(){return this.#vi}add(e){this.#vi+=function(e){if(void 0===e.wheelDeltaY)return-e.deltaY;{const t=45;return e.wheelDeltaY>t?1:e.wheelDeltaY<-t?-1:-e.deltaY/60}}(e)}clear(){this.#vi=0}isTick(){return Math.abs(this.#vi)>=1}}class ra{#Di;#yi=new oa;constructor(e){this.#Di=e}wheel(e){this.#yi.add(e);const t=this.#yi.getSum()>=0;if(!this.#yi.isTick())return;this.#yi.clear(),e.preventDefault();const n=ta(e),i=this.#Di.getLayerGroupByDivId(n.groupDivId),o=i.getPositionHelper();i.canScroll()?t?o.incrementPositionAlongScroll():o.decrementPositionAlongScroll():i.moreThanOne(3)&&(t?o.incrementPosition(3):o.decrementPosition(3))}}class aa{#Di;#Ci;constructor(e,t){this.#Di=e,this.#Ci=t}#Ii=null;#Ti=null;#Li;#Dn;#wi=!1;setShape(e,t,n){if(this.#Ti=e,this.#Li=t,this.#Dn=n,this.#Ti){if(this.#Pi(),this.#Ii=n.getFactory(),void 0===this.#Ii)throw new Error("Could not find a factory to update shape.");this.#Ai()}}getShape(){return this.#Ti}getAnnotation(){return this.#Dn}isActive(){return this.#wi}enable(){this.#wi=!0,this.#Ti&&(this.#Oi(!0),this.#Ti.getLayer()&&this.#Ti.getLayer().draw())}disable(){this.#wi=!1,this.#Ti&&(this.#Oi(!1),this.#Ti.getLayer()&&this.#Ti.getLayer().draw())}reset(){this.#Ti=void 0,this.#Li=void 0,this.#Dn=void 0}resetAnchors(){this.#Pi(),this.#Ai(),this.#Oi(!0)}#bi(e){this.#Ti&&this.#Ti.getParent()&&this.#Ti.getParent().find(".anchor").forEach(e)}#Oi(e){this.#bi((function(t){t.visible(e)}))}setAnchorsActive(e){let t;t=e?e=>{this.#xi(e)}:e=>{this.#Ri(e)},this.#bi(t)}#Pi(){this.#bi((function(e){e.remove()}))}#Ai(){if(!this.#Ti||!this.#Ti.getLayer())return;const e=this.#Ti.getParent(),t=this.#Ii.getAnchors(this.#Ti,this.#Di.getStyle());for(let n=0;n<t.length;++n)this.#xi(t[n]),e.add(t[n])}#xi(t){let n;t.on("dragstart.edit",(e=>{e.cancelBubble=!0,n={mathShape:this.#Dn.mathShape,referencePoints:this.#Dn.referencePoints}})),t.on("dragmove.edit",(t=>{const n=t.target;n instanceof e.Shape&&(function(e,t){const n=t.getParent();!function(e,t,n){let i=!1;e.x()<t.getX()?(e.x(t.getX()),i=!0):e.x()>n.getX()&&(e.x(n.getX()),i=!0),e.y()<t.getY()?(e.y(t.getY()),i=!0):e.y()>n.getY()&&(e.y(n.getY()),i=!0)}(t,new E(-n.x(),-n.y()),new E(e.x-n.x(),e.y-n.y()))}(this.#Li.getBaseSize(),n),void 0!==this.#Ii.constrainAnchorMove&&this.#Ii.constrainAnchorMove(n),this.#Ii.updateAnnotationOnAnchorMove(this.#Dn,n),this.#Ii.updateShapeGroupOnAnchorMove(this.#Dn,n,this.#Di.getStyle()),n.getLayer()?n.getLayer().draw():h.warn("No layer to draw the anchor!"),t.cancelBubble=!0)})),t.on("dragend.edit",(e=>{const t={mathShape:this.#Dn.mathShape,referencePoints:this.#Dn.referencePoints},i=new Qr(this.#Dn,n,t,this.#Li.getDrawController());this.#Di.addToUndoStack(i),this.#Ci({type:"annotationupdate",data:this.#Dn,dataid:this.#Li.getDataId(),keys:Object.keys(t)}),n={mathShape:t.mathShape,referencePoints:t.referencePoints},e.cancelBubble=!0})),t.on("mousedown touchstart",(e=>{e.target.moveToTop()})),t.on("mouseover.edit",(t=>{const n=t.target;n instanceof e.Shape&&(n.stroke("#ddd"),n.getLayer()?n.getLayer().draw():h.warn("No layer to draw the anchor!"))})),t.on("mouseout.edit",(t=>{const n=t.target;n instanceof e.Shape&&(n.stroke("#999"),n.getLayer()?n.getLayer().draw():h.warn("No layer to draw the anchor!"))}))}#Ri(e){e.off("dragstart.edit"),e.off("dragmove.edit"),e.off("dragend.edit"),e.off("mousedown touchstart"),e.off("mouseover.edit"),e.off("mouseout.edit")}}class sa{#Ei;constructor(){this.createTrashIcon()}createTrashIcon(){this.#Ei=new e.Group;const t=new e.Line({points:[-10,-10,10,10],stroke:"red"}),n=new e.Line({points:[10,-10,-10,10],stroke:"red"});this.#Ei.width(20),this.#Ei.height(20),this.#Ei.add(t),this.#Ei.add(n)}activate(e){const t=e.getKonvaStage(),n=t.scale(),i=e.getKonvaLayer(),o={x:1/n.x,y:1/n.y};this.#Ei.x(t.offset().x+t.width()/(2*n.x)),this.#Ei.y(t.offset().y+t.height()/(15*n.y)),this.#Ei.scale(o),i.add(this.#Ei),i.draw()}changeChildrenColourOnTrashHover(e,t,n){if(this.isOverTrash(e))return this.changeGroupChildrenColour(this.#Ei,"orange"),void this.changeGroupChildrenColour(t,"red");this.changeGroupChildrenColour(this.#Ei,"red"),this.changeGroupChildrenColour(t,n)}changeGroupChildrenColour(t,n){t.getChildren().forEach((function(t){t instanceof e.Shape&&void 0!==t.stroke&&t.stroke(n)}))}remove(){this.#Ei.remove()}isOverTrash(e){const t=this.#Ei.width()*Math.abs(this.#Ei.scaleX())/2,n=this.#Ei.height()*Math.abs(this.#Ei.scaleY())/2;return Math.abs(e.x-this.#Ei.x())<t&&Math.abs(e.y-this.#Ei.y())<n}}class la{#Di;#Fi;#Ei;#qi="pointer";#Mi;#Ui;#Ci;constructor(e,t){this.#Di=e,this.#Ci=t,this.#Fi=new aa(e,t),this.#Ei=new sa}setEditorShape(t,n){const i=n.getDrawController();t&&t instanceof e.Shape&&t!==this.#Fi.getShape()&&i.isAnnotationGroupEditable()&&(this.#Fi.disable(),this.#Fi.setShape(t,n,n.getDrawController().getAnnotation(t.getParent().id())),this.#Fi.enable())}getEditorShapeGroup(){let t;if(!this.#Fi.isActive()||(t=this.#Fi.getShape().getParent(),t instanceof e.Group))return t}getEditorAnnotation(){let e;return this.#Fi.isActive()&&(e=this.#Fi.getAnnotation()),e}disableAndResetEditor(){this.#Fi.disable(),this.#Fi.reset()}#Qi(e,t){const n=t.getKonvaStage();return{x:n.offset().x+e.x/n.scale().x,y:n.offset().y+e.y/n.scale().y}}storeMouseOverCursor(e){this.#qi=e}#Vi(){this.#Mi=document.body.style.cursor,document.body.style.cursor=this.#qi,this.#Ui.opacity(.75)}onMouseOutShapeGroup(){void 0!==this.#Mi&&(document.body.style.cursor=this.#Mi,this.#Mi=void 0),void 0!==this.#Ui&&this.#Ui.opacity(1)}#Ni(e){e.on("mouseover",(()=>{this.#Ui=e,this.#Vi()})),e.on("mouseout",(()=>{this.onMouseOutShapeGroup(),this.#Ui=void 0}))}#Bi(e){e.off("mouseover"),e.off("mouseout")}addShapeGroupListeners(e,t,n){this.#Ni(e),this.#ki(e,t,n),this.#Gi(e,t,n),e.on("dblclick",(()=>{const e=t.textExpr,i=t=>{const i=t.textExpr,o=new Qr(t,{textExpr:e},{textExpr:i},n.getDrawController());this.#Di.addToUndoStack(o),o.execute()};void 0!==O.openRoiDialog?O.openRoiDialog(t,i):function(e,t){const n=prompt("Label",e.textExpr);null!==n&&(e.textExpr=n,t(e))}(t,i)}))}#ki(t,n,i){const o=i.getKonvaLayer(),r=t.getChildren(kr)[0];if(!(r instanceof e.Shape))return;let a,s,l,c;r.draggable(!0),r.on("dragstart.draw",(e=>{c=r.stroke(),a={x:r.x(),y:r.y()},s={x:e.target.x(),y:e.target.y()},l={mathShape:n.mathShape,referencePoints:n.referencePoints},this.#Ei.activate(i),this.#Fi.setAnchorsActive(!1),o.draw()})),r.on("dragmove.draw",(e=>{const a=function(e,t){return{min:new E(0,0),max:new E(e.x-Math.abs(t.width()),e.y-Math.abs(t.height()))}}(i.getBaseSize(),r);if(a&&!function(e,t,n){const i=e.getClientRect({relativeTo:e.getParent()});return i.x>t.getX()&&i.x<n.getX()&&i.y>t.getY()&&i.y<n.getY()}(r,a.min,a.max))return r.x(s.x),void r.y(s.y);const l={x:e.target.x()-s.x,y:e.target.y()-s.y},u=t.getChildren(),d=void 0===n.labelPosition;for(const t of u)t===e.target||"label"===t.name()&&!d||"connector"===t.name()||t.move(l);s={x:e.target.x(),y:e.target.y()};const h=n.getFactory();if(void 0===h)throw new Error("Cannot follow drag move without factory");h.updateAnnotationOnTranslation(n,l),h.updateLabelContent(n,t,this.#Di.getStyle()),h.updateConnector(t);const g=xr(e.evt),S={x:g.getX(),y:g.getY()},p=this.#Qi(S,i);this.#Ei.changeChildrenColourOnTrashHover(p,t,c),o.draw()})),r.on("dragend.draw",(e=>{if(this.#Ei.remove(),void 0===e||void 0===e.evt)return;const s=r.x(),u=r.y(),d=xr(e.evt),h={x:d.getX(),y:d.getY()},g=this.#Qi(h,i);if(this.#Ei.isOverTrash(g)){t.x(a.x),t.y(a.y),this.#Fi.disable(),this.#Fi.reset(),this.#Ei.changeGroupChildrenColour(t,c),n.mathShape=l.mathShape,n.referencePoints=l.referencePoints;const e=new Ur(n,i.getDrawController());this.#Di.addToUndoStack(e),e.execute(),this.onMouseOutShapeGroup()}else{const e={x:s-a.x,y:u-a.y};if(0!==e.x||0!==e.y){const e={mathShape:n.mathShape,referencePoints:n.referencePoints},t=new Qr(n,l,e,i.getDrawController());this.#Di.addToUndoStack(t),this.#Ci({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:Object.keys(e)}),l={mathShape:e.mathShape,referencePoints:e.referencePoints}}this.#Fi.setAnchorsActive(!0),this.#Fi.resetAnchors()}o.draw(),a={x:r.x(),y:r.y()}}))}#Gi(t,n,i){const o=t.getChildren(Br)[0];if(!(o instanceof e.Label))return;let r,a;o.draggable(!0),o.on("dragstart.draw",(()=>{r={x:o.x(),y:o.y()},a=n.labelPosition})),o.on("dragmove.draw",(()=>{const e=n.getFactory();if(void 0===e)throw new Error("Cannot udpate connector without factory");e.updateConnector(t)})),o.on("dragend.draw",(()=>{const e=o.x()-r.x,t=o.y()-r.y;if(0!==e||0!==t){const e=new E(o.x(),o.y());n.labelPosition=e;const t=new Qr(n,{labelPosition:a},{labelPosition:e},i.getDrawController());this.#Di.addToUndoStack(t),this.#Ci({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:["labelPosition"]}),a=e}r={x:o.x(),y:o.y()}}))}removeShapeListeners(t){this.#Bi(t),t.off("dblclick");const n=t.getChildren(kr)[0];n instanceof e.Shape&&(n.draggable(!1),n.off("dragstart.draw"),n.off("dragmove.draw"),n.off("dragend.draw"));const i=t.getChildren(Br)[0];i instanceof e.Label&&(i.draggable(!1),i.off("dragstart.draw"),i.off("dragend.draw"))}}const ca="No source image to create mask",ua="No source image to get offsets, ID: {0}",da="No brush origins",ha="No mask defined when adding mask slices",ga="No created mask image",Sa="No mask image for temporary draw command, ID: {0}",pa="No mask image to get offsets from",ma="No mask image for draw command, ID: {0}",fa="No mask ID to apply mask index",va="No mask view layers",Da="No selected segment number",ya="Too many mask view layers: {0}",Ca="More mask layers than expected",Ia="Cannot display mask with no mask ID",Ta="Cannot draw with no mask data ID",La="Cannot draw with no offsets",wa="Cannot draw with no colour list",Pa="Cannot get mask layers with no mask ID",Aa="Cannot get mask view controller: no mask ID",Oa="Cannot get mask view controller: no mask layers",ba="Cannot find source data for an existing mask, ID: {0}",xa="Unsupported scroll index: {0}";function Ra(e,...t){return e.replace(/{(\d+)}/g,((e,n)=>t[n]||""))}const Ea="del",Fa="add";function qa(e,t,n,i){return Ro(e.worldToIndex(t),n,i)}class Ma{mask;dataId;offsetsLists;mode;segmentNumber;srclayerid;originalValuesLists;isSilent}class Ua extends Fr{#Hi;#rn;#zi;#Yi;#Xi;#Wi;#ji;#Zi;#_i;#Ki;constructor(e){super(),this.#Hi=e.mask,this.#rn=e.dataId,this.#zi=e.offsetsLists,this.#Yi=e.mode,this.#Xi=e.segmentNumber,this.#Wi=e.srclayerid,void 0!==e.originalValuesLists&&(this.#ji=e.originalValuesLists),this.#Zi=e.isSilent??!1,this.#_i=this.#Yi===Ea?"brushremove":"brushdraw",this.#Ki="brushdraw"===this.#_i?"brushremove":"brushdraw"}getOriginalValuesLists(){return this.#ji}getExecuteEvent(){const e="brushdraw"===this.#_i?this.#Xi:void 0;return new CustomEvent(this.#_i,{detail:{segmentnumber:e,dataid:this.#rn,srclayerid:this.#Wi}})}getName(){return"Draw-brush"}execute(){if(void 0===this.#Xi)return;let e=this.#Xi;"brushremove"===this.#_i&&(e=0),void 0===this.#ji?this.#ji=this.#Hi.setAtOffsetsAndGetOriginals(this.#zi,e):this.#Hi.setAtOffsetsWithIterator(this.#zi,e),this.#Zi||this.onExecute(this.getExecuteEvent())}undo(){void 0===this.#ji?this.#ji=this.#Hi.setAtOffsetsAndGetOriginals(this.#zi,0):this.#Hi.setAtOffsetsWithIterator(this.#zi,this.#ji);const e="brushdraw"===this.#Ki?this.#Xi:void 0,t=new CustomEvent(this.#Ki,{detail:{segmentnumber:e,dataid:this.#rn,srclayerid:this.#Wi}});this.onUndo(t)}onExecute(e){}onUndo(e){}}class Qa extends EventTarget{#Di;#Ji;constructor(e){super(),this.#Di=e,this.#Ji=new ra(e)}#$i=!1;#Hi;#eo;#to=10;#no={min:1,max:20};#io=Ea;#oo;#ro=0;#ao;#so;#lo;#co;#uo=[];#do(e,t,n){const i=e.getSize().getValues();i[2]=1;const o=new lt(i),r=new mt([t],o,e.getSpacing(),e.getOrientation()),a=new Uint8Array(o.getDimSize(2));a.fill(0),++this.#ro;const s=[this.#ro.toString()],l=new _i(r,a,s);return l.setMeta(n),l.setPhotometricInterpretation("PALETTE COLOR"),l.setPaletteColourMap(new u([0],[0],[0])),l}#ho(e,t,n,i,r,a){const s=function(e,t){const n=t.sort((function(e,t){let n=0;const i=e.get(2),o=t.get(2);return void 0!==i&&void 0!==o&&(n=i-o),n}));const i=n[0].get(2);if(void 0===i)return[];const r=new o([0,0,i]),a=e.indexToWorld(r),s=n.at(-1).get(2);if(void 0===s)return[];const l=new o([0,0,s]),c=e.indexToWorld(l),u=e.getOrigins(),d=.1*e.getSpacing().get(2),g=a.get3D().getClosest(u),S=u[g],p=a.get3D().getDistance(S);p>d&&h.warn("Large distance between origin and origin for first index: "+p);const m=c.get3D().getClosest(u),f=u[m],v=c.get3D().getDistance(f);return v>d&&h.warn("Large distance between origin and origin for last index: "+v),[g,m]}(e,qa(e,n,r,i));if(void 0===s||0===s.length)throw new Error(da);const l=e.getOrigins(),c=t.getOrigins(),u=c[0].getClosest(l),d=c.at(-1).getClosest(l),g=[];if(s[0]<u)for(let e=u-1;e>=s[0];--e)g.push(e);if(s[1]>d)for(let e=d+1;e<=s[1];++e)g.push(e);const S=[];for(const e of g)S.push(l[e]);if(void 0===this.#Hi)throw new Error(ha);const p=this.#Hi.getMeta();for(const e of S)p.numberOfFiles+=1,this.#Hi.appendSlice(this.#do(t,e,a))}#go(e){const t=this.#So().getId();if(void 0===this.#eo)throw new Error(fa);const n=this.#Di.getData(this.#eo);if(!n)throw new Error(Ra(Sa,this.#eo));const i=new Ma;i.mask=n.image,i.dataId=this.#eo,i.offsetsLists=[e],i.mode=this.#io,i.segmentNumber=this.#oo,i.srclayerid=t;const o=new Ua(i);o.execute(),this.#lo.push(e);const r=o.getOriginalValuesLists();void 0!==r&&this.#co.push(r[0])}#po(e,t){if(!t)throw new Error(Ra(ca));const n=t.getGeometry(),i=n.worldToIndex(e).get(2);if(void 0===i)throw new Error("Z position is undefined");const r=new o([0,0,i]),a=n.getOrigins()[i],s=Vi(),l=function(){const e="1.2.826.0.1.3680043.9.7278.1681051091011101.1";return{indices:{value:[{DimensionOrganizationUID:e,DimensionDescriptionLabel:"ReferencedSegmentNumber",DimensionIndexPointer:"(0062,000B)",FunctionalGroupPointer:"(0062,000A)"},{DimensionOrganizationUID:e,DimensionDescriptionLabel:"ImagePositionPatient",DimensionIndexPointer:"(0020,0032)",FunctionalGroupPointer:"(0020,9113)"}]},organizations:{value:[{DimensionOrganizationUID:e}]}}}();s.DimensionOrganizationSequence=l.organizations,s.DimensionIndexSequence=l.indices,s.PixelRepresentation=0,s.numberOfFiles=1;const c=t.getMeta();s.PatientID=c.PatientID,s.StudyInstanceUID=c.StudyInstanceUID,s.SeriesInstanceUID=c.SeriesInstanceUID;const u=[{referencedSOPClassUID:c.SOPClassUID,referencedSOPInstanceUID:t.getImageUid(r)}],d=[];d.push({ReferencedInstanceSequence:{value:u},SeriesInstanceUID:c.SeriesInstanceUID}),s.ReferencedSeriesSequence={value:d},s.custom={frameInfos:[{dimIndex:[1,1],refSegmentNumber:1,imagePosPat:a.getValues(),derivationImages:[{sourceImages:u}]}]},s.lengthUnit=t.getMeta().lengthUnit,this.#Hi=this.#do(n,a,s);const h=wn(s),g=new rs(h);g.image=this.#Hi;const S=this.#Di.getNextDataId();if(!this.#Di.addData(S,g))throw new Error("Cannot add mask data");return S}#mo(e){const t=this.#Di.getDataViewConfigs();let n;for(const i in t){const o=t[i].find((function(t){return t.divId===e}));if(void 0!==o){n=o.orientation;break}}return n}#fo(e){if(void 0===this.#eo)throw new Error(Ia);const t=new zs(e);t.orientation=this.#mo(e),this.#Di.addDataViewConfig(this.#eo,t),this.#Di.render(this.#eo)}#vo(e){const t=e.custom.frameInfos;if(0===t.length)return;const n=t[0].derivationImages;if(void 0===n)return;if(0===n.length)return;const i=n[0].sourceImages;return void 0!==i&&0!==i.length?i[0].referencedSOPInstanceUID:void 0}#Do(e){const t=e.getMeta(),n=this.#vo(t);let i=[];"undefined"!==n&&(i=this.#Di.getDataIdsFromSopUids([n]));let o="0";return i.length>0?o=i[0]:h.warn(Ra(ba,n)),o}#yo(e){if(void 0===this.#eo)throw new Error(Pa);const t=e.getViewLayersByDataId(this.#eo);if(0===t.length)throw new Error(va);return 1!==t.length&&h.warn(Ra(ya,t.length)),t[0]}#Co(e){if(void 0===e)throw new Error(fa);const t=this.#Di.getData(e);if(void 0===t)throw new Error(pa);return t.image}#Io(e){const t=ta(e),n=new E(e.offsetX,e.offsetY),i=this.#Di.getLayerGroupByDivId(t.groupDivId);if(void 0===i)throw new Error("No layergroup to get mask offsets");let o;if(this.#ao=i,o=void 0===this.#eo?i.getBaseViewLayer():i.getViewLayersByDataId(this.#eo)[0],void 0===o)return[];const r=o.getViewController(),a=r.getCurrentPosition();let s,l,c,u;if(r.equalImageMeta({Modality:"SEG"})){this.#Hi=this.#Co(this.#eo);const e=this.#Do(this.#Hi),t=this.#Di.getData(e);if(!t)throw new Error(Ra(ua,e));if(u=t.image,u.isResampled())return h.warn("Cannot update mask with resampled reference image."),[];const i=this.#Di.getViewLayersByDataId(e)[0],a=i.getViewController(),d=i.displayToPlanePos(n);c=a.getPositionFromPlanePoint(d),s=o,l=r}else{const e=o.getDataId(),t=this.#Di.getData(e);if(!t)throw new Error(Ra(ua,e));if(u=t.image,u.isResampled())return h.warn("Cannot create mask on resampled image."),[];const d=o.displayToPlanePos(n);if(c=r.getPositionFromPlanePoint(d),this.#eo=this.#po(a,u),void 0===this.#Hi)throw new Error(ga);const g=i.getDivId(),S=void 0!==g;S&&this.#fo(g),s=this.#yo(i),l=s.getViewController(),S&&l.setCurrentPosition(a)}const d=u.getGeometry(),g=this.#Hi.getMeta(),S=this.#Hi.getGeometry(),p=r.get2DSpacing(),m=[Math.round(this.#to/p.x),Math.round(this.#to/p.y)];let f;const v=r.getScrollDimIndex();switch(v){case 0:f=[1,2];break;case 1:f=[0,2];break;case 2:f=[0,1];break;default:throw new Error(Ra(xa,v))}this.#ho(d,S,c,f,m,g);const D=s.displayToPlanePos(n);return function(e,t){const n=e.getSize(),i=[];for(const e of t){const t=n.indexToOffset(e);t>=0&&i.push(t)}return i.sort((function(e,t){return e-t}))}(S,qa(S,l.getPositionFromPlanePoint(D),m,f))}#To(e){const t=ta(e),n=this.#Di.getLayerGroupByDivId(t.groupDivId);if(void 0===n)throw new Error("No layergroup to check black list");if(void 0===n.getActiveDrawLayer()){const e=n.getActiveViewLayer().getDataId(),t=this.#Di.getData(e).image.getMeta().SeriesInstanceUID;if(this.#uo.includes(t))return!0}return!1}#Lo(e){const t=ta(e),n=this.#Di.getLayerGroupByDivId(t.groupDivId);if(void 0===n)throw new Error("No layergroup to check for view layer");return n.getActiveLayer()instanceof Er}mousedown=e=>{if(!this.#Lo(e)||this.#To(e))return;if(void 0===this.#oo)return void h.warn(Da);this.#$i=!0,this.#so=new E(e.offsetX,e.offsetY),this.#lo=[],this.#co=[],this.#wo(e);const t=this.#Io(e);t.length>0?this.#go(t):(this.#$i=!1,this.#Po(e))};#wo(e){if(2===e.button){this.#io=Ea;const e=new CustomEvent("erasingactivated");this.dispatchEvent(e)}}#Po(e){if(2===e.button){this.#io=Fa;const e=new CustomEvent("erasingdeactivated");this.dispatchEvent(e)}}mousemove=e=>{if(!this.#$i)return;if(void 0===this.#so)return;const t=new E(e.offsetX,e.offsetY),n=Math.abs(t.getX()-this.#so.getX()),i=Math.abs(t.getY()-this.#so.getY());if(n>this.#to/2||i>this.#to/2){const n=this.#Io(e);n.length>0&&this.#go(n),this.#so=t}};mouseup=e=>{if(this.#$i){if(this.#$i=!1,this.#Po(e),void 0===this.#eo)throw new Error(Ta);if(void 0===this.#lo)throw new Error(La);if(void 0===this.#co)throw new Error(wa);this.#lo.reverse(),this.#co.reverse();const t=this.#So().getId(),n=this.#Di.getData(this.#eo);if(!n)throw new Error(Ra(ma,this.#eo));const i=new Ma;i.mask=n.image,i.dataId=this.#eo,i.offsetsLists=this.#lo,i.mode=this.#io,i.segmentNumber=this.#oo,i.srclayerid=t,i.originalValuesLists=this.#co;const o=new Ua(i);o.onExecute=e=>{this.dispatchEvent(e)},o.onUndo=e=>{this.dispatchEvent(e),this.#Hi.recalculateLabels()},this.#Di.addToUndoStack(o),this.dispatchEvent(o.getExecuteEvent()),this.#Hi.recalculateLabels()}};mouseout=e=>{this.mouseup(e)};touchstart=e=>{this.mousedown(e)};touchmove=e=>{this.mousemove(e)};touchend=e=>{this.mouseup(e)};wheel=e=>{this.#Ji.wheel(e)};#So(){if(void 0===this.#eo)throw new Error(Aa);if(void 0===this.#ao)throw new Error("No current layer group");const e=this.#ao.getViewLayersByDataId(this.#eo);if(0===e.length)throw new Error(Oa);return 1!==e.length&&h.warn(Ca),e[0]}keydown=e=>{e.context="Brush",this.#Di.onKeydown(e);const t=e.ctrlKey||e.altKey;if(!t&&"+"===e.key&&this.#to+1<this.#no.max){this.#to+=1;const e=new CustomEvent("brushsizechange",{detail:{value:this.#to}});this.dispatchEvent(e)}else if(!t&&"-"===e.key&&this.#to-1>=this.#no.min){this.#to-=1;const e=new CustomEvent("brushsizechange",{detail:{value:this.#to}});this.dispatchEvent(e)}else t||Number.isNaN(Number.parseInt(e.key,10))?t||"a"!==e.key?t||"d"!==e.key||(this.#io=Ea,h.debug("Brush mode: "+this.#io)):(this.#io=Fa,h.debug("Brush mode: "+this.#io)):this.#io=Fa};activate(e){const t=function(e){let t=[];if(!e)return[];for(const n in e)if(e[n]){const i=e[n];if(Array.isArray(i)){const e=i.map((function(e){return e.divId}));t=[...t,...e]}}return[...new Set(t)]}(this.#Di.getDataViewConfigs());e?this.#Ao(t):this.#Oo(t)}#Ao(e){for(const t of e){const e=document.querySelector("#"+t);if(!e)return;e.addEventListener("contextmenu",(e=>{e.preventDefault(),e.stopPropagation()}))}}#Oo(e){for(const t of e){const e=document.querySelector("#"+t);if(!e)return;e.addEventListener("contextmenu",(e=>{}))}}setFeatures(e){void 0!==e.brushSizeRange&&(this.#no=e.brushSizeRange),void 0!==e.brushSize&&e.brushSize>=this.#no.min&&e.brushSize<this.#no.max&&(this.#to=e.brushSize),void 0!==e.brushMode&&(this.#io=e.brushMode),e.createMask?this.#eo=void 0:void 0!==e.maskDataId&&(this.#eo=e.maskDataId),void 0!==e.selectedSegmentNumber&&(this.#oo=e.selectedSegmentNumber),void 0!==e.blacklist&&(this.#uo=e.blacklist)}init(){}getEventNames(){return["brushdraw","brushremove","brushsizechange","erasingactivated","erasingdeactivated"]}getHelpKeys(){return{title:"tool.Brush.name",brief:"tool.Brush.brief",mouse:{mouse_click:"tool.Brush.mouse_click"},touch:{touch_click:"tool.Brush.touch_click"}}}}class Va{constructor(e,t){this.pointArray=e?e.slice():[],this.controlPointIndexArray=t?t.slice():[]}getPoint(e){return this.pointArray[e]}isControlPoint(e){const t=this.pointArray.indexOf(e);if(-1!==t)return-1!==this.controlPointIndexArray.indexOf(t);throw new Error("Error: isControlPoint called with not in list point.")}getLength(){return this.pointArray.length}addPoint(e){this.pointArray.push(e)}addControlPoint(e){const t=this.pointArray.indexOf(e);if(-1===t)throw new Error("Cannot mark a non registered point as control point.");this.controlPointIndexArray.push(t)}addPoints(e){this.pointArray=this.pointArray.concat(e)}appenPath(e){const t=this.pointArray.length;this.pointArray=this.pointArray.concat(e.pointArray);const n=[];for(let i=0;i<e.controlPointIndexArray.length;++i)n[i]=e.controlPointIndexArray[i]+t;this.controlPointIndexArray=this.controlPointIndexArray.concat(n)}}class Na{constructor(e,t){this.bucketCount=1<<e,this.mask=this.bucketCount-1,this.size=0,this.loc=0,this.cost=void 0!==t?t:function(e){return e},this.buckets=this.buildArray(this.bucketCount)}push(e){const t=this.getBucket(e);e.next=this.buckets[t],this.buckets[t]=e,this.size++}pop(){if(0===this.size)throw new Error("Cannot pop, bucketQueue is empty.");for(;null===this.buckets[this.loc];)this.loc=(this.loc+1)%this.bucketCount;const e=this.buckets[this.loc];return this.buckets[this.loc]=e.next,e.next=null,this.size--,e}remove(e){if(!e)return!1;const t=this.getBucket(e);let n=this.buckets[t];for(;null!==n&&(null===n.next||e.x!==n.next.x||e.y!==n.next.y);)n=n.next;return null!==n&&(n.next=n.next.next,this.size--,!0)}isEmpty(){return 0===this.size}getBucket(e){return this.cost(e)&this.mask}buildArray(e){const t=new Array(e);for(let e=0;e<t.length;e++)t[e]=null;return t}}const Ba=2/(3*Math.PI);function ka(e,t,n,i,o){const r=e[i][n],a=t[i][n];let s=Math.sqrt(r*r+a*a);s=Math.max(s,1e-100),o.x=r/s,o.y=a/s}class Ga{constructor(){this.width=-1,this.height=-1,this.curPoint=null,this.searchGranBits=8,this.searchGran=1<<this.searchGranBits,this.pointsPerPost=500,this.greyscale=null,this.laplace=null,this.gradient=null,this.gradX=null,this.gradY=null,this.parents=null,this.working=!1,this.trained=!1,this.trainingPoints=null,this.edgeWidth=2,this.trainingLength=32,this.edgeGran=256,this.edgeTraining=null,this.gradPointsNeeded=32,this.gradGran=1024,this.gradTraining=null,this.insideGran=256,this.insideTraining=null,this.outsideGran=256,this.outsideTraining=null}getTrainingIdx(e,t){return Math.round((e-1)*t)}getTrainedEdge(e){return this.edgeTraining[this.getTrainingIdx(this.edgeGran,e)]}getTrainedGrad(e){return this.gradTraining[this.getTrainingIdx(this.gradGran,e)]}getTrainedInside(e){return this.insideTraining[this.getTrainingIdx(this.insideGran,e)]}getTrainedOutside(e){return this.outsideTraining[this.getTrainingIdx(this.outsideGran,e)]}setWorking(e){this.working=e}setDimensions(e,t){this.width=e,this.height=t}setData(e){if(-1===this.width||-1===this.height)throw new Error("Dimensions have not been set.");this.greyscale=function(e,t,n){const i={data:[]};for(let o=0;o<n;o++){i.data[o]=[];for(let n=0;n<t;n++){const r=4*(o*t+n);i.data[o][n]=(e[r]+e[r+1]+e[r+2])/765}}return i.dx=function(e,t){return e+1===this.data[t].length&&e--,this.data[t][e+1]-this.data[t][e]},i.dy=function(e,t){return t+1===this.data.length&&t--,this.data[t][e]-this.data[t+1][e]},i.gradMagnitude=function(e,t){const n=this.dx(e,t),i=this.dy(e,t);return Math.sqrt(n*n+i*i)},i.laplace=function(e,t){let n=-16*this.data[t][e];return n+=this.data[t-2][e],n+=this.data[t-1][e-1]+2*this.data[t-1][e]+this.data[t-1][e+1],n+=this.data[t][e-2]+2*this.data[t][e-1]+2*this.data[t][e+1]+this.data[t][e+2],n+=this.data[t+1][e-1]+2*this.data[t+1][e]+this.data[t+1][e+1],n+=this.data[t+2][e],n},i}(e,this.width,this.height),this.laplace=function(e){const t=[];t[0]=[],t[1]=[];for(let n=1;n<e.data.length;n++)t[0][n]=1,t[1][n]=1;for(let n=2;n<e.data.length-2;n++){t[n]=[],t[n][0]=1,t[n][1]=1;for(let i=2;i<e.data[n].length-2;i++)t[n][i]=e.laplace(i,n)>.33?0:1;t[n][e.data[n].length-2]=1,t[n][e.data[n].length-1]=1}t[e.data.length-2]=[],t[e.data.length-1]=[];for(let n=1;n<e.data.length;n++)t[e.data.length-2][n]=1,t[e.data.length-1][n]=1;return t}(this.greyscale),this.gradient=function(e){const t=[];let n,i,o=0;for(i=0;i<e.data.length-1;i++){for(t[i]=[],n=0;n<e.data[i].length-1;n++)t[i][n]=e.gradMagnitude(n,i),o=Math.max(t[i][n],o);t[i][e.data[i].length-1]=t[i][e.data.length-2]}t[e.data.length-1]=[];for(let n=0;n<t[0].length;n++)t[e.data.length-1][n]=t[e.data.length-2][n];for(i=0;i<t.length;i++)for(n=0;n<t[i].length;n++)t[i][n]=1-t[i][n]/o;return t}(this.greyscale),this.gradX=function(e){const t=[];for(let n=0;n<e.data.length;n++){t[n]=[];for(let i=0;i<e.data[n].length-1;i++)t[n][i]=e.dx(i,n);t[n][e.data[n].length-1]=t[n][e.data[n].length-2]}return t}(this.greyscale),this.gradY=function(e){const t=[];for(let n=0;n<e.data.length-1;n++){t[n]=[];for(let i=0;i<e.data[n].length;i++)t[n][i]=e.dy(i,n)}t[e.data.length-1]=[];for(let n=0;n<e.data[0].length;n++)t[e.data.length-1][n]=t[e.data.length-2][n];return t}(this.greyscale);const t=function(e,t,n,i){const o={inside:[],outside:[]},r={x:-1,y:-1};for(let a=0;a<t.length;a++){o.inside[a]=[],o.outside[a]=[];for(let s=0;s<t[a].length;s++){ka(t,n,s,a,r);let l=Math.round(s+e*r.y),c=Math.round(a-e*r.x),u=Math.round(s-e*r.y),d=Math.round(a+e*r.x);l=Math.max(Math.min(l,t[a].length-1),0),u=Math.max(Math.min(u,t[a].length-1),0),c=Math.max(Math.min(c,t.length-1),0),d=Math.max(Math.min(d,t.length-1),0),o.inside[a][s]=i.data[c][l],o.outside[a][s]=i.data[d][u]}}return o}(this.edgeWidth,this.gradX,this.gradY,this.greyscale);this.inside=t.inside,this.outside=t.outside,this.edgeTraining=[],this.gradTraining=[],this.insideTraining=[],this.outsideTraining=[]}findTrainingPoints(e){const t=[];if(null!==this.parents)for(let n=0;n<this.trainingLength&&e;n++)t.push(e),e=this.parents[e.y][e.x];return t}resetTraining(){this.trained=!1}doTraining(e){if(this.trainingPoints=this.findTrainingPoints(e),this.trainingPoints.length<8)return;const t=[];this.calculateTraining(t,this.edgeGran,this.greyscale,this.edgeTraining),this.calculateTraining(t,this.gradGran,this.gradient,this.gradTraining),this.calculateTraining(t,this.insideGran,this.inside,this.insideTraining),this.calculateTraining(t,this.outsideGran,this.outside,this.outsideTraining),this.trainingPoints.length<this.gradPointsNeeded&&this.addInStaticGrad(this.trainingPoints.length,this.gradPointsNeeded),this.trained=!0}calculateTraining(e,t,n,i){let o;for(e.length=t,o=0;o<t;o++)e[o]=0;let r=1;for(o=0;o<this.trainingPoints.length;o++){const i=this.trainingPoints[o],a=this.getTrainingIdx(t,n[i.y][i.x]);e[a]+=1,r=Math.max(r,e[a])}for(o=0;o<t;o++)e[o]=1-e[o]/r;!function(e,t){t[0]=.4*e[0]+.5*e[1]+.1*e[1],t[1]=.25*e[0]+.4*e[1]+.25*e[2]+.1*e[3];for(let n=2;n<e.length-2;n++)t[n]=.05*e[n-2]+.25*e[n-1]+.4*e[n]+.25*e[n+1]+.05*e[n+2];const n=e.length;t[n-2]=.25*e[n-1]+.4*e[n-2]+.25*e[n-3]+.1*e[n-4],t[n-1]=.4*e[n-1]+.5*e[n-2]+.1*e[n-3]}(e,i)}addInStaticGrad(e,t){for(let n=0;n<this.gradGran;n++)this.gradTraining[n]=Math.min(this.gradTraining[n],1-n*(t-e)/(t*this.gradGran))}gradDirection(e,t,n,i){return function(e,t,n,i,o,r){const a={x:-1,y:-1},s={x:-1,y:-1};ka(e,t,n,i,a),ka(e,t,o,r,s);let l=a.y*(o-n)-a.x*(r-i),c=s.y*(o-n)-s.x*(r-i);return l<0&&(l=-l,c=-c),n!==o&&i!==r&&(l*=Math.SQRT1_2,c*=Math.SQRT1_2),Ba*(Math.acos(l)+Math.acos(c))}(this.gradX,this.gradY,e,t,n,i)}dist(e,t,n,i){let o=this.gradient[i][n];e!==n&&t!==i||(o*=Math.SQRT1_2);const r=this.laplace[i][n],a=this.gradDirection(e,t,n,i);return this.trained?.3*this.getTrainedGrad(o)+.3*r+.1*(a+this.getTrainedEdge(this.greyscale.data[t][e])+this.getTrainedInside(this.inside[t][e])+this.getTrainedOutside(this.outside[t][e])):.43*o+.43*r+.11*a}adj(e){const t=[],n=Math.max(e.x-1,0),i=Math.max(e.y-1,0),o=Math.min(e.x+1,this.greyscale.data[0].length-1),r=Math.min(e.y+1,this.greyscale.data.length-1);let a=0;for(let s=i;s<=r;s++)for(let i=n;i<=o;i++)i===e.x&&s===e.y||(t[a++]={x:i,y:s});return t}#bo=e=>Math.round(this.searchGran*this.cost[e.y][e.x]);setPoint(e){let t,n;for(this.setWorking(!0),this.curPoint=e,this.visited=[],n=0;n<this.height;n++)for(this.visited[n]=[],t=0;t<this.width;t++)this.visited[n][t]=!1;for(this.parents=[],n=0;n<this.height;n++)this.parents[n]=[];for(this.cost=[],n=0;n<this.height;n++)for(this.cost[n]=[],t=0;t<this.width;t++)this.cost[n][t]=Number.MAX_VALUE;this.cost[e.y][e.x]=0,this.pq=new Na(this.searchGranBits,this.#bo),this.pq.push(e)}doWork(){if(!this.working)return;this.timeout=null;let e=0;const t=[];for(;!this.pq.isEmpty()&&e<this.pointsPerPost;){const n=this.pq.pop();t.push(n),t.push(this.parents[n.y][n.x]),this.visited[n.y][n.x]=!0;const i=this.adj(n);for(let e=0;e<i.length;e++){const t=i[e],o=this.cost[n.y][n.x]+this.dist(n.x,n.y,t.x,t.y);o<this.cost[t.y][t.x]&&(this.cost[t.y][t.x]!==Number.MAX_VALUE&&this.pq.remove(t),this.cost[t.y][t.x]=o,this.parents[t.y][t.x]=n,this.pq.push(t))}e++}return t}}class Ha{#xo;constructor(e){this.#xo=e}getPosition(e){let t=e.labelPosition;return void 0===t&&(t=this.#xo(e)),t}create(t,n){const i=new e.Text({fontSize:n.getFontSize(),fontFamily:n.getFontFamily(),fill:t.colour,padding:n.getTextPadding(),shadowColor:n.getShadowLineColour(),shadowOffset:n.getShadowOffset(),name:"text"}),o=t.getText();i.setText(o);const r=n.applyZoomScale(1),a={x:2*r.x,y:2*r.y},s=this.getPosition(t),l=new e.Label({x:s.getX(),y:s.getY(),scale:a,visible:0!==o.length,name:"label"});return l.add(i),l.add(new e.Tag({fill:t.colour,opacity:n.getTagOpacity()})),l}updatePosition(t,n){const i=n.getChildren((function(e){return"label"===e.name()}))[0];if(!(i instanceof e.Label))return;const o=this.getPosition(t);i.position({x:o.getX(),y:o.getY()})}getLabelAnchorsPosition(e){const t=e.x(),n=e.y(),i=e.width()*e.scale().x,o=e.height()*e.scale().y;return[new E(t+i/2,n),new E(t,n+o/2),new E(t+i/2,n+o),new E(t+i,n+o/2)]}getClosestPoints(e,t){let n=e[0].getDistance(t[0]),i=e[0],o=t[0];for(const r of e)for(const e of t){const t=r.getDistance(e);t<n&&(n=t,i=r,o=e)}return[i,o]}getConnector(t,n,i){const o=this.getLabelAnchorsPosition(n),r=this.getClosestPoints(t,o);return new e.Line({points:[r[0].getX(),r[0].getY(),r[1].getX(),r[1].getY()],stroke:n.getText().fill(),strokeWidth:i.getStrokeWidth(),strokeScaleEnabled:!1,visible:n.visible(),dash:[10,7],name:"connector"})}updateConnector(t,n){const i=t.getChildren((function(e){return"label"===e.name()}))[0];if(!(i instanceof e.Label))return;const o=this.getLabelAnchorsPosition(i),r=this.getClosestPoints(n,o),a=t.getChildren((function(e){return"connector"===e.name()}))[0];a instanceof e.Line&&a.points([r[0].getX(),r[0].getY(),r[1].getX(),r[1].getY()])}updateContent(t,n){const i=n.getChildren((function(e){return"label"===e.name()}))[0];if(!(i instanceof e.Label))return;const o=t.getText();i.getText().setText(o),i.visible()&&i.visible(0!==o.length)}}class za{#Ro=0;#Eo=0;getMin(){return this.#Ro}setMin(e){this.#Ro=e}getMax(){return this.#Eo}setMax(e){this.#Eo=e}getName(){return"Threshold"}#Fo=null;setOriginalImage(e){this.#Fo=e}getOriginalImage(){return this.#Fo}update(){const e=this.getOriginalImage(),t=e.getDataRange().min;return e.transform((e=>e<this.getMin()||e>this.getMax()?t:e))}}class Ya{getName(){return"Sharpen"}#Fo=null;setOriginalImage(e){this.#Fo=e}getOriginalImage(){return this.#Fo}update(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])}}class Xa{getName(){return"Sobel"}#Fo=null;setOriginalImage(e){this.#Fo=e}getOriginalImage(){return this.#Fo}update(){const e=this.getOriginalImage(),t=e.convolute2D([1,0,-1,2,0,-2,1,0,-1]),n=e.convolute2D([1,2,1,0,0,0,-1,-2,-1]);return t.compose(n,(function(e,t){return Math.sqrt(e*e+t*t)}))}}class Wa extends Fr{#qo;#rn;#Di;constructor(e,t,n){super(),this.#qo=e,this.#rn=t,this.#Di=n}getName(){return"Filter-"+this.#qo.getName()}execute(){this.#Di.setImage(this.#rn,this.#qo.update()),this.#Di.render(this.#rn);const e={type:"filterrun",id:this.getName(),dataId:this.#rn};this.onExecute(e)}undo(){this.#Di.setImage(this.#rn,this.#qo.getOriginalImage()),this.#Di.render(this.#rn);const e={type:"filterundo",id:this.getName(),dataid:this.#rn};this.onUndo(e)}onExecute(e){}onUndo(e){}}const ja={},Za={},_a={WindowLevel:class{#Di;#$i=!1;#so;#Ji;#Mo=!0;constructor(e){this.#Di=e,this.#Ji=new ra(e)}#Uo(e){let t;if(this.#Mo)t=e.getActiveViewLayer();else{const n=function(e){return e.getViewController().isMonochrome()};t=e.getViewLayersFromActive(n)[0]}return t}#Qo(e,t){const n=this.#Di.getLayerGroupByDivId(t),i=this.#Uo(n);void 0!==i&&i.getViewController().isMonochrome()&&(this.#$i=!0,this.#so=e)}#Jn(e,t){if(!this.#$i)return;const n=this.#Di.getLayerGroupByDivId(t),i=this.#Uo(n);if(void 0===i)return;const o=i.getViewController(),r=e.getX()-this.#so.getX(),a=this.#so.getY()-e.getY(),s=o.getImageRescaledDataRange(),l=.001*(s.max-s.min),c=o.getWindowLevel().center,u=o.getWindowLevel().width,d=new f(c+a*l,u+r*l);o.setWindowLevel(d),this.#so=e}#Vo(){this.#$i&&(this.#$i=!1)}mousedown=e=>{const t=xr(e),n=ta(e);this.#Qo(t,n.groupDivId)};mousemove=e=>{const t=xr(e),n=ta(e);this.#Jn(t,n.groupDivId)};mouseup=e=>{this.#Vo()};mouseout=e=>{this.#Vo()};touchstart=e=>{const t=br(e),n=ta(e);this.#Qo(t[0],n.groupDivId)};touchmove=e=>{const t=br(e),n=ta(e);this.#Jn(t[0],n.groupDivId)};touchend=e=>{this.#Vo()};dblclick=e=>{const t=ta(e),n=xr(e),i=this.#Di.getLayerGroupByDivId(t.groupDivId),o=this.#Uo(i);if(void 0===o)return;const r=o.displayToPlaneIndex(n),a=o.getViewController();if(!a.isMonochrome())return;const s=this.#Di.getData(o.getDataId()).image,l=new f(s.getRescaledValueAtIndex(a.getCurrentIndex().getWithNew2D(r.get(0),r.get(1))),a.getWindowLevel().width);a.setWindowLevel(l)};wheel=e=>{this.#Ji.wheel(e)};keydown=e=>{e.context="WindowLevel",this.#Di.onKeydown(e)};activate(e){}init(){}setFeatures(e){void 0!==e.strictViewLayer&&(this.#Mo=e.strictViewLayer)}},Scroll:class{#Di;#$i=!1;#so;#Ji;#No;#Bo=!1;#ko;constructor(e){this.#Di=e,this.#Ji=new ra(e)}#Go(e){let t=e.getActiveViewLayer();if(void 0===t){const n=e.getActiveDrawLayer();if(void 0===n)return void h.warn("No draw layer to do scroll");t=e.getViewLayerById(n.getReferenceLayerId())}return t}#Qo(e,t){this.#Ho();const n=this.#Di.getLayerGroupByDivId(t),i=this.#Go(n);if(void 0===i)return void h.warn("No view layer to start scroll");const o=i.getViewController();o.isPlaying()&&o.stop();const r=i.displayToPlanePos(e),a=o.getPositionFromPlanePoint(r);o.setCurrentPosition(a),this.#$i=!0,this.#so=e}#Jn(e,t){if(!this.#$i)return void(this.#Bo&&this.#zo(e,t));const n=this.#Di.getLayerGroupByDivId(t),i=n.getPositionHelper(),o=e.getY()-this.#so.getY(),r=Math.abs(o)>15,a=e.getX()-this.#so.getX(),s=Math.abs(a)>15;r&&n.canScroll()?o>0?i.decrementPositionAlongScroll():i.incrementPositionAlongScroll():s&&n.moreThanOne(3)&&(a>0?i.incrementPosition(3):i.decrementPosition(3)),(s||r)&&(this.#so=e)}#Vo(){this.#$i&&(this.#$i=!1)}mousedown=e=>{const t=xr(e),n=ta(e);this.#Qo(t,n.groupDivId)};mousemove=e=>{const t=xr(e),n=ta(e);this.#Jn(t,n.groupDivId)};mouseup=e=>{this.#Vo()};mouseout=e=>{this.#Vo(),this.#Ho()};touchstart=e=>{this.#No=setTimeout((()=>{this.dblclick(e)}),500);const t=br(e),n=ta(e);this.#Qo(t[0],n.groupDivId)};touchmove=e=>{null!==this.#No&&(clearTimeout(this.#No),this.#No=null);const t=br(e),n=ta(e);this.#Jn(t[0],n.groupDivId)};touchend=e=>{null!==this.#No&&(clearTimeout(this.#No),this.#No=null),this.#Vo()};wheel=e=>{this.#Ji.wheel(e)};keydown=e=>{e.context="Scroll",this.#Di.onKeydown(e)};dblclick=e=>{const t=ta(e),n=this.#Di.getLayerGroupByDivId(t.groupDivId).getActiveViewLayer();void 0!==n&&n.getViewController().play()};#zo(e,t){const n=this.#Di.getLayerGroupByDivId(t);this.#ko=t,n.showTooltip(e)}#Ho(){void 0!==this.#ko&&(this.#Di.getLayerGroupByDivId(this.#ko).removeTooltipDiv(),this.#ko=void 0)}activate(e){e||this.#Ho()}setFeatures(e){void 0!==e.displayTooltip&&(this.#Bo=e.displayTooltip)}init(){}},ZoomAndPan:class{#Di;#$i=!1;#so;#Yo;#Xo;#Wo;constructor(e){this.#Di=e}#Go(e){let t=e.getActiveViewLayer();if(void 0===t){const n=e.getActiveDrawLayer();if(void 0===n)return void h.warn("No draw layer to do zoom/pan");t=e.getViewLayerById(n.getReferenceLayerId())}return t}#Qo(e){this.#$i=!0,this.#so=e,this.#Yo=!1}#jo=e=>{this.#$i=!0,this.#so=e[0],this.#Yo=!1,this.#Xo=new Co(e[0],e[1]),this.#Wo=this.#Xo.getCentroid()};#Jn(e,t){if(!this.#$i)return;this.#Yo=!0;const n=e.getX()-this.#so.getX(),i=e.getY()-this.#so.getY(),o=this.#Di.getLayerGroupByDivId(t),r=this.#Go(o);if(void 0===r)return void h.warn("No view layer to update zoom/pan");const a=r.getViewController(),s=r.displayToPlaneScale(new E(n,i)),l=a.getOffset3DFromPlaneOffset({x:s.getX(),y:s.getY()});o.addTranslation({x:l.getX(),y:l.getY(),z:l.getZ()}),o.draw(),this.#so=e}#Zo=(e,t)=>{if(!this.#$i)return;this.#Yo=!0;const n=new Co(e[0],e[1]).getLength()/this.#Xo.getLength(),i=this.#Di.getLayerGroupByDivId(t),o=i.getPositionHelper();if(1===n){const t=e[0].getY()-this.#so.getY();if(Math.abs(t)<15)return;i.canScroll()&&(t>0?o.incrementPositionAlongScroll():o.decrementPositionAlongScroll())}else{const e=(n-1)/10;if(Math.abs(e)%.1<=.05&&void 0!==this.#Wo){const t=this.#Go(i);if(void 0===t)return void h.warn("No view layer to do touch zoom/pan");const n=t.getViewController(),o=t.displayToMainPlanePos(this.#Wo),r=n.getPlanePositionFromPlanePoint(o);i.addScale(e,r),i.draw()}}};#_o(e,t){const n=this.#Di.getLayerGroupByDivId(t),i=this.#Go(n);if(void 0===i)return void h.warn("No view layer to set current position");const o=i.getViewController(),r=i.displayToPlanePos(e),a=o.getPositionFromPlanePoint(r);o.setCurrentPosition(a)}#Vo(){this.#$i&&(this.#$i=!1)}mousedown=e=>{const t=xr(e);this.#Qo(t)};mousemove=e=>{const t=xr(e),n=ta(e);this.#Jn(t,n.groupDivId)};mouseup=e=>{if(!this.#Yo){const t=xr(e),n=ta(e);this.#_o(t,n.groupDivId)}this.#Vo()};mouseout=e=>{this.#Vo()};touchstart=e=>{const t=br(e);1===t.length?this.#Qo(t[0]):2===t.length&&this.#jo(t)};touchmove=e=>{const t=br(e),n=ta(e);1===t.length?this.#Jn(t[0],n.groupDivId):2===t.length&&this.#Zo(t,n.groupDivId)};touchend=e=>{if(!this.#Yo){const t=xr(e),n=ta(e);this.#_o(t,n.groupDivId)}this.#Vo()};wheel=e=>{e.preventDefault();const t=-e.deltaY/500,n=ta(e),i=xr(e),o=this.#Di.getLayerGroupByDivId(n.groupDivId),r=this.#Go(o);if(void 0===r)return void h.warn("No view layer to do wheel zoom/pan");const a=r.getViewController(),s=r.displayToMainPlanePos(i),l=a.getPlanePositionFromPlanePoint(s);o.addScale(t,l),o.draw()};keydown=e=>{e.context="ZoomAndPan",this.#Di.onKeydown(e)};activate(e){}init(){}setFeatures(e){}},Opacity:class{#Di;#$i=!1;#so;#Ji;constructor(e){this.#Di=e,this.#Ji=new ra(e)}#Qo(e){this.#$i=!0,this.#so=e}#Jn(e,t){if(!this.#$i)return;const n=e.getX()-this.#so.getX();if(Math.abs(n)>15){const i=this.#Di.getLayerGroupByDivId(t).getActiveLayer(),o=i.getOpacity();i.setOpacity(o+n/200),i.draw(),this.#so=e}}#Vo(){this.#$i&&(this.#$i=!1)}mousedown=e=>{const t=xr(e);this.#Qo(t)};mousemove=e=>{const t=xr(e),n=ta(e);this.#Jn(t,n.groupDivId)};mouseup=e=>{this.#Vo()};mouseout=e=>{this.#Vo()};touchstart=e=>{const t=br(e);this.#Qo(t[0])};touchmove=e=>{const t=br(e),n=ta(e);this.#Jn(t[0],n.groupDivId)};touchend=e=>{this.#Vo()};wheel=e=>{this.#Ji.wheel(e)};keydown=e=>{e.context="Opacity",this.#Di.onKeydown(e)};activate(e){}init(){}setFeatures(e){}},Draw:class{#Di;#Ji;#Ko;#Jo=!1;#$o=null;#Ii=null;#er=null;#tr;#It=[];#nr=null;#ir=!0;#or;#rr;#ar;#sr;#Qn;#lr=!1;#O={};#cr=!1;#ur=[];constructor(e){this.#Di=e,this.#Ji=new ra(e),this.#Qn=new la(e,this.#j),this.#Ko=e.getStyle()}#dr(e){let t=!0;if(void 0!==this.#or){const n=e.getActiveViewLayer().getDataId(),i=this.#Di.getData(n).image.getMeta();t=this.#or(i)}return t}#hr(e){let t=!0;if(void 0!==this.#rr){const n=e.getDataId(),i=this.#Di.getData(n).annotationGroup.getMeta();t=this.#rr(i)}return t}#gr(e){const t=e.getActiveViewLayer().getDataId(),n=this.#Di.createAnnotationData(t);if(void 0!==this.#ar)for(const e of this.#ar)n.annotationGroup.setMetaValue(e.concept,e.value);this.#Di.addAndRenderAnnotationData(n,e.getDivId(),t);const i=e.getActiveDrawLayer();return i.setShapeHandler(this.#Qn),e.setActiveLayerByDataId(i.getDataId()),i}#Sr(e,t){const n=this.#Di.getLayerGroupByDivId(t);let i=n.getActiveDrawLayer();if(void 0===i){if(!this.#dr(n))return void this.#j({type:"warn",message:"Cannot create draw layer, reference meta is invalid"});i=this.#gr(n)}else if(!this.#hr(i))return void this.#j({type:"warn",message:"Cannot create draw, data meta is invalid"});const o=i.getDrawController().getAnnotationGroup(),r=i.getKonvaStage();if(this.#Ko.setZoomScale(r.scale()),o.isEditable()){const t=r.getIntersection({x:e.getX(),y:e.getY()});t?this.#pr(i,t):this.#mr(n,e)}}#Go(e){const t=e.getActiveDrawLayer();if(void 0!==t)return e.getViewLayerById(t.getReferenceLayerId());h.warn("No draw layer to do draw")}#mr(e,t){this.#Qn.disableAndResetEditor(),this.#fr();const n=this.#Go(e);void 0!==n?(this.#nr=n.displayToPlanePos(t),this.#It.push(this.#nr)):h.warn("No view layer to start shape")}#fr(){this.#Jo=!0,this.#Ii=new this.#$o[this.#tr],this.#It=[]}#vr(){this.#Jo=!1,this.#It=[]}#pr(t,n){let i=n.getParent();n instanceof e.Tag&&(i=i.getParent());const o=i.find(".shape")[0];o instanceof e.Shape&&(this.#j({type:"annotationselect",annotationid:i.id(),dataid:t.getDataId()}),this.#Qn.setEditorShape(o,t))}#Dr(e,t){const n=this.#Di.getLayerGroupByDivId(t),i=this.#Go(n);if(void 0===i)return void h.warn("No view layer to update shape");const o=i.displayToPlanePos(e);i.getViewController().validatePlanePoint(o)&&(Math.abs(o.getX()-this.#nr.getX())>0||Math.abs(o.getY()-this.#nr.getY())>0)&&(this.#cr&&this.#It.pop(),this.#nr=o,this.#cr=!0,this.#It.push(this.#nr),this.#yr(this.#It,n))}#Cr(e){if(0!==this.#It.length){if(this.#It.length===this.#Ii.getNPoints()){const t=this.#Di.getLayerGroupByDivId(e);this.#Ir(this.#It,t),this.#vr()}this.#cr=!1}else h.warn("Draw mouseup but no points...")}#Tr(e){const t=ta(e),n=this.#Di.getLayerGroupByDivId(t.groupDivId).getBaseViewLayer().getDataId();return this.#Di.getData(n).image.isResampled()}mousedown=e=>{if(this.#Jo||this.#Tr(e))return;const t=xr(e),n=ta(e);this.#Sr(t,n.groupDivId)};mousemove=e=>{if(!this.#Jo)return;const t=xr(e),n=ta(e);this.#Dr(t,n.groupDivId)};mouseup=e=>{if(!this.#Jo)return;const t=ta(e);this.#Cr(t.groupDivId)};mouseout=e=>{this.mouseup(e)};dblclick=e=>{if(this.#Ii&&void 0!==this.#Ii.getNPoints())return;if(!this.#Jo)return;if(0===this.#It.length)return void h.warn("Draw dblclick but no points...");const t=ta(e),n=this.#Di.getLayerGroupByDivId(t.groupDivId);this.#Ir(this.#It,n),this.#vr()};touchstart=e=>{if(this.#Jo)return;const t=br(e),n=ta(e);this.#Sr(t[0],n.groupDivId)};touchmove=e=>{if(!this.#Jo)return;const t=ta(e),n=br(e),i=this.#Di.getLayerGroupByDivId(t.groupDivId),o=this.#Go(i);if(void 0===o)return void h.warn("No view layer to handle touch move");const r=o.displayToPlanePos(n[0]);o.getViewController().validatePlanePoint(r)&&(Math.abs(r.getX()-this.#nr.getX())>0||Math.abs(r.getY()-this.#nr.getY())>0)&&(1!==this.#It.length&&this.#It.pop(),this.#nr=r,this.#It.push(this.#nr),this.#It.length<this.#Ii.getNPoints()&&(clearTimeout(this.timer),this.timer=setTimeout((()=>{this.#It.push(this.#nr)}),this.#Ii.getTimeout())),this.#yr(this.#It,i))};touchend=e=>{this.dblclick(e)};wheel=e=>{this.#ir&&this.#Ji.wheel(e)};keydown=e=>{this.#Jo||(e.context="Draw",this.#Di.onKeydown(e));const t=this.#Qn.getEditorAnnotation();if(("Delete"===e.key||"Backspace"===e.key)&&void 0!==t){const e=this.#Di.getActiveLayerGroup().getActiveDrawLayer();if(void 0===e)return void h.warn("No draw layer to handle key down");const n=e.getDrawController(),i=new Ur(t,n);this.#Di.addToUndoStack(i),i.execute(),this.#Qn.onMouseOutShapeGroup()}if("Escape"===e.key&&null!==this.#er){const e=this.#er.getLayer();this.#er.destroy(),this.#er=null,this.#vr(),e.draw()}};#yr(e,t){this.#er&&(this.#er.destroy(),this.#er=null);const n=t.getActiveDrawLayer();if(void 0===n)return void h.warn("No draw layer to handle new points");const i=n.getDrawController(),o=n.getKonvaLayer(),r=t.getViewLayerById(n.getReferenceLayerId());if(void 0===r)return void h.warn("No view layer to handle new points");const a=r.getViewController();if(this.#lr){const e=["#ffff80","#ff80ff","#80ffff","#80ff80","8080ff","ff8080"],t=n.getId(),i=t.substring(t.length-1),o=e[parseInt(i,10)-1];void 0!==o&&this.#Ko.setLineColour(o)}const s=new Ja,l=i.getAnnotationGroup().getColour();s.colour=void 0!==l?l:this.#Ko.getLineColour(),s.init(a),this.#Ii.setAnnotationMathShape(s,e),this.#er=this.#Ii.createShapeGroup(s,this.#Ko),n.setLabelVisibility(this.#er),this.#er.getChildren(kr)[0].listening(!1),o.listening(!1),o.add(this.#er),o.draw()}#Ir(e,t){this.#er&&(this.#er.destroy(),this.#er=null);const n=t.getActiveDrawLayer();if(void 0===n)return void h.warn("No draw layer to handle final points");const i=n.getKonvaLayer(),o=n.getDrawController(),r=t.getViewLayerById(n.getReferenceLayerId());if(void 0===r)return void h.warn("No view layer to handle final points");const a=r.getViewController(),s=new Ja,l=o.getAnnotationGroup().getColour();if(s.colour=void 0!==l?l:this.#Ko.getLineColour(),s.init(a),void 0!==this.#sr)for(const e of this.#sr)s.addMetaItem(e.concept,e.value);this.#Ii.setAnnotationMathShape(s,e);const c=new Mr(s,o);this.#Di.addToUndoStack(c),c.execute(),i.listening(!0)}#Lr(e){const t=e.getId();return void 0===this.#ur[t]&&(this.#ur[t]=()=>{e.activateCurrentPositionShapes(!0)}),this.#ur[t]}#wr(e,t){e.setShapeHandler(this.#Qn),e.activateCurrentPositionShapes(t),t?this.#Di.addEventListener("positionchange",this.#Lr(e)):this.#Di.removeEventListener("positionchange",this.#Lr(e))}activate(e){e||this.#Qn.onMouseOutShapeGroup();const t=this.#Di.getDrawLayers();for(const n of t)void 0!==n&&this.#wr(n,e);this.#Di.addEventListener("drawlayeradd",(t=>{const n=this.#Di.getDrawLayers((function(e){return e.getId()===t.layerid}));1===n.length&&this.#wr(n[0],e)}))}setOptions(e){this.#$o=e}getOptionsType(){return"factory"}setFeatures(e){if(void 0!==e.autoShapeColour&&(this.#lr=e.autoShapeColour),void 0!==e.shapeColour&&(this.#Ko.setLineColour(e.shapeColour),this.#lr=!1),void 0!==e.shapeName){if(!this.hasShape(e.shapeName))throw new Error("Unknown shape: '"+e.shapeName+"'");this.#tr=e.shapeName}void 0!==e.mouseOverCursor&&this.#Qn.storeMouseOverCursor(e.mouseOverCursor),void 0!==e.withScroll&&(this.#ir=e.withScroll),void 0!==e.refMetaValidator&&(this.#or=e.refMetaValidator),void 0!==e.drawMetaValidator&&(this.#rr=e.drawMetaValidator),void 0!==e.annotationGroupMeta&&(this.#ar=e.annotationGroupMeta),void 0!==e.annotationMeta&&(this.#sr=e.annotationMeta)}init(){}getEventNames(){return["annotationupdate","annotationselect","warn"]}addEventListener(e,t){void 0===this.#O[e]&&(this.#O[e]=[]),this.#O[e].push(t)}removeEventListener(e,t){if(void 0!==this.#O[e])for(let n=0;n<this.#O[e].length;++n)this.#O[e][n]===t&&this.#O[e].splice(n,1)}#j=e=>{if(void 0!==this.#O[e.type])for(let t=0;t<this.#O[e.type].length;++t)this.#O[e.type][t](e)};hasShape(e){return void 0!==this.#$o[e]}},Brush:Qa,Filter:class{#Di;constructor(e){this.#Di=e}#Pr=null;#Ar=0;#X=new z;activate(e){for(const t in this.#Pr)e?(this.#Pr[t].addEventListener("filterrun",this.#j),this.#Pr[t].addEventListener("filterundo",this.#j)):(this.#Pr[t].removeEventListener("filterrun",this.#j),this.#Pr[t].removeEventListener("filterundo",this.#j))}setOptions(e){this.#Pr={};for(const t in e)this.#Pr[t]=new e[t](this.#Di)}getOptionsType(){return"instance"}init(){for(const e in this.#Pr)this.#Pr[e].init()}keydown=e=>{e.context="Filter",this.#Di.onKeydown(e)};getEventNames(){return["filterrun","filterundo"]}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)};getSelectedFilter(){return this.#Ar}setFeatures(e){if(void 0!==e.filterName){if(!this.hasFilter(e.filterName))throw new Error("Unknown filter: '"+e.filterName+"'");this.#Ar&&this.#Ar.activate(!1),this.#Ar=this.#Pr[e.filterName],this.#Ar.activate(!0)}if(void 0!==e.run&&e.run){let t={};void 0!==e.runArgs&&(t=e.runArgs),this.getSelectedFilter().run(t)}}getFilterList(){return this.#Pr}hasFilter(e){return this.#Pr[e]}},Floodfill:class{#Di;constructor(e){this.#Di=e}#Or=5;#br=0;#xr=2e3;#Rr=null;#Hi=null;#Er=10;#Fr=null;#$i=!1;#Dn;#qr;#Mr=null;#Ur=[];#Qr=!1;#Ko=new jr;setExtend(e){this.#Qr=e}getExtend(){return this.#Qr}#Go(e){const t=e.getActiveDrawLayer();if(void 0!==t)return e.getViewLayerById(t.getReferenceLayerId());h.warn("No draw layer to do floodfill")}#Vr=(e,t)=>{const n=this.#Di.getLayerGroupByDivId(t),i=this.#Go(n);if(void 0===i)return void h.warn("No view layer to get index");const o=i.displayToPlaneIndex(e);return{x:o.get(0),y:o.get(1)}};#Nr(e,n,i){this.#Ur=[];const o={data:this.#Rr.data,width:this.#Rr.width,height:this.#Rr.height,bytes:4};this.#Hi=t.floodFill(o,e.x,e.y,n),this.#Hi=t.gaussBlurOnlyBorder(this.#Hi,this.#Or);let r=t.traceContours(this.#Hi);if(r=t.simplifyContours(r,this.#br,this.#xr),r.length>0&&r[0].points[0].x){if(i)return r[0].points;for(let e=0,t=r[0].points.length;e<t;e++)this.#Ur.push(new E(r[0].points[e].x,r[0].points[e].y));return this.#Ur}return[]}#Br(e,t,n){if(this.#Mr=this.#Nr(e,t,!1),0!==this.#Mr.length){const e=n.getActiveDrawLayer();if(void 0===e)return h.warn("No draw layer to paint border"),!1;const t=e.getDrawController(),i=new Oo(this.#Mr);let o;if(void 0===this.#Dn){this.#Dn=new Ja,this.#Dn.colour=this.#Ko.getLineColour();const r=n.getViewLayerById(e.getReferenceLayerId());if(void 0===r)return h.warn("No view layer to paint border"),!1;const a=r.getViewController();this.#Dn.init(a),this.#Dn.mathShape=i,o=new Mr(this.#Dn,t)}else{const e=this.#Dn.mathShape;o=new Qr(this.#Dn,{mathShape:e},{mathShape:i},t)}this.#Di.addToUndoStack(o),o.execute()}return 0!==this.#Mr.length}extend(e,t,n){if(!this.#qr)throw"'initialpoint' not found. User must click before use extend!";const i=n.getPositionHelper(),o=this.#Go(n);if(void 0===o)return void h.warn("No view layer to extend floodfill");const r=o.getViewController(),a=r.getCurrentIndex(),s=r.getImageSize(),l=this.#Fr||this.#Er;for(let e=a.get(2),o=t||s.get(2);e<o&&this.#Br(this.#qr,l,n);e++)i.incrementPositionAlongScroll();r.setCurrentIndex(a);for(let t=a.get(2),o=e||0;t>o&&this.#Br(this.#qr,l,n);t--)i.decrementPositionAlongScroll();r.setCurrentIndex(a)}onThresholdChange(e){}#Tr(e){const t=this.#Di.getLayerGroupByDivId(e).getBaseViewLayer().getDataId();return this.#Di.getData(t).image.isResampled()}#Qo(e,t){if(this.#Tr(t))return;this.#Dn=void 0;const n=this.#Di.getLayerGroupByDivId(t);let i,o=n.getActiveDrawLayer();if(void 0===o){i=n.getActiveViewLayer();const e=i.getDataId(),r=this.#Di.createAnnotationData(e);this.#Di.addAndRenderAnnotationData(r,t,e),o=n.getActiveDrawLayer(),n.setActiveLayerByDataId(o.getDataId())}else if(i=n.getViewLayerById(o.getReferenceLayerId()),void 0===i)return void h.warn("No view layer to start floodfill");this.#Rr=i.getImageData(),this.#Rr?(this.#Ko.setZoomScale(o.getKonvaLayer().getAbsoluteScale()),this.#$i=!0,this.#qr=this.#Vr(e,t),this.#Br(this.#qr,this.#Er,n),this.onThresholdChange(this.#Er)):h.error("No image found")}#Jn(e,t){if(!this.#$i)return;const n=this.#Vr(e,t);this.#Fr=Math.round(Math.sqrt(Math.pow(this.#qr.x-n.x,2)+Math.pow(this.#qr.y-n.y,2))/2),this.#Fr=this.#Fr<this.#Er?this.#Er:this.#Fr-this.#Er,this.#Br(this.#qr,this.#Fr,this.#Di.getLayerGroupByDivId(t)),this.onThresholdChange(this.#Fr)}#Vo(){this.#$i&&(this.#$i=!1)}mousedown=e=>{const t=xr(e),n=ta(e);this.#Qo(t,n.groupDivId)};mousemove=e=>{const t=xr(e),n=ta(e);this.#Jn(t,n.groupDivId)};mouseup=e=>{this.#Vo()};mouseout=e=>{this.#Vo()};touchstart=e=>{const t=br(e),n=ta(e);this.#Qo(t[0],n.groupDivId)};touchmove=e=>{const t=br(e),n=ta(e);this.#Jn(t[0],n.groupDivId)};touchend=e=>{this.#Vo()};keydown=e=>{e.context="Floodfill",this.#Di.onKeydown(e)};activate(e){e&&(this.#Ko.setBaseScale(this.#Di.getBaseScale()),this.setFeatures({shapeColour:this.#Ko.getLineColour()}))}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#Ko.setLineColour(e.shapeColour)}},Livewire:class{#Di;constructor(e){this.#Di=e}#$i=!1;#so;#Dn;#Ko=new jr;#kr=new Va;#Gr=new Va;#Ur=[];#Hr=5;#zr(e){const t=e.get(1);for(let e=0;e<t;++e)this.#Ur[e]=[]}#Yr(){this.#kr=new Va,this.#Gr=new Va}#Xr=new Ga;#Tr(e){const t=this.#Di.getLayerGroupByDivId(e).getBaseViewLayer().getDataId();return this.#Di.getData(t).image.isResampled()}#Qo(e,t){if(this.#Tr(t))return;const n=this.#Di.getLayerGroupByDivId(t);let i,o=n.getActiveDrawLayer();i=void 0===o?n.getActiveViewLayer():n.getViewLayerById(o.getReferenceLayerId());const r=i.getViewController().getImageSize();this.#Xr.setDimensions(r.get(0),r.get(1)),this.#Xr.setData(i.getImageData().data);const a=i.displayToPlaneIndex(e);if(this.#$i){const e=Math.abs(a.get(0)-this.#so.getX()),t=Math.abs(a.get(1)-this.#so.getY());if(e<this.#Hr&&t<this.#Hr)this.#Wr();else{this.#kr=this.#Gr,this.#zr(r);const e={x:a.get(0),y:a.get(1)};this.#Xr.doTraining(e),this.#kr.addControlPoint(this.#Gr.getPoint(0))}}else{if(this.#Dn=void 0,this.#$i=!0,this.#so=new E(a.get(0),a.get(1)),this.#Yr(),this.#zr(r),void 0===o){const e=i.getDataId(),r=this.#Di.createAnnotationData(e);this.#Di.addAndRenderAnnotationData(r,t,e),o=n.getActiveDrawLayer(),n.setActiveLayerByDataId(o.getDataId())}this.#Ko.setZoomScale(o.getKonvaLayer().getAbsoluteScale());const e={x:a.get(0),y:a.get(1)};this.#Xr.doTraining(e);const s=new E(a.get(0),a.get(1));this.#kr.addPoint(s),this.#kr.addControlPoint(s)}}#Jn(e,t){if(!this.#$i)return;const n=this.#Di.getLayerGroupByDivId(t),i=n.getActiveDrawLayer();if(void 0===i)return void h.warn("No draw layer to update livewire");const o=n.getViewLayerById(i.getReferenceLayerId());if(void 0===o)return void h.warn("No view layer to update livewire");const r=o.displayToPlaneIndex(e);let a,s={x:r.get(0),y:r.get(1)};this.#Xr.setPoint(s);let l=!1;for(;!this.#Ur[s.y][s.x]&&!l;)if(a=this.#Xr.doWork(),0===a.length)l=!0;else for(let e=0;e<a.length-1;e+=2){const t=a[e],n=a[e+1];this.#Ur[t.y][t.x]=n}for(this.#Gr=new Va,l=!1;s&&!l;)this.#Gr.addPoint(new E(s.x,s.y)),this.#Ur[s.y]&&this.#Ur[s.y][s.x]?s=this.#Ur[s.y][s.x]:l=!0;this.#Gr.appenPath(this.#kr);const c=i.getDrawController(),u=new Oo(this.#Gr.pointArray);let d;if(void 0===this.#Dn){this.#Dn=new Ja,this.#Dn.colour=this.#Ko.getLineColour();const e=o.getViewController();this.#Dn.init(e),this.#Dn.mathShape=u,d=new Mr(this.#Dn,c)}else{const e=this.#Dn.mathShape;d=new Qr(this.#Dn,{mathShape:e},{mathShape:u},c)}this.#Di.addToUndoStack(d),d.execute()}#Wr(){this.#$i=!1}mousedown=e=>{const t=xr(e),n=ta(e);this.#Qo(t,n.groupDivId)};mousemove=e=>{const t=xr(e),n=ta(e);this.#Jn(t,n.groupDivId)};mouseup(e){}mouseout=e=>{};dblclick=e=>{this.#Wr()};touchstart=e=>{const t=br(e),n=ta(e);this.#Qo(t[0],n.groupDivId)};touchmove=e=>{const t=br(e),n=ta(e);this.#Jn(t[0],n.groupDivId)};touchend=e=>{};keydown=e=>{e.context="Livewire",this.#Di.onKeydown(e)};activate(e){e&&(this.#Ko.setBaseScale(this.#Di.getBaseScale()),this.setFeatures({shapeColour:this.#Ko.getLineColour()}))}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#Ko.setLineColour(e.shapeColour)}}},Ka={draw:{ArrowFactory:class{#jr="arrow";#Zr=new Ha(this.#_r);static supports(e){return e instanceof E}getName(){return this.#jr}getGroupName(){return this.#jr+"-group"}getNPoints(){return 2}getTimeout(){return 0}setAnnotationMathShape(e,t){e.mathShape=this.#Kr(t),e.referencePoints=[t[1]],e.setTextExpr(this.#Jr()),e.updateQuantification()}createShapeGroup(t,n){const i=new e.Group;i.name(this.getGroupName()),i.visible(!0),i.id(t.trackingUid);const o=this.#$r(t,n);i.add(o);const r=this.#ea(t,n);for(const e of r)i.add(e);const a=this.#Zr.create(t,n);i.add(a);const s=this.#ta(o);return i.add(this.#Zr.getConnector(s,a,n)),i}#ta(e){const t=e.points(),n=e.x(),i=e.y(),o=(t[0]+t[2])/2+n,r=(t[1]+t[3])/2+i;return[new E(o,r)]}#na(e){const t=e.points(),n=e.x(),i=e.y();return[new E(t[0]+n,t[1]+i),new E(t[2]+n,t[3]+i)]}getAnchors(e,t){const n=this.#na(e),i=[];for(let e=0;e<n.length;++e)i.push(Xr(n[e].getX(),n[e].getY(),"anchor"+e,t));return i}constrainAnchorMove(e){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#ia(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Zr.updatePosition(t,o),this.updateConnector(o))}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=this.#oa(i),r=zr(i,0),a=zr(i,1),s=new E(r.x()-o.x(),r.y()-o.y()),l=new E(a.x()-o.x(),a.y()-o.y());t.mathShape=s,t.referencePoints=[l],t.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=e.referencePoints[0],o=new Co(n,i),r=o.getBegin(),a=new E(r.getX()+t.x,r.getY()+t.y),s=o.getEnd(),l=new E(s.getX()+t.x,s.getY()+t.y);e.mathShape=a,e.referencePoints=[l],e.updateQuantification()}updateLabelContent(e,t,n){this.#Zr.updateContent(e,t)}updateConnector(e){const t=this.#oa(e),n=this.#ta(t);this.#Zr.updateConnector(e,n)}#Kr(e){return e[0]}#Jr(){return void 0!==O.labelTexts&&void 0!==O.labelTexts[this.#jr]?O.labelTexts[this.#jr]:Nr[this.#jr]}#$r(t,n){const i=t.mathShape;if(void 0===t.referencePoints||0===t.referencePoints.length)throw new Error("No reference point for arrow");const o=t.referencePoints[0],r=new Co(i,o),a=new e.Line({points:[i.getX(),i.getY(),o.getX(),o.getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"}),s=Lo(r,i,20,n.getZoomScale()),l=Lo(r,o,20,n.getZoomScale());return a.hitFunc((function(e){e.beginPath(),e.moveTo(s.getBegin().getX(),s.getBegin().getY()),e.lineTo(s.getEnd().getX(),s.getEnd().getY()),e.lineTo(l.getEnd().getX(),l.getEnd().getY()),e.lineTo(l.getBegin().getX(),l.getBegin().getY()),e.closePath(),e.fillStrokeShape(a)})),a}#oa(e){return Hr(e)}#ea(t,n){const i=t.mathShape,o=t.referencePoints[0],r=new Co(i,o),a=wo(r,40,20,n.getZoomScale());return[new e.Line({points:[r.getBegin().getX(),r.getBegin().getY(),a.getBegin().getX(),a.getBegin().getY(),a.getEnd().getX(),a.getEnd().getY()],fill:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,closed:!0,name:"shape-triangle"})]}#_r(e){return e.mathShape}#ia(t,n,i){const o=t.mathShape,r=t.referencePoints[0],a=new Co(o,r),s=n.getParent();if(!(s instanceof e.Group))return;const l=this.#oa(s);l.position({x:0,y:0}),l.points([o.getX(),o.getY(),r.getX(),r.getY()]);const c=s.getChildren((function(e){return"shape-triangle"===e.name()}))[0];if(!(c instanceof e.Line))return;const u=zr(s,0),d=zr(s,1);switch(n.id()){case"anchor0":u.x(n.x()),u.y(n.y());break;case"anchor1":d.x(n.x()),d.y(n.y());break;default:h.error("Unhandled anchor id: "+n.id())}const g=wo(a,40,20,i.getZoomScale());c.position({x:0,y:0}),c.points([a.getBegin().getX(),a.getBegin().getY(),g.getBegin().getX(),g.getBegin().getY(),g.getEnd().getX(),g.getEnd().getY()]);const S=Lo(a,o,20,i.getZoomScale()),p=Lo(a,r,20,i.getZoomScale());l.hitFunc((function(e){e.beginPath(),e.moveTo(S.getBegin().getX(),S.getBegin().getY()),e.lineTo(S.getEnd().getX(),S.getEnd().getY()),e.lineTo(p.getEnd().getX(),p.getEnd().getY()),e.lineTo(p.getBegin().getX(),p.getBegin().getY()),e.closePath(),e.fillStrokeShape(l)}))}#ra(e,t){}#aa(e,t){}},CircleFactory:class{#jr="circle";#Zr=new Ha(this.#_r);static supports(e){return e instanceof bo}getName(){return this.#jr}getGroupName(){return this.#jr+"-group"}getNPoints(){return 2}getTimeout(){return 0}setAnnotationMathShape(e,t){e.mathShape=this.#Kr(t),e.setTextExpr(this.#Jr()),e.updateQuantification()}createShapeGroup(t,n){const i=new e.Group;i.name(this.getGroupName()),i.visible(!0),i.id(t.trackingUid);const o=this.#$r(t,n);i.add(this.#$r(t,n));const r=this.#Zr.create(t,n);i.add(this.#Zr.create(t,n));const a=this.#ta(o);return i.add(this.#Zr.getConnector(a,r,n)),i}#ta(e){const t=e.x(),n=e.y(),i=e.radius()*Math.sqrt(2)/2;return[new E(t-i,n-i),new E(t+i,n-i),new E(t-i,n+i),new E(t+i,n+i)]}#na(e){const t=e.x(),n=e.y(),i=e.radius();return[new E(t-i,n),new E(t+i,n),new E(t,n+i),new E(t,n-i)]}getAnchors(e,t){const n=this.#na(e),i=[];for(let e=0;e<n.length;++e)i.push(Xr(n[e].getX(),n[e].getY(),"anchor"+e,t));return i}constrainAnchorMove(t){const n=t.getParent();if(!(n instanceof e.Group))return;const i=zr(n,0),o=zr(n,1),r=zr(n,2),a=zr(n,3);switch(t.id()){case"anchor0":i.y(o.y());break;case"anchor1":o.y(i.y());break;case"anchor2":r.x(a.x());break;case"anchor3":a.x(r.x());break;default:h.error("Unhandled anchor id: "+t.id())}}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#ia(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Zr.updatePosition(t,o),this.updateConnector(o))}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=new E(n.getCenter().getX(),n.getCenter().getY()),o=new E(t.x(),t.y()),r=i.getDistance(o);e.mathShape=new bo(i,r),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter(),o=new E(i.getX()+t.x,i.getY()+t.y);e.mathShape=new bo(o,n.getRadius()),e.updateQuantification()}updateLabelContent(e,t,n){this.#Zr.updateContent(e,t)}updateConnector(e){const t=this.#oa(e),n=this.#ta(t);this.#Zr.updateConnector(e,n)}#Kr(e){const t=Math.abs(e[0].getX()-e[1].getX()),n=Math.abs(e[0].getY()-e[1].getY()),i=Math.round(Math.sqrt(t*t+n*n));return new bo(e[0],i)}#Jr(){return void 0!==O.labelTexts&&void 0!==O.labelTexts[this.#jr]?O.labelTexts[this.#jr]:Nr[this.#jr]}#$r(t,n){const i=t.mathShape;return new e.Circle({x:i.getCenter().getX(),y:i.getCenter().getY(),radius:i.getRadius(),stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"})}#oa(t){const n=t.getChildren(kr)[0];if(n instanceof e.Circle)return n}#_r(e){const t=e.mathShape,n=t.getCenter(),i=t.getRadius();return new E(n.getX()-i,n.getY()+i)}#ia(t,n,i){const o=t.mathShape,r=o.getCenter(),a=o.getRadius(),s=n.getParent();if(!(s instanceof e.Group))return;this.#oa(s).radius(a);const l=zr(s,0),c=zr(s,1),u=zr(s,2),d=zr(s,3),g=c.x()<l.x()?-1:1,S=d.y()<u.y()?1:-1;switch(n.id()){case"anchor0":l.x(n.x()),c.x(r.getX()+g*a),u.y(r.getY()+a),d.y(r.getY()-a);break;case"anchor1":c.x(n.x()),l.x(r.getX()-g*a),u.y(r.getY()+a),d.y(r.getY()-a);break;case"anchor2":u.y(n.y()),l.x(r.getX()-a),c.x(r.getX()+a),d.y(r.getY()-S*a);break;case"anchor3":d.y(n.y()),l.x(r.getX()-a),c.x(r.getX()+a),u.y(r.getY()+S*a);break;default:h.error("Unhandled anchor id: "+n.id())}}#ra(t,n){const i=t.mathShape;let o=0,r=0;void 0!==n&&(o=n.x(),r=n.y());const a=new e.Group;a.name("shadow");const s=i.getRound();for(let n=0;n<s.length;++n){const i=s[n],l=i[0][0],c=i[0][1],u=i[1][0],d=new e.Rect({x:l-o,y:c-r,width:u-l,height:1,fill:t.colour,strokeWidth:0,strokeScaleEnabled:!1,opacity:.3,name:"shadow-element"});a.add(d)}return a}#aa(e,t){const n=t.getChildren((function(e){return"shadow"===e.name()}))[0];if(void 0!==n){n.destroy();const i=this.#ra(e,t);t.add(i),i.moveToBottom()}}},EllipseFactory:class{#jr="ellipse";#Zr=new Ha(this.#_r);static supports(e){return e instanceof xo}getName(){return this.#jr}getGroupName(){return this.#jr+"-group"}getNPoints(){return 2}getTimeout(){return 0}setAnnotationMathShape(e,t){e.mathShape=this.#Kr(t),e.setTextExpr(this.#Jr()),e.updateQuantification()}createShapeGroup(t,n){const i=new e.Group;i.name(this.getGroupName()),i.visible(!0),i.id(t.trackingUid);const o=this.#$r(t,n);i.add(this.#$r(t,n));const r=this.#Zr.create(t,n);i.add(this.#Zr.create(t,n));const a=this.#ta(o);return i.add(this.#Zr.getConnector(a,r,n)),i}#ta(e){const t=e.x(),n=e.y(),i=e.radiusX()*Math.sqrt(2)/2,o=e.radiusY()*Math.sqrt(2)/2;return[new E(t-i,n-o),new E(t+i,n-o),new E(t-i,n+o),new E(t+i,n+o)]}#na(e){const t=e.x(),n=e.y(),i=e.radius();return[new E(t-i.x,n),new E(t+i.x,n),new E(t,n+i.y),new E(t,n-i.y)]}getAnchors(e,t){const n=this.#na(e),i=[];for(let e=0;e<n.length;++e)i.push(Xr(n[e].getX(),n[e].getY(),"anchor"+e,t));return i}constrainAnchorMove(t){const n=t.getParent();if(!(n instanceof e.Group))return;const i=zr(n,0),o=zr(n,1),r=zr(n,2),a=zr(n,3);switch(t.id()){case"anchor0":i.y(o.y());break;case"anchor1":o.y(i.y());break;case"anchor2":r.x(a.x());break;case"anchor3":a.x(r.x());break;default:h.error("Unhandled anchor id: "+t.id())}}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#ia(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Zr.updatePosition(t,o),this.updateConnector(o))}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=n.getCenter();let o=n.getA(),r=n.getB();switch(t.id()){case"anchor0":o=i.getX()-t.x();break;case"anchor1":o=t.x()-i.getX();break;case"anchor2":r=t.y()-i.getY();break;case"anchor3":r=i.getY()-t.y();break;default:h.error("Unhandled anchor id: "+t.id())}e.mathShape=new xo(i,Math.abs(o),Math.abs(r)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter(),o=new E(i.getX()+t.x,i.getY()+t.y);e.mathShape=new xo(o,n.getA(),n.getB()),e.updateQuantification()}updateLabelContent(e,t,n){this.#Zr.updateContent(e,t)}updateConnector(e){const t=this.#oa(e),n=this.#ta(t);this.#Zr.updateConnector(e,n)}#Kr(e){const t=Math.abs(e[0].getX()-e[1].getX()),n=Math.abs(e[0].getY()-e[1].getY());return new xo(e[0],t,n)}#Jr(){return void 0!==O.labelTexts&&void 0!==O.labelTexts[this.#jr]?O.labelTexts[this.#jr]:Nr[this.#jr]}#$r(t,n){const i=t.mathShape,o=i.getCenter(),r={x:i.getA(),y:i.getB()};return new e.Ellipse({x:o.getX(),y:o.getY(),radius:r,radiusX:r.x,radiusY:r.y,stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"})}#oa(t){const n=t.getChildren(kr)[0];if(n instanceof e.Ellipse)return n}#_r(e){const t=e.mathShape,n=t.getCenter();return new E(n.getX()-t.getA(),n.getY()+t.getB())}#ia(t,n,i){const o=t.mathShape,r=o.getCenter(),a=o.getA(),s=o.getB(),l=n.getParent();if(!(l instanceof e.Group))return;this.#oa(l).radius({x:a,y:s});const c=zr(l,0),u=zr(l,1),d=zr(l,2),g=zr(l,3),S=u.x()<c.x()?-1:1,p=g.y()<d.y()?1:-1;switch(n.id()){case"anchor0":c.x(n.x()),u.x(r.getX()+S*a),d.y(r.getY()+s),g.y(r.getY()-s);break;case"anchor1":u.x(n.x()),c.x(r.getX()-S*a),d.y(r.getY()+s),g.y(r.getY()-s);break;case"anchor2":d.y(n.y()),c.x(r.getX()-a),u.x(r.getX()+a),g.y(r.getY()-p*s);break;case"anchor3":g.y(n.y()),c.x(r.getX()-a),u.x(r.getX()+a),d.y(r.getY()+p*s);break;default:h.error("Unhandled anchor id: "+n.id())}}#ra(t,n){const i=t.mathShape;let o=0,r=0;void 0!==n&&(o=n.x(),r=n.y());const a=new e.Group;a.name("shadow");const s=i.getRound();for(let n=0;n<s.length;++n){const i=s[n],l=i[0][0],c=i[0][1],u=i[1][0],d=new e.Rect({x:l-o,y:c-r,width:u-l,height:1,fill:t.colour,strokeWidth:0,strokeScaleEnabled:!1,opacity:.3,name:"shadow-element"});a.add(d)}return a}#aa(e,t){const n=t.getChildren((function(e){return"shadow"===e.name()}))[0];if(void 0!==n){n.destroy();const i=this.#ra(e,t);t.add(i),i.moveToBottom()}}},ProtractorFactory:class{#jr="protractor";#Zr=new Ha(this.#_r);static supports(e){return e instanceof Ao}getName(){return this.#jr}getGroupName(){return this.#jr+"-group"}getNPoints(){return 3}getTimeout(){return 500}setAnnotationMathShape(e,t){e.mathShape=this.#Kr(t),e.setTextExpr(this.#Jr()),e.updateQuantification()}createShapeGroup(t,n){const i=t.mathShape,o=new e.Group;o.name(this.getGroupName()),o.visible(!0),o.id(t.trackingUid);const r=this.#$r(t,n);if(o.add(this.#$r(t,n)),i.getLength()===this.getNPoints()){const e=this.#ea(t,n);for(const t of e)o.add(t);const i=this.#Zr.create(t,n);o.add(this.#Zr.create(t,n));const a=this.#ta(r);o.add(this.#Zr.getConnector(a,i,n))}return o}#ta(e){const t=e.points(),n=e.x(),i=e.y();return[new E(t[2]+n,t[3]+i)]}#na(e){const t=e.points(),n=e.x(),i=e.y();return[new E(t[0]+n,t[1]+i),new E(t[2]+n,t[3]+i),new E(t[4]+n,t[5]+i)]}getAnchors(e,t){const n=this.#na(e),i=[];for(let e=0;e<n.length;++e)i.push(Xr(n[e].getX(),n[e].getY(),"anchor"+e,t));return i}constrainAnchorMove(e){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#ia(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Zr.updatePosition(t,o),this.updateConnector(o))}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=this.#oa(i),r=zr(i,0),a=zr(i,1),s=zr(i,2),l=new E(r.x()-o.x(),r.y()-o.y()),c=new E(a.x()-o.x(),a.y()-o.y()),u=new E(s.x()-o.x(),s.y()-o.y());t.mathShape=new Ao([l,c,u]),t.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<3;++e)i.push(new E(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new Ao(i),e.updateQuantification()}updateLabelContent(e,t,n){this.#Zr.updateContent(e,t)}updateConnector(e){const t=this.#oa(e),n=this.#ta(t);this.#Zr.updateConnector(e,n)}#Kr(e){return new Ao(e)}#Jr(){return void 0!==O.labelTexts&&void 0!==O.labelTexts[this.#jr]?O.labelTexts[this.#jr]:Nr[this.#jr]}#$r(t,n){const i=t.mathShape,o=[];for(let e=0;e<i.getLength();++e)o.push(i.getPoint(e).getX()),o.push(i.getPoint(e).getY());const r=new e.Line({points:o,stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"});return i.getLength()===this.getNPoints()&&r.hitFunc((function(e){e.beginPath(),e.moveTo(i.getPoint(0).getX(),i.getPoint(0).getY()),e.lineTo(i.getPoint(1).getX(),i.getPoint(1).getY()),e.lineTo(i.getPoint(2).getX(),i.getPoint(2).getY()),e.closePath(),e.fillStrokeShape(r)})),r}#oa(e){return Hr(e)}#ea(t,n){const i=t.mathShape,o=new Co(i.getPoint(0),i.getPoint(1)),r=new Co(i.getPoint(1),i.getPoint(2));let a=Io(o,r),s=o.getInclination();a>180&&(a=360-a,s+=a);const l=33*Math.min(o.getLength(),r.getLength())/100;return[new e.Arc({innerRadius:l,outerRadius:l,stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,angle:a,rotation:-s,x:i.getPoint(1).getX(),y:i.getPoint(1).getY(),name:"shape-arc"})]}#_r(e){const t=e.mathShape,n=new Co(t.getPoint(0),t.getPoint(1)),i=new Co(t.getPoint(1),t.getPoint(2)),o=(n.getCentroid().getX()+i.getCentroid().getX())/2,r=(n.getCentroid().getY()+i.getCentroid().getY())/2;return new E(o,r)}#ia(t,n,i){const o=t.mathShape,r=new Co(o.getPoint(0),o.getPoint(1)),a=new Co(o.getPoint(1),o.getPoint(2)),s=n.getParent();if(!(s instanceof e.Group))return;const l=this.#oa(s);l.position({x:0,y:0}),l.points([o.getPoint(0).getX(),o.getPoint(0).getY(),o.getPoint(1).getX(),o.getPoint(1).getY(),o.getPoint(2).getX(),o.getPoint(2).getY()]);const c=s.getChildren((function(e){return"shape-arc"===e.name()}))[0];if(!(c instanceof e.Arc))return;const u=zr(s,0),d=zr(s,1),h=zr(s,2);switch(n.id()){case"anchor0":u.x(n.x()),u.y(n.y());break;case"anchor1":d.x(n.x()),d.y(n.y());break;case"anchor2":h.x(n.x()),h.y(n.y())}let g=Io(r,a),S=r.getInclination();g>180&&(g=360-g,S+=g);const p=33*Math.min(r.getLength(),a.getLength())/100;c.innerRadius(p),c.outerRadius(p),c.angle(g),c.rotation(-S);const m={x:d.x(),y:d.y()};c.position(m),l.hitFunc((function(e){e.beginPath(),e.moveTo(o.getPoint(0).getX(),o.getPoint(0).getY()),e.lineTo(o.getPoint(1).getX(),o.getPoint(1).getY()),e.lineTo(o.getPoint(2).getX(),o.getPoint(2).getY()),e.closePath(),e.fillStrokeShape(l)}))}#ra(e,t){}#aa(e,t){}},RectangleFactory:class{#jr="rectangle";#Zr=new Ha(this.#_r);static supports(e){return e instanceof Eo}getName(){return this.#jr}getGroupName(){return this.#jr+"-group"}getNPoints(){return 2}getTimeout(){return 0}setAnnotationMathShape(e,t){e.mathShape=this.#Kr(t),e.setTextExpr(this.#Jr()),e.updateQuantification()}createShapeGroup(t,n){const i=new e.Group;i.name(this.getGroupName()),i.visible(!0),i.id(t.trackingUid);const o=this.#$r(t,n);i.add(o);const r=this.#Zr.create(t,n);i.add(r);const a=this.#ta(o);return i.add(this.#Zr.getConnector(a,r,n)),i}#ta(e){const t=e.x(),n=e.y(),i=e.width(),o=e.height();return[new E(t+i/2,n),new E(t,n+o/2),new E(t+i/2,n+o),new E(t+i,n+o/2)]}#na(e){const t=e.x(),n=e.y(),i=e.width(),o=e.height();return[new E(t,n),new E(t+i,n),new E(t+i,n+o),new E(t,n+o)]}getAnchors(e,t){const n=this.#na(e),i=[];for(let e=0;e<n.length;++e)i.push(Xr(n[e].getX(),n[e].getY(),"anchor"+e,t));return i}constrainAnchorMove(e){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#ia(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Zr.updatePosition(t,o),this.updateConnector(o))}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=zr(i,0),r=zr(i,2),a=new E(o.x(),o.y()),s=new E(r.x(),r.y());t.mathShape=new Eo(a,s),t.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=new E(i.getX()+t.x,i.getY()+t.y),r=n.getEnd(),a=new E(r.getX()+t.x,r.getY()+t.y);e.mathShape=new Eo(o,a),e.updateQuantification()}updateLabelContent(e,t,n){this.#Zr.updateContent(e,t)}updateConnector(e){const t=this.#oa(e),n=this.#ta(t);this.#Zr.updateConnector(e,n)}#Kr(e){return new Eo(e[0],e[1])}#Jr(){return void 0!==O.labelTexts&&void 0!==O.labelTexts[this.#jr]?O.labelTexts[this.#jr]:Nr[this.#jr]}#$r(t,n){const i=t.mathShape;return new e.Rect({x:i.getBegin().getX(),y:i.getBegin().getY(),width:i.getWidth(),height:i.getHeight(),stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"})}#oa(t){const n=t.getChildren(kr)[0];if(n instanceof e.Rect)return n}#_r(e){const t=e.mathShape;return new E(t.getBegin().getX(),t.getEnd().getY())}#ia(t,n,i){const o=t.mathShape,r=o.getBegin(),a=n.getParent();if(!(a instanceof e.Group))return;const s=this.#oa(a);s.position({x:r.getX(),y:r.getY()}),s.size({width:o.getWidth(),height:o.getHeight()});const l=zr(a,0),c=zr(a,1),u=zr(a,2),d=zr(a,3);switch(n.id()){case"anchor0":l.x(n.x()),l.y(n.y()),c.y(n.y()),d.x(n.x());break;case"anchor1":c.x(n.x()),c.y(n.y()),l.y(n.y()),u.x(n.x());break;case"anchor2":u.x(n.x()),u.y(n.y()),d.y(n.y()),c.x(n.x());break;case"anchor3":d.x(n.x()),d.y(n.y()),u.y(n.y()),l.x(n.x());break;default:h.error("Unhandled anchor id: "+n.id())}}#ra(t,n){const i=t.mathShape.getRound(),o=i.max.getX()-i.min.getX(),r=i.max.getY()-i.min.getY();return new e.Rect({x:i.min.getX(),y:i.min.getY(),width:o,height:r,fill:t.colour,strokeWidth:0,strokeScaleEnabled:!1,opacity:.3,name:"shadow"})}#aa(e,t){const n=t.getChildren((function(e){return"shadow"===e.name()}))[0];if(void 0!==n){n.destroy();const i=this.#ra(e);t.add(i),i.moveToBottom()}}},RoiFactory:class{#jr="roi";#Zr=new Ha(this.#_r);static supports(e){return e instanceof Oo}getName(){return this.#jr}getGroupName(){return this.#jr+"-group"}getNPoints(){}getTimeout(){return 100}setAnnotationMathShape(e,t){e.mathShape=this.#Kr(t),e.setTextExpr(this.#Jr()),e.updateQuantification()}createShapeGroup(t,n){const i=new e.Group;i.name(this.getGroupName()),i.visible(!0),i.id(t.trackingUid);const o=this.#$r(t,n);i.add(this.#$r(t,n));const r=this.#Zr.create(t,n);i.add(this.#Zr.create(t,n));const a=this.#ta(o);return i.add(this.#Zr.getConnector(a,r,n)),i}#na(e){const t=e.points(),n=e.x(),i=e.y(),o=[];for(let e=0;e<t.length;e+=2)o.push(new E(t[e]+n,t[e+1]+i));return o}#ta(e){const t=e.points(),n=e.x(),i=e.y(),o=[];for(let e=0;e<t.length;e+=2){const r=(e+2)%t.length,a=(t[e]+t[r])/2+n,s=(t[e+1]+t[r+1])/2+i;o.push(new E(a,s))}return o}getAnchors(e,t){const n=this.#na(e),i=[];for(let e=0;e<n.length;++e)i.push(Xr(n[e].getX(),n[e].getY(),"anchor"+e,t));return i}constrainAnchorMove(e){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#ia(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Zr.updatePosition(t,o),this.updateConnector(o))}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=this.#oa(i),r=t.mathShape.getPoints().slice(),a=new E(n.x()-o.x(),n.y()-o.y());r[Wr(n.id())]=a,t.mathShape=new Oo(r),t.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<n.getLength();++e)i.push(new E(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new Oo(i),e.updateQuantification()}updateLabelContent(e,t,n){this.#Zr.updateContent(e,t)}updateConnector(e){const t=this.#oa(e),n=this.#ta(t);this.#Zr.updateConnector(e,n)}#Kr(e){return new Oo(e)}#Jr(){return void 0!==O.labelTexts&&void 0!==O.labelTexts[this.#jr]?O.labelTexts[this.#jr]:Nr[this.#jr]}#$r(t,n){const i=t.mathShape,o=[];for(let e=0;e<i.getLength();++e)o.push(i.getPoint(e).getX()),o.push(i.getPoint(e).getY());return new e.Line({points:o,stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape",closed:!0})}#oa(e){return Hr(e)}#_r(e){const t=e.mathShape;return new E(t.getPoint(0).getX(),t.getPoint(0).getY())}#ia(t,n,i){const o=n.getParent();if(!(o instanceof e.Group))return;const r=this.#oa(o),a=r.points(),s=2*Wr(n.id());a[s]=n.x()-r.x(),a[s+1]=n.y()-r.y(),r.points(a);const l=o.getChildren((function(e){return e.id()===n.id()}))[0];l.x(n.x()),l.y(n.y())}#ra(e,t){}#aa(e,t){}},RulerFactory:class{#jr="ruler";#Zr=new Ha(this.#_r);static supports(e){return e instanceof Co}getName(){return this.#jr}getGroupName(){return this.#jr+"-group"}getNPoints(){return 2}getTimeout(){return 0}setAnnotationMathShape(e,t){e.mathShape=this.#Kr(t),e.setTextExpr(this.#Jr()),e.updateQuantification()}createShapeGroup(t,n){const i=new e.Group;i.name(this.getGroupName()),i.visible(!0),i.id(t.trackingUid);const o=this.#$r(t,n);i.add(this.#$r(t,n));const r=this.#ea(t,n);for(const e of r)i.add(e);const a=this.#Zr.create(t,n);i.add(this.#Zr.create(t,n));const s=this.#ta(o);return i.add(this.#Zr.getConnector(s,a,n)),i}#ta(e){const t=e.points(),n=e.x(),i=e.y(),o=(t[0]+t[2])/2+n,r=(t[1]+t[3])/2+i;return[new E(o,r)]}#na(e){const t=e.points(),n=e.x(),i=e.y();return[new E(t[0]+n,t[1]+i),new E(t[2]+n,t[3]+i)]}getAnchors(e,t){const n=this.#na(e),i=[];for(let e=0;e<n.length;++e)i.push(Xr(n[e].getX(),n[e].getY(),"anchor"+e,t));return i}constrainAnchorMove(e){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#ia(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Zr.updatePosition(t,o),this.updateConnector(o))}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=this.#oa(i),r=zr(i,0),a=zr(i,1),s=new E(r.x()-o.x(),r.y()-o.y()),l=new E(a.x()-o.x(),a.y()-o.y());t.mathShape=new Co(s,l),t.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=new E(i.getX()+t.x,i.getY()+t.y),r=n.getEnd(),a=new E(r.getX()+t.x,r.getY()+t.y);e.mathShape=new Co(o,a),e.updateQuantification()}updateLabelContent(e,t,n){this.#Zr.updateContent(e,t)}updateConnector(e){const t=this.#oa(e),n=this.#ta(t);this.#Zr.updateConnector(e,n)}#Kr(e){return new Co(e[0],e[1])}#Jr(){return void 0!==O.labelTexts&&void 0!==O.labelTexts[this.#jr]?O.labelTexts[this.#jr]:Nr[this.#jr]}#$r(t,n){const i=t.mathShape,o=new e.Line({points:[i.getBegin().getX(),i.getBegin().getY(),i.getEnd().getX(),i.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"}),r=Lo(i,i.getBegin(),20,n.getZoomScale()),a=Lo(i,i.getEnd(),20,n.getZoomScale());return o.hitFunc((function(e){e.beginPath(),e.moveTo(r.getBegin().getX(),r.getBegin().getY()),e.lineTo(r.getEnd().getX(),r.getEnd().getY()),e.lineTo(a.getEnd().getX(),a.getEnd().getY()),e.lineTo(a.getBegin().getX(),a.getBegin().getY()),e.closePath(),e.fillStrokeShape(o)})),o}#oa(e){return Hr(e)}#ea(t,n){const i=t.mathShape,o=Lo(i,i.getBegin(),20,n.getZoomScale()),r=new e.Line({points:[o.getBegin().getX(),o.getBegin().getY(),o.getEnd().getX(),o.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick0"}),a=Lo(i,i.getEnd(),20,n.getZoomScale());return[r,new e.Line({points:[a.getBegin().getX(),a.getBegin().getY(),a.getEnd().getX(),a.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick1"})]}#_r(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();let o=n;return n.getY()<i.getY()&&(o=i),o}#ia(t,n,i){const o=t.mathShape,r=n.getParent();if(!(r instanceof e.Group))return;const a=this.#oa(r);a.position({x:0,y:0}),a.points([o.getBegin().getX(),o.getBegin().getY(),o.getEnd().getX(),o.getEnd().getY()]);const s=r.getChildren((function(e){return"shape-tick0"===e.name()}))[0];if(!(s instanceof e.Line))return;const l=r.getChildren((function(e){return"shape-tick1"===e.name()}))[0];if(!(l instanceof e.Line))return;const c=zr(r,0),u=zr(r,1);switch(n.id()){case"anchor0":c.x(n.x()),c.y(n.y());break;case"anchor1":u.x(n.x()),u.y(n.y());break;default:h.error("Unhandled anchor id: "+n.id())}const d=Lo(o,o.getBegin(),20,i.getZoomScale());s.position({x:0,y:0}),s.points([d.getBegin().getX(),d.getBegin().getY(),d.getEnd().getX(),d.getEnd().getY()]);const g=Lo(o,o.getEnd(),20,i.getZoomScale());l.position({x:0,y:0}),l.points([g.getBegin().getX(),g.getBegin().getY(),g.getEnd().getX(),g.getEnd().getY()]),a.hitFunc((function(e){e.beginPath(),e.moveTo(d.getBegin().getX(),d.getBegin().getY()),e.lineTo(d.getEnd().getX(),d.getEnd().getY()),e.lineTo(g.getEnd().getX(),g.getEnd().getY()),e.lineTo(g.getBegin().getX(),g.getBegin().getY()),e.closePath(),e.fillStrokeShape(a)}))}#ra(e,t){}#aa(e,t){}},BidimensionalFactory:class{#jr="bidimensional";#Zr=new Ha(this.#_r);static supports(e){return e instanceof qo}getName(){return this.#jr}getGroupName(){return this.#jr+"-group"}getNPoints(){return 2}getTimeout(){return 0}#Jr(e){return void 0!==O.labelTexts&&void 0!==O.labelTexts[this.#jr]?O.labelTexts[this.#jr]:!0===e.mathShape.hasShortAxisInteraction&&null!==e.quantification?.shortAxis?.value?Nr[this.#jr]:Nr[this.#jr+"Drawing"]}setAnnotationMathShape(e,t){const n=new qo(t[0],t[1]),i=n.getLength();if("number"!=typeof n.shortAxisL1&&(n.shortAxisL1=i/2,n.shortAxisL2=i/2),"number"!=typeof n.shortAxisT&&(n.shortAxisT=.5),!n.shortAxisCenter){const e=this.getPointAlongLine(n,n.shortAxisT);n.shortAxisCenter=e}n.shortAxisLength=n.shortAxisL1+n.shortAxisL2,e.mathShape=n,e.setTextExpr(this.#Jr(e)),e.updateQuantification()}createShapeGroup(t,n){const i=new e.Group;i.name(this.getGroupName()),i.visible(!0),i.id(t.trackingUid);const o=this.#$r(t,n);i.add(o);const r=this.#ea(t,n);for(const e of r)i.add(e);const a=this.#Zr.create(t,n);i.add(a);const s=this.#ta(o);i.add(this.#Zr.getConnector(s,a,n)),i.on("mouseenter",(()=>{i.getLayer()?.draw(),this.updateShortAxisToSolid(i)})),i.on("mouseleave",(()=>{i.getLayer()?.draw(),this.updateShortAxisToSolid(i)})),i?.setAttr("annotation",t),i.on("dragend",(()=>{const e=i.position();0===e.x&&0===e.y||(this.updateAnnotationOnTranslation(i.getAttr("annotation"),e),i.position({x:0,y:0}),i.getLayer()?.draw())}));const l=i.findOne(".bidimensional-short-axis"),c=i.findOne(".short-axis-tick0"),u=i.findOne(".short-axis-tick1");return[l,c,u].forEach((e=>{e&&e.on("mouseenter",(()=>(l&&l.opacity(1),c&&c.opacity(1),u&&u.opacity(1),void i.getLayer()?.draw())))})),i}#$r(t,n){const i=t.mathShape,o=new e.Line({points:[i.getBegin().getX(),i.getBegin().getY(),i.getEnd().getX(),i.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,opacity:1,name:"shape"}),r=Lo(i,i.getBegin(),20,n.getZoomScale?n.getZoomScale():{x:1,y:1}),a=Lo(i,i.getEnd(),20,n.getZoomScale?n.getZoomScale():{x:1,y:1});return o.hitFunc((function(e){e.beginPath(),e.moveTo(r.getBegin().getX(),r.getBegin().getY()),e.lineTo(r.getEnd().getX(),r.getEnd().getY()),e.lineTo(a.getEnd().getX(),a.getEnd().getY()),e.lineTo(a.getBegin().getX(),a.getBegin().getY()),e.closePath(),e.fillStrokeShape(o)})),o}#ea(t,n){const i=t.mathShape,o=10,r=n.getZoomScale?n.getZoomScale():{x:1,y:1},a=Lo(i,i.getBegin(),20,r),s=new e.Line({points:[a.getBegin().getX(),a.getBegin().getY(),a.getEnd().getX(),a.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick0"}),l=Lo(i,i.getEnd(),20,r),c=new e.Line({points:[l.getBegin().getX(),l.getBegin().getY(),l.getEnd().getX(),l.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick1"}),[u,d]=this.getShortAxisEndpoints(t),h=new e.Line({points:[u.getX(),u.getY(),d.getX(),d.getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,dash:t.mathShape.hasShortAxisInteraction?[]:[8,8],opacity:.5,name:"bidimensional-short-axis"}),g=d.getX()-u.getX(),S=d.getY()-u.getY(),p=Math.hypot(g,S);let m,f;return 0===p?(m=1,f=0):(m=-S/p,f=g/p),[s,c,h,new e.Line({points:[u.getX()-m*o/2,u.getY()-f*o/2,u.getX()+m*o/2,u.getY()+f*o/2],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,opacity:.5,name:"short-axis-tick0"}),new e.Line({points:[d.getX()-m*o/2,d.getY()-f*o/2,d.getX()+m*o/2,d.getY()+f*o/2],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,opacity:.5,name:"short-axis-tick1"})]}#ta(e){const t=e.points(),n=e.x(),i=e.y(),o=(t[0]+t[2])/2+n,r=(t[1]+t[3])/2+i;return[new E(o,r)]}#na(e){const t=e.points(),n=e.x(),i=e.y(),o=new E(t[0]+n,t[1]+i),r=new E(t[2]+n,t[3]+i),a=e.getParent(),s=a?.getAttr("annotation");if(!s||!s.mathShape)return[o,r,o,r];const[l,c]=this.getShortAxisEndpoints(s);return[o,r,l,c]}getAnchors(e,t){const n=this.#na(e),i=[];for(let e=0;e<n.length;++e)i.push(Xr(n[e].getX(),n[e].getY(),"anchor"+e,t));return i}constrainAnchorMove(e){const t=e.getParent(),n=t?.getAttr("annotation"),i=n.mathShape;if("anchor2"===e.id()||"anchor3"===e.id()){const t=i.getBegin(),n=i.getEnd(),o=n.getX()-t.getX(),r=n.getY()-t.getY(),a=Math.hypot(o,r);if(0===a)return;const s=o/a,l=r/a,c=-l,u=s,d=e.x()-t.getX(),h=e.y()-t.getY(),g=d*s+h*l;i.shortAxisT=Math.max(0,Math.min(1,g/a));const S=this.getPointAlongLine(i,i.shortAxisT);i.shortAxisCenter=S;const p=d*c+h*u;"anchor2"===e.id()?i.shortAxisL1=Math.max(.1,p):i.shortAxisL2=Math.max(.1,-p),i.shortAxisLength=i.shortAxisL1+i.shortAxisL2;const m="anchor2"===e.id()?i.shortAxisL1:-i.shortAxisL2;e.x(S.getX()+c*m),e.y(S.getY()+u*m)}}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#ia(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Zr.updatePosition(t,o),this.updateConnector(o))}#ia(t,n,i){const o=t.mathShape,r=n.getParent();if(!(r instanceof e.Group))return;const a=r.findOne(".shape");a&&a instanceof e.Line&&(a.position({x:0,y:0}),a.points([o.getBegin().getX(),o.getBegin().getY(),o.getEnd().getX(),o.getEnd().getY()]));const s=r.findOne(".shape-tick0"),l=r.findOne(".shape-tick1"),c=i.getZoomScale(),u=Lo(o,o.getBegin(),20,c);s&&s instanceof e.Line&&(s.position({x:0,y:0}),s.points([u.getBegin().getX(),u.getBegin().getY(),u.getEnd().getX(),u.getEnd().getY()]));const d=Lo(o,o.getEnd(),20,c);l&&l instanceof e.Line&&(l.position({x:0,y:0}),l.points([d.getBegin().getX(),d.getBegin().getY(),d.getEnd().getX(),d.getEnd().getY()])),"anchor2"!==n.id()&&"anchor3"!==n.id()||(o.shortAxisLength=t.mathShape.shortAxisLength,o.shortAxisT=t.mathShape.shortAxisT);const[h,g]=this.getShortAxisEndpoints(t),S=r.findOne(".bidimensional-short-axis");S&&S instanceof e.Line&&(S.position({x:0,y:0}),S.points([h.getX(),h.getY(),g.getX(),g.getY()])),this.updateShortAxisTicks(r,h,g);const p=zr(r,2),m=zr(r,3);p&&m&&(p.x(h.getX()),p.y(h.getY()),m.x(g.getX()),m.y(g.getY())),t.mathShape.hasShortAxisInteraction=!0,t.setTextExpr(this.#Jr(t)),t.updateQuantification?.(),r.getLayer()?.draw()}updateLabelContent(e,t,n){this.#Zr.updateContent(e,t)}updateConnector(t){const n=t.findOne(".shape");if(n&&n instanceof e.Line){const e=this.#ta(n);this.#Zr.updateConnector(t,e)}}#_r(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();let o=n;return n.getY()<i.getY()&&(o=i),o}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd(),r=new E(i.getX()+t.x,i.getY()+t.y),a=new E(o.getX()+t.x,o.getY()+t.y),s=new qo(r,a);s.shortAxisLength=n.shortAxisLength,s.shortAxisT=n.shortAxisT,s.shortAxisL1=n.shortAxisL1,s.shortAxisL2=n.shortAxisL2,n.shortAxisCenter instanceof Object&&"getX"in n.shortAxisCenter&&"getY"in n.shortAxisCenter&&(s.shortAxisCenter=new E(n.shortAxisCenter.getX()+t.x,n.shortAxisCenter.getY()+t.y)),s.hasShortAxisInteraction=n.hasShortAxisInteraction,e.mathShape=s,e.updateQuantification()}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=i.findOne(".shape"),r=zr(i,0),a=zr(i,1),s=new E(r.x()-o.x(),r.y()-o.y()),l=new E(a.x()-o.x(),a.y()-o.y()),c=new qo(s,l),u=t.mathShape;if(u.shortAxisCenter instanceof E){const e=u.shortAxisCenter,t=l.getX()-s.getX(),n=l.getY()-s.getY(),i=t*t+n*n;if(i>0){const o=((e.getX()-s.getX())*t+(e.getY()-s.getY())*n)/i;c.shortAxisT=Math.max(0,Math.min(1,o)),c.shortAxisCenter=new E(s.getX()+t*c.shortAxisT,s.getY()+n*c.shortAxisT)}else c.shortAxisT=.5,c.shortAxisCenter=e}else c.shortAxisT=u.shortAxisT??.5;c.shortAxisL1=u.shortAxisL1,c.shortAxisL2=u.shortAxisL2,c.shortAxisLength=u.shortAxisLength,c.hasShortAxisInteraction=u.hasShortAxisInteraction,t.mathShape=c,t.updateQuantification()}updateShortAxisToSolid(t){const n=t.findOne(".bidimensional-short-axis");n&&n instanceof e.Line&&(n.dash([]),n.getLayer()?.draw())}updateShortAxisTicks(t,n,i){const o=10,r=i.getX()-n.getX(),a=i.getY()-n.getY(),s=Math.hypot(r,a);let l,c;0===s?(l=1,c=0):(l=-a/s,c=r/s);const u=new E(n.getX()-l*o/2,n.getY()-c*o/2),d=new E(n.getX()+l*o/2,n.getY()+c*o/2),h=t.findOne(".short-axis-tick0");h&&h instanceof e.Line&&(h.position({x:0,y:0}),h.points([u.getX(),u.getY(),d.getX(),d.getY()]),h.opacity(.5));const g=new E(i.getX()-l*o/2,i.getY()-c*o/2),S=new E(i.getX()+l*o/2,i.getY()+c*o/2),p=t.findOne(".short-axis-tick1");p&&p instanceof e.Line&&(p.position({x:0,y:0}),p.points([g.getX(),g.getY(),S.getX(),S.getY()]),p.opacity(.5))}getShortAxisEndpoints(e){const t=e.mathShape;let n;if(e.mathShape.shortAxisCenter instanceof E){const i=t.getBegin(),o=t.getEnd(),r=o.getX()-i.getX(),a=o.getY()-i.getY(),s=Math.hypot(r,a);if(0===s)n=e.mathShape.shortAxisCenter;else{const o=r/s,l=a/s,c=(e.mathShape.shortAxisCenter.getX()-i.getX())*o+(e.mathShape.shortAxisCenter.getY()-i.getY())*l,u=Math.max(0,Math.min(1,c/s));e.mathShape.shortAxisT=u,n=this.getPointAlongLine(t,u)}}else{const i="number"==typeof e.mathShape.shortAxisT?e.mathShape.shortAxisT:.5;n=this.getPointAlongLine(t,i)}const i=t.getBegin(),o=t.getEnd(),r=o.getX()-i.getX(),a=o.getY()-i.getY(),s=Math.hypot(r,a);if(0===s||Number.isNaN(n.getX())||Number.isNaN(n.getY()))return[n,n];const l=-a/s,c=r/s;let u,d;return u="number"==typeof e.mathShape.shortAxisL1?e.mathShape.shortAxisL1:"number"==typeof e.mathShape.shortAxisLength?e.mathShape.shortAxisLength/2:0,d="number"==typeof e.mathShape.shortAxisL2?e.mathShape.shortAxisL2:"number"==typeof e.mathShape.shortAxisLength?e.mathShape.shortAxisLength/2:0,Number.isNaN(u)||Number.isNaN(d)?[n,n]:[new E(n.getX()+l*u,n.getY()+c*u),new E(n.getX()-l*d,n.getY()-c*d)]}getPointAlongLine(e,t){const n=e.getBegin(),i=e.getEnd();return new E(n.getX()+(i.getX()-n.getX())*t,n.getY()+(i.getY()-n.getY())*t)}}},filter:{Threshold:class{#Di;constructor(e){this.#Di=e}#qo=new za;#sa=!0;#X=new z;activate(e){e&&(this.#sa=!0)}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run threshod filter on.");if(this.#qo.setMin(e.min),this.#qo.setMax(e.max),this.#sa){const t=this.#Di.getData(e.dataId).image;this.#qo.setOriginalImage(t),this.#sa=!1}const t=new Wa(this.#qo,e.dataId,this.#Di);t.onExecute=this.#j,t.onUndo=this.#j,t.execute(),this.#Di.addToUndoStack(t)}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)}},Sobel:class{#Di;constructor(e){this.#Di=e}#X=new z;activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sobel filter on.");const t=new Xa,n=this.#Di.getData(e.dataId).image;t.setOriginalImage(n);const i=new Wa(t,e.dataId,this.#Di);i.onExecute=this.#j,i.onUndo=this.#j,i.execute(),this.#Di.addToUndoStack(i)}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)}},Sharpen:class{#Di;constructor(e){this.#Di=e}#X=new z;activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sharpen filter on.");const t=new Ya,n=this.#Di.getData(e.dataId).image;t.setOriginalImage(n);const i=new Wa(t,e.dataId,this.#Di);i.onExecute=this.#j,i.onUndo=this.#j,i.execute(),this.#Di.addToUndoStack(i)}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)}}}};class Ja{trackingId;trackingUid;referencedSopInstanceUID;referencedSopClassUID;referencedFrameNumber;mathShape;referencePoints;colour="#ffff80";quantification;textExpr="";labelPosition;planeOrigin;planePoints;#Qt;#nt={};constructor(){this.trackingId=Math.random().toString(36).substring(2,15),this.trackingUid=pn("TrackingUniqueIdentifier")}getMetaConceptIds(){return Object.keys(this.#nt)}getMetaItem(e){return this.#nt[e]}addMetaItem(e,t){const n=e.value;void 0!==this.#nt[n]&&h.warn("Overwriting annotation meta with id="+n),this.#nt[e.value]={concept:e,value:t}}removeMetaItem(e){void 0!==this.#nt[e]&&delete this.#nt[e]}getOrientationName(){let e;return void 0!==this.planePoints&&(e=Lt(this.planePoints[1].getValues().concat(this.planePoints[2].getValues()))),e}init(e){if(void 0!==this.referencedSopInstanceUID)return void h.debug("Cannot initialise annotation twice");this.#Qt=e;const t=e.getCurrentPosition();this.referencedSopInstanceUID=e.getCurrentImageUid(),this.referencedSopClassUID=e.getSopClassUid(),t.length()>3&&(this.referencedFrameNumber=t.get(3)),this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID),e.isAquisitionOrientation()||(this.planePoints=e.getPlanePoints(t))}canView(){return void 0!==this.#Qt}isCompatibleView(e){let t=!1;if(void 0===this.planePoints)e.isAquisitionOrientation()&&(t=!0);else{const n=e.getCosines(),i=new F(n[0],n[1],n[2]),o=new F(n[3],n[4],n[5]);i.equals(this.planePoints[1])&&o.equals(this.planePoints[2])&&(t=!0)}return t}setViewController(e){e.includesImageUid(this.referencedSopInstanceUID)?this.isCompatibleView(e.getPlaneHelper())&&(this.#Qt=e,this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID)):h.warn("Cannot view annotation with reference UID: "+this.referencedSopInstanceUID)}#la(){let e;if(void 0!==this.#Qt){let t=this.planeOrigin;void 0!==this.planePoints&&(t=this.planePoints[0]);const n=[t.getX(),t.getY(),t.getZ()];void 0!==this.referencedFrameNumber&&n.push(this.referencedFrameNumber);const i=new q(n);e=this.#Qt.getIndexFromPosition(i)}return e}getCentroid(){let e;if(void 0!==this.#Qt&&void 0!==this.mathShape.getCentroid&&void 0!==this.mathShape.getCentroid()){const t=this.#la(),n=this.#Qt.getScrollDimIndex(),i=t.getValues()[n],o=this.mathShape.getCentroid();if(e=this.#Qt.getPositionFromPlanePoint(o,i),void 0!==this.referencedFrameNumber){const t=e.getValues();t[3]=this.referencedFrameNumber,e=new q(t)}}return e}setTextExpr(e){if(void 0!==this.#Qt){const t=this.#Qt.getModality();void 0!==e[t]?this.textExpr=e[t]:this.textExpr=e["*"]}else h.warn("Cannot set text expr without a view controller")}getText(){return function(e,t){let n="";if(null==e)return n;if(n=e,null==t)return n;const i=$(e);for(let e=0;e<i.length;++e){const o=t[i[e]];if(null!=o&&null!==o.value&&void 0!==o.value){let t=o.value.toPrecision(4);null!==o.unit&&void 0!==o.unit&&0!==o.unit.length&&("unit.degree"!==o.unit&&(t+=" "),t+=_.t(o.unit));const r="{"+i[e]+"}";n=n.replace(r,t)}}return n}(this.textExpr,this.quantification)}updateQuantification(){void 0!==this.#Qt&&void 0!==this.mathShape.quantify&&(this.quantification=this.mathShape.quantify(this.#Qt,this.#la(),$(this.textExpr)))}getFactory(){let e;if(void 0===this.mathShape)return e;if(void 0!==Za.draw)for(const t in Za.draw){const n=Za.draw[t];if(n.supports(this.mathShape)){e=new n;break}}if(void 0===e)for(const t in Ka.draw){const n=Ka.draw[t];if(n.supports(this.mathShape)){e=new n;break}}return void 0===e&&h.warn("No shape factory found for math shape"),e}}function $a(e,t){const n=Object.keys(t);for(const i of n)void 0!==e[i]&&h.debug("Overwritting tag: "+i),e[i]=t[i]}class es{current;measure}class ts{annotationGroups;responseEvaluations;comment}class ns{#Te;getWarning(){return this.#Te}#ca(e){const t=function(e){let t;return e.startsWith("1.2.826.0.1.3680043.9.7278.1")&&(t=e.substring(29).replace(".99","-beta")),t}(Ne(e,"00020012")),n=void 0!==t&&function(e){const t=Xe(e,"0.34.0"),n=Xe(e,"0.35.0-beta.21");return t>=0&&n<=0}(t),i=vr(e);let o;const r=yr(e);return void 0!==r.conceptNameCode&&(o=r.conceptNameCode.value),n&&void 0===i&&o===$n.value}#ua(e){const t="DCMR-1500"===vr(e);let n;const i=yr(e);void 0!==i.conceptNameCode&&(n=i.conceptNameCode.value);let o=!1;if(t&&n===ti.value){const e=i.contentSequence.find(this.#da);if(void 0!==e){const t=e.contentSequence.find(this.#ha);if(void 0!==t){const e=t.contentSequence.find(this.#ga),n=t.contentSequence.find(this.#Sa);void 0===e&&void 0===n||(o=!0)}}}return o}#pa(e){return"DCMR-4100"===vr(e)}checkElements(e){return this.#Te=void 0,this.#ca(e)||this.#ua(e)||this.#pa(e)||(this.#Te="Not a dwv supported annotation"),this.#Te}#ma(e,t){t.valueType===hr&&t.relationshipType===rr&&(e.referencedSopClassUID=t.value.referencedSOPSequence.referencedSOPClassUID,e.referencedSopInstanceUID=t.value.referencedSOPSequence.referencedSOPInstanceUID,void 0!==t.value.referencedFrameNumber&&(e.referencedFrameNumber=parseInt(t.value.referencedFrameNumber,10)))}#fa(e,t){t.hasHeader(ur,ai(Hn),nr)&&(e.trackingId=t.value,e.trackingUid=t.value)}#va(e,t){t.hasHeader(sr,ai(Hn),ir)&&(e.trackingId=t.value),t.hasHeader(ur,ai(Yn),ir)&&(e.trackingUid=t.value)}#Da(e,t,n){void 0===n&&(n=!1);let i=ar;if(n&&(i=nr),t.hasHeader(sr,ai(ei),i)){e.textExpr=t.value;const n=t.contentSequence.find((function(e){return e.hasHeader(gr,ai(Jn),nr)}));void 0!==n&&(e.labelPosition=new E(n.value.graphicData[0],n.value.graphicData[1]))}if(t.hasHeader(sr,ci(),i)&&(e.colour=t.value),t.hasHeader(gr,ai(Jn),i)&&t.value.graphicType===Bo){const n=[];for(let e=0;e<t.value.graphicData.length;e+=2)n.push(new E(t.value.graphicData[e],t.value.graphicData[e+1]));e.referencePoints=n}if(t.hasHeader(Sr,ai(ii),tr)&&t.value.graphicType===Bo){const n=t.value.graphicData,i=[],o=Math.floor(n.length/3);for(let e=0;e<o;++e){const t=3*e;i.push(new F(n[t],n[t+1],n[t+2]))}e.planePoints=i}this.#ya(e,t),this.#Ca(e,t)}#ya(e,t,n){let i;if(void 0===n&&(i=tr),t.valueType===lr&&t.relationshipType===i){let n=function(e){let t;for(const n in ui){const i=ui[n];if(i.scheme===e.schemeDesignator&&i.key===e.value){t=n;break}}return t}(t.conceptNameCode);if(("a"===n||"b"===n)&&e.mathShape&&e.mathShape.constructor&&"BidimensionalLine"===e.mathShape.constructor.name&&("a"===n?n="longAxis":"b"===n&&(n="shortAxis")),void 0!==n){const i=t.value.measuredValue,o=function(e){let t;for(const n in di){const i=di[n];if("UCUM"===e.schemeDesignator&&i===e.value){t=n;break}}return t}(i.measurementUnitsCode);void 0===e.quantification&&(e.quantification={}),e.quantification[n]={value:i.numericValue,unit:o}}}}#Ca(e,t){t.valueType!==cr&&t.valueType!==sr||t.relationshipType!==tr||e.addMetaItem(t.conceptNameCode,t.value)}#da(e){return e.hasHeader(pr,ai(ni),tr)}#ha(e){return e.hasHeader(pr,ai($n),tr)}#Ia(e){return e.hasHeader(cr,ai(Un),or)}#Ta(e){return e.hasHeader(pr,ai(Bn),nr)}#La(e){return e.hasHeader(sr,ai(Zn),tr)}#wa(e){return e.hasHeader(cr,ai(Xn),tr)}#Pa(e){return e.hasHeader(lr,ai(zn),tr)}#Aa(e){return e.hasHeader(cr,ai(qn),tr)}#ga(e){return e.hasHeader(gr,ai(Mn),tr)}#Oa(e){return void 0!==e.contentSequence.find(this.#ga)}#ba(e){let t;const n=e.contentSequence.find(this.#ga);if(void 0!==n){t=new Ja,t.mathShape=Wo(n.value);const i=n.contentSequence.find((function(e){return e.valueType===hr&&e.relationshipType===rr}));void 0!==i&&this.#ma(t,i);for(const n of e.contentSequence)this.#va(t,n),this.#Da(t,n)}return t}#Sa(e){let t;return e.valueType===lr&&e.relationshipType===tr&&(t=e.contentSequence.find((function(e){return e.valueType===gr&&e.relationshipType===or}))),void 0!==t}#xa(e){let t;return e.valueType===lr&&e.relationshipType===nr&&(t=e.contentSequence.find((function(e){return e.valueType===gr&&e.relationshipType===or}))),void 0!==t}#Ra(e){return void 0!==e.contentSequence.find(this.#Sa)}#Ea(e){let t;const n=e.contentSequence.find(this.#Sa);if(void 0!==n){t=new Ja;const e=n.contentSequence.find((function(e){return e.valueType===gr&&e.relationshipType===or}));t.mathShape=Wo(e.value),t.mathShape instanceof E&&e.value.graphicData.length>=4&&(t.referencePoints=[new E(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find((function(e){return e.valueType===hr&&e.relationshipType===rr}));void 0!==i&&this.#ma(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#va(t,i),this.#ya(t,n),this.#Ca(t,i);return t}#Fa(e){let t;const n=e.contentSequence.find(this.#xa);if(void 0!==n){t=new Ja;const e=n.contentSequence.find((function(e){return e.valueType===gr&&e.relationshipType===or}));t.mathShape=Wo(e.value),t.mathShape instanceof E&&e.value.graphicData.length>=4&&(t.referencePoints=[new E(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find((function(e){return e.valueType===hr&&e.relationshipType===rr}));void 0!==i&&this.#ma(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#va(t,i),this.#ya(t,n,nr),this.#Ca(t,i);return t}#qa(e){if(0===e.contentSequence.length)return;const t=e.contentSequence[0];let n=!1,i=!1;this.#ha(t)&&(n=this.#Oa(t),i=this.#Ra(t));const o=[];let r,a=!1;for(const t of e.contentSequence)if(this.#ha(t)){let e;a=!0,n?e=this.#ba(t):i&&(e=this.#Ea(t)),void 0!==e&&o.push(e)}return a?0!==o.length?r=new Ji(o):h.warn("No valid measurement groups in TID 1500 SR"):h.warn("No measurement groups in TID 1500 SR"),r}#Ma(e){const t=[];let n=!1;for(const i of e.contentSequence)if(this.#Ia(i)){n=!0;const e=this.#Fa(i);void 0!==e&&t.push(e)}const i=[];return n?0!==t.length?i.push(new Ji(t)):h.warn("No valid measurement groups in TID 4100 SR"):h.warn("No image findings in TID 4100 SR"),i}#Ua(e){const t=new Ja;t.mathShape=Wo(e.value);for(const n of e.contentSequence)this.#ma(t,n),this.#fa(t,n),this.#Da(t,n,!0);return t}#Qa(e){let t;e.valueType===pr&&Rn(e.conceptNameCode,ai(ti))||h.warn("Not the expected TID 1500 SR content header");const n=e.contentSequence.find(this.#da);return void 0!==n?t=this.#qa(n):h.warn("No imaging measurements in TID 1500 SR"),t}#Va(e){return e.valueType===pr&&Rn(e.conceptNameCode,ai(Nn))||h.warn("Not the expected TID 4100 SR content header"),e.contentSequence.find(this.#Aa)}#Na(e){e.valueType===pr&&Rn(e.conceptNameCode,ai($n))||console.warn("Not the expected dwv034 content header");const t=[];for(const n of e.contentSequence)n.valueType===gr&&t.push(this.#Ua(n));return new Ji(t)}#Ba(e,t){const n=function(e){return Ne(t,e)};e.setMetaValue("StudyInstanceUID",n("0020000D")),e.setMetaValue("StudyID",n("00200010")),e.setMetaValue("SeriesInstanceUID",n("0020000E")),e.setMetaValue("SeriesNumber",n("00200011")),e.setMetaValue("Modality",n("00080060")),e.setMetaValue("PatientName",n("00100010")),e.setMetaValue("PatientID",n("00100020")),e.setMetaValue("PatientBirthDate",n("00100030")),e.setMetaValue("PatientSex",n("00100040"));const i="0040A375",o=t[i];if(void 0!==o){const t=Ue({[i]:o});e.setMetaValue("CurrentRequestedProcedureEvidenceSequence",t.CurrentRequestedProcedureEvidenceSequence)}}create(e){const t=yr(e);let n,i;if(this.#ua(e)?(i="TID 1500 SR",n=this.#Qa(t)):this.#ca(e)&&(h.warn("DWV v0.34 annotation"),i="DWV v0.34 SR",n=this.#Na(t)),this.#pa(e)){i="TID 4100 SR";const t=this.createCADReport(e);void 0!==t&&(n=t.annotationGroups[0])}if(void 0===n)throw new Error("Cannot create annotation group from "+i);return this.#Ba(n,e),n}createCADReport(e){const t=yr(e),n=this.#Va(t);if(void 0===n)return void h.warn("No CAD processing and Findings Summary in TID 4100 SR");let i=[];if(this.#pa(e)&&(i=this.#Ma(n)),void 0===i)throw new Error("Cannot create annotation groups from TID 4100 SR");for(const t of i)this.#Ba(t,e);const o=[];let r;for(const e of n.contentSequence)if(this.#Ta(e)){const t=this.#ka(e);void 0!==t&&o.push(t)}else this.#La(e)&&(r=e.value);const a=new ts;return a.annotationGroups=i,a.responseEvaluations=o,a.comment=r,a}#Ga(e){const t=new Dr(hr);t.relationshipType=rr,t.conceptNameCode=ai(Kn);const n=new go;n.referencedSOPClassUID=e.referencedSopClassUID,n.referencedSOPInstanceUID=e.referencedSopInstanceUID;const i=new Do;return i.referencedSOPSequence=n,void 0!==e.referencedFrameNumber&&(i.referencedFrameNumber=e.referencedFrameNumber.toString()),t.value=i,t}#Ha(e){const t=[],n=new Dr(sr);n.relationshipType=ir,n.conceptNameCode=ai(Hn),n.value=e.trackingId,t.push(n);const i=new Dr(ur);if(i.relationshipType=ir,i.conceptNameCode=ai(Yn),i.value=e.trackingUid,t.push(i),void 0!==e.textExpr&&0!==e.textExpr.length){const n=new Dr(sr);if(n.relationshipType=ar,n.conceptNameCode=ai(ei),n.value=e.textExpr,void 0!==e.labelPosition){const t=new Dr(gr);t.relationshipType=nr,t.conceptNameCode=ai(Jn);const i=new zo;i.graphicType=No;const o=[e.labelPosition.getX().toString(),e.labelPosition.getY().toString()];i.graphicData=o,t.value=i;const r=this.#Ga(e);t.contentSequence=[r],n.contentSequence=[t]}t.push(n)}const o=new Dr(sr);if(o.relationshipType=ar,o.conceptNameCode=ci(),o.value=e.colour,t.push(o),void 0!==e.referencePoints){const n=new Dr(gr);n.relationshipType=ar,n.conceptNameCode=ai(Jn);const i=new zo;i.graphicType=Bo;const o=[];for(const t of e.referencePoints)o.push(t.getX().toString()),o.push(t.getY().toString());i.graphicData=o,n.value=i;const r=this.#Ga(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.planePoints){const n=new Dr(Sr);n.relationshipType=tr,n.conceptNameCode=ai(ii);const i=new Jo;i.graphicType=Bo;const o=[];for(const t of e.planePoints)o.push(t.getX().toString()),o.push(t.getY().toString()),o.push(t.getZ().toString());i.graphicData=o,n.value=i;const r=this.#Ga(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.quantification)for(const n in e.quantification){const i=Ir(n,ne(e.quantification[n].value,12),e.quantification[n].unit);void 0!==i&&t.push(i)}const r=e.getMetaConceptIds();for(const n of r){const i=e.getMetaItem(n);let o=sr;i.value instanceof xn&&(o=cr);const r=new Dr(o);r.relationshipType=tr,r.conceptNameCode=i.concept,r.value=i.value,t.push(r)}return t}#za(e){const t=new Dr(pr);t.relationshipType=tr,t.conceptNameCode=ai($n),t.value=mr;const n=new Dr(gr);n.relationshipType=tr,n.conceptNameCode=ai(Mn),n.value=Xo(e.mathShape);const i=this.#Ga(e);return n.contentSequence=[i],t.contentSequence=[n].concat(this.#Ha(e)),t}#Ya(e){let t;if(0!==e.getList().length){const n=new Dr(pr);n.conceptNameCode=ai(ni),n.relationshipType=tr,n.value=mr;const i=[];for(const t of e.getList())i.push(this.#za(t));n.contentSequence=i,t=new Dr(pr),t.conceptNameCode=ai(ti),t.value=mr,t.contentSequence=[n]}return t}toDicom(e,t){let n=e.getMeta();n.TransferSyntaxUID="1.2.840.10008.1.2.1",n.SOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",n.MediaStorageSOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",n.CompletionFlag="PARTIAL",n.VerificationFlag="UNVERIFIED";const i=new Date;n.ContentDate=nn(en(i)),n.ContentTime=on(tn(i));const o=n.CurrentRequestedProcedureEvidenceSequence.value[0].ReferencedSeriesSequence.value[0];let r=o.ReferencedSOPSequence;void 0===r&&(o.ReferencedSOPSequence={value:[]},r=o.ReferencedSOPSequence);const a=r.value;for(const t of e.getList()){const e={ReferencedSOPInstanceUID:t.referencedSopInstanceUID,ReferencedSOPClassUID:t.referencedSopClassUID},n=function(t){return t.ReferencedSOPInstanceUID===e.ReferencedSOPInstanceUID&&t.ReferencedSOPClassUID===e.ReferencedSOPClassUID};void 0===a.find(n)&&a.push(e)}n.ContentTemplateSequence={value:[{MappingResource:"DCMR",TemplateIdentifier:"1500"}]};const s=this.#Ya(e);if(void 0===s)throw new Error("No annotation group SR content");return n={...n,...Cr(s)},void 0!==t&&$a(n,t),wn(n)}#Xa(e){const t=new Dr(cr);t.relationshipType=or,t.conceptNameCode=ai(Un),t.value=ai(Qn),t.contentSequence=[];const n=new Dr(sr);n.relationshipType=ir,n.conceptNameCode=ai(Hn),n.value=e.trackingId,t.contentSequence.push(n);const i=new Dr(ur);if(i.relationshipType=ir,i.conceptNameCode=ai(Yn),i.value=e.trackingUid,t.contentSequence.push(i),void 0!==e.quantification)for(const n in e.quantification){const i=Ir(n,ne(e.quantification[n].value,12),e.quantification[n].unit,nr);if(void 0!==i){const n=new Dr(gr);n.relationshipType=or,n.conceptNameCode=ai(jn),n.value=Xo(e.mathShape);const o=this.#Ga(e);n.contentSequence=[o],i.contentSequence=[n],t.contentSequence.push(i)}}const o=e.getMetaConceptIds();for(const n of o){const i=e.getMetaItem(n);let o=sr;i.value instanceof xn&&(o=cr);const r=new Dr(o);r.relationshipType=tr,r.conceptNameCode=i.concept,r.value=i.value,t.contentSequence.push(r)}return t}#Wa(e,t){if(0!==e.getList().length)for(const n of e.getList())t.push(this.#Xa(n))}#ja(e){const t=new Dr(pr);t.relationshipType=nr,t.conceptNameCode=ai(Bn),t.value=mr,t.contentSequence=[];const n=new Dr(cr);if(n.relationshipType=ir,n.conceptNameCode=ai(kn),n.value=ai(Gn),t.contentSequence.push(n),void 0!==e){if(void 0!==e.current){const n=new Dr(cr);n.relationshipType=tr,n.conceptNameCode=ai(Xn),n.value=e.current,t.contentSequence.push(n)}if(void 0!==e.measure){const n=new Dr(lr);n.relationshipType=tr,n.conceptNameCode=ai(zn);const i=new oo;i.numericValue=e.measure,i.measurementUnitsCode=hi("unit.mm");const o=new lo;o.measuredValue=i,n.value=o,t.contentSequence.push(n)}}return t}#ka(e){let t,n,i;for(const i of e.contentSequence)this.#wa(i)?t=i.value:this.#Pa(i)&&(n=i.value.measuredValue.numericValue);return void 0!==t&&(i=new es,i.current=t,void 0!==n&&(i.measure=n)),i}toDicomCADReport(e,t){let n=e.annotationGroups[0].getMeta();n.TransferSyntaxUID="1.2.840.10008.1.2.1",n.SOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",n.MediaStorageSOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",n.CompletionFlag="PARTIAL",n.VerificationFlag="UNVERIFIED";const i=new Date;n.ContentDate=nn(en(i)),n.ContentTime=on(tn(i));const o=n.CurrentRequestedProcedureEvidenceSequence.value[0].ReferencedSeriesSequence.value[0];let r=o.ReferencedSOPSequence;void 0===r&&(o.ReferencedSOPSequence={value:[]},r=o.ReferencedSOPSequence);const a=r.value;for(const t of e.annotationGroups)for(const e of t.getList()){const t={ReferencedSOPInstanceUID:e.referencedSopInstanceUID,ReferencedSOPClassUID:e.referencedSopClassUID},n=function(e){return e.ReferencedSOPInstanceUID===t.ReferencedSOPInstanceUID&&e.ReferencedSOPClassUID===t.ReferencedSOPClassUID};void 0===a.find(n)&&a.push(t)}n.ContentTemplateSequence={value:[{MappingResource:"DCMR",TemplateIdentifier:"4100"}]};const s=new Dr(cr);s.relationshipType=tr,s.conceptNameCode=ai(qn),s.value=ai(Vn),s.contentSequence=[];for(const t of e.responseEvaluations){const e=this.#ja(t);s.contentSequence.push(e)}for(const t of e.annotationGroups)this.#Wa(t,s.contentSequence);if(void 0!==e.comment){const t=new Dr(sr);t.relationshipType=tr,t.conceptNameCode=ai(Zn),t.value=e.comment,s.contentSequence.push(t)}const l=new Dr(pr);if(l.conceptNameCode=ai(Nn),l.value=mr,l.contentSequence.push(s),void 0===l)throw new Error("No annotation group SR content");return n={...n,...Cr(l)},void 0!==t&&$a(n,t),wn(n)}}const is=["dataadd","dataremove","dataimageset","dataupdate"];function os(e,t,n){let i;return i=void 0!==t["00020010"]?"00200013":"imageUid",function(e,t,n,i,o){void 0===o&&(o="");const r={};if(!n)throw new Error("Cannot merge object with an undefined id key: "+n);if(!Object.prototype.hasOwnProperty.call(e,n))throw new Error("Id key not found in first object while merging: "+n+", obj: "+e);if(!Object.prototype.hasOwnProperty.call(t,n))throw new Error("Id key not found in second object while merging: "+n+", obj: "+t);let a=!1;if(Object.prototype.hasOwnProperty.call(e[n],"merged")&&e[n].merged&&(a=!0),!Object.prototype.hasOwnProperty.call(e[n],i))throw new Error("Id value not found in first object while merging: "+n+", valueKey: "+i+", ojb: "+e);if(!Object.prototype.hasOwnProperty.call(t[n],i))throw new Error("Id value not found in second object while merging: "+n+", valueKey: "+i+", ojb: "+t);let s=e[n][i];const l=t[n][i][0]+o;if(r[n]=e[n],a){for(let e=0;e<s.length;++e)if(s[e]===l)throw new Error("The first object already contains id2: "+l+", id1: "+s);r[n][i].push(l)}else{if(s=s[0]+o,s===l)throw new Error("Cannot merge object with same ids: "+s+", id2: "+l);r[n][i][0]=s,r[n][i].push(l),r[n].merged=!0}const c=Object.keys(e),u=Object.keys(t).filter((function(e){return c.indexOf(e)<0})),d=c.concat(u);for(let o=0;o<d.length;++o){const c=d[o];if(c!==n){let n,o,u,d,h;if(Object.prototype.hasOwnProperty.call(e,c)&&(n=e[c],Object.prototype.hasOwnProperty.call(n,i)&&(o=n[i])),Object.prototype.hasOwnProperty.call(t,c)&&(u=t[c],Object.prototype.hasOwnProperty.call(u,i)&&(d=u[i])),void 0!==n?h=n:void 0!==u&&(h=u),!ae(o,d))if(a){if(Array.isArray(o)){h[i]={};for(let e=0;e<s.length;++e)h[i][s[e]]=o}else h[i]=o;void 0===h[i]&&(h[i]={}),h[i][l]=d}else{const e={};e[s]=o,e[l]=d,h[i]=e}r[c]=h}}return r}(e,t,i,"value",n)}class rs{meta;image;annotationGroup;buffer;numberOfFiles;warn=[];#Za=!1;constructor(e){this.meta=e}getComplete(){let e;return void 0!==this.image&&(e=this.image.getComplete()),e}setComplete(e){void 0!==this.image&&this.image.setComplete(e)}hasDuplicateOrigin(){return this.#Za}appendData(e){this.#Za||(void 0!==this.image&&void 0!==e.image&&this.#_a(e.image),this.#Ka(e.meta))}#_a(e){const t=this.image.getGeometry(),n=e.getGeometry();t.canAppendOrigin(n.getOrigin(),n.getInitialTime()).success||(this.#Za=!0),this.#Za||this.image.appendSlice(e)}#Ka(e){const t=Zt(e);let n;void 0!==t&&(n=t.toString()),this.meta=os(this.meta,e,n)}}class as{#ft=[];addClone(e){const t=new rs(structuredClone(e.meta));t.image=e.image.clone(),this.add(t)}add(e){this.#ft.push(e)}buildData(){const e=this.#Ja();if(void 0===e)throw new Error("Non constant number of volumes");if(0===e)throw new Error("Duplicate origins but no volumes");if(1===e)throw new Error("Duplicate origins but just one volume");const t=this.#$a(e,_t);if(void 0===t)throw new Error("Cannot create image for multi-volume");let n,i;for(let e=0;e<t.length;++e){const o=t[e],r=this.#ft[o[0]].meta;i=void 0===i?r:os(i,r,e+":"+_t(r));for(const t of o){const i=this.#ft[t].image;i.getGeometry().setInitialTime(e),void 0===n?n=i:n.appendSlice(i)}}return{image:n,meta:i}}#$a(e,t){const n=this.#es(),i=[],o=[];for(const r of n){if(0===o.length){for(const e of r.indices){const n=t(this.#ft[e].meta);if(o.includes(n))return;o.push(n)}if(o.length!==e)return;o.sort()}for(const e of r.indices){const n=t(this.#ft[e].meta),r=o.indexOf(n);if(-1===r)return;void 0===i[r]&&(i[r]=[]),i[r].push(e)}}const r=n.length;for(const e of i)if(e.length!==r)return;return i}#Ja(){const e=this.#es();if(0===e.length)return 0;const t=e[0].count;for(const n of e)if(n.count!==t)return;return t}#es(){const e=function(e){return function(t){return t.pos.equals(e)}},t=[];for(let n=0;n<this.#ft.length;++n){const i=this.#ft[n].image.getGeometry().getOrigin(),o=e(i),r=t.find(o);void 0===r?t.push({pos:i,indices:[n],count:1}):(++r.count,r.indices.push(n))}return t}}class ss{#ts={};#ns={};#is={};#os=-1;#X=new z;getNextDataId(){return++this.#os,this.#os.toString()}getDataIds(){return Object.keys(this.#ts)}reset(){this.#ts={}}get(e){return this.#ts[e]}getDataIdsFromSopUids(e){const t=[];if(void 0===e||0===e.length)return t;const n=Object.keys(this.#ts);for(const i of n)void 0!==this.#ts[i].image&&this.#ts[i].image.containsImageUids(e)&&t.push(i);return t}getDataIdFromSeriesUid(e){let t;const n=Object.keys(this.#ts);for(const i of n){const n=this.#ts[i].image;if(void 0!==n&&e===n.getMeta().SeriesInstanceUID){t=i;break}}return t}setImage(e,t){this.#ts[e].image=t;for(const n of Wi)t.addEventListener(n,this.#rs(e));this.#j({type:"dataimageset",value:[t],dataid:e})}#as(e){const t=Ne(e.meta,"00080060");let n;if(Fe(e.meta))if("SEG"===t){const t=qt(e.meta);if(void 0===t)throw new Error("Cannot create mask image: the DICOM seg does not have a referenced series UID");const i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create mask image: the DICOM seg referenced series is not loaded");n=new Ni,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,this.#ts[i].image))}else n=new un,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,e.numberOfFiles));else"SR"===t&&(n=new ns,void 0===n.checkElements(e.meta)&&(e.annotationGroup=n.create(e.meta)));void 0!==n&&void 0!==n.getWarning()&&e.warn.push(n.getWarning())}add(e,t){if(void 0===e||void 0!==this.#ts[e])return!1;if(this.#ts[e]=t,void 0===t.image&&void 0===t.annotationGroup&&(this.#as(t),void 0!==t.numberOfFiles&&t.numberOfFiles>1&&(this.#ns[e]=new as,this.#ns[e].addClone(t))),void 0!==t.image)for(const n of Wi)t.image.addEventListener(n,this.#rs(e));if(void 0!==t.annotationGroup)for(const n of Ki)t.annotationGroup.addEventListener(n,this.#rs(e));return this.#j({type:"dataadd",dataid:e}),!0}remove(e){if(void 0!==this.#ts[e]){const t=this.#ts[e].image;if(void 0!==t)for(const n of Wi)t.removeEventListener(n,this.#rs(e));const n=this.#ts[e].annotationGroup;if(void 0!==n)for(const t of Ki)n.removeEventListener(t,this.#rs(e));delete this.#ts[e],this.#j({type:"dataremove",dataid:e})}}stash(e){void 0!==this.#ts[e]&&(this.#is[e]=this.#ts[e],this.remove(e))}unstash(e){void 0!==this.#is[e]&&(this.add(e,this.#is[e]),delete this.#is[e])}getStashedDataIds(){return Object.keys(this.#is)}getStashed(e){return this.#is[e]}update(e,t){if(void 0===this.#ts[e])throw new Error("Cannot find data to update: "+e);const n=this.#ts[e];this.#as(t),void 0!==this.#ns[e]&&this.#ns[e].add(t),n.hasDuplicateOrigin()||n.appendData(t),this.#j({type:"dataupdate",dataid:e})}markDataAsComplete(e){const t=this.#ts[e];if(void 0===t)throw new Error("Cannot find data to mark as complete: "+e);const n={imageHasChanged:!1};if(void 0!==this.#ns[e]&&t.hasDuplicateOrigin()){const i=this.#ns[e].buildData();this.setImage(e,i.image),t.meta=i.meta,delete this.#ns[e],n.imageHasChanged=!0}return t.setComplete(!0),n}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j=e=>{this.#X.fireEvent(e)};#rs(e){return t=>{t.dataid=e,this.#j(t)}}}const ls={WindowLevelBinder:class{getEventType=function(){return"wlchange"};getCallback=function(e){return function(t){const n=e.getViewLayersByDataId(t.dataid);if(0!==n.length){const e=n[0].getViewController();if(2===t.value.length){const n=new f(t.value[0],t.value[1]);e.setWindowLevel(n)}3===t.value.length&&e.setWindowLevelPreset(t.value[2])}}}},PositionBinder:class{getEventType=function(){return"positionchange"};getCallback=function(e){return function(t){const n=t.value[1],i=e.getViewLayersByDataId(t.dataid);let o,r=!1;0!==i.length?(o=i[0],r=!0):o=e.getBaseViewLayer();const a=o.getViewController(),s=a.getCurrentPosition(),l=s.length(),c=n.length;!r&&c>3&&l>3&&(n[3]=s.get(3)),a.setCurrentPosition(new q(n))}}},ZoomBinder:class{getEventType=function(){return"zoomchange"};getCallback=function(e){return function(t){const n={x:t.value[0],y:t.value[1],z:t.value[2]};let i;6===t.value.length&&(i=new F(t.value[3],t.value[4],t.value[5])),e.setScale(n,i),e.draw()}}},OffsetBinder:class{getEventType=function(){return"offsetchange"};getCallback=function(e){return function(t){e.setOffset({x:t.value[0],y:t.value[1],z:t.value[2]}),e.draw()}}},OpacityBinder:class{getEventType=function(){return"opacitychange"};getCallback=function(e){return function(t){if(void 0===t.dataid)return;const n=e.getViewLayersByDataId(t.dataid),i=e.getBaseViewLayer();0!==n.length&&i!==n[0]&&(n[0].setOpacity(t.value),n[0].draw())}}},ColourMapBinder:class{getEventType=function(){return"colourmapchange"};getCallback=function(e){return function(t){const n=e.getViewLayersByDataId(t.dataid);0!==n.length&&n[0].getViewController().setColourMap(t.value[0])}}},MaskViewBinder:class{getEventType=function(){return"maskviewchange"};getCallback=function(e){return function(t){const n=e.getViewLayersByDataId(t.dataid);0!==n.length&&(n[0].setFillOpacity(t.value[0]),n[0].setContourThickness(t.value[1]))}}}};class cs{#ss=[];#ls;#an=!1;#cs=[];#ur=null;getLayerGroup(e){return this.#ss[e]}getNumberOfLayerGroups(){return this.#ss.length}getActiveLayerGroup(){return this.getLayerGroup(this.#ls)}setActiveLayerGroup(e){void 0!==this.getLayerGroup(e)?this.#ls=e:h.warn("No layer group to set as active with index: "+e)}getViewLayersByDataId(e){let t=[];for(const n of this.#ss)t=t.concat(n.getViewLayersByDataId(e));return t}getViewLayers(e){let t=[];for(const n of this.#ss)t=t.concat(n.getViewLayers(e));return t}getDrawLayersByDataId(e){let t=[];for(const n of this.#ss)t=t.concat(n.getDrawLayersByDataId(e));return t}getDrawLayers(e){let t=[];for(const n of this.#ss)t=t.concat(n.getDrawLayers(e));return t}addLayerGroup(e,t){this.#ls=this.#ss.length;const n=new ia(e,t);n.setImageSmoothing(this.#an);const i=this.#ur&&0!==this.#ur.length;return i&&this.unbindLayerGroups(),this.#ss.push(n),i&&this.bindLayerGroups(),n}getLayerGroupByDivId(e){return this.#ss.find((function(t){return t.getDivId()===e}))}setBinders(e){if(null==e)throw new Error("Cannot set null or undefined binders");0!==this.#cs.length&&this.unbindLayerGroups(),this.#cs=e.slice(),this.bindLayerGroups()}empty(){this.unbindLayerGroups();for(const e of this.#ss)e.empty();this.#ss=[],this.#ls=void 0}removeLayersByDataId(e){for(const t of this.#ss)t.removeLayersByDataId(e)}removeLayerGroup(e){const t=this.#ss.findIndex((t=>t===e));if(-1===t)throw new Error("Cannot find layerGroup to remove");this.unbindLayerGroups(),e.empty(),this.#ss.splice(t,1),this.#ls===t&&(this.#ls=void 0),this.bindLayerGroups()}reset(){for(const e of this.#ss)e.reset()}resetZoomPan(){for(const e of this.#ss)e.resetZoomPan()}resetViews(){for(const e of this.#ss)e.resetViews()}draw(){for(const e of this.#ss)e.draw()}fitToContainer(){let e;const t=[];for(let n=0;n<this.#ss.length;++n){const i=this.#ss[n].getDivToWorldSizeRatio();void 0!==i&&this.#ss[n].shouldBind()&&(t.push(n),(void 0===e||i<e)&&(e=i))}for(let n=0;n<this.#ss.length;++n)if(t.includes(n)&&this.#ss[n].shouldBind())this.#ss[n].fitToContainer(e);else{const e=this.#ss[n].getDivToWorldSizeRatio();this.#ss[n].fitToContainer(e)}}bindLayerGroups(){if(0!==this.#ss.length&&1!==this.#ss.length&&0!==this.#cs.length){this.#ur=new Array(this.#ss.length);for(let e=0;e<this.#ss.length;++e)if(this.#ss[e].shouldBind())for(let t=0;t<this.#cs.length;++t)this.#us(e,this.#cs[t])}}unbindLayerGroups(){if(0!==this.#ss.length&&0!==this.#cs.length&&this.#ur){for(let e=0;e<this.#ss.length;++e)if(this.#ss[e].shouldBind())for(let t=0;t<this.#cs.length;++t)this.#ds(e,this.#cs[t]);this.#ur=null}}setImageSmoothing(e){this.#an=e;for(const t of this.#ss)t.setImageSmoothing(e)}#hs(e,t){void 0===this.#ur[t]&&(this.#ur[t]=[]);let n=this.#ur[t].find((function(t){return t.binder===e}));return void 0===n&&(n={binder:e,callback:n=>{this.#ds(t,e),e.getCallback(this.#ss[t])(n),this.#us(t,e)}},this.#ur[t].push(n)),n.callback}#us(e,t){for(let n=0;n<this.#ss.length;++n)n!==e&&this.#ss[n].shouldBind()&&this.#ss[e].addEventListener(t.getEventType(),this.#hs(t,n))}#ds(e,t){if(this.#ur)for(const n in this.#ur)if(parseInt(n,10)!==e)for(const i of this.#ur[n])i.binder.getEventType()===t.getEventType()&&this.#ss[e].removeEventListener(t.getEventType(),i.callback)}}class us{#rn;constructor(e){this.#rn=e}fromJSON(e){const t=JSON.parse(e);let n;if("0.1"===t.version)n=this.#gs(t);else if("0.2"===t.version)n=this.#Ss(t);else if("0.3"===t.version)n=this.#ps(t);else if("0.4"===t.version)n=this.#ms(t);else{if("0.5"!==t.version)throw new Error("Unknown state file format version: '"+t.version+"'.");n=this.#fs(t)}return n}apply(e,t){const n=e.getActiveLayerGroup().getBaseViewLayer().getViewController(),i=new f(t["window-center"],t["window-width"]);n.setWindowLevel(i);const o=e.getActiveLayerGroup().getBaseScale();let r,a;if(void 0!==t.scaleCenter){r={x:t.scale*o.x,y:t.scale*o.y,z:1};const e=t.scaleCenter.x-t.scaleCenter.x*t.scale,n=t.scaleCenter.y-t.scaleCenter.y*t.scale,i=e+t.translation.x*r.x,s=n+t.translation.y*r.y;a={x:-i/r.x,y:-s/r.y,z:0}}else r={x:t.scale.x*o.x,y:t.scale.y*o.y,z:o.z},a={x:t.offset.x,y:t.offset.y,z:0};e.getActiveLayerGroup().setScale(r),e.getActiveLayerGroup().setOffset(a),e.setDrawings(t.drawings,t.drawingsDetails,this.#rn)}#gs(t){const n=function(t){const n=[],i={};let o,r;for(let a=0,s=t.length;a<s;++a){n[a]=[];for(let s=0,l=t[a].length;s<l;++s){o=t[a][s];const l=[];for(let t=0,n=o.length;t<n;++t){r=e.Node.create(o[t]),r.visible(!0);let n={x:0,y:0};const a=r.getChildren((function(e){return"shape"===e.name()}))[0];if(a.stroke(A(a.stroke())),"line-group"===r.name()){r.name("ruler-group");const t=new e.Line({points:[a.points()[0],a.points()[1],a.points()[0],a.points()[1]],name:"shape-tick0"});r.add(t);const n=new e.Line({points:[a.points()[2],a.points()[3],a.points()[2],a.points()[3]],name:"shape-tick1"});r.add(n)}const s=r.getChildren((function(e){return"arc"===e.name()}));1===s.length&&s[0].name("shape-arc");const c=r.getChildren((function(e){return"text"===e.name()}));let u=new e.Text({name:"text",text:""});1===c.length?(n.x=c[0].x(),n.y=c[0].y(),c[0].remove(),u=c[0]):0!==a.points().length&&(n={x:a.points()[0],y:a.points()[1]});const d=new e.Label({x:n.x,y:n.y,name:"label"});d.add(u),d.add(new e.Tag),r.add(d),l.push(JSON.stringify(r.toObject()));let h=u.text();const g=h.length;let S=null;"ruler-group"===r.name()?(S={length:{value:parseFloat(h.substring(0,g-2)),unit:h.substring(-2)}},h="{length}"):"ellipse-group"===r.name()||"rectangle-group"===r.name()?(S={surface:{value:parseFloat(h.substring(0,g-3)),unit:h.substring(-3)}},h="{surface}"):"protractor-group"!==r.name()&&"rectangle-group"!==r.name()||(S={angle:{value:parseFloat(h.substring(0,g-1)),unit:h.substring(-1)}},h="{angle}"),i[r.id()]={textExpr:h,longText:"",quant:S}}n[a].push(l)}}return{drawings:n,drawingsDetails:i}}(t.drawings);return t.drawings=ds(n.drawings).toObject(),t.drawingsDetails=hs(n.drawingsDetails),(t=gs(t)).drawings=Ss(t.drawings),t}#Ss(e){return e.drawings=ds(e.drawings).toObject(),e.drawingsDetails=hs(function(e){const t={},n="string"==typeof e?JSON.parse(e):e;for(let e=0,i=n.length;e<i;++e)for(let i=0,o=n[e].length;i<o;++i)for(let o=0,r=n[e][i].length;o<r;++o){const r=n[e][i][o];t[r.id]={textExpr:r.textExpr,longText:r.longText,quant:r.quant}}return t}(e.drawingsDetails)),(e=gs(e)).drawings=Ss(e.drawings),e}#ps(e){return e.drawingsDetails=hs(e.drawingsDetails),(e=gs(e)).drawings=Ss(e.drawings),e}#ms(e){return(e=gs(e)).drawings=Ss(e.drawings),e}#fs(e){return e}}function ds(t){let n,i,r;const a=new e.Layer({listening:!1,visible:!0}),s="string"==typeof t?JSON.parse(t):t;for(let t=0,c=s.length;t<c;++t)for(let c=0,u=s[t].length;c<u;++c)if(i=s[t][c],0!==i.length){r=new e.Group({id:(l=new o([1,1,t,c]),"slice-"+l.get(2)+"_frame-"+(4===l.length()?l.get(3):0)),name:"position-group",visible:!1});for(let t=0,o=i.length;t<o;++t)n=e.Node.create(i[t]),n.draggable(!0),n.getChildren().forEach((function(e){e.draggable(!1)})),r.add(n);a.add(r)}var l;return a}function hs(e){const t={},n=Object.keys(e);for(let i=0,o=n.length;i<o;++i){const o=e[n[i]];t[n[i]]={meta:{textExpr:o.textExpr,longText:o.longText,quantification:o.quant}}}return t}function gs(e){const t=e.position;return e.position=[t.i,t.j,t.k],e}function Ss(e){const t=e.children;for(let e=0,n=t.length;e<n;++e){const n=t[e],i=n.attrs.id.split("_"),o=parseInt(i[0].substring(6),10),r=parseInt(i[1].substring(6),10);let a="#2-";a+=0===o&&0!==r?r:o,n.attrs.id=a}return e}function ps(e){let t;return"null"!==window.location.origin&&(t=window.location.origin),new URL(e,t)}function ms(e){const t={};let n;if(e&&-1!==(n=e.indexOf("?"))){t.base=e.substring(0,n);let i=e.indexOf("#");-1===i&&(i=e.length);const o=e.substring(n+1,i);t.query=function(e){const t={};if(e){const n=e.split("&");for(let e=0;e<n.length;++e){const i=n[e].split("=");t[i[0]]?(t[i[0]]instanceof Array||(t[i[0]]=[t[i[0]]]),t[i[0]].push(i[1])):t[i[0]]=i[1]}}return t}(o)}return t}function fs(e){const t=ms(e);return 0===Object.keys(t).length?null:t.query}function vs(e){let t;const n=fs(e);return n&&void 0!==n.input&&(t=ys(n.input,n.dwvReplaceMode)),t}function Ds(e,t){const n=fs(e);n&&void 0!==n.input&&Cs(n.input,n.nslices,t)}function ys(e,t){const n=[];let i="key";t&&(i=t);const o=decodeURIComponent(e),r=ms(o);if(0===Object.keys(r).length)n.push(o);else{const e=Object.keys(r.query);let t=null;for(let n=0;n<e.length;++n)if(r.query[e[n]]instanceof Array){t=e[n];break}if(t){const o=r.query[t];let a=r.base;""!==a&&"file"!==t&&(a+="?");let s,l=!1;for(let n=0;n<e.length;++n)e[n]!==t&&(l&&(a+="&"),a+=e[n]+"="+r.query[e[n]],l=!0);for(let e=0;e<o.length;++e)s=a,l&&(s+="&"),"key"===i&&(s+=t+"="),s+=o[e],n.push(s)}else n.push(o)}return n}function Cs(e,t,n){let i="";"/"===e[0]&&(i=window.location.protocol+"//"+window.location.host),i+=e;const o=new XMLHttpRequest;o.open("GET",decodeURIComponent(i),!0),o.responseType="document",o.onload=function(e){n(function(e,t){const n=[],i=e.getElementsByTagName("wado_query")[0].getAttribute("wadoURL")+"?requestType=WADO&contentType=application/dicom&",o=e.getElementsByTagName("Patient");o.length>1&&h.warn("More than one patient, loading first one.");const r=o[0].getElementsByTagName("Study");r.length>1&&h.warn("More than one study, loading first one.");const a=r[0].getAttribute("StudyInstanceUID"),s=r[0].getElementsByTagName("Series");s.length>1&&h.warn("More than one series, loading first one.");const l=s[0].getAttribute("SeriesInstanceUID"),c=s[0].getElementsByTagName("Instance");let u=c.length;t<u&&(u=t);for(let e=0;e<u;++e){const t=i+"&studyUID="+a+"&seriesUID="+l+"&objectUID="+c[e].getAttribute("SOPInstanceUID");n.push(t)}return n}(e.target.responseXML,t))},o.onerror=function(e){h.warn("RequestError while receiving manifest: "+e.target.status)},o.send(null)}class Is{#vs;#Ds=null;#ur=[];#ys={};constructor(e){this.#vs=e}init(){for(const e in this.#vs)this.#vs[e].init();this.enableShortcuts(!0)}enableShortcuts(e){e?window.addEventListener("keydown",this.#Cs("window","keydown"),!0):window.removeEventListener("keydown",this.#Cs("window","keydown"),!0)}getToolList(){return this.#vs}hasTool(e){return void 0!==this.getToolList()[e]}getSelectedTool(){return this.#Ds}getSelectedToolEventHandler(e){return this.getSelectedTool()[e]}setSelectedTool(e){if(!this.hasTool(e))throw new Error("Unknown tool: '"+e+"'");this.#Ds&&this.#Ds.activate(!1),this.#Ds=this.#vs[e],this.#Ds.activate(!0)}setToolFeatures(e){this.getSelectedTool()&&this.getSelectedTool().setFeatures(e)}bindLayerGroup(e,t){const n=e.getDivId();e.addEventListener("activelayerchange",this.#Is(n)),this.#Ts(n,t)}#Ts(e,t){void 0!==this.#ys[e]&&this.#Ls(this.#ys[e]),this.#ys[e]=t,this.#ws(t)}#Is(e){return t=>{const n=t.value[0];void 0!==n&&this.#Ts(e,n)}}#ws(e){e.bindInteraction();const t=Ar;for(let n=0;n<t.length;++n)e.addEventListener(t[n],this.#Cs(e.getId(),t[n]))}#Ls(e){e.unbindInteraction();const t=Ar;for(let n=0;n<t.length;++n)e.removeEventListener(t[n],this.#Cs(e.getId(),t[n]))}#Cs(e,t){if(void 0===this.#ur[e]&&(this.#ur[e]=[]),void 0===this.#ur[e][t]){const n=e=>{if(this.#Ds){const t=this.#Ds[e.type];t&&t(e)}};this.#ur[e][t]=n}return this.#ur[e][t]}}class Ts{#Ps=[];#As=2;#Os;constructor(e){this.#Os=e}setNumberOfDimensions(e){this.#As=e}setNToLoad(e){for(let t=0;t<e;++t){this.#Ps[t]=[];for(let e=0;e<this.#As;++e)this.#Ps[t][e]=0}}onprogress=e=>{if(!e.lengthComputable)return;if(void 0===e.subindex)return;if(void 0===e.index)return;const t=100*e.loaded/e.total;let n;this.#Ps[e.index][e.subindex]=t,n=void 0!==e.item?e.item:{loaded:this.#bs(e.index),total:100,source:e.source},this.#Os({lengthComputable:!0,loaded:this.#xs(),total:100,item:n})};#bs(e){let t=0;for(let n=0;n<this.#As;++n)t+=this.#Ps[e][n];return t/this.#As}#xs(){let e=0;const t=this.#Ps.length;for(let n=0;n<t;++n)e+=this.#bs(n);return Math.round(e/t)}getMonoProgressHandler(e,t){return n=>{n.index=e,n.subindex=t,this.onprogress(n)}}getUndefinedMonoProgressHandler(e){return t=>{t.subindex=e,this.onprogress(t)}}}class Ls{#Rs=null;#Es=[];#Fs=null;#qs=0;#Ms=0;#Us;#ae;getDefaultCharacterSet(){return this.#ae}setDefaultCharacterSet(e){this.#ae=e}#Qs(e){this.#Rs=e,this.#qs=0,this.#Ms=0,this.#Us=!1,this.#Vs(),this.#Ns()}#Bs(e){this.#Es.push(e)}#Vs(){this.#Es=[]}#ks(e){this.#Fs=e}#Ns(){this.#Fs=null}#Gs=e=>{this.#qs++,this.#qs===this.#Rs.length&&this.onload({source:this.#Rs})};#Hs=e=>{this.#Ms++,this.#Ms===this.#Rs.length&&this.onloadend({source:this.#Rs})};#zs(e,t){return n=>{n.source=t,e(n)}}load(e,t){this.onloadstart({source:e}),1===e.length&&(J(e[0],"DICOMDIR")||J(e[0],".dcmdir"))?this.#Ys(e[0],t):this.#Xs(e,t)}#Ws(e,t,n){return i=>{const o=i.target.status;200!==o&&0!==o?(this.onerror({source:t,error:"GET "+i.target.responseURL+" "+i.target.status+" ("+i.target.statusText+")",target:i.target}),this.#Hs()):e.load(i.target.response,t,n)}}#Xs(e,t){if(void 0===e||0===e.length)return;this.#Qs(e);const n=new Ts(this.onprogress);n.setNToLoad(e.length);const i=[];for(let e=0;e<Ms.length;++e)i.push(new Ms[e]);let o=e[0],r=null,a=!1;for(let s=0;s<i.length;++s)if(r=i[s],r.canLoadUrl(o,t)){a=!0,r.setOptions({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=n.getUndefinedMonoProgressHandler(1),r.onloaditem=this.onloaditem,r.onload=this.#Gs,r.onloadend=this.#Hs,r.onerror=this.onerror,r.onabort=this.onabort,this.#ks(r);break}if(!a)throw new Error("No loader found for url: "+o);let s=0;const l=()=>{s<this.#Es.length-1&&!this.#Us&&(++s,this.#Es[s].send(null))};for(let i=0;i<e.length;++i){if(o=e[i],!r.canLoadUrl(o,t))throw new Error("Input url of different type: "+o);const a=new XMLHttpRequest;if(a.open("GET",o,!0),void 0!==t){if(void 0!==t.requestHeaders){const e=t.requestHeaders;for(let t=0;t<e.length;++t)void 0!==e[t].name&&void 0!==e[t].value&&a.setRequestHeader(e[t].name,e[t].value)}void 0!==t.withCredentials&&(a.withCredentials=t.withCredentials)}a.onprogress=this.#zs(n.getMonoProgressHandler(i,0),o),a.onload=this.#Ws(r,o,i),a.onloadend=l;const s=this.#zs(this.onerror,o);a.onerror=e=>{this.#Hs(),s(e)};const c=this.#zs(this.ontimeout,o);a.ontimeout=e=>{this.#Hs(),c(e)};const u=this.#zs(this.onabort,o);a.onabort=e=>{this.#Hs(),u(e)},1===r.loadUrlAs()&&(a.responseType="arraybuffer"),this.#Bs(a)}let c=this.#Es.length;void 0!==t&&void 0!==t.batchSize&&0!==c&&(c=Math.min(t.batchSize,this.#Es.length));for(let e=0;e<c;++e)this.#Us||(s=e,this.#Es[s].send(null))}#Ys(e,t){const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=n=>{const i=n.target.status;if(200!==i&&0!==i)this.onerror({source:e,error:"GET "+n.target.responseURL+" "+n.target.status+" ("+n.target.statusText+")",target:n.target}),this.onloadend({});else{const i=function(e){const t=new st;return t.parse(e),function(e){const t=e["00041220"];if(void 0===t||void 0===t.value)return void h.warn("No Directory Record Sequence found in DICOMDIR.");const n=t.value;if(0===n.length)return void h.warn("The Directory Record Sequence of the DICOMDIR is empty.");const i=[];let o=null,r=null;for(let e=0;e<n.length;++e){const t=n[e]["00041430"];if(void 0===t||void 0===t.value)continue;const a=t.value[0];if("STUDY"===a)r=[],i.push(r);else if("SERIES"===a)o=[],r.push(o);else if("IMAGE"===a){const t=n[e]["00041500"];if(void 0===t||void 0===t.value)continue;const i=t.value;o.push(i.join("/"))}}return i}(t.getDicomElements())}(n.target.response)[0][0],o=e.split("/").slice(0,-1).join("/"),r=[];for(let e=0;e<i.length;++e)r.push(o+"/"+i[e]);this.#Xs(r,t)}},n.onerror=t=>{this.#zs(this.onerror,e)(t),this.onloadend({})},n.onabort=t=>{this.#zs(this.onabort,e)(t),this.onloadend({})},n.send(null)}abort(){this.#Us=!0;for(let e=0;e<this.#Es.length;++e)4!==this.#Es[e].readyState&&this.#Es[e].abort();this.#Fs&&this.#Fs.isLoading()&&this.#Fs.abort()}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}ontimeout(e){}onabort(e){}}class ws extends Gi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./"+i.u(968),i.b),{name:"jpegbaseline.worker",type:"module"})}}class Ps extends Gi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./"+i.u(112),i.b),{name:"jpegloss.worker",type:"module"})}}class As extends Gi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./"+i.u(557),i.b),{name:"jpeg2000.worker",type:"module"})}}class Os extends Gi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./"+i.u(326),i.b),{name:"rle.worker",type:"module"})}}class bs{#js;#Zs;#_s=!1;constructor(e){this.#js=e,this.#Zs=new Bi(10)}decode(e,t,n){this.#_s||(this.#_s=!0,this.#Zs.onworkstart=this.ondecodestart,this.#Zs.onworkitem=this.ondecodeditem,this.#Zs.onwork=this.ondecoded,this.#Zs.onworkend=this.ondecodeend,this.#Zs.onerror=this.onerror,this.#Zs.onabort=this.onabort);const i={buffer:e,meta:t};let o;"jpeg-baseline"===this.#js?o=new ws(i,n):"jpeg-lossless"===this.#js?o=new Ps(i,n):"jpeg2000"===this.#js?o=new As(i,n):"rle"===this.#js&&(o=new Os(i,n)),void 0!==o&&this.#Zs.addWorkerTask(o)}abort(){this.#Zs.abort()}ondecodestart(e){}ondecodeditem(e){}ondecoded(e){}ondecodeend(e){}onerror(e){}onabort(e){}}class xs{#Ks;setOptions(e){this.#Ks=e}#Js;#$s=[];#el=[];#tl=[];#nl=!1;#il(e,t){const n=this.#$s[e].getDicomElements(),i=new rs(n);void 0!==this.#tl[e]&&(i.buffer=this.#tl[e]),i.numberOfFiles=this.#Ks.numberOfFiles,this.onloaditem({data:i,source:t})}#ol(e,t){this.#nl||(this.onprogress({lengthComputable:!0,loaded:100,total:100,index:e,source:t}),this.onload({source:t}),this.onloadend({source:t}))}#rl(e){this.#Js=new bs(e),this.#Js.ondecodeditem=e=>{this.#al(e),e.itemNumber+1===e.numberOfItems&&(this.onload(e),this.onloadend(e))},this.#Js.onerror=this.onerror,this.#Js.onabort=this.onabort}#sl(e){const t=this.#$s[e].getDicomElements(),n={missing:[]},i=Ne(t,"00280100");void 0!==i?n.bitsAllocated=i:n.missing.push("bitsAllocated");const o=Ne(t,"00280103");void 0!==o?n.isSigned=1===o:n.missing.push("pixelRepresentation");const r=Ne(t,"00280011"),a=Ne(t,"00280010");void 0!==r&&void 0!==a?n.sliceSize=r*a:(void 0!==r&&n.missing.push("columns"),void 0!==a&&n.missing.push("rows"));const s=Ne(t,"00280002");if(void 0!==s){if(n.samplesPerPixel=s,1!==s){const e=Ne(t,"00280006");void 0!==e?n.planarConfiguration=e:n.missing.push("planarConfiguration")}}else n.missing.push("samplesPerPixel");return n}#ll(e,t,n){const i=this.#sl(e);if(0!==i.missing.length)return this.#Js.abort(),this.onerror({error:new Error("Missing tags to decompress data:"+i.missing.toString()),source:t}),void this.onloadend({source:t});const o=n.length;for(let r=0;r<o;++r)this.#Js.decode(n[r],i,{itemNumber:r,numberOfItems:o,index:e,indexOrigin:t})}#al(e){const t=e.index,n=e.indexOrigin;this.onprogress({lengthComputable:!0,loaded:e.itemNumber+1,total:e.numberOfItems,index:e.index,source:n});const i=e.data[0];if(1!==e.numberOfItems){if(void 0===this.#el[t]){this.#el[t]=i.length;const o=e.numberOfItems*this.#el[t];try{this.#tl[t]=new i.constructor(o)}catch(e){if(e instanceof RangeError){const e=Math.floor(Math.log(o)/Math.log(2));h.error("Cannot allocate "+i.constructor.name+" of size: "+o+" (>2^"+e+") for decompressed data.")}return this.#Js.abort(),this.onerror({error:e,source:n}),void this.onloadend({source:n})}}i.length!==this.#el[t]&&h.warn("Unsupported varying decompressed data size: "+i.length+" != "+this.#el[t]),this.#tl[t].set(i,this.#el[t]*e.itemNumber)}else this.#tl[t]=i;0===e.itemNumber&&this.#il(t,n)}convert(e,t,n){this.#nl=!1,this.onloadstart({source:t,index:n});const i=new st;void 0!==this.#Ks.defaultCharacterSet&&i.setDefaultCharacterSet(this.#Ks.defaultCharacterSet);try{i.parse(e)}catch(e){return this.onerror({error:e,source:t}),void this.onloadend({source:t})}this.#$s[n]=i;const o=i.getDicomElements(),r=Ee(o);if(void 0!==r){const e=r.value,i=function(e){let t;return tt(e)?t="jpeg2000":$e(e)?t="jpeg-baseline":et(e)?t="jpeg-lossless":nt(e)&&(t="rle"),t}(Ne(o,"00020010"));void 0!==i?(void 0===this.#Js&&this.#rl(i),this.#ll(n,t,e)):(this.#tl[n]=e[0],this.#il(n,t),this.#ol(n,t))}else this.#il(n,t),this.#ol(n,t)}abort(){this.#nl=!0,void 0!==this.#Js?this.#Js.abort():this.onabort({})}onloadstart(e){}onloaditem(e){}onprogress(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class Rs{#Rs=null;#Fs=null;#qs=0;#Ms=0;#ae;getDefaultCharacterSet(){return this.#ae}setDefaultCharacterSet(e){this.#ae=e}#Qs(e){this.#Rs=e,this.#qs=0,this.#Ms=0,this.#Ns()}#ks(e){this.#Fs=e}#Ns(){this.#Fs=null}#Gs=e=>{this.#qs++,this.#qs===this.#Rs.length&&this.onload({source:this.#Rs})};#Hs=e=>{this.#Ms++,this.#Ms===this.#Rs.length&&this.onloadend({source:this.#Rs})};load(e){if(void 0===e||0===e.length)return;this.#Qs(e),this.onloadstart({source:e});const t=new Ts(this.onprogress);t.setNToLoad(e.length),t.setNumberOfDimensions(1);const n=[];for(let e=0;e<Ms.length;++e)n.push(new Ms[e]);let i=e[0],o=null,r=!1;for(let a=0;a<n.length;++a)if(o=n[a],o.canLoadMemory(i)){r=!0,o.setOptions({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),o.onprogress=t.getUndefinedMonoProgressHandler(0),o.onloaditem=this.onloaditem,o.onload=this.#Gs,o.onloadend=this.#Hs,o.onerror=this.onerror,o.onabort=this.onabort,this.#ks(o);break}if(!r)throw new Error("No loader found for data: "+i.filename);for(let t=0;t<e.length;++t){if(i=e[t],!o.canLoadMemory(i))throw new Error("Input data of different type: "+i.filename);o.load(i.data,i.filename,t)}}abort(){this.#Fs&&this.#Fs.isLoading()&&this.#Fs.abort()}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}function Es(e){return parseInt(e,36).toString()}function Fs(e){const t=e.data.length,n=new Uint8Array(t/4*3);let i=0;for(let o=0;o<t;o+=4)n[i]=e.data[o],n[i+1]=e.data[o+1],n[i+2]=e.data[o+2],i+=3;return n}function qs(e,t,n,i,o,r){const a=new lt([e,t,1]),s=new ct([1,1,1]),l=new F(0,0,n),c=new mt([l],a,s),u=new _i(c,i,[r]);u.setPhotometricInterpretation("RGB");const d={BitsStored:8};return void 0!==o&&(d.numberOfFiles=o),u.setMeta(d),u}const Ms=[class{#Ks={};#cl=!1;setOptions(e){this.#Ks=e}isLoading(){return this.#cl}#ul=new xs;load(e,t,n){this.#cl||(this.#ul.setOptions(this.#Ks),this.#ul.onloadstart=this.onloadstart,this.#ul.onprogress=this.onprogress,this.#ul.onloaditem=this.onloaditem,this.#ul.onload=this.onload,this.#ul.onloadend=e=>{this.#cl=!1,this.onloadend(e)},this.#ul.onerror=e=>{e.source=t,this.onerror(e)},this.#ul.onabort=this.onabort),this.#cl=!0,this.#ul.convert(e,t,n)}abort(){this.#cl=!1,this.#ul.abort()}canLoadFile(e){const t=ee(e.name);return null===t||"dcm"===t}canLoadUrl(e,t){if(void 0!==t){if(void 0!==t.forceLoader&&"dicom"===t.forceLoader)return!0;if(void 0!==t.requestHeaders){const e=function(e){return"Accept"===e.name},n=t.requestHeaders.find(e);if(void 0!==n){const e="application/dicom";return K(n.value,e)&&"+"!==n.value[e.length]}}}const n=ps(e),i=ee(n.pathname),o=null===i,r="dcm"===i,a=n.searchParams.get("contentType");return null!=a?"application/dicom"===a:o||r}canLoadMemory(e){const t=e["Content-Type"];if(void 0!==t&&t.startsWith("application/dicom"))return!0;if(void 0!==e.filename){const t=new File(["from memory"],e.filename);return this.canLoadFile(t)}return!1}loadFileAs(){return Us.ArrayBuffer}loadUrlAs(){return 1}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}},class{#cl=!1;setOptions(e){}isLoading(){return this.#cl}load(e,t,n){this.#cl=!0,this.onloadstart({source:t});try{this.onprogress({lengthComputable:!0,loaded:100,total:100,index:n,source:t});const i={data:e,source:t};this.onloaditem(i),this.onload(i)}catch(e){this.onerror({error:e,source:t})}finally{this.#cl=!1,this.onloadend({source:t})}}abort(){this.#cl=!1,this.onabort({}),this.onloadend({})}canLoadFile(e){return"json"===ee(e.name)}canLoadUrl(e,t){if(void 0!==t){if(void 0!==t.forceLoader&&"json"===t.forceLoader)return!0;if(void 0!==t.requestHeaders){const e=function(e){return"Accept"===e.name},n=t.requestHeaders.find(e);if(void 0!==n)return K(n.value,"application/json")||K(n.value,"application/dicom+json")}}return"json"===ee(ps(e).pathname)}canLoadMemory(e){const t=e["Content-Type"];if(void 0!==t&&t.startsWith("application/json"))return!0;if(void 0!==e.filename){const t=new File(["from memory"],e.filename);return this.canLoadFile(t)}return!1}loadFileAs(){return Us.Text}loadUrlAs(){return 0}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}},class{#cl=!1;setOptions(e){}isLoading(){return this.#cl}load(e,t,n){this.onloadstart({source:t}),this.#cl=!0;const i=new Rs;i.onprogress=e=>{e.loaded=50+e.loaded/2,e.index=n,this.onprogress(e)},i.onloaditem=this.onloaditem,i.onload=this.onload,i.onloadend=e=>{this.#cl=!1,this.onloadend(e)},i.onerror=this.onerror,i.onabort=this.onabort,i.load(function(e){const t=new Uint8Array(e),n=[];if(0===t.length)return n;const i=ce(new Uint8Array([13,10,13,10]));let o=le(t,i,0);if(void 0===o)throw new Error("Can't find the end of the first multipart header");const r=se(t.slice(0,o)).split("\r\n");let a;for(let e=0;e<r.length;++e)if("-"===r[e][0]&&"-"===r[e][1]){a=r[e];break}if(void 0===a)throw new Error("Can't find the boundary between multi-parts");const s=ce(te(a)),l=a.length;let c=le(t,s,0);for(;void 0!==o;){const e={},r=se(t.slice(c+l,o)).split("\r\n");for(let t=0;t<r.length;++t){const n=r[t],i=n.indexOf(":");if(-1!==i){const t=n.substring(0,i).trim(),o=n.substring(i+1).trim();e[t]=o}}if(c=le(t,s,o),void 0===c)break;const a=o+4,u=c-2;e.data=a<u?t.slice(a,u).buffer:new Uint8Array,n.push(e),o=le(t,i,c+l)}return n}(e))}abort(){this.#cl=!1,this.onabort({}),this.onloadend({})}canLoadFile(e){return!1}canLoadUrl(e,t){if(void 0!==t){if(void 0!==t.forceLoader&&"multipart"===t.forceLoader)return!0;if(void 0!==t.requestHeaders){const e=function(e){return"Accept"===e.name},n=t.requestHeaders.find(e);if(void 0!==n)return K(n.value,"multipart/related")}}return!1}canLoadMemory(e){return!1}loadFileAs(){return Us.ArrayBuffer}loadUrlAs(){return 1}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}},class{#nl=!1;setOptions(e){}isLoading(){return!0}#dl(e,t){let n=t;n&&"jpg"!==n||(n="jpeg");const i=new Blob([e],{type:"image/"+n});return window.URL.createObjectURL(i)}load(e,t,n){this.#nl=!1;const i=new Image;if(i.onload=()=>{try{if(!this.#nl){this.onprogress({lengthComputable:!0,loaded:100,total:100,index:n,source:t});const e=function(e,t,n){const i=e.width,o=e.height,r=document.createElement("canvas");r.width=i,r.height=o;const a=r.getContext("2d");a.drawImage(e,0,0);const s=a.getImageData(0,0,i,o),l={};let c;"string"==typeof t?(l.origin={value:[t]},c=Es(t)):(l.fileName={value:[t.name]},c=Es(t.name),l.fileType={value:[t.type]},l.fileLastModifiedDate={value:[t.lastModified]}),l.imageWidth={value:[i]},l.imageHeight={value:[o]};const u=n||0;l.imageUid={value:[u]},l.seriesUid={value:[c]};const d=qs(i,o,u,Fs(s),1,u.toString()),h=d.getMeta();h.SeriesInstanceUID=c,d.setMeta(h);const g=new rs(l);return g.image=d,{data:g,source:t}}(i,t,n);this.onloaditem(e),this.onload(e)}}catch(e){this.onerror({error:e,source:t})}finally{this.onloadend({source:t})}},"string"==typeof e)i.src=e;else if("string"==typeof t){const n=t.split(".").pop().toLowerCase();i.src=this.#dl(e,n)}}abort(){this.#nl=!0,this.onabort({}),this.onloadend({})}canLoadFile(e){return void 0!==e.type&&null!==e.type.match("image.*")}canLoadUrl(e,t){if(void 0!==t){if(void 0!==t.forceLoader&&"rawimage"===t.forceLoader)return!0;if(void 0!==t.requestHeaders){const e=function(e){return"Accept"===e.name},n=t.requestHeaders.find(e);if(void 0!==n)return K(n.value,"image/")}}const n=ps(e),i=ee(n.pathname),o="jpeg"===i||"jpg"===i||"png"===i||"gif"===i,r=n.searchParams.get("contentType");return null!=r?"image/jpeg"===r||"image/png"===r||"image/gif"===r:o}canLoadMemory(e){if(void 0!==e.filename){const t=new File(["from memory"],e.filename);return this.canLoadFile(t)}return!1}loadFileAs(){return Us.DataURL}loadUrlAs(){return 1}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}},class{setOptions(e){}isLoading(){return!0}#dl(e,t){const n=new Uint8Array(e);let i="";for(let e=0;e<n.byteLength;++e)i+=String.fromCharCode(n[e]);return"data:video/"+t+";base64,"+window.btoa(i)}load(e,t,n){const i=document.createElement("video");if("string"==typeof t){const n=t.split(".").pop().toLowerCase();i.src=this.#dl(e,n)}else i.src=e;i.onloadedmetadata=e=>{try{!function(e,t,n,i,o,r,a){const s=e.videoWidth,l=e.videoHeight,c=Math.ceil(30*e.duration),u={};let d;"string"==typeof r?(u.origin={value:[r]},d=Es(r)):(u.fileName={value:[r.name]},d=Es(r.name),u.fileType={value:[r.type]},u.fileLastModifiedDate={value:[r.lastModified]}),u.imageWidth={value:[s]},u.imageHeight={value:[l]},u.numberOfFrames={value:[c]},u.imageUid={value:[0]},u.seriesUid={value:[d]};const h=document.createElement("canvas");h.width=s,h.height=l;const g=h.getContext("2d");e.addEventListener("seeked",(function h(f){(function(){i({lengthComputable:!0,loaded:S,total:c,index:a,source:r}),g.drawImage(e,0,0);const n=Fs(g.getImageData(0,0,s,l));if(0===S){p=qs(s,l,1,n,c,a.toString());const e=p.getMeta();e.SeriesInstanceUID=d,p.setMeta(e);const i=new rs(u);i.image=p,t({data:i,source:r})}else p.appendFrameBuffer(n,S);++S})(),m+=1/30,m<=f.target.duration?this.currentTime=m:(n({source:r}),o({source:r}),e.removeEventListener("seeked",h))}),!1);let S=0,p=null,m=0;e.currentTime=m}(e.target,this.onloaditem,this.onload,this.onprogress,this.onloadend,t,n)}catch(e){this.onerror({error:e,source:t}),this.onloadend({source:t})}}}abort(){this.onabort({}),this.onloadend({})}canLoadFile(e){return void 0!==e.type&&null!==e.type.match("video.*")}canLoadUrl(e,t){if(void 0!==t){if(void 0!==t.forceLoader&&"rawvideo"===t.forceLoader)return!0;if(void 0!==t.requestHeaders){const e=function(e){return"Accept"===e.name},n=t.requestHeaders.find(e);if(void 0!==n)return K(n.value,"video/")}}const n=ee(ps(e).pathname);return"mp4"===n||"ogg"===n||"webm"===n}canLoadMemory(e){if(void 0!==e.filename){const t=new File(["from memory"],e.filename);return this.canLoadFile(t)}return!1}loadFileAs(){return Us.DataURL}loadUrlAs(){return 1}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}},class{#cl=!1;setOptions(e){}isLoading(){return this.#cl}#hl="";#gl=[];#Sl=null;#pl(e,t,n){this.#gl.push({filename:this.#hl,data:e});const i=100*this.#gl.length/this.#Sl.length;if(this.onprogress({lengthComputable:!0,loaded:i/2,total:100,index:n,item:{loaded:i,total:100,source:t}}),this.#gl.length<this.#Sl.length){const e=this.#gl.length;this.#hl=this.#Sl[e].name,this.#Sl[e].async("arrayBuffer").then((e=>{this.#pl(e,t,n)}))}else{const e=new Rs;e.onprogress=e=>{e.loaded=50+e.loaded/2,e.index=n,this.onprogress(e)},e.onloaditem=this.onloaditem,e.onload=this.onload,e.onloadend=e=>{this.#cl=!1,this.onloadend(e)},e.onerror=this.onerror,e.onabort=this.onabort,e.load(this.#gl)}}load(e,t,i){this.onloadstart({source:t}),this.#cl=!0,n.loadAsync(e).then((e=>{this.#gl=[],this.#Sl=e.file(/.*\.dcm/);const n=this.#gl.length;this.#hl=this.#Sl[n].name,this.#Sl[n].async("arrayBuffer").then((e=>{this.#pl(e,t,i)}))}))}abort(){this.#cl=!1,this.onabort({}),this.onloadend({})}canLoadFile(e){return"zip"===ee(e.name)}canLoadUrl(e,t){if(void 0!==t){if(void 0!==t.forceLoader&&"zip"===t.forceLoader)return!0;if(void 0!==t.requestHeaders){const e=function(e){return"Accept"===e.name},n=t.requestHeaders.find(e);if(void 0!==n)return K(n.value,"application/zip")}}return"zip"===ee(ps(e).pathname)}canLoadMemory(e){const t=e["Content-Type"];if(void 0!==t&&t.startsWith("application/zip"))return!0;if(void 0!==e.filename){const t=new File(["from memory"],e.filename);return this.canLoadFile(t)}return!1}loadFileAs(){return Us.ArrayBuffer}loadUrlAs(){return 1}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}],Us={Text:0,ArrayBuffer:1,DataURL:2};class Qs{#Rs=null;#ml=[];#Fs=null;#qs=0;#Ms=0;#ae;getDefaultCharacterSet(){return this.#ae}setDefaultCharacterSet(e){this.#ae=e}#Qs(e){this.#Rs=e,this.#qs=0,this.#Ms=0,this.#fl(),this.#Ns()}#vl(e){this.#ml.push(e)}#fl(){this.#ml=[]}#ks(e){this.#Fs=e}#Ns(){this.#Fs=null}#Gs=e=>{this.#qs++,this.#qs===this.#Rs.length&&this.onload({source:this.#Rs})};#Hs=e=>{this.#Ms++,this.#Ms===this.#Rs.length&&this.onloadend({source:this.#Rs})};#zs(e,t){return n=>{n.source=t,e(n)}}#Ws(e,t,n){return i=>{e.load(i.target.result,t,n)}}load(e){if(void 0===e||0===e.length)return;this.#Qs(e),this.onloadstart({source:e});const t=new Ts(this.onprogress);t.setNToLoad(e.length);const n=[];for(let e=0;e<Ms.length;++e)n.push(new Ms[e]);let i=e[0],o=null,r=!1;for(let a=0;a<n.length;++a)if(o=n[a],o.canLoadFile(i)){r=!0,o.setOptions({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),o.onprogress=t.getUndefinedMonoProgressHandler(1),o.onloaditem=this.onloaditem,o.onload=this.#Gs,o.onloadend=this.#Hs,o.onerror=this.onerror,o.onabort=this.onabort,this.#ks(o);break}if(!r)throw new Error("No loader found for file: "+i.name);for(let n=0;n<e.length;++n){if(i=e[n],!o.canLoadFile(i))throw new Error("Input file of different type: "+i);const r=new FileReader;this.#vl(r),r.onprogress=this.#zs(t.getMonoProgressHandler(n,0),i),r.onload=this.#Ws(o,i,n);const a=this.#zs(this.onerror,i);r.onerror=e=>{this.#Hs(),a(e)};const s=this.#zs(this.onabort,i);r.onabort=e=>{this.#Hs(),s(e)},o.loadFileAs()===Us.Text?r.readAsText(i):o.loadFileAs()===Us.DataURL?r.readAsDataURL(i):o.loadFileAs()===Us.ArrayBuffer&&r.readAsArrayBuffer(i)}}abort(){for(let e=0;e<this.#ml.length;++e)1===this.#ml[e].readyState&&this.#ml[e].abort();this.#Fs&&this.#Fs.isLoading()&&this.#Fs.abort()}onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class Vs{#ae;#Dl={};constructor(e){this.#ae=e}loadFiles(e,t){"json"===e[0].name.split(".").pop().toLowerCase()?this.#yl(e[0],t):this.#Cl(e,t)}loadURLs(e,t,n){"json"===e[0].split(".").pop().toLowerCase()?this.#Il(e[0],t,n):this.#Tl(e,t,n)}loadImageObject(e,t){const n=new Rs;this.#Ll(e,n,"image",t)}getLoadingDataIds(){return Object.keys(this.#Dl)}abort(e){void 0!==this.#Dl[e]&&(this.#Dl[e].loader.abort(),delete this.#Dl[e])}#Cl(e,t){const n=new Qs;n.setDefaultCharacterSet(this.#ae),this.#Ll(e,n,"image",t)}#Tl(e,t,n){const i=new Ls;i.setDefaultCharacterSet(this.#ae),this.#Ll(e,i,"image",t,n)}#yl(e,t){const n=new Qs;this.#Ll([e],n,"state",t)}#Il(e,t,n){const i=new Ls;this.#Ll([e],i,"state",t,n)}#Ll(e,t,n,i,o){const r={loadtype:n,dataid:i};t.onloadstart=e=>{this.#Dl[i]={loader:t,isFirstItem:!0},this.#zs(this.onloadstart,r)(e)},t.onprogress=this.#zs(this.onprogress,r),t.onloaditem=e=>{const t={loadtype:n,dataid:i};void 0!==this.#Dl[i]&&(t.isfirstitem=this.#Dl[i].isFirstItem),this.#zs(this.onloaditem,t)(e),void 0!==this.#Dl[i]&&this.#Dl[i].isFirstItem&&(this.#Dl[i].isFirstItem=!1)},t.onload=this.#zs(this.onload,r),t.onloadend=e=>{delete this.#Dl[i],this.#zs(this.onloadend,r)(e)},t.onerror=this.#zs(this.onerror,r),t.onabort=this.#zs(this.onabort,r),void 0!==t.ontimeout&&(t.ontimeout=this.#zs(this.ontimeout,r));try{t.load(e,o)}catch(e){return this.onerror({error:e,dataid:i}),void this.onloadend({dataid:i})}}#zs(e,t){return function(n){const i=Object.keys(t);for(let e=0;e<i.length;++e){const o=i[e];n[o]=t[o]}e(n)}}onloadstart(e){}onprogress(e){}onload(e){}onloaditem(e){}onloadend(e){}onerror(e){}ontimeout(e){}onabort(e){}}class Ns{tags;event;pos;format;precision;value}function Bs(e){return function(t){return Number(t).toPrecision(e)}}function ks(e){let t="";for(let n=0;n<e;++n)0!==n&&(t+=", "),t+="{v"+n+"}";return t}function Gs(e,t){let n=e;for(let e=0;e<t.length;++e)n=n.replace("{v"+e+"}",t[e]);return n}class Hs{#Di;#rn;#wl;#Pl=[];#Al;#Ol={};#bl;#X=new z;constructor(e,t,n){this.#Di=e,this.#rn=t,this.#wl=n;const i=Object.keys(this.#wl);for(let e=0;e<i.length;++e){const t=this.#wl[i[e]];for(const e of t){const t=e.event;void 0!==t&&(this.#Pl.includes(t)||this.#Pl.push(t))}}this.addAppListeners()}reset(){this.#Ol={},this.#bl=void 0}addItemMeta(e){let t;void 0!==e["00020010"]?void 0!==e["00080018"]?(t=e["00080018"].value[0],this.#Ol[t]=function(e,t){const n=[];let i;const o=e["00080060"];if(void 0===o)return n;i=o.value[0];const r=t[i]||t["*"];if(!r)return n;for(const t of r){const i=JSON.parse(JSON.stringify(t)),o=i.tags;if(void 0!==o&&0!==o.length){const t=[];for(const n of o){const i=e[n];if(void 0!==i)if("DA"===i.vr){const e=$t(Kt(i));void 0!==e&&t.push(e.toLocaleDateString())}else if("TM"===i.vr){const e=$t({year:1900,monthIndex:0,day:1},Jt(i));void 0!==e&&t.push(e.toLocaleTimeString())}else t.push(i.value);else t.push("undefined")}void 0!==i.format&&null!==i.format||(i.format=ks(t.length)),i.value=Gs(i.format,t).trim()}n.push(i)}const a=e["00200020"];if(void 0!==a&&2===a.value.length){const e=a.value[0],t=a.value[1];n.push({pos:"cr",value:e,format:"{v0}"}),n.push({pos:"cl",value:_e(e),format:"{v0}"}),n.push({pos:"bc",value:t,format:"{v0}"}),n.push({pos:"tc",value:_e(t),format:"{v0}"})}return n}(e,this.#wl)):h.warn("Missing DICOM SOP instance UID for info data indexing"):void 0!==e.imageUid?(t=e.imageUid.value[0],this.#Ol[t]=function(e,t){const n=[],i=t.DOM;if(!i)return n;for(const t of i){const i=JSON.parse(JSON.stringify(t)),o=i.tags;if(void 0!==o&&0!==o.length){const t=[];for(const n of o){const i=e[n];void 0!==i&&t.push(i.value)}void 0!==i.format&&null!==i.format||(i.format=ks(t.length)),i.value=Gs(i.format,t).trim()}n.push(i)}return n}(e,this.#wl)):h.warn("Missing DOM image UID for info data indexing"),void 0!==t&&(this.#bl=t)}onSliceChange=e=>{e.dataid===this.#rn&&void 0!==e.data&&void 0!==e.data.imageUid&&this.#bl!==e.data.imageUid&&(this.#bl=e.data.imageUid,this.#xl(e))};#xl=e=>{if(void 0!==e.dataid&&e.dataid!==this.#rn)return;const t=this.#Ol[this.#bl];if(void 0!==t){for(const n of t){let t;if(void 0!==n.tags)"positionchange"===e.type&&(t=n.value);else if(void 0!==n.event&&n.event===e.type){const i=n.format;let o=e.value;if(void 0!==n.precision){let e;e="round"===n.precision?Math.round:Bs(parseInt(n.precision,10)),o=o.map(e)}t=Gs(i,o)}void 0!==t&&(n.value=t)}this.#j({type:"valuechange",data:t})}else console.warn("No slice info data for: "+this.#bl)};isListening(){return this.#Al}addAppListeners(){this.#Di.addEventListener("positionchange",this.onSliceChange);for(const e of this.#Pl)this.#Di.addEventListener(e,this.#xl);this.#Al=!0}removeAppListeners(){this.#Di.removeEventListener("positionchange",this.onSliceChange);for(const e of this.#Pl)this.#Di.removeEventListener(e,this.#xl);this.#Al=!1}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}#j(e){this.#X.fireEvent(e)}}class zs{divId;orientation;colourMap;opacity;fillOpacity;contourThickness;wlPresetName;windowCenter;windowWidth;constructor(e){this.divId=e}}class Ys{options;constructor(e){this.options=e}}class Xs{dataViewConfigs;tools;binders;viewOnFirstLoadItem;defaultCharacterSet;overlayConfig;rootDocument;constructor(e){this.dataViewConfigs=e}}class Ws{#Ks=null;#Rl=null;#El=null;#Fl=null;#ql=null;#Ml=null;#Ko=new jr;#ai={};#X=new z;getData(e){return this.#Rl.get(e)}getImage(e){let t;return void 0!==this.getData(e)&&(t=this.getData(e).image),t}setImage(e,t){this.#Rl.setImage(e,t)}getNextDataId(){return this.#Rl.getNextDataId()}addData(e,t){return this.#Rl.add(e,t)}getMetaData(e){let t;return void 0!==this.#Rl.get(e)&&(t=this.#Rl.get(e).meta),t}getDataIds(){return this.#Rl.getDataIds()}getDataIdsFromSopUids(e){return this.#Rl.getDataIdsFromSopUids(e)}getDataIdFromSeriesUid(e){return this.#Rl.getDataIdFromSeriesUid(e)}canScroll(){return this.#ql.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()}canWindowLevel(){return this.#ql.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()}getAddedScale(){return this.#ql.getActiveLayerGroup().getAddedScale()}getBaseScale(){return this.#ql.getActiveLayerGroup().getBaseScale()}getOffset(){return this.#ql.getActiveLayerGroup().getOffset()}getToolboxController(){return this.#El}getActiveLayerGroup(){return this.#ql.getActiveLayerGroup()}setActiveLayerGroup(e){this.#ql.setActiveLayerGroup(e)}getViewLayersByDataId(e){return this.#ql.getViewLayersByDataId(e)}getViewLayers(e){return this.#ql.getViewLayers(e)}getDrawLayersByDataId(e){return this.#ql.getDrawLayersByDataId(e)}getDrawLayers(e){return this.#ql.getDrawLayers(e)}getLayerGroupByDivId(e){return this.#ql.getLayerGroupByDivId(e)}getNumberOfLayerGroups(){return this.#ql.getNumberOfLayerGroups()}getStyle(){return this.#Ko}addToUndoStack=e=>{null!==this.#Ml&&this.#Ml.add(e)};removeFromUndoStack=e=>{let t=!1;return null!==this.#Ml&&(t=this.#Ml.remove(e)),t};init(e){if(this.#Ks=e,void 0===this.#Ks.viewOnFirstLoadItem&&(this.#Ks.viewOnFirstLoadItem=!0),void 0===this.#Ks.dataViewConfigs&&(this.#Ks.dataViewConfigs={}),void 0===this.#Ks.rootDocument&&"undefined"!=typeof document&&(this.#Ks.rootDocument=document),this.#Ml=new qr,this.#Ml.addEventListener("undoadd",this.#j),this.#Ml.addEventListener("undo",this.#j),this.#Ml.addEventListener("redo",this.#j),void 0!==this.#Ks.tools){const e={},t=Object.keys(this.#Ks.tools);for(let n=0;n<t.length;++n){const i=t[n];let o=_a[i];if(void 0===o&&(o=ja[i]),void 0!==o){if(e[i]=new o(this),void 0!==e[i].addEventListener){const t=e[i].getEventNames();for(let n=0;n<t.length;++n)e[i].addEventListener(t[n],this.#j)}const t=this.#Ks.tools[i];if(void 0!==t.options&&0!==t.options.length){let n,o="raw";if(void 0!==e[i].getOptionsType&&(o=e[i].getOptionsType()),"instance"===o||"factory"===o){n={};for(let e=0;e<t.options.length;++e){const r=t.options[e];let a=r;"factory"===o&&(a+="Factory");const s=i.charAt(0).toLowerCase()+i.slice(1);let l,c=Za[s];void 0!==c&&(l=c[a]),void 0===l&&(c=Ka[s],void 0!==c&&(l=c[a])),void 0!==l?n[r]=l:h.warn("Could not find option class for: "+r)}}else n=t.options;e[i].setOptions(n)}}else h.warn("Could not initialise unknown tool: "+i)}this.#El=new Is(e)}this.#Fl=new Vs(this.#Ks.defaultCharacterSet),this.#Fl.onloadstart=this.#Ul,this.#Fl.onprogress=this.#Ql,this.#Fl.onloaditem=this.#Vl,this.#Fl.onload=this.#Nl,this.#Fl.onloadend=this.#Bl,this.#Fl.onerror=this.#kl,this.#Fl.ontimeout=this.#Gl,this.#Fl.onabort=this.#Hl,this.#Rl=new ss;for(const e of is)this.#Rl.addEventListener(e,this.#j);for(const e of Wi)this.#Rl.addEventListener(e,this.#j);for(const e of Ki)this.#Rl.addEventListener(e,this.#j);this.#ql=new cs,void 0!==this.#Ks.binders&&this.#ql.setBinders(this.#Ks.binders)}reset(){this.#ql.empty(),this.#ai={},this.#Ml&&(this.#Ml=new qr,this.#Ml.addEventListener("undoadd",this.#j),this.#Ml.addEventListener("undo",this.#j),this.#Ml.addEventListener("redo",this.#j))}resetLayout(){this.#ql.reset(),this.#ql.draw()}resetZoomPan(){this.#ql.resetZoomPan(),this.#ql.draw()}resetViews(){this.#ql.resetViews()}addEventListener(e,t){this.#X.add(e,t)}removeEventListener(e,t){this.#X.remove(e,t)}loadFiles=e=>{if(0===e.length)return h.warn("Ignoring empty input file list."),"-1";const t=this.#Rl.getNextDataId();return this.#Fl.loadFiles(e,t),t};loadURLs=(e,t)=>{if(0===e.length)return h.warn("Ignoring empty input url list."),"-1";const n=this.#Rl.getNextDataId();return this.#Fl.loadURLs(e,n,t),n};loadFromUri=(e,t)=>{const n=fs(e);n&&void 0!==n.input&&function(e,t,n){e.type&&"manifest"===e.type?Cs(e.input,e.nslices,t):t(ys(e.input,e.dwvReplaceMode),n)}(n,this.loadURLs,t)};loadImageObject=e=>{const t=this.#Rl.getNextDataId();return this.#Fl.loadImageObject(e,t),t};abortAllLoads(){const e=this.#Fl.getLoadingDataIds();for(const t of e)this.abortLoad(t)}abortLoad(e){this.#Fl.abort(e),this.#Rl.remove(e),this.#ql.removeLayersByDataId(e)}fitToContainer(){this.#ql.fitToContainer()}initWLDisplay(){this.#ql.getActiveLayerGroup().getActiveViewLayer().getViewController().initialise()}setImageSmoothing(e){this.#ql.setImageSmoothing(e),this.#ql.draw()}getViewConfigs(e,t){if(void 0===t&&(t=!1),null===this.#Ks.dataViewConfigs||void 0===this.#Ks.dataViewConfigs)throw new Error("No available data view configuration");let n=[];return void 0!==this.#Ks.dataViewConfigs[e]?n=this.#Ks.dataViewConfigs[e]:t||void 0===this.#Ks.dataViewConfigs["*"]||(n=this.#Ks.dataViewConfigs["*"]),n}getViewConfig(e,t,n){return this.getViewConfigs(e,n).find((function(e){return e.divId===t}))}getDataViewConfigs(){return this.#Ks.dataViewConfigs}setDataViewConfigs(e){this.#ql.empty(),this.#Ks.dataViewConfigs=e,this.#zl(e)}addDataViewConfig(e,t,n){void 0===n&&(n=!0);const i=this.#Ks.dataViewConfigs;if(void 0===i[e]&&(i[e]=[]),-1!==i[e].findIndex((function(e){return e.divId===t.divId})))throw new Error("Duplicate view config for data "+e+" and div "+t.divId);this.#Ks.dataViewConfigs[e].push(t),void 0===this.#ql.getLayerGroupByDivId(t.divId)&&this.#Yl(t),void 0!==this.#Rl.get(e)&&n&&this.render(e,[t])}removeDataViewConfig(e,t){const n=this.#Ks.dataViewConfigs;if(void 0===n[e])return;const i=n[e].findIndex((function(e){return e.divId===t}));if(-1===i)return;n[e].splice(i,1),0===n[e].length&&delete n[e];const o=this.#ql.getLayerGroupByDivId(t);if(void 0!==o){const t=o.getViewLayersByDataId(e);1===t.length&&o.removeLayer(t[0]);const n=o.getDrawLayersByDataId(e);1===n.length&&o.removeLayer(n[0]),0===o.getNumberOfLayers()&&this.#ql.removeLayerGroup(o)}}updateDataViewConfig(e,t,n){const i=this.#Ks.dataViewConfigs;if(void 0===i[e])throw new Error("No config for dataId: "+e);const o=i[e].findIndex((function(e){return e.divId===t}));if(-1===o)throw new Error("No config for dataId: "+e+" and divId: "+t);const r=i[e][o];for(const e in n)r[e]=n[e];const a=this.#ql.getLayerGroupByDivId(r.divId);if(void 0!==a){const t=a.getViewLayersByDataId(e);1===t.length&&a.removeLayer(t[0]);const n=a.getDrawLayersByDataId(e);1===n.length&&a.removeLayer(n[0])}void 0!==this.#Rl.get(e)&&this.render(e,[r])}#zl(e){const t=Object.keys(e),n=[];for(let i=0;i<t.length;++i){const o=e[t[i]];for(let e=0;e<o.length;++e){const t=o[e];n.includes(t.divId)||(this.#Yl(t),n.push(t.divId))}}}#Yl(e){const t=this.#Ks.rootDocument.getElementById(e.divId),n=void 0!==this.#Ks.overlayConfig,i=this.#ql.addLayerGroup(t,n);this.#Xl(i)}setLayerGroupsBinders(e){const t=[];for(let n=0;n<e.length;++n)void 0!==ls[e[n]]&&t.push(new ls[e[n]]);this.#ql.setBinders(t)}#Wl(e,t){let n=!1;const i=t.getBaseViewLayer();if(void 0!==i){const t=this.#Rl.get(i.getDataId()).image,o=this.#Rl.get(e).image;if(void 0!==t&&void 0!==o){const e=t.getGeometry().getOrientation();n=o.getGeometry().getOrientation().isSimilar(e)}}else n=!0;return n}render(e,t){if(null==e)throw new Error("Cannot render without data id");const n=this.getData(e),i=void 0!==n&&void 0!==n.image,o=void 0!==n&&void 0!==n.annotationGroup;if(0===this.#ql.getNumberOfLayerGroups()&&this.#zl(this.#Ks.dataViewConfigs),void 0===t&&(t=this.getViewConfigs(e)),0!==t.length)for(let n=0;n<t.length;++n){const r=t[n],a=this.#ql.getLayerGroupByDivId(r.divId);if(!a)throw new Error("No layer group for "+r.divId);!i||this.#Wl(e,a)?(i&&0===a.getViewLayersByDataId(e).length?this.#jl(e,r):o&&0===a.getDrawLayersByDataId(e).length&&this.addDrawLayer(e,r),a.draw()):this.#j({type:"error",error:new Error("Render error: incompatible geometries for overlay"),dataid:e})}else h.info("Not rendering data: "+e+" (no data view config)")}zoom(e,t,n){const i=this.#ql.getActiveLayerGroup(),o=i.getBaseViewLayer().getViewController().getCurrentScrollPosition(),r=new F(t,n,o);i.addScale(e,r),i.draw()}translate(e,t){const n=this.#ql.getActiveLayerGroup();n.addTranslation({x:e,y:t,z:0}),n.draw()}resampleMatch(e,t){const n=this.#Rl.get(e);if(void 0===n)return void h.debug("Cannot resample match, target data '"+e+"' is undefined");if(void 0===n.image)return void h.debug("Cannot resample match, target image '"+e+"' is undefined");const i=this.#Rl.get(t);if(void 0===i)return void h.debug("Cannot resample match, source data '"+t+"' is undefined");if(void 0===i.image)return void h.debug("Cannot resample match, source image '"+t+"' is undefined");const o=n.image.getGeometry().getOrientation(),r=i.image.getGeometry().getOrientation();o.equals(r)?h.info("Same orientation, no resample match for data '"+e+"' and '"+t+"'"):this.resample(e,r)}resample(e,t){const n=this.#Rl.get(e);if(void 0===n)return void h.debug("Cannot resample, target data '"+e+"' is undefined");if(void 0===n.image)return void h.debug("Cannot resample, target image '"+e+"' is undefined");if(n.image.getGeometry().getOrientation().equals(t))return void h.info("Same orientation, no resample for data '"+e+"'");n.image.resample(t);const i=this.#Ks.dataViewConfigs,o=n.image.getMeta(),r=this.#Rl.getDataIds();for(let e=0;e<r.length;e++){const t=this.#Rl.get(r[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===o.SeriesInstanceUID&&this.#Rl.stash(r[e])}this.setDataViewConfigs(i);const a=this.#Rl.getDataIds();for(let e=0;e<a.length;++e)this.render(a[e])}revertResample(e){const t=this.#Rl.get(e);if(void 0===t)return void h.debug("Cannot revert resample, target data '"+e+"' is undefined");if(void 0===t.image)return void h.debug("Cannot revert resample, target image '"+e+"' is undefined");if(!t.image.isResampled())return void h.info("No revert resample needed for data '"+e+"'");t.image.revert();const n=this.#Ks.dataViewConfigs,i=t.image.getMeta(),o=this.#Rl.getStashedDataIds();for(let e=0;e<o.length;e++){const t=this.#Rl.getStashed(o[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===i.SeriesInstanceUID&&this.#Rl.unstash(o[e])}this.setDataViewConfigs(n);const r=this.#Rl.getDataIds();for(let e=0;e<r.length;++e)this.render(r[e])}setOpacity(e){const t=this.#ql.getActiveLayerGroup().getActiveViewLayer();t.setOpacity(e),t.draw()}setDrawings(t,n,i){const r=this.#ql.getActiveLayerGroup().getBaseViewLayer(),a=r.getDataId(),s=this.getData(a),l=r.getViewController(),c=function(t,n,i){const r=[],a=e.Node.create(t).getChildren(Gr);for(let e=0,t=a.length;e<t;++e){const t=a[e],s=t.getChildren();for(let e=0,a=s.length;e<a;++e){const e=new Ja,a=new o(_r(t.id()));e.referencedSopInstanceUID=i.getImageUid(a);const l=s[0];e.trackingId=l.id(),e.trackingUid=l.id();const c=l.getChildren(kr)[0];if(e.colour=c.stroke(),"line-group"===l.name()){const t=c.points();e.mathShape=new E(t[0],t[1]),e.referencePoints=[new E(t[2],t[3])]}else if("ruler-group"===l.name()){const t=c.points();e.mathShape=new Co(new E(t[0],t[1]),new E(t[2],t[3]))}else if("rectangle-group"===l.name())e.mathShape=new Eo(new E(c.x(),c.y()),new E(c.x()+c.width(),c.y()+c.height()));else if("roi-group"===l.name()){const t=c.points(),n=[];for(let e=0;e<t.length;e+=2)n.push(new E(t[e],t[e+1]));e.mathShape=new Oo(n)}else if("freeHand-group"===l.name()){h.warn("Converting freehand into ROI shape");const t=c.points(),n=[];for(let e=0;e<t.length;e+=2)n.push(new E(t[e],t[e+1]));e.mathShape=new Oo(n)}else if("protractor-group"===l.name()){const t=c.points();e.mathShape=new Ao([new E(t[0],t[1]),new E(t[2],t[3]),new E(t[4],t[5])])}else if("ellipse-group"===l.name()){const t=c.absolutePosition();e.mathShape=new xo(new E(t.x,t.y),c.radiusX(),c.radiusY())}else if("circle-group"===l.name()){const t=c.absolutePosition();e.mathShape=new bo(new E(t.x,t.y),c.radius())}else if("bidimensional-group"===l.name()){const t=c.points(),i=new qo(new E(t[0],t[1]),new E(t[2],t[3])),o=n&&n[l.id()]?n[l.id()]:void 0,r=o&&o.meta&&o.meta.quantification?o.meta.quantification:{};"function"==typeof qo.restorePropertiesFromQuantification?qo.restorePropertiesFromQuantification(e,i,r):("number"==typeof r.shortAxisLength&&(i.shortAxisLength=r.shortAxisLength),"number"==typeof r.shortAxisT&&(i.shortAxisT=r.shortAxisT),e.mathShape=i)}if(n){const t=n[l.id()];e.textExpr=t.meta.textExpr,e.quantification=t.meta.quantification}r.push(e)}}return r}(t,n,s.image),u=this.createAnnotationData(a);for(const e of c)e.setViewController(l),u.annotationGroup.add(e);this.#Rl.add(i,u),this.render(i)}applyJsonState(e,t){const n=new us(t);n.apply(this,n.fromJSON(e))}onResize=()=>{this.fitToContainer()};onKeydown=e=>{this.#j(e)};defaultOnKeydown=e=>{if(e.ctrlKey)if(e.shiftKey){const t=this.#ql.getActiveLayerGroup(),n=t.getPositionHelper();"ArrowLeft"===e.key?t.moreThanOne(3)&&n.decrementPosition(3):"ArrowUp"===e.key?t.canScroll()&&n.incrementPositionAlongScroll():"ArrowRight"===e.key?t.moreThanOne(3)&&n.incrementPosition(3):"ArrowDown"===e.key&&t.canScroll()&&n.decrementPositionAlongScroll()}else if("y"===e.key)this.#Ml.redo();else if("z"===e.key)this.#Ml.undo();else if(" "===e.key)for(let e=0;e<this.#ql.getNumberOfLayerGroups();++e)this.#ql.getLayerGroup(e).setShowCrosshair(!this.#ql.getLayerGroup(e).getShowCrosshair())};resetDisplay(){this.resetLayout(),this.initWLDisplay()}resetZoom(){this.resetLayout()}setColourMap(e){this.#ql.getActiveLayerGroup().getActiveViewLayer().getViewController().setColourMap(e)}setWindowLevelPreset(e){this.#ql.getActiveLayerGroup().getActiveViewLayer().getViewController().setWindowLevelPreset(e)}setTool(e){for(let e=0;e<this.#ql.getNumberOfLayerGroups();++e){const t=this.#ql.getLayerGroup(e),n=t.getActiveLayer();void 0!==n&&this.#El.bindLayerGroup(t,n)}this.#El.setSelectedTool(e)}setToolFeatures(e){this.#El.setToolFeatures(e)}undo(){this.#Ml.undo()}redo(){this.#Ml.redo()}getStackSize(){return this.#Ml.getStackSize()}getCurrentStackIndex(){return this.#Ml.getCurrentStackIndex()}getInfoData(e){let t;return void 0!==this.#ai&&(t=this.#ai[e]),t}toggleInfoDataListeners(e){const t=this.getInfoData(e);void 0!==t&&(t.isListening()?t.removeAppListeners():t.addAppListeners())}createAnnotationData(e){const t=this.getData(e).image.getMeta(),n=new rs({});n.annotationGroup=new Ji,n.annotationGroup.setMetaValue("Modality","SR");const i=["PatientName","PatientID","PatientBirthDate","PatientSex","StudyDate","StudyTime","StudyInstanceUID","StudyID","StudyDescription"];for(const e of i)n.annotationGroup.setMetaValue(e,t[e]);return n.annotationGroup.setMetaValue("CurrentRequestedProcedureEvidenceSequence",{value:[{ReferencedSeriesSequence:{value:[{SeriesInstanceUID:t.SeriesInstanceUID}]},StudyInstanceUID:t.StudyInstanceUID}]}),n}addAndRenderAnnotationData(e,t,n){const i=this.getNextDataId();if(!this.addData(i,e))throw new Error("Cannot add annotation data");const o=this.getViewConfigs(n).find((e=>e.divId===t));if(void 0===o)throw new Error("No reference data view config for draw");const r=new zs(t);r.orientation=o.orientation,this.addDataViewConfig(i,r),this.render(i)}#j=e=>{let t=!0;void 0!==e.propagate&&(t=e.propagate,delete e.propagate),t&&this.#X.fireEvent(e)};#Ul=e=>{void 0!==this.#Ks.overlayConfig&&(this.#ai[e.dataid]=new Hs(this,e.dataid,this.#Ks.overlayConfig)),e.type="loadstart",this.#j(e)};#Ql=e=>{e.type="loadprogress",this.#j(e)};#Vl=e=>{let t;void 0===e.data&&h.error("Missing loaditem event data."),void 0===e.loadtype&&h.error("Missing loaditem event load type."),"image"===e.loadtype?t=e.data.meta:"state"===e.loadtype&&(t="state");const n=e.isfirstitem;if("image"===e.loadtype)try{n?this.#Rl.add(e.dataid,e.data):this.#Rl.update(e.dataid,e.data)}catch(t){return this.#kl({dataid:e.dataid,error:t,source:e.source}),void this.#Bl({dataid:e.dataid,source:e.source})}else"state"===e.loadtype&&this.applyJsonState(e.data,e.dataid);this.#j({type:"loaditem",data:t,source:e.source,loadtype:e.loadtype,dataid:e.dataid,isfirstitem:e.isfirstitem,warn:e.warn}),void 0!==this.#ai&&void 0!==this.#ai[e.dataid]&&this.#ai[e.dataid].addItemMeta(t),"image"===e.loadtype&&0!==this.getViewConfigs(e.dataid).length&&n&&this.#Ks.viewOnFirstLoadItem&&this.render(e.dataid)};#Nl=e=>{const t=this.#Rl.markDataAsComplete(e.dataid);this.#Ks.viewOnFirstLoadItem&&void 0!==t.imageHasChanged&&t.imageHasChanged&&this.render(e.dataid),e.type="load",this.#j(e)};#Bl=e=>{e.type="loadend",this.#j(e)};#kl=e=>{void 0===e.type&&(e.type="error"),this.#j(e)};#Gl=e=>{void 0===e.type&&(e.type="timeout"),this.#j(e)};#Hl=e=>{void 0===e.type&&(e.type="abort"),this.#j(e)};#Xl(e){e.addEventListener("zoomchange",this.#j),e.addEventListener("offsetchange",this.#j),e.addEventListener("layerremove",this.#j),e.addEventListener("outofrange",this.#j),e.addEventListener("renderstart",this.#j),e.addEventListener("renderend",this.#j);for(const t of W)e.addEventListener(t,this.#j);e.addEventListener("wlchange",(e=>{const t=ea(e.srclayerid).groupDivId,n=this.getViewConfig(e.dataid,t,!0);void 0!==n&&(n.windowCenter=void 0,n.windowWidth=void 0,n.wlPresetName=void 0,3===e.value.length&&(n.windowCenter=e.value[0],n.windowWidth=e.value[1],n.wlPresetName=e.value[2]))})),e.addEventListener("opacitychange",(e=>{const t=ea(e.srclayerid).groupDivId,n=this.getViewConfig(e.dataid,t,!0);void 0!==n&&(n.opacity=e.value[0])})),e.addEventListener("colourmapchange",(e=>{const t=ea(e.srclayerid).groupDivId,n=this.getViewConfig(e.dataid,t,!0);void 0!==n&&(n.colourMap=e.value[0])}))}#jl(e,t){const n=this.#Rl.get(e);if(!n)throw new Error("Cannot initialise layer with missing data, id: "+e);const i=this.#ql.getLayerGroupByDivId(t.divId);if(!i)throw new Error("Cannot initialise layer with missing group, id: "+t.divId);const o=n.image.getGeometry();this.#ql.unbindLayerGroups();const r=(new x).create(n.meta,n.image),a=Pt(o.getOrientation(),Ct(t.orientation));r.setOrientation(a),r.isMask()&&(n.image.initializeContour(),void 0!==t.fillOpacity&&r.setFillOpacity(t.fillOpacity),void 0!==t.contourThickness&&r.setContourThickness(t.contourThickness));const s=0===i.getNumberOfViewLayers();let l=1;void 0!==t.opacity?l=t.opacity:s||(l=r.isMask()?.8:.5);const c=i.addViewLayer();c.setView(r,e);const u=o.getSize(a).get2D(),d=o.getSpacing(a).get2D();c.initialise(u,d,l);const h=c.getViewController();if(void 0!==t.wlPresetName)h.setWindowLevelPreset(t.wlPresetName);else if(void 0!==t.windowCenter&&void 0!==t.windowWidth){const e=new f(t.windowCenter,t.windowWidth);h.setWindowLevel(e)}void 0!==t.colourMap?h.setColourMap(t.colourMap):s||("PT"===n.image.getMeta().Modality?h.setColourMap("hot"):h.setColourMap("rainbow")),this.#Rl.addEventListener("dataimageset",c.onimageset),void 0!==this.#Ks.overlayConfig&&(i.addInfoData(this.getInfoData(e),e),i.bindInfoData(e));const g=[h.getCurrentIndex().getValues(),h.getCurrentPosition().getValues()];i.updateLayersToPositionChange({value:g,srclayerid:c.getId()}),this.#ql.fitToContainer(),c.setOffset(i.getOffset());const S=this.#Zl(o.getOrientation(),t.orientation);if(this.#_l(S,c),s)c.setScale(i.getScale());else{const e=i.getBaseViewLayer();c.initScale(i.getScale(),e.getAbsoluteZoomOffset())}this.#ql.bindLayerGroups(),this.#El&&this.#El.bindLayerGroup(i,c),this.#j({type:"viewlayeradd",layerid:c.getId(),layergroupid:i.getDivId(),dataid:e}),s&&this.#El&&this.#El.init()}#Kl(e,t){let n;const i=e.getMetaValue("CurrentRequestedProcedureEvidenceSequence");if(void 0!==i){const e=i.value[0],o=e?.ReferencedSeriesSequence,r=o?.value[0],a=r?.SeriesInstanceUID,s={SeriesInstanceUID:a},l=t.searchViewLayers(s);0!==l.length&&(n=l[0])}const o=e.getMetaValue("ReferencedSeriesSequence");if(void 0!==o){const e=o.value[0],i=e?.SeriesInstanceUID,r={SeriesInstanceUID:i},a=t.searchViewLayers(r);0!==a.length&&(n=a[0])}if(void 0===n)for(const i of e.getList()){const e={SOPInstanceUID:i.referencedSopInstanceUID,SOPClassUID:i.referencedSopClassUID},o=t.searchViewLayers(e);if(0!==o.length){n=o[0];break}}return n}addDrawLayer(e,t){const n=this.#ql.getLayerGroupByDivId(t.divId);if(!n)throw new Error("Cannot initialise layer with missing group, id: "+t.divId);const i=this.#Rl.get(e);if(!i)throw new Error("Cannot initialise layer with missing data, id: "+e);const o=i.annotationGroup,r=this.#Kl(o,n);if(void 0===r)return void console.warn("No loaded data that matches the measurements reference series UID");const a=r.getDataId();this.#ql.unbindLayerGroups();const s=r.getViewController();i.annotationGroup.setViewController(s);const l=this.#Rl.get(a);if(!l)throw new Error("Cannot initialise layer without reference data, id: "+a);const c=l.image.getGeometry(),u=Pt(c.getOrientation(),Ct(t.orientation)),d=c.getSize(u).get2D(),h=c.getSpacing(u).get2D(),g=n.addDrawLayer();g.initialise(d,h,r.getId());const S=new Tr(c,u);g.setPlaneHelper(S);const p=[s.getCurrentIndex().getValues(),s.getCurrentPosition().getValues()];n.updateLayersToPositionChange({value:p,srclayerid:g.getId()}),this.#ql.fitToContainer(),g.setOffset(n.getOffset());const m=this.#Zl(c.getOrientation(),t.orientation);this.#_l(m,g),g.initScale(n.getScale(),r.getAbsoluteZoomOffset()),g.setAnnotationGroup(i.annotationGroup,e,this.addToUndoStack),g.setCurrentPosition(s.getCurrentPosition(),s.getCurrentIndex()),this.#ql.bindLayerGroups(),this.#El&&this.#El.bindLayerGroup(n,g),this.#j({type:"drawlayeradd",layerid:g.getId(),layergroupid:n.getDivId(),dataid:e})}#Zl(e,t){const n=It(e.asOneAndZeros());if(void 0===n)throw new Error("Unsupported undefined orientation code");const i=void 0===t,o=!i&&t===yt.Axial,r=!i&&t===yt.Coronal,a=!i&&t===yt.Sagittal,s={x:!1,y:!1},l={x:!1,y:!1,z:!1};return"LPS"===n?(r||a)&&(l.z=!0,s.y=!0):"LAI"===n?i||o?s.y=!0:r?l.z=!0:a&&(l.z=!0,s.x=!0):"RPI"===n?i||o?s.x=!0:r?(l.z=!0,s.x=!0):a&&(l.z=!0):"RAS"===n?(s.x=!0,s.y=!0,(r||a)&&(l.z=!0)):"LSA"===n?(s.y=!0,i||r?l.z=!0:o?l.y=!0:a&&(s.x=!0,l.y=!0,l.z=!0)):"RSP"===n?i||r?(s.x=!0,s.y=!0,l.x=!0,l.z=!0):o?(s.x=!0,l.x=!0):a&&(s.y=!0,l.z=!0):"RIA"===n?(s.x=!0,i||r?l.x=!0:o?(s.y=!0,l.x=!0,l.y=!0):a&&(l.y=!0)):"PSL"===n?(l.z=!0,(i||a||r)&&(s.y=!0)):"PIR"===n?(l.z=!0,(o||r)&&(s.x=!0)):"ASR"===n?(s.x=!0,s.y=!0,(i||a||r)&&(l.z=!0)):"AIL"===n?i||a?(s.x=!0,l.z=!0):o?s.y=!0:r&&(l.z=!0):"LIP"!==n&&h.warn("Unsupported orientation code: "+n+", display could be incorrect"),{scale:l,offset:s}}#_l(e,t){e.offset.x&&t.addFlipOffsetX(),e.offset.y&&t.addFlipOffsetY(),e.scale.x&&t.flipScaleX(),e.scale.y&&t.flipScaleY(),e.scale.z&&t.flipScaleZ()}}class js{#Hi;#Jl;constructor(e){this.#Hi=e;const t=e.getMeta();void 0===t.custom&&(t.custom={}),void 0===t.custom.segments&&(t.custom.segments=[]),this.#Jl=t.custom.segments}getMask(){return this.#Hi}#$l(e){return this.#Jl.findIndex((function(t){return t.number===e}))}hasSegment(e){return-1!==this.#$l(e)}getNumberOfSegments(){return this.#Jl.length}maskHasSegments(e){const t=[],n=[];for(let i=0;i<e.length;++i){const o=this.getSegment(e[i]);void 0!==o?void 0!==o.displayValue?t.push(o.displayValue):t.push(o.number):(h.warn("Unknown segment in maskHasSegments: "+e[i]),n.push(i))}const i=this.#Hi.hasValues(t);for(let e=0;e<n.length;++e)i.splice(n[e],0,!1);return i}getSegment(e){let t;const n=this.#$l(e);return-1!==n&&(t=this.#Jl[n]),t}addSegment(e){-1===this.#$l(e.number)?(this.#Jl.push(e),void 0!==e.displayRGBValue&&this.#Hi.updatePaletteColourMap(e.number,e.displayRGBValue)):h.warn("Not adding segment, it is allready in the segments list: "+e.number)}removeSegment(e){const t=this.#$l(e);-1!==t?this.#Jl.splice(t,1):h.warn("Cannot remove segment, it is not in the segments list: "+e)}updateSegment(e){const t=this.#$l(e.number);-1!==t?this.#Jl[t]=e:h.warn("Cannot update segment, it is not in the segments list: "+e.number)}findOverlap(e){const t=this.#Hi.getGeometry(),n=t.getSize(),i=e.getMask(),o=i.getGeometry(),r=o.getSize(),a={},s=n.getTotalSize();for(let l=0;l<s;l++){const s=this.#Hi.getValueAtOffset(l);if(0!==s){if(void 0!==a[s])a[s].count+=1;else{const e=this.getSegment(s);a[s]={label:e.label,overlap:{},count:1}}const c=n.offsetToIndex(l),u=t.indexToWorld(c),d=o.worldToIndex(u),h=r.indexToOffset(d),g=i.getValueAtOffset(h);if(void 0!==g&&0!==g)if(void 0!==a[s].overlap[g])a[s].overlap[g].count+=1;else{const t=e.getSegment(g);a[s].overlap[g]={label:t.label,count:1,percentage:0}}}}for(const e of Object.values(a))for(const t of Object.values(e.overlap))t.percentage=100*t.count/e.count;return a}}class Zs extends Fr{#Hi;#ec;#Zi;#tc;constructor(e,t,n){super(),this.#Hi=e,this.#ec=t,this.#Zi=void 0!==n&&n,void 0!==t.displayRGBValue?this.#tc=e.getOffsets(t.number):this.#tc=e.getOffsets(t.displayValue)}getName(){return"Delete-segment"}isValid(){return this.#Hi.getMeta().custom.segments.some((e=>e.number===this.#ec.number))}execute(){0!==this.#tc.length&&this.#Hi.setAtOffsets(this.#tc,0),new js(this.#Hi).removeSegment(this.#ec.number),this.#Zi||this.onExecute({type:"masksegmentdelete",segmentnumber:this.#ec.number})}undo(){0!==this.#tc.length&&(void 0!==this.#ec.displayRGBValue?this.#Hi.setAtOffsets(this.#tc,this.#ec.number):this.#Hi.setAtOffsets(this.#tc,this.#ec.displayValue)),new js(this.#Hi).addSegment(this.#ec),this.onUndo({type:"masksegmentredraw",segmentnumber:this.#ec.number})}onExecute(e){}onUndo(e){}}class _s extends Fr{#Hi;#ec;#nc;#ic;#Zi;#tc;constructor(e,t,n,i){super(),this.#Hi=e,this.#ec=t,this.#nc=n,this.#Zi=void 0!==i&&i,void 0!==t.displayRGBValue?this.#ic=t.displayRGBValue:(this.#ic=t.displayValue,this.#tc=e.getOffsets(this.#ic))}getName(){return"Change-segment-colour"}isValid(){let e=!0;return void 0!==this.#tc&&(e=0!==this.#tc.length),e}execute(){"number"==typeof this.#nc?(this.#Hi.setAtOffsets(this.#tc,this.#nc),this.#ec.displayValue=this.#nc):(this.#Hi.updatePaletteColourMap(this.#ec.number,this.#nc),this.#ec.displayRGBValue=this.#nc),this.#Zi||this.onExecute({type:"changemasksegmentcolour",segmentnumber:this.#ec.number,value:[this.#nc]})}undo(){"number"==typeof this.#ic?(this.#Hi.setAtOffsets(this.#tc,this.#ic),this.#ec.displayValue=this.#ic):(this.#Hi.updatePaletteColourMap(this.#ec.number,this.#ic),this.#ec.displayRGBValue=this.#ic),this.onUndo({type:"changemasksegmentcolour",segmentnumber:this.#ec.number,value:[this.#ic]})}onExecute(e){}onUndo(e){}}class Ks{diameter;offset1;offset2}class Js{major;minor}class $s{centroid;centroidIndex;volume;count;diameters;height;id;largestSliceZ}class el{x;y}class tl{x;y;z}class nl{value;unit}export{Ja as Annotation,Ji as AnnotationGroup,ns as AnnotationGroupFactory,Ws as App,Xs as AppOptions,pt as BooleanResult,ts as CADReport,_s as ChangeSegmentColourCommand,bo as Circle,u as ColourMap,Fr as Command,Qe as DataElement,Zs as DeleteSegmentCommand,Ks as Diameter,Js as Diameters,xn as DicomCode,rs as DicomData,st as DicomParser,Dr as DicomSRContent,In as DicomWriter,Vr as DrawController,Zr as DrawLayer,la as DrawShapeHandler,xo as Ellipse,mt as Geometry,_i as Image,o as Index,Hs as InfoData,Ns as InfoDataItem,$s as Label,ia as LayerGroup,Ni as MaskFactory,yi as MaskSegment,js as MaskSegmentHelper,X as MaskSegmentViewHelper,Q as Matrix33,Mt as NormalisedManufacturers,St as NumberRange,yt as Orientation,Tr as PlaneHelper,q as Point,E as Point2D,F as Point3D,wr as PositionHelper,Ao as Protractor,y as RGB,Oo as ROI,Eo as Rectangle,Y as RescaleSlopeAndIntercept,es as ResponseEvaluation,el as Scalar2D,tl as Scalar3D,ra as ScrollWheel,lt as Size,ct as Spacing,Te as Tag,Ys as ToolConfig,Is as ToolboxController,nl as Value,R as Vector3D,Z as View,zs as ViewConfig,Pr as ViewController,Er as ViewLayer,f as WindowLevel,gn as WriterRule,he as addTagsToDictionary,ue as buildMultipart,ji as createImage,Zi as createMaskImage,j as createView,O as custom,_a as defaultToolList,Ka as defaultToolOptions,v as equalWl,Ue as getAsSimpleElements,Vi as getDefaultDicomSegJson,Cr as getDicomSRContentItem,ze as getDwvVersion,wn as getElementsFromJSONTags,Ro as getEllipseIndices,ta as getLayerDetailsFromEvent,Ut as getManufacturer,xr as getMousePoint,Qt as getNormalisedManufacturer,Lt as getOrientationName,xe as getPixelDataTag,Fo as getRectangleIndices,qt as getReferencedSeriesUID,_e as getReverseOrientation,yr as getSRContent,li as getSegmentationCode,we as getTagFromKey,br as getTouchPoints,it as getTypedArray,pn as getUID,vs as getURLsFromKeyValueUri,Ds as handleURLsFromWeasisXMLManifest,We as hasDicomPrefix,I as hexToRgb,_ as i18n,C as isEqualRgb,L as labToUintLab,h as logger,d as luts,ne as precisionRound,T as rgbToHex,P as srgbToCielab,ja as toolList,Za as toolOptions};
1
+ import{default as e}from"konva";import{default as t}from"jszip";import{default as n}from"magic-wand-tool";var i={};const o={};function r(e){const t=o[e];if(void 0!==t)return t.exports;const n=o[e]={exports:{}};return i[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.wc="undefined"!=typeof Worker?Worker:"undefined"!=typeof process&&"function"==typeof process.getBuiltinModule&&process.getBuiltinModule("node:worker_threads").Worker;class a{#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<n;++t)if(this.get(t)!==e.get(t))return!1;return!0}compare(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)this.get(n)!==e.get(n)&&t.push(n);return t}add(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)t.push(this.get(n)+e.get(n));return new a(t)}#t(e,t){const n=this.#e.slice();return e<n.length?n[e]+=t:console.warn("Cannot add to given dimension: ",e,n.length),new a(n)}next(e){return this.#t(e,1)}previous(e){return this.#t(e,-1)}getWithNew2D(e,t){const n=[e,t];for(let e=2,t=this.length();e<t;++e)n.push(this.get(e));return new a(n)}}const s={levels:{TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},level:3,trace(e){this.level<=this.levels.TRACE&&console.trace(e)},debug(e){this.level<=this.levels.DEBUG&&console.debug(e)},info(e){this.level<=this.levels.INFO&&console.info(e)},warn(e){this.level<=this.levels.WARN&&console.warn(e)},error(e){this.level<=this.levels.ERROR&&console.error(e)}},l=(Number.EPSILON,1e-4);class c{min;max;constructor(e,t){this.min=e,this.max=t}}function u(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)<n}function d(e){let t=e>l;return t&&(t=e>.001,t?(t=e>.01,t||s.warn("Using larger+ real world epsilon")):s.warn("Using larger real world epsilon")),t}function h(e,t){const n=Math.pow(10,t),i=.01/n;return Math.round(e*n+i)/n}class g{#n;#i;#o;constructor(e,t,n){this.#n=e,this.#i=t,this.#o=n}getX(){return this.#n}getY(){return this.#i}getZ(){return this.#o}equals(e){return null!==e&&this.#n===e.getX()&&this.#i===e.getY()&&this.#o===e.getZ()}toString(){return`(${this.#n}, ${this.#i}, ${this.#o})`}norm(){return Math.sqrt(this.#n*this.#n+this.#i*this.#i+this.#o*this.#o)}crossProduct(e){return new g(this.#i*e.getZ()-e.getY()*this.#o,this.#o*e.getX()-e.getZ()*this.#n,this.#n*e.getY()-e.getX()*this.#i)}dotProduct(e){return this.#n*e.getX()+this.#i*e.getY()+this.#o*e.getZ()}isCodirectional(e){return this.dotProduct(e)>0}}class S{#n;#i;constructor(e,t){this.#n=e,this.#i=t}getX(){return this.#n}getY(){return this.#i}getValues(){return[this.#n,this.#i]}getCentroid(){return this}contains(e,t=0){return this.getDistance(e)<=t}equals(e){return null!=e&&this.#n===e.getX()&&this.#i===e.getY()}toString(){return`(${this.#n}, ${this.#i})`}getDistance(e){const t=this.#n-e.getX(),n=this.#i-e.getY();return Math.sqrt(t*t+n*n)}}class m{#n;#i;#o;constructor(e,t,n){this.#n=e,this.#i=t,this.#o=n}getX(){return this.#n}getY(){return this.#i}getZ(){return this.#o}getValues(){return[this.#n,this.#i,this.#o]}equals(e){return null!==e&&this.#n===e.getX()&&this.#i===e.getY()&&this.#o===e.getZ()}isSimilar(e,t){return null!==e&&u(this.#n,e.getX(),t)&&u(this.#i,e.getY(),t)&&u(this.#o,e.getZ(),t)}toString(){return`(${this.#n}, ${this.#i}, ${this.#o})`}getDistance(e){return Math.sqrt(this.#r(e))}#r(e){const t=this.#n-e.getX(),n=this.#i-e.getY(),i=this.#o-e.getZ();return t*t+n*n+i*i}getClosest(e){let t=0,n=this.#r(e[t]);for(let i=0;i<e.length;++i){const o=this.#r(e[i]);o<n&&(t=i,n=o)}return t}minus(e){return new g(this.#n-e.getX(),this.#i-e.getY(),this.#o-e.getZ())}}function p(e){return function(t){return t.equals(e)}}function f(e,t){return e.some(function(e){return t.equals(e)})}function v(e){return new m(e[0],e[1],e[2])}class C{#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();t<n;++t)if(this.get(t)!==e.get(t))return!1;return!0}compare(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)this.get(n)!==e.get(n)&&t.push(n);return t}get3D(){return new m(this.get(0),this.get(1),this.get(2))}add(e){if(!this.canCompare(e))return null;const t=[],n=this.getValues(),i=e.getValues();for(let e=0;e<n.length;++e)t.push(n[e]+i[e]);return new C(t)}mergeWith3D(e){const t=this.getValues();return t[0]=e.getX(),t[1]=e.getY(),t[2]=e.getZ(),new C(t)}}const y={t(e){let t=e;const n=e.split(".");return 2===n.length&&"unit"===n[0]&&(t={mm:"mm",cm2:"cm²",ml:"ml",degree:"°",pixel:"pixels",ms:"ms",s:"s",smm2:"s/mm²"}[n[1]]),t}};function D(e,t){return null!=e&&null!=t&&e.substring(e.length-t.length)===t}function I(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 w(e){let t;if(null!=e&&"."!==e[0]){const n=e.toLowerCase().split(".");1!==n.length&&(t=n.pop(),/[a-z]/.test(t)&&!t.includes("/")||(t=void 0))}return t}function T(e){const t=new Uint8Array(e.length);for(let n=0,i=e.length;n<i;n++)t[n]=e.charCodeAt(n);return t}function L(e,t){if(void 0===t){t=[];for(let n=0;n<e.length;++n)t.push(n)}for(let n=0;n<t.length;++n)if(t[n]>=e.length)throw new Error("Non valid dimension for toStringId");let n="";for(let i=0;i<t.length;++i)0!==i&&(n+="_"),n+=`#${t[i]}-${e[t[i]]}`;return n}function P(e,t,n){let i=e.map((e,i)=>function(e,t,n){return void 0===e?t:void 0===t?e:n(e,t)}(e,t[i],n));return t.length>e.length&&(i=i.concat(t.slice(e.length))),i}function A(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&O(e.slice().sort(),t.slice().sort())}function O(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&e.length===t.length&&e.every(function(e,n){return e===t[n]})}function b(e){return String.fromCharCode(...e)}function x(e,t,n,i){(void 0===n||n<0||n>=e.length)&&(n=0),(void 0===i||i<=n||i>e.length)&&(i=e.length);for(let o=n;o<i;++o)if(t(e[o],o,e))return o}function E(e){return function(t,n,i){for(let t=0;t<e.length;++t)if(i[n+t]!==e[t])return!1;return!0}}function R(e,t){const n="\r\n";let i=0;const o=[];for(let r=0;r<e.length;++r){let a="";0!==r&&(a+=n),a+=`--${t}${n}`;const s=Object.keys(e[r]);for(let t=0;t<s.length;++t){const i=s[t];"data"!==i&&(a+=`${i}: ${e[r][i]}${n}`)}a+=n;const l=T(a);o.push(l),i+=l.byteLength+e[r].data.byteLength}const r=T(`${n}--${t}--${n}`),a=new Uint8Array(i+r.byteLength);let s=0;for(let t=0;t<e.length;++t)a.set(o[t],s),s+=o[t].byteLength,a.set(new Uint8Array(e[t].data),s),s+=e[t].data.byteLength;return a.set(r,s),a}class F{#a;#s;constructor(e,t){if(!e||void 0===e)throw new Error("Cannot create tag with no group.");if(4!==e.length)throw new Error(`Cannot create tag with badly sized group: ${e}`);if(!t||void 0===t)throw new Error("Cannot create tag with no element.");if(4!==t.length)throw new Error(`Cannot create tag with badly sized element: ${t}`);this.#a=e,this.#s=t}getGroup(){return this.#a}getElement(){return this.#s}toString(){return`(${this.#a},${this.#s})`}equals(e){return null!=e&&this.#a===e.getGroup()&&this.#s===e.getElement()}getKey(){return this.#a+this.#s}isWithVR(){return!("FFFE"===this.#a&&("E000"===this.#s||"E00D"===this.#s||"E0DD"===this.#s))}isPrivate(){return parseInt(this.#a,16)%2==1}}function M(e,t){let n=parseInt(e.getGroup(),16)-parseInt(t.getGroup(),16);return 0===n&&(n=parseInt(e.getElement(),16)-parseInt(t.getElement(),16)),n}function q(e){if(!e||void 0===e)throw new Error("Cannot create tag with no key.");if(8!==e.length)throw new Error(`Cannot create tag with badly sized key: ${e}`);return new F(e.substring(0,4),e.substring(4,8))}function U(){return new F("FFFE","E000")}function V(e){return"FFFEE000"===e.getKey()}function N(){return new F("FFFE","E00D")}function Q(e){return"FFFEE00D"===e.getKey()}function B(e){return"FFFEE0DD"===e.getKey()}function k(){return new F("7FE0","0010")}function G(e){return["7FE00010","7FE00009","7FE00008"].includes(e.getKey())}function z(e){const t=["7FE00010","7FE00009","7FE00008"];let n;for(const i of t)if(void 0!==e[i]){n=e[i];break}return n}function H(e){return void 0!==z(e)}const Y=/*#__PURE__*/JSON.parse('{"1000":{"0000":["UL","1","GenericGroupLength"],"0010":["US","3","EscapeTriplet"],"0011":["US","3","RunLengthTriplet"],"0012":["US","1","HuffmanTableSize"],"0013":["US","3","HuffmanTableTriplet"],"0014":["US","1","ShiftTableSize"],"0015":["US","3","ShiftTableTriplet"]},"1010":{"0000":["UL","1","GenericGroupLength"],"0004":["US","1-n","ZonalMap"]},"2000":{"0000":["UL","1","GenericGroupLength"],"0010":["IS","1","NumberOfCopies"],"001E":["SQ","1","PrinterConfigurationSequence"],"0020":["CS","1","PrintPriority"],"0030":["CS","1","MediumType"],"0040":["CS","1","FilmDestination"],"0050":["LO","1","FilmSessionLabel"],"0060":["IS","1","MemoryAllocation"],"0061":["IS","1","MaximumMemoryAllocation"],"0062":["CS","1","ColorImagePrintingFlag"],"0063":["CS","1","CollationFlag"],"0065":["CS","1","AnnotationFlag"],"0067":["CS","1","ImageOverlayFlag"],"0069":["CS","1","PresentationLUTFlag"],"006A":["CS","1","ImageBoxPresentationLUTFlag"],"00A0":["US","1","MemoryBitDepth"],"00A1":["US","1","PrintingBitDepth"],"00A2":["SQ","1","MediaInstalledSequence"],"00A4":["SQ","1","OtherMediaAvailableSequence"],"00A8":["SQ","1","SupportedImageDisplayFormatsSequence"],"0500":["SQ","1","ReferencedFilmBoxSequence"],"0510":["SQ","1","ReferencedStoredPrintSequence"]},"2010":{"0000":["UL","1","GenericGroupLength"],"0010":["ST","1","ImageDisplayFormat"],"0030":["CS","1","AnnotationDisplayFormatID"],"0040":["CS","1","FilmOrientation"],"0050":["CS","1","FilmSizeID"],"0052":["CS","1","PrinterResolutionID"],"0054":["CS","1","DefaultPrinterResolutionID"],"0060":["CS","1","MagnificationType"],"0080":["CS","1","SmoothingType"],"00A6":["CS","1","DefaultMagnificationType"],"00A7":["CS","1-n","OtherMagnificationTypesAvailable"],"00A8":["CS","1","DefaultSmoothingType"],"00A9":["CS","1-n","OtherSmoothingTypesAvailable"],"0100":["CS","1","BorderDensity"],"0110":["CS","1","EmptyImageDensity"],"0120":["US","1","MinDensity"],"0130":["US","1","MaxDensity"],"0140":["CS","1","Trim"],"0150":["ST","1","ConfigurationInformation"],"0152":["LT","1","ConfigurationInformationDescription"],"0154":["IS","1","MaximumCollatedFilms"],"015E":["US","1","Illumination"],"0160":["US","1","ReflectedAmbientLight"],"0376":["DS","2","PrinterPixelSpacing"],"0500":["SQ","1","ReferencedFilmSessionSequence"],"0510":["SQ","1","ReferencedImageBoxSequence"],"0520":["SQ","1","ReferencedBasicAnnotationBoxSequence"]},"2020":{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","ImageBoxPosition"],"0020":["CS","1","Polarity"],"0030":["DS","1","RequestedImageSize"],"0040":["CS","1","RequestedDecimateCropBehavior"],"0050":["CS","1","RequestedResolutionID"],"00A0":["CS","1","RequestedImageSizeFlag"],"00A2":["CS","1","DecimateCropResult"],"0110":["SQ","1","BasicGrayscaleImageSequence"],"0111":["SQ","1","BasicColorImageSequence"],"0130":["SQ","1","ReferencedImageOverlayBoxSequence"],"0140":["SQ","1","ReferencedVOILUTBoxSequence"]},"2030":{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","AnnotationPosition"],"0020":["LO","1","TextString"]},"2040":{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","ReferencedOverlayPlaneSequence"],"0011":["US","1-99","ReferencedOverlayPlaneGroups"],"0020":["SQ","1","OverlayPixelDataSequence"],"0060":["CS","1","OverlayMagnificationType"],"0070":["CS","1","OverlaySmoothingType"],"0072":["CS","1","OverlayOrImageMagnification"],"0074":["US","1","MagnifyToNumberOfColumns"],"0080":["CS","1","OverlayForegroundDensity"],"0082":["CS","1","OverlayBackgroundDensity"],"0090":["CS","1","OverlayMode"],"0100":["CS","1","ThresholdDensity"],"0500":["SQ","1","ReferencedImageBoxSequenceRetired"]},"2050":{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","PresentationLUTSequence"],"0020":["CS","1","PresentationLUTShape"],"0500":["SQ","1","ReferencedPresentationLUTSequence"]},"2100":{"0000":["UL","1","GenericGroupLength"],"0010":["SH","1","PrintJobID"],"0020":["CS","1","ExecutionStatus"],"0030":["CS","1","ExecutionStatusInfo"],"0040":["DA","1","CreationDate"],"0050":["TM","1","CreationTime"],"0070":["AE","1","Originator"],"0140":["AE","1","DestinationAE"],"0160":["SH","1","OwnerID"],"0170":["IS","1","NumberOfFilms"],"0500":["SQ","1","ReferencedPrintJobSequencePullStoredPrint"]},"2110":{"0000":["UL","1","GenericGroupLength"],"0010":["CS","1","PrinterStatus"],"0020":["CS","1","PrinterStatusInfo"],"0030":["LO","1","PrinterName"],"0099":["SH","1","PrintQueueID"]},"2120":{"0000":["UL","1","GenericGroupLength"],"0010":["CS","1","QueueStatus"],"0050":["SQ","1","PrintJobDescriptionSequence"],"0070":["SQ","1","ReferencedPrintJobSequence"]},"2130":{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","PrintManagementCapabilitiesSequence"],"0015":["SQ","1","PrinterCharacteristicsSequence"],"0030":["SQ","1","FilmBoxContentSequence"],"0040":["SQ","1","ImageBoxContentSequence"],"0050":["SQ","1","AnnotationContentSequence"],"0060":["SQ","1","ImageOverlayBoxContentSequence"],"0080":["SQ","1","PresentationLUTContentSequence"],"00A0":["SQ","1","ProposedStudySequence"],"00C0":["SQ","1","OriginalImageSequence"]},"2200":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","LabelUsingInformationExtractedFromInstances"],"0002":["UT","1","LabelText"],"0003":["CS","1","LabelStyleSelection"],"0004":["LT","1","MediaDisposition"],"0005":["LT","1","BarcodeValue"],"0006":["CS","1","BarcodeSymbology"],"0007":["CS","1","AllowMediaSplitting"],"0008":["CS","1","IncludeNonDICOMObjects"],"0009":["CS","1","IncludeDisplayApplication"],"000A":["CS","1","PreserveCompositeInstancesAfterMediaCreation"],"000B":["US","1","TotalNumberOfPiecesOfMediaCreated"],"000C":["LO","1","RequestedMediaApplicationProfile"],"000D":["SQ","1","ReferencedStorageMediaSequence"],"000E":["AT","1-n","FailureAttributes"],"000F":["CS","1","AllowLossyCompression"],"0020":["CS","1","RequestPriority"]},"3002":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","RTImageLabel"],"0003":["LO","1","RTImageName"],"0004":["ST","1","RTImageDescription"],"000A":["CS","1","ReportedValuesOrigin"],"000C":["CS","1","RTImagePlane"],"000D":["DS","3","XRayImageReceptorTranslation"],"000E":["DS","1","XRayImageReceptorAngle"],"0010":["DS","6","RTImageOrientation"],"0011":["DS","2","ImagePlanePixelSpacing"],"0012":["DS","2","RTImagePosition"],"0020":["SH","1","RadiationMachineName"],"0022":["DS","1","RadiationMachineSAD"],"0024":["DS","1","RadiationMachineSSD"],"0026":["DS","1","RTImageSID"],"0028":["DS","1","SourceToReferenceObjectDistance"],"0029":["IS","1","FractionNumber"],"0030":["SQ","1","ExposureSequence"],"0032":["DS","1","MetersetExposure"],"0034":["DS","4","DiaphragmPosition"],"0040":["SQ","1","FluenceMapSequence"],"0041":["CS","1","FluenceDataSource"],"0042":["DS","1","FluenceDataScale"],"0050":["SQ","1","PrimaryFluenceModeSequence"],"0051":["CS","1","FluenceMode"],"0052":["SH","1","FluenceModeID"]},"3004":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","DVHType"],"0002":["CS","1","DoseUnits"],"0004":["CS","1","DoseType"],"0005":["CS","1","SpatialTransformOfDose"],"0006":["LO","1","DoseComment"],"0008":["DS","3","NormalizationPoint"],"000A":["CS","1","DoseSummationType"],"000C":["DS","2-n","GridFrameOffsetVector"],"000E":["DS","1","DoseGridScaling"],"0010":["SQ","1","RTDoseROISequence"],"0012":["DS","1","DoseValue"],"0014":["CS","1-3","TissueHeterogeneityCorrection"],"0040":["DS","3","DVHNormalizationPoint"],"0042":["DS","1","DVHNormalizationDoseValue"],"0050":["SQ","1","DVHSequence"],"0052":["DS","1","DVHDoseScaling"],"0054":["CS","1","DVHVolumeUnits"],"0056":["IS","1","DVHNumberOfBins"],"0058":["DS","2-2n","DVHData"],"0060":["SQ","1","DVHReferencedROISequence"],"0062":["CS","1","DVHROIContributionType"],"0070":["DS","1","DVHMinimumDose"],"0072":["DS","1","DVHMaximumDose"],"0074":["DS","1","DVHMeanDose"]},"3006":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","StructureSetLabel"],"0004":["LO","1","StructureSetName"],"0006":["ST","1","StructureSetDescription"],"0008":["DA","1","StructureSetDate"],"0009":["TM","1","StructureSetTime"],"0010":["SQ","1","ReferencedFrameOfReferenceSequence"],"0012":["SQ","1","RTReferencedStudySequence"],"0014":["SQ","1","RTReferencedSeriesSequence"],"0016":["SQ","1","ContourImageSequence"],"0018":["SQ","1","PredecessorStructureSetSequence"],"0020":["SQ","1","StructureSetROISequence"],"0022":["IS","1","ROINumber"],"0024":["UI","1","ReferencedFrameOfReferenceUID"],"0026":["LO","1","ROIName"],"0028":["ST","1","ROIDescription"],"002A":["IS","3","ROIDisplayColor"],"002C":["DS","1","ROIVolume"],"0030":["SQ","1","RTRelatedROISequence"],"0033":["CS","1","RTROIRelationship"],"0036":["CS","1","ROIGenerationAlgorithm"],"0037":["SQ","1","ROIDerivationAlgorithmIdentificationSequence"],"0038":["LO","1","ROIGenerationDescription"],"0039":["SQ","1","ROIContourSequence"],"0040":["SQ","1","ContourSequence"],"0042":["CS","1","ContourGeometricType"],"0044":["DS","1","ContourSlabThickness"],"0045":["DS","3","ContourOffsetVector"],"0046":["IS","1","NumberOfContourPoints"],"0048":["IS","1","ContourNumber"],"0049":["IS","1-n","AttachedContours"],"004A":["SQ","1","SourcePixelPlanesCharacteristicsSequence"],"0050":["DS","3-3n","ContourData"],"0080":["SQ","1","RTROIObservationsSequence"],"0082":["IS","1","ObservationNumber"],"0084":["IS","1","ReferencedROINumber"],"0085":["SH","1","ROIObservationLabel"],"0086":["SQ","1","RTROIIdentificationCodeSequence"],"0088":["ST","1","ROIObservationDescription"],"00A0":["SQ","1","RelatedRTROIObservationsSequence"],"00A4":["CS","1","RTROIInterpretedType"],"00A6":["PN","1","ROIInterpreter"],"00B0":["SQ","1","ROIPhysicalPropertiesSequence"],"00B2":["CS","1","ROIPhysicalProperty"],"00B4":["DS","1","ROIPhysicalPropertyValue"],"00B6":["SQ","1","ROIElementalCompositionSequence"],"00B7":["US","1","ROIElementalCompositionAtomicNumber"],"00B8":["FL","1","ROIElementalCompositionAtomicMassFraction"],"00B9":["SQ","1","AdditionalRTROIIdentificationCodeSequence"],"00C0":["SQ","1","FrameOfReferenceRelationshipSequence"],"00C2":["UI","1","RelatedFrameOfReferenceUID"],"00C4":["CS","1","FrameOfReferenceTransformationType"],"00C6":["DS","16","FrameOfReferenceTransformationMatrix"],"00C8":["LO","1","FrameOfReferenceTransformationComment"],"00C9":["SQ","1","PatientLocationCoordinatesSequence"],"00CA":["SQ","1","PatientLocationCoordinatesCodeSequence"],"00CB":["SQ","1","PatientSupportPositionSequence"]},"3008":{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","MeasuredDoseReferenceSequence"],"0012":["ST","1","MeasuredDoseDescription"],"0014":["CS","1","MeasuredDoseType"],"0016":["DS","1","MeasuredDoseValue"],"0020":["SQ","1","TreatmentSessionBeamSequence"],"0021":["SQ","1","TreatmentSessionIonBeamSequence"],"0022":["IS","1","CurrentFractionNumber"],"0024":["DA","1","TreatmentControlPointDate"],"0025":["TM","1","TreatmentControlPointTime"],"002A":["CS","1","TreatmentTerminationStatus"],"002B":["SH","1","TreatmentTerminationCode"],"002C":["CS","1","TreatmentVerificationStatus"],"0030":["SQ","1","ReferencedTreatmentRecordSequence"],"0032":["DS","1","SpecifiedPrimaryMeterset"],"0033":["DS","1","SpecifiedSecondaryMeterset"],"0036":["DS","1","DeliveredPrimaryMeterset"],"0037":["DS","1","DeliveredSecondaryMeterset"],"003A":["DS","1","SpecifiedTreatmentTime"],"003B":["DS","1","DeliveredTreatmentTime"],"0040":["SQ","1","ControlPointDeliverySequence"],"0041":["SQ","1","IonControlPointDeliverySequence"],"0042":["DS","1","SpecifiedMeterset"],"0044":["DS","1","DeliveredMeterset"],"0045":["FL","1","MetersetRateSet"],"0046":["FL","1","MetersetRateDelivered"],"0047":["FL","1-n","ScanSpotMetersetsDelivered"],"0048":["DS","1","DoseRateDelivered"],"0050":["SQ","1","TreatmentSummaryCalculatedDoseReferenceSequence"],"0052":["DS","1","CumulativeDoseToDoseReference"],"0054":["DA","1","FirstTreatmentDate"],"0056":["DA","1","MostRecentTreatmentDate"],"005A":["IS","1","NumberOfFractionsDelivered"],"0060":["SQ","1","OverrideSequence"],"0061":["AT","1","ParameterSequencePointer"],"0062":["AT","1","OverrideParameterPointer"],"0063":["IS","1","ParameterItemIndex"],"0064":["IS","1","MeasuredDoseReferenceNumber"],"0065":["AT","1","ParameterPointer"],"0066":["ST","1","OverrideReason"],"0067":["US","1","ParameterValueNumber"],"0068":["SQ","1","CorrectedParameterSequence"],"006A":["FL","1","CorrectionValue"],"0070":["SQ","1","CalculatedDoseReferenceSequence"],"0072":["IS","1","CalculatedDoseReferenceNumber"],"0074":["ST","1","CalculatedDoseReferenceDescription"],"0076":["DS","1","CalculatedDoseReferenceDoseValue"],"0078":["DS","1","StartMeterset"],"007A":["DS","1","EndMeterset"],"0080":["SQ","1","ReferencedMeasuredDoseReferenceSequence"],"0082":["IS","1","ReferencedMeasuredDoseReferenceNumber"],"0090":["SQ","1","ReferencedCalculatedDoseReferenceSequence"],"0092":["IS","1","ReferencedCalculatedDoseReferenceNumber"],"00A0":["SQ","1","BeamLimitingDeviceLeafPairsSequence"],"00B0":["SQ","1","RecordedWedgeSequence"],"00C0":["SQ","1","RecordedCompensatorSequence"],"00D0":["SQ","1","RecordedBlockSequence"],"00D1":["SQ","1","RecordedBlockSlabSequence"],"00E0":["SQ","1","TreatmentSummaryMeasuredDoseReferenceSequence"],"00F0":["SQ","1","RecordedSnoutSequence"],"00F2":["SQ","1","RecordedRangeShifterSequence"],"00F4":["SQ","1","RecordedLateralSpreadingDeviceSequence"],"00F6":["SQ","1","RecordedRangeModulatorSequence"],"0100":["SQ","1","RecordedSourceSequence"],"0105":["LO","1","SourceSerialNumber"],"0110":["SQ","1","TreatmentSessionApplicationSetupSequence"],"0116":["CS","1","ApplicationSetupCheck"],"0120":["SQ","1","RecordedBrachyAccessoryDeviceSequence"],"0122":["IS","1","ReferencedBrachyAccessoryDeviceNumber"],"0130":["SQ","1","RecordedChannelSequence"],"0132":["DS","1","SpecifiedChannelTotalTime"],"0134":["DS","1","DeliveredChannelTotalTime"],"0136":["IS","1","SpecifiedNumberOfPulses"],"0138":["IS","1","DeliveredNumberOfPulses"],"013A":["DS","1","SpecifiedPulseRepetitionInterval"],"013C":["DS","1","DeliveredPulseRepetitionInterval"],"0140":["SQ","1","RecordedSourceApplicatorSequence"],"0142":["IS","1","ReferencedSourceApplicatorNumber"],"0150":["SQ","1","RecordedChannelShieldSequence"],"0152":["IS","1","ReferencedChannelShieldNumber"],"0160":["SQ","1","BrachyControlPointDeliveredSequence"],"0162":["DA","1","SafePositionExitDate"],"0164":["TM","1","SafePositionExitTime"],"0166":["DA","1","SafePositionReturnDate"],"0168":["TM","1","SafePositionReturnTime"],"0171":["SQ","1","PulseSpecificBrachyControlPointDeliveredSequence"],"0172":["US","1","PulseNumber"],"0173":["SQ","1","BrachyPulseControlPointDeliveredSequence"],"0200":["CS","1","CurrentTreatmentStatus"],"0202":["ST","1","TreatmentStatusComment"],"0220":["SQ","1","FractionGroupSummarySequence"],"0223":["IS","1","ReferencedFractionNumber"],"0224":["CS","1","FractionGroupType"],"0230":["CS","1","BeamStopperPosition"],"0240":["SQ","1","FractionStatusSummarySequence"],"0250":["DA","1","TreatmentDate"],"0251":["TM","1","TreatmentTime"]},"3010":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","RadiobiologicalDoseEffectSequence"],"0002":["CS","1","RadiobiologicalDoseEffectFlag"],"0003":["SQ","1","EffectiveDoseCalculationMethodCategoryCodeSequence"],"0004":["SQ","1","EffectiveDoseCalculationMethodCodeSequence"],"0005":["LO","1","EffectiveDoseCalculationMethodDescription"],"0006":["UI","1","ConceptualVolumeUID"],"0007":["SQ","1","OriginatingSOPInstanceReferenceSequence"],"0008":["SQ","1","ConceptualVolumeConstituentSequence"],"0009":["SQ","1","EquivalentConceptualVolumeInstanceReferenceSequence"],"000A":["SQ","1","EquivalentConceptualVolumesSequence"],"000B":["UI","1","ReferencedConceptualVolumeUID"],"000C":["UT","1","ConceptualVolumeCombinationExpression"],"000D":["US","1","ConceptualVolumeConstituentIndex"],"000E":["CS","1","ConceptualVolumeCombinationFlag"],"000F":["ST","1","ConceptualVolumeCombinationDescription"],"0010":["CS","1","ConceptualVolumeSegmentationDefinedFlag"],"0011":["SQ","1","ConceptualVolumeSegmentationReferenceSequence"],"0012":["SQ","1","ConceptualVolumeConstituentSegmentationReferenceSequence"],"0013":["UI","1","ConstituentConceptualVolumeUID"],"0014":["SQ","1","DerivationConceptualVolumeSequence"],"0015":["UI","1","SourceConceptualVolumeUID"],"0016":["SQ","1","ConceptualVolumeDerivationAlgorithmSequence"],"0017":["ST","1","ConceptualVolumeDescription"],"0018":["SQ","1","SourceConceptualVolumeSequence"],"0019":["SQ","1","AuthorIdentificationSequence"],"001A":["LO","1","ManufacturerModelVersion"],"001B":["UC","1","DeviceAlternateIdentifier"],"001C":["CS","1","DeviceAlternateIdentifierType"],"001D":["LT","1","DeviceAlternateIdentifierFormat"],"001E":["LO","1","SegmentationCreationTemplateLabel"],"001F":["UI","1","SegmentationTemplateUID"],"0020":["US","1","ReferencedSegmentReferenceIndex"],"0021":["SQ","1","SegmentReferenceSequence"],"0022":["US","1","SegmentReferenceIndex"],"0023":["SQ","1","DirectSegmentReferenceSequence"],"0024":["SQ","1","CombinationSegmentReferenceSequence"],"0025":["SQ","1","ConceptualVolumeSequence"],"0026":["SQ","1","SegmentedRTAccessoryDeviceSequence"],"0027":["SQ","1","SegmentCharacteristicsSequence"],"0028":["SQ","1","RelatedSegmentCharacteristicsSequence"],"0029":["US","1","SegmentCharacteristicsPrecedence"],"002A":["SQ","1","RTSegmentAnnotationSequence"],"002B":["SQ","1","SegmentAnnotationCategoryCodeSequence"],"002C":["SQ","1","SegmentAnnotationTypeCodeSequence"],"002D":["LO","1","DeviceLabel"],"002E":["SQ","1","DeviceTypeCodeSequence"],"002F":["SQ","1","SegmentAnnotationTypeModifierCodeSequence"],"0030":["SQ","1","PatientEquipmentRelationshipCodeSequence"],"0031":["UI","1","ReferencedFiducialsUID"],"0032":["SQ","1","PatientTreatmentOrientationSequence"],"0033":["SH","1","UserContentLabel"],"0034":["LO","1","UserContentLongLabel"],"0035":["SH","1","EntityLabel"],"0036":["LO","1","EntityName"],"0037":["ST","1","EntityDescription"],"0038":["LO","1","EntityLongLabel"],"0039":["US","1","DeviceIndex"],"003A":["US","1","RTTreatmentPhaseIndex"],"003B":["UI","1","RTTreatmentPhaseUID"],"003C":["US","1","RTPrescriptionIndex"],"003D":["US","1","RTSegmentAnnotationIndex"],"003E":["US","1","BasisRTTreatmentPhaseIndex"],"003F":["US","1","RelatedRTTreatmentPhaseIndex"],"0040":["US","1","ReferencedRTTreatmentPhaseIndex"],"0041":["US","1","ReferencedRTPrescriptionIndex"],"0042":["US","1","ReferencedParentRTPrescriptionIndex"],"0043":["ST","1","ManufacturerDeviceIdentifier"],"0044":["SQ","1","InstanceLevelReferencedPerformedProcedureStepSequence"],"0045":["CS","1","RTTreatmentPhaseIntentPresenceFlag"],"0046":["CS","1","RadiotherapyTreatmentType"],"0047":["CS","1-n","TeletherapyRadiationType"],"0048":["CS","1-n","BrachytherapySourceType"],"0049":["SQ","1","ReferencedRTTreatmentPhaseSequence"],"004A":["SQ","1","ReferencedDirectSegmentInstanceSequence"],"004B":["SQ","1","IntendedRTTreatmentPhaseSequence"],"004C":["DA","1","IntendedPhaseStartDate"],"004D":["DA","1","IntendedPhaseEndDate"],"004E":["SQ","1","RTTreatmentPhaseIntervalSequence"],"004F":["CS","1","TemporalRelationshipIntervalAnchor"],"0050":["FD","1","MinimumNumberOfIntervalDays"],"0051":["FD","1","MaximumNumberOfIntervalDays"],"0052":["UI","1-n","PertinentSOPClassesInStudy"],"0053":["UI","1-n","PertinentSOPClassesInSeries"],"0054":["LO","1","RTPrescriptionLabel"],"0055":["SQ","1","RTPhysicianIntentPredecessorSequence"],"0056":["LO","1","RTTreatmentApproachLabel"],"0057":["SQ","1","RTPhysicianIntentSequence"],"0058":["US","1","RTPhysicianIntentIndex"],"0059":["CS","1","RTTreatmentIntentType"],"005A":["UT","1","RTPhysicianIntentNarrative"],"005B":["SQ","1","RTProtocolCodeSequence"],"005C":["ST","1","ReasonForSuperseding"],"005D":["SQ","1","RTDiagnosisCodeSequence"],"005E":["US","1","ReferencedRTPhysicianIntentIndex"],"005F":["SQ","1","RTPhysicianIntentInputInstanceSequence"],"0060":["SQ","1","RTAnatomicPrescriptionSequence"],"0061":["UT","1","PriorTreatmentDoseDescription"],"0062":["SQ","1","PriorTreatmentReferenceSequence"],"0063":["CS","1","DosimetricObjectiveEvaluationScope"],"0064":["SQ","1","TherapeuticRoleCategoryCodeSequence"],"0065":["SQ","1","TherapeuticRoleTypeCodeSequence"],"0066":["US","1","ConceptualVolumeOptimizationPrecedence"],"0067":["SQ","1","ConceptualVolumeCategoryCodeSequence"],"0068":["CS","1","ConceptualVolumeBlockingConstraint"],"0069":["SQ","1","ConceptualVolumeTypeCodeSequence"],"006A":["SQ","1","ConceptualVolumeTypeModifierCodeSequence"],"006B":["SQ","1","RTPrescriptionSequence"],"006C":["SQ","1","DosimetricObjectiveSequence"],"006D":["SQ","1","DosimetricObjectiveTypeCodeSequence"],"006E":["UI","1","DosimetricObjectiveUID"],"006F":["UI","1","ReferencedDosimetricObjectiveUID"],"0070":["SQ","1","DosimetricObjectiveParameterSequence"],"0071":["SQ","1","ReferencedDosimetricObjectivesSequence"],"0073":["CS","1","AbsoluteDosimetricObjectiveFlag"],"0074":["FD","1","DosimetricObjectiveWeight"],"0075":["CS","1","DosimetricObjectivePurpose"],"0076":["SQ","1","PlanningInputInformationSequence"],"0077":["LO","1","TreatmentSite"],"0078":["SQ","1","TreatmentSiteCodeSequence"],"0079":["SQ","1","FractionPatternSequence"],"007A":["UT","1","TreatmentTechniqueNotes"],"007B":["UT","1","PrescriptionNotes"],"007C":["IS","1","NumberOfIntervalFractions"],"007D":["US","1","NumberOfFractions"],"007E":["US","1","IntendedDeliveryDuration"],"007F":["UT","1","FractionationNotes"],"0080":["SQ","1","RTTreatmentTechniqueCodeSequence"],"0081":["SQ","1","PrescriptionNotesSequence"],"0082":["SQ","1","FractionBasedRelationshipSequence"],"0083":["CS","1","FractionBasedRelationshipIntervalAnchor"],"0084":["FD","1","MinimumHoursBetweenFractions"],"0085":["TM","1-n","IntendedFractionStartTime"],"0086":["LT","1","IntendedStartDayOfWeek"],"0087":["SQ","1","WeekdayFractionPatternSequence"],"0088":["SQ","1","DeliveryTimeStructureCodeSequence"],"0089":["SQ","1","TreatmentSiteModifierCodeSequence"],"0090":["CS","1","RoboticBaseLocationIndicator"],"0091":["SQ","1","RoboticPathNodeSetCodeSequence"],"0092":["UL","1","RoboticNodeIdentifier"],"0093":["FD","3","RTTreatmentSourceCoordinates"],"0094":["FD","1","RadiationSourceCoordinateSystemYawAngle"],"0095":["FD","1","RadiationSourceCoordinateSystemRollAngle"],"0096":["FD","1","RadiationSourceCoordinateSystemPitchAngle"],"0097":["SQ","1","RoboticPathControlPointSequence"],"0098":["SQ","1","TomotherapeuticControlPointSequence"],"0099":["FD","1-n","TomotherapeuticLeafOpenDurations"],"009A":["FD","1-n","TomotherapeuticLeafInitialClosedDurations"]},"4000":{"4000":["LT","1","TextComments"],"0000":["UL","1","GenericGroupLength"],"0010":["LT","1","Arbitrary"]},"4008":{"4000":["ST","1","ResultsComments"],"0000":["UL","1","GenericGroupLength"],"0040":["SH","1","ResultsID"],"0042":["LO","1","ResultsIDIssuer"],"0050":["SQ","1","ReferencedInterpretationSequence"],"00FF":["CS","1","ReportProductionStatusTrial"],"0100":["DA","1","InterpretationRecordedDate"],"0101":["TM","1","InterpretationRecordedTime"],"0102":["PN","1","InterpretationRecorder"],"0103":["LO","1","ReferenceToRecordedSound"],"0108":["DA","1","InterpretationTranscriptionDate"],"0109":["TM","1","InterpretationTranscriptionTime"],"010A":["PN","1","InterpretationTranscriber"],"010B":["ST","1","InterpretationText"],"010C":["PN","1","InterpretationAuthor"],"0111":["SQ","1","InterpretationApproverSequence"],"0112":["DA","1","InterpretationApprovalDate"],"0113":["TM","1","InterpretationApprovalTime"],"0114":["PN","1","PhysicianApprovingInterpretation"],"0115":["LT","1","InterpretationDiagnosisDescription"],"0117":["SQ","1","InterpretationDiagnosisCodeSequence"],"0118":["SQ","1","ResultsDistributionListSequence"],"0119":["PN","1","DistributionName"],"011A":["LO","1","DistributionAddress"],"0200":["SH","1","InterpretationID"],"0202":["LO","1","InterpretationIDIssuer"],"0210":["CS","1","InterpretationTypeID"],"0212":["CS","1","InterpretationStatusID"],"0300":["ST","1","Impressions"]},"4010":{"1001":["SQ","1","ThreatROIVoxelSequence"],"1004":["FL","3","ThreatROIBase"],"1005":["FL","3","ThreatROIExtents"],"1006":["OB","1","ThreatROIBitmap"],"1007":["SH","1","RouteSegmentID"],"1008":["CS","1","GantryType"],"1009":["CS","1","OOIOwnerType"],"1010":["US","1","PotentialThreatObjectID"],"1011":["SQ","1","ThreatSequence"],"1012":["CS","1","ThreatCategory"],"1013":["LT","1","ThreatCategoryDescription"],"1014":["CS","1","ATDAbilityAssessment"],"1015":["CS","1","ATDAssessmentFlag"],"1016":["FL","1","ATDAssessmentProbability"],"1017":["FL","1","Mass"],"1018":["FL","1","Density"],"1019":["FL","1","ZEffective"],"1020":["CS","1","RouteSegmentLocationIDType"],"1021":["CS","1-n","AbortReason"],"1023":["FL","1","VolumeOfPTO"],"1024":["CS","1","AbortFlag"],"1025":["DT","1","RouteSegmentStartTime"],"1026":["DT","1","RouteSegmentEndTime"],"1027":["CS","1","TDRType"],"1028":["CS","1","InternationalRouteSegment"],"1029":["LO","1-n","ThreatDetectionAlgorithmAndVersion"],"1031":["CS","1","AlarmDecision"],"1033":["US","1","NumberOfTotalObjects"],"1034":["US","1","NumberOfAlarmObjects"],"1037":["SQ","1","PTORepresentationSequence"],"1038":["SQ","1","ATDAssessmentSequence"],"1039":["CS","1","TIPType"],"1041":["DT","1","OOIOwnerCreationTime"],"1042":["CS","1","OOIType"],"1043":["FL","3","OOISize"],"1044":["CS","1","AcquisitionStatus"],"1045":["SQ","1","BasisMaterialsCodeSequence"],"1046":["CS","1","PhantomType"],"1047":["SQ","1","OOIOwnerSequence"],"1048":["CS","1","ScanType"],"1051":["LO","1","ItineraryID"],"1052":["SH","1","ItineraryIDType"],"1053":["LO","1","ItineraryIDAssigningAuthority"],"1054":["SH","1","RouteID"],"1055":["SH","1","RouteIDAssigningAuthority"],"1056":["CS","1","InboundArrivalType"],"1058":["SH","1","CarrierID"],"1059":["CS","1","CarrierIDAssigningAuthority"],"1060":["FL","3","SourceOrientation"],"1061":["FL","3","SourcePosition"],"1062":["FL","1","BeltHeight"],"1064":["SQ","1","AlgorithmRoutingCodeSequence"],"1067":["CS","1","TransportClassification"],"1068":["LT","1","OOITypeDescriptor"],"1069":["FL","1","TotalProcessingTime"],"1070":["CS","1","AITDeviceType"],"1071":["SQ","1","QRMeasurementsSequence"],"1072":["SQ","1","TargetMaterialSequence"],"1073":["FD","1","SNRThreshold"],"1075":["DS","1","ImageScaleRepresentation"],"1076":["SQ","1","ReferencedPTOSequence"],"1077":["SQ","1","ReferencedTDRInstanceSequence"],"1078":["ST","1","PTOLocationDescription"],"1079":["SQ","1","AnomalyLocatorIndicatorSequence"],"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","LowEnergyDetectors"],"0002":["CS","1","HighEnergyDetectors"],"0004":["SQ","1","DetectorGeometrySequence"],"100A":["SQ","1","RouteSegmentSequence"],"101A":["SH","1","BoardingPassID"],"101B":["FL","3","CenterOfMass"],"101C":["FL","3","CenterOfPTO"],"101D":["FL","6-n","BoundingPolygon"],"101E":["SH","1","RouteSegmentStartLocationID"],"101F":["SH","1","RouteSegmentEndLocationID"],"102A":["SH","1","AssignedLocation"],"102B":["DT","1","AlarmDecisionTime"],"103A":["CS","1","DICOSVersion"],"106C":["OB","1","DetectorCalibrationData"],"106D":["CS","1","AdditionalScreeningPerformed"],"106E":["CS","1","AdditionalInspectionSelectionCriteria"],"106F":["SQ","1","AdditionalInspectionMethodSequence"],"107A":["FL","3","AnomalyLocatorIndicator"],"107B":["SQ","1","PTORegionSequence"],"107C":["CS","1","InspectionSelectionCriteria"],"107D":["SQ","1","SecondaryInspectionMethodSequence"],"107E":["DS","6","PRCSToRCSOrientation"]},"5000":{"1001":["CS","1","CurveActivationLayer"],"2000":["US","1","AudioType"],"2002":["US","1","AudioSampleFormat"],"2004":["US","1","NumberOfChannels"],"2006":["UL","1","NumberOfSamples"],"2008":["UL","1","SampleRate"],"2500":["LO","1","CurveLabel"],"2600":["SQ","1","CurveReferencedOverlaySequence"],"2610":["US","1","CurveReferencedOverlayGroup"],"3000":["ox","1","CurveData"],"0000":["UL","1","GenericGroupLength"],"0005":["US","1","CurveDimensions"],"0010":["US","1","NumberOfPoints"],"0020":["CS","1","TypeOfData"],"0022":["LO","1","CurveDescription"],"0030":["SH","1-n","AxisUnits"],"0040":["SH","1-n","AxisLabels"],"0103":["US","1","DataValueRepresentation"],"0104":["US","1-n","MinimumCoordinateValue"],"0105":["US","1-n","MaximumCoordinateValue"],"0106":["SH","1-n","CurveRange"],"0110":["US","1-n","CurveDataDescriptor"],"0112":["US","1-n","CoordinateStartValue"],"0114":["US","1-n","CoordinateStepValue"],"200A":["UL","1","TotalTime"],"200C":["ox","1","AudioSampleData"],"200E":["LT","1","AudioComments"]},"5200":{"9229":["SQ","1","SharedFunctionalGroupsSequence"],"9230":["SQ","1","PerFrameFunctionalGroupsSequence"],"0000":["UL","1","GenericGroupLength"]},"5400":{"1004":["US","1","WaveformBitsAllocated"],"1006":["CS","1","WaveformSampleInterpretation"],"1010":["ox","1","WaveformData"],"0000":["UL","1","GenericGroupLength"],"0100":["SQ","1","WaveformSequence"],"0110":["ox","1","ChannelMinimumValue"],"0112":["ox","1","ChannelMaximumValue"],"100A":["ox","1","WaveformPaddingValue"]},"5600":{"0000":["UL","1","GenericGroupLength"],"0010":["OF","1","FirstOrderPhaseCorrectionAngle"],"0020":["OF","1","SpectroscopyData"]},"6000":{"1001":["CS","1","OverlayActivationLayer"],"1100":["US","1","OverlayDescriptorGray"],"1101":["US","1","OverlayDescriptorRed"],"1102":["US","1","OverlayDescriptorGreen"],"1103":["US","1","OverlayDescriptorBlue"],"1200":["US","1-n","OverlaysGray"],"1201":["US","1-n","OverlaysRed"],"1202":["US","1-n","OverlaysGreen"],"1203":["US","1-n","OverlaysBlue"],"1301":["IS","1","ROIArea"],"1302":["DS","1","ROIMean"],"1303":["DS","1","ROIStandardDeviation"],"1500":["LO","1","OverlayLabel"],"3000":["ox","1","OverlayData"],"4000":["LT","1","OverlayComments"],"0000":["UL","1","GenericGroupLength"],"0010":["US","1","OverlayRows"],"0011":["US","1","OverlayColumns"],"0012":["US","1","OverlayPlanes"],"0015":["IS","1","NumberOfFramesInOverlay"],"0022":["LO","1","OverlayDescription"],"0040":["CS","1","OverlayType"],"0045":["LO","1","OverlaySubtype"],"0050":["SS","2","OverlayOrigin"],"0051":["US","1","ImageFrameOrigin"],"0052":["US","1","OverlayPlaneOrigin"],"0060":["CS","1","OverlayCompressionCode"],"0061":["SH","1","OverlayCompressionOriginator"],"0062":["SH","1","OverlayCompressionLabel"],"0063":["CS","1","OverlayCompressionDescription"],"0066":["AT","1-n","OverlayCompressionStepPointers"],"0068":["US","1","OverlayRepeatInterval"],"0069":["US","1","OverlayBitsGrouped"],"0100":["US","1","OverlayBitsAllocated"],"0102":["US","1","OverlayBitPosition"],"0110":["CS","1","OverlayFormat"],"0200":["US","1","OverlayLocation"],"0800":["CS","1-n","OverlayCodeLabel"],"0802":["US","1","OverlayNumberOfTables"],"0803":["AT","1-n","OverlayCodeTableLocation"],"0804":["US","1","OverlayBitsForCodeWord"]},"0000":{"1000":["UI","1","AffectedSOPInstanceUID"],"1001":["UI","1","RequestedSOPInstanceUID"],"1002":["US","1","EventTypeID"],"1005":["AT","1-n","AttributeIdentifierList"],"1008":["US","1","ActionTypeID"],"1020":["US","1","NumberOfRemainingSuboperations"],"1021":["US","1","NumberOfCompletedSuboperations"],"1022":["US","1","NumberOfFailedSuboperations"],"1023":["US","1","NumberOfWarningSuboperations"],"1030":["AE","1","MoveOriginatorApplicationEntityTitle"],"1031":["US","1","MoveOriginatorMessageID"],"4000":["LT","1","DialogReceiver"],"4010":["LT","1","TerminalType"],"5010":["SH","1","MessageSetID"],"5020":["SH","1","EndMessageID"],"5110":["LT","1","DisplayFormat"],"5120":["LT","1","PagePositionID"],"5130":["CS","1","TextFormatID"],"5140":["CS","1","NormalReverse"],"5150":["CS","1","AddGrayScale"],"5160":["CS","1","Borders"],"5170":["IS","1","Copies"],"5180":["CS","1","CommandMagnificationType"],"5190":["CS","1","Erase"],"0000":["UL","1","CommandGroupLength"],"0001":["UL","1","CommandLengthToEnd"],"0002":["UI","1","AffectedSOPClassUID"],"0003":["UI","1","RequestedSOPClassUID"],"0010":["SH","1","CommandRecognitionCode"],"0100":["US","1","CommandField"],"0110":["US","1","MessageID"],"0120":["US","1","MessageIDBeingRespondedTo"],"0200":["AE","1","Initiator"],"0300":["AE","1","Receiver"],"0400":["AE","1","FindLocation"],"0600":["AE","1","MoveDestination"],"0700":["US","1","Priority"],"0800":["US","1","CommandDataSetType"],"0850":["US","1","NumberOfMatches"],"0860":["US","1","ResponseSequenceNumber"],"0900":["US","1","Status"],"0901":["AT","1-n","OffendingElement"],"0902":["LO","1","ErrorComment"],"0903":["US","1","ErrorID"],"51A0":["CS","1","Print"],"51B0":["US","1-n","Overlays"]},"0002":{"0000":["UL","1","FileMetaInformationGroupLength"],"0001":["OB","1","FileMetaInformationVersion"],"0002":["UI","1","MediaStorageSOPClassUID"],"0003":["UI","1","MediaStorageSOPInstanceUID"],"0010":["UI","1","TransferSyntaxUID"],"0012":["UI","1","ImplementationClassUID"],"0013":["SH","1","ImplementationVersionName"],"0016":["AE","1","SourceApplicationEntityTitle"],"0017":["AE","1","SendingApplicationEntityTitle"],"0018":["AE","1","ReceivingApplicationEntityTitle"],"0026":["UR","1","SourcePresentationAddress"],"0027":["UR","1","SendingPresentationAddress"],"0028":["UR","1","ReceivingPresentationAddress"],"0031":["OB","1","RTVMetaInformationVersion"],"0032":["UI","1","RTVCommunicationSOPClassUID"],"0033":["UI","1","RTVCommunicationSOPInstanceUID"],"0035":["OB","1","RTVSourceIdentifier"],"0036":["OB","1","RTVFlowIdentifier"],"0037":["UL","1","RTVFlowRTPSamplingRate"],"0038":["FD","1","RTVFlowActualFrameDuration"],"0100":["UI","1","PrivateInformationCreatorUID"],"0102":["OB","1","PrivateInformation"]},"0004":{"1130":["CS","1","FileSetID"],"1141":["CS","1-8","FileSetDescriptorFileID"],"1142":["CS","1","SpecificCharacterSetOfFileSetDescriptorFile"],"1200":["UL","1","OffsetOfTheFirstDirectoryRecordOfTheRootDirectoryEntity"],"1202":["UL","1","OffsetOfTheLastDirectoryRecordOfTheRootDirectoryEntity"],"1212":["US","1","FileSetConsistencyFlag"],"1220":["SQ","1","DirectoryRecordSequence"],"1400":["UL","1","OffsetOfTheNextDirectoryRecord"],"1410":["US","1","RecordInUseFlag"],"1420":["UL","1","OffsetOfReferencedLowerLevelDirectoryEntity"],"1430":["CS","1","DirectoryRecordType"],"1432":["UI","1","PrivateRecordUID"],"1500":["CS","1-8","ReferencedFileID"],"1504":["UL","1","MRDRDirectoryRecordOffset"],"1510":["UI","1","ReferencedSOPClassUIDInFile"],"1511":["UI","1","ReferencedSOPInstanceUIDInFile"],"1512":["UI","1","ReferencedTransferSyntaxUIDInFile"],"1600":["UL","1","NumberOfReferences"],"0000":["UL","1","GenericGroupLength"],"151A":["UI","1-n","ReferencedRelatedGeneralSOPClassUIDInFile"]},"0008":{"1000":["AE","1","NetworkID"],"1010":["SH","1","StationName"],"1030":["LO","1","StudyDescription"],"1032":["SQ","1","ProcedureCodeSequence"],"1040":["LO","1","InstitutionalDepartmentName"],"1041":["SQ","1","InstitutionalDepartmentTypeCodeSequence"],"1048":["PN","1-n","PhysiciansOfRecord"],"1049":["SQ","1","PhysiciansOfRecordIdentificationSequence"],"1050":["PN","1-n","PerformingPhysicianName"],"1052":["SQ","1","PerformingPhysicianIdentificationSequence"],"1060":["PN","1-n","NameOfPhysiciansReadingStudy"],"1062":["SQ","1","PhysiciansReadingStudyIdentificationSequence"],"1070":["PN","1-n","OperatorsName"],"1072":["SQ","1","OperatorIdentificationSequence"],"1080":["LO","1-n","AdmittingDiagnosesDescription"],"1084":["SQ","1","AdmittingDiagnosesCodeSequence"],"1090":["LO","1","ManufacturerModelName"],"1100":["SQ","1","ReferencedResultsSequence"],"1110":["SQ","1","ReferencedStudySequence"],"1111":["SQ","1","ReferencedPerformedProcedureStepSequence"],"1115":["SQ","1","ReferencedSeriesSequence"],"1120":["SQ","1","ReferencedPatientSequence"],"1125":["SQ","1","ReferencedVisitSequence"],"1130":["SQ","1","ReferencedOverlaySequence"],"1134":["SQ","1","ReferencedStereometricInstanceSequence"],"1140":["SQ","1","ReferencedImageSequence"],"1145":["SQ","1","ReferencedCurveSequence"],"1150":["UI","1","ReferencedSOPClassUID"],"1155":["UI","1","ReferencedSOPInstanceUID"],"1156":["SQ","1","DefinitionSourceSequence"],"1160":["IS","1-n","ReferencedFrameNumber"],"1161":["UL","1-n","SimpleFrameList"],"1162":["UL","3-3n","CalculatedFrameList"],"1163":["FD","2","TimeRange"],"1164":["SQ","1","FrameExtractionSequence"],"1167":["UI","1","MultiFrameSourceSOPInstanceUID"],"1190":["UR","1","RetrieveURL"],"1195":["UI","1","TransactionUID"],"1196":["US","1","WarningReason"],"1197":["US","1","FailureReason"],"1198":["SQ","1","FailedSOPSequence"],"1199":["SQ","1","ReferencedSOPSequence"],"1200":["SQ","1","StudiesContainingOtherReferencedInstancesSequence"],"1250":["SQ","1","RelatedSeriesSequence"],"2110":["CS","1","LossyImageCompressionRetired"],"2111":["ST","1","DerivationDescription"],"2112":["SQ","1","SourceImageSequence"],"2120":["SH","1","StageName"],"2122":["IS","1","StageNumber"],"2124":["IS","1","NumberOfStages"],"2127":["SH","1","ViewName"],"2128":["IS","1","ViewNumber"],"2129":["IS","1","NumberOfEventTimers"],"2130":["DS","1-n","EventElapsedTimes"],"2132":["LO","1-n","EventTimerNames"],"2133":["SQ","1","EventTimerSequence"],"2134":["FD","1","EventTimeOffset"],"2135":["SQ","1","EventCodeSequence"],"2142":["IS","1","StartTrim"],"2143":["IS","1","StopTrim"],"2144":["IS","1","RecommendedDisplayFrameRate"],"2200":["CS","1","TransducerPosition"],"2204":["CS","1","TransducerOrientation"],"2208":["CS","1","AnatomicStructure"],"2218":["SQ","1","AnatomicRegionSequence"],"2220":["SQ","1","AnatomicRegionModifierSequence"],"2228":["SQ","1","PrimaryAnatomicStructureSequence"],"2229":["SQ","1","AnatomicStructureSpaceOrRegionSequence"],"2230":["SQ","1","PrimaryAnatomicStructureModifierSequence"],"2240":["SQ","1","TransducerPositionSequence"],"2242":["SQ","1","TransducerPositionModifierSequence"],"2244":["SQ","1","TransducerOrientationSequence"],"2246":["SQ","1","TransducerOrientationModifierSequence"],"2251":["SQ","1","AnatomicStructureSpaceOrRegionCodeSequenceTrial"],"2253":["SQ","1","AnatomicPortalOfEntranceCodeSequenceTrial"],"2255":["SQ","1","AnatomicApproachDirectionCodeSequenceTrial"],"2256":["ST","1","AnatomicPerspectiveDescriptionTrial"],"2257":["SQ","1","AnatomicPerspectiveCodeSequenceTrial"],"2258":["ST","1","AnatomicLocationOfExaminingInstrumentDescriptionTrial"],"2259":["SQ","1","AnatomicLocationOfExaminingInstrumentCodeSequenceTrial"],"3001":["SQ","1","AlternateRepresentationSequence"],"3002":["UI","1-n","AvailableTransferSyntaxUID"],"3010":["UI","1-n","IrradiationEventUID"],"3011":["SQ","1","SourceIrradiationEventSequence"],"3012":["UI","1","RadiopharmaceuticalAdministrationEventUID"],"4000":["LT","1","IdentifyingComments"],"9007":["CS","4","FrameType"],"9092":["SQ","1","ReferencedImageEvidenceSequence"],"9121":["SQ","1","ReferencedRawDataSequence"],"9123":["UI","1","CreatorVersionUID"],"9124":["SQ","1","DerivationImageSequence"],"9154":["SQ","1","SourceImageEvidenceSequence"],"9205":["CS","1","PixelPresentation"],"9206":["CS","1","VolumetricProperties"],"9207":["CS","1","VolumeBasedCalculationTechnique"],"9208":["CS","1","ComplexImageComponent"],"9209":["CS","1","AcquisitionContrast"],"9215":["SQ","1","DerivationCodeSequence"],"9237":["SQ","1","ReferencedPresentationStateSequence"],"9410":["SQ","1","ReferencedOtherPlaneSequence"],"9458":["SQ","1","FrameDisplaySequence"],"9459":["FL","1","RecommendedDisplayFrameRateInFloat"],"9460":["CS","1","SkipFrameRangeFlag"],"0000":["UL","1","GenericGroupLength"],"0001":["UL","1","LengthToEnd"],"0005":["CS","1-n","SpecificCharacterSet"],"0006":["SQ","1","LanguageCodeSequence"],"0008":["CS","2-n","ImageType"],"0010":["SH","1","RecognitionCode"],"0012":["DA","1","InstanceCreationDate"],"0013":["TM","1","InstanceCreationTime"],"0014":["UI","1","InstanceCreatorUID"],"0015":["DT","1","InstanceCoercionDateTime"],"0016":["UI","1","SOPClassUID"],"0018":["UI","1","SOPInstanceUID"],"001A":["UI","1-n","RelatedGeneralSOPClassUID"],"001B":["UI","1","OriginalSpecializedSOPClassUID"],"0020":["DA","1","StudyDate"],"0021":["DA","1","SeriesDate"],"0022":["DA","1","AcquisitionDate"],"0023":["DA","1","ContentDate"],"0024":["DA","1","OverlayDate"],"0025":["DA","1","CurveDate"],"002A":["DT","1","AcquisitionDateTime"],"0030":["TM","1","StudyTime"],"0031":["TM","1","SeriesTime"],"0032":["TM","1","AcquisitionTime"],"0033":["TM","1","ContentTime"],"0034":["TM","1","OverlayTime"],"0035":["TM","1","CurveTime"],"0040":["US","1","DataSetType"],"0041":["LO","1","DataSetSubtype"],"0042":["CS","1","NuclearMedicineSeriesType"],"0050":["SH","1","AccessionNumber"],"0051":["SQ","1","IssuerOfAccessionNumberSequence"],"0052":["CS","1","QueryRetrieveLevel"],"0053":["CS","1","QueryRetrieveView"],"0054":["AE","1-n","RetrieveAETitle"],"0055":["AE","1","StationAETitle"],"0056":["CS","1","InstanceAvailability"],"0058":["UI","1-n","FailedSOPInstanceUIDList"],"0060":["CS","1","Modality"],"0061":["CS","1-n","ModalitiesInStudy"],"0062":["UI","1-n","SOPClassesInStudy"],"0063":["SQ","1","AnatomicRegionsInStudyCodeSequence"],"0064":["CS","1","ConversionType"],"0068":["CS","1","PresentationIntentType"],"0070":["LO","1","Manufacturer"],"0080":["LO","1","InstitutionName"],"0081":["ST","1","InstitutionAddress"],"0082":["SQ","1","InstitutionCodeSequence"],"0090":["PN","1","ReferringPhysicianName"],"0092":["ST","1","ReferringPhysicianAddress"],"0094":["SH","1-n","ReferringPhysicianTelephoneNumbers"],"0096":["SQ","1","ReferringPhysicianIdentificationSequence"],"009C":["PN","1-n","ConsultingPhysicianName"],"009D":["SQ","1","ConsultingPhysicianIdentificationSequence"],"0100":["SH","1","CodeValue"],"0101":["LO","1","ExtendedCodeValue"],"0102":["SH","1","CodingSchemeDesignator"],"0103":["SH","1","CodingSchemeVersion"],"0104":["LO","1","CodeMeaning"],"0105":["CS","1","MappingResource"],"0106":["DT","1","ContextGroupVersion"],"0107":["DT","1","ContextGroupLocalVersion"],"0108":["LT","1","ExtendedCodeMeaning"],"0109":["SQ","1","CodingSchemeResourcesSequence"],"010A":["CS","1","CodingSchemeURLType"],"010B":["CS","1","ContextGroupExtensionFlag"],"010C":["UI","1","CodingSchemeUID"],"010D":["UI","1","ContextGroupExtensionCreatorUID"],"010E":["UR","1","CodingSchemeURL"],"010F":["CS","1","ContextIdentifier"],"0110":["SQ","1","CodingSchemeIdentificationSequence"],"0112":["LO","1","CodingSchemeRegistry"],"0114":["ST","1","CodingSchemeExternalID"],"0115":["ST","1","CodingSchemeName"],"0116":["ST","1","CodingSchemeResponsibleOrganization"],"0117":["UI","1","ContextUID"],"0118":["UI","1","MappingResourceUID"],"0119":["UC","1","LongCodeValue"],"0120":["UR","1","URNCodeValue"],"0121":["SQ","1","EquivalentCodeSequence"],"0122":["LO","1","MappingResourceName"],"0123":["SQ","1","ContextGroupIdentificationSequence"],"0124":["SQ","1","MappingResourceIdentificationSequence"],"0201":["SH","1","TimezoneOffsetFromUTC"],"0202":["","",""],"0220":["SQ","1","ResponsibleGroupCodeSequence"],"0221":["CS","1","EquipmentModality"],"0222":["LO","1","ManufacturerRelatedModelGroup"],"0300":["SQ","1","PrivateDataElementCharacteristicsSequence"],"0301":["US","1","PrivateGroupReference"],"0302":["LO","1","PrivateCreatorReference"],"0303":["CS","1","BlockIdentifyingInformationStatus"],"0304":["US","1-n","NonidentifyingPrivateElements"],"0305":["SQ","1","DeidentificationActionSequence"],"0306":["US","1-n","IdentifyingPrivateElements"],"0307":["CS","1","DeidentificationAction"],"0308":["US","1","PrivateDataElement"],"0309":["UL","1-3","PrivateDataElementValueMultiplicity"],"030A":["CS","1","PrivateDataElementValueRepresentation"],"030B":["UL","1-2","PrivateDataElementNumberOfItems"],"030C":["UC","1","PrivateDataElementName"],"030D":["UC","1","PrivateDataElementKeyword"],"030E":["UT","1","PrivateDataElementDescription"],"030F":["UT","1","PrivateDataElementEncoding"],"0310":["SQ","1","PrivateDataElementDefinitionSequence"],"103E":["LO","1","SeriesDescription"],"103F":["SQ","1","SeriesDescriptionCodeSequence"],"113A":["SQ","1","ReferencedWaveformSequence"],"114A":["SQ","1","ReferencedInstanceSequence"],"114B":["SQ","1","ReferencedRealWorldValueMappingInstanceSequence"],"115A":["UI","1-n","SOPClassesSupported"],"119A":["SQ","1","OtherFailuresSequence"],"212A":["IS","1","NumberOfViewsInStage"],"225A":["SQ","1","AnatomicStructureSpaceOrRegionModifierCodeSequenceTrial"],"225C":["SQ","1","OnAxisBackgroundAnatomicStructureCodeSequenceTrial"]},"0010":{"1000":["LO","1-n","OtherPatientIDs"],"1001":["PN","1-n","OtherPatientNames"],"1002":["SQ","1","OtherPatientIDsSequence"],"1005":["PN","1","PatientBirthName"],"1010":["AS","1","PatientAge"],"1020":["DS","1","PatientSize"],"1021":["SQ","1","PatientSizeCodeSequence"],"1022":["DS","1","PatientBodyMassIndex"],"1023":["DS","1","MeasuredAPDimension"],"1024":["DS","1","MeasuredLateralDimension"],"1030":["DS","1","PatientWeight"],"1040":["LO","1","PatientAddress"],"1050":["LO","1-n","InsurancePlanIdentification"],"1060":["PN","1","PatientMotherBirthName"],"1080":["LO","1","MilitaryRank"],"1081":["LO","1","BranchOfService"],"1090":["LO","1","MedicalRecordLocator"],"1100":["SQ","1","ReferencedPatientPhotoSequence"],"2000":["LO","1-n","MedicalAlerts"],"2110":["LO","1-n","Allergies"],"2150":["LO","1","CountryOfResidence"],"2152":["LO","1","RegionOfResidence"],"2154":["SH","1-n","PatientTelephoneNumbers"],"2155":["LT","1","PatientTelecomInformation"],"2160":["SH","1","EthnicGroup"],"2180":["SH","1","Occupation"],"2201":["LO","1","PatientSpeciesDescription"],"2202":["SQ","1","PatientSpeciesCodeSequence"],"2203":["CS","1","PatientSexNeutered"],"2210":["CS","1","AnatomicalOrientationType"],"2292":["LO","1","PatientBreedDescription"],"2293":["SQ","1","PatientBreedCodeSequence"],"2294":["SQ","1","BreedRegistrationSequence"],"2295":["LO","1","BreedRegistrationNumber"],"2296":["SQ","1","BreedRegistryCodeSequence"],"2297":["PN","1","ResponsiblePerson"],"2298":["CS","1","ResponsiblePersonRole"],"2299":["LO","1","ResponsibleOrganization"],"4000":["LT","1","PatientComments"],"9431":["FL","1","ExaminedBodyThickness"],"0000":["UL","1","GenericGroupLength"],"0010":["PN","1","PatientName"],"0020":["LO","1","PatientID"],"0021":["LO","1","IssuerOfPatientID"],"0022":["CS","1","TypeOfPatientID"],"0024":["SQ","1","IssuerOfPatientIDQualifiersSequence"],"0026":["SQ","1","SourcePatientGroupIdentificationSequence"],"0027":["SQ","1","GroupOfPatientsIdentificationSequence"],"0028":["US","3","SubjectRelativePositionInImage"],"0030":["DA","1","PatientBirthDate"],"0032":["TM","1","PatientBirthTime"],"0033":["LO","1","PatientBirthDateInAlternativeCalendar"],"0034":["LO","1","PatientDeathDateInAlternativeCalendar"],"0035":["CS","1","PatientAlternativeCalendar"],"0040":["CS","1","PatientSex"],"0050":["SQ","1","PatientInsurancePlanCodeSequence"],"0101":["SQ","1","PatientPrimaryLanguageCodeSequence"],"0102":["SQ","1","PatientPrimaryLanguageModifierCodeSequence"],"0200":["CS","1","QualityControlSubject"],"0201":["SQ","1","QualityControlSubjectTypeCodeSequence"],"0212":["UC","1","StrainDescription"],"0213":["LO","1","StrainNomenclature"],"0214":["LO","1","StrainStockNumber"],"0215":["SQ","1","StrainSourceRegistryCodeSequence"],"0216":["SQ","1","StrainStockSequence"],"0217":["LO","1","StrainSource"],"0218":["UT","1","StrainAdditionalInformation"],"0219":["SQ","1","StrainCodeSequence"],"0221":["SQ","1","GeneticModificationsSequence"],"0222":["UC","1","GeneticModificationsDescription"],"0223":["LO","1","GeneticModificationsNomenclature"],"0229":["SQ","1","GeneticModificationsCodeSequence"],"21A0":["CS","1","SmokingStatus"],"21B0":["LT","1","AdditionalPatientHistory"],"21C0":["US","1","PregnancyStatus"],"21D0":["DA","1","LastMenstrualDate"],"21F0":["LO","1","PatientReligiousPreference"]},"0012":{"0000":["UL","1","GenericGroupLength"],"0010":["LO","1","ClinicalTrialSponsorName"],"0020":["LO","1","ClinicalTrialProtocolID"],"0021":["LO","1","ClinicalTrialProtocolName"],"0030":["LO","1","ClinicalTrialSiteID"],"0031":["LO","1","ClinicalTrialSiteName"],"0040":["LO","1","ClinicalTrialSubjectID"],"0042":["LO","1","ClinicalTrialSubjectReadingID"],"0050":["LO","1","ClinicalTrialTimePointID"],"0051":["ST","1","ClinicalTrialTimePointDescription"],"0052":["FD","1","LongitudinalTemporalOffsetFromEvent"],"0053":["CS","1","LongitudinalTemporalEventType"],"0060":["LO","1","ClinicalTrialCoordinatingCenterName"],"0062":["CS","1","PatientIdentityRemoved"],"0063":["LO","1-n","DeidentificationMethod"],"0064":["SQ","1","DeidentificationMethodCodeSequence"],"0071":["LO","1","ClinicalTrialSeriesID"],"0072":["LO","1","ClinicalTrialSeriesDescription"],"0081":["LO","1","ClinicalTrialProtocolEthicsCommitteeName"],"0082":["LO","1","ClinicalTrialProtocolEthicsCommitteeApprovalNumber"],"0083":["SQ","1","ConsentForClinicalTrialUseSequence"],"0084":["CS","1","DistributionType"],"0085":["CS","1","ConsentForDistributionFlag"],"0086":["DA","1","EthicsCommitteeApprovalEffectivenessStartDate"],"0087":["DA","1","EthicsCommitteeApprovalEffectivenessEndDate"]},"0014":{"1010":["ST","1","ActualEnvironmentalConditions"],"1020":["DA","1","ExpiryDate"],"1040":["ST","1","EnvironmentalConditions"],"2002":["SQ","1","EvaluatorSequence"],"2004":["IS","1","EvaluatorNumber"],"2006":["PN","1","EvaluatorName"],"2008":["IS","1","EvaluationAttempt"],"2012":["SQ","1","IndicationSequence"],"2014":["IS","1","IndicationNumber"],"2016":["SH","1","IndicationLabel"],"2018":["ST","1","IndicationDescription"],"2030":["SQ","1","IndicationPhysicalPropertySequence"],"2032":["SH","1","PropertyLabel"],"2202":["IS","1","CoordinateSystemNumberOfAxes"],"2204":["SQ","1","CoordinateSystemAxesSequence"],"2206":["ST","1","CoordinateSystemAxisDescription"],"2208":["CS","1","CoordinateSystemDataSetMapping"],"2210":["OB","1","CoordinateSystemAxisValues"],"2220":["SQ","1","CoordinateSystemTransformSequence"],"2222":["ST","1","TransformDescription"],"2224":["IS","1","TransformNumberOfAxes"],"2226":["IS","1-n","TransformOrderOfAxes"],"2228":["CS","1","TransformedAxisUnits"],"3011":["DS","1","InternalDetectorFrameTime"],"3012":["DS","1","NumberOfFramesIntegrated"],"3020":["SQ","1","DetectorTemperatureSequence"],"3022":["ST","1","SensorName"],"3024":["DS","1","HorizontalOffsetOfSensor"],"3026":["DS","1","VerticalOffsetOfSensor"],"3028":["DS","1","SensorTemperature"],"3040":["SQ","1","DarkCurrentSequence"],"3050":["ox","1","DarkCurrentCounts"],"3060":["SQ","1","GainCorrectionReferenceSequence"],"3070":["ox","1","AirCounts"],"3071":["DS","1","KVUsedInGainCalibration"],"3072":["DS","1","MAUsedInGainCalibration"],"3073":["DS","1","NumberOfFramesUsedForIntegration"],"3074":["LO","1","FilterMaterialUsedInGainCalibration"],"3075":["DS","1","FilterThicknessUsedInGainCalibration"],"3076":["DA","1","DateOfGainCalibration"],"3077":["TM","1","TimeOfGainCalibration"],"3080":["OB","1","BadPixelImage"],"3099":["LT","1","CalibrationNotes"],"3100":["LT","1","LinearityCorrectionTechnique"],"3101":["LT","1","BeamHardeningCorrectionTechnique"],"4002":["SQ","1","PulserEquipmentSequence"],"4004":["CS","1","PulserType"],"4006":["LT","1","PulserNotes"],"4008":["SQ","1","ReceiverEquipmentSequence"],"4010":["SQ","1","TransmitTransducerSequence"],"4011":["SQ","1","ReceiveTransducerSequence"],"4012":["US","1","NumberOfElements"],"4013":["CS","1","ElementShape"],"4014":["DS","1","ElementDimensionA"],"4015":["DS","1","ElementDimensionB"],"4016":["DS","1","ElementPitchA"],"4017":["DS","1","MeasuredBeamDimensionA"],"4018":["DS","1","MeasuredBeamDimensionB"],"4019":["DS","1","LocationOfMeasuredBeamDiameter"],"4020":["SQ","1","PulserSettingsSequence"],"4022":["DS","1","PulseWidth"],"4024":["DS","1","ExcitationFrequency"],"4026":["CS","1","ModulationType"],"4028":["DS","1","Damping"],"4030":["SQ","1","ReceiverSettingsSequence"],"4031":["DS","1","AcquiredSoundpathLength"],"4032":["CS","1","AcquisitionCompressionType"],"4033":["IS","1","AcquisitionSampleSize"],"4034":["DS","1","RectifierSmoothing"],"4035":["SQ","1","DACSequence"],"4036":["CS","1","DACType"],"4038":["DS","1-n","DACGainPoints"],"4040":["SQ","1","PreAmplifierSettingsSequence"],"4050":["SQ","1","TransmitTransducerSettingsSequence"],"4051":["SQ","1","ReceiveTransducerSettingsSequence"],"4052":["DS","1","IncidentAngle"],"4054":["ST","1","CouplingTechnique"],"4056":["ST","1","CouplingMedium"],"4057":["DS","1","CouplingVelocity"],"4058":["DS","1","ProbeCenterLocationX"],"4059":["DS","1","ProbeCenterLocationZ"],"4060":["SQ","1","GateSettingsSequence"],"4062":["DS","1","GateThreshold"],"4064":["DS","1","VelocityOfSound"],"4070":["SQ","1","CalibrationSettingsSequence"],"4072":["ST","1","CalibrationProcedure"],"4074":["SH","1","ProcedureVersion"],"4076":["DA","1","ProcedureCreationDate"],"4078":["DA","1","ProcedureExpirationDate"],"4080":["SQ","1","ProbeDriveEquipmentSequence"],"4081":["CS","1","DriveType"],"4082":["LT","1","ProbeDriveNotes"],"4083":["SQ","1","DriveProbeSequence"],"4084":["DS","1","ProbeInductance"],"4085":["DS","1","ProbeResistance"],"4086":["SQ","1","ReceiveProbeSequence"],"4087":["SQ","1","ProbeDriveSettingsSequence"],"4088":["DS","1","BridgeResistors"],"4089":["DS","1","ProbeOrientationAngle"],"4091":["SQ","1","ChannelSettingsSequence"],"4092":["DS","1","ChannelThreshold"],"5002":["IS","1","LINACEnergy"],"5004":["IS","1","LINACOutput"],"5100":["US","1","ActiveAperture"],"5101":["DS","1","TotalAperture"],"5102":["DS","1","ApertureElevation"],"5103":["DS","1","MainLobeAngle"],"5104":["DS","1","MainRoofAngle"],"5105":["CS","1","ConnectorType"],"5106":["SH","1","WedgeModelNumber"],"5107":["DS","1","WedgeAngleFloat"],"5108":["DS","1","WedgeRoofAngle"],"5109":["CS","1","WedgeElement1Position"],"5110":["SH","1","WedgeManufacturerName"],"5111":["LO","1","WedgeDescription"],"5112":["DS","1","NominalBeamAngle"],"5113":["DS","1","WedgeOffsetX"],"5114":["DS","1","WedgeOffsetY"],"5115":["DS","1","WedgeTotalLength"],"5116":["DS","1","WedgeInContactLength"],"5117":["DS","1","WedgeFrontGap"],"5118":["DS","1","WedgeTotalHeight"],"5119":["DS","1","WedgeFrontHeight"],"0000":["UL","1","GenericGroupLength"],"0023":["ST","1","CADFileFormat"],"0024":["ST","1","ComponentReferenceSystem"],"0025":["ST","1","ComponentManufacturingProcedure"],"0028":["ST","1","ComponentManufacturer"],"0030":["DS","1-n","MaterialThickness"],"0032":["DS","1-n","MaterialPipeDiameter"],"0034":["DS","1-n","MaterialIsolationDiameter"],"0042":["ST","1","MaterialGrade"],"0044":["ST","1","MaterialPropertiesDescription"],"0045":["ST","1","MaterialPropertiesFileFormatRetired"],"0046":["LT","1","MaterialNotes"],"0050":["CS","1","ComponentShape"],"0052":["CS","1","CurvatureType"],"0054":["DS","1","OuterDiameter"],"0056":["DS","1","InnerDiameter"],"0100":["LO","1-n","ComponentWelderIDs"],"0101":["CS","1","SecondaryApprovalStatus"],"0102":["DA","1","SecondaryReviewDate"],"0103":["TM","1","SecondaryReviewTime"],"0104":["PN","1","SecondaryReviewerName"],"0105":["ST","1","RepairID"],"0106":["SQ","1","MultipleComponentApprovalSequence"],"0107":["CS","1-n","OtherApprovalStatus"],"0108":["CS","1-n","OtherSecondaryApprovalStatus"],"201A":["CS","1-n","IndicationType"],"201C":["CS","1","IndicationDisposition"],"201E":["SQ","1","IndicationROISequence"],"220A":["IS","1","CoordinateSystemAxisNumber"],"220C":["CS","1","CoordinateSystemAxisType"],"220E":["CS","1","CoordinateSystemAxisUnits"],"222A":["DS","1-n","CoordinateSystemTransformRotationAndScaleMatrix"],"222C":["DS","1-n","CoordinateSystemTransformTranslationMatrix"],"400A":["CS","1","AmplifierType"],"400C":["LT","1","ReceiverNotes"],"400E":["SQ","1","PreAmplifierEquipmentSequence"],"400F":["LT","1","PreAmplifierNotes"],"401A":["DS","1","NominalFrequency"],"401B":["DS","1","MeasuredCenterFrequency"],"401C":["DS","1","MeasuredBandwidth"],"401D":["DS","1","ElementPitchB"],"403A":["DS","1-n","DACTimePoints"],"403C":["DS","1-n","DACAmplitude"],"405A":["DS","1","SoundPathLength"],"405C":["ST","1","DelayLawIdentifier"],"407A":["DA","1","ProcedureLastModifiedDate"],"407C":["TM","1-n","CalibrationTime"],"407E":["DA","1-n","CalibrationDate"],"408B":["DS","1","UserSelectedGainY"],"408C":["DS","1","UserSelectedPhase"],"408D":["DS","1","UserSelectedOffsetX"],"408E":["DS","1","UserSelectedOffsetY"],"409A":["SQ","1","ScannerSettingsSequence"],"409B":["ST","1","ScanProcedure"],"409C":["DS","1","TranslationRateX"],"409D":["DS","1","TranslationRateY"],"409F":["DS","1","ChannelOverlap"],"40A0":["LO","1-n","ImageQualityIndicatorType"],"40A1":["LO","1-n","ImageQualityIndicatorMaterial"],"40A2":["LO","1-n","ImageQualityIndicatorSize"],"510A":["DS","1","WedgeMaterialVelocity"],"510B":["SH","1","WedgeMaterial"],"510C":["DS","1","WedgeOffsetZ"],"510D":["DS","1","WedgeOriginOffsetX"],"510E":["DS","1","WedgeTimeDelay"],"510F":["SH","1","WedgeName"],"511A":["DS","1","WedgeRearHeight"],"511B":["DS","1","WedgeTotalWidth"],"511C":["DS","1","WedgeInContactWidth"],"511D":["DS","1","WedgeChamferHeight"],"511E":["CS","1","WedgeCurve"],"511F":["DS","1","RadiusAlongWedge"]},"0016":{"1001":["CS","1","LightSourcePolarization"],"1002":["DS","1","EmitterColorTemperature"],"1003":["CS","1","ContactMethod"],"1004":["CS","1-n","ImmersionMedia"],"1005":["DS","1","OpticalMagnificationFactor"],"0000":["UL","1","GenericGroupLength"],"0001":["DS","1","WhitePoint"],"0002":["DS","3","PrimaryChromaticities"],"0003":["UT","1","BatteryLevel"],"0004":["DS","1","ExposureTimeInSeconds"],"0005":["DS","1","FNumber"],"0006":["IS","1","OECFRows"],"0007":["IS","1","OECFColumns"],"0008":["UC","1-n","OECFColumnNames"],"0009":["DS","1-n","OECFValues"],"000A":["IS","1","SpatialFrequencyResponseRows"],"000B":["IS","1","SpatialFrequencyResponseColumns"],"000C":["UC","1-n","SpatialFrequencyResponseColumnNames"],"000D":["DS","1-n","SpatialFrequencyResponseValues"],"000E":["IS","1","ColorFilterArrayPatternRows"],"000F":["IS","1","ColorFilterArrayPatternColumns"],"0010":["DS","1-n","ColorFilterArrayPatternValues"],"0011":["US","1","FlashFiringStatus"],"0012":["US","1","FlashReturnStatus"],"0013":["US","1","FlashMode"],"0014":["US","1","FlashFunctionPresent"],"0015":["US","1","FlashRedEyeMode"],"0016":["US","1","ExposureProgram"],"0017":["UT","1","SpectralSensitivity"],"0018":["IS","1","PhotographicSensitivity"],"0019":["IS","1","SelfTimerMode"],"001A":["US","1","SensitivityType"],"001B":["IS","1","StandardOutputSensitivity"],"001C":["IS","1","RecommendedExposureIndex"],"001D":["IS","1","ISOSpeed"],"001E":["IS","1","ISOSpeedLatitudeyyy"],"001F":["IS","1","ISOSpeedLatitudezzz"],"0020":["UT","1","EXIFVersion"],"0021":["DS","1","ShutterSpeedValue"],"0022":["DS","1","ApertureValue"],"0023":["DS","1","BrightnessValue"],"0024":["DS","1","ExposureBiasValue"],"0025":["DS","1","MaxApertureValue"],"0026":["DS","1","SubjectDistance"],"0027":["US","1","MeteringMode"],"0028":["US","1","LightSource"],"0029":["DS","1","FocalLength"],"002A":["IS","2-4","SubjectArea"],"002B":["OB","1","MakerNote"],"0030":["DS","1","Temperature"],"0031":["DS","1","Humidity"],"0032":["DS","1","Pressure"],"0033":["DS","1","WaterDepth"],"0034":["DS","1","Acceleration"],"0035":["DS","1","CameraElevationAngle"],"0036":["DS","1-2","FlashEnergy"],"0037":["IS","2","SubjectLocation"],"0038":["DS","1","PhotographicExposureIndex"],"0039":["US","1","SensingMethod"],"003A":["US","1","FileSource"],"003B":["US","1","SceneType"],"0041":["US","1","CustomRendered"],"0042":["US","1","ExposureMode"],"0043":["US","1","WhiteBalance"],"0044":["DS","1","DigitalZoomRatio"],"0045":["IS","1","FocalLengthIn35mmFilm"],"0046":["US","1","SceneCaptureType"],"0047":["US","1","GainControl"],"0048":["US","1","Contrast"],"0049":["US","1","Saturation"],"004A":["US","1","Sharpness"],"004B":["OB","1","DeviceSettingDescription"],"004C":["US","1","SubjectDistanceRange"],"004D":["UT","1","CameraOwnerName"],"004E":["DS","4","LensSpecification"],"004F":["UT","1","LensMake"],"0050":["UT","1","LensModel"],"0051":["UT","1","LensSerialNumber"],"0061":["CS","1","InteroperabilityIndex"],"0062":["OB","1","InteroperabilityVersion"],"0070":["OB","1","GPSVersionID"],"0071":["CS","1","GPSLatitudeRef"],"0072":["DS","3","GPSLatitude"],"0073":["CS","1","GPSLongitudeRef"],"0074":["DS","3","GPSLongitude"],"0075":["US","1","GPSAltitudeRef"],"0076":["DS","1","GPSAltitude"],"0077":["DT","1","GPSTimeStamp"],"0078":["UT","1","GPSSatellites"],"0079":["CS","1","GPSStatus"],"007A":["CS","1","GPSMeasureMode"],"007B":["DS","1","GPSDOP"],"007C":["CS","1","GPSSpeedRef"],"007D":["DS","1","GPSSpeed"],"007E":["CS","1","GPSTrackRef"],"007F":["DS","1","GPSTrack"],"0080":["CS","1","GPSImgDirectionRef"],"0081":["DS","1","GPSImgDirection"],"0082":["UT","1","GPSMapDatum"],"0083":["CS","1","GPSDestLatitudeRef"],"0084":["DS","3","GPSDestLatitude"],"0085":["CS","1","GPSDestLongitudeRef"],"0086":["DS","3","GPSDestLongitude"],"0087":["CS","1","GPSDestBearingRef"],"0088":["DS","1","GPSDestBearing"],"0089":["CS","1","GPSDestDistanceRef"],"008A":["DS","1","GPSDestDistance"],"008B":["OB","1","GPSProcessingMethod"],"008C":["OB","1","GPSAreaInformation"],"008D":["DT","1","GPSDateStamp"],"008E":["IS","1","GPSDifferential"]},"0018":{"1000":["LO","1","DeviceSerialNumber"],"1002":["UI","1","DeviceUID"],"1003":["LO","1","DeviceID"],"1004":["LO","1","PlateID"],"1005":["LO","1","GeneratorID"],"1006":["LO","1","GridID"],"1007":["LO","1","CassetteID"],"1008":["LO","1","GantryID"],"1009":["UT","1","UniqueDeviceIdentifier"],"1010":["LO","1","SecondaryCaptureDeviceID"],"1011":["LO","1","HardcopyCreationDeviceID"],"1012":["DA","1","DateOfSecondaryCapture"],"1014":["TM","1","TimeOfSecondaryCapture"],"1016":["LO","1","SecondaryCaptureDeviceManufacturer"],"1017":["LO","1","HardcopyDeviceManufacturer"],"1018":["LO","1","SecondaryCaptureDeviceManufacturerModelName"],"1019":["LO","1-n","SecondaryCaptureDeviceSoftwareVersions"],"1020":["LO","1-n","SoftwareVersions"],"1022":["SH","1","VideoImageFormatAcquired"],"1023":["LO","1","DigitalImageFormatAcquired"],"1030":["LO","1","ProtocolName"],"1040":["LO","1","ContrastBolusRoute"],"1041":["DS","1","ContrastBolusVolume"],"1042":["TM","1","ContrastBolusStartTime"],"1043":["TM","1","ContrastBolusStopTime"],"1044":["DS","1","ContrastBolusTotalDose"],"1045":["IS","1","SyringeCounts"],"1046":["DS","1-n","ContrastFlowRate"],"1047":["DS","1-n","ContrastFlowDuration"],"1048":["CS","1","ContrastBolusIngredient"],"1049":["DS","1","ContrastBolusIngredientConcentration"],"1050":["DS","1","SpatialResolution"],"1060":["DS","1","TriggerTime"],"1061":["LO","1","TriggerSourceOrType"],"1062":["IS","1","NominalInterval"],"1063":["DS","1","FrameTime"],"1064":["LO","1","CardiacFramingType"],"1065":["DS","1-n","FrameTimeVector"],"1066":["DS","1","FrameDelay"],"1067":["DS","1","ImageTriggerDelay"],"1068":["DS","1","MultiplexGroupTimeOffset"],"1069":["DS","1","TriggerTimeOffset"],"1070":["LO","1","RadiopharmaceuticalRoute"],"1071":["DS","1","RadiopharmaceuticalVolume"],"1072":["TM","1","RadiopharmaceuticalStartTime"],"1073":["TM","1","RadiopharmaceuticalStopTime"],"1074":["DS","1","RadionuclideTotalDose"],"1075":["DS","1","RadionuclideHalfLife"],"1076":["DS","1","RadionuclidePositronFraction"],"1077":["DS","1","RadiopharmaceuticalSpecificActivity"],"1078":["DT","1","RadiopharmaceuticalStartDateTime"],"1079":["DT","1","RadiopharmaceuticalStopDateTime"],"1080":["CS","1","BeatRejectionFlag"],"1081":["IS","1","LowRRValue"],"1082":["IS","1","HighRRValue"],"1083":["IS","1","IntervalsAcquired"],"1084":["IS","1","IntervalsRejected"],"1085":["LO","1","PVCRejection"],"1086":["IS","1","SkipBeats"],"1088":["IS","1","HeartRate"],"1090":["IS","1","CardiacNumberOfImages"],"1094":["IS","1","TriggerWindow"],"1100":["DS","1","ReconstructionDiameter"],"1110":["DS","1","DistanceSourceToDetector"],"1111":["DS","1","DistanceSourceToPatient"],"1114":["DS","1","EstimatedRadiographicMagnificationFactor"],"1120":["DS","1","GantryDetectorTilt"],"1121":["DS","1","GantryDetectorSlew"],"1130":["DS","1","TableHeight"],"1131":["DS","1","TableTraverse"],"1134":["CS","1","TableMotion"],"1135":["DS","1-n","TableVerticalIncrement"],"1136":["DS","1-n","TableLateralIncrement"],"1137":["DS","1-n","TableLongitudinalIncrement"],"1138":["DS","1","TableAngle"],"1140":["CS","1","RotationDirection"],"1141":["DS","1","AngularPosition"],"1142":["DS","1-n","RadialPosition"],"1143":["DS","1","ScanArc"],"1144":["DS","1","AngularStep"],"1145":["DS","1","CenterOfRotationOffset"],"1146":["DS","1-n","RotationOffset"],"1147":["CS","1","FieldOfViewShape"],"1149":["IS","1-2","FieldOfViewDimensions"],"1150":["IS","1","ExposureTime"],"1151":["IS","1","XRayTubeCurrent"],"1152":["IS","1","Exposure"],"1153":["IS","1","ExposureInuAs"],"1154":["DS","1","AveragePulseWidth"],"1155":["CS","1","RadiationSetting"],"1156":["CS","1","RectificationType"],"1160":["SH","1","FilterType"],"1161":["LO","1-n","TypeOfFilters"],"1162":["DS","1","IntensifierSize"],"1164":["DS","2","ImagerPixelSpacing"],"1166":["CS","1-n","Grid"],"1170":["IS","1","GeneratorPower"],"1180":["SH","1","CollimatorGridName"],"1181":["CS","1","CollimatorType"],"1182":["IS","1-2","FocalDistance"],"1183":["DS","1-2","XFocusCenter"],"1184":["DS","1-2","YFocusCenter"],"1190":["DS","1-n","FocalSpots"],"1191":["CS","1","AnodeTargetMaterial"],"1200":["DA","1-n","DateOfLastCalibration"],"1201":["TM","1-n","TimeOfLastCalibration"],"1202":["DT","1","DateTimeOfLastCalibration"],"1203":["DT","1","CalibrationDateTime"],"1210":["SH","1-n","ConvolutionKernel"],"1240":["IS","1-n","UpperLowerPixelValues"],"1242":["IS","1","ActualFrameDuration"],"1243":["IS","1","CountRate"],"1244":["US","1","PreferredPlaybackSequencing"],"1250":["SH","1","ReceiveCoilName"],"1251":["SH","1","TransmitCoilName"],"1260":["SH","1","PlateType"],"1261":["LO","1","PhosphorType"],"1271":["FD","1","WaterEquivalentDiameter"],"1272":["SQ","1","WaterEquivalentDiameterCalculationMethodCodeSequence"],"1300":["DS","1","ScanVelocity"],"1301":["CS","1-n","WholeBodyTechnique"],"1302":["IS","1","ScanLength"],"1310":["US","4","AcquisitionMatrix"],"1312":["CS","1","InPlanePhaseEncodingDirection"],"1314":["DS","1","FlipAngle"],"1315":["CS","1","VariableFlipAngleFlag"],"1316":["DS","1","SAR"],"1318":["DS","1","dBdt"],"1320":["FL","1","B1rms"],"1400":["LO","1","AcquisitionDeviceProcessingDescription"],"1401":["LO","1","AcquisitionDeviceProcessingCode"],"1402":["CS","1","CassetteOrientation"],"1403":["CS","1","CassetteSize"],"1404":["US","1","ExposuresOnPlate"],"1405":["IS","1","RelativeXRayExposure"],"1411":["DS","1","ExposureIndex"],"1412":["DS","1","TargetExposureIndex"],"1413":["DS","1","DeviationIndex"],"1450":["DS","1","ColumnAngulation"],"1460":["DS","1","TomoLayerHeight"],"1470":["DS","1","TomoAngle"],"1480":["DS","1","TomoTime"],"1490":["CS","1","TomoType"],"1491":["CS","1","TomoClass"],"1495":["IS","1","NumberOfTomosynthesisSourceImages"],"1500":["CS","1","PositionerMotion"],"1508":["CS","1","PositionerType"],"1510":["DS","1","PositionerPrimaryAngle"],"1511":["DS","1","PositionerSecondaryAngle"],"1520":["DS","1-n","PositionerPrimaryAngleIncrement"],"1521":["DS","1-n","PositionerSecondaryAngleIncrement"],"1530":["DS","1","DetectorPrimaryAngle"],"1531":["DS","1","DetectorSecondaryAngle"],"1600":["CS","1-3","ShutterShape"],"1602":["IS","1","ShutterLeftVerticalEdge"],"1604":["IS","1","ShutterRightVerticalEdge"],"1606":["IS","1","ShutterUpperHorizontalEdge"],"1608":["IS","1","ShutterLowerHorizontalEdge"],"1610":["IS","2","CenterOfCircularShutter"],"1612":["IS","1","RadiusOfCircularShutter"],"1620":["IS","2-2n","VerticesOfThePolygonalShutter"],"1622":["US","1","ShutterPresentationValue"],"1623":["US","1","ShutterOverlayGroup"],"1624":["US","3","ShutterPresentationColorCIELabValue"],"1630":["CS","1","OutlineShapeType"],"1631":["FD","1","OutlineLeftVerticalEdge"],"1632":["FD","1","OutlineRightVerticalEdge"],"1633":["FD","1","OutlineUpperHorizontalEdge"],"1634":["FD","1","OutlineLowerHorizontalEdge"],"1635":["FD","2","CenterOfCircularOutline"],"1636":["FD","1","DiameterOfCircularOutline"],"1637":["UL","1","NumberOfPolygonalVertices"],"1638":["OF","1","VerticesOfThePolygonalOutline"],"1700":["CS","1-3","CollimatorShape"],"1702":["IS","1","CollimatorLeftVerticalEdge"],"1704":["IS","1","CollimatorRightVerticalEdge"],"1706":["IS","1","CollimatorUpperHorizontalEdge"],"1708":["IS","1","CollimatorLowerHorizontalEdge"],"1710":["IS","2","CenterOfCircularCollimator"],"1712":["IS","1","RadiusOfCircularCollimator"],"1720":["IS","2-2n","VerticesOfThePolygonalCollimator"],"1800":["CS","1","AcquisitionTimeSynchronized"],"1801":["SH","1","TimeSource"],"1802":["CS","1","TimeDistributionProtocol"],"1803":["LO","1","NTPSourceAddress"],"2001":["IS","1-n","PageNumberVector"],"2002":["SH","1-n","FrameLabelVector"],"2003":["DS","1-n","FramePrimaryAngleVector"],"2004":["DS","1-n","FrameSecondaryAngleVector"],"2005":["DS","1-n","SliceLocationVector"],"2006":["SH","1-n","DisplayWindowLabelVector"],"2010":["DS","2","NominalScannedPixelSpacing"],"2020":["CS","1","DigitizingDeviceTransportDirection"],"2030":["DS","1","RotationOfScannedFilm"],"2041":["SQ","1","BiopsyTargetSequence"],"2042":["UI","1","TargetUID"],"2043":["FL","2","LocalizingCursorPosition"],"2044":["FL","3","CalculatedTargetPosition"],"2045":["SH","1","TargetLabel"],"2046":["FL","1","DisplayedZValue"],"3100":["CS","1","IVUSAcquisition"],"3101":["DS","1","IVUSPullbackRate"],"3102":["DS","1","IVUSGatedRate"],"3103":["IS","1","IVUSPullbackStartFrameNumber"],"3104":["IS","1","IVUSPullbackStopFrameNumber"],"3105":["IS","1-n","LesionNumber"],"4000":["LT","1","AcquisitionComments"],"5000":["SH","1-n","OutputPower"],"5010":["LO","1-n","TransducerData"],"5011":["SQ","1","TransducerIdentificationSequence"],"5012":["DS","1","FocusDepth"],"5020":["LO","1","ProcessingFunction"],"5021":["LO","1","PostprocessingFunction"],"5022":["DS","1","MechanicalIndex"],"5024":["DS","1","BoneThermalIndex"],"5026":["DS","1","CranialThermalIndex"],"5027":["DS","1","SoftTissueThermalIndex"],"5028":["DS","1","SoftTissueFocusThermalIndex"],"5029":["DS","1","SoftTissueSurfaceThermalIndex"],"5030":["DS","1","DynamicRange"],"5040":["DS","1","TotalGain"],"5050":["IS","1","DepthOfScanField"],"5100":["CS","1","PatientPosition"],"5101":["CS","1","ViewPosition"],"5104":["SQ","1","ProjectionEponymousNameCodeSequence"],"5210":["DS","6","ImageTransformationMatrix"],"5212":["DS","3","ImageTranslationVector"],"6000":["DS","1","Sensitivity"],"6011":["SQ","1","SequenceOfUltrasoundRegions"],"6012":["US","1","RegionSpatialFormat"],"6014":["US","1","RegionDataType"],"6016":["UL","1","RegionFlags"],"6018":["UL","1","RegionLocationMinX0"],"6020":["SL","1","ReferencePixelX0"],"6022":["SL","1","ReferencePixelY0"],"6024":["US","1","PhysicalUnitsXDirection"],"6026":["US","1","PhysicalUnitsYDirection"],"6028":["FD","1","ReferencePixelPhysicalValueX"],"6030":["UL","1","TransducerFrequency"],"6031":["CS","1","TransducerType"],"6032":["UL","1","PulseRepetitionFrequency"],"6034":["FD","1","DopplerCorrectionAngle"],"6036":["FD","1","SteeringAngle"],"6038":["UL","1","DopplerSampleVolumeXPositionRetired"],"6039":["SL","1","DopplerSampleVolumeXPosition"],"6040":["UL","1","TMLinePositionX1Retired"],"6041":["SL","1","TMLinePositionX1"],"6042":["UL","1","TMLinePositionY1Retired"],"6043":["SL","1","TMLinePositionY1"],"6044":["US","1","PixelComponentOrganization"],"6046":["UL","1","PixelComponentMask"],"6048":["UL","1","PixelComponentRangeStart"],"6050":["UL","1","NumberOfTableBreakPoints"],"6052":["UL","1-n","TableOfXBreakPoints"],"6054":["FD","1-n","TableOfYBreakPoints"],"6056":["UL","1","NumberOfTableEntries"],"6058":["UL","1-n","TableOfPixelValues"],"6060":["FL","1-n","RWaveTimeVector"],"6070":["US","1","ActiveImageAreaOverlayGroup"],"7000":["CS","1","DetectorConditionsNominalFlag"],"7001":["DS","1","DetectorTemperature"],"7004":["CS","1","DetectorType"],"7005":["CS","1","DetectorConfiguration"],"7006":["LT","1","DetectorDescription"],"7008":["LT","1","DetectorMode"],"7010":["IS","1","ExposuresOnDetectorSinceLastCalibration"],"7011":["IS","1","ExposuresOnDetectorSinceManufactured"],"7012":["DS","1","DetectorTimeSinceLastExposure"],"7014":["DS","1","DetectorActiveTime"],"7016":["DS","1","DetectorActivationOffsetFromExposure"],"7020":["DS","2","DetectorElementPhysicalSize"],"7022":["DS","2","DetectorElementSpacing"],"7024":["CS","1","DetectorActiveShape"],"7026":["DS","1-2","DetectorActiveDimensions"],"7028":["DS","2","DetectorActiveOrigin"],"7030":["DS","2","FieldOfViewOrigin"],"7032":["DS","1","FieldOfViewRotation"],"7034":["CS","1","FieldOfViewHorizontalFlip"],"7036":["FL","2","PixelDataAreaOriginRelativeToFOV"],"7038":["FL","1","PixelDataAreaRotationAngleRelativeToFOV"],"7040":["LT","1","GridAbsorbingMaterial"],"7041":["LT","1","GridSpacingMaterial"],"7042":["DS","1","GridThickness"],"7044":["DS","1","GridPitch"],"7046":["IS","2","GridAspectRatio"],"7048":["DS","1","GridPeriod"],"7050":["CS","1-n","FilterMaterial"],"7052":["DS","1-n","FilterThicknessMinimum"],"7054":["DS","1-n","FilterThicknessMaximum"],"7056":["FL","1-n","FilterBeamPathLengthMinimum"],"7058":["FL","1-n","FilterBeamPathLengthMaximum"],"7060":["CS","1","ExposureControlMode"],"7062":["LT","1","ExposureControlModeDescription"],"7064":["CS","1","ExposureStatus"],"7065":["DS","1","PhototimerSetting"],"8150":["DS","1","ExposureTimeInuS"],"8151":["DS","1","XRayTubeCurrentInuA"],"9004":["CS","1","ContentQualification"],"9005":["SH","1","PulseSequenceName"],"9006":["SQ","1","MRImagingModifierSequence"],"9008":["CS","1","EchoPulseSequence"],"9009":["CS","1","InversionRecovery"],"9010":["CS","1","FlowCompensation"],"9011":["CS","1","MultipleSpinEcho"],"9012":["CS","1","MultiPlanarExcitation"],"9014":["CS","1","PhaseContrast"],"9015":["CS","1","TimeOfFlightContrast"],"9016":["CS","1","Spoiling"],"9017":["CS","1","SteadyStatePulseSequence"],"9018":["CS","1","EchoPlanarPulseSequence"],"9019":["FD","1","TagAngleFirstAxis"],"9020":["CS","1","MagnetizationTransfer"],"9021":["CS","1","T2Preparation"],"9022":["CS","1","BloodSignalNulling"],"9024":["CS","1","SaturationRecovery"],"9025":["CS","1","SpectrallySelectedSuppression"],"9026":["CS","1","SpectrallySelectedExcitation"],"9027":["CS","1","SpatialPresaturation"],"9028":["CS","1","Tagging"],"9029":["CS","1","OversamplingPhase"],"9030":["FD","1","TagSpacingFirstDimension"],"9032":["CS","1","GeometryOfKSpaceTraversal"],"9033":["CS","1","SegmentedKSpaceTraversal"],"9034":["CS","1","RectilinearPhaseEncodeReordering"],"9035":["FD","1","TagThickness"],"9036":["CS","1","PartialFourierDirection"],"9037":["CS","1","CardiacSynchronizationTechnique"],"9041":["LO","1","ReceiveCoilManufacturerName"],"9042":["SQ","1","MRReceiveCoilSequence"],"9043":["CS","1","ReceiveCoilType"],"9044":["CS","1","QuadratureReceiveCoil"],"9045":["SQ","1","MultiCoilDefinitionSequence"],"9046":["LO","1","MultiCoilConfiguration"],"9047":["SH","1","MultiCoilElementName"],"9048":["CS","1","MultiCoilElementUsed"],"9049":["SQ","1","MRTransmitCoilSequence"],"9050":["LO","1","TransmitCoilManufacturerName"],"9051":["CS","1","TransmitCoilType"],"9052":["FD","1-2","SpectralWidth"],"9053":["FD","1-2","ChemicalShiftReference"],"9054":["CS","1","VolumeLocalizationTechnique"],"9058":["US","1","MRAcquisitionFrequencyEncodingSteps"],"9059":["CS","1","Decoupling"],"9060":["CS","1-2","DecoupledNucleus"],"9061":["FD","1-2","DecouplingFrequency"],"9062":["CS","1","DecouplingMethod"],"9063":["FD","1-2","DecouplingChemicalShiftReference"],"9064":["CS","1","KSpaceFiltering"],"9065":["CS","1-2","TimeDomainFiltering"],"9066":["US","1-2","NumberOfZeroFills"],"9067":["CS","1","BaselineCorrection"],"9069":["FD","1","ParallelReductionFactorInPlane"],"9070":["FD","1","CardiacRRIntervalSpecified"],"9073":["FD","1","AcquisitionDuration"],"9074":["DT","1","FrameAcquisitionDateTime"],"9075":["CS","1","DiffusionDirectionality"],"9076":["SQ","1","DiffusionGradientDirectionSequence"],"9077":["CS","1","ParallelAcquisition"],"9078":["CS","1","ParallelAcquisitionTechnique"],"9079":["FD","1-n","InversionTimes"],"9080":["ST","1","MetaboliteMapDescription"],"9081":["CS","1","PartialFourier"],"9082":["FD","1","EffectiveEchoTime"],"9083":["SQ","1","MetaboliteMapCodeSequence"],"9084":["SQ","1","ChemicalShiftSequence"],"9085":["CS","1","CardiacSignalSource"],"9087":["FD","1","DiffusionBValue"],"9089":["FD","3","DiffusionGradientOrientation"],"9090":["FD","3","VelocityEncodingDirection"],"9091":["FD","1","VelocityEncodingMinimumValue"],"9092":["SQ","1","VelocityEncodingAcquisitionSequence"],"9093":["US","1","NumberOfKSpaceTrajectories"],"9094":["CS","1","CoverageOfKSpace"],"9095":["UL","1","SpectroscopyAcquisitionPhaseRows"],"9096":["FD","1","ParallelReductionFactorInPlaneRetired"],"9098":["FD","1-2","TransmitterFrequency"],"9100":["CS","1-2","ResonantNucleus"],"9101":["CS","1","FrequencyCorrection"],"9103":["SQ","1","MRSpectroscopyFOVGeometrySequence"],"9104":["FD","1","SlabThickness"],"9105":["FD","3","SlabOrientation"],"9106":["FD","3","MidSlabPosition"],"9107":["SQ","1","MRSpatialSaturationSequence"],"9112":["SQ","1","MRTimingAndRelatedParametersSequence"],"9114":["SQ","1","MREchoSequence"],"9115":["SQ","1","MRModifierSequence"],"9117":["SQ","1","MRDiffusionSequence"],"9118":["SQ","1","CardiacSynchronizationSequence"],"9119":["SQ","1","MRAveragesSequence"],"9125":["SQ","1","MRFOVGeometrySequence"],"9126":["SQ","1","VolumeLocalizationSequence"],"9127":["UL","1","SpectroscopyAcquisitionDataColumns"],"9147":["CS","1","DiffusionAnisotropyType"],"9151":["DT","1","FrameReferenceDateTime"],"9152":["SQ","1","MRMetaboliteMapSequence"],"9155":["FD","1","ParallelReductionFactorOutOfPlane"],"9159":["UL","1","SpectroscopyAcquisitionOutOfPlanePhaseSteps"],"9166":["CS","1","BulkMotionStatus"],"9168":["FD","1","ParallelReductionFactorSecondInPlane"],"9169":["CS","1","CardiacBeatRejectionTechnique"],"9170":["CS","1","RespiratoryMotionCompensationTechnique"],"9171":["CS","1","RespiratorySignalSource"],"9172":["CS","1","BulkMotionCompensationTechnique"],"9173":["CS","1","BulkMotionSignalSource"],"9174":["CS","1","ApplicableSafetyStandardAgency"],"9175":["LO","1","ApplicableSafetyStandardDescription"],"9176":["SQ","1","OperatingModeSequence"],"9177":["CS","1","OperatingModeType"],"9178":["CS","1","OperatingMode"],"9179":["CS","1","SpecificAbsorptionRateDefinition"],"9180":["CS","1","GradientOutputType"],"9181":["FD","1","SpecificAbsorptionRateValue"],"9182":["FD","1","GradientOutput"],"9183":["CS","1","FlowCompensationDirection"],"9184":["FD","1","TaggingDelay"],"9185":["ST","1","RespiratoryMotionCompensationTechniqueDescription"],"9186":["SH","1","RespiratorySignalSourceID"],"9195":["FD","1","ChemicalShiftMinimumIntegrationLimitInHz"],"9196":["FD","1","ChemicalShiftMaximumIntegrationLimitInHz"],"9197":["SQ","1","MRVelocityEncodingSequence"],"9198":["CS","1","FirstOrderPhaseCorrection"],"9199":["CS","1","WaterReferencedPhaseCorrection"],"9200":["CS","1","MRSpectroscopyAcquisitionType"],"9214":["CS","1","RespiratoryCyclePosition"],"9217":["FD","1","VelocityEncodingMaximumValue"],"9218":["FD","1","TagSpacingSecondDimension"],"9219":["SS","1","TagAngleSecondAxis"],"9220":["FD","1","FrameAcquisitionDuration"],"9226":["SQ","1","MRImageFrameTypeSequence"],"9227":["SQ","1","MRSpectroscopyFrameTypeSequence"],"9231":["US","1","MRAcquisitionPhaseEncodingStepsInPlane"],"9232":["US","1","MRAcquisitionPhaseEncodingStepsOutOfPlane"],"9234":["UL","1","SpectroscopyAcquisitionPhaseColumns"],"9236":["CS","1","CardiacCyclePosition"],"9239":["SQ","1","SpecificAbsorptionRateSequence"],"9240":["US","1","RFEchoTrainLength"],"9241":["US","1","GradientEchoTrainLength"],"9250":["CS","1","ArterialSpinLabelingContrast"],"9251":["SQ","1","MRArterialSpinLabelingSequence"],"9252":["LO","1","ASLTechniqueDescription"],"9253":["US","1","ASLSlabNumber"],"9254":["FD","1","ASLSlabThickness"],"9255":["FD","3","ASLSlabOrientation"],"9256":["FD","3","ASLMidSlabPosition"],"9257":["CS","1","ASLContext"],"9258":["UL","1","ASLPulseTrainDuration"],"9259":["CS","1","ASLCrusherFlag"],"9260":["SQ","1","ASLSlabSequence"],"9295":["FD","1","ChemicalShiftMinimumIntegrationLimitInppm"],"9296":["FD","1","ChemicalShiftMaximumIntegrationLimitInppm"],"9297":["CS","1","WaterReferenceAcquisition"],"9298":["IS","1","EchoPeakPosition"],"9301":["SQ","1","CTAcquisitionTypeSequence"],"9302":["CS","1","AcquisitionType"],"9303":["FD","1","TubeAngle"],"9304":["SQ","1","CTAcquisitionDetailsSequence"],"9305":["FD","1","RevolutionTime"],"9306":["FD","1","SingleCollimationWidth"],"9307":["FD","1","TotalCollimationWidth"],"9308":["SQ","1","CTTableDynamicsSequence"],"9309":["FD","1","TableSpeed"],"9310":["FD","1","TableFeedPerRotation"],"9311":["FD","1","SpiralPitchFactor"],"9312":["SQ","1","CTGeometrySequence"],"9313":["FD","3","DataCollectionCenterPatient"],"9314":["SQ","1","CTReconstructionSequence"],"9315":["CS","1","ReconstructionAlgorithm"],"9316":["CS","1","ConvolutionKernelGroup"],"9317":["FD","2","ReconstructionFieldOfView"],"9318":["FD","3","ReconstructionTargetCenterPatient"],"9319":["FD","1","ReconstructionAngle"],"9320":["SH","1","ImageFilter"],"9321":["SQ","1","CTExposureSequence"],"9322":["FD","2","ReconstructionPixelSpacing"],"9323":["CS","1-n","ExposureModulationType"],"9324":["FD","1","EstimatedDoseSaving"],"9325":["SQ","1","CTXRayDetailsSequence"],"9326":["SQ","1","CTPositionSequence"],"9327":["FD","1","TablePosition"],"9328":["FD","1","ExposureTimeInms"],"9329":["SQ","1","CTImageFrameTypeSequence"],"9330":["FD","1","XRayTubeCurrentInmA"],"9332":["FD","1","ExposureInmAs"],"9333":["CS","1","ConstantVolumeFlag"],"9334":["CS","1","FluoroscopyFlag"],"9335":["FD","1","DistanceSourceToDataCollectionCenter"],"9337":["US","1","ContrastBolusAgentNumber"],"9338":["SQ","1","ContrastBolusIngredientCodeSequence"],"9340":["SQ","1","ContrastAdministrationProfileSequence"],"9341":["SQ","1","ContrastBolusUsageSequence"],"9342":["CS","1","ContrastBolusAgentAdministered"],"9343":["CS","1","ContrastBolusAgentDetected"],"9344":["CS","1","ContrastBolusAgentPhase"],"9345":["FD","1","CTDIvol"],"9346":["SQ","1","CTDIPhantomTypeCodeSequence"],"9351":["FL","1","CalciumScoringMassFactorPatient"],"9352":["FL","3","CalciumScoringMassFactorDevice"],"9353":["FL","1","EnergyWeightingFactor"],"9360":["SQ","1","CTAdditionalXRaySourceSequence"],"9361":["CS","1","MultienergyCTAcquisition"],"9362":["SQ","1","MultienergyCTAcquisitionSequence"],"9363":["SQ","1","MultienergyCTProcessingSequence"],"9364":["SQ","1","MultienergyCTCharacteristicsSequence"],"9365":["SQ","1","MultienergyCTXRaySourceSequence"],"9366":["US","1","XRaySourceIndex"],"9367":["UC","1","XRaySourceID"],"9368":["CS","1","MultienergySourceTechnique"],"9369":["DT","1","SourceStartDateTime"],"9370":["US","1","XRayDetectorIndex"],"9371":["UC","1","XRayDetectorID"],"9372":["CS","1","MultienergyDetectorType"],"9373":["ST","1","XRayDetectorLabel"],"9374":["DS","1","NominalMaxEnergy"],"9375":["DS","1","NominalMinEnergy"],"9376":["US","1-n","ReferencedXRayDetectorIndex"],"9377":["US","1-n","ReferencedXRaySourceIndex"],"9378":["US","1-n","ReferencedPathIndex"],"9379":["SQ","1","MultienergyCTPathSequence"],"9380":["SQ","1","DecompositionAlgorithmIdentificationSequence"],"9381":["SQ","1","DecompositionMaterialSequence"],"9382":["SQ","1","MaterialAttenuationSequence"],"9383":["DS","1","PhotonEnergy"],"9384":["DS","1","XRayMassAttenuationCoefficient"],"9401":["SQ","1","ProjectionPixelCalibrationSequence"],"9402":["FL","1","DistanceSourceToIsocenter"],"9403":["FL","1","DistanceObjectToTableTop"],"9404":["FL","2","ObjectPixelSpacingInCenterOfBeam"],"9405":["SQ","1","PositionerPositionSequence"],"9406":["SQ","1","TablePositionSequence"],"9407":["SQ","1","CollimatorShapeSequence"],"9410":["CS","1","PlanesInAcquisition"],"9412":["SQ","1","XAXRFFrameCharacteristicsSequence"],"9417":["SQ","1","FrameAcquisitionSequence"],"9420":["CS","1","XRayReceptorType"],"9423":["LO","1","AcquisitionProtocolName"],"9424":["LT","1","AcquisitionProtocolDescription"],"9425":["CS","1","ContrastBolusIngredientOpaque"],"9426":["FL","1","DistanceReceptorPlaneToDetectorHousing"],"9427":["CS","1","IntensifierActiveShape"],"9428":["FL","1-2","IntensifierActiveDimensions"],"9429":["FL","2","PhysicalDetectorSize"],"9430":["FL","2","PositionOfIsocenterProjection"],"9432":["SQ","1","FieldOfViewSequence"],"9433":["LO","1","FieldOfViewDescription"],"9434":["SQ","1","ExposureControlSensingRegionsSequence"],"9435":["CS","1","ExposureControlSensingRegionShape"],"9436":["SS","1","ExposureControlSensingRegionLeftVerticalEdge"],"9437":["SS","1","ExposureControlSensingRegionRightVerticalEdge"],"9438":["SS","1","ExposureControlSensingRegionUpperHorizontalEdge"],"9439":["SS","1","ExposureControlSensingRegionLowerHorizontalEdge"],"9440":["SS","2","CenterOfCircularExposureControlSensingRegion"],"9441":["US","1","RadiusOfCircularExposureControlSensingRegion"],"9442":["SS","2-n","VerticesOfThePolygonalExposureControlSensingRegion"],"9445":["","",""],"9447":["FL","1","ColumnAngulationPatient"],"9449":["FL","1","BeamAngle"],"9451":["SQ","1","FrameDetectorParametersSequence"],"9452":["FL","1","CalculatedAnatomyThickness"],"9455":["SQ","1","CalibrationSequence"],"9456":["SQ","1","ObjectThicknessSequence"],"9457":["CS","1","PlaneIdentification"],"9461":["FL","1-2","FieldOfViewDimensionsInFloat"],"9462":["SQ","1","IsocenterReferenceSystemSequence"],"9463":["FL","1","PositionerIsocenterPrimaryAngle"],"9464":["FL","1","PositionerIsocenterSecondaryAngle"],"9465":["FL","1","PositionerIsocenterDetectorRotationAngle"],"9466":["FL","1","TableXPositionToIsocenter"],"9467":["FL","1","TableYPositionToIsocenter"],"9468":["FL","1","TableZPositionToIsocenter"],"9469":["FL","1","TableHorizontalRotationAngle"],"9470":["FL","1","TableHeadTiltAngle"],"9471":["FL","1","TableCradleTiltAngle"],"9472":["SQ","1","FrameDisplayShutterSequence"],"9473":["FL","1","AcquiredImageAreaDoseProduct"],"9474":["CS","1","CArmPositionerTabletopRelationship"],"9476":["SQ","1","XRayGeometrySequence"],"9477":["SQ","1","IrradiationEventIdentificationSequence"],"9504":["SQ","1","XRay3DFrameTypeSequence"],"9506":["SQ","1","ContributingSourcesSequence"],"9507":["SQ","1","XRay3DAcquisitionSequence"],"9508":["FL","1","PrimaryPositionerScanArc"],"9509":["FL","1","SecondaryPositionerScanArc"],"9510":["FL","1","PrimaryPositionerScanStartAngle"],"9511":["FL","1","SecondaryPositionerScanStartAngle"],"9514":["FL","1","PrimaryPositionerIncrement"],"9515":["FL","1","SecondaryPositionerIncrement"],"9516":["DT","1","StartAcquisitionDateTime"],"9517":["DT","1","EndAcquisitionDateTime"],"9518":["SS","1","PrimaryPositionerIncrementSign"],"9519":["SS","1","SecondaryPositionerIncrementSign"],"9524":["LO","1","ApplicationName"],"9525":["LO","1","ApplicationVersion"],"9526":["LO","1","ApplicationManufacturer"],"9527":["CS","1","AlgorithmType"],"9528":["LO","1","AlgorithmDescription"],"9530":["SQ","1","XRay3DReconstructionSequence"],"9531":["LO","1","ReconstructionDescription"],"9538":["SQ","1","PerProjectionAcquisitionSequence"],"9541":["SQ","1","DetectorPositionSequence"],"9542":["SQ","1","XRayAcquisitionDoseSequence"],"9543":["FD","1","XRaySourceIsocenterPrimaryAngle"],"9544":["FD","1","XRaySourceIsocenterSecondaryAngle"],"9545":["FD","1","BreastSupportIsocenterPrimaryAngle"],"9546":["FD","1","BreastSupportIsocenterSecondaryAngle"],"9547":["FD","1","BreastSupportXPositionToIsocenter"],"9548":["FD","1","BreastSupportYPositionToIsocenter"],"9549":["FD","1","BreastSupportZPositionToIsocenter"],"9550":["FD","1","DetectorIsocenterPrimaryAngle"],"9551":["FD","1","DetectorIsocenterSecondaryAngle"],"9552":["FD","1","DetectorXPositionToIsocenter"],"9553":["FD","1","DetectorYPositionToIsocenter"],"9554":["FD","1","DetectorZPositionToIsocenter"],"9555":["SQ","1","XRayGridSequence"],"9556":["SQ","1","XRayFilterSequence"],"9557":["FD","3","DetectorActiveAreaTLHCPosition"],"9558":["FD","6","DetectorActiveAreaOrientation"],"9559":["CS","1","PositionerPrimaryAngleDirection"],"9601":["SQ","1","DiffusionBMatrixSequence"],"9602":["FD","1","DiffusionBValueXX"],"9603":["FD","1","DiffusionBValueXY"],"9604":["FD","1","DiffusionBValueXZ"],"9605":["FD","1","DiffusionBValueYY"],"9606":["FD","1","DiffusionBValueYZ"],"9607":["FD","1","DiffusionBValueZZ"],"9621":["SQ","1","FunctionalMRSequence"],"9622":["CS","1","FunctionalSettlingPhaseFramesPresent"],"9623":["DT","1","FunctionalSyncPulse"],"9624":["CS","1","SettlingPhaseFrame"],"9701":["DT","1","DecayCorrectionDateTime"],"9715":["FD","1","StartDensityThreshold"],"9716":["FD","1","StartRelativeDensityDifferenceThreshold"],"9717":["FD","1","StartCardiacTriggerCountThreshold"],"9718":["FD","1","StartRespiratoryTriggerCountThreshold"],"9719":["FD","1","TerminationCountsThreshold"],"9720":["FD","1","TerminationDensityThreshold"],"9721":["FD","1","TerminationRelativeDensityThreshold"],"9722":["FD","1","TerminationTimeThreshold"],"9723":["FD","1","TerminationCardiacTriggerCountThreshold"],"9724":["FD","1","TerminationRespiratoryTriggerCountThreshold"],"9725":["CS","1","DetectorGeometry"],"9726":["FD","1","TransverseDetectorSeparation"],"9727":["FD","1","AxialDetectorDimension"],"9729":["US","1","RadiopharmaceuticalAgentNumber"],"9732":["SQ","1","PETFrameAcquisitionSequence"],"9733":["SQ","1","PETDetectorMotionDetailsSequence"],"9734":["SQ","1","PETTableDynamicsSequence"],"9735":["SQ","1","PETPositionSequence"],"9736":["SQ","1","PETFrameCorrectionFactorsSequence"],"9737":["SQ","1","RadiopharmaceuticalUsageSequence"],"9738":["CS","1","AttenuationCorrectionSource"],"9739":["US","1","NumberOfIterations"],"9740":["US","1","NumberOfSubsets"],"9749":["SQ","1","PETReconstructionSequence"],"9751":["SQ","1","PETFrameTypeSequence"],"9755":["CS","1","TimeOfFlightInformationUsed"],"9756":["CS","1","ReconstructionType"],"9758":["CS","1","DecayCorrected"],"9759":["CS","1","AttenuationCorrected"],"9760":["CS","1","ScatterCorrected"],"9761":["CS","1","DeadTimeCorrected"],"9762":["CS","1","GantryMotionCorrected"],"9763":["CS","1","PatientMotionCorrected"],"9764":["CS","1","CountLossNormalizationCorrected"],"9765":["CS","1","RandomsCorrected"],"9766":["CS","1","NonUniformRadialSamplingCorrected"],"9767":["CS","1","SensitivityCalibrated"],"9768":["CS","1","DetectorNormalizationCorrection"],"9769":["CS","1","IterativeReconstructionMethod"],"9770":["CS","1","AttenuationCorrectionTemporalRelationship"],"9771":["SQ","1","PatientPhysiologicalStateSequence"],"9772":["SQ","1","PatientPhysiologicalStateCodeSequence"],"9801":["FD","1-n","DepthsOfFocus"],"9803":["SQ","1","ExcludedIntervalsSequence"],"9804":["DT","1","ExclusionStartDateTime"],"9805":["FD","1","ExclusionDuration"],"9806":["SQ","1","USImageDescriptionSequence"],"9807":["SQ","1","ImageDataTypeSequence"],"9808":["CS","1","DataType"],"9809":["SQ","1","TransducerScanPatternCodeSequence"],"9810":["xs","1","ZeroVelocityPixelValue"],"9900":["LO","1","ReferenceLocationLabel"],"9901":["UT","1","ReferenceLocationDescription"],"9902":["SQ","1","ReferenceBasisCodeSequence"],"9903":["SQ","1","ReferenceGeometryCodeSequence"],"9904":["DS","1","OffsetDistance"],"9905":["CS","1","OffsetDirection"],"9906":["SQ","1","PotentialScheduledProtocolCodeSequence"],"9907":["SQ","1","PotentialRequestedProcedureCodeSequence"],"9908":["UC","1-n","PotentialReasonsForProcedure"],"9909":["SQ","1","PotentialReasonsForProcedureCodeSequence"],"9910":["UT","1","ProtocolDesignRationale"],"9911":["SQ","1","PatientSpecificationSequence"],"9912":["SQ","1","ModelSpecificationSequence"],"9913":["SQ","1","ParametersSpecificationSequence"],"9914":["SQ","1","InstructionSequence"],"9915":["US","1","InstructionIndex"],"9916":["LO","1","InstructionText"],"9917":["UT","1","InstructionDescription"],"9918":["CS","1","InstructionPerformedFlag"],"9919":["DT","1","InstructionPerformedDateTime"],"9920":["SQ","1","AcquisitionProtocolElementSequence"],"9921":["US","1","ProtocolElementNumber"],"9922":["LO","1","ProtocolElementName"],"9923":["UT","1","ProtocolElementCharacteristicsSummary"],"9924":["UT","1","ProtocolElementPurpose"],"9930":["CS","1","AcquisitionMotion"],"9931":["SQ","1","AcquisitionStartLocationSequence"],"9932":["SQ","1","AcquisitionEndLocationSequence"],"9933":["SQ","1","ReconstructionProtocolElementSpecificationSequence"],"9934":["SQ","1","ReconstructionProtocolElementSequence"],"9935":["SQ","1","StorageProtocolElementSpecificationSequence"],"9936":["SQ","1","StorageProtocolElementSequence"],"9937":["LO","1","RequestedSeriesDescription"],"9938":["US","1-n","SourceAcquisitionProtocolElementNumber"],"9939":["US","1-n","SourceAcquisitionBeamNumber"],"9941":["UT","1","ImageFilterDescription"],"9942":["FD","1","CTDIvolNotificationTrigger"],"9943":["FD","1","DLPNotificationTrigger"],"9944":["CS","1","AutoKVPSelectionType"],"9945":["FD","1","AutoKVPUpperBound"],"9946":["FD","1","AutoKVPLowerBound"],"9947":["CS","1","ProtocolDefinedPatientPosition"],"0000":["UL","1","GenericGroupLength"],"0010":["LO","1","ContrastBolusAgent"],"0012":["SQ","1","ContrastBolusAgentSequence"],"0013":["FL","1","ContrastBolusT1Relaxivity"],"0014":["SQ","1","ContrastBolusAdministrationRouteSequence"],"0015":["CS","1","BodyPartExamined"],"0020":["CS","1-n","ScanningSequence"],"0021":["CS","1-n","SequenceVariant"],"0022":["CS","1-n","ScanOptions"],"0023":["CS","1","MRAcquisitionType"],"0024":["SH","1","SequenceName"],"0025":["CS","1","AngioFlag"],"0026":["SQ","1","InterventionDrugInformationSequence"],"0027":["TM","1","InterventionDrugStopTime"],"0028":["DS","1","InterventionDrugDose"],"0029":["SQ","1","InterventionDrugCodeSequence"],"002A":["SQ","1","AdditionalDrugSequence"],"0030":["LO","1-n","Radionuclide"],"0031":["LO","1","Radiopharmaceutical"],"0032":["DS","1","EnergyWindowCenterline"],"0033":["DS","1-n","EnergyWindowTotalWidth"],"0034":["LO","1","InterventionDrugName"],"0035":["TM","1","InterventionDrugStartTime"],"0036":["SQ","1","InterventionSequence"],"0037":["CS","1","TherapyType"],"0038":["CS","1","InterventionStatus"],"0039":["CS","1","TherapyDescription"],"003A":["ST","1","InterventionDescription"],"0040":["IS","1","CineRate"],"0042":["CS","1","InitialCineRunState"],"0050":["DS","1","SliceThickness"],"0060":["DS","1","KVP"],"0061":["DS","1",""],"0070":["IS","1","CountsAccumulated"],"0071":["CS","1","AcquisitionTerminationCondition"],"0072":["DS","1","EffectiveDuration"],"0073":["CS","1","AcquisitionStartCondition"],"0074":["IS","1","AcquisitionStartConditionData"],"0075":["IS","1","AcquisitionTerminationConditionData"],"0080":["DS","1","RepetitionTime"],"0081":["DS","1","EchoTime"],"0082":["DS","1","InversionTime"],"0083":["DS","1","NumberOfAverages"],"0084":["DS","1","ImagingFrequency"],"0085":["SH","1","ImagedNucleus"],"0086":["IS","1-n","EchoNumbers"],"0087":["DS","1","MagneticFieldStrength"],"0088":["DS","1","SpacingBetweenSlices"],"0089":["IS","1","NumberOfPhaseEncodingSteps"],"0090":["DS","1","DataCollectionDiameter"],"0091":["IS","1","EchoTrainLength"],"0093":["DS","1","PercentSampling"],"0094":["DS","1","PercentPhaseFieldOfView"],"0095":["DS","1","PixelBandwidth"],"100A":["SQ","1","UDISequence"],"100B":["UI","1-n","ManufacturerDeviceClassUID"],"101A":["LO","1-n","HardcopyDeviceSoftwareVersion"],"101B":["LO","1","HardcopyDeviceManufacturerModelName"],"106A":["CS","1","SynchronizationTrigger"],"106C":["US","2","SynchronizationChannel"],"106E":["UL","1","TriggerSamplePosition"],"113A":["CS","1","TableType"],"115A":["CS","1","RadiationMode"],"115E":["DS","1","ImageAndFluoroscopyAreaDoseProduct"],"11A0":["DS","1","BodyPartThickness"],"11A2":["DS","1","CompressionForce"],"11A3":["DS","1","CompressionPressure"],"11A4":["LO","1","PaddleDescription"],"11A5":["DS","1","CompressionContactArea"],"11B0":["LO","1","AcquisitionMode"],"11B1":["LO","1","DoseModeName"],"11B2":["CS","1","AcquiredSubtractionMaskFlag"],"11B3":["CS","1","FluoroscopyPersistenceFlag"],"11B4":["CS","1","FluoroscopyLastImageHoldPersistenceFlag"],"11B5":["IS","1","UpperLimitNumberOfPersistentFluoroscopyFrames"],"11B6":["CS","1","ContrastBolusAutoInjectionTriggerFlag"],"11B7":["FD","1","ContrastBolusInjectionDelay"],"11B8":["SQ","1","XAAcquisitionPhaseDetailsSequence"],"11B9":["FD","1","XAAcquisitionFrameRate"],"11BA":["SQ","1","XAPlaneDetailsSequence"],"11BB":["LO","1","AcquisitionFieldOfViewLabel"],"11BC":["SQ","1","XRayFilterDetailsSequence"],"11BD":["FD","1","XAAcquisitionDuration"],"11BE":["CS","1","ReconstructionPipelineType"],"11BF":["SQ","1","ImageFilterDetailsSequence"],"11C0":["CS","1","AppliedMaskSubtractionFlag"],"11C1":["SQ","1","RequestedSeriesDescriptionCodeSequence"],"601A":["UL","1","RegionLocationMinY0"],"601C":["UL","1","RegionLocationMaxX1"],"601E":["UL","1","RegionLocationMaxY1"],"602A":["FD","1","ReferencePixelPhysicalValueY"],"602C":["FD","1","PhysicalDeltaX"],"602E":["FD","1","PhysicalDeltaY"],"603A":["UL","1","DopplerSampleVolumeYPositionRetired"],"603B":["SL","1","DopplerSampleVolumeYPosition"],"603C":["UL","1","TMLinePositionX0Retired"],"603D":["SL","1","TMLinePositionX0"],"603E":["UL","1","TMLinePositionY0Retired"],"603F":["SL","1","TMLinePositionY0"],"604A":["UL","1","PixelComponentRangeStop"],"604C":["US","1","PixelComponentPhysicalUnits"],"604E":["US","1","PixelComponentDataType"],"605A":["FL","1-n","TableOfParameterValues"],"700A":["SH","1","DetectorID"],"700C":["DA","1","DateOfLastDetectorCalibration"],"700E":["TM","1","TimeOfLastDetectorCalibration"],"701A":["DS","2","DetectorBinning"],"702A":["LO","1","DetectorManufacturerName"],"702B":["LO","1","DetectorManufacturerModelName"],"704C":["DS","1","GridFocalDistance"],"925A":["FD","1","ASLCrusherFlowLimit"],"925B":["LO","1","ASLCrusherDescription"],"925C":["CS","1","ASLBolusCutoffFlag"],"925D":["SQ","1","ASLBolusCutoffTimingSequence"],"925E":["LO","1","ASLBolusCutoffTechnique"],"925F":["UL","1","ASLBolusCutoffDelayTime"],"936A":["DT","1","SourceEndDateTime"],"936B":["US","1","SwitchingPhaseNumber"],"936C":["DS","1","SwitchingPhaseNominalDuration"],"936D":["DS","1","SwitchingPhaseTransitionDuration"],"936E":["DS","1","EffectiveBinEnergy"],"936F":["SQ","1","MultienergyCTXRayDetectorSequence"],"937A":["US","1","MultienergyCTPathIndex"],"937B":["UT","1","MultienergyAcquisitionDescription"],"937C":["FD","1","MonoenergeticEnergyEquivalent"],"937D":["SQ","1","MaterialCodeSequence"],"937E":["CS","1","DecompositionMethod"],"937F":["UT","1","DecompositionDescription"],"980B":["CS","1","AliasedDataType"],"980C":["CS","1","PositionMeasuringDeviceUsed"],"980D":["SQ","1","TransducerGeometryCodeSequence"],"980E":["SQ","1","TransducerBeamSteeringCodeSequence"],"980F":["SQ","1","TransducerApplicationCodeSequence"],"990A":["UC","1-n","PotentialDiagnosticTasks"],"990B":["SQ","1","ContraindicationsCodeSequence"],"990C":["SQ","1","ReferencedDefinedProtocolSequence"],"990D":["SQ","1","ReferencedPerformedProtocolSequence"],"990E":["SQ","1","PredecessorProtocolSequence"],"990F":["UT","1","ProtocolPlanningInformation"],"991A":["UT","1","InstructionPerformanceComment"],"991B":["SQ","1","PatientPositioningInstructionSequence"],"991C":["SQ","1","PositioningMethodCodeSequence"],"991D":["SQ","1","PositioningLandmarkSequence"],"991E":["UI","1","TargetFrameOfReferenceUID"],"991F":["SQ","1","AcquisitionProtocolElementSpecificationSequence"],"993A":["US","1-n","SourceReconstructionProtocolElementNumber"],"993B":["SQ","1","ReconstructionStartLocationSequence"],"993C":["SQ","1","ReconstructionEndLocationSequence"],"993D":["SQ","1","ReconstructionAlgorithmSequence"],"993E":["SQ","1","ReconstructionTargetCenterLocationSequence"],"A001":["SQ","1","ContributingEquipmentSequence"],"A002":["DT","1","ContributionDateTime"],"A003":["ST","1","ContributionDescription"]},"0020":{"1000":["IS","1","SeriesInStudy"],"1001":["IS","1","AcquisitionsInSeries"],"1002":["IS","1","ImagesInAcquisition"],"1003":["IS","1","ImagesInSeries"],"1004":["IS","1","AcquisitionsInStudy"],"1005":["IS","1","ImagesInStudy"],"1020":["LO","1-n","Reference"],"1040":["LO","1","PositionReferenceIndicator"],"1041":["DS","1","SliceLocation"],"1070":["IS","1-n","OtherStudyNumbers"],"1200":["IS","1","NumberOfPatientRelatedStudies"],"1202":["IS","1","NumberOfPatientRelatedSeries"],"1204":["IS","1","NumberOfPatientRelatedInstances"],"1206":["IS","1","NumberOfStudyRelatedSeries"],"1208":["IS","1","NumberOfStudyRelatedInstances"],"1209":["IS","1","NumberOfSeriesRelatedInstances"],"3100":["CS","1-n","SourceImageIDs"],"3401":["CS","1","ModifyingDeviceID"],"3402":["CS","1","ModifiedImageID"],"3403":["DA","1","ModifiedImageDate"],"3404":["LO","1","ModifyingDeviceManufacturer"],"3405":["TM","1","ModifiedImageTime"],"3406":["LO","1","ModifiedImageDescription"],"4000":["LT","1","ImageComments"],"5000":["AT","1-n","OriginalImageIdentification"],"5002":["LO","1-n","OriginalImageIdentificationNomenclature"],"9056":["SH","1","StackID"],"9057":["UL","1","InStackPositionNumber"],"9071":["SQ","1","FrameAnatomySequence"],"9072":["CS","1","FrameLaterality"],"9111":["SQ","1","FrameContentSequence"],"9113":["SQ","1","PlanePositionSequence"],"9116":["SQ","1","PlaneOrientationSequence"],"9128":["UL","1","TemporalPositionIndex"],"9153":["FD","1","NominalCardiacTriggerDelayTime"],"9154":["FL","1","NominalCardiacTriggerTimePriorToRPeak"],"9155":["FL","1","ActualCardiacTriggerTimePriorToRPeak"],"9156":["US","1","FrameAcquisitionNumber"],"9157":["UL","1-n","DimensionIndexValues"],"9158":["LT","1","FrameComments"],"9161":["UI","1","ConcatenationUID"],"9162":["US","1","InConcatenationNumber"],"9163":["US","1","InConcatenationTotalNumber"],"9164":["UI","1","DimensionOrganizationUID"],"9165":["AT","1","DimensionIndexPointer"],"9167":["AT","1","FunctionalGroupPointer"],"9170":["SQ","1","UnassignedSharedConvertedAttributesSequence"],"9171":["SQ","1","UnassignedPerFrameConvertedAttributesSequence"],"9172":["SQ","1","ConversionSourceAttributesSequence"],"9213":["LO","1","DimensionIndexPrivateCreator"],"9221":["SQ","1","DimensionOrganizationSequence"],"9222":["SQ","1","DimensionIndexSequence"],"9228":["UL","1","ConcatenationFrameOffsetNumber"],"9238":["LO","1","FunctionalGroupPrivateCreator"],"9241":["FL","1","NominalPercentageOfCardiacPhase"],"9245":["FL","1","NominalPercentageOfRespiratoryPhase"],"9246":["FL","1","StartingRespiratoryAmplitude"],"9247":["CS","1","StartingRespiratoryPhase"],"9248":["FL","1","EndingRespiratoryAmplitude"],"9249":["CS","1","EndingRespiratoryPhase"],"9250":["CS","1","RespiratoryTriggerType"],"9251":["FD","1","RRIntervalTimeNominal"],"9252":["FD","1","ActualCardiacTriggerDelayTime"],"9253":["SQ","1","RespiratorySynchronizationSequence"],"9254":["FD","1","RespiratoryIntervalTime"],"9255":["FD","1","NominalRespiratoryTriggerDelayTime"],"9256":["FD","1","RespiratoryTriggerDelayThreshold"],"9257":["FD","1","ActualRespiratoryTriggerDelayTime"],"9301":["FD","3","ImagePositionVolume"],"9302":["FD","6","ImageOrientationVolume"],"9307":["CS","1","UltrasoundAcquisitionGeometry"],"9308":["FD","3","ApexPosition"],"9309":["FD","16","VolumeToTransducerMappingMatrix"],"9310":["SQ","1","TemporalPositionSequence"],"9311":["CS","1","DimensionOrganizationType"],"9312":["UI","1","VolumeFrameOfReferenceUID"],"9313":["UI","1","TableFrameOfReferenceUID"],"9421":["LO","1","DimensionDescriptionLabel"],"9450":["SQ","1","PatientOrientationInFrameSequence"],"9453":["LO","1","FrameLabel"],"9518":["US","1-n","AcquisitionIndex"],"9529":["SQ","1","ContributingSOPInstancesReferenceSequence"],"9536":["US","1","ReconstructionIndex"],"0000":["UL","1","GenericGroupLength"],"000D":["UI","1","StudyInstanceUID"],"000E":["UI","1","SeriesInstanceUID"],"0010":["SH","1","StudyID"],"0011":["IS","1","SeriesNumber"],"0012":["IS","1","AcquisitionNumber"],"0013":["IS","1","InstanceNumber"],"0014":["IS","1","IsotopeNumber"],"0015":["IS","1","PhaseNumber"],"0016":["IS","1","IntervalNumber"],"0017":["IS","1","TimeSlotNumber"],"0018":["IS","1","AngleNumber"],"0019":["IS","1","ItemNumber"],"0020":["CS","2","PatientOrientation"],"0022":["IS","1","OverlayNumber"],"0024":["IS","1","CurveNumber"],"0026":["IS","1","LUTNumber"],"0030":["DS","3","ImagePosition"],"0032":["DS","3","ImagePositionPatient"],"0035":["DS","6","ImageOrientation"],"0037":["DS","6","ImageOrientationPatient"],"0050":["DS","1","Location"],"0052":["UI","1","FrameOfReferenceUID"],"0060":["CS","1","Laterality"],"0062":["CS","1","ImageLaterality"],"0070":["LO","1","ImageGeometryType"],"0080":["CS","1-n","MaskingImage"],"00AA":["IS","1","ReportNumber"],"0100":["IS","1","TemporalPositionIdentifier"],"0105":["IS","1","NumberOfTemporalPositions"],"0110":["DS","1","TemporalResolution"],"0200":["UI","1","SynchronizationFrameOfReferenceUID"],"0242":["UI","1","SOPInstanceUIDOfConcatenationSource"],"103F":["LO","1","TargetPositionReferenceIndicator"],"930A":["FD","16","VolumeToTableMappingMatrix"],"930B":["CS","1","VolumeToTransducerRelationship"],"930C":["CS","1","PatientFrameOfReferenceSource"],"930D":["FD","1","TemporalPositionTimeOffset"],"930E":["SQ","1","PlanePositionVolumeSequence"],"930F":["SQ","1","PlaneOrientationVolumeSequence"]},"0022":{"1007":["SQ","1","OphthalmicAxialMeasurementsRightEyeSequence"],"1008":["SQ","1","OphthalmicAxialMeasurementsLeftEyeSequence"],"1009":["CS","1","OphthalmicAxialMeasurementsDeviceType"],"1010":["CS","1","OphthalmicAxialLengthMeasurementsType"],"1012":["SQ","1","OphthalmicAxialLengthSequence"],"1019":["FL","1","OphthalmicAxialLength"],"1024":["SQ","1","LensStatusCodeSequence"],"1025":["SQ","1","VitreousStatusCodeSequence"],"1028":["SQ","1","IOLFormulaCodeSequence"],"1029":["LO","1","IOLFormulaDetail"],"1033":["FL","1","KeratometerIndex"],"1035":["SQ","1","SourceOfOphthalmicAxialLengthCodeSequence"],"1036":["SQ","1","SourceOfCornealSizeDataCodeSequence"],"1037":["FL","1","TargetRefraction"],"1039":["CS","1","RefractiveProcedureOccurred"],"1040":["SQ","1","RefractiveSurgeryTypeCodeSequence"],"1044":["SQ","1","OphthalmicUltrasoundMethodCodeSequence"],"1045":["SQ","1","SurgicallyInducedAstigmatismSequence"],"1046":["CS","1","TypeOfOpticalCorrection"],"1047":["SQ","1","ToricIOLPowerSequence"],"1048":["SQ","1","PredictedToricErrorSequence"],"1049":["CS","1","PreSelectedForImplantation"],"1050":["SQ","1","OphthalmicAxialLengthMeasurementsSequence"],"1053":["FL","1","IOLPower"],"1054":["FL","1","PredictedRefractiveError"],"1059":["FL","1","OphthalmicAxialLengthVelocity"],"1065":["LO","1","LensStatusDescription"],"1066":["LO","1","VitreousStatusDescription"],"1090":["SQ","1","IOLPowerSequence"],"1092":["SQ","1","LensConstantSequence"],"1093":["LO","1","IOLManufacturer"],"1094":["LO","1","LensConstantDescription"],"1095":["LO","1","ImplantName"],"1096":["SQ","1","KeratometryMeasurementTypeCodeSequence"],"1097":["LO","1","ImplantPartNumber"],"1100":["SQ","1","ReferencedOphthalmicAxialMeasurementsSequence"],"1101":["SQ","1","OphthalmicAxialLengthMeasurementsSegmentNameCodeSequence"],"1103":["SQ","1","RefractiveErrorBeforeRefractiveSurgeryCodeSequence"],"1121":["FL","1","IOLPowerForExactEmmetropia"],"1122":["FL","1","IOLPowerForExactTargetRefraction"],"1125":["SQ","1","AnteriorChamberDepthDefinitionCodeSequence"],"1127":["SQ","1","LensThicknessSequence"],"1128":["SQ","1","AnteriorChamberDepthSequence"],"1130":["FL","1","LensThickness"],"1131":["FL","1","AnteriorChamberDepth"],"1132":["SQ","1","SourceOfLensThicknessDataCodeSequence"],"1133":["SQ","1","SourceOfAnteriorChamberDepthDataCodeSequence"],"1134":["SQ","1","SourceOfRefractiveMeasurementsSequence"],"1135":["SQ","1","SourceOfRefractiveMeasurementsCodeSequence"],"1140":["CS","1","OphthalmicAxialLengthMeasurementModified"],"1150":["SQ","1","OphthalmicAxialLengthDataSourceCodeSequence"],"1153":["SQ","1","OphthalmicAxialLengthAcquisitionMethodCodeSequence"],"1155":["FL","1","SignalToNoiseRatio"],"1159":["LO","1","OphthalmicAxialLengthDataSourceDescription"],"1210":["SQ","1","OphthalmicAxialLengthMeasurementsTotalLengthSequence"],"1211":["SQ","1","OphthalmicAxialLengthMeasurementsSegmentalLengthSequence"],"1212":["SQ","1","OphthalmicAxialLengthMeasurementsLengthSummationSequence"],"1220":["SQ","1","UltrasoundOphthalmicAxialLengthMeasurementsSequence"],"1225":["SQ","1","OpticalOphthalmicAxialLengthMeasurementsSequence"],"1230":["SQ","1","UltrasoundSelectedOphthalmicAxialLengthSequence"],"1250":["SQ","1","OphthalmicAxialLengthSelectionMethodCodeSequence"],"1255":["SQ","1","OpticalSelectedOphthalmicAxialLengthSequence"],"1257":["SQ","1","SelectedSegmentalOphthalmicAxialLengthSequence"],"1260":["SQ","1","SelectedTotalOphthalmicAxialLengthSequence"],"1262":["SQ","1","OphthalmicAxialLengthQualityMetricSequence"],"1265":["SQ","1","OphthalmicAxialLengthQualityMetricTypeCodeSequence"],"1273":["LO","1","OphthalmicAxialLengthQualityMetricTypeDescription"],"1300":["SQ","1","IntraocularLensCalculationsRightEyeSequence"],"1310":["SQ","1","IntraocularLensCalculationsLeftEyeSequence"],"1330":["SQ","1","ReferencedOphthalmicAxialLengthMeasurementQCImageSequence"],"1415":["CS","1","OphthalmicMappingDeviceType"],"1420":["SQ","1","AcquisitionMethodCodeSequence"],"1423":["SQ","1","AcquisitionMethodAlgorithmSequence"],"1436":["SQ","1","OphthalmicThicknessMapTypeCodeSequence"],"1443":["SQ","1","OphthalmicThicknessMappingNormalsSequence"],"1445":["SQ","1","RetinalThicknessDefinitionCodeSequence"],"1450":["SQ","1","PixelValueMappingToCodedConceptSequence"],"1452":["xs","1","MappedPixelValue"],"1454":["LO","1","PixelValueMappingExplanation"],"1458":["SQ","1","OphthalmicThicknessMapQualityThresholdSequence"],"1460":["FL","1","OphthalmicThicknessMapThresholdQualityRating"],"1463":["FL","2","AnatomicStructureReferencePoint"],"1465":["SQ","1","RegistrationToLocalizerSequence"],"1466":["CS","1","RegisteredLocalizerUnits"],"1467":["FL","2","RegisteredLocalizerTopLeftHandCorner"],"1468":["FL","2","RegisteredLocalizerBottomRightHandCorner"],"1470":["SQ","1","OphthalmicThicknessMapQualityRatingSequence"],"1472":["SQ","1","RelevantOPTAttributesSequence"],"1512":["SQ","1","TransformationMethodCodeSequence"],"1513":["SQ","1","TransformationAlgorithmSequence"],"1515":["CS","1","OphthalmicAxialLengthMethod"],"1517":["FL","1","OphthalmicFOV"],"1518":["SQ","1","TwoDimensionalToThreeDimensionalMapSequence"],"1525":["SQ","1","WideFieldOphthalmicPhotographyQualityRatingSequence"],"1526":["SQ","1","WideFieldOphthalmicPhotographyQualityThresholdSequence"],"1527":["FL","1","WideFieldOphthalmicPhotographyThresholdQualityRating"],"1528":["FL","1","XCoordinatesCenterPixelViewAngle"],"1529":["FL","1","YCoordinatesCenterPixelViewAngle"],"1530":["UL","1","NumberOfMapPoints"],"1531":["OF","1","TwoDimensionalToThreeDimensionalMapData"],"1612":["SQ","1","DerivationAlgorithmSequence"],"1615":["SQ","1","OphthalmicImageTypeCodeSequence"],"1616":["LO","1","OphthalmicImageTypeDescription"],"1618":["SQ","1","ScanPatternTypeCodeSequence"],"1620":["SQ","1","ReferencedSurfaceMeshIdentificationSequence"],"1622":["CS","1","OphthalmicVolumetricPropertiesFlag"],"1624":["FL","1","OphthalmicAnatomicReferencePointXCoordinate"],"1626":["FL","1","OphthalmicAnatomicReferencePointYCoordinate"],"1628":["SQ","1","OphthalmicEnFaceImageQualityRatingSequence"],"1630":["DS","1","QualityThreshold"],"1640":["SQ","1","OCTBscanAnalysisAcquisitionParametersSequence"],"1642":["UL","1","NumberOfBscansPerFrame"],"1643":["FL","1","BscanSlabThickness"],"1644":["FL","1","DistanceBetweenBscanSlabs"],"1645":["FL","1","BscanCycleTime"],"1646":["FL","1-n","BscanCycleTimeVector"],"1649":["FL","1","AscanRate"],"1650":["FL","1","BscanRate"],"1658":["UL","1","SurfaceMeshZPixelOffset"],"0000":["UL","1","GenericGroupLength"],"0001":["US","1","LightPathFilterPassThroughWavelength"],"0002":["US","2","LightPathFilterPassBand"],"0003":["US","1","ImagePathFilterPassThroughWavelength"],"0004":["US","2","ImagePathFilterPassBand"],"0005":["CS","1","PatientEyeMovementCommanded"],"0006":["SQ","1","PatientEyeMovementCommandCodeSequence"],"0007":["FL","1","SphericalLensPower"],"0008":["FL","1","CylinderLensPower"],"0009":["FL","1","CylinderAxis"],"000A":["FL","1","EmmetropicMagnification"],"000B":["FL","1","IntraOcularPressure"],"000C":["FL","1","HorizontalFieldOfView"],"000D":["CS","1","PupilDilated"],"000E":["FL","1","DegreeOfDilation"],"0010":["FL","1","StereoBaselineAngle"],"0011":["FL","1","StereoBaselineDisplacement"],"0012":["FL","1","StereoHorizontalPixelOffset"],"0013":["FL","1","StereoVerticalPixelOffset"],"0014":["FL","1","StereoRotation"],"0015":["SQ","1","AcquisitionDeviceTypeCodeSequence"],"0016":["SQ","1","IlluminationTypeCodeSequence"],"0017":["SQ","1","LightPathFilterTypeStackCodeSequence"],"0018":["SQ","1","ImagePathFilterTypeStackCodeSequence"],"0019":["SQ","1","LensesCodeSequence"],"001A":["SQ","1","ChannelDescriptionCodeSequence"],"001B":["SQ","1","RefractiveStateSequence"],"001C":["SQ","1","MydriaticAgentCodeSequence"],"001D":["SQ","1","RelativeImagePositionCodeSequence"],"001E":["FL","1","CameraAngleOfView"],"0020":["SQ","1","StereoPairsSequence"],"0021":["SQ","1","LeftImageSequence"],"0022":["SQ","1","RightImageSequence"],"0028":["CS","1","StereoPairsPresent"],"0030":["FL","1","AxialLengthOfTheEye"],"0031":["SQ","1","OphthalmicFrameLocationSequence"],"0032":["FL","2-2n","ReferenceCoordinates"],"0035":["FL","1","DepthSpatialResolution"],"0036":["FL","1","MaximumDepthDistortion"],"0037":["FL","1","AlongScanSpatialResolution"],"0038":["FL","1","MaximumAlongScanDistortion"],"0039":["CS","1","OphthalmicImageOrientation"],"0041":["FL","1","DepthOfTransverseImage"],"0042":["SQ","1","MydriaticAgentConcentrationUnitsSequence"],"0048":["FL","1","AcrossScanSpatialResolution"],"0049":["FL","1","MaximumAcrossScanDistortion"],"004E":["DS","1","MydriaticAgentConcentration"],"0055":["FL","1","IlluminationWaveLength"],"0056":["FL","1","IlluminationPower"],"0057":["FL","1","IlluminationBandwidth"],"0058":["SQ","1","MydriaticAgentSequence"],"104A":["SQ","1","ToricIOLPowerForExactEmmetropiaSequence"],"104B":["SQ","1","ToricIOLPowerForExactTargetRefractionSequence"],"112A":["SQ","1","CalculationCommentSequence"],"112B":["CS","1","CalculationCommentType"],"112C":["LT","1","CalculationComment"]},"0024":{"0000":["UL","1","GenericGroupLength"],"0010":["FL","1","VisualFieldHorizontalExtent"],"0011":["FL","1","VisualFieldVerticalExtent"],"0012":["CS","1","VisualFieldShape"],"0016":["SQ","1","ScreeningTestModeCodeSequence"],"0018":["FL","1","MaximumStimulusLuminance"],"0020":["FL","1","BackgroundLuminance"],"0021":["SQ","1","StimulusColorCodeSequence"],"0024":["SQ","1","BackgroundIlluminationColorCodeSequence"],"0025":["FL","1","StimulusArea"],"0028":["FL","1","StimulusPresentationTime"],"0032":["SQ","1","FixationSequence"],"0033":["SQ","1","FixationMonitoringCodeSequence"],"0034":["SQ","1","VisualFieldCatchTrialSequence"],"0035":["US","1","FixationCheckedQuantity"],"0036":["US","1","PatientNotProperlyFixatedQuantity"],"0037":["CS","1","PresentedVisualStimuliDataFlag"],"0038":["US","1","NumberOfVisualStimuli"],"0039":["CS","1","ExcessiveFixationLossesDataFlag"],"0040":["CS","1","ExcessiveFixationLosses"],"0042":["US","1","StimuliRetestingQuantity"],"0044":["LT","1","CommentsOnPatientPerformanceOfVisualField"],"0045":["CS","1","FalseNegativesEstimateFlag"],"0046":["FL","1","FalseNegativesEstimate"],"0048":["US","1","NegativeCatchTrialsQuantity"],"0050":["US","1","FalseNegativesQuantity"],"0051":["CS","1","ExcessiveFalseNegativesDataFlag"],"0052":["CS","1","ExcessiveFalseNegatives"],"0053":["CS","1","FalsePositivesEstimateFlag"],"0054":["FL","1","FalsePositivesEstimate"],"0055":["CS","1","CatchTrialsDataFlag"],"0056":["US","1","PositiveCatchTrialsQuantity"],"0057":["CS","1","TestPointNormalsDataFlag"],"0058":["SQ","1","TestPointNormalsSequence"],"0059":["CS","1","GlobalDeviationProbabilityNormalsFlag"],"0060":["US","1","FalsePositivesQuantity"],"0061":["CS","1","ExcessiveFalsePositivesDataFlag"],"0062":["CS","1","ExcessiveFalsePositives"],"0063":["CS","1","VisualFieldTestNormalsFlag"],"0064":["SQ","1","ResultsNormalsSequence"],"0065":["SQ","1","AgeCorrectedSensitivityDeviationAlgorithmSequence"],"0066":["FL","1","GlobalDeviationFromNormal"],"0067":["SQ","1","GeneralizedDefectSensitivityDeviationAlgorithmSequence"],"0068":["FL","1","LocalizedDeviationFromNormal"],"0069":["LO","1","PatientReliabilityIndicator"],"0070":["FL","1","VisualFieldMeanSensitivity"],"0071":["FL","1","GlobalDeviationProbability"],"0072":["CS","1","LocalDeviationProbabilityNormalsFlag"],"0073":["FL","1","LocalizedDeviationProbability"],"0074":["CS","1","ShortTermFluctuationCalculated"],"0075":["FL","1","ShortTermFluctuation"],"0076":["CS","1","ShortTermFluctuationProbabilityCalculated"],"0077":["FL","1","ShortTermFluctuationProbability"],"0078":["CS","1","CorrectedLocalizedDeviationFromNormalCalculated"],"0079":["FL","1","CorrectedLocalizedDeviationFromNormal"],"0080":["CS","1","CorrectedLocalizedDeviationFromNormalProbabilityCalculated"],"0081":["FL","1","CorrectedLocalizedDeviationFromNormalProbability"],"0083":["SQ","1","GlobalDeviationProbabilitySequence"],"0085":["SQ","1","LocalizedDeviationProbabilitySequence"],"0086":["CS","1","FovealSensitivityMeasured"],"0087":["FL","1","FovealSensitivity"],"0088":["FL","1","VisualFieldTestDuration"],"0089":["SQ","1","VisualFieldTestPointSequence"],"0090":["FL","1","VisualFieldTestPointXCoordinate"],"0091":["FL","1","VisualFieldTestPointYCoordinate"],"0092":["FL","1","AgeCorrectedSensitivityDeviationValue"],"0093":["CS","1","StimulusResults"],"0094":["FL","1","SensitivityValue"],"0095":["CS","1","RetestStimulusSeen"],"0096":["FL","1","RetestSensitivityValue"],"0097":["SQ","1","VisualFieldTestPointNormalsSequence"],"0098":["FL","1","QuantifiedDefect"],"0100":["FL","1","AgeCorrectedSensitivityDeviationProbabilityValue"],"0102":["CS","1","GeneralizedDefectCorrectedSensitivityDeviationFlag"],"0103":["FL","1","GeneralizedDefectCorrectedSensitivityDeviationValue"],"0104":["FL","1","GeneralizedDefectCorrectedSensitivityDeviationProbabilityValue"],"0105":["FL","1","MinimumSensitivityValue"],"0106":["CS","1","BlindSpotLocalized"],"0107":["FL","1","BlindSpotXCoordinate"],"0108":["FL","1","BlindSpotYCoordinate"],"0110":["SQ","1","VisualAcuityMeasurementSequence"],"0112":["SQ","1","RefractiveParametersUsedOnPatientSequence"],"0113":["CS","1","MeasurementLaterality"],"0114":["SQ","1","OphthalmicPatientClinicalInformationLeftEyeSequence"],"0115":["SQ","1","OphthalmicPatientClinicalInformationRightEyeSequence"],"0117":["CS","1","FovealPointNormativeDataFlag"],"0118":["FL","1","FovealPointProbabilityValue"],"0120":["CS","1","ScreeningBaselineMeasured"],"0122":["SQ","1","ScreeningBaselineMeasuredSequence"],"0124":["CS","1","ScreeningBaselineType"],"0126":["FL","1","ScreeningBaselineValue"],"0202":["LO","1","AlgorithmSource"],"0306":["LO","1","DataSetName"],"0307":["LO","1","DataSetVersion"],"0308":["LO","1","DataSetSource"],"0309":["LO","1","DataSetDescription"],"0317":["SQ","1","VisualFieldTestReliabilityGlobalIndexSequence"],"0320":["SQ","1","VisualFieldGlobalResultsIndexSequence"],"0325":["SQ","1","DataObservationSequence"],"0338":["CS","1","IndexNormalsFlag"],"0341":["FL","1","IndexProbability"],"0344":["SQ","1","IndexProbabilitySequence"]},"0028":{"1040":["CS","1","PixelIntensityRelationship"],"1041":["SS","1","PixelIntensityRelationshipSign"],"1050":["DS","1-n","WindowCenter"],"1051":["DS","1-n","WindowWidth"],"1052":["DS","1","RescaleIntercept"],"1053":["DS","1","RescaleSlope"],"1054":["LO","1","RescaleType"],"1055":["LO","1-n","WindowCenterWidthExplanation"],"1056":["CS","1","VOILUTFunction"],"1080":["CS","1","GrayScale"],"1090":["CS","1","RecommendedViewingMode"],"1100":["xs","3","GrayLookupTableDescriptor"],"1101":["xs","3","RedPaletteColorLookupTableDescriptor"],"1102":["xs","3","GreenPaletteColorLookupTableDescriptor"],"1103":["xs","3","BluePaletteColorLookupTableDescriptor"],"1104":["US","3","AlphaPaletteColorLookupTableDescriptor"],"1111":["xs","4","LargeRedPaletteColorLookupTableDescriptor"],"1112":["xs","4","LargeGreenPaletteColorLookupTableDescriptor"],"1113":["xs","4","LargeBluePaletteColorLookupTableDescriptor"],"1199":["UI","1","PaletteColorLookupTableUID"],"1200":["xs","1-n or 1","GrayLookupTableData"],"1201":["OW","1","RedPaletteColorLookupTableData"],"1202":["OW","1","GreenPaletteColorLookupTableData"],"1203":["OW","1","BluePaletteColorLookupTableData"],"1204":["OW","1","AlphaPaletteColorLookupTableData"],"1211":["OW","1","LargeRedPaletteColorLookupTableData"],"1212":["OW","1","LargeGreenPaletteColorLookupTableData"],"1213":["OW","1","LargeBluePaletteColorLookupTableData"],"1214":["UI","1","LargePaletteColorLookupTableUID"],"1221":["OW","1","SegmentedRedPaletteColorLookupTableData"],"1222":["OW","1","SegmentedGreenPaletteColorLookupTableData"],"1223":["OW","1","SegmentedBluePaletteColorLookupTableData"],"1224":["OW","1","SegmentedAlphaPaletteColorLookupTableData"],"1230":["SQ","1","StoredValueColorRangeSequence"],"1231":["FD","1","MinimumStoredValueMapped"],"1232":["FD","1","MaximumStoredValueMapped"],"1300":["CS","1","BreastImplantPresent"],"1350":["CS","1","PartialView"],"1351":["ST","1","PartialViewDescription"],"1352":["SQ","1","PartialViewCodeSequence"],"1401":["SQ","1","DataFrameAssignmentSequence"],"1402":["CS","1","DataPathAssignment"],"1403":["US","1","BitsMappedToColorLookupTable"],"1404":["SQ","1","BlendingLUT1Sequence"],"1405":["CS","1","BlendingLUT1TransferFunction"],"1406":["FD","1","BlendingWeightConstant"],"1407":["US","3","BlendingLookupTableDescriptor"],"1408":["OW","1","BlendingLookupTableData"],"1410":["CS","1","AlphaLUTTransferFunction"],"2000":["OB","1","ICCProfile"],"2002":["CS","1","ColorSpace"],"2110":["CS","1","LossyImageCompression"],"2112":["DS","1-n","LossyImageCompressionRatio"],"2114":["CS","1-n","LossyImageCompressionMethod"],"3000":["SQ","1","ModalityLUTSequence"],"3002":["xs","3","LUTDescriptor"],"3003":["LO","1","LUTExplanation"],"3004":["LO","1","ModalityLUTType"],"3006":["xx","1-n or 1","LUTData"],"3010":["SQ","1","VOILUTSequence"],"3110":["SQ","1","SoftcopyVOILUTSequence"],"4000":["LT","1","ImagePresentationComments"],"5000":["SQ","1","BiPlaneAcquisitionSequence"],"6010":["US","1","RepresentativeFrameNumber"],"6020":["US","1-n","FrameNumbersOfInterest"],"6022":["LO","1-n","FrameOfInterestDescription"],"6023":["CS","1-n","FrameOfInterestType"],"6030":["US","1-n","MaskPointers"],"6040":["US","1-n","RWavePointer"],"6100":["SQ","1","MaskSubtractionSequence"],"6101":["CS","1","MaskOperation"],"6102":["US","2-2n","ApplicableFrameRange"],"6110":["US","1-n","MaskFrameNumbers"],"6112":["US","1","ContrastFrameAveraging"],"6114":["FL","2","MaskSubPixelShift"],"6120":["SS","1","TIDOffset"],"6190":["ST","1","MaskOperationExplanation"],"7000":["SQ","1","EquipmentAdministratorSequence"],"7001":["US","1","NumberOfDisplaySubsystems"],"7002":["US","1","CurrentConfigurationID"],"7003":["US","1","DisplaySubsystemID"],"7004":["SH","1","DisplaySubsystemName"],"7005":["LO","1","DisplaySubsystemDescription"],"7006":["CS","1","SystemStatus"],"7007":["LO","1","SystemStatusComment"],"7008":["SQ","1","TargetLuminanceCharacteristicsSequence"],"7009":["US","1","LuminanceCharacteristicsID"],"7010":["SQ","1","DisplaySubsystemQAResultsSequence"],"7011":["SQ","1","ConfigurationQAResultsSequence"],"7012":["SQ","1","MeasurementEquipmentSequence"],"7013":["CS","1-n","MeasurementFunctions"],"7014":["CS","1","MeasurementEquipmentType"],"7015":["SQ","1","VisualEvaluationResultSequence"],"7016":["SQ","1","DisplayCalibrationResultSequence"],"7017":["US","1","DDLValue"],"7018":["FL","2","CIExyWhitePoint"],"7019":["CS","1","DisplayFunctionType"],"7020":["LO","1","LuminanceResponseDescription"],"7021":["CS","1","WhitePointFlag"],"7022":["SQ","1","DisplayDeviceTypeCodeSequence"],"7023":["SQ","1","DisplaySubsystemSequence"],"7024":["SQ","1","LuminanceResultSequence"],"7025":["CS","1","AmbientLightValueSource"],"7026":["CS","1-n","MeasuredCharacteristics"],"7027":["SQ","1","LuminanceUniformityResultSequence"],"7028":["SQ","1","VisualEvaluationTestSequence"],"7029":["CS","1","TestResult"],"9001":["UL","1","DataPointRows"],"9002":["UL","1","DataPointColumns"],"9003":["CS","1","SignalDomainColumns"],"9099":["US","1","LargestMonochromePixelValue"],"9108":["CS","1","DataRepresentation"],"9110":["SQ","1","PixelMeasuresSequence"],"9132":["SQ","1","FrameVOILUTSequence"],"9145":["SQ","1","PixelValueTransformationSequence"],"9235":["CS","1","SignalDomainRows"],"9411":["FL","1","DisplayFilterPercentage"],"9415":["SQ","1","FramePixelShiftSequence"],"9416":["US","1","SubtractionItemID"],"9422":["SQ","1","PixelIntensityRelationshipLUTSequence"],"9443":["SQ","1","FramePixelDataPropertiesSequence"],"9444":["CS","1","GeometricalProperties"],"9445":["FL","1","GeometricMaximumDistortion"],"9446":["CS","1-n","ImageProcessingApplied"],"9454":["CS","1","MaskSelectionMode"],"9474":["CS","1","LUTFunction"],"9478":["FL","1","MaskVisibilityPercentage"],"9501":["SQ","1","PixelShiftSequence"],"9502":["SQ","1","RegionPixelShiftSequence"],"9503":["SS","2-2n","VerticesOfTheRegion"],"9505":["SQ","1","MultiFramePresentationSequence"],"9506":["US","2-2n","PixelShiftFrameRange"],"9507":["US","2-2n","LUTFrameRange"],"9520":["DS","16","ImageToEquipmentMappingMatrix"],"9537":["CS","1","EquipmentCoordinateSystemIdentification"],"0000":["UL","1","GenericGroupLength"],"0002":["US","1","SamplesPerPixel"],"0003":["US","1","SamplesPerPixelUsed"],"0004":["CS","1","PhotometricInterpretation"],"0005":["US","1","ImageDimensions"],"0006":["US","1","PlanarConfiguration"],"0008":["IS","1","NumberOfFrames"],"0009":["AT","1-n","FrameIncrementPointer"],"000A":["AT","1-n","FrameDimensionPointer"],"0010":["US","1","Rows"],"0011":["US","1","Columns"],"0012":["US","1","Planes"],"0014":["US","1","UltrasoundColorDataPresent"],"0020":["","",""],"0030":["DS","2","PixelSpacing"],"0031":["DS","2","ZoomFactor"],"0032":["DS","2","ZoomCenter"],"0034":["IS","2","PixelAspectRatio"],"0040":["CS","1","ImageFormat"],"0050":["LO","1-n","ManipulatedImage"],"0051":["CS","1-n","CorrectedImage"],"005F":["LO","1","CompressionRecognitionCode"],"0060":["CS","1","CompressionCode"],"0061":["SH","1","CompressionOriginator"],"0062":["LO","1","CompressionLabel"],"0063":["SH","1","CompressionDescription"],"0065":["CS","1-n","CompressionSequence"],"0066":["AT","1-n","CompressionStepPointers"],"0068":["US","1","RepeatInterval"],"0069":["US","1","BitsGrouped"],"0070":["US","1-n","PerimeterTable"],"0071":["xs","1","PerimeterValue"],"0080":["US","1","PredictorRows"],"0081":["US","1","PredictorColumns"],"0082":["US","1-n","PredictorConstants"],"0090":["CS","1","BlockedPixels"],"0091":["US","1","BlockRows"],"0092":["US","1","BlockColumns"],"0093":["US","1","RowOverlap"],"0094":["US","1","ColumnOverlap"],"0100":["US","1","BitsAllocated"],"0101":["US","1","BitsStored"],"0102":["US","1","HighBit"],"0103":["US","1","PixelRepresentation"],"0104":["xs","1","SmallestValidPixelValue"],"0105":["xs","1","LargestValidPixelValue"],"0106":["xs","1","SmallestImagePixelValue"],"0107":["xs","1","LargestImagePixelValue"],"0108":["xs","1","SmallestPixelValueInSeries"],"0109":["xs","1","LargestPixelValueInSeries"],"0110":["xs","1","SmallestImagePixelValueInPlane"],"0111":["xs","1","LargestImagePixelValueInPlane"],"0120":["xs","1","PixelPaddingValue"],"0121":["xs","1","PixelPaddingRangeLimit"],"0122":["FL","1","FloatPixelPaddingValue"],"0123":["FD","1","DoubleFloatPixelPaddingValue"],"0124":["FL","1","FloatPixelPaddingRangeLimit"],"0125":["FD","1","DoubleFloatPixelPaddingRangeLimit"],"0200":["US","1","ImageLocation"],"0300":["CS","1","QualityControlImage"],"0301":["CS","1","BurnedInAnnotation"],"0302":["CS","1","RecognizableVisualFeatures"],"0303":["CS","1","LongitudinalTemporalInformationModified"],"0304":["UI","1","ReferencedColorPaletteInstanceUID"],"0400":["LO","1","TransformLabel"],"0401":["LO","1","TransformVersionNumber"],"0402":["US","1","NumberOfTransformSteps"],"0403":["LO","1-n","SequenceOfCompressedData"],"0404":["AT","1-n","DetailsOfCoefficients"],"04x0":["US","1","RowsForNthOrderCoefficients"],"04x1":["US","1","ColumnsForNthOrderCoefficients"],"04x2":["LO","1-n","CoefficientCoding"],"04x3":["AT","1-n","CoefficientCodingPointers"],"0700":["LO","1","DCTLabel"],"0701":["CS","1-n","DataBlockDescription"],"0702":["AT","1-n","DataBlock"],"0710":["US","1","NormalizationFactorFormat"],"0720":["US","1","ZonalMapNumberFormat"],"0721":["AT","1-n","ZonalMapLocation"],"0722":["US","1","ZonalMapFormat"],"0730":["US","1","AdaptiveMapFormat"],"0740":["US","1","CodeNumberFormat"],"08x0":["CS","1-n","CodeLabel"],"08x2":["US","1","NumberOfTables"],"08x3":["AT","1-n","CodeTableLocation"],"08x4":["US","1","BitsForCodeWord"],"08x8":["AT","1-n","ImageDataLocation"],"0A02":["CS","1","PixelSpacingCalibrationType"],"0A04":["LO","1","PixelSpacingCalibrationDescription"],"135A":["CS","1","SpatialLocationsPreserved"],"140B":["SQ","1","EnhancedPaletteColorLookupTableSequence"],"140C":["SQ","1","BlendingLUT2Sequence"],"140D":["CS","1","BlendingLUT2TransferFunction"],"140E":["CS","1","DataPathID"],"140F":["CS","1","RGBLUTTransferFunction"],"700A":["SQ","1","DisplaySubsystemConfigurationSequence"],"700B":["US","1","ConfigurationID"],"700C":["SH","1","ConfigurationName"],"700D":["LO","1","ConfigurationDescription"],"700E":["US","1","ReferencedTargetLuminanceCharacteristicsID"],"700F":["SQ","1","QAResultsSequence"],"701A":["FL","1","GammaValue"],"701B":["US","1","NumberOfLuminancePoints"],"701C":["SQ","1","LuminanceResponseSequence"],"701D":["FL","1","TargetMinimumLuminance"],"701E":["FL","1","TargetMaximumLuminance"],"701F":["FL","1","LuminanceValue"],"702A":["LO","1","TestResultComment"],"702B":["CS","1","TestImageValidation"],"702C":["SQ","1","TestPatternCodeSequence"],"702D":["SQ","1","MeasurementPatternCodeSequence"],"702E":["SQ","1","VisualEvaluationMethodCodeSequence"],"7FE0":["UR","1","PixelDataProviderURL"]},"0032":{"1000":["DA","1","ScheduledStudyStartDate"],"1001":["TM","1","ScheduledStudyStartTime"],"1010":["DA","1","ScheduledStudyStopDate"],"1011":["TM","1","ScheduledStudyStopTime"],"1020":["LO","1","ScheduledStudyLocation"],"1021":["AE","1-n","ScheduledStudyLocationAETitle"],"1030":["LO","1","ReasonForStudy"],"1031":["SQ","1","RequestingPhysicianIdentificationSequence"],"1032":["PN","1","RequestingPhysician"],"1033":["LO","1","RequestingService"],"1034":["SQ","1","RequestingServiceCodeSequence"],"1040":["DA","1","StudyArrivalDate"],"1041":["TM","1","StudyArrivalTime"],"1050":["DA","1","StudyCompletionDate"],"1051":["TM","1","StudyCompletionTime"],"1055":["CS","1","StudyComponentStatusID"],"1060":["LO","1","RequestedProcedureDescription"],"1064":["SQ","1","RequestedProcedureCodeSequence"],"1065":["SQ","1","RequestedLateralityCodeSequence"],"1066":["UT","1","ReasonForVisit"],"1067":["SQ","1","ReasonForVisitCodeSequence"],"1070":["LO","1","RequestedContrastAgent"],"4000":["LT","1","StudyComments"],"0000":["UL","1","GenericGroupLength"],"000A":["CS","1","StudyStatusID"],"000C":["CS","1","StudyPriorityID"],"0012":["LO","1","StudyIDIssuer"],"0032":["DA","1","StudyVerifiedDate"],"0033":["TM","1","StudyVerifiedTime"],"0034":["DA","1","StudyReadDate"],"0035":["TM","1","StudyReadTime"]},"0034":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","FlowIdentifierSequence"],"0002":["OB","1","FlowIdentifier"],"0003":["UI","1","FlowTransferSyntaxUID"],"0004":["UL","1","FlowRTPSamplingRate"],"0005":["OB","1","SourceIdentifier"],"0007":["OB","1","FrameOriginTimestamp"],"0008":["CS","1","IncludesImagingSubject"],"0009":["SQ","1","FrameUsefulnessGroupSequence"],"000A":["SQ","1","RealTimeBulkDataFlowSequence"],"000B":["SQ","1","CameraPositionGroupSequence"],"000C":["CS","1","IncludesInformation"],"000D":["SQ","1","TimeOfFrameGroupSequence"]},"0038":{"4000":["LT","1","VisitComments"],"0000":["UL","1","GenericGroupLength"],"0004":["SQ","1","ReferencedPatientAliasSequence"],"0008":["CS","1","VisitStatusID"],"0010":["LO","1","AdmissionID"],"0011":["LO","1","IssuerOfAdmissionID"],"0014":["SQ","1","IssuerOfAdmissionIDSequence"],"0016":["LO","1","RouteOfAdmissions"],"001A":["DA","1","ScheduledAdmissionDate"],"001B":["TM","1","ScheduledAdmissionTime"],"001C":["DA","1","ScheduledDischargeDate"],"001D":["TM","1","ScheduledDischargeTime"],"001E":["LO","1","ScheduledPatientInstitutionResidence"],"0020":["DA","1","AdmittingDate"],"0021":["TM","1","AdmittingTime"],"0030":["DA","1","DischargeDate"],"0032":["TM","1","DischargeTime"],"0040":["LO","1","DischargeDiagnosisDescription"],"0044":["SQ","1","DischargeDiagnosisCodeSequence"],"0050":["LO","1","SpecialNeeds"],"0060":["LO","1","ServiceEpisodeID"],"0061":["LO","1","IssuerOfServiceEpisodeID"],"0062":["LO","1","ServiceEpisodeDescription"],"0064":["SQ","1","IssuerOfServiceEpisodeIDSequence"],"0100":["SQ","1","PertinentDocumentsSequence"],"0101":["SQ","1","PertinentResourcesSequence"],"0102":["LO","1","ResourceDescription"],"0300":["LO","1","CurrentPatientLocation"],"0400":["LO","1","PatientInstitutionResidence"],"0500":["LO","1","PatientState"],"0502":["SQ","1","PatientClinicalTrialParticipationSequence"]},"003A":{"0000":["UL","1","GenericGroupLength"],"0004":["CS","1","WaveformOriginality"],"0005":["US","1","NumberOfWaveformChannels"],"0010":["UL","1","NumberOfWaveformSamples"],"001A":["DS","1","SamplingFrequency"],"0020":["SH","1","MultiplexGroupLabel"],"0200":["SQ","1","ChannelDefinitionSequence"],"0202":["IS","1","WaveformChannelNumber"],"0203":["SH","1","ChannelLabel"],"0205":["CS","1-n","ChannelStatus"],"0208":["SQ","1","ChannelSourceSequence"],"0209":["SQ","1","ChannelSourceModifiersSequence"],"020A":["SQ","1","SourceWaveformSequence"],"020C":["LO","1","ChannelDerivationDescription"],"0210":["DS","1","ChannelSensitivity"],"0211":["SQ","1","ChannelSensitivityUnitsSequence"],"0212":["DS","1","ChannelSensitivityCorrectionFactor"],"0213":["DS","1","ChannelBaseline"],"0214":["DS","1","ChannelTimeSkew"],"0215":["DS","1","ChannelSampleSkew"],"0218":["DS","1","ChannelOffset"],"021A":["US","1","WaveformBitsStored"],"0220":["DS","1","FilterLowFrequency"],"0221":["DS","1","FilterHighFrequency"],"0222":["DS","1","NotchFilterFrequency"],"0223":["DS","1","NotchFilterBandwidth"],"0230":["FL","1","WaveformDataDisplayScale"],"0231":["US","3","WaveformDisplayBackgroundCIELabValue"],"0240":["SQ","1","WaveformPresentationGroupSequence"],"0241":["US","1","PresentationGroupNumber"],"0242":["SQ","1","ChannelDisplaySequence"],"0244":["US","3","ChannelRecommendedDisplayCIELabValue"],"0245":["FL","1","ChannelPosition"],"0246":["CS","1","DisplayShadingFlag"],"0247":["FL","1","FractionalChannelDisplayScale"],"0248":["FL","1","AbsoluteChannelDisplayScale"],"0300":["SQ","1","MultiplexedAudioChannelsDescriptionCodeSequence"],"0301":["IS","1","ChannelIdentificationCode"],"0302":["CS","1","ChannelMode"],"0310":["UI","1","MultiplexGroupUID"],"0311":["DS","1","PowerlineFrequency"],"0312":["SQ","1","ChannelImpedanceSequence"],"0313":["DS","1","ImpedanceValue"],"0314":["DT","1","ImpedanceMeasurementDateTime"],"0315":["DS","1","ImpedanceMeasurementFrequency"],"0316":["CS","1","ImpedanceMeasurementCurrentType"]},"0040":{"1001":["SH","1","RequestedProcedureID"],"1002":["LO","1","ReasonForTheRequestedProcedure"],"1003":["SH","1","RequestedProcedurePriority"],"1004":["LO","1","PatientTransportArrangements"],"1005":["LO","1","RequestedProcedureLocation"],"1006":["SH","1","PlacerOrderNumberProcedure"],"1007":["SH","1","FillerOrderNumberProcedure"],"1008":["LO","1","ConfidentialityCode"],"1009":["SH","1","ReportingPriority"],"1010":["PN","1-n","NamesOfIntendedRecipientsOfResults"],"1011":["SQ","1","IntendedRecipientsOfResultsIdentificationSequence"],"1012":["SQ","1","ReasonForPerformedProcedureCodeSequence"],"1060":["LO","1","RequestedProcedureDescriptionTrial"],"1101":["SQ","1","PersonIdentificationCodeSequence"],"1102":["ST","1","PersonAddress"],"1103":["LO","1-n","PersonTelephoneNumbers"],"1104":["LT","1","PersonTelecomInformation"],"1400":["LT","1","RequestedProcedureComments"],"2001":["LO","1","ReasonForTheImagingServiceRequest"],"2004":["DA","1","IssueDateOfImagingServiceRequest"],"2005":["TM","1","IssueTimeOfImagingServiceRequest"],"2006":["SH","1","PlacerOrderNumberImagingServiceRequestRetired"],"2007":["SH","1","FillerOrderNumberImagingServiceRequestRetired"],"2008":["PN","1","OrderEnteredBy"],"2009":["SH","1","OrderEntererLocation"],"2010":["SH","1","OrderCallbackPhoneNumber"],"2011":["LT","1","OrderCallbackTelecomInformation"],"2016":["LO","1","PlacerOrderNumberImagingServiceRequest"],"2017":["LO","1","FillerOrderNumberImagingServiceRequest"],"2400":["LT","1","ImagingServiceRequestComments"],"3001":["LO","1","ConfidentialityConstraintOnPatientDataDescription"],"4001":["CS","1","GeneralPurposeScheduledProcedureStepStatus"],"4002":["CS","1","GeneralPurposePerformedProcedureStepStatus"],"4003":["CS","1","GeneralPurposeScheduledProcedureStepPriority"],"4004":["SQ","1","ScheduledProcessingApplicationsCodeSequence"],"4005":["DT","1","ScheduledProcedureStepStartDateTime"],"4006":["CS","1","MultipleCopiesFlag"],"4007":["SQ","1","PerformedProcessingApplicationsCodeSequence"],"4008":["DT","1","ScheduledProcedureStepExpirationDateTime"],"4009":["SQ","1","HumanPerformerCodeSequence"],"4010":["DT","1","ScheduledProcedureStepModificationDateTime"],"4011":["DT","1","ExpectedCompletionDateTime"],"4015":["SQ","1","ResultingGeneralPurposePerformedProcedureStepsSequence"],"4016":["SQ","1","ReferencedGeneralPurposeScheduledProcedureStepSequence"],"4018":["SQ","1","ScheduledWorkitemCodeSequence"],"4019":["SQ","1","PerformedWorkitemCodeSequence"],"4020":["CS","1","InputAvailabilityFlag"],"4021":["SQ","1","InputInformationSequence"],"4022":["SQ","1","RelevantInformationSequence"],"4023":["UI","1","ReferencedGeneralPurposeScheduledProcedureStepTransactionUID"],"4025":["SQ","1","ScheduledStationNameCodeSequence"],"4026":["SQ","1","ScheduledStationClassCodeSequence"],"4027":["SQ","1","ScheduledStationGeographicLocationCodeSequence"],"4028":["SQ","1","PerformedStationNameCodeSequence"],"4029":["SQ","1","PerformedStationClassCodeSequence"],"4030":["SQ","1","PerformedStationGeographicLocationCodeSequence"],"4031":["SQ","1","RequestedSubsequentWorkitemCodeSequence"],"4032":["SQ","1","NonDICOMOutputCodeSequence"],"4033":["SQ","1","OutputInformationSequence"],"4034":["SQ","1","ScheduledHumanPerformersSequence"],"4035":["SQ","1","ActualHumanPerformersSequence"],"4036":["LO","1","HumanPerformerOrganization"],"4037":["PN","1","HumanPerformerName"],"4040":["CS","1","RawDataHandling"],"4041":["CS","1","InputReadinessState"],"4050":["DT","1","PerformedProcedureStepStartDateTime"],"4051":["DT","1","PerformedProcedureStepEndDateTime"],"4052":["DT","1","ProcedureStepCancellationDateTime"],"4070":["SQ","1","OutputDestinationSequence"],"4071":["SQ","1","DICOMStorageSequence"],"4072":["SQ","1","STOWRSStorageSequence"],"4073":["UR","1","StorageURL"],"4074":["SQ","1","XDSStorageSequence"],"8302":["DS","1","EntranceDoseInmGy"],"8303":["CS","1","EntranceDoseDerivation"],"9092":["SQ","1","ParametricMapFrameTypeSequence"],"9094":["SQ","1","ReferencedImageRealWorldValueMappingSequence"],"9096":["SQ","1","RealWorldValueMappingSequence"],"9098":["SQ","1","PixelValueMappingCodeSequence"],"9210":["SH","1","LUTLabel"],"9211":["xs","1","RealWorldValueLastValueMapped"],"9212":["FD","1-n","RealWorldValueLUTData"],"9213":["FD","1","DoubleFloatRealWorldValueLastValueMapped"],"9214":["FD","1","DoubleFloatRealWorldValueFirstValueMapped"],"9216":["xs","1","RealWorldValueFirstValueMapped"],"9220":["SQ","1","QuantityDefinitionSequence"],"9224":["FD","1","RealWorldValueIntercept"],"9225":["FD","1","RealWorldValueSlope"],"0000":["UL","1","GenericGroupLength"],"0001":["AE","1-n","ScheduledStationAETitle"],"0002":["DA","1","ScheduledProcedureStepStartDate"],"0003":["TM","1","ScheduledProcedureStepStartTime"],"0004":["DA","1","ScheduledProcedureStepEndDate"],"0005":["TM","1","ScheduledProcedureStepEndTime"],"0006":["PN","1","ScheduledPerformingPhysicianName"],"0007":["LO","1","ScheduledProcedureStepDescription"],"0008":["SQ","1","ScheduledProtocolCodeSequence"],"0009":["SH","1","ScheduledProcedureStepID"],"000A":["SQ","1","StageCodeSequence"],"000B":["SQ","1","ScheduledPerformingPhysicianIdentificationSequence"],"0010":["SH","1-n","ScheduledStationName"],"0011":["SH","1","ScheduledProcedureStepLocation"],"0012":["LO","1","PreMedication"],"0020":["CS","1","ScheduledProcedureStepStatus"],"0026":["SQ","1","OrderPlacerIdentifierSequence"],"0027":["SQ","1","OrderFillerIdentifierSequence"],"0031":["UT","1","LocalNamespaceEntityID"],"0032":["UT","1","UniversalEntityID"],"0033":["CS","1","UniversalEntityIDType"],"0035":["CS","1","IdentifierTypeCode"],"0036":["SQ","1","AssigningFacilitySequence"],"0039":["SQ","1","AssigningJurisdictionCodeSequence"],"003A":["SQ","1","AssigningAgencyOrDepartmentCodeSequence"],"0100":["SQ","1","ScheduledProcedureStepSequence"],"0220":["SQ","1","ReferencedNonImageCompositeSOPInstanceSequence"],"0241":["AE","1","PerformedStationAETitle"],"0242":["SH","1","PerformedStationName"],"0243":["SH","1","PerformedLocation"],"0244":["DA","1","PerformedProcedureStepStartDate"],"0245":["TM","1","PerformedProcedureStepStartTime"],"0250":["DA","1","PerformedProcedureStepEndDate"],"0251":["TM","1","PerformedProcedureStepEndTime"],"0252":["CS","1","PerformedProcedureStepStatus"],"0253":["SH","1","PerformedProcedureStepID"],"0254":["LO","1","PerformedProcedureStepDescription"],"0255":["LO","1","PerformedProcedureTypeDescription"],"0260":["SQ","1","PerformedProtocolCodeSequence"],"0261":["CS","1","PerformedProtocolType"],"0270":["SQ","1","ScheduledStepAttributesSequence"],"0275":["SQ","1","RequestAttributesSequence"],"0280":["ST","1","CommentsOnThePerformedProcedureStep"],"0281":["SQ","1","PerformedProcedureStepDiscontinuationReasonCodeSequence"],"0293":["SQ","1","QuantitySequence"],"0294":["DS","1","Quantity"],"0295":["SQ","1","MeasuringUnitsSequence"],"0296":["SQ","1","BillingItemSequence"],"0300":["US","1","TotalTimeOfFluoroscopy"],"0301":["US","1","TotalNumberOfExposures"],"0302":["US","1","EntranceDose"],"0303":["US","1-2","ExposedArea"],"0306":["DS","1","DistanceSourceToEntrance"],"0307":["DS","1","DistanceSourceToSupport"],"030E":["SQ","1","ExposureDoseSequence"],"0310":["ST","1","CommentsOnRadiationDose"],"0312":["DS","1","XRayOutput"],"0314":["DS","1","HalfValueLayer"],"0316":["DS","1","OrganDose"],"0318":["CS","1","OrganExposed"],"0320":["SQ","1","BillingProcedureStepSequence"],"0321":["SQ","1","FilmConsumptionSequence"],"0324":["SQ","1","BillingSuppliesAndDevicesSequence"],"0330":["SQ","1","ReferencedProcedureStepSequence"],"0340":["SQ","1","PerformedSeriesSequence"],"0400":["LT","1","CommentsOnTheScheduledProcedureStep"],"0440":["SQ","1","ProtocolContextSequence"],"0441":["SQ","1","ContentItemModifierSequence"],"0500":["SQ","1","ScheduledSpecimenSequence"],"050A":["LO","1","SpecimenAccessionNumber"],"0512":["LO","1","ContainerIdentifier"],"0513":["SQ","1","IssuerOfTheContainerIdentifierSequence"],"0515":["SQ","1","AlternateContainerIdentifierSequence"],"0518":["SQ","1","ContainerTypeCodeSequence"],"051A":["LO","1","ContainerDescription"],"0520":["SQ","1","ContainerComponentSequence"],"0550":["SQ","1","SpecimenSequence"],"0551":["LO","1","SpecimenIdentifier"],"0552":["SQ","1","SpecimenDescriptionSequenceTrial"],"0553":["ST","1","SpecimenDescriptionTrial"],"0554":["UI","1","SpecimenUID"],"0555":["SQ","1","AcquisitionContextSequence"],"0556":["ST","1","AcquisitionContextDescription"],"0560":["SQ","1","SpecimenDescriptionSequence"],"0562":["SQ","1","IssuerOfTheSpecimenIdentifierSequence"],"059A":["SQ","1","SpecimenTypeCodeSequence"],"0600":["LO","1","SpecimenShortDescription"],"0602":["UT","1","SpecimenDetailedDescription"],"0610":["SQ","1","SpecimenPreparationSequence"],"0612":["SQ","1","SpecimenPreparationStepContentItemSequence"],"0620":["SQ","1","SpecimenLocalizationContentItemSequence"],"06FA":["LO","1","SlideIdentifier"],"0710":["SQ","1","WholeSlideMicroscopyImageFrameTypeSequence"],"071A":["SQ","1","ImageCenterPointCoordinatesSequence"],"072A":["DS","1","XOffsetInSlideCoordinateSystem"],"073A":["DS","1","YOffsetInSlideCoordinateSystem"],"074A":["DS","1","ZOffsetInSlideCoordinateSystem"],"08D8":["SQ","1","PixelSpacingSequence"],"08DA":["SQ","1","CoordinateSystemAxisCodeSequence"],"08EA":["SQ","1","MeasurementUnitsCodeSequence"],"09F8":["SQ","1","VitalStainCodeSequenceTrial"],"100A":["SQ","1","ReasonForRequestedProcedureCodeSequence"],"A007":["CS","1","FindingsFlagTrial"],"A010":["CS","1","RelationshipType"],"A020":["SQ","1","FindingsSequenceTrial"],"A021":["UI","1","FindingsGroupUIDTrial"],"A022":["UI","1","ReferencedFindingsGroupUIDTrial"],"A023":["DA","1","FindingsGroupRecordingDateTrial"],"A024":["TM","1","FindingsGroupRecordingTimeTrial"],"A026":["SQ","1","FindingsSourceCategoryCodeSequenceTrial"],"A027":["LO","1","VerifyingOrganization"],"A028":["SQ","1","DocumentingOrganizationIdentifierCodeSequenceTrial"],"A030":["DT","1","VerificationDateTime"],"A032":["DT","1","ObservationDateTime"],"A033":["DT","1","ObservationStartDateTime"],"A040":["CS","1","ValueType"],"A043":["SQ","1","ConceptNameCodeSequence"],"A047":["LO","1","MeasurementPrecisionDescriptionTrial"],"A050":["CS","1","ContinuityOfContent"],"A057":["CS","1-n","UrgencyOrPriorityAlertsTrial"],"A060":["LO","1","SequencingIndicatorTrial"],"A066":["SQ","1","DocumentIdentifierCodeSequenceTrial"],"A067":["PN","1","DocumentAuthorTrial"],"A068":["SQ","1","DocumentAuthorIdentifierCodeSequenceTrial"],"A070":["SQ","1","IdentifierCodeSequenceTrial"],"A073":["SQ","1","VerifyingObserverSequence"],"A074":["OB","1","ObjectBinaryIdentifierTrial"],"A075":["PN","1","VerifyingObserverName"],"A076":["SQ","1","DocumentingObserverIdentifierCodeSequenceTrial"],"A078":["SQ","1","AuthorObserverSequence"],"A07A":["SQ","1","ParticipantSequence"],"A07C":["SQ","1","CustodialOrganizationSequence"],"A080":["CS","1","ParticipationType"],"A082":["DT","1","ParticipationDateTime"],"A084":["CS","1","ObserverType"],"A085":["SQ","1","ProcedureIdentifierCodeSequenceTrial"],"A088":["SQ","1","VerifyingObserverIdentificationCodeSequence"],"A089":["OB","1","ObjectDirectoryBinaryIdentifierTrial"],"A090":["SQ","1","EquivalentCDADocumentSequence"],"A0B0":["US","2-2n","ReferencedWaveformChannels"],"A110":["DA","1","DateOfDocumentOrVerbalTransactionTrial"],"A112":["TM","1","TimeOfDocumentCreationOrVerbalTransactionTrial"],"A120":["DT","1","DateTime"],"A121":["DA","1","Date"],"A122":["TM","1","Time"],"A123":["PN","1","PersonName"],"A124":["UI","1","UID"],"A125":["CS","2","ReportStatusIDTrial"],"A130":["CS","1","TemporalRangeType"],"A132":["UL","1-n","ReferencedSamplePositions"],"A136":["US","1-n","ReferencedFrameNumbers"],"A138":["DS","1-n","ReferencedTimeOffsets"],"A13A":["DT","1-n","ReferencedDateTime"],"A160":["UT","1","TextValue"],"A161":["FD","1-n","FloatingPointValue"],"A162":["SL","1-n","RationalNumeratorValue"],"A163":["UL","1-n","RationalDenominatorValue"],"A167":["SQ","1","ObservationCategoryCodeSequenceTrial"],"A168":["SQ","1","ConceptCodeSequence"],"A16A":["ST","1","BibliographicCitationTrial"],"A170":["SQ","1","PurposeOfReferenceCodeSequence"],"A171":["UI","1","ObservationUID"],"A172":["UI","1","ReferencedObservationUIDTrial"],"A173":["CS","1","ReferencedObservationClassTrial"],"A174":["CS","1","ReferencedObjectObservationClassTrial"],"A180":["US","1","AnnotationGroupNumber"],"A192":["DA","1","ObservationDateTrial"],"A193":["TM","1","ObservationTimeTrial"],"A194":["CS","1","MeasurementAutomationTrial"],"A195":["SQ","1","ModifierCodeSequence"],"A224":["ST","1","IdentificationDescriptionTrial"],"A290":["CS","1","CoordinatesSetGeometricTypeTrial"],"A296":["SQ","1","AlgorithmCodeSequenceTrial"],"A297":["ST","1","AlgorithmDescriptionTrial"],"A29A":["SL","2-2n","PixelCoordinatesSetTrial"],"A300":["SQ","1","MeasuredValueSequence"],"A301":["SQ","1","NumericValueQualifierCodeSequence"],"A307":["PN","1","CurrentObserverTrial"],"A30A":["DS","1-n","NumericValue"],"A313":["SQ","1","ReferencedAccessionSequenceTrial"],"A33A":["ST","1","ReportStatusCommentTrial"],"A340":["SQ","1","ProcedureContextSequenceTrial"],"A352":["PN","1","VerbalSourceTrial"],"A353":["ST","1","AddressTrial"],"A354":["LO","1","TelephoneNumberTrial"],"A358":["SQ","1","VerbalSourceIdentifierCodeSequenceTrial"],"A360":["SQ","1","PredecessorDocumentsSequence"],"A370":["SQ","1","ReferencedRequestSequence"],"A372":["SQ","1","PerformedProcedureCodeSequence"],"A375":["SQ","1","CurrentRequestedProcedureEvidenceSequence"],"A380":["SQ","1","ReportDetailSequenceTrial"],"A385":["SQ","1","PertinentOtherEvidenceSequence"],"A390":["SQ","1","HL7StructuredDocumentReferenceSequence"],"A402":["UI","1","ObservationSubjectUIDTrial"],"A403":["CS","1","ObservationSubjectClassTrial"],"A404":["SQ","1","ObservationSubjectTypeCodeSequenceTrial"],"A491":["CS","1","CompletionFlag"],"A492":["LO","1","CompletionFlagDescription"],"A493":["CS","1","VerificationFlag"],"A494":["CS","1","ArchiveRequested"],"A496":["CS","1","PreliminaryFlag"],"A504":["SQ","1","ContentTemplateSequence"],"A525":["SQ","1","IdenticalDocumentsSequence"],"A600":["CS","1","ObservationSubjectContextFlagTrial"],"A601":["CS","1","ObserverContextFlagTrial"],"A603":["CS","1","ProcedureContextFlagTrial"],"A730":["SQ","1","ContentSequence"],"A731":["SQ","1","RelationshipSequenceTrial"],"A732":["SQ","1","RelationshipTypeCodeSequenceTrial"],"A744":["SQ","1","LanguageCodeSequenceTrial"],"A801":["SQ","1","TabulatedValuesSequence"],"A802":["UL","1","NumberOfTableRows"],"A803":["UL","1","NumberOfTableColumns"],"A804":["UL","1","TableRowNumber"],"A805":["UL","1","TableColumnNumber"],"A806":["SQ","1","TableRowDefinitionSequence"],"A807":["SQ","1","TableColumnDefinitionSequence"],"A808":["SQ","1","CellValuesSequence"],"A992":["ST","1","UniformResourceLocatorTrial"],"B020":["SQ","1","WaveformAnnotationSequence"],"DB00":["CS","1","TemplateIdentifier"],"DB06":["DT","1","TemplateVersion"],"DB07":["DT","1","TemplateLocalVersion"],"DB0B":["CS","1","TemplateExtensionFlag"],"DB0C":["UI","1","TemplateExtensionOrganizationUID"],"DB0D":["UI","1","TemplateExtensionCreatorUID"],"DB73":["UL","1-n","ReferencedContentItemIdentifier"],"E001":["ST","1","HL7InstanceIdentifier"],"E004":["DT","1","HL7DocumentEffectiveTime"],"E006":["SQ","1","HL7DocumentTypeCodeSequence"],"E008":["SQ","1","DocumentClassCodeSequence"],"E010":["UR","1","RetrieveURI"],"E011":["UI","1","RetrieveLocationUID"],"E020":["CS","1","TypeOfInstances"],"E021":["SQ","1","DICOMRetrievalSequence"],"E022":["SQ","1","DICOMMediaRetrievalSequence"],"E023":["SQ","1","WADORetrievalSequence"],"E024":["SQ","1","XDSRetrievalSequence"],"E025":["SQ","1","WADORSRetrievalSequence"],"E030":["UI","1","RepositoryUniqueID"],"E031":["UI","1","HomeCommunityID"]},"0042":{"0000":["UL","1","GenericGroupLength"],"0010":["ST","1","DocumentTitle"],"0011":["OB","1","EncapsulatedDocument"],"0012":["LO","1","MIMETypeOfEncapsulatedDocument"],"0013":["SQ","1","SourceInstanceSequence"],"0014":["LO","1-n","ListOfMIMETypes"],"0015":["UL","1","EncapsulatedDocumentLength"]},"0044":{"0000":["UL","1","GenericGroupLength"],"0001":["ST","1","ProductPackageIdentifier"],"0002":["CS","1","SubstanceAdministrationApproval"],"0003":["LT","1","ApprovalStatusFurtherDescription"],"0004":["DT","1","ApprovalStatusDateTime"],"0007":["SQ","1","ProductTypeCodeSequence"],"0008":["LO","1-n","ProductName"],"0009":["LT","1","ProductDescription"],"000A":["LO","1","ProductLotIdentifier"],"000B":["DT","1","ProductExpirationDateTime"],"0010":["DT","1","SubstanceAdministrationDateTime"],"0011":["LO","1","SubstanceAdministrationNotes"],"0012":["LO","1","SubstanceAdministrationDeviceID"],"0013":["SQ","1","ProductParameterSequence"],"0019":["SQ","1","SubstanceAdministrationParameterSequence"],"0100":["SQ","1","ApprovalSequence"],"0101":["SQ","1","AssertionCodeSequence"],"0102":["UI","1","AssertionUID"],"0103":["SQ","1","AsserterIdentificationSequence"],"0104":["DT","1","AssertionDateTime"],"0105":["DT","1","AssertionExpirationDateTime"],"0106":["UT","1","AssertionComments"],"0107":["SQ","1","RelatedAssertionSequence"],"0108":["UI","1","ReferencedAssertionUID"],"0109":["SQ","1","ApprovalSubjectSequence"],"010A":["SQ","1","OrganizationalRoleCodeSequence"]},"0046":{"0000":["UL","1","GenericGroupLength"],"0012":["LO","1","LensDescription"],"0014":["SQ","1","RightLensSequence"],"0015":["SQ","1","LeftLensSequence"],"0016":["SQ","1","UnspecifiedLateralityLensSequence"],"0018":["SQ","1","CylinderSequence"],"0028":["SQ","1","PrismSequence"],"0030":["FD","1","HorizontalPrismPower"],"0032":["CS","1","HorizontalPrismBase"],"0034":["FD","1","VerticalPrismPower"],"0036":["CS","1","VerticalPrismBase"],"0038":["CS","1","LensSegmentType"],"0040":["FD","1","OpticalTransmittance"],"0042":["FD","1","ChannelWidth"],"0044":["FD","1","PupilSize"],"0046":["FD","1","CornealSize"],"0047":["SQ","1","CornealSizeSequence"],"0050":["SQ","1","AutorefractionRightEyeSequence"],"0052":["SQ","1","AutorefractionLeftEyeSequence"],"0060":["FD","1","DistancePupillaryDistance"],"0062":["FD","1","NearPupillaryDistance"],"0063":["FD","1","IntermediatePupillaryDistance"],"0064":["FD","1","OtherPupillaryDistance"],"0070":["SQ","1","KeratometryRightEyeSequence"],"0071":["SQ","1","KeratometryLeftEyeSequence"],"0074":["SQ","1","SteepKeratometricAxisSequence"],"0075":["FD","1","RadiusOfCurvature"],"0076":["FD","1","KeratometricPower"],"0077":["FD","1","KeratometricAxis"],"0080":["SQ","1","FlatKeratometricAxisSequence"],"0092":["CS","1","BackgroundColor"],"0094":["CS","1","Optotype"],"0095":["CS","1","OptotypePresentation"],"0097":["SQ","1","SubjectiveRefractionRightEyeSequence"],"0098":["SQ","1","SubjectiveRefractionLeftEyeSequence"],"0100":["SQ","1","AddNearSequence"],"0101":["SQ","1","AddIntermediateSequence"],"0102":["SQ","1","AddOtherSequence"],"0104":["FD","1","AddPower"],"0106":["FD","1","ViewingDistance"],"0110":["SQ","1","CorneaMeasurementsSequence"],"0111":["SQ","1","SourceOfCorneaMeasurementDataCodeSequence"],"0112":["SQ","1","SteepCornealAxisSequence"],"0113":["SQ","1","FlatCornealAxisSequence"],"0114":["FD","1","CornealPower"],"0115":["FD","1","CornealAxis"],"0116":["SQ","1","CorneaMeasurementMethodCodeSequence"],"0117":["FL","1","RefractiveIndexOfCornea"],"0118":["FL","1","RefractiveIndexOfAqueousHumor"],"0121":["SQ","1","VisualAcuityTypeCodeSequence"],"0122":["SQ","1","VisualAcuityRightEyeSequence"],"0123":["SQ","1","VisualAcuityLeftEyeSequence"],"0124":["SQ","1","VisualAcuityBothEyesOpenSequence"],"0125":["CS","1","ViewingDistanceType"],"0135":["SS","2","VisualAcuityModifiers"],"0137":["FD","1","DecimalVisualAcuity"],"0139":["LO","1","OptotypeDetailedDefinition"],"0145":["SQ","1","ReferencedRefractiveMeasurementsSequence"],"0146":["FD","1","SpherePower"],"0147":["FD","1","CylinderPower"],"0201":["CS","1","CornealTopographySurface"],"0202":["FL","2","CornealVertexLocation"],"0203":["FL","1","PupilCentroidXCoordinate"],"0204":["FL","1","PupilCentroidYCoordinate"],"0205":["FL","1","EquivalentPupilRadius"],"0207":["SQ","1","CornealTopographyMapTypeCodeSequence"],"0208":["IS","2-2n","VerticesOfTheOutlineOfPupil"],"0210":["SQ","1","CornealTopographyMappingNormalsSequence"],"0211":["SQ","1","MaximumCornealCurvatureSequence"],"0212":["FL","1","MaximumCornealCurvature"],"0213":["FL","2","MaximumCornealCurvatureLocation"],"0215":["SQ","1","MinimumKeratometricSequence"],"0218":["SQ","1","SimulatedKeratometricCylinderSequence"],"0220":["FL","1","AverageCornealPower"],"0224":["FL","1","CornealISValue"],"0227":["FL","1","AnalyzedArea"],"0230":["FL","1","SurfaceRegularityIndex"],"0232":["FL","1","SurfaceAsymmetryIndex"],"0234":["FL","1","CornealEccentricityIndex"],"0236":["FL","1","KeratoconusPredictionIndex"],"0238":["FL","1","DecimalPotentialVisualAcuity"],"0242":["CS","1","CornealTopographyMapQualityEvaluation"],"0244":["SQ","1","SourceImageCornealProcessedDataSequence"],"0247":["FL","3","CornealPointLocation"],"0248":["CS","1","CornealPointEstimated"],"0249":["FL","1","AxialPower"],"0250":["FL","1","TangentialPower"],"0251":["FL","1","RefractivePower"],"0252":["FL","1","RelativeElevation"],"0253":["FL","1","CornealWavefront"]},"0048":{"0000":["UL","1","GenericGroupLength"],"0001":["FL","1","ImagedVolumeWidth"],"0002":["FL","1","ImagedVolumeHeight"],"0003":["FL","1","ImagedVolumeDepth"],"0006":["UL","1","TotalPixelMatrixColumns"],"0007":["UL","1","TotalPixelMatrixRows"],"0008":["SQ","1","TotalPixelMatrixOriginSequence"],"0010":["CS","1","SpecimenLabelInImage"],"0011":["CS","1","FocusMethod"],"0012":["CS","1","ExtendedDepthOfField"],"0013":["US","1","NumberOfFocalPlanes"],"0014":["FL","1","DistanceBetweenFocalPlanes"],"0015":["US","3","RecommendedAbsentPixelCIELabValue"],"0100":["SQ","1","IlluminatorTypeCodeSequence"],"0102":["DS","6","ImageOrientationSlide"],"0105":["SQ","1","OpticalPathSequence"],"0106":["SH","1","OpticalPathIdentifier"],"0107":["ST","1","OpticalPathDescription"],"0108":["SQ","1","IlluminationColorCodeSequence"],"0110":["SQ","1","SpecimenReferenceSequence"],"0111":["DS","1","CondenserLensPower"],"0112":["DS","1","ObjectiveLensPower"],"0113":["DS","1","ObjectiveLensNumericalAperture"],"0120":["SQ","1","PaletteColorLookupTableSequence"],"0200":["SQ","1","ReferencedImageNavigationSequence"],"0201":["US","2","TopLeftHandCornerOfLocalizerArea"],"0202":["US","2","BottomRightHandCornerOfLocalizerArea"],"0207":["SQ","1","OpticalPathIdentificationSequence"],"021A":["SQ","1","PlanePositionSlideSequence"],"021E":["SL","1","ColumnPositionInTotalImagePixelMatrix"],"021F":["SL","1","RowPositionInTotalImagePixelMatrix"],"0301":["CS","1","PixelOriginInterpretation"],"0302":["UL","1","NumberOfOpticalPaths"],"0303":["UL","1","TotalPixelMatrixFocalPlanes"]},"0050":{"0000":["UL","1","GenericGroupLength"],"0004":["CS","1","CalibrationImage"],"0010":["SQ","1","DeviceSequence"],"0012":["SQ","1","ContainerComponentTypeCodeSequence"],"0013":["FD","1","ContainerComponentThickness"],"0014":["DS","1","DeviceLength"],"0015":["FD","1","ContainerComponentWidth"],"0016":["DS","1","DeviceDiameter"],"0017":["CS","1","DeviceDiameterUnits"],"0018":["DS","1","DeviceVolume"],"0019":["DS","1","InterMarkerDistance"],"001A":["CS","1","ContainerComponentMaterial"],"001B":["LO","1","ContainerComponentID"],"001C":["FD","1","ContainerComponentLength"],"001D":["FD","1","ContainerComponentDiameter"],"001E":["LO","1","ContainerComponentDescription"],"0020":["LO","1","DeviceDescription"],"0021":["ST","1","LongDeviceDescription"]},"0052":{"0000":["UL","1","GenericGroupLength"],"0001":["FL","1","ContrastBolusIngredientPercentByVolume"],"0002":["FD","1","OCTFocalDistance"],"0003":["FD","1","BeamSpotSize"],"0004":["FD","1","EffectiveRefractiveIndex"],"0006":["CS","1","OCTAcquisitionDomain"],"0007":["FD","1","OCTOpticalCenterWavelength"],"0008":["FD","1","AxialResolution"],"0009":["FD","1","RangingDepth"],"0011":["FD","1","ALineRate"],"0012":["US","1","ALinesPerFrame"],"0013":["FD","1","CatheterRotationalRate"],"0014":["FD","1","ALinePixelSpacing"],"0016":["SQ","1","ModeOfPercutaneousAccessSequence"],"0025":["SQ","1","IntravascularOCTFrameTypeSequence"],"0026":["CS","1","OCTZOffsetApplied"],"0027":["SQ","1","IntravascularFrameContentSequence"],"0028":["FD","1","IntravascularLongitudinalDistance"],"0029":["SQ","1","IntravascularOCTFrameContentSequence"],"0030":["SS","1","OCTZOffsetCorrection"],"0031":["CS","1","CatheterDirectionOfRotation"],"0033":["FD","1","SeamLineLocation"],"0034":["FD","1","FirstALineLocation"],"0036":["US","1","SeamLineIndex"],"0038":["US","1","NumberOfPaddedALines"],"0039":["CS","1","InterpolationType"],"003A":["CS","1","RefractiveIndexApplied"]},"0054":{"1000":["CS","2","SeriesType"],"1001":["CS","1","Units"],"1002":["CS","1","CountsSource"],"1004":["CS","1","ReprojectionMethod"],"1006":["CS","1","SUVType"],"1100":["CS","1","RandomsCorrectionMethod"],"1101":["LO","1","AttenuationCorrectionMethod"],"1102":["CS","1","DecayCorrection"],"1103":["LO","1","ReconstructionMethod"],"1104":["LO","1","DetectorLinesOfResponseUsed"],"1105":["LO","1","ScatterCorrectionMethod"],"1200":["DS","1","AxialAcceptance"],"1201":["IS","2","AxialMash"],"1202":["IS","1","TransverseMash"],"1203":["DS","2","DetectorElementSize"],"1210":["DS","1","CoincidenceWindowWidth"],"1220":["CS","1-n","SecondaryCountsType"],"1300":["DS","1","FrameReferenceTime"],"1310":["IS","1","PrimaryPromptsCountsAccumulated"],"1311":["IS","1-n","SecondaryCountsAccumulated"],"1320":["DS","1","SliceSensitivityFactor"],"1321":["DS","1","DecayFactor"],"1322":["DS","1","DoseCalibrationFactor"],"1323":["DS","1","ScatterFractionFactor"],"1324":["DS","1","DeadTimeFactor"],"1330":["US","1","ImageIndex"],"1400":["CS","1-n","CountsIncluded"],"1401":["CS","1","DeadTimeCorrectionFlag"],"0000":["UL","1","GenericGroupLength"],"0010":["US","1-n","EnergyWindowVector"],"0011":["US","1","NumberOfEnergyWindows"],"0012":["SQ","1","EnergyWindowInformationSequence"],"0013":["SQ","1","EnergyWindowRangeSequence"],"0014":["DS","1","EnergyWindowLowerLimit"],"0015":["DS","1","EnergyWindowUpperLimit"],"0016":["SQ","1","RadiopharmaceuticalInformationSequence"],"0017":["IS","1","ResidualSyringeCounts"],"0018":["SH","1","EnergyWindowName"],"0020":["US","1-n","DetectorVector"],"0021":["US","1","NumberOfDetectors"],"0022":["SQ","1","DetectorInformationSequence"],"0030":["US","1-n","PhaseVector"],"0031":["US","1","NumberOfPhases"],"0032":["SQ","1","PhaseInformationSequence"],"0033":["US","1","NumberOfFramesInPhase"],"0036":["IS","1","PhaseDelay"],"0038":["IS","1","PauseBetweenFrames"],"0039":["CS","1","PhaseDescription"],"0050":["US","1-n","RotationVector"],"0051":["US","1","NumberOfRotations"],"0052":["SQ","1","RotationInformationSequence"],"0053":["US","1","NumberOfFramesInRotation"],"0060":["US","1-n","RRIntervalVector"],"0061":["US","1","NumberOfRRIntervals"],"0062":["SQ","1","GatedInformationSequence"],"0063":["SQ","1","DataInformationSequence"],"0070":["US","1-n","TimeSlotVector"],"0071":["US","1","NumberOfTimeSlots"],"0072":["SQ","1","TimeSlotInformationSequence"],"0073":["DS","1","TimeSlotTime"],"0080":["US","1-n","SliceVector"],"0081":["US","1","NumberOfSlices"],"0090":["US","1-n","AngularViewVector"],"0100":["US","1-n","TimeSliceVector"],"0101":["US","1","NumberOfTimeSlices"],"0200":["DS","1","StartAngle"],"0202":["CS","1","TypeOfDetectorMotion"],"0210":["IS","1-n","TriggerVector"],"0211":["US","1","NumberOfTriggersInPhase"],"0220":["SQ","1","ViewCodeSequence"],"0222":["SQ","1","ViewModifierCodeSequence"],"0300":["SQ","1","RadionuclideCodeSequence"],"0302":["SQ","1","AdministrationRouteCodeSequence"],"0304":["SQ","1","RadiopharmaceuticalCodeSequence"],"0306":["SQ","1","CalibrationDataSequence"],"0308":["US","1","EnergyWindowNumber"],"0400":["SH","1","ImageID"],"0410":["SQ","1","PatientOrientationCodeSequence"],"0412":["SQ","1","PatientOrientationModifierCodeSequence"],"0414":["SQ","1","PatientGantryRelationshipCodeSequence"],"0500":["CS","1","SliceProgressionDirection"],"0501":["CS","1","ScanProgressionDirection"]},"0060":{"3000":["SQ","1","HistogramSequence"],"3002":["US","1","HistogramNumberOfBins"],"3004":["xs","1","HistogramFirstBinValue"],"3006":["xs","1","HistogramLastBinValue"],"3008":["US","1","HistogramBinWidth"],"3010":["LO","1","HistogramExplanation"],"3020":["UL","1-n","HistogramData"],"0000":["UL","1","GenericGroupLength"]},"0062":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","SegmentationType"],"0002":["SQ","1","SegmentSequence"],"0003":["SQ","1","SegmentedPropertyCategoryCodeSequence"],"0004":["US","1","SegmentNumber"],"0005":["LO","1","SegmentLabel"],"0006":["ST","1","SegmentDescription"],"0007":["SQ","1","SegmentationAlgorithmIdentificationSequence"],"0008":["CS","1","SegmentAlgorithmType"],"0009":["LO","1-n","SegmentAlgorithmName"],"000A":["SQ","1","SegmentIdentificationSequence"],"000B":["US","1-n","ReferencedSegmentNumber"],"000C":["US","1","RecommendedDisplayGrayscaleValue"],"000D":["US","3","RecommendedDisplayCIELabValue"],"000E":["US","1","MaximumFractionalValue"],"000F":["SQ","1","SegmentedPropertyTypeCodeSequence"],"0010":["CS","1","SegmentationFractionalType"],"0011":["SQ","1","SegmentedPropertyTypeModifierCodeSequence"],"0012":["SQ","1","UsedSegmentsSequence"],"0013":["CS","1","SegmentsOverlap"],"0020":["UT","1","TrackingID"],"0021":["UI","1","TrackingUID"]},"0064":{"0000":["UL","1","GenericGroupLength"],"0002":["SQ","1","DeformableRegistrationSequence"],"0003":["UI","1","SourceFrameOfReferenceUID"],"0005":["SQ","1","DeformableRegistrationGridSequence"],"0007":["UL","3","GridDimensions"],"0008":["FD","3","GridResolution"],"0009":["OF","1","VectorGridData"],"000F":["SQ","1","PreDeformationMatrixRegistrationSequence"],"0010":["SQ","1","PostDeformationMatrixRegistrationSequence"]},"0066":{"0000":["UL","1","GenericGroupLength"],"0001":["UL","1","NumberOfSurfaces"],"0002":["SQ","1","SurfaceSequence"],"0003":["UL","1","SurfaceNumber"],"0004":["LT","1","SurfaceComments"],"0009":["CS","1","SurfaceProcessing"],"000A":["FL","1","SurfaceProcessingRatio"],"000B":["LO","1","SurfaceProcessingDescription"],"000C":["FL","1","RecommendedPresentationOpacity"],"000D":["CS","1","RecommendedPresentationType"],"000E":["CS","1","FiniteVolume"],"0010":["CS","1","Manifold"],"0011":["SQ","1","SurfacePointsSequence"],"0012":["SQ","1","SurfacePointsNormalsSequence"],"0013":["SQ","1","SurfaceMeshPrimitivesSequence"],"0015":["UL","1","NumberOfSurfacePoints"],"0016":["OF","1","PointCoordinatesData"],"0017":["FL","3","PointPositionAccuracy"],"0018":["FL","1","MeanPointDistance"],"0019":["FL","1","MaximumPointDistance"],"001A":["FL","6","PointsBoundingBoxCoordinates"],"001B":["FL","3","AxisOfRotation"],"001C":["FL","3","CenterOfRotation"],"001E":["UL","1","NumberOfVectors"],"001F":["US","1","VectorDimensionality"],"0020":["FL","1-n","VectorAccuracy"],"0021":["OF","1","VectorCoordinateData"],"0022":["OD","1","DoublePointCoordinatesData"],"0023":["OW","1","TrianglePointIndexList"],"0024":["OW","1","EdgePointIndexList"],"0025":["OW","1","VertexPointIndexList"],"0026":["SQ","1","TriangleStripSequence"],"0027":["SQ","1","TriangleFanSequence"],"0028":["SQ","1","LineSequence"],"0029":["OW","1","PrimitivePointIndexList"],"002A":["UL","1","SurfaceCount"],"002B":["SQ","1","ReferencedSurfaceSequence"],"002C":["UL","1","ReferencedSurfaceNumber"],"002D":["SQ","1","SegmentSurfaceGenerationAlgorithmIdentificationSequence"],"002E":["SQ","1","SegmentSurfaceSourceInstanceSequence"],"002F":["SQ","1","AlgorithmFamilyCodeSequence"],"0030":["SQ","1","AlgorithmNameCodeSequence"],"0031":["LO","1","AlgorithmVersion"],"0032":["LT","1","AlgorithmParameters"],"0034":["SQ","1","FacetSequence"],"0035":["SQ","1","SurfaceProcessingAlgorithmIdentificationSequence"],"0036":["LO","1","AlgorithmName"],"0037":["FL","1","RecommendedPointRadius"],"0038":["FL","1","RecommendedLineThickness"],"0040":["OL","1","LongPrimitivePointIndexList"],"0041":["OL","1","LongTrianglePointIndexList"],"0042":["OL","1","LongEdgePointIndexList"],"0043":["OL","1","LongVertexPointIndexList"],"0101":["SQ","1","TrackSetSequence"],"0102":["SQ","1","TrackSequence"],"0103":["OW","1","RecommendedDisplayCIELabValueList"],"0104":["SQ","1","TrackingAlgorithmIdentificationSequence"],"0105":["UL","1","TrackSetNumber"],"0106":["LO","1","TrackSetLabel"],"0107":["UT","1","TrackSetDescription"],"0108":["SQ","1","TrackSetAnatomicalTypeCodeSequence"],"0121":["SQ","1","MeasurementsSequence"],"0124":["SQ","1","TrackSetStatisticsSequence"],"0125":["OF","1","FloatingPointValues"],"0129":["OL","1","TrackPointIndexList"],"0130":["SQ","1","TrackStatisticsSequence"],"0132":["SQ","1","MeasurementValuesSequence"],"0133":["SQ","1","DiffusionAcquisitionCodeSequence"],"0134":["SQ","1","DiffusionModelCodeSequence"]},"0068":{"6210":["LO","1","ImplantSize"],"6221":["LO","1","ImplantTemplateVersion"],"6222":["SQ","1","ReplacedImplantTemplateSequence"],"6223":["CS","1","ImplantType"],"6224":["SQ","1","DerivationImplantTemplateSequence"],"6225":["SQ","1","OriginalImplantTemplateSequence"],"6226":["DT","1","EffectiveDateTime"],"6230":["SQ","1","ImplantTargetAnatomySequence"],"6260":["SQ","1","InformationFromManufacturerSequence"],"6265":["SQ","1","NotificationFromManufacturerSequence"],"6270":["DT","1","InformationIssueDateTime"],"6280":["ST","1","InformationSummary"],"6300":["OB","1","HPGLDocument"],"6310":["US","1","HPGLContourPenNumber"],"6320":["SQ","1","HPGLPenSequence"],"6330":["US","1","HPGLPenNumber"],"6340":["LO","1","HPGLPenLabel"],"6345":["ST","1","HPGLPenDescription"],"6346":["FD","2","RecommendedRotationPoint"],"6347":["FD","4","BoundingRectangle"],"6350":["US","1-n","ImplantTemplate3DModelSurfaceNumber"],"6360":["SQ","1","SurfaceModelDescriptionSequence"],"6380":["LO","1","SurfaceModelLabel"],"6390":["FD","1","SurfaceModelScalingFactor"],"6400":["SQ","1","MatingFeatureDegreeOfFreedomSequence"],"6410":["US","1","DegreeOfFreedomID"],"6420":["CS","1","DegreeOfFreedomType"],"6430":["SQ","1","TwoDMatingFeatureCoordinatesSequence"],"6440":["US","1","ReferencedHPGLDocumentID"],"6450":["FD","2","TwoDMatingPoint"],"6460":["FD","4","TwoDMatingAxes"],"6470":["SQ","1","TwoDDegreeOfFreedomSequence"],"6490":["FD","3","ThreeDDegreeOfFreedomAxis"],"6500":["SQ","1","PlanningLandmarkPointSequence"],"6510":["SQ","1","PlanningLandmarkLineSequence"],"6520":["SQ","1","PlanningLandmarkPlaneSequence"],"6530":["US","1","PlanningLandmarkID"],"6540":["LO","1","PlanningLandmarkDescription"],"6545":["SQ","1","PlanningLandmarkIdentificationCodeSequence"],"6550":["SQ","1","TwoDPointCoordinatesSequence"],"6560":["FD","2","TwoDPointCoordinates"],"6590":["FD","3","ThreeDPointCoordinates"],"6610":["FD","3","ThreeDPlaneOrigin"],"6620":["FD","3","ThreeDPlaneNormal"],"7001":["CS","1","ModelModification"],"7002":["CS","1","ModelMirroring"],"7003":["SQ","1","ModelUsageCodeSequence"],"7004":["UI","1","ModelGroupUID"],"7005":["UR","1","RelativeURIReferenceWithinEncapsulatedDocument"],"0000":["UL","1","GenericGroupLength"],"62A0":["SQ","1","ImplantRegulatoryDisapprovalCodeSequence"],"62A5":["FD","1","OverallTemplateSpatialTolerance"],"62C0":["SQ","1","HPGLDocumentSequence"],"62D0":["US","1","HPGLDocumentID"],"62D5":["LO","1","HPGLDocumentLabel"],"62E0":["SQ","1","ViewOrientationCodeSequence"],"62F0":["SQ","1","ViewOrientationModifierCodeSequence"],"62F2":["FD","1","HPGLDocumentScaling"],"63A0":["SQ","1","MaterialsCodeSequence"],"63A4":["SQ","1","CoatingMaterialsCodeSequence"],"63A8":["SQ","1","ImplantTypeCodeSequence"],"63AC":["SQ","1","FixationMethodCodeSequence"],"63B0":["SQ","1","MatingFeatureSetsSequence"],"63C0":["US","1","MatingFeatureSetID"],"63D0":["LO","1","MatingFeatureSetLabel"],"63E0":["SQ","1","MatingFeatureSequence"],"63F0":["US","1","MatingFeatureID"],"64A0":["FD","2","RangeOfFreedom"],"64C0":["FD","3","ThreeDMatingPoint"],"64D0":["FD","9","ThreeDMatingAxes"],"64F0":["FD","3","TwoDDegreeOfFreedomAxis"],"65A0":["SQ","1","TwoDLineCoordinatesSequence"],"65B0":["FD","4","TwoDLineCoordinates"],"65D0":["FD","6","ThreeDLineCoordinates"],"65E0":["SQ","1","TwoDPlaneCoordinatesSequence"],"65F0":["FD","4","TwoDPlaneIntersection"]},"006A":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","AnnotationCoordinateType"],"0002":["SQ","1","AnnotationGroupSequence"],"0003":["UI","1","AnnotationGroupUID"],"0005":["LO","1","AnnotationGroupLabel"],"0006":["UT","1","AnnotationGroupDescription"],"0007":["CS","1","AnnotationGroupGenerationType"],"0008":["SQ","1","AnnotationGroupAlgorithmIdentificationSequence"],"0009":["SQ","1","AnnotationPropertyCategoryCodeSequence"],"000A":["SQ","1","AnnotationPropertyTypeCodeSequence"],"000B":["SQ","1","AnnotationPropertyTypeModifierCodeSequence"],"000C":["UL","1","NumberOfAnnotations"],"000D":["CS","1","AnnotationAppliesToAllOpticalPaths"],"000E":["SH","1-n","ReferencedOpticalPathIdentifier"],"000F":["CS","1","AnnotationAppliesToAllZPlanes"],"0010":["FD","1-n","CommonZCoordinateValue"],"0011":["OL","1","AnnotationIndexList"]},"0070":{"1101":["UI","1","PresentationDisplayCollectionUID"],"1102":["UI","1","PresentationSequenceCollectionUID"],"1103":["US","1","PresentationSequencePositionIndex"],"1104":["SQ","1","RenderedImageReferenceSequence"],"1201":["SQ","1","VolumetricPresentationStateInputSequence"],"1202":["CS","1","PresentationInputType"],"1203":["US","1","InputSequencePositionIndex"],"1204":["CS","1","Crop"],"1205":["US","1-n","CroppingSpecificationIndex"],"1206":["CS","1","CompositingMethod"],"1207":["US","1","VolumetricPresentationInputNumber"],"1208":["CS","1","ImageVolumeGeometry"],"1209":["UI","1","VolumetricPresentationInputSetUID"],"1301":["SQ","1","VolumeCroppingSequence"],"1302":["CS","1","VolumeCroppingMethod"],"1303":["FD","6","BoundingBoxCrop"],"1304":["SQ","1","ObliqueCroppingPlaneSequence"],"1305":["FD","4","Plane"],"1306":["FD","3","PlaneNormal"],"1309":["US","1","CroppingSpecificationNumber"],"1501":["CS","1","MultiPlanarReconstructionStyle"],"1502":["CS","1","MPRThicknessType"],"1503":["FD","1","MPRSlabThickness"],"1505":["FD","3","MPRTopLeftHandCorner"],"1507":["FD","3","MPRViewWidthDirection"],"1508":["FD","1","MPRViewWidth"],"1511":["FD","3","MPRViewHeightDirection"],"1512":["FD","1","MPRViewHeight"],"1602":["CS","1","RenderProjection"],"1603":["FD","3","ViewpointPosition"],"1604":["FD","3","ViewpointLookAtPoint"],"1605":["FD","3","ViewpointUpDirection"],"1606":["FD","6","RenderFieldOfView"],"1607":["FD","1","SamplingStepSize"],"1701":["CS","1","ShadingStyle"],"1702":["FD","1","AmbientReflectionIntensity"],"1703":["FD","3","LightDirection"],"1704":["FD","1","DiffuseReflectionIntensity"],"1705":["FD","1","SpecularReflectionIntensity"],"1706":["FD","1","Shininess"],"1801":["SQ","1","PresentationStateClassificationComponentSequence"],"1802":["CS","1","ComponentType"],"1803":["SQ","1","ComponentInputSequence"],"1804":["US","1","VolumetricPresentationInputIndex"],"1805":["SQ","1","PresentationStateCompositorComponentSequence"],"1806":["SQ","1","WeightingTransferFunctionSequence"],"1807":["US","3","WeightingLookupTableDescriptor"],"1808":["OB","1","WeightingLookupTableData"],"1901":["SQ","1","VolumetricAnnotationSequence"],"1903":["SQ","1","ReferencedStructuredContextSequence"],"1904":["UI","1","ReferencedContentItem"],"1905":["SQ","1","VolumetricPresentationInputAnnotationSequence"],"1907":["CS","1","AnnotationClipping"],"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","GraphicAnnotationSequence"],"0002":["CS","1","GraphicLayer"],"0003":["CS","1","BoundingBoxAnnotationUnits"],"0004":["CS","1","AnchorPointAnnotationUnits"],"0005":["CS","1","GraphicAnnotationUnits"],"0006":["ST","1","UnformattedTextValue"],"0008":["SQ","1","TextObjectSequence"],"0009":["SQ","1","GraphicObjectSequence"],"0010":["FL","2","BoundingBoxTopLeftHandCorner"],"0011":["FL","2","BoundingBoxBottomRightHandCorner"],"0012":["CS","1","BoundingBoxTextHorizontalJustification"],"0014":["FL","2","AnchorPoint"],"0015":["CS","1","AnchorPointVisibility"],"0020":["US","1","GraphicDimensions"],"0021":["US","1","NumberOfGraphicPoints"],"0022":["FL","2-n","GraphicData"],"0023":["CS","1","GraphicType"],"0024":["CS","1","GraphicFilled"],"0040":["IS","1","ImageRotationRetired"],"0041":["CS","1","ImageHorizontalFlip"],"0042":["US","1","ImageRotation"],"0050":["US","2","DisplayedAreaTopLeftHandCornerTrial"],"0051":["US","2","DisplayedAreaBottomRightHandCornerTrial"],"0052":["SL","2","DisplayedAreaTopLeftHandCorner"],"0053":["SL","2","DisplayedAreaBottomRightHandCorner"],"005A":["SQ","1","DisplayedAreaSelectionSequence"],"0060":["SQ","1","GraphicLayerSequence"],"0062":["IS","1","GraphicLayerOrder"],"0066":["US","1","GraphicLayerRecommendedDisplayGrayscaleValue"],"0067":["US","3","GraphicLayerRecommendedDisplayRGBValue"],"0068":["LO","1","GraphicLayerDescription"],"0080":["CS","1","ContentLabel"],"0081":["LO","1","ContentDescription"],"0082":["DA","1","PresentationCreationDate"],"0083":["TM","1","PresentationCreationTime"],"0084":["PN","1","ContentCreatorName"],"0086":["SQ","1","ContentCreatorIdentificationCodeSequence"],"0087":["SQ","1","AlternateContentDescriptionSequence"],"0100":["CS","1","PresentationSizeMode"],"0101":["DS","2","PresentationPixelSpacing"],"0102":["IS","2","PresentationPixelAspectRatio"],"0103":["FL","1","PresentationPixelMagnificationRatio"],"0207":["LO","1","GraphicGroupLabel"],"0208":["ST","1","GraphicGroupDescription"],"0209":["SQ","1","CompoundGraphicSequence"],"0226":["UL","1","CompoundGraphicInstanceID"],"0227":["LO","1","FontName"],"0228":["CS","1","FontNameType"],"0229":["LO","1","CSSFontName"],"0230":["FD","1","RotationAngle"],"0231":["SQ","1","TextStyleSequence"],"0232":["SQ","1","LineStyleSequence"],"0233":["SQ","1","FillStyleSequence"],"0234":["SQ","1","GraphicGroupSequence"],"0241":["US","3","TextColorCIELabValue"],"0242":["CS","1","HorizontalAlignment"],"0243":["CS","1","VerticalAlignment"],"0244":["CS","1","ShadowStyle"],"0245":["FL","1","ShadowOffsetX"],"0246":["FL","1","ShadowOffsetY"],"0247":["US","3","ShadowColorCIELabValue"],"0248":["CS","1","Underlined"],"0249":["CS","1","Bold"],"0250":["CS","1","Italic"],"0251":["US","3","PatternOnColorCIELabValue"],"0252":["US","3","PatternOffColorCIELabValue"],"0253":["FL","1","LineThickness"],"0254":["CS","1","LineDashingStyle"],"0255":["UL","1","LinePattern"],"0256":["OB","1","FillPattern"],"0257":["CS","1","FillMode"],"0258":["FL","1","ShadowOpacity"],"0261":["FL","1","GapLength"],"0262":["FL","1","DiameterOfVisibility"],"0273":["FL","2","RotationPoint"],"0274":["CS","1","TickAlignment"],"0278":["CS","1","ShowTickLabel"],"0279":["CS","1","TickLabelAlignment"],"0282":["CS","1","CompoundGraphicUnits"],"0284":["FL","1","PatternOnOpacity"],"0285":["FL","1","PatternOffOpacity"],"0287":["SQ","1","MajorTicksSequence"],"0288":["FL","1","TickPosition"],"0289":["SH","1","TickLabel"],"0294":["CS","1","CompoundGraphicType"],"0295":["UL","1","GraphicGroupID"],"0306":["CS","1","ShapeType"],"0308":["SQ","1","RegistrationSequence"],"0309":["SQ","1","MatrixRegistrationSequence"],"030A":["SQ","1","MatrixSequence"],"030B":["FD","16","FrameOfReferenceToDisplayedCoordinateSystemTransformationMatrix"],"030C":["CS","1","FrameOfReferenceTransformationMatrixType"],"030D":["SQ","1","RegistrationTypeCodeSequence"],"030F":["ST","1","FiducialDescription"],"0310":["SH","1","FiducialIdentifier"],"0311":["SQ","1","FiducialIdentifierCodeSequence"],"0312":["FD","1","ContourUncertaintyRadius"],"0314":["SQ","1","UsedFiducialsSequence"],"0318":["SQ","1","GraphicCoordinatesDataSequence"],"031A":["UI","1","FiducialUID"],"031B":["UI","1","ReferencedFiducialUID"],"031C":["SQ","1","FiducialSetSequence"],"031E":["SQ","1","FiducialSequence"],"031F":["SQ","1","FiducialsPropertyCategoryCodeSequence"],"0401":["US","3","GraphicLayerRecommendedDisplayCIELabValue"],"0402":["SQ","1","BlendingSequence"],"0403":["FL","1","RelativeOpacity"],"0404":["SQ","1","ReferencedSpatialRegistrationSequence"],"0405":["CS","1","BlendingPosition"],"120A":["SQ","1","VolumetricPresentationInputSetSequence"],"120B":["CS","1","GlobalCrop"],"120C":["US","1-n","GlobalCroppingSpecificationIndex"],"120D":["CS","1","RenderingMethod"],"150C":["UL","1","NumberOfVolumetricCurvePoints"],"150D":["OD","1","VolumetricCurvePoints"],"1A01":["CS","1","PresentationAnimationStyle"],"1A03":["FD","1","RecommendedAnimationRate"],"1A04":["SQ","1","AnimationCurveSequence"],"1A05":["FD","1","AnimationStepSize"],"1A06":["FD","1","SwivelRange"],"1A07":["OD","1","VolumetricCurveUpDirections"],"1A08":["SQ","1","VolumeStreamSequence"],"1A09":["LO","1","RGBATransferFunctionDescription"],"1B01":["SQ","1","AdvancedBlendingSequence"],"1B02":["US","1","BlendingInputNumber"],"1B03":["SQ","1","BlendingDisplayInputSequence"],"1B04":["SQ","1","BlendingDisplaySequence"],"1B06":["CS","1","BlendingMode"],"1B07":["CS","1","TimeSeriesBlending"],"1B08":["CS","1","GeometryForDisplay"],"1B11":["SQ","1","ThresholdSequence"],"1B12":["SQ","1","ThresholdValueSequence"],"1B13":["CS","1","ThresholdType"],"1B14":["FD","1","ThresholdValue"]},"0072":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","HangingProtocolName"],"0004":["LO","1","HangingProtocolDescription"],"0006":["CS","1","HangingProtocolLevel"],"0008":["LO","1","HangingProtocolCreator"],"000A":["DT","1","HangingProtocolCreationDateTime"],"000C":["SQ","1","HangingProtocolDefinitionSequence"],"000E":["SQ","1","HangingProtocolUserIdentificationCodeSequence"],"0010":["LO","1","HangingProtocolUserGroupName"],"0012":["SQ","1","SourceHangingProtocolSequence"],"0014":["US","1","NumberOfPriorsReferenced"],"0020":["SQ","1","ImageSetsSequence"],"0022":["SQ","1","ImageSetSelectorSequence"],"0024":["CS","1","ImageSetSelectorUsageFlag"],"0026":["AT","1","SelectorAttribute"],"0028":["US","1","SelectorValueNumber"],"0030":["SQ","1","TimeBasedImageSetsSequence"],"0032":["US","1","ImageSetNumber"],"0034":["CS","1","ImageSetSelectorCategory"],"0038":["US","2","RelativeTime"],"003A":["CS","1","RelativeTimeUnits"],"003C":["SS","2","AbstractPriorValue"],"003E":["SQ","1","AbstractPriorCodeSequence"],"0040":["LO","1","ImageSetLabel"],"0050":["CS","1","SelectorAttributeVR"],"0052":["AT","1-n","SelectorSequencePointer"],"0054":["LO","1-n","SelectorSequencePointerPrivateCreator"],"0056":["LO","1","SelectorAttributePrivateCreator"],"005E":["AE","1-n","SelectorAEValue"],"005F":["AS","1-n","SelectorASValue"],"0060":["AT","1-n","SelectorATValue"],"0061":["DA","1-n","SelectorDAValue"],"0062":["CS","1-n","SelectorCSValue"],"0063":["DT","1-n","SelectorDTValue"],"0064":["IS","1-n","SelectorISValue"],"0065":["OB","1","SelectorOBValue"],"0066":["LO","1-n","SelectorLOValue"],"0067":["OF","1","SelectorOFValue"],"0068":["LT","1","SelectorLTValue"],"0069":["OW","1","SelectorOWValue"],"006A":["PN","1-n","SelectorPNValue"],"006B":["TM","1-n","SelectorTMValue"],"006C":["SH","1-n","SelectorSHValue"],"006D":["UN","1","SelectorUNValue"],"006E":["ST","1","SelectorSTValue"],"006F":["UC","1-n","SelectorUCValue"],"0070":["UT","1","SelectorUTValue"],"0071":["UR","1","SelectorURValue"],"0072":["DS","1-n","SelectorDSValue"],"0073":["OD","1","SelectorODValue"],"0074":["FD","1-n","SelectorFDValue"],"0075":["OL","1","SelectorOLValue"],"0076":["FL","1-n","SelectorFLValue"],"0078":["UL","1-n","SelectorULValue"],"007A":["US","1-n","SelectorUSValue"],"007C":["SL","1-n","SelectorSLValue"],"007E":["SS","1-n","SelectorSSValue"],"007F":["UI","1-n","SelectorUIValue"],"0080":["SQ","1","SelectorCodeSequenceValue"],"0081":["OV","1","SelectorOVValue"],"0082":["SV","1-n","SelectorSVValue"],"0083":["UV","1-n","SelectorUVValue"],"0100":["US","1","NumberOfScreens"],"0102":["SQ","1","NominalScreenDefinitionSequence"],"0104":["US","1","NumberOfVerticalPixels"],"0106":["US","1","NumberOfHorizontalPixels"],"0108":["FD","4","DisplayEnvironmentSpatialPosition"],"010A":["US","1","ScreenMinimumGrayscaleBitDepth"],"010C":["US","1","ScreenMinimumColorBitDepth"],"010E":["US","1","ApplicationMaximumRepaintTime"],"0200":["SQ","1","DisplaySetsSequence"],"0202":["US","1","DisplaySetNumber"],"0203":["LO","1","DisplaySetLabel"],"0204":["US","1","DisplaySetPresentationGroup"],"0206":["LO","1","DisplaySetPresentationGroupDescription"],"0208":["CS","1","PartialDataDisplayHandling"],"0210":["SQ","1","SynchronizedScrollingSequence"],"0212":["US","2-n","DisplaySetScrollingGroup"],"0214":["SQ","1","NavigationIndicatorSequence"],"0216":["US","1","NavigationDisplaySet"],"0218":["US","1-n","ReferenceDisplaySets"],"0300":["SQ","1","ImageBoxesSequence"],"0302":["US","1","ImageBoxNumber"],"0304":["CS","1","ImageBoxLayoutType"],"0306":["US","1","ImageBoxTileHorizontalDimension"],"0308":["US","1","ImageBoxTileVerticalDimension"],"0310":["CS","1","ImageBoxScrollDirection"],"0312":["CS","1","ImageBoxSmallScrollType"],"0314":["US","1","ImageBoxSmallScrollAmount"],"0316":["CS","1","ImageBoxLargeScrollType"],"0318":["US","1","ImageBoxLargeScrollAmount"],"0320":["US","1","ImageBoxOverlapPriority"],"0330":["FD","1","CineRelativeToRealTime"],"0400":["SQ","1","FilterOperationsSequence"],"0402":["CS","1","FilterByCategory"],"0404":["CS","1","FilterByAttributePresence"],"0406":["CS","1","FilterByOperator"],"0420":["US","3","StructuredDisplayBackgroundCIELabValue"],"0421":["US","3","EmptyImageBoxCIELabValue"],"0422":["SQ","1","StructuredDisplayImageBoxSequence"],"0424":["SQ","1","StructuredDisplayTextBoxSequence"],"0427":["SQ","1","ReferencedFirstFrameSequence"],"0430":["SQ","1","ImageBoxSynchronizationSequence"],"0432":["US","2-n","SynchronizedImageBoxList"],"0434":["CS","1","TypeOfSynchronization"],"0500":["CS","1","BlendingOperationType"],"0510":["CS","1","ReformattingOperationType"],"0512":["FD","1","ReformattingThickness"],"0514":["FD","1","ReformattingInterval"],"0516":["CS","1","ReformattingOperationInitialViewDirection"],"0520":["CS","1-n","ThreeDRenderingType"],"0600":["SQ","1","SortingOperationsSequence"],"0602":["CS","1","SortByCategory"],"0604":["CS","1","SortingDirection"],"0700":["CS","2","DisplaySetPatientOrientation"],"0702":["CS","1","VOIType"],"0704":["CS","1","PseudoColorType"],"0705":["SQ","1","PseudoColorPaletteInstanceReferenceSequence"],"0706":["CS","1","ShowGrayscaleInverted"],"0710":["CS","1","ShowImageTrueSizeFlag"],"0712":["CS","1","ShowGraphicAnnotationFlag"],"0714":["CS","1","ShowPatientDemographicsFlag"],"0716":["CS","1","ShowAcquisitionTechniquesFlag"],"0717":["CS","1","DisplaySetHorizontalJustification"],"0718":["CS","1","DisplaySetVerticalJustification"]},"0074":{"1000":["CS","1","ProcedureStepState"],"1002":["SQ","1","ProcedureStepProgressInformationSequence"],"1004":["DS","1","ProcedureStepProgress"],"1006":["ST","1","ProcedureStepProgressDescription"],"1007":["SQ","1","ProcedureStepProgressParametersSequence"],"1008":["SQ","1","ProcedureStepCommunicationsURISequence"],"1020":["SQ","1","BeamTaskSequence"],"1022":["CS","1","BeamTaskType"],"1024":["IS","1","BeamOrderIndexTrial"],"1025":["CS","1","AutosequenceFlag"],"1026":["FD","1","TableTopVerticalAdjustedPosition"],"1027":["FD","1","TableTopLongitudinalAdjustedPosition"],"1028":["FD","1","TableTopLateralAdjustedPosition"],"1030":["SQ","1","DeliveryVerificationImageSequence"],"1032":["CS","1","VerificationImageTiming"],"1034":["CS","1","DoubleExposureFlag"],"1036":["CS","1","DoubleExposureOrdering"],"1038":["DS","1","DoubleExposureMetersetTrial"],"1040":["SQ","1","RelatedReferenceRTImageSequence"],"1042":["SQ","1","GeneralMachineVerificationSequence"],"1044":["SQ","1","ConventionalMachineVerificationSequence"],"1046":["SQ","1","IonMachineVerificationSequence"],"1048":["SQ","1","FailedAttributesSequence"],"1050":["SQ","1","AttributeOccurrenceSequence"],"1052":["AT","1","AttributeOccurrencePointer"],"1054":["UL","1","AttributeItemSelector"],"1056":["LO","1","AttributeOccurrencePrivateCreator"],"1057":["IS","1-n","SelectorSequencePointerItems"],"1200":["CS","1","ScheduledProcedureStepPriority"],"1202":["LO","1","WorklistLabel"],"1204":["LO","1","ProcedureStepLabel"],"1210":["SQ","1","ScheduledProcessingParametersSequence"],"1212":["SQ","1","PerformedProcessingParametersSequence"],"1216":["SQ","1","UnifiedProcedureStepPerformedProcedureSequence"],"1220":["SQ","1","RelatedProcedureStepSequence"],"1222":["LO","1","ProcedureStepRelationshipType"],"1224":["SQ","1","ReplacedProcedureStepSequence"],"1230":["LO","1","DeletionLock"],"1234":["AE","1","ReceivingAE"],"1236":["AE","1","RequestingAE"],"1238":["LT","1","ReasonForCancellation"],"1242":["CS","1","SCPStatus"],"1244":["CS","1","SubscriptionListStatus"],"1246":["CS","1","UnifiedProcedureStepListStatus"],"1324":["UL","1","BeamOrderIndex"],"1338":["FD","1","DoubleExposureMeterset"],"1401":["SQ","1","BrachyTaskSequence"],"1402":["DS","1","ContinuationStartTotalReferenceAirKerma"],"1403":["DS","1","ContinuationEndTotalReferenceAirKerma"],"1404":["IS","1","ContinuationPulseNumber"],"1405":["SQ","1","ChannelDeliveryOrderSequence"],"1406":["IS","1","ReferencedChannelNumber"],"1407":["DS","1","StartCumulativeTimeWeight"],"1408":["DS","1","EndCumulativeTimeWeight"],"1409":["SQ","1","OmittedChannelSequence"],"0000":["UL","1","GenericGroupLength"],"0120":["FD","1","ContinuationStartMeterset"],"0121":["FD","1","ContinuationEndMeterset"],"100A":["UR","1","ContactURI"],"100C":["LO","1","ContactDisplayName"],"100E":["SQ","1","ProcedureStepDiscontinuationReasonCodeSequence"],"102A":["FD","1","PatientSupportAdjustedAngle"],"102B":["FD","1","TableTopEccentricAdjustedAngle"],"102C":["FD","1","TableTopPitchAdjustedAngle"],"102D":["FD","1","TableTopRollAdjustedAngle"],"103A":["DS","4","DoubleExposureFieldDeltaTrial"],"104A":["SQ","1","OverriddenAttributesSequence"],"104C":["SQ","1","ConventionalControlPointVerificationSequence"],"104E":["SQ","1","IonControlPointVerificationSequence"],"133A":["FD","4","DoubleExposureFieldDelta"],"140A":["CS","1","ReasonForChannelOmission"],"140B":["LO","1","ReasonForChannelOmissionDescription"],"140C":["IS","1","ChannelDeliveryOrderIndex"],"140D":["SQ","1","ChannelDeliveryContinuationSequence"],"140E":["SQ","1","OmittedApplicationSetupSequence"]},"0076":{"0000":["UL","1","GenericGroupLength"],"0001":["LO","1","ImplantAssemblyTemplateName"],"0003":["LO","1","ImplantAssemblyTemplateIssuer"],"0006":["LO","1","ImplantAssemblyTemplateVersion"],"0008":["SQ","1","ReplacedImplantAssemblyTemplateSequence"],"000A":["CS","1","ImplantAssemblyTemplateType"],"000C":["SQ","1","OriginalImplantAssemblyTemplateSequence"],"000E":["SQ","1","DerivationImplantAssemblyTemplateSequence"],"0010":["SQ","1","ImplantAssemblyTemplateTargetAnatomySequence"],"0020":["SQ","1","ProcedureTypeCodeSequence"],"0030":["LO","1","SurgicalTechnique"],"0032":["SQ","1","ComponentTypesSequence"],"0034":["SQ","1","ComponentTypeCodeSequence"],"0036":["CS","1","ExclusiveComponentType"],"0038":["CS","1","MandatoryComponentType"],"0040":["SQ","1","ComponentSequence"],"0055":["US","1","ComponentID"],"0060":["SQ","1","ComponentAssemblySequence"],"0070":["US","1","Component1ReferencedID"],"0080":["US","1","Component1ReferencedMatingFeatureSetID"],"0090":["US","1","Component1ReferencedMatingFeatureID"],"00A0":["US","1","Component2ReferencedID"],"00B0":["US","1","Component2ReferencedMatingFeatureSetID"],"00C0":["US","1","Component2ReferencedMatingFeatureID"]},"0078":{"0000":["UL","1","GenericGroupLength"],"0001":["LO","1","ImplantTemplateGroupName"],"0010":["ST","1","ImplantTemplateGroupDescription"],"0020":["LO","1","ImplantTemplateGroupIssuer"],"0024":["LO","1","ImplantTemplateGroupVersion"],"0026":["SQ","1","ReplacedImplantTemplateGroupSequence"],"0028":["SQ","1","ImplantTemplateGroupTargetAnatomySequence"],"002A":["SQ","1","ImplantTemplateGroupMembersSequence"],"002E":["US","1","ImplantTemplateGroupMemberID"],"0050":["FD","3","ThreeDImplantTemplateGroupMemberMatchingPoint"],"0060":["FD","9","ThreeDImplantTemplateGroupMemberMatchingAxes"],"0070":["SQ","1","ImplantTemplateGroupMemberMatching2DCoordinatesSequence"],"0090":["FD","2","TwoDImplantTemplateGroupMemberMatchingPoint"],"00A0":["FD","4","TwoDImplantTemplateGroupMemberMatchingAxes"],"00B0":["SQ","1","ImplantTemplateGroupVariationDimensionSequence"],"00B2":["LO","1","ImplantTemplateGroupVariationDimensionName"],"00B4":["SQ","1","ImplantTemplateGroupVariationDimensionRankSequence"],"00B6":["US","1","ReferencedImplantTemplateGroupMemberID"],"00B8":["US","1","ImplantTemplateGroupVariationDimensionRank"]},"0080":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","SurfaceScanAcquisitionTypeCodeSequence"],"0002":["SQ","1","SurfaceScanModeCodeSequence"],"0003":["SQ","1","RegistrationMethodCodeSequence"],"0004":["FD","1","ShotDurationTime"],"0005":["FD","1","ShotOffsetTime"],"0006":["US","1-n","SurfacePointPresentationValueData"],"0007":["US","3-3n","SurfacePointColorCIELabValueData"],"0008":["SQ","1","UVMappingSequence"],"0009":["SH","1","TextureLabel"],"0010":["OF","1","UValueData"],"0011":["OF","1","VValueData"],"0012":["SQ","1","ReferencedTextureSequence"],"0013":["SQ","1","ReferencedSurfaceDataSequence"]},"0082":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","AssessmentSummary"],"0003":["UT","1","AssessmentSummaryDescription"],"0004":["SQ","1","AssessedSOPInstanceSequence"],"0005":["SQ","1","ReferencedComparisonSOPInstanceSequence"],"0006":["UL","1","NumberOfAssessmentObservations"],"0007":["SQ","1","AssessmentObservationsSequence"],"0008":["CS","1","ObservationSignificance"],"000A":["UT","1","ObservationDescription"],"000C":["SQ","1","StructuredConstraintObservationSequence"],"0010":["SQ","1","AssessedAttributeValueSequence"],"0016":["LO","1","AssessmentSetID"],"0017":["SQ","1","AssessmentRequesterSequence"],"0018":["LO","1","SelectorAttributeName"],"0019":["LO","1","SelectorAttributeKeyword"],"0021":["SQ","1","AssessmentTypeCodeSequence"],"0022":["SQ","1","ObservationBasisCodeSequence"],"0023":["LO","1","AssessmentLabel"],"0032":["CS","1","ConstraintType"],"0033":["UT","1","SpecificationSelectionGuidance"],"0034":["SQ","1","ConstraintValueSequence"],"0035":["SQ","1","RecommendedDefaultValueSequence"],"0036":["CS","1","ConstraintViolationSignificance"],"0037":["UT","1","ConstraintViolationCondition"],"0038":["CS","1","ModifiableConstraintFlag"]},"0088":{"0000":["UL","1","GenericGroupLength"],"0130":["SH","1","StorageMediaFileSetID"],"0140":["UI","1","StorageMediaFileSetUID"],"0200":["SQ","1","IconImageSequence"],"0904":["LO","1","TopicTitle"],"0906":["ST","1","TopicSubject"],"0910":["LO","1","TopicAuthor"],"0912":["LO","1-32","TopicKeywords"]},"0100":{"0000":["UL","1","GenericGroupLength"],"0410":["CS","1","SOPInstanceStatus"],"0420":["DT","1","SOPAuthorizationDateTime"],"0424":["LT","1","SOPAuthorizationComment"],"0426":["LO","1","AuthorizationEquipmentCertificationNumber"]},"0400":{"0000":["UL","1","GenericGroupLength"],"0005":["US","1","MACIDNumber"],"0010":["UI","1","MACCalculationTransferSyntaxUID"],"0015":["CS","1","MACAlgorithm"],"0020":["AT","1-n","DataElementsSigned"],"0100":["UI","1","DigitalSignatureUID"],"0105":["DT","1","DigitalSignatureDateTime"],"0110":["CS","1","CertificateType"],"0115":["OB","1","CertificateOfSigner"],"0120":["OB","1","Signature"],"0305":["CS","1","CertifiedTimestampType"],"0310":["OB","1","CertifiedTimestamp"],"0315":["FL","1",""],"0401":["SQ","1","DigitalSignaturePurposeCodeSequence"],"0402":["SQ","1","ReferencedDigitalSignatureSequence"],"0403":["SQ","1","ReferencedSOPInstanceMACSequence"],"0404":["OB","1","MAC"],"0500":["SQ","1","EncryptedAttributesSequence"],"0510":["UI","1","EncryptedContentTransferSyntaxUID"],"0520":["OB","1","EncryptedContent"],"0550":["SQ","1","ModifiedAttributesSequence"],"0551":["SQ","1","NonconformingModifiedAttributesSequence"],"0552":["OB","1","NonconformingDataElementValue"],"0561":["SQ","1","OriginalAttributesSequence"],"0562":["DT","1","AttributeModificationDateTime"],"0563":["LO","1","ModifyingSystem"],"0564":["LO","1","SourceOfPreviousValues"],"0565":["CS","1","ReasonForTheAttributeModification"],"0600":["CS","1","InstanceOriginStatus"]},"300A":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","RTPlanLabel"],"0003":["LO","1","RTPlanName"],"0004":["ST","1","RTPlanDescription"],"0006":["DA","1","RTPlanDate"],"0007":["TM","1","RTPlanTime"],"0009":["LO","1-n","TreatmentProtocols"],"000A":["CS","1","PlanIntent"],"000B":["LO","1-n","TreatmentSites"],"000C":["CS","1","RTPlanGeometry"],"000E":["ST","1","PrescriptionDescription"],"0010":["SQ","1","DoseReferenceSequence"],"0012":["IS","1","DoseReferenceNumber"],"0013":["UI","1","DoseReferenceUID"],"0014":["CS","1","DoseReferenceStructureType"],"0015":["CS","1","NominalBeamEnergyUnit"],"0016":["LO","1","DoseReferenceDescription"],"0018":["DS","3","DoseReferencePointCoordinates"],"001A":["DS","1","NominalPriorDose"],"0020":["CS","1","DoseReferenceType"],"0021":["DS","1","ConstraintWeight"],"0022":["DS","1","DeliveryWarningDose"],"0023":["DS","1","DeliveryMaximumDose"],"0025":["DS","1","TargetMinimumDose"],"0026":["DS","1","TargetPrescriptionDose"],"0027":["DS","1","TargetMaximumDose"],"0028":["DS","1","TargetUnderdoseVolumeFraction"],"002A":["DS","1","OrganAtRiskFullVolumeDose"],"002B":["DS","1","OrganAtRiskLimitDose"],"002C":["DS","1","OrganAtRiskMaximumDose"],"002D":["DS","1","OrganAtRiskOverdoseVolumeFraction"],"0040":["SQ","1","ToleranceTableSequence"],"0042":["IS","1","ToleranceTableNumber"],"0043":["SH","1","ToleranceTableLabel"],"0044":["DS","1","GantryAngleTolerance"],"0046":["DS","1","BeamLimitingDeviceAngleTolerance"],"0048":["SQ","1","BeamLimitingDeviceToleranceSequence"],"004A":["DS","1","BeamLimitingDevicePositionTolerance"],"004B":["FL","1","SnoutPositionTolerance"],"004C":["DS","1","PatientSupportAngleTolerance"],"004E":["DS","1","TableTopEccentricAngleTolerance"],"004F":["FL","1","TableTopPitchAngleTolerance"],"0050":["FL","1","TableTopRollAngleTolerance"],"0051":["DS","1","TableTopVerticalPositionTolerance"],"0052":["DS","1","TableTopLongitudinalPositionTolerance"],"0053":["DS","1","TableTopLateralPositionTolerance"],"0055":["CS","1","RTPlanRelationship"],"0070":["SQ","1","FractionGroupSequence"],"0071":["IS","1","FractionGroupNumber"],"0072":["LO","1","FractionGroupDescription"],"0078":["IS","1","NumberOfFractionsPlanned"],"0079":["IS","1","NumberOfFractionPatternDigitsPerDay"],"007A":["IS","1","RepeatFractionCycleLength"],"007B":["LT","1","FractionPattern"],"0080":["IS","1","NumberOfBeams"],"0082":["DS","3","BeamDoseSpecificationPoint"],"0083":["UI","1","ReferencedDoseReferenceUID"],"0084":["DS","1","BeamDose"],"0086":["DS","1","BeamMeterset"],"0088":["FL","1","BeamDosePointDepth"],"0089":["FL","1","BeamDosePointEquivalentDepth"],"008A":["FL","1","BeamDosePointSSD"],"008B":["CS","1","BeamDoseMeaning"],"008C":["SQ","1","BeamDoseVerificationControlPointSequence"],"008D":["FL","1","AverageBeamDosePointDepth"],"008E":["FL","1","AverageBeamDosePointEquivalentDepth"],"008F":["FL","1","AverageBeamDosePointSSD"],"0090":["CS","1","BeamDoseType"],"0091":["DS","1","AlternateBeamDose"],"0092":["CS","1","AlternateBeamDoseType"],"0093":["CS","1","DepthValueAveragingFlag"],"0094":["DS","1","BeamDosePointSourceToExternalContourDistance"],"00A0":["IS","1","NumberOfBrachyApplicationSetups"],"00A2":["DS","3","BrachyApplicationSetupDoseSpecificationPoint"],"00A4":["DS","1","BrachyApplicationSetupDose"],"00B0":["SQ","1","BeamSequence"],"00B2":["SH","1","TreatmentMachineName"],"00B3":["CS","1","PrimaryDosimeterUnit"],"00B4":["DS","1","SourceAxisDistance"],"00B6":["SQ","1","BeamLimitingDeviceSequence"],"00B8":["CS","1","RTBeamLimitingDeviceType"],"00BA":["DS","1","SourceToBeamLimitingDeviceDistance"],"00BB":["FL","1","IsocenterToBeamLimitingDeviceDistance"],"00BC":["IS","1","NumberOfLeafJawPairs"],"00BE":["DS","3-n","LeafPositionBoundaries"],"00C0":["IS","1","BeamNumber"],"00C2":["LO","1","BeamName"],"00C3":["ST","1","BeamDescription"],"00C4":["CS","1","BeamType"],"00C5":["FD","1","BeamDeliveryDurationLimit"],"00C6":["CS","1","RadiationType"],"00C7":["CS","1","HighDoseTechniqueType"],"00C8":["IS","1","ReferenceImageNumber"],"00CA":["SQ","1","PlannedVerificationImageSequence"],"00CC":["LO","1-n","ImagingDeviceSpecificAcquisitionParameters"],"00CE":["CS","1","TreatmentDeliveryType"],"00D0":["IS","1","NumberOfWedges"],"00D1":["SQ","1","WedgeSequence"],"00D2":["IS","1","WedgeNumber"],"00D3":["CS","1","WedgeType"],"00D4":["SH","1","WedgeID"],"00D5":["IS","1","WedgeAngle"],"00D6":["DS","1","WedgeFactor"],"00D7":["FL","1","TotalWedgeTrayWaterEquivalentThickness"],"00D8":["DS","1","WedgeOrientation"],"00D9":["FL","1","IsocenterToWedgeTrayDistance"],"00DA":["DS","1","SourceToWedgeTrayDistance"],"00DB":["FL","1","WedgeThinEdgePosition"],"00DC":["SH","1","BolusID"],"00DD":["ST","1","BolusDescription"],"00DE":["DS","1","EffectiveWedgeAngle"],"00E0":["IS","1","NumberOfCompensators"],"00E1":["SH","1","MaterialID"],"00E2":["DS","1","TotalCompensatorTrayFactor"],"00E3":["SQ","1","CompensatorSequence"],"00E4":["IS","1","CompensatorNumber"],"00E5":["SH","1","CompensatorID"],"00E6":["DS","1","SourceToCompensatorTrayDistance"],"00E7":["IS","1","CompensatorRows"],"00E8":["IS","1","CompensatorColumns"],"00E9":["DS","2","CompensatorPixelSpacing"],"00EA":["DS","2","CompensatorPosition"],"00EB":["DS","1-n","CompensatorTransmissionData"],"00EC":["DS","1-n","CompensatorThicknessData"],"00ED":["IS","1","NumberOfBoli"],"00EE":["CS","1","CompensatorType"],"00EF":["SH","1","CompensatorTrayID"],"00F0":["IS","1","NumberOfBlocks"],"00F2":["DS","1","TotalBlockTrayFactor"],"00F3":["FL","1","TotalBlockTrayWaterEquivalentThickness"],"00F4":["SQ","1","BlockSequence"],"00F5":["SH","1","BlockTrayID"],"00F6":["DS","1","SourceToBlockTrayDistance"],"00F7":["FL","1","IsocenterToBlockTrayDistance"],"00F8":["CS","1","BlockType"],"00F9":["LO","1","AccessoryCode"],"00FA":["CS","1","BlockDivergence"],"00FB":["CS","1","BlockMountingPosition"],"00FC":["IS","1","BlockNumber"],"00FE":["LO","1","BlockName"],"0100":["DS","1","BlockThickness"],"0102":["DS","1","BlockTransmission"],"0104":["IS","1","BlockNumberOfPoints"],"0106":["DS","2-2n","BlockData"],"0107":["SQ","1","ApplicatorSequence"],"0108":["SH","1","ApplicatorID"],"0109":["CS","1","ApplicatorType"],"010A":["LO","1","ApplicatorDescription"],"010C":["DS","1","CumulativeDoseReferenceCoefficient"],"010E":["DS","1","FinalCumulativeMetersetWeight"],"0110":["IS","1","NumberOfControlPoints"],"0111":["SQ","1","ControlPointSequence"],"0112":["IS","1","ControlPointIndex"],"0114":["DS","1","NominalBeamEnergy"],"0115":["DS","1","DoseRateSet"],"0116":["SQ","1","WedgePositionSequence"],"0118":["CS","1","WedgePosition"],"011A":["SQ","1","BeamLimitingDevicePositionSequence"],"011C":["DS","2-2n","LeafJawPositions"],"011E":["DS","1","GantryAngle"],"011F":["CS","1","GantryRotationDirection"],"0120":["DS","1","BeamLimitingDeviceAngle"],"0121":["CS","1","BeamLimitingDeviceRotationDirection"],"0122":["DS","1","PatientSupportAngle"],"0123":["CS","1","PatientSupportRotationDirection"],"0124":["DS","1","TableTopEccentricAxisDistance"],"0125":["DS","1","TableTopEccentricAngle"],"0126":["CS","1","TableTopEccentricRotationDirection"],"0128":["DS","1","TableTopVerticalPosition"],"0129":["DS","1","TableTopLongitudinalPosition"],"012A":["DS","1","TableTopLateralPosition"],"012C":["DS","3","IsocenterPosition"],"012E":["DS","3","SurfaceEntryPoint"],"0130":["DS","1","SourceToSurfaceDistance"],"0131":["FL","1","AverageBeamDosePointSourceToExternalContourDistance"],"0132":["FL","1","SourceToExternalContourDistance"],"0133":["FL","3","ExternalContourEntryPoint"],"0134":["DS","1","CumulativeMetersetWeight"],"0140":["FL","1","TableTopPitchAngle"],"0142":["CS","1","TableTopPitchRotationDirection"],"0144":["FL","1","TableTopRollAngle"],"0146":["CS","1","TableTopRollRotationDirection"],"0148":["FL","1","HeadFixationAngle"],"014A":["FL","1","GantryPitchAngle"],"014C":["CS","1","GantryPitchRotationDirection"],"014E":["FL","1","GantryPitchAngleTolerance"],"0150":["CS","1","FixationEye"],"0151":["DS","1","ChairHeadFramePosition"],"0152":["DS","1","HeadFixationAngleTolerance"],"0153":["DS","1","ChairHeadFramePositionTolerance"],"0154":["DS","1","FixationLightAzimuthalAngleTolerance"],"0155":["DS","1","FixationLightPolarAngleTolerance"],"0180":["SQ","1","PatientSetupSequence"],"0182":["IS","1","PatientSetupNumber"],"0183":["LO","1","PatientSetupLabel"],"0184":["LO","1","PatientAdditionalPosition"],"0190":["SQ","1","FixationDeviceSequence"],"0192":["CS","1","FixationDeviceType"],"0194":["SH","1","FixationDeviceLabel"],"0196":["ST","1","FixationDeviceDescription"],"0198":["SH","1","FixationDevicePosition"],"0199":["FL","1","FixationDevicePitchAngle"],"019A":["FL","1","FixationDeviceRollAngle"],"01A0":["SQ","1","ShieldingDeviceSequence"],"01A2":["CS","1","ShieldingDeviceType"],"01A4":["SH","1","ShieldingDeviceLabel"],"01A6":["ST","1","ShieldingDeviceDescription"],"01A8":["SH","1","ShieldingDevicePosition"],"01B0":["CS","1","SetupTechnique"],"01B2":["ST","1","SetupTechniqueDescription"],"01B4":["SQ","1","SetupDeviceSequence"],"01B6":["CS","1","SetupDeviceType"],"01B8":["SH","1","SetupDeviceLabel"],"01BA":["ST","1","SetupDeviceDescription"],"01BC":["DS","1","SetupDeviceParameter"],"01D0":["ST","1","SetupReferenceDescription"],"01D2":["DS","1","TableTopVerticalSetupDisplacement"],"01D4":["DS","1","TableTopLongitudinalSetupDisplacement"],"01D6":["DS","1","TableTopLateralSetupDisplacement"],"0200":["CS","1","BrachyTreatmentTechnique"],"0202":["CS","1","BrachyTreatmentType"],"0206":["SQ","1","TreatmentMachineSequence"],"0210":["SQ","1","SourceSequence"],"0212":["IS","1","SourceNumber"],"0214":["CS","1","SourceType"],"0216":["LO","1","SourceManufacturer"],"0218":["DS","1","ActiveSourceDiameter"],"021A":["DS","1","ActiveSourceLength"],"021B":["SH","1","SourceModelID"],"021C":["LO","1","SourceDescription"],"0222":["DS","1","SourceEncapsulationNominalThickness"],"0224":["DS","1","SourceEncapsulationNominalTransmission"],"0226":["LO","1","SourceIsotopeName"],"0228":["DS","1","SourceIsotopeHalfLife"],"0229":["CS","1","SourceStrengthUnits"],"022A":["DS","1","ReferenceAirKermaRate"],"022B":["DS","1","SourceStrength"],"022C":["DA","1","SourceStrengthReferenceDate"],"022E":["TM","1","SourceStrengthReferenceTime"],"0230":["SQ","1","ApplicationSetupSequence"],"0232":["CS","1","ApplicationSetupType"],"0234":["IS","1","ApplicationSetupNumber"],"0236":["LO","1","ApplicationSetupName"],"0238":["LO","1","ApplicationSetupManufacturer"],"0240":["IS","1","TemplateNumber"],"0242":["SH","1","TemplateType"],"0244":["LO","1","TemplateName"],"0250":["DS","1","TotalReferenceAirKerma"],"0260":["SQ","1","BrachyAccessoryDeviceSequence"],"0262":["IS","1","BrachyAccessoryDeviceNumber"],"0263":["SH","1","BrachyAccessoryDeviceID"],"0264":["CS","1","BrachyAccessoryDeviceType"],"0266":["LO","1","BrachyAccessoryDeviceName"],"026A":["DS","1","BrachyAccessoryDeviceNominalThickness"],"026C":["DS","1","BrachyAccessoryDeviceNominalTransmission"],"0271":["DS","1","ChannelEffectiveLength"],"0272":["DS","1","ChannelInnerLength"],"0273":["SH","1","AfterloaderChannelID"],"0274":["DS","1","SourceApplicatorTipLength"],"0280":["SQ","1","ChannelSequence"],"0282":["IS","1","ChannelNumber"],"0284":["DS","1","ChannelLength"],"0286":["DS","1","ChannelTotalTime"],"0288":["CS","1","SourceMovementType"],"028A":["IS","1","NumberOfPulses"],"028C":["DS","1","PulseRepetitionInterval"],"0290":["IS","1","SourceApplicatorNumber"],"0291":["SH","1","SourceApplicatorID"],"0292":["CS","1","SourceApplicatorType"],"0294":["LO","1","SourceApplicatorName"],"0296":["DS","1","SourceApplicatorLength"],"0298":["LO","1","SourceApplicatorManufacturer"],"029C":["DS","1","SourceApplicatorWallNominalThickness"],"029E":["DS","1","SourceApplicatorWallNominalTransmission"],"02A0":["DS","1","SourceApplicatorStepSize"],"02A1":["IS","1","ApplicatorShapeReferencedROINumber"],"02A2":["IS","1","TransferTubeNumber"],"02A4":["DS","1","TransferTubeLength"],"02B0":["SQ","1","ChannelShieldSequence"],"02B2":["IS","1","ChannelShieldNumber"],"02B3":["SH","1","ChannelShieldID"],"02B4":["LO","1","ChannelShieldName"],"02B8":["DS","1","ChannelShieldNominalThickness"],"02BA":["DS","1","ChannelShieldNominalTransmission"],"02C8":["DS","1","FinalCumulativeTimeWeight"],"02D0":["SQ","1","BrachyControlPointSequence"],"02D2":["DS","1","ControlPointRelativePosition"],"02D4":["DS","3","ControlPoint3DPosition"],"02D6":["DS","1","CumulativeTimeWeight"],"02E0":["CS","1","CompensatorDivergence"],"02E1":["CS","1","CompensatorMountingPosition"],"02E2":["DS","1-n","SourceToCompensatorDistance"],"02E3":["FL","1","TotalCompensatorTrayWaterEquivalentThickness"],"02E4":["FL","1","IsocenterToCompensatorTrayDistance"],"02E5":["FL","1","CompensatorColumnOffset"],"02E6":["FL","1-n","IsocenterToCompensatorDistances"],"02E7":["FL","1","CompensatorRelativeStoppingPowerRatio"],"02E8":["FL","1","CompensatorMillingToolDiameter"],"02EA":["SQ","1","IonRangeCompensatorSequence"],"02EB":["LT","1","CompensatorDescription"],"0302":["IS","1","RadiationMassNumber"],"0304":["IS","1","RadiationAtomicNumber"],"0306":["SS","1","RadiationChargeState"],"0308":["CS","1","ScanMode"],"0309":["CS","1","ModulatedScanModeType"],"030A":["FL","2","VirtualSourceAxisDistances"],"030C":["SQ","1","SnoutSequence"],"030D":["FL","1","SnoutPosition"],"030F":["SH","1","SnoutID"],"0312":["IS","1","NumberOfRangeShifters"],"0314":["SQ","1","RangeShifterSequence"],"0316":["IS","1","RangeShifterNumber"],"0318":["SH","1","RangeShifterID"],"0320":["CS","1","RangeShifterType"],"0322":["LO","1","RangeShifterDescription"],"0330":["IS","1","NumberOfLateralSpreadingDevices"],"0332":["SQ","1","LateralSpreadingDeviceSequence"],"0334":["IS","1","LateralSpreadingDeviceNumber"],"0336":["SH","1","LateralSpreadingDeviceID"],"0338":["CS","1","LateralSpreadingDeviceType"],"033A":["LO","1","LateralSpreadingDeviceDescription"],"033C":["FL","1","LateralSpreadingDeviceWaterEquivalentThickness"],"0340":["IS","1","NumberOfRangeModulators"],"0342":["SQ","1","RangeModulatorSequence"],"0344":["IS","1","RangeModulatorNumber"],"0346":["SH","1","RangeModulatorID"],"0348":["CS","1","RangeModulatorType"],"034A":["LO","1","RangeModulatorDescription"],"034C":["SH","1","BeamCurrentModulationID"],"0350":["CS","1","PatientSupportType"],"0352":["SH","1","PatientSupportID"],"0354":["LO","1","PatientSupportAccessoryCode"],"0355":["LO","1","TrayAccessoryCode"],"0356":["FL","1","FixationLightAzimuthalAngle"],"0358":["FL","1","FixationLightPolarAngle"],"035A":["FL","1","MetersetRate"],"0360":["SQ","1","RangeShifterSettingsSequence"],"0362":["LO","1","RangeShifterSetting"],"0364":["FL","1","IsocenterToRangeShifterDistance"],"0366":["FL","1","RangeShifterWaterEquivalentThickness"],"0370":["SQ","1","LateralSpreadingDeviceSettingsSequence"],"0372":["LO","1","LateralSpreadingDeviceSetting"],"0374":["FL","1","IsocenterToLateralSpreadingDeviceDistance"],"0380":["SQ","1","RangeModulatorSettingsSequence"],"0382":["FL","1","RangeModulatorGatingStartValue"],"0384":["FL","1","RangeModulatorGatingStopValue"],"0386":["FL","1","RangeModulatorGatingStartWaterEquivalentThickness"],"0388":["FL","1","RangeModulatorGatingStopWaterEquivalentThickness"],"038A":["FL","1","IsocenterToRangeModulatorDistance"],"038F":["FL","1-n","ScanSpotTimeOffset"],"0390":["SH","1","ScanSpotTuneID"],"0391":["IS","1-n","ScanSpotPrescribedIndices"],"0392":["IS","1","NumberOfScanSpotPositions"],"0393":["CS","1","ScanSpotReordered"],"0394":["FL","1-n","ScanSpotPositionMap"],"0395":["CS","1","ScanSpotReorderingAllowed"],"0396":["FL","1-n","ScanSpotMetersetWeights"],"0398":["FL","2","ScanningSpotSize"],"0399":["FL","2-2n","ScanSpotSizesDelivered"],"039A":["IS","1","NumberOfPaintings"],"03A0":["SQ","1","IonToleranceTableSequence"],"03A2":["SQ","1","IonBeamSequence"],"03A4":["SQ","1","IonBeamLimitingDeviceSequence"],"03A6":["SQ","1","IonBlockSequence"],"03A8":["SQ","1","IonControlPointSequence"],"03AA":["SQ","1","IonWedgeSequence"],"03AC":["SQ","1","IonWedgePositionSequence"],"0401":["SQ","1","ReferencedSetupImageSequence"],"0402":["ST","1","SetupImageComment"],"0410":["SQ","1","MotionSynchronizationSequence"],"0412":["FL","3","ControlPointOrientation"],"0420":["SQ","1","GeneralAccessorySequence"],"0421":["SH","1","GeneralAccessoryID"],"0422":["ST","1","GeneralAccessoryDescription"],"0423":["CS","1","GeneralAccessoryType"],"0424":["IS","1","GeneralAccessoryNumber"],"0425":["FL","1","SourceToGeneralAccessoryDistance"],"0426":["DS","1","IsocenterToGeneralAccessoryDistance"],"0431":["SQ","1","ApplicatorGeometrySequence"],"0432":["CS","1","ApplicatorApertureShape"],"0433":["FL","1","ApplicatorOpening"],"0434":["FL","1","ApplicatorOpeningX"],"0435":["FL","1","ApplicatorOpeningY"],"0436":["FL","1","SourceToApplicatorMountingPositionDistance"],"0440":["IS","1","NumberOfBlockSlabItems"],"0441":["SQ","1","BlockSlabSequence"],"0442":["DS","1","BlockSlabThickness"],"0443":["US","1","BlockSlabNumber"],"0450":["SQ","1","DeviceMotionControlSequence"],"0451":["CS","1","DeviceMotionExecutionMode"],"0452":["CS","1","DeviceMotionObservationMode"],"0453":["SQ","1","DeviceMotionParameterCodeSequence"],"0501":["FL","1","DistalDepthFraction"],"0502":["FL","1","DistalDepth"],"0503":["FL","2","NominalRangeModulationFractions"],"0504":["FL","2","NominalRangeModulatedRegionDepths"],"0505":["SQ","1","DepthDoseParametersSequence"],"0506":["SQ","1","DeliveredDepthDoseParametersSequence"],"0507":["FL","1","DeliveredDistalDepthFraction"],"0508":["FL","1","DeliveredDistalDepth"],"0509":["FL","2","DeliveredNominalRangeModulationFractions"],"0510":["FL","2","DeliveredNominalRangeModulatedRegionDepths"],"0511":["CS","1","DeliveredReferenceDoseDefinition"],"0512":["CS","1","ReferenceDoseDefinition"],"0600":["US","1","RTControlPointIndex"],"0601":["US","1","RadiationGenerationModeIndex"],"0602":["US","1","ReferencedDefinedDeviceIndex"],"0603":["US","1","RadiationDoseIdentificationIndex"],"0604":["US","1","NumberOfRTControlPoints"],"0605":["US","1","ReferencedRadiationGenerationModeIndex"],"0606":["US","1","TreatmentPositionIndex"],"0607":["US","1","ReferencedDeviceIndex"],"0608":["LO","1","TreatmentPositionGroupLabel"],"0609":["UI","1","TreatmentPositionGroupUID"],"060A":["SQ","1","TreatmentPositionGroupSequence"],"060B":["US","1","ReferencedTreatmentPositionIndex"],"060C":["US","1","ReferencedRadiationDoseIdentificationIndex"],"060D":["FD","1","RTAccessoryHolderWaterEquivalentThickness"],"060E":["US","1","ReferencedRTAccessoryHolderDeviceIndex"],"060F":["CS","1","RTAccessoryHolderSlotExistenceFlag"],"0610":["SQ","1","RTAccessoryHolderSlotSequence"],"0611":["LO","1","RTAccessoryHolderSlotID"],"0612":["FD","1","RTAccessoryHolderSlotDistance"],"0613":["FD","1","RTAccessorySlotDistance"],"0614":["SQ","1","RTAccessoryHolderDefinitionSequence"],"0615":["LO","1","RTAccessoryDeviceSlotID"],"0616":["SQ","1","RTRadiationSequence"],"0617":["SQ","1","RadiationDoseSequence"],"0618":["SQ","1","RadiationDoseIdentificationSequence"],"0619":["LO","1","RadiationDoseIdentificationLabel"],"061A":["CS","1","ReferenceDoseType"],"061B":["CS","1","PrimaryDoseValueIndicator"],"061C":["SQ","1","DoseValuesSequence"],"061D":["CS","1-n","DoseValuePurpose"],"061E":["FD","3","ReferenceDosePointCoordinates"],"061F":["SQ","1","RadiationDoseValuesParametersSequence"],"0620":["SQ","1","MetersetToDoseMappingSequence"],"0621":["SQ","1","ExpectedInVivoMeasurementValuesSequence"],"0622":["US","1","ExpectedInVivoMeasurementValueIndex"],"0623":["LO","1","RadiationDoseInVivoMeasurementLabel"],"0624":["FD","2","RadiationDoseCentralAxisDisplacement"],"0625":["FD","1","RadiationDoseValue"],"0626":["FD","1","RadiationDoseSourceToSkinDistance"],"0627":["FD","3","RadiationDoseMeasurementPointCoordinates"],"0628":["FD","1","RadiationDoseSourceToExternalContourDistance"],"0629":["SQ","1","RTToleranceSetSequence"],"062A":["LO","1","RTToleranceSetLabel"],"062B":["SQ","1","AttributeToleranceValuesSequence"],"062C":["FD","1","ToleranceValue"],"062D":["SQ","1","PatientSupportPositionToleranceSequence"],"062E":["FD","1","TreatmentTimeLimit"],"062F":["SQ","1","CArmPhotonElectronControlPointSequence"],"0630":["SQ","1","ReferencedRTRadiationSequence"],"0631":["SQ","1","ReferencedRTInstanceSequence"],"0632":["SQ","1","ReferencedRTPatientSetupSequence"],"0634":["FD","1","SourceToPatientSurfaceDistance"],"0635":["SQ","1","TreatmentMachineSpecialModeCodeSequence"],"0636":["US","1","IntendedNumberOfFractions"],"0637":["CS","1","RTRadiationSetIntent"],"0638":["CS","1","RTRadiationPhysicalAndGeometricContentDetailFlag"],"0639":["CS","1","RTRecordFlag"],"063A":["SQ","1","TreatmentDeviceIdentificationSequence"],"063B":["SQ","1","ReferencedRTPhysicianIntentSequence"],"063C":["FD","1","CumulativeMeterset"],"063D":["FD","1","DeliveryRate"],"063E":["SQ","1","DeliveryRateUnitSequence"],"063F":["SQ","1","TreatmentPositionSequence"],"0640":["FD","1","RadiationSourceAxisDistance"],"0641":["US","1","NumberOfRTBeamLimitingDevices"],"0642":["FD","1","RTBeamLimitingDeviceProximalDistance"],"0643":["FD","1","RTBeamLimitingDeviceDistalDistance"],"0644":["SQ","1","ParallelRTBeamDelimiterDeviceOrientationLabelCodeSequence"],"0645":["FD","1","BeamModifierOrientationAngle"],"0646":["SQ","1","FixedRTBeamDelimiterDeviceSequence"],"0647":["SQ","1","ParallelRTBeamDelimiterDeviceSequence"],"0648":["US","1","NumberOfParallelRTBeamDelimiters"],"0649":["FD","2-n","ParallelRTBeamDelimiterBoundaries"],"064A":["FD","2-n","ParallelRTBeamDelimiterPositions"],"064B":["FD","2","RTBeamLimitingDeviceOffset"],"064C":["SQ","1","RTBeamDelimiterGeometrySequence"],"064D":["SQ","1","RTBeamLimitingDeviceDefinitionSequence"],"064E":["CS","1","ParallelRTBeamDelimiterOpeningMode"],"064F":["CS","1-n","ParallelRTBeamDelimiterLeafMountingSide"],"0650":["UI","1","PatientSetupUID"],"0651":["SQ","1","WedgeDefinitionSequence"],"0652":["FD","1","RadiationBeamWedgeAngle"],"0653":["FD","1","RadiationBeamWedgeThinEdgeDistance"],"0654":["FD","1","RadiationBeamEffectiveWedgeAngle"],"0655":["US","1","NumberOfWedgePositions"],"0656":["SQ","1","RTBeamLimitingDeviceOpeningSequence"],"0657":["US","1","NumberOfRTBeamLimitingDeviceOpenings"],"0658":["SQ","1","RadiationDosimeterUnitSequence"],"0659":["SQ","1","RTDeviceDistanceReferenceLocationCodeSequence"],"065A":["SQ","1","RadiationDeviceConfigurationAndCommissioningKeySequence"],"065B":["SQ","1","PatientSupportPositionParameterSequence"],"065C":["CS","1","PatientSupportPositionSpecificationMethod"],"065D":["SQ","1","PatientSupportPositionDeviceParameterSequence"],"065E":["US","1","DeviceOrderIndex"],"065F":["US","1","PatientSupportPositionParameterOrderIndex"],"0660":["SQ","1","PatientSupportPositionDeviceToleranceSequence"],"0661":["US","1","PatientSupportPositionToleranceOrderIndex"],"0662":["SQ","1","CompensatorDefinitionSequence"],"0663":["CS","1","CompensatorMapOrientation"],"0664":["OF","1","CompensatorProximalThicknessMap"],"0665":["OF","1","CompensatorDistalThicknessMap"],"0666":["FD","1","CompensatorBasePlaneOffset"],"0667":["SQ","1","CompensatorShapeFabricationCodeSequence"],"0668":["SQ","1","CompensatorShapeSequence"],"0669":["FD","1","RadiationBeamCompensatorMillingToolDiameter"],"066A":["SQ","1","BlockDefinitionSequence"],"066B":["OF","1","BlockEdgeData"],"066C":["CS","1","BlockOrientation"],"066D":["FD","1","RadiationBeamBlockThickness"],"066E":["FD","1","RadiationBeamBlockSlabThickness"],"066F":["SQ","1","BlockEdgeDataSequence"],"0670":["US","1","NumberOfRTAccessoryHolders"],"0671":["SQ","1","GeneralAccessoryDefinitionSequence"],"0672":["US","1","NumberOfGeneralAccessories"],"0673":["SQ","1","BolusDefinitionSequence"],"0674":["US","1","NumberOfBoluses"],"0675":["UI","1","EquipmentFrameOfReferenceUID"],"0676":["ST","1","EquipmentFrameOfReferenceDescription"],"0677":["SQ","1","EquipmentReferencePointCoordinatesSequence"],"0678":["SQ","1","EquipmentReferencePointCodeSequence"],"0679":["FD","1","RTBeamLimitingDeviceAngle"],"067A":["FD","1","SourceRollAngle"],"067B":["SQ","1","RadiationGenerationModeSequence"],"067C":["SH","1","RadiationGenerationModeLabel"],"067D":["ST","1","RadiationGenerationModeDescription"],"067E":["SQ","1","RadiationGenerationModeMachineCodeSequence"],"067F":["SQ","1","RadiationTypeCodeSequence"],"0680":["DS","1","NominalEnergy"],"0681":["DS","1","MinimumNominalEnergy"],"0682":["DS","1","MaximumNominalEnergy"],"0683":["SQ","1","RadiationFluenceModifierCodeSequence"],"0684":["SQ","1","EnergyUnitCodeSequence"],"0685":["US","1","NumberOfRadiationGenerationModes"],"0686":["SQ","1","PatientSupportDevicesSequence"],"0687":["US","1","NumberOfPatientSupportDevices"],"0688":["FD","1","RTBeamModifierDefinitionDistance"],"0689":["SQ","1","BeamAreaLimitSequence"],"068A":["SQ","1","ReferencedRTPrescriptionSequence"],"0700":["UI","1","TreatmentSessionUID"],"0701":["CS","1","RTRadiationUsage"],"0702":["SQ","1","ReferencedRTRadiationSetSequence"],"0703":["SQ","1","ReferencedRTRadiationRecordSequence"],"0704":["US","1","RTRadiationSetDeliveryNumber"],"0705":["US","1","ClinicalFractionNumber"],"0706":["CS","1","RTTreatmentFractionCompletionStatus"],"0707":["CS","1","RTRadiationSetUsage"],"0708":["CS","1","TreatmentDeliveryContinuationFlag"],"0709":["CS","1","TreatmentRecordContentOrigin"],"0714":["CS","1","RTTreatmentTerminationStatus"],"0715":["SQ","1","RTTreatmentTerminationReasonCodeSequence"],"0716":["SQ","1","MachineSpecificTreatmentTerminationCodeSequence"],"0722":["SQ","1","RTRadiationSalvageRecordControlPointSequence"],"0723":["CS","1","StartingMetersetValueKnownFlag"],"0730":["ST","1","TreatmentTerminationDescription"],"0731":["SQ","1","TreatmentToleranceViolationSequence"],"0732":["CS","1","TreatmentToleranceViolationCategory"],"0733":["SQ","1","TreatmentToleranceViolationAttributeSequence"],"0734":["ST","1","TreatmentToleranceViolationDescription"],"0735":["ST","1","TreatmentToleranceViolationIdentification"],"0736":["DT","1","TreatmentToleranceViolationDateTime"],"073A":["DT","1","RecordedRTControlPointDateTime"],"073B":["US","1","ReferencedRadiationRTControlPointIndex"],"073E":["SQ","1","AlternateValueSequence"],"073F":["SQ","1","ConfirmationSequence"],"0740":["SQ","1","InterlockSequence"],"0741":["DT","1","InterlockDateTime"],"0742":["ST","1","InterlockDescription"],"0743":["SQ","1","InterlockOriginatingDeviceSequence"],"0744":["SQ","1","InterlockCodeSequence"],"0745":["SQ","1","InterlockResolutionCodeSequence"],"0746":["SQ","1","InterlockResolutionUserSequence"],"0760":["DT","1","OverrideDateTime"],"0761":["SQ","1","TreatmentToleranceViolationTypeCodeSequence"],"0762":["SQ","1","TreatmentToleranceViolationCauseCodeSequence"],"0772":["SQ","1","MeasuredMetersetToDoseMappingSequence"],"0773":["US","1","ReferencedExpectedInVivoMeasurementValueIndex"],"0774":["SQ","1","DoseMeasurementDeviceCodeSequence"],"0780":["SQ","1","AdditionalParameterRecordingInstanceSequence"],"0782":["US","1",""],"0783":["ST","1","InterlockOriginDescription"],"0784":["SQ","1","RTPatientPositionScopeSequence"],"0785":["UI","1","ReferencedTreatmentPositionGroupUID"],"0786":["US","1","RadiationOrderIndex"],"0787":["SQ","1","OmittedRadiationSequence"],"0788":["SQ","1","ReasonForOmissionCodeSequence"],"0789":["SQ","1","RTDeliveryStartPatientPositionSequence"],"078A":["SQ","1","RTTreatmentPreparationPatientPositionSequence"],"078B":["SQ","1","ReferencedRTTreatmentPreparationSequence"],"078C":["SQ","1","ReferencedPatientSetupPhotoSequence"],"078D":["SQ","1","PatientTreatmentPreparationMethodCodeSequence"],"078E":["LT","1","PatientTreatmentPreparationProcedureParameterDescription"],"078F":["SQ","1","PatientTreatmentPreparationDeviceSequence"],"0790":["SQ","1","PatientTreatmentPreparationProcedureSequence"],"0791":["SQ","1","PatientTreatmentPreparationProcedureCodeSequence"],"0792":["LT","1","PatientTreatmentPreparationMethodDescription"],"0793":["SQ","1","PatientTreatmentPreparationProcedureParameterSequence"],"0794":["LT","1","PatientSetupPhotoDescription"],"0795":["US","1","PatientTreatmentPreparationProcedureIndex"],"0796":["US","1","ReferencedPatientSetupProcedureIndex"],"0797":["SQ","1","RTRadiationTaskSequence"],"0798":["SQ","1","RTPatientPositionDisplacementSequence"],"0799":["SQ","1","RTPatientPositionSequence"],"079A":["LO","1","DisplacementReferenceLabel"],"079B":["FD","16","DisplacementMatrix"],"079C":["SQ","1","PatientSupportDisplacementSequence"],"079D":["SQ","1","DisplacementReferenceLocationCodeSequence"],"079E":["CS","1","RTRadiationSetDeliveryUsage"]},"300C":{"0000":["UL","1","GenericGroupLength"],"0002":["SQ","1","ReferencedRTPlanSequence"],"0004":["SQ","1","ReferencedBeamSequence"],"0006":["IS","1","ReferencedBeamNumber"],"0007":["IS","1","ReferencedReferenceImageNumber"],"0008":["DS","1","StartCumulativeMetersetWeight"],"0009":["DS","1","EndCumulativeMetersetWeight"],"000A":["SQ","1","ReferencedBrachyApplicationSetupSequence"],"000C":["IS","1","ReferencedBrachyApplicationSetupNumber"],"000E":["IS","1","ReferencedSourceNumber"],"0020":["SQ","1","ReferencedFractionGroupSequence"],"0022":["IS","1","ReferencedFractionGroupNumber"],"0040":["SQ","1","ReferencedVerificationImageSequence"],"0042":["SQ","1","ReferencedReferenceImageSequence"],"0050":["SQ","1","ReferencedDoseReferenceSequence"],"0051":["IS","1","ReferencedDoseReferenceNumber"],"0055":["SQ","1","BrachyReferencedDoseReferenceSequence"],"0060":["SQ","1","ReferencedStructureSetSequence"],"006A":["IS","1","ReferencedPatientSetupNumber"],"0080":["SQ","1","ReferencedDoseSequence"],"00A0":["IS","1","ReferencedToleranceTableNumber"],"00B0":["SQ","1","ReferencedBolusSequence"],"00C0":["IS","1","ReferencedWedgeNumber"],"00D0":["IS","1","ReferencedCompensatorNumber"],"00E0":["IS","1","ReferencedBlockNumber"],"00F0":["IS","1","ReferencedControlPointIndex"],"00F2":["SQ","1","ReferencedControlPointSequence"],"00F4":["IS","1","ReferencedStartControlPointIndex"],"00F6":["IS","1","ReferencedStopControlPointIndex"],"0100":["IS","1","ReferencedRangeShifterNumber"],"0102":["IS","1","ReferencedLateralSpreadingDeviceNumber"],"0104":["IS","1","ReferencedRangeModulatorNumber"],"0111":["SQ","1","OmittedBeamTaskSequence"],"0112":["CS","1","ReasonForOmission"],"0113":["LO","1","ReasonForOmissionDescription"],"0114":["SQ","1","PrescriptionOverviewSequence"],"0115":["FL","1","TotalPrescriptionDose"],"0116":["SQ","1","PlanOverviewSequence"],"0117":["US","1","PlanOverviewIndex"],"0118":["US","1","ReferencedPlanOverviewIndex"],"0119":["US","1","NumberOfFractionsIncluded"],"0120":["SQ","1","DoseCalibrationConditionsSequence"],"0121":["FD","1","AbsorbedDoseToMetersetRatio"],"0122":["FD","2","DelineatedRadiationFieldSize"],"0123":["CS","1","DoseCalibrationConditionsVerifiedFlag"],"0124":["FD","1","CalibrationReferencePointDepth"],"0125":["SQ","1","GatingBeamHoldTransitionSequence"],"0126":["CS","1","BeamHoldTransition"],"0127":["DT","1","BeamHoldTransitionDateTime"],"0128":["SQ","1","BeamHoldOriginatingDeviceSequence"]},"300E":{"0000":["UL","1","GenericGroupLength"],"0002":["CS","1","ApprovalStatus"],"0004":["DA","1","ReviewDate"],"0005":["TM","1","ReviewTime"],"0008":["PN","1","ReviewerName"]},"4FFE":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","MACParametersSequence"]},"7F00":{"0000":["UL","1","GenericGroupLength"],"0010":["ox","1","VariablePixelData"],"0011":["US","1","VariableNextDataGroup"],"0020":["OW","1","VariableCoefficientsSDVN"],"0030":["OW","1","VariableCoefficientsSDHN"],"0040":["OW","1","VariableCoefficientsSDDN"]},"7FE0":{"0000":["UL","1","GenericGroupLength"],"0001":["OV","1","ExtendedOffsetTable"],"0002":["OV","1","ExtendedOffsetTableLengths"],"0008":["OF","1","FloatPixelData"],"0009":["OD","1","DoubleFloatPixelData"],"0010":["ox","1","PixelData"],"0020":["OW","1","CoefficientsSDVN"],"0030":["OW","1","CoefficientsSDHN"],"0040":["OW","1","CoefficientsSDDN"]},"FFFA":{"0000":["UL","1","GenericGroupLength"],"FFFA":["SQ","1","DigitalSignaturesSequence"]},"FFFC":{"0000":["UL","1","GenericGroupLength"],"FFFC":["OB","1","DataSetTrailingPadding"]},"FFFE":{"0000":["UL","1","GenericGroupLength"],"E000":["NONE","1","Item"],"E00D":["NONE","1","ItemDelimitationItem"],"E0DD":["NONE","1","SequenceDelimitationItem"]}}');function X(e,t){Y[e]=t}const W={"0000":"Command","0002":"Meta Element","0004":"File Set","0008":"Identifying","0009":"SPI Identifying","0010":"Patient","0012":"Clinical Trial","0018":"Acquisition","0019":"SPI Acquisition","0020":"Image","0021":"SPI Image","0022":"Ophthalmology","0028":"Image Presentation","0032":"Study","0038":"Visit","003A":"Waveform","0040":"Procedure","0042":"Encapsulated Document","0050":"Device Information","0054":"Nuclear Medicine","0060":"Histogram","0070":"Presentation State","0072":"Hanging Protocol","0088":"Storage","0100":"Authorization","0400":"Digital Signature",1e3:"Code Table",1010:"Zonal Map",2e3:"Film Session",2010:"Film Box",2020:"Image Box",2030:"Annotation",2040:"Overlay Box",2050:"Presentation LUT",2100:"Print Job",2110:"Printer",2120:"Queue",2130:"Print Content",2200:"Media Creation",3002:"RT Image",3004:"RT Dose",3006:"RT StructureSet",3008:"RT Treatment","300A":"RT Plan","300C":"RT Relationship","300E":"RT Approval",4e3:"Text",4008:"Results","4FFE":"MAC Parameters",5e3:"Curve",5002:"Curve",5004:"Curve",5006:"Curve",5008:"Curve","500A":"Curve","500C":"Curve","500E":"Curve",5010:"Curve",5012:"Curve",5014:"Curve",5016:"Curve",5018:"Curve","501A":"Curve","501C":"Curve","501E":"Curve",5400:"Waveform Data",6e3:"Overlays",6002:"Overlays",6004:"Overlays",6006:"Overlays",6008:"Overlays","600A":"Overlays","600C":"Overlays","600E":"Overlays",6010:"Overlays",6012:"Overlays",6014:"Overlays",6016:"Overlays",6018:"Overlays","601A":"Overlays","601C":"Overlays","601E":"Overlays",FFFC:"Generic","7FE0":"Pixel Data",FFFF:"Unknown"},$={OB:!0,OD:!0,OF:!0,OL:!0,OV:!0,OW:!0,SQ:!0,SV:!0,UC:!0,UN:!0,UR:!0,UT:!0,UV:!0,ox:!0};function j(e){return void 0!==$[e]}const Z={SH:!0,LO:!0,UC:!0,ST:!0,LT:!0,UT:!0,PN:!0};function K(e){return void 0!==Z[e]}const _={AE:"string",AS:"string",AT:void 0,CS:"string",DA:"string",DS:"string",DT:"string",FL:"Float32",FD:"Float64",IS:"string",LO:"string",LT:"string",OB:"Uint8",OD:"Uint64",OF:"Uint32",OL:"Uint32",OV:"Uint64",OW:"Uint16",PN:"string",SH:"string",SL:"Int32",SQ:void 0,SS:"Int16",ST:"string",SV:"Int64",TM:"string",UC:"string",UI:"string",UL:"Uint32",UN:"Uint8",UR:"string",US:"Uint16",UT:"string",UV:"Uint64"},J={"1.2.840.10008.1.2":"Implicit VR Little Endian","1.2.840.10008.1.2.1":"Explicit VR Little Endian","1.2.840.10008.1.2.1.98":"Encapsulated Uncompressed Explicit VR Little Endian","1.2.840.10008.1.2.1.99":"Deflated Explicit VR Little Endian","1.2.840.10008.1.2.2":"Explicit VR Big Endian (Retired)","1.2.840.10008.1.2.4.50":"JPEG Baseline (Process 1)","1.2.840.10008.1.2.4.51":"JPEG Extended (Process 2 & 4)","1.2.840.10008.1.2.4.52":"JPEG Extended (Process 3 & 5) (Retired)","1.2.840.10008.1.2.4.53":"JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8) (Retired)","1.2.840.10008.1.2.4.54":"JPEG Spectral Selection, Non-Hierarchical (Process 7 & 9) (Retired)","1.2.840.10008.1.2.4.55":"JPEG Full Progression, Non-Hierarchical (Process 10 & 12) (Retired)","1.2.840.10008.1.2.4.56":"JPEG Full Progression, Non-Hierarchical (Process 11 & 13) (Retired)","1.2.840.10008.1.2.4.57":"JPEG Lossless, Non-Hierarchical (Process 14)","1.2.840.10008.1.2.4.58":"JPEG Lossless, Non-Hierarchical (Process 15) (Retired)","1.2.840.10008.1.2.4.59":"JPEG Extended, Hierarchical (Process 16 & 18) (Retired)","1.2.840.10008.1.2.4.60":"JPEG Extended, Hierarchical (Process 17 & 19) (Retired)","1.2.840.10008.1.2.4.61":"JPEG Spectral Selection, Hierarchical (Process 20 & 22) (Retired)","1.2.840.10008.1.2.4.62":"JPEG Spectral Selection, Hierarchical (Process 21 & 23) (Retired)","1.2.840.10008.1.2.4.63":"JPEG Full Progression, Hierarchical (Process 24 & 26) (Retired)","1.2.840.10008.1.2.4.64":"JPEG Full Progression, Hierarchical (Process 25 & 27) (Retired)","1.2.840.10008.1.2.4.65":"JPEG Lossless, Hierarchical (Process 28) (Retired)","1.2.840.10008.1.2.4.66":"JPEG Lossless, Hierarchical (Process 29) (Retired)","1.2.840.10008.1.2.4.70":"JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])","1.2.840.10008.1.2.4.80":"JPEG-LS Lossless Image Compression","1.2.840.10008.1.2.4.81":"JPEG-LS Lossy (Near-Lossless) Image Compression","1.2.840.10008.1.2.4.90":"JPEG 2000 Image Compression (Lossless Only)","1.2.840.10008.1.2.4.91":"JPEG 2000 Image Compression","1.2.840.10008.1.2.4.92":"JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)","1.2.840.10008.1.2.4.93":"JPEG 2000 Part 2 Multi-component Image Compression","1.2.840.10008.1.2.4.94":"JPIP Referenced","1.2.840.10008.1.2.4.95":"JPIP Referenced Deflate","1.2.840.10008.1.2.4.100":"MPEG2 Main Profile / Main Level","1.2.840.10008.1.2.4.101":"MPEG2 Main Profile / High Level","1.2.840.10008.1.2.4.102":"MPEG-4 AVC/H.264 High Profile / Level 4.1","1.2.840.10008.1.2.4.103":"MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1","1.2.840.10008.1.2.4.104":"MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video","1.2.840.10008.1.2.4.105":"MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video","1.2.840.10008.1.2.4.106":"MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2","1.2.840.10008.1.2.4.107":"HEVC/H.265 Main Profile / Level 5.1","1.2.840.10008.1.2.4.108":"HEVC/H.265 Main 10 Profile / Level 5.1","1.2.840.10008.1.2.5":"RLE Lossless","1.2.840.10008.1.2.6.1":"RFC 2557 MIME encapsulation (Retired)","1.2.840.10008.1.2.6.2":"XML Encoding (Retired)","1.2.840.10008.1.2.7.1":"SMPTE ST 2110-20 Uncompressed Progressive Active Video","1.2.840.10008.1.2.7.2":"SMPTE ST 2110-20 Uncompressed Interlaced Active Video","1.2.840.10008.1.2.7.3":"SMPTE ST 2110-30 PCM Digital Audio","1.2.840.10008.1.20":"Papyrus 3 Implicit VR Little Endian (Retired)"},ee="1.2.840.10008.1.2",te="1.2.840.10008.1.2.1",ne="1.2.840.10008.1.2.2";class ie{#l;#c;#u;constructor(e,t,n){this.#l=e,this.#c=t,this.#u=n}getVr(){return this.#l}getMultiplicity(){return this.#c}getName(){return this.#u}}function oe(e){if(void 0===e)return;let t;const n=e.getGroup(),i=e.getElement();if(void 0!==Y[n]&&void 0!==Y[n][i]){const e=Y[n][i];t=new ie(e[0],parseInt(e[1],10),e[2])}return t}function re(e){return W[e.getGroup()]}function ae(e){if(null==e)return;const t=Object.keys(Y);for(const n of t){const t=Object.keys(Y[n]);for(const i of t)if(Y[n][i][2]===e)return new F(n,i)}}class se{vr;value;tag;vl;undefinedLength;startOffset;endOffset;items;constructor(e){this.vr=e}}function le(e){return void 0!==e&&void 0!==e.value&&0!==e.value.length}function ce(e,t){let n;return le(e[t])&&(n=e[t].value[0]),n}function ue(e,t){let n;return le(e[t])&&(n=e[t].value),n}function de(e,t,n){let i="";if(void 0===e)i+=` ${t} is undefined,`;else if(void 0===e.value)i+=` ${t} has undefined value,`;else if(0===e.value.length)i+=` ${t} is empty,`;else if(void 0!==n)for(let o=0;o<n.length;++o)e.value.includes(n[o])||(i+=` ${t} does not contain ${n[o]} (value: ${e.value}),`);return i}function he(e){const t=e.byteLength,n=new Uint8Array(e.buffer,e.byteOffset,t),i=e.BYTES_PER_ELEMENT;let o;for(let e=0;e<t;e+=i)for(let t=e+i-1,r=e;t>r;t--,r++)o=n[r],n[r]=n[t],n[t]=o}class ge{#d;#h=!0;#g=function(){return new Int8Array(new Int16Array([1]).buffer)[0]>0}();#S;#m;constructor(e,t){this.#d=e,void 0!==t&&(this.#h=t),this.#S=this.#h!==this.#g,this.#m=new DataView(e)}readUint16(e){return this.#m.getUint16(e,this.#h)}readInt16(e){return this.#m.getInt16(e,this.#h)}readUint32(e){return this.#m.getUint32(e,this.#h)}readBigUint64(e){return this.#m.getBigUint64(e,this.#h)}readInt32(e){return this.#m.getInt32(e,this.#h)}readBigInt64(e){return this.#m.getBigInt64(e,this.#h)}readFloat32(e){return this.#m.getFloat32(e,this.#h)}readFloat64(e){return this.#m.getFloat64(e,this.#h)}readBinaryArray(e,t,n){const i=new Uint8Array(this.#d,e,t);let o;o=void 0!==n?n:8*i.length;const r=new Uint8Array(o);let a,s;for(let e=0;e<o;++e)a=e%8,s=Math.floor(e/8),r[e]=255*!!(i[s]&1<<a);return r}readUint8Array(e,t){return new Uint8Array(this.#d,e,t)}readInt8Array(e,t){return new Int8Array(this.#d,e,t)}readUint16Array(e,t){const n=Uint16Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new Uint16Array(this.#d,e,i),this.#S&&he(o);else{o=new Uint16Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readUint16(t),t+=n}return o}readInt16Array(e,t){const n=Int16Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new Int16Array(this.#d,e,i),this.#S&&he(o);else{o=new Int16Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readInt16(t),t+=n}return o}readUint32Array(e,t){const n=Uint32Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new Uint32Array(this.#d,e,i),this.#S&&he(o);else{o=new Uint32Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readUint32(t),t+=n}return o}readUint64Array(e,t){const n=BigUint64Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new BigUint64Array(this.#d,e,i),this.#S&&he(o);else{o=new BigUint64Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readBigUint64(t),t+=n}return o}readInt32Array(e,t){const n=Int32Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new Int32Array(this.#d,e,i),this.#S&&he(o);else{o=new Int32Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readInt32(t),t+=n}return o}readInt64Array(e,t){const n=BigInt64Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new BigInt64Array(this.#d,e,i),this.#S&&he(o);else{o=new BigInt64Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readBigInt64(t),t+=n}return o}readFloat32Array(e,t){const n=Float32Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new Float32Array(this.#d,e,i),this.#S&&he(o);else{o=new Float32Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readFloat32(t),t+=n}return o}readFloat64Array(e,t){const n=Float64Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new Float64Array(this.#d,e,i),this.#S&&he(o);else{o=new Float64Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readFloat64(t),t+=n}return o}readHex(e){const t=this.readUint16(e).toString(16);return"0000".substring(0,4-t.length)+t.toUpperCase()}}function Se(){return"0.37.0-beta.21"}function me(e){let t;return e.startsWith("1.2.826.0.1.3680043.9.7278.1")&&(t=e.substring(29).replace(".99","-beta")),t}function pe(e){const t=e.split("-");let n=[];for(const e of t)n=n.concat(e.split("."));return n}function fe(e,t){let n=0;const i=pe(e),o=pe(t);for(let e=0;e<3&&(n=parseInt(i[e],10)-parseInt(o[e],10),0===n);++e);if(0===n){const e=4,t=i[e],r=o[e];n=void 0===t&&void 0===r?0:void 0===t&&void 0!==r?1:void 0!==t&&void 0===r?-1:parseInt(t,10)-parseInt(r,10)}return n}function ve(e,t,n){const i=fe(e,t),o=fe(e,n);return i>=0&&o<=0}function Ce(e){return!(e.byteLength<132)&&"DICM"===new Uint8Array(e,128,4).reduce(function(e,t){return e+String.fromCharCode(t)},"")}function ye(e){return e.replace(/\0/g,"").trim()}class De{decode(e){let t="";for(let n=0,i=e.length;n<i;++n)t+=String.fromCharCode(e[n]);return t}}function Ie(e){if(!e)return null;const t={L:"R",R:"L",A:"P",P:"A",H:"F",F:"H"};let n="";for(let i=0;i<e.length;i++){const o=t[e.substring(i,i+1)];o&&(n+=o)}return n}function we(e){return e===ee}function Te(e){return e===ne}function Le(e){return"1.2.840.10008.1.2.4.50"===e||"1.2.840.10008.1.2.4.51"===e}function Pe(e){return"1.2.840.10008.1.2.4.57"===e||"1.2.840.10008.1.2.4.70"===e}function Ae(e){return null!==e.match(/1.2.840.10008.1.2.4.9/)}function Oe(e){return"1.2.840.10008.1.2.5"===e}function be(e,t,n){let i=null;try{1===e||8===e?i=0===t?new Uint8Array(n):new Int8Array(n):16===e?i=0===t?new Uint16Array(n):new Int16Array(n):32===e&&(i=0===t?new Uint32Array(n):new Int32Array(n))}catch(e){Ee(e,n)}return i}function xe(e,t){let n=null;try{n=new(0,e.constructor)(t)}catch(e){Ee(e,t)}return n}function Ee(e,t){if(e instanceof RangeError){const e=Math.floor(Math.log(t)/Math.log(2));s.error(`Cannot allocate array of size: ${t} (>2^${e}).`)}}function Re(e,t){return t?8:j(e)?12:8}const Fe="00280100",Me="00280103",qe="7FE00010";class Ue{#p={};#f;#v=new De;#C=this.#v;#y(e){return this.#v.decode(e)}#D(e){return this.#C.decode(e)}getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}setDecoderCharacterSet(e){this.#C=new TextDecoder(e)}getDicomElements(){return this.#p}safeGet(e){return ce(this.#p,e)}#I(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 F(n,i),endOffset:t}}#w(e,t,n){const i={};let o=this.#T(e,t,n);if(t=o.endOffset,B(o.tag))return{data:i,endOffset:o.endOffset,isSeqDelim:!0};if(i[o.tag.getKey()]={tag:o.tag,vr:"NONE",vl:o.vl,undefinedLength:o.undefinedLength},o.undefinedLength){let r=!1;for(;!r;)o=this.#T(e,t,n),t=o.endOffset,r=Q(o.tag),r||(i[o.tag.getKey()]=o)}else{const r=t;for(t-=o.vl;t<r;)o=this.#T(e,t,n),t=o.endOffset,i[o.tag.getKey()]=o}return{data:i,endOffset:t,isSeqDelim:!1}}#L(e,t,n){const i=[];let o=this.#T(e,t,n);const r=o.vl;t=o.endOffset;let a=!1;for(;!a;)o=this.#T(e,t,n),t=o.endOffset,a=B(o.tag),a||(o.vr="OB",i.push(o));return{data:i,endOffset:t,offsetTableVl:r}}#T(e,t,n,i){const o=this.#I(e,t),r=o.tag;if(void 0!==i&&r.equals(i)){const e=new se("");return e.tag=r,e}t=o.endOffset;let a,l="NONE",c=!0;r.isWithVR()&&(n?(l=oe(r)?.getVr(),void 0===l&&(l="UN"),c=!0):(l=this.#y(e.readUint8Array(t,2)),t+=2*Uint8Array.BYTES_PER_ELEMENT,c=j(l),c&&(t+=2*Uint8Array.BYTES_PER_ELEMENT))),function(e){return Object.keys(_).concat(["NONE","ox","xx","xs"]).includes(e)}(l)||(s.warn(`Unknown VR: ${l} (for tag ${r.getKey()}), treating as 'UN'`),l="UN"),c?(a=e.readUint32(t),t+=Uint32Array.BYTES_PER_ELEMENT):(a=e.readUint16(t),t+=Uint16Array.BYTES_PER_ELEMENT);let u=!1;4294967295===a&&(u=!0,a=0),r.isPrivate()&&"UN"===l&&0===a&&(l="SQ");let d,h=t,g=h+a;if(G(r)&&u){const i=this.#L(e,t,n);t=i.endOffset,h+=i.offsetTableVl,d=i.data,g=t,a=t-h}else if("SQ"===l){let i;if(d=[],u){let o=!1;for(;!o;)i=this.#w(e,t,n),o=i.isSeqDelim,t=i.endOffset,o||d.push(i.data);g=t,a=t-h}else if(0!==a){const o=t+a;for(;t<o;)i=this.#w(e,t,n),d.push(i.data),t=i.endOffset;g=t,a=t-h}}const S=new se(l);return S.tag=r,S.vl=a,S.startOffset=h,S.endOffset=g,u&&(S.undefinedLength=u),d&&(S.items=d),S}#P(e,t,n){const i=e.tag,o=e.vl,r=e.vr,a=e.startOffset;let l,c,u;void 0!==n&&(l=n.bitsAllocated,c=n.pixelRepresentation);const d=_[r];if(G(i))if(e.undefinedLength){u=[];for(let i=0;i<e.items.length;++i)u.push(this.#P(e.items[i],t,n));delete e.items}else{l>8&&"OB"===r&&(s.warn("Reading DICOM pixel data with bitsAllocated>8 and OB VR, treating as OW"),e.vr="OW"),u=[];const d=i.getKey();if("7FE00008"===d)u.push(t.readFloat32Array(a,o));else if("7FE00009"===d)u.push(t.readFloat64Array(a,o));else if(1===l)u.push(t.readBinaryArray(a,o,n.imageBufferSize));else if(8===l)0===c?u.push(t.readUint8Array(a,o)):u.push(t.readInt8Array(a,o));else if(16===l)0===c?u.push(t.readUint16Array(a,o)):u.push(t.readInt16Array(a,o));else{if(32!==l)throw new Error(`Unsupported bits allocated: ${l}`);0===c?u.push(t.readUint32Array(a,o)):u.push(t.readInt32Array(a,o))}}else if(void 0!==d)if("Uint8"===d)u=t.readUint8Array(a,o);else if("Uint16"===d)u=t.readUint16Array(a,o),"O"!==r[0]&&(u=Array.from(u));else if("Uint32"===d)u=t.readUint32Array(a,o),"O"!==r[0]&&(u=Array.from(u));else if("Uint64"===d)u=t.readUint64Array(a,o);else if("Int16"===d)u=Array.from(t.readInt16Array(a,o));else if("Int32"===d)u=Array.from(t.readInt32Array(a,o));else if("Int64"===d)u=t.readInt64Array(a,o);else if("Float32"===d)u=Array.from(t.readFloat32Array(a,o));else if("Float64"===d)u=Array.from(t.readFloat64Array(a,o));else{if("string"!==d)throw new Error(`Unknown VR type: ${d}`);{const e=t.readUint8Array(a,o);u=K(r)?this.#D(e):this.#y(e),u=ye(u).split("\\")}}else if("xx"===r)u=Array.from(t.readUint16Array(a,o));else if("ox"===r)u=8===l?0===c?Array.from(t.readUint8Array(a,o)):Array.from(t.readInt8Array(a,o)):0===c?Array.from(t.readUint16Array(a,o)):Array.from(t.readInt16Array(a,o));else if("xs"===r)u=0===c?Array.from(t.readUint16Array(a,o)):Array.from(t.readInt16Array(a,o));else if("AT"===r){const e=t.readUint16Array(a,o);u=[];for(let t=0,n=e.length;t<n;t+=2){const n=e[t].toString(16),i=e[t+1].toString(16);let o="(";o+="0000".substring(0,4-n.length)+n.toUpperCase(),o+=",",o+="0000".substring(0,4-i.length)+i.toUpperCase(),o+=")",u.push(o)}}else if("SQ"===r){u=[];for(let n=0;n<e.items.length;++n){const i=e.items[n],o={},r=Object.keys(i);let a=l,s=c;for(let e=0;e<r.length;++e){let n=i[Fe];void 0!==n&&void 0!==n.value&&(a=n.value[0]),n=i[Me],void 0!==n&&void 0!==n.value&&(s=n.value[0]);const l={bitsAllocated:a,pixelRepresentation:s},c=i[r[e]];c.value=this.#P(c,t,l),delete c.tag,delete c.vl,delete c.startOffset,delete c.endOffset,o[r[e]]=c}u.push(o)}delete e.items}else"NONE"===r||s.warn(`Unknown VR: ${r} (for tag ${e.tag.getKey()})`),u=[];return u}#A(e,t,n){const i=Object.keys(e);for(let o=0;o<i.length;++o){const r=e[i[o]];void 0===r.value&&(r.value=this.#P(r,t,n)),delete r.tag,delete r.vl,delete r.startOffset,delete r.endOffset}}parse(e,t){let n,i,o;const r=new ge(e);let a=new ge(e);n=128;const l=this.#y(r.readUint8Array(n,4));if(n+=4*Uint8Array.BYTES_PER_ELEMENT,"DICM"===l){o=this.#T(r,n,!1),o.value=this.#P(o,r),n=o.endOffset,this.#p[o.tag.getKey()]=o;const e=n+o.value[0];for(;n<e;)o=this.#T(r,n,!1),n=o.endOffset,this.#p[o.tag.getKey()]=o;if(o=this.#p["00020010"],void 0===o)throw new Error("Not a valid DICOM file (no TransferSyntaxUID found)");o.value=this.#P(o,r),i=o.value[0]}else{s.warn(`Invalid DICM prefix (${l}), trying to guess tansfer syntax.`),o=this.#T(a,0,!1);const e=function(e){const t="0008",n=e.tag.getGroup();if("0800"!==n&&n!==t)throw new Error("Not a valid DICOM file (invalid DICM word found and first element not in 0008 group)");const i=e.vr,o=i.charCodeAt(0),r=i.charCodeAt(1),a=!(o>=65&&o<=90&&r>=65&&r<=90);let s;if(n===t)s=a?ee:te;else{if(a)throw new Error("Not a valid DICOM file (no magic DICM word foundand implicit VR big endian detected)");s=ne}const l=new se("UI");return l.tag=new F("0002","0010"),l.value=[s],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(o);this.#p[e.tag.getKey()]=e,i=e.value[0],n=0}if(!function(e){return e===ee||e===te||e===ne||Le(e)||Pe(e)||Ae(e)||Oe(e)}(i))throw new Error(`Unsupported DICOM transfer syntax: '${i}' (${function(e){let t="Unknown";return void 0!==J[e]&&(t=J[e]),t}(i)})`);let c=!1;we(i)&&(c=!0),Te(i)&&(a=new ge(e,!1));let u,d=!1;for(;n<e.byteLength;){if(o=this.#T(a,n,c,t),void 0!==t&&o.tag.equals(t)){d=!0;break}n=o.endOffset;const e=o.tag.getKey();void 0===this.#p[e]?this.#p[e]=o:s.warn(`Not saving duplicate tag: ${e}`)}if(isNaN(n))throw new Error("Problem while parsing, bad offset");if(d||e.byteLength===n||s.warn(`Did not reach the end of the buffer: ${n} != ${e.byteLength}`),H(this.#p)){let e;void 0!==this.#p[qe]&&(o=this.#p[Me],void 0!==o?(o.value=this.#P(o,a),e=o.value[0]):(s.warn("Reading DICOM pixel data with default pixelRepresentation."),e=0));let t=16;o=this.#p[Fe],void 0!==o?(o.value=this.#P(o,a),t=o.value[0]):s.warn("Reading DICOM pixel data with default bitsAllocated.");let n,i,r=1;o=this.#p["00280008"],void 0!==o&&(o.value=this.#P(o,a),r=parseInt(o.value[0],10)),u={pixelRepresentation:e,bitsAllocated:t,numberOfFrames:r,imageBufferSize:void 0},o=this.#p["00280010"],void 0!==o&&(o.value=this.#P(o,a),n=parseInt(o.value[0],10)),o=this.#p["00280011"],void 0!==o&&(o.value=this.#P(o,a),i=parseInt(o.value[0],10)),void 0!==n&&void 0!==i&&(u.imageBufferSize=n*i*r)}if(void 0!==this.#f&&this.setDecoderCharacterSet(this.#f),o=this.#p["00080005"],void 0!==o){let e;o.value=this.#P(o,a),1===o.value.length?e=o.value[0]:(e=o.value[1],s.warn(`Unsupported character set with code extensions: '${e}'.`)),this.setDecoderCharacterSet(function(e){let t="utf-8";return"ISO_IR 100"===e?t="iso-8859-1":"ISO_IR 101"===e?t="iso-8859-2":"ISO_IR 109"===e?t="iso-8859-3":"ISO_IR 110"===e?t="iso-8859-4":"ISO_IR 144"===e?t="iso-8859-5":"ISO_IR 127"===e?t="iso-8859-6":"ISO_IR 126"===e?t="iso-8859-7":"ISO_IR 138"===e?t="iso-8859-8":"ISO_IR 148"===e?t="iso-8859-9":"ISO_IR 13"===e?t="shift-jis":"ISO_IR 166"===e?t="iso-8859-11":"ISO 2022 IR 87"===e?t="iso-2022-jp":"ISO 2022 IR 149"===e||"ISO 2022 IR 58"===e||("ISO_IR 192"===e?t="utf-8":"GB18030"===e?t="gb18030":"GB2312"===e?t="gb2312":"GBK"===e&&(t="chinese")),t}(e))}if(this.#A(this.#p,a,u),o=this.#p[qe],void 0!==o&&o.undefinedLength){const e=u.numberOfFrames,t=o.value;if(t.length>1&&t.length>e){const n=t.length/e,i=[];let r;for(let o=0;o<e;++o){r=o*n;let e=0;for(let i=0;i<n;++i)e+=t[r+i].length;const a=new t[0].constructor(e);let s=0;for(let e=0;e<n;++e)a.set(t[r+e],s),s+=t[r+e].length;i[o]=a}o.value=i}}}}class Ve{#O;#b;constructor(e,t){this.#O=e,this.#b=t}getSlope(){return this.#O}getIntercept(){return this.#b}apply(e){return e*this.#O+this.#b}equals(e){return null!=e&&this.getSlope()===e.getSlope()&&this.getIntercept()===e.getIntercept()}isID(){return 1===this.getSlope()&&0===this.getIntercept()}}const Ne={wlPresets:void 0,labelTexts:void 0,privateBValueRules:void 0,openRoiDialog:void 0,highlightAnnotation:void 0,highlightSegment:void 0,getVolumeIdTagValue:void 0,getPostLoadVolumeIdTagValue:void 0,volumeIdCandidates:void 0,getTagPixelUnit:void 0};class Qe{#e;#x;constructor(e){this.#e=e}get(e,t){return this.#e[3*e+t]}getInverse(){return void 0===this.#x&&(this.#x=function(e){const t=e.get(0,0),n=e.get(0,1),i=e.get(0,2),o=e.get(1,0),r=e.get(1,1),a=e.get(1,2),l=e.get(2,0),c=e.get(2,1),u=e.get(2,2),d=r*u-a*c,h=a*l-o*u,g=o*c-r*l;let S=t*d+n*h+i*g;if(0!==S)return S=1/S,new Qe([S*d,S*(i*c-n*u),S*(n*a-i*r),S*h,S*(t*u-i*l),S*(i*o-t*a),S*g,S*(n*l-t*c),S*(t*r-n*o)]);s.warn("Cannot invert 3*3 matrix with zero determinant.")}(this)),this.#x}equals(e){for(let t=0;t<3;++t)for(let n=0;n<3;++n)if(this.get(t,n)!==e.get(t,n))return!1;return!0}isSimilar(e,t){for(let n=0;n<3;++n)for(let i=0;i<3;++i)if(!u(this.get(n,i),e.get(n,i),t))return!1;return!0}toString(){let e="[";for(let t=0;t<3;++t){0!==t&&(e+=", \n ");for(let n=0;n<3;++n)0!==n&&(e+=", "),e+=this.get(t,n)}return e+="]",e}multiply(e){const t=[];for(let n=0;n<3;++n)for(let i=0;i<3;++i){let o=0;for(let t=0;t<3;++t)o+=this.get(n,t)*e.get(t,i);t.push(o)}return new Qe(t)}getAbs(){const e=[];for(let t=0;t<3;++t)for(let n=0;n<3;++n)e.push(Math.abs(this.get(t,n)));return new Qe(e)}multiplyArray3D(e){if(3!==e.length)throw new Error(`Cannot multiply 3x3 matrix with non 3D array: ${e.length}`);const t=e[0],n=e[1],i=e[2],o=new Array(3);return o[0]=this.#e[0]*t+this.#e[1]*n+this.#e[2]*i,o[1]=this.#e[3]*t+this.#e[4]*n+this.#e[5]*i,o[2]=this.#e[6]*t+this.#e[7]*n+this.#e[8]*i,o}multiplyTypedArray3D(e,t){const n=e[0],i=e[1],o=e[2];t[0]=this.#e[0]*n+this.#e[1]*i+this.#e[2]*o,t[1]=this.#e[3]*n+this.#e[4]*i+this.#e[5]*o,t[2]=this.#e[6]*n+this.#e[7]*i+this.#e[8]*o}multiplyVector3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new g(t[0],t[1],t[2])}multiplyPoint3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new m(t[0],t[1],t[2])}multiplyIndex3D(e){const t=this.multiplyArray3D(e.getValues());return new a(t)}getRowAbsMax(e){const t=[Math.abs(this.get(e,0)),Math.abs(this.get(e,1)),Math.abs(this.get(e,2))],n=Math.max.apply(null,t),i=t.indexOf(n);return{value:this.get(e,i),index:i}}getColAbsMax(e){const t=[Math.abs(this.get(0,e)),Math.abs(this.get(1,e)),Math.abs(this.get(2,e))],n=Math.max.apply(null,t),i=t.indexOf(n);return{value:this.get(i,e),index:i}}asOneAndZeros(){const e=[];for(let t=0;t<3;++t){const n=this.getRowAbsMax(t),i=n.value>0?1:-1;for(let t=0;t<3;++t)t===n.index?e.push(i):e.push(0)}return new Qe(e)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}getValues(){return this.#e.slice()}}function Be(){return new Qe([1,0,0,0,1,0,0,0,1])}function ke(e){return e.equals(Be())}function Ge(){return new Qe([1,0,0,0,0,1,0,-1,0])}const ze={Axial:"axial",Coronal:"coronal",Sagittal:"sagittal"};function He(e){let t;return e===ze.Axial?t=Be():e===ze.Coronal?t=Ge():e===ze.Sagittal&&(t=new Qe([0,0,-1,1,0,0,0,-1,0])),t}function Ye(e){const t=new g(e.get(0,0),e.get(1,0),e.get(2,0)),n=new g(e.get(0,1),e.get(1,1),e.get(2,1)),i=new g(e.get(0,2),e.get(1,2),e.get(2,2));return Xe(t)+Xe(n)+Xe(i)}function Xe(e){let t=new g(Math.abs(e.getX()),Math.abs(e.getY()),Math.abs(e.getZ())),n="";const i=e.getX()<0?"R":"L",o=e.getY()<0?"A":"P",r=e.getZ()<0?"I":"S",a=1e-4;for(let e=0;e<3;e++)if(t.getX()>a&&t.getX()>t.getY()&&t.getX()>t.getZ())n+=i,t=new g(0,t.getY(),t.getZ());else if(t.getY()>a&&t.getY()>t.getX()&&t.getY()>t.getZ())n+=o,t=new g(t.getX(),0,t.getZ());else{if(!(t.getZ()>a&&t.getZ()>t.getX()&&t.getZ()>t.getY()))break;n+=r,t=new g(t.getX(),t.getY(),0)}return n}function We(e){let t;const n=$e(e);return void 0!==n&&(t=function(e){let t;return["LPS","LAI","RPI","RAS","ALS","ARI","PLI","PRS"].includes(e)?t=ze.Axial:["LSA","LIP","RSP","RIA","ILA","IRP","SLP","SRA"].includes(e)?t=ze.Coronal:["PSL","PIR","ASR","AIL","IAR","IPL","SAL","SPR"].includes(e)&&(t=ze.Sagittal),t}(Ye(n.asOneAndZeros()))),t}function $e(e){let t;if(void 0!==e&&6===e.length){const n=new g(e[0],e[1],e[2]),i=new g(e[3],e[4],e[5]),o=n.crossProduct(i);t=new Qe([n.getX(),i.getX(),o.getX(),n.getY(),i.getY(),o.getY(),n.getZ(),i.getZ(),o.getZ()])}return t}function je(e,t){let n=Be();return void 0!==t&&(n=e.asOneAndZeros().getInverse().multiply(t)),n.getAbs()}class Ze{#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;n<t;++n)if(this.get(n)!==e.get(n))return!1;return!0}get2D(){return{x:this.get(0),y:this.get(1)}}}const Ke={TransferSyntax:"00020010",SOPClassUID:"00080016",Modality:"00080060",ReferencedSeriesSequence:"00081115",ReferencedFrameOfReferenceSequence:"30060010",RTReferencedStudySequence:"30060012",RTReferencedSeriesSequence:"30060014",SeriesInstanceUID:"0020000E",Rows:"00280010",Columns:"00280011",PixelSpacing:"00280030",ImagerPixelSpacing:"00181164",NominalScannedPixelSpacing:"00182010",DistanceSourceToDetector:"00181110",DistanceSourceToPatient:"00181111",EstimatedRadiographicMagnificationFactor:"00181114",PixelAspectRatio:"00280034",SpacingBetweenSlices:"00180088",RescaleType:"00281054",Units:"00541001",ImageOrientationPatient:"00200037",PhotometricInterpretation:"00280004",SamplesPerPixel:"00280002",PixelMeasuresSequence:"00289110",SharedFunctionalGroupsSequence:"52009229",PerFrameFunctionalGroupsSequence:"52009230"};function _e(e){let t;const n=ce(e,Ke.Rows),i=ce(e,Ke.Columns);return void 0!==n&&void 0!==i&&(t=[i,n]),t}function Je(e,t){let n;const i=ue(e,t);return void 0!==i&&2===i.length&&(n=[parseFloat(i[1]),parseFloat(i[0])]),n}function et(e){let t;const n=ue(e,Ke.PixelMeasuresSequence);return void 0!==n&&(t=Je(n[0],Ke.PixelSpacing)),t}function tt(e){let t=Je(e,Ke.PixelSpacing);return void 0===t&&(t=function(e){let t=Je(e,Ke.ImagerPixelSpacing);if(void 0!==t){let n;const i=parseFloat(ce(e,Ke.EstimatedRadiographicMagnificationFactor));if(isNaN(i)){const t=parseFloat(ce(e,Ke.DistanceSourceToDetector)),i=parseFloat(ce(e,Ke.DistanceSourceToPatient));isNaN(t)||isNaN(i)||0===i||(n=t/i)}else n=i;void 0!==n?(t=t.map(e=>e/n),s.warn("Got pixel spacing from corrected ImagerPixelSpacing tag")):s.warn("Got pixel spacing from raw ImagerPixelSpacing tag")}return t}(e)),void 0===t&&(t=function(e){const t=Je(e,Ke.NominalScannedPixelSpacing);return void 0!==t&&s.warn("Got pixel spacing from NominalScannedPixelSpacing tag"),t}(e)),void 0===t&&(t=function(e){let t;const n=ue(e,Ke.SharedFunctionalGroupsSequence);if(void 0!==n&&(t=et(n[0])),void 0===t){const n=ue(e,Ke.PerFrameFunctionalGroupsSequence);void 0!==n&&(t=et(n[0]))}return t}(e)),t}function nt(e){const t=Je(e,Ke.PixelSpacing);if(void 0===t)return;const n=ce(e,Ke.SpacingBetweenSlices);return void 0!==n&&t.push(parseFloat(n)),new Ze(t)}function it(e){const t=ce(e,Ke.PhotometricInterpretation),n=ce(e,Ke.TransferSyntax);if(void 0!==t&&void 0!==n){let i=t.toUpperCase();(Ae(n)||Le(n)||Pe(n))&&!ot(i)&&(i="RGB");let o=ce(e,Ke.SamplesPerPixel);return void 0===o&&(o=1),"RGB"===i&&1===o&&(i="PALETTE COLOR"),i}}function ot(e){return void 0!==e&&null!==e.match(/MONOCHROME/)}function rt(e){let t;const n=ue(e,Ke.ReferencedSeriesSequence);return void 0!==n&&(t=ce(n[0],Ke.SeriesInstanceUID)),t}function at(e){const t=ue(e,Ke.ReferencedFrameOfReferenceSequence);if(void 0===t)return;const n=ue(t[0],Ke.RTReferencedStudySequence);if(void 0===n)return;const i=ue(n[0],Ke.RTReferencedSeriesSequence);return void 0!==i?ce(i[0],Ke.SeriesInstanceUID):void 0}class st{#E;#R;#F;#M;constructor(e){this.#E=e,this.#q()}#q(){this.#R=[],this.#F=[];for(let e=0;e<this.#E;++e)this.#F.push(new lt(this));this.#M=[]}addWorkerTask(e){if(this.#F.length===this.#E&&this.onworkstart({type:"work-start"}),this.#F.length>0){const t=this.#F.shift();this.#M.push(t),t.run(e)}else this.#R.push(e)}abort(){this.#U(),this.#q(),this.onabort({type:"work-abort"}),this.onworkend({type:"work-end"})}onTaskEnd(e){if(this.#R.length>0){const t=this.#R.shift();e.run(t)}else e.stop(),this.#F.push(e),this.#M=this.#M.filter(t=>t.getId()!==e.getId()),this.#F.length===this.#E&&(this.onwork({type:"work"}),this.onworkend({type:"work-end"}))}handleWorkerError=e=>{this.#U(),this.onerror({error:e}),this.onworkend({type:"work-end"})};#U(){for(const e of this.#M)e.stop();this.#M=[]}onworkstart(e){}onworkitem(e){}onwork(e){}onworkend(e){}onerror(e){}onabort(e){}}class lt{parentPool;id;runningTask;worker;constructor(e){this.parentPool=e,this.id=Math.random().toString(36).substring(2,15)}getId(){return this.id}run(e){this.runningTask=e,void 0===this.worker&&(this.worker=this.runningTask.getWorker(),this.worker.onmessage=this.onmessage,this.worker.onerror=this.onerror),this.worker.postMessage(this.runningTask.startMessage)}stop(){void 0!==this.worker&&(this.worker.terminate(),this.worker=void 0,this.runningTask=void 0)}onmessage=e=>{e.itemNumber=this.runningTask.info.itemNumber,e.numberOfItems=this.runningTask.info.numberOfItems,e.index=this.runningTask.info.index,e.indexOrigin=this.runningTask.info.indexOrigin,this.parentPool.onworkitem(e),this.parentPool.onTaskEnd(this)};onerror=e=>{e.itemNumber=this.runningTask.info.itemNumber,e.numberOfItems=this.runningTask.info.numberOfItems,e.index=this.runningTask.info.index,e.indexOrigin=this.runningTask.info.indexOrigin,this.parentPool.handleWorkerError(e),this.stop()}}class ct{constructor(e,t){this.startMessage=e,this.info=t}getWorker(){}}class ut{min;max;mean;stdDev;median;p25;p75;constructor(e,t,n,i){this.min=e,this.max=t,this.mean=n,this.stdDev=i}}function dt(e,t){return function(e){return null!=e&&(e.includes("median")||e.includes("p25")||e.includes("p75"))}(t)?function(e){const t=ht(e);if(void 0===t)return;const n=e.slice().sort(function(e,t){return e-t});return t.median=gt(n,.5),t.p25=gt(n,.25),t.p75=gt(n,.75),t}(e):ht(e)}function ht(e){const t=e.length;if(0===t)return;let n=e[0],i=n,o=0;for(const t of e)t<n?n=t:t>i&&(i=t),o+=t;const r=o/t;let a=0;for(const t of e){const e=t-r;a+=e*e}const s=Math.sqrt(a/t);return new ut(n,i,r,s)}function gt(e,t){if(0===e.length)throw new Error("Empty array provided for percentile calculation.");if(t<0||t>1)throw new Error(`Invalid ratio provided for percentile calculation: ${t}`);const n=(e.length-1)*t,i=Math.floor(n),o=e[i];return n===i?o:o+(e[i+1]-o)*(n-i)}class St{#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;e<this.length();++e)t=t||this.moreThanOne(e);return t}getDimSize(e,t){if(e>this.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;i<e;++i)n*=this.get(i);return n}getTotalSize(e){return this.getDimSize(this.length(),e)}equals(e){if(!e)return!1;const t=this.length();if(t!==e.length())return!1;for(let n=0;n<t;++n)if(this.get(n)!==e.get(n))return!1;return!0}isInBounds(e,t){if(!e)return!1;const n=this.length();if(n!==e.length())return!1;if(void 0===t){t=[];for(let e=0;e<n;++e)t.push(e)}else for(let e=0;e<n;++e)if(t[e]>n-1)throw new Error(`Wrong input dir value: ${t[e]}`);const i=function(e,t){return e>=0&&e<t};for(let n=0;n<t.length;++n)if(!i(e.get(t[n]),this.get(t[n])))return!1;return!0}indexToOffset(e,t){if(e.length()>this.length())throw new Error("Incompatible index and size length");if(void 0===t)t=0;else if(t<0||t>this.length()-1)throw new Error("Invalid start value for indexToOffset");let n=0;for(let i=t;i<e.length();++i){const o=this.get(i),r=e.get(i);if(r>=o||r<0)return-1;n+=r*this.getDimSize(i,t)}return n}offsetToIndex(e){const t=new Array(this.length());let n,i=e;for(let e=this.length()-1;e>0;--e)n=this.getDimSize(e),t[e]=Math.floor(i/n),i-=t[e]*n;return t[0]=i,new a(t)}get2D(){return{x:this.get(0),y:this.get(1)}}#V(e,t){const n=e.slice(0,this.length());for(let i=e.length;i<this.length();++i)void 0!==t&&void 0!==t[i]?n.push(t[i]):n.push(0);return n}normalisePoint(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#V(e.getValues(),n);return new C(i)}normaliseIndex(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#V(e.getValues(),n);return new a(i)}}class mt{success;message;constructor(e){this.success=e}}const pt=1e-4;function ft(e){const t=e.getInverse();return function(e,n){const i=t.multiplyPoint3D(e),o=t.multiplyPoint3D(n);return i.getZ()-o.getZ()}}function vt(e,t,n){const i=e.getClosest(t),o=new g(n.get(0,2),n.get(1,2),n.get(2,2));return{index:i,normalResidual:e.minus(t[i]).dotProduct(o)}}class Ct{#N;#Q;#B;#k=new Map;#G;#z=null;#H=Be();constructor(e,t,n,i,o){this.#N=e,this.#Q=t,this.#B=n,void 0!==o&&(this.#Y(o,e.slice()),this.#G=o),void 0!==i&&(this.#H=i)}#Y(e,t){if("number"!=typeof e?.value)throw new Error("Geometry time must be an object with a number value, for example {value: 2}");this.#k.set(e.value,{time:e,origins:t}),this.#z=null}clone(){return new Ct(this.#N.slice(),new St(this.#Q.getValues()),new Ze(this.#B.getValues()),new Qe(this.#H.getValues()),this.#G)}getInitialTime(){return this.#G}setInitialTime(e){void 0!==this.#G&&this.#k.delete(this.#G.value),this.#Y(e,this.#N.slice()),this.#G=e}getVolumeIds(){return this.#X()?.volumeIds.slice()}#X(){if(null!==this.#z)return this.#z;const e=[...this.#k.values()].map(e=>e.time).sort((e,t)=>e.value-t.value);if(0===e.length||e.some(e=>void 0===e.source))this.#z=void 0;else{const t=e.map(e=>e.value);let n=1/0;for(let e=1;e<t.length;++e)n=Math.min(n,t[e]-t[e-1]);this.#z={volumeIds:e,values:t,tolerance:t.length>1?n/2:.5}}return this.#z}setVolumeIds(e){this.#k.clear();for(const t of e)this.#Y(t,this.#N.slice());this.#G=e[0]}getVolumeIndex(e){const t=this.#X();if(void 0===t)return-1;const n=1e-9*Math.max(1,Math.abs(e));return t.values.findIndex(t=>Math.abs(t-e)<=n)}#W(){const e=this.#X();if(!(void 0===e||this.#Q.length()<4||e.values.length!==this.#Q.get(3)))return e}#$(e,t){const n=t.values,i=n.length-1;let o;if(e<0){const t=i>0?n[1]-n[0]:1;o=n[0]+e*t}else if(e>i){const t=i>0?n[i]-n[i-1]:1;o=n[i]+(e-i)*t}else o=n[e];return o}#j(e,t){const n=t.values;return e<=n[0]-t.tolerance?-1:e>=n[n.length-1]+t.tolerance?n.length:function(e,t){let n=0;for(let i=1;i<e.length;++i)Math.abs(e[i]-t)<Math.abs(e[n]-t)&&(n=i);return n}(n,e)}getCurrentTotalNumberOfSlices(){if(0===this.#k.size)return this.#N.length;let e=0;for(const t of this.#k.values())e+=t.origins.length;return e}hasSlicesAtTime(e){return this.#k.has(e)}getCurrentNumberOfSlicesBeforeTime(e){if(0===this.#k.size)return;let t=0;for(const[n,i]of this.#k)n<e&&(t+=i.origins.length);return t}checkTimeOrigins(){if(void 0===this.#G)return new mt(!0);for(const[e,t]of this.#k){const n=t.origins;if(n.length!==this.#N.length)return{success:!1,message:`Different number of slices for time ${e}: ${n.length} vs ${this.#N.length}`};for(let t=0;t<n.length;++t)if(!n[t].equals(this.#N[t]))return{success:!1,message:`Different origin for time ${e} at slice ${t}`}}return new mt(!0)}getOrigin(){return this.#N[0]}getOrigins(){return this.#N}sortOrigins(){this.#N.sort(ft(this.#H))}includesOrigin(e,t){for(let n=0;n<this.#N.length;++n)if(this.#N[n].isSimilar(e,t))return!0;return!1}getSize(e){let t=this.#Q;if(e&&void 0!==e){let n=yt([this.#Q.get(0),this.#Q.get(1),this.#Q.get(2)],e);n=n.map(Math.abs),t=new St(n.concat(this.#Q.getValues().slice(3)))}return t}updateSliceSpacing(){const e=It(this.#N);if(void 0!==e){1!==this.#B.get(2)&&this.#B.get(2)!==e&&s.debug(`Using geometric spacing ${e} instead of tag spacing ${this.#B.get(2)}`);const t=this.#B.getValues();t[2]=e,this.#B=new Ze(t)}}getSpacing(e){let t=this.#B;if(e&&void 0!==e){let n=yt([this.#B.get(0),this.#B.get(1),this.#B.get(2)],e);n=n.map(Math.abs),t=new Ze(n)}return t}getRealSpacing(){return this.getSpacing(this.#H.getInverse().asOneAndZeros())}getOrientation(){return this.#H}getSliceIndex(e,t){let n=this.#N;void 0!==t&&(n=this.#k.get(t).origins);const i=vt(e,n,this.#H);return i.normalResidual>0?i.index+1:i.index}canAppendSlice(e){const t=e.getSize();if(1!==t.get(2))return{success:!1,message:"Cannot append more than one slice"};const n=this.getSize();if(n.get(0)!==t.get(0))return{success:!1,message:"Cannot append a slice with different number of columns"};if(n.get(1)!==t.get(1))return{success:!1,message:"Cannot append a slice with different number of rows"};if(!this.getOrientation().isSimilar(e.getOrientation(),pt))return{success:!1,message:"Cannot append a slice with different orientation"};const i=this.canAppendOrigin(e.getOrigin(),e.getInitialTime()?.value);return i.success?new mt(!0):i}canAppendOrigin(e,t){const n=function(t){return t.equals(e)},i=this.#G?.value;if(void 0!==t&&t!==i){if(this.#k.has(t)&&void 0!==this.#k.get(t).origins.find(n))return{success:!1,message:"Cannot append same time origin twice"}}else if(void 0!==this.#N.find(n))return{success:!1,message:"Cannot append same origin twice"};return new mt(!0)}appendOrigin(e,t,n){const i=this.canAppendOrigin(e,n);if(!i.success)throw new Error(i.message);if(void 0!==n&&this.#k.get(n).origins.splice(t,0,e),void 0===n||n===this.#G?.value){this.#N.splice(t,0,e);const n=this.#Q.getValues();n[2]+=1,this.#Q=new St(n)}}appendFrame(e,t){this.#Y(t,[e]);const n=this.#Q.getValues(),i=this.#B.getValues();4===n.length?n[3]+=1:(n.push(2),i.push(1)),this.#Q=new St(n),this.#B=new Ze(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())&&this.getOrientation().equals(e.getOrientation())}isSimilar(e,t){return null!=e&&this.getOrigin().isSimilar(e.getOrigin(),t)&&this.getSize().equals(e.getSize())&&this.getSpacing().equals(e.getSpacing())&&this.getOrientation().isSimilar(e.getOrientation(),t)}isInBounds(e){return this.isIndexInBounds(this.worldToIndex(e))}isIndexInBounds(e,t){return this.getSize().isInBounds(e,t)}getRange(){const e=this.getSize().length(),t=new Array(e);t.fill(0);const n=new a(t),i=new a(this.getSize().getValues());return[this.indexToWorld(n),this.indexToWorld(i)]}indexToWorld(e){const t=this.getSpacing(),n=new m(e.get(0)*t.get(0),e.get(1)*t.get(1),e.get(2)*t.get(2)),i=this.getOrientation().multiplyPoint3D(n),o=e.getValues(),r=this.#W();o.length>3&&void 0!==r&&(o[3]=this.#$(o[3],r));const a=this.getOrigin();return o[0]=a.getX()+i.getX(),o[1]=a.getY()+i.getY(),o[2]=a.getZ()+i.getZ(),new C(o)}pointToWorld(e){const t=this.getSpacing(),n=new m(e.getX()*t.get(0),e.getY()*t.get(1),e.getZ()*t.get(2)),i=this.getOrientation().multiplyPoint3D(n),o=this.getOrigin();return new m(o.getX()+i.getX(),o.getY()+i.getY(),o.getZ()+i.getZ())}worldToIndex(e){const t=this.getOrigin(),n=new m(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),i=this.getOrientation().getInverse().multiplyPoint3D(n),o=e.getValues(),r=this.#W();o.length>3&&void 0!==r&&(o[3]=this.#j(o[3],r));const s=this.getSpacing();o[0]=Math.floor(h(i.getX()/s.get(0),5)),o[1]=Math.floor(h(i.getY()/s.get(1),5));const l=Math.floor(h(i.getZ()/s.get(2),5));o[2]=l;const c=this.getOrigins();if(c.length>0){const t=vt(e.get3D(),c,this.getOrientation());Math.abs(t.normalResidual)<s.get(2)/2?o[2]=t.index:t.index===c.length-1&&t.normalResidual>0&&o[2]<c.length?o[2]=c.length:0===t.index&&t.normalResidual<0&&o[2]>=0&&(o[2]=-1)}return new a(o)}worldToPoint(e){const t=this.getOrigin(),n=new m(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),i=this.getOrientation().getInverse().multiplyPoint3D(n),o=e.getValues(),r=this.getSpacing();return o[0]=i.getX()/r.get(0),o[1]=i.getY()/r.get(1),o[2]=i.getZ()/r.get(2),new m(o[0],o[1],o[2])}}function yt(e,t){return t.getInverse().multiplyArray3D(e)}function Dt(e,t){return t.multiplyArray3D(e)}function It(e){if(e.length<=1)return;const t=[];for(let n=0;n<e.length-1;++n){const i=e[n],o=e[n+1],r=i.getDistance(o);if(0===r)throw new Error(`Zero slice spacing ${i.toString()} ${o.toString()}`);t.push(r)}const n=ht(t),i=h(n.mean,4);return n.stdDev>1e-4&&s.warn(`Varying slice spacing, value: ${i} (mean: ${n.mean}, min: ${n.min}, max: ${n.max}, stdDev: ${n.stdDev})`),i}class wt extends ct{constructor(e,t){super(e,t)}getWorker(){return new r.wc(new URL("./assets/workers/resampling.worker.min.js",import.meta.url),{name:"resampling.worker",type:"module"})}}class Tt{#Z=new st(5);constructor(){this.#Z.onerror=e=>{console.error("Resampling failed!",e.error)}}run(e,t,n,i,o,r=void 0){const a=String(Date.now())+Math.random(),s=function(e,t,n){const i=e.getOrientation(),o=t.getInverse().multiply(i),r=e.getSize(),a=e.getSpacing(),s=a.getValues(),l=[0,0,0],c=[0,0,0];for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)for(let n=0;n<=1;n++){const i=new m(s[0]*e,s[1]*t,s[2]*n),r=o.multiplyPoint3D(i);l[0]=Math.max(l[0],r.getX()),l[1]=Math.max(l[1],r.getY()),l[2]=Math.max(l[2],r.getZ()),c[0]=Math.min(c[0],r.getX()),c[1]=Math.min(c[1],r.getY()),c[2]=Math.min(c[2],r.getZ())}const u=[Math.abs(l[0]-c[0]),Math.abs(l[1]-c[1]),Math.abs(l[2]-c[2])],d=u[0]*u[1]*u[2],h=s[0]*s[1]*s[2],g=Math.cbrt(h/d),S=[u[0]*g,u[1]*g,u[2]*g],p=a.length();for(let e=3;e<p;e++)S.push(a.get(e));const f=new Ze(S),v=[r.get(0)/2*a.get(0),r.get(1)/2*a.get(1),r.get(2)/2*a.get(2)];let C=!0;const y=[0,0,0],D=[0,0,0];for(let e=-1;e<=1;e+=2)for(let t=-1;t<=1;t+=2)for(let n=-1;n<=1;n+=2){const i=new m(v[0]*e,v[1]*t,v[2]*n),r=o.multiplyPoint3D(i);C?(y[0]=r.getX(),y[1]=r.getY(),y[2]=r.getZ(),D[0]=r.getX(),D[1]=r.getY(),D[2]=r.getZ(),C=!1):(y[0]=Math.max(y[0],r.getX()),y[1]=Math.max(y[1],r.getY()),y[2]=Math.max(y[2],r.getZ()),D[0]=Math.min(D[0],r.getX()),D[1]=Math.min(D[1],r.getY()),D[2]=Math.min(D[2],r.getZ()))}const I=[Math.round(Math.abs((y[0]-D[0])/f.get(0))),Math.round(Math.abs((y[1]-D[1])/f.get(1))),Math.round(Math.abs((y[2]-D[2])/f.get(2)))],w=r.length();for(let e=3;e<w;e++)I.push(r.get(e));const T=new St(I),L=void 0===n?new m(r.get(0)/2,r.get(1)/2,r.get(2)/2):e.worldToPoint(n),P=[0,0,0];if(void 0===n)P[0]=T.get(0)/2,P[1]=T.get(1)/2,P[2]=T.get(2)/2;else{const e=[(L.getX()-r.get(0)/2)*a.get(0),(L.getY()-r.get(1)/2)*a.get(1),(L.getZ()-r.get(2)/2)*a.get(2)],t=o.multiplyArray3D(e);P[0]=t[0]/f.get(0)+T.get(0)/2,P[1]=t[1]/f.get(1)+T.get(1)/2,P[2]=t[2]/f.get(2)+T.get(2)/2}const A=new m(P[0]*f.get(0),P[1]*f.get(1),P[2]*f.get(2)),O=t.multiplyPoint3D(A),b=e.pointToWorld(L),x=new m(b.getX()-O.getX(),b.getY()-O.getY(),b.getZ()-O.getZ()),E=[0,0,f.get(2)],R=t.multiplyArray3D(E),F=[];for(let e=0;e<T.get(2);e++)F.push(new m(x.getX()+R[0]*e,x.getY()+R[1]*e,x.getZ()+R[2]*e));return new Ct(F,T,f,t)}(t,i,r),l=function(e,t){const n=xe(e,t.getTotalSize());if(null===n)throw new Error("Cannot reallocate data for image resampling.");return n.fill(0),n}(e,s.getSize()),c=function(e,t,n,i,o,r){const a=t.getSize(),s=a.length(),l=n.getSize(),c=l.length(),u=Array(s).fill(0);for(let e=0;e<s;e++)u[e]=a.getDimSize(e);const d=Array(c).fill(0);for(let e=0;e<c;e++)d[e]=l.getDimSize(e);const h=a.getTotalSize(),g=l.getTotalSize(),S=(a,s,l)=>({sourceImageBuffer:e,sourceOrigin:t.getOrigin().getValues(),sourceSize:t.getSize().getValues(),sourceSpacing:t.getSpacing().getValues(),sourceOrientation:t.getOrientation().getValues(),sourceUnitVectors:u,sourceTotalSize:h,targetOrigin:n.getOrigin().getValues(),targetSize:n.getSize().getValues(),targetSpacing:n.getSpacing().getValues(),targetOrientation:n.getOrientation().getValues(),targetUnitVectors:d,targetTotalSize:g,pixelRepresentation:i,interpolate:o,sourceStartOffset:a,targetStartOffset:s,jobId:r,frame:l});if(c<=3)return[S(0,0,0)];const m=l.get(3),p=a.getDimSize(3),f=l.getDimSize(3),v=[];for(let e=0;e<m;e++){const t=p*e,n=f*e;v.push(S(t,n,e))}return v}(e,t,s,n,o,a);return this.#Z.onworkitem=this.ondoneframe,this.#Z.onworkend=this.ondone,c.forEach(e=>{const t=new wt(e,{});this.#Z.addWorkerTask(t)}),{buffer:l,geometry:s,jobId:a}}ondoneframe(e){}ondone(e){}}const Lt={linear:"LINEAR",linear_exact:"LINEAR_EXACT",sigmoid:"SIGMOID"};class Pt{#K;#_;#J=0;#ee=255;#O;#b;constructor(e,t,n){void 0===n&&(n=!1);let i=e,o=t;n||(i-=.5,o-=1),this.#K=i-o/2,this.#_=i+o/2,this.#O=(this.#ee-this.#J)/o,this.#b=(-i/o+.5)*(this.#ee-this.#J)+this.#J}getY(e){let t;return t=e<=this.#K?this.#J:e>this.#_?this.#ee:e*this.#O+this.#b,t}}class At{#J=0;#ee=255;#te;#ne;constructor(e,t){this.#te=e,this.#ne=t}getY(e){return(this.#ee-this.#J)/(1+Math.exp(-4*(e-this.#te)/this.#ne))+this.#J}}class Ot{#ie;#oe=0;#re;#ae=Lt.linear;constructor(e,t){if(this.#ie=e,void 0!==t){const e=[];for(const t in Lt)e.push(Lt[t]);e.includes(t)?this.#ae=t:s.debug(`Unknown VOI LUT function: ${t}`)}this.#q()}getWindowLevel(){return this.#ie}#q(){const e=this.#ie.center,t=this.#ie.width,n=e+this.#oe;this.#ae===Lt.linear_exact?this.#re=new Pt(n,t,!0):this.#ae===Lt.sigmoid?this.#re=new At(n,t):this.#re=new Pt(n,t)}setSignedOffset(e){this.#oe=e,this.#q()}apply(e){return this.#re.getY(e)}}class bt{center;width;constructor(e,t){this.center=e,this.width=t}}function xt(e,t){return null!=e&&null!=t&&e.center===t.center&&e.width===t.width}function Et(e,t,n){if(void 0===e)return;let i=e.center;i=Math.min(i,t.max),i=Math.max(i,t.min);let o=1;void 0===n||n!==Lt.linear_exact&&n!==Lt.sigmoid||(o=0);let r=e.width;return r=Math.max(r,o),r=Math.min(r,t.max-t.min),new bt(i,r)}class Rt{#se=new Map;add(e,t=1){this.#se.set(e,(this.#se.get(e)??0)+t)}getTotal(){let e=0;for(const t of this.#se.values())e+=t;return e}getEntries(){return Array.from(this.#se,([e,t])=>({value:e,count:t})).sort((e,t)=>e.value-t.value)}getRange(){let e,t;for(const n of this.#se.keys())(void 0===e||n<e)&&(e=n),(void 0===t||n>t)&&(t=n);if(void 0!==e)return{min:e,max:t}}getCountInRange(e,t){let n=0;for(const[i,o]of this.#se)(void 0===e||i>=e)&&(void 0===t||i<t)&&(n+=o);return n}getIntervalPercentages(e){const t=this.getTotal(),n=[void 0,...e,void 0],i=[];for(let e=0;e<n.length-1;++e){const o=this.getCountInRange(n[e],n[e+1]);i.push(0===t?0:100*o/t)}return i}getStats(){const e=this.getEntries();if(0===e.length)return;let t=0,n=0;for(const i of e)t+=i.count,n+=i.value*i.count;const i=n/t;let o=0;for(const t of e){const e=t.value-i;o+=e*e*t.count}const r=o/t,a=new ut(e[0].value,e[e.length-1].value,i,Math.sqrt(r));return a.median=Mt(e,t,.5),a.p25=Mt(e,t,.25),a.p75=Mt(e,t,.75),a}}function Ft(e,t){let n=0;for(const i of e)if(n+=i.count,t<n)return i.value;return e[e.length-1].value}function Mt(e,t,n){const i=(t-1)*n,o=Math.floor(i),r=Ft(e,o);return i===o?r:r+(Ft(e,o+1)-r)*(i-o)}class qt{#le=[];#ce;constructor(e){this.#ce=e}getUnit(){return this.#ce}getHistogram(e){let t=this.#le.find(t=>t.rsi.equals(e));return void 0===t&&(t={rsi:e,histogram:new Rt},this.#le.push(t)),t.histogram}add(e,t){this.getHistogram(t).add(e)}getTotal(){let e=0;for(const t of this.#le)e+=t.histogram.getTotal();return e}getRange(){let e,t;for(const n of this.#le){const i=n.histogram.getRange();void 0!==i&&((void 0===e||i.min<e)&&(e=i.min),(void 0===t||i.max>t)&&(t=i.max))}if(void 0!==e)return{min:e,max:t}}getRescaledHistogram(){const e=new Rt;for(const t of this.#le)for(const n of t.histogram.getEntries())e.add(t.rsi.apply(n.value),n.count);return e}getRescaledRange(){return this.getRescaledHistogram().getRange()}getIntervalPercentages(e){return this.getRescaledHistogram().getIntervalPercentages(e)}getStats(){return this.getRescaledHistogram().getStats()}}const Ut=["imagecontentchange","imagegeometrychange","imageresamplingstart","imageresamplingcomplete","imageresampled","labelingstart","labelschanged"];class Vt extends EventTarget{#ue;#d;#de;#he;#ge;#Se;#me;#pe=new Ve(1,0);#fe=null;#ve=!0;#Ce=!0;#ye="MONOCHROME2";#De;#Ie=0;#we;#Te={};#Le=null;#Pe=null;#Ae=null;#Oe;#be=!1;constructor(e,t,n){super(),this.#ue=e,this.#d=t,this.#de=!1,this.#he="0",this.#ge=null,this.#Se=null,this.#me=n,this.#Oe=null,this.#we=this.#d.length/this.#ue.getSize().getTotalSize()}setComplete(e){this.#be=e,e&&this.#ue.updateSliceSpacing()}getComplete(){return this.#be}getInitialIndex(){const e=this.#ue.getSize(),t=new Array(e.length()).fill(0);for(let n=0;n<Math.min(3,t.length);++n)t[n]=Math.floor(e.get(n)/2);return new a(t)}getHasOverlap(){return!1}getImageUid(e){let t=this.#me[0];return 1!==this.#me.length&&void 0!==e&&(t=this.#me[this.getSecondaryOffset(e)]),t}getOriginForImageUid(e){let t;const n=this.#me.indexOf(e);if(-1!==n){const e=this.getGeometry().getOrigins();t=e[n%e.length]}return t}includesImageUid(e){return this.#me.includes(e)}containsImageUids(e){return function(e,t){if(null===e||null===t||void 0===e||void 0===t)return!1;if(0===e.length||0===t.length||t.length>e.length)return!1;for(const n of t)if(!e.includes(n))return!1;return!0}(this.#me,e)}getGeometry(){return this.#ue}getBuffer(){return this.#d}canQuantify(){return 1===this.getNumberOfComponents()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return ot(this.getPhotometricInterpretation())}isMask(){return!1}canScroll(e){const t=this.getGeometry().getSize();let n=1;return void 0!==this.#Te.sliceCapacity&&(n=this.#Te.sliceCapacity),t.canScroll(e)||1!==n}#xe(){return this.#ue.getSize().getTotalSize(2)}getSecondaryOffset(e){return this.#ue.getSize().indexToOffset(e,2)}getRescaleSlopeAndIntercept(e){let t=this.#pe;if(!this.isConstantRSI()){if(void 0===e)throw new Error("Cannot get non constant RSI with empty slice index.");const n=this.getSecondaryOffset(e);void 0!==this.#fe[n]?t=this.#fe[n]:s.warn(`undefined non constant rsi at ${n}`)}return t}#Ee(e){return this.#fe[e]}setRescaleSlopeAndIntercept(e,t){if(this.#ve=this.#ve&&e.isID(),this.#Ce){if(!this.#pe.equals(e))if(void 0===t)this.#pe=e;else{this.#Ce=!1,this.#fe=[];for(let e=0,t=this.#xe();e<t;++e)this.#fe.push(this.#pe);this.#pe=null,this.#fe.splice(t,0,e)}}else{if(void 0===t)throw new Error("Cannot store non constant RSI with empty slice index.");this.#fe.splice(t,0,e)}}isIdentityRSI(){return this.#ve}isConstantRSI(){return this.#Ce}getPhotometricInterpretation(){return this.#ye}setPhotometricInterpretation(e){this.#ye=e}setPaletteColourMap(e){this.#De=e,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPaletteColourMap(){return this.#De}updatePaletteColourMap(e,t){this.#De.red[e]=t.r,this.#De.green[e]=t.g,this.#De.blue[e]=t.b,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPlanarConfiguration(){return this.#Ie}setPlanarConfiguration(e){this.#Ie=e}getNumberOfComponents(){return this.#we}getMeta(){return this.#Te}setMeta(e){this.#Te=e}getValueAtOffset(e){return this.#d[e]}hasValues(e){if(void 0===e||0===e.length)return[];const t=[];for(let n=0;n<e.length;++n)1===this.#we?t.push([e[n]]):3===this.#we&&t.push([e[n].r,e[n].g,e[n].b]);let n;1===this.#we?n=function(e,t){return e[0]===t[0]}:3===this.#we&&(n=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]});const i=function(e){return function(t){return n(t,e)}},o=new Array(e.length);o.fill(!1);const r=t.slice();let a,s;for(let e=0,n=this.#d.length;e<n;e+=this.#we){s=[];for(let n=0;n<r.length;++n){a=!0;for(let t=0;t<this.#we;++t)if(this.#d[e+t]!==r[n][t]){a=!1;break}a&&(o[t.findIndex(i(r[n]))]=!0,s.push(n))}for(let e=0;e<s.length;++e)r.splice(s[e],1);if(0===r.length)break}return o}clone(){const e=this.#d.slice(0),t=new(0,this.constructor)(this.getGeometry().clone(),e,this.#me);if(this.isConstantRSI())t.setRescaleSlopeAndIntercept(this.getRescaleSlopeAndIntercept());else for(let e=0;e<this.#xe();++e)t.setRescaleSlopeAndIntercept(this.#Ee(e),e);return t.setPhotometricInterpretation(this.getPhotometricInterpretation()),t.setPlanarConfiguration(this.getPlanarConfiguration()),t.setPaletteColourMap(structuredClone(this.#De)),t.setMeta(structuredClone(this.getMeta())),t}replaceBuffer(e){this.#d=e,this.dispatchEvent(new CustomEvent("imagecontentchange"))}#Re(e){let t=this.#d;if(this.#d=xe(this.#d,e),null===this.#d)throw new Error("Cannot reallocate data for image.");this.#d.set(t),t=null,this.dispatchEvent(new CustomEvent("imagebufferrealloc"))}#Fe(e,t,n){e>=n||(this.#d.set(this.#d.subarray(e,n),e+t),this.dispatchEvent(new CustomEvent("imagesliceshift",{detail:{indexOffset:e,insertSize:t,maxOffset:n}})))}canAppendSlice(e){if(null===e)return{success:!1,message:"Cannot append null slice"};const t=this.#ue.canAppendSlice(e.getGeometry());return t.success?this.#Me(e):t}#Me(e){if(this.#ye!==e.getPhotometricInterpretation())return{success:!1,message:"Cannot append a slice with different photometric interpretation"};for(const t in this.#Te)if("windowPresets"!==t&&"sliceCapacity"!==t&&"custom"!==t&&"SeriesTime"!==t&&this.#Te[t]!==e.getMeta()[t])return{success:!1,message:`Cannot append a slice with different ${t}: ${this.#Te[t]} != ${e.getMeta()[t]}`};return new mt(!0)}appendSlice(e){const t=this.canAppendSlice(e);if(!t.success)throw new Error(t.message);const n=e.getDataRange(),i=this.getDataRange();this.#Le={min:Math.min(n.min,i.min),max:Math.max(n.max,i.max)};const o=e.getRescaledDataRange(),r=this.getRescaledDataRange();this.#Pe={min:Math.min(o.min,r.min),max:Math.max(o.max,r.max)};let s=this.getGeometry().getSize();const l=e.getGeometry().getInitialTime(),c=l?.value,u=this.#ue.getCurrentTotalNumberOfSlices();let d=!1;void 0===c||this.#ue.hasSlicesAtTime(c)||(this.appendFrame(l,e.getGeometry().getOrigin()),s=this.#ue.getSize(),d=!0);const h=function(e,t){const n=t.getInitialTime()?.value,i=[];if(i.push(0),i.push(0),i.push(e.getSliceIndex(t.getOrigin(),n)),void 0!==n){const t=e.getVolumeIndex(n);i.push(-1!==t?t:n)}return new a(i)}(this.#ue,e.getGeometry()),g=this.#we*s.getDimSize(2);if(void 0===this.#Te.sliceCapacity)throw new Error("Missing slice capacity for buffer manipulation.");const S=g*this.#Te.sliceCapacity;this.#d.length!==S&&this.#Re(S);const m=h.get(2);let p=m;void 0!==c&&(p+=this.#ue.getCurrentNumberOfSlicesBeforeTime(c));const f=p*g,v=u*g;this.#Fe(f,g,v),this.#d.set(e.getBuffer(),f),d||this.#ue.appendOrigin(e.getGeometry().getOrigin(),m,c),this.setRescaleSlopeAndIntercept(e.getRescaleSlopeAndIntercept(),p);const C=this.#me.length;if(this.#me.splice(p,0,e.getImageUid()),void 0!==this.#Te.windowPresets){const t=this.#Te.windowPresets,n=e.getMeta().windowPresets,i=Object.keys(n);let o;for(let e=0;e<i.length;++e){o=i[e];const r=n[o],a=t[o];if(void 0!==a){if((void 0===a.perslice||!1===a.perslice)&&!xt(a.wl[0],r.wl[0])){a.perslice=!0;for(let e=0;e<C-1;++e)a.wl.push(a.wl[0])}void 0!==a.perslice&&!0===a.perslice&&t[o].wl.splice(p,0,r.wl[0])}else t[o]=n[o]}}this.dispatchEvent(new CustomEvent("imagegeometrychange"))}appendFrameBuffer(e,t){const n=this.#ue.getSize(),i=this.#we*n.getDimSize(2);if(void 0===this.#Te.sliceCapacity)throw new Error("Missing slice capacity for frame buffer manipulation.");const o=i*this.#Te.sliceCapacity;this.#d.length!==o&&this.#Re(o),t>=this.#Te.sliceCapacity?s.warn(`Ignoring frame at index ${t} (size: ${this.#Te.sliceCapacity})`):(this.#d.set(e,i*t),this.appendFrame({value:t},new m(0,0,0)))}appendFrame(e,t){this.#ue.appendFrame(t,e),this.dispatchEvent(new CustomEvent("appendframe"))}getDataRange(){return this.#Le||(this.#Le=this.calculateDataRange()),this.#Le}getRescaledDataRange(){return this.#Pe||(this.#Pe=this.calculateRescaledDataRange()),this.#Pe}getHistogram(){return this.#Ae||(this.#Ae=this.#qe(),this.#Le=this.#Ae.getRange(),this.#Pe=this.#Ae.getRescaledRange()),this.#Ae}getValue(e,t,n,i){const o=[e,t,n];void 0!==i&&o.push(i);const r=new a(o);return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(r))}getValueAtIndex(e){return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValue(e,t,n,i){let o=this.getValue(e,t,n,i);if(!this.isIdentityRSI())if(this.isConstantRSI())o=this.getRescaleSlopeAndIntercept().apply(o);else{const r=[e,t,n];void 0!==i&&r.push(i);const s=new a(r);o=this.getRescaleSlopeAndIntercept(s).apply(o)}return o}getRescaledValueAtIndex(e){return this.getRescaledValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValueAtOffset(e){let t=this.getValueAtOffset(e);if(!this.isIdentityRSI())if(this.isConstantRSI())t=this.getRescaleSlopeAndIntercept().apply(t);else{const n=this.getGeometry().getSize().offsetToIndex(e);t=this.getRescaleSlopeAndIntercept(n).apply(t)}return t}getRescaledValuesAtPosition(e){const t=[];if(!this.canQuantify())return t;const n=this.getGeometry(),i=n.getSize(),o=this.getMeta().pixelUnit,r=n.worldToIndex(e).getValues().slice(0,3),s=i.length()>3;if(s&&r.push(0),!n.isIndexInBounds(new a(r)))return t;const l=s?i.get(3):1;let c=n.getVolumeIds();c?.length!==l&&(c=void 0);for(let e=0;e<l;++e){s&&(r[3]=e);const n=void 0!==c?{...c[e]}:{value:e};t.push({volumeId:n,pixValue:{value:this.getRescaledValueAtIndex(new a(r)),unit:o}})}return t}calculateDataRange(){let e,t=this.getValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();i.length()>=3&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateRescaledDataRange(){if(this.isIdentityRSI())return this.getDataRange();if(this.isConstantRSI()){const e=this.getDataRange(),t=this.getRescaleSlopeAndIntercept().apply(e.min),n=this.getRescaleSlopeAndIntercept().apply(e.max);return{min:t<n?t:n,max:t>n?t:n}}let e,t=this.getRescaledValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();3===i.length()&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getRescaledValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}#qe(){const e=this.getGeometry().getSize(),t=e.getDimSize(2),n=new qt(this.getMeta().pixelUnit);for(let i=0,o=e.getTotalSize();i<o;i+=t){const o=n.getHistogram(this.getRescaleSlopeAndIntercept(e.offsetToIndex(i)));for(let e=i;e<i+t;++e)o.add(this.getValueAtOffset(e))}return n}convolute2D(e){if(9!==e.length)throw new Error(`The convolution matrix does not have a length of 9; it has ${e.length}`);const t=this.clone(),n=t.getBuffer(),i=this.getGeometry().getSize(),o=i.getDimSize(2)*this.getNumberOfComponents();for(let t=0;t<i.get(2);++t)this.convoluteBuffer(e,n,t*o);return t}convoluteBuffer(e,t,n){const i=this.getGeometry().getSize(),o=i.get(0),r=i.get(1),a=this.getNumberOfComponents();let s=1,l=1;3===a&&(0===this.getPlanarConfiguration()?s=3:l=i.getDimSize(2));const c=[];c[0]=(-o-1)*s,c[1]=-o*s,c[2]=(1-o)*s,c[3]=-s,c[4]=0,c[5]=s,c[6]=(o-1)*s,c[7]=o*s,c[8]=(o+1)*s;const u=[];u[0]=c[4],u[1]=c[4],u[2]=c[5],u[3]=c[4],u[4]=c[4],u[5]=c[5],u[6]=c[7],u[7]=c[7],u[8]=c[8];const d=[];d[0]=c[1],d[1]=c[1],d[2]=c[2],d[3]=c[4],d[4]=c[4],d[5]=c[5],d[6]=c[7],d[7]=c[7],d[8]=c[8];const h=[];h[0]=c[1],h[1]=c[1],h[2]=c[2],h[3]=c[4],h[4]=c[4],h[5]=c[5],h[6]=c[4],h[7]=c[4],h[8]=c[5];const g=[];g[0]=c[3],g[1]=c[4],g[2]=c[5],g[3]=c[3],g[4]=c[4],g[5]=c[5],g[6]=c[6],g[7]=c[7],g[8]=c[8];const S=[];S[0]=c[0],S[1]=c[1],S[2]=c[2],S[3]=c[3],S[4]=c[4],S[5]=c[5],S[6]=c[3],S[7]=c[4],S[8]=c[5];const m=[];m[0]=c[3],m[1]=c[4],m[2]=c[4],m[3]=c[3],m[4]=c[4],m[5]=c[4],m[6]=c[6],m[7]=c[7],m[8]=c[7];const p=[];p[0]=c[0],p[1]=c[1],p[2]=c[1],p[3]=c[3],p[4]=c[4],p[5]=c[4],p[6]=c[6],p[7]=c[7],p[8]=c[7];const f=[];f[0]=c[0],f[1]=c[1],f[2]=c[1],f[3]=c[3],f[4]=c[4],f[5]=c[4],f[6]=c[3],f[7]=c[4],f[8]=c[4];let v,C,y=n;for(let n=0;n<a;++n){y+=n*l;for(let n=0;n<r;++n)for(let i=0;i<o;++i){C=c,0===i&&0===n?C=u:0===i&&n===r-1?C=h:i===o-1&&0===n?C=m:i===o-1&&n===r-1?C=f:0===i&&n!==r-1&&0!==n?C=d:i===o-1&&n!==r-1&&0!==n?C=p:0!==i&&i!==o-1&&0===n?C=g:0!==i&&i!==o-1&&n===r-1&&(C=S),v=0;for(let t=0;t<9;++t)v+=this.getValueAtOffset(y+C[t])*e[t];t[y]=v,y+=s}}}transform(e){const t=this.clone(),n=t.getBuffer();for(let i=0,o=n.length;i<o;++i)n[i]=e(t.getValueAtOffset(i));return t}compose(e,t){const n=this.clone(),i=n.getBuffer();for(let n=0,o=i.length;n<o;++n)i[n]=Math.floor(t(this.getValueAtOffset(n),e.getValueAtOffset(n)));return n}isResampled(){return this.#de}resample(e,t=void 0,n=void 0){null===this.#Oe&&(this.#Oe=new Tt,this.#Oe.ondoneframe=e=>{const t=e.data;this.#he===t.jobId&&(this.#d.set(t.targetImageBuffer,t.startOffset),this.dispatchEvent(new CustomEvent("imageresampled",{detail:{frame:t.frame}})))},this.#Oe.ondone=e=>{this.dispatchEvent(new CustomEvent("imageresamplingcomplete"))});const i=this.#de&&this.#Se&&this.#ge?{buffer:this.#Se,geometry:this.#ge}:{buffer:this.#d,geometry:this.#ue};this.dispatchEvent(new CustomEvent("imageresamplingstart"));const o=this.#Oe.run(i.buffer,i.geometry,this.#Te.PixelRepresentation,e,void 0===t||t,n);this.#de||(this.#de=!0,this.#Se=this.#d,this.#ge=this.#ue),this.#d=o.buffer,this.#ue=o.geometry;const r=i.geometry.getVolumeIds();void 0!==r&&this.#ue.setVolumeIds(r),this.#he=o.jobId,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange"))}revert(){this.#de&&(this.dispatchEvent(new CustomEvent("imageresamplingstart")),this.#de=!1,this.#d=this.#Se,this.#ue=this.#ge,this.#Se=null,this.#ge=null,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange")),this.dispatchEvent(new CustomEvent("imageresampled")))}}const Nt=["annotationgroupeditablechange","annotationadd","annotationupdate","annotationremove"];class Qt extends EventTarget{#Ue;#Te={};#Ve;#Ne;constructor(e){super(),this.#Ue=void 0!==e?e:[],this.#Ve=!0}getList(){return this.#Ue}getLength(){return this.#Ue.length}isEditable(){return this.#Ve}setEditable(e){this.#Ve=e,this.dispatchEvent(new CustomEvent("annotationgroupeditablechange",{detail:{data:e}}))}getColour(){return this.#Ne}setColour(e){this.#Ne=e}add(e,t){this.#Ue.push(e),this.dispatchEvent(new CustomEvent("annotationadd",{detail:{data:e,propagate:t}}))}update(e,t,n){const i=this.#Ue.findIndex(t=>t.trackingUid===e.trackingUid);-1!==i?((t.includes("mathShape")||t.includes("textExpr"))&&e.updateQuantification(),this.#Ue[i]=e,this.dispatchEvent(new CustomEvent("annotationupdate",{detail:{data:e,keys:t,propagate:n}}))):s.warn("Cannot find annotation to update")}remove(e,t){const n=this.#Ue.findIndex(t=>t.trackingUid===e);if(-1!==n){const e=this.#Ue.splice(n,1)[0];this.dispatchEvent(new CustomEvent("annotationremove",{detail:{data:e,propagate:t}}))}else s.warn("Cannot find annotation to remove")}setViewController(e){for(const t of this.#Ue)t.setViewController(e),t.updateQuantification()}find(e){return this.#Ue.find(t=>t.trackingUid===e)}getMeta(){return this.#Te}hasMeta(e){return void 0!==this.#Te[e]}getMetaValue(e){return this.#Te[e]}setMetaValue(e,t){this.#Te[e]=t}}class Bt{r;g;b;constructor(e,t,n){this.r=e,this.g=t,this.b=n}}function kt(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&e.r===t.r&&e.g===t.g&&e.b===t.b}function Gt(e,t,n){return{r:e+1.402*(n-128),g:e-.34414*(t-128)-.71414*(n-128),b:e+1.772*(t-128)}}function zt(e){return{r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)}}function Ht(e){return`#${((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)}`}function Yt(e){return{l:.001525902*e.l,a:.003891051*e.a-128,b:.003891051*e.b-128}}function Xt(e){return{l:655.35*e.l,a:257*e.a+32896,b:257*e.b+32896}}const Wt={x:95.0489,y:100,z:108.884};function $t(e){return function(e){function t(e){let t;return t=e<=.0031308?12.92*e:1.055*Math.pow(e,.416666667)-.055,Math.min(1,Math.max(0,t))}const n=e.x/100,i=e.y/100,o=e.z/100;return{r:Math.round(255*t(3.2406*n-1.5372*i-.4986*o)),g:Math.round(255*t(-.9689*n+1.8758*i+.0415*o)),b:Math.round(255*t(.0557*n-.204*i+1.057*o))}}(function(e){function t(e){let t;return t=e>.206896552?Math.pow(e,3):.128418549*e-.017712903,t}const n=Wt,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))}function jt(e){return function(e){function t(e){let t;return t=e>.008856452?Math.pow(e,.333333333):7.787037037*e+.137931034,t}const n=Wt,i=t(e.y/n.y);return{l:116*i-16,a:500*(t(e.x/n.x)-i),b:200*(i-t(e.z/n.z))}}(function(e){function t(e){let t;return t=e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4),t}const n=t(e.r/255),i=t(e.g/255),o=t(e.b/255);return{x:100*(.4124*n+.3576*i+.1805*o),y:100*(.2126*n+.7152*i+.0722*o),z:100*(.0193*n+.1192*i+.9505*o)}}(e))}const Zt=[new Bt(0,0,0),new Bt(255,0,0),new Bt(0,255,0),new Bt(0,0,255),new Bt(255,255,0),new Bt(0,255,255),new Bt(255,0,255),new Bt(255,239,213),new Bt(0,0,205),new Bt(205,133,63),new Bt(210,180,140),new Bt(102,205,170),new Bt(0,0,128),new Bt(0,139,139),new Bt(46,139,87),new Bt(255,228,225)];function Kt(e){let t;return t=e<Zt.length?Zt[e]:new Bt(255*Math.random(),255*Math.random(),255*Math.random()),t}class _t{#Qe=10;#Be="Verdana";#ke="#fff";#Ge="#ffff80";#ze={x:1,y:1};#He={x:1,y:1};#Ye=2;#Xe={x:.25,y:.25};#We=.2;#$e=3;getFontFamily(){return this.#Be}getFontSize(){return this.#Qe}getStrokeWidth(){return this.#Ye}getTextColour(){return this.#ke}getLineColour(){return this.#Ge}setLineColour(e){this.#Ge=e}setBaseScale(e){this.#ze=e}setZoomScale(e){this.#He=e}getBaseScale(){return this.#ze}getZoomScale(){return this.#He}scale(e){return e/this.#ze.x}applyZoomScale(e){return{x:e/this.#He.x,y:e/this.#He.y}}applyZoomRatio(e){return e*this.#He.x/this.#He.y}getShadowOffset(){return this.#Xe}getTagOpacity(){return this.#We}getTextPadding(){return this.#$e}getFontStr(){return`normal ${this.getFontSize()}px sans-serif`}getLineHeight(){return this.getFontSize()+this.getFontSize()/5}getScaledFontSize(){return this.scale(this.getFontSize())}getScaledStrokeWidth(){return this.scale(this.getStrokeWidth())}getShadowLineColour(){return function(e){return.001172549*(t=zt(e)).r+.002301961*t.g+447059e-9*t.b<.5;var t}(this.getLineColour())?"#fff":"#000"}}function Jt(e){const t={};let n;if(e&&-1!==(n=e.indexOf("?"))){t.base=e.substring(0,n);let i=e.indexOf("#");-1===i&&(i=e.length);const o=e.substring(n+1,i);t.query=function(e){const t={};if(e){const n=e.split("&");for(let e=0;e<n.length;++e){const i=n[e].split("=");t[i[0]]?(t[i[0]]instanceof Array||(t[i[0]]=[t[i[0]]]),t[i[0]].push(i[1])):t[i[0]]=i[1]}}return t}(o)}return t}function en(e){const t=Jt(e);return 0===Object.keys(t).length?null:t.query}function tn(e){let t;const n=en(e);return n&&void 0!==n.input&&(t=on(n.input,n.dwvReplaceMode)),t}function nn(e,t){const n=en(e);n&&void 0!==n.input&&rn(n.input,n.nslices,t)}function on(e,t){const n=[];let i="key";t&&(i=t);const o=decodeURIComponent(e),r=Jt(o);if(0===Object.keys(r).length)n.push(o);else{const e=Object.keys(r.query);let t=null;for(let n=0;n<e.length;++n)if(r.query[e[n]]instanceof Array){t=e[n];break}if(t){const o=r.query[t];let a=r.base;""!==a&&"file"!==t&&(a+="?");let s,l=!1;for(let n=0;n<e.length;++n)e[n]!==t&&(l&&(a+="&"),a+=`${e[n]}=${r.query[e[n]]}`,l=!0);for(let e=0;e<o.length;++e)s=a,l&&(s+="&"),"key"===i&&(s+=`${t}=`),s+=o[e],n.push(s)}else n.push(o)}return n}function rn(e,t,n){let i="";"/"===e[0]&&(i=`${window.location.protocol}//${window.location.host}`),i+=e;const o=new XMLHttpRequest;o.open("GET",decodeURIComponent(i),!0),o.responseType="document",o.onload=function(e){n(function(e,t){const n=[],i=`${e.getElementsByTagName("wado_query")[0].getAttribute("wadoURL")}?requestType=WADO&contentType=application/dicom&`,o=e.getElementsByTagName("Patient");o.length>1&&s.warn("More than one patient, loading first one.");const r=o[0].getElementsByTagName("Study");r.length>1&&s.warn("More than one study, loading first one.");const a=r[0].getAttribute("StudyInstanceUID"),l=r[0].getElementsByTagName("Series");l.length>1&&s.warn("More than one series, loading first one.");const c=l[0].getAttribute("SeriesInstanceUID"),u=l[0].getElementsByTagName("Instance");let d=u.length;t<d&&(d=t);for(let e=0;e<d;++e){const t=`${i}&studyUID=${a}&seriesUID=${c}&objectUID=${u[e].getAttribute("SOPInstanceUID")}`;n.push(t)}return n}(e.target.responseXML,t))},o.onerror=function(e){s.warn(`RequestError while receiving manifest: ${e.target.status}`)},o.send(null)}const an=["mousedown","mousemove","mouseup","mouseout","wheel","dblclick","touchstart","touchmove","touchend"];function sn(e,t){let n=0,i=0;void 0!==t&&(n=t.left,i=t.top);const o=[];for(let t=0;t<e.length;++t)o.push(new S(e[t].clientX-n,e[t].clientY-i));return o}function ln(e){const t=e.currentTarget.getBoundingClientRect();let n=[];return void 0!==e.targetTouches&&0!==e.targetTouches.length?n=sn(e.targetTouches,t):void 0!==e.changedTouches&&0!==e.changedTouches.length&&(n=sn(e.changedTouches,t)),n}function cn(e){return new S(e.offsetX,e.offsetY)}function un(e,t){const n=document.createElement("canvas");n.width=e,n.height=t;const i=document.createElement("canvas");i.width=1,i.height=1;const o=n.getContext("2d"),r=i.getContext("2d");return o&&(o.fillRect(e-1,t-1,1,1),r.drawImage(n,e-1,t-1,1,1,0,0,1,1)),r&&0!==r.getImageData(0,0,1,1).data[3]}class dn{#je;#Ze=null;#Ke=[];#_e={};constructor(e){this.#je=e}init(){for(const e in this.#je)this.#je[e].init();this.enableShortcuts(!0)}enableShortcuts(e){e?window.addEventListener("keydown",this.#Je("window","keydown"),!0):window.removeEventListener("keydown",this.#Je("window","keydown"),!0)}getToolList(){return this.#je}hasTool(e){return void 0!==this.getToolList()[e]}getSelectedTool(){return this.#Ze}getSelectedToolEventHandler(e){if(this.getSelectedTool())return this.getSelectedTool()[e]}setSelectedTool(e){if(!this.hasTool(e))throw new Error(`Unknown tool: '${e}'`);this.#Ze&&this.#Ze.activate(!1),this.#Ze=this.#je[e],this.#Ze.activate(!0)}setToolFeatures(e){this.getSelectedTool()&&this.getSelectedTool().setFeatures(e)}bindLayerGroup(e,t){const n=e.getDivId();e.addEventListener("activelayerchange",this.#et(n)),this.#tt(n,t)}#tt(e,t){void 0!==this.#_e[e]&&this.#nt(this.#_e[e]),this.#_e[e]=t,this.#it(t)}#et(e){return t=>{const n=t.detail?.value,i=n?.[0];void 0!==i&&this.#tt(e,i)}}#it(e){e.bindInteraction();const t=an;for(let n=0;n<t.length;++n)e.addEventListener(t[n],this.#Je(e.getId(),t[n]))}#nt(e){e.unbindInteraction();const t=an;for(let n=0;n<t.length;++n)e.removeEventListener(t[n],this.#Je(e.getId(),t[n]))}#Je(e,t){if(void 0===this.#Ke[e]&&(this.#Ke[e]=[]),void 0===this.#Ke[e][t]){const n=e=>{if(this.#Ze){const t=this.#Ze[e.type];t&&t(e)}};this.#Ke[e][t]=n}return this.#Ke[e][t]}}class hn{#ot=[];#rt=2;#at;constructor(e){this.#at=e}setNumberOfDimensions(e){this.#rt=e}setNToLoad(e){for(let t=0;t<e;++t){this.#ot[t]=[];for(let e=0;e<this.#rt;++e)this.#ot[t][e]=0}}onprogress=e=>{if(!e.lengthComputable)return;if(void 0===e.subindex)return;if(void 0===e.index)return;const t=100*e.loaded/e.total;let n;this.#ot[e.index][e.subindex]=t,n=void 0!==e.item?e.item:{loaded:this.#st(e.index),total:100,source:e.source},this.#at({lengthComputable:!0,loaded:this.#lt(),total:100,item:n})};#st(e){let t=0;for(let n=0;n<this.#rt;++n)t+=this.#ot[e][n];return t/this.#rt}#lt(){let e=0;const t=this.#ot.length;for(let n=0;n<t;++n)e+=this.#st(n);return Math.round(e/t)}getMonoProgressHandler(e,t){return n=>{n.index=e,n.subindex=t,this.onprogress(n)}}getUndefinedMonoProgressHandler(e){return t=>{t.subindex=e,this.onprogress(t)}}}class gn{onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class Sn extends gn{#ct=null;#ut=[];#dt=null;#ht=0;#gt=0;#St;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#mt(e){this.#ct=e,this.#ht=0,this.#gt=0,this.#St=!1,this.#pt(),this.#ft()}#vt(e){this.#ut.push(e)}#pt(){this.#ut=[]}#Ct(e){this.#dt=e}#ft(){this.#dt=null}#yt=e=>{this.#ht++,this.#ht===this.#ct.length&&this.onload({source:this.#ct})};#Dt=e=>{this.#gt++,this.#gt===this.#ct.length&&this.onloadend({source:this.#ct})};#It(e,t){return n=>{n.source=t,e(n)}}load(e,t){this.onloadstart({source:e}),1===e.length&&(D(e[0],"DICOMDIR")||D(e[0],".dcmdir"))?this.#wt(e[0],t):this.#Tt(e,t)}#Lt(e,t,n){return i=>{const o=i.target.status;200!==o&&0!==o?(this.onerror({source:t,error:`GET ${i.target.responseURL} ${i.target.status} (${i.target.statusText})`,target:i.target}),this.#Dt()):e.load(i.target.response,t,n)}}#Tt(e,t){if(void 0===e||0===e.length)return;this.#mt(e);const n=new hn(this.onprogress);n.setNToLoad(e.length);const i=Tl(),o=[];for(let e=0;e<i.length;++e)o.push(new i[e]);let r=e[0],a=null,s=!1;for(let i=0;i<o.length;++i)if(a=o[i],a.canLoadUrl(r,t)){s=!0,a.setOptions({numberOfItems:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),a.onprogress=n.getUndefinedMonoProgressHandler(1),a.onloaditem=this.onloaditem,a.onload=this.#yt,a.onloadend=this.#Dt,a.onerror=this.onerror,a.onabort=this.onabort,this.#Ct(a);break}if(!s)throw new Error(`No loader found for url: ${r}`);let l=0;const c=()=>{l<this.#ut.length-1&&!this.#St&&(++l,this.#ut[l].send(null))};for(let i=0;i<e.length;++i){if(r=e[i],!a.canLoadUrl(r,t))throw new Error(`Input url of different type: ${r}`);const o=new XMLHttpRequest;if(o.open("GET",r,!0),void 0!==t){if(void 0!==t.requestHeaders){const e=t.requestHeaders;for(let t=0;t<e.length;++t)void 0!==e[t].name&&void 0!==e[t].value&&o.setRequestHeader(e[t].name,e[t].value)}void 0!==t.withCredentials&&(o.withCredentials=t.withCredentials)}o.onprogress=this.#It(n.getMonoProgressHandler(i,0),r),o.onload=this.#Lt(a,r,i),o.onloadend=c;const s=this.#It(this.onerror,r);o.onerror=e=>{this.#Dt(),s(e)};const l=this.#It(this.ontimeout,r);o.ontimeout=e=>{this.#Dt(),l(e)};const u=this.#It(this.onabort,r);o.onabort=e=>{this.#Dt(),u(e)},1===a.loadUrlAs()&&(o.responseType="arraybuffer"),this.#vt(o)}let u=this.#ut.length;void 0!==t&&void 0!==t.batchSize&&0!==u&&(u=Math.min(t.batchSize,this.#ut.length));for(let e=0;e<u;++e)this.#St||(l=e,this.#ut[l].send(null))}#wt(e,t){const n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=n=>{const i=n.target.status;if(200!==i&&0!==i)this.onerror({source:e,error:`GET ${n.target.responseURL} ${n.target.status} (${n.target.statusText})`,target:n.target}),this.onloadend({});else{const i=function(e){const t=new Ue;return t.parse(e),function(e){const t=e["00041220"];if(void 0===t||void 0===t.value)return void s.warn("No Directory Record Sequence found in DICOMDIR.");const n=t.value;if(0===n.length)return void s.warn("The Directory Record Sequence of the DICOMDIR is empty.");const i=[];let o=null,r=null;for(let e=0;e<n.length;++e){const t=n[e]["00041430"];if(void 0===t||void 0===t.value)continue;const a=t.value[0];if("STUDY"===a)r=[],i.push(r);else if("SERIES"===a)o=[],r.push(o);else if("IMAGE"===a){const t=n[e]["00041500"];if(void 0===t||void 0===t.value)continue;const i=t.value;o.push(i.join("/"))}}return i}(t.getDicomElements())}(n.target.response)[0][0],o=e.split("/").slice(0,-1).join("/"),r=[];for(let e=0;e<i.length;++e)r.push(`${o}/${i[e]}`);this.#Tt(r,t)}},n.onerror=t=>{this.#It(this.onerror,e)(t),this.onloadend({})},n.onabort=t=>{this.#It(this.onabort,e)(t),this.onloadend({})},n.send(null)}abort(){this.#St=!0;for(let e=0;e<this.#ut.length;++e)4!==this.#ut[e].readyState&&this.#ut[e].abort();this.#dt&&this.#dt.isLoading()&&this.#dt.abort()}ontimeout(e){}}class mn extends ct{constructor(e,t){super(e,t)}getWorker(){return new r.wc(new URL("./assets/workers/jpegbaseline.worker.min.js",import.meta.url),{name:"jpegbaseline.worker",type:"module"})}}class pn extends ct{constructor(e,t){super(e,t)}getWorker(){return new r.wc(new URL("./assets/workers/jpegloss.worker.min.js",import.meta.url),{name:"jpegloss.worker",type:"module"})}}class fn extends ct{constructor(e,t){super(e,t)}getWorker(){return new r.wc(new URL("./assets/workers/jpeg2000.worker.min.js",import.meta.url),{name:"jpeg2000.worker",type:"module"})}}class vn extends ct{constructor(e,t){super(e,t)}getWorker(){return new r.wc(new URL("./assets/workers/rle.worker.min.js",import.meta.url),{name:"rle.worker",type:"module"})}}class Cn{#Pt;#At;#Ot=!1;constructor(e){this.#Pt=e,this.#At=new st(10)}decode(e,t,n){this.#Ot||(this.#Ot=!0,this.#At.onworkstart=this.ondecodestart,this.#At.onworkitem=this.ondecodeditem,this.#At.onwork=this.ondecoded,this.#At.onworkend=this.ondecodeend,this.#At.onerror=this.onerror,this.#At.onabort=this.onabort);const i={buffer:e,meta:t};let o;"jpeg-baseline"===this.#Pt?o=new mn(i,n):"jpeg-lossless"===this.#Pt?o=new pn(i,n):"jpeg2000"===this.#Pt?o=new fn(i,n):"rle"===this.#Pt&&(o=new vn(i,n)),void 0!==o&&this.#At.addWorkerTask(o)}abort(){this.#At.abort()}ondecodestart(e){}ondecodeditem(e){}ondecoded(e){}ondecodeend(e){}onerror(e){}onabort(e){}}const yn="00080100",Dn="00080102",In="00080119",wn="00080120";class Tn{meaning;value;longValue;urnValue;schemeDesignator;constructor(e){this.meaning=e}toString(){return`(${this.value}, ${this.schemeDesignator}, '${this.meaning}')`}}function Ln(e,t){return void 0!==e&&void 0!==t&&e.schemeDesignator===t.schemeDesignator&&e.value===t.value}function Pn(e){const t=new Tn(e["00080104"].value[0]);if(void 0!==e[yn])t.value=e[yn].value[0];else if(void 0!==e[In])t.longValue=e[In].value[0];else{if(void 0===e[wn])throw new Error("Invalid code with no value, no long value and no urn value.");t.urnValue=e[wn].value[0]}if(void 0!==t.value||void 0!==t.longValue){if(void 0===e[Dn])throw new Error("No coding sheme designator when code value or long value is present");t.schemeDesignator=e[Dn].value[0]}return t}function An(e){const t={};return void 0!==e.value?t.CodeValue=e.value:void 0!==e.longValue?t.LongCodeValue=e.longValue:void 0!==e.urnValue&&(t.URNCodeValue=e.urnValue),void 0!==e.schemeDesignator&&(t.CodingSchemeDesignator=e.schemeDesignator),t.CodeMeaning=e.meaning,t}const On={value:"111017",meaning:"CAD Processing and Findings Summary"},bn={value:"111030",meaning:"Image Region"},xn={value:"111059",meaning:"Single Image Finding"},En={value:"111099",meaning:"Selected region"},Rn={value:"111242",meaning:"All algorithms succeeded; with findings"},Fn={value:"112000",meaning:"Chest CAD Report"},Mn={value:"112020",meaning:"Response Evaluation"},qn={value:"112021",meaning:"Response Evaluation Method"},Un={value:"112022",meaning:"RECIST"},Vn={value:"112039",meaning:"Tracking Identifier"},Nn={value:"112051",meaning:"Measurement of Response"},Qn={value:"112040",meaning:"Tracking Unique Identifier"},Bn={value:"112048",meaning:"Current Response"},kn={value:"113076",meaning:"Segmentation"},Gn={value:"121055",meaning:"Path"},zn={value:"121106",meaning:"Comment"},Hn={value:"121322",meaning:"Source image for image processing operation"},Yn={value:"121324",meaning:"Source Image"},Xn={value:"122438",meaning:"Reference Points"},Wn={value:"125007",meaning:"Measurement Group"},$n={value:"125309",meaning:"Short Label"},jn={value:"126000",meaning:"Imaging Measurement Report"},Zn={value:"126010",meaning:"Imaging Measurements"},Kn={value:"128773",meaning:"Reference Geometry"},_n={1483009:"Angle",42798e3:"Area",103355008:"Width",103339001:"Long axis",103340004:"Short axis",131190003:"Radius",261665006:"Unknown",410668003:"Length",718499004:"Color"},Jn={1:"No units",mm:"Millimeter",deg:"Degree - plane angle",cm2:"Square centimeter","cm2/ml":"Square centimeter per milliliter","/cm":"Per centimeter","g/ml":"Gram per milliliter","g/ml{SUVbw}":"Standardized Uptake Value body weight","mg/ml":"Milligram per milliliter","umol/ml":"Micromole per milliliter","Bq/ml":"Becquerels per milliliter","mg/min/ml":"Milligrams per minute per milliliter","umol/min/ml":"Micromole per minute per milliliter","ml/min/g":"Milliliter per minute per gram","ml/g":"Milliliter per gram","ml/min/ml":"Milliliter per minute per milliliter","ml/ml":"Milliliter per milliliter","%":"Percentage","[hnsf'U]":"Hounsfield unit","10*23/ml":"Electron density","{counts}":"Counts","{counts}/s":"Counts per second","{propcounts}":"Proportional to counts","{propcounts}/s":"Proportional to counts per second"};function ei(e){const t=new Tn(e.meaning);return t.schemeDesignator="DCM",t.value=e.value,t}function ti(e,t){let n,i;return"SCT"===t?n=_n[e]:"UCUM"===t&&(n=Jn[e]),void 0!==n&&(i=new Tn(n),i.schemeDesignator=t,i.value=e),i}function ni(){return ei(kn)}function ii(){return ti("718499004","SCT")}const oi={angle:{key:"1483009",scheme:"SCT"},length:{key:"410668003",scheme:"SCT"},surface:{key:"42798000",scheme:"SCT"},height:{key:"121207",scheme:"DCM"},width:{key:"103355008",scheme:"SCT"},radius:{key:"131190003",scheme:"SCT"},longAxis:{key:"103339001",scheme:"SCT"},shortAxis:{key:"103340004",scheme:"SCT"},min:{key:"113051",scheme:"DCM"},max:{key:"113048",scheme:"DCM"},mean:{key:"113049",scheme:"DCM"},stddev:{key:"113061",scheme:"DCM"}},ri={"unit.mm":"mm","unit.cm2":"cm2","unit.degree":"deg",HU:"[hnsf'U]",MGML:"mg/ml",ED:"10*23/ml",PCT:"%",CNTS:"{counts}",NONE:"1",CM2:"cm2",CM2ML:"cm2/ml",PCNT:"%",CPS:"{counts}/s",BQML:"Bq/ml",MGMINML:"mg/min/ml",UMOLMINML:"umol/min/ml",MLMING:"ml/min/g",MLG:"ml/g","1CM":"/cm",UMOLML:"umol/ml",PROPCNTS:"{propcounts}",PROPCPS:"{propcounts}/s",MLMINML:"ml/min/ml",MLML:"ml/ml",GML:"g/ml",SUV:"g/ml{SUVbw}"};function ai(e){const t=ri[e];let n;return void 0!==t?n=ti(t,"UCUM"):void 0===t&&(n=ti("1","UCUM")),n}const si="00089124",li="00082112",ci="00081150",ui="00081155",di="00209111",hi="00209164",gi="00209113",Si="00209116",mi="00289110",pi="52009230";class fi{dimIndex;imagePosPat;derivationImages;refSegmentNumber;imageOrientationPatient;spacing;constructor(e,t,n,i){this.dimIndex=e,this.imagePosPat=t,this.derivationImages=n,this.refSegmentNumber=i}}function vi(e){const t=[];if(void 0!==e[si]){const n=e[si].value;for(let e=0;e<n.length;++e){const i=[];if(void 0!==n[e][li]){const t=n[e][li].value;for(let e=0;e<t.length;++e){const n={};void 0!==t[e][ci]&&(n.referencedSOPClassUID=t[e][ci].value[0]),void 0!==t[e][ui]&&(n.referencedSOPInstanceUID=t[e][ui].value[0]),i.push(n)}}t.push({sourceImages:i})}}if(void 0===e[di])return void s.info("Missing frame content sequence");const n=e[di].value;if(0===n.length)return void s.info("Empty frame content sequence");const i=n[0]["00209157"].value;let o;const r=e["0062000A"];if(void 0!==r){const e=r.value[0];o=parseInt(e["0062000B"].value[0],10)}if(void 0===e[gi])return void s.info("Missing plane position sequence");const a=e[gi].value;if(0===a.length)return void s.info("Empty plane position sequence");const l=a[0]["00200032"].value;for(let e=0;e<l.length;++e)l[e]=parseFloat(l[e]);const c=new fi(i,l,t,o);if(void 0!==e[Si]){const t=e[Si];if(0!==t.value.length){const e=t.value[0]["00200037"].value;void 0!==e&&(c.imageOrientationPatient=e)}}if(void 0!==e[mi]){const t=e[mi];if(0!==t.value.length){const e=nt(t.value[0]);void 0!==e&&(c.spacing=e)}else s.warn("No shared functional group pixel measure sequence items.")}return c}function Ci(e,t){const n=ue(e,pi);let i;if(void 0!==n){if(void 0!==t&&t!==n.length)throw new Error("perFrameFuncGroupSequence meta and numberOfFrames are not equal.");i=[];for(const e of n)i.push(vi(e))}return i}function yi(e){const t={FrameContentSequence:{value:[{DimensionIndexValues:e.dimIndex}]},PlanePositionSequence:{value:[{ImagePositionPatient:e.imagePosPat}]},SegmentIdentificationSequence:{value:[{ReferencedSegmentNumber:e.refSegmentNumber}]}};if(void 0!==e.derivationImages){const n=An(ei(Hn)),i=An(ei(kn)),o=[];for(const t of e.derivationImages){const e=[];for(const i of t.sourceImages)e.push({PurposeOfReferenceCodeSequence:{value:[n]},ReferencedSOPClassUID:i.referencedSOPClassUID,ReferencedSOPInstanceUID:i.referencedSOPInstanceUID});o.push({DerivationCodeSequence:{value:[i]},SourceImageSequence:{value:e}})}t.DerivationImageSequence={value:o}}return t}function Di(e,t,n){let i;const o=ue(e,pi);if(void 0!==o){for(const e of o){const o=t(e);if(void 0!==o)if(void 0===i)i=o;else if(i!==o)return void s.debug(`Unhandled varying ${n}`)}return i}}function Ii(e,t){const n=ue(e,pi),i=new se("SQ");return i.value=[n[t]],{...e,[pi]:i}}function wi(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0].replaceAll(".","");return{year:parseInt(t.substring(0,4),10),monthIndex:t.length>=6?parseInt(t.substring(4,6),10)-1:0,day:8===t.length?parseInt(t.substring(6,8),10):0}}function Ti(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0].replaceAll(":",""),n=parseInt(t.substring(0,2),10),i=t.length>=4?parseInt(t.substring(2,4),10):0,o=t.length>=6?parseInt(t.substring(4,6),10):0;let r=0;const a=t.indexOf(".");if(-1!==a&&a+1<t.length){const e=t.substring(a+1),n=parseInt(e,10),i=3-e.length;r=i>=0?n*Math.pow(10,i):n/Math.pow(10,-i)}return{hours:n,minutes:i,seconds:o,milliseconds:r}}function Li(e,t){let n;if(void 0!==e){let i=0,o=0,r=0,a=0;void 0!==t&&(void 0!==t.hours&&(i=t.hours),void 0!==t.minutes&&(o=t.minutes),void 0!==t.seconds&&(r=t.seconds),void 0!==t.milliseconds&&(a=t.milliseconds)),n=new Date(e.year,e.monthIndex,e.day,i,o,r,a)}return n}function Pi(e){let t;return void 0!==e&&(t={year:e.getFullYear(),monthIndex:e.getMonth(),day:e.getDate()}),t}function Ai(e){let t;return void 0!==e&&(t={hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}),t}function Oi(e){let t;return void 0!==e&&(t=e.year.toString()+(e.monthIndex+1).toString().padStart(2,"0")+e.day.toString().padStart(2,"0")),t}function bi(e){let t;return void 0!==e&&(t=e.hours.toString().padStart(2,"0")+e.minutes.toString().padStart(2,"0")+e.seconds.toString().padStart(2,"0")),t}function xi(e){return function(t,n){if("mergeId"===n)return t;const i=q(n),o=oe(i);let r=o?.getName();void 0===r&&(r=`x${i.getKey()}`);const a=e[n];for(const e in a)void 0===a[e]&&delete a[e];let s;if("SQ"===a.vr){s={value:[]};for(let e=0;e<a.value.length;++e){const t=a.value[e];s.value.push(Object.keys(t).reduce(xi(t),{}))}}else s=1===a.value.length?a.value[0]:a.value;return t[r]=s,t}}function Ei(e){const t=structuredClone(e);return Object.keys(t).reduce(xi(t),{})}function Ri(e,t){const n=Object.keys(t);for(const i of n)void 0!==e[i]&&s.debug(`Overwritting tag: ${i}`),e[i]=t[i]}function Fi(e){const t=Object.keys(e),n={};for(const i of t){const t=ae(i);if(void 0===t)continue;const o=oe(t),r=o?.getVr();let a,l=!1;const c=e[i];if("SQ"===r){const e=[],t=c;if(void 0!==t.undefinedLength&&(l=t.undefinedLength),Array.isArray(t.value))for(const n of t.value)e.push(Fi(n));else s.debug("Non array simpleTag SQ value");a=e}else a=Array.isArray(c)?c:[c];const u=new se(r);u.tag=t,u.value=a,l&&(u.undefinedLength=l),n[t.getKey()]=u}return n}const Mi="00620005",qi="00620009",Ui="0062000C",Vi="0062000D",Ni="00620003",Qi="0062000F",Bi="00620020";class ki{number;label;algorithmType;algorithmName;displayValue;displayRGBValue;propertyTypeCode;propertyCategoryCode;trackingUid;trackingId;interpretedType;roiInterpreter;constructor(e,t,n){this.number=e,this.label=t,this.algorithmType=n}}function Gi(e){const t=new ki(e["00620004"].value[0],e[Mi]?e[Mi].value[0]:"n/a",e["00620008"].value[0]);if(void 0!==e[qi]&&(t.algorithmName=e[qi].value[0]),void 0!==e[Ui])t.displayValue=e[Ui].value[0];else if(void 0!==e[Vi]){const n=e[Vi].value,i=$t(Yt({l:n[0],a:n[1],b:n[2]}));t.displayRGBValue=i}else s.warn("No recommended colour for segment, using default"),t.displayRGBValue=Kt(t.number);if(void 0===e[Ni])throw new Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=Pn(e[Ni].value[0]),void 0===e[Qi])throw new Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=Pn(e[Qi].value[0]),void 0!==e[Bi]&&(t.trackingId=e[Bi].value[0],t.trackingUid=e["00620021"].value[0]),t}function zi(e){let t=e.algorithmType;void 0===t&&(t="MANUAL");const n={SegmentNumber:e.number,SegmentLabel:e.label,SegmentAlgorithmType:t};if("MANUAL"!==t&&void 0!==e.algorithmName&&(n.SegmentAlgorithmName=e.algorithmName),e.displayRGBValue){const t=Xt(jt(e.displayRGBValue));n.RecommendedDisplayCIELabValue=[Math.round(t.l),Math.round(t.a),Math.round(t.b)]}else n.RecommendedDisplayGrayscaleValue=e.displayValue;return e.propertyCategoryCode&&(n.SegmentedPropertyCategoryCodeSequence={value:[An(e.propertyCategoryCode)]}),e.propertyTypeCode&&(n.SegmentedPropertyTypeCodeSequence={value:[An(e.propertyTypeCode)]}),e.trackingId&&(n.TrackingID=e.trackingId,n.TrackingUID=e.trackingUid),n}const Hi={GE:"ge",SIEMENS:"siemens",PHILIPS:"philips",HITACHI:"hitachi"};function Yi(e){return ce(e,"00080070")}function Xi(e){let t;const n=Yi(e);return void 0!==n&&(t=n.toUpperCase().startsWith("SIEMENS")?Hi.SIEMENS:n.startsWith("GE")?Hi.GE:n.startsWith("Philips")?Hi.PHILIPS:n.toUpperCase().startsWith("HITACHI")?Hi.HITACHI:n.toLowerCase()),t}const Wi="00080016",$i="00080022",ji="00080032",Zi="00189087",Ki="00209111",_i="00209157",Ji="00209128",eo="1.2.840.10008.5.1.4.1.1.4",to="1.2.840.10008.5.1.4.1.1.4.1",no="1.2.840.10008.5.1.4.1.1.4.3",io="1.2.840.10008.5.1.4.1.1.4.4",oo=[{manufacturer:Hi.SIEMENS,key:"0019100C"},{manufacturer:Hi.GE,key:"00431039"},{manufacturer:Hi.HITACHI,key:"00291030"}],ro=[{name:"TemporalPositionIdentifier",getter:So("00200100",e=>parseInt(e,10)),preLoad:!0},{name:"TemporalPositionIndex",getter:function(e){return ao(Di(e,go,"TemporalPositionIndex"),Ji)},preLoad:!0},{name:"DiffusionBValue",getter:function(e){let t;const n=ce(e,Wi);return n!==eo&&n!==to&&n!==no&&n!==io||(t=function(e){let t;const n=ce(e,Wi),i="unit.smm2";if(n===to||n===no||n===io){const n=lo(e);if(void 0!==n)t={value:n,tagKey:Zi,unit:i};else{const n=function(e){let t;return Xi(e)===Hi.PHILIPS&&(t=function(e){let t;return function(e){const t=ue(e,"00209222");return void 0!==t&&t.some(e=>"(0018,9087)"===ce(e,"00209165"))}(e)&&(t=Di(e,uo,"DimensionIndexValues b-value")),t}(e)),t}(e);void 0!==n&&(s.debug("Got b-value for enhanced MR from non standard tag"),t={value:n,tagKey:_i})}}else if(n===eo){const n=function(e){let t;const n=Xi(e),i=ce(e,"00080018");let o;o=void 0!==Ne.privateBValueRules?Ne.privateBValueRules:oo;for(const r of o){let o;if((void 0!==r.uidPrefix&&void 0!==i&&i.startsWith(r.uidPrefix)||void 0!==r.manufacturer&&void 0!==n&&r.manufacturer===n)&&(o=co(e,r.key)),void 0!==o&&!isNaN(parseFloat(o))){t={value:o,key:r.key};break}}if(void 0===t){const n=ce(e,Zi);void 0!==n&&(t={value:n,key:Zi})}return t}(e);if(void 0!==n)t={value:n.value,tagKey:n.key,unit:i};else{const n=lo(e);void 0!==n&&(t={value:n,tagKey:Zi,unit:i})}}if(void 0!==t){const e=ho(t.value,parseFloat);t=void 0!==e?{...t,value:e}:void 0}return t}(e)),t},preLoad:!0},{name:"EchoTime",getter:So("00180081",parseFloat,"unit.ms")},{name:"TriggerTime",getter:So("00181060",parseFloat,"unit.ms")},{name:"InversionTime",getter:So("00180082",parseFloat,"unit.ms")},{name:"AcquisitionTime",getter:function(e){if(void 0===ce(e,ji))return;let t=function(e){const t=Ti(e);if(void 0===t)return;const n=3600*t.hours+60*t.minutes+t.seconds+t.milliseconds/1e3;return isNaN(n)?void 0:n}(e[ji]);if(void 0!==t&&void 0!==ce(e,$i)){const n=wi(e[$i]),i=Date.UTC(n.year,n.monthIndex,n.day);isNaN(i)||(t+=i/1e3)}return ao(t,ji,"unit.s")},relative:!0}];function ao(e,t,n){if(void 0===e)return;const i={value:e,tagKey:t};return void 0!==n&&(i.unit=n),i}function so(e){let t;const n=ue(e,"00189117");return void 0!==n&&(t=ce(n[0],Zi)),t}function lo(e){let t;const n=ue(e,"52009229");return void 0!==n&&(t=so(n[0])),void 0===t&&(t=Di(e,so,"DiffusionBValue")),t}function co(e,t){const n=e[t];if(void 0!==n&&"UN"===n.vr&&void 0!==n.value){const e=ye(String.fromCharCode(...n.value));return 0!==e.length?e.split("\\")[0]:void 0}return ce(e,t)}function uo(e){let t;const n=ue(e,Ki);if(void 0!==n){const e=ue(n[0],_i);void 0!==e&&4===e.length&&(t=ho(e[2],parseFloat))}return t}function ho(e,t){let n;if(void 0!==e){const i=t(e);isNaN(i)||(n=i)}return n}function go(e){let t;const n=ue(e,Ki);return void 0!==n&&(t=ho(ce(n[0],Ji),e=>parseInt(e,10))),t}function So(e,t,n){return function(i){return ao(ho(ce(i,e),t),e,n)}}const mo=[];function po(e){mo.includes(e)||(mo.push(e),s.warn(e))}function fo(e,t){const n=e.getter(t);if(void 0!==n)return{...n,source:e.name}}function vo(e){return{name:"custom",getter(t){const n=e(t);return void 0!==n?{value:n}:void 0}}}function Co(e){if(void 0!==Ne.getVolumeIdTagValue)return po("custom.getVolumeIdTagValue: deprecated since v0.37, please use custom.volumeIdCandidates with a preLoad candidate."),fo(vo(Ne.getVolumeIdTagValue),e);for(const t of Do())if(!0===t.preLoad){const n=fo(t,e);if(void 0!==n)return n}}function yo(e){return Co(e)?.value}function Do(){return void 0!==Ne.volumeIdCandidates?Ne.volumeIdCandidates:ro}function Io(e,t,n){if(e.length!==t.length)return;const i=[];for(const t of e){if("number"!=typeof t||isNaN(t))return;i.includes(t)||i.push(t)}if(i.length<2||i.length*n!==e.length)return;i.sort((e,t)=>e-t);const o=[],r=new Set;for(let a=0;a<e.length;++a){const s=i.indexOf(e[a]),l=s*n+t[a];if(r.has(l))return;r.add(l),o.push(s)}return o}function wo(e){const t=Math.min(...e.map(e=>e.value));return e.map(e=>({...e,value:e.value-t}))}function To(e,t,n){let i;void 0!==Ne.getPostLoadVolumeIdTagValue?(po("custom.getPostLoadVolumeIdTagValue: deprecated since v0.37, please use custom.volumeIdCandidates."),i=[vo(Ne.getPostLoadVolumeIdTagValue)]):i=Do();for(const o of i){const i=e.map(e=>fo(o,e)),r=Io(i.map(e=>e?.value),t,n);if(void 0!==r)return s.debug(`Using '${o.name}' as volume id`),{volumeIndices:r,volumeIds:!0===o.relative?wo(i):i,getter:e=>o.getter(e)?.value}}}const Lo="00209116",Po="00289110";function Ao(e){const t=_e(e),n=[t[0],t[1],1],i=ce(e,"00280008");if(void 0!==i){const e=parseInt(i,10);e>1&&n.push(e)}const o=new St(n);let r=[1,1,1];const a=tt(e);if(void 0!==a)r=[a[0],a[1],1];else{const t=Je(e,Ke.PixelAspectRatio);void 0!==t&&(r=[t[0],t[1],1],s.warn("Use pixel aspect ratio as spacing"))}const l=new Ze(r),c=ue(e,"00200032");let u=new Array(0,0,0);void 0!==c&&(u=[parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2])]);const d=function(e){const t=ue(e,Ke.ImageOrientationPatient);let n;return void 0!==t&&(n=$e(t.map(e=>parseFloat(e)))),n}(e),h=new m(u[0],u[1],u[2]),g=Co(e);return new Ct([h],o,l,d,g)}function Oo(e,t,n){const i=e.getDistance(t);if(i>1e-4){if(!(i<.01))throw new Error(`No reference origin for frame origin ${n}`);s.warn(`Frame origin ${n} is far from reference origin (${i}).`)}}function bo(e,t,n,i){const o=_e(e),r=new St([o[0],o[1],1]);let l,c;const u=ue(e,"52009229");if(void 0!==u){const e=u[0];if(void 0!==e[Lo]){const t=e[Lo];0!==t.value.length?c=t.value[0]["00200037"].value:s.warn("No shared functional group plane orientation sequence items.")}if(void 0!==e[Po]){const t=e[Po];0!==t.value.length?l=nt(t.value[0]):s.warn("No shared functional group pixel measure sequence items.")}}const h=[];for(let e=0;e<t.length;++e){const n=v(t[e].imagePosPat);if(f(h,n)||h.push(n),void 0!==t[e].imageOrientationPatient)if(void 0===c)c=t[e].imageOrientationPatient;else if(!A(c,t[e].imageOrientationPatient))throw new Error("Unsupported multi orientation frames geometry.");if(void 0!==t[e].spacing)if(void 0===l)l=t[e].spacing;else if(!l.equals(t[e].spacing))throw new Error("Unsupported multi resolution frames geometry.")}if(void 0===l)throw new Error("No spacing found for frames geometry");if(void 0===c)throw new Error("No imageOrientationPatient found for frames geometry");const g=$e(c.map(e=>parseFloat(e)));if(void 0===g)throw new Error("Invalid imageOrientationPatient found for frames geometry");let S;if(void 0===n||!1===n){S=h;const e=It(S.slice().sort(ft(g)));2===l.length()?l=new Ze([l.get(0),l.get(1),e]):l.get(2)!==e&&s.debug(`Different tag spacing from geo spacing: ${l.get(2)} - ${e}`)}else S=void 0!==i?function(e,t){const n=new Map;for(let i=0;i<e.length;++i){const o=e[i],r=o.getClosest(t);Oo(o,t[r],i),n.set(r,o)}const i=[...n.keys()],o=Math.min(...i),r=Math.max(...i),a=[];for(let e=o;e<=r;++e)a.push(n.has(e)?n.get(e):t[e]);return a}(h,i):function(e,t){const n=[];n.push(e[0]);let i=0;for(let o=1;o<e.length;++o){++i;let r=new a([0,0,i]),l=t.indexToWorld(r).get3D();const c=e[o];let u=c.getDistance(l);const h=u;for(;d(u);)if(s.debug(`Adding intermediate pos pats at ${l.toString()}`),n.push(l),++i,r=new a([0,0,i]),l=t.indexToWorld(r).get3D(),u=c.getDistance(l),u>h)throw new Error("Test distance is increasing when adding intermediate pos pats");n.push(c)}return n}(h,new Ct([h[0]],r,l,g));if(3!==l.length())throw new Error("Incomplete spacing found for frames geometry");const m=new Ct([S[0]],r,l,g);for(let e=1;e<S.length;++e)m.appendOrigin(S[e],e);const p=Co(e);return void 0!==p&&m.setInitialTime(p),m}function xo(e,t,n,i,o,r,a,s){void 0===a&&(a=!1),void 0===s&&(s=!1);let l=t;a?(r*=-1,s?l-=(o-1)*i:i*=-1):s&&(l+=(o-1)*i,i*=-1);const c=r-o*i;let u=0,d=0;return{next(){if(u<n){const t={value:e(l),done:!1,index:l};return l+=i,++u,++d,d===o&&(d=0,l+=c),t}return{done:!0,index:l}}}}function Eo(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function Ro(e,t,n,i){const o=e.getGeometry().getSize();let r=2;i&&void 0!==i&&(r=i.getColAbsMax(2).index);const s=t.getValues(),l=new a(s.map(function(e,t){return t===r||t>2?e:0}));let c,u=o.indexToOffset(l);void 0===n&&(n=!1),c=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const d=o.get(0),h=o.get(1),g=o.get(2);let S=o.getDimSize(2);const m=e.getNumberOfComponents(),p=1===e.getPlanarConfiguration(),f=function(e,t,n,i,o,r,a,s){return 1===m?xo(e,t,n,i,o,r,a,s):3===m?function(e,t,n,i,o,r,a,s,l){const c=[];return l?(c.push(xo(e,t,n,i,o,r,a,s)),c.push(xo(e,t+n*i,n,i,o,r,a,s)),c.push(xo(e,t+2*n*i,n,i,o,r,a,s))):(i*=3,r*=3,c.push(xo(e,t,n,i,o,r,a,s)),c.push(xo(e,t+1,n,i,o,r,a,s)),c.push(xo(e,t+2,n,i,o,r,a,s))),{next(){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,o,r,a,s,p):void 0};let v;if(i&&void 0!==i){const e=i.getColAbsMax(0),t=i.getColAbsMax(2),n=!1,o=!1;if(2===t.index){const t=d*h;v=0===e.index?f(c,u,t,1,d,d,n,o):f(c,u,t,d,h,1,n,o)}else if(0===t.index){const t=g*h;v=1===e.index?f(c,u,t,d,h,S,n,o):f(c,u,t,S,g,d,n,o)}else{if(1!==t.index)throw new Error(`Unknown direction: ${t.index}`);{const t=g*d;v=0===e.index?f(c,u,t,1,d,S,n,o):f(c,u,t,S,g,1,n,o)}}}else if(1===e.getNumberOfComponents())v=function(e,t,n,i){void 0===i&&(i=1);let o=t;return{next(){if(o<n){const t={value:e(o),done:!1,index:o};return o+=i,t}return{done:!0,index:n}}}}(c,u,u+S);else{if(3!==e.getNumberOfComponents())throw new Error(`Unsupported number of components: ${e.getNumberOfComponents()}`);u*=3,S*=3,v=function(e,t,n,i,o){void 0===i&&(i=1),void 0===o&&(o=!1);let r=t,a=1;o?a=(n-t)/3:i*=3;let s=r+a,l=r+2*a;return{next(){if(r<n){const t={value:[e(r),e(s),e(l)],done:!1,index:[r,s,l]};return r+=i,s+=i,l+=i,t}return{done:!0,index:[n]}}}}(c,u,u+S,1,p)}return v}function Fo(e,t){let n=0,i=0;return{next(){if(n<t){i+1<e.length&&n>=e[i+1].index&&++i;const t={value:e[i].value,done:!1,index:n};return++n,t}return{done:!0,index:t}}}}function Mo(e,t){const n=e.length(),i=Array(n).fill(0);for(let t=0;t<n;t++)i[t]=e.getDimSize(t);const o=Array(n).fill(0);for(let t=0;t<n;t++)o[t]=e.get(t);return{unitVectors:i,sizes:o,spacing:t.getValues(),totalSize:e.getTotalSize()}}class qo extends ct{constructor(e,t){super(e,t)}getWorker(){return new r.wc(new URL("./assets/workers/labeling.worker.min.js",import.meta.url),{name:"labeling.worker",type:"module"})}}class Uo{#Z=new st(navigator?.hardwareConcurrency??4);constructor(){this.#Z.onerror=e=>{console.error("Labeling failed!",e.error)}}run(e,t){this.#Z.onworkitem=this.ondone,this.#Z.onwork=()=>{};const n=new qo(function(e,t){return{imageBuffer:e,...Mo(t.getSize(),t.getSpacing())}}(e,t),{});this.#Z.addWorkerTask(n)}runOverlap(e,t){const n=[],i=new Map(e.map(({segNumber:e,minSlice:t})=>[e,t??0]));this.#Z.onworkitem=e=>{for(const t of e.data.labels){const e=i.get(t.id)??0;t.centroidIndex[2]+=e,t.largestSliceZ+=e,t.minZ+=e,t.maxZ+=e}n.push(...e.data.labels)},this.#Z.onwork=()=>{this.ondone({data:{labels:n}})};for(const{segNumber:n,size:i,slices:o}of e){const e=Mo(i,t.getSpacing());this.#Z.addWorkerTask(new qo({segmentSlice:{segNumber:n,slices:o},...e},{}))}}ondone(e){}}class Vo{#bt=null;#xt=null;#Et=null;initialize(e,t){this.#xt=e,this.#Et=t,this.#bt=new Uint8Array(3*e.length)}isInitialized(){return null!==this.#bt}realloc(e,t){this.#xt=e,this.#Et=t;let n=this.#bt;this.#bt=new Uint8Array(3*e.length),this.#bt.set(n),n=null}shiftSlice(e,t,n){this.#bt.set(this.#bt.subarray(e,n),e+t)}#Rt(e){this.#bt[3*e]=0,this.#bt[3*e+1]=0,this.#bt[3*e+2]=0}resetAroundOffset(e){if(!this.isInitialized())return;this.#Rt(e);const t=this.#Et.getDimSize(0),n=this.#Et.getDimSize(1),i=this.#Et.getDimSize(2);for(let o=-5;o<5;o++)for(let r=-5;r<5;r++)for(let a=-5;a<5;a++){const s=e+t*o+n*r+i*a;s>=0&&s<this.#xt.length&&this.#Rt(s)}}#Ft(e,t,n,i,o,r){return()=>{const a=t+n,s=e+1,l=this.#Et.offsetToIndex(a);return a>=this.#xt.length||a<0||0===l.get(i)||l.get(i)===this.#Et.get(i)-1||255===s?s:s>10?255:this.#xt[a]!==o?s:(r.push(this.#Ft(s,a,n,i,o,r)),0)}}#Mt(e,t,n,i,o,r,a,s){return()=>{const l=t+n,c=e+1,u=this.#Et.offsetToIndex(l);return l>=this.#xt.length||l<0||0===u.get(o)||u.get(o)===this.#Et.get(o)-1||255===c?c:c>10?255:this.#xt[l]!==a?c:(s.push(this.#Ft(c,l,i,r,a,s)),s.push(this.#Ft(c,l,-i,r,a,s)),s.push(this.#Mt(c,l,n,i,o,r,a,s)),0)}}getDistance(e,t){if(!this.isInitialized())return 0;const n=t.getThirdColMajorDirection(),i=(n+1)%3,o=(n+2)%3,r=3*e+n,a=this.#bt[r];if(a>0)return a;const s=this.#xt[e],l=[],c=this.#Et.getDimSize(o),u=this.#Et.getDimSize(i);l.push(this.#Mt(0,e,c,u,o,i,s,l)),l.push(this.#Ft(0,e,u,i,s,l)),l.push(this.#Ft(0,e,-u,i,s,l)),l.push(this.#Mt(0,e,-c,u,o,i,s,l));let d=0;const h=Math.pow(10,2);for(;l.length>0;){if(d++,d>h)return this.#bt[r]=255,255;const e=l.shift()();if(e>0)return this.#bt[r]=e,e}return 1/0}}function No(e,t,n,i){const o={};for(let r=0;r<n;++r){const a=e[i+r];for(const e of t)if(a===e){const t=e-1;void 0===o[t]&&(o[t]=new Uint8Array(n)),o[t][r]=1}}return o}class Qo{#ue;#qt=new Map;#Ut=!1;#Vt;constructor(e){this.#ue=e}getAll(){return this.#qt}setLabelMap(e){this.#Vt=e}addFrame(e,t,n,i,o,r){this.#qt.has(e)||this.#qt.set(e,new Map);const a=this.#qt.get(e);a.has(i)||a.set(i,new Uint8Array(o));const s=a.get(i);for(let e=0;e<o;++e)0!==t[n+e]&&(s[e]=r)}getLabelMap(){if(void 0!==this.#Vt)return this.#Vt;const e=this.#ue.getSize().getDimSize(2),t=this.#ue.getSize().getTotalSize(),n=new Uint8Array(t);for(const[,t]of this.#qt)for(const[i,o]of t){const t=i*e;for(let i=0;i<e;++i)0!==o[i]&&(0!==n[t+i]&&n[t+i]!==o[i]&&(this.#Ut=!0),0===n[t+i]&&(n[t+i]=o[i]))}return this.#Ut&&s.warn("SegmentCollection: detected overlapping segments"),this.#Vt=n,n}#Nt(e){const t=this.#ue.getSize().getDimSize(2),n=Math.floor(e/t);return{sliceIndex:n,localOffset:e-n*t}}updateAtOffset(e,t,n){if(0===this.#qt.size||t===n)return;const i=this.#ue.getSize().getDimSize(2),{sliceIndex:o,localOffset:r}=this.#Nt(e);if(0!==t){const e=this.#qt.get(t)?.get(o);void 0!==e&&(e[r]=0)}if(0!==n){this.#qt.has(n)||this.#qt.set(n,new Map);const e=this.#qt.get(n);e.has(o)||e.set(o,new Uint8Array(i)),e.get(o)[r]=n}}shiftSlices(e,t){if(0!==this.#qt.size&&0!==t){for(const n of this.#qt.values()){const i=[...n.keys()].filter(t=>t>=e);for(const e of i){const i=n.get(e);n.delete(e),n.set(e+t,i)}}this.#Qt=void 0,this.#Bt=""}}getOtherValueAtOffset(e,t){if(0===this.#qt.size)return 0;const{sliceIndex:n,localOffset:i}=this.#Nt(e);for(const[e,o]of this.#qt){if(e===t)continue;const r=o.get(n);if(void 0!==r&&0!==r[i])return r[i]}return 0}clone(){const e=new Qo(this.#ue);for(const[t,n]of this.#qt){const i=new Map;for(const[e,t]of n)i.set(e,t.slice());e.#qt.set(t,i)}return e.#Ut=this.#Ut,e}getHasOverlap(){return this.getLabelMap(),this.#Ut}getSegmentBuffers(e){if(0===this.#qt.size){let t=e.map(e=>e.number);if(0===t.length&&void 0!==this.#Vt){const e=new Set;for(let t=0;t<this.#Vt.length;++t)0!==this.#Vt[t]&&e.add(this.#Vt[t]);t=Array.from(e)}return function(e,t,n){const i=t.getSize(),o=i.getDimSize(2),r={};for(let t=0;t<i.get(2);++t){const i=No(e,n,o,t*o),a=Object.keys(i);for(const e of a)void 0===r[e]&&(r[e]={}),r[e][t]=i[e]}return r}(this.#Vt,this.#ue,t)}const t={};for(const n of e){const e=n.number-1,i=this.#qt.get(n.number);if(void 0!==i)for(const[n,o]of i){const i=new Uint8Array(o.length);let r=!0;for(let e=0;e<o.length;++e)0!==o[e]&&(i[e]=1,r=!1);r||(void 0===t[e]&&(t[e]={}),t[e][n]=i)}}return t}#Qt;#Bt="";getOrBuildUnionContour(e,t){const n=[];for(const[t]of this.#qt)e?.isHidden(t)&&n.push(t);const i=n.sort().join(",");if(void 0!==this.#Qt&&i===this.#Bt)return this.#Qt;const o=t.getDimSize(2),r=new Uint8Array(t.getTotalSize());for(const[t,n]of this.#qt)if(!e?.isHidden(t))for(const[e,t]of n){const n=e*o;for(let e=0;e<o;++e)0!==t[e]&&(r[n+e]=1)}return this.#Qt=new Vo,this.#Qt.initialize(r,t),this.#Bt=i,this.#Qt}}class Bo{#kt;#qt;constructor(e){this.#kt=e;const t=e.getMeta();void 0===t.custom&&(t.custom={}),void 0===t.custom.segments&&(t.custom.segments=[]),this.#qt=t.custom.segments}getMask(){return this.#kt}#Gt(e){return this.#qt.findIndex(function(t){return t.number===e})}hasSegment(e){return-1!==this.#Gt(e)}getNumberOfSegments(){return this.#qt.length}maskHasSegments(e){const t=[],n=[];for(let i=0;i<e.length;++i){const o=this.getSegment(e[i]);void 0!==o?void 0!==o.displayValue?t.push(o.displayValue):t.push(o.number):(s.warn(`Unknown segment in maskHasSegments: ${e[i]}`),n.push(i))}const i=this.#kt.hasValues(t);for(let e=0;e<n.length;++e)i.splice(n[e],0,!1);return i}getSegment(e){let t;const n=this.#Gt(e);return-1!==n&&(t=this.#qt[n]),t}addSegment(e){-1===this.#Gt(e.number)?(this.#qt.push(e),void 0!==e.displayRGBValue&&this.#kt.updatePaletteColourMap(e.number,e.displayRGBValue)):s.warn(`Not adding segment, it is allready in the segments list: ${e.number}`)}removeSegment(e){const t=this.#Gt(e);-1!==t?this.#qt.splice(t,1):s.warn(`Cannot remove segment, it is not in the segments list: ${e}`)}updateSegment(e){const t=this.#Gt(e.number);-1!==t?this.#qt[t]=e:s.warn(`Cannot update segment, it is not in the segments list: ${e.number}`)}findOverlap(e){const t=this.#kt.getGeometry(),n=t.getSize(),i=e.getMask(),o=i.getGeometry(),r=o.getSize(),a={},s=n.getTotalSize();for(let l=0;l<s;l++){const s=this.#kt.getValueAtOffset(l);if(0!==s){if(void 0!==a[s])a[s].count+=1;else{const e=this.getSegment(s);a[s]={label:e.label,overlap:{},count:1}}const c=n.offsetToIndex(l),u=t.indexToWorld(c),d=o.worldToIndex(u),h=r.indexToOffset(d),g=i.getValueAtOffset(h);if(void 0!==g&&0!==g)if(void 0!==a[s].overlap[g])a[s].overlap[g].count+=1;else{const t=e.getSegment(g);a[s].overlap[g]={label:t.label,count:1,percentage:0}}}}for(const e of Object.values(a))for(const t of Object.values(e.overlap))t.percentage=100*t.count/e.count;return a}}class ko extends Vt{#zt;#Ht=new Vo;#Yt=null;#Xt;constructor(e,t,n,i){super(e,t,n),void 0===i&&(i=new Qo(e)).setLabelMap(t),this.#zt=i,this.addEventListener("imagebufferrealloc",()=>{this.#zt?.setLabelMap(this.getBuffer()),this.#Ht.isInitialized()&&this.#Ht.realloc(this.getBuffer(),this.getGeometry().getSize())}),this.addEventListener("imagesliceshift",e=>{const{indexOffset:t,insertSize:n,maxOffset:i}=e.detail,o=this.getGeometry().getSize().getDimSize(2);if(this.#zt?.shiftSlices(t/o,n/o),this.#Ht.isInitialized()){const e=3/this.getNumberOfComponents();this.#Ht.shiftSlice(t*e,n*e,i*e)}})}initializeContour(){this.#Ht.initialize(this.getBuffer(),this.getGeometry().getSize())}getContour(){return this.#Ht}getSegmentCollection(){return this.#zt}getHasOverlap(){return this.#zt?.getHasOverlap()??!1}getMaskReferencedSeriesUID(){return this.getMeta().custom.referencedSeriesUID}isMask(){return!0}getSegmentNumbersAtIndex(e){const t=new Set,n=this.getValueAtIndex(e);if(0!==n&&t.add(n),this.getHasOverlap()){const n=this.getGeometry().getSize(),i=e.get(0)+e.get(1)*n.get(0),o=this.#zt.getAll();for(const[n,r]of o){const o=r.get(e.get(2));void 0!==o&&0!==o[i]&&t.add(n)}}return[...t].sort((e,t)=>e-t)}getOffsets(e){const t=this.getBuffer(),n=this.getNumberOfComponents();let i;if("number"==typeof e){if(1!==n)throw new Error("Number of components is not 1 for getting single value.");i=[e]}else if(void 0!==e.r&&void 0!==e.g&&void 0!==e.b){if(3!==n)throw new Error("Number of components is not 3 for getting RGB value.");i=[e.r,e.g,e.b]}const o=[];let r;for(let e=0;e<t.length;e+=n){r=!0;for(let o=0;o<n;++o)if(t[e+o]!==i[o]){r=!1;break}r&&o.push(e)}return o}setAtOffsets(e,t){const n=this.getBuffer(),i=this.getNumberOfComponents();let o,r;if("number"==typeof t){if(1!==i)throw new Error("Number of components is not 1 for setting single value.");o=[t]}else if(void 0!==t.r&&void 0!==t.g&&void 0!==t.b){if(3!==i)throw new Error("Number of components is not 3 for setting RGB value.");o=[t.r,t.g,t.b]}for(let t=0,a=e.length;t<a;++t)if(r=e[t],1===i){const e=n[r];n[r]=o[0],this.#zt?.updateAtOffset(r,e,o[0])}else for(let e=0;e<i;++e)n[r+e]=o[e];this.dispatchEvent(new CustomEvent("imagecontentchange"))}setAtOffsetsWithValues(e,t){const n=this.getBuffer();for(let i=0;i<e.length;++i){const o=e[i],r=t[i],a=n[o];n[o]=r,this.getContour().resetAroundOffset(o),this.#zt?.updateAtOffset(o,a,r)}this.dispatchEvent(new CustomEvent("imagecontentchange"))}setAtOffsetsAndGetOriginals(e,t){const n=this.getBuffer(),i=[];for(let o=0;o<e.length;++o){const r=e[o];let a=r[0],s=n[a];const l=[];l.push({index:0,value:s});for(let e=0;e<r.length;++e){a=r[e];const i=n[a];s!==i&&(l.push({index:e,value:i}),s=i),n[a]=t,this.getContour().resetAroundOffset(a),this.#zt?.updateAtOffset(a,i,t)}i.push(l)}return this.dispatchEvent(new CustomEvent("imagecontentchange")),i}setAtOffsetsWithIterator(e,t){const n=this.getBuffer(),i=Array.isArray(t);for(let o=0;o<e.length;++o){const r=e[o];let a;a=Fo(i?t[o]:[{index:0,value:t}],r.length);let s=a.next();for(;!s.done;){const e=r[s.index],t=n[e];n[e]=s.value,this.getContour().resetAroundOffset(e),this.#zt?.updateAtOffset(e,t,s.value),s=a.next()}}this.dispatchEvent(new CustomEvent("imagecontentchange"))}#Wt(e){const t=this.getGeometry(),n=t.getSpacing(),i=this.getMeta().lengthUnit;let o=1,r="unit.pixel";"unit.mm"===i&&(o=n.get(0)*n.get(1)*n.get(2)*.001,r="unit.ml");for(const n of e){let e,s;n.centroid=t.indexToWorld(new a(n.centroidIndex)),n.volume={value:n.count*o,unit:r},void 0!==n.diameters&&(void 0!==n.diameters.major&&(e=n.diameters.major.diameter),void 0!==n.diameters.minor&&(s=n.diameters.minor.diameter)),n.diameters={major:{diameter:{value:e,unit:i}},minor:{diameter:{value:s,unit:i}}},n.height={value:n.height,unit:i}}const s=e.sort((e,t)=>t.volume.value-e.volume.value).sort((e,t)=>e.id-t.id);this.#Xt=s,this.dispatchEvent(new CustomEvent("labelschanged",{detail:{labels:s}}))}#$t(){const e=this.getGeometry(),t=e.getSize(),n=t.get(0),i=t.get(1),o=[];for(const[e,t]of this.#zt.getAll()){const r=[...t.keys()],a=Math.min(...r),s=new St([n,i,Math.max(...r)-a+1]),l=[];for(const[e,n]of t)l.push({sliceIndex:e-a,data:new Uint8Array(n)});o.push({segNumber:e,size:s,slices:l,minSlice:a})}this.#Yt.runOverlap(o,e)}getLabels(){return this.#Xt}recalculateLabels(){this.dispatchEvent(new CustomEvent("labelingstart")),null===this.#Yt&&(this.#Yt=new Uo,this.#Yt.ondone=e=>{this.#Wt(e.data.labels),e.data.buffer&&this.replaceBuffer(e.data.buffer)});const e=this.#zt;e?.getHasOverlap()&&e.getAll().size>0?this.#$t():this.#Yt.run(this.getBuffer(),this.getGeometry())}clone(){const e=super.clone(),t=this.#zt.clone();return t.setLabelMap(e.getBuffer()),e.#zt=t,e}getHistogramBySegment(e,t){const n=this.#jt(t);if(void 0===n)return s.warn(`getHistogramBySegment: unknown segment id: ${t}`),[];const i=e.getGeometry();if(!this.#Zt(i))throw new Error("getHistogramBySegment: mask and image geometries are not compatible.");const o=i.getSize(),r=i.getOrigins(),a=this.getGeometry().getOrigins().map(e=>r.findIndex(t=>e.isSimilar(t,1e-4))),l=void 0!==n.displayValue?n.displayValue:n.number,c=4===o.length()?o.get(3):1,u=o.getDimSize(3),d=o.getDimSize(2),h=this.getBuffer(),g=e.getMeta().pixelUnit,S=(t,n,i,r)=>{for(let s=i;s<=r;++s){const i=s*d,r=n*u+a[s]*d,c=e.getRescaleSlopeAndIntercept(o.offsetToIndex(r)),g=t.getHistogram(c);for(let t=0;t<d;++t)h[i+t]===l&&g.add(e.getValueAtOffset(r+t))}};let m=this.#Xt?.filter(e=>e.id===l);void 0!==m&&this.#Kt(m)&&(s.debug("getHistogramBySegment: labels share slices, no label histograms."),m=void 0);const p=[];for(let e=0;e<c;++e){const t=new qt(g);S(t,e,0,a.length-1);const n={volume:e,histogram:t};void 0!==m&&(n.labelHistograms=m.map(t=>{const n=new qt(g);return S(n,e,t.minZ,t.maxZ),{label:t,histogram:n}})),p.push(n)}return p}#Kt(e){const t=e.slice().sort((e,t)=>e.minZ-t.minZ);for(let e=1;e<t.length;++e)if(t[e].minZ<=t[e-1].maxZ)return!0;return!1}#jt(e){const t=new Bo(this),n=this.getMeta()?.custom?.segments??[];for(const t of n)if(t.trackingUid===e)return t;for(const t of n)if(String(t.number)===e)return t;const i=Number(e);if(!Number.isNaN(i)&&t.hasSegment(i))return t.getSegment(i)}#Zt(e){const t=this.getGeometry(),n=t.getSize(),i=e.getSize();for(let e=0;e<2;++e)if(n.get(e)!==i.get(e))return!1;if(!t.getOrientation().isSimilar(e.getOrientation(),1e-4))return!1;const o=e.getOrigins();return t.getOrigins().every(e=>o.some(t=>e.isSimilar(t,1e-4)))}}function Go(e){const t=[];for(let n=0;n<256;++n)t.push(e(n));return t}function zo(e){return e}function Ho(e){return 255-e}class Yo{red;green;blue;constructor(e,t,n){this.red=e,this.green=t,this.blue=n}}const Xo={plain:{red:Go(zo),green:Go(zo),blue:Go(zo)},invPlain:{red:Go(Ho),green:Go(Ho),blue:Go(Ho)},rainbow:{blue:[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,247,239,231,223,215,207,199,191,183,175,167,159,151,143,135,127,119,111,103,95,87,79,71,63,55,47,39,31,23,15,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],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,8,16,24,32,40,48,56,64,72,80,88,96,104,112,120,128,136,144,152,160,168,176,184,192,200,208,216,224,232,240,248,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,253,251,249,247,245,243,241,239,237,235,233,231,229,227,225,223,221,219,217,215,213,211,209,207,205,203,201,199,197,195,193,192,189,186,183,180,177,174,171,168,165,162,159,156,153,150,147,144,141,138,135,132,129,126,123,120,117,114,111,108,105,102,99,96,93,90,87,84,81,78,75,72,69,66,63,60,57,54,51,48,45,42,39,36,33,30,27,24,21,18,15,12,9,6,3],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,62,60,58,56,54,52,50,48,46,44,42,40,38,36,34,32,30,28,26,24,22,20,18,16,14,12,10,8,6,4,2,0,0,0,0,0,0,0,0,0,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,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]},hot:{red:Go(function(e){const t=3*e;return t>255?255:t}),green:Go(function(e){const t=256/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n}),blue:Go(function(e){const t=256/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]}},Wo={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyTime:"00080030",StudyInstanceUID:"0020000D",StudyID:"00200010",ReferringPhysicianName:"00080090",SeriesDate:"00080021",SeriesTime:"00080031",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052",Manufacturer:"00080070",ManufacturerModelName:"00081090",DeviceSerialNumber:"00181000",SoftwareVersions:"00181020",LossyImageCompression:"00282110"};function $o(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,o=!1;if(i=1===n.value.length?n.value[0]:n.value,Array.isArray(i))for(let e=0;e<t.enum.length;++e){if(!Array.isArray(t.enum[e]))throw new Error("Cannot compare array and non array tag value.");if(A(t.enum[e],i)){o=!0;break}}else o=t.enum.includes(i);if(!o)throw new Error(`Unsupported ${t.name} value: ${i}`)}const jo=[{name:"TransferSyntaxUID",tag:"00020010",type:"1",enum:[ee,te,ne]},{name:"MediaStorageSOPClassUID",tag:"00020002",type:"1",enum:["1.2.840.10008.5.1.4.1.1.66.4"]},{name:"SOPClassUID",tag:"00020002",type:"1",enum:["1.2.840.10008.5.1.4.1.1.66.4"]},{name:"Modality",tag:"00080060",type:"1",enum:["SEG"]},{name:"SegmentationType",tag:"00620001",type:"1",enum:["BINARY"]},{name:"DimensionOrganizationType",tag:"00209311",type:"3",enum:["3D"]},{name:"ImageType",tag:"00080008",type:"1",enum:[["DERIVED","PRIMARY"]]},{name:"SamplesPerPixel",tag:"00280002",type:"1",enum:[1]},{name:"PhotometricInterpretation",tag:"00280004",type:"1",enum:["MONOCHROME2"]},{name:"PixelRepresentation",tag:"00280103",type:"1",enum:[0]},{name:"BitsAllocated",tag:"00280100",type:"1",enum:[1]},{name:"BitsStored",tag:"00280101",type:"1",enum:[1]},{name:"HighBit",tag:"00280102",type:"1",enum:[0]}];function Zo(){const e={};for(const t of jo)e[t.name]=t.enum[0];return e}class Ko{#_t;getWarning(){return this.#_t}checkElements(e){}create(e,t,n){const i=function(t){return ce(e,t)};for(const t of jo)$o(e,t);const o=_e(e),r=o[0]*o[1];let a=i("00280008");if(a=void 0!==a?parseInt(a,10):1,a!==t.length/r)throw new Error(`Buffer and numberOfFrames meta are not equal ${a} ${t.length/r}`);const s=function(e){const t=e["00209221"];if(void 0===t||1!==t.value.length)throw new Error("Unsupported dimension organization sequence length");const n=t.value[0][hi].value[0],i=[],o=e["00209222"];if(void 0!==o){const e=o.value;if(2!==e.length)throw new Error("Unsupported dimension index sequence length");let t;for(let o=0;o<e.length;++o){const r=e[o][hi].value[0];if(r!==n)throw new Error("Dimension Index Sequence contains a unknown Dimension Organization");t=e[o]["00209165"].value[0];const a={DimensionOrganizationUID:r,DimensionIndexPointer:t},s=e[o]["00209421"];void 0!==s&&(a.DimensionDescriptionLabel=s.value[0]),i.push(a)}if("(0020,0032)"!==t)throw new Error("Unsupported non image position as last index")}return{organizations:{value:[{DimensionOrganizationUID:n}]},indices:{value:i}}}(e),l=ue(e,"00620002");if(void 0===l)throw new Error("Missing or empty segmentation sequence");const c=[],u=[0],d=[0],h=[0];for(let e=0;e<l.length;++e){const t=Gi(l[e]);void 0!==t.displayRGBValue&&(u[t.number]=t.displayRGBValue.r,d[t.number]=t.displayRGBValue.g,h[t.number]=t.displayRGBValue.b),c.push(t)}let g,S=!1;u.length>1&&(S=!0,g=new Yo(u,d,h));const m=function(e,t){return e.findIndex(function(e){return t.equals(e)})},p=Ci(e,a);if(void 0===p)throw new Error("Missing or empty per frame functional sequence");if(p.some(e=>void 0===e))throw new Error("Incomplete per frame functional groups");let f;void 0!==n&&(f=n.getGeometry().getOrigins());const C=bo(e,p,!0,f);C.sortOrigins();const y=C.getSize().get(2),D=function(e){return function(t){return t.number===e}},I=new Qo(C),w=C.getOrigins();let T;for(let e=0;e<p.length;++e){if(T=m(w,v(p[e].imagePosPat)),-1===T)throw new Error("Cannot find frame origin in mask origins");const n=c.find(D(p[e].refSegmentNumber)),i=S?n.number:n.displayValue;I.addFrame(n.number,t,r*e,T,r,i)}const L=[];for(let e=0;e<y;++e)L.push(e.toString());const P=new ko(C,I.getLabelMap(),L,I);S&&(P.setPhotometricInterpretation("PALETTE COLOR"),P.setPaletteColourMap(g));const A=Zo(),O=Object.keys(Wo);for(const e of O)A[e]=i(Wo[e]);return A.DimensionOrganizationSequence=s.organizations,A.DimensionIndexSequence=s.indices,A.custom={segments:c,frameInfos:p,SOPInstanceUID:i("00080018"),referencedSeriesUID:rt(e)},A.lengthUnit=n.getMeta().lengthUnit,A.sliceCapacity=y,P.setMeta(A),P}toDicom(e,t,n,i){const o=e.getMeta();void 0===t&&(t=o.segments);const r=e.getGeometry(),a=r.getSize();o.Rows=a.get(1),o.Columns=a.get(0);const s=new Date;o.ContentDate=Oi(Pi(s)),o.ContentTime=bi(Ai(s)),void 0!==n&&(o.StudyInstanceUID=n.getMeta().StudyInstanceUID);const l=[];for(const e of t)l.push(zi(e));var c,u;o.SegmentSequence={value:l},o.SharedFunctionalGroupsSequence={value:[{PlaneOrientationSequence:{value:[(u=r.getOrientation(),{ImageOrientationPatient:[u.get(0,0),u.get(1,0),u.get(2,0),u.get(0,1),u.get(1,1),u.get(2,1)]})]},PixelMeasuresSequence:{value:[(c=r.getSpacing(),{SpacingBetweenSlices:c.get(2),PixelSpacing:[c.get(1),c.get(0)]})]}}]};const d=e.getSegmentCollection().getSegmentBuffers(t),h=[],g=[],S=[];for(const i of t){const t=i.number,o=t-1;if(void 0===d[o])continue;const r=Object.keys(d[o]);for(let i=r.length-1;i>=0;--i){const a=Number.parseInt(r[i],10);g.push(d[o][a]);const s=e.getGeometry().getOrigins()[a],l=[s.getX(),s.getY(),s.getZ()],c=new fi([t,r.length-i],l,void 0,t);if(void 0!==n){const e=n.getGeometry().worldToIndex(new C([s.getX(),s.getY(),s.getZ()]));c.derivationImages=[{sourceImages:[{referencedSOPInstanceUID:n.getImageUid(e),referencedSOPClassUID:n.getMeta().SOPClassUID}]}],S.push({ReferencedSOPInstanceUID:n.getImageUid(e),ReferencedSOPClassUID:n.getMeta().SOPClassUID})}h.push(c)}}o.NumberOfFrames=g.length.toString();const m=[];for(const e of h)m.push(yi(e));if(o.PerFrameFunctionalGroupsSequence={value:m},void 0!==n){const e=[];e.push({ReferencedInstanceSequence:{value:S},SeriesInstanceUID:n.getMeta().SeriesInstanceUID}),o.ReferencedSeriesSequence={value:e}}void 0!==i&&Ri(o,i);const p=Fi(o),f=a.getDimSize(2),v=g.length*f/8,y=new se("OB");return y.tag=new F("7FE0","0010"),y.vl=v,y.value=g,p["7FE00010"]=y,p}}function _o(e,t){const n=e.getGeometry(),i=t.getGeometry();if(!n.getSpacing().equals(i.getSpacing()))throw new Error("mergeMaskImages: masks must have similar spacings");if(!n.getOrientation().isSimilar(i.getOrientation(),1e-4))throw new Error("mergeMaskImages: masks must have similar orientations");const o=i.getSize().get(2)>n.getSize().get(2),r=o?i:n,a=r.getOrigins(),l=r.getSize().getDimSize(2),c=function(e,t){return e.getOrigins().map((e,n)=>{let i=-1,o=1/0;for(let t=0;t<a.length;++t){const n=e.getDistance(a[t]);n<o&&(o=n,i=t)}if(o>.01)throw new Error(`mergeMaskImages: mask${t} slice ${n} has no matching slice in the merged geometry`);return o>1e-4&&s.warn(`mergeMaskImages: mask${t} slice ${n} is far from its closest merged-geometry slice (${o}).`),i})},u=o?c(n,"1"):void 0,d=o?void 0:c(i,"2"),h=e.getMeta().custom?.segments??[],g=t.getMeta().custom?.segments??[],S=e.getSegmentCollection().getSegmentBuffers(h),m=t.getSegmentCollection().getSegmentBuffers(g);let p,f;p=h.length>0?h.map(e=>e.number):Object.keys(S).map(e=>Number(e)+1),f=g.length>0?g.map(e=>e.number):Object.keys(m).map(e=>Number(e)+1);const v=new Set(p);let C=v.size>0?Math.max(...v)+1:1;const y=new Map;for(const e of f)if(v.has(e)){const t=C++;s.warn(`mergeMaskImages: segment number conflict, remapping ${e} to ${t}`),y.set(e,t)}else y.set(e,e),v.add(e);const D=[...h,...g.map(e=>({...e,number:y.get(e.number)}))],I=new Qo(r),w="PALETTE COLOR"===e.getPhotometricInterpretation();for(const[e,t]of Object.entries(S)){const n=Number(e)+1,i=h.find(e=>e.number===n),o=w?n:i?.displayValue??n;for(const[e,i]of Object.entries(t)){const t=Number(e),r=u?u[t]:t;I.addFrame(n,i,0,r,l,o)}}const T="PALETTE COLOR"===t.getPhotometricInterpretation();for(const[e,t]of Object.entries(m)){const n=Number(e)+1,i=y.get(n),o=g.find(e=>e.number===n),r=T?i:o?.displayValue??i;for(const[e,n]of Object.entries(t)){const t=Number(e),o=d?d[t]:t;I.addFrame(i,n,0,o,l,r)}}const L=a.map((e,t)=>t.toString()),P=new ko(r,I.getLabelMap(),L,I);if(w||T){const n=e.getPaletteColourMap(),i=n?[...n.red]:new Array(256).fill(0),o=n?[...n.green]:new Array(256).fill(0),r=n?[...n.blue]:new Array(256).fill(0),a=t.getPaletteColourMap();if(a)for(const e of f){const t=y.get(e);i[t]=a.red[e],o[t]=a.green[e],r[t]=a.blue[e]}P.setPhotometricInterpretation("PALETTE COLOR"),P.setPaletteColourMap(new Yo(i,o,r))}else P.setPhotometricInterpretation(e.getPhotometricInterpretation());const A=structuredClone(e.getMeta());return void 0===A.custom&&(A.custom={}),A.custom.segments=D,P.setMeta(A),P}function Jo(e){return(new Ko).create(e,e["7FE00010"].value[0])}class er{name;wl;perslice;constructor(e,t,n){this.name=e,this.wl=t,this.perslice=n}}const tr="00080016",nr="00080060",ir="00280002",or="00280100",rr={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyTime:"00080030",StudyInstanceUID:"0020000D",StudyID:"00200010",StudyDescription:"00081030",ReferringPhysicianName:"00080090",SeriesDate:"00080021",SeriesTime:"00080031",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052",Manufacturer:"00080070",ManufacturerModelName:"00081090",DeviceSerialNumber:"00181000",SoftwareVersions:"00181020",LossyImageCompression:"00282110"},ar=new WeakMap;class sr{#_t;#Jt;getWarning(){return this.#_t}checkElements(e){if(this.#_t=void 0,void 0===_e(e))throw new Error("No image rows or columns in DICOM file");if(!H(e))throw new Error("No pixel data in DICOM file");const t=ce(e,nr);if(void 0!==t&&"PT"===t){const t=it(e);if(void 0!==(n=ce(e,tr))&&/^1\.2\.840\.10008\.5\.1\.4\.1\.1\.7/.test(n)||!ot(t))return this.#_t;const i=function(e){let t="";const n={};let i;t+=de(e["00280051"],"Corrected Image (00280051)",["ATTN","DECY"]),t+=de(e["00541102"],"Decay Correction (00541102)",["START"]),t+=de(e["00541001"],"Units (00541001)",["BQML"]);const o=e["00101030"],r=de(o," PatientWeight (00101030)");if(0===r.length){const e=parseFloat(o.value[0]);isNaN(e)?t+=" PatientWeight is not a number":i=e}else t+=r;const a=function(e){let t,n="";const i=wi(e["00080021"]);let o,r,a;const l=e["00540016"];if(n+=de(l,"RadiopharmaceuticalInformationSequence (00540016)"),void 0!==l){1!==l.value.length&&s.warn("Found more than 1 istopes in RadiopharmaceuticalInformation Sequence.");const e="RadionuclideTotalDose (00181074)",c=l.value[0]["00181074"];if(t=de(c,e),0===t.length){const e=parseFloat(c.value[0]);isNaN(e)?n+=" TotalDose is not a number":o=e}else n+=t;const u="RadionuclideHalfLife (00181075)",d=l.value[0]["00181075"];if(t=de(d,u),0===t.length){const e=parseFloat(d.value[0]);isNaN(e)?n+=" HalfLife is not a number":r=e}else n+=t;const h=l.value[0]["00181078"];let g,S;if(void 0===h)g=i,S=Ti(l.value[0]["00181072"]);else{const e=function(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0].split("&")[0],n=new se("DA");n.value=[t.substring(0,8)];const i=wi(n),o=new se("TM");return o.value=[t.substring(8)],{date:i,time:t.length>=9?Ti(o):void 0}}(h);g=e.date,S=e.time}a=Li(g,S)}let c=Li(i,Ti(e["00080031"]));const u=e["00080022"],d=e["00080032"];if(void 0!==u&&void 0!==d){const t=wi(u),i=Ti(d),o=Li(t,i);if(c>o){const a=`Series date/time is after Aquisition date/time (diff=${(c.getTime()-o.getTime()).toString()}ms) `;s.debug(a);let l=0;const u="FrameReferenceTime (00541300)",d=e["00541300"];n+=de(d,u),void 0!==d&&(l=d.value[0]);let h=0;const g="ActualFrameDuration (00181242)",S=e["00181242"];if(n+=de(S,g),void 0!==S&&(h=S.value[0]),l>0&&h>0){h/=1e3,l/=1e3;const e=Math.log(2)/r,n=e*h,o=1/e*Math.log(n/(1-Math.exp(-n)))-l;c=new Date(t.year,t.monthIndex,t.day,i.hours,i.minutes,i.seconds+o,i.milliseconds)}}}let h;if(void 0!==c&&void 0!==a&&void 0!==o&&void 0!==r){const e=(c.getTime()-a.getTime())/1e3;h=o*Math.pow(2,-e/r)}return{value:h,warning:n}}(e);return t+=a.warning,0!==t.length?n.warning=`Cannot calculate PET SUV: ${t}`:n.value=1e3*i/a.value,n}(e);this.#Jt=i.value,this.#_t=i.warning}var n;return this.#_t}create(e,t,n,i){const o=function(t){return ce(e,t)};let r,a=o(ir);void 0===a&&(a=1),r=void 0!==i?function(e,t){ar.has(e)||ar.set(e,function(e){const t=Ci(e);if(void 0===t)return;if(t.some(e=>void 0===e))return void s.warn("Incomplete per-frame functional groups, not using them for geometry");const n=[],i=[],o=[];for(const e of t){const t=v(e.imagePosPat);let r=i.findIndex(p(t));-1===r&&(r=i.length,i.push(t)),n.push(t),o.push(r)}let r;if(i.length!==n.length){const t=[];for(let i=0;i<n.length;++i)t.push(Ii(e,i));const a=To(t,o,i.length);if(void 0===a)return void s.warn("Duplicate frame origins without volume ids, not using them for geometry");r=a.volumeIds}const a=bo(e,t),l=a.getSize(),c=new St([l.get(0),l.get(1),1]),u=[];for(let e=0;e<n.length;++e)u.push(new Ct([n[e]],c,a.getSpacing(),a.getOrientation(),void 0!==r?r[e]:a.getInitialTime()));return u}(e));const n=ar.get(e);let i;if(void 0!==n)i=n[t].clone();else{const n=Ao(e),o=_e(e);i=new Ct([n.getOrigin()],new St([o[0],o[1],1]),n.getSpacing(),n.getOrientation(),{value:t})}return i}(e,i):Ao(e);const l=r.getSize().getTotalSize(),c=tt(e),u=o("00080018"),d=l*a;if(d!==t.length){if(s.warn(`Badly sized pixel buffer: ${t.length} != ${d}`),!(d<t.length))throw new Error("Underestimated buffer size, can't fix it...");t=t.slice(0,l)}const h=new Vt(r,t,[u]),g=it(e);void 0!==g&&h.setPhotometricInterpretation(g);const S=o("00280006");void 0!==S&&h.setPlanarConfiguration(S);let m=1;const f=o("00281053");if(void 0!==f){const e=parseFloat(f);isNaN(e)||(m=e)}let C=0;const y=o("00281052");if(void 0!==y){const e=parseFloat(y);isNaN(e)||(C=e)}let D=!1,I=1;void 0!==this.#Jt&&(D=!0,I=this.#Jt,s.info(`Applying PET SUV calibration: ${I}`),m*=I,C*=I);const w=new Ve(m,C);if(h.setRescaleSlopeAndIntercept(w),"PALETTE COLOR"===h.getPhotometricInterpretation()){const t=function(e){let t;const n=ue(e,"00281101");if(void 0!==n&&3===n.length){let i,o,r;const a=e["00281201"],l=e["00281202"],c=e["00281203"];if(16===n[2]){let t=!1,u=n[0];0===u&&(u=65536);const d=a.vl;if(d!==2*u&&(t=!0,s.info(`16bits lut but size is not double. desc: ${u} vl: ${d}`)),8===parseInt(ce(e,or),10)&&(t=!0,s.info("Scaling 16bits color lut since bits allocated is 8.")),t){const e=function(e){return e>>8};i=a.value.map(e),o=l.value.map(e),r=c.value.map(e)}}else if(8===n[2]){s.info("Scaling 16bits color lut since the lut descriptor is 8.");let e=a.value.slice(0);i=Array.from(new Uint8Array(e.buffer)),e=l.value.slice(0),o=Array.from(new Uint8Array(e.buffer)),e=c.value.slice(0),r=Array.from(new Uint8Array(e.buffer))}t=new Yo(i,o,r)}return t}(e);void 0!==t&&h.setPaletteColourMap(t)}const T={sliceCapacity:n};if(void 0!==i){const e=parseInt(o("00280008"),10);T.sliceCapacity*=e}T.TransferSyntaxUID=o("00020010"),T.MediaStorageSOPClassUID=o("00020002"),T.SOPClassUID=o(tr),T.Modality=o(nr),T.ImageType=o("00080008"),T.SamplesPerPixel=o(ir),T.PhotometricInterpretation=o("00280004"),T.PixelRepresentation=o("00280103"),T.BitsAllocated=o(or),T.BitsStored=o("00280101"),T.HighBit=o("00280102");const L=Object.keys(rr);for(const e of L)T[e]=o(rr[e]);if(D)T.pixelUnit="SUV";else{const t=(P=e,void 0!==Ne.getTagPixelUnit?Ne.getTagPixelUnit(P):function(e){let t;const n=["RescaleType","Units"];for(const i of n)if(t=ce(e,Ke[i]),void 0!==t)break;if(void 0===t){const n=ce(e,Ke.Modality);void 0!==n&&"CT"===n&&(t="HU")}return t}(P));void 0!==t&&(T.pixelUnit=t)}var P;T.lengthUnit=void 0===c?"unit.pixel":"unit.mm";const A=function(e,t){let n;const i=ue(e,"00281050"),o=ue(e,"00281051");if(void 0!==i&&void 0!==o){n={};const r=ue(e,"00281055");let a;for(let e=0;e<i.length;++e){const l=parseFloat(i[e]);let c=parseFloat(o[e]);l&&c&&0!==c&&(a="",void 0!==r&&(a=r[e]),""===a&&(a=`Default${e}`),c*=t,c<1&&(c=1),n[a]=new er(a,[new bt(l*t,c)])),0===c&&s.warn("Zero window width found in DICOM.")}}return n}(e,I);return void 0!==A&&(T.windowPresets=A),T.VOILUTFunction=o("00281056"),h.setMeta(T),h}}function lr(e){return(new sr).create(e,e["7FE00010"].value[0],1)}const cr="0040A30A",ur="0040A161",dr="0040A162",hr="0040A163",gr="004008EA";class Sr{numericValue;floatingPointValue;rationalNumeratorValue;rationalDenominatorValue;measurementUnitsCode;toString(){return`${this.numericValue} ${this.measurementUnitsCode.toString()}`}}function mr(e){const t={};return void 0!==e.measurementUnitsCode&&(t.MeasurementUnitsCodeSequence={value:[An(e.measurementUnitsCode)]}),void 0!==e.floatingPointValue&&(t.FloatingPointValue=e.floatingPointValue),void 0!==e.rationalNumeratorValue&&(t.RationalNumeratorValue=e.rationalNumeratorValue),void 0!==e.rationalDenominatorValue&&(t.RationalDenominatorValue=e.rationalDenominatorValue),void 0!==e.numericValue&&(t.NumericValue=e.numericValue),t}const pr="0040A300",fr="0040A301";class vr{measuredValue;numericValueQualifierCode;toString(){let e="";return void 0!==this.measuredValue&&(e+=this.measuredValue.toString()),void 0!==this.numericValueQualifierCode&&(e+=` ${this.numericValueQualifierCode.toString()}`),e}}function Cr(e){const t={};return void 0!==e.measuredValue&&(t.MeasuredValueSequence={value:[mr(e.measuredValue)]}),void 0!==e.numericValueQualifierCode&&(t.NumericValueQualifierCodeSequence={value:[An(e.numericValueQualifierCode)]}),t}const yr="00081150",Dr="00081155";class Ir{referencedSOPClassUID;referencedSOPInstanceUID;toString(){return`${this.referencedSOPInstanceUID} (class: ${this.referencedSOPClassUID})`}}function wr(e){const t=new Ir;return void 0!==e[yr]&&(t.referencedSOPClassUID=e[yr].value[0]),void 0!==e[Dr]&&(t.referencedSOPInstanceUID=e[Dr].value[0]),t}function Tr(e){const t={};return void 0!==e.referencedSOPClassUID&&(t.ReferencedSOPClassUID=e.referencedSOPClassUID),void 0!==e.referencedSOPInstanceUID&&(t.ReferencedSOPInstanceUID=e.referencedSOPInstanceUID),t}const Lr="00081160",Pr="00081199",Ar="0062000B";class Or{referencedSOPSequence;referencedFrameNumber;referencedSegmentNumber;toString(){let e=this.referencedSOPSequence.toString();return void 0!==this.referencedFrameNumber&&(e+=`, frame: ${this.referencedFrameNumber}`),e}}function br(e){const t={};return void 0!==e.referencedFrameNumber&&(t.ReferencedFrameNumber=e.referencedFrameNumber),void 0!==e.referencedSOPSequence&&(t.ReferencedSOPSequence={value:[Tr(e.referencedSOPSequence)]}),void 0!==e.referencedSegmentNumber&&(t.ReferencedSegmentNumber=e.referencedSegmentNumber),t}class xr{#en;#tn;constructor(e,t){this.#en=e,this.#tn=t}getBegin(){return this.#en}getEnd(){return this.#tn}equals(e){return null!==e&&this.getBegin().equals(e.getBegin())&&this.getEnd().equals(e.getEnd())}getDeltaX(){return this.getEnd().getX()-this.getBegin().getX()}getDeltaY(){return this.getEnd().getY()-this.getBegin().getY()}getLength(){return Math.sqrt(this.getDeltaX()*this.getDeltaX()+this.getDeltaY()*this.getDeltaY())}getWorldLength(e){let t=null;if(null!==e){const n=this.getDeltaX()*e.x,i=this.getDeltaY()*e.y;t=Math.sqrt(n*n+i*i)}return t}getMidpoint(){return this.getCentroid()}getCentroid(){return new S((this.getBegin().getX()+this.getEnd().getX())/2,(this.getBegin().getY()+this.getEnd().getY())/2)}contains(e,t=0){return Fr(e,this.getBegin(),this.getEnd())<=t}getSlope(){return this.getDeltaY()/this.getDeltaX()}getIntercept(){return(this.getEnd().getX()*this.getBegin().getY()-this.getBegin().getX()*this.getEnd().getY())/this.getDeltaX()}getInclination(){return 180-180*Math.atan2(this.getDeltaY(),this.getDeltaX())/Math.PI}getFlipped(){return new xr(this.#tn,this.#en)}quantify(e){const t=e.get2DSpacing(),n=this.getWorldLength(t);let i;return null!==n&&(i={value:n,unit:e.getLengthUnit()}),{length:i}}}function Er(e,t){const n=e.getDeltaX(),i=e.getDeltaY(),o=t.getDeltaX(),r=t.getDeltaY(),a=n*o+i*r,s=n*r-i*o;return 360-(180-180*Math.atan2(s,a)/Math.PI)}function Rr(e,t){const n=e.getDeltaX(),i=e.getDeltaY();return n*t.getDeltaX()+i*t.getDeltaY()===0}function Fr(e,t,n){const i=n.getX()-t.getX(),o=n.getY()-t.getY(),r=i*i+o*o;let a=0;return 0!==r&&(a=((e.getX()-t.getX())*i+(e.getY()-t.getY())*o)/r,a=Math.max(0,Math.min(1,a))),Math.hypot(e.getX()-(t.getX()+a*i),e.getY()-(t.getY()+a*o))}function Mr(e,t,n,i){void 0===i&&(i={x:1,y:1});const o=-i.x*i.x/(i.y*i.y*e.getSlope());return Ur(o,t.getY()-o*t.getX(),t,n,i)}function qr(e,t,n,i){const o=Ur(e.getSlope(),e.getIntercept(),e.getBegin(),t,i);let r;return r=function(e,t){const n=Math.min(t.getBegin().getX(),t.getEnd().getX()),i=Math.max(t.getBegin().getX(),t.getEnd().getX()),o=Math.min(t.getBegin().getY(),t.getEnd().getY()),r=Math.max(t.getBegin().getY(),t.getEnd().getY());return e.getX()>=n&&e.getX()<=i&&e.getY()>=o&&e.getY()<=r}(o.getBegin(),e)?o.getBegin():o.getEnd(),Mr(e,r,n,i)}function Ur(e,t,n,i,o){let r,a,s,l;if(void 0===o&&(o={x:1,y:1}),u(e,0,1e-4))r=n.getX()-i/(2*o.x),a=n.getY(),s=n.getX()+i/(2*o.x),l=n.getY();else if(Math.abs(e)>1e6)r=n.getX(),a=n.getY()-i/(2*o.y),s=n.getX(),l=n.getY()+i/(2*o.y);else{const c=o.x*o.x,u=o.y*o.y,d=i/(2*Math.sqrt(c+u*e*e));r=n.getX()-d,a=e*r+t,s=n.getX()+d,l=e*s+t}return new xr(new S(r,a),new S(s,l))}class Vr{#nn;constructor(e){if(e.length>3)throw new Error("Too many points for a protractor");this.#nn=e.slice(0,3)}getPoint(e){return this.#nn[e]}getLength(){return this.#nn.length}getCentroid(){return this.#nn[1]}contains(e,t=0){for(let n=0;n<this.#nn.length-1;++n)if(Fr(e,this.#nn[n],this.#nn[n+1])<=t)return!0;return!1}quantify(e,t){let n;if(3===this.#nn.length){let e=Er(new xr(this.#nn[0],this.#nn[1]),new xr(this.#nn[1],this.#nn[2]));e>180&&(e=360-e),n={value:e,unit:"unit.degree"}}return{angle:n}}}class Nr{#nn=[];constructor(e){void 0!==e&&(this.#nn=e)}getPoint(e){return this.#nn[e]}getPoints(){return this.#nn}getLength(){return this.#nn.length}addPoint(e){this.#nn.push(e)}addPoints(e){this.#nn=this.#nn.concat(e)}getCentroid(){let e,t=0,n=0,i=0;for(let e=0;e<this.#nn.length;++e){const o=this.#nn[e];let r;r=e===this.#nn.length-1?this.#nn[0]:this.#nn[e+1];const a=o.getX()*r.getY()-r.getX()*o.getY();t+=a,n+=(o.getX()+r.getX())*a,i+=(o.getY()+r.getY())*a}if(0!==t){const o=1/(3*t);e=new S(o*n,o*i)}return e}contains(e,t=0){const n=this.#nn,i=e.getX(),o=e.getY();let r=!1;for(let a=0,s=n.length-1;a<n.length;s=a++){const l=n[a],c=n[s];if(Fr(e,c,l)<=t)return!0;l.getY()>o!=c.getY()>o&&i<l.getX()+(c.getX()-l.getX())*(o-l.getY())/(c.getY()-l.getY())&&(r=!r)}return r}}class Qr{#in;#on;constructor(e,t){this.#in=e,this.#on=t}getCenter(){return this.#in}getCentroid(){return this.#in}getRadius(){return this.#on}contains(e,t=0){return e.getDistance(this.#in)<=this.#on+t}equals(e){return null!==e&&this.getCenter().equals(e.getCenter())&&this.getRadius()===e.getRadius()}getSurface(){return Math.PI*this.getRadius()*this.getRadius()}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRound(){const e=this.getCenter().getX(),t=this.getCenter().getY(),n=this.getRadius(),i=Math.pow(n,2),o=t+n,r=[];for(let a=t-n;a<o;++a){const n=i-Math.pow(a-t,2);if(Math.abs(n)<1e-7)continue;const o=Math.sqrt(n);o<.5||r.push([[Math.round(e-o),Math.round(a)],[Math.round(e+o),Math.round(a)]])}return r}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r={value:this.getRadius()*i.x,unit:o},a=this.getWorldSurface(i);let s;null!==a&&(s="unit.mm"===o?{value:a/100,unit:"unit.cm2"}:{value:a,unit:o});const l={radius:r,surface:s};if(e.canQuantifyImage()){const i=this.getRound();if(0!==i.length){const o=e.getImageVariableRegionValues(i,t),r=e.getPixelUnit(),a=dt(o,n);void 0!==a&&(l.min={value:a.min,unit:r},l.max={value:a.max,unit:r},l.mean={value:a.mean,unit:r},l.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(l.median={value:a.median,unit:r}),void 0!==a.p25&&(l.p25={value:a.p25,unit:r}),void 0!==a.p75&&(l.p75={value:a.p75,unit:r}))}}return l}}class Br{#in;#rn;#an;constructor(e,t,n){this.#in=e,this.#rn=t,this.#an=n}getCenter(){return this.#in}getCentroid(){return this.#in}getA(){return this.#rn}getB(){return this.#an}contains(e,t=0){const n=this.#rn+t,i=this.#an+t;if(n<=0||i<=0)return!1;const o=(e.getX()-this.#in.getX())/n,r=(e.getY()-this.#in.getY())/i;return o*o+r*r<=1}equals(e){return null!==e&&this.getCenter().equals(e.getCenter())&&this.getA()===e.getA()&&this.getB()===e.getB()}getSurface(){return Math.PI*this.getA()*this.getB()}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRound(){const e=this.getCenter().getX(),t=this.getCenter().getY(),n=this.getA(),i=this.getB(),o=n/i,r=Math.pow(i,2),a=t+i,s=[];for(let n=t-i;n<a;++n){const i=r-Math.pow(n-t,2);if(Math.abs(i)<1e-7)continue;const a=o*Math.sqrt(i);a<.5||s.push([[Math.round(e-a),Math.round(n)],[Math.round(e+a),Math.round(n)]])}return s}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r=2*this.getA()*i.x,a=2*this.getB()*i.y,s={value:Math.max(r,a),unit:o},l={value:Math.min(r,a),unit:o},c=this.getWorldSurface(i);let u;null!==c&&(u="unit.mm"===o?{value:c/100,unit:"unit.cm2"}:{value:c,unit:o});const d={longAxis:s,shortAxis:l,surface:u};if(e.canQuantifyImage()){const i=this.getRound();if(0!==i.length){const o=e.getImageVariableRegionValues(i,t),r=e.getPixelUnit(),a=dt(o,n);void 0!==a&&(d.min={value:a.min,unit:r},d.max={value:a.max,unit:r},d.mean={value:a.mean,unit:r},d.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(d.median={value:a.median,unit:r}),void 0!==a.p25&&(d.p25={value:a.p25,unit:r}),void 0!==a.p75&&(d.p75={value:a.p75,unit:r}))}}return d}}function kr(e,t,n){const i=e.getValues(),o=i.slice(),r=[],s=t[0],l=t[1],c=s/l,u=Math.pow(l,2),d=n[0],h=n[1];for(let e=0;e<l;++e){const t=Math.round(c*Math.sqrt(u-Math.pow(e,2))),n=i[h]+e,s=i[h]-e;for(let e=0;e<t;++e){const t=i[d]+e,l=i[d]-e;o[d]=t,o[h]=n,r.push(new a(o.slice())),s!==n&&(o[h]=s,r.push(new a(o.slice()))),l!==t&&(o[d]=l,o[h]=n,r.push(new a(o.slice())),s!==n&&(o[h]=s,r.push(new a(o.slice()))))}}return r}class Gr{#en;#tn;constructor(e,t){this.#en=new S(Math.min(e.getX(),t.getX()),Math.min(e.getY(),t.getY())),this.#tn=new S(Math.max(e.getX(),t.getX()),Math.max(e.getY(),t.getY()))}getBegin(){return this.#en}getEnd(){return this.#tn}equals(e){return null!==e&&this.getBegin().equals(e.getBegin())&&this.getEnd().equals(e.getEnd())}getSurface(){const e=this.getBegin(),t=this.getEnd();return Math.abs(t.getX()-e.getX())*Math.abs(t.getY()-e.getY())}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRealWidth(){return this.getEnd().getX()-this.getBegin().getX()}getRealHeight(){return this.getEnd().getY()-this.getBegin().getY()}getWidth(){return Math.abs(this.getRealWidth())}getHeight(){return Math.abs(this.getRealHeight())}getRound(){return{min:new S(Math.round(this.getBegin().getX()),Math.round(this.getBegin().getY())),max:new S(Math.round(this.getEnd().getX()),Math.round(this.getEnd().getY()))}}getCentroid(){return new S(this.getBegin().getX()+this.getWidth()/2,this.getBegin().getY()+this.getHeight()/2)}contains(e,t=0){return e.getX()>=this.getBegin().getX()-t&&e.getX()<=this.getEnd().getX()+t&&e.getY()>=this.getBegin().getY()-t&&e.getY()<=this.getEnd().getY()+t}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r={value:this.getWidth()*i.x,unit:o},a={value:this.getHeight()*i.y,unit:o},s=this.getWorldSurface(i);let l;null!==s&&(l="unit.mm"===o?{value:s/100,unit:"unit.cm2"}:{value:s,unit:o});const c={width:r,height:a,surface:l};if(e.canQuantifyImage()){const i=this.getRound(),o=e.getImageRegionValues(i.min,i.max,t),r=e.getPixelUnit(),a=dt(o,n);void 0!==a&&(c.min={value:a.min,unit:r},c.max={value:a.max,unit:r},c.mean={value:a.mean,unit:r},c.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(c.median={value:a.median,unit:r}),void 0!==a.p25&&(c.p25={value:a.p25,unit:r}),void 0!==a.p75&&(c.p75={value:a.p75,unit:r}))}return c}}function zr(e,t,n){const i=e.getValues(),o=i.slice(),r=[],s=t[0],l=Math.floor(s/2),c=t[1],u=Math.floor(c/2),d=n[0],h=n[1];for(let e=0;e<c;++e){o[h]=i[h]-u+e;for(let e=0;e<s;++e)o[d]=i[d]-l+e,r.push(new a(o.slice()))}return r}class Hr{#en;#tn;shortAxisLength;shortAxisCenter;shortAxisL1;shortAxisL2;shortAxisT;constructor(e,t){this.#en=e,this.#tn=t,this.shortAxisCenter=void 0,this.shortAxisT=void 0,this.shortAxisL1=void 0,this.shortAxisL2=void 0,this.shortAxisLength=void 0,this.hasShortAxisInteraction=!1}getBegin(){return this.#en}getEnd(){return this.#tn}getCentroid(){return new S((this.#en.getX()+this.#tn.getX())/2,(this.#en.getY()+this.#tn.getY())/2)}contains(e,t=0){if(Fr(e,this.#en,this.#tn)<=t)return!0;const n=this.getLength();if(void 0===this.shortAxisCenter||0===n)return!1;const i=-this.getDeltaY()/n,o=this.getDeltaX()/n,r=this.shortAxisCenter,a=this.shortAxisL1??0,s=this.shortAxisL2??0;return Fr(e,new S(r.getX()+i*a,r.getY()+o*a),new S(r.getX()-i*s,r.getY()-o*s))<=t}getLength(){const e=this.getDeltaX(),t=this.getDeltaY();return Math.hypot(e,t)}getSlope(){const e=this.getDeltaX(),t=this.getDeltaY();return 0===e?1/0:t/e}getDeltaX(){return this.#tn.getX()-this.#en.getX()}getDeltaY(){return this.#tn.getY()-this.#en.getY()}quantify(e){const t=e.get2DSpacing?.()??{x:1,y:1},n=new xr(this.#en,this.#tn).getWorldLength(t);let i=null;if("number"==typeof this.shortAxisLength&&!Number.isNaN(this.shortAxisLength)){const e=this.getDeltaX(),n=this.getDeltaY(),o=this.getLength();if(o>0){const r="number"==typeof this.shortAxisT?this.shortAxisT:.5,a=this.#en.getX()+e*r,s=this.#en.getY()+n*r,l=new S(a,s),c=-n/o,u=e/o,d="number"==typeof this.shortAxisL1?this.shortAxisL1:this.shortAxisLength/2,h="number"==typeof this.shortAxisL2?this.shortAxisL2:this.shortAxisLength/2,g=new S(l.getX()+c*d,l.getY()+u*d),m=new S(l.getX()-c*h,l.getY()-u*h);i=new xr(g,m).getWorldLength(t),this.shortAxisCenter=l}}const o="number"==typeof i&&!Number.isNaN(i);let r;return null!==n&&(r={longAxis:{value:o?Math.max(n,i):n,unit:e.getLengthUnit()},shortAxis:{value:o?Math.min(n,i):null,unit:e.getLengthUnit()}}),r}static restorePropertiesFromQuantification(e,t,n){if("number"==typeof n.shortAxisLength&&(t.shortAxisLength=n.shortAxisLength),"number"==typeof n.shortAxisT&&(t.shortAxisT=n.shortAxisT),e.mathShape=t,"function"==typeof e.getFactory&&"function"==typeof e.getFactory().getShortAxisEndpoints){const n=e.getFactory(),[i,o]=n.getShortAxisEndpoints(e);if(i&&o){const n=t.getBegin(),r=t.getEnd(),a=(i.getX()+o.getX())/2,s=(i.getY()+o.getY())/2;e.mathShape.shortAxisCenter={x:a,y:s};const l=r.getX()-n.getX(),c=r.getY()-n.getY(),u=Math.sqrt(l*l+c*c);let d=.5;if(u>0){const e=l/u,t=c/u,i=a-n.getX(),o=s-n.getY();d=Math.max(0,Math.min(1,(i*e+o*t)/u))}e.mathShape.shortAxisT=d;const h=Math.sqrt(Math.pow(i.getX()-a,2)+Math.pow(i.getY()-s,2)),g=Math.sqrt(Math.pow(o.getX()-a,2)+Math.pow(o.getY()-s,2));e.mathShape.shortAxisL1=h,e.mathShape.shortAxisL2=g,e.mathShape.shortAxisLength=h+g}}}}const Yr="00480301",Xr="00700022",Wr="00700023",$r="0070031A",jr="POINT",Zr="MULTIPOINT",Kr="POLYLINE",_r="CIRCLE",Jr="ELLIPSE";class ea{graphicData;graphicType;pixelOriginInterpretation;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function ta(e){const t={};return void 0!==e.pixelOriginInterpretation&&(t.PixelOriginInterpretation=e.pixelOriginInterpretation),void 0!==e.graphicData&&(t.GraphicData=e.graphicData),void 0!==e.graphicType&&(t.GraphicType=e.graphicType),void 0!==e.fiducialUID&&(t.FiducialUID=e.fiducialUID),t}function na(e){const t=new ea;if(e instanceof S)t.graphicData=[e.getX().toString(),e.getY().toString()],t.graphicType=jr;else if(e instanceof xr)t.graphicData=[e.getBegin().getX().toString(),e.getBegin().getY().toString(),e.getEnd().getX().toString(),e.getEnd().getY().toString()],t.graphicType=Kr;else if(e instanceof Vr){t.graphicData=[];for(let n=0;n<3;++n)t.graphicData.push(e.getPoint(n).getX().toString()),t.graphicData.push(e.getPoint(n).getY().toString());t.graphicType=Kr}else if(e instanceof Nr){t.graphicData=[];for(let n=0;n<e.getLength();++n)t.graphicData.push(e.getPoint(n).getX().toString()),t.graphicData.push(e.getPoint(n).getY().toString());const n=e.getPoint(0);t.graphicData.push(n.getX().toString()),t.graphicData.push(n.getY().toString()),t.graphicType=Kr}else if(e instanceof Qr){const n=e.getCenter(),i=new S(n.getX()+e.getRadius(),n.getY());t.graphicData=[n.getX().toString(),n.getY().toString(),i.getX().toString(),i.getY().toString()],t.graphicType=_r}else if(e instanceof Br){const n=e.getCenter(),i=e.getA(),o=e.getB();t.graphicData=[(n.getX()-i).toString(),n.getY().toString(),(n.getX()+i).toString(),n.getY().toString(),n.getX().toString(),(n.getY()-o).toString(),n.getX().toString(),(n.getY()+o).toString()],t.graphicType=Jr}else if(e instanceof Gr){const n=e.getBegin(),i=e.getEnd();t.graphicData=[n.getX().toString(),n.getY().toString(),n.getX().toString(),i.getY().toString(),i.getX().toString(),i.getY().toString(),i.getX().toString(),n.getY().toString(),n.getX().toString(),n.getY().toString()],t.graphicType=Kr}else if(e instanceof Hr){let n=0,i=0;const o=e.getBegin(),r=e.getEnd(),a=e.shortAxisCenter instanceof S?e.shortAxisCenter:e.getCentroid(),s=r.getX()-o.getX(),l=r.getY()-o.getY(),c=Math.sqrt(s*s+l*l);0!==c&&(n=-l/c,i=s/c);const u=e.shortAxisL1??e.shortAxisLength/2,d=e.shortAxisL2??e.shortAxisLength/2,h=new S(a.getX()+n*u,a.getY()+i*u),g=new S(a.getX()-n*d,a.getY()-i*d);t.graphicData=[o.getX().toString(),o.getY().toString(),r.getX().toString(),r.getY().toString(),h.getX().toString(),h.getY().toString(),g.getX().toString(),g.getY().toString()],t.graphicType=Kr}return t}function ia(e){if(void 0===e.graphicData)return;const t=e.graphicData.length;if(0===t)throw new Error("No coordinates in scoord data");if(t%2!=0)throw new Error("Expecting even number of coordinates in scoord data");const n=[];for(let i=0;i<t;i+=2)n.push(new S(parseFloat(e.graphicData[i]),parseFloat(e.graphicData[i+1])));let i=!1;const o=n.length;if(o>2){const e=n[0],t=n[o-1];i=e.equals(t)}let r;if(e.graphicType===jr)n.length>1&&s.warn(`Expecting 1 point for point, got ${o}`),r=n[0];else if(e.graphicType===_r){if(n.length<2)throw new Error(`Expecting 2 points for circles, got ${o}`);n.length>2&&s.warn(`Expecting 2 points for circles, got ${o}`);const e=n[0],t=n[1].getDistance(e);r=new Qr(e,t)}else if(e.graphicType===Jr){if(n.length<4)throw new Error(`Expecting 4 points for ellipses, got ${o}`);n.length>4&&s.warn(`Expecting 4 points for ellipses, got ${o}`);const e=n[0].getDistance(n[1])/2,t=n[2].getDistance(n[3])/2,i=new S(n[0].getX()+e,n[0].getY());r=new Br(i,e,t)}else if(e.graphicType===Kr)if(i)if(5===n.length){const e=new xr(n[0],n[1]),t=new xr(n[1],n[2]),i=new xr(n[2],n[3]),o=new xr(n[3],n[4]);r=Rr(e,t)&&Rr(t,i)&&Rr(i,o)?new Gr(n[0],n[2]):new Nr(n.slice(0,-1))}else r=new Nr(n.slice(0,-1));else if(2===n.length)r=new xr(n[0],n[1]);else if(3===n.length)r=new Vr([n[0],n[1],n[2]]);else if(4===n.length){const e=n[0],t=n[1],i=n[2],o=n[3];let a=.5;r=new Hr(e,t);const s=(i.getX()+o.getX())/2,l=(i.getY()+o.getY())/2,c=i.getX()-s,u=i.getY()-l,d=s-o.getX(),h=l-o.getY(),g=Math.sqrt(c*c+u*u),m=Math.sqrt(d*d+h*h),p=g+m,f=t.getX()-e.getX(),v=t.getY()-e.getY(),C=Math.sqrt(f*f+v*v);let y=.5;if(C>0){const t=s-e.getX(),n=l-e.getY(),i=C*C;0!==i&&(a=(t*f+n*v)/i),y=Math.max(0,Math.min(1,a))}r.shortAxisLength=p,r.shortAxisT=y,r.shortAxisL1=g,r.shortAxisL2=m,r.shortAxisCenter=new S(s,l),r.hasShortAxisInteraction=!0}return r}const oa="00700022",ra="00700023",aa="30060024",sa="0070031A";class la{graphicData;graphicType;referencedFrameofReferenceUID;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function ca(e){const t={};return void 0!==e.graphicData&&(t.GraphicData=e.graphicData),void 0!==e.graphicType&&(t.GraphicType=e.graphicType),void 0!==e.referencedFrameofReferenceUID&&(t.ReferencedFrameofReferenceUID=e.referencedFrameofReferenceUID),void 0!==e.fiducialUID&&(t.FiducialUID=e.fiducialUID),t}const ua={ReferencedSOPSequence:"00081199",RelationshipType:"0040A010",ValueType:"0040A040",ConceptNameCodeSequence:"0040A043",ConceptCodeSequence:"0040A168",ContentSequence:"0040A730",DateTime:"0040A120",Date:"0040A121",Time:"0040A122",UID:"0040A124",PersonName:"0040A123",TextValue:"0040A160",ContinuityOfContent:"0040A050",ContentTemplateSequence:"0040A504",MappingResource:"00080105",TemplateIdentifier:"0040DB00"},da="CONTAINS",ha="HAS PROPERTIES",ga="HAS OBS CONTEXT",Sa="INFERRED FROM",ma="SELECTED FROM",pa="HAS CONCEPT MOD",fa="TEXT",va="NUM",Ca="CODE",ya="UIDREF",Da="COMPOSITE",Ia="IMAGE",wa="SCOORD",Ta="SCOORD3D",La="CONTAINER",Pa="SEPARATE",Aa={TEXT:"TextValue",DATE:"Date",TIME:"Time",DATETIME:"DateTime",UIDREF:"UID",PNAME:"PersonName",CONTAINER:"ContinuityOfContent"};function Oa(e){let t;const n=ce(e,ua.ContentTemplateSequence);if(void 0!==n){const e=ce(n,ua.MappingResource),i=ce(n,ua.TemplateIdentifier);void 0!==e&&void 0!==i&&(t=`${e}-${i}`)}return t}class ba{valueType;conceptNameCode;relationshipType;contentSequence=[];value;constructor(e){this.valueType=e}toString(e){void 0===e&&(e="");let t="";void 0!==this.relationshipType&&(t+=`(${this.relationshipType}) `),t+=`${this.valueType}: `,void 0!==this.conceptNameCode&&(t+=this.conceptNameCode.toString()),t+=` = ${this.value.toString()}`;for(const n of this.contentSequence)t+=`\n${e}- ${n.toString(`${e}`)} `;return t}hasHeader(e,t,n){return this.valueType===e&&Ln(this.conceptNameCode,t)&&this.relationshipType===n}}function xa(e){let t=ce(e,ua.ValueType);void 0===t&&(t="");const n=new ba(t);n.relationshipType=ce(e,ua.RelationshipType);const i=ce(e,ua.ConceptNameCodeSequence);if(void 0!==i&&(n.conceptNameCode=Pn(i)),t===Ca)n.value=Pn(ce(e,ua.ConceptCodeSequence));else if(t===va)n.value=function(e){const t=new vr;return void 0!==e[pr]&&(t.measuredValue=function(e){const t=new Sr;return void 0!==e[cr]&&(t.numericValue=parseFloat(e[cr].value[0])),void 0!==e[ur]&&(t.floatingPointValue=parseFloat(e[ur].value[0])),void 0!==e[dr]&&(t.rationalNumeratorValue=parseInt(e[dr].value[0],10)),void 0!==e[hr]&&(t.rationalDenominatorValue=parseInt(e[hr].value[0],10)),void 0!==e[gr]&&(t.measurementUnitsCode=Pn(e[gr].value[0])),t}(e[pr].value[0])),void 0!==e[fr]&&(t.numericValueQualifierCode=Pn(e[fr].value[0])),t}(e);else if(t===Ia)n.value=function(e){const t=new Or;return void 0!==e[Lr]&&(t.referencedFrameNumber=e[Lr].value[0]),void 0!==e[Pr]&&(t.referencedSOPSequence=wr(e[Pr].value[0])),void 0!==e[Ar]&&(t.referencedSegmentNumber=e[Ar].value[0]),t}(e);else if(t===Da)n.value=wr(ce(e,ua.ReferencedSOPSequence));else if(t===wa)n.value=function(e){const t=new ea;return void 0!==e[Xr]&&(t.graphicData=e[Xr].value),void 0!==e[Wr]&&(t.graphicType=e[Wr].value[0]),void 0!==e[Yr]&&(t.pixelOriginInterpretation=e[Yr].value[0]),void 0!==e[$r]&&(t.fiducialUID=e[$r].value[0]),t}(e);else if(t===Ta)n.value=function(e){const t=new la;return void 0!==e[oa]&&(t.graphicData=e[oa].value),void 0!==e[ra]&&(t.graphicType=e[ra].value[0]),void 0!==e[aa]&&(t.referencedFrameofReferenceUID=e[aa].value[0]),void 0!==e[sa]&&(t.fiducialUID=e[sa].value[0]),t}(e);else{const i=Aa[t];void 0!==i?n.value=ce(e,ua[i]):console.warn(`Unsupported input ValueType: ${t}`)}const o=ue(e,ua.ContentSequence);if(void 0!==o)for(const e of o)n.contentSequence.push(xa(e));return n}function Ea(e){let t={};if(void 0!==e.relationshipType&&(t.RelationshipType=e.relationshipType),void 0!==e.valueType&&(t.ValueType=e.valueType),void 0!==e.conceptNameCode&&(t.ConceptNameCodeSequence={value:[An(e.conceptNameCode)]}),"CODE"===e.valueType)t.ConceptCodeSequence={value:[An(e.value)]};else if(e.valueType===va)t={...t,...Cr(e.value)};else if(e.valueType===Ia)t={...t,...br(e.value)};else if(e.valueType===Da)t={...t,...Tr(e.value)};else if(e.valueType===wa)t={...t,...ta(e.value)};else if(e.valueType===Ta)t={...t,...ca(e.value)};else{const n=Aa[e.valueType];void 0!==n?t[n]=e.value:console.warn(`Unsupported output ValueType: ${e.valueType}`)}if(0!==e.contentSequence.length){t.ContentSequence={value:[]};for(const n of e.contentSequence)t.ContentSequence.value.push(Ea(n))}return t}function Ra(e,t,n,i){const o=function(e){const t=oi[e];let n;return void 0!==t&&(n="DCM"===t.scheme?ei({meaning:e,value:t.key}):ti(t.key,t.scheme)),n}(e);if(void 0===o)return;let r=da;void 0!==i&&(r=i);const a=new ba(va);a.relationshipType=r,a.conceptNameCode=o;const s=new Sr;s.numericValue=t,s.measurementUnitsCode=ai(n);const l=new vr;return l.measuredValue=s,a.value=l,a}class Fa{#sn;#n;#i;constructor(e,t,n){this.#sn=e,this.#n=t,this.#i=n}static idFromIndex(e){return`anchor${e}`}static indexFromId(e){return parseInt(e.replace("anchor",""),10)}static fromIndex(e,t,n){return new Fa(Fa.idFromIndex(e),t,n)}getId(){return this.#sn}getX(){return this.#n}getY(){return this.#i}setX(e){this.#n=e}setY(e){this.#i=e}}const Ma={arrow:{"*":""},circle:{"*":"{surface}"},ellipse:{"*":"{surface}"},protractor:{"*":"{angle}"},rectangle:{"*":"{surface}"},roi:{"*":""},ruler:{"*":"{length}"},bidimensional:{"*":"{longAxis} x {shortAxis}"},bidimensionalDrawing:{"*":"{longAxis}"}};function qa(e){return"label"===e.name()}function Ua(e){return"shape"===e.name()}function Va(e){return"position-group"===e.name()}function Na(t,n){const i=t.getChildren(function(e){return e.id()===`anchor${n}`})[0];if(i instanceof e.Ellipse)return i}function Qa(e){return function(t){return t.id()===e}}function Ba(t,n,i,o){const r=o.applyZoomScale(6),a={x:Math.abs(r.x),y:Math.abs(r.y)};return new e.Ellipse({x:t,y:n,stroke:"#999",fill:"rgba(100,100,100,0.7",strokeWidth:o.getStrokeWidth(),strokeScaleEnabled:!1,radius:a,radiusX:a.x,radiusY:a.y,name:"anchor",id:i.toString(),dragOnTop:!1,draggable:!0,visible:!1})}function ka(e){return void 0!==Ne.labelTexts&&void 0!==Ne.labelTexts[e]?Ne.labelTexts[e]:Ma[e]}class Ga{#u="rectangle";#ln;static supports(e){return e instanceof Gr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new Gr(t[0],t[1]),e.setTextExpr(ka(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=Fa.indexFromId(t.getId()),i=(n+1)%4,o=(n+2)%4,r=(n+3)%4;void 0===this.#ln&&(this.#ln=this.getAnchors(e));const a=this.#ln[o];this.#ln[n]=t,n%2==0?(this.#ln[r].setX(t.getX()),this.#ln[i].setY(t.getY())):(this.#ln[r].setY(t.getY()),this.#ln[i].setX(t.getX())),e.mathShape=new Gr(new S(a.getX(),a.getY()),new S(t.getX(),t.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new Gr(new S(i.getX()+t.x,i.getY()+t.y),new S(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){this.#ln=void 0}getAnchors(e){if(void 0!==this.#ln)return this.#ln;const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[Fa.fromIndex(0,n,i),Fa.fromIndex(1,n+o,i),Fa.fromIndex(2,n+o,i+r),Fa.fromIndex(3,n,i+r)]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[new S(n+o/2,i),new S(n,i+r/2),new S(n+o/2,i+r),new S(n+o,i+r/2)]}getDefaultLabelPosition(e){const t=e.mathShape;return new S(t.getBegin().getX(),t.getEnd().getY())}}class za{#u="circle";static supports(e){return e instanceof Qr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){const n=Math.abs(t[0].getX()-t[1].getX()),i=Math.abs(t[0].getY()-t[1].getY());e.mathShape=new Qr(t[0],Math.round(Math.sqrt(n*n+i*i))),e.setTextExpr(ka(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=new S(n.getCenter().getX(),n.getCenter().getY()),o=new S(t.getX(),t.getY());e.mathShape=new Qr(i,i.getDistance(o)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new Qr(new S(i.getX()+t.x,i.getY()+t.y),n.getRadius()),e.updateQuantification()}constrainAnchorMove(e,t){const n=this.getAnchors(t);switch(e.getId()){case"anchor0":e.setY(n[1].getY());break;case"anchor1":e.setY(n[0].getY());break;case"anchor2":e.setX(n[3].getX());break;case"anchor3":e.setX(n[2].getX());break;default:s.error(`Unhandled anchor id: ${e.getId()}`)}}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getRadius();return[Fa.fromIndex(0,n-o,i),Fa.fromIndex(1,n+o,i),Fa.fromIndex(2,n,i+o),Fa.fromIndex(3,n,i-o)]}getConnectorPositions(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getRadius()*Math.sqrt(2)/2;return[new S(n-o,i-o),new S(n+o,i-o),new S(n-o,i+o),new S(n+o,i+o)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter(),i=t.getRadius();return new S(n.getX()-i,n.getY()+i)}}class Ha{#u="ellipse";static supports(e){return e instanceof Br}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){const n=Math.abs(t[0].getX()-t[1].getX()),i=Math.abs(t[0].getY()-t[1].getY());e.mathShape=new Br(t[0],n,i),e.setTextExpr(ka(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=n.getCenter();let o=n.getA(),r=n.getB();switch(t.getId()){case"anchor0":o=i.getX()-t.getX();break;case"anchor1":o=t.getX()-i.getX();break;case"anchor2":r=t.getY()-i.getY();break;case"anchor3":r=i.getY()-t.getY();break;default:s.error(`Unhandled anchor id: ${t.getId()}`)}e.mathShape=new Br(i,Math.abs(o),Math.abs(r)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new Br(new S(i.getX()+t.x,i.getY()+t.y),n.getA(),n.getB()),e.updateQuantification()}constrainAnchorMove(e,t){const n=this.getAnchors(t);switch(e.getId()){case"anchor0":e.setY(n[1].getY());break;case"anchor1":e.setY(n[0].getY());break;case"anchor2":e.setX(n[3].getX());break;case"anchor3":e.setX(n[2].getX());break;default:s.error(`Unhandled anchor id: ${e.getId()}`)}}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getA(),r=t.getB();return[Fa.fromIndex(0,n-o,i),Fa.fromIndex(1,n+o,i),Fa.fromIndex(2,n,i+r),Fa.fromIndex(3,n,i-r)]}getConnectorPositions(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getA()*Math.sqrt(2)/2,r=t.getB()*Math.sqrt(2)/2;return[new S(n-o,i-r),new S(n+o,i-r),new S(n-o,i+r),new S(n+o,i+r)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter();return new S(n.getX()-t.getA(),n.getY()+t.getB())}}class Ya{#u="ruler";static supports(e){return e instanceof xr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new xr(t[0],t[1]),e.setTextExpr(ka(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[Fa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new xr(new S(i.getX(),i.getY()),new S(o.getX(),o.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new xr(new S(i.getX()+t.x,i.getY()+t.y),new S(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[Fa.fromIndex(0,n.getX(),n.getY()),Fa.fromIndex(1,i.getX(),i.getY())]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[new S((n.getX()+i.getX())/2,(n.getY()+i.getY())/2)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return n.getY()>=i.getY()?n:i}}class Xa{#u="arrow";static supports(e){return e instanceof S}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=t[0],e.referencePoints=[t[1]],e.setTextExpr(ka(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[Fa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new S(i.getX(),i.getY()),e.referencePoints=[new S(o.getX(),o.getY())],e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=e.referencePoints[0];e.mathShape=new S(n.getX()+t.x,n.getY()+t.y),e.referencePoints=[new S(i.getX()+t.x,i.getY()+t.y)],e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=e.referencePoints[0];return[Fa.fromIndex(0,t.getX(),t.getY()),Fa.fromIndex(1,n.getX(),n.getY())]}getConnectorPositions(e){const t=e.mathShape,n=e.referencePoints[0];return[new S((t.getX()+n.getX())/2,(t.getY()+n.getY())/2)]}getDefaultLabelPosition(e){return e.mathShape}}class Wa{#u="roi";static supports(e){return e instanceof Nr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new Nr(t),e.setTextExpr(ka(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape.getPoints().slice();n[Fa.indexFromId(t.getId())]=new S(t.getX(),t.getY()),e.mathShape=new Nr(n),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<n.getLength();++e)i.push(new S(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new Nr(i),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=[];for(let e=0;e<t.getLength();++e){const i=t.getPoint(e);n.push(Fa.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){const t=e.mathShape,n=t.getLength(),i=[];for(let e=0;e<n;++e){const o=t.getPoint(e),r=t.getPoint((e+1)%n);i.push(new S((o.getX()+r.getX())/2,(o.getY()+r.getY())/2))}return i}getDefaultLabelPosition(e){return e.mathShape.getPoint(0)}}class $a{#u="protractor";static supports(e){return e instanceof Vr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 3}isComplete(e){return e.mathShape.getLength()===this.getNPoints()}setAnnotationMathShape(e,t){e.mathShape=new Vr(t),e.setTextExpr(ka(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[Fa.indexFromId(t.getId())]=t;const i=n[0],o=n[1],r=n[2];e.mathShape=new Vr([new S(i.getX(),i.getY()),new S(o.getX(),o.getY()),new S(r.getX(),r.getY())]),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<3;++e)i.push(new S(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new Vr(i),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=[];for(let e=0;e<t.getLength();++e){const i=t.getPoint(e);n.push(Fa.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){return[e.mathShape.getPoint(1)]}getDefaultLabelPosition(e){const t=e.mathShape,n=new xr(t.getPoint(0),t.getPoint(1)),i=new xr(t.getPoint(1),t.getPoint(2));return new S((n.getCentroid().getX()+i.getCentroid().getX())/2,(n.getCentroid().getY()+i.getCentroid().getY())/2)}}function ja(e,t,n,i=20){const o=Mr(t,t.getBegin(),i,n),r=Mr(t,t.getEnd(),i,n);e.hitFunc(function(t){t.beginPath(),t.moveTo(o.getBegin().getX(),o.getBegin().getY()),t.lineTo(o.getEnd().getX(),o.getEnd().getY()),t.lineTo(r.getEnd().getX(),r.getEnd().getY()),t.lineTo(r.getBegin().getX(),r.getBegin().getY()),t.closePath(),t.fillStrokeShape(e)})}class Za{createShape(e,t){throw new Error("KonvaShapePainter.createShape not implemented")}updateShape(e,t,n){throw new Error("KonvaShapePainter.updateShape not implemented")}createExtras(e,t){return[]}updateExtras(e,t,n){}}function Ka(e){const t=new xr(e.getPoint(0),e.getPoint(1)),n=new xr(e.getPoint(1),e.getPoint(2));let i=Er(t,n),o=t.getInclination();return i>180&&(i=360-i,o+=i),{radius:33*Math.min(t.getLength(),n.getLength())/100,angle:i,inclination:o}}function _a(t,n,i){const{radius:o,angle:r,inclination:a}=Ka(t),s=t.getPoint(1);return new e.Arc({innerRadius:o,outerRadius:o,stroke:n,strokeWidth:i.getStrokeWidth(),strokeScaleEnabled:!1,angle:r,rotation:-a,x:s.getX(),y:s.getY(),name:"shape-arc"})}function Ja(e,t){e.hitFunc(function(n){n.beginPath(),n.moveTo(t.getPoint(0).getX(),t.getPoint(0).getY()),n.lineTo(t.getPoint(1).getX(),t.getPoint(1).getY()),n.lineTo(t.getPoint(2).getX(),t.getPoint(2).getY()),n.closePath(),n.fillStrokeShape(e)})}const es={rectangle:new class extends Za{createShape(t,n){const i=t.mathShape;return new e.Rect({x:i.getBegin().getX(),y:i.getBegin().getY(),width:i.getWidth(),height:i.getHeight(),stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"})}updateShape(e,t){const n=t.mathShape;e.position({x:n.getBegin().getX(),y:n.getBegin().getY()}),e.size({width:n.getWidth(),height:n.getHeight()})}},circle:new class extends Za{createShape(t,n){const i=t.mathShape;return new e.Circle({x:i.getCenter().getX(),y:i.getCenter().getY(),radius:i.getRadius(),stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"})}updateShape(e,t){e.radius(t.mathShape.getRadius())}},ellipse:new class extends Za{createShape(t,n){const i=t.mathShape,o=i.getCenter(),r={x:i.getA(),y:i.getB()};return new e.Ellipse({x:o.getX(),y:o.getY(),radius:r,radiusX:r.x,radiusY:r.y,stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"})}updateShape(e,t){const n=t.mathShape;e.radius({x:n.getA(),y:n.getB()})}},ruler:new class extends Za{createShape(t,n){const i=t.mathShape,o=new e.Line({points:[i.getBegin().getX(),i.getBegin().getY(),i.getEnd().getX(),i.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"});return ja(o,i,n.getZoomScale()),o}updateShape(e,t,n){const i=t.mathShape;e.position({x:0,y:0}),e.points([i.getBegin().getX(),i.getBegin().getY(),i.getEnd().getX(),i.getEnd().getY()]),ja(e,i,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=n.getZoomScale(),r=Mr(i,i.getBegin(),20,o),a=Mr(i,i.getEnd(),20,o);return[new e.Line({points:[r.getBegin().getX(),r.getBegin().getY(),r.getEnd().getX(),r.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick0"}),new e.Line({points:[a.getBegin().getX(),a.getBegin().getY(),a.getEnd().getX(),a.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick1"})]}updateExtras(t,n,i){const o=n.mathShape,r=i.getZoomScale(),a=Mr(o,o.getBegin(),20,r),s=Mr(o,o.getEnd(),20,r),l=t.getChildren(e=>"shape-tick0"===e.name())[0],c=t.getChildren(e=>"shape-tick1"===e.name())[0];l instanceof e.Line&&(l.position({x:0,y:0}),l.points([a.getBegin().getX(),a.getBegin().getY(),a.getEnd().getX(),a.getEnd().getY()])),c instanceof e.Line&&(c.position({x:0,y:0}),c.points([s.getBegin().getX(),s.getBegin().getY(),s.getEnd().getX(),s.getEnd().getY()]))}},arrow:new class extends Za{createShape(t,n){const i=t.mathShape,o=t.referencePoints[0],r=new xr(i,o),a=new e.Line({points:[i.getX(),i.getY(),o.getX(),o.getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"});return ja(a,r,n.getZoomScale()),a}updateShape(e,t,n){const i=t.mathShape,o=t.referencePoints[0],r=new xr(i,o);e.position({x:0,y:0}),e.points([i.getX(),i.getY(),o.getX(),o.getY()]),ja(e,r,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=t.referencePoints[0],r=qr(new xr(i,o),40,20,n.getZoomScale());return[new e.Line({points:[i.getX(),i.getY(),r.getBegin().getX(),r.getBegin().getY(),r.getEnd().getX(),r.getEnd().getY()],fill:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,closed:!0,name:"shape-triangle"})]}updateExtras(t,n,i){const o=n.mathShape,r=n.referencePoints[0],a=qr(new xr(o,r),40,20,i.getZoomScale()),s=t.getChildren(e=>"shape-triangle"===e.name())[0];s instanceof e.Line&&(s.position({x:0,y:0}),s.points([o.getX(),o.getY(),a.getBegin().getX(),a.getBegin().getY(),a.getEnd().getX(),a.getEnd().getY()]))}},roi:new class extends Za{createShape(t,n){const i=t.mathShape,o=[];for(let e=0;e<i.getLength();++e)o.push(i.getPoint(e).getX(),i.getPoint(e).getY());return new e.Line({points:o,stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,closed:!0,name:"shape"})}updateShape(e,t){const n=t.mathShape,i=[];e.position({x:0,y:0});for(let e=0;e<n.getLength();++e)i.push(n.getPoint(e).getX(),n.getPoint(e).getY());e.points(i)}},protractor:new class extends Za{createShape(t,n){const i=t.mathShape,o=[];for(let e=0;e<i.getLength();++e)o.push(i.getPoint(e).getX(),i.getPoint(e).getY());const r=new e.Line({points:o,stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape"});return 3===i.getLength()&&Ja(r,i),r}updateShape(e,t){const n=t.mathShape;e.position({x:0,y:0}),e.points([n.getPoint(0).getX(),n.getPoint(0).getY(),n.getPoint(1).getX(),n.getPoint(1).getY(),n.getPoint(2).getX(),n.getPoint(2).getY()]),Ja(e,n)}createExtras(e,t){const n=e.mathShape;return 3!==n.getLength()?[]:[_a(n,e.colour,t)]}updateExtras(t,n,i){const o=n.mathShape;if(3!==o.getLength())return;const r=t.getChildren(e=>"shape-arc"===e.name())[0];if(!(r instanceof e.Arc))return;const{radius:a,angle:s,inclination:l}=Ka(o),c=o.getPoint(1);r.innerRadius(a),r.outerRadius(a),r.angle(s),r.rotation(-l),r.position({x:c.getX(),y:c.getY()})}}};function ts(e){const t=es[e];return t||s.error(`shapePainters: no painter for shape '${e}'`),t}class ns{#cn;constructor(e){this.#cn=e}getPosition(e){let t=e.labelPosition;return void 0===t&&(t=this.#cn(e)),t}create(t,n){const i=new e.Text({fontSize:n.getFontSize(),fontFamily:n.getFontFamily(),fill:t.colour,padding:n.getTextPadding(),shadowColor:n.getShadowLineColour(),shadowOffset:n.getShadowOffset(),name:"text"}),o=t.getText();i.setText(o);const r=n.applyZoomScale(1),a={x:2*r.x,y:2*r.y},s=this.getPosition(t),l=new e.Label({x:s.getX(),y:s.getY(),scale:a,visible:0!==o.length,name:"label"});return l.add(i),l.add(new e.Tag({fill:t.colour,opacity:n.getTagOpacity()})),l}updatePosition(t,n){const i=n.getChildren(function(e){return"label"===e.name()})[0];if(!(i instanceof e.Label))return;const o=this.getPosition(t);i.position({x:o.getX(),y:o.getY()})}getLabelAnchorsPosition(e){const t=e.x(),n=e.y(),i=e.width()*e.scale().x,o=e.height()*e.scale().y;return[new S(t+i/2,n),new S(t,n+o/2),new S(t+i/2,n+o),new S(t+i,n+o/2)]}getClosestPoints(e,t){let n=e[0].getDistance(t[0]),i=e[0],o=t[0];for(const r of e)for(const e of t){const t=r.getDistance(e);t<n&&(n=t,i=r,o=e)}return[i,o]}getConnector(t,n,i){const o=this.getLabelAnchorsPosition(n),r=this.getClosestPoints(t,o);return new e.Line({points:[r[0].getX(),r[0].getY(),r[1].getX(),r[1].getY()],stroke:n.getText().fill(),strokeWidth:i.getStrokeWidth(),strokeScaleEnabled:!1,visible:n.visible(),dash:[10,7],name:"connector"})}updateConnector(t,n){const i=t.getChildren(function(e){return"label"===e.name()})[0];if(!(i instanceof e.Label))return;const o=this.getLabelAnchorsPosition(i),r=this.getClosestPoints(n,o),a=t.getChildren(function(e){return"connector"===e.name()})[0];a instanceof e.Line&&a.points([r[0].getX(),r[0].getY(),r[1].getX(),r[1].getY()])}updateContent(t,n){const i=n.getChildren(function(e){return"label"===e.name()})[0];if(!(i instanceof e.Label))return;const o=t.getText();i.getText().setText(o),i.visible()&&i.visible(0!==o.length)}}class is{#un;#dn;constructor(e){this.#un=e,this.#dn=new ns(t=>e.getDefaultLabelPosition(t))}createShapeGroup(t,n){const i=ts(this.#un.getName()),o=new e.Group;if(o.name(this.#un.getGroupName()),o.visible(!0),o.id(t.trackingUid),o.add(i.createShape(t,n)),this.#un.isComplete(t)){for(const e of i.createExtras(t,n))o.add(e);const e=this.#dn.create(t,n);o.add(e);const r=this.#un.getConnectorPositions(t);o.add(this.#dn.getConnector(r,e,n))}return o}getAnchors(e,t){return e?this.#un.getAnchors(e).map(e=>Ba(e.getX(),e.getY(),e.getId(),t)):[]}constrainAnchorMove(e,t){const n=new Fa(e.id(),e.x(),e.y());this.#un.constrainAnchorMove(n,t),e.x(n.getX()),e.y(n.getY())}onAnchorMoveEnd(t,n){this.#un.onAnchorMoveEnd();const i=t.getParent();if(!(i instanceof e.Group))return;const o=this.#un.getAnchors(n);for(const e of o){const t=i.getChildren(t=>t.id()===e.getId())[0];t&&(t.x(e.getX()),t.y(e.getY()))}}updateAnnotationOnAnchorMove(e,t){const n=new Fa(t.id(),t.x(),t.y());this.#un.updateAnnotationOnAnchorMove(e,n)}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();if(!(o instanceof e.Group))return;const r=ts(this.#un.getName()),a=o.getChildren(Ua)[0];r.updateShape(a,t,i),r.updateExtras(o,t,i);const s=this.#un.getAnchors(t);for(const e of s){const t=o.getChildren(t=>t.id()===e.getId())[0];t&&(t.x(e.getX()),t.y(e.getY()))}this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#dn.updatePosition(t,o),this.updateConnector(t,o)}updateLabelContent(e,t,n){this.#dn.updateContent(e,t)}updateConnector(e,t){const n=this.#un.getConnectorPositions(e);this.#dn.updateConnector(t,n)}}class os{#hn=0;#gn=0;getMin(){return this.#hn}setMin(e){this.#hn=e}getMax(){return this.#gn}setMax(e){this.#gn=e}getName(){return"Threshold"}#Sn=null;setOriginalImage(e){this.#Sn=e}getOriginalImage(){return this.#Sn}update(){const e=this.getOriginalImage(),t=e.getDataRange().min;return e.transform(e=>e<this.getMin()||e>this.getMax()?t:e)}}class rs{getName(){return"Sharpen"}#Sn=null;setOriginalImage(e){this.#Sn=e}getOriginalImage(){return this.#Sn}update(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])}}class as{getName(){return"Sobel"}#Sn=null;setOriginalImage(e){this.#Sn=e}getOriginalImage(){return this.#Sn}update(){const e=this.getOriginalImage(),t=e.convolute2D([1,0,-1,2,0,-2,1,0,-1]),n=e.convolute2D([1,2,1,0,0,0,-1,-2,-1]);return t.compose(n,function(e,t){return Math.sqrt(e*e+t*t)})}}class ss{getName(){return""}execute(){}undo(){}}class ls extends EventTarget{#mn=[];#pn=0;getStackSize(){return this.#mn.length}getCurrentStackIndex(){return this.#pn}getCurrentCommand(){return this.#mn[this.#pn-1]}add(e){this.#mn=this.#mn.slice(0,this.#pn),this.#mn.push(e),++this.#pn,this.dispatchEvent(new Event("undoadd"))}remove(e){let t=!1;const n=this.#mn.findIndex(function(t){return t.getName()===e});return-1!==n&&(t=!0,this.dispatchEvent(new CustomEvent("undoremove",{detail:{commandName:e}})),this.#mn.splice(n,1),--this.#pn),t}undo(){this.#pn>0&&(this.dispatchEvent(new Event("undo")),--this.#pn,this.#mn[this.#pn].undo())}redo(){this.#pn<this.#mn.length&&(this.#mn[this.#pn].execute(),++this.#pn,this.dispatchEvent(new Event("redo")))}}class cs extends ss{#fn;#vn;#Cn;constructor(e,t,n){super(),this.#fn=e,this.#vn=t,this.#Cn=n}getName(){return`Filter-${this.#fn.getName()}`}execute(){this.#Cn.getDataController().setImage(this.#vn,this.#fn.update()),this.#Cn.getStageController().render(this.#vn);const e={type:"filterrun",id:this.getName(),dataId:this.#vn};this.onExecute(e)}undo(){this.#Cn.getDataController().setImage(this.#vn,this.#fn.getOriginalImage()),this.#Cn.getStageController().render(this.#vn);const e={type:"filterundo",id:this.getName(),dataid:this.#vn};this.onUndo(e)}onExecute(e){}onUndo(e){}}class us extends EventTarget{#Cn;constructor(e){super(),this.#Cn=e}#yn;#Dn=0;#In=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))};activate(e){for(const t in this.#yn)e?(this.#yn[t].addEventListener("filterrun",this.#In),this.#yn[t].addEventListener("filterundo",this.#In)):(this.#yn[t].removeEventListener("filterrun",this.#In),this.#yn[t].removeEventListener("filterundo",this.#In))}setOptions(e){this.#yn={};for(const t in e)this.#yn[t]=new e[t](this.#Cn)}getOptionsType(){return"instance"}init(){for(const e in this.#yn)this.#yn[e].init()}keydown=e=>{e.context="Filter",this.#Cn.onKeydown(e)};getEventNames(){return["filterrun","filterundo"]}getSelectedFilter(){return this.#Dn}setFeatures(e){if(void 0!==e.filterName){if(!this.hasFilter(e.filterName))throw new Error(`Unknown filter: '${e.filterName}'`);this.#Dn&&this.#Dn.activate(!1),this.#Dn=this.#yn[e.filterName],this.#Dn.activate(!0)}if(void 0!==e.run&&e.run){let t={};void 0!==e.runArgs&&(t=e.runArgs),this.getSelectedFilter().run(t)}}getFilterList(){return this.#yn}hasFilter(e){return void 0!==this.#yn?.[e]}}class ds extends EventTarget{#Cn;constructor(e){super(),this.#Cn=e}#fn=new os;#wn=!0;activate(e){e&&(this.#wn=!0)}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run threshod filter on.");if(this.#fn.setMin(e.min),this.#fn.setMax(e.max),this.#wn){const t=this.#Cn.getDataController().get(e.dataId).image;this.#fn.setOriginalImage(t),this.#wn=!1}const t=new cs(this.#fn,e.dataId,this.#Cn);t.onExecute=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))},t.onUndo=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))},t.execute(),this.#Cn.getUndoController().addToUndoStack(t)}}class hs extends EventTarget{#Cn;constructor(e){super(),this.#Cn=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sharpen filter on.");const t=new rs,n=this.#Cn.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new cs(t,e.dataId,this.#Cn);i.onExecute=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))},i.onUndo=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))},i.execute(),this.#Cn.getUndoController().addToUndoStack(i)}}class gs extends EventTarget{#Cn;constructor(e){super(),this.#Cn=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sobel filter on.");const t=new as,n=this.#Cn.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new cs(t,e.dataId,this.#Cn);i.onExecute=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))},i.onUndo=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))},i.execute(),this.#Cn.getUndoController().addToUndoStack(i)}}const Ss={},ms={draw:{ArrowFactory:class{#un=new Xa;#Tn=new is(this.#un);static supports(e){return Xa.supports(e)}getName(){return this.#un.getName()}getGroupName(){return this.#un.getGroupName()}getNPoints(){return this.#un.getNPoints()}setAnnotationMathShape(e,t){this.#un.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Tn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Tn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Tn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Tn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Tn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Tn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#un.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Tn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Tn.updateConnector(e,t)}},CircleFactory:class{#un=new za;#Tn=new is(this.#un);static supports(e){return za.supports(e)}getName(){return this.#un.getName()}getGroupName(){return this.#un.getGroupName()}getNPoints(){return this.#un.getNPoints()}setAnnotationMathShape(e,t){this.#un.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Tn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Tn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Tn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Tn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Tn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Tn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#un.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Tn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Tn.updateConnector(e,t)}},EllipseFactory:class{#un=new Ha;#Tn=new is(this.#un);static supports(e){return Ha.supports(e)}getName(){return this.#un.getName()}getGroupName(){return this.#un.getGroupName()}getNPoints(){return this.#un.getNPoints()}setAnnotationMathShape(e,t){this.#un.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Tn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Tn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Tn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Tn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Tn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Tn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#un.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Tn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Tn.updateConnector(e,t)}},ProtractorFactory:class{#un=new $a;#Tn=new is(this.#un);static supports(e){return $a.supports(e)}getName(){return this.#un.getName()}getGroupName(){return this.#un.getGroupName()}getNPoints(){return this.#un.getNPoints()}setAnnotationMathShape(e,t){this.#un.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Tn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Tn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Tn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Tn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Tn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Tn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#un.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Tn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Tn.updateConnector(e,t)}},RectangleFactory:class{#un=new Ga;#Tn=new is(this.#un);static supports(e){return Ga.supports(e)}getName(){return this.#un.getName()}getGroupName(){return this.#un.getGroupName()}getNPoints(){return this.#un.getNPoints()}setAnnotationMathShape(e,t){this.#un.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Tn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Tn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Tn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Tn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Tn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Tn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#un.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Tn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Tn.updateConnector(e,t)}},RoiFactory:class{#un=new Wa;#Tn=new is(this.#un);static supports(e){return Wa.supports(e)}getName(){return this.#un.getName()}getGroupName(){return this.#un.getGroupName()}getNPoints(){return this.#un.getNPoints()}setAnnotationMathShape(e,t){this.#un.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Tn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Tn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Tn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Tn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Tn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Tn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#un.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Tn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Tn.updateConnector(e,t)}},RulerFactory:class{#un=new Ya;#Tn=new is(this.#un);static supports(e){return Ya.supports(e)}getName(){return this.#un.getName()}getGroupName(){return this.#un.getGroupName()}getNPoints(){return this.#un.getNPoints()}setAnnotationMathShape(e,t){this.#un.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Tn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Tn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Tn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Tn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Tn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Tn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#un.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Tn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Tn.updateConnector(e,t)}},BidimensionalFactory:class{#u="bidimensional";#dn=new ns(this.#Ln);static supports(e){return e instanceof Hr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}#Pn(e){return void 0!==Ne.labelTexts&&void 0!==Ne.labelTexts[this.#u]?Ne.labelTexts[this.#u]:!0===e.mathShape.hasShortAxisInteraction&&null!==e.quantification?.shortAxis?.value?Ma[this.#u]:Ma[`${this.#u}Drawing`]}setAnnotationMathShape(e,t){const n=new Hr(t[0],t[1]),i=n.getLength();if("number"!=typeof n.shortAxisL1&&(n.shortAxisL1=i/2,n.shortAxisL2=i/2),"number"!=typeof n.shortAxisT&&(n.shortAxisT=.5),!n.shortAxisCenter){const e=this.getPointAlongLine(n,n.shortAxisT);n.shortAxisCenter=e}n.shortAxisLength=n.shortAxisL1+n.shortAxisL2,e.mathShape=n,e.setTextExpr(this.#Pn(e)),e.updateQuantification()}createShapeGroup(t,n){const i=new e.Group;i.name(this.getGroupName()),i.visible(!0),i.id(t.trackingUid);const o=this.#An(t,n);i.add(o);const r=this.#On(t,n);for(const e of r)i.add(e);const a=this.#dn.create(t,n);i.add(a);const s=this.#bn(o);i.add(this.#dn.getConnector(s,a,n)),i.on("mouseenter",()=>{i.getLayer()?.draw(),this.updateShortAxisToSolid(i)}),i.on("mouseleave",()=>{i.getLayer()?.draw(),this.updateShortAxisToSolid(i)}),i.on("dragend",()=>{const e=i.position();0===e.x&&0===e.y||(this.updateAnnotationOnTranslation(i.getAttr("annotation"),e),i.position({x:0,y:0}),i.getLayer()?.draw())});const l=i.findOne(".bidimensional-short-axis"),c=i.findOne(".short-axis-tick0"),u=i.findOne(".short-axis-tick1");return[l,c,u].forEach(e=>{e&&e.on("mouseenter",()=>(l&&l.opacity(1),c&&c.opacity(1),u&&u.opacity(1),void i.getLayer()?.draw()))}),i}#An(t,n){const i=t.mathShape,o=new e.Line({points:[i.getBegin().getX(),i.getBegin().getY(),i.getEnd().getX(),i.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,opacity:1,name:"shape"});return ja(o,i,n.getZoomScale?n.getZoomScale():{x:1,y:1}),o}#On(t,n){const i=t.mathShape,o=10,r=n.getZoomScale?n.getZoomScale():{x:1,y:1},a=Mr(i,i.getBegin(),20,r),s=new e.Line({points:[a.getBegin().getX(),a.getBegin().getY(),a.getEnd().getX(),a.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick0"}),l=Mr(i,i.getEnd(),20,r),c=new e.Line({points:[l.getBegin().getX(),l.getBegin().getY(),l.getEnd().getX(),l.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick1"}),[u,d]=this.getShortAxisEndpoints(t),h=new e.Line({points:[u.getX(),u.getY(),d.getX(),d.getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,dash:t.mathShape.hasShortAxisInteraction?[]:[8,8],opacity:.5,name:"bidimensional-short-axis"}),g=d.getX()-u.getX(),S=d.getY()-u.getY(),m=Math.hypot(g,S);let p,f;return 0===m?(p=1,f=0):(p=-S/m,f=g/m),[s,c,h,new e.Line({points:[u.getX()-p*o/2,u.getY()-f*o/2,u.getX()+p*o/2,u.getY()+f*o/2],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,opacity:.5,name:"short-axis-tick0"}),new e.Line({points:[d.getX()-p*o/2,d.getY()-f*o/2,d.getX()+p*o/2,d.getY()+f*o/2],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,opacity:.5,name:"short-axis-tick1"})]}#bn(e){const t=e.points(),n=e.x(),i=e.y(),o=(t[0]+t[2])/2+n,r=(t[1]+t[3])/2+i;return[new S(o,r)]}#xn(e){if(!e||!e.mathShape)return[];const t=e.mathShape,n=t.getBegin(),i=t.getEnd(),[o,r]=this.getShortAxisEndpoints(e);return[n,i,o,r]}getAnchors(e,t){const n=this.#xn(e),i=[];for(let e=0;e<n.length;++e)i.push(Ba(n[e].getX(),n[e].getY(),`anchor${e}`,t));return i}constrainAnchorMove(e,t){const n=t.mathShape;if("anchor2"===e.id()||"anchor3"===e.id()){const t=n.getBegin(),i=n.getEnd(),o=i.getX()-t.getX(),r=i.getY()-t.getY(),a=Math.hypot(o,r);if(0===a)return;const s=o/a,l=r/a,c=-l,u=s,d=e.x()-t.getX(),h=e.y()-t.getY(),g=d*s+h*l;n.shortAxisT=Math.max(0,Math.min(1,g/a));const S=this.getPointAlongLine(n,n.shortAxisT);n.shortAxisCenter=S;const m=d*c+h*u;"anchor2"===e.id()?n.shortAxisL1=Math.max(.1,m):n.shortAxisL2=Math.max(.1,-m),n.shortAxisLength=n.shortAxisL1+n.shortAxisL2;const p="anchor2"===e.id()?n.shortAxisL1:-n.shortAxisL2;e.x(S.getX()+c*p),e.y(S.getY()+u*p)}}onAnchorMoveEnd(e,t){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#En(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#dn.updatePosition(t,o),this.updateConnector(t,o))}#En(t,n,i){const o=t.mathShape,r=n.getParent();if(!(r instanceof e.Group))return;const a=r.findOne(".shape");a&&a instanceof e.Line&&(a.position({x:0,y:0}),a.points([o.getBegin().getX(),o.getBegin().getY(),o.getEnd().getX(),o.getEnd().getY()]),ja(a,o,i.getZoomScale?i.getZoomScale():{x:1,y:1}));const s=r.findOne(".shape-tick0"),l=r.findOne(".shape-tick1"),c=i.getZoomScale(),u=Mr(o,o.getBegin(),20,c);s&&s instanceof e.Line&&(s.position({x:0,y:0}),s.points([u.getBegin().getX(),u.getBegin().getY(),u.getEnd().getX(),u.getEnd().getY()]));const d=Mr(o,o.getEnd(),20,c);l&&l instanceof e.Line&&(l.position({x:0,y:0}),l.points([d.getBegin().getX(),d.getBegin().getY(),d.getEnd().getX(),d.getEnd().getY()])),"anchor2"!==n.id()&&"anchor3"!==n.id()||(o.shortAxisLength=t.mathShape.shortAxisLength,o.shortAxisT=t.mathShape.shortAxisT);const[h,g]=this.getShortAxisEndpoints(t),S=r.findOne(".bidimensional-short-axis");S&&S instanceof e.Line&&(S.position({x:0,y:0}),S.points([h.getX(),h.getY(),g.getX(),g.getY()])),this.updateShortAxisTicks(r,h,g);const m=Na(r,2),p=Na(r,3);m&&p&&(m.x(h.getX()),m.y(h.getY()),p.x(g.getX()),p.y(g.getY())),t.mathShape.hasShortAxisInteraction=!0,t.setTextExpr(this.#Pn(t)),t.updateQuantification?.(),r.getLayer()?.draw()}updateLabelContent(e,t,n){this.#dn.updateContent(e,t)}updateConnector(t,n){const i=n.findOne(".shape");if(i&&i instanceof e.Line){const e=this.#bn(i);this.#dn.updateConnector(n,e)}}#Ln(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();let o=n;return n.getY()<i.getY()&&(o=i),o}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd(),r=new S(i.getX()+t.x,i.getY()+t.y),a=new S(o.getX()+t.x,o.getY()+t.y),s=new Hr(r,a);s.shortAxisLength=n.shortAxisLength,s.shortAxisT=n.shortAxisT,s.shortAxisL1=n.shortAxisL1,s.shortAxisL2=n.shortAxisL2,n.shortAxisCenter instanceof Object&&"getX"in n.shortAxisCenter&&"getY"in n.shortAxisCenter&&(s.shortAxisCenter=new S(n.shortAxisCenter.getX()+t.x,n.shortAxisCenter.getY()+t.y)),s.hasShortAxisInteraction=n.hasShortAxisInteraction,e.mathShape=s,e.updateQuantification()}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=i.findOne(".shape"),r=Na(i,0),a=Na(i,1),s=new S(r.x()-o.x(),r.y()-o.y()),l=new S(a.x()-o.x(),a.y()-o.y()),c=new Hr(s,l),u=t.mathShape;if(u.shortAxisCenter instanceof S){const e=u.shortAxisCenter,t=l.getX()-s.getX(),n=l.getY()-s.getY(),i=t*t+n*n;if(i>0){const o=((e.getX()-s.getX())*t+(e.getY()-s.getY())*n)/i;c.shortAxisT=Math.max(0,Math.min(1,o)),c.shortAxisCenter=new S(s.getX()+t*c.shortAxisT,s.getY()+n*c.shortAxisT)}else c.shortAxisT=.5,c.shortAxisCenter=e}else c.shortAxisT=u.shortAxisT??.5;c.shortAxisL1=u.shortAxisL1,c.shortAxisL2=u.shortAxisL2,c.shortAxisLength=u.shortAxisLength,c.hasShortAxisInteraction=u.hasShortAxisInteraction,t.mathShape=c,t.updateQuantification()}updateShortAxisToSolid(t){const n=t.findOne(".bidimensional-short-axis");n&&n instanceof e.Line&&(n.dash([]),n.getLayer()?.draw())}updateShortAxisTicks(t,n,i){const o=10,r=i.getX()-n.getX(),a=i.getY()-n.getY(),s=Math.hypot(r,a);let l,c;0===s?(l=1,c=0):(l=-a/s,c=r/s);const u=new S(n.getX()-l*o/2,n.getY()-c*o/2),d=new S(n.getX()+l*o/2,n.getY()+c*o/2),h=t.findOne(".short-axis-tick0");h&&h instanceof e.Line&&(h.position({x:0,y:0}),h.points([u.getX(),u.getY(),d.getX(),d.getY()]),h.opacity(.5));const g=new S(i.getX()-l*o/2,i.getY()-c*o/2),m=new S(i.getX()+l*o/2,i.getY()+c*o/2),p=t.findOne(".short-axis-tick1");p&&p instanceof e.Line&&(p.position({x:0,y:0}),p.points([g.getX(),g.getY(),m.getX(),m.getY()]),p.opacity(.5))}getShortAxisEndpoints(e){const t=e.mathShape;let n;if(e.mathShape.shortAxisCenter instanceof S){const i=t.getBegin(),o=t.getEnd(),r=o.getX()-i.getX(),a=o.getY()-i.getY(),s=Math.hypot(r,a);if(0===s)n=e.mathShape.shortAxisCenter;else{const o=r/s,l=a/s,c=(e.mathShape.shortAxisCenter.getX()-i.getX())*o+(e.mathShape.shortAxisCenter.getY()-i.getY())*l,u=Math.max(0,Math.min(1,c/s));e.mathShape.shortAxisT=u,n=this.getPointAlongLine(t,u)}}else{const i="number"==typeof e.mathShape.shortAxisT?e.mathShape.shortAxisT:.5;n=this.getPointAlongLine(t,i)}const i=t.getBegin(),o=t.getEnd(),r=o.getX()-i.getX(),a=o.getY()-i.getY(),s=Math.hypot(r,a);if(0===s||Number.isNaN(n.getX())||Number.isNaN(n.getY()))return[n,n];const l=-a/s,c=r/s;let u,d;return u="number"==typeof e.mathShape.shortAxisL1?e.mathShape.shortAxisL1:"number"==typeof e.mathShape.shortAxisLength?e.mathShape.shortAxisLength/2:0,d="number"==typeof e.mathShape.shortAxisL2?e.mathShape.shortAxisL2:"number"==typeof e.mathShape.shortAxisLength?e.mathShape.shortAxisLength/2:0,Number.isNaN(u)||Number.isNaN(d)?[n,n]:[new S(n.getX()+l*u,n.getY()+c*u),new S(n.getX()-l*d,n.getY()-c*d)]}getPointAlongLine(e,t){const n=e.getBegin(),i=e.getEnd();return new S(n.getX()+(i.getX()-n.getX())*t,n.getY()+(i.getY()-n.getY())*t)}}},filter:{Threshold:ds,Sobel:gs,Sharpen:hs}};class ps{#h=!0;#m;constructor(e,t){void 0!==t&&(this.#h=t),this.#m=new DataView(e)}writeUint8(e,t){return this.#m.setUint8(e,t),e+Uint8Array.BYTES_PER_ELEMENT}writeInt8(e,t){return this.#m.setInt8(e,t),e+Int8Array.BYTES_PER_ELEMENT}writeUint16(e,t){return this.#m.setUint16(e,t,this.#h),e+Uint16Array.BYTES_PER_ELEMENT}writeInt16(e,t){return this.#m.setInt16(e,t,this.#h),e+Int16Array.BYTES_PER_ELEMENT}writeUint32(e,t){return this.#m.setUint32(e,t,this.#h),e+Uint32Array.BYTES_PER_ELEMENT}writeUint64(e,t){return this.#m.setBigUint64(e,t,this.#h),e+BigUint64Array.BYTES_PER_ELEMENT}writeInt32(e,t){return this.#m.setInt32(e,t,this.#h),e+Int32Array.BYTES_PER_ELEMENT}writeInt64(e,t){return this.#m.setBigInt64(e,t,this.#h),e+BigInt64Array.BYTES_PER_ELEMENT}writeFloat32(e,t){return this.#m.setFloat32(e,t,this.#h),e+Float32Array.BYTES_PER_ELEMENT}writeFloat64(e,t){return this.#m.setFloat64(e,t,this.#h),e+Float64Array.BYTES_PER_ELEMENT}writeHex(e,t){const n=parseInt(t,16);return this.#m.setUint16(e,n,this.#h),e+Uint16Array.BYTES_PER_ELEMENT}writeBinaryArray(e,t){if(t.length%8!=0)throw new Error("Cannot write boolean array as binary.");let n,i;for(let o=0,r=t.length;o<r;o+=8){n=0;for(let e=0;e<8;++e)i=0===t[o+e]?0:1,n+=i<<e;e=this.writeUint8(e,n)}return e}writeUint8Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint8(e,t[n]);return e}writeInt8Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt8(e,t[n]);return e}writeUint16Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint16(e,t[n]);return e}writeInt16Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt16(e,t[n]);return e}writeUint32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint32(e,t[n]);return e}writeUint64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint64(e,t[n]);return e}writeInt32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt32(e,t[n]);return e}writeInt64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt64(e,t[n]);return e}writeFloat32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeFloat32(e,t[n]);return e}writeFloat64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeFloat64(e,t[n]);return e}}let fs=0;const vs={copy:"copy",remove:"remove",clear:"clear",replace:"replace"};class Cs{action;value;constructor(e){this.action=e}}const ys={[vs.copy]:e=>e,[vs.remove]:()=>null,[vs.clear]:e=>(e.value=[],e),[vs.replace]:(e,t)=>(e.value=Ds(t),e)};function Ds(e){const t=Is(e);return Array.isArray(t)?t:[t]}function Is(e){if(Array.isArray(e))return e.map(Is);if(ArrayBuffer.isView(e)&&!(e instanceof DataView))return e.slice();if(e instanceof se||null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t=e instanceof se?new se(e.vr):{};for(const n of Object.keys(e))t[n]=Is(e[n]);return t}return e}function ws(e){const t={},n={};for(const i of Object.keys(e)){const o=e[i];if("default"===i){n[i]=o;continue}if(Ts(i)){n[Ls(i)]=o;continue}const r=ae(i);if(void 0!==r){t[r.getKey()]=o;continue}const a=Object.keys(W).filter(e=>W[e]===i);if(0===a.length)s.warn(`Cannot translate unknown writer rule name: ${i}`);else for(const e of a)t[e]=o}return{...t,...n}}function Ts(e){return/^([0-9A-FX]{4}){1,2}$/i.test(e)}function Ls(e){return e.toUpperCase().replaceAll("X","x")}function Ps(e){return e.toLowerCase().includes("x")}function As(e,t){const n=e=>e.split("x").length-1;return Object.keys(e).filter(e=>e.length===t&&Ts(e)&&Ps(e)).map(t=>({range:Ls(t),rule:e[t]})).sort((e,t)=>n(e.range)-n(t.range))}function Os(e,t){return e.find(e=>(e=>{for(let n=0;n<e.length;++n)if("x"!==e[n]&&e[n]!==t[n])return!1;return!0})(e.range))?.rule}function bs(e){const t=`.${(new Date).toISOString().replace(/\D/g,"").substring(0,14)}`;fs+=1;const n=`.${fs}`;let i="1.2.826.0.1.3680043.9.7278.1.";const o=29+n.length+t.length,r=Math.min(e.length,64-o);if(r>1){let t="";for(let n=0;n<r;++n)t+=e.charCodeAt(n);i+=t.substring(0,r)}return i+=t+n,i}function xs(e){return e%2==0}function Es(e){const t=_[e];return void 0!==t&&"string"===t}function Rs(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}class Fs{encode(e){const t=new Uint8Array(e.length);for(let n=0,i=e.length;n<i;++n)t[n]=e.charCodeAt(n);return t}}const Ms="00080005",qs="00280100";class Us{#Rn=!1;#Fn=!0;#Mn;#qn={default:{action:vs.copy,value:null}};#Un=this.#qn;#Vn=[];#Nn=[];#Qn=[];#Bn=new Fs;#kn=this.#Bn;setUseUnVrForPrivateSq(e){this.#Rn=e}setFixUnknownVR(e){this.#Fn=e}setPrivateTagsWhitelist(e){if(void 0!==e){this.#Mn=new Set;for(const t of e){this.#Mn.add(t);const e=q(t),n=e.getElement();parseInt(n,16)>=4096&&this.#Mn.add(`${e.getGroup()}00${n.substring(0,2)}`)}}else this.#Mn=void 0}setRules(e,t){const n=Object.keys(e).filter(e=>"default"!==e&&!Ts(e));0!==n.length&&s.warn(`Writer rules not indexed by tag or group key: ${n.join(", ")} (they will be ignored, use translateWriterRules for name based rules)`);const i=Object.values(vs),o={},r=[];for(const t of Object.keys(e))i.includes(e[t]?.action)?o[t]=e[t]:r.push(t);if(0!==r.length&&s.warn(`Writer rules with unknown action: ${r.join(", ")} (they will be ignored, expected one of: ${i.join(", ")})`),e=o,this.#Un=e,this.#Vn=As(e,8),this.#Nn=As(e,4),this.#Qn=[],t){const t=Object.keys(e);for(const n of t){const t=e[n];t.action===vs.replace&&void 0!==t.value&&null!==t.value&&8===n.length&&Ts(n)&&!Ps(n)&&void 0!==oe(q(n))&&this.#Qn.push(n)}}}#Gn(e){return this.#Bn.encode(e)}#zn(e){return this.#kn.encode(e)}useSpecialTextEncoder(){this.#kn=new TextEncoder}getElementToWrite(e){if(void 0!==this.#Mn&&e.tag.isPrivate()&&!this.#Mn.has(e.tag.getKey()))return null;const t=e.tag.getKey(),n=e.tag.getGroup();let i=this.#Un[t];void 0===i&&(i=Os(this.#Vn,t)),void 0===i&&(i=this.#Un[n]),void 0===i&&(i=Os(this.#Nn,n)),void 0===i&&(i=this.#Un.default??this.#qn.default);const o=ys[i.action](e,i.value);return null!==o&&"SQ"===o.vr&&Array.isArray(o.value)&&(o.value=o.value.map(e=>this.#Hn(e))),o}#Hn(e){if(null===e||"object"!=typeof e)return e;const t={};for(const n of Object.keys(e)){const i=e[n];if(i.tag=q(n),V(i.tag)){t[n]=i;continue}const o=this.getElementToWrite(i);null!==o&&(t[n]=o)}return t}#Yn(e,t,n,i,o){const r=function(e){return V(e.tag)&&"NONE"===e.vr};for(const a of n){if(0===a.length)continue;let n=!1;const s=a.find(e=>r(e));void 0!==s&&void 0!==s.undefinedLength&&(n=s.undefinedLength);const l=new se("NONE");l.vl=n?4294967295:s.vl,l.tag=U(),l.value=[],t=this.#Xn(e,l,t,i);for(const n of a)r(n)||Q(n.tag)||(t=this.#Xn(e,n,t,i,o));if(n){const n=new se("NONE");n.vl=0,n.tag=N(),n.value=[],t=this.#Xn(e,n,t,i)}}return t}#Wn(e,t,n,i,o,r){const a=n;if("NONE"===t.vr);else if(i instanceof Uint8Array)if(void 0!==r&&1===r){if(i.length%8!=0){s.debug("Padding binary pixel data");const e=8*Math.ceil(i.length/8),t=new Array(e-i.length);t.fill(0),i=Rs(i,t)}n=e.writeBinaryArray(n,i)}else n=e.writeUint8Array(n,i);else if(i instanceof Int8Array)n=e.writeInt8Array(n,i);else if(i instanceof Uint16Array)n=e.writeUint16Array(n,i);else if(i instanceof Int16Array)n=e.writeInt16Array(n,i);else if(i instanceof Uint32Array)n=e.writeUint32Array(n,i);else if(i instanceof Int32Array)n=e.writeInt32Array(n,i);else if(i instanceof Float32Array)n=e.writeFloat32Array(n,i);else if(i instanceof Float64Array)n=e.writeFloat64Array(n,i);else if(i instanceof BigUint64Array)n=e.writeUint64Array(n,i);else if(i instanceof BigInt64Array)n=e.writeInt64Array(n,i);else{const r=_[t.vr];if(void 0!==r)if("Uint8"===r)n=e.writeUint8Array(n,i);else if("Uint16"===r)n=e.writeUint16Array(n,i);else if("Int16"===r)n=e.writeInt16Array(n,i);else if("Uint32"===r)n=e.writeUint32Array(n,i);else if("Int32"===r)n=e.writeInt32Array(n,i);else if("Uint64"===r)n=e.writeUint64Array(n,i);else if("Int64"===r)n=e.writeInt64Array(n,i);else if("Float32"===r)n=e.writeFloat32Array(n,i);else if("Float64"===r)n=e.writeFloat64Array(n,i);else{if("string"!==r)throw new Error(`Unknown VR type: ${r}`);n=e.writeUint8Array(n,i)}else if("SQ"===t.vr)n=this.#Yn(e,n,i,o);else if("AT"===t.vr)for(const t of i){const i=String(t),o=i.substring(1,5),r=i.substring(6,10),a=[parseInt(o,16),parseInt(r,16)];n=e.writeUint16Array(n,a)}else"xs"===t.vr?n=i instanceof Int16Array?e.writeInt16Array(n,i):e.writeUint16Array(n,i):s.warn(`Unknown VR: ${t.vr}`)}if("SQ"!==t.vr&&"NONE"!==t.vr){const e=n-a;if(e!==t.vl){let n=`Offset difference and VL are not equal: ${e} != ${t.vl}`;n+=" (",void 0!==t.tag&&(n+=`${t.tag}, `),n+=`vr:${t.vr})`,s.warn(n)}}return n}#$n(e,t,n,i,o,r){let a=!1;if(void 0!==t.undefinedLength&&(a=t.undefinedLength),a){const a=[];a.push({tag:U(),vr:"NONE",vl:0,value:[]});for(const e of i)a.push({tag:U(),vr:t.vr,vl:e.length,value:e});n=this.#Yn(e,n,[a],o,r)}else{let a=i[0];i.length>1&&(a=function(e){if(void 0===e[0].length)return e;let t=0;for(const n of e)t+=n.length;const n=new e[0].constructor(t);let i=0;for(const t of e)n.set(t,i),i+=t.length;return n}(i)),n=this.#Wn(e,t,n,a,o,r)}return n}#Xn(e,t,n,i,o){const r=t.tag.isWithVR(),a=!(!i&&r)||j(t.vr);n=e.writeHex(n,t.tag.getGroup()),n=e.writeHex(n,t.tag.getElement());let l=t.vr;this.#Rn&&t.tag.isPrivate()&&"SQ"===l&&(s.warn("Write element using VR=UN for private sequence."),l="UN"),r&&!i&&(n=e.writeUint8Array(n,this.#Gn(l)),a&&(n+=2));let c=!1;("SQ"===t.vr||G(t.tag))&&void 0!==t.undefinedLength&&(c=t.undefinedLength);let u=!1;V(t.tag)&&void 0!==t.undefinedLength&&(u=t.undefinedLength);let d=t.vl;(c||u)&&(d=4294967295),n=a?e.writeUint32(n,d):e.writeUint16(n,d);let h=t.value;if(void 0===h&&(h=[]),n=G(t.tag)?this.#$n(e,t,n,h,i,o):this.#Wn(e,t,n,h,i),c){const t=new se("NONE");t.vl=0,t.tag=new F("FFFE","E0DD"),t.value=[],n=this.#Xn(e,t,n,i)}return n}getBuffer(e){const t=e["00020010"].value[0],n=we(t),i=Te(t);if(void 0!==e[Ms]){const t=e[Ms].value[0];void 0!==t&&"ISO-IR 6"!==t&&(s.debug(`Change charset to UTF, was: ${t}`),this.useSpecialTextEncoder(),e[Ms].value=["ISO_IR 192"])}let o;void 0!==e[qs]&&(o=e[qs].value[0]);let r,a=132;const l=[],c=[];let u,d,h=0;const g=new F("0002","0000"),S=new F("0002","0001"),m=new F("0002","0012"),p=new F("0002","0013"),f=this.#Qn.slice(),v=Object.keys(e);for(const t of v){const s=e[t];if(s.tag=q(t),u=this.getElementToWrite(s),!(null===u||g.equals(u.tag)||S.equals(u.tag)||m.equals(u.tag)||p.equals(u.tag))){r=0;const e=f.indexOf(u.tag.getKey());-1!==e&&f.splice(e,1),this.#Fn&&Vs(u,!i),this.#jn(u,u.value,n,o),d=re(u.tag),r+=Re(u.vr,"Meta Element"!==d&&n),r+=u.vl,"Meta Element"===d?(l.push(u),h+=r):c.push(u),a+=r}}for(const e of f){const t=q(e),i=oe(t),o=new se(i?.getVr());o.tag=t;const r=Ds(this.#Un[e].value);let s=Re(o.vr,n);s+=this.#jn(o,r,n),c.push(o),a+=s}const C=Ns("FileMetaInformationVersion");let y=Re(C.vr,!1);y+=this.#jn(C,[0,1],!1),l.push(C),h+=y,a+=y;const D=Ns("ImplementationClassUID");let I=Re(D.vr,!1);const w=`1.2.826.0.1.3680043.9.7278.1.${"0.37.0-beta.21".replace("-beta",".99")}`;I+=this.#jn(D,[w],!1),l.push(D),h+=I,a+=I;const T=Ns("ImplementationVersionName");let L=Re(T.vr,!1);L+=this.#jn(T,["DWV_0.37.0-beta.21"],!1),l.push(T),h+=L,a+=L;const P=function(e,t){return M(e.tag,t.tag)};l.sort(P),c.sort(P);const A=Ns("FileMetaInformationGroupLength");let O=Re(A.vr,!1);O+=this.#jn(A,new Uint32Array([h]),!1),a+=O;const b=new ArrayBuffer(a),x=new ps(b),E=new ps(b,!i);let R=128;R=x.writeUint8Array(R,this.#Gn("DICM")),R=this.#Xn(x,A,R,!1);for(const e of l)R=this.#Xn(x,e,R,!1);const U=132+O+h;R!==U&&s.warn(`Bad size calculation... meta offset: ${R}, calculated size:${U} (diff:${R-U})`);for(const e of c)R=this.#Xn(E,e,R,n,o);return R!==a&&s.warn(`Bad size calculation... final offset: ${R}, calculated size:${a} (diff:${R-a})`),b}#jn(e,t,n,i){let o=0;if("SQ"===e.vr){if(null!==t&&0!==t){const r=[];let a=!1;void 0!==e.undefinedLength&&(a=e.undefinedLength,delete e.undefinedLength);for(const e of t){const t=e,s=[];let l=0;if(null===t||0===t)continue;let c=i;const u=t[qs];void 0!==u&&void 0!==u.value&&(c=u.value[0]);const d=Object.keys(t);for(const e of d){const i=t[e];i.tag=q(e),V(i.tag)||(l+=this.#jn(i,i.value,n,c),s.push(i),l+=Re(i.vr,n))}const h={tag:U(),vr:"NONE",vl:l,value:[]};a&&(h.undefinedLength=a),s.push(h),l+=Re(h.vr,n),a&&(l+=Re("NONE",n));const g=function(e,t){return M(e.tag,t.tag)};s.sort(g),o+=l,r.push(s)}a&&(o+=Re("NONE",n)),e.value=r,e.vl=o,a&&(e.undefinedLength=a)}}else{if(Es(r=e.vr)||"OB"===r){const n=function(e){let t="";return Es(e)&&(t="UI"===e?"\0":" "),t}(e.vr);if(Es(e.vr)){let i;K(e.vr)?(t=this.#zn(t.join("\\")),i=this.#zn(n)):(t=this.#Gn(t.join("\\")),i=this.#Gn(n)),xs(t.length)||(t=Rs(t,i))}else"OB"===e.vr&&(t=function(e){if(null==e||void 0===e.length)throw new Error("Cannot pad undefined or null OB value.");if(0!==e.length&&void 0!==e[0].length){let t=0;for(const n of e)t+=n.length;xs(t)||(e[e.length-1]=Rs(e[e.length-1],[0]))}else xs(e.length)||(e=Rs(e,[0]));return e}(t))}if("AT"===e.vr)o=4*t.length;else if("xs"===e.vr)o=t.length*Uint16Array.BYTES_PER_ELEMENT;else if(function(e){const t=_[e];return void 0!==t&&"string"!==t}(e.vr)||"ox"===e.vr){if(G(e.tag)&&Array.isArray(t)){o=0;for(const e of t)o+=e.length}else o=t.length;const r=_[e.vr];if(G(e.tag)||"ox"===e.vr)if(e.undefinedLength){const e=Re("NONE",n);o+=e,o+=e*t.length,o+=e}else void 0!==i&&(1===i?o=Math.ceil(o/8):16===i?o*=Uint16Array.BYTES_PER_ELEMENT:32===i?o*=Uint32Array.BYTES_PER_ELEMENT:64===i&&(o*=Float64Array.BYTES_PER_ELEMENT));else{if(void 0===r)throw new Error(`Unsupported element: ${e.vr}`);{const e=function(e){let t;return"Uint8"===e?t=Uint8Array.BYTES_PER_ELEMENT:"Uint16"===e?t=Uint16Array.BYTES_PER_ELEMENT:"Int16"===e?t=Int16Array.BYTES_PER_ELEMENT:"Uint32"===e?t=Uint32Array.BYTES_PER_ELEMENT:"Int32"===e?t=Int32Array.BYTES_PER_ELEMENT:"Float32"===e?t=Float32Array.BYTES_PER_ELEMENT:"Float64"===e?t=Float64Array.BYTES_PER_ELEMENT:"Uint64"===e?t=BigUint64Array.BYTES_PER_ELEMENT:"Int64"===e&&(t=BigInt64Array.BYTES_PER_ELEMENT),t}(r);if(void 0===e)throw new Error(`Unknown bytes per element for VR type: ${r}`);o*=e}}}else o=t.length;e.value=t,e.vl=o}var r;return o}}function Vs(e,t){if("UN"===e.vr){const n=oe(e.tag)?.getVr();if(void 0!==n&&e.vr!==n){e.vr=n;const i=_[e.vr];if(void 0!==i&&"Uint8"!==i&&"string"!==i){const n=function(e,t,n){let i;if(void 0===e.buffer)return i;const o=new ge(e.buffer,n),r=e.byteOffset,a=e.length,s=_[t];return"Uint16"===s?i=o.readUint16Array(r,a):"Uint32"===s?i=o.readUint32Array(r,a):"Uint64"===s?i=o.readUint64Array(r,a):"Int16"===s?i=Array.from(o.readInt16Array(r,a)):"Int32"===s?i=Array.from(o.readInt32Array(r,a)):"Int64"===s?i=o.readInt64Array(r,a):"Float32"===s?i=Array.from(o.readFloat32Array(r,a)):"Float64"===s&&(i=Array.from(o.readFloat64Array(r,a))),i}(e.value,e.vr,t);void 0!==n&&(e.value=n)}s.info(`Element ${e.tag.getGroup()} ${e.tag.getElement()} VR changed from UN to ${e.vr}`)}}}function Ns(e){const t=ae(e),n=oe(t),i=new se(n?.getVr());return i.tag=t,i}class Qs{trackingId;trackingUid;referencedSopInstanceUID;referencedSopClassUID;referencedFrameNumber;mathShape;referencePoints;colour="#ffff80";quantification;textExpr="";labelPosition;planeOrigin;planePoints;#Zn;#Te={};constructor(){this.trackingId=Math.random().toString(36).substring(2,15),this.trackingUid=bs("TrackingUniqueIdentifier")}getMetaConceptIds(){return Object.keys(this.#Te)}getMetaItem(e){return this.#Te[e]}addMetaItem(e,t){const n=e.value;void 0!==this.#Te[n]&&s.warn(`Overwriting annotation meta with id=${n}`),this.#Te[e.value]={concept:e,value:t}}removeMetaItem(e){void 0!==this.#Te[e]&&delete this.#Te[e]}getOrientationName(){let e;return void 0!==this.planePoints&&(e=We(this.planePoints[1].getValues().concat(this.planePoints[2].getValues()))),e}init(e){if(void 0!==this.referencedSopInstanceUID)return void s.debug("Cannot initialise annotation twice");this.#Zn=e;const t=e.getCurrentPosition();if(this.referencedSopInstanceUID=e.getCurrentImageUid(),this.referencedSopClassUID=e.getSopClassUid(),t.length()>3){const n=e.getIndexFromPosition(t);this.referencedFrameNumber=n.get(3)+1}this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID),e.isAquisitionOrientation()||(this.planePoints=e.getPlanePoints(t))}canView(){return void 0!==this.#Zn}isCompatibleView(e){let t=!1;if(void 0===this.planePoints)e.isAquisitionOrientation()&&(t=!0);else{const n=e.getCosines(),i=new m(n[0],n[1],n[2]),o=new m(n[3],n[4],n[5]);i.equals(this.planePoints[1])&&o.equals(this.planePoints[2])&&(t=!0)}return t}setViewController(e){e.includesImageUid(this.referencedSopInstanceUID)?this.isCompatibleView(e.getPlaneHelper())&&(this.#Zn=e,this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID)):s.warn(`Cannot view annotation with reference UID: ${this.referencedSopInstanceUID}`)}#Kn(){let e;if(void 0!==this.#Zn){let t=this.planeOrigin;void 0!==this.planePoints&&(t=this.planePoints[0]);const n=[t.getX(),t.getY(),t.getZ()];void 0!==this.referencedFrameNumber&&n.push(this.#_n());const i=new C(n);e=this.#Zn.getIndexFromPosition(i)}return e}getCentroid(){let e;if(void 0!==this.#Zn&&void 0!==this.mathShape.getCentroid&&void 0!==this.mathShape.getCentroid()){const t=this.#Kn(),n=this.#Zn.getScrollDimIndex(),i=t.getValues()[n],o=this.mathShape.getCentroid();if(e=this.#Zn.getPositionFromPlanePoint(o,i),void 0!==this.referencedFrameNumber){const t=e.getValues();t[3]=this.#_n(),e=new C(t)}}return e}#_n(){const e=this.#Zn.getCurrentIndex().getValues();return e[3]=this.referencedFrameNumber-1,this.#Zn.getPositionFromIndex(new a(e)).get(3)}contains(e,t=0){return this.mathShape instanceof S&&void 0!==this.referencePoints?.[0]?Fr(e,this.mathShape,this.referencePoints[0])<=t:"function"==typeof this.mathShape?.contains&&this.mathShape.contains(e,t)}setTextExpr(e){if(void 0!==this.#Zn){const t=this.#Zn.getModality();void 0!==e[t]?this.textExpr=e[t]:this.textExpr=e["*"]}else s.warn("Cannot set text expr without a view controller")}getText(){return function(e,t){let n="";if(null==e)return n;if(n=e,null==t)return n;const i=I(e);for(let e=0;e<i.length;++e){const o=t[i[e]];if(null!=o&&null!==o.value&&void 0!==o.value){let t=o.value.toPrecision(4);null!==o.unit&&void 0!==o.unit&&0!==o.unit.length&&("unit.degree"!==o.unit&&(t+=" "),t+=y.t(o.unit));const r=`{${i[e]}}`;n=n.replace(r,t)}}return n}(this.textExpr,this.quantification)}updateQuantification(){void 0!==this.#Zn&&void 0!==this.mathShape.quantify&&(this.quantification=this.mathShape.quantify(this.#Zn,this.#Kn(),I(this.textExpr)))}getFactory(){let e;if(void 0===this.mathShape)return e;if(void 0!==Ss.draw)for(const t in Ss.draw){const n=Ss.draw[t];if(n.supports(this.mathShape)){e=new n;break}}if(void 0===e)for(const t in ms.draw){const n=ms.draw[t];if(n.supports(this.mathShape)){e=new n;break}}return void 0===e&&s.warn("No shape factory found for math shape"),e}}const Bs="00020012";class ks{current;measure}class Gs{annotationGroups;responseEvaluations;comment}class zs{#_t;#Jn=!1;getWarning(){return this.#_t}#ei(e){const t=me(ce(e,Bs)),n=void 0!==t&&ve(t,"0.34.0","0.35.0-beta.21"),i=Oa(e);let o;const r=xa(e);return void 0!==r.conceptNameCode&&(o=r.conceptNameCode.value),n&&void 0===i&&o===Wn.value}#ti(e){const t=ce(e,Bs);let n;return void 0!==t&&(n=me(t)),void 0!==n&&ve(n,"0.34.0","0.37.0-beta.17")}#ni(e){const t="DCMR-1500"===Oa(e);let n;const i=xa(e);void 0!==i.conceptNameCode&&(n=i.conceptNameCode.value);let o=!1;if(t&&n===jn.value){const e=i.contentSequence.find(this.#ii);if(void 0!==e){const t=e.contentSequence.find(this.#oi);if(void 0!==t){const e=t.contentSequence.find(this.#ri),n=t.contentSequence.find(this.#ai);void 0===e&&void 0===n||(o=!0)}}}return o}#si(e){return"DCMR-4100"===Oa(e)}checkElements(e){return this.#_t=void 0,this.#ei(e)||this.#ni(e)||this.#si(e)||(this.#_t="Not a dwv supported annotation"),this.#_t}#li(e,t){if(t.valueType===Ia&&t.relationshipType===ma&&(e.referencedSopClassUID=t.value.referencedSOPSequence.referencedSOPClassUID,e.referencedSopInstanceUID=t.value.referencedSOPSequence.referencedSOPInstanceUID,void 0!==t.value.referencedFrameNumber)){let n=parseInt(t.value.referencedFrameNumber,10);this.#Jn&&(n+=1),e.referencedFrameNumber=n}}#ci(e,t){t.hasHeader(ya,ei(Vn),ha)&&(e.trackingId=t.value,e.trackingUid=t.value)}#ui(e,t){t.hasHeader(fa,ei(Vn),ga)&&(e.trackingId=t.value),t.hasHeader(ya,ei(Qn),ga)&&(e.trackingUid=t.value)}#di(e,t,n){void 0===n&&(n=!1);let i=pa;if(n&&(i=ha),t.hasHeader(fa,ei($n),i)){e.textExpr=t.value;const n=t.contentSequence.find(function(e){return e.hasHeader(wa,ei(Xn),ha)});void 0!==n&&(e.labelPosition=new S(n.value.graphicData[0],n.value.graphicData[1]))}if(t.hasHeader(fa,ii(),i)&&(e.colour=t.value),t.hasHeader(wa,ei(Xn),i)&&t.value.graphicType===Zr){const n=[];for(let e=0;e<t.value.graphicData.length;e+=2)n.push(new S(t.value.graphicData[e],t.value.graphicData[e+1]));e.referencePoints=n}if(t.hasHeader(Ta,ei(Kn),da)&&t.value.graphicType===Zr){const n=t.value.graphicData,i=[],o=Math.floor(n.length/3);for(let e=0;e<o;++e){const t=3*e;i.push(new m(n[t],n[t+1],n[t+2]))}e.planePoints=i}this.#hi(e,t),this.#gi(e,t)}#hi(e,t,n){let i;if(void 0===n&&(i=da),t.valueType===va&&t.relationshipType===i){const n=function(e){let t;for(const n in oi){const i=oi[n];if(i.scheme===e.schemeDesignator&&i.key===e.value){t=n;break}}return t}(t.conceptNameCode);if(void 0!==n){const i=t.value.measuredValue,o=function(e){let t;for(const n in ri){const i=ri[n];if("UCUM"===e.schemeDesignator&&i===e.value){t=n;break}}return t}(i.measurementUnitsCode);void 0===e.quantification&&(e.quantification={}),e.quantification[n]={value:i.numericValue,unit:o}}}}#gi(e,t){t.valueType!==Ca&&t.valueType!==fa||t.relationshipType!==da||e.addMetaItem(t.conceptNameCode,t.value)}#ii(e){return e.hasHeader(La,ei(Zn),da)}#oi(e){return e.hasHeader(La,ei(Wn),da)}#Si(e){return e.hasHeader(Ca,ei(xn),Sa)}#mi(e){return e.hasHeader(La,ei(Mn),ha)}#pi(e){return e.hasHeader(fa,ei(zn),da)}#fi(e){return e.hasHeader(Ca,ei(Bn),da)}#vi(e){return e.hasHeader(va,ei(Nn),da)}#Ci(e){return e.hasHeader(Ca,ei(On),da)}#ri(e){return e.hasHeader(wa,ei(bn),da)}#yi(e){return void 0!==e.contentSequence.find(this.#ri)}#Di(e){let t;const n=e.contentSequence.find(this.#ri);if(void 0!==n){t=new Qs,t.mathShape=ia(n.value);const i=n.contentSequence.find(function(e){return e.valueType===Ia&&e.relationshipType===ma});void 0!==i&&this.#li(t,i);for(const n of e.contentSequence)this.#ui(t,n),this.#di(t,n)}return t}#ai(e){let t;return e.valueType===va&&e.relationshipType===da&&(t=e.contentSequence.find(function(e){return e.valueType===wa&&e.relationshipType===Sa})),void 0!==t}#Ii(e){let t;return e.valueType===va&&e.relationshipType===ha&&(t=e.contentSequence.find(function(e){return e.valueType===wa&&e.relationshipType===Sa})),void 0!==t}#wi(e){return void 0!==e.contentSequence.find(this.#ai)}#Ti(e){let t;const n=e.contentSequence.find(this.#ai);if(void 0!==n){t=new Qs;const e=n.contentSequence.find(function(e){return e.valueType===wa&&e.relationshipType===Sa});t.mathShape=ia(e.value),t.mathShape instanceof S&&e.value.graphicData.length>=4&&(t.referencePoints=[new S(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===Ia&&e.relationshipType===ma});void 0!==i&&this.#li(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#ui(t,i),this.#hi(t,n),this.#gi(t,i);return t}#Li(e){let t;const n=e.contentSequence.find(this.#Ii);if(void 0!==n){t=new Qs;const e=n.contentSequence.find(function(e){return e.valueType===wa&&e.relationshipType===Sa});t.mathShape=ia(e.value),t.mathShape instanceof S&&e.value.graphicData.length>=4&&(t.referencePoints=[new S(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===Ia&&e.relationshipType===ma});void 0!==i&&this.#li(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#ui(t,i),this.#hi(t,n,ha),this.#gi(t,i);return t}#Pi(e){if(0===e.contentSequence.length)return;const t=e.contentSequence[0];let n=!1,i=!1;this.#oi(t)&&(n=this.#yi(t),i=this.#wi(t));const o=[];let r,a=!1;for(const t of e.contentSequence)if(this.#oi(t)){let e;a=!0,n?e=this.#Di(t):i&&(e=this.#Ti(t)),void 0!==e&&o.push(e)}return a?0!==o.length?r=new Qt(o):s.warn("No valid measurement groups in TID 1500 SR"):s.warn("No measurement groups in TID 1500 SR"),r}#Ai(e){const t=[];let n=!1;for(const i of e.contentSequence)if(this.#Si(i)){n=!0;const e=this.#Li(i);void 0!==e&&t.push(e)}const i=[];return n?0!==t.length?i.push(new Qt(t)):s.warn("No valid measurement groups in TID 4100 SR"):s.warn("No image findings in TID 4100 SR"),i}#Oi(e){const t=new Qs;t.mathShape=ia(e.value);for(const n of e.contentSequence)this.#li(t,n),this.#ci(t,n),this.#di(t,n,!0);return t}#bi(e){let t;e.valueType===La&&Ln(e.conceptNameCode,ei(jn))||s.warn("Not the expected TID 1500 SR content header");const n=e.contentSequence.find(this.#ii);return void 0!==n?t=this.#Pi(n):s.warn("No imaging measurements in TID 1500 SR"),t}#xi(e){return e.valueType===La&&Ln(e.conceptNameCode,ei(Fn))||s.warn("Not the expected TID 4100 SR content header"),e.contentSequence.find(this.#Ci)}#Ei(e){e.valueType===La&&Ln(e.conceptNameCode,ei(Wn))||console.warn("Not the expected dwv034 content header");const t=[];for(const n of e.contentSequence)n.valueType===wa&&t.push(this.#Oi(n));return new Qt(t)}#Ri(e,t){const n=function(e){return ce(t,e)};e.setMetaValue("StudyInstanceUID",n("0020000D")),e.setMetaValue("StudyID",n("00200010")),e.setMetaValue("SeriesInstanceUID",n("0020000E")),e.setMetaValue("SeriesNumber",n("00200011")),e.setMetaValue("Modality",n("00080060")),e.setMetaValue("PatientName",n("00100010")),e.setMetaValue("PatientID",n("00100020")),e.setMetaValue("PatientBirthDate",n("00100030")),e.setMetaValue("PatientSex",n("00100040"));const i="0040A375",o=t[i];if(void 0!==o){const t=Ei({[i]:o});e.setMetaValue("CurrentRequestedProcedureEvidenceSequence",t.CurrentRequestedProcedureEvidenceSequence)}}create(e){this.#Jn=this.#ti(e);const t=xa(e);let n,i;if(this.#ni(e)?(i="TID 1500 SR",n=this.#bi(t)):this.#ei(e)&&(s.warn("DWV v0.34 annotation"),i="DWV v0.34 SR",n=this.#Ei(t)),this.#si(e)){i="TID 4100 SR";const t=this.createCADReport(e);void 0!==t&&(n=t.annotationGroups[0])}if(void 0===n)throw new Error(`Cannot create annotation group from ${i}`);return this.#Ri(n,e),n}createCADReport(e){this.#Jn=this.#ti(e);const t=xa(e),n=this.#xi(t);if(void 0===n)return void s.warn("No CAD processing and Findings Summary in TID 4100 SR");let i=[];if(this.#si(e)&&(i=this.#Ai(n)),void 0===i)throw new Error("Cannot create annotation groups from TID 4100 SR");for(const t of i)this.#Ri(t,e);const o=[];let r;for(const e of n.contentSequence)if(this.#mi(e)){const t=this.#Fi(e);void 0!==t&&o.push(t)}else this.#pi(e)&&(r=e.value);const a=new Gs;return a.annotationGroups=i,a.responseEvaluations=o,a.comment=r,a}#Mi(e){const t=new ba(Ia);t.relationshipType=ma,t.conceptNameCode=ei(Yn);const n=new Ir;n.referencedSOPClassUID=e.referencedSopClassUID,n.referencedSOPInstanceUID=e.referencedSopInstanceUID;const i=new Or;return i.referencedSOPSequence=n,void 0!==e.referencedFrameNumber&&(i.referencedFrameNumber=e.referencedFrameNumber.toString()),t.value=i,t}#qi(e){const t=[],n=new ba(fa);n.relationshipType=ga,n.conceptNameCode=ei(Vn),n.value=e.trackingId,t.push(n);const i=new ba(ya);if(i.relationshipType=ga,i.conceptNameCode=ei(Qn),i.value=e.trackingUid,t.push(i),void 0!==e.textExpr&&0!==e.textExpr.length){const n=new ba(fa);if(n.relationshipType=pa,n.conceptNameCode=ei($n),n.value=e.textExpr,void 0!==e.labelPosition){const t=new ba(wa);t.relationshipType=ha,t.conceptNameCode=ei(Xn);const i=new ea;i.graphicType=jr;const o=[e.labelPosition.getX().toString(),e.labelPosition.getY().toString()];i.graphicData=o,t.value=i;const r=this.#Mi(e);t.contentSequence=[r],n.contentSequence=[t]}t.push(n)}const o=new ba(fa);if(o.relationshipType=pa,o.conceptNameCode=ii(),o.value=e.colour,t.push(o),void 0!==e.referencePoints){const n=new ba(wa);n.relationshipType=pa,n.conceptNameCode=ei(Xn);const i=new ea;i.graphicType=Zr;const o=[];for(const t of e.referencePoints)o.push(t.getX().toString()),o.push(t.getY().toString());i.graphicData=o,n.value=i;const r=this.#Mi(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.planePoints){const n=new ba(Ta);n.relationshipType=da,n.conceptNameCode=ei(Kn);const i=new la;i.graphicType=Zr;const o=[];for(const t of e.planePoints)o.push(t.getX().toString()),o.push(t.getY().toString()),o.push(t.getZ().toString());i.graphicData=o,n.value=i;const r=this.#Mi(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.quantification)for(const n in e.quantification){const i=Ra(n,h(e.quantification[n].value,12),e.quantification[n].unit);void 0!==i&&t.push(i)}const r=e.getMetaConceptIds();for(const n of r){const i=e.getMetaItem(n);let o=fa;i.value instanceof Tn&&(o=Ca);const r=new ba(o);r.relationshipType=da,r.conceptNameCode=i.concept,r.value=i.value,t.push(r)}return t}#Ui(e){const t=new ba(La);t.relationshipType=da,t.conceptNameCode=ei(Wn),t.value=Pa;const n=new ba(wa);n.relationshipType=da,n.conceptNameCode=ei(bn),n.value=na(e.mathShape);const i=this.#Mi(e);return n.contentSequence=[i],t.contentSequence=[n].concat(this.#qi(e)),t}#Vi(e){let t;if(0!==e.getList().length){const n=new ba(La);n.conceptNameCode=ei(Zn),n.relationshipType=da,n.value=Pa;const i=[];for(const t of e.getList())i.push(this.#Ui(t));n.contentSequence=i,t=new ba(La),t.conceptNameCode=ei(jn),t.value=Pa,t.contentSequence=[n]}return t}toDicom(e,t){let n=e.getMeta();n.TransferSyntaxUID="1.2.840.10008.1.2.1",n.SOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",n.MediaStorageSOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",n.CompletionFlag="PARTIAL",n.VerificationFlag="UNVERIFIED";const i=new Date;n.ContentDate=Oi(Pi(i)),n.ContentTime=bi(Ai(i));const o=n.CurrentRequestedProcedureEvidenceSequence.value[0].ReferencedSeriesSequence.value[0];let r=o.ReferencedSOPSequence;void 0===r&&(o.ReferencedSOPSequence={value:[]},r=o.ReferencedSOPSequence);const a=r.value;for(const t of e.getList()){const e={ReferencedSOPInstanceUID:t.referencedSopInstanceUID,ReferencedSOPClassUID:t.referencedSopClassUID},n=function(t){return t.ReferencedSOPInstanceUID===e.ReferencedSOPInstanceUID&&t.ReferencedSOPClassUID===e.ReferencedSOPClassUID};void 0===a.find(n)&&a.push(e)}n.ContentTemplateSequence={value:[{MappingResource:"DCMR",TemplateIdentifier:"1500"}]};const s=this.#Vi(e);if(void 0===s)throw new Error("No annotation group SR content");return n={...n,...Ea(s)},void 0!==t&&Ri(n,t),Fi(n)}#Ni(e){const t=new ba(Ca);t.relationshipType=Sa,t.conceptNameCode=ei(xn),t.value=ei(En),t.contentSequence=[];const n=new ba(fa);n.relationshipType=ga,n.conceptNameCode=ei(Vn),n.value=e.trackingId,t.contentSequence.push(n);const i=new ba(ya);if(i.relationshipType=ga,i.conceptNameCode=ei(Qn),i.value=e.trackingUid,t.contentSequence.push(i),void 0!==e.quantification)for(const n in e.quantification){const i=Ra(n,h(e.quantification[n].value,12),e.quantification[n].unit,ha);if(void 0!==i){const n=new ba(wa);n.relationshipType=Sa,n.conceptNameCode=ei(Gn),n.value=na(e.mathShape);const o=this.#Mi(e);n.contentSequence=[o],i.contentSequence=[n],t.contentSequence.push(i)}}const o=e.getMetaConceptIds();for(const n of o){const i=e.getMetaItem(n);let o=fa;i.value instanceof Tn&&(o=Ca);const r=new ba(o);r.relationshipType=da,r.conceptNameCode=i.concept,r.value=i.value,t.contentSequence.push(r)}return t}#Qi(e,t){if(0!==e.getList().length)for(const n of e.getList())t.push(this.#Ni(n))}#Bi(e){const t=new ba(La);t.relationshipType=ha,t.conceptNameCode=ei(Mn),t.value=Pa,t.contentSequence=[];const n=new ba(Ca);if(n.relationshipType=ga,n.conceptNameCode=ei(qn),n.value=ei(Un),t.contentSequence.push(n),void 0!==e){if(void 0!==e.current){const n=new ba(Ca);n.relationshipType=da,n.conceptNameCode=ei(Bn),n.value=e.current,t.contentSequence.push(n)}if(void 0!==e.measure){const n=new ba(va);n.relationshipType=da,n.conceptNameCode=ei(Nn);const i=new Sr;i.numericValue=e.measure,i.measurementUnitsCode=ai("unit.mm");const o=new vr;o.measuredValue=i,n.value=o,t.contentSequence.push(n)}}return t}#Fi(e){let t,n,i;for(const i of e.contentSequence)this.#fi(i)?t=i.value:this.#vi(i)&&(n=i.value.measuredValue.numericValue);return void 0!==t&&(i=new ks,i.current=t,void 0!==n&&(i.measure=n)),i}toDicomCADReport(e,t){let n=e.annotationGroups[0].getMeta();n.TransferSyntaxUID="1.2.840.10008.1.2.1",n.SOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",n.MediaStorageSOPClassUID="1.2.840.10008.5.1.4.1.1.88.34",n.CompletionFlag="PARTIAL",n.VerificationFlag="UNVERIFIED";const i=new Date;n.ContentDate=Oi(Pi(i)),n.ContentTime=bi(Ai(i));const o=n.CurrentRequestedProcedureEvidenceSequence.value[0].ReferencedSeriesSequence.value[0];let r=o.ReferencedSOPSequence;void 0===r&&(o.ReferencedSOPSequence={value:[]},r=o.ReferencedSOPSequence);const a=r.value;for(const t of e.annotationGroups)for(const e of t.getList()){const t={ReferencedSOPInstanceUID:e.referencedSopInstanceUID,ReferencedSOPClassUID:e.referencedSopClassUID},n=function(e){return e.ReferencedSOPInstanceUID===t.ReferencedSOPInstanceUID&&e.ReferencedSOPClassUID===t.ReferencedSOPClassUID};void 0===a.find(n)&&a.push(t)}n.ContentTemplateSequence={value:[{MappingResource:"DCMR",TemplateIdentifier:"4100"}]};const s=new ba(Ca);s.relationshipType=da,s.conceptNameCode=ei(On),s.value=ei(Rn),s.contentSequence=[];for(const t of e.responseEvaluations){const e=this.#Bi(t);s.contentSequence.push(e)}for(const t of e.annotationGroups)this.#Qi(t,s.contentSequence);if(void 0!==e.comment){const t=new ba(fa);t.relationshipType=da,t.conceptNameCode=ei(zn),t.value=e.comment,s.contentSequence.push(t)}const l=new ba(La);if(l.conceptNameCode=ei(Fn),l.value=Pa,l.contentSequence.push(s),void 0===l)throw new Error("No annotation group SR content");return n={...n,...Ea(l)},void 0!==t&&Ri(n,t),Fi(n)}}const Hs="30060084";class Ys{type;points3D}class Xs{number;name;colour;generationAlgorithm;interpretedType;roiInterpreter;contours}function Ws(e){const t={},n={},i=ue(e,"30060020");if(void 0!==i)for(const e of i){const i=ce(e,"30060022"),o=ce(e,"30060026"),r=ce(e,"30060036");void 0!==i&&(t[i]=o??`ROI ${i}`,n[i]=r)}const o={},r=ue(e,"30060080");if(void 0!==r)for(const e of r){const t=ce(e,Hs);void 0!==t&&(o[t]={interpretedType:ce(e,"300600A4"),roiInterpreter:ce(e,"300600A6")})}const a=[],l=ue(e,"30060039");if(void 0===l)return a;for(const e of l){const i=ce(e,Hs),r=ue(e,"3006002A"),l=ue(e,"0062000D");let c;void 0!==r&&3===r.length?c={r:parseInt(r[0],10),g:parseInt(r[1],10),b:parseInt(r[2],10)}:void 0!==l&&3===l.length?c=$t(Yt({l:l[0],a:l[1],b:l[2]})):(s.warn("No recommended colour for contour, using default"),c=Kt(i));const u=[],d=ue(e,"30060040");if(void 0!==d)for(const e of d){const t=ce(e,"30060042"),n=ue(e,"30060050");if(void 0===n)continue;const i=new Ys;i.type=t??"CLOSED_PLANAR",i.points3D=n.map(e=>parseFloat(e)),u.push(i)}const h=new Xs;h.number=void 0!==i?parseInt(i,10):0,h.name=t[h.number]??`ROI ${h.number}`,h.generationAlgorithm=n[h.number],h.interpretedType=o[h.number]?.interpretedType,h.roiInterpreter=o[h.number]?.roiInterpreter,h.colour=c,h.contours=u,a.push(h)}return a}const $s={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyInstanceUID:"0020000D",StudyID:"00200010",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052"},js=[{name:"TransferSyntaxUID",enum:[te]},{name:"MediaStorageSOPClassUID",enum:["1.2.840.10008.5.1.4.1.1.481.3"]},{name:"SOPClassUID",enum:["1.2.840.10008.5.1.4.1.1.481.3"]},{name:"Modality",enum:["RTSTRUCT"]},{name:"StructureSetLabel",enum:["RT Structure Set"]}];function Zs(){const e={};for(const t of js)e[t.name]=t.enum[0];return e}const Ks=[[-1,0],[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1]],_s={};for(let e=0;e<8;e++)_s[`${Ks[e][0]},${Ks[e][1]}`]=e;function Js(e,t,n,i,o,r,a){const s=[r];for(a[r]=1;s.length>0;){const r=s.shift(),l=r%n,c=r/n|0,u=[l>0?r-1:-1,l<n-1?r+1:-1,c>0?r-n:-1,c<i-1?r+n:-1,l>0&&c>0?r-n-1:-1,l<n-1&&c>0?r-n+1:-1,l>0&&c<i-1?r+n-1:-1,l<n-1&&c<i-1?r+n+1:-1];for(const n of u)-1===n||a[n]||e[t+n]!==o||(a[n]=1,s.push(n))}}function el(e,t,n,i,o,r,a){const s=[{x:r,y:a}];let l=r,c=a-1,u=r,d=a;const h=n*i*2+1;for(let g=0;g<h;g++){const h=_s[`${l-u},${c-d}`];let g=-1,S=-1,m=l,p=c;for(let r=1;r<=8;r++){const a=(h+r)%8,s=u+Ks[a][0],l=d+Ks[a][1];if(s>=0&&s<n&&l>=0&&l<i&&e[t+l*n+s]===o){g=s,S=l;const e=(h+r-1)%8;m=u+Ks[e][0],p=d+Ks[e][1];break}}if(-1===g)break;if(l=m,c=p,u=g,d=S,u===r&&d===a)break;s.push({x:u,y:d})}return s}function tl(e,t,n,i,o){const r=n*i,a=new Uint8Array(r),s=[];for(let l=0;l<r;l++)if(e[t+l]===o&&!a[l]){const r=l%n,c=l/n|0;Js(e,t,n,i,o,l,a);const u=el(e,t,n,i,o,r,c);u.length>=3&&s.push(u)}return s}function nl(e,t,n){const i=n.x-t.x,o=n.y-t.y;if(0===i&&0===o)return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2);const r=((e.x-t.x)*i+(e.y-t.y)*o)/(i*i+o*o);return Math.sqrt((e.x-t.x-r*i)**2+(e.y-t.y-r*o)**2)}function il(e,t){if(e.length<=3)return e;const n=[e[0]];return function n(i,o,r){if(o<=i+1)return;let a=0,s=i;for(let t=i+1;t<o;t++){const n=nl(e[t],e[i],e[o]);n>a&&(a=n,s=t)}a>t&&(n(i,s,r),r.push(e[s]),n(s,o,r))}(0,e.length-1,n),n.push(e[e.length-1]),n}function ol(e,t,n,i,o,r){const a=o.filter(e=>e.length>=3);if(0===a.length)return;const s=a.flatMap(e=>e.map(e=>e.y)),l=Math.max(0,Math.floor(Math.min(...s))),c=Math.min(i-1,Math.ceil(Math.max(...s)));for(let i=l;i<=c;++i){const o=[];for(const e of a){const t=e.length;for(let n=0;n<t;++n){const r=e[n],a=e[(n+1)%t];(i<c?r.y<=i&&a.y>i||a.y<=i&&r.y>i:r.y!==a.y&&(r.y<=i&&a.y>=i||a.y<=i&&r.y>=i))&&o.push(r.x+(i-r.y)/(a.y-r.y)*(a.x-r.x))}}o.sort((e,t)=>e-t);for(let a=0;a+1<o.length;a+=2){const s=Math.max(0,Math.ceil(o[a])),l=Math.min(n-1,Math.floor(o[a+1]));for(let o=s;o<=l;++o)e[t+i*n+o]=r}}}function rl(e,t,n,i,o){const r=n*i,a=function(e,t,n,i,o){const r=new Uint8Array(n*i),a=[];function s(n){r[n]||e[t+n]===o||(r[n]=1,a.push(n))}for(let e=0;e<n;++e)s(e),s((i-1)*n+e);for(let e=0;e<i;++e)s(e*n),s(e*n+n-1);for(;a.length>0;){const e=a.shift(),t=e%n,o=e/n|0;t>0&&s(e-1),t<n-1&&s(e+1),o>0&&s(e-n),o<i-1&&s(e+n),t>0&&o>0&&s(e-n-1),t<n-1&&o>0&&s(e-n+1),t>0&&o<i-1&&s(e+n-1),t<n-1&&o<i-1&&s(e+n+1)}return r}(e,t,n,i,o),s=new Uint8Array(r);let l=!1;for(let n=0;n<r;++n)e[t+n]===o||a[n]||(s[n]=1,l=!0);return l?tl(s,0,n,i,1):[]}class al{#_t;getWarning(){return this.#_t}checkElements(e){return this.#_t=void 0,this.#_t}create(e,t){const n=Ws(e),i=t.getGeometry(),o=i.getSize(),r=o.get(0),s=o.get(1),l=o.get(2),c=r*s,u=new Qo(i),d=[],h=[0],g=[0],S=[0];for(let e=0;e<n.length;++e){const t=n[e],o=e+1,a=new ki(o,t.name,t.generationAlgorithm??"MANUAL");a.interpretedType=t.interpretedType,a.roiInterpreter=t.roiInterpreter,a.displayRGBValue=new Bt(t.colour.r,t.colour.g,t.colour.b),d.push(a),h[o]=t.colour.r,g[o]=t.colour.g,S[o]=t.colour.b;const m=new Map;for(const e of t.contours){if("CLOSED_PLANAR"!==e.type&&"CLOSEDPLANAR_XOR"!==e.type)continue;const t=e.points3D;if(t.length<9)continue;const n=[];for(let e=0;e<t.length;e+=3){const o=i.worldToPoint(new C([t[e],t[e+1],t[e+2]]));n.push({x:o.getX(),y:o.getY(),z:o.getZ()})}const o=Math.round(n[0].z);o<0||o>=l||(m.has(o)||m.set(o,[]),m.get(o).push(n))}for(const[e,t]of m){const n=new Uint8Array(c);ol(n,0,r,s,t,1),u.addFrame(o,n,0,e,c,o)}}const m=[];for(let e=0;e<l;++e)m.push(t.getImageUid(new a([0,0,e])));const p=new ko(i,u.getLabelMap(),m,u);p.setPhotometricInterpretation("PALETTE COLOR"),p.setPaletteColourMap(new Yo(h,g,S));const f=t=>ce(e,t),v={Modality:"RTSTRUCT"};for(const e of Object.keys($s)){const t=f($s[e]);void 0!==t&&(v[e]=t)}v.custom={segments:d,referencedSeriesUID:at(e)};const y=t.getMeta();return void 0!==y.lengthUnit&&(v.lengthUnit=y.lengthUnit),p.setMeta(v),p}toDicom(e,t,n,i){const o=Zs(),r=e.getMeta();for(const e of Object.keys($s)){const t=r[e];void 0!==t&&(o[e]=t)}if(void 0===t&&(t=r.custom?.segments??[]),void 0!==n){const e=n.getMeta();o.StudyInstanceUID=e.StudyInstanceUID,o.ReferencedFrameOfReferenceSequence={value:[{FrameOfReferenceUID:o.FrameOfReferenceUID??"",RTReferencedStudySequence:{value:[{ReferencedSOPInstanceUID:e.StudyInstanceUID??"",RTReferencedSeriesSequence:{value:[{SeriesInstanceUID:e.SeriesInstanceUID??""}]}}]}}]}}const l=new Date;o.StructureSetDate=Oi(Pi(l)),o.StructureSetTime=bi(Ai(l));const c=e.getGeometry(),u=c.getSize(),d=u.get(0),h=u.get(1),g=u.get(2),S=d*h,m=e.getBuffer(),p=e.getHasOverlap(),f=p?e.getSegmentCollection()?.getAll():void 0,v=[],C=[],y=[];for(const e of t){const t=e.number,n=e.displayRGBValue??{r:255,g:0,b:0};v.push({ROINumber:t,ROIName:e.label,ReferencedFrameOfReferenceUID:o.FrameOfReferenceUID??"",ROIGenerationAlgorithm:e.algorithmType??"MANUAL"}),y.push({ObservationNumber:t,ReferencedROINumber:t,RTROIInterpretedType:e.interpretedType??"ORGAN",ROIInterpreter:e.roiInterpreter??""});const i=[],r=f?.get(t);for(let e=0;e<g;e++){const n=p&&r?.has(e),o=n?r.get(e):m,l=n?0:e*S,u=tl(o,l,d,h,t),g=u.length>0?rl(o,l,d,h,t):[],f=u.concat(g),v=g.length>0?"CLOSEDPLANAR_XOR":"CLOSED_PLANAR";for(const t of f){const n=il(t,1);if(n.length<3){s.warn("Saving RT Struct with thin contour, not well supported");continue}const o=[];for(const t of n){const n=c.indexToWorld(new a([t.x,t.y,e]));o.push(n.get(0),n.get(1),n.get(2))}i.push({ContourGeometricType:v,NumberOfContourPoints:n.length,ContourData:o})}}C.push({ReferencedROINumber:t,ROIDisplayColor:[n.r,n.g,n.b],ContourSequence:{value:i}})}return o.StructureSetROISequence={value:v},o.ROIContourSequence={value:C},o.RTROIObservationsSequence={value:y},void 0!==i&&Ri(o,i),Fi(o)}}const sl=["dataadd","dataremove","dataimageset","dataupdate"];function ll(e,t,n){let i;return i=void 0!==t["00020010"]?"00200013":"imageUid",function(e,t,n,i,o=()=>{}){const r={};if(!n)throw new Error(`Cannot merge object with an undefined id key: ${n}`);if(void 0===e[n])throw new Error(`Id key not found in first object while merging: ${n}, obj: ${e}`);if(void 0===t[n])throw new Error(`Id key not found in second object while merging: ${n}, obj: ${t}`);if(!i)throw new Error(`Cannot merge object with an undefined value key: ${i}`);if(void 0===e[n][i])throw new Error(`Id value not found in first object while merging: ${n}, valueKey: ${i}, ojb: ${e}`);if(void 0===t[n][i])throw new Error(`Id value not found in second object while merging: ${n}, valueKey: ${i}, ojb: ${t}`);const a=void 0!==e.mergeId,s=function(e){const t=o(e);return void 0!==t?`-${t}`:""},l=t[n][i][0]+s(t);let c;if(a){if(e.mergeId.includes(l))throw new Error(`The first object already contains id2: ${l}, id1: ${e.mergeId}`);c=e.mergeId,r.mergeId=[...e.mergeId,l]}else{if(c=e[n][i][0]+s(e),c===l)throw new Error(`Cannot merge object with same ids: ${c}, id2: ${l}`);r.mergeId=[c,l]}const u=Object.keys(e).filter(e=>"mergeId"!==e),d=[...new Set([...u,...Object.keys(t)])];for(const n of d){const o=e[n];let s;void 0!==o&&(s=o[i]);const u=t[n];let d,h;if(void 0!==u&&(d=u[i]),void 0!==o?h={...o}:void 0!==u&&(h={...u}),!O(s,d))if(a){if(Array.isArray(s)){h[i]={};for(let e=0;e<c.length;++e)h[i][c[e]]=s}else h[i]={...s};h[i][l]=d}else h[i]={[c]:s,[l]:d};r[n]=h}return r}(e,t,i,"value",n)}class cl{meta;image;annotationGroup;buffer;numberOfItems;frameNumber;warn=[];#ki=!1;constructor(e){this.meta=e}getComplete(){let e;return void 0!==this.image&&(e=this.image.getComplete()),e}setComplete(e){void 0!==this.image&&this.image.setComplete(e)}hasDuplicateOrigin(){return this.#ki}appendData(e){if(!this.#ki){let t=!0;if(void 0!==e.frameNumber&&void 0!==this.image){const n=ce(e.meta,"00080018");t=!this.image.includesImageUid(n)}void 0!==this.image&&void 0!==e.image&&this.#Gi(e.image),t&&this.#zi(e.meta)}}#Gi(e){const t=e.getGeometry();this.image.getGeometry().canAppendOrigin(t.getOrigin(),t.getInitialTime()?.value).success||(this.#ki=!0),this.#ki||this.image.appendSlice(e)}#zi(e){this.meta=ll(this.meta,e,yo)}}class ul{#Ue=[];addClone(e){const t=["7FE00010","7FE00009","7FE00008"],n={};for(const i of Object.keys(e.meta))t.includes(i)||(n[i]=e.meta[i]);const i=new cl(structuredClone(n));i.image=e.image.clone(),i.frameNumber=e.frameNumber,this.add(i)}add(e){this.#Ue.push(e)}buildData(){const e=this.#Hi(),t=this.#Yi(e);if(void 0===t)throw new Error("Non constant number of slices per volumes");if(0===t)throw new Error("Duplicate origins but no volumes");if(1===t)throw new Error("Duplicate origins but just one slice per volume");const{volsIndices:n,volumeIds:i,volumeIndexGetter:o}=this.#Xi(e);if(void 0===n)throw new Error("Cannot create image for multi-volume");let r,a;for(let e=0;e<n.length;++e){const t=n[e],s=this.#Ue[t[0]],l=void 0!==s.frameNumber?Ii(s.meta,s.frameNumber):s.meta;a=void 0===a?l:ll(a,l,o);for(const n of t){const t=this.#Ue[n].image;t.getGeometry().setInitialTime(i[e]),void 0===r?r=t:r.appendSlice(t)}}return{image:r,meta:a}}#Xi(e){const t=[];for(let n=0;n<e.length;++n)for(const i of e[n].indices)t[i]=n;const n=To(this.#Ue.map(e=>void 0!==e.frameNumber?Ii(e.meta,e.frameNumber):e.meta),t,e.length);if(void 0===n)return{volsIndices:void 0,volumeIds:void 0,volumeIndexGetter:void 0};const i=[],o=[];for(const t of e)for(const e of t.indices){const t=n.volumeIndices[e];void 0===i[t]&&(i[t]=[],o[t]=n.volumeIds[e]),i[t].push(e)}return{volsIndices:i,volumeIds:o,volumeIndexGetter:n.getter}}#Yi(e){if(0===e.length)return 0;const t=e[0].count;for(const n of e)if(n.count!==t)return;return t}#Hi(){const e=new Map;for(let t=0;t<this.#Ue.length;++t){const n=this.#Ue[t].image.getGeometry().getOrigin(),i=n.toString();let o=e.get(i);void 0===o&&(o={pos:n,indices:[],count:0},e.set(i,o)),++o.count,o.indices.push(t)}return[...e.values()]}}class dl extends EventTarget{#Wi={};#$i={};#ji={};#Zi=-1;constructor(){super()}getNextDataId(){return++this.#Zi,this.#Zi.toString()}getDataIds(){return Object.keys(this.#Wi)}reset(){this.#Wi={},this.#$i={},this.#ji={}}get(e){return this.#Wi[e]}getDataIdsFromSopUids(e){const t=[];if(void 0===e||0===e.length)return t;const n=Object.keys(this.#Wi);for(const i of n)void 0!==this.#Wi[i].image&&this.#Wi[i].image.containsImageUids(e)&&t.push(i);return t}getDataIdFromSeriesUid(e){let t;const n=Object.keys(this.#Wi);for(const i of n){const n=this.#Wi[i].image;if(void 0!==n&&e===n.getMeta().SeriesInstanceUID){t=i;break}}return t}setImage(e,t){this.#Wi[e].image=t;for(const n of Ut)t.addEventListener(n,this.#Ki(e));this.dispatchEvent(new CustomEvent("dataimageset",{detail:{value:[t],dataid:e}}))}#_i(e){const t=ce(e.meta,"00080060");let n;if(H(e.meta))if("SEG"===t){const t=rt(e.meta);if(void 0===t)throw new Error("Cannot create mask image: the DICOM seg does not have a referenced series UID");const i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create mask image: the DICOM seg referenced series is not loaded");n=new Ko,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,this.#Wi[i].image))}else n=new sr,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,e.numberOfItems,e.frameNumber));else if("SR"===t)n=new zs,void 0===n.checkElements(e.meta)&&(e.annotationGroup=n.create(e.meta));else if("RTSTRUCT"===t){const t=at(e.meta),i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create RT struct: referenced series is not loaded");n=new al,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,this.#Wi[i].image))}void 0!==n&&void 0!==n.getWarning()&&e.warn.push(n.getWarning())}add(e,t){if(void 0===e||void 0!==this.#Wi[e])return!1;if(this.#Wi[e]=t,void 0===t.image&&void 0===t.annotationGroup&&(this.#_i(t),void 0!==t.numberOfItems&&t.numberOfItems>1&&(this.#$i[e]=new ul,this.#$i[e].addClone(t))),void 0!==t.image)for(const n of Ut)t.image.addEventListener(n,this.#Ki(e));if(void 0!==t.annotationGroup)for(const n of Nt)t.annotationGroup.addEventListener(n,this.#Ki(e));return this.dispatchEvent(new CustomEvent("dataadd",{detail:{dataid:e}})),!0}remove(e){if(void 0!==this.#Wi[e]){const t=this.#Wi[e].image;if(void 0!==t)for(const n of Ut)t.removeEventListener(n,this.#Ki(e));const n=this.#Wi[e].annotationGroup;if(void 0!==n)for(const t of Nt)n.removeEventListener(t,this.#Ki(e));delete this.#Wi[e],delete this.#$i[e],this.dispatchEvent(new CustomEvent("dataremove",{detail:{dataid:e}}))}}stash(e){void 0!==this.#Wi[e]&&(this.#ji[e]=this.#Wi[e],this.remove(e))}unstash(e){void 0!==this.#ji[e]&&(this.add(e,this.#ji[e]),delete this.#ji[e])}getStashedDataIds(){return Object.keys(this.#ji)}getStashed(e){return this.#ji[e]}update(e,t){if(void 0===this.#Wi[e])throw new Error(`Cannot find data to update: ${e}`);const n=this.#Wi[e];this.#_i(t),void 0!==this.#$i[e]&&this.#$i[e].add(t),n.hasDuplicateOrigin()||n.appendData(t),this.dispatchEvent(new CustomEvent("dataupdate",{detail:{dataid:e}}))}markDataAsComplete(e){const t=this.#Wi[e];if(void 0===t)throw new Error(`Cannot find data to mark as complete: ${e}`);const n={imageHasChanged:!1};if(void 0!==this.#$i[e]&&t.hasDuplicateOrigin()){const i=this.#$i[e].buildData();this.setImage(e,i.image),t.meta=i.meta,n.imageHasChanged=!0}else if(void 0!==t.image){const e=t.image.getGeometry().checkTimeOrigins();if(!e.success)throw new Error(`Inconsistent volumes: ${e.message}`)}return delete this.#$i[e],t.setComplete(!0),n}#Ki(e){return t=>{const n=Object.assign({},t.detail,{dataid:e});this.dispatchEvent(new CustomEvent(t.type,{detail:n}))}}}class hl{#Ji;setOptions(e){this.#Ji=e}#eo;#to=[];#no=[];#io=[];#oo=!1;#ro(e,t,n,i){const o=this.#to[e].getDicomElements(),r=new cl(o);r.buffer=n,r.numberOfItems=this.#Ji.numberOfItems,r.frameNumber=i,this.onloaditem({data:r,source:t})}#ao(e,t){const n=this.#to[e].getDicomElements();return t>1&&"SEG"!==ce(n,"00080060")}#so(e,t){this.#oo||(this.onprogress({lengthComputable:!0,loaded:100,total:100,index:e,source:t}),this.onload({source:t}),this.onloadend({source:t}))}#lo(e){this.#eo=new Cn(e),this.#eo.ondecodeditem=e=>{this.#co(e)},this.#eo.onerror=this.onerror,this.#eo.onabort=this.onabort}#uo(e){const t=this.#to[e].getDicomElements(),n={missing:[]},i=ce(t,"00280100");void 0!==i?n.bitsAllocated=i:n.missing.push("bitsAllocated");const o=ce(t,"00280103");if(void 0!==o)n.isSigned=1===o;else{const e=ce(t,"7FE00008"),i=ce(t,"7FE00009");void 0!==e||void 0!==i?n.isSigned=!0:n.missing.push("pixelRepresentation")}const r=ce(t,"00280011"),a=ce(t,"00280010");void 0!==r&&void 0!==a?n.sliceSize=r*a:(void 0===r&&n.missing.push("columns"),void 0===a&&n.missing.push("rows"));const s=ce(t,"00280002");if(void 0!==s){if(n.samplesPerPixel=s,1!==s){const e=ce(t,"00280006");void 0!==e?n.planarConfiguration=e:n.missing.push("planarConfiguration")}}else n.missing.push("samplesPerPixel");return n}#do(e,t,n){const i=this.#uo(e);if(0!==i.missing.length)return this.#eo.abort(),this.onerror({error:new Error(`Missing tags to decompress data:${i.missing.toString()}`),source:t}),void this.onloadend({source:t});const o=n.length;for(let r=0;r<o;++r)this.#eo.decode(n[r],i,{itemNumber:r,numberOfItems:o,index:e,indexOrigin:t})}#co(e){if(this.#oo)return;const t=e.index,n=e.indexOrigin;++this.#no[t];const i=this.#no[t];this.onprogress({lengthComputable:!0,loaded:i,total:e.numberOfItems,index:e.index,source:n});const o=e.data[0];if(this.#ao(t,e.numberOfItems))this.#ro(t,n,o,e.itemNumber);else if(1===e.numberOfItems)this.#ro(t,n,o);else{if(void 0===this.#io[t]){const i=e.numberOfItems*o.length;try{this.#io[t]=new o.constructor(i)}catch(e){if(e instanceof RangeError){const e=Math.floor(Math.log(i)/Math.log(2));s.error(`Cannot allocate ${o.constructor.name} of size: ${i} (>2^${e}) for decompressed data.`)}return this.#eo.abort(),this.onerror({error:e,source:n}),void this.onloadend({source:n})}}this.#io[t].set(o,o.length*e.itemNumber),i===e.numberOfItems&&(this.#ro(t,n,this.#io[t]),this.#io[t]=void 0)}i===e.numberOfItems&&(this.onload(e),this.onloadend(e))}convert(e,t,n){this.#oo=!1,this.onloadstart({source:t,index:n});const i=new Ue;void 0!==this.#Ji.defaultCharacterSet&&i.setDefaultCharacterSet(this.#Ji.defaultCharacterSet);try{i.parse(e)}catch(e){return this.onerror({error:e,source:t}),void this.onloadend({source:t})}this.#to[n]=i;const o=i.getDicomElements(),r=z(o);if(void 0!==r){const e=r.value,i=function(e){let t;return Ae(e)?t="jpeg2000":Le(e)?t="jpeg-baseline":Pe(e)?t="jpeg-lossless":Oe(e)&&(t="rle"),t}(ce(o,"00020010"));if(void 0!==i)void 0===this.#eo&&this.#lo(i),this.#no[n]=0,this.#io[n]=void 0,this.#do(n,t,e);else{const i=e[0];let r=parseInt(ce(o,"00280008"),10);if(isNaN(r)&&(r=1),this.#ao(n,r)){const e=i.length/r;for(let o=0;o<r&&!this.#oo;++o)this.#ro(n,t,i.subarray(o*e,(o+1)*e),o)}else this.#ro(n,t,i);this.#so(n,t)}}else this.#ro(n,t),this.#so(n,t)}abort(){this.#oo=!0,void 0!==this.#eo?this.#eo.abort():this.onabort({})}onloadstart(e){}onloaditem(e){}onprogress(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class gl extends gn{#Ji={};#ho=!1;getOptions(){return this.#Ji}setOptions(e){this.#Ji=e}isLoading(){return this.#ho}setLoading(e){this.#ho=e}canLoadFile(e){if(void 0!==e.type&&this.canLoadMediaType(e.type))return!0;const t=w(e.name);return this.canLoadExtension(t)}canLoadUrl(e,t){if(void 0!==t){if(void 0!==t.forceLoader&&this.isLoaderName(t.forceLoader))return!0;if(void 0!==t.requestHeaders){const e=t.requestHeaders.find(e=>"Accept"===e.name);if(void 0!==e)return e.value.split(",").map(e=>e.split(";")[0].trim()).some(e=>this.canLoadMediaType(e))}}const n=function(e){let t;return"null"!==window.location.origin&&(t=window.location.origin),new URL(e,t)}(e),i=w(n.pathname),o=this.canLoadExtension(i),r=n.searchParams.get("contentType"),a=null!=r,s=a?r.split(";")[0].trim():void 0,l=a&&this.canLoadMediaType(s);return a?l:o}canLoadMemory(e){const t=e["Content-Type"];if(void 0!==t){const e=t.split(";")[0].trim();if(this.canLoadMediaType(e))return!0}if(void 0!==e.filename){const t=new File(["from memory"],e.filename);return this.canLoadFile(t)}return!1}isLoaderName(e){return!1}canLoadExtension(e){return!1}canLoadMediaType(e){return!1}}class Sl extends gl{#go=new hl;load(e,t,n){this.isLoading()||(this.#go.setOptions(this.getOptions()),this.#go.onloadstart=this.onloadstart,this.#go.onprogress=this.onprogress,this.#go.onloaditem=this.onloaditem,this.#go.onload=this.onload,this.#go.onloadend=e=>{this.setLoading(!1),this.onloadend(e)},this.#go.onerror=e=>{e.source=t,this.onerror(e)},this.#go.onabort=this.onabort),this.setLoading(!0),this.#go.convert(e,t,n)}abort(){this.setLoading(!1),this.#go.abort()}canLoadExtension(e){return void 0===e||"dcm"===e}isLoaderName(e){return"dicom"===e}canLoadMediaType(e){return"application/dicom"===e}loadFileAs(){return Ll.ArrayBuffer}loadUrlAs(){return 1}}class ml extends gn{#ct=null;#dt=null;#ht=0;#gt=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#mt(e){this.#ct=e,this.#ht=0,this.#gt=0,this.#ft()}#Ct(e){this.#dt=e}#ft(){this.#dt=null}#yt=e=>{this.#ht++,this.#ht===this.#ct.length&&this.onload({source:this.#ct})};#Dt=e=>{this.#gt++,this.#gt===this.#ct.length&&this.onloadend({source:this.#ct})};load(e){if(void 0===e||0===e.length)return;this.#mt(e),this.onloadstart({source:e});const t=new hn(this.onprogress);t.setNToLoad(e.length),t.setNumberOfDimensions(1);const n=Tl(),i=[];for(let e=0;e<n.length;++e)i.push(new n[e]);let o=e[0],r=null,a=!1;for(let n=0;n<i.length;++n)if(r=i[n],r.canLoadMemory(o)){a=!0,r.setOptions({numberOfItems:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=t.getUndefinedMonoProgressHandler(0),r.onloaditem=this.onloaditem,r.onload=this.#yt,r.onloadend=this.#Dt,r.onerror=this.onerror,r.onabort=this.onabort,this.#Ct(r);break}if(!a)throw new Error(`No loader found for data: ${o.filename}`);for(let t=0;t<e.length;++t){if(o=e[t],!r.canLoadMemory(o))throw new Error(`Input data of different type: ${o.filename}`);r.load(o.data,o.filename,t)}}abort(){this.#dt&&this.#dt.isLoading()&&this.#dt.abort()}}class pl extends gl{#So=0;#mo=0;#po=[];load(e,t,n){0===this.#mo&&(this.#So=this.getOptions().numberOfItems??1,this.#po=[],this.setLoading(!0),this.onloadstart({source:t}));const i=function(e){const t=new Uint8Array(e),n=[];if(0===t.length)return n;const i=E(new Uint8Array([13,10,13,10]));let o=x(t,i,0);if(void 0===o)throw new Error("Can't find the end of the first multipart header");const r=b(t.slice(0,o)).split("\r\n");let a;for(let e=0;e<r.length;++e)if("-"===r[e][0]&&"-"===r[e][1]){a=r[e];break}if(void 0===a)throw new Error("Can't find the boundary between multi-parts");const s=E(T(a)),l=a.length;let c=x(t,s,0);for(;void 0!==o;){const e={},r=b(t.slice(c+l,o)).split("\r\n");for(let t=0;t<r.length;++t){const n=r[t],i=n.indexOf(":");if(-1!==i){const t=n.substring(0,i).trim(),o=n.substring(i+1).trim();e[t]=o}}if(c=x(t,s,o),void 0===c)break;const a=o+4,u=c-2;e.data=a<u?t.slice(a,u).buffer:new Uint8Array,n.push(e),o=x(t,i,c+l)}return n}(e);if(this.#po.push(...i),this.#mo++,this.#mo<this.#So)return;const o=new ml;o.onprogress=e=>{e.loaded=50+e.loaded/2,e.index=n,this.onprogress(e)},o.onloaditem=this.onloaditem,o.onload=e=>{for(let t=0;t<this.#So;t++)this.onload(e)},o.onloadend=e=>{this.setLoading(!1),this.#mo=0;const t=this.#So;for(let n=0;n<t;n++)this.onloadend(e)},o.onerror=this.onerror,o.onabort=this.onabort,o.load(this.#po)}abort(){this.setLoading(!1),this.#mo=0,this.onabort({}),this.onloadend({})}isLoaderName(e){return"multipart"===e}canLoadMediaType(e){return"multipart/related"===e}loadFileAs(){return Ll.ArrayBuffer}loadUrlAs(){return 1}}function fl(e){return parseInt(e,36).toString()}function vl(e){const t=e.data.length,n=new Uint8Array(t/4*3);let i=0;for(let o=0;o<t;o+=4)n[i]=e.data[o],n[i+1]=e.data[o+1],n[i+2]=e.data[o+2],i+=3;return n}function Cl(e,t,n,i,o,r){const a=new St([e,t,1]),s=new Ze([1,1,1]),l=new m(0,0,n),c=new Ct([l],a,s),u=new Vt(c,i,[r]);u.setPhotometricInterpretation("RGB");const d={BitsStored:8};return void 0!==o&&(d.sliceCapacity=o),u.setMeta(d),u}class yl extends gl{#fo(e,t){let n=t;n&&"jpg"!==n||(n="jpeg");const i=new Blob([e],{type:`image/${n}`});return window.URL.createObjectURL(i)}load(e,t,n){this.setLoading(!0);const i=new Image;if(i.onload=()=>{try{if(this.isLoading()){this.onprogress({lengthComputable:!0,loaded:100,total:100,index:n,source:t});const e=function(e,t,n){const i=e.width,o=e.height,r=document.createElement("canvas");r.width=i,r.height=o;const a=r.getContext("2d");a.drawImage(e,0,0);const s=a.getImageData(0,0,i,o),l={};let c;"string"==typeof t?(l.origin={value:[t]},c=fl(t)):(l.fileName={value:[t.name]},c=fl(t.name),l.fileType={value:[t.type]},l.fileLastModifiedDate={value:[t.lastModified]}),l.imageWidth={value:[i]},l.imageHeight={value:[o]};const u=n||0;l.imageUid={value:[u]},l.seriesUid={value:[c]};const d=Cl(i,o,u,vl(s),1,u.toString()),h=d.getMeta();h.SeriesInstanceUID=c,d.setMeta(h);const g=new cl(l);return g.image=d,{data:g,source:t}}(i,t,n);this.onloaditem(e),this.onload(e)}}catch(e){this.onerror({error:e,source:t})}finally{this.onloadend({source:t})}},"string"==typeof e)i.src=e;else if("string"==typeof t){const n=t.split(".").pop().toLowerCase();i.src=this.#fo(e,n)}}abort(){this.setLoading(!1),this.onabort({}),this.onloadend({})}canLoadExtension(e){return"jpeg"===e||"jpg"===e||"png"===e||"gif"===e}isLoaderName(e){return"rawimage"===e}canLoadMediaType(e){return e.startsWith("image/")}loadFileAs(){return Ll.DataURL}loadUrlAs(){return 1}}class Dl extends gl{#fo(e,t){const n=new Uint8Array(e);let i="";for(let e=0;e<n.byteLength;++e)i+=String.fromCharCode(n[e]);return`data:video/${t};base64,${window.btoa(i)}`}load(e,t,n){this.setLoading(!0);const i=document.createElement("video");if("string"==typeof t){const n=t.split(".").pop().toLowerCase();i.src=this.#fo(e,n)}else i.src=e;i.onloadedmetadata=e=>{try{this.isLoading()&&function(e,t,n,i,o,r,a){const s=e.videoWidth,l=e.videoHeight,c=Math.ceil(30*e.duration),u={};let d;"string"==typeof r?(u.origin={value:[r]},d=fl(r)):(u.fileName={value:[r.name]},d=fl(r.name),u.fileType={value:[r.type]},u.fileLastModifiedDate={value:[r.lastModified]}),u.imageWidth={value:[s]},u.imageHeight={value:[l]},u.numberOfFrames={value:[c]},u.imageUid={value:[0]},u.seriesUid={value:[d]};const h=document.createElement("canvas");h.width=s,h.height=l;const g=h.getContext("2d");e.addEventListener("seeked",function h(f){(function(){i({lengthComputable:!0,loaded:S,total:c,index:a,source:r}),g.drawImage(e,0,0);const n=vl(g.getImageData(0,0,s,l));if(0===S){m=Cl(s,l,1,n,c,a.toString());const e=m.getMeta();e.SeriesInstanceUID=d,m.setMeta(e);const i=new cl(u);i.image=m,t({data:i,source:r})}else m.appendFrameBuffer(n,S);++S})(),p+=1/30,p<=f.target.duration?this.currentTime=p:(n({source:r}),o({source:r}),e.removeEventListener("seeked",h))},!1);let S=0,m=null,p=0;e.currentTime=p}(e.target,this.onloaditem,this.onload,this.onprogress,this.onloadend,t,n)}catch(e){this.onerror({error:e,source:t}),this.onloadend({source:t})}}}abort(){this.setLoading(!1),this.onabort({}),this.onloadend({})}canLoadExtension(e){return"mp4"===e||"ogg"===e||"webm"===e}isLoaderName(e){return"rawvideo"===e}canLoadMediaType(e){return e.startsWith("video/")}loadFileAs(){return Ll.DataURL}loadUrlAs(){return 1}}class Il extends gl{#vo="";#Co=[];#yo=null;#Do(e,t,n){this.#Co.push({filename:this.#vo,data:e});const i=100*this.#Co.length/this.#yo.length;if(this.onprogress({lengthComputable:!0,loaded:i/2,total:100,index:n,item:{loaded:i,total:100,source:t}}),this.#Co.length<this.#yo.length){const e=this.#Co.length;this.#vo=this.#yo[e].name,this.#yo[e].async("arrayBuffer").then(e=>{this.#Do(e,t,n)}).catch(e=>{this.setLoading(!1),this.onerror({error:e}),this.onloadend({})})}else{const e=new ml;e.onprogress=e=>{e.loaded=50+e.loaded/2,e.index=n,this.onprogress(e)},e.onloaditem=this.onloaditem,e.onload=this.onload,e.onloadend=e=>{this.setLoading(!1),this.onloadend(e)},e.onerror=this.onerror,e.onabort=this.onabort,e.load(this.#Co)}}load(e,n,i){this.onloadstart({source:n}),this.setLoading(!0),t.loadAsync(e).then(e=>{if(this.#Co=[],this.#yo=e.file(/.*\.dcm/),0===this.#yo.length)return this.setLoading(!1),this.onerror({error:new Error("No DICOM file found in ZIP")}),void this.onloadend({});this.#vo=this.#yo[0].name,this.#yo[0].async("arrayBuffer").then(e=>{this.#Do(e,n,i)}).catch(e=>{this.setLoading(!1),this.onerror({error:e}),this.onloadend({})})}).catch(e=>{this.setLoading(!1),this.onerror({error:e}),this.onloadend({})})}abort(){this.setLoading(!1),this.onabort({}),this.onloadend({})}canLoadExtension(e){return"zip"===e}isLoaderName(e){return"zip"===e}canLoadMediaType(e){return"application/zip"===e}loadFileAs(){return Ll.ArrayBuffer}loadUrlAs(){return 1}}let wl=null;function Tl(){return null===wl&&(wl=[Sl,pl,yl,Dl,Il]),wl}const Ll={Text:0,ArrayBuffer:1,DataURL:2};class Pl extends gn{#ct=null;#Io=[];#dt=null;#ht=0;#gt=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#mt(e){this.#ct=e,this.#ht=0,this.#gt=0,this.#wo(),this.#ft()}#To(e){this.#Io.push(e)}#wo(){this.#Io=[]}#Ct(e){this.#dt=e}#ft(){this.#dt=null}#yt=e=>{this.#ht++,this.#ht===this.#ct.length&&this.onload({source:this.#ct})};#Dt=e=>{this.#gt++,this.#gt===this.#ct.length&&this.onloadend({source:this.#ct})};#It(e,t){return n=>{n.source=t,e(n)}}#Lt(e,t,n){return i=>{e.load(i.target.result,t,n)}}load(e){if(void 0===e||0===e.length)return;this.#mt(e),this.onloadstart({source:e});const t=new hn(this.onprogress);t.setNToLoad(e.length);const n=Tl(),i=[];for(let e=0;e<n.length;++e)i.push(new n[e]);let o=e[0],r=null,a=!1;for(let n=0;n<i.length;++n)if(r=i[n],r.canLoadFile(o)){a=!0,r.setOptions({numberOfItems:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=t.getUndefinedMonoProgressHandler(1),r.onloaditem=this.onloaditem,r.onload=this.#yt,r.onloadend=this.#Dt,r.onerror=this.onerror,r.onabort=this.onabort,this.#Ct(r);break}if(!a)throw new Error(`No loader found for file: ${o.name}`);for(let n=0;n<e.length;++n){if(o=e[n],!r.canLoadFile(o))throw new Error(`Input file of different type: ${o}`);const i=new FileReader;this.#To(i),i.onprogress=this.#It(t.getMonoProgressHandler(n,0),o),i.onload=this.#Lt(r,o,n);const a=this.#It(this.onerror,o);i.onerror=e=>{this.#Dt(),a(e)};const s=this.#It(this.onabort,o);i.onabort=e=>{this.#Dt(),s(e)},r.loadFileAs()===Ll.Text?i.readAsText(o):r.loadFileAs()===Ll.DataURL?i.readAsDataURL(o):r.loadFileAs()===Ll.ArrayBuffer&&i.readAsArrayBuffer(o)}}abort(){for(let e=0;e<this.#Io.length;++e)1===this.#Io[e].readyState&&this.#Io[e].abort();this.#dt&&this.#dt.isLoading()&&this.#dt.abort()}}const Al=["loadstart","loadprogress","loaditem","load","loadend","error","abort","timeout"];class Ol extends EventTarget{#f;#Lo={};constructor(e){super(),this.#f=e}loadFiles(e,t){this.#Po(e,t)}loadURLs(e,t,n){this.#Ao(e,t,n)}loadImageObject(e,t){const n=new ml;this.#Oo(e,n,t)}getLoadingDataIds(){return Object.keys(this.#Lo)}abort(e){void 0!==this.#Lo[e]&&(this.#Lo[e].loader.abort(),delete this.#Lo[e])}#Po(e,t){const n=new Pl;n.setDefaultCharacterSet(this.#f),this.#Oo(e,n,t)}#Ao(e,t,n){const i=new Sn;i.setDefaultCharacterSet(this.#f),this.#Oo(e,i,t,n)}#Oo(e,t,n,i){const o={dataid:n};t.onloadstart=e=>{this.#Lo[n]={loader:t,isFirstItem:!0},this.#Ki("loadstart",o)(e)},t.onprogress=this.#Ki("loadprogress",o),t.onloaditem=e=>{const t={dataid:n};void 0!==this.#Lo[n]&&(t.isfirstitem=this.#Lo[n].isFirstItem),this.#Ki("loaditem",t)(e),void 0!==this.#Lo[n]&&this.#Lo[n].isFirstItem&&(this.#Lo[n].isFirstItem=!1)},t.onload=this.#Ki("load",o),t.onloadend=e=>{delete this.#Lo[n],this.#Ki("loadend",o)(e)},t.onerror=this.#Ki("error",o),t.onabort=this.#Ki("abort",o),void 0!==t.ontimeout&&(t.ontimeout=this.#Ki("timeout",o));try{t.load(e,i)}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{dataid:n,error:e}})),this.dispatchEvent(new CustomEvent("loadend",{detail:{dataid:n}}))}}#Ki(e,t){return n=>{const i=Object.assign({},n,t);this.dispatchEvent(new CustomEvent(e,{detail:i}))}}}const bl=["undoadd","undoremove","undo","redo"];class xl extends EventTarget{#bo=new ls;constructor(){super(),this.#xo()}addToUndoStack=e=>{this.#bo.add(e)};removeFromUndoStack=e=>this.#bo.remove(e);undo(){this.#bo.undo()}redo(){this.#bo.redo()}getStackSize(){return this.#bo.getStackSize()}getCurrentStackIndex(){return this.#bo.getCurrentStackIndex()}reset(){this.#bo=new ls,this.#xo()}#xo(){for(const e of bl)this.#bo.addEventListener(e,t=>{const n=Object.assign({},t.detail);this.dispatchEvent(new CustomEvent(e,{detail:n}))})}}class El{tags;event;pos;format;precision;value}function Rl(e){return function(t){return Number(t).toPrecision(e)}}function Fl(e){let t="";for(let n=0;n<e;++n)0!==n&&(t+=", "),t+=`{v${n}}`;return t}function Ml(e,t){let n=e;for(let e=0;e<t.length;++e)n=n.replace(`{v${e}}`,t[e]);return n}class ql extends EventTarget{#Cn;#vn;#Eo;#Ro=[];#Fo;#Mo={};#qo;constructor(e,t,n){super(),this.#Cn=e,this.#vn=t,this.#Eo=n;const i=Object.keys(this.#Eo);for(let e=0;e<i.length;++e){const t=this.#Eo[i[e]];for(const e of t){const t=e.event;void 0!==t&&(this.#Ro.includes(t)||this.#Ro.push(t))}}this.addAppListeners()}reset(){this.#Mo={},this.#qo=void 0}addItemMeta(e){let t;void 0!==e["00020010"]?void 0!==e["00080018"]?(t=e["00080018"].value[0],void 0===this.#Mo[t]&&(this.#Mo[t]=function(e,t){const n=[];let i;const o=e["00080060"];if(void 0===o)return n;i=o.value[0];const r=t[i]||t["*"];if(!r)return n;for(const t of r){const i=JSON.parse(JSON.stringify(t)),o=i.tags;if(void 0!==o&&0!==o.length){const t=[];for(const n of o){const i=e[n];if(void 0!==i)if("DA"===i.vr){const e=Li(wi(i));void 0!==e&&t.push(e.toLocaleDateString())}else if("TM"===i.vr){const e=Li({year:1900,monthIndex:0,day:1},Ti(i));void 0!==e&&t.push(e.toLocaleTimeString())}else t.push(i.value);else t.push("undefined")}void 0!==i.format&&null!==i.format||(i.format=Fl(t.length)),i.value=Ml(i.format,t).trim()}n.push(i)}const a=e["00200020"];if(void 0!==a&&2===a.value.length){const e=a.value[0],t=a.value[1];n.push({pos:"cr",value:e,format:"{v0}"}),n.push({pos:"cl",value:Ie(e),format:"{v0}"}),n.push({pos:"bc",value:t,format:"{v0}"}),n.push({pos:"tc",value:Ie(t),format:"{v0}"})}return n}(e,this.#Eo))):s.warn("Missing DICOM SOP instance UID for info data indexing"):void 0!==e.imageUid?(t=e.imageUid.value[0],this.#Mo[t]=function(e,t){const n=[],i=t.DOM;if(!i)return n;for(const t of i){const i=JSON.parse(JSON.stringify(t)),o=i.tags;if(void 0!==o&&0!==o.length){const t=[];for(const n of o){const i=e[n];void 0!==i&&t.push(i.value)}void 0!==i.format&&null!==i.format||(i.format=Fl(t.length)),i.value=Ml(i.format,t).trim()}n.push(i)}return n}(e,this.#Eo)):s.warn("Missing DOM image UID for info data indexing"),void 0!==t&&(this.#qo=t)}onSliceChange=e=>{s.debug("InfoData.onSliceChange: deprecated since v0.37, please use onPositionChange."),this.onPositionChange(e)};onPositionChange=e=>{const t=e.detail?.dataid;if(t!==this.#vn)return;let n=!1;const i=e.detail?.data;void 0!==i&&void 0!==i.imageUid&&this.#qo!==i.imageUid&&(this.#qo=i.imageUid,n=!0),(n||this.#Ro.includes(e.type))&&this.#Uo(e)};#Uo=e=>{const t=e.detail?.dataid;if(void 0!==t&&t!==this.#vn)return;const n=this.#Mo[this.#qo];if(void 0!==n){for(const t of n){let n;if(void 0!==t.tags)"positionchange"===e.type&&(n=t.value);else if(void 0!==t.event&&t.event===e.type){const i=t.format;let o=e.detail?.value;if(void 0!==t.precision){let e;e="round"===t.precision?Math.round:Rl(parseInt(t.precision,10)),o=o.map(e)}n=Ml(i,o)}void 0!==n&&(t.value=n)}this.dispatchEvent(new CustomEvent("valuechange",{detail:{data:n}}))}else console.warn(`No slice info data for: ${this.#qo}`)};isListening(){return this.#Fo}addAppListeners(){this.#Cn.addEventListener("positionchange",this.onPositionChange);for(const e of this.#Ro)"positionchange"!==e&&this.#Cn.addEventListener(e,this.#Uo);this.#Fo=!0}removeAppListeners(){this.#Cn.removeEventListener("positionchange",this.onPositionChange);for(const e of this.#Ro)"positionchange"!==e&&this.#Cn.removeEventListener(e,this.#Uo);this.#Fo=!1}}function Ul(e,t){let n;if(t)n=e.getActiveViewLayer();else{const t=function(e){return e.getViewController().isMonochrome()};n=e.getViewLayersFromActive(t)[0]}return n}function Vl(e){let t=e.getActiveViewLayer();if(void 0===t){const n=e.getActiveDrawLayer();if(void 0===n)return;t=e.getViewLayerById(n.getReferenceLayerId())}return t}class Nl{onWheel(e,t){}onWheelTick(e,t){}}class Ql extends Nl{onWheelTick(e,t){const n=t.getPositionHelper();t.canScroll()?e?n.incrementPositionAlongScroll():n.decrementPositionAlongScroll():t.moreThanOne(3)&&(e?n.incrementPosition(3):n.decrementPosition(3))}}class Bl extends Nl{onWheel(e,t){if(void 0===t)return;const n=-e.deltaY/500,i=cn(e),o=Vl(t);if(void 0===o)return void s.warn("No view layer to do wheel zoom behavior");const r=o.getViewController(),a=o.displayToMainPlanePos(i),l=r.getPlanePositionFromPlanePoint(a);t.addScale(n,l),t.draw()}}function kl(e){return Number.isInteger(e)&&e>0&&e<=16}class Gl{#pe;#Vo;#No;#Qo;constructor(e,t){if(this.#pe=e,this.#Vo=e.isID(),kl(t)&&(this.#No=Math.pow(2,t)),!this.#Vo){if(void 0===this.#No)throw new Error(`Cannot create modality LUT for bits stored: ${t}`);this.#Qo=new Float32Array(this.#No);for(let e=0;e<this.#No;++e)this.#Qo[e]=this.#pe.apply(e)}}getRSI(){return this.#pe}getLength(){return this.#No}getValue(e){return this.#Vo?e:this.#Qo[e]}}class zl{#Bo;#ko;#Qo;#Go=0;#zo=!0;constructor(e,t,n){if(this.#Bo=e,n&&void 0===this.#Bo.getLength())throw new Error("Cannot create window LUT without LUT length");const i=this.#Bo.getLength();this.#Go=t&&void 0!==i?i/2:0,this.#zo=n}getVoiLut(){return this.#ko}getModalityLut(){return this.#Bo}setVoiLut(e){if(this.#ko=e,this.#ko.setSignedOffset(this.#Bo.getRSI().getSlope()*this.#Go),this.#zo){const e=this.#Bo.getLength();this.#Qo=new Uint8ClampedArray(e);for(let t=0;t<e;++t)this.#Qo[t]=this.#ko.apply(this.#Bo.getValue(t))}}getValue(e){return this.#zo?this.#Qo[e+this.#Go]:Math.floor(this.#ko.apply(e+this.#Go))}}const Hl={CT:{mediastinum:new bt(40,400),lung:new bt(-500,1500),bone:new bt(500,2e3),brain:new bt(40,80),head:new bt(90,350)}};class Yl{create(e,t){const n=new jl(t);"MONOCHROME1"===t.getPhotometricInterpretation()&&n.setColourMap("invPlain");let i={};void 0!==t.getMeta().windowPresets&&(i=t.getMeta().windowPresets),i.minmax=new er("minmax");const o=t.getMeta().Modality;let r;r=void 0!==Ne.wlPresets&&void 0!==Ne.wlPresets[o]?Ne.wlPresets[o]:Hl[o];for(const e in r){const t=r[e];i[e]=new er(e,[new bt(t.center,t.width)])}return n.setWindowPresets(i),n}}class Xl{#Ho=[];#Yo(e){return this.#Ho.indexOf(e)}isHidden(e){return-1!==this.#Yo(e)}addToHidden(e){this.isHidden(e)?s.warn(`Not hidding segment, it is allready in the hidden list: ${e}`):this.#Ho.push(e)}removeFromHidden(e){const t=this.#Yo(e);-1!==t?this.#Ho.splice(t,1):s.warn(`Cannot remove segment, it is not in the hidden list: ${e}`)}}const Wl=["wlchange","wlpresetadd","colourmapchange","positionchange","opacitychange","alphafuncchange","maskviewchange"];function $l(e,t){return(new Yl).create(e,t)}class jl extends EventTarget{#Xo;#Wo;#Ce;#$o;#jo={minmax:new er("minmax")};#Zo;#Ko;#_o="plain";#Jo;#H;#er=.33;#tr=1;#nr;#ir=function(e,t){return 255};#or=(e,t)=>{if(0===e||this.#rr.isHidden(e))return 0;let n=this.#ar(t);return void 0!==this.#sr&&e===this.#sr.segmentNumber&&(n*=this.#sr.opacity),n};#ar(e){return 0!==this.getContourThickness()&&this.#Xo.getContour().getDistance(e,this.getOrientation())<=this.getContourThickness()?255:255*this.getFillOpacity()}#sr;#rr;constructor(e){super(),this.setImage(e)}getImage(){return this.#Xo}setImage(e){this.#Xo=e;const t=e.getMeta().windowPresets;if(void 0!==t)for(const e of Object.keys(t))this.#jo[e]=t[e];void 0===this.getCurrentPosition()&&this.setCurrentIndex(e.getInitialIndex(),!0),this.isMask()?(this.#rr=new Xl,this.#nr=this.#or):(this.#nr=this.#ir,this.#Xo.addEventListener("appendframe",()=>{const e=this.getCurrentIndex();if(3===e.length()){const t=e.getValues();t.push(0),this.setCurrentIndex(new a(t),!0)}}))}isMask(){return this.#Xo instanceof ko}setMaskViewHelper(e){this.#rr=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}getSegmentHighlight(){return this.#sr}setSegmentHighlight(e,t){void 0===e?this.#sr=void 0:(void 0===t&&(t=1),this.#sr={segmentNumber:e,opacity:Math.min(Math.max(t,0),1)}),this.dispatchEvent(new CustomEvent("segmenthighlightchange"))}getOrientation(){return this.#H}setOrientation(e){this.#H=e}getFillOpacity(){return this.#er}setFillOpacity(e){this.#er=e>1?1:e<0?0:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#er,this.#tr]}}))}getContourThickness(){return this.#tr}setContourThickness(e){this.#tr=e<0?0:e>10?10:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#er,this.#tr]}}))}getPlaybackMilliseconds(e){return e||(e=10),Math.round(1e3/e)}getAlphaFunction(){return this.#nr}setAlphaFunction(e){this.#nr=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}#lr(){const e=this.#Xo.getBuffer();return e instanceof Float32Array||e instanceof Float64Array}#cr(){return!this.#lr()&&kl(this.#Xo.getMeta().BitsStored)}#ur(){if(void 0!==this.#Zo&&void 0!==this.#jo[this.#Zo]&&void 0!==this.#jo[this.#Zo].perslice&&!0===this.#jo[this.#Zo].perslice&&!this.#Xo.isResampled()){const e=this.getCurrentIndex();if(void 0===e)throw new Error("Cannot get window lut with no current index");const t=this.#Xo.getSecondaryOffset(e),n=this.#jo[this.#Zo].wl[t];void 0!==n&&this.setWindowLevel(n,this.#Zo,!0)}if(void 0===this.#Ko&&this.setWindowLevelPresetById(0,!0),void 0===this.#Ce||this.#Xo.isConstantRSI()!==this.#Ce||this.#cr()!==this.#$o){let e,t;this.#Ce=this.#Xo.isConstantRSI(),this.#$o=this.#cr(),this.#Ce&&this.#$o?(e=this.#Xo.getRescaleSlopeAndIntercept(),t=!0):(e=new Ve(1,0),t=!1);const n=new Gl(e,this.#Xo.getMeta().BitsStored);this.#Wo=new zl(n,!this.#lr()&&1===this.#Xo.getMeta().PixelRepresentation,t)}const e=this.#Wo.getVoiLut();let t;if(void 0!==e&&(t=e.getWindowLevel()),void 0===e||!xt(this.#Ko,t)){const e=new Ot(this.#Ko,this.#Xo.getMeta().VOILUTFunction);this.#Wo.setVoiLut(e)}return this.#Wo}getWindowPresets(){return this.#jo}getWindowPresetsNames(){return Object.keys(this.#jo)}setWindowPresets(e){this.#jo=e}addWindowPresets(e){const t=Object.keys(e);for(const n of t)if(void 0!==this.#jo[n]){if(void 0!==this.#jo[n].perslice&&!0===this.#jo[n].perslice)throw new Error("Cannot add perslice preset");this.#jo[n]=e[n]}else this.#jo[n]=e[n],this.dispatchEvent(new CustomEvent("wlpresetadd",{detail:{name:n}}))}getCurrentWindowPresetName(){return this.#Zo}getColourMap(){return this.#_o}#dr(){return Xo[this.#_o]}setColourMap(e){if(!Xo[e])throw new Error(`Unknown colour map: '${e}'`);this.#_o=e,this.dispatchEvent(new CustomEvent("colourmapchange",{detail:{value:[e]}}))}getCurrentPosition(){return this.#Jo}getCurrentIndex(){const e=this.getCurrentPosition();if(void 0!==e)return this.getImage().getGeometry().worldToIndex(e)}getCurrentImageUid(){return this.#Xo.getImageUid(this.getCurrentIndex())}getOriginForImageUid(e){return this.#Xo.getOriginForImageUid(e)}includesImageUid(e){return this.#Xo.includesImageUid(e)}isPositionInBounds(e){void 0===e&&(e=this.#Jo);const t=this.#Xo.getGeometry(),n=t.worldToIndex(e),i=[this.getScrollDimIndex()];return 4===n.length()&&i.push(3),t.isIndexInBounds(n,i)}getOrigin(e){const t=this.#Xo.getGeometry();let n=0;return void 0!==e&&(n=t.worldToIndex(e).get(2)),t.getOrigins()[n]}setCurrentIndex(e,t){const n=this.#Xo.getGeometry().indexToWorld(e);return this.setCurrentPosition(n,t)}setCurrentPosition(e,t){void 0===t&&(t=!1);const n=this.#Xo.getGeometry(),i=n.getSize().normalisePoint(e,this.#Jo),o=n.worldToIndex(i),r=[this.getScrollDimIndex()];if(4===o.length()&&r.push(3),!n.isIndexInBounds(o,r))return this.#Jo=i,t||this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:[o.getValues(),e.getValues()],valid:!1}})),!1;let a=[];const s=this.getCurrentIndex();if(void 0!==s)if(s.canCompare(o))a=s.compare(o);else{const e=Math.min(s.length(),o.length());for(let t=0;t<e;++t)s.get(t)!==o.get(t)&&a.push(t);const t=Math.max(s.length(),o.length());for(let n=e;n<t;++n)a.push(n)}else for(let e=0;e<o.length();++e)a.push(e);if(this.#Jo=i,!t){const t=[o.getValues(),e.getValues()];if(this.#Xo.canQuantify()){const e=this.#Xo.getRescaledValueAtIndex(o);t.push(e)}this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:t,diffDims:a,data:{imageUid:this.#Xo.getImageUid(o)}}}))}return!0}setWindowLevel(e,t,n){if(void 0===t&&(t="manual"),"manual"!==t&&void 0===this.#jo[t])throw new Error(`Unknown window level preset: '${t}'`);void 0===n&&(n=!1);const i=Et(e,this.#Xo.getRescaledDataRange(),this.#Xo.getMeta().VOILUTFunction),o=!xt(i,this.#Ko),r=this.#Zo!==t;(o||r)&&(this.#Ko=i,this.#Zo=t,"manual"===t&&(void 0!==this.#jo[t]?this.#jo[t].wl[0]=i:this.addWindowPresets({manual:new er("manual",[i])})),this.dispatchEvent(new CustomEvent("wlchange",{detail:{value:[i.center,i.width,t],wc:i.center,ww:i.width,skipGenerate:n}})))}getWindowLevel(){return this.#ur().getVoiLut().getWindowLevel()}setWindowLevelPreset(e,t){const n=this.getWindowPresets()[e];if(void 0===n)throw new Error(`Unknown window level preset: '${e}'`);"minmax"===e&&void 0===n.wl&&(n.wl=[this.getWindowLevelMinMax()]);let i=n.wl[0];if(void 0!==n.perslice&&!0===n.perslice&&!this.#Xo.isResampled()){const e=this.#Xo.getSecondaryOffset(this.getCurrentIndex());i=n.wl[e]}void 0!==i&&this.setWindowLevel(i,e,t)}setWindowLevelPresetById(e,t){const n=Object.keys(this.getWindowPresets());this.setWindowLevelPreset(n[e],t)}getWindowLevelMinMax(){const e=this.getImage().getRescaledDataRange(),t=e.max-e.min,n=e.min+t/2;return Et(new bt(n,t),e,this.#Xo.getMeta().VOILUTFunction)}setWindowLevelMinMax(){const e=this.getWindowLevelMinMax();this.setWindowLevel(e,"minmax")}generateImageData(e,t){if(void 0===t&&void 0===(t=this.getCurrentIndex()))throw new Error("Cannot generate image data with no current index");const n=this.getImage(),i=!n.isConstantRSI()||!this.#cr(),o=Ro(n,t,i,this.getOrientation()),r=n.getPhotometricInterpretation();switch(r){case"MONOCHROME1":case"MONOCHROME2":!function(e,t,n,i,o){let r,a=0,s=t.next();for(;!s.done;)r=i.getValue(s.value),e.data[a]=o.red[r],e.data[a+1]=o.green[r],e.data[a+2]=o.blue[r],e.data[a+3]=n(s.value,s.index),a+=4,s=t.next()}(e,o,this.getAlphaFunction(),this.#ur(),this.#dr());break;case"PALETTE COLOR":n instanceof ko&&n.getHasOverlap()?function(e,t,n,i,o,r,a,s,l,c){const u=i.getAll(),d=Math.round(255*l),h=s>0?i.getOrBuildUnionContour(c,r):null;let g=0,S=t.next();for(;!S.done;){const i=S.index;if(0===S.value)e.data[g]=0,e.data[g+1]=0,e.data[g+2]=0,e.data[g+3]=0;else{const t=Math.floor(i/o),r=i%o;let l=0,S=0,m=0,p=0;for(const[e,i]of u){if(c?.isHidden(e))continue;const o=i.get(t);void 0!==o&&0!==o[r]&&(l+=n.red[e],S+=n.green[e],m+=n.blue[e],++p)}if(0===p)e.data[g+3]=0;else{e.data[g]=Math.round(l/p),e.data[g+1]=Math.round(S/p),e.data[g+2]=Math.round(m/p);let t=d;null!==h&&h.getDistance(i,a)<=s&&(t=255),e.data[g+3]=t}}g+=4,S=t.next()}}(e,o,n.getPaletteColourMap(),n.getSegmentCollection(),n.getGeometry().getSize().getDimSize(2),n.getGeometry().getSize(),this.getOrientation(),this.getContourThickness(),this.getFillOpacity(),this.#rr):function(e,t,n,i,o){const r=function(e){return e>>8};o&&s.info("Scaling 16bits data to 8bits.");let a,l=0,c=t.next();for(;!c.done;)a=c.value,o?(e.data[l]=r(i.red[a]),e.data[l+1]=r(i.green[a]),e.data[l+2]=r(i.blue[a])):(e.data[l]=i.red[a],e.data[l+1]=i.green[a],e.data[l+2]=i.blue[a]),e.data[l+3]=n(a,c.index),l+=4,c=t.next()}(e,o,this.getAlphaFunction(),n.getPaletteColourMap(),16===n.getMeta().BitsStored);break;case"RGB":!function(e,t,n){let i=0,o=t.next();for(;!o.done;)e.data[i]=o.value[0],e.data[i+1]=o.value[1],e.data[i+2]=o.value[2],e.data[i+3]=n(o.value,o.index),i+=4,o=t.next()}(e,o,this.getAlphaFunction());break;case"YBR_FULL":!function(e,t,n){let i,o=0,r=t.next();for(;!r.done;)i=Gt(r.value[0],r.value[1],r.value[2]),e.data[o]=i.r,e.data[o+1]=i.g,e.data[o+2]=i.b,e.data[o+3]=n(r.value,r.index),o+=4,r=t.next()}(e,o,this.getAlphaFunction());break;default:throw new Error(`Unsupported photometric interpretation: ${r}`)}}getScrollDimIndex(){let e=2;const t=this.getOrientation();return void 0!==t&&(e=t.getThirdColMajorDirection()),e}isAquisitionOrientation(){return ke(this.#H)}}class Zl{#hr={};add(e,t){void 0===this.#hr[e]&&(this.#hr[e]=[]),this.#hr[e].push(t)}remove(e,t){if(void 0===this.#hr[e])return;let n=0;for(let i=0;i<this.#hr[e].length;++i)this.#hr[e][i]===t&&(++n,this.#hr[e].splice(i,1));0===n&&s.debug(`No callback found on remove listener for type ${e}`)}fireEvent=e=>{if(void 0===this.#hr[e.type])return;const t=this.#hr[e.type].slice();for(let n=0;n<t.length;++n)t[n](e)}}class Kl{#gr;#B;#Sr;#mr;#pr;constructor(e,t){this.#gr=e,this.#B=e.getRealSpacing(),this.#Sr=e.getOrientation(),this.#mr=t,this.#pr=function(e,t){let n=e.asOneAndZeros().multiply(t);return e.asOneAndZeros().getAbs().isSimilar(Ge().getAbs())&&(n=n.getAbs()),n}(this.#Sr,t)}getViewOrientation(){return this.#mr}getTargetOrientation(){return this.#pr}getOffset3DFromPlaneOffset(e){const t=new g(e.x,e.y,0),n=this.getTargetDeOrientedVector3D(t);return new g(n.getX()*this.#B.get(0),n.getY()*this.#B.get(1),n.getZ()*this.#B.get(2))}getPlaneOffsetFromOffset3D(e){const t=new g(e.x/this.#B.get(0),e.y/this.#B.get(1),e.z/this.#B.get(2)),n=this.getTargetOrientedVector3D(t);return{x:n.getX(),y:n.getY()}}getTargetOrientedVector3D(e){let t=e;return void 0!==this.#pr&&(t=this.#pr.getInverse().multiplyVector3D(e)),t}getTargetDeOrientedVector3D(e){let t=e;return void 0!==this.#pr&&(t=this.#pr.multiplyVector3D(e)),t}getTargetDeOrientedPoint3D(e){let t=e;return void 0!==this.#pr&&(t=this.#pr.multiplyPoint3D(e)),t}getImageOrientedVector3D(e){let t=e;if(void 0!==this.#mr){const n=Dt([e.getX(),e.getY(),e.getZ()],this.#mr);t=new g(n[0],n[1],n[2])}return t}getImageOrientedPoint3D(e){let t=e;if(void 0!==this.#mr){const n=Dt([e.getX(),e.getY(),e.getZ()],this.#mr);t=new m(n[0],n[1],n[2])}return t}getImageDeOrientedVector3D(e){let t=e;if(void 0!==this.#mr){const n=yt([e.getX(),e.getY(),e.getZ()],this.#mr);t=new g(n[0],n[1],n[2])}return t}getImageDeOrientedPoint3D(e){let t=e;if(void 0!==this.#mr){const n=yt([e.getX(),e.getY(),e.getZ()],this.#mr);t=new m(n[0],n[1],n[2])}return t}getPositionFromPlanePoint(e,t){const n=new m(e.getX(),e.getY(),t),i=this.getImageOrientedPoint3D(n);return this.#gr.pointToWorld(i)}getPlanePointFromPosition(e){const t=this.#gr.worldToPoint(e);return this.getImageDeOrientedPoint3D(t)}getCosines(){return[(e=this.#pr).get(0,0),e.get(1,0),e.get(2,0),e.get(0,1),e.get(1,1),e.get(2,1)];var e}getPlanePoints(e){const t=this.worldToIndex(e),n=this.indexToWorld(t),i=this.getPlanePointFromPosition(n),o=this.getPositionFromPlanePoint(new S(0,0),i.getZ()),r=this.#gr.getOrigins(),a=r[o.getClosest(r)],s=o.getValues(),l=a.getValues(),c=this.getNativeScrollDimIndex();s[c]=l[c];const u=this.getCosines();return[new m(s[0],s[1],s[2]),new m(u[0],u[1],u[2]),new m(u[3],u[4],u[5])]}worldToIndex(e){return this.#gr.worldToIndex(e)}indexToWorld(e){return this.#gr.indexToWorld(e)}isAquisitionOrientation(){return ke(this.#mr)}getTargetOrientedPositiveXYZ(e){const t=yt([e.x,e.y,e.z],this.#pr);return{x:t[0],y:t[1],z:t[2]}}getScrollDimIndex(){let e;return e=void 0!==this.#mr?this.#mr.getThirdColMajorDirection():2,e}getNativeScrollDimIndex(){let e;return e=void 0!==this.#Sr?this.#Sr.getThirdColMajorDirection():2,e}}class _l{#m;constructor(e){this.#m=e}getCurrentPosition(){return this.#m.getCurrentPosition()}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(n=this.#m.setCurrentPosition(e,t)),n}}class Jl{#fr;#ue;#Jo;#vr;constructor(e){this.#fr=new _l(e),this.#ue=e.getImage().getGeometry(),this.#Jo=e.getCurrentPosition(),this.#vr=e.getScrollDimIndex()}getGeometry(){return this.#ue}getScrollDimIndex(){return this.#vr}getMaximumDimValue(e){return this.#ue.getSize().get(e)-1}getMaximumScrollValue(){return this.getMaximumDimValue(this.#vr)}getCurrentPosition(){return this.#ue.getSize().normalisePoint(this.#fr.getCurrentPosition(),this.#Jo)}getCurrentPositionDimValue(e){return this.getCurrentIndex().get(e)}getCurrentPositionScrollValue(){return this.getCurrentPositionDimValue(this.#vr)}getCurrentPositionAtDimValue(e,t){const n=this.getCurrentIndex().getValues();return n[e]=t,this.#ue.indexToWorld(new a(n))}getCurrentPositionAtScrollValue(e){return this.getCurrentPositionAtDimValue(this.#vr,e)}getCurrentIndex(){return this.#ue.worldToIndex(this.getCurrentPosition())}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(this.#Jo=this.#ue.getSize().normalisePoint(e,this.#Jo),n=this.#fr.setCurrentPosition(e,t)),n}setCurrentPositionSafe(e,t){let n=!1;return this.isPositionInBounds(e)&&(n=this.setCurrentPosition(e,t)),n}merge(e){if(this.#vr!==e.getScrollDimIndex())throw new Error("Cannot merge helper of a view with different orientation");this.#ue=function(e,t){const n=e.getOrientation();if(!n.isSimilar(t.getOrientation(),pt))throw new Error("Cannot merge geometries with different orientation");const i=n.getInverse(),o=function(e,t){return P(e,t,Math.min)},r=function(e,t){return P(e,t,Math.max)},a=new Ze(o(e.getSpacing().getValues(),t.getSpacing().getValues())),s=function(e){return i.multiplyPoint3D(e.get3D())},l=e.getRange().map(s),c=t.getRange().map(s),u=o(l[0].getValues(),c[0].getValues()),d=r(l[1].getValues(),c[1].getValues());let h=[];for(let e=0;e<u.length;++e)h.push(Math.round(Math.abs(d[e]-u[e])/a.get(e)));const g=r(e.getSize().getValues(),t.getSize().getValues());h=h.concat(g.slice(3));const S=new St(h),p=[];for(let e=0;e<S.get(2);++e){const t=u.slice();t[2]=u[2]+e*a.get(2);const i=new m(t[0],t[1],t[2]);p.push(n.multiplyPoint3D(i))}return new Ct(p,S,a,n)}(this.#ue,e.getGeometry()),this.#Jo=this.#ue.getSize().normalisePoint(this.#Jo,e.getCurrentPosition())}isPositionInBounds(e){const t=this.#ue.worldToIndex(e),n=[this.#vr];return 4===t.length()&&n.push(3),this.#ue.isIndexInBounds(t,n)}getIncrementPosition(e){const t=this.getCurrentIndex().next(e);return this.#ue.indexToWorld(t)}getDecrementPosition(e){const t=this.getCurrentIndex().previous(e);return this.#ue.indexToWorld(t)}incrementPosition(e){return this.setCurrentPositionSafe(this.getIncrementPosition(e))}decrementPosition(e){return this.setCurrentPositionSafe(this.getDecrementPosition(e))}incrementPositionAlongScroll(){return this.incrementPosition(this.#vr)}decrementPositionAlongScroll(){return this.decrementPosition(this.#vr)}}class ec{#m;#Cr;#yr;constructor(e){if(void 0===e.getImage())throw new Error("View does not have an image, cannot setup controller");this.#m=e,this.#Cr=new Kl(e.getImage().getGeometry(),e.getOrientation())}getPlaneHelper(){return this.#Cr}updatePlaneHelper(){this.#Cr=new Kl(this.#m.getImage().getGeometry(),this.#m.getOrientation())}isMask(){return this.#m.isMask()}initialise(){this.resetWindowLevel(),this.resetPosition()}resetWindowLevel(){this.setWindowLevelPresetById(0)}resetPosition(){this.setCurrentPosition(this.getPositionFromPlanePoint(new S(0,0)))}getModality(){return this.#m.getImage().getMeta().Modality}getSopClassUid(){return this.#m.getImage().getMeta().SOPClassUID}getWindowLevelPresetsNames(){return this.#m.getWindowPresetsNames()}addWindowLevelPresets(e){return this.#m.addWindowPresets(e)}setWindowLevelPreset(e){this.#m.setWindowLevelPreset(e)}setWindowLevelPresetById(e){this.#m.setWindowLevelPresetById(e)}isPlaying(){return void 0!==this.#yr}getPositionHelper(){return new Jl(this.#m)}getCurrentPosition(){return this.#m.getCurrentPosition()}getCurrentIndex(){return this.#m.getCurrentIndex()}getCurrentImageUid(){return this.#m.getCurrentImageUid()}getOriginForImageUid(e){return this.#m.getOriginForImageUid(e)}includesImageUid(e){return this.#m.includesImageUid(e)}getCurrentOrientedIndex(){let e=this.getCurrentIndex();if(void 0!==this.#m.getOrientation()){const t=this.#Cr.getImageDeOrientedVector3D(new g(e.get(0),e.get(1),e.get(2)));e=new a([t.getX(),t.getY(),t.getZ()])}return e}getScrollDimIndex(){return this.#m.getScrollDimIndex()}getCurrentIndexScrollValue(){return this.getCurrentIndex().get(this.#m.getScrollDimIndex())}getOrigin(e){return this.#m.getOrigin(e)}isAquisitionOrientation(){return this.#m.isAquisitionOrientation()}getPlanePoints(e){return this.#Cr.getPlanePoints(e)}getCurrentScrollPosition(){const e=this.#m.getScrollDimIndex();return this.#m.getCurrentPosition().get(e)}generateImageData(e,t){this.#m.generateImageData(e,t)}setImage(e){const t=this.#m.getImage().getGeometry(),n=e.getGeometry();this.#m.setImage(e),t.equals(n)||this.updatePlaneHelper()}get2DSpacing(){return this.#m.getImage().getGeometry().getSpacing(this.#m.getOrientation()).get2D()}getRescaledImageValue(e){const t=this.#m.getImage();if(!t.canQuantify())return;const n=t.getGeometry(),i=n.worldToIndex(e);let o;return n.isIndexInBounds(i)&&(o=t.getRescaledValueAtIndex(i)),o}getSegmentNumbersAtPosition(e){const t=this.#m.getImage();if(!(t instanceof ko))return[];const n=t.getGeometry(),i=n.worldToIndex(e);return n.isIndexInBounds(i)?t.getSegmentNumbersAtIndex(i):[]}getPixelUnit(){return this.#m.getImage().getMeta().pixelUnit}getLengthUnit(){return this.#m.getImage().getMeta().lengthUnit}#Dr(e,t,n,i){const o=Eo(Ro(e,t,n,i)),r=e.getGeometry().getSize(i).getValues();r[2]=1;const a=new St(r),s=e.getGeometry().getSpacing(i).getValues();s[2]=1;const l=new Ze(s),c=new m(0,0,0),u=new Ct([c],a,l);return new Vt(u,o)}getImageRegionValues(e,t,n){let i=this.#m.getImage();const o=this.#m.getOrientation();let r=n,s=!0;ke(o)||(i=this.#Dr(i,r,s,o),r=new a([0,0,0]),s=!1);const l=function(e,t,n,i,o){if(1!==e.getNumberOfComponents())throw new Error(`Unsupported number of components for region iterator: ${e.getNumberOfComponents()}`);let r;void 0===n&&(n=!1),r=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const a=e.getGeometry().getSize();void 0===i&&(i=new S(0,0)),void 0===o&&(o=new S(a.get(0)-1,a.get(1)));const s=a.indexToOffset(t.getWithNew2D(i.getX(),i.getY())),l=a.indexToOffset(t.getWithNew2D(o.getX(),o.getY()-1)),c=Math.max(1,o.getX()-i.getX());return function(e,t,n,i,o,r){let a=t,s=0;return{next(){if(a<n){const t={value:e(a),done:!1,index:a};return s+=1,a+=1,s===o&&(s=0,a+=r),t}return{done:!0,index:n}}}}(r,s,l+1,0,c,a.get(0)-c)}(i,r,s,e,t);let c=[];return l&&(c=Eo(l)),c}getImageVariableRegionValues(e,t){let n=this.#m.getImage();const i=this.#m.getOrientation();let o=t,r=!0;ke(i)||(n=this.#Dr(n,o,r,i),o=new a([0,0,0]),r=!1);const s=function(e,t,n,i){if(1!==e.getNumberOfComponents())throw new Error(`Unsupported number of components for region iterator: ${e.getNumberOfComponents()}`);let o;void 0===n&&(n=!1),o=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const r=e.getGeometry().getSize(),a=[];let s,l=null,c=null,u=null;for(let e=0;e<i.length;++e){s=i[e];const t=s[1][0]-s[0][0];0!==t&&(u=e,l||(l=s[0]),a.push([s[0][0],t,r.get(0)-s[1][0]]))}if(null!==u&&(c=i[u][1]),0!==a.length)return function(e,t,n,i,o){let r=t,a=0,s=0;return{next(){if(r<n){const t={value:e(r),done:!1,index:r};return s+=1,r+=1,s===o[a][1]&&(s=0,r+=o[a][2],a+=1,a<o.length&&(r+=o[a][0])),t}return{done:!0,index:n}}}}(o,r.indexToOffset(t.getWithNew2D(l[0],l[1])),r.indexToOffset(t.getWithNew2D(c[0],c[1]))+1,0,a)}(n,o,r,e);let l=[];return s&&(l=Eo(s)),l}canQuantifyImage(){return this.#m.getImage().canQuantify()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return this.#m.getImage().isMonochrome()}canScroll(){return this.#m.getImage().canScroll(this.#m.getOrientation())}getImageSize(){return this.#m.getImage().getGeometry().getSize(this.#m.getOrientation())}getImageSpacing(){return this.#m.getImage().getGeometry().getSpacing(this.#m.getOrientation())}moreThanOne(e){return this.getImageSize().moreThanOne(e)}getImageWorldSize(){const e=this.#m.getImage().getGeometry(),t=e.getSize(this.#m.getOrientation()).get2D(),n=e.getSpacing(this.#m.getOrientation()).get2D();return{x:t.x*n.x,y:t.y*n.y}}getImageRescaledDataRange(){return this.#m.getImage().getRescaledDataRange()}equalImageMeta(e){const t=this.#m.getImage().getMeta(),n=Object.keys(e);for(let i=0;i<n.length;++i){const o=n[i];if(void 0===t[o])return!1;if(t[o]!==e[o])return!1}return!0}isPositionInBounds(e){return this.#m.isPositionInBounds(e)}setCurrentPosition(e,t){return this.#m.setCurrentPosition(e,t)}getPositionFromPlanePoint(e,t){void 0===t&&(t=this.getCurrentIndexScrollValue());const n=new m(e.getX(),e.getY(),t),i=this.#Cr.getImageOrientedPoint3D(n),o=this.#m.getImage().getGeometry().pointToWorld(i);return this.getCurrentPosition().mergeWith3D(o)}validatePlanePoint(e){const t=this.getPositionFromPlanePoint(e);return this.#m.getImage().getGeometry().isInBounds(t)}getPlanePositionFromPosition(e){const t=this.#m.getImage().getGeometry().worldToPoint(e),n=this.#Cr.getImageDeOrientedPoint3D(t);return new S(n.getX(),n.getY())}getIndexFromPosition(e){return this.#m.getImage().getGeometry().worldToIndex(e)}getPositionFromIndex(e){return this.#m.getImage().getGeometry().indexToWorld(e)}setCurrentIndex(e,t){return this.#m.setCurrentIndex(e,t)}getPlanePositionFromPlanePoint(e){const t=this.getCurrentIndexScrollValue(),n=new m(e.getX(),e.getY(),t),i=this.#Cr.getTargetDeOrientedPoint3D(n),o=this.#m.getImage().getGeometry().getRealSpacing();return new m(i.getX()*o.get(0),i.getY()*o.get(1),i.getZ()*o.get(2))}getOffset3DFromPlaneOffset(e){return this.#Cr.getOffset3DFromPlaneOffset(e)}play(){if(this.canScroll())if(void 0===this.#yr){const e=this.#m.getImage(),t=e.getMeta().RecommendedDisplayFrameRate,n=this.#m.getPlaybackMilliseconds(t),i=e.getGeometry().getSize().canScroll3D(),o=this.getPositionHelper();this.#yr=window.setInterval(()=>{let e;if(e=i?o.incrementPositionAlongScroll():o.incrementPosition(3),!e){const e=this.getCurrentIndex().getValues(),t=this.#m.getOrientation();i?e[t.getThirdColMajorDirection()]=0:e[3]=0;const n=new a(e),o=this.#m.getImage().getGeometry();this.setCurrentPosition(o.indexToWorld(n))}},n)}else this.stop()}stop(){void 0!==this.#yr&&(clearInterval(this.#yr),this.#yr=void 0)}getWindowLevel(){return this.#m.getWindowLevel()}getCurrentWindowPresetName(){return this.#m.getCurrentWindowPresetName()}setWindowLevel(e){this.#m.setWindowLevel(e)}getColourMap(){return this.#m.getColourMap()}setColourMap(e){this.#m.setColourMap(e)}setViewAlphaFunction(e){this.#m.setAlphaFunction(e)}setMaskViewHelper(e){this.#m.setMaskViewHelper(e)}getSegmentHighlight(){return this.#m.getSegmentHighlight()}setSegmentHighlight(e,t){this.#m.setSegmentHighlight(e,t)}getFillOpacity(){return this.#m.getFillOpacity()}setFillOpacity(e){this.#m.setFillOpacity(e)}getContourThickness(){return this.#m.getContourThickness()}setContourThickness(e){this.#m.setContourThickness(e)}bindImageAndLayer(e){const t=this.#m.getImage();t.addEventListener("imagecontentchange",e.onimagecontentchange),t.addEventListener("imagegeometrychange",e.onimagegeometrychange),t.addEventListener("imageresampled",e.onimageresampled)}unbindImageAndLayer(e){const t=this.#m.getImage();t.removeEventListener("imagecontentchange",e.onimagecontentchange),t.removeEventListener("imagegeometrychange",e.onimagegeometrychange),t.removeEventListener("imageresampled",e.onimageresampled)}}class tc{#Ir;#Zn=null;#wr=null;#Tr=null;#Lr=null;#Pr=!0;#Ar;#Or;#br;#xr=1;#Er={x:1,y:1};#Rr={x:1,y:1};#Fr={x:1,y:1,z:1};#Mr={x:1,y:1};#qr=1;#Ur={x:1,y:1};#Vr={x:0,y:0};#Nr={x:0,y:0};#Qr={x:0,y:0};#Br={x:0,y:0};#kr={x:0,y:0};#Gr={x:0,y:0};#zr=null;#Hr;#vn;#Yr=new Zl;#Xr=!1;#Wr;#$r;constructor(e){this.#Ir=e,this.#Ir.className+=" viewLayer"}getDataId(){return this.#vn}getScale(){return this.#Er}getAbsoluteZoomOffset(){return{x:this.#Br.x*this.#Rr.x,y:this.#Br.y*this.#Rr.y}}setImageSmoothing(e){this.#Xr=e}setView(e,t){this.#vn=t,e.addEventListener("wlchange",this.#jr),e.addEventListener("colourmapchange",this.#Zr),e.addEventListener("positionchange",this.#Kr),e.addEventListener("alphafuncchange",this.#_r),e.addEventListener("maskviewchange",this.#Jr),e.addEventListener("segmenthighlightchange",this.#ea);for(const t of Wl)e.addEventListener(t,this.#ta);this.#Zn=new ec(e),this.bindImage()}getViewController(){return this.#Zn}getImageData(){return this.#Ar}onimageset=e=>{const t=e.detail?.dataid,n=e.detail?.value;this.#vn===t&&(this.#Zn.setImage(n[0]),this.#na(this.#Zn.getImageSize().get2D()),this.#zr=!0)};bindImage(){this.#Zn&&this.#Zn.bindImageAndLayer(this)}unbindImage(){this.#Zn&&this.#Zn.unbindImageAndLayer(this)}onimagecontentchange=e=>{const t=e.detail?.dataid;void 0!==t&&this.#vn!==t||(this.#Pr=this.#Zn.isPositionInBounds(),this.#zr=!0,this.draw())};onimagegeometrychange=e=>{const t=e.detail?.dataid;if(void 0===t||this.#vn===t){const e=this.#Zn.getImageSize().get2D(),t=this.#Zn.getImageSpacing().get2D(),n=this.#Or.x!==e.x||this.#Or.y!==e.y,i=this.#br.x!==t.x||this.#br.y!==t.y;if(i&&(this.#Zn.updatePlaneHelper(),this.#ia(t)),n){if(void 0!==this.#Wr&&void 0!==this.#$r){const e=this.#Zn.getOrigin(),t=this.#$r.minus(e),n=this.#Zn.getOrigin(this.#Zn.getCurrentPosition());if(void 0!==n){const e=this.#Wr.minus(n);this.setBaseOffset(t,e)}}this.#na(e)}(i||n)&&(this.#zr=!0,this.draw())}};onimageresampled=e=>{const t=this.#Zn.getCurrentIndex().get(3),n=void 0===t||t===e.detail?.frame,i=e.detail?.dataid;void 0!==i&&this.#vn!==i||!n||(this.#zr=!0,this.draw())};getId(){return this.#Ir.id}removeFromDOM(){this.#Ir.remove()}getBaseSize(){return this.#Or}getImageWorldSize(){return this.#Zn.getImageWorldSize()}getOpacity(){return this.#xr}setOpacity(e){e!==this.#xr&&(this.#xr=Math.min(Math.max(e,0),1),this.#ta(new CustomEvent("opacitychange",{detail:{value:[this.#xr]}})))}highlightSegment(e,t){if(void 0===t&&(t=750),void 0!==this.#Hr&&this.#Hr(),!this.#Zn.isMask())return!1;if(void 0!==Ne.highlightSegment)return this.#Hr=Ne.highlightSegment(this,e,t),!0;let n;const i=()=>{cancelAnimationFrame(n),this.#Zn.setSegmentHighlight(),this.#Hr===i&&(this.#Hr=void 0)};let o;const r=a=>{void 0===o&&(o=a);const s=a-o;if(s>=t)return void i();const l=.8*Math.sin(Math.PI*s/t);this.#Zn.setSegmentHighlight(e,1-l),n=requestAnimationFrame(r)};return this.#Hr=i,n=requestAnimationFrame(r),!0}getFillOpacity(){return this.#Zn.getFillOpacity()}setFillOpacity(e){this.#Zn.setFillOpacity(e)}getContourThickness(){return this.#Zn.getContourThickness()}setContourThickness(e){this.#Zn.setContourThickness(e)}addFlipOffsetX(){this.#Gr.x+=this.#wr.width/this.#Er.x,this.#Vr.x+=this.#Gr.x}addFlipOffsetY(){this.#Gr.y+=this.#wr.height/this.#Er.y,this.#Vr.y+=this.#Gr.y}flipScaleX(){this.#Fr.x*=-1}flipScaleY(){this.#Fr.y*=-1}flipScaleZ(){this.#Fr.z*=-1}setScale(e,t){const n=this.#Zn.getPlaneHelper(),i=n.getTargetOrientedPositiveXYZ({x:e.x*this.#Fr.x,y:e.y*this.#Fr.y,z:e.z*this.#Fr.z}),o={x:this.#Rr.x*i.x,y:this.#Rr.y*i.y};if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:this.#Vr.x-this.#Br.x,y:this.#Vr.y-this.#Br.y};this.#Br={x:0,y:0},this.#Vr=e}else if(void 0!==t){let e=n.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#Nr.x,y:e.y+this.#Nr.y};const i=hc(this.#Vr,this.#Er,o,e),r={x:this.#Br.x+i.x-this.#Vr.x,y:this.#Br.y+i.y-this.#Vr.y};this.#Br=r,this.#Vr=i}this.#Er=o}initScale(e,t){const n=this.#Zn.getPlaneHelper().getTargetOrientedPositiveXYZ({x:e.x*this.#Fr.x,y:e.y*this.#Fr.y,z:e.z*this.#Fr.z}),i={x:this.#Rr.x*n.x,y:this.#Rr.y*n.y};this.#Er=i,this.#Br={x:t.x/this.#Rr.x,y:t.y/this.#Rr.y},this.#Vr={x:this.#Vr.x+this.#Br.x,y:this.#Vr.y+this.#Br.y}}setBaseOffset(e,t,n,i){const o=this.#Zn.getPlaneHelper(),r=o.getNativeScrollDimIndex(),a=o.getPlaneOffsetFromOffset3D({x:0===r?e.getX():t.getX(),y:1===r?e.getY():t.getY(),z:2===r?e.getZ():t.getZ()}),s=this.#Nr.x!==a.x||this.#Nr.y!==a.y;return void 0!==n&&void 0!==i&&(this.#Wr=n,this.#$r=i),s&&(this.#Vr={x:this.#Vr.x-this.#Nr.x+a.x,y:this.#Vr.y-this.#Nr.y+a.y},this.#Nr=a),s}setOffset(e){const t=this.#Zn.getPlaneHelper().getPlaneOffsetFromOffset3D(e);this.#Vr={x:this.#Vr.x-this.#kr.x+t.x,y:this.#Vr.y-this.#kr.y+t.y},this.#kr=t}displayToPlaneIndex(e){const t=this.displayToPlanePos(e);return new a([Math.floor(t.getX()),Math.floor(t.getY())])}displayToPlaneScale(e){return new S(e.getX()/this.#Er.x,e.getY()/this.#Er.y)}displayToPlanePos(e){const t=this.displayToPlaneScale(e);return new S(t.getX()+this.#Vr.x,t.getY()+this.#Vr.y)}planePosToDisplay(e){let t=(e.getX()-this.#Vr.x+this.#Nr.x)*this.#Er.x,n=(e.getY()-this.#Vr.y+this.#Nr.y)*this.#Er.y;return(t<0||t>=this.#wr.width)&&(t=void 0),(n<0||n>=this.#wr.height)&&(n=void 0),new S(t,n)}displayToMainPlanePos(e){const t=this.displayToPlanePos(e);return new S(t.getX()-this.#Nr.x,t.getY()-this.#Nr.y)}display(e){this.#Ir.style.display=e?"":"none"}isVisible(){return""===this.#Ir.style.display}draw(){this.#Pr&&(this.#ta(new CustomEvent("renderstart",{detail:{layerid:this.getId()}})),this.#zr&&this.#oa(),this.#Lr.globalAlpha=this.#xr,this.clear(),this.#Lr.setTransform(this.#Er.x,0,0,this.#Er.y,-1*this.#Vr.x*this.#Er.x,-1*this.#Vr.y*this.#Er.y),this.#Lr.imageSmoothingEnabled=this.#Xr,this.#Lr.drawImage(this.#Tr,0,0),this.#ta(new CustomEvent("renderend",{detail:{layerid:this.getId()}})))}initialise(e,t,n){this.#br=t,this.#xr=Math.min(Math.max(n,0),1),this.#wr=document.createElement("canvas"),this.#Ir.appendChild(this.#wr),this.#wr.getContext?(this.#Lr=this.#wr.getContext("2d"),this.#Lr?(this.#Tr=document.createElement("canvas"),this.#na(e),this.#zr=!0):alert("Error: failed to get the 2D context.")):alert("Error: no canvas.getContext method.")}#na(e){if(!un(e.x,e.y))throw new Error(`Cannot create canvas with size ${e.x}, ${e.y}`);this.#Or=e,this.#Tr.width=this.#Or.x,this.#Tr.height=this.#Or.y,this.#Lr.clearRect(0,0,this.#Or.x,this.#Or.y),this.#Ar=this.#Lr.createImageData(this.#Or.x,this.#Or.y)}#ia(e){this.#br=e,this.fitToContainer(this.#Mr,this.#qr,this.#Ur)}fitToContainer(e,t,n){let i=!1;const o={x:t*this.#br.x,y:t*this.#br.y},r=o.x/this.#Rr.x,a=o.y/this.#Rr.y,s=e.x/(this.#wr.width*r),l=e.y/(this.#wr.height*a);if(this.#wr.width!==e.x||this.#wr.height!==e.y){if(!un(e.x,e.y))throw new Error(`Cannot resize canvas ${e.x}, ${e.y}`);this.#wr.width=e.x,this.#wr.height=e.y,i=!0}const c={x:this.#Er.x*r,y:this.#Er.y*a};this.#Er.x===c.x&&this.#Er.y===c.y||(this.#Rr=o,this.#Er=c,i=!0);const u={x:n.x/o.x,y:n.y/o.y},d={x:e.x/o.x,y:e.y/o.y},h={x:0!==this.#Gr.x?d.x:0,y:0!==this.#Gr.y?d.y:0};if(this.#Qr.x!==u.x||this.#Qr.y!==u.y||this.#Gr.x!==h.x||this.#Gr.y!==h.y){const e={x:this.#Br.x*s,y:this.#Br.y*l};this.#Vr={x:this.#Vr.x+u.x-this.#Qr.x+h.x-this.#Gr.x+e.x-this.#Br.x,y:this.#Vr.y+u.y-this.#Qr.y+h.y-this.#Gr.y+e.y-this.#Br.y},this.#Gr=h,this.#Qr=u,this.#Br=e,i=!0}this.#Mr=e,this.#qr=t,this.#Ur=n,i&&this.draw()}bindInteraction(){this.#Ir.style.pointerEvents="auto";const e=an;for(let t=0;t<e.length;++t){const n=e[t],i="wheel"!==n&&"touchstart"!==n;this.#Ir.addEventListener(n,this.#ra,{passive:i})}}unbindInteraction(){this.#Ir.style.pointerEvents="none";const e=an;for(let t=0;t<e.length;++t)this.#Ir.removeEventListener(e[t],this.#ra)}addEventListener(e,t){this.#Yr.add(e,t)}removeEventListener(e,t){this.#Yr.remove(e,t)}#ta=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#vn});this.#Yr.fireEvent(new CustomEvent(e.type,{detail:t}))};#ra=e=>{e.srclayerid=this.getId(),e.dataid=this.#vn,this.#Yr.fireEvent(e)};#oa(){this.#Zn.generateImageData(this.#Ar),this.#Tr.getContext("2d").putImageData(this.#Ar,0,0),this.#zr=!1}#jr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#zr=!0,this.draw())};#Zr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#zr=!0,this.draw())};#Kr=e=>{if(void 0===e.detail?.skipGenerate||!0!==e.detail?.skipGenerate){let t=!0;if(void 0!==e.detail?.valid&&(t=e.detail.valid),t){const t=[0,1,2],n=t.indexOf(this.#Zn.getScrollDimIndex());t.splice(n,1);const i=e.detail?.diffDims?.filter(function(e){return-1===t.indexOf(e)});0===i.length&&this.#Pr||(this.#Pr=!0,this.#zr=!0,this.draw())}else this.#Pr&&(this.#Pr=!1,this.clear())}};isValidPosition(){return this.#Pr}#_r=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#zr=!0,this.draw())};#ea=()=>{this.#zr=!0,this.draw()};#Jr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#zr=!0,this.draw())};setCurrentPosition(e,t){return this.#Zn.setCurrentPosition(e)}clear(){this.#Lr.save(),this.#Lr.setTransform(1,0,0,1,0,0),this.#Lr.clearRect(0,0,this.#wr.width,this.#wr.height),this.#Lr.restore()}}class nc extends ss{#aa;#sa;constructor(e,t){super(),this.#aa=e,this.#sa=t}getName(){return`AddAnnotation-${this.#aa.trackingUid}`}execute(){this.#sa.addAnnotation(this.#aa)}undo(){this.#sa.removeAnnotation(this.#aa.trackingUid)}}class ic extends ss{#aa;#sa;constructor(e,t){super(),this.#aa=e,this.#sa=t}getName(){return`RemoveAnnotation-${this.#aa.trackingUid}`}execute(){this.#sa.removeAnnotation(this.#aa.trackingUid)}undo(){this.#sa.addAnnotation(this.#aa)}}class oc extends ss{#aa;#sa;#la;#ca;constructor(e,t,n,i){super(),this.#aa=e,this.#sa=i,this.#la=t,this.#ca=n}getName(){return`UpdateAnnotation-${this.#aa.trackingUid}`}execute(){const e=Object.keys(this.#ca);for(const t of e)this.#aa[t]=this.#ca[t];this.#sa.updateAnnotation(this.#aa,e)}undo(){const e=Object.keys(this.#la);for(const t of e)this.#aa[t]=this.#la[t];this.#sa.updateAnnotation(this.#aa,e)}}class rc{#ua;getAnnotation(e){return this.#ua.find(e)}getAnnotationGroup(){return this.#ua}isAnnotationGroupEditable(){return this.#ua.isEditable()}setAnnotationGroupEditable(e){this.#ua.setEditable(e)}addAnnotation(e){this.#ua.add(e)}updateAnnotation(e,t,n){this.#ua.update(e,t,n)}removeAnnotation(e){this.#ua.remove(e)}removeAnnotationWithCommand(e,t){const n=this.getAnnotation(e);if(void 0===n)return void s.warn(`Cannot create remove command for undefined annotation: ${e}`);const i=new ic(n,this);t(i),i.execute()}updateAnnotationWithCommand(e,t,n,i){const o=this.getAnnotation(e);if(void 0===o)return void s.warn(`Cannot create update command for undefined annotation: ${e}`);const r=new oc(o,t,n,this);i(r),r.execute()}removeAllAnnotationsWithCommand(e){for(const t of[...this.#ua.getList()])this.removeAnnotationWithCommand(t.trackingUid,e)}constructor(e){this.#ua=void 0!==e?e:new Qt}hasAnnotationMeta(e){return this.#ua.hasMeta(e)}setAnnotationMeta(e,t){this.#ua.setMetaValue(e,t)}}class ac{#Ir;#da=null;#Or;#br;#Rr={x:1,y:1};#Fr={x:1,y:1,z:1};#Nr={x:0,y:0};#Qr={x:0,y:0};#Br={x:0,y:0};#kr={x:0,y:0};#Gr={x:0,y:0};#Hr;#sa;#Cr;#vn;#ha;#ga;#Sa;#ma=!0;constructor(e){this.#Ir=e,this.#Ir.className+=" drawLayer"}setShapeHandler(e){this.#Sa=e}getDataId(){return this.#vn}getReferenceLayerId(){return this.#ha}#Yr=new Zl;getKonvaStage(){return this.#da}getKonvaLayer(){return this.#da.getLayers()[0]}getDrawController(){return this.#sa}setPlaneHelper(e){this.#Cr=e}getId(){return this.#Ir.id}removeFromDOM(){this.#Ir.remove()}getBaseSize(){return this.#Or}getOpacity(){return this.#da.opacity()}setOpacity(e){this.#da.opacity(Math.min(Math.max(e,0),1))}addFlipOffsetX(){const e=this.#da.scale(),t=this.#da.size();this.#Gr.x+=t.width/e.x;const n=this.#da.offset();n.x+=this.#Gr.x,this.#da.offset(n)}addFlipOffsetY(){const e=this.#da.scale(),t=this.#da.size();this.#Gr.y+=t.height/e.y;const n=this.#da.offset();n.y+=this.#Gr.y,this.#da.offset(n)}flipScaleX(){this.#Fr.x*=-1}flipScaleY(){this.#Fr.y*=-1}flipScaleZ(){this.#Fr.z*=-1}setScale(e,t){const n=this.#Cr.getTargetOrientedPositiveXYZ({x:e.x*this.#Fr.x,y:e.y*this.#Fr.y,z:e.z*this.#Fr.z}),i={x:this.#Rr.x*n.x,y:this.#Rr.y*n.y},o=this.#da.offset();if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:o.x-this.#Br.x,y:o.y-this.#Br.y};this.#Br={x:0,y:0},this.#da.offset(e)}else if(void 0!==t){let e=this.#Cr.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#Nr.x,y:e.y+this.#Nr.y};const n=hc(o,this.#da.scale(),i,e),r={x:this.#Br.x+n.x-o.x,y:this.#Br.y+n.y-o.y};this.#Br=r,this.#da.offset(n)}this.#da.scale(i),this.#pa(i)}initScale(e,t){const n=this.#Cr.getTargetOrientedPositiveXYZ({x:e.x*this.#Fr.x,y:e.y*this.#Fr.y,z:e.z*this.#Fr.z}),i={x:this.#Rr.x*n.x,y:this.#Rr.y*n.y};this.#da.scale(i),this.#Br={x:t.x/this.#Rr.x,y:t.y/this.#Rr.y};const o=this.#da.offset();this.#da.offset({x:o.x+this.#Br.x,y:o.y+this.#Br.y})}setOffset(e){const t=this.#Cr.getPlaneOffsetFromOffset3D(e),n=this.#da.offset();this.#da.offset({x:n.x-this.#kr.x+t.x,y:n.y-this.#kr.y+t.y}),this.#kr=t}setBaseOffset(e,t){const n=this.#Cr.getNativeScrollDimIndex(),i=this.#Cr.getPlaneOffsetFromOffset3D({x:0===n?e.getX():t.getX(),y:1===n?e.getY():t.getY(),z:2===n?e.getZ():t.getZ()}),o=this.#Nr.x!==i.x||this.#Nr.y!==i.y;if(o){const e=this.#da.offset();this.#da.offset({x:e.x-this.#Nr.x+i.x,y:e.y-this.#Nr.y+i.y}),this.#Nr=i}return o}display(e){this.#Ir.style.display=e?"":"none"}isVisible(){return""===this.#Ir.style.display}draw(){this.#da.draw()}initialise(t,n,i){this.#Or=t,this.#br=n,this.#ha=i,this.#da=new e.Stage({container:this.#Ir,width:this.#Or.x,height:this.#Or.y,listening:!1}),this.#da.getContent().setAttribute("style","");const o=new e.Layer({listening:!1,visible:!0});this.#da.add(o)}setAnnotationGroup(e,t,n){if(this.#vn=t,e.addEventListener("annotationadd",e=>{this.#fa(e.detail.data,!0),this.getKonvaLayer().draw()}),e.addEventListener("annotationupdate",e=>{this.#va(e.detail.data),this.getKonvaLayer().draw()}),e.addEventListener("annotationremove",e=>{this.#Ca(e.detail.data),this.getKonvaLayer().draw()}),e.addEventListener("annotationgroupeditablechange",e=>{this.activateCurrentPositionShapes(e.detail.data)}),this.#sa=new rc(e),0!==e.getLength())for(const t of e.getList())this.#fa(t,!1),n(new nc(t,this.getDrawController()))}activateCurrentPositionShapes(t){const n=this.getKonvaLayer(),i=this.getDrawController(),o=t&&i.getAnnotationGroup().isEditable();if(this.#da.listening(!1),void 0!==this.#Sa){const t=this.#Sa.getEditorShapeGroup();o&&void 0!==t&&t.getParent()===this.#ya()||this.#Sa.disableAndResetEditor();const i=n.getChildren();for(const t of i)t instanceof e.Group&&t.getChildren().forEach(t=>{t instanceof e.Group&&this.#Sa.removeShapeListeners(t)})}if(o){this.#da.listening(!0);const t=this.#ya().getChildren();0!==t.length&&n.listening(!0),void 0!==this.#Sa&&t.forEach(t=>{if(t instanceof e.Group){const e=i.getAnnotation(t.id());this.#Sa.addShapeGroupListeners(t,e,this)}})}n.draw()}#Da(e){let t,n;if(void 0!==e.planePoints?t=e.planePoints:void 0!==e.planeOrigin&&(t=[e.planeOrigin]),void 0!==t){let i;void 0!==e.referencedFrameNumber&&(i=e.referencedFrameNumber-1),n=this.#Ia(t,i)}return n}#Ia(e,t){let n="";for(const t of e)0!==n.length&&(n+="-"),n+=L([h(t.getX(),2),h(t.getY(),2),h(t.getZ(),2)]);return void 0!==t&&(n+=`-${t}`),n}#wa(t){let n;const i=this.#Da(t),o=this.getKonvaLayer().getChildren(Qa(i));if(0!==o.length){const i=o[0];if(!(i instanceof e.Group))return;const r=i.getChildren(Qa(t.trackingUid));0!==r.length&&r[0]instanceof e.Group&&(n=r[0])}return n}#fa(t,n){if(!t.canView()||!t.isCompatibleView(this.#Cr))return;const i=this.#Da(t);let o=this.getKonvaLayer().getChildren(Qa(i))[0];if(void 0===o&&(o=new e.Group({id:i,name:"position-group",visible:n}),this.getKonvaLayer().add(o)),!(o instanceof e.Group))return;const r=new _t,a=this.getKonvaStage();r.setZoomScale(a.scale());const s=t.getFactory();if(void 0===s)throw new Error("Cannot add an annotation draw without factory");const l=s.createShapeGroup(t,r);o.add(l),n&&void 0!==this.#Sa&&this.#Sa.addShapeGroupListeners(l,t,this),this.setLabelVisibility(l)}#Ca(t){const n=this.#wa(t);return n instanceof e.Group?(n.remove(),!0):(s.debug("No shape group to remove"),!1)}#va(e){this.#Ca(e)&&this.#fa(e,!0)}fitToContainer(e,t,n){const i={x:t*this.#br.x,y:t*this.#br.y},o=i.x/this.#Rr.x,r=i.y/this.#Rr.y,a=e.x/(this.#da.width()*o),s=e.y/(this.#da.height()*r);this.#da.width()===e.x&&this.#da.height()===e.y||(this.#da.width(e.x),this.#da.height(e.y));const l={x:this.#da.scale().x*o,y:this.#da.scale().y*r};this.#da.scale().x===l.x&&this.#da.scale().y===l.y||(this.#Rr=i,this.#da.scale(l),this.#pa(l));const c={x:n.x/i.x,y:n.y/i.y},u={x:e.x/i.x,y:e.y/i.y},d={x:0!==this.#Gr.x?u.x:0,y:0!==this.#Gr.y?u.y:0};if(this.#Qr.x!==c.x||this.#Qr.y!==c.y||this.#Gr.x!==d.x||this.#Gr.y!==d.y){const e={x:this.#Br.x*a,y:this.#Br.y*s};this.#da.offset({x:this.#da.offset().x+c.x-this.#Qr.x+d.x-this.#Gr.x+e.x-this.#Br.x,y:this.#da.offset().y+c.y-this.#Qr.y+d.y-this.#Gr.y+e.y-this.#Br.y}),this.#Gr=d,this.#Qr=c,this.#Br=e}}getAnnotationAt(t,n=0){const i=this.getKonvaLayer().getChildren(Qa(this.#ga))[0];if(!(i instanceof e.Group&&i.isVisible()))return;const o=this.getDrawController(),r=i.getChildren().slice().reverse();for(const e of r){if(!e.isVisible())continue;const i=o.getAnnotation(e.id());if(i?.contains(t,n))return i}}isAnnotationVisible(e){const t=this.#Ta(e);return void 0!==t&&t.isVisible()}setAnnotationVisibility(e,t){const n=this.#Ta(e);return void 0!==n&&(void 0===t&&(t=!n.isVisible()),n.visible(t),this.draw(),!0)}highlightAnnotation(t,n){void 0===n&&(n=500),void 0!==this.#Hr&&this.#Hr();const i=this.#Ta(t);if(void 0===i)return!1;if(void 0!==Ne.highlightAnnotation)return this.#Hr=Ne.highlightAnnotation(i,this.getKonvaLayer(),n),!0;const o=i.opacity(),r=()=>{a.stop(),i.opacity(o),this.draw(),this.#Hr===r&&(this.#Hr=void 0)},a=new e.Animation(e=>{if(e.time>=n)return r(),!1;const t=.8*Math.sin(Math.PI*e.time/n);i.opacity(o*(1-t))},this.getKonvaLayer());return this.#Hr=r,a.start(),!0}setLabelsVisibility(t){this.#ma=t;const n=this.getKonvaLayer().getChildren();for(const i of n)if(i instanceof e.Group){const n=i.getChildren();for(const i of n)i instanceof e.Group&&this.#La(i,t)}}#La(t,n){const i=t.getChildren(qa)[0];if(i instanceof e.Label&&(void 0===n&&(n=!i.isVisible()),void 0!==i.getText()&&0!==i.getText().text().length)){i.visible(n);const e=t.getChildren(e=>"Line"===e.className&&"connector"===e.name())[0];e&&e.visible(n)}}setLabelVisibility(e){this.#La(e,this.#ma)}deleteDraw(e,t){}deleteDraws(e){}getNumberOfDraws(){const t=this.getKonvaLayer().getChildren();let n=0;for(const i of t)i instanceof e.Group&&(n+=i.getChildren().length);return n}bindInteraction(){this.#da.listening(!0),this.#Ir.style.pointerEvents="auto";const e=an;for(let t=0;t<e.length;++t)this.#Ir.addEventListener(e[t],this.#ra)}unbindInteraction(){this.#da.listening(!1),this.#Ir.style.pointerEvents="none";const e=an;for(let t=0;t<e.length;++t)this.#Ir.removeEventListener(e[t],this.#ra)}setCurrentPosition(e,t){void 0===t&&(t=this.#Cr.worldToIndex(e));const n=this.#Cr.getPlanePoints(e);let i,o;i=this.#Cr.isAquisitionOrientation()?[n[0]]:n,t.length()>3&&(o=t.get(3));const r=this.#Ia(i,o);return this.#Pa(r),this.#ta(new CustomEvent("positionchange",{detail:{value:[t.getValues(),e.getValues()],valid:!0}})),!0}#Pa(e){this.#ga=e;const t=this.getKonvaLayer().getChildren(Va);let n;for(let i=0,o=t.length;i<o;++i)n=!1,void 0!==e&&t[i].id()===e&&(n=!0),t[i].visible(n);this.getKonvaLayer().draw()}#ya(){if(void 0===this.#ga)return;const t=this.getKonvaLayer().getChildren(e=>e.id()===this.#ga);let n;return 1===t.length?t[0]instanceof e.Group&&(n=t[0]):0===t.length?(n=new e.Group,n.name("position-group"),n.id(this.#ga),n.visible(!0),this.getKonvaLayer().add(n)):s.warn("Unexpected number of draw position groups"),n}#Ta(e){return this.getKonvaLayer().findOne(`#${e}`)}addEventListener(e,t){this.#Yr.add(e,t)}removeEventListener(e,t){this.#Yr.remove(e,t)}#ta=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#vn});this.#Yr.fireEvent(new CustomEvent(e.type,{detail:t}))};#ra=e=>{e.srclayerid=this.getId(),e.dataid=this.#vn,this.#Yr.fireEvent(e)};#pa(e){const t=2/e.x,n=2/e.y,i=this.#da.find("Label");for(let e=0;e<i.length;++e)i[e].scale({x:t,y:n})}}function sc(e){return`info-${e}`}function lc(e){let t;t=void 0!==e.tags?e.tags.join(""):e.event;let n=encodeURIComponent(e.format.toLowerCase());return n=n.replace(/%[0-9A-F]{2}/gi,""),`${sc(e.pos)}-${t}-${n}`}class cc{#Aa=!1;#Ir;constructor(e){this.#Ir=e}onDataChange=e=>{const t=e.detail?.data;if(void 0!==t){if(void 0!==e.detail?.srclayerid){const t=uc(e.detail.srclayerid),i={groupDivId:(n=this.#Ir.id).substring(0,n.length-10)};if(t.groupDivId!==i.groupDivId)return}var n;this.#Aa||this.#Oa(t),this.#ba(t)}};#Oa(e){const t=[];for(const n of e){const e=n.pos;t.includes(e)||t.push(e)}for(const n of t){const t=document.createElement("ul");for(const i of e)if(i.pos===n){const e=document.createElement("li");e.id=lc(i),void 0!==i.tags&&e.appendChild(document.createTextNode(i.value)),t.appendChild(e)}const i=document.createElement("div");i.id=sc(n),i.className=`info-${n} info`,i.appendChild(t),this.#Ir.appendChild(i)}this.#Aa=!0}#ba(e){for(const t of e){const e=`#${lc(t)}`,n=this.#Ir.querySelector(e),i=t.value;i&&n&&n.replaceChildren(document.createTextNode(i))}}}function uc(e){const t=e.split("-layer-");return 2!==t.length&&s.warn("Not the expected layer div id format..."),{groupDivId:t[0],layerIndex:t[1],layerId:e}}function dc(e){let t=null;const n=e.target.closest(".layer");return n&&void 0!==n.id&&(t=uc(n.id)),t}function hc(e,t,n,i){const o=(i.x-e.x)*t.x,r=(i.y-e.y)*t.y;return{x:i.x-o/n.x,y:i.y-r/n.y}}class gc extends EventTarget{#Ir;#xa=[];#Er={x:1,y:1,z:1};#ze={x:1,y:1,z:1};#Vr={x:0,y:0,z:0};#Ea=void 0;#Ra=!1;#Fa=[];#Ma;#Xr=!1;#qa;#Ua;#Va=[];#Na;getPositionHelper(){if(void 0===this.#qa)for(const e of this.#xa)if(e instanceof tc){const t=e.getViewController().getPositionHelper();void 0===this.#qa?this.#qa=t:this.#qa.merge(t)}return this.#qa}constructor(e,t){if(super(),this.#Ir=e,void 0!==t&&!0===t){const t=document.createElement("div");t.id=`${e.id}-infolayer`,t.className="infoLayer",e.appendChild(t),this.#Ua=new cc(t)}}getShowCrosshair(){return this.#Ra}setShowCrosshair(e){this.#Ra=e,e?(this.addEventListener("offsetchange",this.#Qa),this.addEventListener("zoomchange",this.#Qa),this.#Ba()):(this.removeEventListener("offsetchange",this.#Qa),this.removeEventListener("zoomchange",this.#Qa),this.#ka())}setImageSmoothing(e){this.#Xr=e;for(const t of this.#xa)t instanceof tc&&t.setImageSmoothing(e)}#Qa=e=>{this.#Ba()};getDivId(){let e;return null!==this.#Ir&&(e=this.#Ir.id),e}getScale(){return this.#Er}getBaseScale(){return this.#ze}getAddedScale(){return{x:this.#Er.x/this.#ze.x,y:this.#Er.y/this.#ze.y,z:this.#Er.z/this.#ze.z}}getOffset(){return this.#Vr}getNumberOfLayers(){let e=0;return this.#xa.forEach(t=>{void 0!==t&&e++}),e}includes(e){if(void 0===e)return!1;for(const t of this.#xa)if(void 0!==t&&t.getId()===e)return!0;return!1}getViewLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#xa)n instanceof tc&&e(n)&&t.push(n);return t}getViewLayersFromActive(e){void 0===e&&(e=function(){return!0});let t=0;void 0!==this.#Ea&&(t=this.#Ea);const n=[];for(let e=t;e>=0;e--)n.push(e);for(let e=this.#xa.length-1;e>t;e--)n.push(e);const i=[];for(const t of n){const n=this.#xa[t];n instanceof tc&&e(n)&&i.push(n)}return i}someViewLayer(e){let t=!1;for(const n of this.#xa)if(n instanceof tc&&e(n)){t=!0;break}return t}getDrawLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#xa)n instanceof ac&&e(n)&&t.push(n);return t}getNumberOfViewLayers(){let e=0;return this.#xa.forEach(t=>{void 0!==t&&t instanceof tc&&e++}),e}getActiveLayer(){let e;return void 0!==this.#Ea&&(e=this.#xa[this.#Ea]),e}getActiveViewLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof tc&&(e=t),e}getBaseViewLayer(){let e;for(const t of this.#xa)if(t instanceof tc){e=t;break}return e}getViewLayerById(e){const t=this.getViewLayers(function(t){return t.getId()===e});let n;return 1===t.length&&(n=t[0]),n}getViewLayersByDataId(e){return this.getViewLayers(function(t){return t.getDataId()===e})}searchViewLayers(e){const t=structuredClone(e);let n;void 0!==t.SOPInstanceUID&&(n=t.SOPInstanceUID,delete t.SOPInstanceUID);const i=void 0!==n,o=0!==Object.keys(t).length,r=[];for(const e of this.#xa)if(e instanceof tc){let a=!1;o&&(a=e.getViewController().equalImageMeta(t));let s=!1;i&&(s=e.getViewController().includesImageUid(n));let l=!1;o&&i?l=a&&s:o?l=a:i&&(l=s),l&&r.push(e)}return r}getViewDataIndices(){const e=[];for(const t of this.#xa)t instanceof tc&&e.push(t.getDataId());return e}getActiveDrawLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof ac&&(e=t),e}getDrawLayerById(e){const t=this.getDrawLayers(function(t){return t.getId()===e});let n;return 1===t.length&&(n=t[0]),n}getDrawLayersByDataId(e){return this.getDrawLayers(function(t){return t.getDataId()===e})}setActiveLayer(e){this.#Ea=e;const t=this.#xa[e];if(void 0!==this.#Ua){let e=t;t instanceof ac&&(e=this.getViewLayerById(t.getReferenceLayerId()));const n=e?.getDataId();void 0!==this.#Va[n]&&n!==this.#Na&&(this.unbindInfoData(),this.bindInfoData(n))}this.dispatchEvent(new CustomEvent("activelayerchange",{detail:{value:[this.#xa[e]]}}))}setActiveLayerById(e){let t;for(let n=0;n<this.#xa.length;++n)if(void 0!==this.#xa[n]&&this.#xa[n].getId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):s.warn(`No layer to set as active with id: ${e}`)}setActiveLayerByDataId(e){let t;for(let n=0;n<this.#xa.length;++n)if(void 0!==this.#xa[n]&&this.#xa[n].getDataId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):s.warn(`No layer to set as active with dataId: ${e}`)}addViewLayer(){const e=this.#xa.length,t=this.#Ga();this.#Ir.append(t);const n=new tc(t);return n.setImageSmoothing(this.#Xr),this.#xa.push(n),this.setActiveLayer(e),this.#za(n),this.#qa=void 0,n}addDrawLayer(){this.#Ea=this.#xa.length;const e=this.#Ga();this.#Ir.append(e);const t=new ac(e);return this.#xa.push(t),this.#Ha(t),t}#za(e){e.addEventListener("positionchange",this.updateLayersToPositionChange);for(const t of Wl)e.addEventListener(t,this.#ta);e.addEventListener("renderstart",this.#ta),e.addEventListener("renderend",this.#ta)}#Ya(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange);for(const t of Wl)e.removeEventListener(t,this.#ta);e.removeEventListener("renderstart",this.#ta),e.removeEventListener("renderend",this.#ta),e.unbindImage()}#Ha(e){e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#ta)}#Xa(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#ta)}addInfoData(e,t){this.#Va[t]=e}bindInfoData(e){if(void 0!==this.#Na)return;const t=this.#Va[e];void 0!==t&&t.addEventListener("valuechange",this.#Ua.onDataChange),this.#Na=e}unbindInfoData(){const e=this.#Va[this.#Na];void 0!==e&&e.removeEventListener("valuechange",this.#Ua.onDataChange),this.#Na=void 0}#Ga(){const e=document.createElement("div");return e.id=`${this.getDivId()}-layer-${this.#xa.length}`,e.className="layer",e.style.pointerEvents="none",e}empty(){for(const e of this.#xa)void 0!==e&&this.removeLayer(e);this.#xa=[],this.#ka()}removeLayersByDataId(e){for(const t of this.#xa)void 0!==t&&t.getDataId()===e&&this.removeLayer(t)}removeLayer(e){const t=this.#xa.findIndex(t=>t===e);if(-1===t)throw new Error("Cannot find layer to remove");this.#Ea===t&&(this.#Ea=void 0),e instanceof tc?this.#Ya(e):this.#Xa(e),this.#xa[t]=void 0,this.#qa=void 0,e.removeFromDOM(),this.dispatchEvent(new CustomEvent("layerremove",{detail:{layerid:e.getId(),layergroupid:this.getDivId()}}))}#Ba(){let e;this.#ka();for(const t of this.#xa)if(t instanceof tc){e=t;break}if(void 0===e)return void s.warn("No layer to show crosshair");if(this.#Wa(e))return void s.warn("Not enabling crosshair for secondary capture");const t=e.getViewController(),n=t.getCurrentPosition(),i=t.getPlanePositionFromPosition(n),o=e.planePosToDisplay(i);if(void 0!==o.getY()){const e=document.createElement("hr");e.id=`${this.getDivId()}-scroll-crosshair-horizontal`,e.className="horizontal",e.style.width=`${this.#Ir.offsetWidth}px`,e.style.left="0px",e.style.top=`${o.getY()}px`,this.#Fa.push(e),this.#Ir.appendChild(e)}if(void 0!==o.getX()){const e=document.createElement("hr");e.id=`${this.getDivId()}-scroll-crosshair-vertical`,e.className="vertical",e.style.width=`${this.#Ir.offsetHeight}px`,e.style.left=`${o.getX()}px`,e.style.top="0px",this.#Fa.push(e),this.#Ir.appendChild(e)}}#ka(){for(const e of this.#Fa)e.remove();this.#Fa=[]}showTooltip(e){this.removeTooltipDiv();const t=this.getBaseViewLayer(),n=t.getViewController(),i=t.displayToPlanePos(e),o=n.getPositionFromPlanePoint(i),r=n.getRescaledImageValue(o);if(void 0!==r){const t=document.createElement("span");t.id="scroll-tooltip",t.style.left=`${e.getX()+10}px`,t.style.top=`${e.getY()+10}px`;let i=h(r,3).toString();void 0!==n.getPixelUnit()&&(i+=` ${n.getPixelUnit()}`),t.appendChild(document.createTextNode(i)),this.#Ma=t,this.#Ir.appendChild(t)}}removeTooltipDiv(){void 0!==this.#Ma&&(this.#Ma.remove(),this.#Ma=void 0)}isPositionInBounds(e){return this.someViewLayer(function(t){return t.getViewController().isPositionInBounds(e)})}canScroll(){return this.someViewLayer(function(e){return e.getViewController().canScroll()})}#Wa(e){let t=!1;const n=e.getViewController().getSopClassUid();return void 0!==n&&(t=n.startsWith("1.2.840.10008.5.1.4.1.1.7")),t}shouldBind(){const e=this.getBaseViewLayer();return void 0!==e&&!this.#Wa(e)}moreThanOne(e){return this.someViewLayer(function(t){return t.getViewController().moreThanOne(e)})}hasAnyLayerWithValidPosition(){return this.someViewLayer(function(e){return e.isValidPosition()})}#$a=e=>{const t=e.detail?.dataid,n=this.#Va[t];void 0!==n&&n.onPositionChange(e)};updateLayersToPositionChange=e=>{for(const e of this.#xa)void 0!==e&&(e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#ta),e.addEventListener("positionchange",this.#$a));const t=e.detail?.value,n=new a(t[0]),i=new C(t[1]),o={};let r,s;for(const t of this.#xa){if(void 0===t)continue;let a=!1;if(t instanceof tc){const e=t.getViewController(),n=e.getOrigin(),l=e.getOrigin(i);let c,u;if(void 0===s)r=n,s=l,c=new g(0,0,0),u=new g(0,0,0);else if(e.isPositionInBounds(i)&&void 0!==l){const e=r.minus(n);c=new g(e.getX(),e.getY(),e.getZ());const t=s.minus(l);u=new g(t.getX(),t.getY(),t.getZ())}void 0!==c&&void 0!==u&&(a=t.setBaseOffset(c,u,s,r),o[t.getId()]={scroll:c,plane:u})}if(t instanceof ac){const e=o[t.getReferenceLayerId()];void 0!==e&&(a=t.setBaseOffset(e.scroll,e.plane))}let l=!1;const c=e.detail?.srclayerid;t.getId()!==c&&(l=t.setCurrentPosition(i,n)),!l&&a&&t.draw()}const l=this.hasAnyLayerWithValidPosition();this.dispatchEvent(new CustomEvent("outofrange",{detail:{layergroupid:this.getDivId(),value:[!l]}})),this.#Ra&&this.#Ba();for(const e of this.#xa)void 0!==e&&(e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#ta),e.removeEventListener("positionchange",this.#$a))};getDivToWorldSizeRatio(){if(0===this.#Ir.offsetWidth&&0===this.#Ir.offsetHeight)throw new Error(`Cannot fit to zero sized container with id '${this.#Ir.id}'.`);const e=this.getMaxWorldSize();if(void 0!==e){if(0===this.#Ir.offsetHeight){const t=this.#Ir.offsetWidth/e.x,n=e.y*t;this.#Ir.style.height=`${n}px`}return Math.min(this.#Ir.offsetWidth/e.x,this.#Ir.offsetHeight/e.y)}}fitToContainer(e){const t=this.getMaxWorldSize();if(void 0===t)return;const n={x:this.#Ir.offsetWidth,y:this.#Ir.offsetHeight},i={x:-.5*(n.x-Math.floor(t.x*e)),y:-.5*(n.y-Math.floor(t.y*e))};for(const t of this.#xa)void 0!==t&&t.fitToContainer(n,e,i);this.#Ra&&this.#Ba()}getMaxWorldSize(){let e={x:0,y:0};for(const t of this.#xa)if(t instanceof tc){const n=t.getImageWorldSize();n.x>e.x&&(e.x=n.x),n.y>e.y&&(e.y=n.y)}return 0===e.x&&0===e.y&&(e=void 0),e}flipScaleZ(){this.#ze.z*=-1,this.setScale(this.#ze)}addScale(e,t){const n={x:this.#Er.x*(1+e),y:this.#Er.y*(1+e),z:this.#Er.z*(1+e)};this.setScale(n,t)}setScale(e,t){this.#Er=e;for(const e of this.#xa)void 0!==e&&e.setScale(this.#Er,t);const n=[e.x,e.y,e.z];void 0!==t&&(n.push(t.getX()),n.push(t.getY()),n.push(t.getZ())),this.dispatchEvent(new CustomEvent("zoomchange",{detail:{value:n}}))}addTranslation(e){this.setOffset({x:this.#Vr.x-e.x,y:this.#Vr.y-e.y,z:this.#Vr.z-e.z})}setOffset(e){this.#Vr=e;for(const e of this.#xa)void 0!==e&&e.setOffset(this.#Vr);this.dispatchEvent(new CustomEvent("offsetchange",{detail:{value:[this.#Vr.x,this.#Vr.y,this.#Vr.z]}}))}reset(){this.setScale(this.#ze),this.setOffset({x:0,y:0,z:0})}resetZoomPan(){this.setScale(this.#ze),this.setOffset({x:0,y:0,z:0})}resetViews(){let e=!0;for(const t of this.#xa)if(void 0!==t&&t instanceof tc){const n=t.getViewController();e&&(n.resetPosition(),e=!1),n.resetWindowLevel()}}draw(){for(const e of this.#xa)void 0!==e&&e.draw()}display(e){for(const t of this.#xa)void 0!==t&&t.display(e)}#ta=e=>{const t=null!==e.detail&&"object"==typeof e.detail?Object.assign({},e.detail):{};this.dispatchEvent(new CustomEvent(e.type,{detail:t}))}}class Sc{#ja=0;add(e){this.#ja+=function(e){return void 0===e.wheelDeltaY?-e.deltaY:e.wheelDeltaY>45?1:e.wheelDeltaY<-45?-1:-e.deltaY/60}(e)}getSum(){return this.#ja}isTick(){return Math.abs(this.#ja)>=1}clear(){this.#ja=0}}class mc extends EventTarget{#Za;#Ka;#_a;#Ja;#es=new Sc;#ts;#ns;#is;#os;#rs;#as=!1;#ss;constructor({stageController:e,dragBehavior:t,hoverBehavior:n,wheelBehavior:i,doubleClickBehavior:o,twoTouchBehavior:r,tapBehavior:a,longTouchToDblClickMs:s=500}){super(),this.#Za=e,this.#Ka=t,this.#_a=n,this.#Ja=i,this.#ts=o,this.#ns=r,this.#is=a,this.#os=s}#ls(e){return this.#Za.getLayerGroupByDivId(e)}#cs(e){const t=dc(e),n=this.#ls(t.groupDivId);return{point:cn(e),layerGroup:n}}#us(e){return void 0===this.#ss||this.#ss.getDistance(e)>5}#ds(e){const t=dc(e),n=this.#ls(t.groupDivId);return{point:ln(e)[0],layerGroup:n}}getEventNames(){return[]}wheel=e=>{if(void 0===this.#Ja)return;e.preventDefault();const t=dc(e),n=this.#ls(t.groupDivId);this.#Ja.onWheel(e,n),this.#es.add(e);const i=this.#es.getSum()>=0;this.#es.isTick()&&(this.#es.clear(),this.#Ja.onWheelTick(i,n))};dblclick=e=>{const{point:t,layerGroup:n}=this.#cs(e);void 0!==this.#ts?this.#ts.onDoubleClick(t,n):this.#is?.isActive()&&this.#is.onEnd()};#hs(e,t){void 0!==this.#ts?this.#ts.onDoubleClick(e,t):this.#is?.isActive()&&(this.#is.onTap(e,t),this.#is.onEnd()),this.#as=!1,this.#rs=void 0}cancel(){this.#as=!1,this.#ss=void 0,this.#gs(),this.#Ka?.isActive()&&this.#Ka.reset(),this.#is?.isActive()&&this.#is.reset(),this.#ns?.isActive()&&this.#ns?.reset(),this.#_a?.reset()}mousedown=e=>{this.#Ka?.isActive()&&this.#Ka.reset();const{point:t,layerGroup:n}=this.#cs(e);this.#as=!0,this.#ss=t,!this.#is?.isActive()&&this.#Ka?.canStart(t,n)&&this.#Ka.onStart(t,n,{mouseDownButton:e.button})};mousemove=e=>{const{point:t,layerGroup:n}=this.#cs(e);this.#as?(this.#_a?.onEnd(),this.#Ka?.isActive()&&this.#Ka.onUpdate(t,n)):(this.#is?.isActive()&&this.#is.onUpdate(t,n),this.#_a?.onUpdate(t,n))};mouseup=e=>{const{point:t,layerGroup:n}=this.#cs(e),i=this.#us(t);this.#Ka?.isActive()&&(i?this.#Ka.onEnd():this.#Ka.reset()),this.#is&&(this.#is.isActive()||this.#as&&!i)&&this.#is.onTap(t,n),this.#as=!1};mouseout=e=>{this.#Ka?.isActive()&&this.#Ka.onEnd(),this.#is?.isActive()&&this.#is.onEnd(),this.#_a?.onEnd(),this.#as=!1,this.#ss=void 0};touchstart=e=>{this.#Ka?.isActive()&&this.#Ka.reset(),this.#gs();const t=ln(e);if(this.#as=!0,this.#ss=t[0],1===t.length){const{point:t,layerGroup:n}=this.#ds(e);this.#Ka?.canStart(t,n)&&this.#Ka.onStart(t,n,{});const i=this.#os;null!=i&&i>0&&(e.preventDefault(),this.#rs=setTimeout(()=>{this.#hs(t,n)},i))}else 2===t.length&&this.#ns?.onStart(t)};touchmove=e=>{this.#gs();const{point:t,layerGroup:n}=this.#ds(e),i=ln(e);1===i.length?this.#Ka?.isActive()&&this.#Ka.onUpdate(t,n):2===i.length&&(this.#Ka?.isActive()&&this.#Ka.reset(),this.#ns?.isActive()&&this.#ns.onUpdate(i,n))};touchend=e=>{if(this.#gs(),this.#ns?.isActive())return void this.#ns.onEnd();const{point:t,layerGroup:n}=this.#ds(e),i=this.#us(t);this.#Ka?.isActive()&&(i?this.#Ka.onEnd():this.#Ka.reset()),this.#is&&(this.#is.isActive()||this.#as&&!i)&&this.#is.onTap(t,n),this.#as=!1};#gs(){void 0!==this.#rs&&(clearTimeout(this.#rs),this.#rs=void 0)}}function pc(e){return{x:"number"==typeof e?.x?e.x:0,y:"number"==typeof e?.y?e.y:0}}class fc{#Ss;#ms;constructor(e,t,{threshold:n}={}){this.#Ss={x:t.getX()-e.getX(),y:t.getY()-e.getY()},this.#ms=pc(n)}get delta(){return this.#Ss}passesThresholdX(){const e=this.#ms.x;return e<=0||Math.abs(this.#Ss.x)>=e}passesThresholdY(){const e=this.#ms.y;return e<=0||Math.abs(this.#Ss.y)>=e}passesThreshold(){return this.passesThresholdX()||this.passesThresholdY()}}class vc extends EventTarget{#ps;#fs;#vs;constructor({threshold:e}={}){super(),this.setDragThreshold(e)}get startPoint(){return this.#ps}get prevPoint(){return this.#fs}setDragThreshold(e){this.#vs=pc(e)}isActive(){return void 0!==this.#fs}canStart(e,t){return!0}reset(){this.#ps=void 0,this.#fs=void 0}onStart(e,t,n){this.#ps=e,this.#fs=e}onUpdate(e,t){const n=new fc(this.#fs,e,{threshold:this.#vs});n.passesThreshold()&&(this.#fs=e,this.onDrag(n,t))}onDrag(e,t){}onEnd(){this.#fs=void 0,this.reset()}}class Cc extends vc{#Cs;constructor({activeViewLayerOnly:e=!0}={}){super(),this.#Cs=e}setActiveViewLayerOnly(e){this.#Cs=e}canStart(e,t){const n=Ul(t,this.#Cs);return void 0!==n&&!!n.getViewController().isMonochrome()}onDrag(e,t){const n=Ul(t,this.#Cs);if(void 0===n)return;const i=n.getViewController(),o=e.delta.x,r=-e.delta.y,a=i.getImageRescaledDataRange(),s=.001*(a.max-a.min),l=i.getWindowLevel().center,c=i.getWindowLevel().width,u=new bt(l+r*s,c+o*s);i.setWindowLevel(u)}}class yc extends vc{constructor(){super({threshold:{x:15,y:15}})}canStart(e,t){return void 0!==Vl(t)||(s.warn("No view layer to start scroll"),!1)}onDrag(e,t){const n=t.getPositionHelper();e.passesThresholdY()&&t.canScroll()?e.delta.y>0?n.decrementPositionAlongScroll():n.incrementPositionAlongScroll():e.passesThresholdX()&&t.moreThanOne(3)&&(e.delta.x>0?n.incrementPosition(3):n.decrementPosition(3))}}class Dc extends vc{constructor(){super({threshold:{x:15,y:15}})}canStart(e,t){return void 0!==t.getActiveLayer()}onDrag(e,t){if(!e.passesThresholdX())return;const n=t.getActiveLayer();if(void 0===n)return;const i=n.getOpacity();n.setOpacity(i+e.delta.x/200),n.draw()}}class Ic extends vc{onDrag(e,t){const n=Vl(t);if(void 0===n)return void s.warn("No view layer to update pan drag behavior");const i=n.getViewController(),o=n.displayToPlaneScale(new S(e.delta.x,e.delta.y)),r=i.getOffset3DFromPlaneOffset({x:o.getX(),y:o.getY()});t.addTranslation({x:r.getX(),y:r.getY(),z:r.getZ()}),t.draw()}}class wc{onDoubleClick(e,t){}}class Tc extends wc{#ys;#Cs;constructor({dataController:e,activeViewLayerOnly:t=!0}){super(),this.#ys=e,this.#Cs=t}setActiveViewLayerOnly(e){this.#Cs=e}onDoubleClick(e,t){const n=Ul(t,this.#Cs);if(void 0===n)return;const i=n.displayToPlaneIndex(e),o=n.getViewController();if(!o.isMonochrome())return;const r=this.#ys.get(n.getDataId()).image,a=new bt(r.getRescaledValueAtIndex(o.getCurrentIndex().getWithNew2D(i.get(0),i.get(1))),o.getWindowLevel().width);o.setWindowLevel(a)}}class Lc extends wc{onDoubleClick(e,t){const n=Vl(t);void 0!==n?n.getViewController().play():s.warn("No view layer to play double click behavior")}}class Pc{reset(){}onUpdate(e,t){}onEnd(){this.reset()}}class Ac extends Pc{#Ds=!1;#Is;constructor({tooltipEnabled:e=!1}={}){super(),this.#Ds=e}setTooltipEnabled(e){this.#Ds=e}reset(){void 0!==this.#Is&&(this.#Is.removeTooltipDiv(),this.#Is=void 0)}onUpdate(e,t){this.#Ds&&this.#ws(e,t)}#ws(e,t){this.#Is=t,t.showTooltip(e)}}class Oc extends EventTarget{#nn=[];#Ts=1;setNumberOfTaps(e){this.#nn=[],this.#Ts=e}isActive(){return 0!==this.#nn.length}reset(){this.#nn=[]}getPointList(){return this.#nn.slice()}onUpdate(e,t){}onTap(e,t){this.#nn.push(e),this.#nn.length===this.#Ts&&this.onEnd()}onEnd(){this.#nn=[],this.reset()}}class bc extends Oc{onTap(e,t){super.onTap(e,t);const n=Vl(t);if(void 0===n)return void s.warn("No view layer to set current position");const i=n.getViewController(),o=n.displayToPlanePos(e),r=i.getPositionFromPlanePoint(o);i.setCurrentPosition(r),this.dispatchEvent(new CustomEvent("tap",{detail:{position:r.getValues(),annotations:this.#Ls(e,t),segments:this.#Ps(e,t)}}))}#Ls(e,t){const n=[];for(const i of t.getDrawLayers()){if(!i.isVisible())continue;const o=t.getViewLayerById(i.getReferenceLayerId());if(void 0===o)continue;const r=o.displayToPlanePos(e),a=o.displayToPlaneScale(new S(5,5)).getX(),s=i.getAnnotationAt(r,a);void 0!==s&&n.push({annotationid:s.trackingUid,dataid:i.getDataId()})}return n}#Ps(e,t){const n=[],i=t.getViewLayers(e=>e.isVisible()&&e.getViewController().isMask());for(const t of i){const i=t.getViewController(),o=t.displayToPlanePos(e),r=i.getPositionFromPlanePoint(o),a=i.getSegmentNumbersAtPosition(r);0!==a.length&&n.push({dataid:t.getDataId(),segmentnumbers:a})}return n}}class xc{isActive(){return!1}reset(){}onStart(e){}onUpdate(e,t){return!1}onEnd(){this.reset()}}class Ec extends xc{#As;#Os;isActive(){return void 0!==this.#As}reset(){this.#As=void 0,this.#Os=void 0}onStart(e){this.#As=new xr(e[0],e[1]),this.#Os=this.#As.getCentroid()}onUpdate(e,t){if(void 0===this.#As)return!1;const n=new xr(e[0],e[1]).getLength()/this.#As.getLength(),i=t.getPositionHelper();if(1===n){const n=e[0].getY()-this.#As.getBegin().getY();if(Math.abs(n)<15)return!0;t.canScroll()&&(n>0?i.incrementPositionAlongScroll():i.decrementPositionAlongScroll())}else{const e=(n-1)/10;if(Math.abs(e)%.1<=.05&&void 0!==this.#Os){const n=Vl(t);if(void 0===n)return s.warn("No view layer to do touch zoom behavior"),!0;const i=n.getViewController(),o=n.displayToMainPlanePos(this.#Os),r=i.getPlanePositionFromPlanePoint(o);t.addScale(e,r),t.draw()}}return!0}onEnd(){this.#As=void 0,this.reset()}}function Rc(e,t){const n=t.getActiveDrawLayer();if(void 0===n)return s.warn("No draw layer to check point"),!1;const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return s.warn("No view layer to check point"),!1;const o=i.displayToPlanePos(e);return i.getViewController().validatePlanePoint(o)}class Fc{#Cn;#bs;#xs;#Es;#Rs;#Fs;#Ms;#qs;#Us;#Vs=!1;constructor(e){this.#Cn=e,this.#bs=e.getStyle()}setOptions(e){this.#xs=e}setFeatures(e){if(void 0!==e.autoShapeColour&&(this.#Vs=e.autoShapeColour),void 0!==e.shapeColour&&(this.#bs.setLineColour(e.shapeColour),this.#Vs=!1),void 0!==e.refMetaValidator&&(this.#Ms=e.refMetaValidator),void 0!==e.annotationGroupMeta&&(this.#qs=e.annotationGroupMeta),void 0!==e.annotationMeta&&(this.#Us=e.annotationMeta),void 0!==e.shapeName){if(!this.hasShape(e.shapeName))throw new Error(`Unknown shape: '${e.shapeName}'`);this.#Es=e.shapeName,void 0!==this.#xs&&(this.#Rs=new this.#xs[this.#Es])}}hasShape(e){return void 0!==this.#xs?.[e]}tryBeginPlacement(e){let t=e.getActiveDrawLayer();return void 0===t&&this.#Ns(e)&&this.#Qs(e)&&(t=this.#Bs(e)),!(void 0===t||!this.#ks())}#ks(){return!(!this.#xs||!this.#Es)||(s.warn("DrawPreview: missing factory list or shape name"),!1)}getNPoints(){let e=0;return void 0!==this.#Rs&&(e=this.#Rs.getNPoints()),e}resetPlacement(){if(this.#Fs){const e=this.#Fs.getLayer();this.#Fs.destroy(),this.#Fs=void 0,e.draw()}}#Ns(e){let t=!0;const n=this.#Ms;if(void 0!==n){const i=e.getActiveViewLayer().getDataId();t=n(this.#Cn.getDataController().get(i).image.getMeta())}return t}#Qs(e){const t=e.getBaseViewLayer().getDataId();return!this.#Cn.getDataController().get(t).image.isResampled()}getCannotCreateReason(e){let t;return this.#Ns(e)||(t="reference data is invalid"),this.#Qs(e)||(t="base data is invalid"),t}#Bs(e){const t=e.getActiveViewLayer().getDataId(),n=this.#Cn.createAnnotationData(t),i=this.#qs;if(void 0!==i)for(const e of i)n.annotationGroup.setMetaValue(e.concept,e.value);this.#Cn.addAndRenderAnnotationData(n,e.getDivId(),t);const o=e.getActiveDrawLayer();e.setActiveLayerByDataId(o.getDataId());const r=o.getKonvaStage();return this.#bs.setZoomScale(r.scale()),o}#Gs(e){if(this.#Vs){const t=["#ffff80","#ff80ff","#80ffff","#80ff80","8080ff","ff8080"],n=e.getId(),i=n.substring(n.length-1),o=t[parseInt(i,10)-1];void 0!==o&&this.#bs.setLineColour(o)}}#zs(e,t){const n=t.getActiveDrawLayer(),i=n.getDrawController(),o=t.getViewLayerById(n.getReferenceLayerId());if(void 0===o)return void s.warn("No view layer to handle new points");const r=o.getViewController(),a=new Qs,l=i.getAnnotationGroup().getColour();a.colour=void 0!==l?l:this.#bs.getLineColour(),a.init(r);const c=this.#Us;if(void 0!==c)for(const e of c)a.addMetaItem(e.concept,e.value);const u=e.map(e=>o.displayToPlanePos(e));return this.#Rs.setAnnotationMathShape(a,u),a}onNewPoints(e,t){this.#Fs&&(this.#Fs.destroy(),this.#Fs=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void s.warn("No draw layer to handle new points");const i=n.getKonvaLayer();this.#Gs(n);const o=this.#zs(e,t);void 0!==o&&(this.#Fs=this.#Rs.createShapeGroup(o,this.#bs),n.setLabelVisibility(this.#Fs),this.#Fs.getChildren(Ua)[0].listening(!1),i.listening(!1),i.add(this.#Fs),i.draw())}onFinalPoints(e,t){this.#Fs&&(this.#Fs.destroy(),this.#Fs=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void s.warn("No draw layer to handle final points");const i=n.getKonvaLayer(),o=n.getDrawController(),r=this.#zs(e,t);if(void 0===r)return;const a=new nc(r,o);this.#Cn.getUndoController().addToUndoStack(a),a.execute(),i.listening(!0)}}class Mc extends Oc{#Hs;#Ys;#Xs;#Ws;constructor(e,t){super(),this.#Xs=new Fc(e),this.#Ws=t}setOptions(e){this.#Xs.setOptions(e)}setFeatures(e){this.#Xs.setFeatures(e),this.#Ws.setFeatures(e)}hasShape(e){return this.#Xs.hasShape(e)}#$s(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Ws.checkCanEdit(n)?this.#Ws.trySelectShapeGroup(e,n):(this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:"Cannot edit draw, data meta is invalid"}})),!1))}#js(){const e=this.#Xs.getNPoints();void 0===e?super.setNumberOfTaps(65535):super.setNumberOfTaps(e)}resetPlacement(){this.#Xs.resetPlacement(),super.onEnd()}#Zs(e){const t=this.getPointList();return t.length>0&&t[t.length-1].equals(e)}onUpdate(e,t){if(!this.isActive())return;if(this.#Zs(e))return;if(!Rc(e,t))return;this.#Hs=e,this.#Ys=t;const n=this.getPointList();n.push(e),this.#Xs.onNewPoints(n,t)}onTap(e,t){if(!this.isActive()){if(this.#$s(e,t))return;if(!this.#Xs.tryBeginPlacement(t)){const e=this.#Xs.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#Ws.disableAndResetEditor(),this.#js()}if(this.#Zs(e))return;this.#Ys=t,super.onTap(e,t);const n=this.getPointList();n.length>1&&this.#Xs.onNewPoints(n,t)}onEnd(){const e=this.getPointList(),t=this.#Ys,n=this.#Xs.getNPoints();e.length>0&&t&&(void 0!==n?e.length===n?this.#Xs.onFinalPoints(e,t):e.length!==n-1||void 0===this.#Hs||this.#Zs(this.#Hs)?this.#Xs.resetPlacement():(e.push(this.#Hs),this.#Xs.onFinalPoints(e,t)):e.length>2?this.#Xs.onFinalPoints(e,t):this.#Xs.resetPlacement()),this.#Hs=void 0,this.#Ys=void 0,super.onEnd()}}class qc extends vc{#Ws;#Hs;#Ys;#Xs;constructor(e,t){super(),this.#Ws=t,this.#Xs=new Fc(e)}setOptions(e){this.#Xs.setOptions(e)}setFeatures(e){this.#Xs.setFeatures(e)}resetPlacement(){this.#Xs.resetPlacement(),super.onEnd()}#Ks(e,t){let n;if(void 0!==t&&t.getDrawController().getAnnotationGroup().isEditable()){const i=t.getKonvaStage().getIntersection({x:e.getX(),y:e.getY()});i&&(n=i)}return n}canStart(e,t){return 2===this.#Xs.getNPoints()}onStart(e,t,n){if(!this.isActive()){const n=t.getActiveDrawLayer();if(void 0!==n&&this.#Ks(e,n))return;if(!this.#Xs.tryBeginPlacement(t)){const e=this.#Xs.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#Ws.disableAndResetEditor()}this.#Ys=t,super.onStart(e,t,n)}onDrag(e,t){if(!this.isActive())return;if(!Rc(this.prevPoint,t))return;this.#Hs=this.prevPoint,this.#Ys=t;const n=[this.startPoint,this.#Hs];this.#Xs.onNewPoints(n,t)}onEnd(){const e=this.#Ys;if(e&&void 0!==this.#Hs){const t=[this.startPoint,this.#Hs];this.#Xs.onFinalPoints(t,e)}this.#Hs=void 0,this.#Ys=void 0,super.onEnd()}}class Uc{#Cn;#Sa;#Ke=[];#_s;#Js;constructor(e,t){this.#Cn=e,this.#Sa=t}setFeatures(e){void 0!==e.drawMetaValidator&&(this.#Js=e.drawMetaValidator)}disableAndResetEditor(){this.#Sa.disableAndResetEditor()}checkCanEdit(e){return this.#el(e)}#el(e){let t=!0;const n=this.#Js;if(void 0!==n){const i=e.getDataId();t=n(this.#Cn.getDataController().get(i).annotationGroup.getMeta())}return t}#Ks(e,t){let n;if(void 0!==t&&t.getDrawController().getAnnotationGroup().isEditable()){const i=t.getKonvaStage().getIntersection({x:e.getX(),y:e.getY()});i&&(n=i)}return n}#tl(t,n){let i=t.getParent();t instanceof e.Tag&&(i=i.getParent());const o=i.find(".shape")[0];return o instanceof e.Shape&&(this.#Sa.setEditorShape(o,n),!0)}trySelectShapeGroup(e,t){const n=this.#Ks(e,t);return void 0!==n&&this.#tl(n,t)}#nl(e){const t=e.getId();return void 0===this.#Ke[t]&&(this.#Ke[t]=()=>{e.activateCurrentPositionShapes(!0)}),this.#Ke[t]}#il(){return e=>{const t=e.detail?.layerid,n=this.#Cn.getStageController().getDrawLayers(function(e){return e.getId()===t});1===n.length&&this.#ol(n[0],!0)}}#rl(){void 0===this.#_s&&(this.#_s=this.#il(),this.#Cn.addEventListener("drawlayeradd",this.#_s))}#al(){void 0!==this.#_s&&(this.#Cn.removeEventListener("drawlayeradd",this.#_s),this.#_s=void 0)}#ol(e,t){e.setShapeHandler(this.#Sa),e.activateCurrentPositionShapes(t),t?this.#Cn.addEventListener("positionchange",this.#nl(e)):this.#Cn.removeEventListener("positionchange",this.#nl(e))}activate(e){e||this.#Sa.onMouseOutShapeGroup();const t=this.#Cn.getStageController().getDrawLayers();for(const n of t)void 0!==n&&this.#ol(n,e);e?this.#rl():this.#al()}}class Vc{#Cn;#sl;constructor(e,t){this.#Cn=e,this.#sl=t}#Rs;#ll;#cl;#aa;#ul=!1;setShape(e,t,n){if(this.#ll=e,this.#cl=t,this.#aa=n,void 0!==this.#ll){if(this.#dl(),this.#Rs=n.getFactory(),void 0===this.#Rs)throw new Error("Could not find a factory to update shape.");this.#hl()}}getShape(){return this.#ll}getAnnotation(){return this.#aa}isActive(){return this.#ul}enable(){this.#ul=!0,void 0!==this.#ll&&(this.#gl(!0),this.#ll.getLayer()&&this.#ll.getLayer().draw())}disable(){this.#ul=!1,void 0!==this.#ll&&(this.#gl(!1),this.#ll.getLayer()&&this.#ll.getLayer().draw())}reset(){this.#ll=void 0,this.#cl=void 0,this.#aa=void 0}resetAnchors(){this.#dl(),this.#hl(),this.#gl(!0)}#Sl(e){void 0!==this.#ll&&this.#ll.getParent()&&this.#ll.getParent().find(".anchor").forEach(e)}#gl(e){this.#Sl(function(t){t.visible(e)})}setAnchorsActive(e){let t;t=e?e=>{this.#ml(e)}:e=>{this.#pl(e)},this.#Sl(t)}#dl(){this.#Sl(function(e){e.remove()})}#hl(){if(void 0===this.#ll||!this.#ll.getLayer())return;if(void 0===this.#Rs)return;const e=this.#ll.getParent(),t=this.#Rs.getAnchors(this.#aa,this.#Cn.getStyle());for(let n=0;n<t.length;++n)this.#ml(t[n]),e.add(t[n])}#ml(t){let n;t.on("dragstart.edit",e=>{e.cancelBubble=!0,n={mathShape:this.#aa.mathShape,referencePoints:this.#aa.referencePoints}}),t.on("dragmove.edit",t=>{const n=t.target;n instanceof e.Shape&&void 0!==this.#Rs&&(function(e,t){const n=t.getParent();!function(e,t,n){let i=!1;e.x()<t.getX()?(e.x(t.getX()),i=!0):e.x()>n.getX()&&(e.x(n.getX()),i=!0),e.y()<t.getY()?(e.y(t.getY()),i=!0):e.y()>n.getY()&&(e.y(n.getY()),i=!0)}(t,new S(-n.x(),-n.y()),new S(e.x-n.x(),e.y-n.y()))}(this.#cl.getBaseSize(),n),void 0!==this.#Rs.constrainAnchorMove&&this.#Rs.constrainAnchorMove(n,this.#aa),this.#Rs.updateAnnotationOnAnchorMove(this.#aa,n),this.#Rs.updateShapeGroupOnAnchorMove(this.#aa,n,this.#Cn.getStyle()),n.getLayer()?n.getLayer().draw():s.warn("No layer to draw the anchor!"),t.cancelBubble=!0)}),t.on("dragend.edit",t=>{const i=t.target;if(!(i instanceof e.Shape))return;this.#Rs?.onAnchorMoveEnd(i,this.#aa);const o={mathShape:this.#aa.mathShape,referencePoints:this.#aa.referencePoints},r=new oc(this.#aa,n,o,this.#cl.getDrawController());this.#Cn.getUndoController().addToUndoStack(r),this.#sl({type:"annotationupdate",data:this.#aa,dataid:this.#cl.getDataId(),keys:Object.keys(o)}),n={mathShape:o.mathShape,referencePoints:o.referencePoints},t.cancelBubble=!0}),t.on("mousedown touchstart",e=>{e.target.moveToTop()}),t.on("mouseover.edit",t=>{const n=t.target;n instanceof e.Shape&&(n.stroke("#ddd"),n.getLayer()?n.getLayer().draw():s.warn("No layer to draw the anchor!"))}),t.on("mouseout.edit",t=>{const n=t.target;n instanceof e.Shape&&(n.stroke("#999"),n.getLayer()?n.getLayer().draw():s.warn("No layer to draw the anchor!"))})}#pl(e){e.off("dragstart.edit"),e.off("dragmove.edit"),e.off("dragend.edit"),e.off("mousedown touchstart"),e.off("mouseover.edit"),e.off("mouseout.edit")}}class Nc{#fl;constructor(){this.createTrashIcon()}createTrashIcon(){this.#fl=new e.Group;const t=new e.Line({points:[-10,-10,10,10],stroke:"red"}),n=new e.Line({points:[10,-10,-10,10],stroke:"red"});this.#fl.width(20),this.#fl.height(20),this.#fl.add(t),this.#fl.add(n)}activate(e){const t=e.getKonvaStage(),n=t.scale(),i=e.getKonvaLayer(),o={x:1/n.x,y:1/n.y};this.#fl.x(t.offset().x+t.width()/(2*n.x)),this.#fl.y(t.offset().y+t.height()/(15*n.y)),this.#fl.scale(o),i.add(this.#fl),i.draw()}changeChildrenColourOnTrashHover(e,t,n){if(this.isOverTrash(e))return this.changeGroupChildrenColour(this.#fl,"orange"),void this.changeGroupChildrenColour(t,"red");this.changeGroupChildrenColour(this.#fl,"red"),this.changeGroupChildrenColour(t,n)}changeGroupChildrenColour(t,n){t.getChildren().forEach(function(t){t instanceof e.Shape&&void 0!==t.stroke&&t.stroke(n)})}remove(){this.#fl.remove()}isOverTrash(e){const t=this.#fl.width()*Math.abs(this.#fl.scaleX())/2,n=this.#fl.height()*Math.abs(this.#fl.scaleY())/2;return Math.abs(e.x-this.#fl.x())<t&&Math.abs(e.y-this.#fl.y())<n}}class Qc extends EventTarget{#Cn;#vl;#fl;#Cl="pointer";#yl;#Dl;#sl=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))};constructor(e){super(),this.#Cn=e,this.#vl=new Vc(e,this.#sl),this.#fl=new Nc}setEditorShape(t,n){const i=n.getDrawController();if(t&&t instanceof e.Shape&&t!==this.#vl.getShape()&&i.isAnnotationGroupEditable()){this.#vl.disable();const e=t.getParent().id();this.#vl.setShape(t,n,i.getAnnotation(e)),this.#sl({type:"annotationselect",annotationid:e,dataid:n.getDataId()}),this.#vl.enable()}}getEditorShapeGroup(){let t;if(!this.#vl.isActive()||(t=this.#vl.getShape().getParent(),t instanceof e.Group))return t}getEditorAnnotation(){let e;return this.#vl.isActive()&&(e=this.#vl.getAnnotation()),e}disableAndResetEditor(){this.#vl.disable(),this.#vl.reset()}#Il(e,t){const n=t.getKonvaStage();return{x:n.offset().x+e.x/n.scale().x,y:n.offset().y+e.y/n.scale().y}}storeMouseOverCursor(e){this.#Cl=e}#wl(){this.#yl=document.body.style.cursor,document.body.style.cursor=this.#Cl,this.#Dl.opacity(.75)}onMouseOutShapeGroup(){void 0!==this.#yl&&(document.body.style.cursor=this.#yl,this.#yl=void 0),void 0!==this.#Dl&&this.#Dl.opacity(1)}#Tl(e){e.on("mouseover",()=>{this.#Dl=e,this.#wl()}),e.on("mouseout",()=>{this.onMouseOutShapeGroup(),this.#Dl=void 0})}#Ll(e){e.off("mouseover"),e.off("mouseout")}addShapeGroupListeners(e,t,n){this.#Tl(e),this.#Pl(e,t,n),this.#Al(e,t,n),e.on("dblclick",()=>{const e=t.textExpr,i=t=>{const i=t.textExpr,o=new oc(t,{textExpr:e},{textExpr:i},n.getDrawController());this.#Cn.getUndoController().addToUndoStack(o),o.execute()};void 0!==Ne.openRoiDialog?Ne.openRoiDialog(t,i):function(e,t){const n=prompt("Label",e.textExpr);null!==n&&(e.textExpr=n,t(e))}(t,i)})}#Pl(t,n,i){const o=i.getKonvaLayer(),r=t.getChildren(Ua)[0];if(!(r instanceof e.Shape))return;let a,s,l,c;r.draggable(!0),r.on("dragstart.draw",e=>{c=r.stroke(),a={x:r.x(),y:r.y()},s={x:e.target.x(),y:e.target.y()},l={mathShape:n.mathShape,referencePoints:n.referencePoints},this.#fl.activate(i),this.#vl.setAnchorsActive(!1),o.draw()}),r.on("dragmove.draw",e=>{const a=function(e,t){return{min:new S(0,0),max:new S(e.x-Math.abs(t.width()),e.y-Math.abs(t.height()))}}(i.getBaseSize(),r);if(a&&!function(e,t,n){const i=e.getClientRect({relativeTo:e.getParent()});return i.x>t.getX()&&i.x<n.getX()&&i.y>t.getY()&&i.y<n.getY()}(r,a.min,a.max))return r.x(s.x),void r.y(s.y);const l={x:e.target.x()-s.x,y:e.target.y()-s.y},u=t.getChildren(),d=void 0===n.labelPosition;for(const t of u)t===e.target||"label"===t.name()&&!d||"connector"===t.name()||t.move(l);s={x:e.target.x(),y:e.target.y()};const h=n.getFactory();if(void 0===h)throw new Error("Cannot follow drag move without factory");h.updateAnnotationOnTranslation(n,l),h.updateLabelContent(n,t,this.#Cn.getStyle()),h.updateConnector(n,t);const g=cn(e.evt),m={x:g.getX(),y:g.getY()},p=this.#Il(m,i);this.#fl.changeChildrenColourOnTrashHover(p,t,c),o.draw()}),r.on("dragend.draw",e=>{const s=this.#Cn.getUndoController();if(this.#fl.remove(),void 0===e||void 0===e.evt)return;const u=r.x(),d=r.y(),h=cn(e.evt),g={x:h.getX(),y:h.getY()},S=this.#Il(g,i);if(this.#fl.isOverTrash(S)){t.x(a.x),t.y(a.y),this.#vl.disable(),this.#vl.reset(),this.#fl.changeGroupChildrenColour(t,c),n.mathShape=l.mathShape,n.referencePoints=l.referencePoints;const e=new ic(n,i.getDrawController());s.addToUndoStack(e),e.execute(),this.onMouseOutShapeGroup()}else{const e={x:u-a.x,y:d-a.y};if(0!==e.x||0!==e.y){const e={mathShape:n.mathShape,referencePoints:n.referencePoints},t=new oc(n,l,e,i.getDrawController());s.addToUndoStack(t),this.#sl({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:Object.keys(e)}),l={mathShape:e.mathShape,referencePoints:e.referencePoints}}this.#vl.setAnchorsActive(!0),this.#vl.resetAnchors()}o.draw(),a={x:r.x(),y:r.y()}})}#Al(t,n,i){const o=t.getChildren(qa)[0];if(!(o instanceof e.Label))return;let r,a;o.draggable(!0),o.on("dragstart.draw",()=>{r={x:o.x(),y:o.y()},a=n.labelPosition}),o.on("dragmove.draw",()=>{const e=n.getFactory();if(void 0===e)throw new Error("Cannot udpate connector without factory");e.updateConnector(n,t)}),o.on("dragend.draw",()=>{const e=this.#Cn.getUndoController(),t=o.x()-r.x,s=o.y()-r.y;if(0!==t||0!==s){const t=new S(o.x(),o.y());n.labelPosition=t;const r=new oc(n,{labelPosition:a},{labelPosition:t},i.getDrawController());e.addToUndoStack(r),this.#sl({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:["labelPosition"]}),a=t}r={x:o.x(),y:o.y()}})}removeShapeListeners(t){this.#Ll(t),t.off("dblclick");const n=t.getChildren(Ua)[0];n instanceof e.Shape&&(n.draggable(!1),n.off("dragstart.draw"),n.off("dragmove.draw"),n.off("dragend.draw"));const i=t.getChildren(qa)[0];i instanceof e.Label&&(i.draggable(!1),i.off("dragstart.draw"),i.off("dragend.draw"))}}class Bc{mask;dataId;offsetsLists;mode;segmentNumber;srclayerid;originalValuesLists;isSilent}class kc extends ss{#kt;#vn;#Ol;#bl;#xl;#El;#Rl;#Fl;#Ml;#ql;constructor(e){super(),this.#kt=e.mask,this.#vn=e.dataId,this.#Ol=e.offsetsLists,this.#bl=e.mode,this.#xl=e.segmentNumber,this.#El=e.srclayerid,void 0!==e.originalValuesLists&&(this.#Rl=e.originalValuesLists),this.#Fl=e.isSilent??!1,this.#Ml="del"===this.#bl?"brushremove":"brushdraw",this.#ql="brushdraw"===this.#Ml?"brushremove":"brushdraw"}getOriginalValuesLists(){return this.#Rl}getExecuteEvent(){const e="brushdraw"===this.#Ml?this.#xl:void 0;return new CustomEvent(this.#Ml,{detail:{segmentnumber:e,dataid:this.#vn,srclayerid:this.#El}})}getName(){return"Draw-brush"}execute(){if(void 0===this.#xl)return;let e=this.#xl;"brushremove"===this.#Ml&&(e=0),void 0===this.#Rl?this.#Rl=this.#kt.setAtOffsetsAndGetOriginals(this.#Ol,e):this.#kt.setAtOffsetsWithIterator(this.#Ol,e),this.#Fl||this.onExecute(this.getExecuteEvent())}undo(){void 0===this.#Rl?this.#Rl=this.#kt.setAtOffsetsAndGetOriginals(this.#Ol,0):this.#kt.setAtOffsetsWithIterator(this.#Ol,this.#Rl);const e="brushdraw"===this.#ql?this.#xl:void 0,t=new CustomEvent(this.#ql,{detail:{segmentnumber:e,dataid:this.#vn,srclayerid:this.#El}});this.onUndo(t)}onExecute(e){}onUndo(e){}}const Gc="No source image to create mask",zc="No source image to get offsets, ID: {0}",Hc="No brush origins",Yc="No mask defined when adding mask slices",Xc="No created mask image",Wc="No mask image for temporary draw command, ID: {0}",$c="No mask image to get offsets from",jc="No mask image for draw command, ID: {0}",Zc="No mask ID to apply mask index",Kc="No mask view layers",_c="No selected segment number",Jc="Too many mask view layers: {0}",eu="More mask layers than expected",tu="Cannot display mask with no mask ID",nu="Cannot draw with no mask data ID",iu="Cannot draw with no offsets",ou="Cannot draw with no colour list",ru="Cannot get mask layers with no mask ID",au="Cannot get mask view controller: no mask ID",su="Cannot get mask view controller: no mask layers",lu="Cannot find source data for an existing mask, ID: {0}",cu="Unsupported scroll index: {0}";function uu(e,...t){return e.replace(/{(\d+)}/g,(e,n)=>t[n]||"")}const du="del";function hu(e,t,n,i){return kr(e.worldToIndex(t),n,i)}class gu extends EventTarget{#Cn;#Ul=10;#Vl={min:1,max:20};#Nl="del";#Ql;#kt;#Bl;#Is;#kl=0;#Gl;#zl;constructor(e){super(),this.#Cn=e.app}#Hl(e){const t=this.#Vl.min,n=this.#Vl.max;return Math.min(Math.max(e,t),n-1)}getBrushSize(){return this.#Ul}getBrushMode(){return this.#Nl}getSelectedSegmentNumber(){return this.#Ql}setBrushMode(e){this.setFeatures({brushMode:e})}setFeatures(e){if(void 0!==e.brushSizeRange&&(this.#Vl=e.brushSizeRange,this.#Ul=this.#Hl(this.#Ul)),void 0!==e.brushSize&&(this.#Ul=this.#Hl(e.brushSize)),void 0!==e.brushSizeAdd){const t=this.#Hl(this.#Ul+e.brushSizeAdd);if(t!==this.#Ul){this.#Ul=t;const e=new CustomEvent("brushsizechange",{detail:{value:this.#Ul}});this.dispatchEvent(e)}}void 0!==e.brushMode&&(this.#Nl=e.brushMode),void 0!==e.selectedSegmentNumber&&(this.#Ql=e.selectedSegmentNumber),e.createMask?this.#Bl=void 0:void 0!==e.maskDataId&&(this.#Bl=e.maskDataId)}#Yl(e,t,n,i=!1){const o=e.getSize().getValues();o[2]=1;const r=new St(o),a=new Ct([t],r,e.getSpacing(),e.getOrientation()),s=new Uint8Array(r.getDimSize(2));s.fill(0),++this.#kl;const l=[this.#kl.toString()],c=i?new ko(a,s,l):new Vt(a,s,l);return c.setMeta(n),c.setPhotometricInterpretation("PALETTE COLOR"),c.setPaletteColourMap(new Yo([0],[0],[0])),c}#Xl(e,t,n,i,o,r){const l=function(e,t){const n=t.sort(function(e,t){let n=0;const i=e.get(2),o=t.get(2);return void 0!==i&&void 0!==o&&(n=i-o),n});const i=n[0].get(2);if(void 0===i)return[];const o=new a([0,0,i]),r=e.indexToWorld(o),l=n.at(-1).get(2);if(void 0===l)return[];const c=new a([0,0,l]),u=e.indexToWorld(c),d=e.getOrigins(),h=.1*e.getSpacing().get(2),g=r.get3D().getClosest(d),S=d[g],m=r.get3D().getDistance(S);m>h&&s.warn(`Large distance between origin and origin for first index: ${m}`);const p=u.get3D().getClosest(d),f=d[p],v=u.get3D().getDistance(f);return v>h&&s.warn(`Large distance between origin and origin for last index: ${v}`),[g,p]}(e,hu(e,n,o,i));if(void 0===l||0===l.length)throw new Error(Hc);const c=e.getOrigins(),u=t.getOrigins(),d=u[0].getClosest(c),h=u.at(-1).getClosest(c),g=[];if(l[0]<d)for(let e=d-1;e>=l[0];--e)g.push(e);if(l[1]>h)for(let e=h+1;e<=l[1];++e)g.push(e);const S=[];for(const e of g)S.push(c[e]);if(void 0===this.#kt)throw new Error(Yc);const m=this.#kt.getMeta();for(const e of S)m.sliceCapacity+=1,this.#kt.appendSlice(this.#Yl(t,e,r))}#Wl(e,t){if(!t)throw new Error(uu(Gc));const n=t.getGeometry(),i=n.worldToIndex(e).get(2);if(void 0===i)throw new Error("Z position is undefined");const o=new a([0,0,i]),r=n.getOrigins()[i],s=Zo(),l=function(){const e="1.2.826.0.1.3680043.9.7278.1681051091011101.1";return{indices:{value:[{DimensionOrganizationUID:e,DimensionDescriptionLabel:"ReferencedSegmentNumber",DimensionIndexPointer:"(0062,000B)",FunctionalGroupPointer:"(0062,000A)"},{DimensionOrganizationUID:e,DimensionDescriptionLabel:"ImagePositionPatient",DimensionIndexPointer:"(0020,0032)",FunctionalGroupPointer:"(0020,9113)"}]},organizations:{value:[{DimensionOrganizationUID:e}]}}}();s.DimensionOrganizationSequence=l.organizations,s.DimensionIndexSequence=l.indices,s.PixelRepresentation=0,s.sliceCapacity=1;const c=t.getMeta();s.PatientID=c.PatientID,s.StudyInstanceUID=c.StudyInstanceUID,s.SeriesInstanceUID=c.SeriesInstanceUID;const u=[{referencedSOPClassUID:c.SOPClassUID,referencedSOPInstanceUID:t.getImageUid(o)}],d=[];d.push({ReferencedInstanceSequence:{value:u},SeriesInstanceUID:c.SeriesInstanceUID}),s.ReferencedSeriesSequence={value:d},s.custom={referencedSeriesUID:c.SeriesInstanceUID,frameInfos:[{dimIndex:[1,1],refSegmentNumber:1,imagePosPat:r.getValues(),derivationImages:[{sourceImages:u}]}]},s.lengthUnit=t.getMeta().lengthUnit,this.#kt=this.#Yl(n,r,s,!0);const h=Fi(s),g=new cl(h);g.image=this.#kt;const S=this.#Cn.getDataController(),m=S.getNextDataId();if(!S.add(m,g))throw new Error("Cannot add mask data");return m}#$l(e){const t=this.#Cn.getStageController().getDataViewConfigs();let n;for(const i in t){const o=t[i].find(function(t){return t.divId===e});if(void 0!==o){n=o.orientation;break}}return n}#jl(e){if(void 0===this.#Bl)throw new Error(tu);const t=new bu(e);t.orientation=this.#$l(e);const n=this.#Cn.getStageController();n.addDataViewConfig(this.#Bl,t),n.render(this.#Bl)}#Zl(e){const t=e.getMaskReferencedSeriesUID();let n;return"undefined"!==t&&(n=this.#Cn.getDataController().getDataIdFromSeriesUid(t)),void 0===n&&s.warn(uu(lu,t)),n}#Kl(e){if(void 0===this.#Bl)throw new Error(ru);const t=e.getViewLayersByDataId(this.#Bl);if(0===t.length)throw new Error(Kc);return 1!==t.length&&s.warn(uu(Jc,t.length)),t[0]}#_l(e){if(void 0===e)throw new Error(Zc);const t=this.#Cn.getDataController().get(e);if(void 0===t)throw new Error($c);return t.image}#Jl(e,t){if(void 0===t)throw new Error("No layergroup to get mask offsets");let n;if(this.#Is=t,n=void 0===this.#Bl?t.getBaseViewLayer():t.getViewLayersByDataId(this.#Bl)[0],void 0===n)return[];const i=n.getViewController(),o=i.getCurrentPosition();let r,a,l,c;if(i.equalImageMeta({Modality:"SEG"})||i.equalImageMeta({Modality:"RTSTRUCT"})){this.#kt=this.#_l(this.#Bl);const t=this.#Zl(this.#kt),o=this.#Cn.getDataController().get(t);if(!o)throw new Error(uu(zc,t));if(c=o.image,c.isResampled())return s.warn("Cannot update mask with resampled reference image."),[];const u=this.#Cn.getStageController().getViewLayersByDataId(t)[0],d=u.getViewController(),h=u.displayToPlanePos(e);l=d.getPositionFromPlanePoint(h),r=n,a=i}else{const u=n.getDataId(),d=this.#Cn.getDataController().get(u);if(!d)throw new Error(uu(zc,u));if(c=d.image,c.isResampled())return s.warn("Cannot create mask on resampled image."),[];const h=n.displayToPlanePos(e);if(l=i.getPositionFromPlanePoint(h),this.#Bl=this.#Wl(o,c),void 0===this.#kt)throw new Error(Xc);const g=t.getDivId(),S=void 0!==g;S&&this.#jl(g),r=this.#Kl(t),a=r.getViewController(),S&&a.setCurrentPosition(o)}const u=c.getGeometry(),d=this.#kt.getMeta(),h=this.#kt.getGeometry(),g=i.get2DSpacing(),S=[Math.round(this.#Ul/g.x),Math.round(this.#Ul/g.y)];let m;const p=i.getScrollDimIndex();switch(p){case 0:m=[1,2];break;case 1:m=[0,2];break;case 2:m=[0,1];break;default:throw new Error(uu(cu,p))}this.#Xl(u,h,l,m,S,d);const f=r.displayToPlanePos(e);return function(e,t){const n=e.getSize(),i=[];for(const e of t){const t=n.indexToOffset(e);t>=0&&i.push(t)}return i.sort(function(e,t){return e-t})}(h,hu(h,a.getPositionFromPlanePoint(f),S,m))}#ec(e){const t=this.#tc().getId();if(void 0===this.#Bl)throw new Error(Zc);const n=this.#Cn.getDataController().get(this.#Bl);if(!n)throw new Error(uu(Wc,this.#Bl));const i=new Bc;i.mask=n.image,i.dataId=this.#Bl,i.offsetsLists=[e],i.mode=this.#Nl,i.segmentNumber=this.#Ql,i.srclayerid=t;const o=new kc(i);o.execute();const r=o.getOriginalValuesLists();if(void 0!==r)return r[0]}beginStroke(e,t){this.#Gl=[],this.#zl=[];const n=this.#Jl(e,t);if(n.length>0){this.#Gl.push(n);const e=this.#ec(n);return void 0!==e&&this.#zl.push(e),!0}return!1}paintStep(e,t){const n=this.#Jl(e,t);if(n.length>0){this.#Gl.push(n);const e=this.#ec(n);void 0!==e&&this.#zl.push(e)}}finalizeStroke(){if(void 0===this.#Bl)throw new Error(nu);if(void 0===this.#Gl)throw new Error(iu);if(void 0===this.#zl)throw new Error(ou);this.#Gl.reverse(),this.#zl.reverse();const e=this.#tc().getId(),t=this.#Cn.getDataController().get(this.#Bl);if(!t)throw new Error(uu(jc,this.#Bl));const n=new Bc;n.mask=t.image,n.dataId=this.#Bl,n.offsetsLists=this.#Gl,n.mode=this.#Nl,n.segmentNumber=this.#Ql,n.srclayerid=e,n.originalValuesLists=this.#zl;const i=new kc(n);i.onExecute=e=>{this.dispatchEvent(e)},i.onUndo=e=>{this.dispatchEvent(e),this.#kt.recalculateLabels()},this.#Cn.getUndoController().addToUndoStack(i),this.dispatchEvent(i.getExecuteEvent()),this.#kt.recalculateLabels()}#tc(){if(void 0===this.#Bl)throw new Error(au);if(void 0===this.#Is)throw new Error("No current layer group");const e=this.#Is.getViewLayersByDataId(this.#Bl);if(0===e.length)throw new Error(su);return 1!==e.length&&s.warn(eu),e[0]}}const Su=["brushsizechange","brushdraw","brushremove"];class mu extends vc{#Cn;#nc;#ic=!1;#oc=[];constructor(e){super(),this.#Cn=e,this.#nc=new gu({app:e});for(const e of Su)this.#nc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}setFeatures(e){void 0!==e.blacklist&&(this.#oc=e.blacklist),this.#nc.setFeatures(e)}canStart(e,t){return!(!this.#rc(t)||this.#ac(t)||(this.#Ut(t)?(s.warn("Cannot paint on series with overlapping slices"),1):void 0===this.#nc.getSelectedSegmentNumber()&&(s.warn(_c),1)))}onStart(e,t,n){super.onStart(e,t,n);const i=this.#nc.getBrushSize()/2;this.setDragThreshold({x:i,y:i}),this.#ic=!1,2===n?.mouseDownButton&&this.#sc(),this.#nc.beginStroke(e,t)||(this.#lc(),super.onEnd())}onDrag(e,t){const n=this.prevPoint;void 0!==n&&this.#nc.paintStep(n,t)}onEnd(){this.isActive()&&(this.#nc.finalizeStroke(),this.#lc()),super.onEnd()}reset(){this.isActive()&&(this.#nc.finalizeStroke(),this.#lc()),super.reset()}#rc(e){if(void 0===e)throw new Error("No layergroup to check for view layer");return e.getActiveLayer()instanceof tc}#ac(e){if(void 0===e)throw new Error("No layergroup to check black list");if(void 0===e.getActiveDrawLayer()){const t=e.getActiveViewLayer().getDataId(),n=this.#Cn.getDataController().get(t).image.getMeta().SeriesInstanceUID;if(this.#oc.includes(n))return!0}return!1}#Ut(e){if(void 0===e)throw new Error("No layergroup to check for overlap");const t=e.getActiveViewLayer();if(void 0===t)throw new Error("No viewlayer to check for overlap");const n=t.getDataId(),i=this.#Cn.getDataController().get(n);return i.image instanceof ko&&i.image.getHasOverlap()}#sc(){this.#ic=!0,this.#nc.setBrushMode(du),this.dispatchEvent(new CustomEvent("erasingactivated"))}#lc(){this.#ic&&this.#nc.getBrushMode()===du&&(this.#nc.setBrushMode("add"),this.dispatchEvent(new CustomEvent("erasingdeactivated"))),this.#ic=!1}}class pu extends vc{#Cn;#aa;#cc;#uc;#dc=[];#hc;#gc=10;#Sc=5;#mc=0;#pc=2e3;#fc=[];#bs;#Ws;constructor(e,t,n){super(),this.#Cn=e,this.#bs=t,this.#Ws=n}setFeatures(e){this.#Ws.setFeatures(e)}#vc(e){const t=e.getActiveDrawLayer();if(void 0!==t)return e.getViewLayerById(t.getReferenceLayerId());s.warn("No draw layer to do floodfill")}#Cc=(e,t)=>{const n=this.#vc(t);if(void 0===n)return void s.warn("No view layer to get index");const i=n.displayToPlaneIndex(e);return{x:i.get(0),y:i.get(1)}};#yc(e,t,i){this.#fc=[];const o={data:this.#uc?.data,width:this.#uc?.width,height:this.#uc?.height,bytes:4},r=n.floodFill(o,e.x,e.y,t),a=n.gaussBlurOnlyBorder(r,this.#Sc);let s=n.traceContours(a);if(s=n.simplifyContours(s,this.#mc,this.#pc),s.length>0&&s[0].points[0].x){if(i)return s[0].points;for(let e=0,t=s[0].points.length;e<t;e++)this.#fc.push(new S(s[0].points[e].x,s[0].points[e].y));return this.#fc}return[]}#Dc(e,t,n){if(this.#dc=this.#yc(e,t,!1),0!==this.#dc.length){const e=n.getActiveDrawLayer();if(void 0===e)return s.warn("No draw layer to paint border"),!1;const t=e.getDrawController(),i=new Nr(this.#dc);let o;if(void 0===this.#aa){this.#aa=new Qs,this.#aa.colour=this.#bs.getLineColour();const r=n.getViewLayerById(e.getReferenceLayerId());if(void 0===r)return s.warn("No view layer to paint border"),!1;const a=r.getViewController();this.#aa.init(a),this.#aa.mathShape=i,o=new nc(this.#aa,t)}else{const e=this.#aa.mathShape;o=new oc(this.#aa,{mathShape:e},{mathShape:i},t)}this.#Cn.getUndoController().addToUndoStack(o),o.execute()}return 0!==this.#dc.length}#Ic(e){const t=e.getBaseViewLayer().getDataId();return this.#Cn.getDataController().get(t).image.isResampled()}#$s(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Ws.checkCanEdit(n)?this.#Ws.trySelectShapeGroup(e,n):(this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:"Cannot edit draw, data meta is invalid"}})),!1))}canStart(e,t){return!0}onStart(e,t,n){if(this.#Ic(t))return;if(!this.isActive()&&this.#$s(e,t))return;let i;this.#aa=void 0;let o=t.getActiveDrawLayer();if(void 0===o){i=t.getActiveViewLayer();const e=i.getDataId(),n=this.#Cn.createAnnotationData(e),r=t.getDivId().replace("-layer-0","");this.#Cn.addAndRenderAnnotationData(n,r,e),o=t.getActiveDrawLayer(),o.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(o.getDataId())}else if(i=t.getViewLayerById(o.getReferenceLayerId()),void 0===i)return void s.warn("No view layer to start floodfill");this.#uc=i.getImageData(),void 0!==this.#uc?(this.#bs.setZoomScale(o.getKonvaLayer().getAbsoluteScale()),this.#cc=this.#Cc(e,t),this.#Dc(this.#cc,this.#gc,t),super.onStart(e,t,n)):s.error("No image info found")}onUpdate(e,t){if(!this.isActive())return;const n=this.#Cc(e,t);this.#hc=Math.round(Math.sqrt(Math.pow(this.#cc.x-n.x,2)+Math.pow(this.#cc.y-n.y,2))/2),this.#hc=this.#hc<this.#gc?this.#gc:this.#hc-this.#gc,this.#Dc(this.#cc,this.#hc,t),super.onUpdate(e,t)}}class fu{constructor(e,t){this.pointArray=e?e.slice():[],this.controlPointIndexArray=t?t.slice():[]}getPoint(e){return this.pointArray[e]}isControlPoint(e){const t=this.pointArray.indexOf(e);if(-1===t)throw new Error("Error: isControlPoint called with not in list point.");return-1!==this.controlPointIndexArray.indexOf(t)}getLength(){return this.pointArray.length}addPoint(e){this.pointArray.push(e)}addControlPoint(e){const t=this.pointArray.indexOf(e);if(-1===t)throw new Error("Cannot mark a non registered point as control point.");this.controlPointIndexArray.push(t)}addPoints(e){this.pointArray=this.pointArray.concat(e)}appenPath(e){const t=this.pointArray.length;this.pointArray=this.pointArray.concat(e.pointArray);const n=[];for(let i=0;i<e.controlPointIndexArray.length;++i)n[i]=e.controlPointIndexArray[i]+t;this.controlPointIndexArray=this.controlPointIndexArray.concat(n)}}class vu{constructor(e,t){this.bucketCount=1<<e,this.mask=this.bucketCount-1,this.size=0,this.loc=0,this.cost=void 0!==t?t:function(e){return e},this.buckets=this.buildArray(this.bucketCount)}push(e){const t=this.getBucket(e);e.next=this.buckets[t],this.buckets[t]=e,this.size++}pop(){if(0===this.size)throw new Error("Cannot pop, bucketQueue is empty.");for(;null===this.buckets[this.loc];)this.loc=(this.loc+1)%this.bucketCount;const e=this.buckets[this.loc];return this.buckets[this.loc]=e.next,e.next=null,this.size--,e}remove(e){if(!e)return!1;const t=this.getBucket(e);let n=this.buckets[t];for(;null!==n&&(null===n.next||e.x!==n.next.x||e.y!==n.next.y);)n=n.next;return null!==n&&(n.next=n.next.next,this.size--,!0)}isEmpty(){return 0===this.size}getBucket(e){return this.cost(e)&this.mask}buildArray(e){const t=new Array(e);for(let e=0;e<t.length;e++)t[e]=null;return t}}const Cu=2/(3*Math.PI);function yu(e,t,n,i,o){const r=e[i][n],a=t[i][n];let s=Math.sqrt(r*r+a*a);s=Math.max(s,1e-100),o.x=r/s,o.y=a/s}class Du{constructor(){this.width=-1,this.height=-1,this.curPoint=null,this.searchGranBits=8,this.searchGran=1<<this.searchGranBits,this.pointsPerPost=500,this.greyscale=null,this.laplace=null,this.gradient=null,this.gradX=null,this.gradY=null,this.parents=null,this.working=!1,this.trained=!1,this.trainingPoints=null,this.edgeWidth=2,this.trainingLength=32,this.edgeGran=256,this.edgeTraining=null,this.gradPointsNeeded=32,this.gradGran=1024,this.gradTraining=null,this.insideGran=256,this.insideTraining=null,this.outsideGran=256,this.outsideTraining=null}getTrainingIdx(e,t){return Math.round((e-1)*t)}getTrainedEdge(e){return this.edgeTraining[this.getTrainingIdx(this.edgeGran,e)]}getTrainedGrad(e){return this.gradTraining[this.getTrainingIdx(this.gradGran,e)]}getTrainedInside(e){return this.insideTraining[this.getTrainingIdx(this.insideGran,e)]}getTrainedOutside(e){return this.outsideTraining[this.getTrainingIdx(this.outsideGran,e)]}setWorking(e){this.working=e}setDimensions(e,t){this.width=e,this.height=t}setData(e){if(-1===this.width||-1===this.height)throw new Error("Dimensions have not been set.");this.greyscale=function(e,t,n){const i={data:[]};for(let o=0;o<n;o++){i.data[o]=[];for(let n=0;n<t;n++){const r=4*(o*t+n);i.data[o][n]=(e[r]+e[r+1]+e[r+2])/765}}return i.dx=function(e,t){return e+1===this.data[t].length&&e--,this.data[t][e+1]-this.data[t][e]},i.dy=function(e,t){return t+1===this.data.length&&t--,this.data[t][e]-this.data[t+1][e]},i.gradMagnitude=function(e,t){const n=this.dx(e,t),i=this.dy(e,t);return Math.sqrt(n*n+i*i)},i.laplace=function(e,t){let n=-16*this.data[t][e];return n+=this.data[t-2][e],n+=this.data[t-1][e-1]+2*this.data[t-1][e]+this.data[t-1][e+1],n+=this.data[t][e-2]+2*this.data[t][e-1]+2*this.data[t][e+1]+this.data[t][e+2],n+=this.data[t+1][e-1]+2*this.data[t+1][e]+this.data[t+1][e+1],n+=this.data[t+2][e],n},i}(e,this.width,this.height),this.laplace=function(e){const t=[];t[0]=[],t[1]=[];for(let n=1;n<e.data.length;n++)t[0][n]=1,t[1][n]=1;for(let n=2;n<e.data.length-2;n++){t[n]=[],t[n][0]=1,t[n][1]=1;for(let i=2;i<e.data[n].length-2;i++)t[n][i]=e.laplace(i,n)>.33?0:1;t[n][e.data[n].length-2]=1,t[n][e.data[n].length-1]=1}t[e.data.length-2]=[],t[e.data.length-1]=[];for(let n=1;n<e.data.length;n++)t[e.data.length-2][n]=1,t[e.data.length-1][n]=1;return t}(this.greyscale),this.gradient=function(e){const t=[];let n,i,o=0;for(i=0;i<e.data.length-1;i++){for(t[i]=[],n=0;n<e.data[i].length-1;n++)t[i][n]=e.gradMagnitude(n,i),o=Math.max(t[i][n],o);t[i][e.data[i].length-1]=t[i][e.data.length-2]}t[e.data.length-1]=[];for(let n=0;n<t[0].length;n++)t[e.data.length-1][n]=t[e.data.length-2][n];for(i=0;i<t.length;i++)for(n=0;n<t[i].length;n++)t[i][n]=1-t[i][n]/o;return t}(this.greyscale),this.gradX=function(e){const t=[];for(let n=0;n<e.data.length;n++){t[n]=[];for(let i=0;i<e.data[n].length-1;i++)t[n][i]=e.dx(i,n);t[n][e.data[n].length-1]=t[n][e.data[n].length-2]}return t}(this.greyscale),this.gradY=function(e){const t=[];for(let n=0;n<e.data.length-1;n++){t[n]=[];for(let i=0;i<e.data[n].length;i++)t[n][i]=e.dy(i,n)}t[e.data.length-1]=[];for(let n=0;n<e.data[0].length;n++)t[e.data.length-1][n]=t[e.data.length-2][n];return t}(this.greyscale);const t=function(e,t,n,i){const o={inside:[],outside:[]},r={x:-1,y:-1};for(let a=0;a<t.length;a++){o.inside[a]=[],o.outside[a]=[];for(let s=0;s<t[a].length;s++){yu(t,n,s,a,r);let l=Math.round(s+e*r.y),c=Math.round(a-e*r.x),u=Math.round(s-e*r.y),d=Math.round(a+e*r.x);l=Math.max(Math.min(l,t[a].length-1),0),u=Math.max(Math.min(u,t[a].length-1),0),c=Math.max(Math.min(c,t.length-1),0),d=Math.max(Math.min(d,t.length-1),0),o.inside[a][s]=i.data[c][l],o.outside[a][s]=i.data[d][u]}}return o}(this.edgeWidth,this.gradX,this.gradY,this.greyscale);this.inside=t.inside,this.outside=t.outside,this.edgeTraining=[],this.gradTraining=[],this.insideTraining=[],this.outsideTraining=[]}findTrainingPoints(e){const t=[];if(null!==this.parents)for(let n=0;n<this.trainingLength&&e;n++)t.push(e),e=this.parents[e.y][e.x];return t}resetTraining(){this.trained=!1}doTraining(e){if(this.trainingPoints=this.findTrainingPoints(e),this.trainingPoints.length<8)return;const t=[];this.calculateTraining(t,this.edgeGran,this.greyscale,this.edgeTraining),this.calculateTraining(t,this.gradGran,this.gradient,this.gradTraining),this.calculateTraining(t,this.insideGran,this.inside,this.insideTraining),this.calculateTraining(t,this.outsideGran,this.outside,this.outsideTraining),this.trainingPoints.length<this.gradPointsNeeded&&this.addInStaticGrad(this.trainingPoints.length,this.gradPointsNeeded),this.trained=!0}calculateTraining(e,t,n,i){let o;for(e.length=t,o=0;o<t;o++)e[o]=0;let r=1;for(o=0;o<this.trainingPoints.length;o++){const i=this.trainingPoints[o],a=this.getTrainingIdx(t,n[i.y][i.x]);e[a]+=1,r=Math.max(r,e[a])}for(o=0;o<t;o++)e[o]=1-e[o]/r;!function(e,t){t[0]=.4*e[0]+.5*e[1]+.1*e[1],t[1]=.25*e[0]+.4*e[1]+.25*e[2]+.1*e[3];for(let n=2;n<e.length-2;n++)t[n]=.05*e[n-2]+.25*e[n-1]+.4*e[n]+.25*e[n+1]+.05*e[n+2];const n=e.length;t[n-2]=.25*e[n-1]+.4*e[n-2]+.25*e[n-3]+.1*e[n-4],t[n-1]=.4*e[n-1]+.5*e[n-2]+.1*e[n-3]}(e,i)}addInStaticGrad(e,t){for(let n=0;n<this.gradGran;n++)this.gradTraining[n]=Math.min(this.gradTraining[n],1-n*(t-e)/(t*this.gradGran))}gradDirection(e,t,n,i){return function(e,t,n,i,o,r){const a={x:-1,y:-1},s={x:-1,y:-1};yu(e,t,n,i,a),yu(e,t,o,r,s);let l=a.y*(o-n)-a.x*(r-i),c=s.y*(o-n)-s.x*(r-i);return l<0&&(l=-l,c=-c),n!==o&&i!==r&&(l*=Math.SQRT1_2,c*=Math.SQRT1_2),Cu*(Math.acos(l)+Math.acos(c))}(this.gradX,this.gradY,e,t,n,i)}dist(e,t,n,i){let o=this.gradient[i][n];e!==n&&t!==i||(o*=Math.SQRT1_2);const r=this.laplace[i][n],a=this.gradDirection(e,t,n,i);return this.trained?.3*this.getTrainedGrad(o)+.3*r+.1*(a+this.getTrainedEdge(this.greyscale.data[t][e])+this.getTrainedInside(this.inside[t][e])+this.getTrainedOutside(this.outside[t][e])):.43*o+.43*r+.11*a}adj(e){const t=[],n=Math.max(e.x-1,0),i=Math.max(e.y-1,0),o=Math.min(e.x+1,this.greyscale.data[0].length-1),r=Math.min(e.y+1,this.greyscale.data.length-1);let a=0;for(let s=i;s<=r;s++)for(let i=n;i<=o;i++)i===e.x&&s===e.y||(t[a++]={x:i,y:s});return t}#wc=e=>Math.round(this.searchGran*this.cost[e.y][e.x]);setPoint(e){let t,n;for(this.setWorking(!0),this.curPoint=e,this.visited=[],n=0;n<this.height;n++)for(this.visited[n]=[],t=0;t<this.width;t++)this.visited[n][t]=!1;for(this.parents=[],n=0;n<this.height;n++)this.parents[n]=[];for(this.cost=[],n=0;n<this.height;n++)for(this.cost[n]=[],t=0;t<this.width;t++)this.cost[n][t]=Number.MAX_VALUE;this.cost[e.y][e.x]=0,this.pq=new vu(this.searchGranBits,this.#wc),this.pq.push(e)}doWork(){if(!this.working)return;this.timeout=null;let e=0;const t=[];for(;!this.pq.isEmpty()&&e<this.pointsPerPost;){const n=this.pq.pop();t.push(n),t.push(this.parents[n.y][n.x]),this.visited[n.y][n.x]=!0;const i=this.adj(n);for(let e=0;e<i.length;e++){const t=i[e],o=this.cost[n.y][n.x]+this.dist(n.x,n.y,t.x,t.y);o<this.cost[t.y][t.x]&&(this.cost[t.y][t.x]!==Number.MAX_VALUE&&this.pq.remove(t),this.cost[t.y][t.x]=o,this.parents[t.y][t.x]=n,this.pq.push(t))}e++}return t}}class Iu extends Oc{#Cn;#bs;#ps;#aa;#Tc=new fu;#Lc=new fu;#fc=[];#Pc=5;#Ac=new Du;#Ws;constructor(e,t,n){super(),this.#Cn=e,this.#bs=t,this.#Ws=n,super.setNumberOfTaps(500)}setFeatures(e){this.#Ws.setFeatures(e)}#Oc(e){const t=e.get(1);for(let e=0;e<t;++e)this.#fc[e]=[]}#bc(){this.#Tc=new fu,this.#Lc=new fu}#Ic(e){const t=e.getBaseViewLayer().getDataId();return this.#Cn.getDataController().get(t).image.isResampled()}#$s(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Ws.checkCanEdit(n)?this.#Ws.trySelectShapeGroup(e,n):(this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:"Cannot edit draw, data meta is invalid"}})),!1))}onTap(e,t){if(this.#Ic(t))return;if(!this.isActive()&&this.#$s(e,t))return;let n,i=t.getActiveDrawLayer();n=void 0===i?t.getActiveViewLayer():t.getViewLayerById(i.getReferenceLayerId());const o=n.getViewController().getImageSize();this.#Ac.setDimensions(o.get(0),o.get(1)),this.#Ac.setData(n.getImageData().data);const r=n.displayToPlaneIndex(e);if(this.isActive()){const e=Math.abs(r.get(0)-this.#ps.getX()),t=Math.abs(r.get(1)-this.#ps.getY());if(e<this.#Pc&&t<this.#Pc)this.onEnd();else{this.#Tc=this.#Lc,this.#Oc(o);const e={x:r.get(0),y:r.get(1)};this.#Ac.doTraining(e),this.#Tc.addControlPoint(this.#Lc.getPoint(0))}}else{if(this.#aa=void 0,this.#ps=new S(r.get(0),r.get(1)),this.#bc(),this.#Oc(o),void 0===i){const e=n.getDataId(),o=this.#Cn.createAnnotationData(e);this.#Cn.addAndRenderAnnotationData(o,t.getDivId(),e),i=t.getActiveDrawLayer(),i.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(i.getDataId())}this.#bs.setZoomScale(i.getKonvaLayer().getAbsoluteScale());const e={x:r.get(0),y:r.get(1)};this.#Ac.doTraining(e);const a=new S(r.get(0),r.get(1));this.#Tc.addPoint(a),this.#Tc.addControlPoint(a)}super.onTap(e,t)}onUpdate(e,t){if(!this.isActive())return;const n=t.getActiveDrawLayer();if(void 0===n)return void s.warn("No draw layer to update livewire");const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return void s.warn("No view layer to update livewire");const o=i.displayToPlaneIndex(e);let r,a={x:o.get(0),y:o.get(1)};this.#Ac.setPoint(a);let l=!1;for(;!this.#fc[a.y][a.x]&&!l;)if(r=this.#Ac.doWork(),0===r.length)l=!0;else for(let e=0;e<r.length-1;e+=2){const t=r[e],n=r[e+1];this.#fc[t.y][t.x]=n}for(this.#Lc=new fu,l=!1;a&&!l;)this.#Lc.addPoint(new S(a.x,a.y)),this.#fc[a.y]&&this.#fc[a.y][a.x]?a=this.#fc[a.y][a.x]:l=!0;this.#Lc.appenPath(this.#Tc);const c=n.getDrawController(),u=new Nr(this.#Lc.pointArray);let d;if(void 0===this.#aa){this.#aa=new Qs,this.#aa.colour=this.#bs.getLineColour();const e=i.getViewController();this.#aa.init(e),this.#aa.mathShape=u,d=new nc(this.#aa,c)}else{const e=this.#aa.mathShape;d=new oc(this.#aa,{mathShape:e},{mathShape:u},c)}this.#Cn.getUndoController().addToUndoStack(d),d.execute(),super.onUpdate(e,t)}reset(){this.#aa=void 0,this.#bc(),this.#fc=[],super.reset()}}const wu={},Tu={WindowLevel:class extends mc{#Cn;#Ka;#ts;constructor(e){const t=new Cc,n=new Tc({dataController:e.getDataController()});super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new Ql,doubleClickBehavior:n}),this.#Cn=e,this.#Ka=t,this.#ts=n}keydown=e=>{e.context="WindowLevel",this.#Cn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){void 0!==e.strictViewLayer&&(s.warn("strictViewLayer is deprecated, use activeViewLayerOnly instead"),this.#Ka.setActiveViewLayerOnly(e.strictViewLayer),this.#ts.setActiveViewLayerOnly(e.strictViewLayer)),void 0!==e.activeViewLayerOnly&&(this.#Ka.setActiveViewLayerOnly(e.activeViewLayerOnly),this.#ts.setActiveViewLayerOnly(e.activeViewLayerOnly))}},Scroll:class extends mc{#Cn;#xc;constructor(e){const t=new Ac,n=new bc;super({stageController:e.getStageController(),dragBehavior:new yc,hoverBehavior:t,wheelBehavior:new Ql,doubleClickBehavior:new Lc,tapBehavior:n}),this.#Cn=e,this.#xc=t;for(const e of this.getEventNames())n.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{e.context="Scroll",this.#Cn.onKeydown(e)};activate(e){e||this.cancel()}setFeatures(e){void 0!==e.displayTooltip&&this.#xc.setTooltipEnabled(Boolean(e.displayTooltip))}init(){}getEventNames(){return["tap"]}},ZoomAndPan:class extends mc{#Cn;constructor(e){const t=new bc;super({stageController:e.getStageController(),dragBehavior:new Ic,wheelBehavior:new Bl,twoTouchBehavior:new Ec,tapBehavior:t}),this.#Cn=e;for(const e of this.getEventNames())t.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{e.context="ZoomAndPan",this.#Cn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}getEventNames(){return["tap"]}},Opacity:class extends mc{#Cn;constructor(e){super({stageController:e.getStageController(),dragBehavior:new Dc,wheelBehavior:new Ql}),this.#Cn=e}keydown=e=>{e.context="Opacity",this.#Cn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Draw:class extends mc{#Cn;#Ws;#Ec;#Rc;#Sa;constructor(e){const t=new Qc(e),n=new Uc(e,t),i=new Mc(e,n),o=new qc(e,n);super({stageController:e.getStageController(),dragBehavior:o,tapBehavior:i,wheelBehavior:new Ql}),this.#Cn=e,this.#Ws=n,this.#Ec=o,this.#Rc=i,this.#Sa=t;for(const e of this.getEventNames())this.#Ec.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}),this.#Rc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}),this.#Sa.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{this.#Rc.isActive()||(e.context="Draw",this.#Cn.onKeydown(e));const t=this.#Sa.getEditorAnnotation();if(("Delete"===e.key||"Backspace"===e.key)&&void 0!==t){const e=this.#Cn.getStageController().getActiveLayerGroup().getActiveDrawLayer();if(void 0===e)return void s.warn("No draw layer to handle key down");const n=e.getDrawController(),i=this.#Cn.getUndoController(),o=new ic(t,n);i.addToUndoStack(o),o.execute(),this.#Sa.onMouseOutShapeGroup()}"Escape"===e.key&&(this.#Ec.resetPlacement(),this.#Rc.resetPlacement(),this.#Ws.disableAndResetEditor())};activate(e){e||this.cancel(),this.#Ws.activate(e)}setOptions(e){this.#Ec.setOptions(e),this.#Rc.setOptions(e)}getOptionsType(){return"factory"}setFeatures(e){void 0!==e.mouseOverCursor&&this.#Sa.storeMouseOverCursor(e.mouseOverCursor),this.#Ec.setFeatures(e),this.#Rc.setFeatures(e)}init(){}getEventNames(){return["annotationupdate","annotationselect","warn"]}hasShape(e){return this.#Rc.hasShape(e)}},Brush:class extends mc{#Fc;#Cn;constructor(e){const t=new mu(e);super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new Ql,longTouchToDblClickMs:null}),this.#Fc=t,this.#Cn=e;for(const e of this.getEventNames())this.#Fc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{e.context="Brush",this.#Cn.onKeydown(e);const t=e.ctrlKey||e.altKey;t||"+"!==e.key?t||"-"!==e.key?(t||Number.isNaN(Number.parseInt(e.key,10)))&&(t||"a"!==e.key?t||"d"!==e.key||this.#Fc.setFeatures({brushMode:du}):this.#Fc.setFeatures({brushMode:"add"})):this.#Fc.setFeatures({brushSizeAdd:-1}):this.#Fc.setFeatures({brushSizeAdd:1})};activate(e){const t=function(e){let t=[];if(!e)return[];for(const n in e)if(e[n]){const i=e[n];if(Array.isArray(i)){const e=i.map(function(e){return e.divId});t=[...t,...e]}}return[...new Set(t)]}(this.#Cn.getStageController().getDataViewConfigs());e?this.#Mc(t):(this.cancel(),this.#qc(t))}#Mc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",e=>{e.preventDefault(),e.stopPropagation()})}}#qc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",e=>{})}}setFeatures(e){this.#Fc.setFeatures(e)}init(){}getEventNames(){return["brushdraw","brushremove","brushsizechange","erasingactivated","erasingdeactivated"]}getHelpKeys(){return{title:"tool.Brush.name",brief:"tool.Brush.brief",mouse:{mouse_click:"tool.Brush.mouse_click"},touch:{touch_click:"tool.Brush.touch_click"}}}},Filter:us,Floodfill:class extends mc{#Cn;#Ws;#Ka;#bs=new _t;constructor(e){const t=new _t,n=new Qc(e),i=new Uc(e,n),o=new pu(e,t,i);super({stageController:e.getStageController(),dragBehavior:o,wheelBehavior:new Ql}),this.#Cn=e,this.#Ws=i,this.#Ka=o,this.#bs=t}keydown=e=>{e.context="Floodfill",this.#Cn.onKeydown(e),"Escape"===e.key&&this.#Ws.disableAndResetEditor()};activate(e){if(e){const e=this.#Cn.getStageController().getActiveLayerGroup();this.#bs.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#bs.getLineColour()})}else this.cancel();this.#Ws.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#bs.setLineColour(e.shapeColour),this.#Ka.setFeatures(e)}},Livewire:class extends mc{#Cn;#Ws;#is;#bs;constructor(e){const t=new _t,n=new Qc(e),i=new Uc(e,n),o=new Iu(e,t,i);super({stageController:e.getStageController(),tapBehavior:o,wheelBehavior:new Ql}),this.#Cn=e,this.#Ws=i,this.#is=o,this.#bs=t}keydown=e=>{e.context="Livewire",this.#Cn.onKeydown(e),"Escape"===e.key&&this.#Ws.disableAndResetEditor()};activate(e){if(e){const e=this.#Cn.getStageController().getActiveLayerGroup();this.#bs.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#bs.getLineColour()})}else this.cancel();this.#Ws.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#bs.setLineColour(e.shapeColour),this.#is.setFeatures(e)}}},Lu={WindowLevelBinder:class{getEventType=function(){return"wlchange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value,o=e.getViewLayersByDataId(n);if(0!==o.length){const e=o[0].getViewController();if(2===i.length){const t=new bt(i[0],i[1]);e.setWindowLevel(t)}3===i.length&&e.setWindowLevelPreset(i[2])}}}},PositionBinder:class{getEventType=function(){return"positionchange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value,o=i[1],r=e.getViewLayersByDataId(n);let a,s=!1;0!==r.length?(a=r[0],s=!0):a=e.getBaseViewLayer();const l=a.getViewController(),c=l.getCurrentPosition(),u=c.length(),d=o.length;!s&&d>3&&u>3&&(o[3]=c.get(3)),l.setCurrentPosition(new C(o))}}},ZoomBinder:class{getEventType=function(){return"zoomchange"};getCallback=function(e){return function(t){const n=t.detail?.value,i={x:n[0],y:n[1],z:n[2]};let o;6===n.length&&(o=new m(n[3],n[4],n[5])),e.setScale(i,o),e.draw()}}},OffsetBinder:class{getEventType=function(){return"offsetchange"};getCallback=function(e){return function(t){const n=t.detail?.value;e.setOffset({x:n[0],y:n[1],z:n[2]}),e.draw()}}},OpacityBinder:class{getEventType=function(){return"opacitychange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value;if(void 0===n)return;const o=e.getViewLayersByDataId(n),r=e.getBaseViewLayer();0!==o.length&&r!==o[0]&&(o[0].setOpacity(i),o[0].draw())}}},ColourMapBinder:class{getEventType=function(){return"colourmapchange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value,o=e.getViewLayersByDataId(n);0!==o.length&&o[0].getViewController().setColourMap(i[0])}}},MaskViewBinder:class{getEventType=function(){return"maskviewchange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value,o=e.getViewLayersByDataId(n);0!==o.length&&(o[0].setFillOpacity(i[0]),o[0].setContourThickness(i[1]))}}}};class Pu{#Uc=[];#Vc;#Xr=!1;#Nc=[];#Ke=null;getLayerGroup(e){return this.#Uc[e]}getNumberOfLayerGroups(){return this.#Uc.length}getActiveLayerGroup(){return this.getLayerGroup(this.#Vc)}setActiveLayerGroup(e){void 0!==this.getLayerGroup(e)?this.#Vc=e:s.warn(`No layer group to set as active with index: ${e}`)}getViewLayersByDataId(e){let t=[];for(const n of this.#Uc)t=t.concat(n.getViewLayersByDataId(e));return t}getViewLayers(e){let t=[];for(const n of this.#Uc)t=t.concat(n.getViewLayers(e));return t}getDrawLayersByDataId(e){let t=[];for(const n of this.#Uc)t=t.concat(n.getDrawLayersByDataId(e));return t}getDrawLayers(e){let t=[];for(const n of this.#Uc)t=t.concat(n.getDrawLayers(e));return t}addLayerGroup(e,t){this.#Vc=this.#Uc.length;const n=new gc(e,t);n.setImageSmoothing(this.#Xr);const i=this.#Ke&&0!==this.#Ke.length;return i&&this.unbindLayerGroups(),this.#Uc.push(n),i&&this.bindLayerGroups(),n}getLayerGroupByDivId(e){return this.#Uc.find(function(t){return t.getDivId()===e})}setBinders(e){if(null==e)throw new Error("Cannot set null or undefined binders");0!==this.#Nc.length&&this.unbindLayerGroups(),this.#Nc=e.slice(),this.bindLayerGroups()}empty(){this.unbindLayerGroups();for(const e of this.#Uc)e.empty();this.#Uc=[],this.#Vc=void 0}removeLayersByDataId(e){for(const t of this.#Uc)t.removeLayersByDataId(e)}removeLayerGroup(e){const t=this.#Uc.findIndex(t=>t===e);if(-1===t)throw new Error("Cannot find layerGroup to remove");this.unbindLayerGroups(),e.empty(),this.#Uc.splice(t,1),this.#Vc===t&&(this.#Vc=void 0),this.bindLayerGroups()}reset(){for(const e of this.#Uc)e.reset()}resetZoomPan(){for(const e of this.#Uc)e.resetZoomPan()}resetViews(){for(const e of this.#Uc)e.resetViews()}draw(){for(const e of this.#Uc)e.draw()}fitToContainer(){let e;const t=[];for(let n=0;n<this.#Uc.length;++n){const i=this.#Uc[n].getDivToWorldSizeRatio();void 0!==i&&this.#Uc[n].shouldBind()&&(t.push(n),(void 0===e||i<e)&&(e=i))}for(let n=0;n<this.#Uc.length;++n)if(t.includes(n)&&this.#Uc[n].shouldBind())this.#Uc[n].fitToContainer(e);else{const e=this.#Uc[n].getDivToWorldSizeRatio();this.#Uc[n].fitToContainer(e)}}bindLayerGroups(){if(0!==this.#Uc.length&&1!==this.#Uc.length&&0!==this.#Nc.length){this.#Ke=new Array(this.#Uc.length);for(let e=0;e<this.#Uc.length;++e)if(this.#Uc[e].shouldBind())for(let t=0;t<this.#Nc.length;++t)this.#Qc(e,this.#Nc[t])}}unbindLayerGroups(){if(0!==this.#Uc.length&&0!==this.#Nc.length&&this.#Ke){for(let e=0;e<this.#Uc.length;++e)if(this.#Uc[e].shouldBind())for(let t=0;t<this.#Nc.length;++t)this.#Bc(e,this.#Nc[t]);this.#Ke=null}}setImageSmoothing(e){this.#Xr=e;for(const t of this.#Uc)t.setImageSmoothing(e)}#kc(e,t){if(!this.#Ke)return;void 0===this.#Ke[t]&&(this.#Ke[t]=[]);let n=this.#Ke[t].find(function(t){return t.binder===e});return void 0===n&&(n={binder:e,callback:n=>{this.#Bc(t,e),e.getCallback(this.#Uc[t])(n),this.#Qc(t,e)}},this.#Ke[t].push(n)),n.callback}#Qc(e,t){for(let n=0;n<this.#Uc.length;++n)n!==e&&this.#Uc[n].shouldBind()&&this.#Uc[e].addEventListener(t.getEventType(),this.#kc(t,n))}#Bc(e,t){if(this.#Ke)for(const n in this.#Ke)if(parseInt(n,10)!==e)for(const i of this.#Ke[n])i.binder.getEventType()===t.getEventType()&&this.#Uc[e].removeEventListener(t.getEventType(),i.callback)}}const Au=["viewlayeradd","drawlayeradd","error","zoomchange","offsetchange","layerremove","outofrange","renderstart","renderend",...Wl];class Ou extends EventTarget{#Gc=null;#ys;#Ji;#zc;#Hc;#Yc;constructor(e,t){super(),this.#ys=e,this.#Ji=t,this.#Gc=new Pu,void 0!==t.binders&&this.#Gc.setBinders(t.binders)}setToolboxController(e){this.#zc=e}setAddToUndoStack(e){this.#Hc=e}setGetInfoData(e){this.#Yc=e}getViewConfigs(e,t){if(void 0===t&&(t=!1),null===this.#Ji.dataViewConfigs||void 0===this.#Ji.dataViewConfigs)throw new Error("No available data view configuration");let n=[];return void 0!==this.#Ji.dataViewConfigs[e]?n=this.#Ji.dataViewConfigs[e]:t||void 0===this.#Ji.dataViewConfigs["*"]||(n=this.#Ji.dataViewConfigs["*"]),n}getViewConfig(e,t,n){return this.getViewConfigs(e,n).find(function(e){return e.divId===t})}getDataViewConfigs(){return this.#Ji.dataViewConfigs}setDataViewConfigs(e){this.#Gc.empty(),this.#Ji.dataViewConfigs=e,this.#Xc(e)}addDataViewConfig(e,t,n){void 0===n&&(n=!0);const i=this.#Ji.dataViewConfigs;if(void 0===i[e]&&(i[e]=[]),-1!==i[e].findIndex(function(e){return e.divId===t.divId}))throw new Error(`Duplicate view config for data ${e} and div ${t.divId}`);this.#Ji.dataViewConfigs[e].push(t),void 0===this.#Gc.getLayerGroupByDivId(t.divId)&&this.#Wc(t),void 0!==this.#ys.get(e)&&n&&this.render(e,[t])}removeDataViewConfig(e,t){const n=this.#Ji.dataViewConfigs;if(void 0===n[e])return;const i=n[e].findIndex(function(e){return e.divId===t});if(-1===i)return;n[e].splice(i,1),0===n[e].length&&delete n[e];const o=this.#Gc.getLayerGroupByDivId(t);if(void 0!==o){const t=o.getViewLayersByDataId(e);1===t.length&&o.removeLayer(t[0]);const n=o.getDrawLayersByDataId(e);1===n.length&&o.removeLayer(n[0]),0===o.getNumberOfLayers()&&this.#Gc.removeLayerGroup(o)}}updateDataViewConfig(e,t,n){const i=this.#Ji.dataViewConfigs;if(void 0===i[e])throw new Error(`No config for dataId: ${e}`);const o=i[e].findIndex(function(e){return e.divId===t});if(-1===o)throw new Error(`No config for dataId: ${e} and divId: ${t}`);const r=i[e][o];for(const e in n)r[e]=n[e];const a=this.#Gc.getLayerGroupByDivId(r.divId);if(void 0!==a){const t=a.getViewLayersByDataId(e);1===t.length&&a.removeLayer(t[0]);const n=a.getDrawLayersByDataId(e);1===n.length&&a.removeLayer(n[0])}void 0!==this.#ys.get(e)&&this.render(e,[r])}getActiveLayerGroup(){return this.#Gc.getActiveLayerGroup()}setActiveLayerGroup(e){this.#Gc.setActiveLayerGroup(e)}getLayerGroup(e){return this.#Gc.getLayerGroup(e)}getNumberOfLayerGroups(){return this.#Gc.getNumberOfLayerGroups()}getViewLayersByDataId(e){return this.#Gc.getViewLayersByDataId(e)}getViewLayers(e){return this.#Gc.getViewLayers(e)}getDrawLayersByDataId(e){return this.#Gc.getDrawLayersByDataId(e)}getDrawLayers(e){return this.#Gc.getDrawLayers(e)}getLayerGroupByDivId(e){return this.#Gc.getLayerGroupByDivId(e)}getAddedScale(){return this.#Gc.getActiveLayerGroup().getAddedScale()}getBaseScale(){return this.#Gc.getActiveLayerGroup().getBaseScale()}getOffset(){return this.#Gc.getActiveLayerGroup().getOffset()}empty(){this.#Gc.empty()}removeLayersByDataId(e){this.#Gc.removeLayersByDataId(e)}setBinders(e){this.#Gc.setBinders(e)}fitToContainer(){this.#Gc.fitToContainer()}draw(){this.#Gc.draw()}resetLayout(){this.#Gc.reset(),this.#Gc.draw()}resetZoomPan(){this.#Gc.resetZoomPan(),this.#Gc.draw()}resetViews(){this.#Gc.resetViews()}setImageSmoothing(e){this.#Gc.setImageSmoothing(e),this.#Gc.draw()}zoom(e,t,n){const i=this.#Gc.getActiveLayerGroup(),o=i.getBaseViewLayer().getViewController().getCurrentScrollPosition(),r=new m(t,n,o);i.addScale(e,r),i.draw()}translate(e,t){const n=this.#Gc.getActiveLayerGroup();n.addTranslation({x:e,y:t,z:0}),n.draw()}render(e,t){if(null==e)throw new Error("Cannot render without data id");const n=this.#ys.get(e),i=void 0!==n&&void 0!==n.image,o=void 0!==n&&void 0!==n.annotationGroup;if(0===this.#Gc.getNumberOfLayerGroups()&&this.#Xc(this.#Ji.dataViewConfigs),void 0===t&&(t=this.getViewConfigs(e)),0!==t.length)for(let n=0;n<t.length;++n){const r=t[n],a=this.#Gc.getLayerGroupByDivId(r.divId);if(!a)throw new Error(`No layer group for ${r.divId}`);!i||this.#$c(e,a)?(i&&0===a.getViewLayersByDataId(e).length?this.#jc(e,r):o&&0===a.getDrawLayersByDataId(e).length&&this.#Zc(e,r),a.draw()):this.dispatchEvent(new CustomEvent("error",{detail:{error:new Error("Render error: incompatible geometries for overlay"),dataid:e}}))}else s.info(`Not rendering data: ${e} (no data view config)`)}#Kc=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#Xc(e){const t=Object.keys(e),n=[];for(let i=0;i<t.length;++i){const o=e[t[i]];for(let e=0;e<o.length;++e){const t=o[e];n.includes(t.divId)||(this.#Wc(t),n.push(t.divId))}}}#Wc(e){const t=this.#Ji.rootDocument.getElementById(e.divId),n=void 0!==this.#Ji.overlayConfig,i=this.#Gc.addLayerGroup(t,n);this.#_c(i)}#_c(e){e.addEventListener("zoomchange",this.#Kc),e.addEventListener("offsetchange",this.#Kc),e.addEventListener("layerremove",this.#Kc),e.addEventListener("outofrange",this.#Kc),e.addEventListener("renderstart",this.#Kc),e.addEventListener("renderend",this.#Kc);for(const t of Wl)e.addEventListener(t,this.#Kc);e.addEventListener("wlchange",e=>{const t=e.detail?.srclayerid,n=e.detail?.dataid,i=e.detail?.value,o=uc(t).groupDivId,r=this.getViewConfig(n,o,!0);void 0!==r&&(r.windowCenter=void 0,r.windowWidth=void 0,r.wlPresetName=void 0,3===i.length&&(r.windowCenter=i[0],r.windowWidth=i[1],r.wlPresetName=i[2]))}),e.addEventListener("opacitychange",e=>{const t=e.detail?.srclayerid,n=e.detail?.dataid,i=e.detail?.value,o=uc(t).groupDivId,r=this.getViewConfig(n,o,!0);void 0!==r&&(r.opacity=i[0])}),e.addEventListener("colourmapchange",e=>{const t=e.detail?.srclayerid,n=e.detail?.dataid,i=e.detail?.value,o=uc(t).groupDivId,r=this.getViewConfig(n,o,!0);void 0!==r&&(r.colourMap=i[0])})}#$c(e,t){let n=!1;const i=t.getBaseViewLayer();if(void 0!==i){const t=this.#ys.get(i.getDataId()).image,o=this.#ys.get(e).image;if(void 0!==t&&void 0!==o){const e=t.getGeometry().getOrientation();n=o.getGeometry().getOrientation().isSimilar(e,1e-4)}}else n=!0;return n}#jc(e,t){const n=this.#ys.get(e);if(!n)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const i=this.#Gc.getLayerGroupByDivId(t.divId);if(!i)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const o=n.image.getGeometry();this.#Gc.unbindLayerGroups();const r=(new Yl).create(n.meta,n.image),a=je(o.getOrientation(),He(t.orientation));r.setOrientation(a),n.image instanceof ko&&(n.image.initializeContour(),void 0!==t.fillOpacity&&r.setFillOpacity(t.fillOpacity),void 0!==t.contourThickness&&r.setContourThickness(t.contourThickness));const s=0===i.getNumberOfViewLayers();let l=1;void 0!==t.opacity?l=t.opacity:s||(l=r.isMask()?.8:.5);const c=i.addViewLayer();c.setView(r,e);const u=o.getSize(a).get2D(),d=o.getSpacing(a).get2D();c.initialise(u,d,l);const h=c.getViewController();if(void 0!==t.wlPresetName)h.setWindowLevelPreset(t.wlPresetName);else if(void 0!==t.windowCenter&&void 0!==t.windowWidth){const e=new bt(t.windowCenter,t.windowWidth);h.setWindowLevel(e)}void 0!==t.colourMap?h.setColourMap(t.colourMap):s||("PT"===n.image.getMeta().Modality?h.setColourMap("hot"):h.setColourMap("rainbow")),this.#ys.addEventListener("dataimageset",c.onimageset),s&&void 0!==this.#Ji.overlayConfig&&void 0!==this.#Yc&&(i.addInfoData(this.#Yc(e),e),i.bindInfoData(e));const g=[h.getCurrentIndex().getValues(),h.getCurrentPosition().getValues()];i.updateLayersToPositionChange(new CustomEvent("positionchange",{detail:{value:g,srclayerid:c.getId()}})),this.#Gc.fitToContainer(),c.setOffset(i.getOffset());const S=this.#Jc(o.getOrientation(),t.orientation);if(this.#eu(S,c),s)c.setScale(i.getScale());else{const e=i.getBaseViewLayer();c.initScale(i.getScale(),e.getAbsoluteZoomOffset())}this.#Gc.bindLayerGroups(),this.#zc&&this.#zc.bindLayerGroup(i,c),this.dispatchEvent(new CustomEvent("viewlayeradd",{detail:{layerid:c.getId(),layergroupid:i.getDivId(),dataid:e}})),s&&this.#zc&&this.#zc.init()}#Zc(e,t){const n=this.#Gc.getLayerGroupByDivId(t.divId);if(!n)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const i=this.#ys.get(e);if(!i)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const o=i.annotationGroup,r=this.#tu(o,n);if(void 0===r)return void console.warn("No loaded data that matches the measurements reference series UID");const a=r.getDataId();this.#Gc.unbindLayerGroups();const s=r.getViewController();i.annotationGroup.setViewController(s);const l=this.#ys.get(a);if(!l)throw new Error(`Cannot initialise layer without reference data, id: ${a}`);const c=l.image.getGeometry(),u=je(c.getOrientation(),He(t.orientation)),d=c.getSize(u).get2D(),h=c.getSpacing(u).get2D(),g=n.addDrawLayer();g.initialise(d,h,r.getId());const S=new Kl(c,u);g.setPlaneHelper(S);const m=[s.getCurrentIndex().getValues(),s.getCurrentPosition().getValues()];n.updateLayersToPositionChange(new CustomEvent("positionchange",{detail:{value:m,srclayerid:g.getId()}})),this.#Gc.fitToContainer(),g.setOffset(n.getOffset());const p=this.#Jc(c.getOrientation(),t.orientation);this.#eu(p,g),g.initScale(n.getScale(),r.getAbsoluteZoomOffset()),g.setAnnotationGroup(i.annotationGroup,e,this.#Hc),g.setCurrentPosition(s.getCurrentPosition(),s.getCurrentIndex()),this.#Gc.bindLayerGroups(),this.#zc&&this.#zc.bindLayerGroup(n,g),this.dispatchEvent(new CustomEvent("drawlayeradd",{detail:{layerid:g.getId(),layergroupid:n.getDivId(),dataid:e}}))}#tu(e,t){let n;const i=e.getMetaValue("CurrentRequestedProcedureEvidenceSequence");if(void 0!==i){const e=i.value[0],o=e?.ReferencedSeriesSequence,r=o?.value[0],a=r?.SeriesInstanceUID,s={SeriesInstanceUID:a},l=t.searchViewLayers(s);0!==l.length&&(n=l[0])}const o=e.getMetaValue("ReferencedSeriesSequence");if(void 0!==o){const e=o.value[0],i=e?.SeriesInstanceUID,r={SeriesInstanceUID:i},a=t.searchViewLayers(r);0!==a.length&&(n=a[0])}if(void 0===n)for(const i of e.getList()){const e={SOPInstanceUID:i.referencedSopInstanceUID,SOPClassUID:i.referencedSopClassUID},o=t.searchViewLayers(e);if(0!==o.length){n=o[0];break}}return n}#Jc(e,t){const n=Ye(e.asOneAndZeros());if(void 0===n)throw new Error("Unsupported undefined orientation code");const i=void 0===t,o=!i&&t===ze.Axial,r=!i&&t===ze.Coronal,a=!i&&t===ze.Sagittal,l={x:!1,y:!1},c={x:!1,y:!1,z:!1};return"LPS"===n?(r||a)&&(c.z=!0,l.y=!0):"LAI"===n?i||o?l.y=!0:r?c.z=!0:a&&(c.z=!0,l.x=!0):"RPI"===n?i||o?l.x=!0:r?(c.z=!0,l.x=!0):a&&(c.z=!0):"RAS"===n?(l.x=!0,l.y=!0,(r||a)&&(c.z=!0)):"LSA"===n?(l.y=!0,i||r?c.z=!0:o?c.y=!0:a&&(l.x=!0,c.y=!0,c.z=!0)):"RSP"===n?i||r?(l.x=!0,l.y=!0,c.x=!0,c.z=!0):o?(l.x=!0,c.x=!0):a&&(l.y=!0,c.z=!0):"RIA"===n?(l.x=!0,i||r?c.x=!0:o?(l.y=!0,c.x=!0,c.y=!0):a&&(c.y=!0)):"PSL"===n?(c.z=!0,(i||a||r)&&(l.y=!0)):"PIR"===n?(c.z=!0,(o||r)&&(l.x=!0)):"ASR"===n?(l.x=!0,l.y=!0,(i||a||r)&&(c.z=!0)):"AIL"===n?i||a?(l.x=!0,c.z=!0):o?l.y=!0:r&&(c.z=!0):"LIP"!==n&&s.warn(`Unsupported orientation code: ${n}, display could be incorrect`),{scale:c,offset:l}}#eu(e,t){e.offset.x&&t.addFlipOffsetX(),e.offset.y&&t.addFlipOffsetY(),e.scale.x&&t.flipScaleX(),e.scale.y&&t.flipScaleY(),e.scale.z&&t.flipScaleZ()}}class bu{divId;orientation;colourMap;opacity;fillOpacity;contourThickness;wlPresetName;windowCenter;windowWidth;constructor(e){this.divId=e}}class xu{options;constructor(e){this.options=e}}class Eu{dataViewConfigs;tools;binders;viewOnFirstLoadItem;defaultCharacterSet;overlayConfig;rootDocument;constructor(e){this.dataViewConfigs=e}}class Ru extends EventTarget{#Ji=null;#ys=null;#zc=null;#nu=null;#Za=null;#iu=null;#bs=new _t;#Va={};getDataController(){return this.#ys}getData(e){return s.debug("App.getData: deprecated since v0.37, please use via app.getDataController."),this.#ys.get(e)}getImage(e){let t;return s.debug("App.getImage: deprecated since v0.34, please use the getData method."),void 0!==this.#ys.get(e)&&(t=this.#ys.get(e).image),t}setImage(e,t){s.debug("App.setImage: deprecated since v0.37, please use via app.getDataController."),this.#ys.setImage(e,t)}getNextDataId(){return s.debug("App.getNextDataId: deprecated since v0.37, please use via app.getDataController."),this.#ys.getNextDataId()}addData(e,t){return s.debug("App.addData: deprecated since v0.37, please use via app.getDataController."),this.#ys.add(e,t)}getMetaData(e){let t;return s.debug("App.getMetaData: deprecated since v0.37, please use via app.getDataController."),void 0!==this.#ys.get(e)&&(t=this.#ys.get(e).meta),t}getDataIds(){return s.debug("App.getDataIds: deprecated since v0.37, please use via app.getDataController."),this.#ys.getDataIds()}getDataIdsFromSopUids(e){return s.debug("App.getDataIdsFromSopUids: deprecated since v0.37, please use via app.getDataController."),this.#ys.getDataIdsFromSopUids(e)}getDataIdFromSeriesUid(e){return s.debug("App.getDataIdFromSeriesUid: deprecated since v0.37, please use via app.getDataController."),this.#ys.getDataIdFromSeriesUid(e)}canScroll(){return s.debug("App.canScroll: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Za.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()}canWindowLevel(){return s.debug("App.canWindowLevel: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Za.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()}getAddedScale(){return s.debug("App.getAddedScale: deprecated since v0.37, please access from the active layer group."),this.#Za.getAddedScale()}getBaseScale(){return s.debug("App.getBaseScale: deprecated since v0.37, please access from the active layer group."),this.#Za.getBaseScale()}getOffset(){return s.debug("App.getOffset: deprecated since v0.37, please access from the active layer group."),this.#Za.getOffset()}getToolboxController(){return this.#zc}getStageController(){return this.#Za}getUndoController(){return this.#iu}getActiveLayerGroup(){return s.debug("App.getActiveLayerGroup: deprecated since v0.37, use app.getStageController().getActiveLayerGroup()"),this.#Za.getActiveLayerGroup()}setActiveLayerGroup(e){s.debug("App.setActiveLayerGroup: deprecated since v0.37, use app.getStageController().setActiveLayerGroup()"),this.#Za.setActiveLayerGroup(e)}getViewLayersByDataId(e){return s.debug("App.getViewLayersByDataId: deprecated since v0.37, use app.getStageController().getViewLayersByDataId()"),this.#Za.getViewLayersByDataId(e)}getViewLayers(e){return s.debug("App.getViewLayers: deprecated since v0.37, use app.getStageController().getViewLayers()"),this.#Za.getViewLayers(e)}getDrawLayersByDataId(e){return s.debug("App.getDrawLayersByDataId: deprecated since v0.37, use app.getStageController().getDrawLayersByDataId()"),this.#Za.getDrawLayersByDataId(e)}getDrawLayers(e){return s.debug("App.getDrawLayers: deprecated since v0.37, use app.getStageController().getDrawLayers()"),this.#Za.getDrawLayers(e)}getLayerGroupByDivId(e){return s.debug("App.getLayerGroupByDivId: deprecated since v0.37, use app.getStageController().getLayerGroupByDivId()"),this.#Za.getLayerGroupByDivId(e)}getNumberOfLayerGroups(){return s.debug("App.getNumberOfLayerGroups: deprecated since v0.37, use app.getStageController().getNumberOfLayerGroups()"),this.#Za.getNumberOfLayerGroups()}getStyle(){return this.#bs}addToUndoStack=e=>{s.debug("App.addToUndoStack: deprecated since v0.37, please use via app.getUndoController."),null!==this.#iu&&this.#iu.addToUndoStack(e)};removeFromUndoStack=e=>{s.debug("App.removeFromUndoStack: deprecated since v0.37, please use via app.getUndoController.");let t=!1;return null!==this.#iu&&(t=this.#iu.removeFromUndoStack(e)),t};init(e){this.#Ji=e,void 0===this.#Ji.viewOnFirstLoadItem&&(this.#Ji.viewOnFirstLoadItem=!0),void 0===this.#Ji.dataViewConfigs&&(this.#Ji.dataViewConfigs={}),void 0===this.#Ji.rootDocument&&"undefined"!=typeof document&&(this.#Ji.rootDocument=document),this.#nu=new Ol(this.#Ji.defaultCharacterSet),this.#nu.addEventListener("loadstart",this.#ou),this.#nu.addEventListener("loaditem",this.#ru),this.#nu.addEventListener("load",this.#au);for(const e of Al)"loadstart"!==e&&"loaditem"!==e&&"load"!==e&&this.#nu.addEventListener(e,this.#ta);this.#ys=new dl;for(const e of sl)this.#ys.addEventListener(e,this.#ta);for(const e of Ut)this.#ys.addEventListener(e,this.#ta);for(const e of Nt)this.#ys.addEventListener(e,this.#ta);this.#iu=new xl;for(const e of bl)this.#iu.addEventListener(e,this.#ta);this.#Za=new Ou(this.#ys,this.#Ji),this.#Za.setAddToUndoStack(e=>this.#iu.addToUndoStack(e)),this.#Za.setGetInfoData(e=>this.getInfoData(e));for(const e of Au)this.#Za.addEventListener(e,this.#ta);if(void 0!==this.#Ji.tools){const e={},t=Object.keys(this.#Ji.tools);for(let n=0;n<t.length;++n){const i=t[n];let o=Tu[i];if(void 0===o&&(o=wu[i]),void 0!==o){if(e[i]=new o(this),void 0!==e[i].addEventListener){const t=e[i].getEventNames();for(let n=0;n<t.length;++n)e[i].addEventListener(t[n],this.#ta)}const t=this.#Ji.tools[i];if(void 0!==t.options&&0!==t.options.length){let n,o="raw";if(void 0!==e[i].getOptionsType&&(o=e[i].getOptionsType()),"instance"===o||"factory"===o){n={};for(let e=0;e<t.options.length;++e){const r=t.options[e];let a=r;"factory"===o&&(a+="Factory");const l=i.charAt(0).toLowerCase()+i.slice(1);let c,u=Ss[l];void 0!==u&&(c=u[a]),void 0===c&&(u=ms[l],void 0!==u&&(c=u[a])),void 0!==c?n[r]=c:s.warn(`Could not find option class for: ${r}`)}}else n=t.options;e[i].setOptions(n)}}else s.warn(`Could not initialise unknown tool: ${i}`)}this.#zc=new dn(e),this.#Za.setToolboxController(this.#zc)}}reset(){this.#Za.empty(),this.#Va={},this.#iu&&this.#iu.reset()}resetLayout(){s.debug("App.resetLayout: deprecated since v0.35, prefer resetZoomPan."),this.#Za.resetLayout()}resetZoomPan(){s.debug("App.resetZoomPan: deprecated since v0.37, use app.getStageController().resetZoomPan()"),this.#Za.resetZoomPan()}resetViews(){s.debug("App.resetViews: deprecated since v0.37, use app.getStageController().resetViews()"),this.#Za.resetViews()}loadFiles=e=>{if(0===e.length)return s.warn("Ignoring empty input file list."),"-1";const t=this.#ys.getNextDataId();return this.#nu.loadFiles(e,t),t};loadURLs=(e,t)=>{if(0===e.length)return s.warn("Ignoring empty input url list."),"-1";const n=this.#ys.getNextDataId();return this.#nu.loadURLs(e,n,t),n};loadFromUri=(e,t)=>{s.debug("App.loadFromUri: deprecated since v0.36, please extract the file list and pass it to loadURLs.");const n=en(e);n&&void 0!==n.input&&function(e,t,n){e.type&&"manifest"===e.type?rn(e.input,e.nslices,t):t(on(e.input,e.dwvReplaceMode),n)}(n,this.loadURLs,t)};loadImageObject=e=>{const t=this.#ys.getNextDataId();return this.#nu.loadImageObject(e,t),t};abortAllLoads(){const e=this.#nu.getLoadingDataIds();for(const t of e)this.abortLoad(t)}abortLoad(e){this.#nu.abort(e),this.#ys.remove(e),this.#Za.removeLayersByDataId(e)}fitToContainer(){s.debug("App.fitToContainer: deprecated since v0.37, use app.getStageController().fitToContainer()"),this.#Za.fitToContainer()}initWLDisplay(){s.debug("App.initWLDisplay: deprecated since v0.33, please set the opacity of the desired view layer directly."),this.#Za.getActiveLayerGroup().getActiveViewLayer().getViewController().initialise()}setImageSmoothing(e){s.debug("App.setImageSmoothing: deprecated since v0.37, use app.getStageController().setImageSmoothing()"),this.#Za.setImageSmoothing(e)}getViewConfigs(e,t){return s.debug("App.getViewConfigs: deprecated since v0.37, use app.getStageController().getViewConfigs()"),this.#Za.getViewConfigs(e,t)}getViewConfig(e,t,n){return s.debug("App.getViewConfig: deprecated since v0.37, use app.getStageController().getViewConfig()"),this.#Za.getViewConfig(e,t,n)}getDataViewConfigs(){return s.debug("App.getDataViewConfigs: deprecated since v0.37, use app.getStageController().getDataViewConfigs()"),this.#Za.getDataViewConfigs()}setDataViewConfigs(e){s.debug("App.setDataViewConfigs: deprecated since v0.37, use app.getStageController().setDataViewConfigs()"),this.#Za.setDataViewConfigs(e)}addDataViewConfig(e,t,n){s.debug("App.addDataViewConfig: deprecated since v0.37, use app.getStageController().addDataViewConfig()"),this.#Za.addDataViewConfig(e,t,n)}removeDataViewConfig(e,t){s.debug("App.removeDataViewConfig: deprecated since v0.37, use app.getStageController().removeDataViewConfig()"),this.#Za.removeDataViewConfig(e,t)}updateDataViewConfig(e,t,n){s.debug("App.updateDataViewConfig: deprecated since v0.37, use app.getStageController().updateDataViewConfig()"),this.#Za.updateDataViewConfig(e,t,n)}setLayerGroupsBinders(e){const t=[];for(let n=0;n<e.length;++n)void 0!==Lu[e[n]]&&t.push(new Lu[e[n]]);this.#Za.setBinders(t)}render(e,t){s.debug("App.render: deprecated since v0.37, use app.getStageController().render()"),this.#Za.render(e,t)}zoom(e,t,n){s.debug("App.zoom: deprecated since v0.37, please access from the active layer group."),this.#Za.zoom(e,t,n)}translate(e,t){s.debug("App.translate: deprecated since v0.37, please access from the active layer group."),this.#Za.translate(e,t)}resampleMatch(e,t){const n=this.#ys.get(e);if(void 0===n)return void s.debug(`Cannot resample match, target data '${e}' is undefined`);if(void 0===n.image)return void s.debug(`Cannot resample match, target image '${e}' is undefined`);const i=this.#ys.get(t);if(void 0===i)return void s.debug(`Cannot resample match, source data '${t}' is undefined`);if(void 0===i.image)return void s.debug(`Cannot resample match, source image '${t}' is undefined`);const o=n.image.getGeometry().getOrientation(),r=i.image.getGeometry().getOrientation();o.equals(r)?s.info(`Same orientation, no resample match for data '${e}' and '${t}'`):this.resample(e,r)}resample(e,t){const n=this.#ys.get(e);if(void 0===n)return void s.debug(`Cannot resample, target data '${e}' is undefined`);if(void 0===n.image)return void s.debug(`Cannot resample, target image '${e}' is undefined`);if(n.image.getGeometry().getOrientation().equals(t))return void s.info(`Same orientation, no resample for data '${e}'`);n.image.resample(t);const i=this.#Ji.dataViewConfigs,o=n.image.getMeta(),r=this.#ys.getDataIds();for(let e=0;e<r.length;e++){const t=this.#ys.get(r[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===o.SeriesInstanceUID&&this.#ys.stash(r[e])}const a=this.getStageController();a.setDataViewConfigs(i);const l=this.#ys.getDataIds();for(let e=0;e<l.length;++e)a.render(l[e])}revertResample(e){const t=this.#ys.get(e);if(void 0===t)return void s.debug(`Cannot revert resample, target data '${e}' is undefined`);if(void 0===t.image)return void s.debug(`Cannot revert resample, target image '${e}' is undefined`);if(!t.image.isResampled())return void s.info(`No revert resample needed for data '${e}'`);t.image.revert();const n=this.#Ji.dataViewConfigs,i=t.image.getMeta(),o=this.#ys.getStashedDataIds();for(let e=0;e<o.length;e++){const t=this.#ys.getStashed(o[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===i.SeriesInstanceUID&&this.#ys.unstash(o[e])}const r=this.getStageController();r.setDataViewConfigs(n);const a=this.#ys.getDataIds();for(let e=0;e<a.length;++e)r.render(a[e])}setOpacity(e){s.debug("App.setOpacity: deprecated since v0.33, please set the opacity of the desired view layer directly.");const t=this.#Za.getActiveLayerGroup().getActiveViewLayer();t.setOpacity(e),t.draw()}onResize=()=>{this.getStageController().fitToContainer()};onKeydown=e=>{this.dispatchEvent(new CustomEvent("keydown",{detail:{key:e.key,code:e.code,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,context:e.context}}))};defaultOnKeydown=e=>{if(e.ctrlKey)if(e.shiftKey){const t=this.#Za.getActiveLayerGroup(),n=t.getPositionHelper();"ArrowLeft"===e.key?t.moreThanOne(3)&&n.decrementPosition(3):"ArrowUp"===e.key?t.canScroll()&&n.incrementPositionAlongScroll():"ArrowRight"===e.key?t.moreThanOne(3)&&n.incrementPosition(3):"ArrowDown"===e.key&&t.canScroll()&&n.decrementPositionAlongScroll()}else if("y"===e.key)this.#iu.redo();else if("z"===e.key)this.#iu.undo();else if(" "===e.key){const e=this.#Za.getNumberOfLayerGroups();for(let t=0;t<e;++t)this.#Za.getLayerGroup(t).setShowCrosshair(!this.#Za.getLayerGroup(t).getShowCrosshair())}};resetDisplay(){this.resetLayout(),this.initWLDisplay()}resetZoom(){this.resetLayout()}setColourMap(e){s.debug("App.setColourMap: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Za.getActiveLayerGroup().getActiveViewLayer().getViewController().setColourMap(e)}setWindowLevelPreset(e){s.debug("App.setWindowLevelPreset: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Za.getActiveLayerGroup().getActiveViewLayer().getViewController().setWindowLevelPreset(e)}setTool(e){for(let e=0;e<this.#Za.getNumberOfLayerGroups();++e){const t=this.#Za.getLayerGroup(e),n=t.getActiveLayer();void 0!==n&&this.#zc.bindLayerGroup(t,n)}this.#zc.setSelectedTool(e)}setToolFeatures(e){this.#zc.setToolFeatures(e)}undo(){s.debug("App.undo: deprecated since v0.37, please use via app.getUndoController."),this.#iu.undo()}redo(){s.debug("App.redo: deprecated since v0.37, please use via app.getUndoController."),this.#iu.redo()}getStackSize(){return s.debug("App.getStackSize: deprecated since v0.37, please use via app.getUndoController."),this.#iu.getStackSize()}getCurrentStackIndex(){return s.debug("App.getCurrentStackIndex: deprecated since v0.37, please use via app.getUndoController."),this.#iu.getCurrentStackIndex()}getInfoData(e){let t;return void 0!==this.#Va&&(t=this.#Va[e]),t}toggleInfoDataListeners(e){const t=this.getInfoData(e);void 0!==t&&(t.isListening()?t.removeAppListeners():t.addAppListeners())}createAnnotationData(e){const t=this.#ys.get(e).image.getMeta(),n=new cl({});n.annotationGroup=new Qt,n.annotationGroup.setMetaValue("Modality","SR");const i=["PatientName","PatientID","PatientBirthDate","PatientSex","StudyDate","StudyTime","StudyInstanceUID","StudyID","StudyDescription"];for(const e of i)n.annotationGroup.setMetaValue(e,t[e]);return n.annotationGroup.setMetaValue("CurrentRequestedProcedureEvidenceSequence",{value:[{ReferencedSeriesSequence:{value:[{SeriesInstanceUID:t.SeriesInstanceUID}]},StudyInstanceUID:t.StudyInstanceUID}]}),n}addAndRenderAnnotationData(e,t,n){const i=this.#ys,o=i.getNextDataId();if(!i.add(o,e))throw new Error("Cannot add annotation data");const r=this.#Za.getViewConfigs(n).find(e=>e.divId===t);if(void 0===r)throw new Error("No reference data view config for draw");const a=new bu(t);a.orientation=r.orientation,this.#Za.addDataViewConfig(o,a),this.#Za.render(o)}#ta=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#ou=e=>{void 0!==this.#Ji.overlayConfig&&0===Object.keys(this.#Va).length&&(this.#Va[e.detail.dataid]=new ql(this,e.detail.dataid,this.#Ji.overlayConfig)),this.#ta(e)};#ru=e=>{void 0===e.detail.data&&s.error("Missing loaditem event data.");const t=e.detail.isfirstitem;try{t?this.#ys.add(e.detail.dataid,e.detail.data):this.#ys.update(e.detail.dataid,e.detail.data)}catch(t){return this.dispatchEvent(new CustomEvent("error",{detail:{dataid:e.detail.dataid,source:e.detail.source,error:t}})),this.abortLoad(e.detail.dataid),void this.dispatchEvent(new CustomEvent("loadend",{detail:{dataid:e.detail.dataid,source:e.detail.source}}))}this.#ta(e),void 0!==this.#Va&&void 0!==this.#Va[e.detail.dataid]&&this.#Va[e.detail.dataid].addItemMeta(e.detail.data.meta),t&&this.#Ji.viewOnFirstLoadItem&&0!==this.#Za.getViewConfigs(e.detail.dataid).length&&this.#Za.render(e.detail.dataid)};#au=e=>{const t=this.#ys.markDataAsComplete(e.detail.dataid);this.#Ji.viewOnFirstLoadItem&&void 0!==t.imageHasChanged&&t.imageHasChanged&&this.#Za.render(e.detail.dataid),this.#ta(e)}}class Fu extends ss{#kt;#su;#Fl;#lu;constructor(e,t,n){super(),this.#kt=e,this.#su=t,this.#Fl=void 0!==n&&n,void 0!==t.displayRGBValue?this.#lu=e.getOffsets(t.number):this.#lu=e.getOffsets(t.displayValue)}getName(){return"Delete-segment"}isValid(){return this.#kt.getMeta().custom.segments.some(e=>e.number===this.#su.number)}execute(){if(0!==this.#lu.length){const e=this.#kt.getSegmentCollection(),t=this.#su.number,n=this.#lu.map(function(n){return e?.getOtherValueAtOffset(n,t)??0});this.#kt.setAtOffsetsWithValues(this.#lu,n)}new Bo(this.#kt).removeSegment(this.#su.number),this.#Fl||this.onExecute({type:"masksegmentdelete",segmentnumber:this.#su.number})}undo(){0!==this.#lu.length&&(void 0!==this.#su.displayRGBValue?this.#kt.setAtOffsets(this.#lu,this.#su.number):this.#kt.setAtOffsets(this.#lu,this.#su.displayValue)),new Bo(this.#kt).addSegment(this.#su),this.onUndo({type:"masksegmentredraw",segmentnumber:this.#su.number})}onExecute(e){}onUndo(e){}}class Mu extends ss{#kt;#su;#cu;#uu;#Fl;#lu;constructor(e,t,n,i){super(),this.#kt=e,this.#su=t,this.#cu=n,this.#Fl=void 0!==i&&i,void 0!==t.displayRGBValue?this.#uu=t.displayRGBValue:(this.#uu=t.displayValue,this.#lu=e.getOffsets(this.#uu))}getName(){return"Change-segment-colour"}isValid(){let e=!0;return void 0!==this.#lu&&(e=0!==this.#lu.length),e}execute(){"number"==typeof this.#cu?(this.#kt.setAtOffsets(this.#lu,this.#cu),this.#su.displayValue=this.#cu):(this.#kt.updatePaletteColourMap(this.#su.number,this.#cu),this.#su.displayRGBValue=this.#cu),this.#Fl||this.onExecute({type:"changemasksegmentcolour",segmentnumber:this.#su.number,value:[this.#cu]})}undo(){"number"==typeof this.#uu?(this.#kt.setAtOffsets(this.#lu,this.#uu),this.#su.displayValue=this.#uu):(this.#kt.updatePaletteColourMap(this.#su.number,this.#uu),this.#su.displayRGBValue=this.#uu),this.onUndo({type:"changemasksegmentcolour",segmentnumber:this.#su.number,value:[this.#uu]})}onExecute(e){}onUndo(e){}}class qu{diameter;offset1;offset2}class Uu{major;minor}class Vu{centroid;centroidIndex;volume;count;diameters;height;id;largestSliceZ;minZ;maxZ}class Nu{x;y}class Qu{x;y;z}export{Qs as Annotation,Qt as AnnotationGroup,zs as AnnotationGroupFactory,Ru as App,Eu as AppOptions,mt as BooleanResult,Gs as CADReport,Mu as ChangeSegmentColourCommand,Qr as Circle,Yo as ColourMap,ss as Command,dl as DataController,se as DataElement,Fu as DeleteSegmentCommand,qu as Diameter,Uu as Diameters,Tn as DicomCode,cl as DicomData,Ue as DicomParser,ba as DicomSRContent,Us as DicomWriter,kc as DrawBrushCommand,Bc as DrawBrushCommandProperties,rc as DrawController,ac as DrawLayer,Qc as DrawShapeHandler,Br as Ellipse,Ct as Geometry,Rt as Histogram,Vt as Image,Vo as ImageContour,qt as ImageHistogram,a as Index,ql as InfoData,El as InfoDataItem,Vu as Label,gc as LayerGroup,Ko as MaskFactory,ko as MaskImage,ki as MaskSegment,Bo as MaskSegmentHelper,Xl as MaskSegmentViewHelper,Qe as Matrix33,Hi as NormalisedManufacturers,c as NumberRange,ze as Orientation,Kl as PlaneHelper,C as Point,S as Point2D,m as Point3D,Jl as PositionHelper,Vr as Protractor,Bt as RGB,Nr as ROI,Xs as RTROI,Ys as RTROIContour,Gr as Rectangle,Ve as RescaleSlopeAndIntercept,ks as ResponseEvaluation,al as RtStructFactory,cs as RunFilterCommand,Nu as Scalar2D,Qu as Scalar3D,Ql as ScrollWheelBehavior,Qo as SegmentCollection,St as Size,Ze as Spacing,Ou as StageController,F as Tag,ie as TagInfo,xu as ToolConfig,dn as ToolboxController,xl as UndoController,g as Vector3D,jl as View,bu as ViewConfig,ec as ViewController,tc as ViewLayer,Nl as WheelBehavior,bt as WindowLevel,er as WindowPreset,Cs as WriterRule,vs as WriterRuleActions,X as addTagsToDictionary,tl as bufferToPolygons,R as buildMultipart,Ne as custom,oo as defaultPrivateBValueRules,Tu as defaultToolList,ms as defaultToolOptions,ro as defaultVolumeIdCandidates,lr as demoCreateImage,Jo as demoCreateMaskImage,$l as demoCreateView,xt as equalWl,Ei as getAsSimpleTagValues,Zs as getDefaultDicomRTStructJson,Zo as getDefaultDicomSegJson,Ea as getDicomSRContentItem,re as getDicomTagGroupName,oe as getDicomTagInfo,Se as getDwvVersion,Fi as getElementsFromSimpleTagValues,kr as getEllipseIndices,dc as getLayerDetailsFromEvent,Yi as getManufacturer,cn as getMousePoint,Xi as getNormalisedManufacturer,We as getOrientationName,k as getPixelDataTag,Ws as getRTStructFromElements,zr as getRectangleIndices,rt as getReferencedSeriesUID,at as getReferencedSeriesUIDFromRTStruct,Ie as getReverseOrientation,xa as getSRContent,ni as getSegmentationCode,q as getTagFromKey,ln as getTouchPoints,be as getTypedArray,bs as getUID,tn as getURLsFromKeyValueUri,nn as handleURLsFromWeasisXMLManifest,Ce as hasDicomPrefix,zt as hexToRgb,y as i18n,kt as isEqualRgb,Xt as labToUintLab,s as logger,Xo as luts,_o as mergeMaskImages,Ri as mergeTagValues,h as precisionRound,Ht as rgbToHex,il as simplifyPolygon,jt as srgbToCielab,wu as toolList,Ss as toolOptions,ws as translateWriterRules};
2
2
  //# sourceMappingURL=dwv.node.min.js.map