dwv 0.37.0-beta.13 → 0.37.0-beta.15
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.
- package/dist/assets/workers/resampling.worker.min.js.map +1 -1
- package/dist/dwv.d.ts +298 -212
- package/dist/dwv.min.js +1 -1
- package/dist/dwv.min.js.map +1 -1
- package/dist/dwv.node.min.js +1 -1
- package/dist/dwv.node.min.js.map +1 -1
- package/package.json +19 -18
package/dist/dwv.node.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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)}};class l{success;message;constructor(e){this.success=e}}Number.EPSILON;class c{value;unit}class u{min;max;constructor(e,t){this.min=e,this.max=t}}function d(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)<n}function h(e,t,n,i){return function(e,t,n){void 0===t&&(t=Number.EPSILON),void 0===n&&(n=1);const i=Math.abs(e)/t,o=i<n,r=new l(o);return o||(r.message=`${S(i,2)}`),r}(e-t,n,i)}function g(e){let t=e>1e-4;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 S(e,t){const n=Math.pow(10,t),i=.01/n;return Math.round(e*n+i)/n}class p{#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 p(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 m{#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}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 f{#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&&d(this.#n,e.getX(),t)&&d(this.#i,e.getY(),t)&&d(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 p(this.#n-e.getX(),this.#i-e.getY(),this.#o-e.getZ())}}function v(e,t){return e.some(function(e){return t.equals(e)})}function C(e){return new f(e[0],e[1],e[2])}class D{#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 D(t)}mergeWith3D(e){const t=this.getValues();return t[0]=e.getX(),t[1]=e.getY(),t[2]=e.getZ(),new D(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"}[n[1]]),t}};function I(e,t){return null!=e&&null!=t&&e.substring(e.length-t.length)===t}function w(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 T(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 L(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 P(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 A(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 O(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&b(e.slice().sort(),t.slice().sort())}function b(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 x(e){return String.fromCharCode(...e)}function E(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 R(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 F(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=L(a);o.push(l),i+=l.byteLength+e[r].data.byteLength}const r=L(`${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 M{#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 q(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 U(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 M(e.substring(0,4),e.substring(4,8))}function V(){return new M("FFFE","E000")}function Q(e){return"FFFEE000"===e.getKey()}function N(){return new M("FFFE","E00D")}function B(e){return"FFFEE00D"===e.getKey()}function k(e){return"FFFEE0DD"===e.getKey()}function G(){return new M("7FE0","0010")}function z(e){return["7FE00010","7FE00009","7FE00008"].includes(e.getKey())}function H(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 Y(e){return void 0!==H(e)}const X=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 W(e,t){X[e]=t}const $={"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"},j={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 Z(e){return void 0!==j[e]}const _={SH:!0,LO:!0,UC:!0,ST:!0,LT:!0,UT:!0,PN:!0};function K(e){return void 0!==_[e]}const J={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"},ee={"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)"},te="1.2.840.10008.1.2",ne="1.2.840.10008.1.2.1",ie="1.2.840.10008.1.2.2";class oe{#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 re(e){if(void 0===e)return;let t;const n=e.getGroup(),i=e.getElement();if(void 0!==X[n]&&void 0!==X[n][i]){const e=X[n][i];t=new oe(e[0],parseInt(e[1],10),e[2])}return t}function ae(e){return $[e.getGroup()]}function se(e){if(null==e)return;const t=Object.keys(X);for(const n of t){const t=Object.keys(X[n]);for(const i of t)if(X[n][i][2]===e)return new M(n,i)}}class le{vr;value;tag;vl;undefinedLength;startOffset;endOffset;items;constructor(e){this.vr=e}}function ce(e){return void 0!==e&&void 0!==e.value&&0!==e.value.length}function ue(e,t){let n;return ce(e[t])&&(n=e[t].value[0]),n}function de(e,t){let n;return ce(e[t])&&(n=e[t].value),n}function he(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 Se{#d;#h=!0;#g=function(){return new Int8Array(new Int16Array([1]).buffer)[0]>0}();#S;#p;constructor(e,t){this.#d=e,void 0!==t&&(this.#h=t),this.#S=this.#h!==this.#g,this.#p=new DataView(e)}readUint16(e){return this.#p.getUint16(e,this.#h)}readInt16(e){return this.#p.getInt16(e,this.#h)}readUint32(e){return this.#p.getUint32(e,this.#h)}readBigUint64(e){return this.#p.getBigUint64(e,this.#h)}readInt32(e){return this.#p.getInt32(e,this.#h)}readBigInt64(e){return this.#p.getBigInt64(e,this.#h)}readFloat32(e){return this.#p.getFloat32(e,this.#h)}readFloat64(e){return this.#p.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&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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 pe(){return"0.37.0-beta.13"}function me(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=me(e),o=me(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){return!(e.byteLength<132)&&"DICM"===new Uint8Array(e,128,4).reduce(function(e,t){return e+String.fromCharCode(t)},"")}const Ce=String.fromCharCode("u200B");class De{decode(e){let t="";for(let n=0,i=e.length;n<i;++n)t+=String.fromCharCode(e[n]);return t}}function ye(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 Ie(e){return e===te}function we(e){return e===ie}function Te(e){return"1.2.840.10008.1.2.4.50"===e||"1.2.840.10008.1.2.4.51"===e}function Le(e){return"1.2.840.10008.1.2.4.57"===e||"1.2.840.10008.1.2.4.70"===e}function Pe(e){return null!==e.match(/1.2.840.10008.1.2.4.9/)}function Ae(e){return"1.2.840.10008.1.2.5"===e}function Oe(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));s.error(`Cannot allocate array of size: ${n} (>2^${e}).`)}}return i}function be(e,t){return t?8:Z(e)?12:8}const xe="00280100",Ee="00280103";class Re{#m={};#f;#v=new De;#C=this.#v;#D(e){return this.#v.decode(e)}#y(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.#m}safeGet(e){return ue(this.#m,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 M(n,i),endOffset:t}}#w(e,t,n){const i={};let o=this.#T(e,t,n);if(t=o.endOffset,k(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=B(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=k(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 le("");return e.tag=r,e}t=o.endOffset;let a,l="NONE",c=!0;r.isWithVR()&&(n?(l=re(r)?.getVr(),void 0===l&&(l="UN"),c=!0):(l=this.#D(e.readUint8Array(t,2)),t+=2*Uint8Array.BYTES_PER_ELEMENT,c=Z(l),c&&(t+=2*Uint8Array.BYTES_PER_ELEMENT))),function(e){return Object.keys(J).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(z(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 le(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=J[r];if(z(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 if(l>8&&"OB"===r&&(s.warn("Reading DICOM pixel data with bitsAllocated>8 and OB VR, treating as OW"),e.vr="OW"),u=[],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)u.push(t.readFloat32Array(a,o));else{if(64!==l)throw new Error(`Unsupported bits allocated: ${l}`);u.push(t.readFloat64Array(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.#y(e):this.#D(e),u=function(e){let t=e;const n=e.length-1;return e[n]===Ce&&(t=e.substring(0,n)),t=t.trim(),t}(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[xe];void 0!==n&&void 0!==n.value&&(a=n.value[0]),n=i[Ee],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 Se(e);let a=new Se(e);n=128;const l=this.#D(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.#m[o.tag.getKey()]=o;const e=n+o.value[0];for(;n<e;)o=this.#T(r,n,!1),n=o.endOffset,this.#m[o.tag.getKey()]=o;if(o=this.#m["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?te:ne;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 le("UI");return l.tag=new M("0002","0010"),l.value=[s],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(o);this.#m[e.tag.getKey()]=e,i=e.value[0],n=0}if(!function(e){return e===te||e===ne||e===ie||Te(e)||Le(e)||Pe(e)||Ae(e)}(i))throw new Error(`Unsupported DICOM transfer syntax: '${i}' (${function(e){let t="Unknown";return void 0!==ee[e]&&(t=ee[e]),t}(i)})`);let c=!1;Ie(i)&&(c=!0),we(i)&&(a=new Se(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.#m[e]?this.#m[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}`),Y(this.#m)){let e=0;o=this.#m[Ee],void 0!==o?(o.value=this.#P(o,a),e=o.value[0]):s.warn("Reading DICOM pixel data with default pixelRepresentation.");let t=16;o=this.#m[xe],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.#m["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.#m["00280010"],void 0!==o&&(o.value=this.#P(o,a),n=parseInt(o.value[0],10)),o=this.#m["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.#m["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.#m,a,u),o=this.#m["7FE00010"],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}}}}function Fe(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 Me(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function qe(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 p=e.getNumberOfComponents(),m=1===e.getPlanarConfiguration(),f=function(e,t,n,i,o,r,a,s){return 1===p?Fe(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(Fe(e,t,n,i,o,r,a,s)),c.push(Fe(e,t+n*i,n,i,o,r,a,s)),c.push(Fe(e,t+2*n*i,n,i,o,r,a,s))):(i*=3,r*=3,c.push(Fe(e,t,n,i,o,r,a,s)),c.push(Fe(e,t+1,n,i,o,r,a,s)),c.push(Fe(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,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(){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,m)}return v}function Ue(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}}}}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 Qe={linear:"LINEAR",linear_exact:"LINEAR_EXACT",sigmoid:"SIGMOID"};class Ne{#x;#E;#R=0;#F=255;#O;#b;constructor(e,t,n){void 0===n&&(n=!1);let i=e,o=t;n||(i-=.5,o-=1),this.#x=i-o/2,this.#E=i+o/2,this.#O=(this.#F-this.#R)/o,this.#b=(-i/o+.5)*(this.#F-this.#R)+this.#R}getY(e){let t;return t=e<=this.#x?this.#R:e>this.#E?this.#F:e*this.#O+this.#b,t}}class Be{#R=0;#F=255;#M;#q;constructor(e,t){this.#M=e,this.#q=t}getY(e){return(this.#F-this.#R)/(1+Math.exp(-4*(e-this.#M)/this.#q))+this.#R}}class ke{#U;#V=0;#Q;#N=Qe.linear;constructor(e,t){if(this.#U=e,void 0!==t){const e=[];for(const t in Qe)e.push(Qe[t]);e.includes(t)?this.#N=t:s.debug(`Unknown VOI LUT function: ${t}`)}this.#B()}getWindowLevel(){return this.#U}#B(){const e=this.#U.center,t=this.#U.width,n=e+this.#V;this.#N===Qe.linear_exact?this.#Q=new Ne(n,t,!0):this.#N===Qe.sigmoid?this.#Q=new Be(n,t):this.#Q=new Ne(n,t)}setSignedOffset(e){this.#V=e,this.#B()}apply(e){return this.#Q.getY(e)}}class Ge{center;width;constructor(e,t){this.center=e,this.width=t}}function ze(e,t){return null!=e&&null!=t&&e.center===t.center&&e.width===t.width}function He(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!==Qe.linear_exact&&n!==Qe.sigmoid||(o=0);let r=e.width;return r=Math.max(r,o),r=Math.min(r,t.max-t.min),new Ge(i,r)}class Ye{name;wl;perslice;constructor(e,t,n){this.name=e,this.wl=t,this.perslice=n}}function Xe(e){const t=[];for(let n=0;n<256;++n)t.push(e(n));return t}function We(e){return e}function $e(e){return 255-e}class je{red;green;blue;constructor(e,t,n){this.red=e,this.green=t,this.blue=n}}const Ze={plain:{red:Xe(We),green:Xe(We),blue:Xe(We)},invPlain:{red:Xe($e),green:Xe($e),blue:Xe($e)},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:Xe(function(e){const t=3*e;return t>255?255:t}),green:Xe(function(e){const t=256/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n}),blue:Xe(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]}},_e={wlPresets:void 0,labelTexts:void 0,privateBValueRules:void 0,openRoiDialog:void 0,getVolumeIdTagValue:void 0,getPostLoadVolumeIdTagValue:void 0,postLoadVolumeIdCandidates:void 0,getTagPixelUnit:void 0};class Ke{#e;#k;constructor(e){this.#e=e}get(e,t){return this.#e[3*e+t]}getInverse(){return void 0===this.#k&&(this.#k=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 Ke([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.#k}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(!d(this.get(n,i),e.get(n,i),t))return!1;return!0}isSimilarProgressive(e,t){let n;for(let i=0;i<3;++i)for(let o=0;o<3;++o){const r=h(this.get(i,o),e.get(i,o),t,10);if(!r.success)return!1;if(void 0!==r.message){const e=parseInt(r.message,10);(void 0===n||e>n)&&(n=e)}}return void 0!==n&&s.warn(`Using larger tolerance for matrix similarity: max diff is ~${n} times tolerance`),!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 Ke(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 Ke(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 p(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 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 Ke(e)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}getValues(){return this.#e.slice()}}function Je(){return new Ke([1,0,0,0,1,0,0,0,1])}function et(e){return e.equals(Je())}function tt(){return new Ke([1,0,0,0,0,1,0,-1,0])}const nt={Axial:"axial",Coronal:"coronal",Sagittal:"sagittal"};function it(e){let t;return e===nt.Axial?t=Je():e===nt.Coronal?t=tt():e===nt.Sagittal&&(t=new Ke([0,0,-1,1,0,0,0,-1,0])),t}function ot(e){const t=new p(e.get(0,0),e.get(1,0),e.get(2,0)),n=new p(e.get(0,1),e.get(1,1),e.get(2,1)),i=new p(e.get(0,2),e.get(1,2),e.get(2,2));return rt(t)+rt(n)+rt(i)}function rt(e){let t=new p(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 p(0,t.getY(),t.getZ());else if(t.getY()>a&&t.getY()>t.getX()&&t.getY()>t.getZ())n+=o,t=new p(t.getX(),0,t.getZ());else{if(!(t.getZ()>a&&t.getZ()>t.getX()&&t.getZ()>t.getY()))break;n+=r,t=new p(t.getX(),t.getY(),0)}return n}function at(e){let t;const n=st(e);return void 0!==n&&(t=function(e){let t;return["LPS","LAI","RPI","RAS","ALS","ARI","PLI","PRS"].includes(e)?t=nt.Axial:["LSA","LIP","RSP","RIA","ILA","IRP","SLP","SRA"].includes(e)?t=nt.Coronal:["PSL","PIR","ASR","AIL","IAR","IPL","SAL","SPR"].includes(e)&&(t=nt.Sagittal),t}(ot(n.asOneAndZeros()))),t}function st(e){let t;if(void 0!==e&&6===e.length){const n=new p(e[0],e[1],e[2]),i=new p(e[3],e[4],e[5]),o=n.crossProduct(i);t=new Ke([n.getX(),i.getX(),o.getX(),n.getY(),i.getY(),o.getY(),n.getZ(),i.getZ(),o.getZ()])}return t}function lt(e,t){let n=Je();return void 0!==t&&(n=e.asOneAndZeros().getInverse().multiply(t)),n.getAbs()}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)}}}const ut={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 dt(e){let t;const n=ue(e,ut.Rows),i=ue(e,ut.Columns);return void 0!==n&&void 0!==i&&(t=[i,n]),t}function ht(e,t){let n;const i=de(e,t);return void 0!==i&&2===i.length&&(n=[parseFloat(i[1]),parseFloat(i[0])]),n}function gt(e){let t;const n=de(e,ut.PixelMeasuresSequence);return void 0!==n&&(t=ht(n[0],ut.PixelSpacing)),t}function St(e){let t=ht(e,ut.PixelSpacing);return void 0===t&&(t=function(e){let t=ht(e,ut.ImagerPixelSpacing);if(void 0!==t){let n;const i=parseFloat(ue(e,ut.EstimatedRadiographicMagnificationFactor));if(isNaN(i)){const t=parseFloat(ue(e,ut.DistanceSourceToDetector)),i=parseFloat(ue(e,ut.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=ht(e,ut.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=de(e,ut.SharedFunctionalGroupsSequence);if(void 0!==n&&(t=gt(n[0])),void 0===t){const n=de(e,ut.PerFrameFunctionalGroupsSequence);void 0!==n&&(t=gt(n[0]))}return t}(e)),t}function pt(e){const t=ht(e,ut.PixelSpacing);if(void 0===t)return;const n=ue(e,ut.SpacingBetweenSlices);return void 0!==n&&t.push(parseFloat(n)),new ct(t)}function mt(e){const t=ue(e,ut.PhotometricInterpretation),n=ue(e,ut.TransferSyntax);if(void 0!==t&&void 0!==n){let i=t.toUpperCase();(Pe(n)||Te(n)||Le(n))&&!ft(i)&&(i="RGB");let o=ue(e,ut.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 vt(e){let t;const n=de(e,ut.ReferencedSeriesSequence);return void 0!==n&&(t=ue(n[0],ut.SeriesInstanceUID)),t}function Ct(e){const t=de(e,ut.ReferencedFrameOfReferenceSequence);if(void 0===t)return;const n=de(t[0],ut.RTReferencedStudySequence);if(void 0===n)return;const i=de(n[0],ut.RTReferencedSeriesSequence);return void 0!==i?ue(i[0],ut.SeriesInstanceUID):void 0}class Dt{#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)}}#G(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.#G(e.getValues(),n);return new D(i)}normaliseIndex(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#G(e.getValues(),n);return new a(i)}}class yt{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 It(e,t){return function(e){return null!=e&&(e.includes("median")||e.includes("p25")||e.includes("p75"))}(t)?function(e){const t=wt(e);return e.sort(function(e,t){return e-t}),t.median=Tt(e,.5),t.p25=Tt(e,.25),t.p75=Tt(e,.75),t}(e):wt(e)}function wt(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 yt(t,n,a,l)}function Tt(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)}const Lt=1e-6;class Pt{#z;#H;#Y;#X={};#W;#$=Je();constructor(e,t,n,i,o){this.#z=e,this.#H=t,this.#Y=n,void 0!==o&&(this.#W=o,this.#X[o]=e.slice()),void 0!==i&&(this.#$=i)}clone(){return new Pt(this.#z.slice(),new Dt(this.#H.getValues()),new ct(this.#Y.getValues()),new Ke(this.#$.getValues()),this.#W)}getInitialTime(){return this.#W}setInitialTime(e){void 0!==this.#X[this.#W]&&delete this.#X[this.#W],this.#W=e,this.#X[e]=this.#z.slice()}getCurrentTotalNumberOfSlices(){const e=Object.keys(this.#X);if(0===e.length)return this.#z.length;let t=0;for(let n=0;n<e.length;++n)t+=this.#X[e[n]].length;return t}hasSlicesAtTime(e){return void 0!==this.#X[e]}getCurrentNumberOfSlicesBeforeTime(e){const t=Object.keys(this.#X);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.#X[o].length}return n}getOrigin(){return this.#z[0]}getOrigins(){return this.#z}sortOrigins(){this.#z.sort(function(e){const t=e.getInverse();return function(e,n){const i=t.multiplyPoint3D(e),o=t.multiplyPoint3D(n);return i.getZ()-o.getZ()}}(this.#$))}includesOrigin(e,t){for(let n=0;n<this.#z.length;++n)if(this.#z[n].isSimilar(e,t))return!0;return!1}getSize(e){let t=this.#H;if(e&&void 0!==e){let n=At([this.#H.get(0),this.#H.get(1),this.#H.get(2)],e);n=n.map(Math.abs),t=new Dt(n.concat(this.#H.getValues().slice(3)))}return t}updateSliceSpacing(){const e=bt(this.#z);if(void 0!==e){1!==this.#Y.get(2)&&this.#Y.get(2)!==e&&s.debug(`Using geometric spacing ${e} instead of tag spacing ${this.#Y.get(2)}`);const t=this.#Y.getValues();t[2]=e,this.#Y=new ct(t)}}getSpacing(e){let t=this.#Y;if(e&&void 0!==e){let n=At([this.#Y.get(0),this.#Y.get(1),this.#Y.get(2)],e);n=n.map(Math.abs),t=new ct(n)}return t}getRealSpacing(){return this.getSpacing(this.#$.getInverse().asOneAndZeros())}getOrientation(){return this.#$}getSliceIndex(e,t){let n=this.#z;void 0!==t&&(n=this.#X[t]);const i=e.getClosest(n),o=n[i],r=e.minus(o);return new p(this.#$.get(0,2),this.#$.get(1,2),this.#$.get(2,2)).isCodirectional(r)?i+1:i}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(),Lt))return{success:!1,message:"Cannot append a slice with different orientation"};const i=this.canAppendOrigin(e.getOrigin(),e.getInitialTime());return i.success?new l(!0):i}canAppendVolume(e){if(void 0===e.getInitialTime())return{success:!1,message:"Missing time value for image append"};const t=this.getSize(),n=e.getSize();return t.get(0)!==n.get(0)?{success:!1,message:"Cannot append an image with different number of columns"}:t.get(1)!==n.get(1)?{success:!1,message:"Cannot append an image with different number of rows"}:t.get(2)!==n.get(2)?{success:!1,message:"Cannot append an image with different number of slices"}:this.getOrientation().isSimilar(e.getOrientation(),Lt)?new l(!0):{success:!1,message:"Cannot append an image with different orientation"}}canAppendOrigin(e,t){const n=function(t){return t.equals(e)};if(void 0!==t&&t!==this.#W){if(void 0!==this.#X[t]&&void 0!==this.#X[t].find(n))return{success:!1,message:"Cannot append same time origin twice"}}else if(void 0!==this.#z.find(n))return{success:!1,message:"Cannot append same origin twice"};return new l(!0)}appendOrigin(e,t,n){const i=this.canAppendOrigin(e,n);if(!i.success)throw new Error(i.message);if(void 0!==n&&this.#X[n].splice(t,0,e),void 0===n||n===this.#W){this.#z.splice(t,0,e);const n=this.#H.getValues();n[2]+=1,this.#H=new Dt(n)}}appendFrame(e,t){this.#X[t]=[e];const n=this.#H.getValues(),i=this.#Y.getValues();4===n.length?n[3]+=1:(n.push(2),i.push(1)),this.#H=new Dt(n),this.#Y=new ct(i)}appendVolume(e,t){if(this.hasSlicesAtTime(t))throw new Error(`Cannot append volume, time ${t} already exists`);if(e.length!==this.getSize().get(2))throw new Error(`Cannot append a volume with a different number of slices: ${e.length} != ${this.getSize().get(2)}`);this.#X[t]=e.slice();const n=this.#H.getValues(),i=this.#Y.getValues();4===n.length?n[3]+=1:(n.push(2),i.push(1)),this.#H=new Dt(n),this.#Y=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())}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 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 D(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),o=e.getValues(),r=this.getSpacing();return o[0]=Math.floor(S(i.getX()/r.get(0),5)),o[1]=Math.floor(S(i.getY()/r.get(1),5)),o[2]=Math.floor(S(i.getZ()/r.get(2),5)),new a(o)}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 At(e,t){return t.getInverse().multiplyArray3D(e)}function Ot(e,t){return t.multiplyArray3D(e)}function bt(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=wt(t),i=S(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}const xt={GE:"ge",SIEMENS:"siemens",PHILIPS:"philips",HITASHI:"hitashi"};function Et(e){return ue(e,"00080070")}function Rt(e){let t;const n=Et(e);return void 0!==n&&(t=n.toUpperCase().startsWith("SIEMENS")?xt.SIEMENS:n.startsWith("GE")?xt.GE:n.startsWith("Philips")?xt.PHILIPS:n.toLowerCase()),t}const Ft="00080016",Mt="52009230",qt="00189087",Ut="00209111",Vt=[{manufacturer:xt.SIEMENS,key:"0019100C"},{manufacturer:xt.GE,key:"00431039"},{manufacturer:xt.HITASHI,key:"00291030"}],Qt="1.2.840.10008.5.1.4.1.1.4",Nt="1.2.840.10008.5.1.4.1.1.4.1",Bt="1.2.840.10008.5.1.4.1.1.4.2",kt="1.2.840.10008.5.1.4.1.1.4.3";function Gt(e){let t;const n=de(e,"00189117");return void 0!==n&&(t=ue(n[0],qt)),t}function zt(e){let t;const n=de(e,"52009229");if(void 0!==n&&(t=Gt(n[0])),void 0===t){const n=de(e,Mt);if(void 0!==n)for(const e of n)if(t=Gt(e),void 0!==t)break}return t}function Ht(e){let t;const n=ue(e,Ft);return n===Nt||n===Bt||n===kt?(t=zt(e),void 0===t&&(t=function(e){let t;const n=Rt(e);return void 0!==n&&n===xt.PHILIPS&&(t=function(e){let t,n=!1;const i=de(e,"00209222");if(void 0!==i)for(const e of i){const t=ue(e,"00209165");if(void 0!==t&&"(0018,9087)"===t){n=!0;break}}if(n){const n=de(e,Mt);if(void 0!==n){const e=de(n[0],Ut);if(void 0!==e){const n=de(e[0],"00209157");void 0!==n&&(t=n[2])}}}return t}(e)),t}(e),void 0!==t&&s.debug("Got b-value for enhanced MR from non standard tag"))):n===Qt&&(t=function(e){let t;if(void 0===t){const n=Rt(e),i=ue(e,"00080018");let o;o=void 0!==_e.privateBValueRules?_e.privateBValueRules:Vt;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=ue(e,r.key)),void 0!==t&&!isNaN(parseInt(t,10)))break}return void 0===t&&(t=ue(e,qt)),t}(e),void 0===t&&void 0===t&&(t=zt(e))),void 0!==t&&(t=parseInt(t,10)),t}function Yt(e){let t;const n=ue(e,Ft);if(n===Qt||n===Nt||n===Bt||n===kt){const n=Ht(e);void 0!==n&&(t=n)}return t}function Xt(e){let t;const n=de(e,Mt);if(void 0!==n){for(const e of n){const n=de(e,Ut);if(void 0===n)continue;const i=ue(n[0],"00209128");if(void 0!==i){const e=parseInt(i,10);if(void 0===t)t=e;else if(t!==e)return void s.debug("Unhandled varying TemporalPositionIndex")}}return t}}function Wt(e,t){return function(n){let i;const o=ue(n,e);return void 0!==o&&(i=t(o)),i}}const $t=Wt("00200100",e=>parseInt(e,10));function jt(e){let t;if(void 0!==_e.getVolumeIdTagValue)t=_e.getVolumeIdTagValue(e);else if(t=$t(e),void 0===t&&(t=Xt(e)),void 0===t){const n=Yt(e);void 0!==n&&(t=n)}return t}const Zt=[{name:"TemporalPositionIdentifier",getter:$t},{name:"TemporalPositionIndex",getter:Xt},{name:"DiffusionBValue",getter:Yt},{name:"EchoTime",getter:Wt("00180081",parseFloat)},{name:"TriggerTime",getter:Wt("00181060",parseFloat)},{name:"InversionTime",getter:Wt("00180082",parseFloat)},{name:"AcquisitionTime",getter:Wt("00080032",parseFloat)}],_t="00209116",Kt="00289110";function Jt(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 en(e,t,n,i){const o=dt(e),r=new Dt([o[0],o[1],1]);let l,c;const u=de(e,"52009229");if(void 0!==u){const e=u[0];if(void 0!==e[_t]){const t=e[_t];0!==t.value.length?c=t.value[0]["00200037"].value:s.warn("No shared functional group plane orientation sequence items.")}if(void 0!==e[Kt]){const t=e[Kt];0!==t.value.length?l=pt(t.value[0]):s.warn("No shared functional group pixel measure sequence items.")}}const d=[];for(let e=0;e<t.length;++e){const n=C(t[e].imagePosPat);if(v(d,n)||d.push(n),void 0!==t[e].imageOrientationPatient)if(void 0===c)c=t[e].imageOrientationPatient;else if(!O(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 h=st(c.map(e=>parseFloat(e)));if(void 0===h)throw new Error("Invalid imageOrientationPatient found for frames geometry");let S;if(void 0===n||!1===n){S=d;const e=bt(S);2===l.length()?l=new ct([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=[];n.push(e[0]);let i=e[0].getClosest(t);Jt(e[0],t[i],0);for(let o=1;o<e.length;++o){const r=e[o],a=r.getClosest(t);if(Jt(r,t[a],o),a!==i+1)for(let e=i+1;e<a;++e)n.push(t[e]);n.push(r),i=a}return n}(d,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 d=u;for(;g(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>d)throw new Error("Test distance is increasing when adding intermediate pos pats");n.push(c)}return n}(d,new Pt([d[0]],r,l,h));if(3!==l.length())throw new Error("Incomplete spacing found for frames geometry");const p=new Pt([S[0]],r,l,h);for(let e=1;e<S.length;++e)p.appendOrigin(S[e],e);const m=jt(e);return void 0!==m&&p.setInitialTime(m),p}function tn(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 nn(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 on(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 rn(e){let t;return void 0!==e&&(t={year:e.getFullYear(),monthIndex:e.getMonth(),day:e.getDate()}),t}function an(e){let t;return void 0!==e&&(t={hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}),t}function sn(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 ln(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 cn="00080100",un="00080102",dn="00080119",hn="00080120";class gn{meaning;value;longValue;urnValue;schemeDesignator;constructor(e){this.meaning=e}toString(){return`(${this.value}, ${this.schemeDesignator}, '${this.meaning}')`}}function Sn(e,t){return void 0!==e&&void 0!==t&&e.schemeDesignator===t.schemeDesignator&&e.value===t.value}function pn(e){const t=new gn(e["00080104"].value[0]);if(void 0!==e[cn])t.value=e[cn].value[0];else if(void 0!==e[dn])t.longValue=e[dn].value[0];else{if(void 0===e[hn])throw new Error("Invalid code with no value, no long value and no urn value.");t.urnValue=e[hn].value[0]}if(void 0!==t.value||void 0!==t.longValue){if(void 0===e[un])throw new Error("No coding sheme designator when code value or long value is present");t.schemeDesignator=e[un].value[0]}return t}function mn(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 fn={value:"111017",meaning:"CAD Processing and Findings Summary"},vn={value:"111030",meaning:"Image Region"},Cn={value:"111059",meaning:"Single Image Finding"},Dn={value:"111099",meaning:"Selected region"},yn={value:"111242",meaning:"All algorithms succeeded; with findings"},In={value:"112000",meaning:"Chest CAD Report"},wn={value:"112020",meaning:"Response Evaluation"},Tn={value:"112021",meaning:"Response Evaluation Method"},Ln={value:"112022",meaning:"RECIST"},Pn={value:"112039",meaning:"Tracking Identifier"},An={value:"112051",meaning:"Measurement of Response"},On={value:"112040",meaning:"Tracking Unique Identifier"},bn={value:"112048",meaning:"Current Response"},xn={value:"113076",meaning:"Segmentation"},En={value:"121055",meaning:"Path"},Rn={value:"121106",meaning:"Comment"},Fn={value:"121322",meaning:"Source image for image processing operation"},Mn={value:"121324",meaning:"Source Image"},qn={value:"122438",meaning:"Reference Points"},Un={value:"125007",meaning:"Measurement Group"},Vn={value:"125309",meaning:"Short Label"},Qn={value:"126000",meaning:"Imaging Measurement Report"},Nn={value:"126010",meaning:"Imaging Measurements"},Bn={value:"128773",meaning:"Reference Geometry"},kn={1483009:"Angle",42798e3:"Area",103355008:"Width",103339001:"Long axis",103340004:"Short axis",131190003:"Radius",261665006:"Unknown",410668003:"Length",718499004:"Color"},Gn={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 zn(e){const t=new gn(e.meaning);return t.schemeDesignator="DCM",t.value=e.value,t}function Hn(e,t){let n,i;return"SCT"===t?n=kn[e]:"UCUM"===t&&(n=Gn[e]),void 0!==n&&(i=new gn(n),i.schemeDesignator=t,i.value=e),i}function Yn(){return zn(xn)}function Xn(){return Hn("718499004","SCT")}const Wn={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"}},$n={"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 jn(e){const t=$n[e];let n;return void 0!==t?n=Hn(t,"UCUM"):void 0===t&&(n=Hn("1","UCUM")),n}const Zn="00089124",_n="00082112",Kn="00081150",Jn="00081155",ei="00209111",ti="00209164",ni="00209113",ii="00209116",oi="00289110";class ri{dimIndex;imagePosPat;derivationImages;refSegmentNumber;imageOrientationPatient;spacing;constructor(e,t,n,i){this.dimIndex=e,this.imagePosPat=t,this.derivationImages=n,this.refSegmentNumber=i}}function ai(e){const t=[];if(void 0!==e[Zn]){const n=e[Zn].value;for(let e=0;e<n.length;++e){const i=[];if(void 0!==n[e][_n]){const t=n[e][_n].value;for(let e=0;e<t.length;++e){const n={};void 0!==t[e][Kn]&&(n.referencedSOPClassUID=t[e][Kn].value[0]),void 0!==t[e][Jn]&&(n.referencedSOPInstanceUID=t[e][Jn].value[0]),i.push(n)}}t.push({sourceImages:i})}}if(void 0===e[ei])return void s.info("Missing frame content sequence");const n=e[ei].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[ni])return void s.info("Missing plane position sequence");const a=e[ni].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 ri(i,l,t,o);if(void 0!==e[ii]){const t=e[ii];if(0!==t.value.length){const e=t.value[0]["00200037"].value;void 0!==e&&(c.imageOrientationPatient=e)}}if(void 0!==e[oi]){const t=e[oi];if(0!==t.value.length){const e=pt(t.value[0]);void 0!==e&&(c.spacing=e)}else s.warn("No shared functional group pixel measure sequence items.")}return c}function si(e,t){const n=de(e,"52009230");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(ai(e))}return i}function li(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=mn(zn(Fn)),i=mn(zn(xn)),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 ci="00080016",ui="00080060",di="00280002",hi="00280100",gi={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 Si{#j;#Z;getWarning(){return this.#j}checkElements(e){if(this.#j=void 0,void 0===dt(e))throw new Error("No image rows or columns in DICOM file");if(!Y(e))throw new Error("No pixel data in DICOM file");const t=ue(e,ui);if(void 0!==t&&"PT"===t){const t=mt(e);if(void 0!==(n=ue(e,ci))&&/^1\.2\.840\.10008\.5\.1\.4\.1\.1\.7/.test(n)||!ft(t))return this.#j;const i=function(e){let t="";const n={};let i;t+=he(e["00280051"],"Corrected Image (00280051)",["ATTN","DECY"]),t+=he(e["00541102"],"Decay Correction (00541102)",["START"]),t+=he(e["00541001"],"Units (00541001)",["BQML"]);const o=e["00101030"],r=he(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=tn(e["00080021"]);let o,r,a;const l=e["00540016"];if(n+=he(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=he(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=he(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=nn(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 le("DA");n.value=[t.substring(0,8)];const i=tn(n),o=new le("TM");return o.value=[t.substring(8)],{date:i,time:t.length>=9?nn(o):void 0}}(h);g=e.date,S=e.time}a=on(g,S)}let c=on(i,nn(e["00080031"]));const u=e["00080022"],d=e["00080032"];if(void 0!==u&&void 0!==d){const t=tn(u),i=nn(d),o=on(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+=he(d,u),void 0!==d&&(l=d.value[0]);let h=0;const g="ActualFrameDuration (00181242)",S=e["00181242"];if(n+=he(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.#Z=i.value,this.#j=i.warning}var n;return this.#j}create(e,t,n){const i=function(t){return ue(e,t)};let o,r=i(di);void 0===r&&(r=1);const a=si(e);if(void 0!==a){const n=[];let i=!0;for(const e of a){const t=C(e.imagePosPat);if(v(n,t)){i=!1;break}n.push(t)}if(i){s.debug("Using frame infos for geometry"),o=en(e,a),o.sortOrigins();const i=o.getOrigins(),l=n.map(function(e){const t=i.findIndex((n=e,function(e){return e.equals(n)}));var n;if(-1===t)throw new Error("Cannot find frame origin in sorted origins");return t});if(l.some(function(e,t){return e!==t})){const n=dt(e),i=n[0]*n[1]*r,o=t.slice();for(let e=0;e<a.length;++e)o.set(t.subarray(e*i,(e+1)*i),l[e]*i);t=o}}}void 0===o&&(o=function(e){const t=dt(e),n=[t[0],t[1],1],i=ue(e,"00280008");if(void 0!==i){const e=parseInt(i,10);e>1&&n.push(e)}const o=new Dt(n);let r=[1,1,1];const a=St(e);if(void 0!==a)r=[a[0],a[1],1];else{const t=ht(e,ut.PixelAspectRatio);void 0!==t&&(r=[t[0],t[1],1],s.warn("Use pixel aspect ratio as spacing"))}const l=new ct(r),c=de(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=de(e,ut.ImageOrientationPatient);let n;return void 0!==t&&(n=st(t.map(e=>parseFloat(e)))),n}(e),h=new f(u[0],u[1],u[2]),g=jt(e);return new Pt([h],o,l,d,g)}(e));const l=o.getSize().getTotalSize(),c=St(e),u=i("00080018"),d=l*r;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 lo(o,t,[u]),g=mt(e);void 0!==g&&h.setPhotometricInterpretation(g);const S=i("00280006");void 0!==S&&h.setPlanarConfiguration(S);let p=1;const m=i("00281053");if(void 0!==m){const e=parseFloat(m);isNaN(e)||(p=e)}let D=0;const y=i("00281052");if(void 0!==y){const e=parseFloat(y);isNaN(e)||(D=e)}let I=!1,w=1;void 0!==this.#Z&&(I=!0,w=this.#Z,s.info(`Applying PET SUV calibration: ${w}`),p*=w,D*=w);const T=new Ve(p,D);if(h.setRescaleSlopeAndIntercept(T),"PALETTE COLOR"===h.getPhotometricInterpretation()){const t=function(e){let t;const n=de(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(ue(e,hi),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 je(i,o,r)}return t}(e);void 0!==t&&h.setPaletteColourMap(t)}const L={numberOfFiles:n};L.TransferSyntaxUID=i("00020010"),L.MediaStorageSOPClassUID=i("00020002"),L.SOPClassUID=i(ci),L.Modality=i(ui),L.ImageType=i("00080008"),L.SamplesPerPixel=i(di),L.PhotometricInterpretation=i("00280004"),L.PixelRepresentation=i("00280103"),L.BitsAllocated=i(hi),L.BitsStored=i("00280101"),L.HighBit=i("00280102");const P=Object.keys(gi);for(const e of P)L[e]=i(gi[e]);if(I)L.pixelUnit="SUV";else{const t=(A=e,void 0!==_e.getTagPixelUnit?_e.getTagPixelUnit(A):function(e){let t;const n=["RescaleType","Units"];for(const i of n)if(t=ue(e,ut[i]),void 0!==t)break;if(void 0===t){const n=ue(e,ut.Modality);void 0!==n&&"CT"===n&&(t="HU")}return t}(A));void 0!==t&&(L.pixelUnit=t)}var A;L.lengthUnit=void 0===c?"unit.pixel":"unit.mm";const O=function(e,t){let n;const i=de(e,"00281050"),o=de(e,"00281051");if(void 0!==i&&void 0!==o){n={};const r=de(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 Ye(a,[new Ge(l*t,c)])),0===c&&s.warn("Zero window width found in DICOM.")}}return n}(e,w);return void 0!==O&&(L.windowPresets=O),L.VOILUTFunction=i("00281056"),h.setMeta(L),h}}function pi(e){return function(t,n){if("mergeId"===n)return t;const i=U(n),o=re(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(pi(t),{}))}}else s=1===a.value.length?a.value[0]:a.value;return t[r]=s,t}}function mi(e){const t=structuredClone(e);return Object.keys(t).reduce(pi(t),{})}function fi(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 vi(e){const t=Object.keys(e),n={};for(const i of t){const t=se(i);if(void 0===t)continue;const o=re(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(vi(n));else s.debug("Non array simpleTag SQ value");a=e}else a=Array.isArray(c)?c:[c];const u=new le(r);u.tag=t,u.value=a,l&&(u.undefinedLength=l),n[t.getKey()]=u}return n}class Ci{r;g;b;constructor(e,t,n){this.r=e,this.g=t,this.b=n}}function Di(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 yi(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 Ii(e){return{r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)}}function wi(e){return`#${((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)}`}function Ti(e){return{l:.001525902*e.l,a:.003891051*e.a-128,b:.003891051*e.b-128}}function Li(e){return{l:655.35*e.l,a:257*e.a+32896,b:257*e.b+32896}}const Pi={x:95.0489,y:100,z:108.884};function Ai(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=Pi,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 Oi(e){return function(e){function t(e){let t;return t=e>.008856452?Math.pow(e,.333333333):7.787037037*e+.137931034,t}const n=Pi,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 bi(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 xi=[new Ci(0,0,0),new Ci(255,0,0),new Ci(0,255,0),new Ci(0,0,255),new Ci(255,255,0),new Ci(0,255,255),new Ci(255,0,255),new Ci(255,239,213),new Ci(0,0,205),new Ci(205,133,63),new Ci(210,180,140),new Ci(102,205,170),new Ci(0,0,128),new Ci(0,139,139),new Ci(46,139,87),new Ci(255,228,225)];function Ei(e){let t;return t=e<xi.length?xi[e]:new Ci(255*Math.random(),255*Math.random(),255*Math.random()),t}const Ri="00620005",Fi="00620009",Mi="0062000C",qi="0062000D",Ui="00620003",Vi="0062000F",Qi="00620020";class Ni{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 Bi(e){const t=new Ni(e["00620004"].value[0],e[Ri]?e[Ri].value[0]:"n/a",e["00620008"].value[0]);if(void 0!==e[Fi]&&(t.algorithmName=e[Fi].value[0]),void 0!==e[Mi])t.displayValue=e[Mi].value[0];else if(void 0!==e[qi]){const n=e[qi].value,i=Ai(Ti({l:n[0],a:n[1],b:n[2]}));t.displayRGBValue=i}else s.warn("No recommended colour for segment, using default"),t.displayRGBValue=Ei(t.number);if(void 0===e[Ui])throw new Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=pn(e[Ui].value[0]),void 0===e[Vi])throw new Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=pn(e[Vi].value[0]),void 0!==e[Qi]&&(t.trackingId=e[Qi].value[0],t.trackingUid=e["00620021"].value[0]),t}function ki(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=Li(Oi(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:[mn(e.propertyCategoryCode)]}),e.propertyTypeCode&&(n.SegmentedPropertyTypeCodeSequence={value:[mn(e.propertyTypeCode)]}),e.trackingId&&(n.TrackingID=e.trackingId,n.TrackingUID=e.trackingUid),n}class Gi{#_=null;#K=null;#J=null;initialize(e,t){this.#K=e,this.#J=t,this.#_=new Uint8Array(3*e.length)}isInitialized(){return null!==this.#_}realloc(e,t){this.#K=e,this.#J=t;let n=this.#_;this.#_=new Uint8Array(3*e.length),this.#_.set(n),n=null}shiftSlice(e,t,n){this.#_.set(this.#_.subarray(e,n),e+t)}#ee(e){this.#_[3*e]=0,this.#_[3*e+1]=0,this.#_[3*e+2]=0}resetAroundOffset(e){if(!this.isInitialized())return;this.#ee(e);const t=this.#J.getDimSize(0),n=this.#J.getDimSize(1),i=this.#J.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.#K.length&&this.#ee(s)}}#te(e,t,n,i,o,r){return()=>{const a=t+n,s=e+1,l=this.#J.offsetToIndex(a);return a>=this.#K.length||a<0||0===l.get(i)||l.get(i)===this.#J.get(i)-1||255===s?s:s>10?255:this.#K[a]!==o?s:(r.push(this.#te(s,a,n,i,o,r)),0)}}#ne(e,t,n,i,o,r,a,s){return()=>{const l=t+n,c=e+1,u=this.#J.offsetToIndex(l);return l>=this.#K.length||l<0||0===u.get(o)||u.get(o)===this.#J.get(o)-1||255===c?c:c>10?255:this.#K[l]!==a?c:(s.push(this.#te(c,l,i,r,a,s)),s.push(this.#te(c,l,-i,r,a,s)),s.push(this.#ne(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.#_[r];if(a>0)return a;const s=this.#K[e],l=[],c=this.#J.getDimSize(o),u=this.#J.getDimSize(i);l.push(this.#ne(0,e,c,u,o,i,s,l)),l.push(this.#te(0,e,u,i,s,l)),l.push(this.#te(0,e,-u,i,s,l)),l.push(this.#ne(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.#_[r]=255,255;const e=l.shift()();if(e>0)return this.#_[r]=e,e}return 1/0}}function zi(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 Hi{#ie;#oe=new Map;#re=!1;#ae;constructor(e){this.#ie=e}getAll(){return this.#oe}setLabelMap(e){this.#ae=e}addFrame(e,t,n,i,o,r){this.#oe.has(e)||this.#oe.set(e,new Map);const a=this.#oe.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.#ae)return this.#ae;const e=this.#ie.getSize().getDimSize(2),t=this.#ie.getSize().getTotalSize(),n=new Uint8Array(t);for(const[,t]of this.#oe)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.#re=!0),0===n[t+i]&&(n[t+i]=o[i]))}return this.#re&&s.warn("SegmentCollection: detected overlapping segments"),this.#ae=n,n}getHasOverlap(){return this.getLabelMap(),this.#re}getSegmentBuffers(e){if(0===this.#oe.size){let t=e.map(e=>e.number);if(0===t.length&&void 0!==this.#ae){const e=new Set;for(let t=0;t<this.#ae.length;++t)0!==this.#ae[t]&&e.add(this.#ae[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=zi(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.#ae,this.#ie,t)}const t={};for(const n of e){const e=n.number-1,i=this.#oe.get(n.number);if(void 0!==i)for(const[n,o]of i){void 0===t[e]&&(t[e]={});const i=new Uint8Array(o.length);for(let e=0;e<o.length;++e)0!==o[e]&&(i[e]=1);t[e][n]=i}}return t}#se;#le="";getOrBuildUnionContour(e,t){const n=[];for(const[t]of this.#oe)e?.isHidden(t)&&n.push(t);const i=n.sort().join(",");if(void 0!==this.#se&&i===this.#le)return this.#se;const o=t.getDimSize(2),r=new Uint8Array(t.getTotalSize());for(const[t,n]of this.#oe)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.#se=new Gi,this.#se.initialize(r,t),this.#le=i,this.#se}}const Yi={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 Xi(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(O(t.enum[e],i)){o=!0;break}}else o=t.enum.includes(i);if(!o)throw new Error(`Unsupported ${t.name} value: ${i}`)}const Wi=[{name:"TransferSyntaxUID",tag:"00020010",type:"1",enum:[te,ne,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 $i(){const e={};for(const t of Wi)e[t.name]=t.enum[0];return e}class ji{#j;getWarning(){return this.#j}checkElements(e){}create(e,t,n){const i=function(t){return ue(e,t)};for(const t of Wi)Xi(e,t);const o=dt(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][ti].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][ti].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=de(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=Bi(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 je(u,d,h));const p=function(e,t){return e.findIndex(function(e){return t.equals(e)})},m=si(e,a);if(void 0===m)throw new Error("Missing or empty per frame functional sequence");let f;void 0!==n&&(f=n.getGeometry().getOrigins());const v=en(e,m,!0,f);v.sortOrigins();const D=v.getSize().get(2),y=function(e){return function(t){return t.number===e}},I=new Hi(v),w=v.getOrigins();let T;for(let e=0;e<m.length;++e){if(T=p(w,C(m[e].imagePosPat)),-1===T)throw new Error("Cannot find frame origin in mask origins");const n=c.find(y(m[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<D;++e)L.push(e.toString());const P=new lo(v,I.getLabelMap(),L);P.setSegmentCollection(I),S&&(P.setPhotometricInterpretation("PALETTE COLOR"),P.setPaletteColourMap(g));const A=$i(),O=Object.keys(Yi);for(const e of O)A[e]=i(Yi[e]);return A.DimensionOrganizationSequence=s.organizations,A.DimensionIndexSequence=s.indices,A.custom={segments:c,frameInfos:m,SOPInstanceUID:i("00080018"),referencedSeriesUID:vt(e)},A.lengthUnit=n.getMeta().lengthUnit,A.numberOfFiles=D,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=sn(rn(s)),o.ContentTime=ln(an(s)),void 0!==n&&(o.StudyInstanceUID=n.getMeta().StudyInstanceUID);const l=[];for(const e of t)l.push(ki(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 ri([t,r.length-i],l,void 0,t);if(void 0!==n){const e=n.getGeometry().worldToIndex(new D([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 p=[];for(const e of h)p.push(li(e));if(o.PerFrameFunctionalGroupsSequence={value:p},void 0!==n){const e=[];e.push({ReferencedInstanceSequence:{value:S},SeriesInstanceUID:n.getMeta().SeriesInstanceUID}),o.ReferencedSeriesSequence={value:e}}void 0!==i&&fi(o,i);const m=vi(o),f=a.getDimSize(2),v=g.length*f/8,C=new le("OB");return C.tag=new M("7FE0","0010"),C.vl=v,C.value=g,m["7FE00010"]=C,m}}function Zi(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),p=t.getSegmentCollection().getSegmentBuffers(g);let m,f;m=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(p).map(e=>Number(e)+1);const v=new Set(m);let C=v.size>0?Math.max(...v)+1:1;const D=new Map;for(const e of f)if(v.has(e)){const t=C++;s.warn(`mergeMaskImages: segment number conflict, remapping ${e} to ${t}`),D.set(e,t)}else D.set(e,e),v.add(e);const y=[...h,...g.map(e=>({...e,number:D.get(e.number)}))],I=new Hi(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(p)){const n=Number(e)+1,i=D.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 lo(r,I.getLabelMap(),L);if(P.setSegmentCollection(I),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=D.get(e);i[t]=a.red[e],o[t]=a.green[e],r[t]=a.blue[e]}P.setPhotometricInterpretation("PALETTE COLOR"),P.setPaletteColourMap(new je(i,o,r))}else P.setPhotometricInterpretation(e.getPhotometricInterpretation());const A=structuredClone(e.getMeta());return void 0===A.custom&&(A.custom={}),A.custom.segments=y,P.setMeta(A),P}class _i{#ce;#ue;#de;#he;constructor(e){this.#ce=e,this.#B()}#B(){this.#ue=[],this.#de=[];for(let e=0;e<this.#ce;++e)this.#de.push(new Ki(this));this.#he=[]}addWorkerTask(e){if(this.#de.length===this.#ce&&this.onworkstart({type:"work-start"}),this.#de.length>0){const t=this.#de.shift();this.#he.push(t),t.run(e)}else this.#ue.push(e)}abort(){this.#ge(),this.#B(),this.onabort({type:"work-abort"}),this.onworkend({type:"work-end"})}onTaskEnd(e){if(this.#ue.length>0){const t=this.#ue.shift();e.run(t)}else e.stop(),this.#de.push(e),this.#he=this.#he.filter(t=>t.getId()!==e.getId()),this.#de.length===this.#ce&&(this.onwork({type:"work"}),this.onworkend({type:"work-end"}))}handleWorkerError=e=>{this.#ge(),this.onerror({error:e}),this.onworkend({type:"work-end"})};#ge(){for(const e of this.#he)e.stop();this.#he=[]}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,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 Ji{constructor(e,t){this.startMessage=e,this.info=t}getWorker(){}}function eo(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 to extends Ji{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 no{#Se=new _i(navigator?.hardwareConcurrency??4);constructor(){this.#Se.onerror=e=>{console.error("Labeling failed!",e.error)}}run(e,t){this.#Se.onworkitem=this.ondone,this.#Se.onwork=()=>{};const n=new to(function(e,t){return{imageBuffer:e,...eo(t.getSize(),t.getSpacing())}}(e,t),{});this.#Se.addWorkerTask(n)}runOverlap(e,t){const n=[],i=new Map(e.map(({segNumber:e,minSlice:t})=>[e,t??0]));this.#Se.onworkitem=e=>{for(const t of e.data.labels){const e=i.get(t.id)??0;t.centroidIndex[2]+=e,t.largestSliceZ+=e}n.push(...e.data.labels)},this.#Se.onwork=()=>{this.ondone({data:{labels:n}})};for(const{segNumber:n,size:i,slices:o}of e){const e=eo(i,t.getSpacing());this.#Se.addWorkerTask(new to({segmentSlice:{segNumber:n,slices:o},...e},{}))}}ondone(e){}}class io extends Ji{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 oo{#Se=new _i(5);constructor(){this.#Se.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 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),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 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(v[0]*e,v[1]*t,v[2]*n),r=o.multiplyPoint3D(i);C?(D[0]=r.getX(),D[1]=r.getY(),D[2]=r.getZ(),y[0]=r.getX(),y[1]=r.getY(),y[2]=r.getZ(),C=!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 I=[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)))],w=r.length();for(let e=3;e<w;e++)I.push(r.get(e));const T=new Dt(I),L=void 0===n?new f(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]/m.get(0)+T.get(0)/2,P[1]=t[1]/m.get(1)+T.get(1)/2,P[2]=t[2]/m.get(2)+T.get(2)/2}const A=new f(P[0]*m.get(0),P[1]*m.get(1),P[2]*m.get(2)),O=t.multiplyPoint3D(A),b=e.pointToWorld(L),x=new f(b.getX()-O.getX(),b.getY()-O.getY(),b.getZ()-O.getZ()),E=[0,0,m.get(2)],R=t.multiplyArray3D(E),F=[];for(let e=0;e<T.get(2);e++)F.push(new f(x.getX()+R[0]*e,x.getY()+R[1]*e,x.getZ()+R[2]*e));return new Pt(F,T,m,t)}(t,i,r),l=function(e,t,n){const i=Oe(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 p=l.get(3),m=a.getDimSize(3),f=l.getDimSize(3),v=[];for(let e=0;e<p;e++){const t=m*e,n=f*e;v.push(S(t,n,e))}return v}(e,t,s,n,o,a);return this.#Se.onworkitem=this.ondoneframe,this.#Se.onworkend=this.ondone,c.forEach(e=>{const t=new io(e,{});this.#Se.addWorkerTask(t)}),{buffer:l,geometry:s,jobId:a}}ondoneframe(e){}ondone(e){}}const ro=["imagecontentchange","imagegeometrychange","imageresamplingstart","imageresamplingcomplete","imageresampled","labelingstart","labelschanged"];function ao(e){return(new Si).create(e,e["7FE00010"].value[0],1)}function so(e){return(new ji).create(e,e["7FE00010"].value[0])}class lo extends EventTarget{#ie;#d;#pe;#me;#fe;#ve;#Ce;#De;#ye=new Ve(1,0);#Ie=null;#we=!0;#Te=!0;#Le="MONOCHROME2";#Pe;#Ae=0;#Oe;#be={};#xe=null;#Ee=null;#Re=null;#Fe;#Me;#qe=!1;#Ue;constructor(e,t,n){super(),this.#ie=e,this.#d=t,this.#me=!1,this.#fe="0",this.#ve=null,this.#Ce=null,this.#pe=new Gi,this.#De=n,this.#Fe=null,this.#Me=null,this.#Oe=this.#d.length/this.#ie.getSize().getTotalSize()}setComplete(e){this.#qe=e,e&&this.#ie.updateSliceSpacing()}getComplete(){return this.#qe}setupSegmentCollection(){this.#Ue=new Hi(this.#ie),this.#Ue.setLabelMap(this.#d)}setSegmentCollection(e){this.#Ue=e}getSegmentCollection(){return this.#Ue}getHasOverlap(){return this.#Ue?.getHasOverlap()??!1}getImageUid(e){let t=this.#De[0];return 1!==this.#De.length&&void 0!==e&&(t=this.#De[this.getSecondaryOffset(e)]),t}getOriginForImageUid(e){let t;const n=this.#De.indexOf(e);return-1!==n&&(t=this.getGeometry().getOrigins()[n]),t}includesImageUid(e){return this.#De.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.#De,e)}getGeometry(){return this.#ie}getBuffer(){return this.#d}canQuantify(){return 1===this.getNumberOfComponents()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return ft(this.getPhotometricInterpretation())}isMask(){const e=this.getMeta().Modality;return"SEG"===e||"RTSTRUCT"===e}getMaskReferencedSeriesUID(){let e;return this.isMask()&&(e=this.getMeta().custom.referencedSeriesUID),e}canScroll(e){const t=this.getGeometry().getSize();let n=1;return void 0!==this.#be.numberOfFiles&&(n=this.#be.numberOfFiles),t.canScroll(e)||1!==n}#Ve(){return this.#ie.getSize().getTotalSize(2)}getSecondaryOffset(e){return this.#ie.getSize().indexToOffset(e,2)}getRescaleSlopeAndIntercept(e){let t=this.#ye;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.#Ie[n]?t=this.#Ie[n]:s.warn(`undefined non constant rsi at ${n}`)}return t}#Qe(e){return this.#Ie[e]}setRescaleSlopeAndIntercept(e,t){if(this.#we=this.#we&&e.isID(),this.#Te){if(!this.#ye.equals(e))if(void 0===t)this.#ye=e;else{this.#Te=!1,this.#Ie=[];for(let e=0,t=this.#Ve();e<t;++e)this.#Ie.push(this.#ye);this.#ye=null,this.#Ie.splice(t,0,e)}}else{if(void 0===t)throw new Error("Cannot store non constant RSI with empty slice index.");this.#Ie.splice(t,0,e)}}isIdentityRSI(){return this.#we}isConstantRSI(){return this.#Te}getPhotometricInterpretation(){return this.#Le}setPhotometricInterpretation(e){this.#Le=e}setPaletteColourMap(e){this.#Pe=e,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPaletteColourMap(){return this.#Pe}updatePaletteColourMap(e,t){this.#Pe.red[e]=t.r,this.#Pe.green[e]=t.g,this.#Pe.blue[e]=t.b,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPlanarConfiguration(){return this.#Ae}setPlanarConfiguration(e){this.#Ae=e}getNumberOfComponents(){return this.#Oe}getMeta(){return this.#be}setMeta(e){this.#be=e}getValueAtOffset(e){return this.#d[e]}getOffsets(e){let t;if("number"==typeof e){if(1!==this.#Oe)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.#Oe)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.#d.length;e+=this.#Oe){i=!0;for(let n=0;n<this.#Oe;++n)if(this.#d[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.#Oe?t.push([e[n]]):3===this.#Oe&&t.push([e[n].r,e[n].g,e[n].b]);let n;1===this.#Oe?n=function(e,t){return e[0]===t[0]}:3===this.#Oe&&(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.#Oe){s=[];for(let n=0;n<r.length;++n){a=!0;for(let t=0;t<this.#Oe;++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 lo(this.getGeometry().clone(),e,this.#De);if(this.isConstantRSI())t.setRescaleSlopeAndIntercept(this.getRescaleSlopeAndIntercept());else for(let e=0;e<this.#Ve();++e)t.setRescaleSlopeAndIntercept(this.#Qe(e),e);return t.setPhotometricInterpretation(this.getPhotometricInterpretation()),t.setPlanarConfiguration(this.getPlanarConfiguration()),t.setPaletteColourMap(structuredClone(this.#Pe)),t.setMeta(structuredClone(this.getMeta())),t}#Ne(e){let t=this.#d;if(this.#d=Oe(8*this.#d.BYTES_PER_ELEMENT,this.#be.PixelRepresentation,e),null===this.#d)throw new Error("Cannot reallocate data for image.");this.#d.set(t),t=null}canAppendSlice(e){if(null===e)return{success:!1,message:"Cannot append null slice"};const t=this.#ie.canAppendSlice(e.getGeometry());return t.success?this.#Be(e):t}#Be(e){if(this.#Le!==e.getPhotometricInterpretation())return{success:!1,message:"Cannot append a slice with different photometric interpretation"};for(const t in this.#be)if("windowPresets"!==t&&"numberOfFiles"!==t&&"custom"!==t&&"SeriesTime"!==t&&this.#be[t]!==e.getMeta()[t])return{success:!1,message:`Cannot append a slice with different ${t}: ${this.#be[t]} != ${e.getMeta()[t]}`};return new l(!0)}canAppendVolume(e){if(null===e)return{success:!1,message:"Cannot append null volume"};const t=this.#ie.canAppendVolume(e.getGeometry());return t.success?this.#Be(e):t}appendSlice(e){const t=this.canAppendSlice(e);if(!t.success)throw new Error(t.message);const n=e.getDataRange(),i=this.getDataRange();this.#xe={min:Math.min(n.min,i.min),max:Math.max(n.max,i.max)};const o=e.getRescaledDataRange(),r=this.getRescaledDataRange();this.#Ee={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=this.#ie.getCurrentTotalNumberOfSlices();let u=!1;void 0===l||this.#ie.hasSlicesAtTime(l)||(this.appendFrame(l,e.getGeometry().getOrigin()),s=this.#ie.getSize(),u=!0);const d=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 a(i)}(this.#ie,e.getGeometry()),h=this.#Oe*s.getDimSize(2);if(void 0===this.#be.numberOfFiles)throw new Error("Missing number of files for buffer manipulation.");const g=h*this.#be.numberOfFiles;this.#d.length!==g&&(this.#Ne(g),this.#pe.isInitialized()&&this.#pe.realloc(this.#d,this.#ie.getSize()));const S=d.get(2);let p=S;void 0!==l&&(p+=this.#ie.getCurrentNumberOfSlicesBeforeTime(l));const m=p*h,f=c*h;if(m<f&&(this.#d.set(this.#d.subarray(m,f),m+h),this.#pe.isInitialized())){const e=3*s.getDimSize(2),t=p*e,n=c*e;this.#pe.shiftSlice(t,e,n)}this.#d.set(e.getBuffer(),m),u||this.#ie.appendOrigin(e.getGeometry().getOrigin(),S,l),this.setRescaleSlopeAndIntercept(e.getRescaleSlopeAndIntercept(),p);const v=this.#De.length;if(this.#De.splice(p,0,e.getImageUid()),void 0!==this.#be.windowPresets){const t=this.#be.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)&&!ze(a.wl[0],r.wl[0])){a.perslice=!0;for(let e=0;e<v-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"))}appendVolume(e){const t=this.canAppendVolume(e);if(!t.success)throw new Error(t.message);const n=e.getDataRange(),i=this.getDataRange();this.#xe={min:Math.min(n.min,i.min),max:Math.max(n.max,i.max)};const o=e.getRescaledDataRange(),r=this.getRescaledDataRange();this.#Ee={min:Math.min(o.min,r.min),max:Math.max(o.max,r.max)};const a=e.getGeometry().getInitialTime();if(void 0===this.#ie.getCurrentNumberOfSlicesBeforeTime(a)){const e=this.#ie.getInitialTime();this.#ie.setInitialTime(void 0!==e?e:0)}const s=this.#ie.getCurrentTotalNumberOfSlices(),l=e.getGeometry().getOrigins(),c=l.length;this.#ie.appendVolume(l,a);const u=this.#ie.getSize(),d=this.#Oe*u.getDimSize(2),h=this.#Oe*u.getDimSize(3);if(void 0===this.#be.numberOfFiles)throw new Error("Missing number of files for buffer manipulation.");const g=h*this.#be.numberOfFiles;this.#d.length!==g&&(this.#Ne(g),this.#pe.isInitialized()&&this.#pe.realloc(this.#d,this.#ie.getSize()));const S=this.#ie.getCurrentNumberOfSlicesBeforeTime(a),p=S*d,m=c*d,f=s*d;if(p<f&&(this.#d.set(this.#d.subarray(p,f),p+m),this.#pe.isInitialized())){const e=3*u.getDimSize(2),t=S*e,n=s*e;this.#pe.shiftSlice(t,e*c,n)}this.#d.set(e.getBuffer(),p);for(let t=0;t<c;++t)this.setRescaleSlopeAndIntercept(e.getRescaleSlopeAndIntercept(),S+t);const v=this.#De.length;for(let t=0;t<c;++t)this.#De.splice(S+t,0,e.getImageUid());if(void 0!==this.#be.windowPresets){const t=this.#be.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)&&!ze(a.wl[0],r.wl[0])){a.perslice=!0;for(let e=0;e<v-1;++e)a.wl.push(a.wl[0])}if(void 0!==a.perslice&&!0===a.perslice)for(let e=0;e<c;++e)t[o].wl.splice(S+e,0,r.wl[0])}else t[o]=n[o]}}this.dispatchEvent(new CustomEvent("imagegeometrychange"))}appendFrameBuffer(e,t){const n=this.#ie.getSize(),i=this.#Oe*n.getDimSize(2);if(void 0===this.#be.numberOfFiles)throw new Error("Missing number of files for frame buffer manipulation.");const o=i*this.#be.numberOfFiles;this.#d.length!==o&&(this.#Ne(o),this.#pe.isInitialized()&&this.#pe.realloc(this.#d,this.#ie.getSize())),t>=this.#be.numberOfFiles?s.warn(`Ignoring frame at index ${t} (size: ${this.#be.numberOfFiles})`):(this.#d.set(e,i*t),this.appendFrame(t,new f(0,0,0)))}appendFrame(e,t){this.#ie.appendFrame(t,e),this.dispatchEvent(new CustomEvent("appendframe"))}getDataRange(){return this.#xe||(this.#xe=this.calculateDataRange()),this.#xe}getRescaledDataRange(){return this.#Ee||(this.#Ee=this.calculateRescaledDataRange()),this.#Ee}getHistogram(){if(!this.#Re){const e=this.calculateHistogram();this.#xe=e.dataRange,this.#Ee=e.rescaledDataRange,this.#Re=e.histogram}return this.#Re}setAtOffsets(e,t){let n,i;if("number"==typeof t){if(1!==this.#Oe)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.#Oe)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.#Oe;++e)this.#d[i+e]=n[e]}this.dispatchEvent(new CustomEvent("imagecontentchange"))}setAtOffsetsAndGetOriginals(e,t){const n=[];for(let i=0;i<e.length;++i){const o=e[i];let r=o[0],a=this.#d[r];const s=[];s.push({index:0,value:a});for(let e=0;e<o.length;++e){r=o[e];const n=this.#d[r];a!==n&&(s.push({index:e,value:n}),a=n),this.#d[r]=t,this.#pe.resetAroundOffset(r)}n.push(s)}return this.dispatchEvent(new CustomEvent("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=Ue(n?t[i]:[{index:0,value:t}],o.length);let a=r.next();for(;!a.done;){const e=o[a.index];this.#d[e]=a.value,this.#pe.resetAroundOffset(e),a=r.next()}}this.dispatchEvent(new CustomEvent("imagecontentchange"))}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}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]=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,C,D=n;for(let n=0;n<a;++n){D+=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=p: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=m: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(D+C[t])*e[t];t[D]=v,D+=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.#pe.initialize(this.#d,this.#ie.getSize())}getContour(){return this.#pe}#ke(e){const t=this.#ie.getSpacing(),n=this.getMeta().lengthUnit;let i=1,o="unit.pixel";"unit.mm"===n&&(i=t.get(0)*t.get(1)*t.get(2)*.001,o="unit.ml");for(const t of e){let e,r;t.centroid=this.#ie.indexToWorld(new a(t.centroidIndex)),t.volume={value:t.count*i,unit:o},void 0!==t.diameters&&(void 0!==t.diameters.major&&(e=t.diameters.major.diameter),void 0!==t.diameters.minor&&(r=t.diameters.minor.diameter)),t.diameters={major:{diameter:{value:e,unit:n}},minor:{diameter:{value:r,unit:n}}},t.height={value:t.height,unit:n}}const r=e.sort((e,t)=>t.volume.value-e.volume.value).sort((e,t)=>e.id-t.id);this.dispatchEvent(new CustomEvent("labelschanged",{detail:{labels:r}}))}#Ge(){const e=this.#ie.getSize(),t=e.get(0),n=e.get(1),i=[];for(const[e,o]of this.#Ue.getAll()){const r=[...o.keys()],a=Math.min(...r),s=new Dt([t,n,Math.max(...r)-a+1]),l=[];for(const[e,t]of o)l.push({sliceIndex:e-a,data:new Uint8Array(t)});i.push({segNumber:e,size:s,slices:l,minSlice:a})}this.#Fe.runOverlap(i,this.#ie)}recalculateLabels(){this.dispatchEvent(new CustomEvent("labelingstart")),null===this.#Fe&&(this.#Fe=new no,this.#Fe.ondone=e=>{this.#ke(e.data.labels),e.data.buffer&&(this.#d=e.data.buffer,this.dispatchEvent(new CustomEvent("imagecontentchange")))});const e=this.#Ue;e?.getHasOverlap()&&e.getAll().size>0?this.#Ge():this.#Fe.run(this.#d,this.#ie)}isResampled(){return this.#me}resample(e,t=void 0,n=void 0){null===this.#Me&&(this.#Me=new oo,this.#Me.ondoneframe=e=>{const t=e.data;this.#fe===t.jobId&&(this.#d.set(t.targetImageBuffer,t.startOffset),this.dispatchEvent(new CustomEvent("imageresampled",{detail:{frame:t.frame}})))},this.#Me.ondone=e=>{this.dispatchEvent(new CustomEvent("imageresamplingcomplete"))});const i=this.#me&&this.#Ce&&this.#ve?{buffer:this.#Ce,geometry:this.#ve}:{buffer:this.#d,geometry:this.#ie};this.dispatchEvent(new CustomEvent("imageresamplingstart"));const o=this.#Me.run(i.buffer,i.geometry,this.#be.PixelRepresentation,e,void 0===t||t,n);this.#me||(this.#me=!0,this.#Ce=this.#d,this.#ve=this.#ie),this.#d=o.buffer,this.#ie=o.geometry,this.#fe=o.jobId,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange"))}revert(){this.#me&&(this.dispatchEvent(new CustomEvent("imageresamplingstart")),this.#me=!1,this.#d=this.#Ce,this.#ie=this.#ve,this.#Ce=null,this.#ve=null,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange")),this.dispatchEvent(new CustomEvent("imageresampled")))}}const co=["annotationgroupeditablechange","annotationadd","annotationupdate","annotationremove"];class uo extends EventTarget{#ze;#be={};#He;#Ye;constructor(e){super(),this.#ze=void 0!==e?e:[],this.#He=!0}getList(){return this.#ze}getLength(){return this.#ze.length}isEditable(){return this.#He}setEditable(e){this.#He=e,this.dispatchEvent(new CustomEvent("annotationgroupeditablechange",{detail:{data:e}}))}getColour(){return this.#Ye}setColour(e){this.#Ye=e}add(e,t){this.#ze.push(e),this.dispatchEvent(new CustomEvent("annotationadd",{detail:{data:e,propagate:t}}))}update(e,t,n){const i=this.#ze.findIndex(t=>t.trackingUid===e.trackingUid);-1!==i?((t.includes("mathShape")||t.includes("textExpr"))&&e.updateQuantification(),this.#ze[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.#ze.findIndex(t=>t.trackingUid===e);if(-1!==n){const e=this.#ze.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.#ze)t.setViewController(e),t.updateQuantification()}find(e){return this.#ze.find(t=>t.trackingUid===e)}getMeta(){return this.#be}hasMeta(e){return void 0!==this.#be[e]}getMetaValue(e){return this.#be[e]}setMetaValue(e,t){this.#be[e]=t}}class ho{#Xe=10;#We="Verdana";#$e="#fff";#je="#ffff80";#Ze={x:1,y:1};#_e={x:1,y:1};#Ke=2;#Je={x:.25,y:.25};#et=.2;#tt=3;getFontFamily(){return this.#We}getFontSize(){return this.#Xe}getStrokeWidth(){return this.#Ke}getTextColour(){return this.#$e}getLineColour(){return this.#je}setLineColour(e){this.#je=e}setBaseScale(e){this.#Ze=e}setZoomScale(e){this.#_e=e}getBaseScale(){return this.#Ze}getZoomScale(){return this.#_e}scale(e){return e/this.#Ze.x}applyZoomScale(e){return{x:e/this.#_e.x,y:e/this.#_e.y}}applyZoomRatio(e){return e*this.#_e.x/this.#_e.y}getShadowOffset(){return this.#Je}getTagOpacity(){return this.#et}getTextPadding(){return this.#tt}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=Ii(e)).r+.002301961*t.g+447059e-9*t.b<.5;var t}(this.getLineColour())?"#fff":"#000"}}class go{#nt;constructor(e){this.#nt=e}fromJSON(e){const t=JSON.parse(e);let n;if("0.1"===t.version)n=this.#it(t);else if("0.2"===t.version)n=this.#ot(t);else if("0.3"===t.version)n=this.#rt(t);else if("0.4"===t.version)n=this.#at(t);else{if("0.5"!==t.version)throw new Error(`Unknown state file format version: '${t.version}'.`);n=this.#st(t)}return n}apply(e,t){const n=e.getStageController(),i=n.getActiveLayerGroup().getBaseViewLayer().getViewController(),o=new Ge(t["window-center"],t["window-width"]);i.setWindowLevel(o);const r=n.getActiveLayerGroup().getBaseScale();let a,s;if(void 0!==t.scaleCenter){a={x:t.scale*r.x,y:t.scale*r.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*a.x,o=n+t.translation.y*a.y;s={x:-i/a.x,y:-o/a.y,z:0}}else a={x:t.scale.x*r.x,y:t.scale.y*r.y,z:r.z},s={x:t.offset.x,y:t.offset.y,z:0};n.getActiveLayerGroup().setScale(a),n.getActiveLayerGroup().setOffset(s),e.setDrawings(t.drawings,t.drawingsDetails,this.#nt)}#it(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(bi(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=So(n.drawings).toObject(),t.drawingsDetails=po(n.drawingsDetails),(t=mo(t)).drawings=fo(t.drawings),t}#ot(e){return e.drawings=So(e.drawings).toObject(),e.drawingsDetails=po(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=mo(e)).drawings=fo(e.drawings),e}#rt(e){return e.drawingsDetails=po(e.drawingsDetails),(e=mo(e)).drawings=fo(e.drawings),e}#at(e){return(e=mo(e)).drawings=fo(e.drawings),e}#st(e){return e}}function So(t){let n,i,o;function r(e){return`slice-${e.get(2)}_frame-${4===e.length()?e.get(3):0}`}const s=new e.Layer({listening:!1,visible:!0}),l="string"==typeof t?JSON.parse(t):t;for(let t=0,c=l.length;t<c;++t)for(let c=0,u=l[t].length;c<u;++c)if(i=l[t][c],0!==i.length){o=new e.Group({id:r(new a([1,1,t,c])),name:"position-group",visible:!1});for(let t=0,r=i.length;t<r;++t)n=e.Node.create(i[t]),n.draggable(!0),n.getChildren().forEach(function(e){e.draggable(!1)}),o.add(n);s.add(o)}return s}function po(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 mo(e){const t=e.position;return e.position=[t.i,t.j,t.k],e}function fo(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 vo(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 Co(e){const t=vo(e);return 0===Object.keys(t).length?null:t.query}function Do(e){let t;const n=Co(e);return n&&void 0!==n.input&&(t=Io(n.input,n.dwvReplaceMode)),t}function yo(e,t){const n=Co(e);n&&void 0!==n.input&&wo(n.input,n.nslices,t)}function Io(e,t){const n=[];let i="key";t&&(i=t);const o=decodeURIComponent(e),r=vo(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 wo(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 To=["mousedown","mousemove","mouseup","mouseout","wheel","dblclick","touchstart","touchmove","touchend"];function Lo(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 m(e[t].clientX-n,e[t].clientY-i));return o}function Po(e){const t=e.currentTarget.getBoundingClientRect();let n=[];return void 0!==e.targetTouches&&0!==e.targetTouches.length?n=Lo(e.targetTouches,t):void 0!==e.changedTouches&&0!==e.changedTouches.length&&(n=Lo(e.changedTouches,t)),n}function Ao(e){return new m(e.offsetX,e.offsetY)}function Oo(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 bo{#lt;#ct=null;#ut=[];#dt={};constructor(e){this.#lt=e}init(){for(const e in this.#lt)this.#lt[e].init();this.enableShortcuts(!0)}enableShortcuts(e){e?window.addEventListener("keydown",this.#ht("window","keydown"),!0):window.removeEventListener("keydown",this.#ht("window","keydown"),!0)}getToolList(){return this.#lt}hasTool(e){return void 0!==this.getToolList()[e]}getSelectedTool(){return this.#ct}getSelectedToolEventHandler(e){return this.getSelectedTool()[e]}setSelectedTool(e){if(!this.hasTool(e))throw new Error(`Unknown tool: '${e}'`);this.#ct&&this.#ct.activate(!1),this.#ct=this.#lt[e],this.#ct.activate(!0)}setToolFeatures(e){this.getSelectedTool()&&this.getSelectedTool().setFeatures(e)}bindLayerGroup(e,t){const n=e.getDivId();e.addEventListener("activelayerchange",this.#gt(n)),this.#St(n,t)}#St(e,t){void 0!==this.#dt[e]&&this.#pt(this.#dt[e]),this.#dt[e]=t,this.#mt(t)}#gt(e){return t=>{const n=t.detail?.value,i=n?.[0];void 0!==i&&this.#St(e,i)}}#mt(e){e.bindInteraction();const t=To;for(let n=0;n<t.length;++n)e.addEventListener(t[n],this.#ht(e.getId(),t[n]))}#pt(e){e.unbindInteraction();const t=To;for(let n=0;n<t.length;++n)e.removeEventListener(t[n],this.#ht(e.getId(),t[n]))}#ht(e,t){if(void 0===this.#ut[e]&&(this.#ut[e]=[]),void 0===this.#ut[e][t]){const n=e=>{if(this.#ct){const t=this.#ct[e.type];t&&t(e)}};this.#ut[e][t]=n}return this.#ut[e][t]}}class xo{#ft=[];#vt=2;#Ct;constructor(e){this.#Ct=e}setNumberOfDimensions(e){this.#vt=e}setNToLoad(e){for(let t=0;t<e;++t){this.#ft[t]=[];for(let e=0;e<this.#vt;++e)this.#ft[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.#ft[e.index][e.subindex]=t,n=void 0!==e.item?e.item:{loaded:this.#Dt(e.index),total:100,source:e.source},this.#Ct({lengthComputable:!0,loaded:this.#yt(),total:100,item:n})};#Dt(e){let t=0;for(let n=0;n<this.#vt;++n)t+=this.#ft[e][n];return t/this.#vt}#yt(){let e=0;const t=this.#ft.length;for(let n=0;n<t;++n)e+=this.#Dt(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 Eo{onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class Ro extends Eo{#It=null;#wt=[];#Tt=null;#Lt=0;#Pt=0;#At;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#Ot(e){this.#It=e,this.#Lt=0,this.#Pt=0,this.#At=!1,this.#bt(),this.#xt()}#Et(e){this.#wt.push(e)}#bt(){this.#wt=[]}#Rt(e){this.#Tt=e}#xt(){this.#Tt=null}#Ft=e=>{this.#Lt++,this.#Lt===this.#It.length&&this.onload({source:this.#It})};#Mt=e=>{this.#Pt++,this.#Pt===this.#It.length&&this.onloadend({source:this.#It})};#qt(e,t){return n=>{n.source=t,e(n)}}load(e,t){this.onloadstart({source:e}),1===e.length&&(I(e[0],"DICOMDIR")||I(e[0],".dcmdir"))?this.#Ut(e[0],t):this.#Vt(e,t)}#Qt(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.#Mt()):e.load(i.target.response,t,n)}}#Vt(e,t){if(void 0===e||0===e.length)return;this.#Ot(e);const n=new xo(this.onprogress);n.setNToLoad(e.length);const i=zs(),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({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),a.onprogress=n.getUndefinedMonoProgressHandler(1),a.onloaditem=this.onloaditem,a.onload=this.#Ft,a.onloadend=this.#Mt,a.onerror=this.onerror,a.onabort=this.onabort,this.#Rt(a);break}if(!s)throw new Error(`No loader found for url: ${r}`);let l=0;const c=()=>{l<this.#wt.length-1&&!this.#At&&(++l,this.#wt[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.#qt(n.getMonoProgressHandler(i,0),r),o.onload=this.#Qt(a,r,i),o.onloadend=c;const s=this.#qt(this.onerror,r);o.onerror=e=>{this.#Mt(),s(e)};const l=this.#qt(this.ontimeout,r);o.ontimeout=e=>{this.#Mt(),l(e)};const u=this.#qt(this.onabort,r);o.onabort=e=>{this.#Mt(),u(e)},1===a.loadUrlAs()&&(o.responseType="arraybuffer"),this.#Et(o)}let u=this.#wt.length;void 0!==t&&void 0!==t.batchSize&&0!==u&&(u=Math.min(t.batchSize,this.#wt.length));for(let e=0;e<u;++e)this.#At||(l=e,this.#wt[l].send(null))}#Ut(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 Re;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.#Vt(r,t)}},n.onerror=t=>{this.#qt(this.onerror,e)(t),this.onloadend({})},n.onabort=t=>{this.#qt(this.onabort,e)(t),this.onloadend({})},n.send(null)}abort(){this.#At=!0;for(let e=0;e<this.#wt.length;++e)4!==this.#wt[e].readyState&&this.#wt[e].abort();this.#Tt&&this.#Tt.isLoading()&&this.#Tt.abort()}ontimeout(e){}}class Fo extends Ji{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 Mo extends Ji{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 qo extends Ji{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 Uo extends Ji{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 Vo{#Nt;#Bt;#kt=!1;constructor(e){this.#Nt=e,this.#Bt=new _i(10)}decode(e,t,n){this.#kt||(this.#kt=!0,this.#Bt.onworkstart=this.ondecodestart,this.#Bt.onworkitem=this.ondecodeditem,this.#Bt.onwork=this.ondecoded,this.#Bt.onworkend=this.ondecodeend,this.#Bt.onerror=this.onerror,this.#Bt.onabort=this.onabort);const i={buffer:e,meta:t};let o;"jpeg-baseline"===this.#Nt?o=new Fo(i,n):"jpeg-lossless"===this.#Nt?o=new Mo(i,n):"jpeg2000"===this.#Nt?o=new qo(i,n):"rle"===this.#Nt&&(o=new Uo(i,n)),void 0!==o&&this.#Bt.addWorkerTask(o)}abort(){this.#Bt.abort()}ondecodestart(e){}ondecodeditem(e){}ondecoded(e){}ondecodeend(e){}onerror(e){}onabort(e){}}const Qo="0040A30A",No="0040A161",Bo="0040A162",ko="0040A163",Go="004008EA";class zo{numericValue;floatingPointValue;rationalNumeratorValue;rationalDenominatorValue;measurementUnitsCode;toString(){return`${this.numericValue} ${this.measurementUnitsCode.toString()}`}}function Ho(e){const t={};return void 0!==e.measurementUnitsCode&&(t.MeasurementUnitsCodeSequence={value:[mn(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 Yo="0040A300",Xo="0040A301";class Wo{measuredValue;numericValueQualifierCode;toString(){let e="";return void 0!==this.measuredValue&&(e+=this.measuredValue.toString()),void 0!==this.numericValueQualifierCode&&(e+=` ${this.numericValueQualifierCode.toString()}`),e}}function $o(e){const t={};return void 0!==e.measuredValue&&(t.MeasuredValueSequence={value:[Ho(e.measuredValue)]}),void 0!==e.numericValueQualifierCode&&(t.NumericValueQualifierCodeSequence={value:[mn(e.numericValueQualifierCode)]}),t}const jo="00081150",Zo="00081155";class _o{referencedSOPClassUID;referencedSOPInstanceUID;toString(){return`${this.referencedSOPInstanceUID} (class: ${this.referencedSOPClassUID})`}}function Ko(e){const t=new _o;return void 0!==e[jo]&&(t.referencedSOPClassUID=e[jo].value[0]),void 0!==e[Zo]&&(t.referencedSOPInstanceUID=e[Zo].value[0]),t}function Jo(e){const t={};return void 0!==e.referencedSOPClassUID&&(t.ReferencedSOPClassUID=e.referencedSOPClassUID),void 0!==e.referencedSOPInstanceUID&&(t.ReferencedSOPInstanceUID=e.referencedSOPInstanceUID),t}const er="00081160",tr="00081199",nr="0062000B";class ir{referencedSOPSequence;referencedFrameNumber;referencedSegmentNumber;toString(){let e=this.referencedSOPSequence.toString();return void 0!==this.referencedFrameNumber&&(e+=`, frame: ${this.referencedFrameNumber}`),e}}function or(e){const t={};return void 0!==e.referencedFrameNumber&&(t.ReferencedFrameNumber=e.referencedFrameNumber),void 0!==e.referencedSOPSequence&&(t.ReferencedSOPSequence={value:[Jo(e.referencedSOPSequence)]}),void 0!==e.referencedSegmentNumber&&(t.ReferencedSegmentNumber=e.referencedSegmentNumber),t}class rr{#Gt;#zt;constructor(e,t){this.#Gt=e,this.#zt=t}getBegin(){return this.#Gt}getEnd(){return this.#zt}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 m((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 rr(this.#zt,this.#Gt)}quantify(e){const t=e.get2DSpacing(),n=this.getWorldLength(t);let i;return null!==n&&(i={value:n,unit:e.getLengthUnit()}),{length:i}}}function ar(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 sr(e,t){const n=e.getDeltaX(),i=e.getDeltaY();return n*t.getDeltaX()+i*t.getDeltaY()===0}function lr(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 cr(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(),lr(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}),d(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 rr(new m(r,a),new m(s,l))}class dr{#Ht;constructor(e){if(e.length>3)throw new Error("Too many points for a protractor");this.#Ht=e.slice(0,3)}getPoint(e){return this.#Ht[e]}getLength(){return this.#Ht.length}getCentroid(){return this.#Ht[1]}quantify(e,t){let n;if(3===this.#Ht.length){let e=ar(new rr(this.#Ht[0],this.#Ht[1]),new rr(this.#Ht[1],this.#Ht[2]));e>180&&(e=360-e),n={value:e,unit:"unit.degree"}}return{angle:n}}}class hr{#Ht=[];constructor(e){void 0!==e&&(this.#Ht=e)}getPoint(e){return this.#Ht[e]}getPoints(){return this.#Ht}getLength(){return this.#Ht.length}addPoint(e){this.#Ht.push(e)}addPoints(e){this.#Ht=this.#Ht.concat(e)}getCentroid(){let e,t=0,n=0,i=0;for(let e=0;e<this.#Ht.length;++e){const o=this.#Ht[e];let r;r=e===this.#Ht.length-1?this.#Ht[0]:this.#Ht[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 m(o*n,o*i)}return e}}class gr{#Yt;#Xt;constructor(e,t){this.#Yt=e,this.#Xt=t}getCenter(){return this.#Yt}getCentroid(){return this.#Yt}getRadius(){return this.#Xt}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=It(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 Sr{#Yt;#Wt;#$t;constructor(e,t,n){this.#Yt=e,this.#Wt=t,this.#$t=n}getCenter(){return this.#Yt}getCentroid(){return this.#Yt}getA(){return this.#Wt}getB(){return this.#$t}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=It(o,n);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 pr(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 mr{#Gt;#zt;constructor(e,t){this.#Gt=new m(Math.min(e.getX(),t.getX()),Math.min(e.getY(),t.getY())),this.#zt=new m(Math.max(e.getX(),t.getX()),Math.max(e.getY(),t.getY()))}getBegin(){return this.#Gt}getEnd(){return this.#zt}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 m(Math.round(this.getBegin().getX()),Math.round(this.getBegin().getY())),max:new m(Math.round(this.getEnd().getX()),Math.round(this.getEnd().getY()))}}getCentroid(){return new m(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=It(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 fr(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 vr{#Gt;#zt;shortAxisLength;shortAxisCenter;shortAxisL1;shortAxisL2;shortAxisT;constructor(e,t){this.#Gt=e,this.#zt=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.#Gt}getEnd(){return this.#zt}getCentroid(){return new m((this.#Gt.getX()+this.#zt.getX())/2,(this.#Gt.getY()+this.#zt.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.#zt.getX()-this.#Gt.getX()}getDeltaY(){return this.#zt.getY()-this.#Gt.getY()}quantify(e){const t=e.get2DSpacing?.()??{x:1,y:1},n=new rr(this.#Gt,this.#zt).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.#Gt.getX()+e*r,s=this.#Gt.getY()+n*r,l=new m(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 m(l.getX()+c*d,l.getY()+u*d),S=new m(l.getX()-c*h,l.getY()-u*h);i=new rr(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 Cr="00480301",Dr="00700022",yr="00700023",Ir="0070031A",wr="POINT",Tr="MULTIPOINT",Lr="POLYLINE",Pr="CIRCLE",Ar="ELLIPSE";class Or{graphicData;graphicType;pixelOriginInterpretation;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function br(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 xr(e){const t=new Or;if(e instanceof m)t.graphicData=[e.getX().toString(),e.getY().toString()],t.graphicType=wr;else if(e instanceof rr)t.graphicData=[e.getBegin().getX().toString(),e.getBegin().getY().toString(),e.getEnd().getX().toString(),e.getEnd().getY().toString()],t.graphicType=Lr;else if(e instanceof dr){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=Lr}else if(e instanceof hr){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=Lr}else if(e instanceof gr){const n=e.getCenter(),i=new m(n.getX()+e.getRadius(),n.getY());t.graphicData=[n.getX().toString(),n.getY().toString(),i.getX().toString(),i.getY().toString()],t.graphicType=Pr}else if(e instanceof Sr){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=Ar}else if(e instanceof mr){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=Lr}else if(e instanceof vr){let n=0,i=0;const o=e.getBegin(),r=e.getEnd(),a=e.shortAxisCenter instanceof m?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 m(a.getX()+n*u,a.getY()+i*u),g=new m(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=Lr}return t}function Er(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 m(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===wr)n.length>1&&s.warn(`Expecting 1 point for point, got ${o}`),r=n[0];else if(e.graphicType===Pr){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 gr(e,t)}else if(e.graphicType===Ar){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 m(n[0].getX()+e,n[0].getY());r=new Sr(i,e,t)}else if(e.graphicType===Lr)if(i)if(5===n.length){const e=new rr(n[0],n[1]),t=new rr(n[1],n[2]),i=new rr(n[2],n[3]),o=new rr(n[3],n[4]);r=sr(e,t)&&sr(t,i)&&sr(i,o)?new mr(n[0],n[2]):new hr(n.slice(0,-1))}else r=new hr(n.slice(0,-1));else if(2===n.length)r=new rr(n[0],n[1]);else if(3===n.length)r=new dr([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 vr(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,f=t.getX()-e.getX(),v=t.getY()-e.getY(),C=Math.sqrt(f*f+v*v);let D=.5;if(C>0){const t=s-e.getX(),n=l-e.getY(),i=C*C;0!==i&&(a=(t*f+n*v)/i),D=Math.max(0,Math.min(1,a))}r.shortAxisLength=p,r.shortAxisT=D,r.shortAxisL1=g,r.shortAxisL2=S,r.shortAxisCenter=new m(s,l),r.hasShortAxisInteraction=!0}return r}const Rr="00700022",Fr="00700023",Mr="30060024",qr="0070031A";class Ur{graphicData;graphicType;referencedFrameofReferenceUID;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Vr(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 Qr={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"},Nr="CONTAINS",Br="HAS PROPERTIES",kr="HAS OBS CONTEXT",Gr="INFERRED FROM",zr="SELECTED FROM",Hr="HAS CONCEPT MOD",Yr="TEXT",Xr="NUM",Wr="CODE",$r="UIDREF",jr="COMPOSITE",Zr="IMAGE",_r="SCOORD",Kr="SCOORD3D",Jr="CONTAINER",ea="SEPARATE",ta={TEXT:"TextValue",DATE:"Date",TIME:"Time",DATETIME:"DateTime",UIDREF:"UID",PNAME:"PersonName",CONTAINER:"ContinuityOfContent"};function na(e){let t;const n=ue(e,Qr.ContentTemplateSequence);if(void 0!==n){const e=ue(n,Qr.MappingResource),i=ue(n,Qr.TemplateIdentifier);void 0!==e&&void 0!==i&&(t=`${e}-${i}`)}return t}class ia{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&&Sn(this.conceptNameCode,t)&&this.relationshipType===n}}function oa(e){let t=ue(e,Qr.ValueType);void 0===t&&(t="");const n=new ia(t);n.relationshipType=ue(e,Qr.RelationshipType);const i=ue(e,Qr.ConceptNameCodeSequence);if(void 0!==i&&(n.conceptNameCode=pn(i)),t===Wr)n.value=pn(ue(e,Qr.ConceptCodeSequence));else if(t===Xr)n.value=function(e){const t=new Wo;return void 0!==e[Yo]&&(t.measuredValue=function(e){const t=new zo;return void 0!==e[Qo]&&(t.numericValue=parseFloat(e[Qo].value[0])),void 0!==e[No]&&(t.floatingPointValue=parseFloat(e[No].value[0])),void 0!==e[Bo]&&(t.rationalNumeratorValue=parseInt(e[Bo].value[0],10)),void 0!==e[ko]&&(t.rationalDenominatorValue=parseInt(e[ko].value[0],10)),void 0!==e[Go]&&(t.measurementUnitsCode=pn(e[Go].value[0])),t}(e[Yo].value[0])),void 0!==e[Xo]&&(t.numericValueQualifierCode=pn(e[Xo].value[0])),t}(e);else if(t===Zr)n.value=function(e){const t=new ir;return void 0!==e[er]&&(t.referencedFrameNumber=e[er].value[0]),void 0!==e[tr]&&(t.referencedSOPSequence=Ko(e[tr].value[0])),void 0!==e[nr]&&(t.referencedSegmentNumber=e[nr].value[0]),t}(e);else if(t===jr)n.value=Ko(ue(e,Qr.ReferencedSOPSequence));else if(t===_r)n.value=function(e){const t=new Or;return void 0!==e[Dr]&&(t.graphicData=e[Dr].value),void 0!==e[yr]&&(t.graphicType=e[yr].value[0]),void 0!==e[Cr]&&(t.pixelOriginInterpretation=e[Cr].value[0]),void 0!==e[Ir]&&(t.fiducialUID=e[Ir].value[0]),t}(e);else if(t===Kr)n.value=function(e){const t=new Ur;return void 0!==e[Rr]&&(t.graphicData=e[Rr].value),void 0!==e[Fr]&&(t.graphicType=e[Fr].value[0]),void 0!==e[Mr]&&(t.referencedFrameofReferenceUID=e[Mr].value[0]),void 0!==e[qr]&&(t.fiducialUID=e[qr].value[0]),t}(e);else{const i=ta[t];void 0!==i?n.value=ue(e,Qr[i]):console.warn(`Unsupported input ValueType: ${t}`)}const o=de(e,Qr.ContentSequence);if(void 0!==o)for(const e of o)n.contentSequence.push(oa(e));return n}function ra(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:[mn(e.conceptNameCode)]}),"CODE"===e.valueType)t.ConceptCodeSequence={value:[mn(e.value)]};else if(e.valueType===Xr)t={...t,...$o(e.value)};else if(e.valueType===Zr)t={...t,...or(e.value)};else if(e.valueType===jr)t={...t,...Jo(e.value)};else if(e.valueType===_r)t={...t,...br(e.value)};else if(e.valueType===Kr)t={...t,...Vr(e.value)};else{const n=ta[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(ra(n))}return t}function aa(e,t,n,i){const o=function(e){const t=Wn[e];let n;return void 0!==t&&(n="DCM"===t.scheme?zn({meaning:e,value:t.key}):Hn(t.key,t.scheme)),n}(e);if(void 0===o)return;let r=Nr;void 0!==i&&(r=i);const a=new ia(Xr);a.relationshipType=r,a.conceptNameCode=o;const s=new zo;s.numericValue=t,s.measurementUnitsCode=jn(n);const l=new Wo;return l.measuredValue=s,a.value=l,a}class sa{#jt;#n;#i;constructor(e,t,n){this.#jt=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 sa(sa.idFromIndex(e),t,n)}getId(){return this.#jt}getX(){return this.#n}getY(){return this.#i}setX(e){this.#n=e}setY(e){this.#i=e}}const la={arrow:{"*":""},circle:{"*":"{surface}"},ellipse:{"*":"{surface}"},protractor:{"*":"{angle}"},rectangle:{"*":"{surface}"},roi:{"*":""},ruler:{"*":"{length}"},bidimensional:{"*":"{longAxis} x {shortAxis}"},bidimensionalDrawing:{"*":"{longAxis}"}};function ca(e){return"label"===e.name()}function ua(e){return"shape"===e.name()}function da(e){return"position-group"===e.name()}function ha(t,n){const i=t.getChildren(function(e){return e.id()===`anchor${n}`})[0];if(i instanceof e.Ellipse)return i}function ga(e){return function(t){return t.id()===e}}function Sa(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 pa(e){return void 0!==_e.labelTexts&&void 0!==_e.labelTexts[e]?_e.labelTexts[e]:la[e]}class ma{#u="rectangle";#Zt;static supports(e){return e instanceof mr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new mr(t[0],t[1]),e.setTextExpr(pa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=sa.indexFromId(t.getId()),i=(n+1)%4,o=(n+2)%4,r=(n+3)%4;void 0===this.#Zt&&(this.#Zt=this.getAnchors(e));const a=this.#Zt[o];this.#Zt[n]=t,n%2==0?(this.#Zt[r].setX(t.getX()),this.#Zt[i].setY(t.getY())):(this.#Zt[r].setY(t.getY()),this.#Zt[i].setX(t.getX())),e.mathShape=new mr(new m(a.getX(),a.getY()),new m(t.getX(),t.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new mr(new m(i.getX()+t.x,i.getY()+t.y),new m(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){this.#Zt=void 0}getAnchors(e){if(void 0!==this.#Zt)return this.#Zt;const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[sa.fromIndex(0,n,i),sa.fromIndex(1,n+o,i),sa.fromIndex(2,n+o,i+r),sa.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 m(n+o/2,i),new m(n,i+r/2),new m(n+o/2,i+r),new m(n+o,i+r/2)]}getDefaultLabelPosition(e){const t=e.mathShape;return new m(t.getBegin().getX(),t.getEnd().getY())}}class fa{#u="circle";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){const n=Math.abs(t[0].getX()-t[1].getX()),i=Math.abs(t[0].getY()-t[1].getY());e.mathShape=new gr(t[0],Math.round(Math.sqrt(n*n+i*i))),e.setTextExpr(pa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=new m(n.getCenter().getX(),n.getCenter().getY()),o=new m(t.getX(),t.getY());e.mathShape=new gr(i,i.getDistance(o)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new gr(new m(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[sa.fromIndex(0,n-o,i),sa.fromIndex(1,n+o,i),sa.fromIndex(2,n,i+o),sa.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 m(n-o,i-o),new m(n+o,i-o),new m(n-o,i+o),new m(n+o,i+o)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter(),i=t.getRadius();return new m(n.getX()-i,n.getY()+i)}}class va{#u="ellipse";static supports(e){return e instanceof Sr}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 Sr(t[0],n,i),e.setTextExpr(pa(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 Sr(i,Math.abs(o),Math.abs(r)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new Sr(new m(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[sa.fromIndex(0,n-o,i),sa.fromIndex(1,n+o,i),sa.fromIndex(2,n,i+r),sa.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 m(n-o,i-r),new m(n+o,i-r),new m(n-o,i+r),new m(n+o,i+r)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter();return new m(n.getX()-t.getA(),n.getY()+t.getB())}}class Ca{#u="ruler";static supports(e){return e instanceof rr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new rr(t[0],t[1]),e.setTextExpr(pa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[sa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new rr(new m(i.getX(),i.getY()),new m(o.getX(),o.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new rr(new m(i.getX()+t.x,i.getY()+t.y),new m(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[sa.fromIndex(0,n.getX(),n.getY()),sa.fromIndex(1,i.getX(),i.getY())]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[new m((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 Da{#u="arrow";static supports(e){return e instanceof m}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(pa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[sa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new m(i.getX(),i.getY()),e.referencePoints=[new m(o.getX(),o.getY())],e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=e.referencePoints[0];e.mathShape=new m(n.getX()+t.x,n.getY()+t.y),e.referencePoints=[new m(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[sa.fromIndex(0,t.getX(),t.getY()),sa.fromIndex(1,n.getX(),n.getY())]}getConnectorPositions(e){const t=e.mathShape,n=e.referencePoints[0];return[new m((t.getX()+n.getX())/2,(t.getY()+n.getY())/2)]}getDefaultLabelPosition(e){return e.mathShape}}class ya{#u="roi";static supports(e){return e instanceof hr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new hr(t),e.setTextExpr(pa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape.getPoints().slice();n[sa.indexFromId(t.getId())]=new m(t.getX(),t.getY()),e.mathShape=new hr(n),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<n.getLength();++e)i.push(new m(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new hr(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(sa.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 m((o.getX()+r.getX())/2,(o.getY()+r.getY())/2))}return i}getDefaultLabelPosition(e){return e.mathShape.getPoint(0)}}class Ia{#u="protractor";static supports(e){return e instanceof dr}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 dr(t),e.setTextExpr(pa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[sa.indexFromId(t.getId())]=t;const i=n[0],o=n[1],r=n[2];e.mathShape=new dr([new m(i.getX(),i.getY()),new m(o.getX(),o.getY()),new m(r.getX(),r.getY())]),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<3;++e)i.push(new m(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new dr(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(sa.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){return[e.mathShape.getPoint(1)]}getDefaultLabelPosition(e){const t=e.mathShape,n=new rr(t.getPoint(0),t.getPoint(1)),i=new rr(t.getPoint(1),t.getPoint(2));return new m((n.getCentroid().getX()+i.getCentroid().getX())/2,(n.getCentroid().getY()+i.getCentroid().getY())/2)}}function wa(e,t,n,i=20){const o=lr(t,t.getBegin(),i,n),r=lr(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 Ta{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 La(e){const t=new rr(e.getPoint(0),e.getPoint(1)),n=new rr(e.getPoint(1),e.getPoint(2));let i=ar(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 Pa(t,n,i){const{radius:o,angle:r,inclination:a}=La(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 Aa(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 Oa={rectangle:new class extends Ta{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 Ta{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 Ta{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 Ta{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 wa(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()]),wa(e,i,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=n.getZoomScale(),r=lr(i,i.getBegin(),20,o),a=lr(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=lr(o,o.getBegin(),20,r),s=lr(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 Ta{createShape(t,n){const i=t.mathShape,o=t.referencePoints[0],r=new rr(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 wa(a,r,n.getZoomScale()),a}updateShape(e,t,n){const i=t.mathShape,o=t.referencePoints[0],r=new rr(i,o);e.position({x:0,y:0}),e.points([i.getX(),i.getY(),o.getX(),o.getY()]),wa(e,r,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=t.referencePoints[0],r=cr(new rr(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=cr(new rr(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 Ta{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 Ta{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()&&Aa(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()]),Aa(e,n)}createExtras(e,t){const n=e.mathShape;return 3!==n.getLength()?[]:[Pa(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}=La(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 ba(e){const t=Oa[e];return t||s.error(`shapePainters: no painter for shape '${e}'`),t}class xa{#_t;constructor(e){this.#_t=e}getPosition(e){let t=e.labelPosition;return void 0===t&&(t=this.#_t(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 m(t+i/2,n),new m(t,n+o/2),new m(t+i/2,n+o),new m(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 Ea{#Kt;#Jt;constructor(e){this.#Kt=e,this.#Jt=new xa(t=>e.getDefaultLabelPosition(t))}createShapeGroup(t,n){const i=ba(this.#Kt.getName()),o=new e.Group;if(o.name(this.#Kt.getGroupName()),o.visible(!0),o.id(t.trackingUid),o.add(i.createShape(t,n)),this.#Kt.isComplete(t)){for(const e of i.createExtras(t,n))o.add(e);const e=this.#Jt.create(t,n);o.add(e);const r=this.#Kt.getConnectorPositions(t);o.add(this.#Jt.getConnector(r,e,n))}return o}getAnchors(e,t){return e?this.#Kt.getAnchors(e).map(e=>Sa(e.getX(),e.getY(),e.getId(),t)):[]}constrainAnchorMove(e,t){const n=new sa(e.id(),e.x(),e.y());this.#Kt.constrainAnchorMove(n,t),e.x(n.getX()),e.y(n.getY())}onAnchorMoveEnd(t,n){this.#Kt.onAnchorMoveEnd();const i=t.getParent();if(!(i instanceof e.Group))return;const o=this.#Kt.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 sa(t.id(),t.x(),t.y());this.#Kt.updateAnnotationOnAnchorMove(e,n)}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();if(!(o instanceof e.Group))return;const r=ba(this.#Kt.getName()),a=o.getChildren(ua)[0];r.updateShape(a,t,i),r.updateExtras(o,t,i);const s=this.#Kt.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.#Jt.updatePosition(t,o),this.updateConnector(t,o)}updateLabelContent(e,t,n){this.#Jt.updateContent(e,t)}updateConnector(e,t){const n=this.#Kt.getConnectorPositions(e);this.#Jt.updateConnector(t,n)}}class Ra{#en=0;#tn=0;getMin(){return this.#en}setMin(e){this.#en=e}getMax(){return this.#tn}setMax(e){this.#tn=e}getName(){return"Threshold"}#nn=null;setOriginalImage(e){this.#nn=e}getOriginalImage(){return this.#nn}update(){const e=this.getOriginalImage(),t=e.getDataRange().min;return e.transform(e=>e<this.getMin()||e>this.getMax()?t:e)}}class Fa{getName(){return"Sharpen"}#nn=null;setOriginalImage(e){this.#nn=e}getOriginalImage(){return this.#nn}update(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])}}class Ma{getName(){return"Sobel"}#nn=null;setOriginalImage(e){this.#nn=e}getOriginalImage(){return this.#nn}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 qa{getName(){return""}execute(){}undo(){}}class Ua extends EventTarget{#in=[];#on=0;getStackSize(){return this.#in.length}getCurrentStackIndex(){return this.#on}getCurrentCommand(){return this.#in[this.#on-1]}add(e){this.#in=this.#in.slice(0,this.#on),this.#in.push(e),++this.#on,this.dispatchEvent(new Event("undoadd"))}remove(e){let t=!1;const n=this.#in.findIndex(function(t){return t.getName()===e});return-1!==n&&(t=!0,this.dispatchEvent(new CustomEvent("undoremove",{detail:{commandName:e}})),this.#in.splice(n,1),--this.#on),t}undo(){this.#on>0&&(this.dispatchEvent(new Event("undo")),--this.#on,this.#in[this.#on].undo())}redo(){this.#on<this.#in.length&&(this.#in[this.#on].execute(),++this.#on,this.dispatchEvent(new Event("redo")))}}class Va extends qa{#rn;#nt;#an;constructor(e,t,n){super(),this.#rn=e,this.#nt=t,this.#an=n}getName(){return`Filter-${this.#rn.getName()}`}execute(){this.#an.getDataController().setImage(this.#nt,this.#rn.update()),this.#an.getStageController().render(this.#nt);const e={type:"filterrun",id:this.getName(),dataId:this.#nt};this.onExecute(e)}undo(){this.#an.getDataController().setImage(this.#nt,this.#rn.getOriginalImage()),this.#an.getStageController().render(this.#nt);const e={type:"filterundo",id:this.getName(),dataid:this.#nt};this.onUndo(e)}onExecute(e){}onUndo(e){}}class Qa extends EventTarget{#an;constructor(e){super(),this.#an=e}#sn;#ln=0;#cn=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))};activate(e){for(const t in this.#sn)e?(this.#sn[t].addEventListener("filterrun",this.#cn),this.#sn[t].addEventListener("filterundo",this.#cn)):(this.#sn[t].removeEventListener("filterrun",this.#cn),this.#sn[t].removeEventListener("filterundo",this.#cn))}setOptions(e){this.#sn={};for(const t in e)this.#sn[t]=new e[t](this.#an)}getOptionsType(){return"instance"}init(){for(const e in this.#sn)this.#sn[e].init()}keydown=e=>{e.context="Filter",this.#an.onKeydown(e)};getEventNames(){return["filterrun","filterundo"]}getSelectedFilter(){return this.#ln}setFeatures(e){if(void 0!==e.filterName){if(!this.hasFilter(e.filterName))throw new Error(`Unknown filter: '${e.filterName}'`);this.#ln&&this.#ln.activate(!1),this.#ln=this.#sn[e.filterName],this.#ln.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.#sn}hasFilter(e){return void 0!==this.#sn?.[e]}}class Na extends EventTarget{#an;constructor(e){super(),this.#an=e}#rn=new Ra;#un=!0;activate(e){e&&(this.#un=!0)}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run threshod filter on.");if(this.#rn.setMin(e.min),this.#rn.setMax(e.max),this.#un){const t=this.#an.getDataController().get(e.dataId).image;this.#rn.setOriginalImage(t),this.#un=!1}const t=new Va(this.#rn,e.dataId,this.#an);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.#an.getUndoController().addToUndoStack(t)}}class Ba extends EventTarget{#an;constructor(e){super(),this.#an=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sharpen filter on.");const t=new Fa,n=this.#an.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Va(t,e.dataId,this.#an);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.#an.getUndoController().addToUndoStack(i)}}class ka extends EventTarget{#an;constructor(e){super(),this.#an=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sobel filter on.");const t=new Ma,n=this.#an.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Va(t,e.dataId,this.#an);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.#an.getUndoController().addToUndoStack(i)}}const Ga={},za={draw:{ArrowFactory:class{#Kt=new Da;#dn=new Ea(this.#Kt);static supports(e){return Da.supports(e)}getName(){return this.#Kt.getName()}getGroupName(){return this.#Kt.getGroupName()}getNPoints(){return this.#Kt.getNPoints()}setAnnotationMathShape(e,t){this.#Kt.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#dn.createShapeGroup(e,t)}getAnchors(e,t){return this.#dn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#dn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#dn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#dn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#dn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#Kt.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#dn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#dn.updateConnector(e,t)}},CircleFactory:class{#Kt=new fa;#dn=new Ea(this.#Kt);static supports(e){return fa.supports(e)}getName(){return this.#Kt.getName()}getGroupName(){return this.#Kt.getGroupName()}getNPoints(){return this.#Kt.getNPoints()}setAnnotationMathShape(e,t){this.#Kt.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#dn.createShapeGroup(e,t)}getAnchors(e,t){return this.#dn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#dn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#dn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#dn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#dn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#Kt.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#dn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#dn.updateConnector(e,t)}},EllipseFactory:class{#Kt=new va;#dn=new Ea(this.#Kt);static supports(e){return va.supports(e)}getName(){return this.#Kt.getName()}getGroupName(){return this.#Kt.getGroupName()}getNPoints(){return this.#Kt.getNPoints()}setAnnotationMathShape(e,t){this.#Kt.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#dn.createShapeGroup(e,t)}getAnchors(e,t){return this.#dn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#dn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#dn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#dn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#dn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#Kt.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#dn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#dn.updateConnector(e,t)}},ProtractorFactory:class{#Kt=new Ia;#dn=new Ea(this.#Kt);static supports(e){return Ia.supports(e)}getName(){return this.#Kt.getName()}getGroupName(){return this.#Kt.getGroupName()}getNPoints(){return this.#Kt.getNPoints()}setAnnotationMathShape(e,t){this.#Kt.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#dn.createShapeGroup(e,t)}getAnchors(e,t){return this.#dn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#dn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#dn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#dn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#dn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#Kt.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#dn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#dn.updateConnector(e,t)}},RectangleFactory:class{#Kt=new ma;#dn=new Ea(this.#Kt);static supports(e){return ma.supports(e)}getName(){return this.#Kt.getName()}getGroupName(){return this.#Kt.getGroupName()}getNPoints(){return this.#Kt.getNPoints()}setAnnotationMathShape(e,t){this.#Kt.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#dn.createShapeGroup(e,t)}getAnchors(e,t){return this.#dn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#dn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#dn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#dn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#dn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#Kt.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#dn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#dn.updateConnector(e,t)}},RoiFactory:class{#Kt=new ya;#dn=new Ea(this.#Kt);static supports(e){return ya.supports(e)}getName(){return this.#Kt.getName()}getGroupName(){return this.#Kt.getGroupName()}getNPoints(){return this.#Kt.getNPoints()}setAnnotationMathShape(e,t){this.#Kt.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#dn.createShapeGroup(e,t)}getAnchors(e,t){return this.#dn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#dn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#dn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#dn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#dn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#Kt.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#dn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#dn.updateConnector(e,t)}},RulerFactory:class{#Kt=new Ca;#dn=new Ea(this.#Kt);static supports(e){return Ca.supports(e)}getName(){return this.#Kt.getName()}getGroupName(){return this.#Kt.getGroupName()}getNPoints(){return this.#Kt.getNPoints()}setAnnotationMathShape(e,t){this.#Kt.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#dn.createShapeGroup(e,t)}getAnchors(e,t){return this.#dn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#dn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#dn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#dn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#dn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#Kt.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#dn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#dn.updateConnector(e,t)}},BidimensionalFactory:class{#u="bidimensional";#Jt=new xa(this.#hn);static supports(e){return e instanceof vr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}#gn(e){return void 0!==_e.labelTexts&&void 0!==_e.labelTexts[this.#u]?_e.labelTexts[this.#u]:!0===e.mathShape.hasShortAxisInteraction&&null!==e.quantification?.shortAxis?.value?la[this.#u]:la[`${this.#u}Drawing`]}setAnnotationMathShape(e,t){const n=new vr(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.#gn(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.#Sn(t,n);i.add(o);const r=this.#pn(t,n);for(const e of r)i.add(e);const a=this.#Jt.create(t,n);i.add(a);const s=this.#mn(o);i.add(this.#Jt.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}#Sn(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 wa(o,i,n.getZoomScale?n.getZoomScale():{x:1,y:1}),o}#pn(t,n){const i=t.mathShape,o=10,r=n.getZoomScale?n.getZoomScale():{x:1,y:1},a=lr(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=lr(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"})]}#mn(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 m(o,r)]}#fn(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.#fn(e),i=[];for(let e=0;e<n.length;++e)i.push(Sa(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 p=d*c+h*u;"anchor2"===e.id()?n.shortAxisL1=Math.max(.1,p):n.shortAxisL2=Math.max(.1,-p),n.shortAxisLength=n.shortAxisL1+n.shortAxisL2;const m="anchor2"===e.id()?n.shortAxisL1:-n.shortAxisL2;e.x(S.getX()+c*m),e.y(S.getY()+u*m)}}onAnchorMoveEnd(e,t){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#vn(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Jt.updatePosition(t,o),this.updateConnector(t,o))}#vn(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()]),wa(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=lr(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=lr(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=ha(r,2),m=ha(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.#gn(t)),t.updateQuantification?.(),r.getLayer()?.draw()}updateLabelContent(e,t,n){this.#Jt.updateContent(e,t)}updateConnector(t,n){const i=n.findOne(".shape");if(i&&i instanceof e.Line){const e=this.#mn(i);this.#Jt.updateConnector(n,e)}}#hn(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 m(i.getX()+t.x,i.getY()+t.y),a=new m(o.getX()+t.x,o.getY()+t.y),s=new vr(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 m(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=ha(i,0),a=ha(i,1),s=new m(r.x()-o.x(),r.y()-o.y()),l=new m(a.x()-o.x(),a.y()-o.y()),c=new vr(s,l),u=t.mathShape;if(u.shortAxisCenter instanceof m){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 m(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 m(n.getX()-l*o/2,n.getY()-c*o/2),d=new m(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 m(i.getX()-l*o/2,i.getY()-c*o/2),S=new m(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 m){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 m(n.getX()+l*u,n.getY()+c*u),new m(n.getX()-l*d,n.getY()-c*d)]}getPointAlongLine(e,t){const n=e.getBegin(),i=e.getEnd();return new m(n.getX()+(i.getX()-n.getX())*t,n.getY()+(i.getY()-n.getY())*t)}}},filter:{Threshold:Na,Sobel:ka,Sharpen:Ba}};class Ha{#h=!0;#p;constructor(e,t){void 0!==t&&(this.#h=t),this.#p=new DataView(e)}writeUint8(e,t){return this.#p.setUint8(e,t),e+Uint8Array.BYTES_PER_ELEMENT}writeInt8(e,t){return this.#p.setInt8(e,t),e+Int8Array.BYTES_PER_ELEMENT}writeUint16(e,t){return this.#p.setUint16(e,t,this.#h),e+Uint16Array.BYTES_PER_ELEMENT}writeInt16(e,t){return this.#p.setInt16(e,t,this.#h),e+Int16Array.BYTES_PER_ELEMENT}writeUint32(e,t){return this.#p.setUint32(e,t,this.#h),e+Uint32Array.BYTES_PER_ELEMENT}writeUint64(e,t){return this.#p.setBigUint64(e,t,this.#h),e+BigUint64Array.BYTES_PER_ELEMENT}writeInt32(e,t){return this.#p.setInt32(e,t,this.#h),e+Int32Array.BYTES_PER_ELEMENT}writeInt64(e,t){return this.#p.setBigInt64(e,t,this.#h),e+BigInt64Array.BYTES_PER_ELEMENT}writeFloat32(e,t){return this.#p.setFloat32(e,t,this.#h),e+Float32Array.BYTES_PER_ELEMENT}writeFloat64(e,t){return this.#p.setFloat64(e,t,this.#h),e+Float64Array.BYTES_PER_ELEMENT}writeHex(e,t){const n=parseInt(t,16);return this.#p.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 Ya=0;class Xa{action;value;constructor(e){this.action=e}}const Wa={copy:e=>e,remove:()=>null,clear:e=>(e.value=[],e),replace:(e,t)=>(e.value=[t],e)};function $a(e){const t=`.${(new Date).toISOString().replace(/\D/g,"").substring(0,14)}`;Ya+=1;const n=`.${Ya}`;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 ja(e){return e%2==0}function Za(e){const t=J[e];return void 0!==t&&"string"===t}function _a(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}class Ka{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 Ja="00080005",es="00280100";class ts{#Cn=!1;#Dn=!0;#yn={default:{action:"copy",value:null}};#In=this.#yn;#wn=[];#Tn=new Ka;#Ln=this.#Tn;setUseUnVrForPrivateSq(e){this.#Cn=e}setFixUnknownVR(e){this.#Dn=e}setRules(e,t){if(this.#In=e,this.#wn=[],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){const e=re(U(n));t=void 0!==e?.getName()}if(t)e=n;else{const t=se(n);void 0!==t&&(e=t.getKey())}void 0!==e&&this.#wn.push(e)}}}}#Pn(e){return this.#Tn.encode(e)}#An(e){return this.#Ln.encode(e)}useSpecialTextEncoder(){this.#Ln=new TextEncoder}getElementToWrite(e){const t=ae(e.tag),n=re(e.tag),i=n?.getName();let o;return o=void 0!==this.#In[e.tag.getKey()]?this.#In[e.tag.getKey()]:void 0!==i&&void 0!==this.#In[i]?this.#In[i]:void 0!==this.#In[t]?this.#In[t]:this.#In.default,Wa[o.action](e,o.value)}#On(e,t,n,i,o){const r=function(e){return Q(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 le("NONE");l.vl=n?4294967295:s.vl,l.tag=V(),l.value=[],t=this.#bn(e,l,t,i);for(const n of a)r(n)||B(n.tag)||(t=this.#bn(e,n,t,i,o));if(n){const n=new le("NONE");n.vl=0,n.tag=N(),n.value=[],t=this.#bn(e,n,t,i)}}return t}#xn(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=_a(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=J[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.#On(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}#En(e,t,n,i,o,r){let a=!1;if(void 0!==t.undefinedLength&&(a=t.undefinedLength),a){const a=[];a.push({tag:V(),vr:"NONE",vl:0,value:[]});for(const e of i)a.push({tag:V(),vr:t.vr,vl:e.length,value:e});n=this.#On(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.#xn(e,t,n,a,o,r)}return n}#bn(e,t,n,i,o){const r=t.tag.isWithVR(),a=!(!i&&r)||Z(t.vr);n=e.writeHex(n,t.tag.getGroup()),n=e.writeHex(n,t.tag.getElement());let l=t.vr;this.#Cn&&t.tag.isPrivate()&&"SQ"===l&&(s.warn("Write element using VR=UN for private sequence."),l="UN"),r&&!i&&(n=e.writeUint8Array(n,this.#Pn(l)),a&&(n+=2));let c=!1;("SQ"===t.vr||z(t.tag))&&void 0!==t.undefinedLength&&(c=t.undefinedLength);let u=!1;Q(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=z(t.tag)?this.#En(e,t,n,h,i,o):this.#xn(e,t,n,h,i),c){const t=new le("NONE");t.vl=0,t.tag=new M("FFFE","E0DD"),t.value=[],n=this.#bn(e,t,n,i)}return n}getBuffer(e){const t=e["00020010"].value[0],n=Ie(t),i=we(t);if(void 0!==e[Ja]){const t=e[Ja].value[0];void 0!==t&&"ISO-IR 6"!==t&&(s.debug(`Change charset to UTF, was: ${t}`),this.useSpecialTextEncoder(),e[Ja].value=["ISO_IR 192"])}let o;void 0!==e[es]&&(o=e[es].value[0]);let r,a=132;const l=[],c=[];let u,d,h=0;const g=new M("0002","0000"),S=new M("0002","0001"),p=new M("0002","0012"),m=new M("0002","0013"),f=this.#wn.slice(),v=Object.keys(e);for(const t of v){const s=e[t];if(s.tag=U(t),u=this.getElementToWrite(s),!(null===u||g.equals(u.tag)||S.equals(u.tag)||p.equals(u.tag)||m.equals(u.tag))){r=0;const e=f.indexOf(u.tag.getKey());-1!==e&&f.splice(e,1),this.#Dn&&ns(u,!i),this.#Rn(u,u.value,n,o),d=ae(u.tag),r+=be(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=U(e),i=re(t),o=new le(i?.getVr());let r;if(o.tag=t,void 0!==this.#In[e])r=this.#In[e].value;else{const e=i?.getName();r=this.#In[e].value}let s=be(o.vr,n);s+=this.#Rn(o,[r],n),c.push(o),a+=s}const C=is("FileMetaInformationVersion");let D=be(C.vr,!1);D+=this.#Rn(C,[0,1],!1),l.push(C),h+=D,a+=D;const y=is("ImplementationClassUID");let I=be(y.vr,!1);const w=`1.2.826.0.1.3680043.9.7278.1.${"0.37.0-beta.13".replace("-beta",".99")}`;I+=this.#Rn(y,[w],!1),l.push(y),h+=I,a+=I;const T=is("ImplementationVersionName");let L=be(T.vr,!1);L+=this.#Rn(T,["DWV_0.37.0-beta.13"],!1),l.push(T),h+=L,a+=L;const P=function(e,t){return q(e.tag,t.tag)};l.sort(P),c.sort(P);const A=is("FileMetaInformationGroupLength");let O=be(A.vr,!1);O+=this.#Rn(A,new Uint32Array([h]),!1),a+=O;const b=new ArrayBuffer(a),x=new Ha(b),E=new Ha(b,!i);let R=128;R=x.writeUint8Array(R,this.#Pn("DICM")),R=this.#bn(x,A,R,!1);for(const e of l)R=this.#bn(x,e,R,!1);const F=132+O+h;R!==F&&s.warn(`Bad size calculation... meta offset: ${R}, calculated size:${F} (diff:${R-F})`);for(const e of c)R=this.#bn(E,e,R,n,o);return R!==a&&s.warn(`Bad size calculation... final offset: ${R}, calculated size:${a} (diff:${R-a})`),b}#Rn(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[es];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=U(e),Q(i.tag)||(l+=this.#Rn(i,i.value,n,c),s.push(i),l+=be(i.vr,n))}const h={tag:V(),vr:"NONE",vl:l,value:[]};a&&(h.undefinedLength=a),s.push(h),l+=be(h.vr,n),a&&(l+=be("NONE",n));const g=function(e,t){return q(e.tag,t.tag)};s.sort(g),o+=l,r.push(s)}a&&(o+=be("NONE",n)),e.value=r,e.vl=o,a&&(e.undefinedLength=a)}}else{if(Za(r=e.vr)||"OB"===r){const n=function(e){let t="";return Za(e)&&(t="UI"===e?"\0":" "),t}(e.vr);if(Za(e.vr)){let i;K(e.vr)?(t=this.#An(t.join("\\")),i=this.#An(n)):(t=this.#Pn(t.join("\\")),i=this.#Pn(n)),ja(t.length)||(t=_a(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;ja(t)||(e[e.length-1]=_a(e[e.length-1],[0]))}else ja(e.length)||(e=_a(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=J[e];return void 0!==t&&"string"!==t}(e.vr)||"ox"===e.vr){if(z(e.tag)&&Array.isArray(t)){o=0;for(const e of t)o+=e.length}else o=t.length;const r=J[e.vr];if(z(e.tag)||"ox"===e.vr)if(e.undefinedLength){const e=be("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 ns(e,t){if("UN"===e.vr){const n=re(e.tag)?.getVr();if(void 0!==n&&e.vr!==n){e.vr=n;const i=J[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 Se(e.buffer,n),r=e.byteOffset,a=e.length,s=J[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 is(e){const t=se(e),n=re(t),i=new le(n?.getVr());return i.tag=t,i}class os{trackingId;trackingUid;referencedSopInstanceUID;referencedSopClassUID;referencedFrameNumber;mathShape;referencePoints;colour="#ffff80";quantification;textExpr="";labelPosition;planeOrigin;planePoints;#Fn;#be={};constructor(){this.trackingId=Math.random().toString(36).substring(2,15),this.trackingUid=$a("TrackingUniqueIdentifier")}getMetaConceptIds(){return Object.keys(this.#be)}getMetaItem(e){return this.#be[e]}addMetaItem(e,t){const n=e.value;void 0!==this.#be[n]&&s.warn(`Overwriting annotation meta with id=${n}`),this.#be[e.value]={concept:e,value:t}}removeMetaItem(e){void 0!==this.#be[e]&&delete this.#be[e]}getOrientationName(){let e;return void 0!==this.planePoints&&(e=at(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.#Fn=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.#Fn}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.#Fn=e,this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID)):s.warn(`Cannot view annotation with reference UID: ${this.referencedSopInstanceUID}`)}#Mn(){let e;if(void 0!==this.#Fn){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 D(n);e=this.#Fn.getIndexFromPosition(i)}return e}getCentroid(){let e;if(void 0!==this.#Fn&&void 0!==this.mathShape.getCentroid&&void 0!==this.mathShape.getCentroid()){const t=this.#Mn(),n=this.#Fn.getScrollDimIndex(),i=t.getValues()[n],o=this.mathShape.getCentroid();if(e=this.#Fn.getPositionFromPlanePoint(o,i),void 0!==this.referencedFrameNumber){const t=e.getValues();t[3]=this.referencedFrameNumber,e=new D(t)}}return e}setTextExpr(e){if(void 0!==this.#Fn){const t=this.#Fn.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=w(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.#Fn&&void 0!==this.mathShape.quantify&&(this.quantification=this.mathShape.quantify(this.#Fn,this.#Mn(),w(this.textExpr)))}getFactory(){let e;if(void 0===this.mathShape)return e;if(void 0!==Ga.draw)for(const t in Ga.draw){const n=Ga.draw[t];if(n.supports(this.mathShape)){e=new n;break}}if(void 0===e)for(const t in za.draw){const n=za.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}}class rs{current;measure}class as{annotationGroups;responseEvaluations;comment}class ss{#j;getWarning(){return this.#j}#qn(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}(ue(e,"00020012")),n=void 0!==t&&function(e){const t=fe(e,"0.34.0"),n=fe(e,"0.35.0-beta.21");return t>=0&&n<=0}(t),i=na(e);let o;const r=oa(e);return void 0!==r.conceptNameCode&&(o=r.conceptNameCode.value),n&&void 0===i&&o===Un.value}#Un(e){const t="DCMR-1500"===na(e);let n;const i=oa(e);void 0!==i.conceptNameCode&&(n=i.conceptNameCode.value);let o=!1;if(t&&n===Qn.value){const e=i.contentSequence.find(this.#Vn);if(void 0!==e){const t=e.contentSequence.find(this.#Qn);if(void 0!==t){const e=t.contentSequence.find(this.#Nn),n=t.contentSequence.find(this.#Bn);void 0===e&&void 0===n||(o=!0)}}}return o}#kn(e){return"DCMR-4100"===na(e)}checkElements(e){return this.#j=void 0,this.#qn(e)||this.#Un(e)||this.#kn(e)||(this.#j="Not a dwv supported annotation"),this.#j}#Gn(e,t){t.valueType===Zr&&t.relationshipType===zr&&(e.referencedSopClassUID=t.value.referencedSOPSequence.referencedSOPClassUID,e.referencedSopInstanceUID=t.value.referencedSOPSequence.referencedSOPInstanceUID,void 0!==t.value.referencedFrameNumber&&(e.referencedFrameNumber=parseInt(t.value.referencedFrameNumber,10)))}#zn(e,t){t.hasHeader($r,zn(Pn),Br)&&(e.trackingId=t.value,e.trackingUid=t.value)}#Hn(e,t){t.hasHeader(Yr,zn(Pn),kr)&&(e.trackingId=t.value),t.hasHeader($r,zn(On),kr)&&(e.trackingUid=t.value)}#Yn(e,t,n){void 0===n&&(n=!1);let i=Hr;if(n&&(i=Br),t.hasHeader(Yr,zn(Vn),i)){e.textExpr=t.value;const n=t.contentSequence.find(function(e){return e.hasHeader(_r,zn(qn),Br)});void 0!==n&&(e.labelPosition=new m(n.value.graphicData[0],n.value.graphicData[1]))}if(t.hasHeader(Yr,Xn(),i)&&(e.colour=t.value),t.hasHeader(_r,zn(qn),i)&&t.value.graphicType===Tr){const n=[];for(let e=0;e<t.value.graphicData.length;e+=2)n.push(new m(t.value.graphicData[e],t.value.graphicData[e+1]));e.referencePoints=n}if(t.hasHeader(Kr,zn(Bn),Nr)&&t.value.graphicType===Tr){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.#Xn(e,t),this.#Wn(e,t)}#Xn(e,t,n){let i;if(void 0===n&&(i=Nr),t.valueType===Xr&&t.relationshipType===i){const n=function(e){let t;for(const n in Wn){const i=Wn[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 $n){const i=$n[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}}}}#Wn(e,t){t.valueType!==Wr&&t.valueType!==Yr||t.relationshipType!==Nr||e.addMetaItem(t.conceptNameCode,t.value)}#Vn(e){return e.hasHeader(Jr,zn(Nn),Nr)}#Qn(e){return e.hasHeader(Jr,zn(Un),Nr)}#$n(e){return e.hasHeader(Wr,zn(Cn),Gr)}#jn(e){return e.hasHeader(Jr,zn(wn),Br)}#Zn(e){return e.hasHeader(Yr,zn(Rn),Nr)}#_n(e){return e.hasHeader(Wr,zn(bn),Nr)}#Kn(e){return e.hasHeader(Xr,zn(An),Nr)}#Jn(e){return e.hasHeader(Wr,zn(fn),Nr)}#Nn(e){return e.hasHeader(_r,zn(vn),Nr)}#ei(e){return void 0!==e.contentSequence.find(this.#Nn)}#ti(e){let t;const n=e.contentSequence.find(this.#Nn);if(void 0!==n){t=new os,t.mathShape=Er(n.value);const i=n.contentSequence.find(function(e){return e.valueType===Zr&&e.relationshipType===zr});void 0!==i&&this.#Gn(t,i);for(const n of e.contentSequence)this.#Hn(t,n),this.#Yn(t,n)}return t}#Bn(e){let t;return e.valueType===Xr&&e.relationshipType===Nr&&(t=e.contentSequence.find(function(e){return e.valueType===_r&&e.relationshipType===Gr})),void 0!==t}#ni(e){let t;return e.valueType===Xr&&e.relationshipType===Br&&(t=e.contentSequence.find(function(e){return e.valueType===_r&&e.relationshipType===Gr})),void 0!==t}#ii(e){return void 0!==e.contentSequence.find(this.#Bn)}#oi(e){let t;const n=e.contentSequence.find(this.#Bn);if(void 0!==n){t=new os;const e=n.contentSequence.find(function(e){return e.valueType===_r&&e.relationshipType===Gr});t.mathShape=Er(e.value),t.mathShape instanceof m&&e.value.graphicData.length>=4&&(t.referencePoints=[new m(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===Zr&&e.relationshipType===zr});void 0!==i&&this.#Gn(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#Hn(t,i),this.#Xn(t,n),this.#Wn(t,i);return t}#ri(e){let t;const n=e.contentSequence.find(this.#ni);if(void 0!==n){t=new os;const e=n.contentSequence.find(function(e){return e.valueType===_r&&e.relationshipType===Gr});t.mathShape=Er(e.value),t.mathShape instanceof m&&e.value.graphicData.length>=4&&(t.referencePoints=[new m(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===Zr&&e.relationshipType===zr});void 0!==i&&this.#Gn(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#Hn(t,i),this.#Xn(t,n,Br),this.#Wn(t,i);return t}#ai(e){if(0===e.contentSequence.length)return;const t=e.contentSequence[0];let n=!1,i=!1;this.#Qn(t)&&(n=this.#ei(t),i=this.#ii(t));const o=[];let r,a=!1;for(const t of e.contentSequence)if(this.#Qn(t)){let e;a=!0,n?e=this.#ti(t):i&&(e=this.#oi(t)),void 0!==e&&o.push(e)}return a?0!==o.length?r=new uo(o):s.warn("No valid measurement groups in TID 1500 SR"):s.warn("No measurement groups in TID 1500 SR"),r}#si(e){const t=[];let n=!1;for(const i of e.contentSequence)if(this.#$n(i)){n=!0;const e=this.#ri(i);void 0!==e&&t.push(e)}const i=[];return n?0!==t.length?i.push(new uo(t)):s.warn("No valid measurement groups in TID 4100 SR"):s.warn("No image findings in TID 4100 SR"),i}#li(e){const t=new os;t.mathShape=Er(e.value);for(const n of e.contentSequence)this.#Gn(t,n),this.#zn(t,n),this.#Yn(t,n,!0);return t}#ci(e){let t;e.valueType===Jr&&Sn(e.conceptNameCode,zn(Qn))||s.warn("Not the expected TID 1500 SR content header");const n=e.contentSequence.find(this.#Vn);return void 0!==n?t=this.#ai(n):s.warn("No imaging measurements in TID 1500 SR"),t}#ui(e){return e.valueType===Jr&&Sn(e.conceptNameCode,zn(In))||s.warn("Not the expected TID 4100 SR content header"),e.contentSequence.find(this.#Jn)}#di(e){e.valueType===Jr&&Sn(e.conceptNameCode,zn(Un))||console.warn("Not the expected dwv034 content header");const t=[];for(const n of e.contentSequence)n.valueType===_r&&t.push(this.#li(n));return new uo(t)}#hi(e,t){const n=function(e){return ue(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=mi({[i]:o});e.setMetaValue("CurrentRequestedProcedureEvidenceSequence",t.CurrentRequestedProcedureEvidenceSequence)}}create(e){const t=oa(e);let n,i;if(this.#Un(e)?(i="TID 1500 SR",n=this.#ci(t)):this.#qn(e)&&(s.warn("DWV v0.34 annotation"),i="DWV v0.34 SR",n=this.#di(t)),this.#kn(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.#hi(n,e),n}createCADReport(e){const t=oa(e),n=this.#ui(t);if(void 0===n)return void s.warn("No CAD processing and Findings Summary in TID 4100 SR");let i=[];if(this.#kn(e)&&(i=this.#si(n)),void 0===i)throw new Error("Cannot create annotation groups from TID 4100 SR");for(const t of i)this.#hi(t,e);const o=[];let r;for(const e of n.contentSequence)if(this.#jn(e)){const t=this.#gi(e);void 0!==t&&o.push(t)}else this.#Zn(e)&&(r=e.value);const a=new as;return a.annotationGroups=i,a.responseEvaluations=o,a.comment=r,a}#Si(e){const t=new ia(Zr);t.relationshipType=zr,t.conceptNameCode=zn(Mn);const n=new _o;n.referencedSOPClassUID=e.referencedSopClassUID,n.referencedSOPInstanceUID=e.referencedSopInstanceUID;const i=new ir;return i.referencedSOPSequence=n,void 0!==e.referencedFrameNumber&&(i.referencedFrameNumber=e.referencedFrameNumber.toString()),t.value=i,t}#pi(e){const t=[],n=new ia(Yr);n.relationshipType=kr,n.conceptNameCode=zn(Pn),n.value=e.trackingId,t.push(n);const i=new ia($r);if(i.relationshipType=kr,i.conceptNameCode=zn(On),i.value=e.trackingUid,t.push(i),void 0!==e.textExpr&&0!==e.textExpr.length){const n=new ia(Yr);if(n.relationshipType=Hr,n.conceptNameCode=zn(Vn),n.value=e.textExpr,void 0!==e.labelPosition){const t=new ia(_r);t.relationshipType=Br,t.conceptNameCode=zn(qn);const i=new Or;i.graphicType=wr;const o=[e.labelPosition.getX().toString(),e.labelPosition.getY().toString()];i.graphicData=o,t.value=i;const r=this.#Si(e);t.contentSequence=[r],n.contentSequence=[t]}t.push(n)}const o=new ia(Yr);if(o.relationshipType=Hr,o.conceptNameCode=Xn(),o.value=e.colour,t.push(o),void 0!==e.referencePoints){const n=new ia(_r);n.relationshipType=Hr,n.conceptNameCode=zn(qn);const i=new Or;i.graphicType=Tr;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.#Si(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.planePoints){const n=new ia(Kr);n.relationshipType=Nr,n.conceptNameCode=zn(Bn);const i=new Ur;i.graphicType=Tr;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.#Si(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.quantification)for(const n in e.quantification){const i=aa(n,S(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=Yr;i.value instanceof gn&&(o=Wr);const r=new ia(o);r.relationshipType=Nr,r.conceptNameCode=i.concept,r.value=i.value,t.push(r)}return t}#mi(e){const t=new ia(Jr);t.relationshipType=Nr,t.conceptNameCode=zn(Un),t.value=ea;const n=new ia(_r);n.relationshipType=Nr,n.conceptNameCode=zn(vn),n.value=xr(e.mathShape);const i=this.#Si(e);return n.contentSequence=[i],t.contentSequence=[n].concat(this.#pi(e)),t}#fi(e){let t;if(0!==e.getList().length){const n=new ia(Jr);n.conceptNameCode=zn(Nn),n.relationshipType=Nr,n.value=ea;const i=[];for(const t of e.getList())i.push(this.#mi(t));n.contentSequence=i,t=new ia(Jr),t.conceptNameCode=zn(Qn),t.value=ea,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=sn(rn(i)),n.ContentTime=ln(an(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.#fi(e);if(void 0===s)throw new Error("No annotation group SR content");return n={...n,...ra(s)},void 0!==t&&fi(n,t),vi(n)}#vi(e){const t=new ia(Wr);t.relationshipType=Gr,t.conceptNameCode=zn(Cn),t.value=zn(Dn),t.contentSequence=[];const n=new ia(Yr);n.relationshipType=kr,n.conceptNameCode=zn(Pn),n.value=e.trackingId,t.contentSequence.push(n);const i=new ia($r);if(i.relationshipType=kr,i.conceptNameCode=zn(On),i.value=e.trackingUid,t.contentSequence.push(i),void 0!==e.quantification)for(const n in e.quantification){const i=aa(n,S(e.quantification[n].value,12),e.quantification[n].unit,Br);if(void 0!==i){const n=new ia(_r);n.relationshipType=Gr,n.conceptNameCode=zn(En),n.value=xr(e.mathShape);const o=this.#Si(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=Yr;i.value instanceof gn&&(o=Wr);const r=new ia(o);r.relationshipType=Nr,r.conceptNameCode=i.concept,r.value=i.value,t.contentSequence.push(r)}return t}#Ci(e,t){if(0!==e.getList().length)for(const n of e.getList())t.push(this.#vi(n))}#Di(e){const t=new ia(Jr);t.relationshipType=Br,t.conceptNameCode=zn(wn),t.value=ea,t.contentSequence=[];const n=new ia(Wr);if(n.relationshipType=kr,n.conceptNameCode=zn(Tn),n.value=zn(Ln),t.contentSequence.push(n),void 0!==e){if(void 0!==e.current){const n=new ia(Wr);n.relationshipType=Nr,n.conceptNameCode=zn(bn),n.value=e.current,t.contentSequence.push(n)}if(void 0!==e.measure){const n=new ia(Xr);n.relationshipType=Nr,n.conceptNameCode=zn(An);const i=new zo;i.numericValue=e.measure,i.measurementUnitsCode=jn("unit.mm");const o=new Wo;o.measuredValue=i,n.value=o,t.contentSequence.push(n)}}return t}#gi(e){let t,n,i;for(const i of e.contentSequence)this.#_n(i)?t=i.value:this.#Kn(i)&&(n=i.value.measuredValue.numericValue);return void 0!==t&&(i=new rs,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=sn(rn(i)),n.ContentTime=ln(an(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 ia(Wr);s.relationshipType=Nr,s.conceptNameCode=zn(fn),s.value=zn(yn),s.contentSequence=[];for(const t of e.responseEvaluations){const e=this.#Di(t);s.contentSequence.push(e)}for(const t of e.annotationGroups)this.#Ci(t,s.contentSequence);if(void 0!==e.comment){const t=new ia(Yr);t.relationshipType=Nr,t.conceptNameCode=zn(Rn),t.value=e.comment,s.contentSequence.push(t)}const l=new ia(Jr);if(l.conceptNameCode=zn(In),l.value=ea,l.contentSequence.push(s),void 0===l)throw new Error("No annotation group SR content");return n={...n,...ra(l)},void 0!==t&&fi(n,t),vi(n)}}const ls="30060084";class cs{type;points3D}class us{number;name;colour;generationAlgorithm;interpretedType;roiInterpreter;contours}function ds(e){const t={},n={},i=de(e,"30060020");if(void 0!==i)for(const e of i){const i=ue(e,"30060022"),o=ue(e,"30060026"),r=ue(e,"30060036");void 0!==i&&(t[i]=o??`ROI ${i}`,n[i]=r)}const o={},r=de(e,"30060080");if(void 0!==r)for(const e of r){const t=ue(e,ls);void 0!==t&&(o[t]={interpretedType:ue(e,"300600A4"),roiInterpreter:ue(e,"300600A6")})}const a=[],l=de(e,"30060039");if(void 0===l)return a;for(const e of l){const i=ue(e,ls),r=de(e,"3006002A"),l=de(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=Ai(Ti({l:l[0],a:l[1],b:l[2]})):(s.warn("No recommended colour for contour, using default"),c=Ei(i));const u=[],d=de(e,"30060040");if(void 0!==d)for(const e of d){const t=ue(e,"30060042"),n=de(e,"30060050");if(void 0===n)continue;const i=new cs;i.type=t??"CLOSED_PLANAR",i.points3D=n.map(e=>parseFloat(e)),u.push(i)}const h=new us;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 hs={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyInstanceUID:"0020000D",StudyID:"00200010",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052"},gs=[{name:"TransferSyntaxUID",enum:[ne]},{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 Ss(){const e={};for(const t of gs)e[t.name]=t.enum[0];return e}const ps=[[-1,0],[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1]],ms={};for(let e=0;e<8;e++)ms[`${ps[e][0]},${ps[e][1]}`]=e;function fs(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 vs(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=ms[`${l-u},${c-d}`];let g=-1,S=-1,p=l,m=c;for(let r=1;r<=8;r++){const a=(h+r)%8,s=u+ps[a][0],l=d+ps[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;p=u+ps[e][0],m=d+ps[e][1];break}}if(-1===g)break;if(l=p,c=m,u=g,d=S,u===r&&d===a)break;s.push({x:u,y:d})}return s}function Cs(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;fs(e,t,n,i,o,l,a);const u=vs(e,t,n,i,o,r,c);u.length>=3&&s.push(u)}return s}function Ds(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 ys(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=Ds(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 Is(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 ws(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?Cs(s,0,n,i,1):[]}class Ts{#j;getWarning(){return this.#j}checkElements(e){return this.#j=void 0,this.#j}create(e,t){const n=ds(e),i=t.getGeometry(),o=i.getSize(),r=o.get(0),s=o.get(1),l=o.get(2),c=r*s,u=new Hi(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 Ni(o,t.name,t.generationAlgorithm??"MANUAL");a.interpretedType=t.interpretedType,a.roiInterpreter=t.roiInterpreter,a.displayRGBValue=new Ci(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 p=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 D([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||(p.has(o)||p.set(o,[]),p.get(o).push(n))}for(const[e,t]of p){const n=new Uint8Array(c);Is(n,0,r,s,t,1),u.addFrame(o,n,0,e,c,o)}}const p=[];for(let e=0;e<l;++e)p.push(t.getImageUid(new a([0,0,e])));const m=new lo(i,u.getLabelMap(),p);m.setSegmentCollection(u),m.setPhotometricInterpretation("PALETTE COLOR"),m.setPaletteColourMap(new je(h,g,S));const f=t=>ue(e,t),v={Modality:"RTSTRUCT"};for(const e of Object.keys(hs)){const t=f(hs[e]);void 0!==t&&(v[e]=t)}v.custom={segments:d,referencedSeriesUID:Ct(e)};const C=t.getMeta();return void 0!==C.lengthUnit&&(v.lengthUnit=C.lengthUnit),m.setMeta(v),m}toDicom(e,t,n,i){const o=Ss(),r=e.getMeta();for(const e of Object.keys(hs)){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=sn(rn(l)),o.StructureSetTime=ln(an(l));const c=e.getGeometry(),u=c.getSize(),d=u.get(0),h=u.get(1),g=u.get(2),S=d*h,p=e.getBuffer(),m=e.getHasOverlap(),f=m?e.getSegmentCollection()?.getAll():void 0,v=[],C=[],D=[];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"}),D.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=m&&r?.has(e),o=n?r.get(e):p,l=n?0:e*S,u=Cs(o,l,d,h,t),g=u.length>0?ws(o,l,d,h,t):[],f=u.concat(g),v=g.length>0?"CLOSEDPLANAR_XOR":"CLOSED_PLANAR";for(const t of f){const n=ys(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:D},void 0!==i&&fi(o,i),vi(o)}}const Ls=["dataadd","dataremove","dataimageset","dataupdate"];function Ps(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}),!b(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 As{meta;image;annotationGroup;buffer;numberOfFiles;warn=[];#yi=!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.#yi}appendData(e){this.#yi||(void 0!==this.image&&void 0!==e.image&&this.#Ii(e.image),this.#wi(e.meta))}#Ii(e){const t=e.getGeometry();t.getSize().get(2)>1?this.image.appendVolume(e):(this.image.getGeometry().canAppendOrigin(t.getOrigin(),t.getInitialTime()).success||(this.#yi=!0),this.#yi||this.image.appendSlice(e))}#wi(e){this.meta=Ps(this.meta,e,jt)}}class Os{#ze=[];addClone(e){const t=new As(structuredClone(e.meta));t.image=e.image.clone(),this.add(t)}add(e){this.#ze.push(e)}buildData(){const e=this.#Ti(),t=this.#Li(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,volumeIndexGetter:i}=this.#Pi(e,t);if(void 0===n)throw new Error("Cannot create image for multi-volume");let o,r;for(let e=0;e<n.length;++e){const t=n[e],a=this.#ze[t[0]].meta;r=void 0===r?a:Ps(r,a,i);for(const n of t){const t=this.#ze[n].image;t.getGeometry().setInitialTime(e),void 0===o?o=t:o.appendSlice(t)}}return{image:o,meta:r}}#Pi(e,t){if(void 0!==_e.getPostLoadVolumeIdTagValue){const n=_e.getPostLoadVolumeIdTagValue;return{volsIndices:this.#Ai(e,t,n),volumeIndexGetter:n}}const n=void 0!==_e.postLoadVolumeIdCandidates?_e.postLoadVolumeIdCandidates:Zt;for(const i of n){const n=this.#Ai(e,t,i.getter);if(void 0!==n)return s.debug(`Using '${i.name}' as temporal position identifier`),{volsIndices:n,volumeIndexGetter:i.getter}}return{volsIndices:void 0,volumeIndexGetter:void 0}}#Ai(e,t,n){const i=[],o=[];for(const r of e){if(0===o.length){for(const e of r.indices){const t=n(this.#ze[e].meta);if(o.includes(t))return;o.push(t)}if(o.length!==t)return;o.sort()}for(const e of r.indices){const t=n(this.#ze[e].meta),r=o.indexOf(t);if(-1===r)return;void 0===i[r]&&(i[r]=[]),i[r].push(e)}}const r=e.length;for(const e of i)if(e.length!==r)return;return i}#Li(e){if(0===e.length)return 0;const t=e[0].count;for(const n of e)if(n.count!==t)return;return t}#Ti(){const e=function(e){return function(t){return t.pos.equals(e)}},t=[];for(let n=0;n<this.#ze.length;++n){const i=this.#ze[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 bs extends EventTarget{#Oi={};#bi={};#xi={};#Ei=-1;constructor(){super()}getNextDataId(){return++this.#Ei,this.#Ei.toString()}getDataIds(){return Object.keys(this.#Oi)}reset(){this.#Oi={}}get(e){return this.#Oi[e]}getDataIdsFromSopUids(e){const t=[];if(void 0===e||0===e.length)return t;const n=Object.keys(this.#Oi);for(const i of n)void 0!==this.#Oi[i].image&&this.#Oi[i].image.containsImageUids(e)&&t.push(i);return t}getDataIdFromSeriesUid(e){let t;const n=Object.keys(this.#Oi);for(const i of n){const n=this.#Oi[i].image;if(void 0!==n&&e===n.getMeta().SeriesInstanceUID){t=i;break}}return t}setImage(e,t){this.#Oi[e].image=t;for(const n of ro)t.addEventListener(n,this.#Ri(e));this.dispatchEvent(new CustomEvent("dataimageset",{detail:{value:[t],dataid:e}}))}#Fi(e){const t=ue(e.meta,"00080060");let n;if(Y(e.meta))if("SEG"===t){const t=vt(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 ji,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,this.#Oi[i].image))}else n=new Si,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,e.numberOfFiles));else if("SR"===t)n=new ss,void 0===n.checkElements(e.meta)&&(e.annotationGroup=n.create(e.meta));else if("RTSTRUCT"===t){const t=Ct(e.meta),i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create RT struct: referenced series is not loaded");n=new Ts,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,this.#Oi[i].image))}void 0!==n&&void 0!==n.getWarning()&&e.warn.push(n.getWarning())}add(e,t){if(void 0===e||void 0!==this.#Oi[e])return!1;if(this.#Oi[e]=t,void 0===t.image&&void 0===t.annotationGroup&&(this.#Fi(t),void 0!==t.numberOfFiles&&t.numberOfFiles>1&&(this.#bi[e]=new Os,this.#bi[e].addClone(t))),void 0!==t.image)for(const n of ro)t.image.addEventListener(n,this.#Ri(e));if(void 0!==t.annotationGroup)for(const n of co)t.annotationGroup.addEventListener(n,this.#Ri(e));return this.dispatchEvent(new CustomEvent("dataadd",{detail:{dataid:e}})),!0}remove(e){if(void 0!==this.#Oi[e]){const t=this.#Oi[e].image;if(void 0!==t)for(const n of ro)t.removeEventListener(n,this.#Ri(e));const n=this.#Oi[e].annotationGroup;if(void 0!==n)for(const t of co)n.removeEventListener(t,this.#Ri(e));delete this.#Oi[e],this.dispatchEvent(new CustomEvent("dataremove",{detail:{dataid:e}}))}}stash(e){void 0!==this.#Oi[e]&&(this.#xi[e]=this.#Oi[e],this.remove(e))}unstash(e){void 0!==this.#xi[e]&&(this.add(e,this.#xi[e]),delete this.#xi[e])}getStashedDataIds(){return Object.keys(this.#xi)}getStashed(e){return this.#xi[e]}update(e,t){if(void 0===this.#Oi[e])throw new Error(`Cannot find data to update: ${e}`);const n=this.#Oi[e];this.#Fi(t),void 0!==this.#bi[e]&&this.#bi[e].add(t),n.hasDuplicateOrigin()||n.appendData(t),this.dispatchEvent(new CustomEvent("dataupdate",{detail:{dataid:e}}))}markDataAsComplete(e){const t=this.#Oi[e];if(void 0===t)throw new Error(`Cannot find data to mark as complete: ${e}`);const n={imageHasChanged:!1};if(void 0!==this.#bi[e]&&t.hasDuplicateOrigin()){const i=this.#bi[e].buildData();this.setImage(e,i.image),t.meta=i.meta,delete this.#bi[e],n.imageHasChanged=!0}return t.setComplete(!0),n}#Ri(e){return t=>{const n=Object.assign({},t.detail,{dataid:e});this.dispatchEvent(new CustomEvent(t.type,{detail:n}))}}}class xs{#Mi;setOptions(e){this.#Mi=e}#qi;#Ui=[];#Vi=[];#Qi=[];#Ni=!1;#Bi(e,t){const n=this.#Ui[e].getDicomElements(),i=new As(n);void 0!==this.#Qi[e]&&(i.buffer=this.#Qi[e]),i.numberOfFiles=this.#Mi.numberOfFiles,this.onloaditem({data:i,source:t})}#ki(e,t){this.#Ni||(this.onprogress({lengthComputable:!0,loaded:100,total:100,index:e,source:t}),this.onload({source:t}),this.onloadend({source:t}))}#Gi(e){this.#qi=new Vo(e),this.#qi.ondecodeditem=e=>{this.#zi(e),e.itemNumber+1===e.numberOfItems&&(this.onload(e),this.onloadend(e))},this.#qi.onerror=this.onerror,this.#qi.onabort=this.onabort}#Hi(e){const t=this.#Ui[e].getDicomElements(),n={missing:[]},i=ue(t,"00280100");void 0!==i?n.bitsAllocated=i:n.missing.push("bitsAllocated");const o=ue(t,"00280103");void 0!==o?n.isSigned=1===o:n.missing.push("pixelRepresentation");const r=ue(t,"00280011"),a=ue(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=ue(t,"00280002");if(void 0!==s){if(n.samplesPerPixel=s,1!==s){const e=ue(t,"00280006");void 0!==e?n.planarConfiguration=e:n.missing.push("planarConfiguration")}}else n.missing.push("samplesPerPixel");return n}#Yi(e,t,n){const i=this.#Hi(e);if(0!==i.missing.length)return this.#qi.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.#qi.decode(n[r],i,{itemNumber:r,numberOfItems:o,index:e,indexOrigin:t})}#zi(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.#Vi[t]){this.#Vi[t]=i.length;const o=e.numberOfItems*this.#Vi[t];try{this.#Qi[t]=new i.constructor(o)}catch(e){if(e instanceof RangeError){const e=Math.floor(Math.log(o)/Math.log(2));s.error(`Cannot allocate ${i.constructor.name} of size: ${o} (>2^${e}) for decompressed data.`)}return this.#qi.abort(),this.onerror({error:e,source:n}),void this.onloadend({source:n})}}i.length!==this.#Vi[t]&&s.warn(`Unsupported varying decompressed data size: ${i.length} != ${this.#Vi[t]}`),this.#Qi[t].set(i,this.#Vi[t]*e.itemNumber)}else this.#Qi[t]=i;0===e.itemNumber&&this.#Bi(t,n)}convert(e,t,n){this.#Ni=!1,this.onloadstart({source:t,index:n});const i=new Re;void 0!==this.#Mi.defaultCharacterSet&&i.setDefaultCharacterSet(this.#Mi.defaultCharacterSet);try{i.parse(e)}catch(e){return this.onerror({error:e,source:t}),void this.onloadend({source:t})}this.#Ui[n]=i;const o=i.getDicomElements(),r=H(o);if(void 0!==r){const e=r.value,i=function(e){let t;return Pe(e)?t="jpeg2000":Te(e)?t="jpeg-baseline":Le(e)?t="jpeg-lossless":Ae(e)&&(t="rle"),t}(ue(o,"00020010"));void 0!==i?(void 0===this.#qi&&this.#Gi(i),this.#Yi(n,t,e)):(this.#Qi[n]=e[0],this.#Bi(n,t),this.#ki(n,t))}else this.#Bi(n,t),this.#ki(n,t)}abort(){this.#Ni=!0,void 0!==this.#qi?this.#qi.abort():this.onabort({})}onloadstart(e){}onloaditem(e){}onprogress(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class Es extends Eo{#Mi={};#Xi=!1;getOptions(){return this.#Mi}setOptions(e){this.#Mi=e}isLoading(){return this.#Xi}setLoading(e){this.#Xi=e}canLoadFile(e){if(void 0!==e.type&&this.canLoadMediaType(e.type))return!0;const t=T(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=T(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 Rs extends Es{#Wi=new xs;load(e,t,n){this.isLoading()||(this.#Wi.setOptions(this.getOptions()),this.#Wi.onloadstart=this.onloadstart,this.#Wi.onprogress=this.onprogress,this.#Wi.onloaditem=this.onloaditem,this.#Wi.onload=this.onload,this.#Wi.onloadend=e=>{this.setLoading(!1),this.onloadend(e)},this.#Wi.onerror=e=>{e.source=t,this.onerror(e)},this.#Wi.onabort=this.onabort),this.setLoading(!0),this.#Wi.convert(e,t,n)}abort(){this.setLoading(!1),this.#Wi.abort()}canLoadExtension(e){return void 0===e||"dcm"===e}isLoaderName(e){return"dicom"===e}canLoadMediaType(e){return"application/dicom"===e}loadFileAs(){return Hs.ArrayBuffer}loadUrlAs(){return 1}}class Fs extends Es{load(e,t,n){this.setLoading(!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.setLoading(!1),this.onloadend({source:t})}}abort(){this.setLoading(!1),this.onabort({}),this.onloadend({})}canLoadExtension(e){return"json"===e}isLoaderName(e){return"json"===e}canLoadMediaType(e){return"application/json"===e||"application/dicom+json"===e}loadFileAs(){return Hs.Text}loadUrlAs(){return 0}}class Ms extends Eo{#It=null;#Tt=null;#Lt=0;#Pt=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#Ot(e){this.#It=e,this.#Lt=0,this.#Pt=0,this.#xt()}#Rt(e){this.#Tt=e}#xt(){this.#Tt=null}#Ft=e=>{this.#Lt++,this.#Lt===this.#It.length&&this.onload({source:this.#It})};#Mt=e=>{this.#Pt++,this.#Pt===this.#It.length&&this.onloadend({source:this.#It})};load(e){if(void 0===e||0===e.length)return;this.#Ot(e),this.onloadstart({source:e});const t=new xo(this.onprogress);t.setNToLoad(e.length),t.setNumberOfDimensions(1);const n=zs(),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({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=t.getUndefinedMonoProgressHandler(0),r.onloaditem=this.onloaditem,r.onload=this.#Ft,r.onloadend=this.#Mt,r.onerror=this.onerror,r.onabort=this.onabort,this.#Rt(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.#Tt&&this.#Tt.isLoading()&&this.#Tt.abort()}}class qs extends Es{#$i=0;#ji=0;#Zi=[];load(e,t,n){0===this.#ji&&(this.#$i=this.getOptions().numberOfFiles??1,this.#Zi=[],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=R(new Uint8Array([13,10,13,10]));let o=E(t,i,0);if(void 0===o)throw new Error("Can't find the end of the first multipart header");const r=x(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=R(L(a)),l=a.length;let c=E(t,s,0);for(;void 0!==o;){const e={},r=x(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=E(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=E(t,i,c+l)}return n}(e);if(this.#Zi.push(...i),this.#ji++,this.#ji<this.#$i)return;const o=new Ms;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.#$i;t++)this.onload(e)},o.onloadend=e=>{this.setLoading(!1),this.#ji=0;const t=this.#$i;for(let n=0;n<t;n++)this.onloadend(e)},o.onerror=this.onerror,o.onabort=this.onabort,o.load(this.#Zi)}abort(){this.setLoading(!1),this.#ji=0,this.onabort({}),this.onloadend({})}isLoaderName(e){return"multipart"===e}canLoadMediaType(e){return"multipart/related"===e}loadFileAs(){return Hs.ArrayBuffer}loadUrlAs(){return 1}}function Us(e){return parseInt(e,36).toString()}function Vs(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 Dt([e,t,1]),s=new ct([1,1,1]),l=new f(0,0,n),c=new Pt([l],a,s),u=new lo(c,i,[r]);u.setPhotometricInterpretation("RGB");const d={BitsStored:8};return void 0!==o&&(d.numberOfFiles=o),u.setMeta(d),u}class Ns extends Es{#_i(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=Us(t)):(l.fileName={value:[t.name]},c=Us(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,Vs(s),1,u.toString()),h=d.getMeta();h.SeriesInstanceUID=c,d.setMeta(h);const g=new As(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.#_i(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 Hs.DataURL}loadUrlAs(){return 1}}class Bs extends Es{#_i(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.#_i(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=Us(r)):(u.fileName={value:[r.name]},d=Us(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=Vs(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 As(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.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 Hs.DataURL}loadUrlAs(){return 1}}class ks extends Es{#Ki="";#Ji=[];#eo=null;#to(e,t,n){this.#Ji.push({filename:this.#Ki,data:e});const i=100*this.#Ji.length/this.#eo.length;if(this.onprogress({lengthComputable:!0,loaded:i/2,total:100,index:n,item:{loaded:i,total:100,source:t}}),this.#Ji.length<this.#eo.length){const e=this.#Ji.length;this.#Ki=this.#eo[e].name,this.#eo[e].async("arrayBuffer").then(e=>{this.#to(e,t,n)}).catch(e=>{this.setLoading(!1),this.onerror({error:e}),this.onloadend({})})}else{const e=new Ms;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.#Ji)}}load(e,n,i){this.onloadstart({source:n}),this.setLoading(!0),t.loadAsync(e).then(e=>{if(this.#Ji=[],this.#eo=e.file(/.*\.dcm/),0===this.#eo.length)return this.setLoading(!1),this.onerror({error:new Error("No DICOM file found in ZIP")}),void this.onloadend({});this.#Ki=this.#eo[0].name,this.#eo[0].async("arrayBuffer").then(e=>{this.#to(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 Hs.ArrayBuffer}loadUrlAs(){return 1}}let Gs=null;function zs(){return null===Gs&&(Gs=[Rs,Fs,qs,Ns,Bs,ks]),Gs}const Hs={Text:0,ArrayBuffer:1,DataURL:2};class Ys extends Eo{#It=null;#no=[];#Tt=null;#Lt=0;#Pt=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#Ot(e){this.#It=e,this.#Lt=0,this.#Pt=0,this.#io(),this.#xt()}#oo(e){this.#no.push(e)}#io(){this.#no=[]}#Rt(e){this.#Tt=e}#xt(){this.#Tt=null}#Ft=e=>{this.#Lt++,this.#Lt===this.#It.length&&this.onload({source:this.#It})};#Mt=e=>{this.#Pt++,this.#Pt===this.#It.length&&this.onloadend({source:this.#It})};#qt(e,t){return n=>{n.source=t,e(n)}}#Qt(e,t,n){return i=>{e.load(i.target.result,t,n)}}load(e){if(void 0===e||0===e.length)return;this.#Ot(e),this.onloadstart({source:e});const t=new xo(this.onprogress);t.setNToLoad(e.length);const n=zs(),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({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=t.getUndefinedMonoProgressHandler(1),r.onloaditem=this.onloaditem,r.onload=this.#Ft,r.onloadend=this.#Mt,r.onerror=this.onerror,r.onabort=this.onabort,this.#Rt(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.#oo(i),i.onprogress=this.#qt(t.getMonoProgressHandler(n,0),o),i.onload=this.#Qt(r,o,n);const a=this.#qt(this.onerror,o);i.onerror=e=>{this.#Mt(),a(e)};const s=this.#qt(this.onabort,o);i.onabort=e=>{this.#Mt(),s(e)},r.loadFileAs()===Hs.Text?i.readAsText(o):r.loadFileAs()===Hs.DataURL?i.readAsDataURL(o):r.loadFileAs()===Hs.ArrayBuffer&&i.readAsArrayBuffer(o)}}abort(){for(let e=0;e<this.#no.length;++e)1===this.#no[e].readyState&&this.#no[e].abort();this.#Tt&&this.#Tt.isLoading()&&this.#Tt.abort()}}const Xs=["loadstart","loadprogress","loaditem","load","loadend","error","abort","timeout"];class Ws extends EventTarget{#f;#ro={};constructor(e){super(),this.#f=e}loadFiles(e,t){"json"===e[0].name.split(".").pop().toLowerCase()?this.#ao(e[0],t):this.#so(e,t)}loadURLs(e,t,n){"json"===e[0].split(".").pop().toLowerCase()?this.#lo(e[0],t,n):this.#co(e,t,n)}loadImageObject(e,t){const n=new Ms;this.#uo(e,n,"image",t)}getLoadingDataIds(){return Object.keys(this.#ro)}abort(e){void 0!==this.#ro[e]&&(this.#ro[e].loader.abort(),delete this.#ro[e])}#so(e,t){const n=new Ys;n.setDefaultCharacterSet(this.#f),this.#uo(e,n,"image",t)}#co(e,t,n){const i=new Ro;i.setDefaultCharacterSet(this.#f),this.#uo(e,i,"image",t,n)}#ao(e,t){const n=new Ys;this.#uo([e],n,"state",t)}#lo(e,t,n){const i=new Ro;this.#uo([e],i,"state",t,n)}#uo(e,t,n,i,o){const r={dataid:i,loadtype:n};t.onloadstart=e=>{this.#ro[i]={loader:t,isFirstItem:!0},this.#Ri("loadstart",r)(e)},t.onprogress=this.#Ri("loadprogress",r),t.onloaditem=e=>{const t={dataid:i,loadtype:n};void 0!==this.#ro[i]&&(t.isfirstitem=this.#ro[i].isFirstItem),this.#Ri("loaditem",t)(e),void 0!==this.#ro[i]&&this.#ro[i].isFirstItem&&(this.#ro[i].isFirstItem=!1)},t.onload=this.#Ri("load",r),t.onloadend=e=>{delete this.#ro[i],this.#Ri("loadend",r)(e)},t.onerror=this.#Ri("error",r),t.onabort=this.#Ri("abort",r),void 0!==t.ontimeout&&(t.ontimeout=this.#Ri("timeout",r));try{t.load(e,o)}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{dataid:i,loadtype:n,error:e}})),this.dispatchEvent(new CustomEvent("loadend",{detail:{dataid:i,loadtype:n}}))}}#Ri(e,t){return n=>{const i=Object.assign({},n,t);this.dispatchEvent(new CustomEvent(e,{detail:i}))}}}const $s=["undoadd","undoremove","undo","redo"];class js extends EventTarget{#do=new Ua;constructor(){super(),this.#ho()}addToUndoStack=e=>{this.#do.add(e)};removeFromUndoStack=e=>this.#do.remove(e);undo(){this.#do.undo()}redo(){this.#do.redo()}getStackSize(){return this.#do.getStackSize()}getCurrentStackIndex(){return this.#do.getCurrentStackIndex()}reset(){this.#do=new Ua,this.#ho()}#ho(){for(const e of $s)this.#do.addEventListener(e,t=>{const n=Object.assign({},t.detail);this.dispatchEvent(new CustomEvent(e,{detail:n}))})}}class Zs{tags;event;pos;format;precision;value}function _s(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 Js(e,t){let n=e;for(let e=0;e<t.length;++e)n=n.replace(`{v${e}}`,t[e]);return n}class el extends EventTarget{#an;#nt;#go;#So=[];#po;#mo={};#fo;constructor(e,t,n){super(),this.#an=e,this.#nt=t,this.#go=n;const i=Object.keys(this.#go);for(let e=0;e<i.length;++e){const t=this.#go[i[e]];for(const e of t){const t=e.event;void 0!==t&&(this.#So.includes(t)||this.#So.push(t))}}this.addAppListeners()}reset(){this.#mo={},this.#fo=void 0}addItemMeta(e){let t;void 0!==e["00020010"]?void 0!==e["00080018"]?(t=e["00080018"].value[0],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=on(tn(i));void 0!==e&&t.push(e.toLocaleDateString())}else if("TM"===i.vr){const e=on({year:1900,monthIndex:0,day:1},nn(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=Js(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:ye(e),format:"{v0}"}),n.push({pos:"bc",value:t,format:"{v0}"}),n.push({pos:"tc",value:ye(t),format:"{v0}"})}return n}(e,this.#go)):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=Ks(t.length)),i.value=Js(i.format,t).trim()}n.push(i)}return n}(e,this.#go)):s.warn("Missing DOM image UID for info data indexing"),void 0!==t&&(this.#fo=t)}onSliceChange=e=>{const t=e.detail?.dataid;if(t!==this.#nt)return;const n=e.detail?.data;void 0!==n&&void 0!==n.imageUid&&this.#fo!==n.imageUid&&(this.#fo=n.imageUid,this.#vo(e))};#vo=e=>{const t=e.detail?.dataid;if(void 0!==t&&t!==this.#nt)return;const n=this.#mo[this.#fo];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:_s(parseInt(t.precision,10)),o=o.map(e)}n=Js(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.#fo}`)};isListening(){return this.#po}addAppListeners(){this.#an.addEventListener("positionchange",this.onSliceChange);for(const e of this.#So)this.#an.addEventListener(e,this.#vo);this.#po=!0}removeAppListeners(){this.#an.removeEventListener("positionchange",this.onSliceChange);for(const e of this.#So)this.#an.removeEventListener(e,this.#vo);this.#po=!1}}function tl(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 nl(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 il{onWheel(e,t){}onWheelTick(e,t){}}class ol extends il{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 rl extends il{onWheel(e,t){if(void 0===t)return;const n=-e.deltaY/500,i=Ao(e),o=nl(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()}}class al{#ye;#Co;#Do;#yo;constructor(e,t){if(this.#ye=e,this.#Co=e.isID(),this.#Do=Math.pow(2,t),!this.#Co){this.#yo=new Float32Array(this.#Do);for(let e=0;e<this.#Do;++e)this.#yo[e]=this.#ye.apply(e)}}getRSI(){return this.#ye}getLength(){return this.#Do}getValue(e){return this.#Co?e:this.#yo[e]}}class sl{#Io;#wo;#yo;#To=0;#Lo=!0;constructor(e,t,n){if(this.#Io=e,t){const e=this.#Io.getLength();this.#To=e/2}else this.#To=0;this.#Lo=n}getVoiLut(){return this.#wo}getModalityLut(){return this.#Io}setVoiLut(e){if(this.#wo=e,this.#wo.setSignedOffset(this.#Io.getRSI().getSlope()*this.#To),this.#Lo){const e=this.#Io.getLength();this.#yo=new Uint8ClampedArray(e);for(let t=0;t<e;++t)this.#yo[t]=this.#wo.apply(this.#Io.getValue(t))}}getValue(e){return this.#Lo?this.#yo[e+this.#To]:Math.floor(this.#wo.apply(e+this.#To))}}const ll={CT:{mediastinum:new Ge(40,400),lung:new Ge(-500,1500),bone:new Ge(500,2e3),brain:new Ge(40,80),head:new Ge(90,350)}};class cl{create(e,t){const n=new gl(t);"MONOCHROME1"===t.getPhotometricInterpretation()&&n.setColourMap("invPlain");let i={};void 0!==t.getMeta().windowPresets&&(i=t.getMeta().windowPresets),i.minmax=new Ye("minmax");const o=t.getMeta().Modality;let r;r=void 0!==_e.wlPresets&&void 0!==_e.wlPresets[o]?_e.wlPresets[o]:ll[o];for(const e in r){const t=r[e];i[e]=new Ye(e,[new Ge(t.center,t.width)])}return n.setWindowPresets(i),n}}class ul{#Po=[];#Ao(e){return this.#Po.indexOf(e)}isHidden(e){return-1!==this.#Ao(e)}addToHidden(e){this.isHidden(e)?s.warn(`Not hidding segment, it is allready in the hidden list: ${e}`):this.#Po.push(e)}removeFromHidden(e){const t=this.#Ao(e);-1!==t?this.#Po.splice(t,1):s.warn(`Cannot remove segment, it is not in the hidden list: ${e}`)}}const dl=["wlchange","wlpresetadd","colourmapchange","positionchange","opacitychange","alphafuncchange","maskviewchange"];function hl(e,t){return(new cl).create(e,t)}class gl extends EventTarget{#Oo;#bo;#Te;#xo={minmax:new Ye("minmax")};#Eo;#Ro;#Fo="plain";#Mo;#$;#qo=.33;#Uo=1;#Vo;#Qo=function(e,t){return 255};#No=(e,t)=>0===e||this.#Bo.isHidden(e)?0:0!==this.getContourThickness()&&this.#Oo.getContour().getDistance(t,this.getOrientation())<=this.getContourThickness()?255:255*this.getFillOpacity();#Bo;constructor(e){super(),this.setImage(e)}getImage(){return this.#Oo}setImage(e){this.#Oo=e;const t=e.getMeta().windowPresets;if(void 0!==t)for(const e of Object.keys(t))this.#xo[e]=t[e];void 0===this.getCurrentPosition()&&this.setCurrentIndex(this.#ko(),!0),this.isMask()?(this.#Bo=new ul,this.#Vo=this.#No):(this.#Vo=this.#Qo,this.#Oo.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.#Oo.isMask()}setMaskViewHelper(e){this.#Bo=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}getOrientation(){return this.#$}setOrientation(e){this.#$=e}getFillOpacity(){return this.#qo}setFillOpacity(e){this.#qo=e>1?1:e<0?0:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#qo,this.#Uo]}}))}getContourThickness(){return this.#Uo}setContourThickness(e){this.#Uo=e<0?0:e>10?10:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#qo,this.#Uo]}}))}#ko(){const e=this.#Oo.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 a(t))}getPlaybackMilliseconds(e){return e||(e=10),Math.round(1e3/e)}getAlphaFunction(){return this.#Vo}setAlphaFunction(e){this.#Vo=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}#Go(){if(void 0!==this.#Eo&&void 0!==this.#xo[this.#Eo]&&void 0!==this.#xo[this.#Eo].perslice&&!0===this.#xo[this.#Eo].perslice&&!this.#Oo.isResampled()){const e=this.getCurrentIndex();if(void 0===e)throw new Error("Cannot get window lut with no current index");const t=this.#Oo.getSecondaryOffset(e),n=this.#xo[this.#Eo].wl[t];void 0!==n&&this.setWindowLevel(n,this.#Eo,!0)}if(void 0===this.#Ro&&this.setWindowLevelPresetById(0,!0),void 0===this.#Te||this.#Oo.isConstantRSI()!==this.#Te){let e,t;this.#Te=this.#Oo.isConstantRSI(),this.#Te?(e=this.#Oo.getRescaleSlopeAndIntercept(),t=!0):(e=new Ve(1,0),t=!1);const n=new al(e,this.#Oo.getMeta().BitsStored);this.#bo=new sl(n,1===this.#Oo.getMeta().PixelRepresentation,t)}const e=this.#bo.getVoiLut();let t;if(void 0!==e&&(t=e.getWindowLevel()),void 0===e||!ze(this.#Ro,t)){const e=new ke(this.#Ro,this.#Oo.getMeta().VOILUTFunction);this.#bo.setVoiLut(e)}return this.#bo}getWindowPresets(){return this.#xo}getWindowPresetsNames(){return Object.keys(this.#xo)}setWindowPresets(e){this.#xo=e}addWindowPresets(e){const t=Object.keys(e);for(const n of t)if(void 0!==this.#xo[n]){if(void 0!==this.#xo[n].perslice&&!0===this.#xo[n].perslice)throw new Error("Cannot add perslice preset");this.#xo[n]=e[n]}else this.#xo[n]=e[n],this.dispatchEvent(new CustomEvent("wlpresetadd",{detail:{name:n}}))}getCurrentWindowPresetName(){return this.#Eo}getColourMap(){return this.#Fo}#zo(){return Ze[this.#Fo]}setColourMap(e){if(!Ze[e])throw new Error(`Unknown colour map: '${e}'`);this.#Fo=e,this.dispatchEvent(new CustomEvent("colourmapchange",{detail:{value:[e]}}))}getCurrentPosition(){return this.#Mo}getCurrentIndex(){const e=this.getCurrentPosition();if(void 0!==e)return this.getImage().getGeometry().worldToIndex(e)}getCurrentImageUid(){return this.#Oo.getImageUid(this.getCurrentIndex())}getOriginForImageUid(e){return this.#Oo.getOriginForImageUid(e)}includesImageUid(e){return this.#Oo.includesImageUid(e)}isPositionInBounds(e){void 0===e&&(e=this.#Mo);const t=this.#Oo.getGeometry(),n=t.worldToIndex(e),i=[this.getScrollDimIndex()];return 4===n.length()&&i.push(3),t.isIndexInBounds(n,i)}getOrigin(e){const t=this.#Oo.getGeometry();let n=0;return void 0!==e&&(n=t.worldToIndex(e).get(2)),t.getOrigins()[n]}setCurrentIndex(e,t){const n=this.#Oo.getGeometry().indexToWorld(e);return this.setCurrentPosition(n,t)}setCurrentPosition(e,t){void 0===t&&(t=!1);const n=this.#Oo.getGeometry(),i=n.getSize().normalisePoint(e,this.#Mo),o=n.worldToIndex(i),r=[this.getScrollDimIndex()];if(4===o.length()&&r.push(3),!n.isIndexInBounds(o,r))return this.#Mo=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.#Mo=i,!t){const t=[o.getValues(),e.getValues()];if(this.#Oo.canQuantify()){const e=this.#Oo.getRescaledValueAtIndex(o);t.push(e)}this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:t,diffDims:a,data:{imageUid:this.#Oo.getImageUid(o)}}}))}return!0}setWindowLevel(e,t,n){if(void 0===t&&(t="manual"),"manual"!==t&&void 0===this.#xo[t])throw new Error(`Unknown window level preset: '${t}'`);void 0===n&&(n=!1);const i=He(e,this.#Oo.getRescaledDataRange(),this.#Oo.getMeta().VOILUTFunction),o=!ze(i,this.#Ro),r=this.#Eo!==t;(o||r)&&(this.#Ro=i,this.#Eo=t,"manual"===t&&(void 0!==this.#xo[t]?this.#xo[t].wl[0]=i:this.addWindowPresets({manual:new Ye("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.#Go().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.#Oo.isResampled()){const e=this.#Oo.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 He(new Ge(n,t),e,this.#Oo.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=qe(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.#Go(),this.#zo());break;case"PALETTE COLOR":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,p=0,m=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],p+=n.blue[e],++m)}if(0===m)e.data[g+3]=0;else{e.data[g]=Math.round(l/m),e.data[g+1]=Math.round(S/m),e.data[g+2]=Math.round(p/m);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.#Bo):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=yi(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 et(this.#$)}}class Sl{#Ho={};add(e,t){void 0===this.#Ho[e]&&(this.#Ho[e]=[]),this.#Ho[e].push(t)}remove(e,t){if(void 0===this.#Ho[e])return;let n=0;for(let i=0;i<this.#Ho[e].length;++i)this.#Ho[e][i]===t&&(++n,this.#Ho[e].splice(i,1));0===n&&s.debug(`No callback found on remove listener for type ${e}`)}fireEvent=e=>{if(void 0===this.#Ho[e.type])return;const t=this.#Ho[e.type].slice();for(let n=0;n<t.length;++n)t[n](e)}}class pl{#Yo;#Y;#Xo;#Wo;#$o;constructor(e,t){this.#Yo=e,this.#Y=e.getRealSpacing(),this.#Xo=e.getOrientation(),this.#Wo=t,this.#$o=function(e,t){let n=e.asOneAndZeros().multiply(t);return e.asOneAndZeros().getAbs().isSimilar(tt().getAbs())&&(n=n.getAbs()),n}(this.#Xo,t)}getViewOrientation(){return this.#Wo}getTargetOrientation(){return this.#$o}getOffset3DFromPlaneOffset(e){const t=new p(e.x,e.y,0),n=this.getTargetDeOrientedVector3D(t);return new p(n.getX()*this.#Y.get(0),n.getY()*this.#Y.get(1),n.getZ()*this.#Y.get(2))}getPlaneOffsetFromOffset3D(e){const t=new p(e.x/this.#Y.get(0),e.y/this.#Y.get(1),e.z/this.#Y.get(2)),n=this.getTargetOrientedVector3D(t);return{x:n.getX(),y:n.getY()}}getTargetOrientedVector3D(e){let t=e;return void 0!==this.#$o&&(t=this.#$o.getInverse().multiplyVector3D(e)),t}getTargetDeOrientedVector3D(e){let t=e;return void 0!==this.#$o&&(t=this.#$o.multiplyVector3D(e)),t}getTargetDeOrientedPoint3D(e){let t=e;return void 0!==this.#$o&&(t=this.#$o.multiplyPoint3D(e)),t}getImageOrientedVector3D(e){let t=e;if(void 0!==this.#Wo){const n=Ot([e.getX(),e.getY(),e.getZ()],this.#Wo);t=new p(n[0],n[1],n[2])}return t}getImageOrientedPoint3D(e){let t=e;if(void 0!==this.#Wo){const n=Ot([e.getX(),e.getY(),e.getZ()],this.#Wo);t=new f(n[0],n[1],n[2])}return t}getImageDeOrientedVector3D(e){let t=e;if(void 0!==this.#Wo){const n=At([e.getX(),e.getY(),e.getZ()],this.#Wo);t=new p(n[0],n[1],n[2])}return t}getImageDeOrientedPoint3D(e){let t=e;if(void 0!==this.#Wo){const n=At([e.getX(),e.getY(),e.getZ()],this.#Wo);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.#Yo.pointToWorld(i)}getPlanePointFromPosition(e){const t=this.#Yo.worldToPoint(e);return this.getImageDeOrientedPoint3D(t)}getCosines(){return[(e=this.#$o).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 m(0,0),i.getZ()),r=this.#Yo.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.#Yo.worldToIndex(e)}indexToWorld(e){return this.#Yo.indexToWorld(e)}isAquisitionOrientation(){return et(this.#Wo)}getTargetOrientedPositiveXYZ(e){const t=At([e.x,e.y,e.z],this.#$o);return{x:t[0],y:t[1],z:t[2]}}getScrollDimIndex(){let e;return e=void 0!==this.#Wo?this.#Wo.getThirdColMajorDirection():2,e}getNativeScrollDimIndex(){let e;return e=void 0!==this.#Xo?this.#Xo.getThirdColMajorDirection():2,e}}class ml{#p;constructor(e){this.#p=e}getCurrentPosition(){return this.#p.getCurrentPosition()}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(n=this.#p.setCurrentPosition(e,t)),n}}class fl{#jo;#ie;#Mo;#Zo;constructor(e){this.#jo=new ml(e),this.#ie=e.getImage().getGeometry(),this.#Mo=e.getCurrentPosition(),this.#Zo=e.getScrollDimIndex()}getGeometry(){return this.#ie}getScrollDimIndex(){return this.#Zo}getMaximumDimValue(e){return this.#ie.getSize().get(e)-1}getMaximumScrollValue(){return this.getMaximumDimValue(this.#Zo)}getCurrentPosition(){return this.#ie.getSize().normalisePoint(this.#jo.getCurrentPosition(),this.#Mo)}getCurrentPositionDimValue(e){return this.getCurrentIndex().get(e)}getCurrentPositionScrollValue(){return this.getCurrentPositionDimValue(this.#Zo)}getCurrentPositionAtDimValue(e,t){const n=this.getCurrentIndex().getValues();return n[e]=t,this.#ie.indexToWorld(new a(n))}getCurrentPositionAtScrollValue(e){return this.getCurrentPositionAtDimValue(this.#Zo,e)}getCurrentIndex(){return this.#ie.worldToIndex(this.getCurrentPosition())}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(this.#Mo=this.#ie.getSize().normalisePoint(e,this.#Mo),n=this.#jo.setCurrentPosition(e,t)),n}setCurrentPositionSafe(e,t){let n=!1;return this.isPositionInBounds(e)&&(n=this.setCurrentPosition(e,t)),n}merge(e){if(this.#Zo!==e.getScrollDimIndex())throw new Error("Cannot merge helper of a view with different orientation");this.#ie=function(e,t){const n=e.getOrientation();if(!n.isSimilarProgressive(t.getOrientation(),Lt))throw new Error("Cannot merge geometries with different orientation");const i=n.getInverse(),o=function(e,t){return A(e,t,Math.min)},r=function(e,t){return A(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 Dt(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 Pt(p,S,a,n)}(this.#ie,e.getGeometry()),this.#Mo=this.#ie.getSize().normalisePoint(this.#Mo,e.getCurrentPosition())}isPositionInBounds(e){const t=this.#ie.worldToIndex(e),n=[this.#Zo];return 4===t.length()&&n.push(3),this.#ie.isIndexInBounds(t,n)}getIncrementPosition(e){const t=this.getCurrentIndex().next(e);return this.#ie.indexToWorld(t)}getDecrementPosition(e){const t=this.getCurrentIndex().previous(e);return this.#ie.indexToWorld(t)}incrementPosition(e){return this.setCurrentPositionSafe(this.getIncrementPosition(e))}decrementPosition(e){return this.setCurrentPositionSafe(this.getDecrementPosition(e))}incrementPositionAlongScroll(){return this.incrementPosition(this.#Zo)}decrementPositionAlongScroll(){return this.decrementPosition(this.#Zo)}}class vl{#p;#_o;#Ko;constructor(e){if(void 0===e.getImage())throw new Error("View does not have an image, cannot setup controller");this.#p=e,this.#_o=new pl(e.getImage().getGeometry(),e.getOrientation())}getPlaneHelper(){return this.#_o}updatePlaneHelper(){this.#_o=new pl(this.#p.getImage().getGeometry(),this.#p.getOrientation())}isMask(){return this.#p.isMask()}initialise(){this.resetWindowLevel(),this.resetPosition()}resetWindowLevel(){this.setWindowLevelPresetById(0)}resetPosition(){this.setCurrentPosition(this.getPositionFromPlanePoint(new m(0,0)))}getModality(){return this.#p.getImage().getMeta().Modality}getSopClassUid(){return this.#p.getImage().getMeta().SOPClassUID}getWindowLevelPresetsNames(){return this.#p.getWindowPresetsNames()}addWindowLevelPresets(e){return this.#p.addWindowPresets(e)}setWindowLevelPreset(e){this.#p.setWindowLevelPreset(e)}setWindowLevelPresetById(e){this.#p.setWindowLevelPresetById(e)}isPlaying(){return void 0!==this.#Ko}getPositionHelper(){return new fl(this.#p)}getCurrentPosition(){return this.#p.getCurrentPosition()}getCurrentIndex(){return this.#p.getCurrentIndex()}getCurrentImageUid(){return this.#p.getCurrentImageUid()}getOriginForImageUid(e){return this.#p.getOriginForImageUid(e)}includesImageUid(e){return this.#p.includesImageUid(e)}getCurrentOrientedIndex(){let e=this.getCurrentIndex();if(void 0!==this.#p.getOrientation()){const t=this.#_o.getImageDeOrientedVector3D(new p(e.get(0),e.get(1),e.get(2)));e=new a([t.getX(),t.getY(),t.getZ()])}return e}getScrollDimIndex(){return this.#p.getScrollDimIndex()}getCurrentIndexScrollValue(){return this.getCurrentIndex().get(this.#p.getScrollDimIndex())}getOrigin(e){return this.#p.getOrigin(e)}isAquisitionOrientation(){return this.#p.isAquisitionOrientation()}getPlanePoints(e){return this.#_o.getPlanePoints(e)}getCurrentScrollPosition(){const e=this.#p.getScrollDimIndex();return this.#p.getCurrentPosition().get(e)}generateImageData(e,t){this.#p.generateImageData(e,t)}setImage(e){const t=this.#p.getImage().getGeometry(),n=e.getGeometry();this.#p.setImage(e),t.equals(n)||this.updatePlaneHelper()}get2DSpacing(){return this.#p.getImage().getGeometry().getSpacing(this.#p.getOrientation()).get2D()}getRescaledImageValue(e){const t=this.#p.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.#p.getImage().getMeta().pixelUnit}getLengthUnit(){return this.#p.getImage().getMeta().lengthUnit}#Jo(e,t,n,i){const o=Me(qe(e,t,n,i)),r=e.getGeometry().getSize(i).getValues();r[2]=1;const a=new Dt(r),s=e.getGeometry().getSpacing(i).getValues();s[2]=1;const l=new ct(s),c=new f(0,0,0),u=new Pt([c],a,l);return new lo(u,o)}getImageRegionValues(e,t,n){let i=this.#p.getImage();const o=this.#p.getOrientation();let r=n,s=!0;et(o)||(i=this.#Jo(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 m(0,0)),void 0===o&&(o=new m(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=Me(l)),c}getImageVariableRegionValues(e,t){let n=this.#p.getImage();const i=this.#p.getOrientation();let o=t,r=!0;et(i)||(n=this.#Jo(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=Me(s)),l}canQuantifyImage(){return this.#p.getImage().canQuantify()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return this.#p.getImage().isMonochrome()}canScroll(){return this.#p.getImage().canScroll(this.#p.getOrientation())}getImageSize(){return this.#p.getImage().getGeometry().getSize(this.#p.getOrientation())}getImageSpacing(){return this.#p.getImage().getGeometry().getSpacing(this.#p.getOrientation())}moreThanOne(e){return this.getImageSize().moreThanOne(e)}getImageWorldSize(){const e=this.#p.getImage().getGeometry(),t=e.getSize(this.#p.getOrientation()).get2D(),n=e.getSpacing(this.#p.getOrientation()).get2D();return{x:t.x*n.x,y:t.y*n.y}}getImageRescaledDataRange(){return this.#p.getImage().getRescaledDataRange()}equalImageMeta(e){const t=this.#p.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.#p.isPositionInBounds(e)}setCurrentPosition(e,t){return this.#p.setCurrentPosition(e,t)}getPositionFromPlanePoint(e,t){void 0===t&&(t=this.getCurrentIndexScrollValue());const n=new f(e.getX(),e.getY(),t),i=this.#_o.getImageOrientedPoint3D(n),o=this.#p.getImage().getGeometry().pointToWorld(i);return this.getCurrentPosition().mergeWith3D(o)}validatePlanePoint(e){const t=this.getPositionFromPlanePoint(e);return this.#p.getImage().getGeometry().isInBounds(t)}getPlanePositionFromPosition(e){const t=this.#p.getImage().getGeometry().worldToPoint(e),n=this.#_o.getImageDeOrientedPoint3D(t);return new m(n.getX(),n.getY())}getIndexFromPosition(e){return this.#p.getImage().getGeometry().worldToIndex(e)}setCurrentIndex(e,t){return this.#p.setCurrentIndex(e,t)}getPlanePositionFromPlanePoint(e){const t=this.getCurrentIndexScrollValue(),n=new f(e.getX(),e.getY(),t),i=this.#_o.getTargetDeOrientedPoint3D(n),o=this.#p.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.#_o.getOffset3DFromPlaneOffset(e)}play(){if(this.canScroll())if(void 0===this.#Ko){const e=this.#p.getImage(),t=e.getMeta().RecommendedDisplayFrameRate,n=this.#p.getPlaybackMilliseconds(t),i=e.getGeometry().getSize().canScroll3D(),o=this.getPositionHelper();this.#Ko=window.setInterval(()=>{let e;if(e=i?o.incrementPositionAlongScroll():o.incrementPosition(3),!e){const e=this.getCurrentIndex().getValues(),t=this.#p.getOrientation();i?e[t.getThirdColMajorDirection()]=0:e[3]=0;const n=new a(e),o=this.#p.getImage().getGeometry();this.setCurrentPosition(o.indexToWorld(n))}},n)}else this.stop()}stop(){void 0!==this.#Ko&&(clearInterval(this.#Ko),this.#Ko=void 0)}getWindowLevel(){return this.#p.getWindowLevel()}getCurrentWindowPresetName(){return this.#p.getCurrentWindowPresetName()}setWindowLevel(e){this.#p.setWindowLevel(e)}getColourMap(){return this.#p.getColourMap()}setColourMap(e){this.#p.setColourMap(e)}setViewAlphaFunction(e){this.#p.setAlphaFunction(e)}setMaskViewHelper(e){this.#p.setMaskViewHelper(e)}getFillOpacity(){return this.#p.getFillOpacity()}setFillOpacity(e){this.#p.setFillOpacity(e)}getContourThickness(){return this.#p.getContourThickness()}setContourThickness(e){this.#p.setContourThickness(e)}bindImageAndLayer(e){const t=this.#p.getImage();t.addEventListener("imagecontentchange",e.onimagecontentchange),t.addEventListener("imagegeometrychange",e.onimagegeometrychange),t.addEventListener("imageresampled",e.onimageresampled)}unbindImageAndLayer(e){const t=this.#p.getImage();t.removeEventListener("imagecontentchange",e.onimagecontentchange),t.removeEventListener("imagegeometrychange",e.onimagegeometrychange),t.removeEventListener("imageresampled",e.onimageresampled)}}class Cl{#er;#Fn=null;#tr=null;#nr=null;#ir=null;#or=!0;#rr;#ar;#sr;#lr=1;#cr={x:1,y:1};#ur={x:1,y:1};#dr={x:1,y:1,z:1};#hr={x:1,y:1};#gr=1;#Sr={x:1,y:1};#pr={x:0,y:0};#mr={x:0,y:0};#fr={x:0,y:0};#vr={x:0,y:0};#Cr={x:0,y:0};#Dr={x:0,y:0};#yr=null;#nt;#Ir=new Sl;#wr=!1;#Tr;#Lr;constructor(e){this.#er=e,this.#er.className+=" viewLayer"}getDataId(){return this.#nt}getScale(){return this.#cr}getAbsoluteZoomOffset(){return{x:this.#vr.x*this.#ur.x,y:this.#vr.y*this.#ur.y}}setImageSmoothing(e){this.#wr=e}setView(e,t){this.#nt=t,e.addEventListener("wlchange",this.#Pr),e.addEventListener("colourmapchange",this.#Ar),e.addEventListener("positionchange",this.#Or),e.addEventListener("alphafuncchange",this.#br),e.addEventListener("maskviewchange",this.#xr);for(const t of dl)e.addEventListener(t,this.#Er);this.#Fn=new vl(e),this.bindImage()}getViewController(){return this.#Fn}getImageData(){return this.#rr}onimageset=e=>{const t=e.detail?.dataid,n=e.detail?.value;this.#nt===t&&(this.#Fn.setImage(n[0]),this.#Rr(this.#Fn.getImageSize().get2D()),this.#yr=!0)};bindImage(){this.#Fn&&this.#Fn.bindImageAndLayer(this)}unbindImage(){this.#Fn&&this.#Fn.unbindImageAndLayer(this)}onimagecontentchange=e=>{const t=e.detail?.dataid;void 0!==t&&this.#nt!==t||(this.#or=this.#Fn.isPositionInBounds(),this.#yr=!0,this.draw())};onimagegeometrychange=e=>{const t=e.detail?.dataid;if(void 0===t||this.#nt===t){const e=this.#Fn.getImageSize().get2D(),t=this.#Fn.getImageSpacing().get2D(),n=this.#ar.x!==e.x||this.#ar.y!==e.y,i=this.#sr.x!==t.x||this.#sr.y!==t.y;if(i&&(this.#Fn.updatePlaneHelper(),this.#Fr(t)),n){if(void 0!==this.#Tr&&void 0!==this.#Lr){const e=this.#Fn.getOrigin(),t=this.#Lr.minus(e),n=this.#Fn.getOrigin(this.#Fn.getCurrentPosition());if(void 0!==n){const e=this.#Tr.minus(n);this.setBaseOffset(t,e)}}this.#Rr(e)}(i||n)&&(this.#yr=!0,this.draw())}};onimageresampled=e=>{const t=this.#Fn.getCurrentIndex().get(3),n=void 0===t||t===e.detail?.frame,i=e.detail?.dataid;void 0!==i&&this.#nt!==i||!n||(this.#yr=!0,this.draw())};getId(){return this.#er.id}removeFromDOM(){this.#er.remove()}getBaseSize(){return this.#ar}getImageWorldSize(){return this.#Fn.getImageWorldSize()}getOpacity(){return this.#lr}setOpacity(e){e!==this.#lr&&(this.#lr=Math.min(Math.max(e,0),1),this.#Er(new CustomEvent("opacitychange",{detail:{value:[this.#lr]}})))}getFillOpacity(){return this.#Fn.getFillOpacity()}setFillOpacity(e){this.#Fn.setFillOpacity(e)}getContourThickness(){return this.#Fn.getContourThickness()}setContourThickness(e){this.#Fn.setContourThickness(e)}addFlipOffsetX(){this.#Dr.x+=this.#tr.width/this.#cr.x,this.#pr.x+=this.#Dr.x}addFlipOffsetY(){this.#Dr.y+=this.#tr.height/this.#cr.y,this.#pr.y+=this.#Dr.y}flipScaleX(){this.#dr.x*=-1}flipScaleY(){this.#dr.y*=-1}flipScaleZ(){this.#dr.z*=-1}setScale(e,t){const n=this.#Fn.getPlaneHelper(),i=n.getTargetOrientedPositiveXYZ({x:e.x*this.#dr.x,y:e.y*this.#dr.y,z:e.z*this.#dr.z}),o={x:this.#ur.x*i.x,y:this.#ur.y*i.y};if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:this.#pr.x-this.#vr.x,y:this.#pr.y-this.#vr.y};this.#vr={x:0,y:0},this.#pr=e}else if(void 0!==t){let e=n.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#mr.x,y:e.y+this.#mr.y};const i=El(this.#pr,this.#cr,o,e),r={x:this.#vr.x+i.x-this.#pr.x,y:this.#vr.y+i.y-this.#pr.y};this.#vr=r,this.#pr=i}this.#cr=o}initScale(e,t){const n=this.#Fn.getPlaneHelper().getTargetOrientedPositiveXYZ({x:e.x*this.#dr.x,y:e.y*this.#dr.y,z:e.z*this.#dr.z}),i={x:this.#ur.x*n.x,y:this.#ur.y*n.y};this.#cr=i,this.#vr={x:t.x/this.#ur.x,y:t.y/this.#ur.y},this.#pr={x:this.#pr.x+this.#vr.x,y:this.#pr.y+this.#vr.y}}setBaseOffset(e,t,n,i){const o=this.#Fn.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.#mr.x!==a.x||this.#mr.y!==a.y;return void 0!==n&&void 0!==i&&(this.#Tr=n,this.#Lr=i),s&&(this.#pr={x:this.#pr.x-this.#mr.x+a.x,y:this.#pr.y-this.#mr.y+a.y},this.#mr=a),s}setOffset(e){const t=this.#Fn.getPlaneHelper().getPlaneOffsetFromOffset3D(e);this.#pr={x:this.#pr.x-this.#Cr.x+t.x,y:this.#pr.y-this.#Cr.y+t.y},this.#Cr=t}displayToPlaneIndex(e){const t=this.displayToPlanePos(e);return new a([Math.floor(t.getX()),Math.floor(t.getY())])}displayToPlaneScale(e){return new m(e.getX()/this.#cr.x,e.getY()/this.#cr.y)}displayToPlanePos(e){const t=this.displayToPlaneScale(e);return new m(t.getX()+this.#pr.x,t.getY()+this.#pr.y)}planePosToDisplay(e){let t=(e.getX()-this.#pr.x+this.#mr.x)*this.#cr.x,n=(e.getY()-this.#pr.y+this.#mr.y)*this.#cr.y;return(t<0||t>=this.#tr.width)&&(t=void 0),(n<0||n>=this.#tr.height)&&(n=void 0),new m(t,n)}displayToMainPlanePos(e){const t=this.displayToPlanePos(e);return new m(t.getX()-this.#mr.x,t.getY()-this.#mr.y)}display(e){this.#er.style.display=e?"":"none"}isVisible(){return""===this.#er.style.display}draw(){this.#or&&(this.#Er(new CustomEvent("renderstart",{detail:{layerid:this.getId()}})),this.#yr&&this.#Mr(),this.#ir.globalAlpha=this.#lr,this.clear(),this.#ir.setTransform(this.#cr.x,0,0,this.#cr.y,-1*this.#pr.x*this.#cr.x,-1*this.#pr.y*this.#cr.y),this.#ir.imageSmoothingEnabled=this.#wr,this.#ir.drawImage(this.#nr,0,0),this.#Er(new CustomEvent("renderend",{detail:{layerid:this.getId()}})))}initialise(e,t,n){this.#sr=t,this.#lr=Math.min(Math.max(n,0),1),this.#tr=document.createElement("canvas"),this.#er.appendChild(this.#tr),this.#tr.getContext?(this.#ir=this.#tr.getContext("2d"),this.#ir?(this.#nr=document.createElement("canvas"),this.#Rr(e),this.#yr=!0):alert("Error: failed to get the 2D context.")):alert("Error: no canvas.getContext method.")}#Rr(e){if(!Oo(e.x,e.y))throw new Error(`Cannot create canvas with size ${e.x}, ${e.y}`);this.#ar=e,this.#nr.width=this.#ar.x,this.#nr.height=this.#ar.y,this.#ir.clearRect(0,0,this.#ar.x,this.#ar.y),this.#rr=this.#ir.createImageData(this.#ar.x,this.#ar.y)}#Fr(e){this.#sr=e,this.fitToContainer(this.#hr,this.#gr,this.#Sr)}fitToContainer(e,t,n){let i=!1;const o={x:t*this.#sr.x,y:t*this.#sr.y},r=o.x/this.#ur.x,a=o.y/this.#ur.y,s=e.x/(this.#tr.width*r),l=e.y/(this.#tr.height*a);if(this.#tr.width!==e.x||this.#tr.height!==e.y){if(!Oo(e.x,e.y))throw new Error(`Cannot resize canvas ${e.x}, ${e.y}`);this.#tr.width=e.x,this.#tr.height=e.y,i=!0}const c={x:this.#cr.x*r,y:this.#cr.y*a};this.#cr.x===c.x&&this.#cr.y===c.y||(this.#ur=o,this.#cr=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.#Dr.x?d.x:0,y:0!==this.#Dr.y?d.y:0};if(this.#fr.x!==u.x||this.#fr.y!==u.y||this.#Dr.x!==h.x||this.#Dr.y!==h.y){const e={x:this.#vr.x*s,y:this.#vr.y*l};this.#pr={x:this.#pr.x+u.x-this.#fr.x+h.x-this.#Dr.x+e.x-this.#vr.x,y:this.#pr.y+u.y-this.#fr.y+h.y-this.#Dr.y+e.y-this.#vr.y},this.#Dr=h,this.#fr=u,this.#vr=e,i=!0}this.#hr=e,this.#gr=t,this.#Sr=n,i&&this.draw()}bindInteraction(){this.#er.style.pointerEvents="auto";const e=To;for(let t=0;t<e.length;++t){const n=e[t],i="wheel"!==n&&"touchstart"!==n;this.#er.addEventListener(n,this.#qr,{passive:i})}}unbindInteraction(){this.#er.style.pointerEvents="none";const e=To;for(let t=0;t<e.length;++t)this.#er.removeEventListener(e[t],this.#qr)}addEventListener(e,t){this.#Ir.add(e,t)}removeEventListener(e,t){this.#Ir.remove(e,t)}#Er=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#nt});this.#Ir.fireEvent(new CustomEvent(e.type,{detail:t}))};#qr=e=>{e.srclayerid=this.getId(),e.dataid=this.#nt,this.#Ir.fireEvent(e)};#Mr(){this.#Fn.generateImageData(this.#rr),this.#nr.getContext("2d").putImageData(this.#rr,0,0),this.#yr=!1}#Pr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#yr=!0,this.draw())};#Ar=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#yr=!0,this.draw())};#Or=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.#Fn.getScrollDimIndex());t.splice(n,1);const i=e.detail?.diffDims?.filter(function(e){return-1===t.indexOf(e)});0===i.length&&this.#or||(this.#or=!0,this.#yr=!0,this.draw())}else this.#or&&(this.#or=!1,this.clear())}};isValidPosition(){return this.#or}#br=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#yr=!0,this.draw())};#xr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#yr=!0,this.draw())};setCurrentPosition(e,t){return this.#Fn.setCurrentPosition(e)}clear(){this.#ir.save(),this.#ir.setTransform(1,0,0,1,0,0),this.#ir.clearRect(0,0,this.#tr.width,this.#tr.height),this.#ir.restore()}}class Dl extends qa{#Ur;#Vr;constructor(e,t){super(),this.#Ur=e,this.#Vr=t}getName(){return`AddAnnotation-${this.#Ur.trackingUid}`}execute(){this.#Vr.addAnnotation(this.#Ur)}undo(){this.#Vr.removeAnnotation(this.#Ur.trackingUid)}}class yl extends qa{#Ur;#Vr;constructor(e,t){super(),this.#Ur=e,this.#Vr=t}getName(){return`RemoveAnnotation-${this.#Ur.trackingUid}`}execute(){this.#Vr.removeAnnotation(this.#Ur.trackingUid)}undo(){this.#Vr.addAnnotation(this.#Ur)}}class Il extends qa{#Ur;#Vr;#Qr;#Nr;constructor(e,t,n,i){super(),this.#Ur=e,this.#Vr=i,this.#Qr=t,this.#Nr=n}getName(){return`UpdateAnnotation-${this.#Ur.trackingUid}`}execute(){const e=Object.keys(this.#Nr);for(const t of e)this.#Ur[t]=this.#Nr[t];this.#Vr.updateAnnotation(this.#Ur,e)}undo(){const e=Object.keys(this.#Qr);for(const t of e)this.#Ur[t]=this.#Qr[t];this.#Vr.updateAnnotation(this.#Ur,e)}}class wl{#Br;getAnnotation(e){return this.#Br.find(e)}getAnnotationGroup(){return this.#Br}isAnnotationGroupEditable(){return this.#Br.isEditable()}setAnnotationGroupEditable(e){this.#Br.setEditable(e)}addAnnotation(e){this.#Br.add(e)}updateAnnotation(e,t,n){this.#Br.update(e,t,n)}removeAnnotation(e){this.#Br.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 yl(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 Il(o,t,n,this);i(r),r.execute()}removeAllAnnotationsWithCommand(e){for(const t of this.#Br.getList())this.removeAnnotationWithCommand(t.trackingUid,e)}constructor(e){this.#Br=void 0!==e?e:new uo}hasAnnotationMeta(e){return this.#Br.hasMeta(e)}setAnnotationMeta(e,t){this.#Br.setMetaValue(e,t)}}class Tl{#er;#kr=null;#ar;#sr;#ur={x:1,y:1};#dr={x:1,y:1,z:1};#mr={x:0,y:0};#fr={x:0,y:0};#vr={x:0,y:0};#Cr={x:0,y:0};#Dr={x:0,y:0};#Vr;#_o;#nt;#Gr;#zr;#Hr;#Yr=!0;constructor(e){this.#er=e,this.#er.className+=" drawLayer"}setShapeHandler(e){this.#Hr=e}getDataId(){return this.#nt}getReferenceLayerId(){return this.#Gr}#Ir=new Sl;getKonvaStage(){return this.#kr}getKonvaLayer(){return this.#kr.getLayers()[0]}getDrawController(){return this.#Vr}setPlaneHelper(e){this.#_o=e}getId(){return this.#er.id}removeFromDOM(){this.#er.remove()}getBaseSize(){return this.#ar}getOpacity(){return this.#kr.opacity()}setOpacity(e){this.#kr.opacity(Math.min(Math.max(e,0),1))}addFlipOffsetX(){const e=this.#kr.scale(),t=this.#kr.size();this.#Dr.x+=t.width/e.x;const n=this.#kr.offset();n.x+=this.#Dr.x,this.#kr.offset(n)}addFlipOffsetY(){const e=this.#kr.scale(),t=this.#kr.size();this.#Dr.y+=t.height/e.y;const n=this.#kr.offset();n.y+=this.#Dr.y,this.#kr.offset(n)}flipScaleX(){this.#dr.x*=-1}flipScaleY(){this.#dr.y*=-1}flipScaleZ(){this.#dr.z*=-1}setScale(e,t){const n=this.#_o.getTargetOrientedPositiveXYZ({x:e.x*this.#dr.x,y:e.y*this.#dr.y,z:e.z*this.#dr.z}),i={x:this.#ur.x*n.x,y:this.#ur.y*n.y},o=this.#kr.offset();if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:o.x-this.#vr.x,y:o.y-this.#vr.y};this.#vr={x:0,y:0},this.#kr.offset(e)}else if(void 0!==t){let e=this.#_o.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#mr.x,y:e.y+this.#mr.y};const n=El(o,this.#kr.scale(),i,e),r={x:this.#vr.x+n.x-o.x,y:this.#vr.y+n.y-o.y};this.#vr=r,this.#kr.offset(n)}this.#kr.scale(i),this.#Xr(i)}initScale(e,t){const n=this.#_o.getTargetOrientedPositiveXYZ({x:e.x*this.#dr.x,y:e.y*this.#dr.y,z:e.z*this.#dr.z}),i={x:this.#ur.x*n.x,y:this.#ur.y*n.y};this.#kr.scale(i),this.#vr={x:t.x/this.#ur.x,y:t.y/this.#ur.y};const o=this.#kr.offset();this.#kr.offset({x:o.x+this.#vr.x,y:o.y+this.#vr.y})}setOffset(e){const t=this.#_o.getPlaneOffsetFromOffset3D(e),n=this.#kr.offset();this.#kr.offset({x:n.x-this.#Cr.x+t.x,y:n.y-this.#Cr.y+t.y}),this.#Cr=t}setBaseOffset(e,t){const n=this.#_o.getNativeScrollDimIndex(),i=this.#_o.getPlaneOffsetFromOffset3D({x:0===n?e.getX():t.getX(),y:1===n?e.getY():t.getY(),z:2===n?e.getZ():t.getZ()}),o=this.#mr.x!==i.x||this.#mr.y!==i.y;if(o){const e=this.#kr.offset();this.#kr.offset({x:e.x-this.#mr.x+i.x,y:e.y-this.#mr.y+i.y}),this.#mr=i}return o}display(e){this.#er.style.display=e?"":"none"}isVisible(){return""===this.#er.style.display}draw(){this.#kr.draw()}initialise(t,n,i){this.#ar=t,this.#sr=n,this.#Gr=i,this.#kr=new e.Stage({container:this.#er,width:this.#ar.x,height:this.#ar.y,listening:!1}),this.#kr.getContent().setAttribute("style","");const o=new e.Layer({listening:!1,visible:!0});this.#kr.add(o)}setAnnotationGroup(e,t,n){if(this.#nt=t,e.addEventListener("annotationadd",e=>{this.#Wr(e.detail.data,!0),this.getKonvaLayer().draw()}),e.addEventListener("annotationupdate",e=>{this.#$r(e.detail.data),this.getKonvaLayer().draw()}),e.addEventListener("annotationremove",e=>{this.#jr(e.detail.data),this.getKonvaLayer().draw()}),e.addEventListener("annotationgroupeditablechange",e=>{this.activateCurrentPositionShapes(e.detail.data)}),this.#Vr=new wl(e),0!==e.getLength())for(const t of e.getList())this.#Wr(t,!1),n(new Dl(t,this.getDrawController()))}activateCurrentPositionShapes(t){const n=this.getKonvaLayer();if(this.#kr.listening(!1),void 0!==this.#Hr){this.#Hr.disableAndResetEditor();const t=n.getChildren();for(const n of t)n instanceof e.Group&&n.getChildren().forEach(t=>{t instanceof e.Group&&this.#Hr.removeShapeListeners(t)})}const i=this.getDrawController();if(t&&i.getAnnotationGroup().isEditable()){this.#kr.listening(!0);const t=this.#Zr().getChildren();0!==t.length&&n.listening(!0),void 0!==this.#Hr&&t.forEach(t=>{if(t instanceof e.Group){const e=i.getAnnotation(t.id());this.#Hr.addShapeGroupListeners(t,e,this)}})}n.draw()}#_r(e){let t,n;return void 0!==e.planePoints?t=e.planePoints:void 0!==e.planeOrigin&&(t=[e.planeOrigin]),void 0!==t&&(n=this.#Kr(t,e.referencedFrameNumber)),n}#Kr(e,t){let n="";for(const t of e)0!==n.length&&(n+="-"),n+=P([S(t.getX(),2),S(t.getY(),2),S(t.getZ(),2)]);return void 0!==t&&(n+=`-${t}`),n}#Jr(t){let n;const i=this.#_r(t),o=this.getKonvaLayer().getChildren(ga(i));if(0!==o.length){const i=o[0];if(!(i instanceof e.Group))return;const r=i.getChildren(ga(t.trackingUid));0!==r.length&&r[0]instanceof e.Group&&(n=r[0])}return n}#Wr(t,n){if(!t.canView()||!t.isCompatibleView(this.#_o))return;const i=this.#_r(t);let o=this.getKonvaLayer().getChildren(ga(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 ho,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.#Hr&&this.#Hr.addShapeGroupListeners(l,t,this),this.setLabelVisibility(l)}#jr(t){const n=this.#Jr(t);return n instanceof e.Group?(n.remove(),!0):(s.debug("No shape group to remove"),!1)}#$r(e){this.#jr(e)&&this.#Wr(e,!0)}fitToContainer(e,t,n){const i={x:t*this.#sr.x,y:t*this.#sr.y},o=i.x/this.#ur.x,r=i.y/this.#ur.y,a=e.x/(this.#kr.width()*o),s=e.y/(this.#kr.height()*r);this.#kr.width()===e.x&&this.#kr.height()===e.y||(this.#kr.width(e.x),this.#kr.height(e.y));const l={x:this.#kr.scale().x*o,y:this.#kr.scale().y*r};this.#kr.scale().x===l.x&&this.#kr.scale().y===l.y||(this.#ur=i,this.#kr.scale(l),this.#Xr(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.#Dr.x?u.x:0,y:0!==this.#Dr.y?u.y:0};if(this.#fr.x!==c.x||this.#fr.y!==c.y||this.#Dr.x!==d.x||this.#Dr.y!==d.y){const e={x:this.#vr.x*a,y:this.#vr.y*s};this.#kr.offset({x:this.#kr.offset().x+c.x-this.#fr.x+d.x-this.#Dr.x+e.x-this.#vr.x,y:this.#kr.offset().y+c.y-this.#fr.y+d.y-this.#Dr.y+e.y-this.#vr.y}),this.#Dr=d,this.#fr=c,this.#vr=e}}isAnnotationVisible(e){const t=this.#ea(e);return void 0!==t&&t.isVisible()}setAnnotationVisibility(e,t){const n=this.#ea(e);return void 0!==n&&(void 0===t&&(t=!n.isVisible()),n.visible(t),this.draw(),!0)}setLabelsVisibility(t){this.#Yr=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.#ta(i,t)}}#ta(t,n){const i=t.getChildren(ca)[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.#ta(e,this.#Yr)}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.#kr.listening(!0),this.#er.style.pointerEvents="auto";const e=To;for(let t=0;t<e.length;++t)this.#er.addEventListener(e[t],this.#qr)}unbindInteraction(){this.#kr.listening(!1),this.#er.style.pointerEvents="none";const e=To;for(let t=0;t<e.length;++t)this.#er.removeEventListener(e[t],this.#qr)}setCurrentPosition(e,t){void 0===t&&(t=this.#_o.worldToIndex(e));const n=this.#_o.getPlanePoints(e);let i,o;i=this.#_o.isAquisitionOrientation()?[n[0]]:n,e.length()>3&&(o=e.get(3));const r=this.#Kr(i,o);return this.#na(r),this.#Er(new CustomEvent("positionchange",{detail:{value:[t.getValues(),e.getValues()],valid:!0}})),!0}#na(e){this.#zr=e;const t=this.getKonvaLayer().getChildren(da);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()}#Zr(){if(void 0===this.#zr)return;const t=this.getKonvaLayer().getChildren(e=>e.id()===this.#zr);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.#zr),n.visible(!0),this.getKonvaLayer().add(n)):s.warn("Unexpected number of draw position groups"),n}#ea(e){return this.getKonvaLayer().findOne(`#${e}`)}addEventListener(e,t){this.#Ir.add(e,t)}removeEventListener(e,t){this.#Ir.remove(e,t)}#Er=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#nt});this.#Ir.fireEvent(new CustomEvent(e.type,{detail:t}))};#qr=e=>{e.srclayerid=this.getId(),e.dataid=this.#nt,this.#Ir.fireEvent(e)};#Xr(e){const t=2/e.x,n=2/e.y,i=this.#kr.find("Label");for(let e=0;e<i.length;++e)i[e].scale({x:t,y:n})}}function Ll(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 Pl(e){return`info-${e}`}function Al(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,""),`${Pl(e.pos)}-${t}-${n}`}class Ol{#ia=!1;#er;constructor(e){this.#er=e}onDataChange=e=>{const t=e.detail?.data;if(void 0!==t){if(void 0!==e.detail?.srclayerid){const t=bl(e.detail.srclayerid),i={groupDivId:(n=this.#er.id).substring(0,n.length-10)};if(t.groupDivId!==i.groupDivId)return}var n;this.#ia||this.#oa(t),this.#ra(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=Al(i),void 0!==i.tags&&e.appendChild(document.createTextNode(i.value)),t.appendChild(e)}const i=document.createElement("div");i.id=Pl(n),i.className=`info-${n} info`,i.appendChild(t),this.#er.appendChild(i)}this.#ia=!0}#ra(e){for(const t of e){const e=`#${Al(t)}`,n=this.#er.querySelector(e),i=t.value;i&&n&&n.replaceChildren(document.createTextNode(i))}}}function bl(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 xl(e){let t=null;const n=e.target.closest(".layer");return n&&void 0!==n.id&&(t=bl(n.id)),t}function El(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 Rl extends EventTarget{#er;#aa=[];#cr={x:1,y:1,z:1};#Ze={x:1,y:1,z:1};#pr={x:0,y:0,z:0};#sa=void 0;#la=!1;#ca=[];#ua;#wr=!1;#da;#ha;#ga=[];#Sa;getPositionHelper(){if(void 0===this.#da)for(const e of this.#aa)if(e instanceof Cl){const t=e.getViewController().getPositionHelper();void 0===this.#da?this.#da=t:this.#da.merge(t)}return this.#da}constructor(e,t){if(super(),this.#er=e,void 0!==t&&!0===t){const t=document.createElement("div");t.id=`${e.id}-infolayer`,t.className="infoLayer",e.appendChild(t),this.#ha=new Ol(t)}}getShowCrosshair(){return this.#la}setShowCrosshair(e){this.#la=e,e?(this.addEventListener("offsetchange",this.#pa),this.addEventListener("zoomchange",this.#pa),this.#ma()):(this.removeEventListener("offsetchange",this.#pa),this.removeEventListener("zoomchange",this.#pa),this.#fa())}setImageSmoothing(e){this.#wr=e;for(const t of this.#aa)t instanceof Cl&&t.setImageSmoothing(e)}#pa=e=>{this.#ma()};getDivId(){let e;return null!==this.#er&&(e=this.#er.id),e}getScale(){return this.#cr}getBaseScale(){return this.#Ze}getAddedScale(){return{x:this.#cr.x/this.#Ze.x,y:this.#cr.y/this.#Ze.y,z:this.#cr.z/this.#Ze.z}}getOffset(){return this.#pr}getNumberOfLayers(){let e=0;return this.#aa.forEach(t=>{void 0!==t&&e++}),e}includes(e){if(void 0===e)return!1;for(const t of this.#aa)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.#aa)n instanceof Cl&&e(n)&&t.push(n);return t}getViewLayersFromActive(e){void 0===e&&(e=function(){return!0});let t=0;void 0!==this.#sa&&(t=this.#sa);const n=[];for(let e=t;e>=0;e--)n.push(e);for(let e=this.#aa.length-1;e>t;e--)n.push(e);const i=[];for(const t of n){const n=this.#aa[t];n instanceof Cl&&e(n)&&i.push(n)}return i}someViewLayer(e){let t=!1;for(const n of this.#aa)if(n instanceof Cl&&e(n)){t=!0;break}return t}getDrawLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#aa)n instanceof Tl&&e(n)&&t.push(n);return t}getNumberOfViewLayers(){let e=0;return this.#aa.forEach(t=>{void 0!==t&&t instanceof Cl&&e++}),e}getActiveLayer(){let e;return void 0!==this.#sa&&(e=this.#aa[this.#sa]),e}getActiveViewLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof Cl&&(e=t),e}getBaseViewLayer(){let e;for(const t of this.#aa)if(t instanceof Cl){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.#aa)if(e instanceof Cl){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.#aa)t instanceof Cl&&e.push(t.getDataId());return e}getActiveDrawLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof Tl&&(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.#sa=e;const t=this.#aa[e];if(void 0!==this.#ha){this.unbindInfoData();const e=t.getDataId();this.bindInfoData(e)}this.dispatchEvent(new CustomEvent("activelayerchange",{detail:{value:[this.#aa[e]]}}))}setActiveLayerById(e){let t;for(let n=0;n<this.#aa.length;++n)if(void 0!==this.#aa[n]&&this.#aa[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.#aa.length;++n)if(void 0!==this.#aa[n]&&this.#aa[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.#aa.length,t=this.#va();this.#er.append(t);const n=new Cl(t);return n.setImageSmoothing(this.#wr),this.#aa.push(n),this.setActiveLayer(e),this.#Ca(n),this.#da=void 0,n}addDrawLayer(){this.#sa=this.#aa.length;const e=this.#va();this.#er.append(e);const t=new Tl(e);return this.#aa.push(t),this.#Da(t),t}#Ca(e){e.addEventListener("positionchange",this.updateLayersToPositionChange);for(const t of dl)e.addEventListener(t,this.#Er);e.addEventListener("renderstart",this.#Er),e.addEventListener("renderend",this.#Er)}#ya(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange);for(const t of dl)e.removeEventListener(t,this.#Er);e.removeEventListener("renderstart",this.#Er),e.removeEventListener("renderend",this.#Er),e.unbindImage()}#Da(e){e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#Er)}#Ia(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#Er)}addInfoData(e,t){this.#ga[t]=e}bindInfoData(e){if(void 0!==this.#Sa)return;const t=this.#ga[e];void 0!==t&&t.addEventListener("valuechange",this.#ha.onDataChange),this.#Sa=e}unbindInfoData(){const e=this.#ga[this.#Sa];void 0!==e&&e.removeEventListener("valuechange",this.#ha.onDataChange),this.#Sa=void 0}#va(){const e=document.createElement("div");return e.id=`${this.getDivId()}-layer-${this.#aa.length}`,e.className="layer",e.style.pointerEvents="none",e}empty(){for(const e of this.#aa)void 0!==e&&this.removeLayer(e);this.#aa=[],this.#fa()}removeLayersByDataId(e){for(const t of this.#aa)void 0!==t&&t.getDataId()===e&&this.removeLayer(t)}removeLayer(e){const t=this.#aa.findIndex(t=>t===e);if(-1===t)throw new Error("Cannot find layer to remove");this.#sa===t&&(this.#sa=void 0),e instanceof Cl?this.#ya(e):this.#Ia(e),this.#aa[t]=void 0,this.#da=void 0,e.removeFromDOM(),this.dispatchEvent(new CustomEvent("layerremove",{detail:{layerid:e.getId(),layergroupid:this.getDivId()}}))}#ma(){let e;this.#fa();for(const t of this.#aa)if(t instanceof Cl){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.#er.offsetWidth}px`,e.style.left="0px",e.style.top=`${o.getY()}px`,this.#ca.push(e),this.#er.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.#er.offsetHeight}px`,e.style.left=`${o.getX()}px`,e.style.top="0px",this.#ca.push(e),this.#er.appendChild(e)}}#fa(){for(const e of this.#ca)e.remove();this.#ca=[]}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=S(r,3).toString();void 0!==n.getPixelUnit()&&(i+=` ${n.getPixelUnit()}`),t.appendChild(document.createTextNode(i)),this.#ua=t,this.#er.appendChild(t)}}removeTooltipDiv(){void 0!==this.#ua&&(this.#ua.remove(),this.#ua=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()})}#Ta=e=>{const t=e.detail?.dataid,n=this.#ga[t];void 0!==n&&n.onSliceChange(e)};updateLayersToPositionChange=e=>{for(const e of this.#aa)void 0!==e&&(e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#Er),e.addEventListener("positionchange",this.#Ta));const t=e.detail?.value,n=new a(t[0]),i=new D(t[1]),o={};let r,s;for(const t of this.#aa){if(void 0===t)continue;let a=!1;if(t instanceof Cl){const e=t.getViewController(),n=e.getOrigin(),l=e.getOrigin(i);let c,u;if(void 0===s)r=n,s=l,c=new p(0,0,0),u=new p(0,0,0);else if(e.isPositionInBounds(i)&&void 0!==l){const e=r.minus(n);c=new p(e.getX(),e.getY(),e.getZ());const t=s.minus(l);u=new p(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 Tl){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.#la&&this.#ma();for(const e of this.#aa)void 0!==e&&(e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#Er),e.removeEventListener("positionchange",this.#Ta))};getDivToWorldSizeRatio(){if(0===this.#er.offsetWidth&&0===this.#er.offsetHeight)throw new Error(`Cannot fit to zero sized container with id '${this.#er.id}'.`);const e=this.getMaxWorldSize();if(void 0!==e){if(0===this.#er.offsetHeight){const t=this.#er.offsetWidth/e.x,n=e.y*t;this.#er.style.height=`${n}px`}return Math.min(this.#er.offsetWidth/e.x,this.#er.offsetHeight/e.y)}}fitToContainer(e){const t=this.getMaxWorldSize();if(void 0===t)return;const n={x:this.#er.offsetWidth,y:this.#er.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.#aa)void 0!==t&&t.fitToContainer(n,e,i);this.#la&&this.#ma()}getMaxWorldSize(){let e={x:0,y:0};for(const t of this.#aa)if(t instanceof Cl){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.#cr.x*(1+e),y:this.#cr.y*(1+e),z:this.#cr.z*(1+e)};this.setScale(n,t)}setScale(e,t){this.#cr=e;for(const e of this.#aa)void 0!==e&&e.setScale(this.#cr,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.#pr.x-e.x,y:this.#pr.y-e.y,z:this.#pr.z-e.z})}setOffset(e){this.#pr=e;for(const e of this.#aa)void 0!==e&&e.setOffset(this.#pr);this.dispatchEvent(new CustomEvent("offsetchange",{detail:{value:[this.#pr.x,this.#pr.y,this.#pr.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.#aa)if(void 0!==t&&t instanceof Cl){const n=t.getViewController();e&&(n.resetPosition(),e=!1),n.resetWindowLevel()}}draw(){for(const e of this.#aa)void 0!==e&&e.draw()}display(e){for(const t of this.#aa)void 0!==t&&t.display(e)}#Er=e=>{const t=null!==e.detail&&"object"==typeof e.detail?Object.assign({},e.detail):{};this.dispatchEvent(new CustomEvent(e.type,{detail:t}))}}class Fl{#La=0;add(e){this.#La+=function(e){return void 0===e.wheelDeltaY?-e.deltaY:e.wheelDeltaY>45?1:e.wheelDeltaY<-45?-1:-e.deltaY/60}(e)}getSum(){return this.#La}isTick(){return Math.abs(this.#La)>=1}clear(){this.#La=0}}class Ml extends EventTarget{#Pa;#Aa;#Oa;#ba;#xa=new Fl;#Ea;#Ra;#Fa;#Ma;#qa;#Ua=!1;#Va=!1;constructor({stageController:e,dragBehavior:t,hoverBehavior:n,wheelBehavior:i,doubleClickBehavior:o,twoTouchBehavior:r,tapBehavior:a,longTouchToDblClickMs:s=500}){super(),this.#Pa=e,this.#Aa=t,this.#Oa=n,this.#ba=i,this.#Ea=o,this.#Ra=r,this.#Fa=a,this.#Ma=s}#Qa(e){return this.#Pa.getLayerGroupByDivId(e)}#Na(e){const t=xl(e),n=this.#Qa(t.groupDivId);return{point:Ao(e),layerGroup:n}}#Ba(e){const t=xl(e),n=this.#Qa(t.groupDivId);return{point:Po(e)[0],layerGroup:n}}getEventNames(){return[]}wheel=e=>{if(void 0===this.#ba)return;e.preventDefault();const t=xl(e),n=this.#Qa(t.groupDivId);this.#ba.onWheel(e,n),this.#xa.add(e);const i=this.#xa.getSum()>=0;this.#xa.isTick()&&(this.#xa.clear(),this.#ba.onWheelTick(i,n))};dblclick=e=>{const{point:t,layerGroup:n}=this.#Na(e);void 0!==this.#Ea?this.#Ea.onDoubleClick(t,n):this.#Fa?.isActive()&&this.#Fa.onEnd()};#ka(e,t){void 0!==this.#Ea?this.#Ea.onDoubleClick(e,t):this.#Fa?.isActive()&&(this.#Fa.onTap(e,t),this.#Fa.onEnd()),this.#Ua=!1,this.#qa=void 0}cancel(){this.#Ua=!1,this.#Va=!1,this.#Ga(),this.#Aa?.isActive()&&this.#Aa.reset(),this.#Fa?.isActive()&&this.#Fa.reset(),this.#Ra?.isActive()&&this.#Ra?.reset(),this.#Oa?.reset()}mousedown=e=>{this.#Aa?.isActive()&&this.#Aa.reset(),this.#Va=!1,this.#Ua=!0;const{point:t,layerGroup:n}=this.#Na(e);!this.#Fa?.isActive()&&this.#Aa?.canStart(t,n)&&this.#Aa.onStart(t,n,{mouseDownButton:e.button})};mousemove=e=>{this.#Va=!0;const{point:t,layerGroup:n}=this.#Na(e);this.#Ua?(this.#Oa?.onEnd(),this.#Aa?.isActive()&&this.#Aa.onUpdate(t,n)):(this.#Fa?.isActive()&&this.#Fa.onUpdate(t,n),this.#Oa?.onUpdate(t,n))};mouseup=e=>{if(this.#Aa?.isActive()&&(this.#Va?this.#Aa.onEnd():this.#Aa.reset()),this.#Fa&&(this.#Fa.isActive()||this.#Ua&&!this.#Va)){const{point:t,layerGroup:n}=this.#Na(e);this.#Fa.onTap(t,n)}this.#Ua=!1};mouseout=e=>{this.#Aa?.isActive()&&this.#Aa.onEnd(),this.#Fa?.isActive()&&this.#Fa.onEnd(),this.#Oa?.onEnd(),this.#Ua=!1,this.#Va=!1};touchstart=e=>{this.#Aa?.isActive()&&this.#Aa.reset(),this.#Va=!1,this.#Ga(),this.#Ua=!0;const t=Po(e);if(1===t.length){const{point:t,layerGroup:n}=this.#Ba(e);this.#Aa?.canStart(t,n)&&this.#Aa.onStart(t,n,{});const i=this.#Ma;null!=i&&i>0&&(e.preventDefault(),this.#qa=setTimeout(()=>{this.#ka(t,n)},i))}else 2===t.length&&this.#Ra?.onStart(t)};touchmove=e=>{this.#Ga(),this.#Va=!0;const{point:t,layerGroup:n}=this.#Ba(e),i=Po(e);1===i.length?this.#Aa?.isActive()&&this.#Aa.onUpdate(t,n):2===i.length&&(this.#Aa?.isActive()&&this.#Aa.reset(),this.#Ra?.isActive()&&this.#Ra.onUpdate(i,n))};touchend=e=>{if(this.#Ga(),this.#Ra?.isActive())this.#Ra.onEnd();else{if(this.#Aa?.isActive()&&(this.#Va?this.#Aa.onEnd():this.#Aa.reset()),this.#Fa&&(this.#Fa.isActive()||this.#Ua&&!this.#Va)){const{point:t,layerGroup:n}=this.#Ba(e);this.#Fa.onTap(t,n)}this.#Ua=!1}};#Ga(){void 0!==this.#qa&&(clearTimeout(this.#qa),this.#qa=void 0)}}function ql(e){return{x:"number"==typeof e?.x?e.x:0,y:"number"==typeof e?.y?e.y:0}}class Ul{#za;#Ha;constructor(e,t,{threshold:n}={}){this.#za={x:t.getX()-e.getX(),y:t.getY()-e.getY()},this.#Ha=ql(n)}get delta(){return this.#za}passesThresholdX(){const e=this.#Ha.x;return e<=0||Math.abs(this.#za.x)>=e}passesThresholdY(){const e=this.#Ha.y;return e<=0||Math.abs(this.#za.y)>=e}passesThreshold(){return this.passesThresholdX()||this.passesThresholdY()}}class Vl extends EventTarget{#Ya;#Xa;#Wa;constructor({threshold:e}={}){super(),this.setDragThreshold(e)}get startPoint(){return this.#Ya}get prevPoint(){return this.#Xa}setDragThreshold(e){this.#Wa=ql(e)}isActive(){return void 0!==this.#Xa}canStart(e,t){return!0}reset(){this.#Ya=void 0,this.#Xa=void 0}onStart(e,t,n){this.#Ya=e,this.#Xa=e}onUpdate(e,t){const n=new Ul(this.#Xa,e,{threshold:this.#Wa});n.passesThreshold()&&(this.#Xa=e,this.onDrag(n,t))}onDrag(e,t){}onEnd(){this.#Xa=void 0,this.reset()}}class Ql extends Vl{#$a;constructor({activeViewLayerOnly:e=!0}={}){super(),this.#$a=e}setActiveViewLayerOnly(e){this.#$a=e}canStart(e,t){const n=tl(t,this.#$a);return void 0!==n&&!!n.getViewController().isMonochrome()}onDrag(e,t){const n=tl(t,this.#$a);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 Ge(l+r*s,c+o*s);i.setWindowLevel(u)}}class Nl extends Vl{constructor(){super({threshold:{x:15,y:15}})}canStart(e,t){return void 0!==nl(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 Bl extends Vl{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 kl extends Vl{onDrag(e,t){const n=nl(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 m(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 Gl{onDoubleClick(e,t){}}class zl extends Gl{#ja;#$a;constructor({dataController:e,activeViewLayerOnly:t=!0}){super(),this.#ja=e,this.#$a=t}setActiveViewLayerOnly(e){this.#$a=e}onDoubleClick(e,t){const n=tl(t,this.#$a);if(void 0===n)return;const i=n.displayToPlaneIndex(e),o=n.getViewController();if(!o.isMonochrome())return;const r=this.#ja.get(n.getDataId()).image,a=new Ge(r.getRescaledValueAtIndex(o.getCurrentIndex().getWithNew2D(i.get(0),i.get(1))),o.getWindowLevel().width);o.setWindowLevel(a)}}class Hl extends Gl{onDoubleClick(e,t){const n=nl(t);void 0!==n?n.getViewController().play():s.warn("No view layer to play double click behavior")}}class Yl{reset(){}onUpdate(e,t){}onEnd(){this.reset()}}class Xl extends Yl{#Za=!1;#_a;constructor({tooltipEnabled:e=!1}={}){super(),this.#Za=e}setTooltipEnabled(e){this.#Za=e}reset(){void 0!==this.#_a&&(this.#_a.removeTooltipDiv(),this.#_a=void 0)}onUpdate(e,t){this.#Za&&this.#Ka(e,t)}#Ka(e,t){this.#_a=t,t.showTooltip(e)}}class Wl extends EventTarget{#Ht=[];#Ja=1;setNumberOfTaps(e){this.#Ht=[],this.#Ja=e}isActive(){return 0!==this.#Ht.length}reset(){this.#Ht=[]}getPointList(){return this.#Ht.slice()}onUpdate(e,t){}onTap(e,t){this.#Ht.push(e),this.#Ht.length===this.#Ja&&this.onEnd()}onEnd(){this.#Ht=[],this.reset()}}class $l extends Wl{onTap(e,t){super.onTap(e,t);const n=nl(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)}}class jl{isActive(){return!1}reset(){}onStart(e){}onUpdate(e,t){return!1}onEnd(){this.reset()}}class Zl extends jl{#es;#ts;isActive(){return void 0!==this.#es}reset(){this.#es=void 0,this.#ts=void 0}onStart(e){this.#es=new rr(e[0],e[1]),this.#ts=this.#es.getCentroid()}onUpdate(e,t){if(void 0===this.#es)return!1;const n=new rr(e[0],e[1]).getLength()/this.#es.getLength(),i=t.getPositionHelper();if(1===n){const n=e[0].getY()-this.#es.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.#ts){const n=nl(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.#ts),r=i.getPlanePositionFromPlanePoint(o);t.addScale(e,r),t.draw()}}return!0}onEnd(){this.#es=void 0,this.reset()}}function _l(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 Kl{#an;#ns;#is;#os;#rs;#as;#ss;#ls;#cs;#us=!1;constructor(e){this.#an=e,this.#ns=e.getStyle()}setOptions(e){this.#is=e}setFeatures(e){if(void 0!==e.autoShapeColour&&(this.#us=e.autoShapeColour),void 0!==e.shapeColour&&(this.#ns.setLineColour(e.shapeColour),this.#us=!1),void 0!==e.refMetaValidator&&(this.#ss=e.refMetaValidator),void 0!==e.annotationGroupMeta&&(this.#ls=e.annotationGroupMeta),void 0!==e.annotationMeta&&(this.#cs=e.annotationMeta),void 0!==e.shapeName){if(!this.hasShape(e.shapeName))throw new Error(`Unknown shape: '${e.shapeName}'`);this.#os=e.shapeName,void 0!==this.#is&&(this.#rs=new this.#is[this.#os])}}hasShape(e){return void 0!==this.#is?.[e]}tryBeginPlacement(e){let t=e.getActiveDrawLayer();return void 0===t&&this.#ds(e)&&this.#hs(e)&&(t=this.#gs(e)),!(void 0===t||!this.#Ss())}#Ss(){return!(!this.#is||!this.#os)||(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.#as){const e=this.#as.getLayer();this.#as.destroy(),this.#as=void 0,e.draw()}}#ds(e){let t=!0;const n=this.#ss;if(void 0!==n){const i=e.getActiveViewLayer().getDataId();t=n(this.#an.getDataController().get(i).image.getMeta())}return t}#hs(e){const t=e.getBaseViewLayer().getDataId();return!this.#an.getDataController().get(t).image.isResampled()}getCannotCreateReason(e){let t;return this.#ds(e)||(t="reference data is invalid"),this.#hs(e)||(t="base data is invalid"),t}#gs(e){const t=e.getActiveViewLayer().getDataId(),n=this.#an.createAnnotationData(t),i=this.#ls;if(void 0!==i)for(const e of i)n.annotationGroup.setMetaValue(e.concept,e.value);this.#an.addAndRenderAnnotationData(n,e.getDivId(),t);const o=e.getActiveDrawLayer();e.setActiveLayerByDataId(o.getDataId());const r=o.getKonvaStage();return this.#ns.setZoomScale(r.scale()),o}#ps(e){if(this.#us){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.#ns.setLineColour(o)}}#ms(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 os,l=i.getAnnotationGroup().getColour();a.colour=void 0!==l?l:this.#ns.getLineColour(),a.init(r);const c=this.#cs;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.#as&&(this.#as.destroy(),this.#as=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.#ps(n);const o=this.#ms(e,t);void 0!==o&&(this.#as=this.#rs.createShapeGroup(o,this.#ns),n.setLabelVisibility(this.#as),this.#as.getChildren(ua)[0].listening(!1),i.listening(!1),i.add(this.#as),i.draw())}onFinalPoints(e,t){this.#as&&(this.#as.destroy(),this.#as=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.#ms(e,t);if(void 0===r)return;const a=new Dl(r,o);this.#an.getUndoController().addToUndoStack(a),a.execute(),i.listening(!0)}}class Jl extends Wl{#fs;#vs;#Cs;#Ds;constructor(e,t){super(),this.#Cs=new Kl(e),this.#Ds=t}setOptions(e){this.#Cs.setOptions(e)}setFeatures(e){this.#Cs.setFeatures(e),this.#Ds.setFeatures(e)}hasShape(e){return this.#Cs.hasShape(e)}#ys(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Ds.checkCanEdit(n)?this.#Ds.trySelectShapeGroup(e,n):(this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:"Cannot edit draw, data meta is invalid"}})),!1))}#Is(){const e=this.#Cs.getNPoints();void 0===e?super.setNumberOfTaps(65535):super.setNumberOfTaps(e)}resetPlacement(){this.#Cs.resetPlacement(),super.onEnd()}#ws(e){const t=this.getPointList();return t.length>0&&t[t.length-1].equals(e)}onUpdate(e,t){if(!this.isActive())return;if(this.#ws(e))return;if(!_l(e,t))return;this.#fs=e,this.#vs=t;const n=this.getPointList();n.push(e),this.#Cs.onNewPoints(n,t)}onTap(e,t){if(!this.isActive()){if(this.#ys(e,t))return;if(!this.#Cs.tryBeginPlacement(t)){const e=this.#Cs.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#Ds.disableAndResetEditor(),this.#Is()}if(this.#ws(e))return;this.#vs=t,super.onTap(e,t);const n=this.getPointList();n.length>1&&this.#Cs.onNewPoints(n,t)}onEnd(){const e=this.getPointList(),t=this.#vs,n=this.#Cs.getNPoints();e.length>0&&t&&(void 0!==n?e.length===n?this.#Cs.onFinalPoints(e,t):e.length!==n-1||void 0===this.#fs||this.#ws(this.#fs)?this.#Cs.resetPlacement():(e.push(this.#fs),this.#Cs.onFinalPoints(e,t)):e.length>2?this.#Cs.onFinalPoints(e,t):this.#Cs.resetPlacement()),this.#fs=void 0,this.#vs=void 0,super.onEnd()}}class ec extends Vl{#Ds;#fs;#vs;#Cs;constructor(e,t){super(),this.#Ds=t,this.#Cs=new Kl(e)}setOptions(e){this.#Cs.setOptions(e)}setFeatures(e){this.#Cs.setFeatures(e)}resetPlacement(){this.#Cs.resetPlacement(),super.onEnd()}#Ts(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.#Cs.getNPoints()}onStart(e,t,n){if(!this.isActive()){const n=t.getActiveDrawLayer();if(void 0!==n&&this.#Ts(e,n))return;if(!this.#Cs.tryBeginPlacement(t)){const e=this.#Cs.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#Ds.disableAndResetEditor()}this.#vs=t,super.onStart(e,t,n)}onDrag(e,t){if(!this.isActive())return;if(!_l(this.prevPoint,t))return;this.#fs=this.prevPoint,this.#vs=t;const n=[this.startPoint,this.#fs];this.#Cs.onNewPoints(n,t)}onEnd(){const e=this.#vs;if(e&&void 0!==this.#fs){const t=[this.startPoint,this.#fs];this.#Cs.onFinalPoints(t,e)}this.#fs=void 0,this.#vs=void 0,super.onEnd()}}class tc{#an;#Hr;#ut=[];#Ls;#Ps;constructor(e,t){this.#an=e,this.#Hr=t}setFeatures(e){void 0!==e.drawMetaValidator&&(this.#Ps=e.drawMetaValidator)}disableAndResetEditor(){this.#Hr.disableAndResetEditor()}checkCanEdit(e){return this.#As(e)}#As(e){let t=!0;const n=this.#Ps;if(void 0!==n){const i=e.getDataId();t=n(this.#an.getDataController().get(i).annotationGroup.getMeta())}return t}#Ts(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}#Os(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.#Hr.setEditorShape(o,n),!0)}trySelectShapeGroup(e,t){const n=this.#Ts(e,t);return void 0!==n&&this.#Os(n,t)}#bs(e){const t=e.getId();return void 0===this.#ut[t]&&(this.#ut[t]=()=>{e.activateCurrentPositionShapes(!0)}),this.#ut[t]}#xs(){return e=>{const t=e.detail?.layerid,n=this.#an.getStageController().getDrawLayers(function(e){return e.getId()===t});1===n.length&&this.#Es(n[0],!0)}}#Rs(){void 0===this.#Ls&&(this.#Ls=this.#xs(),this.#an.addEventListener("drawlayeradd",this.#Ls))}#Fs(){void 0!==this.#Ls&&(this.#an.removeEventListener("drawlayeradd",this.#Ls),this.#Ls=void 0)}#Es(e,t){e.setShapeHandler(this.#Hr),e.activateCurrentPositionShapes(t),t?this.#an.addEventListener("positionchange",this.#bs(e)):this.#an.removeEventListener("positionchange",this.#bs(e))}activate(e){e||this.#Hr.onMouseOutShapeGroup();const t=this.#an.getStageController().getDrawLayers();for(const n of t)void 0!==n&&this.#Es(n,e);e?this.#Rs():this.#Fs()}}class nc{#an;#Ms;constructor(e,t){this.#an=e,this.#Ms=t}#rs;#qs;#Us;#Ur;#Vs=!1;setShape(e,t,n){if(this.#qs=e,this.#Us=t,this.#Ur=n,void 0!==this.#qs){if(this.#Qs(),this.#rs=n.getFactory(),void 0===this.#rs)throw new Error("Could not find a factory to update shape.");this.#Ns()}}getShape(){return this.#qs}getAnnotation(){return this.#Ur}isActive(){return this.#Vs}enable(){this.#Vs=!0,void 0!==this.#qs&&(this.#Bs(!0),this.#qs.getLayer()&&this.#qs.getLayer().draw())}disable(){this.#Vs=!1,void 0!==this.#qs&&(this.#Bs(!1),this.#qs.getLayer()&&this.#qs.getLayer().draw())}reset(){this.#qs=void 0,this.#Us=void 0,this.#Ur=void 0}resetAnchors(){this.#Qs(),this.#Ns(),this.#Bs(!0)}#ks(e){void 0!==this.#qs&&this.#qs.getParent()&&this.#qs.getParent().find(".anchor").forEach(e)}#Bs(e){this.#ks(function(t){t.visible(e)})}setAnchorsActive(e){let t;t=e?e=>{this.#Gs(e)}:e=>{this.#zs(e)},this.#ks(t)}#Qs(){this.#ks(function(e){e.remove()})}#Ns(){if(void 0===this.#qs||!this.#qs.getLayer())return;if(void 0===this.#rs)return;const e=this.#qs.getParent(),t=this.#rs.getAnchors(this.#Ur,this.#an.getStyle());for(let n=0;n<t.length;++n)this.#Gs(t[n]),e.add(t[n])}#Gs(t){let n;t.on("dragstart.edit",e=>{e.cancelBubble=!0,n={mathShape:this.#Ur.mathShape,referencePoints:this.#Ur.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 m(-n.x(),-n.y()),new m(e.x-n.x(),e.y-n.y()))}(this.#Us.getBaseSize(),n),void 0!==this.#rs.constrainAnchorMove&&this.#rs.constrainAnchorMove(n,this.#Ur),this.#rs.updateAnnotationOnAnchorMove(this.#Ur,n),this.#rs.updateShapeGroupOnAnchorMove(this.#Ur,n,this.#an.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.#Ur);const o={mathShape:this.#Ur.mathShape,referencePoints:this.#Ur.referencePoints},r=new Il(this.#Ur,n,o,this.#Us.getDrawController());this.#an.getUndoController().addToUndoStack(r),this.#Ms({type:"annotationupdate",data:this.#Ur,dataid:this.#Us.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!"))})}#zs(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 ic{#Hs;constructor(){this.createTrashIcon()}createTrashIcon(){this.#Hs=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.#Hs.width(20),this.#Hs.height(20),this.#Hs.add(t),this.#Hs.add(n)}activate(e){const t=e.getKonvaStage(),n=t.scale(),i=e.getKonvaLayer(),o={x:1/n.x,y:1/n.y};this.#Hs.x(t.offset().x+t.width()/(2*n.x)),this.#Hs.y(t.offset().y+t.height()/(15*n.y)),this.#Hs.scale(o),i.add(this.#Hs),i.draw()}changeChildrenColourOnTrashHover(e,t,n){if(this.isOverTrash(e))return this.changeGroupChildrenColour(this.#Hs,"orange"),void this.changeGroupChildrenColour(t,"red");this.changeGroupChildrenColour(this.#Hs,"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.#Hs.remove()}isOverTrash(e){const t=this.#Hs.width()*Math.abs(this.#Hs.scaleX())/2,n=this.#Hs.height()*Math.abs(this.#Hs.scaleY())/2;return Math.abs(e.x-this.#Hs.x())<t&&Math.abs(e.y-this.#Hs.y())<n}}class oc extends EventTarget{#an;#Ys;#Hs;#Xs="pointer";#Ws;#$s;#Ms=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))};constructor(e){super(),this.#an=e,this.#Ys=new nc(e,this.#Ms),this.#Hs=new ic}setEditorShape(t,n){const i=n.getDrawController();if(t&&t instanceof e.Shape&&t!==this.#Ys.getShape()&&i.isAnnotationGroupEditable()){this.#Ys.disable();const e=t.getParent().id();this.#Ys.setShape(t,n,i.getAnnotation(e)),this.#Ms({type:"annotationselect",annotationid:e,dataid:n.getDataId()}),this.#Ys.enable()}}getEditorShapeGroup(){let t;if(!this.#Ys.isActive()||(t=this.#Ys.getShape().getParent(),t instanceof e.Group))return t}getEditorAnnotation(){let e;return this.#Ys.isActive()&&(e=this.#Ys.getAnnotation()),e}disableAndResetEditor(){this.#Ys.disable(),this.#Ys.reset()}#js(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.#Xs=e}#Zs(){this.#Ws=document.body.style.cursor,document.body.style.cursor=this.#Xs,this.#$s.opacity(.75)}onMouseOutShapeGroup(){void 0!==this.#Ws&&(document.body.style.cursor=this.#Ws,this.#Ws=void 0),void 0!==this.#$s&&this.#$s.opacity(1)}#_s(e){e.on("mouseover",()=>{this.#$s=e,this.#Zs()}),e.on("mouseout",()=>{this.onMouseOutShapeGroup(),this.#$s=void 0})}#Ks(e){e.off("mouseover"),e.off("mouseout")}addShapeGroupListeners(e,t,n){this.#_s(e),this.#Js(e,t,n),this.#el(e,t,n),e.on("dblclick",()=>{const e=t.textExpr,i=t=>{const i=t.textExpr,o=new Il(t,{textExpr:e},{textExpr:i},n.getDrawController());this.#an.getUndoController().addToUndoStack(o),o.execute()};void 0!==_e.openRoiDialog?_e.openRoiDialog(t,i):function(e,t){const n=prompt("Label",e.textExpr);null!==n&&(e.textExpr=n,t(e))}(t,i)})}#Js(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.#Hs.activate(i),this.#Ys.setAnchorsActive(!1),o.draw()}),r.on("dragmove.draw",e=>{const a=function(e,t){return{min:new m(0,0),max:new m(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.#an.getStyle()),h.updateConnector(n,t);const g=Ao(e.evt),S={x:g.getX(),y:g.getY()},p=this.#js(S,i);this.#Hs.changeChildrenColourOnTrashHover(p,t,c),o.draw()}),r.on("dragend.draw",e=>{const s=this.#an.getUndoController();if(this.#Hs.remove(),void 0===e||void 0===e.evt)return;const u=r.x(),d=r.y(),h=Ao(e.evt),g={x:h.getX(),y:h.getY()},S=this.#js(g,i);if(this.#Hs.isOverTrash(S)){t.x(a.x),t.y(a.y),this.#Ys.disable(),this.#Ys.reset(),this.#Hs.changeGroupChildrenColour(t,c),n.mathShape=l.mathShape,n.referencePoints=l.referencePoints;const e=new yl(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 Il(n,l,e,i.getDrawController());s.addToUndoStack(t),this.#Ms({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:Object.keys(e)}),l={mathShape:e.mathShape,referencePoints:e.referencePoints}}this.#Ys.setAnchorsActive(!0),this.#Ys.resetAnchors()}o.draw(),a={x:r.x(),y:r.y()}})}#el(t,n,i){const o=t.getChildren(ca)[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.#an.getUndoController(),t=o.x()-r.x,s=o.y()-r.y;if(0!==t||0!==s){const t=new m(o.x(),o.y());n.labelPosition=t;const r=new Il(n,{labelPosition:a},{labelPosition:t},i.getDrawController());e.addToUndoStack(r),this.#Ms({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:["labelPosition"]}),a=t}r={x:o.x(),y:o.y()}})}removeShapeListeners(t){this.#Ks(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(ca)[0];i instanceof e.Label&&(i.draggable(!1),i.off("dragstart.draw"),i.off("dragend.draw"))}}class rc{mask;dataId;offsetsLists;mode;segmentNumber;srclayerid;originalValuesLists;isSilent}class ac extends qa{#tl;#nt;#nl;#il;#ol;#rl;#al;#sl;#ll;#cl;constructor(e){super(),this.#tl=e.mask,this.#nt=e.dataId,this.#nl=e.offsetsLists,this.#il=e.mode,this.#ol=e.segmentNumber,this.#rl=e.srclayerid,void 0!==e.originalValuesLists&&(this.#al=e.originalValuesLists),this.#sl=e.isSilent??!1,this.#ll="del"===this.#il?"brushremove":"brushdraw",this.#cl="brushdraw"===this.#ll?"brushremove":"brushdraw"}getOriginalValuesLists(){return this.#al}getExecuteEvent(){const e="brushdraw"===this.#ll?this.#ol:void 0;return new CustomEvent(this.#ll,{detail:{segmentnumber:e,dataid:this.#nt,srclayerid:this.#rl}})}getName(){return"Draw-brush"}execute(){if(void 0===this.#ol)return;let e=this.#ol;"brushremove"===this.#ll&&(e=0),void 0===this.#al?this.#al=this.#tl.setAtOffsetsAndGetOriginals(this.#nl,e):this.#tl.setAtOffsetsWithIterator(this.#nl,e),this.#sl||this.onExecute(this.getExecuteEvent())}undo(){void 0===this.#al?this.#al=this.#tl.setAtOffsetsAndGetOriginals(this.#nl,0):this.#tl.setAtOffsetsWithIterator(this.#nl,this.#al);const e="brushdraw"===this.#cl?this.#ol:void 0,t=new CustomEvent(this.#cl,{detail:{segmentnumber:e,dataid:this.#nt,srclayerid:this.#rl}});this.onUndo(t)}onExecute(e){}onUndo(e){}}const sc="No source image to create mask",lc="No source image to get offsets, ID: {0}",cc="No brush origins",uc="No mask defined when adding mask slices",dc="No created mask image",hc="No mask image for temporary draw command, ID: {0}",gc="No mask image to get offsets from",Sc="No mask image for draw command, ID: {0}",pc="No mask ID to apply mask index",mc="No mask view layers",fc="No selected segment number",vc="Too many mask view layers: {0}",Cc="More mask layers than expected",Dc="Cannot display mask with no mask ID",yc="Cannot draw with no mask data ID",Ic="Cannot draw with no offsets",wc="Cannot draw with no colour list",Tc="Cannot get mask layers with no mask ID",Lc="Cannot get mask view controller: no mask ID",Pc="Cannot get mask view controller: no mask layers",Ac="Cannot find source data for an existing mask, ID: {0}",Oc="Unsupported scroll index: {0}";function bc(e,...t){return e.replace(/{(\d+)}/g,(e,n)=>t[n]||"")}const xc="del";function Ec(e,t,n,i){return pr(e.worldToIndex(t),n,i)}class Rc extends EventTarget{#an;#ul=10;#dl={min:1,max:20};#hl="del";#gl;#tl;#Sl;#_a;#pl=0;#ml;#fl;constructor(e){super(),this.#an=e.app}#vl(e){const t=this.#dl.min,n=this.#dl.max;return Math.min(Math.max(e,t),n-1)}getBrushSize(){return this.#ul}getBrushMode(){return this.#hl}getSelectedSegmentNumber(){return this.#gl}setBrushMode(e){this.setFeatures({brushMode:e})}setFeatures(e){if(void 0!==e.brushSizeRange&&(this.#dl=e.brushSizeRange,this.#ul=this.#vl(this.#ul)),void 0!==e.brushSize&&(this.#ul=this.#vl(e.brushSize)),void 0!==e.brushSizeAdd){const t=this.#vl(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.#hl=e.brushMode),void 0!==e.selectedSegmentNumber&&(this.#gl=e.selectedSegmentNumber),e.createMask?this.#Sl=void 0:void 0!==e.maskDataId&&(this.#Sl=e.maskDataId)}#Cl(e,t,n){const i=e.getSize().getValues();i[2]=1;const o=new Dt(i),r=new Pt([t],o,e.getSpacing(),e.getOrientation()),a=new Uint8Array(o.getDimSize(2));a.fill(0),++this.#pl;const s=[this.#pl.toString()],l=new lo(r,a,s);return l.setMeta(n),l.setPhotometricInterpretation("PALETTE COLOR"),l.setPaletteColourMap(new je([0],[0],[0])),l}#Dl(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],p=r.get3D().getDistance(S);p>h&&s.warn(`Large distance between origin and origin for first index: ${p}`);const m=u.get3D().getClosest(d),f=d[m],v=u.get3D().getDistance(f);return v>h&&s.warn(`Large distance between origin and origin for last index: ${v}`),[g,m]}(e,Ec(e,n,o,i));if(void 0===l||0===l.length)throw new Error(cc);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.#tl)throw new Error(uc);const p=this.#tl.getMeta();for(const e of S)p.numberOfFiles+=1,this.#tl.appendSlice(this.#Cl(t,e,r))}#yl(e,t){if(!t)throw new Error(bc(sc));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=$i(),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(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.#tl=this.#Cl(n,r,s),this.#tl.setupSegmentCollection();const h=vi(s),g=new As(h);g.image=this.#tl;const S=this.#an.getDataController(),p=S.getNextDataId();if(!S.add(p,g))throw new Error("Cannot add mask data");return p}#Il(e){const t=this.#an.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}#wl(e){if(void 0===this.#Sl)throw new Error(Dc);const t=new $c(e);t.orientation=this.#Il(e);const n=this.#an.getStageController();n.addDataViewConfig(this.#Sl,t),n.render(this.#Sl)}#Tl(e){const t=e.getMaskReferencedSeriesUID();let n;return"undefined"!==t&&(n=this.#an.getDataController().getDataIdFromSeriesUid(t)),void 0===n&&s.warn(bc(Ac,t)),n}#Ll(e){if(void 0===this.#Sl)throw new Error(Tc);const t=e.getViewLayersByDataId(this.#Sl);if(0===t.length)throw new Error(mc);return 1!==t.length&&s.warn(bc(vc,t.length)),t[0]}#Pl(e){if(void 0===e)throw new Error(pc);const t=this.#an.getDataController().get(e);if(void 0===t)throw new Error(gc);return t.image}#Al(e,t){if(void 0===t)throw new Error("No layergroup to get mask offsets");let n;if(this.#_a=t,n=void 0===this.#Sl?t.getBaseViewLayer():t.getViewLayersByDataId(this.#Sl)[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.#tl=this.#Pl(this.#Sl);const t=this.#Tl(this.#tl),o=this.#an.getDataController().get(t);if(!o)throw new Error(bc(lc,t));if(c=o.image,c.isResampled())return s.warn("Cannot update mask with resampled reference image."),[];const u=this.#an.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.#an.getDataController().get(u);if(!d)throw new Error(bc(lc,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.#Sl=this.#yl(o,c),void 0===this.#tl)throw new Error(dc);const g=t.getDivId(),S=void 0!==g;S&&this.#wl(g),r=this.#Ll(t),a=r.getViewController(),S&&a.setCurrentPosition(o)}const u=c.getGeometry(),d=this.#tl.getMeta(),h=this.#tl.getGeometry(),g=i.get2DSpacing(),S=[Math.round(this.#ul/g.x),Math.round(this.#ul/g.y)];let p;const m=i.getScrollDimIndex();switch(m){case 0:p=[1,2];break;case 1:p=[0,2];break;case 2:p=[0,1];break;default:throw new Error(bc(Oc,m))}this.#Dl(u,h,l,p,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,Ec(h,a.getPositionFromPlanePoint(f),S,p))}#Ol(e){const t=this.#bl().getId();if(void 0===this.#Sl)throw new Error(pc);const n=this.#an.getDataController().get(this.#Sl);if(!n)throw new Error(bc(hc,this.#Sl));const i=new rc;i.mask=n.image,i.dataId=this.#Sl,i.offsetsLists=[e],i.mode=this.#hl,i.segmentNumber=this.#gl,i.srclayerid=t;const o=new ac(i);o.execute();const r=o.getOriginalValuesLists();if(void 0!==r)return r[0]}beginStroke(e,t){this.#ml=[],this.#fl=[];const n=this.#Al(e,t);if(n.length>0){this.#ml.push(n);const e=this.#Ol(n);return void 0!==e&&this.#fl.push(e),!0}return!1}paintStep(e,t){const n=this.#Al(e,t);if(n.length>0){this.#ml.push(n);const e=this.#Ol(n);void 0!==e&&this.#fl.push(e)}}finalizeStroke(){if(void 0===this.#Sl)throw new Error(yc);if(void 0===this.#ml)throw new Error(Ic);if(void 0===this.#fl)throw new Error(wc);this.#ml.reverse(),this.#fl.reverse();const e=this.#bl().getId(),t=this.#an.getDataController().get(this.#Sl);if(!t)throw new Error(bc(Sc,this.#Sl));const n=new rc;n.mask=t.image,n.dataId=this.#Sl,n.offsetsLists=this.#ml,n.mode=this.#hl,n.segmentNumber=this.#gl,n.srclayerid=e,n.originalValuesLists=this.#fl;const i=new ac(n);i.onExecute=e=>{this.dispatchEvent(e)},i.onUndo=e=>{this.dispatchEvent(e),this.#tl.recalculateLabels()},this.#an.getUndoController().addToUndoStack(i),this.dispatchEvent(i.getExecuteEvent()),this.#tl.recalculateLabels()}#bl(){if(void 0===this.#Sl)throw new Error(Lc);if(void 0===this.#_a)throw new Error("No current layer group");const e=this.#_a.getViewLayersByDataId(this.#Sl);if(0===e.length)throw new Error(Pc);return 1!==e.length&&s.warn(Cc),e[0]}}const Fc=["brushsizechange","brushdraw","brushremove"];class Mc extends Vl{#an;#xl;#El=!1;#Rl=[];constructor(e){super(),this.#an=e,this.#xl=new Rc({app:e});for(const e of Fc)this.#xl.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}setFeatures(e){void 0!==e.blacklist&&(this.#Rl=e.blacklist),this.#xl.setFeatures(e)}canStart(e,t){return!(!this.#Fl(t)||this.#Ml(t)||(this.#re(t)?(s.warn("Cannot paint on series with overlapping slices"),1):void 0===this.#xl.getSelectedSegmentNumber()&&(s.warn(fc),1)))}onStart(e,t,n){super.onStart(e,t,n);const i=this.#xl.getBrushSize()/2;this.setDragThreshold({x:i,y:i}),this.#El=!1,2===n?.mouseDownButton&&this.#ql(),this.#xl.beginStroke(e,t)||(this.#Ul(),super.onEnd())}onDrag(e,t){const n=this.prevPoint;void 0!==n&&this.#xl.paintStep(n,t)}onEnd(){this.isActive()&&(this.#xl.finalizeStroke(),this.#Ul()),super.onEnd()}reset(){this.isActive()&&(this.#xl.finalizeStroke(),this.#Ul()),super.reset()}#Fl(e){if(void 0===e)throw new Error("No layergroup to check for view layer");return e.getActiveLayer()instanceof Cl}#Ml(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.#an.getDataController().get(t).image.getMeta().SeriesInstanceUID;if(this.#Rl.includes(n))return!0}return!1}#re(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();return this.#an.getDataController().get(n).image.getHasOverlap()}#ql(){this.#El=!0,this.#xl.setBrushMode(xc),this.dispatchEvent(new CustomEvent("erasingactivated"))}#Ul(){this.#El&&this.#xl.getBrushMode()===xc&&(this.#xl.setBrushMode("add"),this.dispatchEvent(new CustomEvent("erasingdeactivated"))),this.#El=!1}}class qc extends Vl{#an;#Ur;#Vl;#Ql;#Nl=[];#Bl;#kl=10;#Gl=5;#zl=0;#Hl=2e3;#Yl=[];#ns;#Ds;constructor(e,t,n){super(),this.#an=e,this.#ns=t,this.#Ds=n}setFeatures(e){this.#Ds.setFeatures(e)}#Xl(e){const t=e.getActiveDrawLayer();if(void 0!==t)return e.getViewLayerById(t.getReferenceLayerId());s.warn("No draw layer to do floodfill")}#Wl=(e,t)=>{const n=this.#Xl(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)}};#$l(e,t,i){this.#Yl=[];const o={data:this.#Ql?.data,width:this.#Ql?.width,height:this.#Ql?.height,bytes:4},r=n.floodFill(o,e.x,e.y,t),a=n.gaussBlurOnlyBorder(r,this.#Gl);let s=n.traceContours(a);if(s=n.simplifyContours(s,this.#zl,this.#Hl),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.#Yl.push(new m(s[0].points[e].x,s[0].points[e].y));return this.#Yl}return[]}#jl(e,t,n){if(this.#Nl=this.#$l(e,t,!1),0!==this.#Nl.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 hr(this.#Nl);let o;if(void 0===this.#Ur){this.#Ur=new os,this.#Ur.colour=this.#ns.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.#Ur.init(a),this.#Ur.mathShape=i,o=new Dl(this.#Ur,t)}else{const e=this.#Ur.mathShape;o=new Il(this.#Ur,{mathShape:e},{mathShape:i},t)}this.#an.getUndoController().addToUndoStack(o),o.execute()}return 0!==this.#Nl.length}#Zl(e){const t=e.getBaseViewLayer().getDataId();return this.#an.getDataController().get(t).image.isResampled()}#ys(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Ds.checkCanEdit(n)?this.#Ds.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.#Zl(t))return;if(!this.isActive()&&this.#ys(e,t))return;let i;this.#Ur=void 0;let o=t.getActiveDrawLayer();if(void 0===o){i=t.getActiveViewLayer();const e=i.getDataId(),n=this.#an.createAnnotationData(e),r=t.getDivId().replace("-layer-0","");this.#an.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.#Ql=i.getImageData(),void 0!==this.#Ql?(this.#ns.setZoomScale(o.getKonvaLayer().getAbsoluteScale()),this.#Vl=this.#Wl(e,t),this.#jl(this.#Vl,this.#kl,t),super.onStart(e,t,n)):s.error("No image info found")}onUpdate(e,t){if(!this.isActive())return;const n=this.#Wl(e,t);this.#Bl=Math.round(Math.sqrt(Math.pow(this.#Vl.x-n.x,2)+Math.pow(this.#Vl.y-n.y,2))/2),this.#Bl=this.#Bl<this.#kl?this.#kl:this.#Bl-this.#kl,this.#jl(this.#Vl,this.#Bl,t),super.onUpdate(e,t)}}class Uc{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 Vc{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 Qc=2/(3*Math.PI);function Nc(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 Bc{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++){Nc(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};Nc(e,t,n,i,a),Nc(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),Qc*(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}#_l=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 Vc(this.searchGranBits,this.#_l),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 kc extends Wl{#an;#ns;#Ya;#Ur;#Kl=new Uc;#Jl=new Uc;#Yl=[];#ec=5;#tc=new Bc;#Ds;constructor(e,t,n){super(),this.#an=e,this.#ns=t,this.#Ds=n,super.setNumberOfTaps(500)}setFeatures(e){this.#Ds.setFeatures(e)}#nc(e){const t=e.get(1);for(let e=0;e<t;++e)this.#Yl[e]=[]}#ic(){this.#Kl=new Uc,this.#Jl=new Uc}#Zl(e){const t=e.getBaseViewLayer().getDataId();return this.#an.getDataController().get(t).image.isResampled()}#ys(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Ds.checkCanEdit(n)?this.#Ds.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.#Zl(t))return;if(!this.isActive()&&this.#ys(e,t))return;let n,i=t.getActiveDrawLayer();n=void 0===i?t.getActiveViewLayer():t.getViewLayerById(i.getReferenceLayerId());const o=n.getViewController().getImageSize();this.#tc.setDimensions(o.get(0),o.get(1)),this.#tc.setData(n.getImageData().data);const r=n.displayToPlaneIndex(e);if(this.isActive()){const e=Math.abs(r.get(0)-this.#Ya.getX()),t=Math.abs(r.get(1)-this.#Ya.getY());if(e<this.#ec&&t<this.#ec)this.onEnd();else{this.#Kl=this.#Jl,this.#nc(o);const e={x:r.get(0),y:r.get(1)};this.#tc.doTraining(e),this.#Kl.addControlPoint(this.#Jl.getPoint(0))}}else{if(this.#Ur=void 0,this.#Ya=new m(r.get(0),r.get(1)),this.#ic(),this.#nc(o),void 0===i){const e=n.getDataId(),o=this.#an.createAnnotationData(e);this.#an.addAndRenderAnnotationData(o,t.getDivId(),e),i=t.getActiveDrawLayer(),i.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(i.getDataId())}this.#ns.setZoomScale(i.getKonvaLayer().getAbsoluteScale());const e={x:r.get(0),y:r.get(1)};this.#tc.doTraining(e);const a=new m(r.get(0),r.get(1));this.#Kl.addPoint(a),this.#Kl.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.#tc.setPoint(a);let l=!1;for(;!this.#Yl[a.y][a.x]&&!l;)if(r=this.#tc.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.#Yl[t.y][t.x]=n}for(this.#Jl=new Uc,l=!1;a&&!l;)this.#Jl.addPoint(new m(a.x,a.y)),this.#Yl[a.y]&&this.#Yl[a.y][a.x]?a=this.#Yl[a.y][a.x]:l=!0;this.#Jl.appenPath(this.#Kl);const c=n.getDrawController(),u=new hr(this.#Jl.pointArray);let d;if(void 0===this.#Ur){this.#Ur=new os,this.#Ur.colour=this.#ns.getLineColour();const e=i.getViewController();this.#Ur.init(e),this.#Ur.mathShape=u,d=new Dl(this.#Ur,c)}else{const e=this.#Ur.mathShape;d=new Il(this.#Ur,{mathShape:e},{mathShape:u},c)}this.#an.getUndoController().addToUndoStack(d),d.execute(),super.onUpdate(e,t)}reset(){this.#Ur=void 0,this.#ic(),this.#Yl=[],super.reset()}}const Gc={},zc={WindowLevel:class extends Ml{#an;#Aa;#Ea;constructor(e){const t=new Ql,n=new zl({dataController:e.getDataController()});super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new ol,doubleClickBehavior:n}),this.#an=e,this.#Aa=t,this.#Ea=n}keydown=e=>{e.context="WindowLevel",this.#an.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){void 0!==e.strictViewLayer&&(s.warn("strictViewLayer is deprecated, use activeViewLayerOnly instead"),this.#Aa.setActiveViewLayerOnly(e.strictViewLayer),this.#Ea.setActiveViewLayerOnly(e.strictViewLayer)),void 0!==e.activeViewLayerOnly&&(this.#Aa.setActiveViewLayerOnly(e.activeViewLayerOnly),this.#Ea.setActiveViewLayerOnly(e.activeViewLayerOnly))}},Scroll:class extends Ml{#an;#oc;constructor(e){const t=new Xl;super({stageController:e.getStageController(),dragBehavior:new Nl,hoverBehavior:t,wheelBehavior:new ol,doubleClickBehavior:new Hl,tapBehavior:new $l}),this.#an=e,this.#oc=t}keydown=e=>{e.context="Scroll",this.#an.onKeydown(e)};activate(e){e||this.cancel()}setFeatures(e){void 0!==e.displayTooltip&&this.#oc.setTooltipEnabled(Boolean(e.displayTooltip))}init(){}},ZoomAndPan:class extends Ml{#an;constructor(e){super({stageController:e.getStageController(),dragBehavior:new kl,wheelBehavior:new rl,twoTouchBehavior:new Zl,tapBehavior:new $l}),this.#an=e}keydown=e=>{e.context="ZoomAndPan",this.#an.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Opacity:class extends Ml{#an;constructor(e){super({stageController:e.getStageController(),dragBehavior:new Bl,wheelBehavior:new ol}),this.#an=e}keydown=e=>{e.context="Opacity",this.#an.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Draw:class extends Ml{#an;#Ds;#rc;#ac;#Hr;constructor(e){const t=new oc(e),n=new tc(e,t),i=new Jl(e,n),o=new ec(e,n);super({stageController:e.getStageController(),dragBehavior:o,tapBehavior:i,wheelBehavior:new ol}),this.#an=e,this.#Ds=n,this.#rc=o,this.#ac=i,this.#Hr=t;for(const e of this.getEventNames())this.#rc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}),this.#ac.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}),this.#Hr.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{this.#ac.isActive()||(e.context="Draw",this.#an.onKeydown(e));const t=this.#Hr.getEditorAnnotation();if(("Delete"===e.key||"Backspace"===e.key)&&void 0!==t){const e=this.#an.getStageController().getActiveLayerGroup().getActiveDrawLayer();if(void 0===e)return void s.warn("No draw layer to handle key down");const n=e.getDrawController(),i=this.#an.getUndoController(),o=new yl(t,n);i.addToUndoStack(o),o.execute(),this.#Hr.onMouseOutShapeGroup()}"Escape"===e.key&&(this.#rc.resetPlacement(),this.#ac.resetPlacement(),this.#Ds.disableAndResetEditor())};activate(e){e||this.cancel(),this.#Ds.activate(e)}setOptions(e){this.#rc.setOptions(e),this.#ac.setOptions(e)}getOptionsType(){return"factory"}setFeatures(e){void 0!==e.mouseOverCursor&&this.#Hr.storeMouseOverCursor(e.mouseOverCursor),this.#rc.setFeatures(e),this.#ac.setFeatures(e)}init(){}getEventNames(){return["annotationupdate","annotationselect","warn"]}hasShape(e){return this.#ac.hasShape(e)}},Brush:class extends Ml{#sc;#an;constructor(e){const t=new Mc(e);super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new ol,longTouchToDblClickMs:null}),this.#sc=t,this.#an=e;for(const e of this.getEventNames())this.#sc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{e.context="Brush",this.#an.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.#sc.setFeatures({brushMode:xc}):this.#sc.setFeatures({brushMode:"add"})):this.#sc.setFeatures({brushSizeAdd:-1}):this.#sc.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.#an.getStageController().getDataViewConfigs());e?this.#lc(t):(this.cancel(),this.#cc(t))}#lc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",e=>{e.preventDefault(),e.stopPropagation()})}}#cc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",e=>{})}}setFeatures(e){this.#sc.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:Qa,Floodfill:class extends Ml{#an;#Ds;#Aa;#ns=new ho;constructor(e){const t=new ho,n=new oc(e),i=new tc(e,n),o=new qc(e,t,i);super({stageController:e.getStageController(),dragBehavior:o,wheelBehavior:new ol}),this.#an=e,this.#Ds=i,this.#Aa=o,this.#ns=t}keydown=e=>{e.context="Floodfill",this.#an.onKeydown(e),"Escape"===e.key&&this.#Ds.disableAndResetEditor()};activate(e){if(e){const e=this.#an.getStageController().getActiveLayerGroup();this.#ns.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#ns.getLineColour()})}else this.cancel();this.#Ds.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#ns.setLineColour(e.shapeColour),this.#Aa.setFeatures(e)}},Livewire:class extends Ml{#an;#Ds;#Fa;#ns;constructor(e){const t=new ho,n=new oc(e),i=new tc(e,n),o=new kc(e,t,i);super({stageController:e.getStageController(),tapBehavior:o,wheelBehavior:new ol}),this.#an=e,this.#Ds=i,this.#Fa=o,this.#ns=t}keydown=e=>{e.context="Livewire",this.#an.onKeydown(e),"Escape"===e.key&&this.#Ds.disableAndResetEditor()};activate(e){if(e){const e=this.#an.getStageController().getActiveLayerGroup();this.#ns.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#ns.getLineColour()})}else this.cancel();this.#Ds.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#ns.setLineColour(e.shapeColour),this.#Fa.setFeatures(e)}}},Hc={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 Ge(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 D(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 f(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 Yc{#uc=[];#dc;#wr=!1;#hc=[];#ut=null;getLayerGroup(e){return this.#uc[e]}getNumberOfLayerGroups(){return this.#uc.length}getActiveLayerGroup(){return this.getLayerGroup(this.#dc)}setActiveLayerGroup(e){void 0!==this.getLayerGroup(e)?this.#dc=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.#dc=this.#uc.length;const n=new Rl(e,t);n.setImageSmoothing(this.#wr);const i=this.#ut&&0!==this.#ut.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.#hc.length&&this.unbindLayerGroups(),this.#hc=e.slice(),this.bindLayerGroups()}empty(){this.unbindLayerGroups();for(const e of this.#uc)e.empty();this.#uc=[],this.#dc=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.#dc===t&&(this.#dc=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.#hc.length){this.#ut=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.#hc.length;++t)this.#gc(e,this.#hc[t])}}unbindLayerGroups(){if(0!==this.#uc.length&&0!==this.#hc.length&&this.#ut){for(let e=0;e<this.#uc.length;++e)if(this.#uc[e].shouldBind())for(let t=0;t<this.#hc.length;++t)this.#Sc(e,this.#hc[t]);this.#ut=null}}setImageSmoothing(e){this.#wr=e;for(const t of this.#uc)t.setImageSmoothing(e)}#pc(e,t){if(!this.#ut)return;void 0===this.#ut[t]&&(this.#ut[t]=[]);let n=this.#ut[t].find(function(t){return t.binder===e});return void 0===n&&(n={binder:e,callback:n=>{this.#Sc(t,e),e.getCallback(this.#uc[t])(n),this.#gc(t,e)}},this.#ut[t].push(n)),n.callback}#gc(e,t){for(let n=0;n<this.#uc.length;++n)n!==e&&this.#uc[n].shouldBind()&&this.#uc[e].addEventListener(t.getEventType(),this.#pc(t,n))}#Sc(e,t){if(this.#ut)for(const n in this.#ut)if(parseInt(n,10)!==e)for(const i of this.#ut[n])i.binder.getEventType()===t.getEventType()&&this.#uc[e].removeEventListener(t.getEventType(),i.callback)}}const Xc=["viewlayeradd","drawlayeradd","error","zoomchange","offsetchange","layerremove","outofrange","renderstart","renderend",...dl];class Wc extends EventTarget{#mc=null;#ja;#Mi;#fc;#vc;#Cc;constructor(e,t){super(),this.#ja=e,this.#Mi=t,this.#mc=new Yc,void 0!==t.binders&&this.#mc.setBinders(t.binders)}setToolboxController(e){this.#fc=e}setAddToUndoStack(e){this.#vc=e}setGetInfoData(e){this.#Cc=e}getViewConfigs(e,t){if(void 0===t&&(t=!1),null===this.#Mi.dataViewConfigs||void 0===this.#Mi.dataViewConfigs)throw new Error("No available data view configuration");let n=[];return void 0!==this.#Mi.dataViewConfigs[e]?n=this.#Mi.dataViewConfigs[e]:t||void 0===this.#Mi.dataViewConfigs["*"]||(n=this.#Mi.dataViewConfigs["*"]),n}getViewConfig(e,t,n){return this.getViewConfigs(e,n).find(function(e){return e.divId===t})}getDataViewConfigs(){return this.#Mi.dataViewConfigs}setDataViewConfigs(e){this.#mc.empty(),this.#Mi.dataViewConfigs=e,this.#Dc(e)}addDataViewConfig(e,t,n){void 0===n&&(n=!0);const i=this.#Mi.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.#Mi.dataViewConfigs[e].push(t),void 0===this.#mc.getLayerGroupByDivId(t.divId)&&this.#yc(t),void 0!==this.#ja.get(e)&&n&&this.render(e,[t])}removeDataViewConfig(e,t){const n=this.#Mi.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.#mc.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.#mc.removeLayerGroup(o)}}updateDataViewConfig(e,t,n){const i=this.#Mi.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.#mc.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.#ja.get(e)&&this.render(e,[r])}getActiveLayerGroup(){return this.#mc.getActiveLayerGroup()}setActiveLayerGroup(e){this.#mc.setActiveLayerGroup(e)}getLayerGroup(e){return this.#mc.getLayerGroup(e)}getNumberOfLayerGroups(){return this.#mc.getNumberOfLayerGroups()}getViewLayersByDataId(e){return this.#mc.getViewLayersByDataId(e)}getViewLayers(e){return this.#mc.getViewLayers(e)}getDrawLayersByDataId(e){return this.#mc.getDrawLayersByDataId(e)}getDrawLayers(e){return this.#mc.getDrawLayers(e)}getLayerGroupByDivId(e){return this.#mc.getLayerGroupByDivId(e)}getAddedScale(){return this.#mc.getActiveLayerGroup().getAddedScale()}getBaseScale(){return this.#mc.getActiveLayerGroup().getBaseScale()}getOffset(){return this.#mc.getActiveLayerGroup().getOffset()}empty(){this.#mc.empty()}removeLayersByDataId(e){this.#mc.removeLayersByDataId(e)}setBinders(e){this.#mc.setBinders(e)}fitToContainer(){this.#mc.fitToContainer()}draw(){this.#mc.draw()}resetLayout(){this.#mc.reset(),this.#mc.draw()}resetZoomPan(){this.#mc.resetZoomPan(),this.#mc.draw()}resetViews(){this.#mc.resetViews()}setImageSmoothing(e){this.#mc.setImageSmoothing(e),this.#mc.draw()}zoom(e,t,n){const i=this.#mc.getActiveLayerGroup(),o=i.getBaseViewLayer().getViewController().getCurrentScrollPosition(),r=new f(t,n,o);i.addScale(e,r),i.draw()}translate(e,t){const n=this.#mc.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.#ja.get(e),i=void 0!==n&&void 0!==n.image,o=void 0!==n&&void 0!==n.annotationGroup;if(0===this.#mc.getNumberOfLayerGroups()&&this.#Dc(this.#Mi.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.#mc.getLayerGroupByDivId(r.divId);if(!a)throw new Error(`No layer group for ${r.divId}`);!i||this.#Ic(e,a)?(i&&0===a.getViewLayersByDataId(e).length?this.#wc(e,r):o&&0===a.getDrawLayersByDataId(e).length&&this.#Tc(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)`)}#Lc=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#Dc(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.#yc(t),n.push(t.divId))}}}#yc(e){const t=this.#Mi.rootDocument.getElementById(e.divId),n=void 0!==this.#Mi.overlayConfig,i=this.#mc.addLayerGroup(t,n);this.#Pc(i)}#Pc(e){e.addEventListener("zoomchange",this.#Lc),e.addEventListener("offsetchange",this.#Lc),e.addEventListener("layerremove",this.#Lc),e.addEventListener("outofrange",this.#Lc),e.addEventListener("renderstart",this.#Lc),e.addEventListener("renderend",this.#Lc);for(const t of dl)e.addEventListener(t,this.#Lc);e.addEventListener("wlchange",e=>{const t=e.detail?.srclayerid,n=e.detail?.dataid,i=e.detail?.value,o=bl(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=bl(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=bl(t).groupDivId,r=this.getViewConfig(n,o,!0);void 0!==r&&(r.colourMap=i[0])})}#Ic(e,t){let n=!1;const i=t.getBaseViewLayer();if(void 0!==i){const t=this.#ja.get(i.getDataId()).image,o=this.#ja.get(e).image;if(void 0!==t&&void 0!==o){const e=t.getGeometry().getOrientation();n=o.getGeometry().getOrientation().isSimilarProgressive(e,Lt)}}else n=!0;return n}#wc(e,t){const n=this.#ja.get(e);if(!n)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const i=this.#mc.getLayerGroupByDivId(t.divId);if(!i)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const o=n.image.getGeometry();this.#mc.unbindLayerGroups();const r=(new cl).create(n.meta,n.image),a=lt(o.getOrientation(),it(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 Ge(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.#ja.addEventListener("dataimageset",c.onimageset),s&&void 0!==this.#Mi.overlayConfig&&void 0!==this.#Cc&&(i.addInfoData(this.#Cc(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.#mc.fitToContainer(),c.setOffset(i.getOffset());const S=this.#Ac(o.getOrientation(),t.orientation);if(this.#Oc(S,c),s)c.setScale(i.getScale());else{const e=i.getBaseViewLayer();c.initScale(i.getScale(),e.getAbsoluteZoomOffset())}this.#mc.bindLayerGroups(),this.#fc&&this.#fc.bindLayerGroup(i,c),this.dispatchEvent(new CustomEvent("viewlayeradd",{detail:{layerid:c.getId(),layergroupid:i.getDivId(),dataid:e}})),s&&this.#fc&&this.#fc.init()}#Tc(e,t){const n=this.#mc.getLayerGroupByDivId(t.divId);if(!n)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const i=this.#ja.get(e);if(!i)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const o=i.annotationGroup,r=this.#bc(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.#mc.unbindLayerGroups();const s=r.getViewController();i.annotationGroup.setViewController(s);const l=this.#ja.get(a);if(!l)throw new Error(`Cannot initialise layer without reference data, id: ${a}`);const c=l.image.getGeometry(),u=lt(c.getOrientation(),it(t.orientation)),d=c.getSize(u).get2D(),h=c.getSpacing(u).get2D(),g=n.addDrawLayer();g.initialise(d,h,r.getId());const S=new pl(c,u);g.setPlaneHelper(S);const p=[s.getCurrentIndex().getValues(),s.getCurrentPosition().getValues()];n.updateLayersToPositionChange(new CustomEvent("positionchange",{detail:{value:p,srclayerid:g.getId()}})),this.#mc.fitToContainer(),g.setOffset(n.getOffset());const m=this.#Ac(c.getOrientation(),t.orientation);this.#Oc(m,g),g.initScale(n.getScale(),r.getAbsoluteZoomOffset()),g.setAnnotationGroup(i.annotationGroup,e,this.#vc),g.setCurrentPosition(s.getCurrentPosition(),s.getCurrentIndex()),this.#mc.bindLayerGroups(),this.#fc&&this.#fc.bindLayerGroup(n,g),this.dispatchEvent(new CustomEvent("drawlayeradd",{detail:{layerid:g.getId(),layergroupid:n.getDivId(),dataid:e}}))}#bc(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}#Ac(e,t){const n=ot(e.asOneAndZeros());if(void 0===n)throw new Error("Unsupported undefined orientation code");const i=void 0===t,o=!i&&t===nt.Axial,r=!i&&t===nt.Coronal,a=!i&&t===nt.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}}#Oc(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 $c{divId;orientation;colourMap;opacity;fillOpacity;contourThickness;wlPresetName;windowCenter;windowWidth;constructor(e){this.divId=e}}class jc{options;constructor(e){this.options=e}}class Zc{dataViewConfigs;tools;binders;viewOnFirstLoadItem;defaultCharacterSet;overlayConfig;rootDocument;constructor(e){this.dataViewConfigs=e}}class _c extends EventTarget{#Mi=null;#ja=null;#fc=null;#xc=null;#Pa=null;#Ec=null;#ns=new ho;#ga={};getDataController(){return this.#ja}getData(e){return s.debug("App.getData: deprecated since v0.37, please use via app.getDataController."),this.#ja.get(e)}getImage(e){let t;return s.debug("App.getImage: deprecated since v0.34, please use the getData method."),void 0!==this.#ja.get(e)&&(t=this.#ja.get(e).image),t}setImage(e,t){s.debug("App.setImage: deprecated since v0.37, please use via app.getDataController."),this.#ja.setImage(e,t)}getNextDataId(){return s.debug("App.getNextDataId: deprecated since v0.37, please use via app.getDataController."),this.#ja.getNextDataId()}addData(e,t){return s.debug("App.addData: deprecated since v0.37, please use via app.getDataController."),this.#ja.add(e,t)}getMetaData(e){let t;return s.debug("App.getMetaData: deprecated since v0.37, please use via app.getDataController."),void 0!==this.#ja.get(e)&&(t=this.#ja.get(e).meta),t}getDataIds(){return s.debug("App.getDataIds: deprecated since v0.37, please use via app.getDataController."),this.#ja.getDataIds()}getDataIdsFromSopUids(e){return s.debug("App.getDataIdsFromSopUids: deprecated since v0.37, please use via app.getDataController."),this.#ja.getDataIdsFromSopUids(e)}getDataIdFromSeriesUid(e){return s.debug("App.getDataIdFromSeriesUid: deprecated since v0.37, please use via app.getDataController."),this.#ja.getDataIdFromSeriesUid(e)}canScroll(){return s.debug("App.canScroll: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Pa.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()}canWindowLevel(){return s.debug("App.canWindowLevel: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Pa.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()}getAddedScale(){return s.debug("App.getAddedScale: deprecated since v0.37, please access from the active layer group."),this.#Pa.getAddedScale()}getBaseScale(){return s.debug("App.getBaseScale: deprecated since v0.37, please access from the active layer group."),this.#Pa.getBaseScale()}getOffset(){return s.debug("App.getOffset: deprecated since v0.37, please access from the active layer group."),this.#Pa.getOffset()}getToolboxController(){return this.#fc}getStageController(){return this.#Pa}getUndoController(){return this.#Ec}getActiveLayerGroup(){return s.debug("App.getActiveLayerGroup: deprecated since v0.37, use app.getStageController().getActiveLayerGroup()"),this.#Pa.getActiveLayerGroup()}setActiveLayerGroup(e){s.debug("App.setActiveLayerGroup: deprecated since v0.37, use app.getStageController().setActiveLayerGroup()"),this.#Pa.setActiveLayerGroup(e)}getViewLayersByDataId(e){return s.debug("App.getViewLayersByDataId: deprecated since v0.37, use app.getStageController().getViewLayersByDataId()"),this.#Pa.getViewLayersByDataId(e)}getViewLayers(e){return s.debug("App.getViewLayers: deprecated since v0.37, use app.getStageController().getViewLayers()"),this.#Pa.getViewLayers(e)}getDrawLayersByDataId(e){return s.debug("App.getDrawLayersByDataId: deprecated since v0.37, use app.getStageController().getDrawLayersByDataId()"),this.#Pa.getDrawLayersByDataId(e)}getDrawLayers(e){return s.debug("App.getDrawLayers: deprecated since v0.37, use app.getStageController().getDrawLayers()"),this.#Pa.getDrawLayers(e)}getLayerGroupByDivId(e){return s.debug("App.getLayerGroupByDivId: deprecated since v0.37, use app.getStageController().getLayerGroupByDivId()"),this.#Pa.getLayerGroupByDivId(e)}getNumberOfLayerGroups(){return s.debug("App.getNumberOfLayerGroups: deprecated since v0.37, use app.getStageController().getNumberOfLayerGroups()"),this.#Pa.getNumberOfLayerGroups()}getStyle(){return this.#ns}addToUndoStack=e=>{s.debug("App.addToUndoStack: deprecated since v0.37, please use via app.getUndoController."),null!==this.#Ec&&this.#Ec.addToUndoStack(e)};removeFromUndoStack=e=>{s.debug("App.removeFromUndoStack: deprecated since v0.37, please use via app.getUndoController.");let t=!1;return null!==this.#Ec&&(t=this.#Ec.removeFromUndoStack(e)),t};init(e){this.#Mi=e,void 0===this.#Mi.viewOnFirstLoadItem&&(this.#Mi.viewOnFirstLoadItem=!0),void 0===this.#Mi.dataViewConfigs&&(this.#Mi.dataViewConfigs={}),void 0===this.#Mi.rootDocument&&"undefined"!=typeof document&&(this.#Mi.rootDocument=document),this.#xc=new Ws(this.#Mi.defaultCharacterSet),this.#xc.addEventListener("loadstart",this.#Rc),this.#xc.addEventListener("loaditem",this.#Fc),this.#xc.addEventListener("load",this.#Mc);for(const e of Xs)"loadstart"!==e&&"loaditem"!==e&&"load"!==e&&this.#xc.addEventListener(e,this.#Er);this.#ja=new bs;for(const e of Ls)this.#ja.addEventListener(e,this.#Er);for(const e of ro)this.#ja.addEventListener(e,this.#Er);for(const e of co)this.#ja.addEventListener(e,this.#Er);this.#Ec=new js;for(const e of $s)this.#Ec.addEventListener(e,this.#Er);this.#Pa=new Wc(this.#ja,this.#Mi),this.#Pa.setAddToUndoStack(e=>this.#Ec.addToUndoStack(e)),this.#Pa.setGetInfoData(e=>this.getInfoData(e));for(const e of Xc)this.#Pa.addEventListener(e,this.#Er);if(void 0!==this.#Mi.tools){const e={},t=Object.keys(this.#Mi.tools);for(let n=0;n<t.length;++n){const i=t[n];let o=zc[i];if(void 0===o&&(o=Gc[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.#Er)}const t=this.#Mi.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=Ga[l];void 0!==u&&(c=u[a]),void 0===c&&(u=za[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.#fc=new bo(e),this.#Pa.setToolboxController(this.#fc)}}reset(){this.#Pa.empty(),this.#ga={},this.#Ec&&this.#Ec.reset()}resetLayout(){s.debug("App.resetLayout: deprecated since v0.35, prefer resetZoomPan."),this.#Pa.resetLayout()}resetZoomPan(){s.debug("App.resetZoomPan: deprecated since v0.37, use app.getStageController().resetZoomPan()"),this.#Pa.resetZoomPan()}resetViews(){s.debug("App.resetViews: deprecated since v0.37, use app.getStageController().resetViews()"),this.#Pa.resetViews()}loadFiles=e=>{if(0===e.length)return s.warn("Ignoring empty input file list."),"-1";const t=this.#ja.getNextDataId();return this.#xc.loadFiles(e,t),t};loadURLs=(e,t)=>{if(0===e.length)return s.warn("Ignoring empty input url list."),"-1";const n=this.#ja.getNextDataId();return this.#xc.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=Co(e);n&&void 0!==n.input&&function(e,t,n){e.type&&"manifest"===e.type?wo(e.input,e.nslices,t):t(Io(e.input,e.dwvReplaceMode),n)}(n,this.loadURLs,t)};loadImageObject=e=>{const t=this.#ja.getNextDataId();return this.#xc.loadImageObject(e,t),t};abortAllLoads(){const e=this.#xc.getLoadingDataIds();for(const t of e)this.abortLoad(t)}abortLoad(e){this.#xc.abort(e),this.#ja.remove(e),this.#Pa.removeLayersByDataId(e)}fitToContainer(){s.debug("App.fitToContainer: deprecated since v0.37, use app.getStageController().fitToContainer()"),this.#Pa.fitToContainer()}initWLDisplay(){s.debug("App.initWLDisplay: deprecated since v0.33, please set the opacity of the desired view layer directly."),this.#Pa.getActiveLayerGroup().getActiveViewLayer().getViewController().initialise()}setImageSmoothing(e){s.debug("App.setImageSmoothing: deprecated since v0.37, use app.getStageController().setImageSmoothing()"),this.#Pa.setImageSmoothing(e)}getViewConfigs(e,t){return s.debug("App.getViewConfigs: deprecated since v0.37, use app.getStageController().getViewConfigs()"),this.#Pa.getViewConfigs(e,t)}getViewConfig(e,t,n){return s.debug("App.getViewConfig: deprecated since v0.37, use app.getStageController().getViewConfig()"),this.#Pa.getViewConfig(e,t,n)}getDataViewConfigs(){return s.debug("App.getDataViewConfigs: deprecated since v0.37, use app.getStageController().getDataViewConfigs()"),this.#Pa.getDataViewConfigs()}setDataViewConfigs(e){s.debug("App.setDataViewConfigs: deprecated since v0.37, use app.getStageController().setDataViewConfigs()"),this.#Pa.setDataViewConfigs(e)}addDataViewConfig(e,t,n){s.debug("App.addDataViewConfig: deprecated since v0.37, use app.getStageController().addDataViewConfig()"),this.#Pa.addDataViewConfig(e,t,n)}removeDataViewConfig(e,t){s.debug("App.removeDataViewConfig: deprecated since v0.37, use app.getStageController().removeDataViewConfig()"),this.#Pa.removeDataViewConfig(e,t)}updateDataViewConfig(e,t,n){s.debug("App.updateDataViewConfig: deprecated since v0.37, use app.getStageController().updateDataViewConfig()"),this.#Pa.updateDataViewConfig(e,t,n)}setLayerGroupsBinders(e){const t=[];for(let n=0;n<e.length;++n)void 0!==Hc[e[n]]&&t.push(new Hc[e[n]]);this.#Pa.setBinders(t)}render(e,t){s.debug("App.render: deprecated since v0.37, use app.getStageController().render()"),this.#Pa.render(e,t)}zoom(e,t,n){s.debug("App.zoom: deprecated since v0.37, please access from the active layer group."),this.#Pa.zoom(e,t,n)}translate(e,t){s.debug("App.translate: deprecated since v0.37, please access from the active layer group."),this.#Pa.translate(e,t)}resampleMatch(e,t){const n=this.#ja.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.#ja.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.#ja.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.#Mi.dataViewConfigs,o=n.image.getMeta(),r=this.#ja.getDataIds();for(let e=0;e<r.length;e++){const t=this.#ja.get(r[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===o.SeriesInstanceUID&&this.#ja.stash(r[e])}const a=this.getStageController();a.setDataViewConfigs(i);const l=this.#ja.getDataIds();for(let e=0;e<l.length;++e)a.render(l[e])}revertResample(e){const t=this.#ja.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.#Mi.dataViewConfigs,i=t.image.getMeta(),o=this.#ja.getStashedDataIds();for(let e=0;e<o.length;e++){const t=this.#ja.getStashed(o[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===i.SeriesInstanceUID&&this.#ja.unstash(o[e])}const r=this.getStageController();r.setDataViewConfigs(n);const a=this.#ja.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.#Pa.getActiveLayerGroup().getActiveViewLayer();t.setOpacity(e),t.draw()}setDrawings(t,n,i){s.debug("App.setDrawings: deprecated since v0.34, please switch to DICOM SR annotations.");const o=this.#Pa.getActiveLayerGroup().getBaseViewLayer(),r=o.getDataId(),l=this.#ja.get(r),c=o.getViewController(),u=function(t,n,i){const o=[],r=e.Node.create(t).getChildren(da);for(let e=0,t=r.length;e<t;++e){const t=r[e],l=t.getChildren();for(let e=0,r=l.length;e<r;++e){const e=new os,r=new a(Ll(t.id()));e.referencedSopInstanceUID=i.getImageUid(r);const c=l[0];e.trackingId=c.id(),e.trackingUid=c.id();const u=c.getChildren(ua)[0];if(e.colour=u.stroke(),"line-group"===c.name()){const t=u.points();e.mathShape=new m(t[0],t[1]),e.referencePoints=[new m(t[2],t[3])]}else if("ruler-group"===c.name()){const t=u.points();e.mathShape=new rr(new m(t[0],t[1]),new m(t[2],t[3]))}else if("rectangle-group"===c.name())e.mathShape=new mr(new m(u.x(),u.y()),new m(u.x()+u.width(),u.y()+u.height()));else if("roi-group"===c.name()){const t=u.points(),n=[];for(let e=0;e<t.length;e+=2)n.push(new m(t[e],t[e+1]));e.mathShape=new hr(n)}else if("freeHand-group"===c.name()){s.warn("Converting freehand into ROI shape");const t=u.points(),n=[];for(let e=0;e<t.length;e+=2)n.push(new m(t[e],t[e+1]));e.mathShape=new hr(n)}else if("protractor-group"===c.name()){const t=u.points();e.mathShape=new dr([new m(t[0],t[1]),new m(t[2],t[3]),new m(t[4],t[5])])}else if("ellipse-group"===c.name()){const t=u.absolutePosition();e.mathShape=new Sr(new m(t.x,t.y),u.radiusX(),u.radiusY())}else if("circle-group"===c.name()){const t=u.absolutePosition();e.mathShape=new gr(new m(t.x,t.y),u.radius())}else if("bidimensional-group"===c.name()){const t=u.points(),i=new vr(new m(t[0],t[1]),new m(t[2],t[3])),o=n&&n[c.id()]?n[c.id()]:void 0,r=o&&o.meta&&o.meta.quantification?o.meta.quantification:{};"function"==typeof vr.restorePropertiesFromQuantification?vr.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[c.id()];e.textExpr=t.meta.textExpr,e.quantification=t.meta.quantification}o.push(e)}}return o}(t,n,l.image),d=this.createAnnotationData(r);for(const e of u)e.setViewController(c),d.annotationGroup.add(e);this.#ja.add(i,d),this.#Pa.render(i)}applyJsonState(e,t){s.debug("App.applyJsonState: deprecated since v0.34, please switch to DICOM SR for annotations.");const n=new go(t);n.apply(this,n.fromJSON(e))}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.#Pa.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.#Ec.redo();else if("z"===e.key)this.#Ec.undo();else if(" "===e.key){const e=this.#Pa.getNumberOfLayerGroups();for(let t=0;t<e;++t)this.#Pa.getLayerGroup(t).setShowCrosshair(!this.#Pa.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.#Pa.getActiveLayerGroup().getActiveViewLayer().getViewController().setColourMap(e)}setWindowLevelPreset(e){s.debug("App.setWindowLevelPreset: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Pa.getActiveLayerGroup().getActiveViewLayer().getViewController().setWindowLevelPreset(e)}setTool(e){for(let e=0;e<this.#Pa.getNumberOfLayerGroups();++e){const t=this.#Pa.getLayerGroup(e),n=t.getActiveLayer();void 0!==n&&this.#fc.bindLayerGroup(t,n)}this.#fc.setSelectedTool(e)}setToolFeatures(e){this.#fc.setToolFeatures(e)}undo(){s.debug("App.undo: deprecated since v0.37, please use via app.getUndoController."),this.#Ec.undo()}redo(){s.debug("App.redo: deprecated since v0.37, please use via app.getUndoController."),this.#Ec.redo()}getStackSize(){return s.debug("App.getStackSize: deprecated since v0.37, please use via app.getUndoController."),this.#Ec.getStackSize()}getCurrentStackIndex(){return s.debug("App.getCurrentStackIndex: deprecated since v0.37, please use via app.getUndoController."),this.#Ec.getCurrentStackIndex()}getInfoData(e){let t;return void 0!==this.#ga&&(t=this.#ga[e]),t}toggleInfoDataListeners(e){const t=this.getInfoData(e);void 0!==t&&(t.isListening()?t.removeAppListeners():t.addAppListeners())}createAnnotationData(e){const t=this.#ja.get(e).image.getMeta(),n=new As({});n.annotationGroup=new uo,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.#ja,o=i.getNextDataId();if(!i.add(o,e))throw new Error("Cannot add annotation data");const r=this.#Pa.getViewConfigs(n).find(e=>e.divId===t);if(void 0===r)throw new Error("No reference data view config for draw");const a=new $c(t);a.orientation=r.orientation,this.#Pa.addDataViewConfig(o,a),this.#Pa.render(o)}#Er=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#Rc=e=>{void 0!==this.#Mi.overlayConfig&&0===Object.keys(this.#ga).length&&(this.#ga[e.detail.dataid]=new el(this,e.detail.dataid,this.#Mi.overlayConfig)),this.#Er(e)};#Fc=e=>{void 0===e.detail.data&&s.error("Missing loaditem event data."),void 0===e.detail.loadtype&&s.error("Missing loaditem event load type.");const t=e.detail.isfirstitem;if("image"===e.detail.loadtype)try{t?this.#ja.add(e.detail.dataid,e.detail.data):this.#ja.update(e.detail.dataid,e.detail.data)}catch(t){return this.dispatchEvent(new CustomEvent("error",{detail:{dataid:e.detail.dataid,loadtype:e.detail.loadtype,source:e.detail.source,error:t}})),void this.dispatchEvent(new CustomEvent("loadend",{detail:{dataid:e.detail.dataid,loadtype:e.detail.loadtype,source:e.detail.source}}))}else"state"===e.detail.loadtype&&this.applyJsonState(e.detail.data,e.detail.dataid);this.#Er(e),void 0!==this.#ga&&void 0!==this.#ga[e.detail.dataid]&&this.#ga[e.detail.dataid].addItemMeta(e.detail.data.meta),"image"===e.detail.loadtype&&0!==this.#Pa.getViewConfigs(e.detail.dataid).length&&t&&this.#Mi.viewOnFirstLoadItem&&this.#Pa.render(e.detail.dataid)};#Mc=e=>{const t=this.#ja.markDataAsComplete(e.detail.dataid);this.#Mi.viewOnFirstLoadItem&&void 0!==t.imageHasChanged&&t.imageHasChanged&&this.#Pa.render(e.detail.dataid),this.#Er(e)}}class Kc{#tl;#oe;constructor(e){this.#tl=e;const t=e.getMeta();void 0===t.custom&&(t.custom={}),void 0===t.custom.segments&&(t.custom.segments=[]),this.#oe=t.custom.segments}getMask(){return this.#tl}#qc(e){return this.#oe.findIndex(function(t){return t.number===e})}hasSegment(e){return-1!==this.#qc(e)}getNumberOfSegments(){return this.#oe.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.#tl.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.#qc(e);return-1!==n&&(t=this.#oe[n]),t}addSegment(e){-1===this.#qc(e.number)?(this.#oe.push(e),void 0!==e.displayRGBValue&&this.#tl.updatePaletteColourMap(e.number,e.displayRGBValue)):s.warn(`Not adding segment, it is allready in the segments list: ${e.number}`)}removeSegment(e){const t=this.#qc(e);-1!==t?this.#oe.splice(t,1):s.warn(`Cannot remove segment, it is not in the segments list: ${e}`)}updateSegment(e){const t=this.#qc(e.number);-1!==t?this.#oe[t]=e:s.warn(`Cannot update segment, it is not in the segments list: ${e.number}`)}findOverlap(e){const t=this.#tl.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.#tl.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 Jc extends qa{#tl;#Uc;#sl;#Vc;constructor(e,t,n){super(),this.#tl=e,this.#Uc=t,this.#sl=void 0!==n&&n,void 0!==t.displayRGBValue?this.#Vc=e.getOffsets(t.number):this.#Vc=e.getOffsets(t.displayValue)}getName(){return"Delete-segment"}isValid(){return this.#tl.getMeta().custom.segments.some(e=>e.number===this.#Uc.number)}execute(){0!==this.#Vc.length&&this.#tl.setAtOffsets(this.#Vc,0),new Kc(this.#tl).removeSegment(this.#Uc.number),this.#sl||this.onExecute({type:"masksegmentdelete",segmentnumber:this.#Uc.number})}undo(){0!==this.#Vc.length&&(void 0!==this.#Uc.displayRGBValue?this.#tl.setAtOffsets(this.#Vc,this.#Uc.number):this.#tl.setAtOffsets(this.#Vc,this.#Uc.displayValue)),new Kc(this.#tl).addSegment(this.#Uc),this.onUndo({type:"masksegmentredraw",segmentnumber:this.#Uc.number})}onExecute(e){}onUndo(e){}}class eu extends qa{#tl;#Uc;#Qc;#Nc;#sl;#Vc;constructor(e,t,n,i){super(),this.#tl=e,this.#Uc=t,this.#Qc=n,this.#sl=void 0!==i&&i,void 0!==t.displayRGBValue?this.#Nc=t.displayRGBValue:(this.#Nc=t.displayValue,this.#Vc=e.getOffsets(this.#Nc))}getName(){return"Change-segment-colour"}isValid(){let e=!0;return void 0!==this.#Vc&&(e=0!==this.#Vc.length),e}execute(){"number"==typeof this.#Qc?(this.#tl.setAtOffsets(this.#Vc,this.#Qc),this.#Uc.displayValue=this.#Qc):(this.#tl.updatePaletteColourMap(this.#Uc.number,this.#Qc),this.#Uc.displayRGBValue=this.#Qc),this.#sl||this.onExecute({type:"changemasksegmentcolour",segmentnumber:this.#Uc.number,value:[this.#Qc]})}undo(){"number"==typeof this.#Nc?(this.#tl.setAtOffsets(this.#Vc,this.#Nc),this.#Uc.displayValue=this.#Nc):(this.#tl.updatePaletteColourMap(this.#Uc.number,this.#Nc),this.#Uc.displayRGBValue=this.#Nc),this.onUndo({type:"changemasksegmentcolour",segmentnumber:this.#Uc.number,value:[this.#Nc]})}onExecute(e){}onUndo(e){}}class tu{diameter;offset1;offset2}class nu{major;minor}class iu{centroid;centroidIndex;volume;count;diameters;height;id;largestSliceZ}class ou{x;y}class ru{x;y;z}export{os as Annotation,uo as AnnotationGroup,ss as AnnotationGroupFactory,_c as App,Zc as AppOptions,l as BooleanResult,as as CADReport,eu as ChangeSegmentColourCommand,gr as Circle,je as ColourMap,qa as Command,bs as DataController,le as DataElement,Jc as DeleteSegmentCommand,tu as Diameter,nu as Diameters,gn as DicomCode,As as DicomData,Re as DicomParser,ia as DicomSRContent,ts as DicomWriter,ac as DrawBrushCommand,rc as DrawBrushCommandProperties,wl as DrawController,Tl as DrawLayer,oc as DrawShapeHandler,Sr as Ellipse,Pt as Geometry,lo as Image,Gi as ImageContour,a as Index,el as InfoData,Zs as InfoDataItem,iu as Label,Rl as LayerGroup,ji as MaskFactory,Ni as MaskSegment,Kc as MaskSegmentHelper,ul as MaskSegmentViewHelper,Ke as Matrix33,xt as NormalisedManufacturers,u as NumberRange,c as NumberValue,nt as Orientation,pl as PlaneHelper,D as Point,m as Point2D,f as Point3D,fl as PositionHelper,dr as Protractor,Ci as RGB,hr as ROI,us as RTROI,cs as RTROIContour,mr as Rectangle,Ve as RescaleSlopeAndIntercept,rs as ResponseEvaluation,Ts as RtStructFactory,Va as RunFilterCommand,ou as Scalar2D,ru as Scalar3D,ol as ScrollWheelBehavior,Hi as SegmentCollection,Dt as Size,ct as Spacing,Wc as StageController,M as Tag,oe as TagInfo,jc as ToolConfig,bo as ToolboxController,js as UndoController,p as Vector3D,gl as View,$c as ViewConfig,vl as ViewController,Cl as ViewLayer,il as WheelBehavior,Ge as WindowLevel,Ye as WindowPreset,Xa as WriterRule,W as addTagsToDictionary,Cs as bufferToPolygons,F as buildMultipart,ao as createImage,so as createMaskImage,hl as createView,_e as custom,zc as defaultToolList,za as defaultToolOptions,ze as equalWl,mi as getAsSimpleTagValues,Ss as getDefaultDicomRTStructJson,$i as getDefaultDicomSegJson,ra as getDicomSRContentItem,ae as getDicomTagGroupName,re as getDicomTagInfo,pe as getDwvVersion,vi as getElementsFromSimpleTagValues,pr as getEllipseIndices,xl as getLayerDetailsFromEvent,Et as getManufacturer,Ao as getMousePoint,Rt as getNormalisedManufacturer,at as getOrientationName,G as getPixelDataTag,ds as getRTStructFromElements,fr as getRectangleIndices,vt as getReferencedSeriesUID,Ct as getReferencedSeriesUIDFromRTStruct,ye as getReverseOrientation,oa as getSRContent,Yn as getSegmentationCode,U as getTagFromKey,Po as getTouchPoints,Oe as getTypedArray,$a as getUID,Do as getURLsFromKeyValueUri,yo as handleURLsFromWeasisXMLManifest,ve as hasDicomPrefix,Ii as hexToRgb,y as i18n,Di as isEqualRgb,Li as labToUintLab,s as logger,Ze as luts,Zi as mergeMaskImages,fi as mergeTagValues,S as precisionRound,wi as rgbToHex,ys as simplifyPolygon,Oi as srgbToCielab,Gc as toolList,Ga 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)}};class l{success;message;constructor(e){this.success=e}}Number.EPSILON;class c{value;unit}class u{min;max;constructor(e,t){this.min=e,this.max=t}}function d(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)<n}function h(e,t,n,i){return function(e,t,n){void 0===t&&(t=Number.EPSILON),void 0===n&&(n=1);const i=Math.abs(e)/t,o=i<n,r=new l(o);return o||(r.message=`${S(i,2)}`),r}(e-t,n,i)}function g(e){let t=e>1e-4;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 S(e,t){const n=Math.pow(10,t),i=.01/n;return Math.round(e*n+i)/n}class p{#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 p(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 m{#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}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 f{#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&&d(this.#n,e.getX(),t)&&d(this.#i,e.getY(),t)&&d(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 p(this.#n-e.getX(),this.#i-e.getY(),this.#o-e.getZ())}}function v(e,t){return e.some(function(e){return t.equals(e)})}function C(e){return new f(e[0],e[1],e[2])}class D{#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 D(t)}mergeWith3D(e){const t=this.getValues();return t[0]=e.getX(),t[1]=e.getY(),t[2]=e.getZ(),new D(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"}[n[1]]),t}};function I(e,t){return null!=e&&null!=t&&e.substring(e.length-t.length)===t}function w(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 T(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 L(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 P(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 A(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 O(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&b(e.slice().sort(),t.slice().sort())}function b(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 x(e){return String.fromCharCode(...e)}function E(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 R(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 F(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=L(a);o.push(l),i+=l.byteLength+e[r].data.byteLength}const r=L(`${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 M{#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 q(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 U(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 M(e.substring(0,4),e.substring(4,8))}function Q(){return new M("FFFE","E000")}function V(e){return"FFFEE000"===e.getKey()}function N(){return new M("FFFE","E00D")}function B(e){return"FFFEE00D"===e.getKey()}function k(e){return"FFFEE0DD"===e.getKey()}function G(){return new M("7FE0","0010")}function z(e){return["7FE00010","7FE00009","7FE00008"].includes(e.getKey())}function H(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 Y(e){return void 0!==H(e)}const X=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 W(e,t){X[e]=t}const $={"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"},j={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 Z(e){return void 0!==j[e]}const _={SH:!0,LO:!0,UC:!0,ST:!0,LT:!0,UT:!0,PN:!0};function K(e){return void 0!==_[e]}const J={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"},ee={"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)"},te="1.2.840.10008.1.2",ne="1.2.840.10008.1.2.1",ie="1.2.840.10008.1.2.2";class oe{#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 re(e){if(void 0===e)return;let t;const n=e.getGroup(),i=e.getElement();if(void 0!==X[n]&&void 0!==X[n][i]){const e=X[n][i];t=new oe(e[0],parseInt(e[1],10),e[2])}return t}function ae(e){return $[e.getGroup()]}function se(e){if(null==e)return;const t=Object.keys(X);for(const n of t){const t=Object.keys(X[n]);for(const i of t)if(X[n][i][2]===e)return new M(n,i)}}class le{vr;value;tag;vl;undefinedLength;startOffset;endOffset;items;constructor(e){this.vr=e}}function ce(e){return void 0!==e&&void 0!==e.value&&0!==e.value.length}function ue(e,t){let n;return ce(e[t])&&(n=e[t].value[0]),n}function de(e,t){let n;return ce(e[t])&&(n=e[t].value),n}function he(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 Se{#d;#h=!0;#g=function(){return new Int8Array(new Int16Array([1]).buffer)[0]>0}();#S;#p;constructor(e,t){this.#d=e,void 0!==t&&(this.#h=t),this.#S=this.#h!==this.#g,this.#p=new DataView(e)}readUint16(e){return this.#p.getUint16(e,this.#h)}readInt16(e){return this.#p.getInt16(e,this.#h)}readUint32(e){return this.#p.getUint32(e,this.#h)}readBigUint64(e){return this.#p.getBigUint64(e,this.#h)}readInt32(e){return this.#p.getInt32(e,this.#h)}readBigInt64(e){return this.#p.getBigInt64(e,this.#h)}readFloat32(e){return this.#p.getFloat32(e,this.#h)}readFloat64(e){return this.#p.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&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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.#d,e,i),this.#S&&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 pe(){return"0.37.0-beta.15"}function me(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=me(e),o=me(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){return!(e.byteLength<132)&&"DICM"===new Uint8Array(e,128,4).reduce(function(e,t){return e+String.fromCharCode(t)},"")}const Ce=String.fromCharCode("u200B");class De{decode(e){let t="";for(let n=0,i=e.length;n<i;++n)t+=String.fromCharCode(e[n]);return t}}function ye(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 Ie(e){return e===te}function we(e){return e===ie}function Te(e){return"1.2.840.10008.1.2.4.50"===e||"1.2.840.10008.1.2.4.51"===e}function Le(e){return"1.2.840.10008.1.2.4.57"===e||"1.2.840.10008.1.2.4.70"===e}function Pe(e){return null!==e.match(/1.2.840.10008.1.2.4.9/)}function Ae(e){return"1.2.840.10008.1.2.5"===e}function Oe(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));s.error(`Cannot allocate array of size: ${n} (>2^${e}).`)}}return i}function be(e,t){return t?8:Z(e)?12:8}const xe="00280100",Ee="00280103";class Re{#m={};#f;#v=new De;#C=this.#v;#D(e){return this.#v.decode(e)}#y(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.#m}safeGet(e){return ue(this.#m,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 M(n,i),endOffset:t}}#w(e,t,n){const i={};let o=this.#T(e,t,n);if(t=o.endOffset,k(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=B(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=k(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 le("");return e.tag=r,e}t=o.endOffset;let a,l="NONE",c=!0;r.isWithVR()&&(n?(l=re(r)?.getVr(),void 0===l&&(l="UN"),c=!0):(l=this.#D(e.readUint8Array(t,2)),t+=2*Uint8Array.BYTES_PER_ELEMENT,c=Z(l),c&&(t+=2*Uint8Array.BYTES_PER_ELEMENT))),function(e){return Object.keys(J).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(z(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 le(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=J[r];if(z(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 if(l>8&&"OB"===r&&(s.warn("Reading DICOM pixel data with bitsAllocated>8 and OB VR, treating as OW"),e.vr="OW"),u=[],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)u.push(t.readFloat32Array(a,o));else{if(64!==l)throw new Error(`Unsupported bits allocated: ${l}`);u.push(t.readFloat64Array(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.#y(e):this.#D(e),u=function(e){let t=e;const n=e.length-1;return e[n]===Ce&&(t=e.substring(0,n)),t=t.trim(),t}(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[xe];void 0!==n&&void 0!==n.value&&(a=n.value[0]),n=i[Ee],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 Se(e);let a=new Se(e);n=128;const l=this.#D(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.#m[o.tag.getKey()]=o;const e=n+o.value[0];for(;n<e;)o=this.#T(r,n,!1),n=o.endOffset,this.#m[o.tag.getKey()]=o;if(o=this.#m["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?te:ne;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 le("UI");return l.tag=new M("0002","0010"),l.value=[s],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(o);this.#m[e.tag.getKey()]=e,i=e.value[0],n=0}if(!function(e){return e===te||e===ne||e===ie||Te(e)||Le(e)||Pe(e)||Ae(e)}(i))throw new Error(`Unsupported DICOM transfer syntax: '${i}' (${function(e){let t="Unknown";return void 0!==ee[e]&&(t=ee[e]),t}(i)})`);let c=!1;Ie(i)&&(c=!0),we(i)&&(a=new Se(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.#m[e]?this.#m[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}`),Y(this.#m)){let e=0;o=this.#m[Ee],void 0!==o?(o.value=this.#P(o,a),e=o.value[0]):s.warn("Reading DICOM pixel data with default pixelRepresentation.");let t=16;o=this.#m[xe],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.#m["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.#m["00280010"],void 0!==o&&(o.value=this.#P(o,a),n=parseInt(o.value[0],10)),o=this.#m["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.#m["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.#m,a,u),o=this.#m["7FE00010"],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 Fe{#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 Me={wlPresets:void 0,labelTexts:void 0,privateBValueRules:void 0,openRoiDialog:void 0,getVolumeIdTagValue:void 0,getPostLoadVolumeIdTagValue:void 0,postLoadVolumeIdCandidates: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(!d(this.get(n,i),e.get(n,i),t))return!1;return!0}isSimilarProgressive(e,t){let n;for(let i=0;i<3;++i)for(let o=0;o<3;++o){const r=h(this.get(i,o),e.get(i,o),t,10);if(!r.success)return!1;if(void 0!==r.message){const e=parseInt(r.message,10);(void 0===n||e>n)&&(n=e)}}return void 0!==n&&s.warn(`Using larger tolerance for matrix similarity: max diff is ~${n} times tolerance`),!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 p(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 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 Ue(){return new qe([1,0,0,0,1,0,0,0,1])}function Qe(e){return e.equals(Ue())}function Ve(){return new qe([1,0,0,0,0,1,0,-1,0])}const Ne={Axial:"axial",Coronal:"coronal",Sagittal:"sagittal"};function Be(e){let t;return e===Ne.Axial?t=Ue():e===Ne.Coronal?t=Ve():e===Ne.Sagittal&&(t=new qe([0,0,-1,1,0,0,0,-1,0])),t}function ke(e){const t=new p(e.get(0,0),e.get(1,0),e.get(2,0)),n=new p(e.get(0,1),e.get(1,1),e.get(2,1)),i=new p(e.get(0,2),e.get(1,2),e.get(2,2));return Ge(t)+Ge(n)+Ge(i)}function Ge(e){let t=new p(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 p(0,t.getY(),t.getZ());else if(t.getY()>a&&t.getY()>t.getX()&&t.getY()>t.getZ())n+=o,t=new p(t.getX(),0,t.getZ());else{if(!(t.getZ()>a&&t.getZ()>t.getX()&&t.getZ()>t.getY()))break;n+=r,t=new p(t.getX(),t.getY(),0)}return n}function ze(e){let t;const n=He(e);return void 0!==n&&(t=function(e){let t;return["LPS","LAI","RPI","RAS","ALS","ARI","PLI","PRS"].includes(e)?t=Ne.Axial:["LSA","LIP","RSP","RIA","ILA","IRP","SLP","SRA"].includes(e)?t=Ne.Coronal:["PSL","PIR","ASR","AIL","IAR","IPL","SAL","SPR"].includes(e)&&(t=Ne.Sagittal),t}(ke(n.asOneAndZeros()))),t}function He(e){let t;if(void 0!==e&&6===e.length){const n=new p(e[0],e[1],e[2]),i=new p(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 Ye(e,t){let n=Ue();return void 0!==t&&(n=e.asOneAndZeros().getInverse().multiply(t)),n.getAbs()}class Xe{#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 We={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=ue(e,We.Rows),i=ue(e,We.Columns);return void 0!==n&&void 0!==i&&(t=[i,n]),t}function je(e,t){let n;const i=de(e,t);return void 0!==i&&2===i.length&&(n=[parseFloat(i[1]),parseFloat(i[0])]),n}function Ze(e){let t;const n=de(e,We.PixelMeasuresSequence);return void 0!==n&&(t=je(n[0],We.PixelSpacing)),t}function _e(e){let t=je(e,We.PixelSpacing);return void 0===t&&(t=function(e){let t=je(e,We.ImagerPixelSpacing);if(void 0!==t){let n;const i=parseFloat(ue(e,We.EstimatedRadiographicMagnificationFactor));if(isNaN(i)){const t=parseFloat(ue(e,We.DistanceSourceToDetector)),i=parseFloat(ue(e,We.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,We.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=de(e,We.SharedFunctionalGroupsSequence);if(void 0!==n&&(t=Ze(n[0])),void 0===t){const n=de(e,We.PerFrameFunctionalGroupsSequence);void 0!==n&&(t=Ze(n[0]))}return t}(e)),t}function Ke(e){const t=je(e,We.PixelSpacing);if(void 0===t)return;const n=ue(e,We.SpacingBetweenSlices);return void 0!==n&&t.push(parseFloat(n)),new Xe(t)}function Je(e){const t=ue(e,We.PhotometricInterpretation),n=ue(e,We.TransferSyntax);if(void 0!==t&&void 0!==n){let i=t.toUpperCase();(Pe(n)||Te(n)||Le(n))&&!et(i)&&(i="RGB");let o=ue(e,We.SamplesPerPixel);return void 0===o&&(o=1),"RGB"===i&&1===o&&(i="PALETTE COLOR"),i}}function et(e){return void 0!==e&&null!==e.match(/MONOCHROME/)}function tt(e){let t;const n=de(e,We.ReferencedSeriesSequence);return void 0!==n&&(t=ue(n[0],We.SeriesInstanceUID)),t}function nt(e){const t=de(e,We.ReferencedFrameOfReferenceSequence);if(void 0===t)return;const n=de(t[0],We.RTReferencedStudySequence);if(void 0===n)return;const i=de(n[0],We.RTReferencedSeriesSequence);return void 0!==i?ue(i[0],We.SeriesInstanceUID):void 0}class it{#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 ot(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 ot{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 rt{constructor(e,t){this.startMessage=e,this.info=t}getWorker(){}}class at{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 st(e,t){return function(e){return null!=e&&(e.includes("median")||e.includes("p25")||e.includes("p75"))}(t)?function(e){const t=lt(e);return e.sort(function(e,t){return e-t}),t.median=ct(e,.5),t.p25=ct(e,.25),t.p75=ct(e,.75),t}(e):lt(e)}function lt(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 at(t,n,a,l)}function ct(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 ut{#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)}}#Q(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.#Q(e.getValues(),n);return new D(i)}normaliseIndex(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#Q(e.getValues(),n);return new a(i)}}const dt=1e-6;function ht(e){const t=e.getInverse();return function(e,n){const i=t.multiplyPoint3D(e),o=t.multiplyPoint3D(n);return i.getZ()-o.getZ()}}function gt(e,t,n){const i=e.getClosest(t),o=new p(n.get(0,2),n.get(1,2),n.get(2,2));return{index:i,normalResidual:e.minus(t[i]).dotProduct(o)}}class St{#V;#N;#B;#k={};#G;#z=Ue();constructor(e,t,n,i,o){this.#V=e,this.#N=t,this.#B=n,void 0!==o&&(this.#G=o,this.#k[o]=e.slice()),void 0!==i&&(this.#z=i)}clone(){return new St(this.#V.slice(),new ut(this.#N.getValues()),new Xe(this.#B.getValues()),new qe(this.#z.getValues()),this.#G)}getInitialTime(){return this.#G}setInitialTime(e){void 0!==this.#k[this.#G]&&delete this.#k[this.#G],this.#G=e,this.#k[e]=this.#V.slice()}getCurrentTotalNumberOfSlices(){const e=Object.keys(this.#k);if(0===e.length)return this.#V.length;let t=0;for(let n=0;n<e.length;++n)t+=this.#k[e[n]].length;return t}hasSlicesAtTime(e){return void 0!==this.#k[e]}getCurrentNumberOfSlicesBeforeTime(e){const t=Object.keys(this.#k);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.#k[o].length}return n}getOrigin(){return this.#V[0]}getOrigins(){return this.#V}sortOrigins(){this.#V.sort(ht(this.#z))}includesOrigin(e,t){for(let n=0;n<this.#V.length;++n)if(this.#V[n].isSimilar(e,t))return!0;return!1}getSize(e){let t=this.#N;if(e&&void 0!==e){let n=pt([this.#N.get(0),this.#N.get(1),this.#N.get(2)],e);n=n.map(Math.abs),t=new ut(n.concat(this.#N.getValues().slice(3)))}return t}updateSliceSpacing(){const e=ft(this.#V);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 Xe(t)}}getSpacing(e){let t=this.#B;if(e&&void 0!==e){let n=pt([this.#B.get(0),this.#B.get(1),this.#B.get(2)],e);n=n.map(Math.abs),t=new Xe(n)}return t}getRealSpacing(){return this.getSpacing(this.#z.getInverse().asOneAndZeros())}getOrientation(){return this.#z}getSliceIndex(e,t){let n=this.#V;void 0!==t&&(n=this.#k[t]);const i=gt(e,n,this.#z);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(),dt))return{success:!1,message:"Cannot append a slice with different orientation"};const i=this.canAppendOrigin(e.getOrigin(),e.getInitialTime());return i.success?new l(!0):i}canAppendOrigin(e,t){const n=function(t){return t.equals(e)};if(void 0!==t&&t!==this.#G){if(void 0!==this.#k[t]&&void 0!==this.#k[t].find(n))return{success:!1,message:"Cannot append same time origin twice"}}else if(void 0!==this.#V.find(n))return{success:!1,message:"Cannot append same origin twice"};return new l(!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[n].splice(t,0,e),void 0===n||n===this.#G){this.#V.splice(t,0,e);const n=this.#N.getValues();n[2]+=1,this.#N=new ut(n)}}appendFrame(e,t){this.#k[t]=[e];const n=this.#N.getValues(),i=this.#B.getValues();4===n.length?n[3]+=1:(n.push(2),i.push(1)),this.#N=new ut(n),this.#B=new Xe(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 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 D(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),o=e.getValues(),r=this.getSpacing();o[0]=Math.floor(S(i.getX()/r.get(0),5)),o[1]=Math.floor(S(i.getY()/r.get(1),5));const s=Math.floor(S(i.getZ()/r.get(2),5));o[2]=s;const l=this.getOrigins();if(l.length>0){const t=gt(e.get3D(),l,this.getOrientation());Math.abs(t.normalResidual)<r.get(2)/2?o[2]=t.index:t.index===l.length-1&&t.normalResidual>0&&o[2]<l.length?o[2]=l.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 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 pt(e,t){return t.getInverse().multiplyArray3D(e)}function mt(e,t){return t.multiplyArray3D(e)}function ft(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=lt(t),i=S(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 vt extends rt{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 Ct{#H=new it(5);constructor(){this.#H.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 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 Xe(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 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(v[0]*e,v[1]*t,v[2]*n),r=o.multiplyPoint3D(i);C?(D[0]=r.getX(),D[1]=r.getY(),D[2]=r.getZ(),y[0]=r.getX(),y[1]=r.getY(),y[2]=r.getZ(),C=!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 I=[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)))],w=r.length();for(let e=3;e<w;e++)I.push(r.get(e));const T=new ut(I),L=void 0===n?new f(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]/m.get(0)+T.get(0)/2,P[1]=t[1]/m.get(1)+T.get(1)/2,P[2]=t[2]/m.get(2)+T.get(2)/2}const A=new f(P[0]*m.get(0),P[1]*m.get(1),P[2]*m.get(2)),O=t.multiplyPoint3D(A),b=e.pointToWorld(L),x=new f(b.getX()-O.getX(),b.getY()-O.getY(),b.getZ()-O.getZ()),E=[0,0,m.get(2)],R=t.multiplyArray3D(E),F=[];for(let e=0;e<T.get(2);e++)F.push(new f(x.getX()+R[0]*e,x.getY()+R[1]*e,x.getZ()+R[2]*e));return new St(F,T,m,t)}(t,i,r),l=function(e,t,n){const i=Oe(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 p=l.get(3),m=a.getDimSize(3),f=l.getDimSize(3),v=[];for(let e=0;e<p;e++){const t=m*e,n=f*e;v.push(S(t,n,e))}return v}(e,t,s,n,o,a);return this.#H.onworkitem=this.ondoneframe,this.#H.onworkend=this.ondone,c.forEach(e=>{const t=new vt(e,{});this.#H.addWorkerTask(t)}),{buffer:l,geometry:s,jobId:a}}ondoneframe(e){}ondone(e){}}const Dt={linear:"LINEAR",linear_exact:"LINEAR_EXACT",sigmoid:"SIGMOID"};class yt{#Y;#X;#W=0;#$=255;#O;#b;constructor(e,t,n){void 0===n&&(n=!1);let i=e,o=t;n||(i-=.5,o-=1),this.#Y=i-o/2,this.#X=i+o/2,this.#O=(this.#$-this.#W)/o,this.#b=(-i/o+.5)*(this.#$-this.#W)+this.#W}getY(e){let t;return t=e<=this.#Y?this.#W:e>this.#X?this.#$:e*this.#O+this.#b,t}}class It{#W=0;#$=255;#j;#Z;constructor(e,t){this.#j=e,this.#Z=t}getY(e){return(this.#$-this.#W)/(1+Math.exp(-4*(e-this.#j)/this.#Z))+this.#W}}class wt{#_;#K=0;#J;#ee=Dt.linear;constructor(e,t){if(this.#_=e,void 0!==t){const e=[];for(const t in Dt)e.push(Dt[t]);e.includes(t)?this.#ee=t:s.debug(`Unknown VOI LUT function: ${t}`)}this.#q()}getWindowLevel(){return this.#_}#q(){const e=this.#_.center,t=this.#_.width,n=e+this.#K;this.#ee===Dt.linear_exact?this.#J=new yt(n,t,!0):this.#ee===Dt.sigmoid?this.#J=new It(n,t):this.#J=new yt(n,t)}setSignedOffset(e){this.#K=e,this.#q()}apply(e){return this.#J.getY(e)}}class Tt{center;width;constructor(e,t){this.center=e,this.width=t}}function Lt(e,t){return null!=e&&null!=t&&e.center===t.center&&e.width===t.width}function Pt(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!==Dt.linear_exact&&n!==Dt.sigmoid||(o=0);let r=e.width;return r=Math.max(r,o),r=Math.min(r,t.max-t.min),new Tt(i,r)}const At=["imagecontentchange","imagegeometrychange","imageresamplingstart","imageresamplingcomplete","imageresampled","labelingstart","labelschanged"];class Ot extends EventTarget{#te;#d;#ne;#ie;#oe;#re;#ae;#se=new Fe(1,0);#le=null;#ce=!0;#ue=!0;#de="MONOCHROME2";#he;#ge=0;#Se;#pe={};#me=null;#fe=null;#ve=null;#Ce;#De=!1;constructor(e,t,n){super(),this.#te=e,this.#d=t,this.#ne=!1,this.#ie="0",this.#oe=null,this.#re=null,this.#ae=n,this.#Ce=null,this.#Se=this.#d.length/this.#te.getSize().getTotalSize()}setComplete(e){this.#De=e,e&&this.#te.updateSliceSpacing()}getComplete(){return this.#De}getInitialIndex(){const e=this.#te.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.#ae[0];return 1!==this.#ae.length&&void 0!==e&&(t=this.#ae[this.getSecondaryOffset(e)]),t}getOriginForImageUid(e){let t;const n=this.#ae.indexOf(e);return-1!==n&&(t=this.getGeometry().getOrigins()[n]),t}includesImageUid(e){return this.#ae.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.#ae,e)}getGeometry(){return this.#te}getBuffer(){return this.#d}canQuantify(){return 1===this.getNumberOfComponents()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return et(this.getPhotometricInterpretation())}isMask(){return!1}canScroll(e){const t=this.getGeometry().getSize();let n=1;return void 0!==this.#pe.numberOfFiles&&(n=this.#pe.numberOfFiles),t.canScroll(e)||1!==n}#ye(){return this.#te.getSize().getTotalSize(2)}getSecondaryOffset(e){return this.#te.getSize().indexToOffset(e,2)}getRescaleSlopeAndIntercept(e){let t=this.#se;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.#le[n]?t=this.#le[n]:s.warn(`undefined non constant rsi at ${n}`)}return t}#Ie(e){return this.#le[e]}setRescaleSlopeAndIntercept(e,t){if(this.#ce=this.#ce&&e.isID(),this.#ue){if(!this.#se.equals(e))if(void 0===t)this.#se=e;else{this.#ue=!1,this.#le=[];for(let e=0,t=this.#ye();e<t;++e)this.#le.push(this.#se);this.#se=null,this.#le.splice(t,0,e)}}else{if(void 0===t)throw new Error("Cannot store non constant RSI with empty slice index.");this.#le.splice(t,0,e)}}isIdentityRSI(){return this.#ce}isConstantRSI(){return this.#ue}getPhotometricInterpretation(){return this.#de}setPhotometricInterpretation(e){this.#de=e}setPaletteColourMap(e){this.#he=e,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPaletteColourMap(){return this.#he}updatePaletteColourMap(e,t){this.#he.red[e]=t.r,this.#he.green[e]=t.g,this.#he.blue[e]=t.b,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPlanarConfiguration(){return this.#ge}setPlanarConfiguration(e){this.#ge=e}getNumberOfComponents(){return this.#Se}getMeta(){return this.#pe}setMeta(e){this.#pe=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.#Se?t.push([e[n]]):3===this.#Se&&t.push([e[n].r,e[n].g,e[n].b]);let n;1===this.#Se?n=function(e,t){return e[0]===t[0]}:3===this.#Se&&(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.#Se){s=[];for(let n=0;n<r.length;++n){a=!0;for(let t=0;t<this.#Se;++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.#ae);if(this.isConstantRSI())t.setRescaleSlopeAndIntercept(this.getRescaleSlopeAndIntercept());else for(let e=0;e<this.#ye();++e)t.setRescaleSlopeAndIntercept(this.#Ie(e),e);return t.setPhotometricInterpretation(this.getPhotometricInterpretation()),t.setPlanarConfiguration(this.getPlanarConfiguration()),t.setPaletteColourMap(structuredClone(this.#he)),t.setMeta(structuredClone(this.getMeta())),t}replaceBuffer(e){this.#d=e,this.dispatchEvent(new CustomEvent("imagecontentchange"))}#we(e){let t=this.#d;if(this.#d=Oe(8*this.#d.BYTES_PER_ELEMENT,this.#pe.PixelRepresentation,e),null===this.#d)throw new Error("Cannot reallocate data for image.");this.#d.set(t),t=null,this.dispatchEvent(new CustomEvent("imagebufferrealloc"))}#Te(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.#te.canAppendSlice(e.getGeometry());return t.success?this.#Le(e):t}#Le(e){if(this.#de!==e.getPhotometricInterpretation())return{success:!1,message:"Cannot append a slice with different photometric interpretation"};for(const t in this.#pe)if("windowPresets"!==t&&"numberOfFiles"!==t&&"custom"!==t&&"SeriesTime"!==t&&this.#pe[t]!==e.getMeta()[t])return{success:!1,message:`Cannot append a slice with different ${t}: ${this.#pe[t]} != ${e.getMeta()[t]}`};return new l(!0)}appendSlice(e){const t=this.canAppendSlice(e);if(!t.success)throw new Error(t.message);const n=e.getDataRange(),i=this.getDataRange();this.#me={min:Math.min(n.min,i.min),max:Math.max(n.max,i.max)};const o=e.getRescaledDataRange(),r=this.getRescaledDataRange();this.#fe={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=this.#te.getCurrentTotalNumberOfSlices();let u=!1;void 0===l||this.#te.hasSlicesAtTime(l)||(this.appendFrame(l,e.getGeometry().getOrigin()),s=this.#te.getSize(),u=!0);const d=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 a(i)}(this.#te,e.getGeometry()),h=this.#Se*s.getDimSize(2);if(void 0===this.#pe.numberOfFiles)throw new Error("Missing number of files for buffer manipulation.");const g=h*this.#pe.numberOfFiles;this.#d.length!==g&&this.#we(g);const S=d.get(2);let p=S;void 0!==l&&(p+=this.#te.getCurrentNumberOfSlicesBeforeTime(l));const m=p*h,f=c*h;this.#Te(m,h,f),this.#d.set(e.getBuffer(),m),u||this.#te.appendOrigin(e.getGeometry().getOrigin(),S,l),this.setRescaleSlopeAndIntercept(e.getRescaleSlopeAndIntercept(),p);const v=this.#ae.length;if(this.#ae.splice(p,0,e.getImageUid()),void 0!==this.#pe.windowPresets){const t=this.#pe.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)&&!Lt(a.wl[0],r.wl[0])){a.perslice=!0;for(let e=0;e<v-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.#te.getSize(),i=this.#Se*n.getDimSize(2);if(void 0===this.#pe.numberOfFiles)throw new Error("Missing number of files for frame buffer manipulation.");const o=i*this.#pe.numberOfFiles;this.#d.length!==o&&this.#we(o),t>=this.#pe.numberOfFiles?s.warn(`Ignoring frame at index ${t} (size: ${this.#pe.numberOfFiles})`):(this.#d.set(e,i*t),this.appendFrame(t,new f(0,0,0)))}appendFrame(e,t){this.#te.appendFrame(t,e),this.dispatchEvent(new CustomEvent("appendframe"))}getDataRange(){return this.#me||(this.#me=this.calculateDataRange()),this.#me}getRescaledDataRange(){return this.#fe||(this.#fe=this.calculateRescaledDataRange()),this.#fe}getHistogram(){if(!this.#ve){const e=this.calculateHistogram();this.#me=e.dataRange,this.#fe=e.rescaledDataRange,this.#ve=e.histogram}return this.#ve}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}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]=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,C,D=n;for(let n=0;n<a;++n){D+=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=p: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=m: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(D+C[t])*e[t];t[D]=v,D+=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.#ne}resample(e,t=void 0,n=void 0){null===this.#Ce&&(this.#Ce=new Ct,this.#Ce.ondoneframe=e=>{const t=e.data;this.#ie===t.jobId&&(this.#d.set(t.targetImageBuffer,t.startOffset),this.dispatchEvent(new CustomEvent("imageresampled",{detail:{frame:t.frame}})))},this.#Ce.ondone=e=>{this.dispatchEvent(new CustomEvent("imageresamplingcomplete"))});const i=this.#ne&&this.#re&&this.#oe?{buffer:this.#re,geometry:this.#oe}:{buffer:this.#d,geometry:this.#te};this.dispatchEvent(new CustomEvent("imageresamplingstart"));const o=this.#Ce.run(i.buffer,i.geometry,this.#pe.PixelRepresentation,e,void 0===t||t,n);this.#ne||(this.#ne=!0,this.#re=this.#d,this.#oe=this.#te),this.#d=o.buffer,this.#te=o.geometry,this.#ie=o.jobId,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange"))}revert(){this.#ne&&(this.dispatchEvent(new CustomEvent("imageresamplingstart")),this.#ne=!1,this.#d=this.#re,this.#te=this.#oe,this.#re=null,this.#oe=null,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange")),this.dispatchEvent(new CustomEvent("imageresampled")))}}const bt=["annotationgroupeditablechange","annotationadd","annotationupdate","annotationremove"];class xt extends EventTarget{#Pe;#pe={};#Ae;#Oe;constructor(e){super(),this.#Pe=void 0!==e?e:[],this.#Ae=!0}getList(){return this.#Pe}getLength(){return this.#Pe.length}isEditable(){return this.#Ae}setEditable(e){this.#Ae=e,this.dispatchEvent(new CustomEvent("annotationgroupeditablechange",{detail:{data:e}}))}getColour(){return this.#Oe}setColour(e){this.#Oe=e}add(e,t){this.#Pe.push(e),this.dispatchEvent(new CustomEvent("annotationadd",{detail:{data:e,propagate:t}}))}update(e,t,n){const i=this.#Pe.findIndex(t=>t.trackingUid===e.trackingUid);-1!==i?((t.includes("mathShape")||t.includes("textExpr"))&&e.updateQuantification(),this.#Pe[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.#Pe.findIndex(t=>t.trackingUid===e);if(-1!==n){const e=this.#Pe.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.#Pe)t.setViewController(e),t.updateQuantification()}find(e){return this.#Pe.find(t=>t.trackingUid===e)}getMeta(){return this.#pe}hasMeta(e){return void 0!==this.#pe[e]}getMetaValue(e){return this.#pe[e]}setMetaValue(e,t){this.#pe[e]=t}}class Et{r;g;b;constructor(e,t,n){this.r=e,this.g=t,this.b=n}}function Rt(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 Ft(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 Mt(e){return{r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)}}function qt(e){return`#${((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)}`}function Ut(e){return{l:.001525902*e.l,a:.003891051*e.a-128,b:.003891051*e.b-128}}function Qt(e){return{l:655.35*e.l,a:257*e.a+32896,b:257*e.b+32896}}const Vt={x:95.0489,y:100,z:108.884};function Nt(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=Vt,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 Bt(e){return function(e){function t(e){let t;return t=e>.008856452?Math.pow(e,.333333333):7.787037037*e+.137931034,t}const n=Vt,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 kt=[new Et(0,0,0),new Et(255,0,0),new Et(0,255,0),new Et(0,0,255),new Et(255,255,0),new Et(0,255,255),new Et(255,0,255),new Et(255,239,213),new Et(0,0,205),new Et(205,133,63),new Et(210,180,140),new Et(102,205,170),new Et(0,0,128),new Et(0,139,139),new Et(46,139,87),new Et(255,228,225)];function Gt(e){let t;return t=e<kt.length?kt[e]:new Et(255*Math.random(),255*Math.random(),255*Math.random()),t}class zt{#be=10;#xe="Verdana";#Ee="#fff";#Re="#ffff80";#Fe={x:1,y:1};#Me={x:1,y:1};#qe=2;#Ue={x:.25,y:.25};#Qe=.2;#Ve=3;getFontFamily(){return this.#xe}getFontSize(){return this.#be}getStrokeWidth(){return this.#qe}getTextColour(){return this.#Ee}getLineColour(){return this.#Re}setLineColour(e){this.#Re=e}setBaseScale(e){this.#Fe=e}setZoomScale(e){this.#Me=e}getBaseScale(){return this.#Fe}getZoomScale(){return this.#Me}scale(e){return e/this.#Fe.x}applyZoomScale(e){return{x:e/this.#Me.x,y:e/this.#Me.y}}applyZoomRatio(e){return e*this.#Me.x/this.#Me.y}getShadowOffset(){return this.#Ue}getTagOpacity(){return this.#Qe}getTextPadding(){return this.#Ve}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=Mt(e)).r+.002301961*t.g+447059e-9*t.b<.5;var t}(this.getLineColour())?"#fff":"#000"}}function Ht(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 Yt(e){const t=Ht(e);return 0===Object.keys(t).length?null:t.query}function Xt(e){let t;const n=Yt(e);return n&&void 0!==n.input&&(t=$t(n.input,n.dwvReplaceMode)),t}function Wt(e,t){const n=Yt(e);n&&void 0!==n.input&&jt(n.input,n.nslices,t)}function $t(e,t){const n=[];let i="key";t&&(i=t);const o=decodeURIComponent(e),r=Ht(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 jt(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 Zt=["mousedown","mousemove","mouseup","mouseout","wheel","dblclick","touchstart","touchmove","touchend"];function _t(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 m(e[t].clientX-n,e[t].clientY-i));return o}function Kt(e){const t=e.currentTarget.getBoundingClientRect();let n=[];return void 0!==e.targetTouches&&0!==e.targetTouches.length?n=_t(e.targetTouches,t):void 0!==e.changedTouches&&0!==e.changedTouches.length&&(n=_t(e.changedTouches,t)),n}function Jt(e){return new m(e.offsetX,e.offsetY)}function en(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 tn{#Ne;#Be=null;#ke=[];#Ge={};constructor(e){this.#Ne=e}init(){for(const e in this.#Ne)this.#Ne[e].init();this.enableShortcuts(!0)}enableShortcuts(e){e?window.addEventListener("keydown",this.#ze("window","keydown"),!0):window.removeEventListener("keydown",this.#ze("window","keydown"),!0)}getToolList(){return this.#Ne}hasTool(e){return void 0!==this.getToolList()[e]}getSelectedTool(){return this.#Be}getSelectedToolEventHandler(e){if(this.getSelectedTool())return this.getSelectedTool()[e]}setSelectedTool(e){if(!this.hasTool(e))throw new Error(`Unknown tool: '${e}'`);this.#Be&&this.#Be.activate(!1),this.#Be=this.#Ne[e],this.#Be.activate(!0)}setToolFeatures(e){this.getSelectedTool()&&this.getSelectedTool().setFeatures(e)}bindLayerGroup(e,t){const n=e.getDivId();e.addEventListener("activelayerchange",this.#He(n)),this.#Ye(n,t)}#Ye(e,t){void 0!==this.#Ge[e]&&this.#Xe(this.#Ge[e]),this.#Ge[e]=t,this.#We(t)}#He(e){return t=>{const n=t.detail?.value,i=n?.[0];void 0!==i&&this.#Ye(e,i)}}#We(e){e.bindInteraction();const t=Zt;for(let n=0;n<t.length;++n)e.addEventListener(t[n],this.#ze(e.getId(),t[n]))}#Xe(e){e.unbindInteraction();const t=Zt;for(let n=0;n<t.length;++n)e.removeEventListener(t[n],this.#ze(e.getId(),t[n]))}#ze(e,t){if(void 0===this.#ke[e]&&(this.#ke[e]=[]),void 0===this.#ke[e][t]){const n=e=>{if(this.#Be){const t=this.#Be[e.type];t&&t(e)}};this.#ke[e][t]=n}return this.#ke[e][t]}}class nn{#$e=[];#je=2;#Ze;constructor(e){this.#Ze=e}setNumberOfDimensions(e){this.#je=e}setNToLoad(e){for(let t=0;t<e;++t){this.#$e[t]=[];for(let e=0;e<this.#je;++e)this.#$e[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.#$e[e.index][e.subindex]=t,n=void 0!==e.item?e.item:{loaded:this.#_e(e.index),total:100,source:e.source},this.#Ze({lengthComputable:!0,loaded:this.#Ke(),total:100,item:n})};#_e(e){let t=0;for(let n=0;n<this.#je;++n)t+=this.#$e[e][n];return t/this.#je}#Ke(){let e=0;const t=this.#$e.length;for(let n=0;n<t;++n)e+=this.#_e(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 on{onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class rn extends on{#Je=null;#et=[];#tt=null;#nt=0;#it=0;#ot;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#rt(e){this.#Je=e,this.#nt=0,this.#it=0,this.#ot=!1,this.#at(),this.#st()}#lt(e){this.#et.push(e)}#at(){this.#et=[]}#ct(e){this.#tt=e}#st(){this.#tt=null}#ut=e=>{this.#nt++,this.#nt===this.#Je.length&&this.onload({source:this.#Je})};#dt=e=>{this.#it++,this.#it===this.#Je.length&&this.onloadend({source:this.#Je})};#ht(e,t){return n=>{n.source=t,e(n)}}load(e,t){this.onloadstart({source:e}),1===e.length&&(I(e[0],"DICOMDIR")||I(e[0],".dcmdir"))?this.#gt(e[0],t):this.#St(e,t)}#pt(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)}}#St(e,t){if(void 0===e||0===e.length)return;this.#rt(e);const n=new nn(this.onprogress);n.setNToLoad(e.length);const i=Gs(),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({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),a.onprogress=n.getUndefinedMonoProgressHandler(1),a.onloaditem=this.onloaditem,a.onload=this.#ut,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.#et.length-1&&!this.#ot&&(++l,this.#et[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.#ht(n.getMonoProgressHandler(i,0),r),o.onload=this.#pt(a,r,i),o.onloadend=c;const s=this.#ht(this.onerror,r);o.onerror=e=>{this.#dt(),s(e)};const l=this.#ht(this.ontimeout,r);o.ontimeout=e=>{this.#dt(),l(e)};const u=this.#ht(this.onabort,r);o.onabort=e=>{this.#dt(),u(e)},1===a.loadUrlAs()&&(o.responseType="arraybuffer"),this.#lt(o)}let u=this.#et.length;void 0!==t&&void 0!==t.batchSize&&0!==u&&(u=Math.min(t.batchSize,this.#et.length));for(let e=0;e<u;++e)this.#ot||(l=e,this.#et[l].send(null))}#gt(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 Re;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.#St(r,t)}},n.onerror=t=>{this.#ht(this.onerror,e)(t),this.onloadend({})},n.onabort=t=>{this.#ht(this.onabort,e)(t),this.onloadend({})},n.send(null)}abort(){this.#ot=!0;for(let e=0;e<this.#et.length;++e)4!==this.#et[e].readyState&&this.#et[e].abort();this.#tt&&this.#tt.isLoading()&&this.#tt.abort()}ontimeout(e){}}class an extends rt{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 sn extends rt{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 ln extends rt{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 cn extends rt{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 un{#mt;#ft;#vt=!1;constructor(e){this.#mt=e,this.#ft=new it(10)}decode(e,t,n){this.#vt||(this.#vt=!0,this.#ft.onworkstart=this.ondecodestart,this.#ft.onworkitem=this.ondecodeditem,this.#ft.onwork=this.ondecoded,this.#ft.onworkend=this.ondecodeend,this.#ft.onerror=this.onerror,this.#ft.onabort=this.onabort);const i={buffer:e,meta:t};let o;"jpeg-baseline"===this.#mt?o=new an(i,n):"jpeg-lossless"===this.#mt?o=new sn(i,n):"jpeg2000"===this.#mt?o=new ln(i,n):"rle"===this.#mt&&(o=new cn(i,n)),void 0!==o&&this.#ft.addWorkerTask(o)}abort(){this.#ft.abort()}ondecodestart(e){}ondecodeditem(e){}ondecoded(e){}ondecodeend(e){}onerror(e){}onabort(e){}}function dn(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 hn(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 gn(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 Sn(e){let t;return void 0!==e&&(t={year:e.getFullYear(),monthIndex:e.getMonth(),day:e.getDate()}),t}function pn(e){let t;return void 0!==e&&(t={hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}),t}function mn(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 fn(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 vn(e){return function(t,n){if("mergeId"===n)return t;const i=U(n),o=re(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(vn(t),{}))}}else s=1===a.value.length?a.value[0]:a.value;return t[r]=s,t}}function Cn(e){const t=structuredClone(e);return Object.keys(t).reduce(vn(t),{})}function Dn(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 yn(e){const t=Object.keys(e),n={};for(const i of t){const t=se(i);if(void 0===t)continue;const o=re(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(yn(n));else s.debug("Non array simpleTag SQ value");a=e}else a=Array.isArray(c)?c:[c];const u=new le(r);u.tag=t,u.value=a,l&&(u.undefinedLength=l),n[t.getKey()]=u}return n}const In="00080100",wn="00080102",Tn="00080119",Ln="00080120";class Pn{meaning;value;longValue;urnValue;schemeDesignator;constructor(e){this.meaning=e}toString(){return`(${this.value}, ${this.schemeDesignator}, '${this.meaning}')`}}function An(e,t){return void 0!==e&&void 0!==t&&e.schemeDesignator===t.schemeDesignator&&e.value===t.value}function On(e){const t=new Pn(e["00080104"].value[0]);if(void 0!==e[In])t.value=e[In].value[0];else if(void 0!==e[Tn])t.longValue=e[Tn].value[0];else{if(void 0===e[Ln])throw new Error("Invalid code with no value, no long value and no urn value.");t.urnValue=e[Ln].value[0]}if(void 0!==t.value||void 0!==t.longValue){if(void 0===e[wn])throw new Error("No coding sheme designator when code value or long value is present");t.schemeDesignator=e[wn].value[0]}return t}function bn(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 xn={value:"111017",meaning:"CAD Processing and Findings Summary"},En={value:"111030",meaning:"Image Region"},Rn={value:"111059",meaning:"Single Image Finding"},Fn={value:"111099",meaning:"Selected region"},Mn={value:"111242",meaning:"All algorithms succeeded; with findings"},qn={value:"112000",meaning:"Chest CAD Report"},Un={value:"112020",meaning:"Response Evaluation"},Qn={value:"112021",meaning:"Response Evaluation Method"},Vn={value:"112022",meaning:"RECIST"},Nn={value:"112039",meaning:"Tracking Identifier"},Bn={value:"112051",meaning:"Measurement of Response"},kn={value:"112040",meaning:"Tracking Unique Identifier"},Gn={value:"112048",meaning:"Current Response"},zn={value:"113076",meaning:"Segmentation"},Hn={value:"121055",meaning:"Path"},Yn={value:"121106",meaning:"Comment"},Xn={value:"121322",meaning:"Source image for image processing operation"},Wn={value:"121324",meaning:"Source Image"},$n={value:"122438",meaning:"Reference Points"},jn={value:"125007",meaning:"Measurement Group"},Zn={value:"125309",meaning:"Short Label"},_n={value:"126000",meaning:"Imaging Measurement Report"},Kn={value:"126010",meaning:"Imaging Measurements"},Jn={value:"128773",meaning:"Reference Geometry"},ei={1483009:"Angle",42798e3:"Area",103355008:"Width",103339001:"Long axis",103340004:"Short axis",131190003:"Radius",261665006:"Unknown",410668003:"Length",718499004:"Color"},ti={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 ni(e){const t=new Pn(e.meaning);return t.schemeDesignator="DCM",t.value=e.value,t}function ii(e,t){let n,i;return"SCT"===t?n=ei[e]:"UCUM"===t&&(n=ti[e]),void 0!==n&&(i=new Pn(n),i.schemeDesignator=t,i.value=e),i}function oi(){return ni(zn)}function ri(){return ii("718499004","SCT")}const ai={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"}},si={"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 li(e){const t=si[e];let n;return void 0!==t?n=ii(t,"UCUM"):void 0===t&&(n=ii("1","UCUM")),n}const ci="00620005",ui="00620009",di="0062000C",hi="0062000D",gi="00620003",Si="0062000F",pi="00620020";class mi{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 fi(e){const t=new mi(e["00620004"].value[0],e[ci]?e[ci].value[0]:"n/a",e["00620008"].value[0]);if(void 0!==e[ui]&&(t.algorithmName=e[ui].value[0]),void 0!==e[di])t.displayValue=e[di].value[0];else if(void 0!==e[hi]){const n=e[hi].value,i=Nt(Ut({l:n[0],a:n[1],b:n[2]}));t.displayRGBValue=i}else s.warn("No recommended colour for segment, using default"),t.displayRGBValue=Gt(t.number);if(void 0===e[gi])throw new Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=On(e[gi].value[0]),void 0===e[Si])throw new Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=On(e[Si].value[0]),void 0!==e[pi]&&(t.trackingId=e[pi].value[0],t.trackingUid=e["00620021"].value[0]),t}function vi(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=Qt(Bt(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:[bn(e.propertyCategoryCode)]}),e.propertyTypeCode&&(n.SegmentedPropertyTypeCodeSequence={value:[bn(e.propertyTypeCode)]}),e.trackingId&&(n.TrackingID=e.trackingId,n.TrackingUID=e.trackingUid),n}const Ci="00089124",Di="00082112",yi="00081150",Ii="00081155",wi="00209111",Ti="00209164",Li="00209113",Pi="00209116",Ai="00289110";class Oi{dimIndex;imagePosPat;derivationImages;refSegmentNumber;imageOrientationPatient;spacing;constructor(e,t,n,i){this.dimIndex=e,this.imagePosPat=t,this.derivationImages=n,this.refSegmentNumber=i}}function bi(e){const t=[];if(void 0!==e[Ci]){const n=e[Ci].value;for(let e=0;e<n.length;++e){const i=[];if(void 0!==n[e][Di]){const t=n[e][Di].value;for(let e=0;e<t.length;++e){const n={};void 0!==t[e][yi]&&(n.referencedSOPClassUID=t[e][yi].value[0]),void 0!==t[e][Ii]&&(n.referencedSOPInstanceUID=t[e][Ii].value[0]),i.push(n)}}t.push({sourceImages:i})}}if(void 0===e[wi])return void s.info("Missing frame content sequence");const n=e[wi].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[Li])return void s.info("Missing plane position sequence");const a=e[Li].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 Oi(i,l,t,o);if(void 0!==e[Pi]){const t=e[Pi];if(0!==t.value.length){const e=t.value[0]["00200037"].value;void 0!==e&&(c.imageOrientationPatient=e)}}if(void 0!==e[Ai]){const t=e[Ai];if(0!==t.value.length){const e=Ke(t.value[0]);void 0!==e&&(c.spacing=e)}else s.warn("No shared functional group pixel measure sequence items.")}return c}function xi(e,t){const n=de(e,"52009230");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(bi(e))}return i}function Ei(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=bn(ni(Xn)),i=bn(ni(zn)),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 Ri={GE:"ge",SIEMENS:"siemens",PHILIPS:"philips",HITASHI:"hitashi"};function Fi(e){return ue(e,"00080070")}function Mi(e){let t;const n=Fi(e);return void 0!==n&&(t=n.toUpperCase().startsWith("SIEMENS")?Ri.SIEMENS:n.startsWith("GE")?Ri.GE:n.startsWith("Philips")?Ri.PHILIPS:n.toLowerCase()),t}const qi="00080016",Ui="52009230",Qi="00189087",Vi="00209111",Ni=[{manufacturer:Ri.SIEMENS,key:"0019100C"},{manufacturer:Ri.GE,key:"00431039"},{manufacturer:Ri.HITASHI,key:"00291030"}],Bi="1.2.840.10008.5.1.4.1.1.4",ki="1.2.840.10008.5.1.4.1.1.4.1",Gi="1.2.840.10008.5.1.4.1.1.4.2",zi="1.2.840.10008.5.1.4.1.1.4.3";function Hi(e){let t;const n=de(e,"00189117");return void 0!==n&&(t=ue(n[0],Qi)),t}function Yi(e){let t;const n=de(e,"52009229");if(void 0!==n&&(t=Hi(n[0])),void 0===t){const n=de(e,Ui);if(void 0!==n)for(const e of n)if(t=Hi(e),void 0!==t)break}return t}function Xi(e){let t;const n=ue(e,qi);return n===ki||n===Gi||n===zi?(t=Yi(e),void 0===t&&(t=function(e){let t;const n=Mi(e);return void 0!==n&&n===Ri.PHILIPS&&(t=function(e){let t,n=!1;const i=de(e,"00209222");if(void 0!==i)for(const e of i){const t=ue(e,"00209165");if(void 0!==t&&"(0018,9087)"===t){n=!0;break}}if(n){const n=de(e,Ui);if(void 0!==n){const e=de(n[0],Vi);if(void 0!==e){const n=de(e[0],"00209157");void 0!==n&&(t=n[2])}}}return t}(e)),t}(e),void 0!==t&&s.debug("Got b-value for enhanced MR from non standard tag"))):n===Bi&&(t=function(e){let t;if(void 0===t){const n=Mi(e),i=ue(e,"00080018");let o;o=void 0!==Me.privateBValueRules?Me.privateBValueRules:Ni;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=ue(e,r.key)),void 0!==t&&!isNaN(parseInt(t,10)))break}return void 0===t&&(t=ue(e,Qi)),t}(e),void 0===t&&void 0===t&&(t=Yi(e))),void 0!==t&&(t=parseInt(t,10)),t}function Wi(e){let t;const n=ue(e,qi);if(n===Bi||n===ki||n===Gi||n===zi){const n=Xi(e);void 0!==n&&(t=n)}return t}function $i(e){let t;const n=de(e,Ui);if(void 0!==n){for(const e of n){const n=de(e,Vi);if(void 0===n)continue;const i=ue(n[0],"00209128");if(void 0!==i){const e=parseInt(i,10);if(void 0===t)t=e;else if(t!==e)return void s.debug("Unhandled varying TemporalPositionIndex")}}return t}}function ji(e,t){return function(n){let i;const o=ue(n,e);return void 0!==o&&(i=t(o)),i}}const Zi=ji("00200100",e=>parseInt(e,10));function _i(e){let t;if(void 0!==Me.getVolumeIdTagValue)t=Me.getVolumeIdTagValue(e);else if(t=Zi(e),void 0===t&&(t=$i(e)),void 0===t){const n=Wi(e);void 0!==n&&(t=n)}return t}const Ki=[{name:"TemporalPositionIdentifier",getter:Zi},{name:"TemporalPositionIndex",getter:$i},{name:"DiffusionBValue",getter:Wi},{name:"EchoTime",getter:ji("00180081",parseFloat)},{name:"TriggerTime",getter:ji("00181060",parseFloat)},{name:"InversionTime",getter:ji("00180082",parseFloat)},{name:"AcquisitionTime",getter:ji("00080032",parseFloat)}],Ji="00209116",eo="00289110";function to(e){const t=$e(e),n=[t[0],t[1],1],i=ue(e,"00280008");if(void 0!==i){const e=parseInt(i,10);e>1&&n.push(e)}const o=new ut(n);let r=[1,1,1];const a=_e(e);if(void 0!==a)r=[a[0],a[1],1];else{const t=je(e,We.PixelAspectRatio);void 0!==t&&(r=[t[0],t[1],1],s.warn("Use pixel aspect ratio as spacing"))}const l=new Xe(r),c=de(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=de(e,We.ImageOrientationPatient);let n;return void 0!==t&&(n=He(t.map(e=>parseFloat(e)))),n}(e),h=new f(u[0],u[1],u[2]),g=_i(e);return new St([h],o,l,d,g)}function no(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 io(e,t,n,i){const o=$e(e),r=new ut([o[0],o[1],1]);let l,c;const u=de(e,"52009229");if(void 0!==u){const e=u[0];if(void 0!==e[Ji]){const t=e[Ji];0!==t.value.length?c=t.value[0]["00200037"].value:s.warn("No shared functional group plane orientation sequence items.")}if(void 0!==e[eo]){const t=e[eo];0!==t.value.length?l=Ke(t.value[0]):s.warn("No shared functional group pixel measure sequence items.")}}const d=[];for(let e=0;e<t.length;++e){const n=C(t[e].imagePosPat);if(v(d,n)||d.push(n),void 0!==t[e].imageOrientationPatient)if(void 0===c)c=t[e].imageOrientationPatient;else if(!O(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 h=He(c.map(e=>parseFloat(e)));if(void 0===h)throw new Error("Invalid imageOrientationPatient found for frames geometry");let S;if(void 0===n||!1===n){S=d;const e=ft(S.slice().sort(ht(h)));2===l.length()?l=new Xe([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);no(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}(d,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 d=u;for(;g(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>d)throw new Error("Test distance is increasing when adding intermediate pos pats");n.push(c)}return n}(d,new St([d[0]],r,l,h));if(3!==l.length())throw new Error("Incomplete spacing found for frames geometry");const p=new St([S[0]],r,l,h);for(let e=1;e<S.length;++e)p.appendOrigin(S[e],e);const m=_i(e);return void 0!==m&&p.setInitialTime(m),p}function oo(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 ro(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function ao(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 p=e.getNumberOfComponents(),m=1===e.getPlanarConfiguration(),f=function(e,t,n,i,o,r,a,s){return 1===p?oo(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(oo(e,t,n,i,o,r,a,s)),c.push(oo(e,t+n*i,n,i,o,r,a,s)),c.push(oo(e,t+2*n*i,n,i,o,r,a,s))):(i*=3,r*=3,c.push(oo(e,t,n,i,o,r,a,s)),c.push(oo(e,t+1,n,i,o,r,a,s)),c.push(oo(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,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(){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,m)}return v}function so(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 lo(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 co extends rt{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{#H=new it(navigator?.hardwareConcurrency??4);constructor(){this.#H.onerror=e=>{console.error("Labeling failed!",e.error)}}run(e,t){this.#H.onworkitem=this.ondone,this.#H.onwork=()=>{};const n=new co(function(e,t){return{imageBuffer:e,...lo(t.getSize(),t.getSpacing())}}(e,t),{});this.#H.addWorkerTask(n)}runOverlap(e,t){const n=[],i=new Map(e.map(({segNumber:e,minSlice:t})=>[e,t??0]));this.#H.onworkitem=e=>{for(const t of e.data.labels){const e=i.get(t.id)??0;t.centroidIndex[2]+=e,t.largestSliceZ+=e}n.push(...e.data.labels)},this.#H.onwork=()=>{this.ondone({data:{labels:n}})};for(const{segNumber:n,size:i,slices:o}of e){const e=lo(i,t.getSpacing());this.#H.addWorkerTask(new co({segmentSlice:{segNumber:n,slices:o},...e},{}))}}ondone(e){}}class ho{#Ct=null;#Dt=null;#yt=null;initialize(e,t){this.#Dt=e,this.#yt=t,this.#Ct=new Uint8Array(3*e.length)}isInitialized(){return null!==this.#Ct}realloc(e,t){this.#Dt=e,this.#yt=t;let n=this.#Ct;this.#Ct=new Uint8Array(3*e.length),this.#Ct.set(n),n=null}shiftSlice(e,t,n){this.#Ct.set(this.#Ct.subarray(e,n),e+t)}#It(e){this.#Ct[3*e]=0,this.#Ct[3*e+1]=0,this.#Ct[3*e+2]=0}resetAroundOffset(e){if(!this.isInitialized())return;this.#It(e);const t=this.#yt.getDimSize(0),n=this.#yt.getDimSize(1),i=this.#yt.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.#Dt.length&&this.#It(s)}}#wt(e,t,n,i,o,r){return()=>{const a=t+n,s=e+1,l=this.#yt.offsetToIndex(a);return a>=this.#Dt.length||a<0||0===l.get(i)||l.get(i)===this.#yt.get(i)-1||255===s?s:s>10?255:this.#Dt[a]!==o?s:(r.push(this.#wt(s,a,n,i,o,r)),0)}}#Tt(e,t,n,i,o,r,a,s){return()=>{const l=t+n,c=e+1,u=this.#yt.offsetToIndex(l);return l>=this.#Dt.length||l<0||0===u.get(o)||u.get(o)===this.#yt.get(o)-1||255===c?c:c>10?255:this.#Dt[l]!==a?c:(s.push(this.#wt(c,l,i,r,a,s)),s.push(this.#wt(c,l,-i,r,a,s)),s.push(this.#Tt(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.#Ct[r];if(a>0)return a;const s=this.#Dt[e],l=[],c=this.#yt.getDimSize(o),u=this.#yt.getDimSize(i);l.push(this.#Tt(0,e,c,u,o,i,s,l)),l.push(this.#wt(0,e,u,i,s,l)),l.push(this.#wt(0,e,-u,i,s,l)),l.push(this.#Tt(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.#Ct[r]=255,255;const e=l.shift()();if(e>0)return this.#Ct[r]=e,e}return 1/0}}function go(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 So{#te;#Lt=new Map;#Pt=!1;#At;constructor(e){this.#te=e}getAll(){return this.#Lt}setLabelMap(e){this.#At=e}addFrame(e,t,n,i,o,r){this.#Lt.has(e)||this.#Lt.set(e,new Map);const a=this.#Lt.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.#At)return this.#At;const e=this.#te.getSize().getDimSize(2),t=this.#te.getSize().getTotalSize(),n=new Uint8Array(t);for(const[,t]of this.#Lt)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.#Pt=!0),0===n[t+i]&&(n[t+i]=o[i]))}return this.#Pt&&s.warn("SegmentCollection: detected overlapping segments"),this.#At=n,n}#Ot(e){const t=this.#te.getSize().getDimSize(2),n=Math.floor(e/t);return{sliceIndex:n,localOffset:e-n*t}}updateAtOffset(e,t,n){if(0===this.#Lt.size||t===n)return;const i=this.#te.getSize().getDimSize(2),{sliceIndex:o,localOffset:r}=this.#Ot(e);if(0!==t){const e=this.#Lt.get(t)?.get(o);void 0!==e&&(e[r]=0)}if(0!==n){this.#Lt.has(n)||this.#Lt.set(n,new Map);const e=this.#Lt.get(n);e.has(o)||e.set(o,new Uint8Array(i)),e.get(o)[r]=n}}shiftSlices(e,t){if(0!==this.#Lt.size&&0!==t){for(const n of this.#Lt.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.#bt=void 0,this.#xt=""}}getOtherValueAtOffset(e,t){if(0===this.#Lt.size)return 0;const{sliceIndex:n,localOffset:i}=this.#Ot(e);for(const[e,o]of this.#Lt){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 So(this.#te);for(const[t,n]of this.#Lt){const i=new Map;for(const[e,t]of n)i.set(e,t.slice());e.#Lt.set(t,i)}return e.#Pt=this.#Pt,e}getHasOverlap(){return this.getLabelMap(),this.#Pt}getSegmentBuffers(e){if(0===this.#Lt.size){let t=e.map(e=>e.number);if(0===t.length&&void 0!==this.#At){const e=new Set;for(let t=0;t<this.#At.length;++t)0!==this.#At[t]&&e.add(this.#At[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=go(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.#At,this.#te,t)}const t={};for(const n of e){const e=n.number-1,i=this.#Lt.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}#bt;#xt="";getOrBuildUnionContour(e,t){const n=[];for(const[t]of this.#Lt)e?.isHidden(t)&&n.push(t);const i=n.sort().join(",");if(void 0!==this.#bt&&i===this.#xt)return this.#bt;const o=t.getDimSize(2),r=new Uint8Array(t.getTotalSize());for(const[t,n]of this.#Lt)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.#bt=new ho,this.#bt.initialize(r,t),this.#xt=i,this.#bt}}class po extends Ot{#Et;#Rt=new ho;#Ft=null;constructor(e,t,n,i){super(e,t,n),void 0===i&&(i=new So(e)).setLabelMap(t),this.#Et=i,this.addEventListener("imagebufferrealloc",()=>{this.#Et?.setLabelMap(this.getBuffer()),this.#Rt.isInitialized()&&this.#Rt.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.#Et?.shiftSlices(t/o,n/o),this.#Rt.isInitialized()){const e=3/this.getNumberOfComponents();this.#Rt.shiftSlice(t*e,n*e,i*e)}})}initializeContour(){this.#Rt.initialize(this.getBuffer(),this.getGeometry().getSize())}getContour(){return this.#Rt}getSegmentCollection(){return this.#Et}getHasOverlap(){return this.#Et?.getHasOverlap()??!1}getMaskReferencedSeriesUID(){return this.getMeta().custom.referencedSeriesUID}isMask(){return!0}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.#Et?.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.#Et?.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.#Et?.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=so(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.#Et?.updateAtOffset(e,t,s.value),s=a.next()}}this.dispatchEvent(new CustomEvent("imagecontentchange"))}#Mt(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.dispatchEvent(new CustomEvent("labelschanged",{detail:{labels:s}}))}#qt(){const e=this.getGeometry(),t=e.getSize(),n=t.get(0),i=t.get(1),o=[];for(const[e,t]of this.#Et.getAll()){const r=[...t.keys()],a=Math.min(...r),s=new ut([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.#Ft.runOverlap(o,e)}recalculateLabels(){this.dispatchEvent(new CustomEvent("labelingstart")),null===this.#Ft&&(this.#Ft=new uo,this.#Ft.ondone=e=>{this.#Mt(e.data.labels),e.data.buffer&&this.replaceBuffer(e.data.buffer)});const e=this.#Et;e?.getHasOverlap()&&e.getAll().size>0?this.#qt():this.#Ft.run(this.getBuffer(),this.getGeometry())}clone(){const e=super.clone(),t=this.#Et.clone();return t.setLabelMap(e.getBuffer()),e.#Et=t,e}}function mo(e){const t=[];for(let n=0;n<256;++n)t.push(e(n));return t}function fo(e){return e}function vo(e){return 255-e}class Co{red;green;blue;constructor(e,t,n){this.red=e,this.green=t,this.blue=n}}const Do={plain:{red:mo(fo),green:mo(fo),blue:mo(fo)},invPlain:{red:mo(vo),green:mo(vo),blue:mo(vo)},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:mo(function(e){const t=3*e;return t>255?255:t}),green:mo(function(e){const t=256/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n}),blue:mo(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]}},yo={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 Io(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(O(t.enum[e],i)){o=!0;break}}else o=t.enum.includes(i);if(!o)throw new Error(`Unsupported ${t.name} value: ${i}`)}const wo=[{name:"TransferSyntaxUID",tag:"00020010",type:"1",enum:[te,ne,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 To(){const e={};for(const t of wo)e[t.name]=t.enum[0];return e}class Lo{#Ut;getWarning(){return this.#Ut}checkElements(e){}create(e,t,n){const i=function(t){return ue(e,t)};for(const t of wo)Io(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][Ti].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][Ti].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=de(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=fi(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 Co(u,d,h));const p=function(e,t){return e.findIndex(function(e){return t.equals(e)})},m=xi(e,a);if(void 0===m)throw new Error("Missing or empty per frame functional sequence");if(m.some(e=>void 0===e))throw new Error("Incomplete per frame functional groups");let f;void 0!==n&&(f=n.getGeometry().getOrigins());const v=io(e,m,!0,f);v.sortOrigins();const D=v.getSize().get(2),y=function(e){return function(t){return t.number===e}},I=new So(v),w=v.getOrigins();let T;for(let e=0;e<m.length;++e){if(T=p(w,C(m[e].imagePosPat)),-1===T)throw new Error("Cannot find frame origin in mask origins");const n=c.find(y(m[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<D;++e)L.push(e.toString());const P=new po(v,I.getLabelMap(),L,I);S&&(P.setPhotometricInterpretation("PALETTE COLOR"),P.setPaletteColourMap(g));const A=To(),O=Object.keys(yo);for(const e of O)A[e]=i(yo[e]);return A.DimensionOrganizationSequence=s.organizations,A.DimensionIndexSequence=s.indices,A.custom={segments:c,frameInfos:m,SOPInstanceUID:i("00080018"),referencedSeriesUID:tt(e)},A.lengthUnit=n.getMeta().lengthUnit,A.numberOfFiles=D,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=mn(Sn(s)),o.ContentTime=fn(pn(s)),void 0!==n&&(o.StudyInstanceUID=n.getMeta().StudyInstanceUID);const l=[];for(const e of t)l.push(vi(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 Oi([t,r.length-i],l,void 0,t);if(void 0!==n){const e=n.getGeometry().worldToIndex(new D([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 p=[];for(const e of h)p.push(Ei(e));if(o.PerFrameFunctionalGroupsSequence={value:p},void 0!==n){const e=[];e.push({ReferencedInstanceSequence:{value:S},SeriesInstanceUID:n.getMeta().SeriesInstanceUID}),o.ReferencedSeriesSequence={value:e}}void 0!==i&&Dn(o,i);const m=yn(o),f=a.getDimSize(2),v=g.length*f/8,C=new le("OB");return C.tag=new M("7FE0","0010"),C.vl=v,C.value=g,m["7FE00010"]=C,m}}function Po(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),p=t.getSegmentCollection().getSegmentBuffers(g);let m,f;m=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(p).map(e=>Number(e)+1);const v=new Set(m);let C=v.size>0?Math.max(...v)+1:1;const D=new Map;for(const e of f)if(v.has(e)){const t=C++;s.warn(`mergeMaskImages: segment number conflict, remapping ${e} to ${t}`),D.set(e,t)}else D.set(e,e),v.add(e);const y=[...h,...g.map(e=>({...e,number:D.get(e.number)}))],I=new So(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(p)){const n=Number(e)+1,i=D.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 po(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=D.get(e);i[t]=a.red[e],o[t]=a.green[e],r[t]=a.blue[e]}P.setPhotometricInterpretation("PALETTE COLOR"),P.setPaletteColourMap(new Co(i,o,r))}else P.setPhotometricInterpretation(e.getPhotometricInterpretation());const A=structuredClone(e.getMeta());return void 0===A.custom&&(A.custom={}),A.custom.segments=y,P.setMeta(A),P}function Ao(e){return(new Lo).create(e,e["7FE00010"].value[0])}class Oo{name;wl;perslice;constructor(e,t,n){this.name=e,this.wl=t,this.perslice=n}}const bo="00080016",xo="00080060",Eo="00280002",Ro="00280100",Fo={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"},Mo=new WeakMap;class qo{#Ut;#Qt;getWarning(){return this.#Ut}checkElements(e){if(this.#Ut=void 0,void 0===$e(e))throw new Error("No image rows or columns in DICOM file");if(!Y(e))throw new Error("No pixel data in DICOM file");const t=ue(e,xo);if(void 0!==t&&"PT"===t){const t=Je(e);if(void 0!==(n=ue(e,bo))&&/^1\.2\.840\.10008\.5\.1\.4\.1\.1\.7/.test(n)||!et(t))return this.#Ut;const i=function(e){let t="";const n={};let i;t+=he(e["00280051"],"Corrected Image (00280051)",["ATTN","DECY"]),t+=he(e["00541102"],"Decay Correction (00541102)",["START"]),t+=he(e["00541001"],"Units (00541001)",["BQML"]);const o=e["00101030"],r=he(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=dn(e["00080021"]);let o,r,a;const l=e["00540016"];if(n+=he(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=he(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=he(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=hn(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 le("DA");n.value=[t.substring(0,8)];const i=dn(n),o=new le("TM");return o.value=[t.substring(8)],{date:i,time:t.length>=9?hn(o):void 0}}(h);g=e.date,S=e.time}a=gn(g,S)}let c=gn(i,hn(e["00080031"]));const u=e["00080022"],d=e["00080032"];if(void 0!==u&&void 0!==d){const t=dn(u),i=hn(d),o=gn(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+=he(d,u),void 0!==d&&(l=d.value[0]);let h=0;const g="ActualFrameDuration (00181242)",S=e["00181242"];if(n+=he(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.#Qt=i.value,this.#Ut=i.warning}var n;return this.#Ut}create(e,t,n,i){const o=function(t){return ue(e,t)};let r,a=o(Eo);void 0===a&&(a=1),r=void 0!==i?function(e,t){Mo.has(e)||Mo.set(e,function(e){const t=xi(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=[];for(const e of t){const t=C(e.imagePosPat);if(v(n,t))return;n.push(t)}const i=io(e,t);i.sortOrigins();const o=i.getOrigins();return{geometry:i,frameSliceIndices:n.map(function(e){const t=o.findIndex((n=e,function(e){return e.equals(n)}));var n;if(-1===t)throw new Error("Cannot find frame origin in sorted origins");return t})}}(e));const n=Mo.get(e),i=$e(e),o=new ut([i[0],i[1],1]);let r;if(void 0!==n){const e=n.geometry,i=n.frameSliceIndices[t];r=new St([e.getOrigins()[i]],o,e.getSpacing(),e.getOrientation(),e.getInitialTime())}else{const n=to(e);r=new St([n.getOrigin()],o,n.getSpacing(),n.getOrientation(),t)}return r}(e,i):to(e);const l=r.getSize().getTotalSize(),c=_e(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 Ot(r,t,[u]),g=Je(e);void 0!==g&&h.setPhotometricInterpretation(g);const S=o("00280006");void 0!==S&&h.setPlanarConfiguration(S);let p=1;const m=o("00281053");if(void 0!==m){const e=parseFloat(m);isNaN(e)||(p=e)}let f=0;const D=o("00281052");if(void 0!==D){const e=parseFloat(D);isNaN(e)||(f=e)}let y=!1,I=1;void 0!==this.#Qt&&(y=!0,I=this.#Qt,s.info(`Applying PET SUV calibration: ${I}`),p*=I,f*=I);const w=new Fe(p,f);if(h.setRescaleSlopeAndIntercept(w),"PALETTE COLOR"===h.getPhotometricInterpretation()){const t=function(e){let t;const n=de(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(ue(e,Ro),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 Co(i,o,r)}return t}(e);void 0!==t&&h.setPaletteColourMap(t)}const T={numberOfFiles:n};if(void 0!==i){const e=parseInt(o("00280008"),10);T.numberOfFiles*=e}T.TransferSyntaxUID=o("00020010"),T.MediaStorageSOPClassUID=o("00020002"),T.SOPClassUID=o(bo),T.Modality=o(xo),T.ImageType=o("00080008"),T.SamplesPerPixel=o(Eo),T.PhotometricInterpretation=o("00280004"),T.PixelRepresentation=o("00280103"),T.BitsAllocated=o(Ro),T.BitsStored=o("00280101"),T.HighBit=o("00280102");const L=Object.keys(Fo);for(const e of L)T[e]=o(Fo[e]);if(y)T.pixelUnit="SUV";else{const t=(P=e,void 0!==Me.getTagPixelUnit?Me.getTagPixelUnit(P):function(e){let t;const n=["RescaleType","Units"];for(const i of n)if(t=ue(e,We[i]),void 0!==t)break;if(void 0===t){const n=ue(e,We.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=de(e,"00281050"),o=de(e,"00281051");if(void 0!==i&&void 0!==o){n={};const r=de(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 Oo(a,[new Tt(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 Uo(e){return(new qo).create(e,e["7FE00010"].value[0],1)}const Qo="0040A30A",Vo="0040A161",No="0040A162",Bo="0040A163",ko="004008EA";class Go{numericValue;floatingPointValue;rationalNumeratorValue;rationalDenominatorValue;measurementUnitsCode;toString(){return`${this.numericValue} ${this.measurementUnitsCode.toString()}`}}function zo(e){const t={};return void 0!==e.measurementUnitsCode&&(t.MeasurementUnitsCodeSequence={value:[bn(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 Ho="0040A300",Yo="0040A301";class Xo{measuredValue;numericValueQualifierCode;toString(){let e="";return void 0!==this.measuredValue&&(e+=this.measuredValue.toString()),void 0!==this.numericValueQualifierCode&&(e+=` ${this.numericValueQualifierCode.toString()}`),e}}function Wo(e){const t={};return void 0!==e.measuredValue&&(t.MeasuredValueSequence={value:[zo(e.measuredValue)]}),void 0!==e.numericValueQualifierCode&&(t.NumericValueQualifierCodeSequence={value:[bn(e.numericValueQualifierCode)]}),t}const $o="00081150",jo="00081155";class Zo{referencedSOPClassUID;referencedSOPInstanceUID;toString(){return`${this.referencedSOPInstanceUID} (class: ${this.referencedSOPClassUID})`}}function _o(e){const t=new Zo;return void 0!==e[$o]&&(t.referencedSOPClassUID=e[$o].value[0]),void 0!==e[jo]&&(t.referencedSOPInstanceUID=e[jo].value[0]),t}function Ko(e){const t={};return void 0!==e.referencedSOPClassUID&&(t.ReferencedSOPClassUID=e.referencedSOPClassUID),void 0!==e.referencedSOPInstanceUID&&(t.ReferencedSOPInstanceUID=e.referencedSOPInstanceUID),t}const Jo="00081160",er="00081199",tr="0062000B";class nr{referencedSOPSequence;referencedFrameNumber;referencedSegmentNumber;toString(){let e=this.referencedSOPSequence.toString();return void 0!==this.referencedFrameNumber&&(e+=`, frame: ${this.referencedFrameNumber}`),e}}function ir(e){const t={};return void 0!==e.referencedFrameNumber&&(t.ReferencedFrameNumber=e.referencedFrameNumber),void 0!==e.referencedSOPSequence&&(t.ReferencedSOPSequence={value:[Ko(e.referencedSOPSequence)]}),void 0!==e.referencedSegmentNumber&&(t.ReferencedSegmentNumber=e.referencedSegmentNumber),t}class or{#Vt;#Nt;constructor(e,t){this.#Vt=e,this.#Nt=t}getBegin(){return this.#Vt}getEnd(){return this.#Nt}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 m((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 or(this.#Nt,this.#Vt)}quantify(e){const t=e.get2DSpacing(),n=this.getWorldLength(t);let i;return null!==n&&(i={value:n,unit:e.getLengthUnit()}),{length:i}}}function rr(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 ar(e,t){const n=e.getDeltaX(),i=e.getDeltaY();return n*t.getDeltaX()+i*t.getDeltaY()===0}function sr(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 cr(o,t.getY()-o*t.getX(),t,n,i)}function lr(e,t,n,i){const o=cr(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(),sr(e,r,n,i)}function cr(e,t,n,i,o){let r,a,s,l;if(void 0===o&&(o={x:1,y:1}),d(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 or(new m(r,a),new m(s,l))}class ur{#Bt;constructor(e){if(e.length>3)throw new Error("Too many points for a protractor");this.#Bt=e.slice(0,3)}getPoint(e){return this.#Bt[e]}getLength(){return this.#Bt.length}getCentroid(){return this.#Bt[1]}quantify(e,t){let n;if(3===this.#Bt.length){let e=rr(new or(this.#Bt[0],this.#Bt[1]),new or(this.#Bt[1],this.#Bt[2]));e>180&&(e=360-e),n={value:e,unit:"unit.degree"}}return{angle:n}}}class dr{#Bt=[];constructor(e){void 0!==e&&(this.#Bt=e)}getPoint(e){return this.#Bt[e]}getPoints(){return this.#Bt}getLength(){return this.#Bt.length}addPoint(e){this.#Bt.push(e)}addPoints(e){this.#Bt=this.#Bt.concat(e)}getCentroid(){let e,t=0,n=0,i=0;for(let e=0;e<this.#Bt.length;++e){const o=this.#Bt[e];let r;r=e===this.#Bt.length-1?this.#Bt[0]:this.#Bt[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 m(o*n,o*i)}return e}}class hr{#kt;#Gt;constructor(e,t){this.#kt=e,this.#Gt=t}getCenter(){return this.#kt}getCentroid(){return this.#kt}getRadius(){return this.#Gt}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=st(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 gr{#kt;#zt;#Ht;constructor(e,t,n){this.#kt=e,this.#zt=t,this.#Ht=n}getCenter(){return this.#kt}getCentroid(){return this.#kt}getA(){return this.#zt}getB(){return this.#Ht}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=st(o,n);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 Sr(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 pr{#Vt;#Nt;constructor(e,t){this.#Vt=new m(Math.min(e.getX(),t.getX()),Math.min(e.getY(),t.getY())),this.#Nt=new m(Math.max(e.getX(),t.getX()),Math.max(e.getY(),t.getY()))}getBegin(){return this.#Vt}getEnd(){return this.#Nt}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 m(Math.round(this.getBegin().getX()),Math.round(this.getBegin().getY())),max:new m(Math.round(this.getEnd().getX()),Math.round(this.getEnd().getY()))}}getCentroid(){return new m(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=st(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 mr(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 fr{#Vt;#Nt;shortAxisLength;shortAxisCenter;shortAxisL1;shortAxisL2;shortAxisT;constructor(e,t){this.#Vt=e,this.#Nt=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.#Vt}getEnd(){return this.#Nt}getCentroid(){return new m((this.#Vt.getX()+this.#Nt.getX())/2,(this.#Vt.getY()+this.#Nt.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.#Nt.getX()-this.#Vt.getX()}getDeltaY(){return this.#Nt.getY()-this.#Vt.getY()}quantify(e){const t=e.get2DSpacing?.()??{x:1,y:1},n=new or(this.#Vt,this.#Nt).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.#Vt.getX()+e*r,s=this.#Vt.getY()+n*r,l=new m(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 m(l.getX()+c*d,l.getY()+u*d),S=new m(l.getX()-c*h,l.getY()-u*h);i=new or(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 vr="00480301",Cr="00700022",Dr="00700023",yr="0070031A",Ir="POINT",wr="MULTIPOINT",Tr="POLYLINE",Lr="CIRCLE",Pr="ELLIPSE";class Ar{graphicData;graphicType;pixelOriginInterpretation;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Or(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 br(e){const t=new Ar;if(e instanceof m)t.graphicData=[e.getX().toString(),e.getY().toString()],t.graphicType=Ir;else if(e instanceof or)t.graphicData=[e.getBegin().getX().toString(),e.getBegin().getY().toString(),e.getEnd().getX().toString(),e.getEnd().getY().toString()],t.graphicType=Tr;else if(e instanceof ur){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=Tr}else if(e instanceof dr){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=Tr}else if(e instanceof hr){const n=e.getCenter(),i=new m(n.getX()+e.getRadius(),n.getY());t.graphicData=[n.getX().toString(),n.getY().toString(),i.getX().toString(),i.getY().toString()],t.graphicType=Lr}else if(e instanceof gr){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=Pr}else if(e instanceof pr){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=Tr}else if(e instanceof fr){let n=0,i=0;const o=e.getBegin(),r=e.getEnd(),a=e.shortAxisCenter instanceof m?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 m(a.getX()+n*u,a.getY()+i*u),g=new m(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=Tr}return t}function xr(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 m(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===Ir)n.length>1&&s.warn(`Expecting 1 point for point, got ${o}`),r=n[0];else if(e.graphicType===Lr){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 hr(e,t)}else if(e.graphicType===Pr){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 m(n[0].getX()+e,n[0].getY());r=new gr(i,e,t)}else if(e.graphicType===Tr)if(i)if(5===n.length){const e=new or(n[0],n[1]),t=new or(n[1],n[2]),i=new or(n[2],n[3]),o=new or(n[3],n[4]);r=ar(e,t)&&ar(t,i)&&ar(i,o)?new pr(n[0],n[2]):new dr(n.slice(0,-1))}else r=new dr(n.slice(0,-1));else if(2===n.length)r=new or(n[0],n[1]);else if(3===n.length)r=new ur([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 fr(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,f=t.getX()-e.getX(),v=t.getY()-e.getY(),C=Math.sqrt(f*f+v*v);let D=.5;if(C>0){const t=s-e.getX(),n=l-e.getY(),i=C*C;0!==i&&(a=(t*f+n*v)/i),D=Math.max(0,Math.min(1,a))}r.shortAxisLength=p,r.shortAxisT=D,r.shortAxisL1=g,r.shortAxisL2=S,r.shortAxisCenter=new m(s,l),r.hasShortAxisInteraction=!0}return r}const Er="00700022",Rr="00700023",Fr="30060024",Mr="0070031A";class qr{graphicData;graphicType;referencedFrameofReferenceUID;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Ur(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 Qr={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"},Vr="CONTAINS",Nr="HAS PROPERTIES",Br="HAS OBS CONTEXT",kr="INFERRED FROM",Gr="SELECTED FROM",zr="HAS CONCEPT MOD",Hr="TEXT",Yr="NUM",Xr="CODE",Wr="UIDREF",$r="COMPOSITE",jr="IMAGE",Zr="SCOORD",_r="SCOORD3D",Kr="CONTAINER",Jr="SEPARATE",ea={TEXT:"TextValue",DATE:"Date",TIME:"Time",DATETIME:"DateTime",UIDREF:"UID",PNAME:"PersonName",CONTAINER:"ContinuityOfContent"};function ta(e){let t;const n=ue(e,Qr.ContentTemplateSequence);if(void 0!==n){const e=ue(n,Qr.MappingResource),i=ue(n,Qr.TemplateIdentifier);void 0!==e&&void 0!==i&&(t=`${e}-${i}`)}return t}class na{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&&An(this.conceptNameCode,t)&&this.relationshipType===n}}function ia(e){let t=ue(e,Qr.ValueType);void 0===t&&(t="");const n=new na(t);n.relationshipType=ue(e,Qr.RelationshipType);const i=ue(e,Qr.ConceptNameCodeSequence);if(void 0!==i&&(n.conceptNameCode=On(i)),t===Xr)n.value=On(ue(e,Qr.ConceptCodeSequence));else if(t===Yr)n.value=function(e){const t=new Xo;return void 0!==e[Ho]&&(t.measuredValue=function(e){const t=new Go;return void 0!==e[Qo]&&(t.numericValue=parseFloat(e[Qo].value[0])),void 0!==e[Vo]&&(t.floatingPointValue=parseFloat(e[Vo].value[0])),void 0!==e[No]&&(t.rationalNumeratorValue=parseInt(e[No].value[0],10)),void 0!==e[Bo]&&(t.rationalDenominatorValue=parseInt(e[Bo].value[0],10)),void 0!==e[ko]&&(t.measurementUnitsCode=On(e[ko].value[0])),t}(e[Ho].value[0])),void 0!==e[Yo]&&(t.numericValueQualifierCode=On(e[Yo].value[0])),t}(e);else if(t===jr)n.value=function(e){const t=new nr;return void 0!==e[Jo]&&(t.referencedFrameNumber=e[Jo].value[0]),void 0!==e[er]&&(t.referencedSOPSequence=_o(e[er].value[0])),void 0!==e[tr]&&(t.referencedSegmentNumber=e[tr].value[0]),t}(e);else if(t===$r)n.value=_o(ue(e,Qr.ReferencedSOPSequence));else if(t===Zr)n.value=function(e){const t=new Ar;return void 0!==e[Cr]&&(t.graphicData=e[Cr].value),void 0!==e[Dr]&&(t.graphicType=e[Dr].value[0]),void 0!==e[vr]&&(t.pixelOriginInterpretation=e[vr].value[0]),void 0!==e[yr]&&(t.fiducialUID=e[yr].value[0]),t}(e);else if(t===_r)n.value=function(e){const t=new qr;return void 0!==e[Er]&&(t.graphicData=e[Er].value),void 0!==e[Rr]&&(t.graphicType=e[Rr].value[0]),void 0!==e[Fr]&&(t.referencedFrameofReferenceUID=e[Fr].value[0]),void 0!==e[Mr]&&(t.fiducialUID=e[Mr].value[0]),t}(e);else{const i=ea[t];void 0!==i?n.value=ue(e,Qr[i]):console.warn(`Unsupported input ValueType: ${t}`)}const o=de(e,Qr.ContentSequence);if(void 0!==o)for(const e of o)n.contentSequence.push(ia(e));return n}function oa(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:[bn(e.conceptNameCode)]}),"CODE"===e.valueType)t.ConceptCodeSequence={value:[bn(e.value)]};else if(e.valueType===Yr)t={...t,...Wo(e.value)};else if(e.valueType===jr)t={...t,...ir(e.value)};else if(e.valueType===$r)t={...t,...Ko(e.value)};else if(e.valueType===Zr)t={...t,...Or(e.value)};else if(e.valueType===_r)t={...t,...Ur(e.value)};else{const n=ea[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(oa(n))}return t}function ra(e,t,n,i){const o=function(e){const t=ai[e];let n;return void 0!==t&&(n="DCM"===t.scheme?ni({meaning:e,value:t.key}):ii(t.key,t.scheme)),n}(e);if(void 0===o)return;let r=Vr;void 0!==i&&(r=i);const a=new na(Yr);a.relationshipType=r,a.conceptNameCode=o;const s=new Go;s.numericValue=t,s.measurementUnitsCode=li(n);const l=new Xo;return l.measuredValue=s,a.value=l,a}class aa{#Yt;#n;#i;constructor(e,t,n){this.#Yt=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 aa(aa.idFromIndex(e),t,n)}getId(){return this.#Yt}getX(){return this.#n}getY(){return this.#i}setX(e){this.#n=e}setY(e){this.#i=e}}const sa={arrow:{"*":""},circle:{"*":"{surface}"},ellipse:{"*":"{surface}"},protractor:{"*":"{angle}"},rectangle:{"*":"{surface}"},roi:{"*":""},ruler:{"*":"{length}"},bidimensional:{"*":"{longAxis} x {shortAxis}"},bidimensionalDrawing:{"*":"{longAxis}"}};function la(e){return"label"===e.name()}function ca(e){return"shape"===e.name()}function ua(e){return"position-group"===e.name()}function da(t,n){const i=t.getChildren(function(e){return e.id()===`anchor${n}`})[0];if(i instanceof e.Ellipse)return i}function ha(e){return function(t){return t.id()===e}}function ga(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 Sa(e){return void 0!==Me.labelTexts&&void 0!==Me.labelTexts[e]?Me.labelTexts[e]:sa[e]}class pa{#u="rectangle";#Xt;static supports(e){return e instanceof pr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new pr(t[0],t[1]),e.setTextExpr(Sa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=aa.indexFromId(t.getId()),i=(n+1)%4,o=(n+2)%4,r=(n+3)%4;void 0===this.#Xt&&(this.#Xt=this.getAnchors(e));const a=this.#Xt[o];this.#Xt[n]=t,n%2==0?(this.#Xt[r].setX(t.getX()),this.#Xt[i].setY(t.getY())):(this.#Xt[r].setY(t.getY()),this.#Xt[i].setX(t.getX())),e.mathShape=new pr(new m(a.getX(),a.getY()),new m(t.getX(),t.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new pr(new m(i.getX()+t.x,i.getY()+t.y),new m(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){this.#Xt=void 0}getAnchors(e){if(void 0!==this.#Xt)return this.#Xt;const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[aa.fromIndex(0,n,i),aa.fromIndex(1,n+o,i),aa.fromIndex(2,n+o,i+r),aa.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 m(n+o/2,i),new m(n,i+r/2),new m(n+o/2,i+r),new m(n+o,i+r/2)]}getDefaultLabelPosition(e){const t=e.mathShape;return new m(t.getBegin().getX(),t.getEnd().getY())}}class ma{#u="circle";static supports(e){return e instanceof hr}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 hr(t[0],Math.round(Math.sqrt(n*n+i*i))),e.setTextExpr(Sa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=new m(n.getCenter().getX(),n.getCenter().getY()),o=new m(t.getX(),t.getY());e.mathShape=new hr(i,i.getDistance(o)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new hr(new m(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[aa.fromIndex(0,n-o,i),aa.fromIndex(1,n+o,i),aa.fromIndex(2,n,i+o),aa.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 m(n-o,i-o),new m(n+o,i-o),new m(n-o,i+o),new m(n+o,i+o)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter(),i=t.getRadius();return new m(n.getX()-i,n.getY()+i)}}class fa{#u="ellipse";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){const n=Math.abs(t[0].getX()-t[1].getX()),i=Math.abs(t[0].getY()-t[1].getY());e.mathShape=new gr(t[0],n,i),e.setTextExpr(Sa(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 gr(i,Math.abs(o),Math.abs(r)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new gr(new m(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[aa.fromIndex(0,n-o,i),aa.fromIndex(1,n+o,i),aa.fromIndex(2,n,i+r),aa.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 m(n-o,i-r),new m(n+o,i-r),new m(n-o,i+r),new m(n+o,i+r)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter();return new m(n.getX()-t.getA(),n.getY()+t.getB())}}class va{#u="ruler";static supports(e){return e instanceof or}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new or(t[0],t[1]),e.setTextExpr(Sa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[aa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new or(new m(i.getX(),i.getY()),new m(o.getX(),o.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new or(new m(i.getX()+t.x,i.getY()+t.y),new m(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[aa.fromIndex(0,n.getX(),n.getY()),aa.fromIndex(1,i.getX(),i.getY())]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[new m((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 Ca{#u="arrow";static supports(e){return e instanceof m}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(Sa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[aa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new m(i.getX(),i.getY()),e.referencePoints=[new m(o.getX(),o.getY())],e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=e.referencePoints[0];e.mathShape=new m(n.getX()+t.x,n.getY()+t.y),e.referencePoints=[new m(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[aa.fromIndex(0,t.getX(),t.getY()),aa.fromIndex(1,n.getX(),n.getY())]}getConnectorPositions(e){const t=e.mathShape,n=e.referencePoints[0];return[new m((t.getX()+n.getX())/2,(t.getY()+n.getY())/2)]}getDefaultLabelPosition(e){return e.mathShape}}class Da{#u="roi";static supports(e){return e instanceof dr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new dr(t),e.setTextExpr(Sa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape.getPoints().slice();n[aa.indexFromId(t.getId())]=new m(t.getX(),t.getY()),e.mathShape=new dr(n),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<n.getLength();++e)i.push(new m(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new dr(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(aa.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 m((o.getX()+r.getX())/2,(o.getY()+r.getY())/2))}return i}getDefaultLabelPosition(e){return e.mathShape.getPoint(0)}}class ya{#u="protractor";static supports(e){return e instanceof ur}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 ur(t),e.setTextExpr(Sa(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[aa.indexFromId(t.getId())]=t;const i=n[0],o=n[1],r=n[2];e.mathShape=new ur([new m(i.getX(),i.getY()),new m(o.getX(),o.getY()),new m(r.getX(),r.getY())]),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<3;++e)i.push(new m(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new ur(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(aa.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){return[e.mathShape.getPoint(1)]}getDefaultLabelPosition(e){const t=e.mathShape,n=new or(t.getPoint(0),t.getPoint(1)),i=new or(t.getPoint(1),t.getPoint(2));return new m((n.getCentroid().getX()+i.getCentroid().getX())/2,(n.getCentroid().getY()+i.getCentroid().getY())/2)}}function Ia(e,t,n,i=20){const o=sr(t,t.getBegin(),i,n),r=sr(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 wa{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 Ta(e){const t=new or(e.getPoint(0),e.getPoint(1)),n=new or(e.getPoint(1),e.getPoint(2));let i=rr(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 La(t,n,i){const{radius:o,angle:r,inclination:a}=Ta(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 Pa(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 Aa={rectangle:new class extends wa{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 wa{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 wa{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 wa{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 Ia(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()]),Ia(e,i,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=n.getZoomScale(),r=sr(i,i.getBegin(),20,o),a=sr(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=sr(o,o.getBegin(),20,r),s=sr(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 wa{createShape(t,n){const i=t.mathShape,o=t.referencePoints[0],r=new or(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 Ia(a,r,n.getZoomScale()),a}updateShape(e,t,n){const i=t.mathShape,o=t.referencePoints[0],r=new or(i,o);e.position({x:0,y:0}),e.points([i.getX(),i.getY(),o.getX(),o.getY()]),Ia(e,r,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=t.referencePoints[0],r=lr(new or(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=lr(new or(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 wa{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 wa{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()&&Pa(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()]),Pa(e,n)}createExtras(e,t){const n=e.mathShape;return 3!==n.getLength()?[]:[La(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}=Ta(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 Oa(e){const t=Aa[e];return t||s.error(`shapePainters: no painter for shape '${e}'`),t}class ba{#Wt;constructor(e){this.#Wt=e}getPosition(e){let t=e.labelPosition;return void 0===t&&(t=this.#Wt(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 m(t+i/2,n),new m(t,n+o/2),new m(t+i/2,n+o),new m(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 xa{#$t;#jt;constructor(e){this.#$t=e,this.#jt=new ba(t=>e.getDefaultLabelPosition(t))}createShapeGroup(t,n){const i=Oa(this.#$t.getName()),o=new e.Group;if(o.name(this.#$t.getGroupName()),o.visible(!0),o.id(t.trackingUid),o.add(i.createShape(t,n)),this.#$t.isComplete(t)){for(const e of i.createExtras(t,n))o.add(e);const e=this.#jt.create(t,n);o.add(e);const r=this.#$t.getConnectorPositions(t);o.add(this.#jt.getConnector(r,e,n))}return o}getAnchors(e,t){return e?this.#$t.getAnchors(e).map(e=>ga(e.getX(),e.getY(),e.getId(),t)):[]}constrainAnchorMove(e,t){const n=new aa(e.id(),e.x(),e.y());this.#$t.constrainAnchorMove(n,t),e.x(n.getX()),e.y(n.getY())}onAnchorMoveEnd(t,n){this.#$t.onAnchorMoveEnd();const i=t.getParent();if(!(i instanceof e.Group))return;const o=this.#$t.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 aa(t.id(),t.x(),t.y());this.#$t.updateAnnotationOnAnchorMove(e,n)}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();if(!(o instanceof e.Group))return;const r=Oa(this.#$t.getName()),a=o.getChildren(ca)[0];r.updateShape(a,t,i),r.updateExtras(o,t,i);const s=this.#$t.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.#jt.updatePosition(t,o),this.updateConnector(t,o)}updateLabelContent(e,t,n){this.#jt.updateContent(e,t)}updateConnector(e,t){const n=this.#$t.getConnectorPositions(e);this.#jt.updateConnector(t,n)}}class Ea{#Zt=0;#_t=0;getMin(){return this.#Zt}setMin(e){this.#Zt=e}getMax(){return this.#_t}setMax(e){this.#_t=e}getName(){return"Threshold"}#Kt=null;setOriginalImage(e){this.#Kt=e}getOriginalImage(){return this.#Kt}update(){const e=this.getOriginalImage(),t=e.getDataRange().min;return e.transform(e=>e<this.getMin()||e>this.getMax()?t:e)}}class Ra{getName(){return"Sharpen"}#Kt=null;setOriginalImage(e){this.#Kt=e}getOriginalImage(){return this.#Kt}update(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])}}class Fa{getName(){return"Sobel"}#Kt=null;setOriginalImage(e){this.#Kt=e}getOriginalImage(){return this.#Kt}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 Ma{getName(){return""}execute(){}undo(){}}class qa extends EventTarget{#Jt=[];#en=0;getStackSize(){return this.#Jt.length}getCurrentStackIndex(){return this.#en}getCurrentCommand(){return this.#Jt[this.#en-1]}add(e){this.#Jt=this.#Jt.slice(0,this.#en),this.#Jt.push(e),++this.#en,this.dispatchEvent(new Event("undoadd"))}remove(e){let t=!1;const n=this.#Jt.findIndex(function(t){return t.getName()===e});return-1!==n&&(t=!0,this.dispatchEvent(new CustomEvent("undoremove",{detail:{commandName:e}})),this.#Jt.splice(n,1),--this.#en),t}undo(){this.#en>0&&(this.dispatchEvent(new Event("undo")),--this.#en,this.#Jt[this.#en].undo())}redo(){this.#en<this.#Jt.length&&(this.#Jt[this.#en].execute(),++this.#en,this.dispatchEvent(new Event("redo")))}}class Ua extends Ma{#tn;#nn;#in;constructor(e,t,n){super(),this.#tn=e,this.#nn=t,this.#in=n}getName(){return`Filter-${this.#tn.getName()}`}execute(){this.#in.getDataController().setImage(this.#nn,this.#tn.update()),this.#in.getStageController().render(this.#nn);const e={type:"filterrun",id:this.getName(),dataId:this.#nn};this.onExecute(e)}undo(){this.#in.getDataController().setImage(this.#nn,this.#tn.getOriginalImage()),this.#in.getStageController().render(this.#nn);const e={type:"filterundo",id:this.getName(),dataid:this.#nn};this.onUndo(e)}onExecute(e){}onUndo(e){}}class Qa extends EventTarget{#in;constructor(e){super(),this.#in=e}#on;#rn=0;#an=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))};activate(e){for(const t in this.#on)e?(this.#on[t].addEventListener("filterrun",this.#an),this.#on[t].addEventListener("filterundo",this.#an)):(this.#on[t].removeEventListener("filterrun",this.#an),this.#on[t].removeEventListener("filterundo",this.#an))}setOptions(e){this.#on={};for(const t in e)this.#on[t]=new e[t](this.#in)}getOptionsType(){return"instance"}init(){for(const e in this.#on)this.#on[e].init()}keydown=e=>{e.context="Filter",this.#in.onKeydown(e)};getEventNames(){return["filterrun","filterundo"]}getSelectedFilter(){return this.#rn}setFeatures(e){if(void 0!==e.filterName){if(!this.hasFilter(e.filterName))throw new Error(`Unknown filter: '${e.filterName}'`);this.#rn&&this.#rn.activate(!1),this.#rn=this.#on[e.filterName],this.#rn.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.#on}hasFilter(e){return void 0!==this.#on?.[e]}}class Va extends EventTarget{#in;constructor(e){super(),this.#in=e}#tn=new Ea;#sn=!0;activate(e){e&&(this.#sn=!0)}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run threshod filter on.");if(this.#tn.setMin(e.min),this.#tn.setMax(e.max),this.#sn){const t=this.#in.getDataController().get(e.dataId).image;this.#tn.setOriginalImage(t),this.#sn=!1}const t=new Ua(this.#tn,e.dataId,this.#in);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.#in.getUndoController().addToUndoStack(t)}}class Na extends EventTarget{#in;constructor(e){super(),this.#in=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sharpen filter on.");const t=new Ra,n=this.#in.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Ua(t,e.dataId,this.#in);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.#in.getUndoController().addToUndoStack(i)}}class Ba extends EventTarget{#in;constructor(e){super(),this.#in=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sobel filter on.");const t=new Fa,n=this.#in.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Ua(t,e.dataId,this.#in);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.#in.getUndoController().addToUndoStack(i)}}const ka={},Ga={draw:{ArrowFactory:class{#$t=new Ca;#ln=new xa(this.#$t);static supports(e){return Ca.supports(e)}getName(){return this.#$t.getName()}getGroupName(){return this.#$t.getGroupName()}getNPoints(){return this.#$t.getNPoints()}setAnnotationMathShape(e,t){this.#$t.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#ln.createShapeGroup(e,t)}getAnchors(e,t){return this.#ln.getAnchors(e,t)}constrainAnchorMove(e,t){this.#ln.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#ln.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#ln.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#ln.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#$t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#ln.updateLabelContent(e,t,n)}updateConnector(e,t){this.#ln.updateConnector(e,t)}},CircleFactory:class{#$t=new ma;#ln=new xa(this.#$t);static supports(e){return ma.supports(e)}getName(){return this.#$t.getName()}getGroupName(){return this.#$t.getGroupName()}getNPoints(){return this.#$t.getNPoints()}setAnnotationMathShape(e,t){this.#$t.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#ln.createShapeGroup(e,t)}getAnchors(e,t){return this.#ln.getAnchors(e,t)}constrainAnchorMove(e,t){this.#ln.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#ln.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#ln.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#ln.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#$t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#ln.updateLabelContent(e,t,n)}updateConnector(e,t){this.#ln.updateConnector(e,t)}},EllipseFactory:class{#$t=new fa;#ln=new xa(this.#$t);static supports(e){return fa.supports(e)}getName(){return this.#$t.getName()}getGroupName(){return this.#$t.getGroupName()}getNPoints(){return this.#$t.getNPoints()}setAnnotationMathShape(e,t){this.#$t.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#ln.createShapeGroup(e,t)}getAnchors(e,t){return this.#ln.getAnchors(e,t)}constrainAnchorMove(e,t){this.#ln.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#ln.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#ln.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#ln.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#$t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#ln.updateLabelContent(e,t,n)}updateConnector(e,t){this.#ln.updateConnector(e,t)}},ProtractorFactory:class{#$t=new ya;#ln=new xa(this.#$t);static supports(e){return ya.supports(e)}getName(){return this.#$t.getName()}getGroupName(){return this.#$t.getGroupName()}getNPoints(){return this.#$t.getNPoints()}setAnnotationMathShape(e,t){this.#$t.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#ln.createShapeGroup(e,t)}getAnchors(e,t){return this.#ln.getAnchors(e,t)}constrainAnchorMove(e,t){this.#ln.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#ln.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#ln.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#ln.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#$t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#ln.updateLabelContent(e,t,n)}updateConnector(e,t){this.#ln.updateConnector(e,t)}},RectangleFactory:class{#$t=new pa;#ln=new xa(this.#$t);static supports(e){return pa.supports(e)}getName(){return this.#$t.getName()}getGroupName(){return this.#$t.getGroupName()}getNPoints(){return this.#$t.getNPoints()}setAnnotationMathShape(e,t){this.#$t.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#ln.createShapeGroup(e,t)}getAnchors(e,t){return this.#ln.getAnchors(e,t)}constrainAnchorMove(e,t){this.#ln.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#ln.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#ln.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#ln.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#$t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#ln.updateLabelContent(e,t,n)}updateConnector(e,t){this.#ln.updateConnector(e,t)}},RoiFactory:class{#$t=new Da;#ln=new xa(this.#$t);static supports(e){return Da.supports(e)}getName(){return this.#$t.getName()}getGroupName(){return this.#$t.getGroupName()}getNPoints(){return this.#$t.getNPoints()}setAnnotationMathShape(e,t){this.#$t.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#ln.createShapeGroup(e,t)}getAnchors(e,t){return this.#ln.getAnchors(e,t)}constrainAnchorMove(e,t){this.#ln.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#ln.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#ln.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#ln.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#$t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#ln.updateLabelContent(e,t,n)}updateConnector(e,t){this.#ln.updateConnector(e,t)}},RulerFactory:class{#$t=new va;#ln=new xa(this.#$t);static supports(e){return va.supports(e)}getName(){return this.#$t.getName()}getGroupName(){return this.#$t.getGroupName()}getNPoints(){return this.#$t.getNPoints()}setAnnotationMathShape(e,t){this.#$t.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#ln.createShapeGroup(e,t)}getAnchors(e,t){return this.#ln.getAnchors(e,t)}constrainAnchorMove(e,t){this.#ln.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#ln.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#ln.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#ln.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#$t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#ln.updateLabelContent(e,t,n)}updateConnector(e,t){this.#ln.updateConnector(e,t)}},BidimensionalFactory:class{#u="bidimensional";#jt=new ba(this.#cn);static supports(e){return e instanceof fr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}#un(e){return void 0!==Me.labelTexts&&void 0!==Me.labelTexts[this.#u]?Me.labelTexts[this.#u]:!0===e.mathShape.hasShortAxisInteraction&&null!==e.quantification?.shortAxis?.value?sa[this.#u]:sa[`${this.#u}Drawing`]}setAnnotationMathShape(e,t){const n=new fr(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.#un(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.#dn(t,n);i.add(o);const r=this.#hn(t,n);for(const e of r)i.add(e);const a=this.#jt.create(t,n);i.add(a);const s=this.#gn(o);i.add(this.#jt.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}#dn(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 Ia(o,i,n.getZoomScale?n.getZoomScale():{x:1,y:1}),o}#hn(t,n){const i=t.mathShape,o=10,r=n.getZoomScale?n.getZoomScale():{x:1,y:1},a=sr(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=sr(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"})]}#gn(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 m(o,r)]}#Sn(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.#Sn(e),i=[];for(let e=0;e<n.length;++e)i.push(ga(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 p=d*c+h*u;"anchor2"===e.id()?n.shortAxisL1=Math.max(.1,p):n.shortAxisL2=Math.max(.1,-p),n.shortAxisLength=n.shortAxisL1+n.shortAxisL2;const m="anchor2"===e.id()?n.shortAxisL1:-n.shortAxisL2;e.x(S.getX()+c*m),e.y(S.getY()+u*m)}}onAnchorMoveEnd(e,t){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#pn(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#jt.updatePosition(t,o),this.updateConnector(t,o))}#pn(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()]),Ia(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=sr(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=sr(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=da(r,2),m=da(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.#un(t)),t.updateQuantification?.(),r.getLayer()?.draw()}updateLabelContent(e,t,n){this.#jt.updateContent(e,t)}updateConnector(t,n){const i=n.findOne(".shape");if(i&&i instanceof e.Line){const e=this.#gn(i);this.#jt.updateConnector(n,e)}}#cn(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 m(i.getX()+t.x,i.getY()+t.y),a=new m(o.getX()+t.x,o.getY()+t.y),s=new fr(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 m(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=da(i,0),a=da(i,1),s=new m(r.x()-o.x(),r.y()-o.y()),l=new m(a.x()-o.x(),a.y()-o.y()),c=new fr(s,l),u=t.mathShape;if(u.shortAxisCenter instanceof m){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 m(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 m(n.getX()-l*o/2,n.getY()-c*o/2),d=new m(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 m(i.getX()-l*o/2,i.getY()-c*o/2),S=new m(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 m){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 m(n.getX()+l*u,n.getY()+c*u),new m(n.getX()-l*d,n.getY()-c*d)]}getPointAlongLine(e,t){const n=e.getBegin(),i=e.getEnd();return new m(n.getX()+(i.getX()-n.getX())*t,n.getY()+(i.getY()-n.getY())*t)}}},filter:{Threshold:Va,Sobel:Ba,Sharpen:Na}};class za{#h=!0;#p;constructor(e,t){void 0!==t&&(this.#h=t),this.#p=new DataView(e)}writeUint8(e,t){return this.#p.setUint8(e,t),e+Uint8Array.BYTES_PER_ELEMENT}writeInt8(e,t){return this.#p.setInt8(e,t),e+Int8Array.BYTES_PER_ELEMENT}writeUint16(e,t){return this.#p.setUint16(e,t,this.#h),e+Uint16Array.BYTES_PER_ELEMENT}writeInt16(e,t){return this.#p.setInt16(e,t,this.#h),e+Int16Array.BYTES_PER_ELEMENT}writeUint32(e,t){return this.#p.setUint32(e,t,this.#h),e+Uint32Array.BYTES_PER_ELEMENT}writeUint64(e,t){return this.#p.setBigUint64(e,t,this.#h),e+BigUint64Array.BYTES_PER_ELEMENT}writeInt32(e,t){return this.#p.setInt32(e,t,this.#h),e+Int32Array.BYTES_PER_ELEMENT}writeInt64(e,t){return this.#p.setBigInt64(e,t,this.#h),e+BigInt64Array.BYTES_PER_ELEMENT}writeFloat32(e,t){return this.#p.setFloat32(e,t,this.#h),e+Float32Array.BYTES_PER_ELEMENT}writeFloat64(e,t){return this.#p.setFloat64(e,t,this.#h),e+Float64Array.BYTES_PER_ELEMENT}writeHex(e,t){const n=parseInt(t,16);return this.#p.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 Ha=0;class Ya{action;value;constructor(e){this.action=e}}const Xa={copy:e=>e,remove:()=>null,clear:e=>(e.value=[],e),replace:(e,t)=>(e.value=[t],e)};function Wa(e){const t=`.${(new Date).toISOString().replace(/\D/g,"").substring(0,14)}`;Ha+=1;const n=`.${Ha}`;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 $a(e){return e%2==0}function ja(e){const t=J[e];return void 0!==t&&"string"===t}function Za(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}class _a{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 Ka="00080005",Ja="00280100";class es{#mn=!1;#fn=!0;#vn={default:{action:"copy",value:null}};#Cn=this.#vn;#Dn=[];#yn=new _a;#In=this.#yn;setUseUnVrForPrivateSq(e){this.#mn=e}setFixUnknownVR(e){this.#fn=e}setRules(e,t){if(this.#Cn=e,this.#Dn=[],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){const e=re(U(n));t=void 0!==e?.getName()}if(t)e=n;else{const t=se(n);void 0!==t&&(e=t.getKey())}void 0!==e&&this.#Dn.push(e)}}}}#wn(e){return this.#yn.encode(e)}#Tn(e){return this.#In.encode(e)}useSpecialTextEncoder(){this.#In=new TextEncoder}getElementToWrite(e){const t=ae(e.tag),n=re(e.tag),i=n?.getName();let o;return o=void 0!==this.#Cn[e.tag.getKey()]?this.#Cn[e.tag.getKey()]:void 0!==i&&void 0!==this.#Cn[i]?this.#Cn[i]:void 0!==this.#Cn[t]?this.#Cn[t]:this.#Cn.default,Xa[o.action](e,o.value)}#Ln(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 le("NONE");l.vl=n?4294967295:s.vl,l.tag=Q(),l.value=[],t=this.#Pn(e,l,t,i);for(const n of a)r(n)||B(n.tag)||(t=this.#Pn(e,n,t,i,o));if(n){const n=new le("NONE");n.vl=0,n.tag=N(),n.value=[],t=this.#Pn(e,n,t,i)}}return t}#An(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=Za(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=J[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.#Ln(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}#On(e,t,n,i,o,r){let a=!1;if(void 0!==t.undefinedLength&&(a=t.undefinedLength),a){const a=[];a.push({tag:Q(),vr:"NONE",vl:0,value:[]});for(const e of i)a.push({tag:Q(),vr:t.vr,vl:e.length,value:e});n=this.#Ln(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.#An(e,t,n,a,o,r)}return n}#Pn(e,t,n,i,o){const r=t.tag.isWithVR(),a=!(!i&&r)||Z(t.vr);n=e.writeHex(n,t.tag.getGroup()),n=e.writeHex(n,t.tag.getElement());let l=t.vr;this.#mn&&t.tag.isPrivate()&&"SQ"===l&&(s.warn("Write element using VR=UN for private sequence."),l="UN"),r&&!i&&(n=e.writeUint8Array(n,this.#wn(l)),a&&(n+=2));let c=!1;("SQ"===t.vr||z(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=z(t.tag)?this.#On(e,t,n,h,i,o):this.#An(e,t,n,h,i),c){const t=new le("NONE");t.vl=0,t.tag=new M("FFFE","E0DD"),t.value=[],n=this.#Pn(e,t,n,i)}return n}getBuffer(e){const t=e["00020010"].value[0],n=Ie(t),i=we(t);if(void 0!==e[Ka]){const t=e[Ka].value[0];void 0!==t&&"ISO-IR 6"!==t&&(s.debug(`Change charset to UTF, was: ${t}`),this.useSpecialTextEncoder(),e[Ka].value=["ISO_IR 192"])}let o;void 0!==e[Ja]&&(o=e[Ja].value[0]);let r,a=132;const l=[],c=[];let u,d,h=0;const g=new M("0002","0000"),S=new M("0002","0001"),p=new M("0002","0012"),m=new M("0002","0013"),f=this.#Dn.slice(),v=Object.keys(e);for(const t of v){const s=e[t];if(s.tag=U(t),u=this.getElementToWrite(s),!(null===u||g.equals(u.tag)||S.equals(u.tag)||p.equals(u.tag)||m.equals(u.tag))){r=0;const e=f.indexOf(u.tag.getKey());-1!==e&&f.splice(e,1),this.#fn&&ts(u,!i),this.#bn(u,u.value,n,o),d=ae(u.tag),r+=be(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=U(e),i=re(t),o=new le(i?.getVr());let r;if(o.tag=t,void 0!==this.#Cn[e])r=this.#Cn[e].value;else{const e=i?.getName();r=this.#Cn[e].value}let s=be(o.vr,n);s+=this.#bn(o,[r],n),c.push(o),a+=s}const C=ns("FileMetaInformationVersion");let D=be(C.vr,!1);D+=this.#bn(C,[0,1],!1),l.push(C),h+=D,a+=D;const y=ns("ImplementationClassUID");let I=be(y.vr,!1);const w=`1.2.826.0.1.3680043.9.7278.1.${"0.37.0-beta.15".replace("-beta",".99")}`;I+=this.#bn(y,[w],!1),l.push(y),h+=I,a+=I;const T=ns("ImplementationVersionName");let L=be(T.vr,!1);L+=this.#bn(T,["DWV_0.37.0-beta.15"],!1),l.push(T),h+=L,a+=L;const P=function(e,t){return q(e.tag,t.tag)};l.sort(P),c.sort(P);const A=ns("FileMetaInformationGroupLength");let O=be(A.vr,!1);O+=this.#bn(A,new Uint32Array([h]),!1),a+=O;const b=new ArrayBuffer(a),x=new za(b),E=new za(b,!i);let R=128;R=x.writeUint8Array(R,this.#wn("DICM")),R=this.#Pn(x,A,R,!1);for(const e of l)R=this.#Pn(x,e,R,!1);const F=132+O+h;R!==F&&s.warn(`Bad size calculation... meta offset: ${R}, calculated size:${F} (diff:${R-F})`);for(const e of c)R=this.#Pn(E,e,R,n,o);return R!==a&&s.warn(`Bad size calculation... final offset: ${R}, calculated size:${a} (diff:${R-a})`),b}#bn(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[Ja];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=U(e),V(i.tag)||(l+=this.#bn(i,i.value,n,c),s.push(i),l+=be(i.vr,n))}const h={tag:Q(),vr:"NONE",vl:l,value:[]};a&&(h.undefinedLength=a),s.push(h),l+=be(h.vr,n),a&&(l+=be("NONE",n));const g=function(e,t){return q(e.tag,t.tag)};s.sort(g),o+=l,r.push(s)}a&&(o+=be("NONE",n)),e.value=r,e.vl=o,a&&(e.undefinedLength=a)}}else{if(ja(r=e.vr)||"OB"===r){const n=function(e){let t="";return ja(e)&&(t="UI"===e?"\0":" "),t}(e.vr);if(ja(e.vr)){let i;K(e.vr)?(t=this.#Tn(t.join("\\")),i=this.#Tn(n)):(t=this.#wn(t.join("\\")),i=this.#wn(n)),$a(t.length)||(t=Za(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;$a(t)||(e[e.length-1]=Za(e[e.length-1],[0]))}else $a(e.length)||(e=Za(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=J[e];return void 0!==t&&"string"!==t}(e.vr)||"ox"===e.vr){if(z(e.tag)&&Array.isArray(t)){o=0;for(const e of t)o+=e.length}else o=t.length;const r=J[e.vr];if(z(e.tag)||"ox"===e.vr)if(e.undefinedLength){const e=be("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 ts(e,t){if("UN"===e.vr){const n=re(e.tag)?.getVr();if(void 0!==n&&e.vr!==n){e.vr=n;const i=J[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 Se(e.buffer,n),r=e.byteOffset,a=e.length,s=J[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=se(e),n=re(t),i=new le(n?.getVr());return i.tag=t,i}class is{trackingId;trackingUid;referencedSopInstanceUID;referencedSopClassUID;referencedFrameNumber;mathShape;referencePoints;colour="#ffff80";quantification;textExpr="";labelPosition;planeOrigin;planePoints;#xn;#pe={};constructor(){this.trackingId=Math.random().toString(36).substring(2,15),this.trackingUid=Wa("TrackingUniqueIdentifier")}getMetaConceptIds(){return Object.keys(this.#pe)}getMetaItem(e){return this.#pe[e]}addMetaItem(e,t){const n=e.value;void 0!==this.#pe[n]&&s.warn(`Overwriting annotation meta with id=${n}`),this.#pe[e.value]={concept:e,value:t}}removeMetaItem(e){void 0!==this.#pe[e]&&delete this.#pe[e]}getOrientationName(){let e;return void 0!==this.planePoints&&(e=ze(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.#xn=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.#xn}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.#xn=e,this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID)):s.warn(`Cannot view annotation with reference UID: ${this.referencedSopInstanceUID}`)}#En(){let e;if(void 0!==this.#xn){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 D(n);e=this.#xn.getIndexFromPosition(i)}return e}getCentroid(){let e;if(void 0!==this.#xn&&void 0!==this.mathShape.getCentroid&&void 0!==this.mathShape.getCentroid()){const t=this.#En(),n=this.#xn.getScrollDimIndex(),i=t.getValues()[n],o=this.mathShape.getCentroid();if(e=this.#xn.getPositionFromPlanePoint(o,i),void 0!==this.referencedFrameNumber){const t=e.getValues();t[3]=this.referencedFrameNumber,e=new D(t)}}return e}setTextExpr(e){if(void 0!==this.#xn){const t=this.#xn.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=w(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.#xn&&void 0!==this.mathShape.quantify&&(this.quantification=this.mathShape.quantify(this.#xn,this.#En(),w(this.textExpr)))}getFactory(){let e;if(void 0===this.mathShape)return e;if(void 0!==ka.draw)for(const t in ka.draw){const n=ka.draw[t];if(n.supports(this.mathShape)){e=new n;break}}if(void 0===e)for(const t in Ga.draw){const n=Ga.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}}class os{current;measure}class rs{annotationGroups;responseEvaluations;comment}class as{#Ut;getWarning(){return this.#Ut}#Rn(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}(ue(e,"00020012")),n=void 0!==t&&function(e){const t=fe(e,"0.34.0"),n=fe(e,"0.35.0-beta.21");return t>=0&&n<=0}(t),i=ta(e);let o;const r=ia(e);return void 0!==r.conceptNameCode&&(o=r.conceptNameCode.value),n&&void 0===i&&o===jn.value}#Fn(e){const t="DCMR-1500"===ta(e);let n;const i=ia(e);void 0!==i.conceptNameCode&&(n=i.conceptNameCode.value);let o=!1;if(t&&n===_n.value){const e=i.contentSequence.find(this.#Mn);if(void 0!==e){const t=e.contentSequence.find(this.#qn);if(void 0!==t){const e=t.contentSequence.find(this.#Un),n=t.contentSequence.find(this.#Qn);void 0===e&&void 0===n||(o=!0)}}}return o}#Vn(e){return"DCMR-4100"===ta(e)}checkElements(e){return this.#Ut=void 0,this.#Rn(e)||this.#Fn(e)||this.#Vn(e)||(this.#Ut="Not a dwv supported annotation"),this.#Ut}#Nn(e,t){t.valueType===jr&&t.relationshipType===Gr&&(e.referencedSopClassUID=t.value.referencedSOPSequence.referencedSOPClassUID,e.referencedSopInstanceUID=t.value.referencedSOPSequence.referencedSOPInstanceUID,void 0!==t.value.referencedFrameNumber&&(e.referencedFrameNumber=parseInt(t.value.referencedFrameNumber,10)))}#Bn(e,t){t.hasHeader(Wr,ni(Nn),Nr)&&(e.trackingId=t.value,e.trackingUid=t.value)}#kn(e,t){t.hasHeader(Hr,ni(Nn),Br)&&(e.trackingId=t.value),t.hasHeader(Wr,ni(kn),Br)&&(e.trackingUid=t.value)}#Gn(e,t,n){void 0===n&&(n=!1);let i=zr;if(n&&(i=Nr),t.hasHeader(Hr,ni(Zn),i)){e.textExpr=t.value;const n=t.contentSequence.find(function(e){return e.hasHeader(Zr,ni($n),Nr)});void 0!==n&&(e.labelPosition=new m(n.value.graphicData[0],n.value.graphicData[1]))}if(t.hasHeader(Hr,ri(),i)&&(e.colour=t.value),t.hasHeader(Zr,ni($n),i)&&t.value.graphicType===wr){const n=[];for(let e=0;e<t.value.graphicData.length;e+=2)n.push(new m(t.value.graphicData[e],t.value.graphicData[e+1]));e.referencePoints=n}if(t.hasHeader(_r,ni(Jn),Vr)&&t.value.graphicType===wr){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.#zn(e,t),this.#Hn(e,t)}#zn(e,t,n){let i;if(void 0===n&&(i=Vr),t.valueType===Yr&&t.relationshipType===i){const n=function(e){let t;for(const n in ai){const i=ai[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 si){const i=si[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}}}}#Hn(e,t){t.valueType!==Xr&&t.valueType!==Hr||t.relationshipType!==Vr||e.addMetaItem(t.conceptNameCode,t.value)}#Mn(e){return e.hasHeader(Kr,ni(Kn),Vr)}#qn(e){return e.hasHeader(Kr,ni(jn),Vr)}#Yn(e){return e.hasHeader(Xr,ni(Rn),kr)}#Xn(e){return e.hasHeader(Kr,ni(Un),Nr)}#Wn(e){return e.hasHeader(Hr,ni(Yn),Vr)}#$n(e){return e.hasHeader(Xr,ni(Gn),Vr)}#jn(e){return e.hasHeader(Yr,ni(Bn),Vr)}#Zn(e){return e.hasHeader(Xr,ni(xn),Vr)}#Un(e){return e.hasHeader(Zr,ni(En),Vr)}#_n(e){return void 0!==e.contentSequence.find(this.#Un)}#Kn(e){let t;const n=e.contentSequence.find(this.#Un);if(void 0!==n){t=new is,t.mathShape=xr(n.value);const i=n.contentSequence.find(function(e){return e.valueType===jr&&e.relationshipType===Gr});void 0!==i&&this.#Nn(t,i);for(const n of e.contentSequence)this.#kn(t,n),this.#Gn(t,n)}return t}#Qn(e){let t;return e.valueType===Yr&&e.relationshipType===Vr&&(t=e.contentSequence.find(function(e){return e.valueType===Zr&&e.relationshipType===kr})),void 0!==t}#Jn(e){let t;return e.valueType===Yr&&e.relationshipType===Nr&&(t=e.contentSequence.find(function(e){return e.valueType===Zr&&e.relationshipType===kr})),void 0!==t}#ei(e){return void 0!==e.contentSequence.find(this.#Qn)}#ti(e){let t;const n=e.contentSequence.find(this.#Qn);if(void 0!==n){t=new is;const e=n.contentSequence.find(function(e){return e.valueType===Zr&&e.relationshipType===kr});t.mathShape=xr(e.value),t.mathShape instanceof m&&e.value.graphicData.length>=4&&(t.referencePoints=[new m(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===jr&&e.relationshipType===Gr});void 0!==i&&this.#Nn(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#kn(t,i),this.#zn(t,n),this.#Hn(t,i);return t}#ni(e){let t;const n=e.contentSequence.find(this.#Jn);if(void 0!==n){t=new is;const e=n.contentSequence.find(function(e){return e.valueType===Zr&&e.relationshipType===kr});t.mathShape=xr(e.value),t.mathShape instanceof m&&e.value.graphicData.length>=4&&(t.referencePoints=[new m(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===jr&&e.relationshipType===Gr});void 0!==i&&this.#Nn(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#kn(t,i),this.#zn(t,n,Nr),this.#Hn(t,i);return t}#ii(e){if(0===e.contentSequence.length)return;const t=e.contentSequence[0];let n=!1,i=!1;this.#qn(t)&&(n=this.#_n(t),i=this.#ei(t));const o=[];let r,a=!1;for(const t of e.contentSequence)if(this.#qn(t)){let e;a=!0,n?e=this.#Kn(t):i&&(e=this.#ti(t)),void 0!==e&&o.push(e)}return a?0!==o.length?r=new xt(o):s.warn("No valid measurement groups in TID 1500 SR"):s.warn("No measurement groups in TID 1500 SR"),r}#oi(e){const t=[];let n=!1;for(const i of e.contentSequence)if(this.#Yn(i)){n=!0;const e=this.#ni(i);void 0!==e&&t.push(e)}const i=[];return n?0!==t.length?i.push(new xt(t)):s.warn("No valid measurement groups in TID 4100 SR"):s.warn("No image findings in TID 4100 SR"),i}#ri(e){const t=new is;t.mathShape=xr(e.value);for(const n of e.contentSequence)this.#Nn(t,n),this.#Bn(t,n),this.#Gn(t,n,!0);return t}#ai(e){let t;e.valueType===Kr&&An(e.conceptNameCode,ni(_n))||s.warn("Not the expected TID 1500 SR content header");const n=e.contentSequence.find(this.#Mn);return void 0!==n?t=this.#ii(n):s.warn("No imaging measurements in TID 1500 SR"),t}#si(e){return e.valueType===Kr&&An(e.conceptNameCode,ni(qn))||s.warn("Not the expected TID 4100 SR content header"),e.contentSequence.find(this.#Zn)}#li(e){e.valueType===Kr&&An(e.conceptNameCode,ni(jn))||console.warn("Not the expected dwv034 content header");const t=[];for(const n of e.contentSequence)n.valueType===Zr&&t.push(this.#ri(n));return new xt(t)}#ci(e,t){const n=function(e){return ue(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=Cn({[i]:o});e.setMetaValue("CurrentRequestedProcedureEvidenceSequence",t.CurrentRequestedProcedureEvidenceSequence)}}create(e){const t=ia(e);let n,i;if(this.#Fn(e)?(i="TID 1500 SR",n=this.#ai(t)):this.#Rn(e)&&(s.warn("DWV v0.34 annotation"),i="DWV v0.34 SR",n=this.#li(t)),this.#Vn(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.#ci(n,e),n}createCADReport(e){const t=ia(e),n=this.#si(t);if(void 0===n)return void s.warn("No CAD processing and Findings Summary in TID 4100 SR");let i=[];if(this.#Vn(e)&&(i=this.#oi(n)),void 0===i)throw new Error("Cannot create annotation groups from TID 4100 SR");for(const t of i)this.#ci(t,e);const o=[];let r;for(const e of n.contentSequence)if(this.#Xn(e)){const t=this.#ui(e);void 0!==t&&o.push(t)}else this.#Wn(e)&&(r=e.value);const a=new rs;return a.annotationGroups=i,a.responseEvaluations=o,a.comment=r,a}#di(e){const t=new na(jr);t.relationshipType=Gr,t.conceptNameCode=ni(Wn);const n=new Zo;n.referencedSOPClassUID=e.referencedSopClassUID,n.referencedSOPInstanceUID=e.referencedSopInstanceUID;const i=new nr;return i.referencedSOPSequence=n,void 0!==e.referencedFrameNumber&&(i.referencedFrameNumber=e.referencedFrameNumber.toString()),t.value=i,t}#hi(e){const t=[],n=new na(Hr);n.relationshipType=Br,n.conceptNameCode=ni(Nn),n.value=e.trackingId,t.push(n);const i=new na(Wr);if(i.relationshipType=Br,i.conceptNameCode=ni(kn),i.value=e.trackingUid,t.push(i),void 0!==e.textExpr&&0!==e.textExpr.length){const n=new na(Hr);if(n.relationshipType=zr,n.conceptNameCode=ni(Zn),n.value=e.textExpr,void 0!==e.labelPosition){const t=new na(Zr);t.relationshipType=Nr,t.conceptNameCode=ni($n);const i=new Ar;i.graphicType=Ir;const o=[e.labelPosition.getX().toString(),e.labelPosition.getY().toString()];i.graphicData=o,t.value=i;const r=this.#di(e);t.contentSequence=[r],n.contentSequence=[t]}t.push(n)}const o=new na(Hr);if(o.relationshipType=zr,o.conceptNameCode=ri(),o.value=e.colour,t.push(o),void 0!==e.referencePoints){const n=new na(Zr);n.relationshipType=zr,n.conceptNameCode=ni($n);const i=new Ar;i.graphicType=wr;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.#di(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.planePoints){const n=new na(_r);n.relationshipType=Vr,n.conceptNameCode=ni(Jn);const i=new qr;i.graphicType=wr;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.#di(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.quantification)for(const n in e.quantification){const i=ra(n,S(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=Hr;i.value instanceof Pn&&(o=Xr);const r=new na(o);r.relationshipType=Vr,r.conceptNameCode=i.concept,r.value=i.value,t.push(r)}return t}#gi(e){const t=new na(Kr);t.relationshipType=Vr,t.conceptNameCode=ni(jn),t.value=Jr;const n=new na(Zr);n.relationshipType=Vr,n.conceptNameCode=ni(En),n.value=br(e.mathShape);const i=this.#di(e);return n.contentSequence=[i],t.contentSequence=[n].concat(this.#hi(e)),t}#Si(e){let t;if(0!==e.getList().length){const n=new na(Kr);n.conceptNameCode=ni(Kn),n.relationshipType=Vr,n.value=Jr;const i=[];for(const t of e.getList())i.push(this.#gi(t));n.contentSequence=i,t=new na(Kr),t.conceptNameCode=ni(_n),t.value=Jr,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=mn(Sn(i)),n.ContentTime=fn(pn(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.#Si(e);if(void 0===s)throw new Error("No annotation group SR content");return n={...n,...oa(s)},void 0!==t&&Dn(n,t),yn(n)}#pi(e){const t=new na(Xr);t.relationshipType=kr,t.conceptNameCode=ni(Rn),t.value=ni(Fn),t.contentSequence=[];const n=new na(Hr);n.relationshipType=Br,n.conceptNameCode=ni(Nn),n.value=e.trackingId,t.contentSequence.push(n);const i=new na(Wr);if(i.relationshipType=Br,i.conceptNameCode=ni(kn),i.value=e.trackingUid,t.contentSequence.push(i),void 0!==e.quantification)for(const n in e.quantification){const i=ra(n,S(e.quantification[n].value,12),e.quantification[n].unit,Nr);if(void 0!==i){const n=new na(Zr);n.relationshipType=kr,n.conceptNameCode=ni(Hn),n.value=br(e.mathShape);const o=this.#di(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=Hr;i.value instanceof Pn&&(o=Xr);const r=new na(o);r.relationshipType=Vr,r.conceptNameCode=i.concept,r.value=i.value,t.contentSequence.push(r)}return t}#mi(e,t){if(0!==e.getList().length)for(const n of e.getList())t.push(this.#pi(n))}#fi(e){const t=new na(Kr);t.relationshipType=Nr,t.conceptNameCode=ni(Un),t.value=Jr,t.contentSequence=[];const n=new na(Xr);if(n.relationshipType=Br,n.conceptNameCode=ni(Qn),n.value=ni(Vn),t.contentSequence.push(n),void 0!==e){if(void 0!==e.current){const n=new na(Xr);n.relationshipType=Vr,n.conceptNameCode=ni(Gn),n.value=e.current,t.contentSequence.push(n)}if(void 0!==e.measure){const n=new na(Yr);n.relationshipType=Vr,n.conceptNameCode=ni(Bn);const i=new Go;i.numericValue=e.measure,i.measurementUnitsCode=li("unit.mm");const o=new Xo;o.measuredValue=i,n.value=o,t.contentSequence.push(n)}}return t}#ui(e){let t,n,i;for(const i of e.contentSequence)this.#$n(i)?t=i.value:this.#jn(i)&&(n=i.value.measuredValue.numericValue);return void 0!==t&&(i=new os,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=mn(Sn(i)),n.ContentTime=fn(pn(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 na(Xr);s.relationshipType=Vr,s.conceptNameCode=ni(xn),s.value=ni(Mn),s.contentSequence=[];for(const t of e.responseEvaluations){const e=this.#fi(t);s.contentSequence.push(e)}for(const t of e.annotationGroups)this.#mi(t,s.contentSequence);if(void 0!==e.comment){const t=new na(Hr);t.relationshipType=Vr,t.conceptNameCode=ni(Yn),t.value=e.comment,s.contentSequence.push(t)}const l=new na(Kr);if(l.conceptNameCode=ni(qn),l.value=Jr,l.contentSequence.push(s),void 0===l)throw new Error("No annotation group SR content");return n={...n,...oa(l)},void 0!==t&&Dn(n,t),yn(n)}}const ss="30060084";class ls{type;points3D}class cs{number;name;colour;generationAlgorithm;interpretedType;roiInterpreter;contours}function us(e){const t={},n={},i=de(e,"30060020");if(void 0!==i)for(const e of i){const i=ue(e,"30060022"),o=ue(e,"30060026"),r=ue(e,"30060036");void 0!==i&&(t[i]=o??`ROI ${i}`,n[i]=r)}const o={},r=de(e,"30060080");if(void 0!==r)for(const e of r){const t=ue(e,ss);void 0!==t&&(o[t]={interpretedType:ue(e,"300600A4"),roiInterpreter:ue(e,"300600A6")})}const a=[],l=de(e,"30060039");if(void 0===l)return a;for(const e of l){const i=ue(e,ss),r=de(e,"3006002A"),l=de(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=Nt(Ut({l:l[0],a:l[1],b:l[2]})):(s.warn("No recommended colour for contour, using default"),c=Gt(i));const u=[],d=de(e,"30060040");if(void 0!==d)for(const e of d){const t=ue(e,"30060042"),n=de(e,"30060050");if(void 0===n)continue;const i=new ls;i.type=t??"CLOSED_PLANAR",i.points3D=n.map(e=>parseFloat(e)),u.push(i)}const h=new cs;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 ds={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyInstanceUID:"0020000D",StudyID:"00200010",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052"},hs=[{name:"TransferSyntaxUID",enum:[ne]},{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 gs(){const e={};for(const t of hs)e[t.name]=t.enum[0];return e}const Ss=[[-1,0],[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1]],ps={};for(let e=0;e<8;e++)ps[`${Ss[e][0]},${Ss[e][1]}`]=e;function ms(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 fs(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=ps[`${l-u},${c-d}`];let g=-1,S=-1,p=l,m=c;for(let r=1;r<=8;r++){const a=(h+r)%8,s=u+Ss[a][0],l=d+Ss[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;p=u+Ss[e][0],m=d+Ss[e][1];break}}if(-1===g)break;if(l=p,c=m,u=g,d=S,u===r&&d===a)break;s.push({x:u,y:d})}return s}function vs(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;ms(e,t,n,i,o,l,a);const u=fs(e,t,n,i,o,r,c);u.length>=3&&s.push(u)}return s}function Cs(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 Ds(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=Cs(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 ys(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 Is(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?vs(s,0,n,i,1):[]}class ws{#Ut;getWarning(){return this.#Ut}checkElements(e){return this.#Ut=void 0,this.#Ut}create(e,t){const n=us(e),i=t.getGeometry(),o=i.getSize(),r=o.get(0),s=o.get(1),l=o.get(2),c=r*s,u=new So(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 mi(o,t.name,t.generationAlgorithm??"MANUAL");a.interpretedType=t.interpretedType,a.roiInterpreter=t.roiInterpreter,a.displayRGBValue=new Et(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 p=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 D([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||(p.has(o)||p.set(o,[]),p.get(o).push(n))}for(const[e,t]of p){const n=new Uint8Array(c);ys(n,0,r,s,t,1),u.addFrame(o,n,0,e,c,o)}}const p=[];for(let e=0;e<l;++e)p.push(t.getImageUid(new a([0,0,e])));const m=new po(i,u.getLabelMap(),p,u);m.setPhotometricInterpretation("PALETTE COLOR"),m.setPaletteColourMap(new Co(h,g,S));const f=t=>ue(e,t),v={Modality:"RTSTRUCT"};for(const e of Object.keys(ds)){const t=f(ds[e]);void 0!==t&&(v[e]=t)}v.custom={segments:d,referencedSeriesUID:nt(e)};const C=t.getMeta();return void 0!==C.lengthUnit&&(v.lengthUnit=C.lengthUnit),m.setMeta(v),m}toDicom(e,t,n,i){const o=gs(),r=e.getMeta();for(const e of Object.keys(ds)){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=mn(Sn(l)),o.StructureSetTime=fn(pn(l));const c=e.getGeometry(),u=c.getSize(),d=u.get(0),h=u.get(1),g=u.get(2),S=d*h,p=e.getBuffer(),m=e.getHasOverlap(),f=m?e.getSegmentCollection()?.getAll():void 0,v=[],C=[],D=[];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"}),D.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=m&&r?.has(e),o=n?r.get(e):p,l=n?0:e*S,u=vs(o,l,d,h,t),g=u.length>0?Is(o,l,d,h,t):[],f=u.concat(g),v=g.length>0?"CLOSEDPLANAR_XOR":"CLOSED_PLANAR";for(const t of f){const n=Ds(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:D},void 0!==i&&Dn(o,i),yn(o)}}const Ts=["dataadd","dataremove","dataimageset","dataupdate"];function Ls(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}),!b(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 Ps{meta;image;annotationGroup;buffer;numberOfFiles;frameNumber;warn=[];#vi=!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.#vi}appendData(e){if(!this.#vi){let t=!0;if(void 0!==e.frameNumber&&void 0!==this.image){const n=ue(e.meta,"00080018");t=!this.image.includesImageUid(n)}void 0!==this.image&&void 0!==e.image&&(this.#Ci(e.image),this.#vi&&void 0!==e.frameNumber&&s.error("Cannot append frame with duplicate origin, following data will be ignored")),t&&this.#Di(e.meta)}}#Ci(e){const t=e.getGeometry();this.image.getGeometry().canAppendOrigin(t.getOrigin(),t.getInitialTime()).success||(this.#vi=!0),this.#vi||this.image.appendSlice(e)}#Di(e){this.meta=Ls(this.meta,e,_i)}}class As{#Pe=[];addClone(e){const t=new Ps(structuredClone(e.meta));t.image=e.image.clone(),this.add(t)}add(e){this.#Pe.push(e)}buildData(){const e=this.#yi(),t=this.#Ii(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,volumeIndexGetter:i}=this.#wi(e,t);if(void 0===n)throw new Error("Cannot create image for multi-volume");let o,r;for(let e=0;e<n.length;++e){const t=n[e],a=this.#Pe[t[0]].meta;r=void 0===r?a:Ls(r,a,i);for(const n of t){const t=this.#Pe[n].image;t.getGeometry().setInitialTime(e),void 0===o?o=t:o.appendSlice(t)}}return{image:o,meta:r}}#wi(e,t){if(void 0!==Me.getPostLoadVolumeIdTagValue){const n=Me.getPostLoadVolumeIdTagValue;return{volsIndices:this.#Ti(e,t,n),volumeIndexGetter:n}}const n=void 0!==Me.postLoadVolumeIdCandidates?Me.postLoadVolumeIdCandidates:Ki;for(const i of n){const n=this.#Ti(e,t,i.getter);if(void 0!==n)return s.debug(`Using '${i.name}' as temporal position identifier`),{volsIndices:n,volumeIndexGetter:i.getter}}return{volsIndices:void 0,volumeIndexGetter:void 0}}#Ti(e,t,n){const i=[],o=[];for(const r of e){if(0===o.length){for(const e of r.indices){const t=n(this.#Pe[e].meta);if(o.includes(t))return;o.push(t)}if(o.length!==t)return;o.sort()}for(const e of r.indices){const t=n(this.#Pe[e].meta),r=o.indexOf(t);if(-1===r)return;void 0===i[r]&&(i[r]=[]),i[r].push(e)}}const r=e.length;for(const e of i)if(e.length!==r)return;return i}#Ii(e){if(0===e.length)return 0;const t=e[0].count;for(const n of e)if(n.count!==t)return;return t}#yi(){const e=function(e){return function(t){return t.pos.equals(e)}},t=[];for(let n=0;n<this.#Pe.length;++n){const i=this.#Pe[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 Os extends EventTarget{#Li={};#Pi={};#Ai={};#Oi=-1;constructor(){super()}getNextDataId(){return++this.#Oi,this.#Oi.toString()}getDataIds(){return Object.keys(this.#Li)}reset(){this.#Li={}}get(e){return this.#Li[e]}getDataIdsFromSopUids(e){const t=[];if(void 0===e||0===e.length)return t;const n=Object.keys(this.#Li);for(const i of n)void 0!==this.#Li[i].image&&this.#Li[i].image.containsImageUids(e)&&t.push(i);return t}getDataIdFromSeriesUid(e){let t;const n=Object.keys(this.#Li);for(const i of n){const n=this.#Li[i].image;if(void 0!==n&&e===n.getMeta().SeriesInstanceUID){t=i;break}}return t}setImage(e,t){this.#Li[e].image=t;for(const n of At)t.addEventListener(n,this.#bi(e));this.dispatchEvent(new CustomEvent("dataimageset",{detail:{value:[t],dataid:e}}))}#xi(e){const t=ue(e.meta,"00080060");let n;if(Y(e.meta))if("SEG"===t){const t=tt(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 Lo,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,this.#Li[i].image))}else n=new qo,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,e.numberOfFiles,e.frameNumber));else if("SR"===t)n=new as,void 0===n.checkElements(e.meta)&&(e.annotationGroup=n.create(e.meta));else if("RTSTRUCT"===t){const t=nt(e.meta),i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create RT struct: referenced series is not loaded");n=new ws,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,this.#Li[i].image))}void 0!==n&&void 0!==n.getWarning()&&e.warn.push(n.getWarning())}add(e,t){if(void 0===e||void 0!==this.#Li[e])return!1;if(this.#Li[e]=t,void 0===t.image&&void 0===t.annotationGroup&&(this.#xi(t),void 0!==t.numberOfFiles&&t.numberOfFiles>1&&void 0===t.frameNumber&&(this.#Pi[e]=new As,this.#Pi[e].addClone(t))),void 0!==t.image)for(const n of At)t.image.addEventListener(n,this.#bi(e));if(void 0!==t.annotationGroup)for(const n of bt)t.annotationGroup.addEventListener(n,this.#bi(e));return this.dispatchEvent(new CustomEvent("dataadd",{detail:{dataid:e}})),!0}remove(e){if(void 0!==this.#Li[e]){const t=this.#Li[e].image;if(void 0!==t)for(const n of At)t.removeEventListener(n,this.#bi(e));const n=this.#Li[e].annotationGroup;if(void 0!==n)for(const t of bt)n.removeEventListener(t,this.#bi(e));delete this.#Li[e],this.dispatchEvent(new CustomEvent("dataremove",{detail:{dataid:e}}))}}stash(e){void 0!==this.#Li[e]&&(this.#Ai[e]=this.#Li[e],this.remove(e))}unstash(e){void 0!==this.#Ai[e]&&(this.add(e,this.#Ai[e]),delete this.#Ai[e])}getStashedDataIds(){return Object.keys(this.#Ai)}getStashed(e){return this.#Ai[e]}update(e,t){if(void 0===this.#Li[e])throw new Error(`Cannot find data to update: ${e}`);const n=this.#Li[e];this.#xi(t),void 0!==this.#Pi[e]&&void 0===t.frameNumber&&this.#Pi[e].add(t),n.hasDuplicateOrigin()||n.appendData(t),this.dispatchEvent(new CustomEvent("dataupdate",{detail:{dataid:e}}))}markDataAsComplete(e){const t=this.#Li[e];if(void 0===t)throw new Error(`Cannot find data to mark as complete: ${e}`);const n={imageHasChanged:!1};if(void 0!==this.#Pi[e]&&t.hasDuplicateOrigin()){const i=this.#Pi[e].buildData();this.setImage(e,i.image),t.meta=i.meta,delete this.#Pi[e],n.imageHasChanged=!0}return t.setComplete(!0),n}#bi(e){return t=>{const n=Object.assign({},t.detail,{dataid:e});this.dispatchEvent(new CustomEvent(t.type,{detail:n}))}}}class bs{#Ei;setOptions(e){this.#Ei=e}#Ri;#Fi=[];#Mi=[];#qi=[];#Ui=!1;#Qi(e,t,n,i){const o=this.#Fi[e].getDicomElements(),r=new Ps(o);r.buffer=n,r.numberOfFiles=this.#Ei.numberOfFiles,r.frameNumber=i,this.onloaditem({data:r,source:t})}#Vi(e,t){const n=this.#Fi[e].getDicomElements();return t>1&&"SEG"!==ue(n,"00080060")}#Ni(e,t){this.#Ui||(this.onprogress({lengthComputable:!0,loaded:100,total:100,index:e,source:t}),this.onload({source:t}),this.onloadend({source:t}))}#Bi(e){this.#Ri=new un(e),this.#Ri.ondecodeditem=e=>{this.#ki(e)},this.#Ri.onerror=this.onerror,this.#Ri.onabort=this.onabort}#Gi(e){const t=this.#Fi[e].getDicomElements(),n={missing:[]},i=ue(t,"00280100");void 0!==i?n.bitsAllocated=i:n.missing.push("bitsAllocated");const o=ue(t,"00280103");void 0!==o?n.isSigned=1===o:n.missing.push("pixelRepresentation");const r=ue(t,"00280011"),a=ue(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=ue(t,"00280002");if(void 0!==s){if(n.samplesPerPixel=s,1!==s){const e=ue(t,"00280006");void 0!==e?n.planarConfiguration=e:n.missing.push("planarConfiguration")}}else n.missing.push("samplesPerPixel");return n}#zi(e,t,n){const i=this.#Gi(e);if(0!==i.missing.length)return this.#Ri.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.#Ri.decode(n[r],i,{itemNumber:r,numberOfItems:o,index:e,indexOrigin:t})}#ki(e){if(this.#Ui)return;const t=e.index,n=e.indexOrigin;++this.#Mi[t];const i=this.#Mi[t];this.onprogress({lengthComputable:!0,loaded:i,total:e.numberOfItems,index:e.index,source:n});const o=e.data[0];if(this.#Vi(t,e.numberOfItems))this.#Qi(t,n,o,e.itemNumber);else if(1===e.numberOfItems)this.#Qi(t,n,o);else{if(void 0===this.#qi[t]){const i=e.numberOfItems*o.length;try{this.#qi[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.#Ri.abort(),this.onerror({error:e,source:n}),void this.onloadend({source:n})}}this.#qi[t].set(o,o.length*e.itemNumber),i===e.numberOfItems&&(this.#Qi(t,n,this.#qi[t]),this.#qi[t]=void 0)}i===e.numberOfItems&&(this.onload(e),this.onloadend(e))}convert(e,t,n){this.#Ui=!1,this.onloadstart({source:t,index:n});const i=new Re;void 0!==this.#Ei.defaultCharacterSet&&i.setDefaultCharacterSet(this.#Ei.defaultCharacterSet);try{i.parse(e)}catch(e){return this.onerror({error:e,source:t}),void this.onloadend({source:t})}this.#Fi[n]=i;const o=i.getDicomElements(),r=H(o);if(void 0!==r){const e=r.value,i=function(e){let t;return Pe(e)?t="jpeg2000":Te(e)?t="jpeg-baseline":Le(e)?t="jpeg-lossless":Ae(e)&&(t="rle"),t}(ue(o,"00020010"));if(void 0!==i)void 0===this.#Ri&&this.#Bi(i),this.#Mi[n]=0,this.#qi[n]=void 0,this.#zi(n,t,e);else{const i=e[0];let r=parseInt(ue(o,"00280008"),10);if(isNaN(r)&&(r=1),this.#Vi(n,r)){const e=i.length/r;for(let o=0;o<r&&!this.#Ui;++o)this.#Qi(n,t,i.subarray(o*e,(o+1)*e),o)}else this.#Qi(n,t,i);this.#Ni(n,t)}}else this.#Qi(n,t),this.#Ni(n,t)}abort(){this.#Ui=!0,void 0!==this.#Ri?this.#Ri.abort():this.onabort({})}onloadstart(e){}onloaditem(e){}onprogress(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class xs extends on{#Ei={};#Hi=!1;getOptions(){return this.#Ei}setOptions(e){this.#Ei=e}isLoading(){return this.#Hi}setLoading(e){this.#Hi=e}canLoadFile(e){if(void 0!==e.type&&this.canLoadMediaType(e.type))return!0;const t=T(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=T(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 Es extends xs{#Yi=new bs;load(e,t,n){this.isLoading()||(this.#Yi.setOptions(this.getOptions()),this.#Yi.onloadstart=this.onloadstart,this.#Yi.onprogress=this.onprogress,this.#Yi.onloaditem=this.onloaditem,this.#Yi.onload=this.onload,this.#Yi.onloadend=e=>{this.setLoading(!1),this.onloadend(e)},this.#Yi.onerror=e=>{e.source=t,this.onerror(e)},this.#Yi.onabort=this.onabort),this.setLoading(!0),this.#Yi.convert(e,t,n)}abort(){this.setLoading(!1),this.#Yi.abort()}canLoadExtension(e){return void 0===e||"dcm"===e}isLoaderName(e){return"dicom"===e}canLoadMediaType(e){return"application/dicom"===e}loadFileAs(){return zs.ArrayBuffer}loadUrlAs(){return 1}}class Rs extends xs{load(e,t,n){this.setLoading(!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.setLoading(!1),this.onloadend({source:t})}}abort(){this.setLoading(!1),this.onabort({}),this.onloadend({})}canLoadExtension(e){return"json"===e}isLoaderName(e){return"json"===e}canLoadMediaType(e){return"application/json"===e||"application/dicom+json"===e}loadFileAs(){return zs.Text}loadUrlAs(){return 0}}class Fs extends on{#Je=null;#tt=null;#nt=0;#it=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#rt(e){this.#Je=e,this.#nt=0,this.#it=0,this.#st()}#ct(e){this.#tt=e}#st(){this.#tt=null}#ut=e=>{this.#nt++,this.#nt===this.#Je.length&&this.onload({source:this.#Je})};#dt=e=>{this.#it++,this.#it===this.#Je.length&&this.onloadend({source:this.#Je})};load(e){if(void 0===e||0===e.length)return;this.#rt(e),this.onloadstart({source:e});const t=new nn(this.onprogress);t.setNToLoad(e.length),t.setNumberOfDimensions(1);const n=Gs(),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({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=t.getUndefinedMonoProgressHandler(0),r.onloaditem=this.onloaditem,r.onload=this.#ut,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.#tt&&this.#tt.isLoading()&&this.#tt.abort()}}class Ms extends xs{#Xi=0;#Wi=0;#$i=[];load(e,t,n){0===this.#Wi&&(this.#Xi=this.getOptions().numberOfFiles??1,this.#$i=[],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=R(new Uint8Array([13,10,13,10]));let o=E(t,i,0);if(void 0===o)throw new Error("Can't find the end of the first multipart header");const r=x(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=R(L(a)),l=a.length;let c=E(t,s,0);for(;void 0!==o;){const e={},r=x(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=E(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=E(t,i,c+l)}return n}(e);if(this.#$i.push(...i),this.#Wi++,this.#Wi<this.#Xi)return;const o=new Fs;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.#Xi;t++)this.onload(e)},o.onloadend=e=>{this.setLoading(!1),this.#Wi=0;const t=this.#Xi;for(let n=0;n<t;n++)this.onloadend(e)},o.onerror=this.onerror,o.onabort=this.onabort,o.load(this.#$i)}abort(){this.setLoading(!1),this.#Wi=0,this.onabort({}),this.onloadend({})}isLoaderName(e){return"multipart"===e}canLoadMediaType(e){return"multipart/related"===e}loadFileAs(){return zs.ArrayBuffer}loadUrlAs(){return 1}}function qs(e){return parseInt(e,36).toString()}function Us(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 ut([e,t,1]),s=new Xe([1,1,1]),l=new f(0,0,n),c=new St([l],a,s),u=new Ot(c,i,[r]);u.setPhotometricInterpretation("RGB");const d={BitsStored:8};return void 0!==o&&(d.numberOfFiles=o),u.setMeta(d),u}class Vs extends xs{#ji(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=qs(t)):(l.fileName={value:[t.name]},c=qs(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,Us(s),1,u.toString()),h=d.getMeta();h.SeriesInstanceUID=c,d.setMeta(h);const g=new Ps(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.#ji(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 zs.DataURL}loadUrlAs(){return 1}}class Ns extends xs{#ji(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.#ji(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=qs(r)):(u.fileName={value:[r.name]},d=qs(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=Us(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 Ps(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.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 zs.DataURL}loadUrlAs(){return 1}}class Bs extends xs{#Zi="";#_i=[];#Ki=null;#Ji(e,t,n){this.#_i.push({filename:this.#Zi,data:e});const i=100*this.#_i.length/this.#Ki.length;if(this.onprogress({lengthComputable:!0,loaded:i/2,total:100,index:n,item:{loaded:i,total:100,source:t}}),this.#_i.length<this.#Ki.length){const e=this.#_i.length;this.#Zi=this.#Ki[e].name,this.#Ki[e].async("arrayBuffer").then(e=>{this.#Ji(e,t,n)}).catch(e=>{this.setLoading(!1),this.onerror({error:e}),this.onloadend({})})}else{const e=new Fs;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.#_i)}}load(e,n,i){this.onloadstart({source:n}),this.setLoading(!0),t.loadAsync(e).then(e=>{if(this.#_i=[],this.#Ki=e.file(/.*\.dcm/),0===this.#Ki.length)return this.setLoading(!1),this.onerror({error:new Error("No DICOM file found in ZIP")}),void this.onloadend({});this.#Zi=this.#Ki[0].name,this.#Ki[0].async("arrayBuffer").then(e=>{this.#Ji(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 zs.ArrayBuffer}loadUrlAs(){return 1}}let ks=null;function Gs(){return null===ks&&(ks=[Es,Rs,Ms,Vs,Ns,Bs]),ks}const zs={Text:0,ArrayBuffer:1,DataURL:2};class Hs extends on{#Je=null;#eo=[];#tt=null;#nt=0;#it=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#rt(e){this.#Je=e,this.#nt=0,this.#it=0,this.#to(),this.#st()}#no(e){this.#eo.push(e)}#to(){this.#eo=[]}#ct(e){this.#tt=e}#st(){this.#tt=null}#ut=e=>{this.#nt++,this.#nt===this.#Je.length&&this.onload({source:this.#Je})};#dt=e=>{this.#it++,this.#it===this.#Je.length&&this.onloadend({source:this.#Je})};#ht(e,t){return n=>{n.source=t,e(n)}}#pt(e,t,n){return i=>{e.load(i.target.result,t,n)}}load(e){if(void 0===e||0===e.length)return;this.#rt(e),this.onloadstart({source:e});const t=new nn(this.onprogress);t.setNToLoad(e.length);const n=Gs(),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({numberOfFiles:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=t.getUndefinedMonoProgressHandler(1),r.onloaditem=this.onloaditem,r.onload=this.#ut,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.#no(i),i.onprogress=this.#ht(t.getMonoProgressHandler(n,0),o),i.onload=this.#pt(r,o,n);const a=this.#ht(this.onerror,o);i.onerror=e=>{this.#dt(),a(e)};const s=this.#ht(this.onabort,o);i.onabort=e=>{this.#dt(),s(e)},r.loadFileAs()===zs.Text?i.readAsText(o):r.loadFileAs()===zs.DataURL?i.readAsDataURL(o):r.loadFileAs()===zs.ArrayBuffer&&i.readAsArrayBuffer(o)}}abort(){for(let e=0;e<this.#eo.length;++e)1===this.#eo[e].readyState&&this.#eo[e].abort();this.#tt&&this.#tt.isLoading()&&this.#tt.abort()}}const Ys=["loadstart","loadprogress","loaditem","load","loadend","error","abort","timeout"];class Xs extends EventTarget{#f;#io={};constructor(e){super(),this.#f=e}loadFiles(e,t){this.#oo(e,t)}loadURLs(e,t,n){this.#ro(e,t,n)}loadImageObject(e,t){const n=new Fs;this.#ao(e,n,"image",t)}getLoadingDataIds(){return Object.keys(this.#io)}abort(e){void 0!==this.#io[e]&&(this.#io[e].loader.abort(),delete this.#io[e])}#oo(e,t){const n=new Hs;n.setDefaultCharacterSet(this.#f),this.#ao(e,n,"image",t)}#ro(e,t,n){const i=new rn;i.setDefaultCharacterSet(this.#f),this.#ao(e,i,"image",t,n)}#ao(e,t,n,i,o){const r={dataid:i,loadtype:n};t.onloadstart=e=>{this.#io[i]={loader:t,isFirstItem:!0},this.#bi("loadstart",r)(e)},t.onprogress=this.#bi("loadprogress",r),t.onloaditem=e=>{const t={dataid:i,loadtype:n};void 0!==this.#io[i]&&(t.isfirstitem=this.#io[i].isFirstItem),this.#bi("loaditem",t)(e),void 0!==this.#io[i]&&this.#io[i].isFirstItem&&(this.#io[i].isFirstItem=!1)},t.onload=this.#bi("load",r),t.onloadend=e=>{delete this.#io[i],this.#bi("loadend",r)(e)},t.onerror=this.#bi("error",r),t.onabort=this.#bi("abort",r),void 0!==t.ontimeout&&(t.ontimeout=this.#bi("timeout",r));try{t.load(e,o)}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{dataid:i,loadtype:n,error:e}})),this.dispatchEvent(new CustomEvent("loadend",{detail:{dataid:i,loadtype:n}}))}}#bi(e,t){return n=>{const i=Object.assign({},n,t);this.dispatchEvent(new CustomEvent(e,{detail:i}))}}}const Ws=["undoadd","undoremove","undo","redo"];class $s extends EventTarget{#so=new qa;constructor(){super(),this.#lo()}addToUndoStack=e=>{this.#so.add(e)};removeFromUndoStack=e=>this.#so.remove(e);undo(){this.#so.undo()}redo(){this.#so.redo()}getStackSize(){return this.#so.getStackSize()}getCurrentStackIndex(){return this.#so.getCurrentStackIndex()}reset(){this.#so=new qa,this.#lo()}#lo(){for(const e of Ws)this.#so.addEventListener(e,t=>{const n=Object.assign({},t.detail);this.dispatchEvent(new CustomEvent(e,{detail:n}))})}}class js{tags;event;pos;format;precision;value}function Zs(e){return function(t){return Number(t).toPrecision(e)}}function _s(e){let t="";for(let n=0;n<e;++n)0!==n&&(t+=", "),t+=`{v${n}}`;return t}function Ks(e,t){let n=e;for(let e=0;e<t.length;++e)n=n.replace(`{v${e}}`,t[e]);return n}class Js extends EventTarget{#in;#nn;#co;#uo=[];#do;#ho={};#go;constructor(e,t,n){super(),this.#in=e,this.#nn=t,this.#co=n;const i=Object.keys(this.#co);for(let e=0;e<i.length;++e){const t=this.#co[i[e]];for(const e of t){const t=e.event;void 0!==t&&(this.#uo.includes(t)||this.#uo.push(t))}}this.addAppListeners()}reset(){this.#ho={},this.#go=void 0}addItemMeta(e){let t;void 0!==e["00020010"]?void 0!==e["00080018"]?(t=e["00080018"].value[0],void 0===this.#ho[t]&&(this.#ho[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=gn(dn(i));void 0!==e&&t.push(e.toLocaleDateString())}else if("TM"===i.vr){const e=gn({year:1900,monthIndex:0,day:1},hn(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=_s(t.length)),i.value=Ks(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:ye(e),format:"{v0}"}),n.push({pos:"bc",value:t,format:"{v0}"}),n.push({pos:"tc",value:ye(t),format:"{v0}"})}return n}(e,this.#co))):s.warn("Missing DICOM SOP instance UID for info data indexing"):void 0!==e.imageUid?(t=e.imageUid.value[0],this.#ho[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=_s(t.length)),i.value=Ks(i.format,t).trim()}n.push(i)}return n}(e,this.#co)):s.warn("Missing DOM image UID for info data indexing"),void 0!==t&&(this.#go=t)}onSliceChange=e=>{const t=e.detail?.dataid;if(t!==this.#nn)return;const n=e.detail?.data;void 0!==n&&void 0!==n.imageUid&&this.#go!==n.imageUid&&(this.#go=n.imageUid,this.#So(e))};#So=e=>{const t=e.detail?.dataid;if(void 0!==t&&t!==this.#nn)return;const n=this.#ho[this.#go];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:Zs(parseInt(t.precision,10)),o=o.map(e)}n=Ks(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.#go}`)};isListening(){return this.#do}addAppListeners(){this.#in.addEventListener("positionchange",this.onSliceChange);for(const e of this.#uo)this.#in.addEventListener(e,this.#So);this.#do=!0}removeAppListeners(){this.#in.removeEventListener("positionchange",this.onSliceChange);for(const e of this.#uo)this.#in.removeEventListener(e,this.#So);this.#do=!1}}function el(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 tl(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 il 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 ol extends nl{onWheel(e,t){if(void 0===t)return;const n=-e.deltaY/500,i=Jt(e),o=tl(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()}}class rl{#se;#po;#mo;#fo;constructor(e,t){if(this.#se=e,this.#po=e.isID(),this.#mo=Math.pow(2,t),!this.#po){this.#fo=new Float32Array(this.#mo);for(let e=0;e<this.#mo;++e)this.#fo[e]=this.#se.apply(e)}}getRSI(){return this.#se}getLength(){return this.#mo}getValue(e){return this.#po?e:this.#fo[e]}}class al{#vo;#Co;#fo;#Do=0;#yo=!0;constructor(e,t,n){if(this.#vo=e,t){const e=this.#vo.getLength();this.#Do=e/2}else this.#Do=0;this.#yo=n}getVoiLut(){return this.#Co}getModalityLut(){return this.#vo}setVoiLut(e){if(this.#Co=e,this.#Co.setSignedOffset(this.#vo.getRSI().getSlope()*this.#Do),this.#yo){const e=this.#vo.getLength();this.#fo=new Uint8ClampedArray(e);for(let t=0;t<e;++t)this.#fo[t]=this.#Co.apply(this.#vo.getValue(t))}}getValue(e){return this.#yo?this.#fo[e+this.#Do]:Math.floor(this.#Co.apply(e+this.#Do))}}const sl={CT:{mediastinum:new Tt(40,400),lung:new Tt(-500,1500),bone:new Tt(500,2e3),brain:new Tt(40,80),head:new Tt(90,350)}};class ll{create(e,t){const n=new hl(t);"MONOCHROME1"===t.getPhotometricInterpretation()&&n.setColourMap("invPlain");let i={};void 0!==t.getMeta().windowPresets&&(i=t.getMeta().windowPresets),i.minmax=new Oo("minmax");const o=t.getMeta().Modality;let r;r=void 0!==Me.wlPresets&&void 0!==Me.wlPresets[o]?Me.wlPresets[o]:sl[o];for(const e in r){const t=r[e];i[e]=new Oo(e,[new Tt(t.center,t.width)])}return n.setWindowPresets(i),n}}class cl{#Io=[];#wo(e){return this.#Io.indexOf(e)}isHidden(e){return-1!==this.#wo(e)}addToHidden(e){this.isHidden(e)?s.warn(`Not hidding segment, it is allready in the hidden list: ${e}`):this.#Io.push(e)}removeFromHidden(e){const t=this.#wo(e);-1!==t?this.#Io.splice(t,1):s.warn(`Cannot remove segment, it is not in the hidden list: ${e}`)}}const ul=["wlchange","wlpresetadd","colourmapchange","positionchange","opacitychange","alphafuncchange","maskviewchange"];function dl(e,t){return(new ll).create(e,t)}class hl extends EventTarget{#To;#Lo;#ue;#Po={minmax:new Oo("minmax")};#Ao;#Oo;#bo="plain";#xo;#z;#Eo=.33;#Ro=1;#Fo;#Mo=function(e,t){return 255};#qo=(e,t)=>0===e||this.#Uo.isHidden(e)?0:0!==this.getContourThickness()&&this.#To.getContour().getDistance(t,this.getOrientation())<=this.getContourThickness()?255:255*this.getFillOpacity();#Uo;constructor(e){super(),this.setImage(e)}getImage(){return this.#To}setImage(e){this.#To=e;const t=e.getMeta().windowPresets;if(void 0!==t)for(const e of Object.keys(t))this.#Po[e]=t[e];void 0===this.getCurrentPosition()&&this.setCurrentIndex(e.getInitialIndex(),!0),this.isMask()?(this.#Uo=new cl,this.#Fo=this.#qo):(this.#Fo=this.#Mo,this.#To.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.#To instanceof po}setMaskViewHelper(e){this.#Uo=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}getOrientation(){return this.#z}setOrientation(e){this.#z=e}getFillOpacity(){return this.#Eo}setFillOpacity(e){this.#Eo=e>1?1:e<0?0:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#Eo,this.#Ro]}}))}getContourThickness(){return this.#Ro}setContourThickness(e){this.#Ro=e<0?0:e>10?10:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#Eo,this.#Ro]}}))}getPlaybackMilliseconds(e){return e||(e=10),Math.round(1e3/e)}getAlphaFunction(){return this.#Fo}setAlphaFunction(e){this.#Fo=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}#Qo(){if(void 0!==this.#Ao&&void 0!==this.#Po[this.#Ao]&&void 0!==this.#Po[this.#Ao].perslice&&!0===this.#Po[this.#Ao].perslice&&!this.#To.isResampled()){const e=this.getCurrentIndex();if(void 0===e)throw new Error("Cannot get window lut with no current index");const t=this.#To.getSecondaryOffset(e),n=this.#Po[this.#Ao].wl[t];void 0!==n&&this.setWindowLevel(n,this.#Ao,!0)}if(void 0===this.#Oo&&this.setWindowLevelPresetById(0,!0),void 0===this.#ue||this.#To.isConstantRSI()!==this.#ue){let e,t;this.#ue=this.#To.isConstantRSI(),this.#ue?(e=this.#To.getRescaleSlopeAndIntercept(),t=!0):(e=new Fe(1,0),t=!1);const n=new rl(e,this.#To.getMeta().BitsStored);this.#Lo=new al(n,1===this.#To.getMeta().PixelRepresentation,t)}const e=this.#Lo.getVoiLut();let t;if(void 0!==e&&(t=e.getWindowLevel()),void 0===e||!Lt(this.#Oo,t)){const e=new wt(this.#Oo,this.#To.getMeta().VOILUTFunction);this.#Lo.setVoiLut(e)}return this.#Lo}getWindowPresets(){return this.#Po}getWindowPresetsNames(){return Object.keys(this.#Po)}setWindowPresets(e){this.#Po=e}addWindowPresets(e){const t=Object.keys(e);for(const n of t)if(void 0!==this.#Po[n]){if(void 0!==this.#Po[n].perslice&&!0===this.#Po[n].perslice)throw new Error("Cannot add perslice preset");this.#Po[n]=e[n]}else this.#Po[n]=e[n],this.dispatchEvent(new CustomEvent("wlpresetadd",{detail:{name:n}}))}getCurrentWindowPresetName(){return this.#Ao}getColourMap(){return this.#bo}#Vo(){return Do[this.#bo]}setColourMap(e){if(!Do[e])throw new Error(`Unknown colour map: '${e}'`);this.#bo=e,this.dispatchEvent(new CustomEvent("colourmapchange",{detail:{value:[e]}}))}getCurrentPosition(){return this.#xo}getCurrentIndex(){const e=this.getCurrentPosition();if(void 0!==e)return this.getImage().getGeometry().worldToIndex(e)}getCurrentImageUid(){return this.#To.getImageUid(this.getCurrentIndex())}getOriginForImageUid(e){return this.#To.getOriginForImageUid(e)}includesImageUid(e){return this.#To.includesImageUid(e)}isPositionInBounds(e){void 0===e&&(e=this.#xo);const t=this.#To.getGeometry(),n=t.worldToIndex(e),i=[this.getScrollDimIndex()];return 4===n.length()&&i.push(3),t.isIndexInBounds(n,i)}getOrigin(e){const t=this.#To.getGeometry();let n=0;return void 0!==e&&(n=t.worldToIndex(e).get(2)),t.getOrigins()[n]}setCurrentIndex(e,t){const n=this.#To.getGeometry().indexToWorld(e);return this.setCurrentPosition(n,t)}setCurrentPosition(e,t){void 0===t&&(t=!1);const n=this.#To.getGeometry(),i=n.getSize().normalisePoint(e,this.#xo),o=n.worldToIndex(i),r=[this.getScrollDimIndex()];if(4===o.length()&&r.push(3),!n.isIndexInBounds(o,r))return this.#xo=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.#xo=i,!t){const t=[o.getValues(),e.getValues()];if(this.#To.canQuantify()){const e=this.#To.getRescaledValueAtIndex(o);t.push(e)}this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:t,diffDims:a,data:{imageUid:this.#To.getImageUid(o)}}}))}return!0}setWindowLevel(e,t,n){if(void 0===t&&(t="manual"),"manual"!==t&&void 0===this.#Po[t])throw new Error(`Unknown window level preset: '${t}'`);void 0===n&&(n=!1);const i=Pt(e,this.#To.getRescaledDataRange(),this.#To.getMeta().VOILUTFunction),o=!Lt(i,this.#Oo),r=this.#Ao!==t;(o||r)&&(this.#Oo=i,this.#Ao=t,"manual"===t&&(void 0!==this.#Po[t]?this.#Po[t].wl[0]=i:this.addWindowPresets({manual:new Oo("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.#Qo().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.#To.isResampled()){const e=this.#To.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 Pt(new Tt(n,t),e,this.#To.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=ao(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.#Qo(),this.#Vo());break;case"PALETTE COLOR":n instanceof po&&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,p=0,m=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],p+=n.blue[e],++m)}if(0===m)e.data[g+3]=0;else{e.data[g]=Math.round(l/m),e.data[g+1]=Math.round(S/m),e.data[g+2]=Math.round(p/m);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.#Uo):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=Ft(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 Qe(this.#z)}}class gl{#No={};add(e,t){void 0===this.#No[e]&&(this.#No[e]=[]),this.#No[e].push(t)}remove(e,t){if(void 0===this.#No[e])return;let n=0;for(let i=0;i<this.#No[e].length;++i)this.#No[e][i]===t&&(++n,this.#No[e].splice(i,1));0===n&&s.debug(`No callback found on remove listener for type ${e}`)}fireEvent=e=>{if(void 0===this.#No[e.type])return;const t=this.#No[e.type].slice();for(let n=0;n<t.length;++n)t[n](e)}}class Sl{#Bo;#B;#ko;#Go;#zo;constructor(e,t){this.#Bo=e,this.#B=e.getRealSpacing(),this.#ko=e.getOrientation(),this.#Go=t,this.#zo=function(e,t){let n=e.asOneAndZeros().multiply(t);return e.asOneAndZeros().getAbs().isSimilar(Ve().getAbs())&&(n=n.getAbs()),n}(this.#ko,t)}getViewOrientation(){return this.#Go}getTargetOrientation(){return this.#zo}getOffset3DFromPlaneOffset(e){const t=new p(e.x,e.y,0),n=this.getTargetDeOrientedVector3D(t);return new p(n.getX()*this.#B.get(0),n.getY()*this.#B.get(1),n.getZ()*this.#B.get(2))}getPlaneOffsetFromOffset3D(e){const t=new p(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.#zo&&(t=this.#zo.getInverse().multiplyVector3D(e)),t}getTargetDeOrientedVector3D(e){let t=e;return void 0!==this.#zo&&(t=this.#zo.multiplyVector3D(e)),t}getTargetDeOrientedPoint3D(e){let t=e;return void 0!==this.#zo&&(t=this.#zo.multiplyPoint3D(e)),t}getImageOrientedVector3D(e){let t=e;if(void 0!==this.#Go){const n=mt([e.getX(),e.getY(),e.getZ()],this.#Go);t=new p(n[0],n[1],n[2])}return t}getImageOrientedPoint3D(e){let t=e;if(void 0!==this.#Go){const n=mt([e.getX(),e.getY(),e.getZ()],this.#Go);t=new f(n[0],n[1],n[2])}return t}getImageDeOrientedVector3D(e){let t=e;if(void 0!==this.#Go){const n=pt([e.getX(),e.getY(),e.getZ()],this.#Go);t=new p(n[0],n[1],n[2])}return t}getImageDeOrientedPoint3D(e){let t=e;if(void 0!==this.#Go){const n=pt([e.getX(),e.getY(),e.getZ()],this.#Go);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.#Bo.pointToWorld(i)}getPlanePointFromPosition(e){const t=this.#Bo.worldToPoint(e);return this.getImageDeOrientedPoint3D(t)}getCosines(){return[(e=this.#zo).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 m(0,0),i.getZ()),r=this.#Bo.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.#Bo.worldToIndex(e)}indexToWorld(e){return this.#Bo.indexToWorld(e)}isAquisitionOrientation(){return Qe(this.#Go)}getTargetOrientedPositiveXYZ(e){const t=pt([e.x,e.y,e.z],this.#zo);return{x:t[0],y:t[1],z:t[2]}}getScrollDimIndex(){let e;return e=void 0!==this.#Go?this.#Go.getThirdColMajorDirection():2,e}getNativeScrollDimIndex(){let e;return e=void 0!==this.#ko?this.#ko.getThirdColMajorDirection():2,e}}class pl{#p;constructor(e){this.#p=e}getCurrentPosition(){return this.#p.getCurrentPosition()}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(n=this.#p.setCurrentPosition(e,t)),n}}class ml{#Ho;#te;#xo;#Yo;constructor(e){this.#Ho=new pl(e),this.#te=e.getImage().getGeometry(),this.#xo=e.getCurrentPosition(),this.#Yo=e.getScrollDimIndex()}getGeometry(){return this.#te}getScrollDimIndex(){return this.#Yo}getMaximumDimValue(e){return this.#te.getSize().get(e)-1}getMaximumScrollValue(){return this.getMaximumDimValue(this.#Yo)}getCurrentPosition(){return this.#te.getSize().normalisePoint(this.#Ho.getCurrentPosition(),this.#xo)}getCurrentPositionDimValue(e){return this.getCurrentIndex().get(e)}getCurrentPositionScrollValue(){return this.getCurrentPositionDimValue(this.#Yo)}getCurrentPositionAtDimValue(e,t){const n=this.getCurrentIndex().getValues();return n[e]=t,this.#te.indexToWorld(new a(n))}getCurrentPositionAtScrollValue(e){return this.getCurrentPositionAtDimValue(this.#Yo,e)}getCurrentIndex(){return this.#te.worldToIndex(this.getCurrentPosition())}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(this.#xo=this.#te.getSize().normalisePoint(e,this.#xo),n=this.#Ho.setCurrentPosition(e,t)),n}setCurrentPositionSafe(e,t){let n=!1;return this.isPositionInBounds(e)&&(n=this.setCurrentPosition(e,t)),n}merge(e){if(this.#Yo!==e.getScrollDimIndex())throw new Error("Cannot merge helper of a view with different orientation");this.#te=function(e,t){const n=e.getOrientation();if(!n.isSimilarProgressive(t.getOrientation(),dt))throw new Error("Cannot merge geometries with different orientation");const i=n.getInverse(),o=function(e,t){return A(e,t,Math.min)},r=function(e,t){return A(e,t,Math.max)},a=new Xe(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 ut(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 St(p,S,a,n)}(this.#te,e.getGeometry()),this.#xo=this.#te.getSize().normalisePoint(this.#xo,e.getCurrentPosition())}isPositionInBounds(e){const t=this.#te.worldToIndex(e),n=[this.#Yo];return 4===t.length()&&n.push(3),this.#te.isIndexInBounds(t,n)}getIncrementPosition(e){const t=this.getCurrentIndex().next(e);return this.#te.indexToWorld(t)}getDecrementPosition(e){const t=this.getCurrentIndex().previous(e);return this.#te.indexToWorld(t)}incrementPosition(e){return this.setCurrentPositionSafe(this.getIncrementPosition(e))}decrementPosition(e){return this.setCurrentPositionSafe(this.getDecrementPosition(e))}incrementPositionAlongScroll(){return this.incrementPosition(this.#Yo)}decrementPositionAlongScroll(){return this.decrementPosition(this.#Yo)}}class fl{#p;#Xo;#Wo;constructor(e){if(void 0===e.getImage())throw new Error("View does not have an image, cannot setup controller");this.#p=e,this.#Xo=new Sl(e.getImage().getGeometry(),e.getOrientation())}getPlaneHelper(){return this.#Xo}updatePlaneHelper(){this.#Xo=new Sl(this.#p.getImage().getGeometry(),this.#p.getOrientation())}isMask(){return this.#p.isMask()}initialise(){this.resetWindowLevel(),this.resetPosition()}resetWindowLevel(){this.setWindowLevelPresetById(0)}resetPosition(){this.setCurrentPosition(this.getPositionFromPlanePoint(new m(0,0)))}getModality(){return this.#p.getImage().getMeta().Modality}getSopClassUid(){return this.#p.getImage().getMeta().SOPClassUID}getWindowLevelPresetsNames(){return this.#p.getWindowPresetsNames()}addWindowLevelPresets(e){return this.#p.addWindowPresets(e)}setWindowLevelPreset(e){this.#p.setWindowLevelPreset(e)}setWindowLevelPresetById(e){this.#p.setWindowLevelPresetById(e)}isPlaying(){return void 0!==this.#Wo}getPositionHelper(){return new ml(this.#p)}getCurrentPosition(){return this.#p.getCurrentPosition()}getCurrentIndex(){return this.#p.getCurrentIndex()}getCurrentImageUid(){return this.#p.getCurrentImageUid()}getOriginForImageUid(e){return this.#p.getOriginForImageUid(e)}includesImageUid(e){return this.#p.includesImageUid(e)}getCurrentOrientedIndex(){let e=this.getCurrentIndex();if(void 0!==this.#p.getOrientation()){const t=this.#Xo.getImageDeOrientedVector3D(new p(e.get(0),e.get(1),e.get(2)));e=new a([t.getX(),t.getY(),t.getZ()])}return e}getScrollDimIndex(){return this.#p.getScrollDimIndex()}getCurrentIndexScrollValue(){return this.getCurrentIndex().get(this.#p.getScrollDimIndex())}getOrigin(e){return this.#p.getOrigin(e)}isAquisitionOrientation(){return this.#p.isAquisitionOrientation()}getPlanePoints(e){return this.#Xo.getPlanePoints(e)}getCurrentScrollPosition(){const e=this.#p.getScrollDimIndex();return this.#p.getCurrentPosition().get(e)}generateImageData(e,t){this.#p.generateImageData(e,t)}setImage(e){const t=this.#p.getImage().getGeometry(),n=e.getGeometry();this.#p.setImage(e),t.equals(n)||this.updatePlaneHelper()}get2DSpacing(){return this.#p.getImage().getGeometry().getSpacing(this.#p.getOrientation()).get2D()}getRescaledImageValue(e){const t=this.#p.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.#p.getImage().getMeta().pixelUnit}getLengthUnit(){return this.#p.getImage().getMeta().lengthUnit}#$o(e,t,n,i){const o=ro(ao(e,t,n,i)),r=e.getGeometry().getSize(i).getValues();r[2]=1;const a=new ut(r),s=e.getGeometry().getSpacing(i).getValues();s[2]=1;const l=new Xe(s),c=new f(0,0,0),u=new St([c],a,l);return new Ot(u,o)}getImageRegionValues(e,t,n){let i=this.#p.getImage();const o=this.#p.getOrientation();let r=n,s=!0;Qe(o)||(i=this.#$o(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 m(0,0)),void 0===o&&(o=new m(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=ro(l)),c}getImageVariableRegionValues(e,t){let n=this.#p.getImage();const i=this.#p.getOrientation();let o=t,r=!0;Qe(i)||(n=this.#$o(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=ro(s)),l}canQuantifyImage(){return this.#p.getImage().canQuantify()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return this.#p.getImage().isMonochrome()}canScroll(){return this.#p.getImage().canScroll(this.#p.getOrientation())}getImageSize(){return this.#p.getImage().getGeometry().getSize(this.#p.getOrientation())}getImageSpacing(){return this.#p.getImage().getGeometry().getSpacing(this.#p.getOrientation())}moreThanOne(e){return this.getImageSize().moreThanOne(e)}getImageWorldSize(){const e=this.#p.getImage().getGeometry(),t=e.getSize(this.#p.getOrientation()).get2D(),n=e.getSpacing(this.#p.getOrientation()).get2D();return{x:t.x*n.x,y:t.y*n.y}}getImageRescaledDataRange(){return this.#p.getImage().getRescaledDataRange()}equalImageMeta(e){const t=this.#p.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.#p.isPositionInBounds(e)}setCurrentPosition(e,t){return this.#p.setCurrentPosition(e,t)}getPositionFromPlanePoint(e,t){void 0===t&&(t=this.getCurrentIndexScrollValue());const n=new f(e.getX(),e.getY(),t),i=this.#Xo.getImageOrientedPoint3D(n),o=this.#p.getImage().getGeometry().pointToWorld(i);return this.getCurrentPosition().mergeWith3D(o)}validatePlanePoint(e){const t=this.getPositionFromPlanePoint(e);return this.#p.getImage().getGeometry().isInBounds(t)}getPlanePositionFromPosition(e){const t=this.#p.getImage().getGeometry().worldToPoint(e),n=this.#Xo.getImageDeOrientedPoint3D(t);return new m(n.getX(),n.getY())}getIndexFromPosition(e){return this.#p.getImage().getGeometry().worldToIndex(e)}setCurrentIndex(e,t){return this.#p.setCurrentIndex(e,t)}getPlanePositionFromPlanePoint(e){const t=this.getCurrentIndexScrollValue(),n=new f(e.getX(),e.getY(),t),i=this.#Xo.getTargetDeOrientedPoint3D(n),o=this.#p.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.#Xo.getOffset3DFromPlaneOffset(e)}play(){if(this.canScroll())if(void 0===this.#Wo){const e=this.#p.getImage(),t=e.getMeta().RecommendedDisplayFrameRate,n=this.#p.getPlaybackMilliseconds(t),i=e.getGeometry().getSize().canScroll3D(),o=this.getPositionHelper();this.#Wo=window.setInterval(()=>{let e;if(e=i?o.incrementPositionAlongScroll():o.incrementPosition(3),!e){const e=this.getCurrentIndex().getValues(),t=this.#p.getOrientation();i?e[t.getThirdColMajorDirection()]=0:e[3]=0;const n=new a(e),o=this.#p.getImage().getGeometry();this.setCurrentPosition(o.indexToWorld(n))}},n)}else this.stop()}stop(){void 0!==this.#Wo&&(clearInterval(this.#Wo),this.#Wo=void 0)}getWindowLevel(){return this.#p.getWindowLevel()}getCurrentWindowPresetName(){return this.#p.getCurrentWindowPresetName()}setWindowLevel(e){this.#p.setWindowLevel(e)}getColourMap(){return this.#p.getColourMap()}setColourMap(e){this.#p.setColourMap(e)}setViewAlphaFunction(e){this.#p.setAlphaFunction(e)}setMaskViewHelper(e){this.#p.setMaskViewHelper(e)}getFillOpacity(){return this.#p.getFillOpacity()}setFillOpacity(e){this.#p.setFillOpacity(e)}getContourThickness(){return this.#p.getContourThickness()}setContourThickness(e){this.#p.setContourThickness(e)}bindImageAndLayer(e){const t=this.#p.getImage();t.addEventListener("imagecontentchange",e.onimagecontentchange),t.addEventListener("imagegeometrychange",e.onimagegeometrychange),t.addEventListener("imageresampled",e.onimageresampled)}unbindImageAndLayer(e){const t=this.#p.getImage();t.removeEventListener("imagecontentchange",e.onimagecontentchange),t.removeEventListener("imagegeometrychange",e.onimagegeometrychange),t.removeEventListener("imageresampled",e.onimageresampled)}}class vl{#jo;#xn=null;#Zo=null;#_o=null;#Ko=null;#Jo=!0;#er;#tr;#nr;#ir=1;#or={x:1,y:1};#rr={x:1,y:1};#ar={x:1,y:1,z:1};#sr={x:1,y:1};#lr=1;#cr={x:1,y:1};#ur={x:0,y:0};#dr={x:0,y:0};#hr={x:0,y:0};#gr={x:0,y:0};#Sr={x:0,y:0};#pr={x:0,y:0};#mr=null;#nn;#fr=new gl;#vr=!1;#Cr;#Dr;constructor(e){this.#jo=e,this.#jo.className+=" viewLayer"}getDataId(){return this.#nn}getScale(){return this.#or}getAbsoluteZoomOffset(){return{x:this.#gr.x*this.#rr.x,y:this.#gr.y*this.#rr.y}}setImageSmoothing(e){this.#vr=e}setView(e,t){this.#nn=t,e.addEventListener("wlchange",this.#yr),e.addEventListener("colourmapchange",this.#Ir),e.addEventListener("positionchange",this.#wr),e.addEventListener("alphafuncchange",this.#Tr),e.addEventListener("maskviewchange",this.#Lr);for(const t of ul)e.addEventListener(t,this.#Pr);this.#xn=new fl(e),this.bindImage()}getViewController(){return this.#xn}getImageData(){return this.#er}onimageset=e=>{const t=e.detail?.dataid,n=e.detail?.value;this.#nn===t&&(this.#xn.setImage(n[0]),this.#Ar(this.#xn.getImageSize().get2D()),this.#mr=!0)};bindImage(){this.#xn&&this.#xn.bindImageAndLayer(this)}unbindImage(){this.#xn&&this.#xn.unbindImageAndLayer(this)}onimagecontentchange=e=>{const t=e.detail?.dataid;void 0!==t&&this.#nn!==t||(this.#Jo=this.#xn.isPositionInBounds(),this.#mr=!0,this.draw())};onimagegeometrychange=e=>{const t=e.detail?.dataid;if(void 0===t||this.#nn===t){const e=this.#xn.getImageSize().get2D(),t=this.#xn.getImageSpacing().get2D(),n=this.#tr.x!==e.x||this.#tr.y!==e.y,i=this.#nr.x!==t.x||this.#nr.y!==t.y;if(i&&(this.#xn.updatePlaneHelper(),this.#Or(t)),n){if(void 0!==this.#Cr&&void 0!==this.#Dr){const e=this.#xn.getOrigin(),t=this.#Dr.minus(e),n=this.#xn.getOrigin(this.#xn.getCurrentPosition());if(void 0!==n){const e=this.#Cr.minus(n);this.setBaseOffset(t,e)}}this.#Ar(e)}(i||n)&&(this.#mr=!0,this.draw())}};onimageresampled=e=>{const t=this.#xn.getCurrentIndex().get(3),n=void 0===t||t===e.detail?.frame,i=e.detail?.dataid;void 0!==i&&this.#nn!==i||!n||(this.#mr=!0,this.draw())};getId(){return this.#jo.id}removeFromDOM(){this.#jo.remove()}getBaseSize(){return this.#tr}getImageWorldSize(){return this.#xn.getImageWorldSize()}getOpacity(){return this.#ir}setOpacity(e){e!==this.#ir&&(this.#ir=Math.min(Math.max(e,0),1),this.#Pr(new CustomEvent("opacitychange",{detail:{value:[this.#ir]}})))}getFillOpacity(){return this.#xn.getFillOpacity()}setFillOpacity(e){this.#xn.setFillOpacity(e)}getContourThickness(){return this.#xn.getContourThickness()}setContourThickness(e){this.#xn.setContourThickness(e)}addFlipOffsetX(){this.#pr.x+=this.#Zo.width/this.#or.x,this.#ur.x+=this.#pr.x}addFlipOffsetY(){this.#pr.y+=this.#Zo.height/this.#or.y,this.#ur.y+=this.#pr.y}flipScaleX(){this.#ar.x*=-1}flipScaleY(){this.#ar.y*=-1}flipScaleZ(){this.#ar.z*=-1}setScale(e,t){const n=this.#xn.getPlaneHelper(),i=n.getTargetOrientedPositiveXYZ({x:e.x*this.#ar.x,y:e.y*this.#ar.y,z:e.z*this.#ar.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.#ur.x-this.#gr.x,y:this.#ur.y-this.#gr.y};this.#gr={x:0,y:0},this.#ur=e}else if(void 0!==t){let e=n.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#dr.x,y:e.y+this.#dr.y};const i=bl(this.#ur,this.#or,o,e),r={x:this.#gr.x+i.x-this.#ur.x,y:this.#gr.y+i.y-this.#ur.y};this.#gr=r,this.#ur=i}this.#or=o}initScale(e,t){const n=this.#xn.getPlaneHelper().getTargetOrientedPositiveXYZ({x:e.x*this.#ar.x,y:e.y*this.#ar.y,z:e.z*this.#ar.z}),i={x:this.#rr.x*n.x,y:this.#rr.y*n.y};this.#or=i,this.#gr={x:t.x/this.#rr.x,y:t.y/this.#rr.y},this.#ur={x:this.#ur.x+this.#gr.x,y:this.#ur.y+this.#gr.y}}setBaseOffset(e,t,n,i){const o=this.#xn.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.#dr.x!==a.x||this.#dr.y!==a.y;return void 0!==n&&void 0!==i&&(this.#Cr=n,this.#Dr=i),s&&(this.#ur={x:this.#ur.x-this.#dr.x+a.x,y:this.#ur.y-this.#dr.y+a.y},this.#dr=a),s}setOffset(e){const t=this.#xn.getPlaneHelper().getPlaneOffsetFromOffset3D(e);this.#ur={x:this.#ur.x-this.#Sr.x+t.x,y:this.#ur.y-this.#Sr.y+t.y},this.#Sr=t}displayToPlaneIndex(e){const t=this.displayToPlanePos(e);return new a([Math.floor(t.getX()),Math.floor(t.getY())])}displayToPlaneScale(e){return new m(e.getX()/this.#or.x,e.getY()/this.#or.y)}displayToPlanePos(e){const t=this.displayToPlaneScale(e);return new m(t.getX()+this.#ur.x,t.getY()+this.#ur.y)}planePosToDisplay(e){let t=(e.getX()-this.#ur.x+this.#dr.x)*this.#or.x,n=(e.getY()-this.#ur.y+this.#dr.y)*this.#or.y;return(t<0||t>=this.#Zo.width)&&(t=void 0),(n<0||n>=this.#Zo.height)&&(n=void 0),new m(t,n)}displayToMainPlanePos(e){const t=this.displayToPlanePos(e);return new m(t.getX()-this.#dr.x,t.getY()-this.#dr.y)}display(e){this.#jo.style.display=e?"":"none"}isVisible(){return""===this.#jo.style.display}draw(){this.#Jo&&(this.#Pr(new CustomEvent("renderstart",{detail:{layerid:this.getId()}})),this.#mr&&this.#br(),this.#Ko.globalAlpha=this.#ir,this.clear(),this.#Ko.setTransform(this.#or.x,0,0,this.#or.y,-1*this.#ur.x*this.#or.x,-1*this.#ur.y*this.#or.y),this.#Ko.imageSmoothingEnabled=this.#vr,this.#Ko.drawImage(this.#_o,0,0),this.#Pr(new CustomEvent("renderend",{detail:{layerid:this.getId()}})))}initialise(e,t,n){this.#nr=t,this.#ir=Math.min(Math.max(n,0),1),this.#Zo=document.createElement("canvas"),this.#jo.appendChild(this.#Zo),this.#Zo.getContext?(this.#Ko=this.#Zo.getContext("2d"),this.#Ko?(this.#_o=document.createElement("canvas"),this.#Ar(e),this.#mr=!0):alert("Error: failed to get the 2D context.")):alert("Error: no canvas.getContext method.")}#Ar(e){if(!en(e.x,e.y))throw new Error(`Cannot create canvas with size ${e.x}, ${e.y}`);this.#tr=e,this.#_o.width=this.#tr.x,this.#_o.height=this.#tr.y,this.#Ko.clearRect(0,0,this.#tr.x,this.#tr.y),this.#er=this.#Ko.createImageData(this.#tr.x,this.#tr.y)}#Or(e){this.#nr=e,this.fitToContainer(this.#sr,this.#lr,this.#cr)}fitToContainer(e,t,n){let i=!1;const o={x:t*this.#nr.x,y:t*this.#nr.y},r=o.x/this.#rr.x,a=o.y/this.#rr.y,s=e.x/(this.#Zo.width*r),l=e.y/(this.#Zo.height*a);if(this.#Zo.width!==e.x||this.#Zo.height!==e.y){if(!en(e.x,e.y))throw new Error(`Cannot resize canvas ${e.x}, ${e.y}`);this.#Zo.width=e.x,this.#Zo.height=e.y,i=!0}const c={x:this.#or.x*r,y:this.#or.y*a};this.#or.x===c.x&&this.#or.y===c.y||(this.#rr=o,this.#or=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.#pr.x?d.x:0,y:0!==this.#pr.y?d.y:0};if(this.#hr.x!==u.x||this.#hr.y!==u.y||this.#pr.x!==h.x||this.#pr.y!==h.y){const e={x:this.#gr.x*s,y:this.#gr.y*l};this.#ur={x:this.#ur.x+u.x-this.#hr.x+h.x-this.#pr.x+e.x-this.#gr.x,y:this.#ur.y+u.y-this.#hr.y+h.y-this.#pr.y+e.y-this.#gr.y},this.#pr=h,this.#hr=u,this.#gr=e,i=!0}this.#sr=e,this.#lr=t,this.#cr=n,i&&this.draw()}bindInteraction(){this.#jo.style.pointerEvents="auto";const e=Zt;for(let t=0;t<e.length;++t){const n=e[t],i="wheel"!==n&&"touchstart"!==n;this.#jo.addEventListener(n,this.#xr,{passive:i})}}unbindInteraction(){this.#jo.style.pointerEvents="none";const e=Zt;for(let t=0;t<e.length;++t)this.#jo.removeEventListener(e[t],this.#xr)}addEventListener(e,t){this.#fr.add(e,t)}removeEventListener(e,t){this.#fr.remove(e,t)}#Pr=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#nn});this.#fr.fireEvent(new CustomEvent(e.type,{detail:t}))};#xr=e=>{e.srclayerid=this.getId(),e.dataid=this.#nn,this.#fr.fireEvent(e)};#br(){this.#xn.generateImageData(this.#er),this.#_o.getContext("2d").putImageData(this.#er,0,0),this.#mr=!1}#yr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#mr=!0,this.draw())};#Ir=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#mr=!0,this.draw())};#wr=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.#xn.getScrollDimIndex());t.splice(n,1);const i=e.detail?.diffDims?.filter(function(e){return-1===t.indexOf(e)});0===i.length&&this.#Jo||(this.#Jo=!0,this.#mr=!0,this.draw())}else this.#Jo&&(this.#Jo=!1,this.clear())}};isValidPosition(){return this.#Jo}#Tr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#mr=!0,this.draw())};#Lr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#mr=!0,this.draw())};setCurrentPosition(e,t){return this.#xn.setCurrentPosition(e)}clear(){this.#Ko.save(),this.#Ko.setTransform(1,0,0,1,0,0),this.#Ko.clearRect(0,0,this.#Zo.width,this.#Zo.height),this.#Ko.restore()}}class Cl extends Ma{#Er;#Rr;constructor(e,t){super(),this.#Er=e,this.#Rr=t}getName(){return`AddAnnotation-${this.#Er.trackingUid}`}execute(){this.#Rr.addAnnotation(this.#Er)}undo(){this.#Rr.removeAnnotation(this.#Er.trackingUid)}}class Dl extends Ma{#Er;#Rr;constructor(e,t){super(),this.#Er=e,this.#Rr=t}getName(){return`RemoveAnnotation-${this.#Er.trackingUid}`}execute(){this.#Rr.removeAnnotation(this.#Er.trackingUid)}undo(){this.#Rr.addAnnotation(this.#Er)}}class yl extends Ma{#Er;#Rr;#Fr;#Mr;constructor(e,t,n,i){super(),this.#Er=e,this.#Rr=i,this.#Fr=t,this.#Mr=n}getName(){return`UpdateAnnotation-${this.#Er.trackingUid}`}execute(){const e=Object.keys(this.#Mr);for(const t of e)this.#Er[t]=this.#Mr[t];this.#Rr.updateAnnotation(this.#Er,e)}undo(){const e=Object.keys(this.#Fr);for(const t of e)this.#Er[t]=this.#Fr[t];this.#Rr.updateAnnotation(this.#Er,e)}}class Il{#qr;getAnnotation(e){return this.#qr.find(e)}getAnnotationGroup(){return this.#qr}isAnnotationGroupEditable(){return this.#qr.isEditable()}setAnnotationGroupEditable(e){this.#qr.setEditable(e)}addAnnotation(e){this.#qr.add(e)}updateAnnotation(e,t,n){this.#qr.update(e,t,n)}removeAnnotation(e){this.#qr.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 Dl(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 yl(o,t,n,this);i(r),r.execute()}removeAllAnnotationsWithCommand(e){for(const t of[...this.#qr.getList()])this.removeAnnotationWithCommand(t.trackingUid,e)}constructor(e){this.#qr=void 0!==e?e:new xt}hasAnnotationMeta(e){return this.#qr.hasMeta(e)}setAnnotationMeta(e,t){this.#qr.setMetaValue(e,t)}}class wl{#jo;#Ur=null;#tr;#nr;#rr={x:1,y:1};#ar={x:1,y:1,z:1};#dr={x:0,y:0};#hr={x:0,y:0};#gr={x:0,y:0};#Sr={x:0,y:0};#pr={x:0,y:0};#Rr;#Xo;#nn;#Qr;#Vr;#Nr;#Br=!0;constructor(e){this.#jo=e,this.#jo.className+=" drawLayer"}setShapeHandler(e){this.#Nr=e}getDataId(){return this.#nn}getReferenceLayerId(){return this.#Qr}#fr=new gl;getKonvaStage(){return this.#Ur}getKonvaLayer(){return this.#Ur.getLayers()[0]}getDrawController(){return this.#Rr}setPlaneHelper(e){this.#Xo=e}getId(){return this.#jo.id}removeFromDOM(){this.#jo.remove()}getBaseSize(){return this.#tr}getOpacity(){return this.#Ur.opacity()}setOpacity(e){this.#Ur.opacity(Math.min(Math.max(e,0),1))}addFlipOffsetX(){const e=this.#Ur.scale(),t=this.#Ur.size();this.#pr.x+=t.width/e.x;const n=this.#Ur.offset();n.x+=this.#pr.x,this.#Ur.offset(n)}addFlipOffsetY(){const e=this.#Ur.scale(),t=this.#Ur.size();this.#pr.y+=t.height/e.y;const n=this.#Ur.offset();n.y+=this.#pr.y,this.#Ur.offset(n)}flipScaleX(){this.#ar.x*=-1}flipScaleY(){this.#ar.y*=-1}flipScaleZ(){this.#ar.z*=-1}setScale(e,t){const n=this.#Xo.getTargetOrientedPositiveXYZ({x:e.x*this.#ar.x,y:e.y*this.#ar.y,z:e.z*this.#ar.z}),i={x:this.#rr.x*n.x,y:this.#rr.y*n.y},o=this.#Ur.offset();if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:o.x-this.#gr.x,y:o.y-this.#gr.y};this.#gr={x:0,y:0},this.#Ur.offset(e)}else if(void 0!==t){let e=this.#Xo.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#dr.x,y:e.y+this.#dr.y};const n=bl(o,this.#Ur.scale(),i,e),r={x:this.#gr.x+n.x-o.x,y:this.#gr.y+n.y-o.y};this.#gr=r,this.#Ur.offset(n)}this.#Ur.scale(i),this.#kr(i)}initScale(e,t){const n=this.#Xo.getTargetOrientedPositiveXYZ({x:e.x*this.#ar.x,y:e.y*this.#ar.y,z:e.z*this.#ar.z}),i={x:this.#rr.x*n.x,y:this.#rr.y*n.y};this.#Ur.scale(i),this.#gr={x:t.x/this.#rr.x,y:t.y/this.#rr.y};const o=this.#Ur.offset();this.#Ur.offset({x:o.x+this.#gr.x,y:o.y+this.#gr.y})}setOffset(e){const t=this.#Xo.getPlaneOffsetFromOffset3D(e),n=this.#Ur.offset();this.#Ur.offset({x:n.x-this.#Sr.x+t.x,y:n.y-this.#Sr.y+t.y}),this.#Sr=t}setBaseOffset(e,t){const n=this.#Xo.getNativeScrollDimIndex(),i=this.#Xo.getPlaneOffsetFromOffset3D({x:0===n?e.getX():t.getX(),y:1===n?e.getY():t.getY(),z:2===n?e.getZ():t.getZ()}),o=this.#dr.x!==i.x||this.#dr.y!==i.y;if(o){const e=this.#Ur.offset();this.#Ur.offset({x:e.x-this.#dr.x+i.x,y:e.y-this.#dr.y+i.y}),this.#dr=i}return o}display(e){this.#jo.style.display=e?"":"none"}isVisible(){return""===this.#jo.style.display}draw(){this.#Ur.draw()}initialise(t,n,i){this.#tr=t,this.#nr=n,this.#Qr=i,this.#Ur=new e.Stage({container:this.#jo,width:this.#tr.x,height:this.#tr.y,listening:!1}),this.#Ur.getContent().setAttribute("style","");const o=new e.Layer({listening:!1,visible:!0});this.#Ur.add(o)}setAnnotationGroup(e,t,n){if(this.#nn=t,e.addEventListener("annotationadd",e=>{this.#Gr(e.detail.data,!0),this.getKonvaLayer().draw()}),e.addEventListener("annotationupdate",e=>{this.#zr(e.detail.data),this.getKonvaLayer().draw()}),e.addEventListener("annotationremove",e=>{this.#Hr(e.detail.data),this.getKonvaLayer().draw()}),e.addEventListener("annotationgroupeditablechange",e=>{this.activateCurrentPositionShapes(e.detail.data)}),this.#Rr=new Il(e),0!==e.getLength())for(const t of e.getList())this.#Gr(t,!1),n(new Cl(t,this.getDrawController()))}activateCurrentPositionShapes(t){const n=this.getKonvaLayer();if(this.#Ur.listening(!1),void 0!==this.#Nr){this.#Nr.disableAndResetEditor();const t=n.getChildren();for(const n of t)n instanceof e.Group&&n.getChildren().forEach(t=>{t instanceof e.Group&&this.#Nr.removeShapeListeners(t)})}const i=this.getDrawController();if(t&&i.getAnnotationGroup().isEditable()){this.#Ur.listening(!0);const t=this.#Yr().getChildren();0!==t.length&&n.listening(!0),void 0!==this.#Nr&&t.forEach(t=>{if(t instanceof e.Group){const e=i.getAnnotation(t.id());this.#Nr.addShapeGroupListeners(t,e,this)}})}n.draw()}#Xr(e){let t,n;return void 0!==e.planePoints?t=e.planePoints:void 0!==e.planeOrigin&&(t=[e.planeOrigin]),void 0!==t&&(n=this.#Wr(t,e.referencedFrameNumber)),n}#Wr(e,t){let n="";for(const t of e)0!==n.length&&(n+="-"),n+=P([S(t.getX(),2),S(t.getY(),2),S(t.getZ(),2)]);return void 0!==t&&(n+=`-${t}`),n}#$r(t){let n;const i=this.#Xr(t),o=this.getKonvaLayer().getChildren(ha(i));if(0!==o.length){const i=o[0];if(!(i instanceof e.Group))return;const r=i.getChildren(ha(t.trackingUid));0!==r.length&&r[0]instanceof e.Group&&(n=r[0])}return n}#Gr(t,n){if(!t.canView()||!t.isCompatibleView(this.#Xo))return;const i=this.#Xr(t);let o=this.getKonvaLayer().getChildren(ha(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 zt,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.#Nr&&this.#Nr.addShapeGroupListeners(l,t,this),this.setLabelVisibility(l)}#Hr(t){const n=this.#$r(t);return n instanceof e.Group?(n.remove(),!0):(s.debug("No shape group to remove"),!1)}#zr(e){this.#Hr(e)&&this.#Gr(e,!0)}fitToContainer(e,t,n){const i={x:t*this.#nr.x,y:t*this.#nr.y},o=i.x/this.#rr.x,r=i.y/this.#rr.y,a=e.x/(this.#Ur.width()*o),s=e.y/(this.#Ur.height()*r);this.#Ur.width()===e.x&&this.#Ur.height()===e.y||(this.#Ur.width(e.x),this.#Ur.height(e.y));const l={x:this.#Ur.scale().x*o,y:this.#Ur.scale().y*r};this.#Ur.scale().x===l.x&&this.#Ur.scale().y===l.y||(this.#rr=i,this.#Ur.scale(l),this.#kr(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.#pr.x?u.x:0,y:0!==this.#pr.y?u.y:0};if(this.#hr.x!==c.x||this.#hr.y!==c.y||this.#pr.x!==d.x||this.#pr.y!==d.y){const e={x:this.#gr.x*a,y:this.#gr.y*s};this.#Ur.offset({x:this.#Ur.offset().x+c.x-this.#hr.x+d.x-this.#pr.x+e.x-this.#gr.x,y:this.#Ur.offset().y+c.y-this.#hr.y+d.y-this.#pr.y+e.y-this.#gr.y}),this.#pr=d,this.#hr=c,this.#gr=e}}isAnnotationVisible(e){const t=this.#jr(e);return void 0!==t&&t.isVisible()}setAnnotationVisibility(e,t){const n=this.#jr(e);return void 0!==n&&(void 0===t&&(t=!n.isVisible()),n.visible(t),this.draw(),!0)}setLabelsVisibility(t){this.#Br=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.#Zr(i,t)}}#Zr(t,n){const i=t.getChildren(la)[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.#Zr(e,this.#Br)}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.#Ur.listening(!0),this.#jo.style.pointerEvents="auto";const e=Zt;for(let t=0;t<e.length;++t)this.#jo.addEventListener(e[t],this.#xr)}unbindInteraction(){this.#Ur.listening(!1),this.#jo.style.pointerEvents="none";const e=Zt;for(let t=0;t<e.length;++t)this.#jo.removeEventListener(e[t],this.#xr)}setCurrentPosition(e,t){void 0===t&&(t=this.#Xo.worldToIndex(e));const n=this.#Xo.getPlanePoints(e);let i,o;i=this.#Xo.isAquisitionOrientation()?[n[0]]:n,e.length()>3&&(o=e.get(3));const r=this.#Wr(i,o);return this.#_r(r),this.#Pr(new CustomEvent("positionchange",{detail:{value:[t.getValues(),e.getValues()],valid:!0}})),!0}#_r(e){this.#Vr=e;const t=this.getKonvaLayer().getChildren(ua);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()}#Yr(){if(void 0===this.#Vr)return;const t=this.getKonvaLayer().getChildren(e=>e.id()===this.#Vr);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.#Vr),n.visible(!0),this.getKonvaLayer().add(n)):s.warn("Unexpected number of draw position groups"),n}#jr(e){return this.getKonvaLayer().findOne(`#${e}`)}addEventListener(e,t){this.#fr.add(e,t)}removeEventListener(e,t){this.#fr.remove(e,t)}#Pr=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#nn});this.#fr.fireEvent(new CustomEvent(e.type,{detail:t}))};#xr=e=>{e.srclayerid=this.getId(),e.dataid=this.#nn,this.#fr.fireEvent(e)};#kr(e){const t=2/e.x,n=2/e.y,i=this.#Ur.find("Label");for(let e=0;e<i.length;++e)i[e].scale({x:t,y:n})}}function Tl(e){return`info-${e}`}function Ll(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,""),`${Tl(e.pos)}-${t}-${n}`}class Pl{#Kr=!1;#jo;constructor(e){this.#jo=e}onDataChange=e=>{const t=e.detail?.data;if(void 0!==t){if(void 0!==e.detail?.srclayerid){const t=Al(e.detail.srclayerid),i={groupDivId:(n=this.#jo.id).substring(0,n.length-10)};if(t.groupDivId!==i.groupDivId)return}var n;this.#Kr||this.#Jr(t),this.#ea(t)}};#Jr(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=Ll(i),void 0!==i.tags&&e.appendChild(document.createTextNode(i.value)),t.appendChild(e)}const i=document.createElement("div");i.id=Tl(n),i.className=`info-${n} info`,i.appendChild(t),this.#jo.appendChild(i)}this.#Kr=!0}#ea(e){for(const t of e){const e=`#${Ll(t)}`,n=this.#jo.querySelector(e),i=t.value;i&&n&&n.replaceChildren(document.createTextNode(i))}}}function Al(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 Ol(e){let t=null;const n=e.target.closest(".layer");return n&&void 0!==n.id&&(t=Al(n.id)),t}function bl(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 xl extends EventTarget{#jo;#ta=[];#or={x:1,y:1,z:1};#Fe={x:1,y:1,z:1};#ur={x:0,y:0,z:0};#na=void 0;#ia=!1;#oa=[];#ra;#vr=!1;#aa;#sa;#la=[];#ca;getPositionHelper(){if(void 0===this.#aa)for(const e of this.#ta)if(e instanceof vl){const t=e.getViewController().getPositionHelper();void 0===this.#aa?this.#aa=t:this.#aa.merge(t)}return this.#aa}constructor(e,t){if(super(),this.#jo=e,void 0!==t&&!0===t){const t=document.createElement("div");t.id=`${e.id}-infolayer`,t.className="infoLayer",e.appendChild(t),this.#sa=new Pl(t)}}getShowCrosshair(){return this.#ia}setShowCrosshair(e){this.#ia=e,e?(this.addEventListener("offsetchange",this.#ua),this.addEventListener("zoomchange",this.#ua),this.#da()):(this.removeEventListener("offsetchange",this.#ua),this.removeEventListener("zoomchange",this.#ua),this.#ha())}setImageSmoothing(e){this.#vr=e;for(const t of this.#ta)t instanceof vl&&t.setImageSmoothing(e)}#ua=e=>{this.#da()};getDivId(){let e;return null!==this.#jo&&(e=this.#jo.id),e}getScale(){return this.#or}getBaseScale(){return this.#Fe}getAddedScale(){return{x:this.#or.x/this.#Fe.x,y:this.#or.y/this.#Fe.y,z:this.#or.z/this.#Fe.z}}getOffset(){return this.#ur}getNumberOfLayers(){let e=0;return this.#ta.forEach(t=>{void 0!==t&&e++}),e}includes(e){if(void 0===e)return!1;for(const t of this.#ta)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.#ta)n instanceof vl&&e(n)&&t.push(n);return t}getViewLayersFromActive(e){void 0===e&&(e=function(){return!0});let t=0;void 0!==this.#na&&(t=this.#na);const n=[];for(let e=t;e>=0;e--)n.push(e);for(let e=this.#ta.length-1;e>t;e--)n.push(e);const i=[];for(const t of n){const n=this.#ta[t];n instanceof vl&&e(n)&&i.push(n)}return i}someViewLayer(e){let t=!1;for(const n of this.#ta)if(n instanceof vl&&e(n)){t=!0;break}return t}getDrawLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#ta)n instanceof wl&&e(n)&&t.push(n);return t}getNumberOfViewLayers(){let e=0;return this.#ta.forEach(t=>{void 0!==t&&t instanceof vl&&e++}),e}getActiveLayer(){let e;return void 0!==this.#na&&(e=this.#ta[this.#na]),e}getActiveViewLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof vl&&(e=t),e}getBaseViewLayer(){let e;for(const t of this.#ta)if(t instanceof vl){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.#ta)if(e instanceof vl){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.#ta)t instanceof vl&&e.push(t.getDataId());return e}getActiveDrawLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof wl&&(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.#na=e;const t=this.#ta[e];if(void 0!==this.#sa){this.unbindInfoData();const e=t.getDataId();this.bindInfoData(e)}this.dispatchEvent(new CustomEvent("activelayerchange",{detail:{value:[this.#ta[e]]}}))}setActiveLayerById(e){let t;for(let n=0;n<this.#ta.length;++n)if(void 0!==this.#ta[n]&&this.#ta[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.#ta.length;++n)if(void 0!==this.#ta[n]&&this.#ta[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.#ta.length,t=this.#ga();this.#jo.append(t);const n=new vl(t);return n.setImageSmoothing(this.#vr),this.#ta.push(n),this.setActiveLayer(e),this.#Sa(n),this.#aa=void 0,n}addDrawLayer(){this.#na=this.#ta.length;const e=this.#ga();this.#jo.append(e);const t=new wl(e);return this.#ta.push(t),this.#pa(t),t}#Sa(e){e.addEventListener("positionchange",this.updateLayersToPositionChange);for(const t of ul)e.addEventListener(t,this.#Pr);e.addEventListener("renderstart",this.#Pr),e.addEventListener("renderend",this.#Pr)}#ma(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange);for(const t of ul)e.removeEventListener(t,this.#Pr);e.removeEventListener("renderstart",this.#Pr),e.removeEventListener("renderend",this.#Pr),e.unbindImage()}#pa(e){e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#Pr)}#fa(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#Pr)}addInfoData(e,t){this.#la[t]=e}bindInfoData(e){if(void 0!==this.#ca)return;const t=this.#la[e];void 0!==t&&t.addEventListener("valuechange",this.#sa.onDataChange),this.#ca=e}unbindInfoData(){const e=this.#la[this.#ca];void 0!==e&&e.removeEventListener("valuechange",this.#sa.onDataChange),this.#ca=void 0}#ga(){const e=document.createElement("div");return e.id=`${this.getDivId()}-layer-${this.#ta.length}`,e.className="layer",e.style.pointerEvents="none",e}empty(){for(const e of this.#ta)void 0!==e&&this.removeLayer(e);this.#ta=[],this.#ha()}removeLayersByDataId(e){for(const t of this.#ta)void 0!==t&&t.getDataId()===e&&this.removeLayer(t)}removeLayer(e){const t=this.#ta.findIndex(t=>t===e);if(-1===t)throw new Error("Cannot find layer to remove");this.#na===t&&(this.#na=void 0),e instanceof vl?this.#ma(e):this.#fa(e),this.#ta[t]=void 0,this.#aa=void 0,e.removeFromDOM(),this.dispatchEvent(new CustomEvent("layerremove",{detail:{layerid:e.getId(),layergroupid:this.getDivId()}}))}#da(){let e;this.#ha();for(const t of this.#ta)if(t instanceof vl){e=t;break}if(void 0===e)return void s.warn("No layer to show crosshair");if(this.#va(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.#jo.offsetWidth}px`,e.style.left="0px",e.style.top=`${o.getY()}px`,this.#oa.push(e),this.#jo.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.#jo.offsetHeight}px`,e.style.left=`${o.getX()}px`,e.style.top="0px",this.#oa.push(e),this.#jo.appendChild(e)}}#ha(){for(const e of this.#oa)e.remove();this.#oa=[]}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=S(r,3).toString();void 0!==n.getPixelUnit()&&(i+=` ${n.getPixelUnit()}`),t.appendChild(document.createTextNode(i)),this.#ra=t,this.#jo.appendChild(t)}}removeTooltipDiv(){void 0!==this.#ra&&(this.#ra.remove(),this.#ra=void 0)}isPositionInBounds(e){return this.someViewLayer(function(t){return t.getViewController().isPositionInBounds(e)})}canScroll(){return this.someViewLayer(function(e){return e.getViewController().canScroll()})}#va(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.#va(e)}moreThanOne(e){return this.someViewLayer(function(t){return t.getViewController().moreThanOne(e)})}hasAnyLayerWithValidPosition(){return this.someViewLayer(function(e){return e.isValidPosition()})}#Ca=e=>{const t=e.detail?.dataid,n=this.#la[t];void 0!==n&&n.onSliceChange(e)};updateLayersToPositionChange=e=>{for(const e of this.#ta)void 0!==e&&(e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#Pr),e.addEventListener("positionchange",this.#Ca));const t=e.detail?.value,n=new a(t[0]),i=new D(t[1]),o={};let r,s;for(const t of this.#ta){if(void 0===t)continue;let a=!1;if(t instanceof vl){const e=t.getViewController(),n=e.getOrigin(),l=e.getOrigin(i);let c,u;if(void 0===s)r=n,s=l,c=new p(0,0,0),u=new p(0,0,0);else if(e.isPositionInBounds(i)&&void 0!==l){const e=r.minus(n);c=new p(e.getX(),e.getY(),e.getZ());const t=s.minus(l);u=new p(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 wl){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.#ia&&this.#da();for(const e of this.#ta)void 0!==e&&(e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#Pr),e.removeEventListener("positionchange",this.#Ca))};getDivToWorldSizeRatio(){if(0===this.#jo.offsetWidth&&0===this.#jo.offsetHeight)throw new Error(`Cannot fit to zero sized container with id '${this.#jo.id}'.`);const e=this.getMaxWorldSize();if(void 0!==e){if(0===this.#jo.offsetHeight){const t=this.#jo.offsetWidth/e.x,n=e.y*t;this.#jo.style.height=`${n}px`}return Math.min(this.#jo.offsetWidth/e.x,this.#jo.offsetHeight/e.y)}}fitToContainer(e){const t=this.getMaxWorldSize();if(void 0===t)return;const n={x:this.#jo.offsetWidth,y:this.#jo.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.#ta)void 0!==t&&t.fitToContainer(n,e,i);this.#ia&&this.#da()}getMaxWorldSize(){let e={x:0,y:0};for(const t of this.#ta)if(t instanceof vl){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.#Fe.z*=-1,this.setScale(this.#Fe)}addScale(e,t){const n={x:this.#or.x*(1+e),y:this.#or.y*(1+e),z:this.#or.z*(1+e)};this.setScale(n,t)}setScale(e,t){this.#or=e;for(const e of this.#ta)void 0!==e&&e.setScale(this.#or,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.#ur.x-e.x,y:this.#ur.y-e.y,z:this.#ur.z-e.z})}setOffset(e){this.#ur=e;for(const e of this.#ta)void 0!==e&&e.setOffset(this.#ur);this.dispatchEvent(new CustomEvent("offsetchange",{detail:{value:[this.#ur.x,this.#ur.y,this.#ur.z]}}))}reset(){this.setScale(this.#Fe),this.setOffset({x:0,y:0,z:0})}resetZoomPan(){this.setScale(this.#Fe),this.setOffset({x:0,y:0,z:0})}resetViews(){let e=!0;for(const t of this.#ta)if(void 0!==t&&t instanceof vl){const n=t.getViewController();e&&(n.resetPosition(),e=!1),n.resetWindowLevel()}}draw(){for(const e of this.#ta)void 0!==e&&e.draw()}display(e){for(const t of this.#ta)void 0!==t&&t.display(e)}#Pr=e=>{const t=null!==e.detail&&"object"==typeof e.detail?Object.assign({},e.detail):{};this.dispatchEvent(new CustomEvent(e.type,{detail:t}))}}class El{#Da=0;add(e){this.#Da+=function(e){return void 0===e.wheelDeltaY?-e.deltaY:e.wheelDeltaY>45?1:e.wheelDeltaY<-45?-1:-e.deltaY/60}(e)}getSum(){return this.#Da}isTick(){return Math.abs(this.#Da)>=1}clear(){this.#Da=0}}class Rl extends EventTarget{#ya;#Ia;#wa;#Ta;#La=new El;#Pa;#Aa;#Oa;#ba;#xa;#Ea=!1;#Ra;constructor({stageController:e,dragBehavior:t,hoverBehavior:n,wheelBehavior:i,doubleClickBehavior:o,twoTouchBehavior:r,tapBehavior:a,longTouchToDblClickMs:s=500}){super(),this.#ya=e,this.#Ia=t,this.#wa=n,this.#Ta=i,this.#Pa=o,this.#Aa=r,this.#Oa=a,this.#ba=s}#Fa(e){return this.#ya.getLayerGroupByDivId(e)}#Ma(e){const t=Ol(e),n=this.#Fa(t.groupDivId);return{point:Jt(e),layerGroup:n}}#qa(e){return void 0===this.#Ra||this.#Ra.getDistance(e)>5}#Ua(e){const t=Ol(e),n=this.#Fa(t.groupDivId);return{point:Kt(e)[0],layerGroup:n}}getEventNames(){return[]}wheel=e=>{if(void 0===this.#Ta)return;e.preventDefault();const t=Ol(e),n=this.#Fa(t.groupDivId);this.#Ta.onWheel(e,n),this.#La.add(e);const i=this.#La.getSum()>=0;this.#La.isTick()&&(this.#La.clear(),this.#Ta.onWheelTick(i,n))};dblclick=e=>{const{point:t,layerGroup:n}=this.#Ma(e);void 0!==this.#Pa?this.#Pa.onDoubleClick(t,n):this.#Oa?.isActive()&&this.#Oa.onEnd()};#Qa(e,t){void 0!==this.#Pa?this.#Pa.onDoubleClick(e,t):this.#Oa?.isActive()&&(this.#Oa.onTap(e,t),this.#Oa.onEnd()),this.#Ea=!1,this.#xa=void 0}cancel(){this.#Ea=!1,this.#Ra=void 0,this.#Va(),this.#Ia?.isActive()&&this.#Ia.reset(),this.#Oa?.isActive()&&this.#Oa.reset(),this.#Aa?.isActive()&&this.#Aa?.reset(),this.#wa?.reset()}mousedown=e=>{this.#Ia?.isActive()&&this.#Ia.reset();const{point:t,layerGroup:n}=this.#Ma(e);this.#Ea=!0,this.#Ra=t,!this.#Oa?.isActive()&&this.#Ia?.canStart(t,n)&&this.#Ia.onStart(t,n,{mouseDownButton:e.button})};mousemove=e=>{const{point:t,layerGroup:n}=this.#Ma(e);this.#Ea?(this.#wa?.onEnd(),this.#Ia?.isActive()&&this.#Ia.onUpdate(t,n)):(this.#Oa?.isActive()&&this.#Oa.onUpdate(t,n),this.#wa?.onUpdate(t,n))};mouseup=e=>{const{point:t,layerGroup:n}=this.#Ma(e),i=this.#qa(t);this.#Ia?.isActive()&&(i?this.#Ia.onEnd():this.#Ia.reset()),this.#Oa&&(this.#Oa.isActive()||this.#Ea&&!i)&&this.#Oa.onTap(t,n),this.#Ea=!1};mouseout=e=>{this.#Ia?.isActive()&&this.#Ia.onEnd(),this.#Oa?.isActive()&&this.#Oa.onEnd(),this.#wa?.onEnd(),this.#Ea=!1,this.#Ra=void 0};touchstart=e=>{this.#Ia?.isActive()&&this.#Ia.reset(),this.#Va();const t=Kt(e);if(this.#Ea=!0,this.#Ra=t[0],1===t.length){const{point:t,layerGroup:n}=this.#Ua(e);this.#Ia?.canStart(t,n)&&this.#Ia.onStart(t,n,{});const i=this.#ba;null!=i&&i>0&&(e.preventDefault(),this.#xa=setTimeout(()=>{this.#Qa(t,n)},i))}else 2===t.length&&this.#Aa?.onStart(t)};touchmove=e=>{this.#Va();const{point:t,layerGroup:n}=this.#Ua(e),i=Kt(e);1===i.length?this.#Ia?.isActive()&&this.#Ia.onUpdate(t,n):2===i.length&&(this.#Ia?.isActive()&&this.#Ia.reset(),this.#Aa?.isActive()&&this.#Aa.onUpdate(i,n))};touchend=e=>{if(this.#Va(),this.#Aa?.isActive())return void this.#Aa.onEnd();const{point:t,layerGroup:n}=this.#Ua(e),i=this.#qa(t);this.#Ia?.isActive()&&(i?this.#Ia.onEnd():this.#Ia.reset()),this.#Oa&&(this.#Oa.isActive()||this.#Ea&&!i)&&this.#Oa.onTap(t,n),this.#Ea=!1};#Va(){void 0!==this.#xa&&(clearTimeout(this.#xa),this.#xa=void 0)}}function Fl(e){return{x:"number"==typeof e?.x?e.x:0,y:"number"==typeof e?.y?e.y:0}}class Ml{#Na;#Ba;constructor(e,t,{threshold:n}={}){this.#Na={x:t.getX()-e.getX(),y:t.getY()-e.getY()},this.#Ba=Fl(n)}get delta(){return this.#Na}passesThresholdX(){const e=this.#Ba.x;return e<=0||Math.abs(this.#Na.x)>=e}passesThresholdY(){const e=this.#Ba.y;return e<=0||Math.abs(this.#Na.y)>=e}passesThreshold(){return this.passesThresholdX()||this.passesThresholdY()}}class ql extends EventTarget{#ka;#Ga;#za;constructor({threshold:e}={}){super(),this.setDragThreshold(e)}get startPoint(){return this.#ka}get prevPoint(){return this.#Ga}setDragThreshold(e){this.#za=Fl(e)}isActive(){return void 0!==this.#Ga}canStart(e,t){return!0}reset(){this.#ka=void 0,this.#Ga=void 0}onStart(e,t,n){this.#ka=e,this.#Ga=e}onUpdate(e,t){const n=new Ml(this.#Ga,e,{threshold:this.#za});n.passesThreshold()&&(this.#Ga=e,this.onDrag(n,t))}onDrag(e,t){}onEnd(){this.#Ga=void 0,this.reset()}}class Ul extends ql{#Ha;constructor({activeViewLayerOnly:e=!0}={}){super(),this.#Ha=e}setActiveViewLayerOnly(e){this.#Ha=e}canStart(e,t){const n=el(t,this.#Ha);return void 0!==n&&!!n.getViewController().isMonochrome()}onDrag(e,t){const n=el(t,this.#Ha);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 Tt(l+r*s,c+o*s);i.setWindowLevel(u)}}class Ql extends ql{constructor(){super({threshold:{x:15,y:15}})}canStart(e,t){return void 0!==tl(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 Vl extends ql{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 Nl extends ql{onDrag(e,t){const n=tl(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 m(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 Bl{onDoubleClick(e,t){}}class kl extends Bl{#Ya;#Ha;constructor({dataController:e,activeViewLayerOnly:t=!0}){super(),this.#Ya=e,this.#Ha=t}setActiveViewLayerOnly(e){this.#Ha=e}onDoubleClick(e,t){const n=el(t,this.#Ha);if(void 0===n)return;const i=n.displayToPlaneIndex(e),o=n.getViewController();if(!o.isMonochrome())return;const r=this.#Ya.get(n.getDataId()).image,a=new Tt(r.getRescaledValueAtIndex(o.getCurrentIndex().getWithNew2D(i.get(0),i.get(1))),o.getWindowLevel().width);o.setWindowLevel(a)}}class Gl extends Bl{onDoubleClick(e,t){const n=tl(t);void 0!==n?n.getViewController().play():s.warn("No view layer to play double click behavior")}}class zl{reset(){}onUpdate(e,t){}onEnd(){this.reset()}}class Hl extends zl{#Xa=!1;#Wa;constructor({tooltipEnabled:e=!1}={}){super(),this.#Xa=e}setTooltipEnabled(e){this.#Xa=e}reset(){void 0!==this.#Wa&&(this.#Wa.removeTooltipDiv(),this.#Wa=void 0)}onUpdate(e,t){this.#Xa&&this.#$a(e,t)}#$a(e,t){this.#Wa=t,t.showTooltip(e)}}class Yl extends EventTarget{#Bt=[];#ja=1;setNumberOfTaps(e){this.#Bt=[],this.#ja=e}isActive(){return 0!==this.#Bt.length}reset(){this.#Bt=[]}getPointList(){return this.#Bt.slice()}onUpdate(e,t){}onTap(e,t){this.#Bt.push(e),this.#Bt.length===this.#ja&&this.onEnd()}onEnd(){this.#Bt=[],this.reset()}}class Xl extends Yl{onTap(e,t){super.onTap(e,t);const n=tl(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)}}class Wl{isActive(){return!1}reset(){}onStart(e){}onUpdate(e,t){return!1}onEnd(){this.reset()}}class $l extends Wl{#Za;#_a;isActive(){return void 0!==this.#Za}reset(){this.#Za=void 0,this.#_a=void 0}onStart(e){this.#Za=new or(e[0],e[1]),this.#_a=this.#Za.getCentroid()}onUpdate(e,t){if(void 0===this.#Za)return!1;const n=new or(e[0],e[1]).getLength()/this.#Za.getLength(),i=t.getPositionHelper();if(1===n){const n=e[0].getY()-this.#Za.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.#_a){const n=tl(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.#_a),r=i.getPlanePositionFromPlanePoint(o);t.addScale(e,r),t.draw()}}return!0}onEnd(){this.#Za=void 0,this.reset()}}function jl(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 Zl{#in;#Ka;#Ja;#es;#ts;#ns;#is;#os;#rs;#as=!1;constructor(e){this.#in=e,this.#Ka=e.getStyle()}setOptions(e){this.#Ja=e}setFeatures(e){if(void 0!==e.autoShapeColour&&(this.#as=e.autoShapeColour),void 0!==e.shapeColour&&(this.#Ka.setLineColour(e.shapeColour),this.#as=!1),void 0!==e.refMetaValidator&&(this.#is=e.refMetaValidator),void 0!==e.annotationGroupMeta&&(this.#os=e.annotationGroupMeta),void 0!==e.annotationMeta&&(this.#rs=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.#Ja&&(this.#ts=new this.#Ja[this.#es])}}hasShape(e){return void 0!==this.#Ja?.[e]}tryBeginPlacement(e){let t=e.getActiveDrawLayer();return void 0===t&&this.#ss(e)&&this.#ls(e)&&(t=this.#cs(e)),!(void 0===t||!this.#us())}#us(){return!(!this.#Ja||!this.#es)||(s.warn("DrawPreview: missing factory list or shape name"),!1)}getNPoints(){let e=0;return void 0!==this.#ts&&(e=this.#ts.getNPoints()),e}resetPlacement(){if(this.#ns){const e=this.#ns.getLayer();this.#ns.destroy(),this.#ns=void 0,e.draw()}}#ss(e){let t=!0;const n=this.#is;if(void 0!==n){const i=e.getActiveViewLayer().getDataId();t=n(this.#in.getDataController().get(i).image.getMeta())}return t}#ls(e){const t=e.getBaseViewLayer().getDataId();return!this.#in.getDataController().get(t).image.isResampled()}getCannotCreateReason(e){let t;return this.#ss(e)||(t="reference data is invalid"),this.#ls(e)||(t="base data is invalid"),t}#cs(e){const t=e.getActiveViewLayer().getDataId(),n=this.#in.createAnnotationData(t),i=this.#os;if(void 0!==i)for(const e of i)n.annotationGroup.setMetaValue(e.concept,e.value);this.#in.addAndRenderAnnotationData(n,e.getDivId(),t);const o=e.getActiveDrawLayer();e.setActiveLayerByDataId(o.getDataId());const r=o.getKonvaStage();return this.#Ka.setZoomScale(r.scale()),o}#ds(e){if(this.#as){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.#Ka.setLineColour(o)}}#hs(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 is,l=i.getAnnotationGroup().getColour();a.colour=void 0!==l?l:this.#Ka.getLineColour(),a.init(r);const c=this.#rs;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.#ts.setAnnotationMathShape(a,u),a}onNewPoints(e,t){this.#ns&&(this.#ns.destroy(),this.#ns=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.#ds(n);const o=this.#hs(e,t);void 0!==o&&(this.#ns=this.#ts.createShapeGroup(o,this.#Ka),n.setLabelVisibility(this.#ns),this.#ns.getChildren(ca)[0].listening(!1),i.listening(!1),i.add(this.#ns),i.draw())}onFinalPoints(e,t){this.#ns&&(this.#ns.destroy(),this.#ns=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.#hs(e,t);if(void 0===r)return;const a=new Cl(r,o);this.#in.getUndoController().addToUndoStack(a),a.execute(),i.listening(!0)}}class _l extends Yl{#gs;#Ss;#ps;#ms;constructor(e,t){super(),this.#ps=new Zl(e),this.#ms=t}setOptions(e){this.#ps.setOptions(e)}setFeatures(e){this.#ps.setFeatures(e),this.#ms.setFeatures(e)}hasShape(e){return this.#ps.hasShape(e)}#fs(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ms.checkCanEdit(n)?this.#ms.trySelectShapeGroup(e,n):(this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:"Cannot edit draw, data meta is invalid"}})),!1))}#vs(){const e=this.#ps.getNPoints();void 0===e?super.setNumberOfTaps(65535):super.setNumberOfTaps(e)}resetPlacement(){this.#ps.resetPlacement(),super.onEnd()}#Cs(e){const t=this.getPointList();return t.length>0&&t[t.length-1].equals(e)}onUpdate(e,t){if(!this.isActive())return;if(this.#Cs(e))return;if(!jl(e,t))return;this.#gs=e,this.#Ss=t;const n=this.getPointList();n.push(e),this.#ps.onNewPoints(n,t)}onTap(e,t){if(!this.isActive()){if(this.#fs(e,t))return;if(!this.#ps.tryBeginPlacement(t)){const e=this.#ps.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#ms.disableAndResetEditor(),this.#vs()}if(this.#Cs(e))return;this.#Ss=t,super.onTap(e,t);const n=this.getPointList();n.length>1&&this.#ps.onNewPoints(n,t)}onEnd(){const e=this.getPointList(),t=this.#Ss,n=this.#ps.getNPoints();e.length>0&&t&&(void 0!==n?e.length===n?this.#ps.onFinalPoints(e,t):e.length!==n-1||void 0===this.#gs||this.#Cs(this.#gs)?this.#ps.resetPlacement():(e.push(this.#gs),this.#ps.onFinalPoints(e,t)):e.length>2?this.#ps.onFinalPoints(e,t):this.#ps.resetPlacement()),this.#gs=void 0,this.#Ss=void 0,super.onEnd()}}class Kl extends ql{#ms;#gs;#Ss;#ps;constructor(e,t){super(),this.#ms=t,this.#ps=new Zl(e)}setOptions(e){this.#ps.setOptions(e)}setFeatures(e){this.#ps.setFeatures(e)}resetPlacement(){this.#ps.resetPlacement(),super.onEnd()}#Ds(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.#ps.getNPoints()}onStart(e,t,n){if(!this.isActive()){const n=t.getActiveDrawLayer();if(void 0!==n&&this.#Ds(e,n))return;if(!this.#ps.tryBeginPlacement(t)){const e=this.#ps.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#ms.disableAndResetEditor()}this.#Ss=t,super.onStart(e,t,n)}onDrag(e,t){if(!this.isActive())return;if(!jl(this.prevPoint,t))return;this.#gs=this.prevPoint,this.#Ss=t;const n=[this.startPoint,this.#gs];this.#ps.onNewPoints(n,t)}onEnd(){const e=this.#Ss;if(e&&void 0!==this.#gs){const t=[this.startPoint,this.#gs];this.#ps.onFinalPoints(t,e)}this.#gs=void 0,this.#Ss=void 0,super.onEnd()}}class Jl{#in;#Nr;#ke=[];#ys;#Is;constructor(e,t){this.#in=e,this.#Nr=t}setFeatures(e){void 0!==e.drawMetaValidator&&(this.#Is=e.drawMetaValidator)}disableAndResetEditor(){this.#Nr.disableAndResetEditor()}checkCanEdit(e){return this.#ws(e)}#ws(e){let t=!0;const n=this.#Is;if(void 0!==n){const i=e.getDataId();t=n(this.#in.getDataController().get(i).annotationGroup.getMeta())}return t}#Ds(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}#Ts(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.#Nr.setEditorShape(o,n),!0)}trySelectShapeGroup(e,t){const n=this.#Ds(e,t);return void 0!==n&&this.#Ts(n,t)}#Ls(e){const t=e.getId();return void 0===this.#ke[t]&&(this.#ke[t]=()=>{e.activateCurrentPositionShapes(!0)}),this.#ke[t]}#Ps(){return e=>{const t=e.detail?.layerid,n=this.#in.getStageController().getDrawLayers(function(e){return e.getId()===t});1===n.length&&this.#As(n[0],!0)}}#Os(){void 0===this.#ys&&(this.#ys=this.#Ps(),this.#in.addEventListener("drawlayeradd",this.#ys))}#bs(){void 0!==this.#ys&&(this.#in.removeEventListener("drawlayeradd",this.#ys),this.#ys=void 0)}#As(e,t){e.setShapeHandler(this.#Nr),e.activateCurrentPositionShapes(t),t?this.#in.addEventListener("positionchange",this.#Ls(e)):this.#in.removeEventListener("positionchange",this.#Ls(e))}activate(e){e||this.#Nr.onMouseOutShapeGroup();const t=this.#in.getStageController().getDrawLayers();for(const n of t)void 0!==n&&this.#As(n,e);e?this.#Os():this.#bs()}}class ec{#in;#xs;constructor(e,t){this.#in=e,this.#xs=t}#ts;#Es;#Rs;#Er;#Fs=!1;setShape(e,t,n){if(this.#Es=e,this.#Rs=t,this.#Er=n,void 0!==this.#Es){if(this.#Ms(),this.#ts=n.getFactory(),void 0===this.#ts)throw new Error("Could not find a factory to update shape.");this.#qs()}}getShape(){return this.#Es}getAnnotation(){return this.#Er}isActive(){return this.#Fs}enable(){this.#Fs=!0,void 0!==this.#Es&&(this.#Us(!0),this.#Es.getLayer()&&this.#Es.getLayer().draw())}disable(){this.#Fs=!1,void 0!==this.#Es&&(this.#Us(!1),this.#Es.getLayer()&&this.#Es.getLayer().draw())}reset(){this.#Es=void 0,this.#Rs=void 0,this.#Er=void 0}resetAnchors(){this.#Ms(),this.#qs(),this.#Us(!0)}#Qs(e){void 0!==this.#Es&&this.#Es.getParent()&&this.#Es.getParent().find(".anchor").forEach(e)}#Us(e){this.#Qs(function(t){t.visible(e)})}setAnchorsActive(e){let t;t=e?e=>{this.#Vs(e)}:e=>{this.#Ns(e)},this.#Qs(t)}#Ms(){this.#Qs(function(e){e.remove()})}#qs(){if(void 0===this.#Es||!this.#Es.getLayer())return;if(void 0===this.#ts)return;const e=this.#Es.getParent(),t=this.#ts.getAnchors(this.#Er,this.#in.getStyle());for(let n=0;n<t.length;++n)this.#Vs(t[n]),e.add(t[n])}#Vs(t){let n;t.on("dragstart.edit",e=>{e.cancelBubble=!0,n={mathShape:this.#Er.mathShape,referencePoints:this.#Er.referencePoints}}),t.on("dragmove.edit",t=>{const n=t.target;n instanceof e.Shape&&void 0!==this.#ts&&(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 m(-n.x(),-n.y()),new m(e.x-n.x(),e.y-n.y()))}(this.#Rs.getBaseSize(),n),void 0!==this.#ts.constrainAnchorMove&&this.#ts.constrainAnchorMove(n,this.#Er),this.#ts.updateAnnotationOnAnchorMove(this.#Er,n),this.#ts.updateShapeGroupOnAnchorMove(this.#Er,n,this.#in.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.#ts?.onAnchorMoveEnd(i,this.#Er);const o={mathShape:this.#Er.mathShape,referencePoints:this.#Er.referencePoints},r=new yl(this.#Er,n,o,this.#Rs.getDrawController());this.#in.getUndoController().addToUndoStack(r),this.#xs({type:"annotationupdate",data:this.#Er,dataid:this.#Rs.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!"))})}#Ns(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 tc{#Bs;constructor(){this.createTrashIcon()}createTrashIcon(){this.#Bs=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.#Bs.width(20),this.#Bs.height(20),this.#Bs.add(t),this.#Bs.add(n)}activate(e){const t=e.getKonvaStage(),n=t.scale(),i=e.getKonvaLayer(),o={x:1/n.x,y:1/n.y};this.#Bs.x(t.offset().x+t.width()/(2*n.x)),this.#Bs.y(t.offset().y+t.height()/(15*n.y)),this.#Bs.scale(o),i.add(this.#Bs),i.draw()}changeChildrenColourOnTrashHover(e,t,n){if(this.isOverTrash(e))return this.changeGroupChildrenColour(this.#Bs,"orange"),void this.changeGroupChildrenColour(t,"red");this.changeGroupChildrenColour(this.#Bs,"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.#Bs.remove()}isOverTrash(e){const t=this.#Bs.width()*Math.abs(this.#Bs.scaleX())/2,n=this.#Bs.height()*Math.abs(this.#Bs.scaleY())/2;return Math.abs(e.x-this.#Bs.x())<t&&Math.abs(e.y-this.#Bs.y())<n}}class nc extends EventTarget{#in;#ks;#Bs;#Gs="pointer";#zs;#Hs;#xs=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))};constructor(e){super(),this.#in=e,this.#ks=new ec(e,this.#xs),this.#Bs=new tc}setEditorShape(t,n){const i=n.getDrawController();if(t&&t instanceof e.Shape&&t!==this.#ks.getShape()&&i.isAnnotationGroupEditable()){this.#ks.disable();const e=t.getParent().id();this.#ks.setShape(t,n,i.getAnnotation(e)),this.#xs({type:"annotationselect",annotationid:e,dataid:n.getDataId()}),this.#ks.enable()}}getEditorShapeGroup(){let t;if(!this.#ks.isActive()||(t=this.#ks.getShape().getParent(),t instanceof e.Group))return t}getEditorAnnotation(){let e;return this.#ks.isActive()&&(e=this.#ks.getAnnotation()),e}disableAndResetEditor(){this.#ks.disable(),this.#ks.reset()}#Ys(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.#Gs=e}#Xs(){this.#zs=document.body.style.cursor,document.body.style.cursor=this.#Gs,this.#Hs.opacity(.75)}onMouseOutShapeGroup(){void 0!==this.#zs&&(document.body.style.cursor=this.#zs,this.#zs=void 0),void 0!==this.#Hs&&this.#Hs.opacity(1)}#Ws(e){e.on("mouseover",()=>{this.#Hs=e,this.#Xs()}),e.on("mouseout",()=>{this.onMouseOutShapeGroup(),this.#Hs=void 0})}#$s(e){e.off("mouseover"),e.off("mouseout")}addShapeGroupListeners(e,t,n){this.#Ws(e),this.#js(e,t,n),this.#Zs(e,t,n),e.on("dblclick",()=>{const e=t.textExpr,i=t=>{const i=t.textExpr,o=new yl(t,{textExpr:e},{textExpr:i},n.getDrawController());this.#in.getUndoController().addToUndoStack(o),o.execute()};void 0!==Me.openRoiDialog?Me.openRoiDialog(t,i):function(e,t){const n=prompt("Label",e.textExpr);null!==n&&(e.textExpr=n,t(e))}(t,i)})}#js(t,n,i){const o=i.getKonvaLayer(),r=t.getChildren(ca)[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.#Bs.activate(i),this.#ks.setAnchorsActive(!1),o.draw()}),r.on("dragmove.draw",e=>{const a=function(e,t){return{min:new m(0,0),max:new m(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.#in.getStyle()),h.updateConnector(n,t);const g=Jt(e.evt),S={x:g.getX(),y:g.getY()},p=this.#Ys(S,i);this.#Bs.changeChildrenColourOnTrashHover(p,t,c),o.draw()}),r.on("dragend.draw",e=>{const s=this.#in.getUndoController();if(this.#Bs.remove(),void 0===e||void 0===e.evt)return;const u=r.x(),d=r.y(),h=Jt(e.evt),g={x:h.getX(),y:h.getY()},S=this.#Ys(g,i);if(this.#Bs.isOverTrash(S)){t.x(a.x),t.y(a.y),this.#ks.disable(),this.#ks.reset(),this.#Bs.changeGroupChildrenColour(t,c),n.mathShape=l.mathShape,n.referencePoints=l.referencePoints;const e=new Dl(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 yl(n,l,e,i.getDrawController());s.addToUndoStack(t),this.#xs({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:Object.keys(e)}),l={mathShape:e.mathShape,referencePoints:e.referencePoints}}this.#ks.setAnchorsActive(!0),this.#ks.resetAnchors()}o.draw(),a={x:r.x(),y:r.y()}})}#Zs(t,n,i){const o=t.getChildren(la)[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.#in.getUndoController(),t=o.x()-r.x,s=o.y()-r.y;if(0!==t||0!==s){const t=new m(o.x(),o.y());n.labelPosition=t;const r=new yl(n,{labelPosition:a},{labelPosition:t},i.getDrawController());e.addToUndoStack(r),this.#xs({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:["labelPosition"]}),a=t}r={x:o.x(),y:o.y()}})}removeShapeListeners(t){this.#$s(t),t.off("dblclick");const n=t.getChildren(ca)[0];n instanceof e.Shape&&(n.draggable(!1),n.off("dragstart.draw"),n.off("dragmove.draw"),n.off("dragend.draw"));const i=t.getChildren(la)[0];i instanceof e.Label&&(i.draggable(!1),i.off("dragstart.draw"),i.off("dragend.draw"))}}class ic{mask;dataId;offsetsLists;mode;segmentNumber;srclayerid;originalValuesLists;isSilent}class oc extends Ma{#_s;#nn;#Ks;#Js;#el;#tl;#nl;#il;#ol;#rl;constructor(e){super(),this.#_s=e.mask,this.#nn=e.dataId,this.#Ks=e.offsetsLists,this.#Js=e.mode,this.#el=e.segmentNumber,this.#tl=e.srclayerid,void 0!==e.originalValuesLists&&(this.#nl=e.originalValuesLists),this.#il=e.isSilent??!1,this.#ol="del"===this.#Js?"brushremove":"brushdraw",this.#rl="brushdraw"===this.#ol?"brushremove":"brushdraw"}getOriginalValuesLists(){return this.#nl}getExecuteEvent(){const e="brushdraw"===this.#ol?this.#el:void 0;return new CustomEvent(this.#ol,{detail:{segmentnumber:e,dataid:this.#nn,srclayerid:this.#tl}})}getName(){return"Draw-brush"}execute(){if(void 0===this.#el)return;let e=this.#el;"brushremove"===this.#ol&&(e=0),void 0===this.#nl?this.#nl=this.#_s.setAtOffsetsAndGetOriginals(this.#Ks,e):this.#_s.setAtOffsetsWithIterator(this.#Ks,e),this.#il||this.onExecute(this.getExecuteEvent())}undo(){void 0===this.#nl?this.#nl=this.#_s.setAtOffsetsAndGetOriginals(this.#Ks,0):this.#_s.setAtOffsetsWithIterator(this.#Ks,this.#nl);const e="brushdraw"===this.#rl?this.#el:void 0,t=new CustomEvent(this.#rl,{detail:{segmentnumber:e,dataid:this.#nn,srclayerid:this.#tl}});this.onUndo(t)}onExecute(e){}onUndo(e){}}const rc="No source image to create mask",ac="No source image to get offsets, ID: {0}",sc="No brush origins",lc="No mask defined when adding mask slices",cc="No created mask image",uc="No mask image for temporary draw command, ID: {0}",dc="No mask image to get offsets from",hc="No mask image for draw command, ID: {0}",gc="No mask ID to apply mask index",Sc="No mask view layers",pc="No selected segment number",mc="Too many mask view layers: {0}",fc="More mask layers than expected",vc="Cannot display mask with no mask ID",Cc="Cannot draw with no mask data ID",Dc="Cannot draw with no offsets",yc="Cannot draw with no colour list",Ic="Cannot get mask layers with no mask ID",wc="Cannot get mask view controller: no mask ID",Tc="Cannot get mask view controller: no mask layers",Lc="Cannot find source data for an existing mask, ID: {0}",Pc="Unsupported scroll index: {0}";function Ac(e,...t){return e.replace(/{(\d+)}/g,(e,n)=>t[n]||"")}const Oc="del";function bc(e,t,n,i){return Sr(e.worldToIndex(t),n,i)}class xc extends EventTarget{#in;#al=10;#sl={min:1,max:20};#ll="del";#cl;#_s;#ul;#Wa;#dl=0;#hl;#gl;constructor(e){super(),this.#in=e.app}#Sl(e){const t=this.#sl.min,n=this.#sl.max;return Math.min(Math.max(e,t),n-1)}getBrushSize(){return this.#al}getBrushMode(){return this.#ll}getSelectedSegmentNumber(){return this.#cl}setBrushMode(e){this.setFeatures({brushMode:e})}setFeatures(e){if(void 0!==e.brushSizeRange&&(this.#sl=e.brushSizeRange,this.#al=this.#Sl(this.#al)),void 0!==e.brushSize&&(this.#al=this.#Sl(e.brushSize)),void 0!==e.brushSizeAdd){const t=this.#Sl(this.#al+e.brushSizeAdd);if(t!==this.#al){this.#al=t;const e=new CustomEvent("brushsizechange",{detail:{value:this.#al}});this.dispatchEvent(e)}}void 0!==e.brushMode&&(this.#ll=e.brushMode),void 0!==e.selectedSegmentNumber&&(this.#cl=e.selectedSegmentNumber),e.createMask?this.#ul=void 0:void 0!==e.maskDataId&&(this.#ul=e.maskDataId)}#pl(e,t,n,i=!1){const o=e.getSize().getValues();o[2]=1;const r=new ut(o),a=new St([t],r,e.getSpacing(),e.getOrientation()),s=new Uint8Array(r.getDimSize(2));s.fill(0),++this.#dl;const l=[this.#dl.toString()],c=i?new po(a,s,l):new Ot(a,s,l);return c.setMeta(n),c.setPhotometricInterpretation("PALETTE COLOR"),c.setPaletteColourMap(new Co([0],[0],[0])),c}#ml(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],p=r.get3D().getDistance(S);p>h&&s.warn(`Large distance between origin and origin for first index: ${p}`);const m=u.get3D().getClosest(d),f=d[m],v=u.get3D().getDistance(f);return v>h&&s.warn(`Large distance between origin and origin for last index: ${v}`),[g,m]}(e,bc(e,n,o,i));if(void 0===l||0===l.length)throw new Error(sc);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.#_s)throw new Error(lc);const p=this.#_s.getMeta();for(const e of S)p.numberOfFiles+=1,this.#_s.appendSlice(this.#pl(t,e,r))}#fl(e,t){if(!t)throw new Error(Ac(rc));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=To(),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(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.#_s=this.#pl(n,r,s,!0);const h=yn(s),g=new Ps(h);g.image=this.#_s;const S=this.#in.getDataController(),p=S.getNextDataId();if(!S.add(p,g))throw new Error("Cannot add mask data");return p}#vl(e){const t=this.#in.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}#Cl(e){if(void 0===this.#ul)throw new Error(vc);const t=new Xc(e);t.orientation=this.#vl(e);const n=this.#in.getStageController();n.addDataViewConfig(this.#ul,t),n.render(this.#ul)}#Dl(e){const t=e.getMaskReferencedSeriesUID();let n;return"undefined"!==t&&(n=this.#in.getDataController().getDataIdFromSeriesUid(t)),void 0===n&&s.warn(Ac(Lc,t)),n}#yl(e){if(void 0===this.#ul)throw new Error(Ic);const t=e.getViewLayersByDataId(this.#ul);if(0===t.length)throw new Error(Sc);return 1!==t.length&&s.warn(Ac(mc,t.length)),t[0]}#Il(e){if(void 0===e)throw new Error(gc);const t=this.#in.getDataController().get(e);if(void 0===t)throw new Error(dc);return t.image}#wl(e,t){if(void 0===t)throw new Error("No layergroup to get mask offsets");let n;if(this.#Wa=t,n=void 0===this.#ul?t.getBaseViewLayer():t.getViewLayersByDataId(this.#ul)[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.#_s=this.#Il(this.#ul);const t=this.#Dl(this.#_s),o=this.#in.getDataController().get(t);if(!o)throw new Error(Ac(ac,t));if(c=o.image,c.isResampled())return s.warn("Cannot update mask with resampled reference image."),[];const u=this.#in.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.#in.getDataController().get(u);if(!d)throw new Error(Ac(ac,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.#ul=this.#fl(o,c),void 0===this.#_s)throw new Error(cc);const g=t.getDivId(),S=void 0!==g;S&&this.#Cl(g),r=this.#yl(t),a=r.getViewController(),S&&a.setCurrentPosition(o)}const u=c.getGeometry(),d=this.#_s.getMeta(),h=this.#_s.getGeometry(),g=i.get2DSpacing(),S=[Math.round(this.#al/g.x),Math.round(this.#al/g.y)];let p;const m=i.getScrollDimIndex();switch(m){case 0:p=[1,2];break;case 1:p=[0,2];break;case 2:p=[0,1];break;default:throw new Error(Ac(Pc,m))}this.#ml(u,h,l,p,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,bc(h,a.getPositionFromPlanePoint(f),S,p))}#Tl(e){const t=this.#Ll().getId();if(void 0===this.#ul)throw new Error(gc);const n=this.#in.getDataController().get(this.#ul);if(!n)throw new Error(Ac(uc,this.#ul));const i=new ic;i.mask=n.image,i.dataId=this.#ul,i.offsetsLists=[e],i.mode=this.#ll,i.segmentNumber=this.#cl,i.srclayerid=t;const o=new oc(i);o.execute();const r=o.getOriginalValuesLists();if(void 0!==r)return r[0]}beginStroke(e,t){this.#hl=[],this.#gl=[];const n=this.#wl(e,t);if(n.length>0){this.#hl.push(n);const e=this.#Tl(n);return void 0!==e&&this.#gl.push(e),!0}return!1}paintStep(e,t){const n=this.#wl(e,t);if(n.length>0){this.#hl.push(n);const e=this.#Tl(n);void 0!==e&&this.#gl.push(e)}}finalizeStroke(){if(void 0===this.#ul)throw new Error(Cc);if(void 0===this.#hl)throw new Error(Dc);if(void 0===this.#gl)throw new Error(yc);this.#hl.reverse(),this.#gl.reverse();const e=this.#Ll().getId(),t=this.#in.getDataController().get(this.#ul);if(!t)throw new Error(Ac(hc,this.#ul));const n=new ic;n.mask=t.image,n.dataId=this.#ul,n.offsetsLists=this.#hl,n.mode=this.#ll,n.segmentNumber=this.#cl,n.srclayerid=e,n.originalValuesLists=this.#gl;const i=new oc(n);i.onExecute=e=>{this.dispatchEvent(e)},i.onUndo=e=>{this.dispatchEvent(e),this.#_s.recalculateLabels()},this.#in.getUndoController().addToUndoStack(i),this.dispatchEvent(i.getExecuteEvent()),this.#_s.recalculateLabels()}#Ll(){if(void 0===this.#ul)throw new Error(wc);if(void 0===this.#Wa)throw new Error("No current layer group");const e=this.#Wa.getViewLayersByDataId(this.#ul);if(0===e.length)throw new Error(Tc);return 1!==e.length&&s.warn(fc),e[0]}}const Ec=["brushsizechange","brushdraw","brushremove"];class Rc extends ql{#in;#Pl;#Al=!1;#Ol=[];constructor(e){super(),this.#in=e,this.#Pl=new xc({app:e});for(const e of Ec)this.#Pl.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}setFeatures(e){void 0!==e.blacklist&&(this.#Ol=e.blacklist),this.#Pl.setFeatures(e)}canStart(e,t){return!(!this.#bl(t)||this.#xl(t)||(this.#Pt(t)?(s.warn("Cannot paint on series with overlapping slices"),1):void 0===this.#Pl.getSelectedSegmentNumber()&&(s.warn(pc),1)))}onStart(e,t,n){super.onStart(e,t,n);const i=this.#Pl.getBrushSize()/2;this.setDragThreshold({x:i,y:i}),this.#Al=!1,2===n?.mouseDownButton&&this.#El(),this.#Pl.beginStroke(e,t)||(this.#Rl(),super.onEnd())}onDrag(e,t){const n=this.prevPoint;void 0!==n&&this.#Pl.paintStep(n,t)}onEnd(){this.isActive()&&(this.#Pl.finalizeStroke(),this.#Rl()),super.onEnd()}reset(){this.isActive()&&(this.#Pl.finalizeStroke(),this.#Rl()),super.reset()}#bl(e){if(void 0===e)throw new Error("No layergroup to check for view layer");return e.getActiveLayer()instanceof vl}#xl(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.#in.getDataController().get(t).image.getMeta().SeriesInstanceUID;if(this.#Ol.includes(n))return!0}return!1}#Pt(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.#in.getDataController().get(n);return i.image instanceof po&&i.image.getHasOverlap()}#El(){this.#Al=!0,this.#Pl.setBrushMode(Oc),this.dispatchEvent(new CustomEvent("erasingactivated"))}#Rl(){this.#Al&&this.#Pl.getBrushMode()===Oc&&(this.#Pl.setBrushMode("add"),this.dispatchEvent(new CustomEvent("erasingdeactivated"))),this.#Al=!1}}class Fc extends ql{#in;#Er;#Fl;#Ml;#ql=[];#Ul;#Ql=10;#Vl=5;#Nl=0;#Bl=2e3;#kl=[];#Ka;#ms;constructor(e,t,n){super(),this.#in=e,this.#Ka=t,this.#ms=n}setFeatures(e){this.#ms.setFeatures(e)}#Gl(e){const t=e.getActiveDrawLayer();if(void 0!==t)return e.getViewLayerById(t.getReferenceLayerId());s.warn("No draw layer to do floodfill")}#zl=(e,t)=>{const n=this.#Gl(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)}};#Hl(e,t,i){this.#kl=[];const o={data:this.#Ml?.data,width:this.#Ml?.width,height:this.#Ml?.height,bytes:4},r=n.floodFill(o,e.x,e.y,t),a=n.gaussBlurOnlyBorder(r,this.#Vl);let s=n.traceContours(a);if(s=n.simplifyContours(s,this.#Nl,this.#Bl),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.#kl.push(new m(s[0].points[e].x,s[0].points[e].y));return this.#kl}return[]}#Yl(e,t,n){if(this.#ql=this.#Hl(e,t,!1),0!==this.#ql.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 dr(this.#ql);let o;if(void 0===this.#Er){this.#Er=new is,this.#Er.colour=this.#Ka.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.#Er.init(a),this.#Er.mathShape=i,o=new Cl(this.#Er,t)}else{const e=this.#Er.mathShape;o=new yl(this.#Er,{mathShape:e},{mathShape:i},t)}this.#in.getUndoController().addToUndoStack(o),o.execute()}return 0!==this.#ql.length}#Xl(e){const t=e.getBaseViewLayer().getDataId();return this.#in.getDataController().get(t).image.isResampled()}#fs(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ms.checkCanEdit(n)?this.#ms.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.#Xl(t))return;if(!this.isActive()&&this.#fs(e,t))return;let i;this.#Er=void 0;let o=t.getActiveDrawLayer();if(void 0===o){i=t.getActiveViewLayer();const e=i.getDataId(),n=this.#in.createAnnotationData(e),r=t.getDivId().replace("-layer-0","");this.#in.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.#Ml=i.getImageData(),void 0!==this.#Ml?(this.#Ka.setZoomScale(o.getKonvaLayer().getAbsoluteScale()),this.#Fl=this.#zl(e,t),this.#Yl(this.#Fl,this.#Ql,t),super.onStart(e,t,n)):s.error("No image info found")}onUpdate(e,t){if(!this.isActive())return;const n=this.#zl(e,t);this.#Ul=Math.round(Math.sqrt(Math.pow(this.#Fl.x-n.x,2)+Math.pow(this.#Fl.y-n.y,2))/2),this.#Ul=this.#Ul<this.#Ql?this.#Ql:this.#Ul-this.#Ql,this.#Yl(this.#Fl,this.#Ul,t),super.onUpdate(e,t)}}class Mc{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 qc{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 Uc=2/(3*Math.PI);function Qc(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 Vc{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++){Qc(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};Qc(e,t,n,i,a),Qc(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),Uc*(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}#Wl=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 qc(this.searchGranBits,this.#Wl),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 Nc extends Yl{#in;#Ka;#ka;#Er;#$l=new Mc;#jl=new Mc;#kl=[];#Zl=5;#_l=new Vc;#ms;constructor(e,t,n){super(),this.#in=e,this.#Ka=t,this.#ms=n,super.setNumberOfTaps(500)}setFeatures(e){this.#ms.setFeatures(e)}#Kl(e){const t=e.get(1);for(let e=0;e<t;++e)this.#kl[e]=[]}#Jl(){this.#$l=new Mc,this.#jl=new Mc}#Xl(e){const t=e.getBaseViewLayer().getDataId();return this.#in.getDataController().get(t).image.isResampled()}#fs(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ms.checkCanEdit(n)?this.#ms.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.#Xl(t))return;if(!this.isActive()&&this.#fs(e,t))return;let n,i=t.getActiveDrawLayer();n=void 0===i?t.getActiveViewLayer():t.getViewLayerById(i.getReferenceLayerId());const o=n.getViewController().getImageSize();this.#_l.setDimensions(o.get(0),o.get(1)),this.#_l.setData(n.getImageData().data);const r=n.displayToPlaneIndex(e);if(this.isActive()){const e=Math.abs(r.get(0)-this.#ka.getX()),t=Math.abs(r.get(1)-this.#ka.getY());if(e<this.#Zl&&t<this.#Zl)this.onEnd();else{this.#$l=this.#jl,this.#Kl(o);const e={x:r.get(0),y:r.get(1)};this.#_l.doTraining(e),this.#$l.addControlPoint(this.#jl.getPoint(0))}}else{if(this.#Er=void 0,this.#ka=new m(r.get(0),r.get(1)),this.#Jl(),this.#Kl(o),void 0===i){const e=n.getDataId(),o=this.#in.createAnnotationData(e);this.#in.addAndRenderAnnotationData(o,t.getDivId(),e),i=t.getActiveDrawLayer(),i.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(i.getDataId())}this.#Ka.setZoomScale(i.getKonvaLayer().getAbsoluteScale());const e={x:r.get(0),y:r.get(1)};this.#_l.doTraining(e);const a=new m(r.get(0),r.get(1));this.#$l.addPoint(a),this.#$l.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.#_l.setPoint(a);let l=!1;for(;!this.#kl[a.y][a.x]&&!l;)if(r=this.#_l.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.#kl[t.y][t.x]=n}for(this.#jl=new Mc,l=!1;a&&!l;)this.#jl.addPoint(new m(a.x,a.y)),this.#kl[a.y]&&this.#kl[a.y][a.x]?a=this.#kl[a.y][a.x]:l=!0;this.#jl.appenPath(this.#$l);const c=n.getDrawController(),u=new dr(this.#jl.pointArray);let d;if(void 0===this.#Er){this.#Er=new is,this.#Er.colour=this.#Ka.getLineColour();const e=i.getViewController();this.#Er.init(e),this.#Er.mathShape=u,d=new Cl(this.#Er,c)}else{const e=this.#Er.mathShape;d=new yl(this.#Er,{mathShape:e},{mathShape:u},c)}this.#in.getUndoController().addToUndoStack(d),d.execute(),super.onUpdate(e,t)}reset(){this.#Er=void 0,this.#Jl(),this.#kl=[],super.reset()}}const Bc={},kc={WindowLevel:class extends Rl{#in;#Ia;#Pa;constructor(e){const t=new Ul,n=new kl({dataController:e.getDataController()});super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new il,doubleClickBehavior:n}),this.#in=e,this.#Ia=t,this.#Pa=n}keydown=e=>{e.context="WindowLevel",this.#in.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){void 0!==e.strictViewLayer&&(s.warn("strictViewLayer is deprecated, use activeViewLayerOnly instead"),this.#Ia.setActiveViewLayerOnly(e.strictViewLayer),this.#Pa.setActiveViewLayerOnly(e.strictViewLayer)),void 0!==e.activeViewLayerOnly&&(this.#Ia.setActiveViewLayerOnly(e.activeViewLayerOnly),this.#Pa.setActiveViewLayerOnly(e.activeViewLayerOnly))}},Scroll:class extends Rl{#in;#ec;constructor(e){const t=new Hl;super({stageController:e.getStageController(),dragBehavior:new Ql,hoverBehavior:t,wheelBehavior:new il,doubleClickBehavior:new Gl,tapBehavior:new Xl}),this.#in=e,this.#ec=t}keydown=e=>{e.context="Scroll",this.#in.onKeydown(e)};activate(e){e||this.cancel()}setFeatures(e){void 0!==e.displayTooltip&&this.#ec.setTooltipEnabled(Boolean(e.displayTooltip))}init(){}},ZoomAndPan:class extends Rl{#in;constructor(e){super({stageController:e.getStageController(),dragBehavior:new Nl,wheelBehavior:new ol,twoTouchBehavior:new $l,tapBehavior:new Xl}),this.#in=e}keydown=e=>{e.context="ZoomAndPan",this.#in.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Opacity:class extends Rl{#in;constructor(e){super({stageController:e.getStageController(),dragBehavior:new Vl,wheelBehavior:new il}),this.#in=e}keydown=e=>{e.context="Opacity",this.#in.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Draw:class extends Rl{#in;#ms;#tc;#nc;#Nr;constructor(e){const t=new nc(e),n=new Jl(e,t),i=new _l(e,n),o=new Kl(e,n);super({stageController:e.getStageController(),dragBehavior:o,tapBehavior:i,wheelBehavior:new il}),this.#in=e,this.#ms=n,this.#tc=o,this.#nc=i,this.#Nr=t;for(const e of this.getEventNames())this.#tc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}),this.#nc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}),this.#Nr.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{this.#nc.isActive()||(e.context="Draw",this.#in.onKeydown(e));const t=this.#Nr.getEditorAnnotation();if(("Delete"===e.key||"Backspace"===e.key)&&void 0!==t){const e=this.#in.getStageController().getActiveLayerGroup().getActiveDrawLayer();if(void 0===e)return void s.warn("No draw layer to handle key down");const n=e.getDrawController(),i=this.#in.getUndoController(),o=new Dl(t,n);i.addToUndoStack(o),o.execute(),this.#Nr.onMouseOutShapeGroup()}"Escape"===e.key&&(this.#tc.resetPlacement(),this.#nc.resetPlacement(),this.#ms.disableAndResetEditor())};activate(e){e||this.cancel(),this.#ms.activate(e)}setOptions(e){this.#tc.setOptions(e),this.#nc.setOptions(e)}getOptionsType(){return"factory"}setFeatures(e){void 0!==e.mouseOverCursor&&this.#Nr.storeMouseOverCursor(e.mouseOverCursor),this.#tc.setFeatures(e),this.#nc.setFeatures(e)}init(){}getEventNames(){return["annotationupdate","annotationselect","warn"]}hasShape(e){return this.#nc.hasShape(e)}},Brush:class extends Rl{#ic;#in;constructor(e){const t=new Rc(e);super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new il,longTouchToDblClickMs:null}),this.#ic=t,this.#in=e;for(const e of this.getEventNames())this.#ic.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{e.context="Brush",this.#in.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.#ic.setFeatures({brushMode:Oc}):this.#ic.setFeatures({brushMode:"add"})):this.#ic.setFeatures({brushSizeAdd:-1}):this.#ic.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.#in.getStageController().getDataViewConfigs());e?this.#oc(t):(this.cancel(),this.#rc(t))}#oc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",e=>{e.preventDefault(),e.stopPropagation()})}}#rc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",e=>{})}}setFeatures(e){this.#ic.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:Qa,Floodfill:class extends Rl{#in;#ms;#Ia;#Ka=new zt;constructor(e){const t=new zt,n=new nc(e),i=new Jl(e,n),o=new Fc(e,t,i);super({stageController:e.getStageController(),dragBehavior:o,wheelBehavior:new il}),this.#in=e,this.#ms=i,this.#Ia=o,this.#Ka=t}keydown=e=>{e.context="Floodfill",this.#in.onKeydown(e),"Escape"===e.key&&this.#ms.disableAndResetEditor()};activate(e){if(e){const e=this.#in.getStageController().getActiveLayerGroup();this.#Ka.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#Ka.getLineColour()})}else this.cancel();this.#ms.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#Ka.setLineColour(e.shapeColour),this.#Ia.setFeatures(e)}},Livewire:class extends Rl{#in;#ms;#Oa;#Ka;constructor(e){const t=new zt,n=new nc(e),i=new Jl(e,n),o=new Nc(e,t,i);super({stageController:e.getStageController(),tapBehavior:o,wheelBehavior:new il}),this.#in=e,this.#ms=i,this.#Oa=o,this.#Ka=t}keydown=e=>{e.context="Livewire",this.#in.onKeydown(e),"Escape"===e.key&&this.#ms.disableAndResetEditor()};activate(e){if(e){const e=this.#in.getStageController().getActiveLayerGroup();this.#Ka.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#Ka.getLineColour()})}else this.cancel();this.#ms.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#Ka.setLineColour(e.shapeColour),this.#Oa.setFeatures(e)}}},Gc={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 Tt(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 D(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 f(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 zc{#ac=[];#sc;#vr=!1;#lc=[];#ke=null;getLayerGroup(e){return this.#ac[e]}getNumberOfLayerGroups(){return this.#ac.length}getActiveLayerGroup(){return this.getLayerGroup(this.#sc)}setActiveLayerGroup(e){void 0!==this.getLayerGroup(e)?this.#sc=e:s.warn(`No layer group to set as active with index: ${e}`)}getViewLayersByDataId(e){let t=[];for(const n of this.#ac)t=t.concat(n.getViewLayersByDataId(e));return t}getViewLayers(e){let t=[];for(const n of this.#ac)t=t.concat(n.getViewLayers(e));return t}getDrawLayersByDataId(e){let t=[];for(const n of this.#ac)t=t.concat(n.getDrawLayersByDataId(e));return t}getDrawLayers(e){let t=[];for(const n of this.#ac)t=t.concat(n.getDrawLayers(e));return t}addLayerGroup(e,t){this.#sc=this.#ac.length;const n=new xl(e,t);n.setImageSmoothing(this.#vr);const i=this.#ke&&0!==this.#ke.length;return i&&this.unbindLayerGroups(),this.#ac.push(n),i&&this.bindLayerGroups(),n}getLayerGroupByDivId(e){return this.#ac.find(function(t){return t.getDivId()===e})}setBinders(e){if(null==e)throw new Error("Cannot set null or undefined binders");0!==this.#lc.length&&this.unbindLayerGroups(),this.#lc=e.slice(),this.bindLayerGroups()}empty(){this.unbindLayerGroups();for(const e of this.#ac)e.empty();this.#ac=[],this.#sc=void 0}removeLayersByDataId(e){for(const t of this.#ac)t.removeLayersByDataId(e)}removeLayerGroup(e){const t=this.#ac.findIndex(t=>t===e);if(-1===t)throw new Error("Cannot find layerGroup to remove");this.unbindLayerGroups(),e.empty(),this.#ac.splice(t,1),this.#sc===t&&(this.#sc=void 0),this.bindLayerGroups()}reset(){for(const e of this.#ac)e.reset()}resetZoomPan(){for(const e of this.#ac)e.resetZoomPan()}resetViews(){for(const e of this.#ac)e.resetViews()}draw(){for(const e of this.#ac)e.draw()}fitToContainer(){let e;const t=[];for(let n=0;n<this.#ac.length;++n){const i=this.#ac[n].getDivToWorldSizeRatio();void 0!==i&&this.#ac[n].shouldBind()&&(t.push(n),(void 0===e||i<e)&&(e=i))}for(let n=0;n<this.#ac.length;++n)if(t.includes(n)&&this.#ac[n].shouldBind())this.#ac[n].fitToContainer(e);else{const e=this.#ac[n].getDivToWorldSizeRatio();this.#ac[n].fitToContainer(e)}}bindLayerGroups(){if(0!==this.#ac.length&&1!==this.#ac.length&&0!==this.#lc.length){this.#ke=new Array(this.#ac.length);for(let e=0;e<this.#ac.length;++e)if(this.#ac[e].shouldBind())for(let t=0;t<this.#lc.length;++t)this.#cc(e,this.#lc[t])}}unbindLayerGroups(){if(0!==this.#ac.length&&0!==this.#lc.length&&this.#ke){for(let e=0;e<this.#ac.length;++e)if(this.#ac[e].shouldBind())for(let t=0;t<this.#lc.length;++t)this.#uc(e,this.#lc[t]);this.#ke=null}}setImageSmoothing(e){this.#vr=e;for(const t of this.#ac)t.setImageSmoothing(e)}#dc(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.#uc(t,e),e.getCallback(this.#ac[t])(n),this.#cc(t,e)}},this.#ke[t].push(n)),n.callback}#cc(e,t){for(let n=0;n<this.#ac.length;++n)n!==e&&this.#ac[n].shouldBind()&&this.#ac[e].addEventListener(t.getEventType(),this.#dc(t,n))}#uc(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.#ac[e].removeEventListener(t.getEventType(),i.callback)}}const Hc=["viewlayeradd","drawlayeradd","error","zoomchange","offsetchange","layerremove","outofrange","renderstart","renderend",...ul];class Yc extends EventTarget{#hc=null;#Ya;#Ei;#gc;#Sc;#pc;constructor(e,t){super(),this.#Ya=e,this.#Ei=t,this.#hc=new zc,void 0!==t.binders&&this.#hc.setBinders(t.binders)}setToolboxController(e){this.#gc=e}setAddToUndoStack(e){this.#Sc=e}setGetInfoData(e){this.#pc=e}getViewConfigs(e,t){if(void 0===t&&(t=!1),null===this.#Ei.dataViewConfigs||void 0===this.#Ei.dataViewConfigs)throw new Error("No available data view configuration");let n=[];return void 0!==this.#Ei.dataViewConfigs[e]?n=this.#Ei.dataViewConfigs[e]:t||void 0===this.#Ei.dataViewConfigs["*"]||(n=this.#Ei.dataViewConfigs["*"]),n}getViewConfig(e,t,n){return this.getViewConfigs(e,n).find(function(e){return e.divId===t})}getDataViewConfigs(){return this.#Ei.dataViewConfigs}setDataViewConfigs(e){this.#hc.empty(),this.#Ei.dataViewConfigs=e,this.#mc(e)}addDataViewConfig(e,t,n){void 0===n&&(n=!0);const i=this.#Ei.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.#Ei.dataViewConfigs[e].push(t),void 0===this.#hc.getLayerGroupByDivId(t.divId)&&this.#fc(t),void 0!==this.#Ya.get(e)&&n&&this.render(e,[t])}removeDataViewConfig(e,t){const n=this.#Ei.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.#hc.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.#hc.removeLayerGroup(o)}}updateDataViewConfig(e,t,n){const i=this.#Ei.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.#hc.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.#Ya.get(e)&&this.render(e,[r])}getActiveLayerGroup(){return this.#hc.getActiveLayerGroup()}setActiveLayerGroup(e){this.#hc.setActiveLayerGroup(e)}getLayerGroup(e){return this.#hc.getLayerGroup(e)}getNumberOfLayerGroups(){return this.#hc.getNumberOfLayerGroups()}getViewLayersByDataId(e){return this.#hc.getViewLayersByDataId(e)}getViewLayers(e){return this.#hc.getViewLayers(e)}getDrawLayersByDataId(e){return this.#hc.getDrawLayersByDataId(e)}getDrawLayers(e){return this.#hc.getDrawLayers(e)}getLayerGroupByDivId(e){return this.#hc.getLayerGroupByDivId(e)}getAddedScale(){return this.#hc.getActiveLayerGroup().getAddedScale()}getBaseScale(){return this.#hc.getActiveLayerGroup().getBaseScale()}getOffset(){return this.#hc.getActiveLayerGroup().getOffset()}empty(){this.#hc.empty()}removeLayersByDataId(e){this.#hc.removeLayersByDataId(e)}setBinders(e){this.#hc.setBinders(e)}fitToContainer(){this.#hc.fitToContainer()}draw(){this.#hc.draw()}resetLayout(){this.#hc.reset(),this.#hc.draw()}resetZoomPan(){this.#hc.resetZoomPan(),this.#hc.draw()}resetViews(){this.#hc.resetViews()}setImageSmoothing(e){this.#hc.setImageSmoothing(e),this.#hc.draw()}zoom(e,t,n){const i=this.#hc.getActiveLayerGroup(),o=i.getBaseViewLayer().getViewController().getCurrentScrollPosition(),r=new f(t,n,o);i.addScale(e,r),i.draw()}translate(e,t){const n=this.#hc.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.#Ya.get(e),i=void 0!==n&&void 0!==n.image,o=void 0!==n&&void 0!==n.annotationGroup;if(0===this.#hc.getNumberOfLayerGroups()&&this.#mc(this.#Ei.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.#hc.getLayerGroupByDivId(r.divId);if(!a)throw new Error(`No layer group for ${r.divId}`);!i||this.#vc(e,a)?(i&&0===a.getViewLayersByDataId(e).length?this.#Cc(e,r):o&&0===a.getDrawLayersByDataId(e).length&&this.#Dc(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)`)}#yc=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#mc(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.#fc(t),n.push(t.divId))}}}#fc(e){const t=this.#Ei.rootDocument.getElementById(e.divId),n=void 0!==this.#Ei.overlayConfig,i=this.#hc.addLayerGroup(t,n);this.#Ic(i)}#Ic(e){e.addEventListener("zoomchange",this.#yc),e.addEventListener("offsetchange",this.#yc),e.addEventListener("layerremove",this.#yc),e.addEventListener("outofrange",this.#yc),e.addEventListener("renderstart",this.#yc),e.addEventListener("renderend",this.#yc);for(const t of ul)e.addEventListener(t,this.#yc);e.addEventListener("wlchange",e=>{const t=e.detail?.srclayerid,n=e.detail?.dataid,i=e.detail?.value,o=Al(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=Al(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=Al(t).groupDivId,r=this.getViewConfig(n,o,!0);void 0!==r&&(r.colourMap=i[0])})}#vc(e,t){let n=!1;const i=t.getBaseViewLayer();if(void 0!==i){const t=this.#Ya.get(i.getDataId()).image,o=this.#Ya.get(e).image;if(void 0!==t&&void 0!==o){const e=t.getGeometry().getOrientation();n=o.getGeometry().getOrientation().isSimilarProgressive(e,dt)}}else n=!0;return n}#Cc(e,t){const n=this.#Ya.get(e);if(!n)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const i=this.#hc.getLayerGroupByDivId(t.divId);if(!i)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const o=n.image.getGeometry();this.#hc.unbindLayerGroups();const r=(new ll).create(n.meta,n.image),a=Ye(o.getOrientation(),Be(t.orientation));r.setOrientation(a),n.image instanceof po&&(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 Tt(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.#Ya.addEventListener("dataimageset",c.onimageset),s&&void 0!==this.#Ei.overlayConfig&&void 0!==this.#pc&&(i.addInfoData(this.#pc(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.#hc.fitToContainer(),c.setOffset(i.getOffset());const S=this.#wc(o.getOrientation(),t.orientation);if(this.#Tc(S,c),s)c.setScale(i.getScale());else{const e=i.getBaseViewLayer();c.initScale(i.getScale(),e.getAbsoluteZoomOffset())}this.#hc.bindLayerGroups(),this.#gc&&this.#gc.bindLayerGroup(i,c),this.dispatchEvent(new CustomEvent("viewlayeradd",{detail:{layerid:c.getId(),layergroupid:i.getDivId(),dataid:e}})),s&&this.#gc&&this.#gc.init()}#Dc(e,t){const n=this.#hc.getLayerGroupByDivId(t.divId);if(!n)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const i=this.#Ya.get(e);if(!i)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const o=i.annotationGroup,r=this.#Lc(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.#hc.unbindLayerGroups();const s=r.getViewController();i.annotationGroup.setViewController(s);const l=this.#Ya.get(a);if(!l)throw new Error(`Cannot initialise layer without reference data, id: ${a}`);const c=l.image.getGeometry(),u=Ye(c.getOrientation(),Be(t.orientation)),d=c.getSize(u).get2D(),h=c.getSpacing(u).get2D(),g=n.addDrawLayer();g.initialise(d,h,r.getId());const S=new Sl(c,u);g.setPlaneHelper(S);const p=[s.getCurrentIndex().getValues(),s.getCurrentPosition().getValues()];n.updateLayersToPositionChange(new CustomEvent("positionchange",{detail:{value:p,srclayerid:g.getId()}})),this.#hc.fitToContainer(),g.setOffset(n.getOffset());const m=this.#wc(c.getOrientation(),t.orientation);this.#Tc(m,g),g.initScale(n.getScale(),r.getAbsoluteZoomOffset()),g.setAnnotationGroup(i.annotationGroup,e,this.#Sc),g.setCurrentPosition(s.getCurrentPosition(),s.getCurrentIndex()),this.#hc.bindLayerGroups(),this.#gc&&this.#gc.bindLayerGroup(n,g),this.dispatchEvent(new CustomEvent("drawlayeradd",{detail:{layerid:g.getId(),layergroupid:n.getDivId(),dataid:e}}))}#Lc(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}#wc(e,t){const n=ke(e.asOneAndZeros());if(void 0===n)throw new Error("Unsupported undefined orientation code");const i=void 0===t,o=!i&&t===Ne.Axial,r=!i&&t===Ne.Coronal,a=!i&&t===Ne.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}}#Tc(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 Xc{divId;orientation;colourMap;opacity;fillOpacity;contourThickness;wlPresetName;windowCenter;windowWidth;constructor(e){this.divId=e}}class Wc{options;constructor(e){this.options=e}}class $c{dataViewConfigs;tools;binders;viewOnFirstLoadItem;defaultCharacterSet;overlayConfig;rootDocument;constructor(e){this.dataViewConfigs=e}}class jc extends EventTarget{#Ei=null;#Ya=null;#gc=null;#Pc=null;#ya=null;#Ac=null;#Ka=new zt;#la={};getDataController(){return this.#Ya}getData(e){return s.debug("App.getData: deprecated since v0.37, please use via app.getDataController."),this.#Ya.get(e)}getImage(e){let t;return s.debug("App.getImage: deprecated since v0.34, please use the getData method."),void 0!==this.#Ya.get(e)&&(t=this.#Ya.get(e).image),t}setImage(e,t){s.debug("App.setImage: deprecated since v0.37, please use via app.getDataController."),this.#Ya.setImage(e,t)}getNextDataId(){return s.debug("App.getNextDataId: deprecated since v0.37, please use via app.getDataController."),this.#Ya.getNextDataId()}addData(e,t){return s.debug("App.addData: deprecated since v0.37, please use via app.getDataController."),this.#Ya.add(e,t)}getMetaData(e){let t;return s.debug("App.getMetaData: deprecated since v0.37, please use via app.getDataController."),void 0!==this.#Ya.get(e)&&(t=this.#Ya.get(e).meta),t}getDataIds(){return s.debug("App.getDataIds: deprecated since v0.37, please use via app.getDataController."),this.#Ya.getDataIds()}getDataIdsFromSopUids(e){return s.debug("App.getDataIdsFromSopUids: deprecated since v0.37, please use via app.getDataController."),this.#Ya.getDataIdsFromSopUids(e)}getDataIdFromSeriesUid(e){return s.debug("App.getDataIdFromSeriesUid: deprecated since v0.37, please use via app.getDataController."),this.#Ya.getDataIdFromSeriesUid(e)}canScroll(){return s.debug("App.canScroll: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#ya.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()}canWindowLevel(){return s.debug("App.canWindowLevel: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#ya.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()}getAddedScale(){return s.debug("App.getAddedScale: deprecated since v0.37, please access from the active layer group."),this.#ya.getAddedScale()}getBaseScale(){return s.debug("App.getBaseScale: deprecated since v0.37, please access from the active layer group."),this.#ya.getBaseScale()}getOffset(){return s.debug("App.getOffset: deprecated since v0.37, please access from the active layer group."),this.#ya.getOffset()}getToolboxController(){return this.#gc}getStageController(){return this.#ya}getUndoController(){return this.#Ac}getActiveLayerGroup(){return s.debug("App.getActiveLayerGroup: deprecated since v0.37, use app.getStageController().getActiveLayerGroup()"),this.#ya.getActiveLayerGroup()}setActiveLayerGroup(e){s.debug("App.setActiveLayerGroup: deprecated since v0.37, use app.getStageController().setActiveLayerGroup()"),this.#ya.setActiveLayerGroup(e)}getViewLayersByDataId(e){return s.debug("App.getViewLayersByDataId: deprecated since v0.37, use app.getStageController().getViewLayersByDataId()"),this.#ya.getViewLayersByDataId(e)}getViewLayers(e){return s.debug("App.getViewLayers: deprecated since v0.37, use app.getStageController().getViewLayers()"),this.#ya.getViewLayers(e)}getDrawLayersByDataId(e){return s.debug("App.getDrawLayersByDataId: deprecated since v0.37, use app.getStageController().getDrawLayersByDataId()"),this.#ya.getDrawLayersByDataId(e)}getDrawLayers(e){return s.debug("App.getDrawLayers: deprecated since v0.37, use app.getStageController().getDrawLayers()"),this.#ya.getDrawLayers(e)}getLayerGroupByDivId(e){return s.debug("App.getLayerGroupByDivId: deprecated since v0.37, use app.getStageController().getLayerGroupByDivId()"),this.#ya.getLayerGroupByDivId(e)}getNumberOfLayerGroups(){return s.debug("App.getNumberOfLayerGroups: deprecated since v0.37, use app.getStageController().getNumberOfLayerGroups()"),this.#ya.getNumberOfLayerGroups()}getStyle(){return this.#Ka}addToUndoStack=e=>{s.debug("App.addToUndoStack: deprecated since v0.37, please use via app.getUndoController."),null!==this.#Ac&&this.#Ac.addToUndoStack(e)};removeFromUndoStack=e=>{s.debug("App.removeFromUndoStack: deprecated since v0.37, please use via app.getUndoController.");let t=!1;return null!==this.#Ac&&(t=this.#Ac.removeFromUndoStack(e)),t};init(e){this.#Ei=e,void 0===this.#Ei.viewOnFirstLoadItem&&(this.#Ei.viewOnFirstLoadItem=!0),void 0===this.#Ei.dataViewConfigs&&(this.#Ei.dataViewConfigs={}),void 0===this.#Ei.rootDocument&&"undefined"!=typeof document&&(this.#Ei.rootDocument=document),this.#Pc=new Xs(this.#Ei.defaultCharacterSet),this.#Pc.addEventListener("loadstart",this.#Oc),this.#Pc.addEventListener("loaditem",this.#bc),this.#Pc.addEventListener("load",this.#xc);for(const e of Ys)"loadstart"!==e&&"loaditem"!==e&&"load"!==e&&this.#Pc.addEventListener(e,this.#Pr);this.#Ya=new Os;for(const e of Ts)this.#Ya.addEventListener(e,this.#Pr);for(const e of At)this.#Ya.addEventListener(e,this.#Pr);for(const e of bt)this.#Ya.addEventListener(e,this.#Pr);this.#Ac=new $s;for(const e of Ws)this.#Ac.addEventListener(e,this.#Pr);this.#ya=new Yc(this.#Ya,this.#Ei),this.#ya.setAddToUndoStack(e=>this.#Ac.addToUndoStack(e)),this.#ya.setGetInfoData(e=>this.getInfoData(e));for(const e of Hc)this.#ya.addEventListener(e,this.#Pr);if(void 0!==this.#Ei.tools){const e={},t=Object.keys(this.#Ei.tools);for(let n=0;n<t.length;++n){const i=t[n];let o=kc[i];if(void 0===o&&(o=Bc[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.#Pr)}const t=this.#Ei.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=ka[l];void 0!==u&&(c=u[a]),void 0===c&&(u=Ga[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.#gc=new tn(e),this.#ya.setToolboxController(this.#gc)}}reset(){this.#ya.empty(),this.#la={},this.#Ac&&this.#Ac.reset()}resetLayout(){s.debug("App.resetLayout: deprecated since v0.35, prefer resetZoomPan."),this.#ya.resetLayout()}resetZoomPan(){s.debug("App.resetZoomPan: deprecated since v0.37, use app.getStageController().resetZoomPan()"),this.#ya.resetZoomPan()}resetViews(){s.debug("App.resetViews: deprecated since v0.37, use app.getStageController().resetViews()"),this.#ya.resetViews()}loadFiles=e=>{if(0===e.length)return s.warn("Ignoring empty input file list."),"-1";const t=this.#Ya.getNextDataId();return this.#Pc.loadFiles(e,t),t};loadURLs=(e,t)=>{if(0===e.length)return s.warn("Ignoring empty input url list."),"-1";const n=this.#Ya.getNextDataId();return this.#Pc.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=Yt(e);n&&void 0!==n.input&&function(e,t,n){e.type&&"manifest"===e.type?jt(e.input,e.nslices,t):t($t(e.input,e.dwvReplaceMode),n)}(n,this.loadURLs,t)};loadImageObject=e=>{const t=this.#Ya.getNextDataId();return this.#Pc.loadImageObject(e,t),t};abortAllLoads(){const e=this.#Pc.getLoadingDataIds();for(const t of e)this.abortLoad(t)}abortLoad(e){this.#Pc.abort(e),this.#Ya.remove(e),this.#ya.removeLayersByDataId(e)}fitToContainer(){s.debug("App.fitToContainer: deprecated since v0.37, use app.getStageController().fitToContainer()"),this.#ya.fitToContainer()}initWLDisplay(){s.debug("App.initWLDisplay: deprecated since v0.33, please set the opacity of the desired view layer directly."),this.#ya.getActiveLayerGroup().getActiveViewLayer().getViewController().initialise()}setImageSmoothing(e){s.debug("App.setImageSmoothing: deprecated since v0.37, use app.getStageController().setImageSmoothing()"),this.#ya.setImageSmoothing(e)}getViewConfigs(e,t){return s.debug("App.getViewConfigs: deprecated since v0.37, use app.getStageController().getViewConfigs()"),this.#ya.getViewConfigs(e,t)}getViewConfig(e,t,n){return s.debug("App.getViewConfig: deprecated since v0.37, use app.getStageController().getViewConfig()"),this.#ya.getViewConfig(e,t,n)}getDataViewConfigs(){return s.debug("App.getDataViewConfigs: deprecated since v0.37, use app.getStageController().getDataViewConfigs()"),this.#ya.getDataViewConfigs()}setDataViewConfigs(e){s.debug("App.setDataViewConfigs: deprecated since v0.37, use app.getStageController().setDataViewConfigs()"),this.#ya.setDataViewConfigs(e)}addDataViewConfig(e,t,n){s.debug("App.addDataViewConfig: deprecated since v0.37, use app.getStageController().addDataViewConfig()"),this.#ya.addDataViewConfig(e,t,n)}removeDataViewConfig(e,t){s.debug("App.removeDataViewConfig: deprecated since v0.37, use app.getStageController().removeDataViewConfig()"),this.#ya.removeDataViewConfig(e,t)}updateDataViewConfig(e,t,n){s.debug("App.updateDataViewConfig: deprecated since v0.37, use app.getStageController().updateDataViewConfig()"),this.#ya.updateDataViewConfig(e,t,n)}setLayerGroupsBinders(e){const t=[];for(let n=0;n<e.length;++n)void 0!==Gc[e[n]]&&t.push(new Gc[e[n]]);this.#ya.setBinders(t)}render(e,t){s.debug("App.render: deprecated since v0.37, use app.getStageController().render()"),this.#ya.render(e,t)}zoom(e,t,n){s.debug("App.zoom: deprecated since v0.37, please access from the active layer group."),this.#ya.zoom(e,t,n)}translate(e,t){s.debug("App.translate: deprecated since v0.37, please access from the active layer group."),this.#ya.translate(e,t)}resampleMatch(e,t){const n=this.#Ya.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.#Ya.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.#Ya.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.#Ei.dataViewConfigs,o=n.image.getMeta(),r=this.#Ya.getDataIds();for(let e=0;e<r.length;e++){const t=this.#Ya.get(r[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===o.SeriesInstanceUID&&this.#Ya.stash(r[e])}const a=this.getStageController();a.setDataViewConfigs(i);const l=this.#Ya.getDataIds();for(let e=0;e<l.length;++e)a.render(l[e])}revertResample(e){const t=this.#Ya.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.#Ei.dataViewConfigs,i=t.image.getMeta(),o=this.#Ya.getStashedDataIds();for(let e=0;e<o.length;e++){const t=this.#Ya.getStashed(o[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===i.SeriesInstanceUID&&this.#Ya.unstash(o[e])}const r=this.getStageController();r.setDataViewConfigs(n);const a=this.#Ya.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.#ya.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.#ya.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.#Ac.redo();else if("z"===e.key)this.#Ac.undo();else if(" "===e.key){const e=this.#ya.getNumberOfLayerGroups();for(let t=0;t<e;++t)this.#ya.getLayerGroup(t).setShowCrosshair(!this.#ya.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.#ya.getActiveLayerGroup().getActiveViewLayer().getViewController().setColourMap(e)}setWindowLevelPreset(e){s.debug("App.setWindowLevelPreset: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#ya.getActiveLayerGroup().getActiveViewLayer().getViewController().setWindowLevelPreset(e)}setTool(e){for(let e=0;e<this.#ya.getNumberOfLayerGroups();++e){const t=this.#ya.getLayerGroup(e),n=t.getActiveLayer();void 0!==n&&this.#gc.bindLayerGroup(t,n)}this.#gc.setSelectedTool(e)}setToolFeatures(e){this.#gc.setToolFeatures(e)}undo(){s.debug("App.undo: deprecated since v0.37, please use via app.getUndoController."),this.#Ac.undo()}redo(){s.debug("App.redo: deprecated since v0.37, please use via app.getUndoController."),this.#Ac.redo()}getStackSize(){return s.debug("App.getStackSize: deprecated since v0.37, please use via app.getUndoController."),this.#Ac.getStackSize()}getCurrentStackIndex(){return s.debug("App.getCurrentStackIndex: deprecated since v0.37, please use via app.getUndoController."),this.#Ac.getCurrentStackIndex()}getInfoData(e){let t;return void 0!==this.#la&&(t=this.#la[e]),t}toggleInfoDataListeners(e){const t=this.getInfoData(e);void 0!==t&&(t.isListening()?t.removeAppListeners():t.addAppListeners())}createAnnotationData(e){const t=this.#Ya.get(e).image.getMeta(),n=new Ps({});n.annotationGroup=new xt,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.#Ya,o=i.getNextDataId();if(!i.add(o,e))throw new Error("Cannot add annotation data");const r=this.#ya.getViewConfigs(n).find(e=>e.divId===t);if(void 0===r)throw new Error("No reference data view config for draw");const a=new Xc(t);a.orientation=r.orientation,this.#ya.addDataViewConfig(o,a),this.#ya.render(o)}#Pr=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#Oc=e=>{void 0!==this.#Ei.overlayConfig&&0===Object.keys(this.#la).length&&(this.#la[e.detail.dataid]=new Js(this,e.detail.dataid,this.#Ei.overlayConfig)),this.#Pr(e)};#bc=e=>{void 0===e.detail.data&&s.error("Missing loaditem event data."),void 0===e.detail.loadtype&&s.error("Missing loaditem event load type.");const t=e.detail.isfirstitem;if("image"===e.detail.loadtype)try{t?this.#Ya.add(e.detail.dataid,e.detail.data):this.#Ya.update(e.detail.dataid,e.detail.data)}catch(t){return this.dispatchEvent(new CustomEvent("error",{detail:{dataid:e.detail.dataid,loadtype:e.detail.loadtype,source:e.detail.source,error:t}})),this.abortLoad(e.detail.dataid),void this.dispatchEvent(new CustomEvent("loadend",{detail:{dataid:e.detail.dataid,loadtype:e.detail.loadtype,source:e.detail.source}}))}this.#Pr(e),void 0!==this.#la&&void 0!==this.#la[e.detail.dataid]&&this.#la[e.detail.dataid].addItemMeta(e.detail.data.meta),"image"===e.detail.loadtype&&0!==this.#ya.getViewConfigs(e.detail.dataid).length&&t&&this.#Ei.viewOnFirstLoadItem&&this.#ya.render(e.detail.dataid)};#xc=e=>{const t=this.#Ya.markDataAsComplete(e.detail.dataid);this.#Ei.viewOnFirstLoadItem&&void 0!==t.imageHasChanged&&t.imageHasChanged&&this.#ya.render(e.detail.dataid),this.#Pr(e)}}class Zc{#_s;#Lt;constructor(e){this.#_s=e;const t=e.getMeta();void 0===t.custom&&(t.custom={}),void 0===t.custom.segments&&(t.custom.segments=[]),this.#Lt=t.custom.segments}getMask(){return this.#_s}#Ec(e){return this.#Lt.findIndex(function(t){return t.number===e})}hasSegment(e){return-1!==this.#Ec(e)}getNumberOfSegments(){return this.#Lt.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.#_s.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.#Ec(e);return-1!==n&&(t=this.#Lt[n]),t}addSegment(e){-1===this.#Ec(e.number)?(this.#Lt.push(e),void 0!==e.displayRGBValue&&this.#_s.updatePaletteColourMap(e.number,e.displayRGBValue)):s.warn(`Not adding segment, it is allready in the segments list: ${e.number}`)}removeSegment(e){const t=this.#Ec(e);-1!==t?this.#Lt.splice(t,1):s.warn(`Cannot remove segment, it is not in the segments list: ${e}`)}updateSegment(e){const t=this.#Ec(e.number);-1!==t?this.#Lt[t]=e:s.warn(`Cannot update segment, it is not in the segments list: ${e.number}`)}findOverlap(e){const t=this.#_s.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.#_s.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 _c extends Ma{#_s;#Rc;#il;#Fc;constructor(e,t,n){super(),this.#_s=e,this.#Rc=t,this.#il=void 0!==n&&n,void 0!==t.displayRGBValue?this.#Fc=e.getOffsets(t.number):this.#Fc=e.getOffsets(t.displayValue)}getName(){return"Delete-segment"}isValid(){return this.#_s.getMeta().custom.segments.some(e=>e.number===this.#Rc.number)}execute(){if(0!==this.#Fc.length){const e=this.#_s.getSegmentCollection(),t=this.#Rc.number,n=this.#Fc.map(function(n){return e?.getOtherValueAtOffset(n,t)??0});this.#_s.setAtOffsetsWithValues(this.#Fc,n)}new Zc(this.#_s).removeSegment(this.#Rc.number),this.#il||this.onExecute({type:"masksegmentdelete",segmentnumber:this.#Rc.number})}undo(){0!==this.#Fc.length&&(void 0!==this.#Rc.displayRGBValue?this.#_s.setAtOffsets(this.#Fc,this.#Rc.number):this.#_s.setAtOffsets(this.#Fc,this.#Rc.displayValue)),new Zc(this.#_s).addSegment(this.#Rc),this.onUndo({type:"masksegmentredraw",segmentnumber:this.#Rc.number})}onExecute(e){}onUndo(e){}}class Kc extends Ma{#_s;#Rc;#Mc;#qc;#il;#Fc;constructor(e,t,n,i){super(),this.#_s=e,this.#Rc=t,this.#Mc=n,this.#il=void 0!==i&&i,void 0!==t.displayRGBValue?this.#qc=t.displayRGBValue:(this.#qc=t.displayValue,this.#Fc=e.getOffsets(this.#qc))}getName(){return"Change-segment-colour"}isValid(){let e=!0;return void 0!==this.#Fc&&(e=0!==this.#Fc.length),e}execute(){"number"==typeof this.#Mc?(this.#_s.setAtOffsets(this.#Fc,this.#Mc),this.#Rc.displayValue=this.#Mc):(this.#_s.updatePaletteColourMap(this.#Rc.number,this.#Mc),this.#Rc.displayRGBValue=this.#Mc),this.#il||this.onExecute({type:"changemasksegmentcolour",segmentnumber:this.#Rc.number,value:[this.#Mc]})}undo(){"number"==typeof this.#qc?(this.#_s.setAtOffsets(this.#Fc,this.#qc),this.#Rc.displayValue=this.#qc):(this.#_s.updatePaletteColourMap(this.#Rc.number,this.#qc),this.#Rc.displayRGBValue=this.#qc),this.onUndo({type:"changemasksegmentcolour",segmentnumber:this.#Rc.number,value:[this.#qc]})}onExecute(e){}onUndo(e){}}class Jc{diameter;offset1;offset2}class eu{major;minor}class tu{centroid;centroidIndex;volume;count;diameters;height;id;largestSliceZ}class nu{x;y}class iu{x;y;z}export{is as Annotation,xt as AnnotationGroup,as as AnnotationGroupFactory,jc as App,$c as AppOptions,l as BooleanResult,rs as CADReport,Kc as ChangeSegmentColourCommand,hr as Circle,Co as ColourMap,Ma as Command,Os as DataController,le as DataElement,_c as DeleteSegmentCommand,Jc as Diameter,eu as Diameters,Pn as DicomCode,Ps as DicomData,Re as DicomParser,na as DicomSRContent,es as DicomWriter,oc as DrawBrushCommand,ic as DrawBrushCommandProperties,Il as DrawController,wl as DrawLayer,nc as DrawShapeHandler,gr as Ellipse,St as Geometry,Ot as Image,ho as ImageContour,a as Index,Js as InfoData,js as InfoDataItem,tu as Label,xl as LayerGroup,Lo as MaskFactory,po as MaskImage,mi as MaskSegment,Zc as MaskSegmentHelper,cl as MaskSegmentViewHelper,qe as Matrix33,Ri as NormalisedManufacturers,u as NumberRange,c as NumberValue,Ne as Orientation,Sl as PlaneHelper,D as Point,m as Point2D,f as Point3D,ml as PositionHelper,ur as Protractor,Et as RGB,dr as ROI,cs as RTROI,ls as RTROIContour,pr as Rectangle,Fe as RescaleSlopeAndIntercept,os as ResponseEvaluation,ws as RtStructFactory,Ua as RunFilterCommand,nu as Scalar2D,iu as Scalar3D,il as ScrollWheelBehavior,So as SegmentCollection,ut as Size,Xe as Spacing,Yc as StageController,M as Tag,oe as TagInfo,Wc as ToolConfig,tn as ToolboxController,$s as UndoController,p as Vector3D,hl as View,Xc as ViewConfig,fl as ViewController,vl as ViewLayer,nl as WheelBehavior,Tt as WindowLevel,Oo as WindowPreset,Ya as WriterRule,W as addTagsToDictionary,vs as bufferToPolygons,F as buildMultipart,Me as custom,kc as defaultToolList,Ga as defaultToolOptions,Uo as demoCreateImage,Ao as demoCreateMaskImage,dl as demoCreateView,Lt as equalWl,Cn as getAsSimpleTagValues,gs as getDefaultDicomRTStructJson,To as getDefaultDicomSegJson,oa as getDicomSRContentItem,ae as getDicomTagGroupName,re as getDicomTagInfo,pe as getDwvVersion,yn as getElementsFromSimpleTagValues,Sr as getEllipseIndices,Ol as getLayerDetailsFromEvent,Fi as getManufacturer,Jt as getMousePoint,Mi as getNormalisedManufacturer,ze as getOrientationName,G as getPixelDataTag,us as getRTStructFromElements,mr as getRectangleIndices,tt as getReferencedSeriesUID,nt as getReferencedSeriesUIDFromRTStruct,ye as getReverseOrientation,ia as getSRContent,oi as getSegmentationCode,U as getTagFromKey,Kt as getTouchPoints,Oe as getTypedArray,Wa as getUID,Xt as getURLsFromKeyValueUri,Wt as handleURLsFromWeasisXMLManifest,ve as hasDicomPrefix,Mt as hexToRgb,y as i18n,Rt as isEqualRgb,Qt as labToUintLab,s as logger,Do as luts,Po as mergeMaskImages,Dn as mergeTagValues,S as precisionRound,qt as rgbToHex,Ds as simplifyPolygon,Bt as srgbToCielab,Bc as toolList,ka as toolOptions};
|
|
2
2
|
//# sourceMappingURL=dwv.node.min.js.map
|