dwv 0.37.0-beta.12 → 0.37.0-beta.13

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/dwv.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";class i{#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 i(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 i(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 i(n)}}const o={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 r{success;message;constructor(e){this.success=e}}Number.EPSILON;class a{value;unit}class s{min;max;constructor(e,t){this.min=e,this.max=t}}function l(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)<n}function c(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,a=new r(o);return o||(a.message=`${d(i,2)}`),a}(e-t,n,i)}function u(e){let t=e>1e-4;return t&&(t=e>.001,t?(t=e>.01,t||o.warn("Using larger+ real world epsilon")):o.warn("Using larger real world epsilon")),t}function d(e,t){const n=Math.pow(10,t),i=.01/n;return Math.round(e*n+i)/n}class h{#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 h(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 g{#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 S{#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&&l(this.#n,e.getX(),t)&&l(this.#i,e.getY(),t)&&l(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 h(this.#n-e.getX(),this.#i-e.getY(),this.#o-e.getZ())}}function p(e){return new S(e[0],e[1],e[2])}class m{#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 S(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 m(t)}mergeWith3D(e){const t=this.getValues();return t[0]=e.getX(),t[1]=e.getY(),t[2]=e.getZ(),new m(t)}}const f={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 v(e,t){return null!=e&&null!=t&&e.substring(e.length-t.length)===t}function C(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 D(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 y(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 I(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 w(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 T(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&L(e.slice().sort(),t.slice().sort())}function L(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 P(e){return String.fromCharCode(...e)}function A(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 O(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 b(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=y(a);o.push(l),i+=l.byteLength+e[r].data.byteLength}const r=y(`${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 x{#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 E(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 R(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 x(e.substring(0,4),e.substring(4,8))}function F(){return new x("FFFE","E000")}function M(e){return"FFFEE000"===e.getKey()}function q(e){return"FFFEE00D"===e.getKey()}function U(e){return"FFFEE0DD"===e.getKey()}function Q(){return new x("7FE0","0010")}function V(e){return["7FE00010","7FE00009","7FE00008"].includes(e.getKey())}function N(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 B(e){return void 0!==N(e)}const k=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 G(e,t){k[e]=t}const z={"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"},H={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 Y(e){return void 0!==H[e]}const X={SH:!0,LO:!0,UC:!0,ST:!0,LT:!0,UT:!0,PN:!0};function W(e){return void 0!==X[e]}const $={AE:"string",AS:"string",AT:void 0,CS:"string",DA:"string",DS:"string",DT:"string",FL:"Float32",FD:"Float64",IS:"string",LO:"string",LT:"string",OB:"Uint8",OD:"Uint64",OF:"Uint32",OL:"Uint32",OV:"Uint64",OW:"Uint16",PN:"string",SH:"string",SL:"Int32",SQ:void 0,SS:"Int16",ST:"string",SV:"Int64",TM:"string",UC:"string",UI:"string",UL:"Uint32",UN:"Uint8",UR:"string",US:"Uint16",UT:"string",UV:"Uint64"},j={"1.2.840.10008.1.2":"Implicit VR Little Endian","1.2.840.10008.1.2.1":"Explicit VR Little Endian","1.2.840.10008.1.2.1.98":"Encapsulated Uncompressed Explicit VR Little Endian","1.2.840.10008.1.2.1.99":"Deflated Explicit VR Little Endian","1.2.840.10008.1.2.2":"Explicit VR Big Endian (Retired)","1.2.840.10008.1.2.4.50":"JPEG Baseline (Process 1)","1.2.840.10008.1.2.4.51":"JPEG Extended (Process 2 & 4)","1.2.840.10008.1.2.4.52":"JPEG Extended (Process 3 & 5) (Retired)","1.2.840.10008.1.2.4.53":"JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8) (Retired)","1.2.840.10008.1.2.4.54":"JPEG Spectral Selection, Non-Hierarchical (Process 7 & 9) (Retired)","1.2.840.10008.1.2.4.55":"JPEG Full Progression, Non-Hierarchical (Process 10 & 12) (Retired)","1.2.840.10008.1.2.4.56":"JPEG Full Progression, Non-Hierarchical (Process 11 & 13) (Retired)","1.2.840.10008.1.2.4.57":"JPEG Lossless, Non-Hierarchical (Process 14)","1.2.840.10008.1.2.4.58":"JPEG Lossless, Non-Hierarchical (Process 15) (Retired)","1.2.840.10008.1.2.4.59":"JPEG Extended, Hierarchical (Process 16 & 18) (Retired)","1.2.840.10008.1.2.4.60":"JPEG Extended, Hierarchical (Process 17 & 19) (Retired)","1.2.840.10008.1.2.4.61":"JPEG Spectral Selection, Hierarchical (Process 20 & 22) (Retired)","1.2.840.10008.1.2.4.62":"JPEG Spectral Selection, Hierarchical (Process 21 & 23) (Retired)","1.2.840.10008.1.2.4.63":"JPEG Full Progression, Hierarchical (Process 24 & 26) (Retired)","1.2.840.10008.1.2.4.64":"JPEG Full Progression, Hierarchical (Process 25 & 27) (Retired)","1.2.840.10008.1.2.4.65":"JPEG Lossless, Hierarchical (Process 28) (Retired)","1.2.840.10008.1.2.4.66":"JPEG Lossless, Hierarchical (Process 29) (Retired)","1.2.840.10008.1.2.4.70":"JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])","1.2.840.10008.1.2.4.80":"JPEG-LS Lossless Image Compression","1.2.840.10008.1.2.4.81":"JPEG-LS Lossy (Near-Lossless) Image Compression","1.2.840.10008.1.2.4.90":"JPEG 2000 Image Compression (Lossless Only)","1.2.840.10008.1.2.4.91":"JPEG 2000 Image Compression","1.2.840.10008.1.2.4.92":"JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)","1.2.840.10008.1.2.4.93":"JPEG 2000 Part 2 Multi-component Image Compression","1.2.840.10008.1.2.4.94":"JPIP Referenced","1.2.840.10008.1.2.4.95":"JPIP Referenced Deflate","1.2.840.10008.1.2.4.100":"MPEG2 Main Profile / Main Level","1.2.840.10008.1.2.4.101":"MPEG2 Main Profile / High Level","1.2.840.10008.1.2.4.102":"MPEG-4 AVC/H.264 High Profile / Level 4.1","1.2.840.10008.1.2.4.103":"MPEG-4 AVC/H.264 BD-compatible High Profile / Level 4.1","1.2.840.10008.1.2.4.104":"MPEG-4 AVC/H.264 High Profile / Level 4.2 For 2D Video","1.2.840.10008.1.2.4.105":"MPEG-4 AVC/H.264 High Profile / Level 4.2 For 3D Video","1.2.840.10008.1.2.4.106":"MPEG-4 AVC/H.264 Stereo High Profile / Level 4.2","1.2.840.10008.1.2.4.107":"HEVC/H.265 Main Profile / Level 5.1","1.2.840.10008.1.2.4.108":"HEVC/H.265 Main 10 Profile / Level 5.1","1.2.840.10008.1.2.5":"RLE Lossless","1.2.840.10008.1.2.6.1":"RFC 2557 MIME encapsulation (Retired)","1.2.840.10008.1.2.6.2":"XML Encoding (Retired)","1.2.840.10008.1.2.7.1":"SMPTE ST 2110-20 Uncompressed Progressive Active Video","1.2.840.10008.1.2.7.2":"SMPTE ST 2110-20 Uncompressed Interlaced Active Video","1.2.840.10008.1.2.7.3":"SMPTE ST 2110-30 PCM Digital Audio","1.2.840.10008.1.20":"Papyrus 3 Implicit VR Little Endian (Retired)"},Z="1.2.840.10008.1.2",_="1.2.840.10008.1.2.1",K="1.2.840.10008.1.2.2";class J{#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 ee(e){if(void 0===e)return;let t;const n=e.getGroup(),i=e.getElement();if(void 0!==k[n]&&void 0!==k[n][i]){const e=k[n][i];t=new J(e[0],parseInt(e[1],10),e[2])}return t}function te(e){return z[e.getGroup()]}function ne(e){if(null==e)return;const t=Object.keys(k);for(const n of t){const t=Object.keys(k[n]);for(const i of t)if(k[n][i][2]===e)return new x(n,i)}}class ie{vr;value;tag;vl;undefinedLength;startOffset;endOffset;items;constructor(e){this.vr=e}}function oe(e){return void 0!==e&&void 0!==e.value&&0!==e.value.length}function re(e,t){let n;return oe(e[t])&&(n=e[t].value[0]),n}function ae(e,t){let n;return oe(e[t])&&(n=e[t].value),n}function se(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 le(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 ce{#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&&le(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&&le(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&&le(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&&le(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&&le(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&&le(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&&le(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&&le(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 ue(){return"0.37.0-beta.12"}function de(e){const t=e.split("-");let n=[];for(const e of t)n=n.concat(e.split("."));return n}function he(e,t){let n=0;const i=de(e),o=de(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 ge(e){return!(e.byteLength<132)&&"DICM"===new Uint8Array(e,128,4).reduce((function(e,t){return e+String.fromCharCode(t)}),"")}const Se=String.fromCharCode("u200B");class pe{decode(e){let t="";for(let n=0,i=e.length;n<i;++n)t+=String.fromCharCode(e[n]);return t}}function me(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 fe(e){return e===Z}function ve(e){return e===K}function Ce(e){return"1.2.840.10008.1.2.4.50"===e||"1.2.840.10008.1.2.4.51"===e}function De(e){return"1.2.840.10008.1.2.4.57"===e||"1.2.840.10008.1.2.4.70"===e}function ye(e){return null!==e.match(/1.2.840.10008.1.2.4.9/)}function Ie(e){return"1.2.840.10008.1.2.5"===e}function we(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));o.error(`Cannot allocate array of size: ${n} (>2^${e}).`)}}return i}function Te(e,t){return t?8:Y(e)?12:8}const Le="00280100",Pe="00280103";class Ae{#m={};#f;#v=new pe;#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 re(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 x(n,i),endOffset:t}}#w(e,t,n){const i={};let o=this.#T(e,t,n);if(t=o.endOffset,U(o.tag))return{data:i,endOffset:o.endOffset,isSeqDelim:!0};if(i[o.tag.getKey()]={tag:o.tag,vr:"NONE",vl:o.vl,undefinedLength:o.undefinedLength},o.undefinedLength){let r=!1;for(;!r;)o=this.#T(e,t,n),t=o.endOffset,r=q(o.tag),r||(i[o.tag.getKey()]=o)}else{const r=t;for(t-=o.vl;t<r;)o=this.#T(e,t,n),t=o.endOffset,i[o.tag.getKey()]=o}return{data:i,endOffset:t,isSeqDelim:!1}}#L(e,t,n){const i=[];let o=this.#T(e,t,n);const r=o.vl;t=o.endOffset;let a=!1;for(;!a;)o=this.#T(e,t,n),t=o.endOffset,a=U(o.tag),a||(o.vr="OB",i.push(o));return{data:i,endOffset:t,offsetTableVl:r}}#T(e,t,n,i){const r=this.#I(e,t),a=r.tag;if(void 0!==i&&a.equals(i)){const e=new ie("");return e.tag=a,e}t=r.endOffset;let s,l="NONE",c=!0;a.isWithVR()&&(n?(l=ee(a)?.getVr(),void 0===l&&(l="UN"),c=!0):(l=this.#D(e.readUint8Array(t,2)),t+=2*Uint8Array.BYTES_PER_ELEMENT,c=Y(l),c&&(t+=2*Uint8Array.BYTES_PER_ELEMENT))),function(e){return Object.keys($).concat(["NONE","ox","xx","xs"]).includes(e)}(l)||(o.warn(`Unknown VR: ${l} (for tag ${a.getKey()}), treating as 'UN'`),l="UN"),c?(s=e.readUint32(t),t+=Uint32Array.BYTES_PER_ELEMENT):(s=e.readUint16(t),t+=Uint16Array.BYTES_PER_ELEMENT);let u=!1;4294967295===s&&(u=!0,s=0),a.isPrivate()&&"UN"===l&&0===s&&(l="SQ");let d,h=t,g=h+s;if(V(a)&&u){const i=this.#L(e,t,n);t=i.endOffset,h+=i.offsetTableVl,d=i.data,g=t,s=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,s=t-h}else if(0!==s){const o=t+s;for(;t<o;)i=this.#w(e,t,n),d.push(i.data),t=i.endOffset;g=t,s=t-h}}const S=new ie(l);return S.tag=a,S.vl=s,S.startOffset=h,S.endOffset=g,u&&(S.undefinedLength=u),d&&(S.items=d),S}#P(e,t,n){const i=e.tag,r=e.vl,a=e.vr,s=e.startOffset;let l,c,u;void 0!==n&&(l=n.bitsAllocated,c=n.pixelRepresentation);const d=$[a];if(V(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"===a&&(o.warn("Reading DICOM pixel data with bitsAllocated>8 and OB VR, treating as OW"),e.vr="OW"),u=[],1===l)u.push(t.readBinaryArray(s,r,n.imageBufferSize));else if(8===l)0===c?u.push(t.readUint8Array(s,r)):u.push(t.readInt8Array(s,r));else if(16===l)0===c?u.push(t.readUint16Array(s,r)):u.push(t.readInt16Array(s,r));else if(32===l)u.push(t.readFloat32Array(s,r));else{if(64!==l)throw new Error(`Unsupported bits allocated: ${l}`);u.push(t.readFloat64Array(s,r))}else if(void 0!==d)if("Uint8"===d)u=t.readUint8Array(s,r);else if("Uint16"===d)u=t.readUint16Array(s,r),"O"!==a[0]&&(u=Array.from(u));else if("Uint32"===d)u=t.readUint32Array(s,r),"O"!==a[0]&&(u=Array.from(u));else if("Uint64"===d)u=t.readUint64Array(s,r);else if("Int16"===d)u=Array.from(t.readInt16Array(s,r));else if("Int32"===d)u=Array.from(t.readInt32Array(s,r));else if("Int64"===d)u=t.readInt64Array(s,r);else if("Float32"===d)u=Array.from(t.readFloat32Array(s,r));else if("Float64"===d)u=Array.from(t.readFloat64Array(s,r));else{if("string"!==d)throw new Error(`Unknown VR type: ${d}`);{const e=t.readUint8Array(s,r);u=W(a)?this.#y(e):this.#D(e),u=function(e){let t=e;const n=e.length-1;return e[n]===Se&&(t=e.substring(0,n)),t=t.trim(),t}(u).split("\\")}}else if("xx"===a)u=Array.from(t.readUint16Array(s,r));else if("ox"===a)u=8===l?0===c?Array.from(t.readUint8Array(s,r)):Array.from(t.readInt8Array(s,r)):0===c?Array.from(t.readUint16Array(s,r)):Array.from(t.readInt16Array(s,r));else if("xs"===a)u=0===c?Array.from(t.readUint16Array(s,r)):Array.from(t.readInt16Array(s,r));else if("AT"===a){const e=t.readUint16Array(s,r);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"===a){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[Le];void 0!==n&&void 0!==n.value&&(a=n.value[0]),n=i[Pe],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"===a||o.warn(`Unknown VR: ${a} (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,r;const a=new ce(e);let s=new ce(e);n=128;const l=this.#D(a.readUint8Array(n,4));if(n+=4*Uint8Array.BYTES_PER_ELEMENT,"DICM"===l){r=this.#T(a,n,!1),r.value=this.#P(r,a),n=r.endOffset,this.#m[r.tag.getKey()]=r;const e=n+r.value[0];for(;n<e;)r=this.#T(a,n,!1),n=r.endOffset,this.#m[r.tag.getKey()]=r;if(r=this.#m["00020010"],void 0===r)throw new Error("Not a valid DICOM file (no TransferSyntaxUID found)");r.value=this.#P(r,a),i=r.value[0]}else{o.warn(`Invalid DICM prefix (${l}), trying to guess tansfer syntax.`),r=this.#T(s,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?Z:_;else{if(a)throw new Error("Not a valid DICOM file (no magic DICM word foundand implicit VR big endian detected)");s=K}const l=new ie("UI");return l.tag=new x("0002","0010"),l.value=[s],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(r);this.#m[e.tag.getKey()]=e,i=e.value[0],n=0}if(!function(e){return e===Z||e===_||e===K||Ce(e)||De(e)||ye(e)||Ie(e)}(i))throw new Error(`Unsupported DICOM transfer syntax: '${i}' (${function(e){let t="Unknown";return void 0!==j[e]&&(t=j[e]),t}(i)})`);let c=!1;fe(i)&&(c=!0),ve(i)&&(s=new ce(e,!1));let u,d=!1;for(;n<e.byteLength;){if(r=this.#T(s,n,c,t),void 0!==t&&r.tag.equals(t)){d=!0;break}n=r.endOffset;const e=r.tag.getKey();void 0===this.#m[e]?this.#m[e]=r:o.warn(`Not saving duplicate tag: ${e}`)}if(isNaN(n))throw new Error("Problem while parsing, bad offset");if(d||e.byteLength===n||o.warn(`Did not reach the end of the buffer: ${n} != ${e.byteLength}`),B(this.#m)){let e=0;r=this.#m[Pe],void 0!==r?(r.value=this.#P(r,s),e=r.value[0]):o.warn("Reading DICOM pixel data with default pixelRepresentation.");let t=16;r=this.#m[Le],void 0!==r?(r.value=this.#P(r,s),t=r.value[0]):o.warn("Reading DICOM pixel data with default bitsAllocated.");let n,i,a=1;r=this.#m["00280008"],void 0!==r&&(r.value=this.#P(r,s),a=parseInt(r.value[0],10)),u={pixelRepresentation:e,bitsAllocated:t,numberOfFrames:a,imageBufferSize:void 0},r=this.#m["00280010"],void 0!==r&&(r.value=this.#P(r,s),n=parseInt(r.value[0],10)),r=this.#m["00280011"],void 0!==r&&(r.value=this.#P(r,s),i=parseInt(r.value[0],10)),void 0!==n&&void 0!==i&&(u.imageBufferSize=n*i*a)}if(void 0!==this.#f&&this.setDecoderCharacterSet(this.#f),r=this.#m["00080005"],void 0!==r){let e;r.value=this.#P(r,s),1===r.value.length?e=r.value[0]:(e=r.value[1],o.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,s,u),r=this.#m["7FE00010"],void 0!==r&&r.undefinedLength){const e=u.numberOfFrames,t=r.value;if(t.length>1&&t.length>e){const n=t.length/e,i=[];let o;for(let r=0;r<e;++r){o=r*n;let e=0;for(let i=0;i<n;++i)e+=t[o+i].length;const a=new t[0].constructor(e);let s=0;for(let e=0;e<n;++e)a.set(t[o+e],s),s+=t[o+e].length;i[r]=a}r.value=i}}}}function Oe(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 be(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function xe(e,t,n,o){const r=e.getGeometry().getSize();let a=2;o&&void 0!==o&&(a=o.getColAbsMax(2).index);const s=t.getValues(),l=new i(s.map((function(e,t){return t===a||t>2?e:0})));let c,u=r.indexToOffset(l);void 0===n&&(n=!1),c=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const d=r.get(0),h=r.get(1),g=r.get(2);let S=r.getDimSize(2);const p=e.getNumberOfComponents(),m=1===e.getPlanarConfiguration(),f=function(e,t,n,i,o,r,a,s){return 1===p?Oe(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(Oe(e,t,n,i,o,r,a,s)),c.push(Oe(e,t+n*i,n,i,o,r,a,s)),c.push(Oe(e,t+2*n*i,n,i,o,r,a,s))):(i*=3,r*=3,c.push(Oe(e,t,n,i,o,r,a,s)),c.push(Oe(e,t+1,n,i,o,r,a,s)),c.push(Oe(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(o&&void 0!==o){const e=o.getColAbsMax(0),t=o.getColAbsMax(2),n=!1,i=!1;if(2===t.index){const t=d*h;v=0===e.index?f(c,u,t,1,d,d,n,i):f(c,u,t,d,h,1,n,i)}else if(0===t.index){const t=g*h;v=1===e.index?f(c,u,t,d,h,S,n,i):f(c,u,t,S,g,d,n,i)}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,i):f(c,u,t,S,g,1,n,i)}}}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 Ee(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 Re{#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 Fe={linear:"LINEAR",linear_exact:"LINEAR_EXACT",sigmoid:"SIGMOID"};class Me{#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 qe{#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 Ue{#U;#Q=0;#V;#N=Fe.linear;constructor(e,t){if(this.#U=e,void 0!==t){const e=[];for(const t in Fe)e.push(Fe[t]);e.includes(t)?this.#N=t:o.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.#Q;this.#N===Fe.linear_exact?this.#V=new Me(n,t,!0):this.#N===Fe.sigmoid?this.#V=new qe(n,t):this.#V=new Me(n,t)}setSignedOffset(e){this.#Q=e,this.#B()}apply(e){return this.#V.getY(e)}}class Qe{center;width;constructor(e,t){this.center=e,this.width=t}}function Ve(e,t){return null!=e&&null!=t&&e.center===t.center&&e.width===t.width}function Ne(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!==Fe.linear_exact&&n!==Fe.sigmoid||(o=0);let r=e.width;return r=Math.max(r,o),r=Math.min(r,t.max-t.min),new Qe(i,r)}class Be{name;wl;perslice;constructor(e,t,n){this.name=e,this.wl=t,this.perslice=n}}function ke(e){const t=[];for(let n=0;n<256;++n)t.push(e(n));return t}function Ge(e){return e}function ze(e){return 255-e}class He{red;green;blue;constructor(e,t,n){this.red=e,this.green=t,this.blue=n}}const Ye={plain:{red:ke(Ge),green:ke(Ge),blue:ke(Ge)},invPlain:{red:ke(ze),green:ke(ze),blue:ke(ze)},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:ke((function(e){const t=3*e;return t>255?255:t})),green:ke((function(e){const t=256/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n})),blue:ke((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]}},Xe={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 We{#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),r=e.get(1,0),a=e.get(1,1),s=e.get(1,2),l=e.get(2,0),c=e.get(2,1),u=e.get(2,2),d=a*u-s*c,h=s*l-r*u,g=r*c-a*l;let S=t*d+n*h+i*g;if(0!==S)return S=1/S,new We([S*d,S*(i*c-n*u),S*(n*s-i*a),S*h,S*(t*u-i*l),S*(i*r-t*s),S*g,S*(n*l-t*c),S*(t*a-n*r)]);o.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(!l(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=c(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&&o.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 We(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 We(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 h(t[0],t[1],t[2])}multiplyPoint3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new S(t[0],t[1],t[2])}multiplyIndex3D(e){const t=this.multiplyArray3D(e.getValues());return new i(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 We(e)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}getValues(){return this.#e.slice()}}function $e(){return new We([1,0,0,0,1,0,0,0,1])}function je(e){return e.equals($e())}function Ze(){return new We([1,0,0,0,0,1,0,-1,0])}const _e={Axial:"axial",Coronal:"coronal",Sagittal:"sagittal"};function Ke(e){let t;return e===_e.Axial?t=$e():e===_e.Coronal?t=Ze():e===_e.Sagittal&&(t=new We([0,0,-1,1,0,0,0,-1,0])),t}function Je(e){const t=new h(e.get(0,0),e.get(1,0),e.get(2,0)),n=new h(e.get(0,1),e.get(1,1),e.get(2,1)),i=new h(e.get(0,2),e.get(1,2),e.get(2,2));return et(t)+et(n)+et(i)}function et(e){let t=new h(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 h(0,t.getY(),t.getZ());else if(t.getY()>a&&t.getY()>t.getX()&&t.getY()>t.getZ())n+=o,t=new h(t.getX(),0,t.getZ());else{if(!(t.getZ()>a&&t.getZ()>t.getX()&&t.getZ()>t.getY()))break;n+=r,t=new h(t.getX(),t.getY(),0)}return n}function tt(e){let t;const n=nt(e);return void 0!==n&&(t=function(e){let t;return["LPS","LAI","RPI","RAS","ALS","ARI","PLI","PRS"].includes(e)?t=_e.Axial:["LSA","LIP","RSP","RIA","ILA","IRP","SLP","SRA"].includes(e)?t=_e.Coronal:["PSL","PIR","ASR","AIL","IAR","IPL","SAL","SPR"].includes(e)&&(t=_e.Sagittal),t}(Je(n.asOneAndZeros()))),t}function nt(e){let t;if(void 0!==e&&6===e.length){const n=new h(e[0],e[1],e[2]),i=new h(e[3],e[4],e[5]),o=n.crossProduct(i);t=new We([n.getX(),i.getX(),o.getX(),n.getY(),i.getY(),o.getY(),n.getZ(),i.getZ(),o.getZ()])}return t}function it(e,t){let n=$e();return void 0!==t&&(n=e.asOneAndZeros().getInverse().multiply(t)),n.getAbs()}class ot{#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 rt={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 at(e){let t;const n=re(e,rt.Rows),i=re(e,rt.Columns);return void 0!==n&&void 0!==i&&(t=[i,n]),t}function st(e,t){let n;const i=ae(e,t);return void 0!==i&&2===i.length&&(n=[parseFloat(i[1]),parseFloat(i[0])]),n}function lt(e){let t;const n=ae(e,rt.PixelMeasuresSequence);return void 0!==n&&(t=st(n[0],rt.PixelSpacing)),t}function ct(e){let t=st(e,rt.PixelSpacing);return void 0===t&&(t=function(e){let t=st(e,rt.ImagerPixelSpacing);if(void 0!==t){let n;const i=parseFloat(re(e,rt.EstimatedRadiographicMagnificationFactor));if(isNaN(i)){const t=parseFloat(re(e,rt.DistanceSourceToDetector)),i=parseFloat(re(e,rt.DistanceSourceToPatient));isNaN(t)||isNaN(i)||0===i||(n=t/i)}else n=i;void 0!==n?(t=t.map((e=>e/n)),o.warn("Got pixel spacing from corrected ImagerPixelSpacing tag")):o.warn("Got pixel spacing from raw ImagerPixelSpacing tag")}return t}(e)),void 0===t&&(t=function(e){const t=st(e,rt.NominalScannedPixelSpacing);return void 0!==t&&o.warn("Got pixel spacing from NominalScannedPixelSpacing tag"),t}(e)),void 0===t&&(t=function(e){let t;const n=ae(e,rt.SharedFunctionalGroupsSequence);if(void 0!==n&&(t=lt(n[0])),void 0===t){const n=ae(e,rt.PerFrameFunctionalGroupsSequence);void 0!==n&&(t=lt(n[0]))}return t}(e)),t}function ut(e){const t=st(e,rt.PixelSpacing);if(void 0===t)return;const n=re(e,rt.SpacingBetweenSlices);return void 0!==n&&t.push(parseFloat(n)),new ot(t)}function dt(e){const t=re(e,rt.PhotometricInterpretation),n=re(e,rt.TransferSyntax);if(void 0!==t&&void 0!==n){let i=t.toUpperCase();(ye(n)||Ce(n)||De(n))&&!ht(i)&&(i="RGB");let o=re(e,rt.SamplesPerPixel);return void 0===o&&(o=1),"RGB"===i&&1===o&&(i="PALETTE COLOR"),i}}function ht(e){return void 0!==e&&null!==e.match(/MONOCHROME/)}function gt(e){let t;const n=ae(e,rt.ReferencedSeriesSequence);return void 0!==n&&(t=re(n[0],rt.SeriesInstanceUID)),t}function St(e){const t=ae(e,rt.ReferencedFrameOfReferenceSequence);if(void 0===t)return;const n=ae(t[0],rt.RTReferencedStudySequence);if(void 0===n)return;const i=ae(n[0],rt.RTReferencedSeriesSequence);return void 0!==i?re(i[0],rt.SeriesInstanceUID):void 0}class pt{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create size with no values.");if(0===e.length)throw new Error("Cannot create size with empty values.");if(!e.every((function(e){return!isNaN(e)&&0!==e})))throw new Error("Cannot create size with non number or zero values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return`(${this.#e.toString()})`}getValues(){return this.#e.slice()}moreThanOne(e){return this.length()>=e+1&&1!==this.get(e)}canScroll3D(e){let t=2;return void 0!==e&&(t=e.getThirdColMajorDirection()),this.moreThanOne(t)}canScroll(e){let t=this.canScroll3D(e);for(let e=3;e<this.length();++e)t=t||this.moreThanOne(e);return t}getDimSize(e,t){if(e>this.length())return null;if(void 0===t)t=0;else if(t<0||t>e)throw new Error("Invalid start value for getDimSize");let n=1;for(let i=t;i<e;++i)n*=this.get(i);return n}getTotalSize(e){return this.getDimSize(this.length(),e)}equals(e){if(!e)return!1;const t=this.length();if(t!==e.length())return!1;for(let n=0;n<t;++n)if(this.get(n)!==e.get(n))return!1;return!0}isInBounds(e,t){if(!e)return!1;const n=this.length();if(n!==e.length())return!1;if(void 0===t){t=[];for(let e=0;e<n;++e)t.push(e)}else for(let e=0;e<n;++e)if(t[e]>n-1)throw new Error(`Wrong input dir value: ${t[e]}`);for(let n=0;n<t.length;++n)if(i=e.get(t[n]),o=this.get(t[n]),!(i>=0&&i<o))return!1;var i,o;return!0}indexToOffset(e,t){if(e.length()>this.length())throw new Error("Incompatible index and size length");if(void 0===t)t=0;else if(t<0||t>this.length()-1)throw new Error("Invalid start value for indexToOffset");let n=0;for(let i=t;i<e.length();++i){const o=this.get(i),r=e.get(i);if(r>=o||r<0)return-1;n+=r*this.getDimSize(i,t)}return n}offsetToIndex(e){const t=new Array(this.length());let n,o=e;for(let e=this.length()-1;e>0;--e)n=this.getDimSize(e),t[e]=Math.floor(o/n),o-=t[e]*n;return t[0]=o,new i(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 m(i)}normaliseIndex(e,t){let n;void 0!==t&&(n=t.getValues());const o=this.#G(e.getValues(),n);return new i(o)}}class mt{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 ft(e,t){return function(e){return null!=e&&(e.includes("median")||e.includes("p25")||e.includes("p75"))}(t)?function(e){const t=vt(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):vt(e)}function vt(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 mt(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)}const Dt=1e-6;class yt{#z;#H;#Y;#X={};#W;#$=$e();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 yt(this.#z.slice(),new pt(this.#H.getValues()),new ot(this.#Y.getValues()),new We(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}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=It([this.#H.get(0),this.#H.get(1),this.#H.get(2)],e);n=n.map(Math.abs),t=new pt(n.concat(this.#H.getValues().slice(3)))}return t}updateSliceSpacing(){const e=function(e){if(e.length<=1)return;const t=[];for(let n=0;n<e.length-1;++n){const i=e[n],o=e[n+1],r=i.getDistance(o);if(0===r)throw new Error(`Zero slice spacing ${i.toString()} ${o.toString()}`);t.push(r)}const n=vt(t),i=d(n.mean,4);return n.stdDev>1e-4&&o.warn(`Varying slice spacing, value: ${i} (mean: ${n.mean}, min: ${n.min}, max: ${n.max}, stdDev: ${n.stdDev})`),i}(this.#z);if(void 0!==e){1!==this.#Y.get(2)&&this.#Y.get(2)!==e&&o.debug(`Using geometric spacing ${e} instead of tag spacing ${this.#Y.get(2)}`);const t=this.#Y.getValues();t[2]=e,this.#Y=new ot(t)}}getSpacing(e){let t=this.#Y;if(e&&void 0!==e){let n=It([this.#Y.get(0),this.#Y.get(1),this.#Y.get(2)],e);n=n.map(Math.abs),t=new ot(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 h(this.#$.get(0,2),this.#$.get(1,2),this.#$.get(2,2)).isCodirectional(r)?i+1:i}canAppend(e){const t=e.getSize();if(1!==t.get(2))return{success:!1,message:"Cannot append more than one slice"};const n=this.getSize();if(n.get(0)!==t.get(0))return{success:!1,message:"Cannot append a slice with different number of columns"};if(n.get(1)!==t.get(1))return{success:!1,message:"Cannot append a slice with different number of rows"};if(!this.getOrientation().isSimilar(e.getOrientation(),Dt))return{success:!1,message:"Cannot append a slice with different orientation"};const i=this.canAppendOrigin(e.getOrigin(),e.getInitialTime());return i.success?new r(!0):i}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 r(!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 pt(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 pt(n),this.#Y=new ot(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 i(t),o=new i(this.getSize().getValues());return[this.indexToWorld(n),this.indexToWorld(o)]}indexToWorld(e){const t=this.getSpacing(),n=new S(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 m(o)}pointToWorld(e){const t=this.getSpacing(),n=new S(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 S(o.getX()+i.getX(),o.getY()+i.getY(),o.getZ()+i.getZ())}worldToIndex(e){const t=this.getOrigin(),n=new S(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),o=this.getOrientation().getInverse().multiplyPoint3D(n),r=e.getValues(),a=this.getSpacing();return r[0]=Math.floor(d(o.getX()/a.get(0),5)),r[1]=Math.floor(d(o.getY()/a.get(1),5)),r[2]=Math.floor(d(o.getZ()/a.get(2),5)),new i(r)}worldToPoint(e){const t=this.getOrigin(),n=new S(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 S(o[0],o[1],o[2])}}function It(e,t){return t.getInverse().multiplyArray3D(e)}function wt(e,t){return t.multiplyArray3D(e)}const Tt={GE:"ge",SIEMENS:"siemens",PHILIPS:"philips",HITASHI:"hitashi"};function Lt(e){return re(e,"00080070")}function Pt(e){let t;const n=Lt(e);return void 0!==n&&(t=n.toUpperCase().startsWith("SIEMENS")?Tt.SIEMENS:n.startsWith("GE")?Tt.GE:n.startsWith("Philips")?Tt.PHILIPS:n.toLowerCase()),t}const At="00080016",Ot="52009230",bt="00189087",xt=[{manufacturer:Tt.SIEMENS,key:"0019100C"},{manufacturer:Tt.GE,key:"00431039"},{manufacturer:Tt.HITASHI,key:"00291030"}],Et="1.2.840.10008.5.1.4.1.1.4",Rt="1.2.840.10008.5.1.4.1.1.4.1",Ft="1.2.840.10008.5.1.4.1.1.4.2",Mt="1.2.840.10008.5.1.4.1.1.4.3";function qt(e){let t;const n=ae(e,"00189117");return void 0!==n&&(t=re(n[0],bt)),t}function Ut(e){let t;const n=ae(e,"52009229");if(void 0!==n&&(t=qt(n[0])),void 0===t){const n=ae(e,Ot);if(void 0!==n)for(const e of n)if(t=qt(e),void 0!==t)break}return t}function Qt(e){let t;const n=re(e,At);return n===Rt||n===Ft||n===Mt?(t=Ut(e),void 0===t&&(t=function(e){let t;const n=Pt(e);return void 0!==n&&n===Tt.PHILIPS&&(t=function(e){let t,n=!1;const i=ae(e,"00209222");if(void 0!==i)for(const e of i){const t=re(e,"00209165");if(void 0!==t&&"(0018,9087)"===t){n=!0;break}}if(n){const n=ae(e,Ot);if(void 0!==n){const e=ae(n[0],"00209111");if(void 0!==e){const n=ae(e[0],"00209157");void 0!==n&&(t=n[2])}}}return t}(e)),t}(e),void 0!==t&&o.debug("Got b-value for enhanced MR from non standard tag"))):n===Et&&(t=function(e){let t;if(void 0===t){const n=Pt(e),i=re(e,"00080018");let o;o=void 0!==Xe.privateBValueRules?Xe.privateBValueRules:xt;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=re(e,r.key)),void 0!==t&&!isNaN(parseInt(t,10)))break}return void 0===t&&(t=re(e,bt)),t}(e),void 0===t&&void 0===t&&(t=Ut(e))),void 0!==t&&(t=parseInt(t,10)),t}function Vt(e){let t;const n=re(e,At);if(n===Et||n===Rt||n===Ft||n===Mt){const n=Qt(e);void 0!==n&&(t=n)}return t}function Nt(e){let t;if(void 0!==Xe.getVolumeIdTagValue)t=Xe.getVolumeIdTagValue(e);else{const n=Vt(e);void 0!==n&&(t=n)}return t}function Bt(e,t){return function(n){let i;const o=re(n,e);return void 0!==o&&(i=t(o)),i}}const kt=[{name:"TemporalPositionIdentifier",getter:Bt("00200100",(e=>parseInt(e,10)))},{name:"DiffusionBValue",getter:Vt},{name:"EchoTime",getter:Bt("00180081",parseFloat)},{name:"TriggerTime",getter:Bt("00181060",parseFloat)},{name:"InversionTime",getter:Bt("00180082",parseFloat)},{name:"AcquisitionTime",getter:Bt("00080032",parseFloat)}],Gt="00209116",zt="00289110";function Ht(e,t){return e.some((function(e){return n=t,i=e,JSON.stringify(n)===JSON.stringify(i);var n,i}))}function Yt(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}`);o.warn(`Frame origin ${n} is far from reference origin (${i}).`)}}function Xt(e,t,n){const r=at(e),a=new pt([r[0],r[1],1]);let s,l;const c=ae(e,"52009229");if(void 0!==c){const e=c[0];if(void 0!==e[Gt]){const t=e[Gt];0!==t.value.length?l=t.value[0]["00200037"].value:o.warn("No shared functional group plane orientation sequence items.")}if(void 0!==e[zt]){const t=e[zt];0!==t.value.length?s=ut(t.value[0]):o.warn("No shared functional group pixel measure sequence items.")}}const d=[];for(let e=0;e<t.length;++e){if(Ht(d,t[e].imagePosPat)||d.push(t[e].imagePosPat),void 0!==t[e].imageOrientationPatient)if(void 0===l)l=t[e].imageOrientationPatient;else if(!T(l,t[e].imageOrientationPatient))throw new Error("Unsupported multi orientation frames geometry.");if(void 0!==t[e].spacing)if(void 0===s)s=t[e].spacing;else if(!s.equals(t[e].spacing))throw new Error("Unsupported multi resolution frames geometry.")}if(void 0===s)throw new Error("No spacing found for frames geometry");if(3!==s.length())throw new Error("Incomplete spacing found for frames geometry");if(void 0===l)throw new Error("No imageOrientationPatient found for frames geometry");const h=nt(l.map((e=>parseFloat(e))));if(void 0===h)throw new Error("Invalid imageOrientationPatient found for frames geometry");d.sort(function(e){const t=e.getInverse();return function(e,n){const i=t.multiplyArray3D(e),o=t.multiplyArray3D(n);return i[2]-o[2]}}(h));const g=[];for(const e of d)g.push(p(e));return function(e,t,n,r,a){let s;s=void 0!==a?function(e,t){const n=[];n.push(e[0]);let i=e[0].getClosest(t);Yt(e[0],t[i],0);for(let o=1;o<e.length;++o){const r=e[o],a=r.getClosest(t);if(Yt(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}(e,a):function(e,t){const n=[];n.push(e[0]);let r=0;for(let a=1;a<e.length;++a){++r;let s=new i([0,0,r]),l=t.indexToWorld(s).get3D();const c=e[a];let d=c.getDistance(l);const h=d;for(;u(d);)if(o.debug(`Adding intermediate pos pats at ${l.toString()}`),n.push(l),++r,s=new i([0,0,r]),l=t.indexToWorld(s).get3D(),d=c.getDistance(l),d>h)throw new Error("Test distance is increasing when adding intermediate pos pats");n.push(c)}return n}(e,new yt([e[0]],t,n,r));const l=new yt([e[0]],t,n,r);for(let e=1;e<s.length;++e)l.appendOrigin(s[e],e);return l}(g,a,s,h,n)}function Wt(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 $t(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 jt(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 Zt(e){let t;return void 0!==e&&(t={year:e.getFullYear(),monthIndex:e.getMonth(),day:e.getDate()}),t}function _t(e){let t;return void 0!==e&&(t={hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}),t}function Kt(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 Jt(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 en="00080100",tn="00080102",nn="00080119",on="00080120";class rn{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 sn(e){const t=new rn(e["00080104"].value[0]);if(void 0!==e[en])t.value=e[en].value[0];else if(void 0!==e[nn])t.longValue=e[nn].value[0];else{if(void 0===e[on])throw new Error("Invalid code with no value, no long value and no urn value.");t.urnValue=e[on].value[0]}if(void 0!==t.value||void 0!==t.longValue){if(void 0===e[tn])throw new Error("No coding sheme designator when code value or long value is present");t.schemeDesignator=e[tn].value[0]}return t}function ln(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 cn={value:"111017",meaning:"CAD Processing and Findings Summary"},un={value:"111030",meaning:"Image Region"},dn={value:"111059",meaning:"Single Image Finding"},hn={value:"111099",meaning:"Selected region"},gn={value:"111242",meaning:"All algorithms succeeded; with findings"},Sn={value:"112000",meaning:"Chest CAD Report"},pn={value:"112020",meaning:"Response Evaluation"},mn={value:"112021",meaning:"Response Evaluation Method"},fn={value:"112022",meaning:"RECIST"},vn={value:"112039",meaning:"Tracking Identifier"},Cn={value:"112051",meaning:"Measurement of Response"},Dn={value:"112040",meaning:"Tracking Unique Identifier"},yn={value:"112048",meaning:"Current Response"},In={value:"113076",meaning:"Segmentation"},wn={value:"121055",meaning:"Path"},Tn={value:"121106",meaning:"Comment"},Ln={value:"121322",meaning:"Source image for image processing operation"},Pn={value:"121324",meaning:"Source Image"},An={value:"122438",meaning:"Reference Points"},On={value:"125007",meaning:"Measurement Group"},bn={value:"125309",meaning:"Short Label"},xn={value:"126000",meaning:"Imaging Measurement Report"},En={value:"126010",meaning:"Imaging Measurements"},Rn={value:"128773",meaning:"Reference Geometry"},Fn={1483009:"Angle",42798e3:"Area",103355008:"Width",103339001:"Long axis",103340004:"Short axis",131190003:"Radius",261665006:"Unknown",410668003:"Length",718499004:"Color"},Mn={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 qn(e){const t=new rn(e.meaning);return t.schemeDesignator="DCM",t.value=e.value,t}function Un(e,t){let n,i;return"SCT"===t?n=Fn[e]:"UCUM"===t&&(n=Mn[e]),void 0!==n&&(i=new rn(n),i.schemeDesignator=t,i.value=e),i}function Qn(){return qn(In)}function Vn(){return Un("718499004","SCT")}const Nn={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"}},Bn={"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 kn(e){const t=Bn[e];let n;return void 0!==t?n=Un(t,"UCUM"):void 0===t&&(n=Un("1","UCUM")),n}const Gn="00089124",zn="00082112",Hn="00081150",Yn="00081155",Xn="00209111",Wn="00209113",$n="00209116",jn="00289110";class Zn{dimIndex;imagePosPat;derivationImages;refSegmentNumber;imageOrientationPatient;spacing;constructor(e,t,n,i){this.dimIndex=e,this.imagePosPat=t,this.derivationImages=n,this.refSegmentNumber=i}}function _n(e){const t=[];if(void 0!==e[Gn]){const n=e[Gn].value;for(let e=0;e<n.length;++e){const i=[];if(void 0!==n[e][zn]){const t=n[e][zn].value;for(let e=0;e<t.length;++e){const n={};void 0!==t[e][Hn]&&(n.referencedSOPClassUID=t[e][Hn].value[0]),void 0!==t[e][Yn]&&(n.referencedSOPInstanceUID=t[e][Yn].value[0]),i.push(n)}}t.push({sourceImages:i})}}if(void 0===e[Xn])throw new Error("Missing frame content sequence");const n=e[Xn].value;if(0===n.length)throw new Error("Empty frame content sequence");const i=n[0]["00209157"].value;let r;const a=e["0062000A"];if(void 0!==a){const e=a.value[0];r=parseInt(e["0062000B"].value[0],10)}if(void 0===e[Wn])throw new Error("Missing plane position sequence");const s=e[Wn].value;if(0===s.length)throw new Error("Empty plane position sequence");const l=s[0]["00200032"].value;for(let e=0;e<l.length;++e)l[e]=parseFloat(l[e]);const c=new Zn(i,l,t,r);if(void 0!==e[$n]){const t=e[$n];if(0!==t.value.length){const e=t.value[0]["00200037"].value;void 0!==e&&(c.imageOrientationPatient=e)}}if(void 0!==e[jn]){const t=e[jn];if(0!==t.value.length){const e=ut(t.value[0]);void 0!==e&&(c.spacing=e)}else o.warn("No shared functional group pixel measure sequence items.")}return c}function Kn(e,t){const n=ae(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(let e=0;e<n.length;++e)i.push(_n(n[e]))}return i}function Jn(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=ln(qn(Ln)),i=ln(qn(In)),o=[];for(const t of e.derivationImages){const e=[];for(const i of t.sourceImages)e.push({PurposeOfReferenceCodeSequence:{value:[n]},ReferencedSOPClassUID:i.referencedSOPClassUID,ReferencedSOPInstanceUID:i.referencedSOPInstanceUID});o.push({DerivationCodeSequence:{value:[i]},SourceImageSequence:{value:e}})}t.DerivationImageSequence={value:o}}return t}const ei="00080016",ti="00080060",ni="00280002",ii="00280100",oi={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 ri{#j;#Z;getWarning(){return this.#j}checkElements(e){if(this.#j=void 0,void 0===at(e))throw new Error("No image rows or columns in DICOM file");if(!B(e))throw new Error("No pixel data in DICOM file");const t=re(e,ti);if(void 0!==t&&"PT"===t){const t=dt(e);if(void 0!==(n=re(e,ei))&&/^1\.2\.840\.10008\.5\.1\.4\.1\.1\.7/.test(n)||!ht(t))return this.#j;const i=function(e){let t="";const n={};let i;t+=se(e["00280051"],"Corrected Image (00280051)",["ATTN","DECY"]),t+=se(e["00541102"],"Decay Correction (00541102)",["START"]),t+=se(e["00541001"],"Units (00541001)",["BQML"]);const r=e["00101030"],a=se(r," PatientWeight (00101030)");if(0===a.length){const e=parseFloat(r.value[0]);isNaN(e)?t+=" PatientWeight is not a number":i=e}else t+=a;const s=function(e){let t,n="";const i=Wt(e["00080021"]);let r,a,s;const l=e["00540016"];if(n+=se(l,"RadiopharmaceuticalInformationSequence (00540016)"),void 0!==l){1!==l.value.length&&o.warn("Found more than 1 istopes in RadiopharmaceuticalInformation Sequence.");const e="RadionuclideTotalDose (00181074)",c=l.value[0]["00181074"];if(t=se(c,e),0===t.length){const e=parseFloat(c.value[0]);isNaN(e)?n+=" TotalDose is not a number":r=e}else n+=t;const u="RadionuclideHalfLife (00181075)",d=l.value[0]["00181075"];if(t=se(d,u),0===t.length){const e=parseFloat(d.value[0]);isNaN(e)?n+=" HalfLife is not a number":a=e}else n+=t;const h=l.value[0]["00181078"];let g,S;if(void 0===h)g=i,S=$t(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 ie("DA");n.value=[t.substring(0,8)];const i=Wt(n),o=new ie("TM");return o.value=[t.substring(8)],{date:i,time:t.length>=9?$t(o):void 0}}(h);g=e.date,S=e.time}s=jt(g,S)}let c=jt(i,$t(e["00080031"]));const u=e["00080022"],d=e["00080032"];if(void 0!==u&&void 0!==d){const t=Wt(u),i=$t(d),r=jt(t,i);if(c>r){const s=`Series date/time is after Aquisition date/time (diff=${(c.getTime()-r.getTime()).toString()}ms) `;o.debug(s);let l=0;const u="FrameReferenceTime (00541300)",d=e["00541300"];n+=se(d,u),void 0!==d&&(l=d.value[0]);let h=0;const g="ActualFrameDuration (00181242)",S=e["00181242"];if(n+=se(S,g),void 0!==S&&(h=S.value[0]),l>0&&h>0){h/=1e3,l/=1e3;const e=Math.log(2)/a,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!==s&&void 0!==r&&void 0!==a){const e=(c.getTime()-s.getTime())/1e3;h=r*Math.pow(2,-e/a)}return{value:h,warning:n}}(e);return t+=s.warning,0!==t.length?n.warning=`Cannot calculate PET SUV: ${t}`:n.value=1e3*i/s.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 re(e,t)};let r;const a=Kn(e);if(void 0!==a){const t=[];let n=!0;for(const e of a){if(Ht(t,e.imagePosPat)){n=!1;break}t.push(e.imagePosPat)}n&&(o.debug("Using frame infos for geometry"),r=Xt(e,a))}void 0===r&&(r=function(e){const t=at(e),n=[t[0],t[1],1],i=re(e,"00280008");if(void 0!==i){const e=parseInt(i,10);e>1&&n.push(e)}const r=new pt(n);let a=[1,1,1];const s=ct(e);if(void 0!==s)a=[s[0],s[1],1];else{const t=st(e,rt.PixelAspectRatio);void 0!==t&&(a=[t[0],t[1],1],o.warn("Use pixel aspect ratio as spacing"))}const l=new ot(a),c=ae(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=ae(e,rt.ImageOrientationPatient);let n;return void 0!==t&&(n=nt(t.map((e=>parseFloat(e))))),n}(e),h=new S(u[0],u[1],u[2]),g=Nt(e);return new yt([h],r,l,d,g)}(e));const s=r.getSize().getTotalSize(),l=ct(e),c=i("00080018");let u=i(ni);void 0===u&&(u=1);const d=s*u;if(d!==t.length){if(o.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,s)}const h=new Ki(r,t,[c]),g=dt(e);void 0!==g&&h.setPhotometricInterpretation(g);const p=i("00280006");void 0!==p&&h.setPlanarConfiguration(p);let m=1;const f=i("00281053");if(void 0!==f){const e=parseFloat(f);isNaN(e)||(m=e)}let v=0;const C=i("00281052");if(void 0!==C){const e=parseFloat(C);isNaN(e)||(v=e)}let D=!1,y=1;void 0!==this.#Z&&(D=!0,y=this.#Z,o.info(`Applying PET SUV calibration: ${y}`),m*=y,v*=y);const I=new Re(m,v);if(h.setRescaleSlopeAndIntercept(I),"PALETTE COLOR"===h.getPhotometricInterpretation()){const t=function(e){let t;const n=ae(e,"00281101");if(void 0!==n&&3===n.length){let i,r,a;const s=e["00281201"],l=e["00281202"],c=e["00281203"];if(16===n[2]){let t=!1,u=n[0];0===u&&(u=65536);const d=s.vl;if(d!==2*u&&(t=!0,o.info(`16bits lut but size is not double. desc: ${u} vl: ${d}`)),8===parseInt(re(e,ii),10)&&(t=!0,o.info("Scaling 16bits color lut since bits allocated is 8.")),t){const e=function(e){return e>>8};i=s.value.map(e),r=l.value.map(e),a=c.value.map(e)}}else if(8===n[2]){o.info("Scaling 16bits color lut since the lut descriptor is 8.");let e=s.value.slice(0);i=Array.from(new Uint8Array(e.buffer)),e=l.value.slice(0),r=Array.from(new Uint8Array(e.buffer)),e=c.value.slice(0),a=Array.from(new Uint8Array(e.buffer))}t=new He(i,r,a)}return t}(e);void 0!==t&&h.setPaletteColourMap(t)}const w={numberOfFiles:n};w.TransferSyntaxUID=i("00020010"),w.MediaStorageSOPClassUID=i("00020002"),w.SOPClassUID=i(ei),w.Modality=i(ti),w.ImageType=i("00080008"),w.SamplesPerPixel=i(ni),w.PhotometricInterpretation=i("00280004"),w.PixelRepresentation=i("00280103"),w.BitsAllocated=i(ii),w.BitsStored=i("00280101"),w.HighBit=i("00280102");const T=Object.keys(oi);for(const e of T)w[e]=i(oi[e]);if(D)w.pixelUnit="SUV";else{const t=(L=e,void 0!==Xe.getTagPixelUnit?Xe.getTagPixelUnit(L):function(e){let t;const n=["RescaleType","Units"];for(const i of n)if(t=re(e,rt[i]),void 0!==t)break;if(void 0===t){const n=re(e,rt.Modality);void 0!==n&&"CT"===n&&(t="HU")}return t}(L));void 0!==t&&(w.pixelUnit=t)}var L;w.lengthUnit=void 0===l?"unit.pixel":"unit.mm";const P=function(e,t){let n;const i=ae(e,"00281050"),r=ae(e,"00281051");if(void 0!==i&&void 0!==r){n={};const a=ae(e,"00281055");let s;for(let e=0;e<i.length;++e){const l=parseFloat(i[e]);let c=parseFloat(r[e]);l&&c&&0!==c&&(s="",void 0!==a&&(s=a[e]),""===s&&(s=`Default${e}`),c*=t,c<1&&(c=1),n[s]=new Be(s,[new Qe(l*t,c)])),0===c&&o.warn("Zero window width found in DICOM.")}}return n}(e,y);return void 0!==P&&(w.windowPresets=P),w.VOILUTFunction=i("00281056"),h.setMeta(w),h}}function ai(e){return function(t,n){if("mergeId"===n)return t;const i=R(n),o=ee(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(ai(t),{}))}}else s=1===a.value.length?a.value[0]:a.value;return t[r]=s,t}}function si(e){const t=structuredClone(e);return Object.keys(t).reduce(ai(t),{})}function li(e,t){const n=Object.keys(t);for(const i of n)void 0!==e[i]&&o.debug(`Overwritting tag: ${i}`),e[i]=t[i]}function ci(e){const t=Object.keys(e),n={};for(const i of t){const t=ne(i);if(void 0===t)continue;const r=ee(t),a=r?.getVr();let s,l=!1;const c=e[i];if("SQ"===a){const e=[],t=c;if(void 0!==t.undefinedLength&&(l=t.undefinedLength),Array.isArray(t.value))for(const n of t.value)e.push(ci(n));else o.debug("Non array simpleTag SQ value");s=e}else s=Array.isArray(c)?c:[c];const u=new ie(a);u.tag=t,u.value=s,l&&(u.undefinedLength=l),n[t.getKey()]=u}return n}class ui{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 hi(e){return{r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)}}function gi(e){return`#${((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)}`}function Si(e){return{l:.001525902*e.l,a:.003891051*e.a-128,b:.003891051*e.b-128}}function pi(e){return{l:655.35*e.l,a:257*e.a+32896,b:257*e.b+32896}}const mi={x:95.0489,y:100,z:108.884};function fi(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=mi,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 vi(e){return function(e){function t(e){let t;return t=e>.008856452?Math.pow(e,.333333333):7.787037037*e+.137931034,t}const n=mi,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 Ci(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 Di=[new ui(0,0,0),new ui(255,0,0),new ui(0,255,0),new ui(0,0,255),new ui(255,255,0),new ui(0,255,255),new ui(255,0,255),new ui(255,239,213),new ui(0,0,205),new ui(205,133,63),new ui(210,180,140),new ui(102,205,170),new ui(0,0,128),new ui(0,139,139),new ui(46,139,87),new ui(255,228,225)];function yi(e){let t;return t=e<Di.length?Di[e]:new ui(255*Math.random(),255*Math.random(),255*Math.random()),t}const Ii="00620005",wi="00620009",Ti="0062000C",Li="0062000D",Pi="00620003",Ai="0062000F",Oi="00620020";class bi{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 xi(e){const t=new bi(e["00620004"].value[0],e[Ii]?e[Ii].value[0]:"n/a",e["00620008"].value[0]);if(void 0!==e[wi]&&(t.algorithmName=e[wi].value[0]),void 0!==e[Ti])t.displayValue=e[Ti].value[0];else if(void 0!==e[Li]){const n=e[Li].value,i=fi(Si({l:n[0],a:n[1],b:n[2]}));t.displayRGBValue=i}else o.warn("No recommended colour for segment, using default"),t.displayRGBValue=yi(t.number);if(void 0===e[Pi])throw new Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=sn(e[Pi].value[0]),void 0===e[Ai])throw new Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=sn(e[Ai].value[0]),void 0!==e[Oi]&&(t.trackingId=e[Oi].value[0],t.trackingUid=e["00620021"].value[0]),t}function Ei(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=pi(vi(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:[ln(e.propertyCategoryCode)]}),e.propertyTypeCode&&(n.SegmentedPropertyTypeCodeSequence={value:[ln(e.propertyTypeCode)]}),e.trackingId&&(n.TrackingID=e.trackingId,n.TrackingUID=e.trackingUid),n}class Ri{#_=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 Fi(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 Mi{#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&&o.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=Fi(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 Ri,this.#se.initialize(r,t),this.#le=i,this.#se}}const qi={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyTime:"00080030",StudyInstanceUID:"0020000D",StudyID:"00200010",ReferringPhysicianName:"00080090",SeriesDate:"00080021",SeriesTime:"00080031",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052",Manufacturer:"00080070",ManufacturerModelName:"00081090",DeviceSerialNumber:"00181000",SoftwareVersions:"00181020",LossyImageCompression:"00282110"};function Ui(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(T(t.enum[e],i)){o=!0;break}}else o=t.enum.includes(i);if(!o)throw new Error(`Unsupported ${t.name} value: ${i}`)}const Qi=[{name:"TransferSyntaxUID",tag:"00020010",type:"1",enum:[Z,_,K]},{name:"MediaStorageSOPClassUID",tag:"00020002",type:"1",enum:["1.2.840.10008.5.1.4.1.1.66.4"]},{name:"SOPClassUID",tag:"00020002",type:"1",enum:["1.2.840.10008.5.1.4.1.1.66.4"]},{name:"Modality",tag:"00080060",type:"1",enum:["SEG"]},{name:"SegmentationType",tag:"00620001",type:"1",enum:["BINARY"]},{name:"DimensionOrganizationType",tag:"00209311",type:"3",enum:["3D"]},{name:"ImageType",tag:"00080008",type:"1",enum:[["DERIVED","PRIMARY"]]},{name:"SamplesPerPixel",tag:"00280002",type:"1",enum:[1]},{name:"PhotometricInterpretation",tag:"00280004",type:"1",enum:["MONOCHROME2"]},{name:"PixelRepresentation",tag:"00280103",type:"1",enum:[0]},{name:"BitsAllocated",tag:"00280100",type:"1",enum:[1]},{name:"BitsStored",tag:"00280101",type:"1",enum:[1]},{name:"HighBit",tag:"00280102",type:"1",enum:[0]}];function Vi(){const e={};for(const t of Qi)e[t.name]=t.enum[0];return e}class Ni{#j;getWarning(){return this.#j}checkElements(e){}create(e,t,n){const i=function(t){return re(e,t)};for(const t of Qi)Ui(e,t);const o=at(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]["00209164"].value[0],i=[],o=e["00209222"];if(void 0!==o){const e=o.value;if(2!==e.length)throw new Error("Unsupported dimension index sequence length");let t;for(let o=0;o<e.length;++o){const r=e[o]["00209164"].value[0];if(r!==n)throw new Error("Dimension Index Sequence contains a unknown Dimension Organization");t=e[o]["00209165"].value[0];const a={DimensionOrganizationUID:r,DimensionIndexPointer:t};void 0!==e[o]["00209421"]&&(a.DimensionDescriptionLabel=e[o]["00209421"].value[0]),i.push(a)}if("(0020,0032)"!==t)throw new Error("Unsupported non image position as last index")}return{organizations:{value:[{DimensionOrganizationUID:n}]},indices:{value:i}}}(e),l=ae(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=xi(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 He(u,d,h));const m=function(e,t){return e.findIndex((function(e){return t.equals(e)}))},f=Kn(e,a);if(void 0===f)throw new Error("Missing or empty per frame functional sequence");let v;void 0!==n&&(v=n.getGeometry().getOrigins());const C=Xt(e,f,v),D=C.getSize().get(2),y=function(e){return function(t){return t.number===e}},I=new Mi(C),w=C.getOrigins();let T;for(let e=0;e<f.length;++e){if(T=m(w,p(f[e].imagePosPat)),-1===T)throw new Error("Cannot find frame origin in mask origins");const n=c.find(y(f[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 Ki(C,I.getLabelMap(),L);P.setSegmentCollection(I),S&&(P.setPhotometricInterpretation("PALETTE COLOR"),P.setPaletteColourMap(g));const A=Vi(),O=Object.keys(qi);for(const e of O)A[e]=i(qi[e]);return A.DimensionOrganizationSequence=s.organizations,A.DimensionIndexSequence=s.indices,A.custom={segments:c,frameInfos:f,SOPInstanceUID:i("00080018"),referencedSeriesUID:gt(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=Kt(Zt(s)),o.ContentTime=Jt(_t(s)),void 0!==n&&(o.StudyInstanceUID=n.getMeta().StudyInstanceUID);const l=[];for(const e of t)l.push(Ei(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 Zn([t,r.length-i],l,void 0,t);if(void 0!==n){const e=n.getGeometry().worldToIndex(new m([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(Jn(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&&li(o,i);const f=ci(o),v=a.getDimSize(2),C=g.length*v/8,D=new ie("OB");return D.tag=new x("7FE0","0010"),D.vl=C,D.value=g,f["7FE00010"]=D,f}}function Bi(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 r=i.getSize().get(2)>n.getSize().get(2),a=r?i:n,s=a.getOrigins(),l=a.getSize().getDimSize(2),c=function(e,t){return e.getOrigins().map(((e,n)=>{let i=-1,r=1/0;for(let t=0;t<s.length;++t){const n=e.getDistance(s[t]);n<r&&(r=n,i=t)}if(r>.01)throw new Error(`mergeMaskImages: mask${t} slice ${n} has no matching slice in the merged geometry`);return r>1e-4&&o.warn(`mergeMaskImages: mask${t} slice ${n} is far from its closest merged-geometry slice (${r}).`),i}))},u=r?c(n,"1"):void 0,d=r?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++;o.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 Mi(a),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=s.map(((e,t)=>t.toString())),P=new Ki(a,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 He(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 ki{#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 Gi(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 Gi{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 zi{constructor(e,t){this.startMessage=e,this.info=t}getWorker(){}}function Hi(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 Yi extends zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/labeling.worker.min.js",import.meta.url),{name:"labeling.worker",type:"module"})}}class Xi{#Se=new ki(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 Yi(function(e,t){return{imageBuffer:e,...Hi(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=Hi(i,t.getSpacing());this.#Se.addWorkerTask(new Yi({segmentSlice:{segNumber:n,slices:o},...e},{}))}}ondone(e){}}class Wi extends zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/resampling.worker.min.js",import.meta.url),{name:"resampling.worker",type:"module"})}}class $i{#Se=new ki(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 S(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),p=[u[0]*g,u[1]*g,u[2]*g],m=a.length();for(let e=3;e<m;e++)p.push(a.get(e));const f=new ot(p),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 S(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])/f.get(0))),Math.round(Math.abs((D[1]-y[1])/f.get(1))),Math.round(Math.abs((D[2]-y[2])/f.get(2)))],w=r.length();for(let e=3;e<w;e++)I.push(r.get(e));const T=new pt(I),L=void 0===n?new S(r.get(0)/2,r.get(1)/2,r.get(2)/2):e.worldToPoint(n),P=[0,0,0];if(void 0===n)P[0]=T.get(0)/2,P[1]=T.get(1)/2,P[2]=T.get(2)/2;else{const e=[(L.getX()-r.get(0)/2)*a.get(0),(L.getY()-r.get(1)/2)*a.get(1),(L.getZ()-r.get(2)/2)*a.get(2)],t=o.multiplyArray3D(e);P[0]=t[0]/f.get(0)+T.get(0)/2,P[1]=t[1]/f.get(1)+T.get(1)/2,P[2]=t[2]/f.get(2)+T.get(2)/2}const A=new S(P[0]*f.get(0),P[1]*f.get(1),P[2]*f.get(2)),O=t.multiplyPoint3D(A),b=e.pointToWorld(L),x=new S(b.getX()-O.getX(),b.getY()-O.getY(),b.getZ()-O.getZ()),E=[0,0,f.get(2)],R=t.multiplyArray3D(E),F=[];for(let e=0;e<T.get(2);e++)F.push(new S(x.getX()+R[0]*e,x.getY()+R[1]*e,x.getZ()+R[2]*e));return new yt(F,T,f,t)}(t,i,r),l=function(e,t,n){const i=we(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 Wi(e,{});this.#Se.addWorkerTask(t)})),{buffer:l,geometry:s,jobId:a}}ondoneframe(e){}ondone(e){}}const ji=["imagecontentchange","imagegeometrychange","imageresamplingstart","imageresamplingcomplete","imageresampled","labelingstart","labelschanged"];function Zi(e){return(new ri).create(e,e["7FE00010"].value[0],1)}function _i(e){return(new Ni).create(e,e["7FE00010"].value[0])}class Ki extends EventTarget{#ie;#d;#pe;#me;#fe;#ve;#Ce;#De;#ye=new Re(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 Ri,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 Mi(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 ht(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}#Qe(){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]:o.warn(`undefined non constant rsi at ${n}`)}return t}#Ve(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.#Qe();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 Ki(this.getGeometry().clone(),e,this.#De);if(this.isConstantRSI())t.setRescaleSlopeAndIntercept(this.getRescaleSlopeAndIntercept());else for(let e=0;e<this.#Qe();++e)t.setRescaleSlopeAndIntercept(this.#Ve(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=we(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}canAppend(e){if(null===e)return{success:!1,message:"Cannot append null slice"};const t=this.#ie.canAppend(e.getGeometry());if(!t.success)return t;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 r(!0)}appendSlice(e){const t=this.canAppend(e);if(!t.success)throw new Error(t.message);const n=e.getDataRange(),o=this.getDataRange();this.#xe={min:Math.min(n.min,o.min),max:Math.max(n.max,o.max)};const r=e.getRescaledDataRange(),a=this.getRescaledDataRange();this.#Ee={min:Math.min(r.min,a.min),max:Math.max(r.max,a.max)};let s=this.getGeometry().getSize();const l=e.getGeometry().getInitialTime();let c=!1;void 0===l||this.#ie.hasSlicesAtTime(l)||(this.appendFrame(l,e.getGeometry().getOrigin()),s=this.#ie.getSize(),c=!0);const u=function(e,t){const n=t.getInitialTime(),o=[];return o.push(0),o.push(0),o.push(e.getSliceIndex(t.getOrigin(),n)),void 0!==n&&o.push(n),new i(o)}(this.#ie,e.getGeometry()),d=this.#Oe*s.getDimSize(2);if(void 0===this.#be.numberOfFiles)throw new Error("Missing number of files for buffer manipulation.");const h=d*this.#be.numberOfFiles;this.#d.length!==h&&(this.#Ne(h),this.#pe.isInitialized()&&this.#pe.realloc(this.#d,this.#ie.getSize()));const g=u.get(2);let S=g;void 0!==l&&(S+=this.#ie.getCurrentNumberOfSlicesBeforeTime(l));const p=S*d,m=this.#ie.getCurrentTotalNumberOfSlices(),f=m*d;if(p<f&&(this.#d.set(this.#d.subarray(p,f),p+d),this.#pe.isInitialized())){const e=3*s.getDimSize(2),t=S*e,n=m*e;this.#pe.shiftSlice(t,e,n)}this.#d.set(e.getBuffer(),p),c||this.#ie.appendOrigin(e.getGeometry().getOrigin(),g,l),this.setRescaleSlopeAndIntercept(e.getRescaleSlopeAndIntercept(),S);const v=this.#De.length;if(this.#De.splice(S,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)&&!Ve(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(S,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 r=i*this.#be.numberOfFiles;this.#d.length!==r&&(this.#Ne(r),this.#pe.isInitialized()&&this.#pe.realloc(this.#d,this.#ie.getSize())),t>=this.#be.numberOfFiles?o.warn(`Ignoring frame at index ${t} (size: ${this.#be.numberOfFiles})`):(this.#d.set(e,i*t),this.appendFrame(t,new S(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=Ee(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,o){const r=[e,t,n];void 0!==o&&r.push(o);const a=new i(r);return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(a))}getValueAtIndex(e){return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValue(e,t,n,o){let r=this.getValue(e,t,n,o);if(!this.isIdentityRSI())if(this.isConstantRSI())r=this.getRescaleSlopeAndIntercept().apply(r);else{const a=[e,t,n];void 0!==o&&a.push(o);const s=new i(a);r=this.getRescaleSlopeAndIntercept(s).apply(r)}return r}getRescaledValueAtIndex(e){return this.getRescaledValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValueAtOffset(e){let t=this.getValueAtOffset(e);if(!this.isIdentityRSI())if(this.isConstantRSI())t=this.getRescaleSlopeAndIntercept().apply(t);else{const n=this.getGeometry().getSize().offsetToIndex(e);t=this.getRescaleSlopeAndIntercept(n).apply(t)}return t}calculateDataRange(){let e,t=this.getValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();i.length()>=3&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateRescaledDataRange(){if(this.isIdentityRSI())return this.getDataRange();if(this.isConstantRSI()){const e=this.getDataRange(),t=this.getRescaleSlopeAndIntercept().apply(e.min),n=this.getRescaleSlopeAndIntercept().apply(e.max);return{min:t<n?t:n,max:t>n?t:n}}let e,t=this.getRescaledValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();3===i.length()&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getRescaledValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateHistogram(){const e=this.getGeometry().getSize(),t=[];let n,i,o=this.getValueAtOffset(0),r=o,a=this.getRescaledValueAtOffset(0),s=a;for(let l=0,c=e.getTotalSize();l<c;++l)n=this.getValueAtOffset(l),n>r&&(r=n),n<o&&(o=n),i=this.getRescaledValueAtOffset(l),i>s&&(s=i),i<a&&(a=i),t[i]=(t[i]||0)+1;const l={min:o,max:r},c={min:a,max:s},u=[];for(let e=a;e<=s;++e)u.push([e,t[e]||0]);return{dataRange:l,rescaledDataRange:c,histogram:u}}convolute2D(e){if(9!==e.length)throw new Error(`The convolution matrix does not have a length of 9; it has ${e.length}`);const t=this.clone(),n=t.getBuffer(),i=this.getGeometry().getSize(),o=i.getDimSize(2)*this.getNumberOfComponents();for(let t=0;t<i.get(2);++t)this.convoluteBuffer(e,n,t*o);return t}convoluteBuffer(e,t,n){const i=this.getGeometry().getSize(),o=i.get(0),r=i.get(1),a=this.getNumberOfComponents();let s=1,l=1;3===a&&(0===this.getPlanarConfiguration()?s=3:l=i.getDimSize(2));const c=[];c[0]=(-o-1)*s,c[1]=-o*s,c[2]=(1-o)*s,c[3]=-s,c[4]=0,c[5]=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}#Be(e){const t=this.#ie.getSpacing(),n=this.getMeta().lengthUnit;let o=1,r="unit.pixel";"unit.mm"===n&&(o=t.get(0)*t.get(1)*t.get(2)*.001,r="unit.ml");for(const t of e){let e,a;t.centroid=this.#ie.indexToWorld(new i(t.centroidIndex)),t.volume={value:t.count*o,unit:r},void 0!==t.diameters&&(void 0!==t.diameters.major&&(e=t.diameters.major.diameter),void 0!==t.diameters.minor&&(a=t.diameters.minor.diameter)),t.diameters={major:{diameter:{value:e,unit:n}},minor:{diameter:{value:a,unit:n}}},t.height={value:t.height,unit:n}}const a=e.sort(((e,t)=>t.volume.value-e.volume.value)).sort(((e,t)=>e.id-t.id));this.dispatchEvent(new CustomEvent("labelschanged",{detail:{labels:a}}))}#ke(){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 pt([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 Xi,this.#Fe.ondone=e=>{this.#Be(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.#ke():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 $i,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 Ji=["annotationgroupeditablechange","annotationadd","annotationupdate","annotationremove"];class eo extends EventTarget{#Ge;#be={};#ze;#He;constructor(e){super(),this.#Ge=void 0!==e?e:[],this.#ze=!0}getList(){return this.#Ge}getLength(){return this.#Ge.length}isEditable(){return this.#ze}setEditable(e){this.#ze=e,this.dispatchEvent(new CustomEvent("annotationgroupeditablechange",{detail:{data:e}}))}getColour(){return this.#He}setColour(e){this.#He=e}add(e,t){this.#Ge.push(e),this.dispatchEvent(new CustomEvent("annotationadd",{detail:{data:e,propagate:t}}))}update(e,t,n){const i=this.#Ge.findIndex((t=>t.trackingUid===e.trackingUid));-1!==i?((t.includes("mathShape")||t.includes("textExpr"))&&e.updateQuantification(),this.#Ge[i]=e,this.dispatchEvent(new CustomEvent("annotationupdate",{detail:{data:e,keys:t,propagate:n}}))):o.warn("Cannot find annotation to update")}remove(e,t){const n=this.#Ge.findIndex((t=>t.trackingUid===e));if(-1!==n){const e=this.#Ge.splice(n,1)[0];this.dispatchEvent(new CustomEvent("annotationremove",{detail:{data:e,propagate:t}}))}else o.warn("Cannot find annotation to remove")}setViewController(e){for(const t of this.#Ge)t.setViewController(e),t.updateQuantification()}find(e){return this.#Ge.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 to{#Ye=10;#Xe="Verdana";#We="#fff";#$e="#ffff80";#je={x:1,y:1};#Ze={x:1,y:1};#_e=2;#Ke={x:.25,y:.25};#Je=.2;#et=3;getFontFamily(){return this.#Xe}getFontSize(){return this.#Ye}getStrokeWidth(){return this.#_e}getTextColour(){return this.#We}getLineColour(){return this.#$e}setLineColour(e){this.#$e=e}setBaseScale(e){this.#je=e}setZoomScale(e){this.#Ze=e}getBaseScale(){return this.#je}getZoomScale(){return this.#Ze}scale(e){return e/this.#je.x}applyZoomScale(e){return{x:e/this.#Ze.x,y:e/this.#Ze.y}}applyZoomRatio(e){return e*this.#Ze.x/this.#Ze.y}getShadowOffset(){return this.#Ke}getTagOpacity(){return this.#Je}getTextPadding(){return this.#et}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=hi(e)).r+.002301961*t.g+447059e-9*t.b<.5;var t}(this.getLineColour())?"#fff":"#000"}}class no{#tt;constructor(e){this.#tt=e}fromJSON(e){const t=JSON.parse(e);let n;if("0.1"===t.version)n=this.#nt(t);else if("0.2"===t.version)n=this.#it(t);else if("0.3"===t.version)n=this.#ot(t);else if("0.4"===t.version)n=this.#rt(t);else{if("0.5"!==t.version)throw new Error(`Unknown state file format version: '${t.version}'.`);n=this.#at(t)}return n}apply(e,t){const n=e.getStageController(),i=n.getActiveLayerGroup().getBaseViewLayer().getViewController(),o=new Qe(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.#tt)}#nt(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(Ci(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=io(n.drawings).toObject(),t.drawingsDetails=oo(n.drawingsDetails),(t=ro(t)).drawings=ao(t.drawings),t}#it(e){return e.drawings=io(e.drawings).toObject(),e.drawingsDetails=oo(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=ro(e)).drawings=ao(e.drawings),e}#ot(e){return e.drawingsDetails=oo(e.drawingsDetails),(e=ro(e)).drawings=ao(e.drawings),e}#rt(e){return(e=ro(e)).drawings=ao(e.drawings),e}#at(e){return e}}function io(t){let n,o,r;const a=new e.Layer({listening:!1,visible:!0}),s="string"==typeof t?JSON.parse(t):t;for(let t=0,c=s.length;t<c;++t)for(let c=0,u=s[t].length;c<u;++c)if(o=s[t][c],0!==o.length){r=new e.Group({id:(l=new i([1,1,t,c]),`slice-${l.get(2)}_frame-${4===l.length()?l.get(3):0}`),name:"position-group",visible:!1});for(let t=0,i=o.length;t<i;++t)n=e.Node.create(o[t]),n.draggable(!0),n.getChildren().forEach((function(e){e.draggable(!1)})),r.add(n);a.add(r)}var l;return a}function oo(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 ro(e){const t=e.position;return e.position=[t.i,t.j,t.k],e}function ao(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 so(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 lo(e){const t=so(e);return 0===Object.keys(t).length?null:t.query}function co(e){let t;const n=lo(e);return n&&void 0!==n.input&&(t=ho(n.input,n.dwvReplaceMode)),t}function uo(e,t){const n=lo(e);n&&void 0!==n.input&&go(n.input,n.nslices,t)}function ho(e,t){const n=[];let i="key";t&&(i=t);const o=decodeURIComponent(e),r=so(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 go(e,t,n){let i="";"/"===e[0]&&(i=`${window.location.protocol}//${window.location.host}`),i+=e;const r=new XMLHttpRequest;r.open("GET",decodeURIComponent(i),!0),r.responseType="document",r.onload=function(e){n(function(e,t){const n=[],i=`${e.getElementsByTagName("wado_query")[0].getAttribute("wadoURL")}?requestType=WADO&contentType=application/dicom&`,r=e.getElementsByTagName("Patient");r.length>1&&o.warn("More than one patient, loading first one.");const a=r[0].getElementsByTagName("Study");a.length>1&&o.warn("More than one study, loading first one.");const s=a[0].getAttribute("StudyInstanceUID"),l=a[0].getElementsByTagName("Series");l.length>1&&o.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=${s}&seriesUID=${c}&objectUID=${u[e].getAttribute("SOPInstanceUID")}`;n.push(t)}return n}(e.target.responseXML,t))},r.onerror=function(e){o.warn(`RequestError while receiving manifest: ${e.target.status}`)},r.send(null)}const So=["mousedown","mousemove","mouseup","mouseout","wheel","dblclick","touchstart","touchmove","touchend"];function po(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 g(e[t].clientX-n,e[t].clientY-i));return o}function mo(e){const t=e.currentTarget.getBoundingClientRect();let n=[];return void 0!==e.targetTouches&&0!==e.targetTouches.length?n=po(e.targetTouches,t):void 0!==e.changedTouches&&0!==e.changedTouches.length&&(n=po(e.changedTouches,t)),n}function fo(e){return new g(e.offsetX,e.offsetY)}function vo(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 Co{#st;#lt=null;#ct=[];#ut={};constructor(e){this.#st=e}init(){for(const e in this.#st)this.#st[e].init();this.enableShortcuts(!0)}enableShortcuts(e){e?window.addEventListener("keydown",this.#dt("window","keydown"),!0):window.removeEventListener("keydown",this.#dt("window","keydown"),!0)}getToolList(){return this.#st}hasTool(e){return void 0!==this.getToolList()[e]}getSelectedTool(){return this.#lt}getSelectedToolEventHandler(e){return this.getSelectedTool()[e]}setSelectedTool(e){if(!this.hasTool(e))throw new Error(`Unknown tool: '${e}'`);this.#lt&&this.#lt.activate(!1),this.#lt=this.#st[e],this.#lt.activate(!0)}setToolFeatures(e){this.getSelectedTool()&&this.getSelectedTool().setFeatures(e)}bindLayerGroup(e,t){const n=e.getDivId();e.addEventListener("activelayerchange",this.#ht(n)),this.#gt(n,t)}#gt(e,t){void 0!==this.#ut[e]&&this.#St(this.#ut[e]),this.#ut[e]=t,this.#pt(t)}#ht(e){return t=>{const n=t.detail?.value,i=n?.[0];void 0!==i&&this.#gt(e,i)}}#pt(e){e.bindInteraction();const t=So;for(let n=0;n<t.length;++n)e.addEventListener(t[n],this.#dt(e.getId(),t[n]))}#St(e){e.unbindInteraction();const t=So;for(let n=0;n<t.length;++n)e.removeEventListener(t[n],this.#dt(e.getId(),t[n]))}#dt(e,t){if(void 0===this.#ct[e]&&(this.#ct[e]=[]),void 0===this.#ct[e][t]){const n=e=>{if(this.#lt){const t=this.#lt[e.type];t&&t(e)}};this.#ct[e][t]=n}return this.#ct[e][t]}}class Do{#mt=[];#ft=2;#vt;constructor(e){this.#vt=e}setNumberOfDimensions(e){this.#ft=e}setNToLoad(e){for(let t=0;t<e;++t){this.#mt[t]=[];for(let e=0;e<this.#ft;++e)this.#mt[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.#mt[e.index][e.subindex]=t,n=void 0!==e.item?e.item:{loaded:this.#Ct(e.index),total:100,source:e.source},this.#vt({lengthComputable:!0,loaded:this.#Dt(),total:100,item:n})};#Ct(e){let t=0;for(let n=0;n<this.#ft;++n)t+=this.#mt[e][n];return t/this.#ft}#Dt(){let e=0;const t=this.#mt.length;for(let n=0;n<t;++n)e+=this.#Ct(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 yo{onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class Io extends yo{#yt=null;#It=[];#wt=null;#Tt=0;#Lt=0;#Pt;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#At(e){this.#yt=e,this.#Tt=0,this.#Lt=0,this.#Pt=!1,this.#Ot(),this.#bt()}#xt(e){this.#It.push(e)}#Ot(){this.#It=[]}#Et(e){this.#wt=e}#bt(){this.#wt=null}#Rt=e=>{this.#Tt++,this.#Tt===this.#yt.length&&this.onload({source:this.#yt})};#Ft=e=>{this.#Lt++,this.#Lt===this.#yt.length&&this.onloadend({source:this.#yt})};#Mt(e,t){return n=>{n.source=t,e(n)}}load(e,t){this.onloadstart({source:e}),1===e.length&&(v(e[0],"DICOMDIR")||v(e[0],".dcmdir"))?this.#qt(e[0],t):this.#Ut(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.#Ft()):e.load(i.target.response,t,n)}}#Ut(e,t){if(void 0===e||0===e.length)return;this.#At(e);const n=new Do(this.onprogress);n.setNToLoad(e.length);const i=Fs(),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.#Rt,a.onloadend=this.#Ft,a.onerror=this.onerror,a.onabort=this.onabort,this.#Et(a);break}if(!s)throw new Error(`No loader found for url: ${r}`);let l=0;const c=()=>{l<this.#It.length-1&&!this.#Pt&&(++l,this.#It[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.#Mt(n.getMonoProgressHandler(i,0),r),o.onload=this.#Qt(a,r,i),o.onloadend=c;const s=this.#Mt(this.onerror,r);o.onerror=e=>{this.#Ft(),s(e)};const l=this.#Mt(this.ontimeout,r);o.ontimeout=e=>{this.#Ft(),l(e)};const u=this.#Mt(this.onabort,r);o.onabort=e=>{this.#Ft(),u(e)},1===a.loadUrlAs()&&(o.responseType="arraybuffer"),this.#xt(o)}let u=this.#It.length;void 0!==t&&void 0!==t.batchSize&&0!==u&&(u=Math.min(t.batchSize,this.#It.length));for(let e=0;e<u;++e)this.#Pt||(l=e,this.#It[l].send(null))}#qt(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 Ae;return t.parse(e),function(e){const t=e["00041220"];if(void 0===t||void 0===t.value)return void o.warn("No Directory Record Sequence found in DICOMDIR.");const n=t.value;if(0===n.length)return void o.warn("The Directory Record Sequence of the DICOMDIR is empty.");const i=[];let r=null,a=null;for(let e=0;e<n.length;++e){const t=n[e]["00041430"];if(void 0===t||void 0===t.value)continue;const o=t.value[0];if("STUDY"===o)a=[],i.push(a);else if("SERIES"===o)r=[],a.push(r);else if("IMAGE"===o){const t=n[e]["00041500"];if(void 0===t||void 0===t.value)continue;const i=t.value;r.push(i.join("/"))}}return i}(t.getDicomElements())}(n.target.response)[0][0],r=e.split("/").slice(0,-1).join("/"),a=[];for(let e=0;e<i.length;++e)a.push(`${r}/${i[e]}`);this.#Ut(a,t)}},n.onerror=t=>{this.#Mt(this.onerror,e)(t),this.onloadend({})},n.onabort=t=>{this.#Mt(this.onabort,e)(t),this.onloadend({})},n.send(null)}abort(){this.#Pt=!0;for(let e=0;e<this.#It.length;++e)4!==this.#It[e].readyState&&this.#It[e].abort();this.#wt&&this.#wt.isLoading()&&this.#wt.abort()}ontimeout(e){}}class wo extends zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/jpegbaseline.worker.min.js",import.meta.url),{name:"jpegbaseline.worker",type:"module"})}}class To extends zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/jpegloss.worker.min.js",import.meta.url),{name:"jpegloss.worker",type:"module"})}}class Lo extends zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/jpeg2000.worker.min.js",import.meta.url),{name:"jpeg2000.worker",type:"module"})}}class Po extends zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/rle.worker.min.js",import.meta.url),{name:"rle.worker",type:"module"})}}class Ao{#Vt;#Nt;#Bt=!1;constructor(e){this.#Vt=e,this.#Nt=new ki(10)}decode(e,t,n){this.#Bt||(this.#Bt=!0,this.#Nt.onworkstart=this.ondecodestart,this.#Nt.onworkitem=this.ondecodeditem,this.#Nt.onwork=this.ondecoded,this.#Nt.onworkend=this.ondecodeend,this.#Nt.onerror=this.onerror,this.#Nt.onabort=this.onabort);const i={buffer:e,meta:t};let o;"jpeg-baseline"===this.#Vt?o=new wo(i,n):"jpeg-lossless"===this.#Vt?o=new To(i,n):"jpeg2000"===this.#Vt?o=new Lo(i,n):"rle"===this.#Vt&&(o=new Po(i,n)),void 0!==o&&this.#Nt.addWorkerTask(o)}abort(){this.#Nt.abort()}ondecodestart(e){}ondecodeditem(e){}ondecoded(e){}ondecodeend(e){}onerror(e){}onabort(e){}}const Oo="0040A30A",bo="0040A161",xo="0040A162",Eo="0040A163",Ro="004008EA";class Fo{numericValue;floatingPointValue;rationalNumeratorValue;rationalDenominatorValue;measurementUnitsCode;toString(){return`${this.numericValue} ${this.measurementUnitsCode.toString()}`}}function Mo(e){const t={};return void 0!==e.measurementUnitsCode&&(t.MeasurementUnitsCodeSequence={value:[ln(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 qo="0040A300",Uo="0040A301";class Qo{measuredValue;numericValueQualifierCode;toString(){let e="";return void 0!==this.measuredValue&&(e+=this.measuredValue.toString()),void 0!==this.numericValueQualifierCode&&(e+=` ${this.numericValueQualifierCode.toString()}`),e}}function Vo(e){const t={};return void 0!==e.measuredValue&&(t.MeasuredValueSequence={value:[Mo(e.measuredValue)]}),void 0!==e.numericValueQualifierCode&&(t.NumericValueQualifierCodeSequence={value:[ln(e.numericValueQualifierCode)]}),t}const No="00081150",Bo="00081155";class ko{referencedSOPClassUID;referencedSOPInstanceUID;toString(){return`${this.referencedSOPInstanceUID} (class: ${this.referencedSOPClassUID})`}}function Go(e){const t=new ko;return void 0!==e[No]&&(t.referencedSOPClassUID=e[No].value[0]),void 0!==e[Bo]&&(t.referencedSOPInstanceUID=e[Bo].value[0]),t}function zo(e){const t={};return void 0!==e.referencedSOPClassUID&&(t.ReferencedSOPClassUID=e.referencedSOPClassUID),void 0!==e.referencedSOPInstanceUID&&(t.ReferencedSOPInstanceUID=e.referencedSOPInstanceUID),t}const Ho="00081160",Yo="00081199",Xo="0062000B";class Wo{referencedSOPSequence;referencedFrameNumber;referencedSegmentNumber;toString(){let e=this.referencedSOPSequence.toString();return void 0!==this.referencedFrameNumber&&(e+=`, frame: ${this.referencedFrameNumber}`),e}}function $o(e){const t={};return void 0!==e.referencedFrameNumber&&(t.ReferencedFrameNumber=e.referencedFrameNumber),void 0!==e.referencedSOPSequence&&(t.ReferencedSOPSequence={value:[zo(e.referencedSOPSequence)]}),void 0!==e.referencedSegmentNumber&&(t.ReferencedSegmentNumber=e.referencedSegmentNumber),t}class jo{#kt;#Gt;constructor(e,t){this.#kt=e,this.#Gt=t}getBegin(){return this.#kt}getEnd(){return this.#Gt}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 g((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 jo(this.#Gt,this.#kt)}quantify(e){const t=e.get2DSpacing(),n=this.getWorldLength(t);let i;return null!==n&&(i={value:n,unit:e.getLengthUnit()}),{length:i}}}function Zo(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 _o(e,t){const n=e.getDeltaX(),i=e.getDeltaY();return n*t.getDeltaX()+i*t.getDeltaY()==0}function Ko(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 er(o,t.getY()-o*t.getX(),t,n,i)}function Jo(e,t,n,i){const o=er(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(),Ko(e,r,n,i)}function er(e,t,n,i,o){let r,a,s,c;if(void 0===o&&(o={x:1,y:1}),l(e,0,1e-4))r=n.getX()-i/(2*o.x),a=n.getY(),s=n.getX()+i/(2*o.x),c=n.getY();else if(Math.abs(e)>1e6)r=n.getX(),a=n.getY()-i/(2*o.y),s=n.getX(),c=n.getY()+i/(2*o.y);else{const l=o.x*o.x,u=o.y*o.y,d=i/(2*Math.sqrt(l+u*e*e));r=n.getX()-d,a=e*r+t,s=n.getX()+d,c=e*s+t}return new jo(new g(r,a),new g(s,c))}class tr{#zt;constructor(e){if(e.length>3)throw new Error("Too many points for a protractor");this.#zt=e.slice(0,3)}getPoint(e){return this.#zt[e]}getLength(){return this.#zt.length}getCentroid(){return this.#zt[1]}quantify(e,t){let n;if(3===this.#zt.length){let e=Zo(new jo(this.#zt[0],this.#zt[1]),new jo(this.#zt[1],this.#zt[2]));e>180&&(e=360-e),n={value:e,unit:"unit.degree"}}return{angle:n}}}class nr{#zt=[];constructor(e){void 0!==e&&(this.#zt=e)}getPoint(e){return this.#zt[e]}getPoints(){return this.#zt}getLength(){return this.#zt.length}addPoint(e){this.#zt.push(e)}addPoints(e){this.#zt=this.#zt.concat(e)}getCentroid(){let e,t=0,n=0,i=0;for(let e=0;e<this.#zt.length;++e){const o=this.#zt[e];let r;r=e===this.#zt.length-1?this.#zt[0]:this.#zt[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 g(o*n,o*i)}return e}}class ir{#Ht;#Yt;constructor(e,t){this.#Ht=e,this.#Yt=t}getCenter(){return this.#Ht}getCentroid(){return this.#Ht}getRadius(){return this.#Yt}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=ft(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 or{#Ht;#Xt;#Wt;constructor(e,t,n){this.#Ht=e,this.#Xt=t,this.#Wt=n}getCenter(){return this.#Ht}getCentroid(){return this.#Ht}getA(){return this.#Xt}getB(){return this.#Wt}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=ft(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 rr(e,t,n){const o=e.getValues(),r=o.slice(),a=[],s=t[0],l=t[1],c=s/l,u=Math.pow(l,2),d=n[0],h=n[1];for(let e=0;e<l;++e){const t=Math.round(c*Math.sqrt(u-Math.pow(e,2))),n=o[h]+e,s=o[h]-e;for(let e=0;e<t;++e){const t=o[d]+e,l=o[d]-e;r[d]=t,r[h]=n,a.push(new i(r.slice())),s!==n&&(r[h]=s,a.push(new i(r.slice()))),l!==t&&(r[d]=l,r[h]=n,a.push(new i(r.slice())),s!==n&&(r[h]=s,a.push(new i(r.slice()))))}}return a}class ar{#kt;#Gt;constructor(e,t){this.#kt=new g(Math.min(e.getX(),t.getX()),Math.min(e.getY(),t.getY())),this.#Gt=new g(Math.max(e.getX(),t.getX()),Math.max(e.getY(),t.getY()))}getBegin(){return this.#kt}getEnd(){return this.#Gt}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 g(Math.round(this.getBegin().getX()),Math.round(this.getBegin().getY())),max:new g(Math.round(this.getEnd().getX()),Math.round(this.getEnd().getY()))}}getCentroid(){return new g(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=ft(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 sr(e,t,n){const o=e.getValues(),r=o.slice(),a=[],s=t[0],l=Math.floor(s/2),c=t[1],u=Math.floor(c/2),d=n[0],h=n[1];for(let e=0;e<c;++e){r[h]=o[h]-u+e;for(let e=0;e<s;++e)r[d]=o[d]-l+e,a.push(new i(r.slice()))}return a}class lr{#kt;#Gt;shortAxisLength;shortAxisCenter;shortAxisL1;shortAxisL2;shortAxisT;constructor(e,t){this.#kt=e,this.#Gt=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.#kt}getEnd(){return this.#Gt}getCentroid(){return new g((this.#kt.getX()+this.#Gt.getX())/2,(this.#kt.getY()+this.#Gt.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.#Gt.getX()-this.#kt.getX()}getDeltaY(){return this.#Gt.getY()-this.#kt.getY()}quantify(e){const t=e.get2DSpacing?.()??{x:1,y:1},n=new jo(this.#kt,this.#Gt).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.#kt.getX()+e*r,s=this.#kt.getY()+n*r,l=new g(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,S=new g(l.getX()+c*d,l.getY()+u*d),p=new g(l.getX()-c*h,l.getY()-u*h);i=new jo(S,p).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",ur="00700022",dr="00700023",hr="0070031A",gr="POINT",Sr="MULTIPOINT",pr="POLYLINE",mr="CIRCLE",fr="ELLIPSE";class vr{graphicData;graphicType;pixelOriginInterpretation;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Cr(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 Dr(e){const t=new vr;if(e instanceof g)t.graphicData=[e.getX().toString(),e.getY().toString()],t.graphicType=gr;else if(e instanceof jo)t.graphicData=[e.getBegin().getX().toString(),e.getBegin().getY().toString(),e.getEnd().getX().toString(),e.getEnd().getY().toString()],t.graphicType=pr;else if(e instanceof tr){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=pr}else if(e instanceof nr){t.graphicData=[];for(let n=0;n<e.getLength();++n)t.graphicData.push(e.getPoint(n).getX().toString()),t.graphicData.push(e.getPoint(n).getY().toString());const n=e.getPoint(0);t.graphicData.push(n.getX().toString()),t.graphicData.push(n.getY().toString()),t.graphicType=pr}else if(e instanceof ir){const n=e.getCenter(),i=new g(n.getX()+e.getRadius(),n.getY());t.graphicData=[n.getX().toString(),n.getY().toString(),i.getX().toString(),i.getY().toString()],t.graphicType=mr}else if(e instanceof or){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=fr}else if(e instanceof ar){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=pr}else if(e instanceof lr){let n=0,i=0;const o=e.getBegin(),r=e.getEnd(),a=e.shortAxisCenter instanceof g?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 g(a.getX()+n*u,a.getY()+i*u),S=new g(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(),S.getX().toString(),S.getY().toString()],t.graphicType=pr}return t}function yr(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 g(parseFloat(e.graphicData[i]),parseFloat(e.graphicData[i+1])));let i=!1;const r=n.length;if(r>2){const e=n[0],t=n[r-1];i=e.equals(t)}let a;if(e.graphicType===gr)n.length>1&&o.warn(`Expecting 1 point for point, got ${r}`),a=n[0];else if(e.graphicType===mr){if(n.length<2)throw new Error(`Expecting 2 points for circles, got ${r}`);n.length>2&&o.warn(`Expecting 2 points for circles, got ${r}`);const e=n[0],t=n[1].getDistance(e);a=new ir(e,t)}else if(e.graphicType===fr){if(n.length<4)throw new Error(`Expecting 4 points for ellipses, got ${r}`);n.length>4&&o.warn(`Expecting 4 points for ellipses, got ${r}`);const e=n[0].getDistance(n[1])/2,t=n[2].getDistance(n[3])/2,i=new g(n[0].getX()+e,n[0].getY());a=new or(i,e,t)}else if(e.graphicType===pr)if(i)if(5===n.length){const e=new jo(n[0],n[1]),t=new jo(n[1],n[2]),i=new jo(n[2],n[3]),o=new jo(n[3],n[4]);a=_o(e,t)&&_o(t,i)&&_o(i,o)?new ar(n[0],n[2]):new nr(n.slice(0,-1))}else a=new nr(n.slice(0,-1));else if(2===n.length)a=new jo(n[0],n[1]);else if(3===n.length)a=new tr([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 r=.5;a=new lr(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(),S=Math.sqrt(c*c+u*u),p=Math.sqrt(d*d+h*h),m=S+p,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&&(r=(t*f+n*v)/i),D=Math.max(0,Math.min(1,r))}a.shortAxisLength=m,a.shortAxisT=D,a.shortAxisL1=S,a.shortAxisL2=p,a.shortAxisCenter=new g(s,l),a.hasShortAxisInteraction=!0}return a}const Ir="00700022",wr="00700023",Tr="30060024",Lr="0070031A";class Pr{graphicData;graphicType;referencedFrameofReferenceUID;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Ar(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 Or={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"},br="CONTAINS",xr="HAS PROPERTIES",Er="HAS OBS CONTEXT",Rr="INFERRED FROM",Fr="SELECTED FROM",Mr="HAS CONCEPT MOD",qr="TEXT",Ur="NUM",Qr="CODE",Vr="UIDREF",Nr="COMPOSITE",Br="IMAGE",kr="SCOORD",Gr="SCOORD3D",zr="CONTAINER",Hr="SEPARATE",Yr={TEXT:"TextValue",DATE:"Date",TIME:"Time",DATETIME:"DateTime",UIDREF:"UID",PNAME:"PersonName",CONTAINER:"ContinuityOfContent"};function Xr(e){let t;const n=re(e,Or.ContentTemplateSequence);if(void 0!==n){const e=re(n,Or.MappingResource),i=re(n,Or.TemplateIdentifier);void 0!==e&&void 0!==i&&(t=`${e}-${i}`)}return t}class Wr{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 $r(e){let t=re(e,Or.ValueType);void 0===t&&(t="");const n=new Wr(t);n.relationshipType=re(e,Or.RelationshipType);const i=re(e,Or.ConceptNameCodeSequence);if(void 0!==i&&(n.conceptNameCode=sn(i)),t===Qr)n.value=sn(re(e,Or.ConceptCodeSequence));else if(t===Ur)n.value=function(e){const t=new Qo;return void 0!==e[qo]&&(t.measuredValue=function(e){const t=new Fo;return void 0!==e[Oo]&&(t.numericValue=parseFloat(e[Oo].value[0])),void 0!==e[bo]&&(t.floatingPointValue=parseFloat(e[bo].value[0])),void 0!==e[xo]&&(t.rationalNumeratorValue=parseInt(e[xo].value[0],10)),void 0!==e[Eo]&&(t.rationalDenominatorValue=parseInt(e[Eo].value[0],10)),void 0!==e[Ro]&&(t.measurementUnitsCode=sn(e[Ro].value[0])),t}(e[qo].value[0])),void 0!==e[Uo]&&(t.numericValueQualifierCode=sn(e[Uo].value[0])),t}(e);else if(t===Br)n.value=function(e){const t=new Wo;return void 0!==e[Ho]&&(t.referencedFrameNumber=e[Ho].value[0]),void 0!==e[Yo]&&(t.referencedSOPSequence=Go(e[Yo].value[0])),void 0!==e[Xo]&&(t.referencedSegmentNumber=e[Xo].value[0]),t}(e);else if(t===Nr)n.value=Go(re(e,Or.ReferencedSOPSequence));else if(t===kr)n.value=function(e){const t=new vr;return void 0!==e[ur]&&(t.graphicData=e[ur].value),void 0!==e[dr]&&(t.graphicType=e[dr].value[0]),void 0!==e[cr]&&(t.pixelOriginInterpretation=e[cr].value[0]),void 0!==e[hr]&&(t.fiducialUID=e[hr].value[0]),t}(e);else if(t===Gr)n.value=function(e){const t=new Pr;return void 0!==e[Ir]&&(t.graphicData=e[Ir].value),void 0!==e[wr]&&(t.graphicType=e[wr].value[0]),void 0!==e[Tr]&&(t.referencedFrameofReferenceUID=e[Tr].value[0]),void 0!==e[Lr]&&(t.fiducialUID=e[Lr].value[0]),t}(e);else{const i=Yr[t];void 0!==i?n.value=re(e,Or[i]):console.warn(`Unsupported input ValueType: ${t}`)}const o=ae(e,Or.ContentSequence);if(void 0!==o)for(const e of o)n.contentSequence.push($r(e));return n}function jr(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:[ln(e.conceptNameCode)]}),"CODE"===e.valueType)t.ConceptCodeSequence={value:[ln(e.value)]};else if(e.valueType===Ur)t={...t,...Vo(e.value)};else if(e.valueType===Br)t={...t,...$o(e.value)};else if(e.valueType===Nr)t={...t,...zo(e.value)};else if(e.valueType===kr)t={...t,...Cr(e.value)};else if(e.valueType===Gr)t={...t,...Ar(e.value)};else{const n=Yr[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(jr(n))}return t}function Zr(e,t,n,i){const o=function(e){const t=Nn[e];let n;return void 0!==t&&(n="DCM"===t.scheme?qn({meaning:e,value:t.key}):Un(t.key,t.scheme)),n}(e);if(void 0===o)return;let r=br;void 0!==i&&(r=i);const a=new Wr(Ur);a.relationshipType=r,a.conceptNameCode=o;const s=new Fo;s.numericValue=t,s.measurementUnitsCode=kn(n);const l=new Qo;return l.measuredValue=s,a.value=l,a}class _r{#$t;#n;#i;constructor(e,t,n){this.#$t=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 _r(_r.idFromIndex(e),t,n)}getId(){return this.#$t}getX(){return this.#n}getY(){return this.#i}setX(e){this.#n=e}setY(e){this.#i=e}}const Kr={arrow:{"*":""},circle:{"*":"{surface}"},ellipse:{"*":"{surface}"},protractor:{"*":"{angle}"},rectangle:{"*":"{surface}"},roi:{"*":""},ruler:{"*":"{length}"},bidimensional:{"*":"{longAxis} x {shortAxis}"},bidimensionalDrawing:{"*":"{longAxis}"}};function Jr(e){return"label"===e.name()}function ea(e){return"shape"===e.name()}function ta(e){return"position-group"===e.name()}function na(t,n){const i=t.getChildren((function(e){return e.id()===`anchor${n}`}))[0];if(i instanceof e.Ellipse)return i}function ia(e){return function(t){return t.id()===e}}function oa(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 ra(e){return void 0!==Xe.labelTexts&&void 0!==Xe.labelTexts[e]?Xe.labelTexts[e]:Kr[e]}class aa{#u="rectangle";#jt;static supports(e){return e instanceof ar}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new ar(t[0],t[1]),e.setTextExpr(ra(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=_r.indexFromId(t.getId()),i=(n+1)%4,o=(n+2)%4,r=(n+3)%4;void 0===this.#jt&&(this.#jt=this.getAnchors(e));const a=this.#jt[o];this.#jt[n]=t,n%2==0?(this.#jt[r].setX(t.getX()),this.#jt[i].setY(t.getY())):(this.#jt[r].setY(t.getY()),this.#jt[i].setX(t.getX())),e.mathShape=new ar(new g(a.getX(),a.getY()),new g(t.getX(),t.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new ar(new g(i.getX()+t.x,i.getY()+t.y),new g(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){this.#jt=void 0}getAnchors(e){if(void 0!==this.#jt)return this.#jt;const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[_r.fromIndex(0,n,i),_r.fromIndex(1,n+o,i),_r.fromIndex(2,n+o,i+r),_r.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 g(n+o/2,i),new g(n,i+r/2),new g(n+o/2,i+r),new g(n+o,i+r/2)]}getDefaultLabelPosition(e){const t=e.mathShape;return new g(t.getBegin().getX(),t.getEnd().getY())}}class sa{#u="circle";static supports(e){return e instanceof ir}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 ir(t[0],Math.round(Math.sqrt(n*n+i*i))),e.setTextExpr(ra(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=new g(n.getCenter().getX(),n.getCenter().getY()),o=new g(t.getX(),t.getY());e.mathShape=new ir(i,i.getDistance(o)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new ir(new g(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:o.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[_r.fromIndex(0,n-o,i),_r.fromIndex(1,n+o,i),_r.fromIndex(2,n,i+o),_r.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 g(n-o,i-o),new g(n+o,i-o),new g(n-o,i+o),new g(n+o,i+o)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter(),i=t.getRadius();return new g(n.getX()-i,n.getY()+i)}}class la{#u="ellipse";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){const n=Math.abs(t[0].getX()-t[1].getX()),i=Math.abs(t[0].getY()-t[1].getY());e.mathShape=new or(t[0],n,i),e.setTextExpr(ra(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=n.getCenter();let r=n.getA(),a=n.getB();switch(t.getId()){case"anchor0":r=i.getX()-t.getX();break;case"anchor1":r=t.getX()-i.getX();break;case"anchor2":a=t.getY()-i.getY();break;case"anchor3":a=i.getY()-t.getY();break;default:o.error(`Unhandled anchor id: ${t.getId()}`)}e.mathShape=new or(i,Math.abs(r),Math.abs(a)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new or(new g(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:o.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[_r.fromIndex(0,n-o,i),_r.fromIndex(1,n+o,i),_r.fromIndex(2,n,i+r),_r.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 g(n-o,i-r),new g(n+o,i-r),new g(n-o,i+r),new g(n+o,i+r)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter();return new g(n.getX()-t.getA(),n.getY()+t.getB())}}class ca{#u="ruler";static supports(e){return e instanceof jo}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new jo(t[0],t[1]),e.setTextExpr(ra(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[_r.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new jo(new g(i.getX(),i.getY()),new g(o.getX(),o.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new jo(new g(i.getX()+t.x,i.getY()+t.y),new g(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[_r.fromIndex(0,n.getX(),n.getY()),_r.fromIndex(1,i.getX(),i.getY())]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[new g((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 ua{#u="arrow";static supports(e){return e instanceof g}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(ra(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[_r.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new g(i.getX(),i.getY()),e.referencePoints=[new g(o.getX(),o.getY())],e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=e.referencePoints[0];e.mathShape=new g(n.getX()+t.x,n.getY()+t.y),e.referencePoints=[new g(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[_r.fromIndex(0,t.getX(),t.getY()),_r.fromIndex(1,n.getX(),n.getY())]}getConnectorPositions(e){const t=e.mathShape,n=e.referencePoints[0];return[new g((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 nr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new nr(t),e.setTextExpr(ra(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape.getPoints().slice();n[_r.indexFromId(t.getId())]=new g(t.getX(),t.getY()),e.mathShape=new nr(n),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<n.getLength();++e)i.push(new g(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new nr(i),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=[];for(let e=0;e<t.getLength();++e){const i=t.getPoint(e);n.push(_r.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 g((o.getX()+r.getX())/2,(o.getY()+r.getY())/2))}return i}getDefaultLabelPosition(e){return e.mathShape.getPoint(0)}}class ha{#u="protractor";static supports(e){return e instanceof tr}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 tr(t),e.setTextExpr(ra(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[_r.indexFromId(t.getId())]=t;const i=n[0],o=n[1],r=n[2];e.mathShape=new tr([new g(i.getX(),i.getY()),new g(o.getX(),o.getY()),new g(r.getX(),r.getY())]),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<3;++e)i.push(new g(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new tr(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(_r.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){return[e.mathShape.getPoint(1)]}getDefaultLabelPosition(e){const t=e.mathShape,n=new jo(t.getPoint(0),t.getPoint(1)),i=new jo(t.getPoint(1),t.getPoint(2));return new g((n.getCentroid().getX()+i.getCentroid().getX())/2,(n.getCentroid().getY()+i.getCentroid().getY())/2)}}function ga(e,t,n,i=20){const o=Ko(t,t.getBegin(),i,n),r=Ko(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 Sa{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 pa(e){const t=new jo(e.getPoint(0),e.getPoint(1)),n=new jo(e.getPoint(1),e.getPoint(2));let i=Zo(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 ma(t,n,i){const{radius:o,angle:r,inclination:a}=pa(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 fa(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 va={rectangle:new class extends Sa{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 Sa{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 Sa{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 Sa{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 ga(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()]),ga(e,i,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=n.getZoomScale(),r=Ko(i,i.getBegin(),20,o),a=Ko(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=Ko(o,o.getBegin(),20,r),s=Ko(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 Sa{createShape(t,n){const i=t.mathShape,o=t.referencePoints[0],r=new jo(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 ga(a,r,n.getZoomScale()),a}updateShape(e,t,n){const i=t.mathShape,o=t.referencePoints[0],r=new jo(i,o);e.position({x:0,y:0}),e.points([i.getX(),i.getY(),o.getX(),o.getY()]),ga(e,r,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=t.referencePoints[0],r=Jo(new jo(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=Jo(new jo(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 Sa{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 Sa{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()&&fa(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()]),fa(e,n)}createExtras(e,t){const n=e.mathShape;return 3!==n.getLength()?[]:[ma(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}=pa(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 Ca(e){const t=va[e];return t||o.error(`shapePainters: no painter for shape '${e}'`),t}class Da{#Zt;constructor(e){this.#Zt=e}getPosition(e){let t=e.labelPosition;return void 0===t&&(t=this.#Zt(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 g(t+i/2,n),new g(t,n+o/2),new g(t+i/2,n+o),new g(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 ya{#_t;#Kt;constructor(e){this.#_t=e,this.#Kt=new Da((t=>e.getDefaultLabelPosition(t)))}createShapeGroup(t,n){const i=Ca(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.#Kt.create(t,n);o.add(e);const r=this.#_t.getConnectorPositions(t);o.add(this.#Kt.getConnector(r,e,n))}return o}getAnchors(e,t){return e?this.#_t.getAnchors(e).map((e=>oa(e.getX(),e.getY(),e.getId(),t))):[]}constrainAnchorMove(e,t){const n=new _r(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 _r(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=Ca(this.#_t.getName()),a=o.getChildren(ea)[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.#Kt.updatePosition(t,o),this.updateConnector(t,o)}updateLabelContent(e,t,n){this.#Kt.updateContent(e,t)}updateConnector(e,t){const n=this.#_t.getConnectorPositions(e);this.#Kt.updateConnector(t,n)}}class Ia{#Jt=0;#en=0;getMin(){return this.#Jt}setMin(e){this.#Jt=e}getMax(){return this.#en}setMax(e){this.#en=e}getName(){return"Threshold"}#tn=null;setOriginalImage(e){this.#tn=e}getOriginalImage(){return this.#tn}update(){const e=this.getOriginalImage(),t=e.getDataRange().min;return e.transform((e=>e<this.getMin()||e>this.getMax()?t:e))}}class wa{getName(){return"Sharpen"}#tn=null;setOriginalImage(e){this.#tn=e}getOriginalImage(){return this.#tn}update(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])}}class Ta{getName(){return"Sobel"}#tn=null;setOriginalImage(e){this.#tn=e}getOriginalImage(){return this.#tn}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 La{getName(){return""}execute(){}undo(){}}class Pa extends EventTarget{#nn=[];#in=0;getStackSize(){return this.#nn.length}getCurrentStackIndex(){return this.#in}getCurrentCommand(){return this.#nn[this.#in-1]}add(e){this.#nn=this.#nn.slice(0,this.#in),this.#nn.push(e),++this.#in,this.dispatchEvent(new Event("undoadd"))}remove(e){let t=!1;const n=this.#nn.findIndex((function(t){return t.getName()===e}));return-1!==n&&(t=!0,this.dispatchEvent(new CustomEvent("undoremove",{detail:{commandName:e}})),this.#nn.splice(n,1),--this.#in),t}undo(){this.#in>0&&(this.dispatchEvent(new Event("undo")),--this.#in,this.#nn[this.#in].undo())}redo(){this.#in<this.#nn.length&&(this.#nn[this.#in].execute(),++this.#in,this.dispatchEvent(new Event("redo")))}}class Aa extends La{#on;#tt;#rn;constructor(e,t,n){super(),this.#on=e,this.#tt=t,this.#rn=n}getName(){return`Filter-${this.#on.getName()}`}execute(){this.#rn.getDataController().setImage(this.#tt,this.#on.update()),this.#rn.getStageController().render(this.#tt);const e={type:"filterrun",id:this.getName(),dataId:this.#tt};this.onExecute(e)}undo(){this.#rn.getDataController().setImage(this.#tt,this.#on.getOriginalImage()),this.#rn.getStageController().render(this.#tt);const e={type:"filterundo",id:this.getName(),dataid:this.#tt};this.onUndo(e)}onExecute(e){}onUndo(e){}}class Oa extends EventTarget{#rn;constructor(e){super(),this.#rn=e}#an;#sn=0;#ln=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))};activate(e){for(const t in this.#an)e?(this.#an[t].addEventListener("filterrun",this.#ln),this.#an[t].addEventListener("filterundo",this.#ln)):(this.#an[t].removeEventListener("filterrun",this.#ln),this.#an[t].removeEventListener("filterundo",this.#ln))}setOptions(e){this.#an={};for(const t in e)this.#an[t]=new e[t](this.#rn)}getOptionsType(){return"instance"}init(){for(const e in this.#an)this.#an[e].init()}keydown=e=>{e.context="Filter",this.#rn.onKeydown(e)};getEventNames(){return["filterrun","filterundo"]}getSelectedFilter(){return this.#sn}setFeatures(e){if(void 0!==e.filterName){if(!this.hasFilter(e.filterName))throw new Error(`Unknown filter: '${e.filterName}'`);this.#sn&&this.#sn.activate(!1),this.#sn=this.#an[e.filterName],this.#sn.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.#an}hasFilter(e){return void 0!==this.#an?.[e]}}class ba extends EventTarget{#rn;constructor(e){super(),this.#rn=e}#on=new Ia;#cn=!0;activate(e){e&&(this.#cn=!0)}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run threshod filter on.");if(this.#on.setMin(e.min),this.#on.setMax(e.max),this.#cn){const t=this.#rn.getDataController().get(e.dataId).image;this.#on.setOriginalImage(t),this.#cn=!1}const t=new Aa(this.#on,e.dataId,this.#rn);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.#rn.getUndoController().addToUndoStack(t)}}class xa extends EventTarget{#rn;constructor(e){super(),this.#rn=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sharpen filter on.");const t=new wa,n=this.#rn.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Aa(t,e.dataId,this.#rn);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.#rn.getUndoController().addToUndoStack(i)}}class Ea extends EventTarget{#rn;constructor(e){super(),this.#rn=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sobel filter on.");const t=new Ta,n=this.#rn.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Aa(t,e.dataId,this.#rn);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.#rn.getUndoController().addToUndoStack(i)}}const Ra={},Fa={draw:{ArrowFactory:class{#_t=new ua;#un=new ya(this.#_t);static supports(e){return ua.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.#un.createShapeGroup(e,t)}getAnchors(e,t){return this.#un.getAnchors(e,t)}constrainAnchorMove(e,t){this.#un.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#un.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#un.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#un.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#_t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#un.updateLabelContent(e,t,n)}updateConnector(e,t){this.#un.updateConnector(e,t)}},CircleFactory:class{#_t=new sa;#un=new ya(this.#_t);static supports(e){return sa.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.#un.createShapeGroup(e,t)}getAnchors(e,t){return this.#un.getAnchors(e,t)}constrainAnchorMove(e,t){this.#un.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#un.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#un.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#un.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#_t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#un.updateLabelContent(e,t,n)}updateConnector(e,t){this.#un.updateConnector(e,t)}},EllipseFactory:class{#_t=new la;#un=new ya(this.#_t);static supports(e){return la.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.#un.createShapeGroup(e,t)}getAnchors(e,t){return this.#un.getAnchors(e,t)}constrainAnchorMove(e,t){this.#un.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#un.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#un.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#un.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#_t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#un.updateLabelContent(e,t,n)}updateConnector(e,t){this.#un.updateConnector(e,t)}},ProtractorFactory:class{#_t=new ha;#un=new ya(this.#_t);static supports(e){return ha.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.#un.createShapeGroup(e,t)}getAnchors(e,t){return this.#un.getAnchors(e,t)}constrainAnchorMove(e,t){this.#un.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#un.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#un.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#un.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#_t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#un.updateLabelContent(e,t,n)}updateConnector(e,t){this.#un.updateConnector(e,t)}},RectangleFactory:class{#_t=new aa;#un=new ya(this.#_t);static supports(e){return aa.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.#un.createShapeGroup(e,t)}getAnchors(e,t){return this.#un.getAnchors(e,t)}constrainAnchorMove(e,t){this.#un.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#un.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#un.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#un.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#_t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#un.updateLabelContent(e,t,n)}updateConnector(e,t){this.#un.updateConnector(e,t)}},RoiFactory:class{#_t=new da;#un=new ya(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.#un.createShapeGroup(e,t)}getAnchors(e,t){return this.#un.getAnchors(e,t)}constrainAnchorMove(e,t){this.#un.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#un.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#un.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#un.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#_t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#un.updateLabelContent(e,t,n)}updateConnector(e,t){this.#un.updateConnector(e,t)}},RulerFactory:class{#_t=new ca;#un=new ya(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.#un.createShapeGroup(e,t)}getAnchors(e,t){return this.#un.getAnchors(e,t)}constrainAnchorMove(e,t){this.#un.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#un.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#un.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#un.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#_t.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#un.updateLabelContent(e,t,n)}updateConnector(e,t){this.#un.updateConnector(e,t)}},BidimensionalFactory:class{#u="bidimensional";#Kt=new Da(this.#dn);static supports(e){return e instanceof lr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}#hn(e){return void 0!==Xe.labelTexts&&void 0!==Xe.labelTexts[this.#u]?Xe.labelTexts[this.#u]:!0===e.mathShape.hasShortAxisInteraction&&null!==e.quantification?.shortAxis?.value?Kr[this.#u]:Kr[`${this.#u}Drawing`]}setAnnotationMathShape(e,t){const n=new lr(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.#hn(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.#gn(t,n);i.add(o);const r=this.#Sn(t,n);for(const e of r)i.add(e);const a=this.#Kt.create(t,n);i.add(a);const s=this.#pn(o);i.add(this.#Kt.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}#gn(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 ga(o,i,n.getZoomScale?n.getZoomScale():{x:1,y:1}),o}#Sn(t,n){const i=t.mathShape,o=10,r=n.getZoomScale?n.getZoomScale():{x:1,y:1},a=Ko(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=Ko(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"})]}#pn(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 g(o,r)]}#mn(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.#mn(e),i=[];for(let e=0;e<n.length;++e)i.push(oa(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.#fn(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Kt.updatePosition(t,o),this.updateConnector(t,o))}#fn(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()]),ga(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=Ko(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=Ko(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=na(r,2),m=na(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.#hn(t)),t.updateQuantification?.(),r.getLayer()?.draw()}updateLabelContent(e,t,n){this.#Kt.updateContent(e,t)}updateConnector(t,n){const i=n.findOne(".shape");if(i&&i instanceof e.Line){const e=this.#pn(i);this.#Kt.updateConnector(n,e)}}#dn(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 g(i.getX()+t.x,i.getY()+t.y),a=new g(o.getX()+t.x,o.getY()+t.y),s=new lr(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 g(n.shortAxisCenter.getX()+t.x,n.shortAxisCenter.getY()+t.y)),s.hasShortAxisInteraction=n.hasShortAxisInteraction,e.mathShape=s,e.updateQuantification()}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=i.findOne(".shape"),r=na(i,0),a=na(i,1),s=new g(r.x()-o.x(),r.y()-o.y()),l=new g(a.x()-o.x(),a.y()-o.y()),c=new lr(s,l),u=t.mathShape;if(u.shortAxisCenter instanceof g){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 g(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 g(n.getX()-l*o/2,n.getY()-c*o/2),d=new g(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 S=new g(i.getX()-l*o/2,i.getY()-c*o/2),p=new g(i.getX()+l*o/2,i.getY()+c*o/2),m=t.findOne(".short-axis-tick1");m&&m instanceof e.Line&&(m.position({x:0,y:0}),m.points([S.getX(),S.getY(),p.getX(),p.getY()]),m.opacity(.5))}getShortAxisEndpoints(e){const t=e.mathShape;let n;if(e.mathShape.shortAxisCenter instanceof g){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 g(n.getX()+l*u,n.getY()+c*u),new g(n.getX()-l*d,n.getY()-c*d)]}getPointAlongLine(e,t){const n=e.getBegin(),i=e.getEnd();return new g(n.getX()+(i.getX()-n.getX())*t,n.getY()+(i.getY()-n.getY())*t)}}},filter:{Threshold:ba,Sobel:Ea,Sharpen:xa}};class Ma{#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 qa=0;class Ua{action;value;constructor(e){this.action=e}}const Qa={copy:e=>e,remove:()=>null,clear:e=>(e.value=[],e),replace:(e,t)=>(e.value=[t],e)};function Va(e){const t=`.${(new Date).toISOString().replace(/\D/g,"").substring(0,14)}`;qa+=1;const n=`.${qa}`;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 Na(e){return e%2==0}function Ba(e){const t=$[e];return void 0!==t&&"string"===t}function ka(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}class Ga{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 za="00080005",Ha="00280100";class Ya{#vn=!1;#Cn=!0;#Dn={default:{action:"copy",value:null}};#yn=this.#Dn;#In=[];#wn=new Ga;#Tn=this.#wn;setUseUnVrForPrivateSq(e){this.#vn=e}setFixUnknownVR(e){this.#Cn=e}setRules(e,t){if(this.#yn=e,this.#In=[],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=ee(R(n));t=void 0!==e?.getName()}if(t)e=n;else{const t=ne(n);void 0!==t&&(e=t.getKey())}void 0!==e&&this.#In.push(e)}}}}#Ln(e){return this.#wn.encode(e)}#Pn(e){return this.#Tn.encode(e)}useSpecialTextEncoder(){this.#Tn=new TextEncoder}getElementToWrite(e){const t=te(e.tag),n=ee(e.tag),i=n?.getName();let o;return o=void 0!==this.#yn[e.tag.getKey()]?this.#yn[e.tag.getKey()]:void 0!==i&&void 0!==this.#yn[i]?this.#yn[i]:void 0!==this.#yn[t]?this.#yn[t]:this.#yn.default,Qa[o.action](e,o.value)}#An(e,t,n,i,o){const r=function(e){return M(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 ie("NONE");l.vl=n?4294967295:s.vl,l.tag=F(),l.value=[],t=this.#On(e,l,t,i);for(const n of a)r(n)||q(n.tag)||(t=this.#On(e,n,t,i,o));if(n){const n=new ie("NONE");n.vl=0,n.tag=new x("FFFE","E00D"),n.value=[],t=this.#On(e,n,t,i)}}return t}#bn(e,t,n,i,r,a){const s=n;if("NONE"===t.vr);else if(i instanceof Uint8Array)if(void 0!==a&&1===a){if(i.length%8!=0){o.debug("Padding binary pixel data");const e=8*Math.ceil(i.length/8),t=new Array(e-i.length);t.fill(0),i=ka(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 a=$[t.vr];if(void 0!==a)if("Uint8"===a)n=e.writeUint8Array(n,i);else if("Uint16"===a)n=e.writeUint16Array(n,i);else if("Int16"===a)n=e.writeInt16Array(n,i);else if("Uint32"===a)n=e.writeUint32Array(n,i);else if("Int32"===a)n=e.writeInt32Array(n,i);else if("Uint64"===a)n=e.writeUint64Array(n,i);else if("Int64"===a)n=e.writeInt64Array(n,i);else if("Float32"===a)n=e.writeFloat32Array(n,i);else if("Float64"===a)n=e.writeFloat64Array(n,i);else{if("string"!==a)throw new Error(`Unknown VR type: ${a}`);n=e.writeUint8Array(n,i)}else if("SQ"===t.vr)n=this.#An(e,n,i,r);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):o.warn(`Unknown VR: ${t.vr}`)}if("SQ"!==t.vr&&"NONE"!==t.vr){const e=n-s;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})`,o.warn(n)}}return n}#xn(e,t,n,i,o,r){let a=!1;if(void 0!==t.undefinedLength&&(a=t.undefinedLength),a){const a=[];a.push({tag:F(),vr:"NONE",vl:0,value:[]});for(const e of i)a.push({tag:F(),vr:t.vr,vl:e.length,value:e});n=this.#An(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.#bn(e,t,n,a,o,r)}return n}#On(e,t,n,i,r){const a=t.tag.isWithVR(),s=!(!i&&a)||Y(t.vr);n=e.writeHex(n,t.tag.getGroup()),n=e.writeHex(n,t.tag.getElement());let l=t.vr;this.#vn&&t.tag.isPrivate()&&"SQ"===l&&(o.warn("Write element using VR=UN for private sequence."),l="UN"),a&&!i&&(n=e.writeUint8Array(n,this.#Ln(l)),s&&(n+=2));let c=!1;("SQ"===t.vr||V(t.tag))&&void 0!==t.undefinedLength&&(c=t.undefinedLength);let u=!1;M(t.tag)&&void 0!==t.undefinedLength&&(u=t.undefinedLength);let d=t.vl;(c||u)&&(d=4294967295),n=s?e.writeUint32(n,d):e.writeUint16(n,d);let h=t.value;if(void 0===h&&(h=[]),n=V(t.tag)?this.#xn(e,t,n,h,i,r):this.#bn(e,t,n,h,i),c){const t=new ie("NONE");t.vl=0,t.tag=new x("FFFE","E0DD"),t.value=[],n=this.#On(e,t,n,i)}return n}getBuffer(e){const t=e["00020010"].value[0],n=fe(t),i=ve(t);if(void 0!==e[za]){const t=e[za].value[0];void 0!==t&&"ISO-IR 6"!==t&&(o.debug(`Change charset to UTF, was: ${t}`),this.useSpecialTextEncoder(),e[za].value=["ISO_IR 192"])}let r;void 0!==e[Ha]&&(r=e[Ha].value[0]);let a,s=132;const l=[],c=[];let u,d,h=0;const g=new x("0002","0000"),S=new x("0002","0001"),p=new x("0002","0012"),m=new x("0002","0013"),f=this.#In.slice(),v=Object.keys(e);for(const t of v){const o=e[t];if(o.tag=R(t),u=this.getElementToWrite(o),!(null===u||g.equals(u.tag)||S.equals(u.tag)||p.equals(u.tag)||m.equals(u.tag))){a=0;const e=f.indexOf(u.tag.getKey());-1!==e&&f.splice(e,1),this.#Cn&&Xa(u,!i),this.#En(u,u.value,n,r),d=te(u.tag),a+=Te(u.vr,"Meta Element"!==d&&n),a+=u.vl,"Meta Element"===d?(l.push(u),h+=a):c.push(u),s+=a}}for(const e of f){const t=R(e),i=ee(t),o=new ie(i?.getVr());let r;if(o.tag=t,void 0!==this.#yn[e])r=this.#yn[e].value;else{const e=i?.getName();r=this.#yn[e].value}let a=Te(o.vr,n);a+=this.#En(o,[r],n),c.push(o),s+=a}const C=Wa("FileMetaInformationVersion");let D=Te(C.vr,!1);D+=this.#En(C,[0,1],!1),l.push(C),h+=D,s+=D;const y=Wa("ImplementationClassUID");let I=Te(y.vr,!1);const w=`1.2.826.0.1.3680043.9.7278.1.${"0.37.0-beta.12".replace("-beta",".99")}`;I+=this.#En(y,[w],!1),l.push(y),h+=I,s+=I;const T=Wa("ImplementationVersionName");let L=Te(T.vr,!1);L+=this.#En(T,["DWV_0.37.0-beta.12"],!1),l.push(T),h+=L,s+=L;const P=function(e,t){return E(e.tag,t.tag)};l.sort(P),c.sort(P);const A=Wa("FileMetaInformationGroupLength");let O=Te(A.vr,!1);O+=this.#En(A,new Uint32Array([h]),!1),s+=O;const b=new ArrayBuffer(s),F=new Ma(b),M=new Ma(b,!i);let q=128;q=F.writeUint8Array(q,this.#Ln("DICM")),q=this.#On(F,A,q,!1);for(const e of l)q=this.#On(F,e,q,!1);const U=132+O+h;q!==U&&o.warn(`Bad size calculation... meta offset: ${q}, calculated size:${U} (diff:${q-U})`);for(const e of c)q=this.#On(M,e,q,n,r);return q!==s&&o.warn(`Bad size calculation... final offset: ${q}, calculated size:${s} (diff:${q-s})`),b}#En(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[Ha];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=R(e),M(i.tag)||(l+=this.#En(i,i.value,n,c),s.push(i),l+=Te(i.vr,n))}const h={tag:F(),vr:"NONE",vl:l,value:[]};a&&(h.undefinedLength=a),s.push(h),l+=Te(h.vr,n),a&&(l+=Te("NONE",n));const g=function(e,t){return E(e.tag,t.tag)};s.sort(g),o+=l,r.push(s)}a&&(o+=Te("NONE",n)),e.value=r,e.vl=o,a&&(e.undefinedLength=a)}}else{if(Ba(r=e.vr)||"OB"===r){const n=function(e){let t="";return Ba(e)&&(t="UI"===e?"\0":" "),t}(e.vr);if(Ba(e.vr)){let i;W(e.vr)?(t=this.#Pn(t.join("\\")),i=this.#Pn(n)):(t=this.#Ln(t.join("\\")),i=this.#Ln(n)),Na(t.length)||(t=ka(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;Na(t)||(e[e.length-1]=ka(e[e.length-1],[0]))}else Na(e.length)||(e=ka(e,[0]));return e}(t))}if("AT"===e.vr)o=4*t.length;else if("xs"===e.vr)o=t.length*Uint16Array.BYTES_PER_ELEMENT;else if(function(e){const t=$[e];return void 0!==t&&"string"!==t}(e.vr)||"ox"===e.vr){if(V(e.tag)&&Array.isArray(t)){o=0;for(const e of t)o+=e.length}else o=t.length;const r=$[e.vr];if(V(e.tag)||"ox"===e.vr)if(e.undefinedLength){const e=Te("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 Xa(e,t){if("UN"===e.vr){const n=ee(e.tag)?.getVr();if(void 0!==n&&e.vr!==n){e.vr=n;const i=$[e.vr];if(void 0!==i&&"Uint8"!==i&&"string"!==i){const n=function(e,t,n){let i;if(void 0===e.buffer)return i;const o=new ce(e.buffer,n),r=e.byteOffset,a=e.length,s=$[t];return"Uint16"===s?i=o.readUint16Array(r,a):"Uint32"===s?i=o.readUint32Array(r,a):"Uint64"===s?i=o.readUint64Array(r,a):"Int16"===s?i=Array.from(o.readInt16Array(r,a)):"Int32"===s?i=Array.from(o.readInt32Array(r,a)):"Int64"===s?i=o.readInt64Array(r,a):"Float32"===s?i=Array.from(o.readFloat32Array(r,a)):"Float64"===s&&(i=Array.from(o.readFloat64Array(r,a))),i}(e.value,e.vr,t);void 0!==n&&(e.value=n)}o.info(`Element ${e.tag.getGroup()} ${e.tag.getElement()} VR changed from UN to ${e.vr}`)}}}function Wa(e){const t=ne(e),n=ee(t),i=new ie(n?.getVr());return i.tag=t,i}class $a{trackingId;trackingUid;referencedSopInstanceUID;referencedSopClassUID;referencedFrameNumber;mathShape;referencePoints;colour="#ffff80";quantification;textExpr="";labelPosition;planeOrigin;planePoints;#Rn;#be={};constructor(){this.trackingId=Math.random().toString(36).substring(2,15),this.trackingUid=Va("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]&&o.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=tt(this.planePoints[1].getValues().concat(this.planePoints[2].getValues()))),e}init(e){if(void 0!==this.referencedSopInstanceUID)return void o.debug("Cannot initialise annotation twice");this.#Rn=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.#Rn}isCompatibleView(e){let t=!1;if(void 0===this.planePoints)e.isAquisitionOrientation()&&(t=!0);else{const n=e.getCosines(),i=new S(n[0],n[1],n[2]),o=new S(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.#Rn=e,this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID)):o.warn(`Cannot view annotation with reference UID: ${this.referencedSopInstanceUID}`)}#Fn(){let e;if(void 0!==this.#Rn){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 m(n);e=this.#Rn.getIndexFromPosition(i)}return e}getCentroid(){let e;if(void 0!==this.#Rn&&void 0!==this.mathShape.getCentroid&&void 0!==this.mathShape.getCentroid()){const t=this.#Fn(),n=this.#Rn.getScrollDimIndex(),i=t.getValues()[n],o=this.mathShape.getCentroid();if(e=this.#Rn.getPositionFromPlanePoint(o,i),void 0!==this.referencedFrameNumber){const t=e.getValues();t[3]=this.referencedFrameNumber,e=new m(t)}}return e}setTextExpr(e){if(void 0!==this.#Rn){const t=this.#Rn.getModality();void 0!==e[t]?this.textExpr=e[t]:this.textExpr=e["*"]}else o.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=C(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+=f.t(o.unit));const r=`{${i[e]}}`;n=n.replace(r,t)}}return n}(this.textExpr,this.quantification)}updateQuantification(){void 0!==this.#Rn&&void 0!==this.mathShape.quantify&&(this.quantification=this.mathShape.quantify(this.#Rn,this.#Fn(),C(this.textExpr)))}getFactory(){let e;if(void 0===this.mathShape)return e;if(void 0!==Ra.draw)for(const t in Ra.draw){const n=Ra.draw[t];if(n.supports(this.mathShape)){e=new n;break}}if(void 0===e)for(const t in Fa.draw){const n=Fa.draw[t];if(n.supports(this.mathShape)){e=new n;break}}return void 0===e&&o.warn("No shape factory found for math shape"),e}}class ja{current;measure}class Za{annotationGroups;responseEvaluations;comment}class _a{#j;getWarning(){return this.#j}#Mn(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}(re(e,"00020012")),n=void 0!==t&&function(e){const t=he(e,"0.34.0"),n=he(e,"0.35.0-beta.21");return t>=0&&n<=0}(t),i=Xr(e);let o;const r=$r(e);return void 0!==r.conceptNameCode&&(o=r.conceptNameCode.value),n&&void 0===i&&o===On.value}#qn(e){const t="DCMR-1500"===Xr(e);let n;const i=$r(e);void 0!==i.conceptNameCode&&(n=i.conceptNameCode.value);let o=!1;if(t&&n===xn.value){const e=i.contentSequence.find(this.#Un);if(void 0!==e){const t=e.contentSequence.find(this.#Qn);if(void 0!==t){const e=t.contentSequence.find(this.#Vn),n=t.contentSequence.find(this.#Nn);void 0===e&&void 0===n||(o=!0)}}}return o}#Bn(e){return"DCMR-4100"===Xr(e)}checkElements(e){return this.#j=void 0,this.#Mn(e)||this.#qn(e)||this.#Bn(e)||(this.#j="Not a dwv supported annotation"),this.#j}#kn(e,t){t.valueType===Br&&t.relationshipType===Fr&&(e.referencedSopClassUID=t.value.referencedSOPSequence.referencedSOPClassUID,e.referencedSopInstanceUID=t.value.referencedSOPSequence.referencedSOPInstanceUID,void 0!==t.value.referencedFrameNumber&&(e.referencedFrameNumber=parseInt(t.value.referencedFrameNumber,10)))}#Gn(e,t){t.hasHeader(Vr,qn(vn),xr)&&(e.trackingId=t.value,e.trackingUid=t.value)}#zn(e,t){t.hasHeader(qr,qn(vn),Er)&&(e.trackingId=t.value),t.hasHeader(Vr,qn(Dn),Er)&&(e.trackingUid=t.value)}#Hn(e,t,n){void 0===n&&(n=!1);let i=Mr;if(n&&(i=xr),t.hasHeader(qr,qn(bn),i)){e.textExpr=t.value;const n=t.contentSequence.find((function(e){return e.hasHeader(kr,qn(An),xr)}));void 0!==n&&(e.labelPosition=new g(n.value.graphicData[0],n.value.graphicData[1]))}if(t.hasHeader(qr,Vn(),i)&&(e.colour=t.value),t.hasHeader(kr,qn(An),i)&&t.value.graphicType===Sr){const n=[];for(let e=0;e<t.value.graphicData.length;e+=2)n.push(new g(t.value.graphicData[e],t.value.graphicData[e+1]));e.referencePoints=n}if(t.hasHeader(Gr,qn(Rn),br)&&t.value.graphicType===Sr){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 S(n[t],n[t+1],n[t+2]))}e.planePoints=i}this.#Yn(e,t),this.#Xn(e,t)}#Yn(e,t,n){let i;if(void 0===n&&(i=br),t.valueType===Ur&&t.relationshipType===i){const n=function(e){let t;for(const n in Nn){const i=Nn[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 Bn){const i=Bn[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}}}}#Xn(e,t){t.valueType!==Qr&&t.valueType!==qr||t.relationshipType!==br||e.addMetaItem(t.conceptNameCode,t.value)}#Un(e){return e.hasHeader(zr,qn(En),br)}#Qn(e){return e.hasHeader(zr,qn(On),br)}#Wn(e){return e.hasHeader(Qr,qn(dn),Rr)}#$n(e){return e.hasHeader(zr,qn(pn),xr)}#jn(e){return e.hasHeader(qr,qn(Tn),br)}#Zn(e){return e.hasHeader(Qr,qn(yn),br)}#_n(e){return e.hasHeader(Ur,qn(Cn),br)}#Kn(e){return e.hasHeader(Qr,qn(cn),br)}#Vn(e){return e.hasHeader(kr,qn(un),br)}#Jn(e){return void 0!==e.contentSequence.find(this.#Vn)}#ei(e){let t;const n=e.contentSequence.find(this.#Vn);if(void 0!==n){t=new $a,t.mathShape=yr(n.value);const i=n.contentSequence.find((function(e){return e.valueType===Br&&e.relationshipType===Fr}));void 0!==i&&this.#kn(t,i);for(const n of e.contentSequence)this.#zn(t,n),this.#Hn(t,n)}return t}#Nn(e){let t;return e.valueType===Ur&&e.relationshipType===br&&(t=e.contentSequence.find((function(e){return e.valueType===kr&&e.relationshipType===Rr}))),void 0!==t}#ti(e){let t;return e.valueType===Ur&&e.relationshipType===xr&&(t=e.contentSequence.find((function(e){return e.valueType===kr&&e.relationshipType===Rr}))),void 0!==t}#ni(e){return void 0!==e.contentSequence.find(this.#Nn)}#ii(e){let t;const n=e.contentSequence.find(this.#Nn);if(void 0!==n){t=new $a;const e=n.contentSequence.find((function(e){return e.valueType===kr&&e.relationshipType===Rr}));t.mathShape=yr(e.value),t.mathShape instanceof g&&e.value.graphicData.length>=4&&(t.referencePoints=[new g(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find((function(e){return e.valueType===Br&&e.relationshipType===Fr}));void 0!==i&&this.#kn(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#zn(t,i),this.#Yn(t,n),this.#Xn(t,i);return t}#oi(e){let t;const n=e.contentSequence.find(this.#ti);if(void 0!==n){t=new $a;const e=n.contentSequence.find((function(e){return e.valueType===kr&&e.relationshipType===Rr}));t.mathShape=yr(e.value),t.mathShape instanceof g&&e.value.graphicData.length>=4&&(t.referencePoints=[new g(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find((function(e){return e.valueType===Br&&e.relationshipType===Fr}));void 0!==i&&this.#kn(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#zn(t,i),this.#Yn(t,n,xr),this.#Xn(t,i);return t}#ri(e){if(0===e.contentSequence.length)return;const t=e.contentSequence[0];let n=!1,i=!1;this.#Qn(t)&&(n=this.#Jn(t),i=this.#ni(t));const r=[];let a,s=!1;for(const t of e.contentSequence)if(this.#Qn(t)){let e;s=!0,n?e=this.#ei(t):i&&(e=this.#ii(t)),void 0!==e&&r.push(e)}return s?0!==r.length?a=new eo(r):o.warn("No valid measurement groups in TID 1500 SR"):o.warn("No measurement groups in TID 1500 SR"),a}#ai(e){const t=[];let n=!1;for(const i of e.contentSequence)if(this.#Wn(i)){n=!0;const e=this.#oi(i);void 0!==e&&t.push(e)}const i=[];return n?0!==t.length?i.push(new eo(t)):o.warn("No valid measurement groups in TID 4100 SR"):o.warn("No image findings in TID 4100 SR"),i}#si(e){const t=new $a;t.mathShape=yr(e.value);for(const n of e.contentSequence)this.#kn(t,n),this.#Gn(t,n),this.#Hn(t,n,!0);return t}#li(e){let t;e.valueType===zr&&an(e.conceptNameCode,qn(xn))||o.warn("Not the expected TID 1500 SR content header");const n=e.contentSequence.find(this.#Un);return void 0!==n?t=this.#ri(n):o.warn("No imaging measurements in TID 1500 SR"),t}#ci(e){return e.valueType===zr&&an(e.conceptNameCode,qn(Sn))||o.warn("Not the expected TID 4100 SR content header"),e.contentSequence.find(this.#Kn)}#ui(e){e.valueType===zr&&an(e.conceptNameCode,qn(On))||console.warn("Not the expected dwv034 content header");const t=[];for(const n of e.contentSequence)n.valueType===kr&&t.push(this.#si(n));return new eo(t)}#di(e,t){const n=function(e){return re(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=si({[i]:o});e.setMetaValue("CurrentRequestedProcedureEvidenceSequence",t.CurrentRequestedProcedureEvidenceSequence)}}create(e){const t=$r(e);let n,i;if(this.#qn(e)?(i="TID 1500 SR",n=this.#li(t)):this.#Mn(e)&&(o.warn("DWV v0.34 annotation"),i="DWV v0.34 SR",n=this.#ui(t)),this.#Bn(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.#di(n,e),n}createCADReport(e){const t=$r(e),n=this.#ci(t);if(void 0===n)return void o.warn("No CAD processing and Findings Summary in TID 4100 SR");let i=[];if(this.#Bn(e)&&(i=this.#ai(n)),void 0===i)throw new Error("Cannot create annotation groups from TID 4100 SR");for(const t of i)this.#di(t,e);const r=[];let a;for(const e of n.contentSequence)if(this.#$n(e)){const t=this.#hi(e);void 0!==t&&r.push(t)}else this.#jn(e)&&(a=e.value);const s=new Za;return s.annotationGroups=i,s.responseEvaluations=r,s.comment=a,s}#gi(e){const t=new Wr(Br);t.relationshipType=Fr,t.conceptNameCode=qn(Pn);const n=new ko;n.referencedSOPClassUID=e.referencedSopClassUID,n.referencedSOPInstanceUID=e.referencedSopInstanceUID;const i=new Wo;return i.referencedSOPSequence=n,void 0!==e.referencedFrameNumber&&(i.referencedFrameNumber=e.referencedFrameNumber.toString()),t.value=i,t}#Si(e){const t=[],n=new Wr(qr);n.relationshipType=Er,n.conceptNameCode=qn(vn),n.value=e.trackingId,t.push(n);const i=new Wr(Vr);if(i.relationshipType=Er,i.conceptNameCode=qn(Dn),i.value=e.trackingUid,t.push(i),void 0!==e.textExpr&&0!==e.textExpr.length){const n=new Wr(qr);if(n.relationshipType=Mr,n.conceptNameCode=qn(bn),n.value=e.textExpr,void 0!==e.labelPosition){const t=new Wr(kr);t.relationshipType=xr,t.conceptNameCode=qn(An);const i=new vr;i.graphicType=gr;const o=[e.labelPosition.getX().toString(),e.labelPosition.getY().toString()];i.graphicData=o,t.value=i;const r=this.#gi(e);t.contentSequence=[r],n.contentSequence=[t]}t.push(n)}const o=new Wr(qr);if(o.relationshipType=Mr,o.conceptNameCode=Vn(),o.value=e.colour,t.push(o),void 0!==e.referencePoints){const n=new Wr(kr);n.relationshipType=Mr,n.conceptNameCode=qn(An);const i=new vr;i.graphicType=Sr;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.#gi(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.planePoints){const n=new Wr(Gr);n.relationshipType=br,n.conceptNameCode=qn(Rn);const i=new Pr;i.graphicType=Sr;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.#gi(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.quantification)for(const n in e.quantification){const i=Zr(n,d(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=qr;i.value instanceof rn&&(o=Qr);const r=new Wr(o);r.relationshipType=br,r.conceptNameCode=i.concept,r.value=i.value,t.push(r)}return t}#pi(e){const t=new Wr(zr);t.relationshipType=br,t.conceptNameCode=qn(On),t.value=Hr;const n=new Wr(kr);n.relationshipType=br,n.conceptNameCode=qn(un),n.value=Dr(e.mathShape);const i=this.#gi(e);return n.contentSequence=[i],t.contentSequence=[n].concat(this.#Si(e)),t}#mi(e){let t;if(0!==e.getList().length){const n=new Wr(zr);n.conceptNameCode=qn(En),n.relationshipType=br,n.value=Hr;const i=[];for(const t of e.getList())i.push(this.#pi(t));n.contentSequence=i,t=new Wr(zr),t.conceptNameCode=qn(xn),t.value=Hr,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=Kt(Zt(i)),n.ContentTime=Jt(_t(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.#mi(e);if(void 0===s)throw new Error("No annotation group SR content");return n={...n,...jr(s)},void 0!==t&&li(n,t),ci(n)}#fi(e){const t=new Wr(Qr);t.relationshipType=Rr,t.conceptNameCode=qn(dn),t.value=qn(hn),t.contentSequence=[];const n=new Wr(qr);n.relationshipType=Er,n.conceptNameCode=qn(vn),n.value=e.trackingId,t.contentSequence.push(n);const i=new Wr(Vr);if(i.relationshipType=Er,i.conceptNameCode=qn(Dn),i.value=e.trackingUid,t.contentSequence.push(i),void 0!==e.quantification)for(const n in e.quantification){const i=Zr(n,d(e.quantification[n].value,12),e.quantification[n].unit,xr);if(void 0!==i){const n=new Wr(kr);n.relationshipType=Rr,n.conceptNameCode=qn(wn),n.value=Dr(e.mathShape);const o=this.#gi(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=qr;i.value instanceof rn&&(o=Qr);const r=new Wr(o);r.relationshipType=br,r.conceptNameCode=i.concept,r.value=i.value,t.contentSequence.push(r)}return t}#vi(e,t){if(0!==e.getList().length)for(const n of e.getList())t.push(this.#fi(n))}#Ci(e){const t=new Wr(zr);t.relationshipType=xr,t.conceptNameCode=qn(pn),t.value=Hr,t.contentSequence=[];const n=new Wr(Qr);if(n.relationshipType=Er,n.conceptNameCode=qn(mn),n.value=qn(fn),t.contentSequence.push(n),void 0!==e){if(void 0!==e.current){const n=new Wr(Qr);n.relationshipType=br,n.conceptNameCode=qn(yn),n.value=e.current,t.contentSequence.push(n)}if(void 0!==e.measure){const n=new Wr(Ur);n.relationshipType=br,n.conceptNameCode=qn(Cn);const i=new Fo;i.numericValue=e.measure,i.measurementUnitsCode=kn("unit.mm");const o=new Qo;o.measuredValue=i,n.value=o,t.contentSequence.push(n)}}return t}#hi(e){let t,n,i;for(const i of e.contentSequence)this.#Zn(i)?t=i.value:this.#_n(i)&&(n=i.value.measuredValue.numericValue);return void 0!==t&&(i=new ja,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=Kt(Zt(i)),n.ContentTime=Jt(_t(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 Wr(Qr);s.relationshipType=br,s.conceptNameCode=qn(cn),s.value=qn(gn),s.contentSequence=[];for(const t of e.responseEvaluations){const e=this.#Ci(t);s.contentSequence.push(e)}for(const t of e.annotationGroups)this.#vi(t,s.contentSequence);if(void 0!==e.comment){const t=new Wr(qr);t.relationshipType=br,t.conceptNameCode=qn(Tn),t.value=e.comment,s.contentSequence.push(t)}const l=new Wr(zr);if(l.conceptNameCode=qn(Sn),l.value=Hr,l.contentSequence.push(s),void 0===l)throw new Error("No annotation group SR content");return n={...n,...jr(l)},void 0!==t&&li(n,t),ci(n)}}const Ka="30060084";class Ja{type;points3D}class es{number;name;colour;generationAlgorithm;interpretedType;roiInterpreter;contours}function ts(e){const t={},n={},i=ae(e,"30060020");if(void 0!==i)for(const e of i){const i=re(e,"30060022"),o=re(e,"30060026"),r=re(e,"30060036");void 0!==i&&(t[i]=o??`ROI ${i}`,n[i]=r)}const r={},a=ae(e,"30060080");if(void 0!==a)for(const e of a){const t=re(e,Ka);void 0!==t&&(r[t]={interpretedType:re(e,"300600A4"),roiInterpreter:re(e,"300600A6")})}const s=[],l=ae(e,"30060039");if(void 0===l)return s;for(const e of l){const i=re(e,Ka),a=ae(e,"3006002A"),l=ae(e,"0062000D");let c;void 0!==a&&3===a.length?c={r:parseInt(a[0],10),g:parseInt(a[1],10),b:parseInt(a[2],10)}:void 0!==l&&3===l.length?c=fi(Si({l:l[0],a:l[1],b:l[2]})):(o.warn("No recommended colour for contour, using default"),c=yi(i));const u=[],d=ae(e,"30060040");if(void 0!==d)for(const e of d){const t=re(e,"30060042"),n=ae(e,"30060050");if(void 0===n)continue;const i=new Ja;i.type=t??"CLOSED_PLANAR",i.points3D=n.map((e=>parseFloat(e))),u.push(i)}const h=new es;h.number=void 0!==i?parseInt(i,10):0,h.name=t[h.number]??`ROI ${h.number}`,h.generationAlgorithm=n[h.number],h.interpretedType=r[h.number]?.interpretedType,h.roiInterpreter=r[h.number]?.roiInterpreter,h.colour=c,h.contours=u,s.push(h)}return s}const ns={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyInstanceUID:"0020000D",StudyID:"00200010",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052"},is=[{name:"TransferSyntaxUID",enum:[_]},{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 os(){const e={};for(const t of is)e[t.name]=t.enum[0];return e}const rs=[[-1,0],[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1]],as={};for(let e=0;e<8;e++)as[`${rs[e][0]},${rs[e][1]}`]=e;function ss(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 ls(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=as[`${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+rs[a][0],l=d+rs[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+rs[e][0],m=d+rs[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;ss(e,t,n,i,o,l,a);const u=ls(e,t,n,i,o,r,c);u.length>=3&&s.push(u)}return s}function us(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=us(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 hs(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 gs(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 Ss{#j;getWarning(){return this.#j}checkElements(e){return this.#j=void 0,this.#j}create(e,t){const n=ts(e),o=t.getGeometry(),r=o.getSize(),a=r.get(0),s=r.get(1),l=r.get(2),c=a*s,u=new Mi(o),d=[],h=[0],g=[0],S=[0];for(let e=0;e<n.length;++e){const t=n[e],i=e+1,r=new bi(i,t.name,t.generationAlgorithm??"MANUAL");r.interpretedType=t.interpretedType,r.roiInterpreter=t.roiInterpreter,r.displayRGBValue=new ui(t.colour.r,t.colour.g,t.colour.b),d.push(r),h[i]=t.colour.r,g[i]=t.colour.g,S[i]=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 i=o.worldToPoint(new m([t[e],t[e+1],t[e+2]]));n.push({x:i.getX(),y:i.getY(),z:i.getZ()})}const i=Math.round(n[0].z);i<0||i>=l||(p.has(i)||p.set(i,[]),p.get(i).push(n))}for(const[e,t]of p){const n=new Uint8Array(c);hs(n,0,a,s,t,1),u.addFrame(i,n,0,e,c,i)}}const p=[];for(let e=0;e<l;++e)p.push(t.getImageUid(new i([0,0,e])));const f=new Ki(o,u.getLabelMap(),p);f.setSegmentCollection(u),f.setPhotometricInterpretation("PALETTE COLOR"),f.setPaletteColourMap(new He(h,g,S));const v=t=>re(e,t),C={Modality:"RTSTRUCT"};for(const e of Object.keys(ns)){const t=v(ns[e]);void 0!==t&&(C[e]=t)}C.custom={segments:d,referencedSeriesUID:St(e)};const D=t.getMeta();return void 0!==D.lengthUnit&&(C.lengthUnit=D.lengthUnit),f.setMeta(C),f}toDicom(e,t,n,r){const a=os(),s=e.getMeta();for(const e of Object.keys(ns)){const t=s[e];void 0!==t&&(a[e]=t)}if(void 0===t&&(t=s.custom?.segments??[]),void 0!==n){const e=n.getMeta();a.StudyInstanceUID=e.StudyInstanceUID,a.ReferencedFrameOfReferenceSequence={value:[{FrameOfReferenceUID:a.FrameOfReferenceUID??"",RTReferencedStudySequence:{value:[{ReferencedSOPInstanceUID:e.StudyInstanceUID??"",RTReferencedSeriesSequence:{value:[{SeriesInstanceUID:e.SeriesInstanceUID??""}]}}]}}]}}const l=new Date;a.StructureSetDate=Kt(Zt(l)),a.StructureSetTime=Jt(_t(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:a.FrameOfReferenceUID??"",ROIGenerationAlgorithm:e.algorithmType??"MANUAL"}),D.push({ObservationNumber:t,ReferencedROINumber:t,RTROIInterpretedType:e.interpretedType??"ORGAN",ROIInterpreter:e.roiInterpreter??""});const r=[],s=f?.get(t);for(let e=0;e<g;e++){const n=m&&s?.has(e),a=n?s.get(e):p,l=n?0:e*S,u=cs(a,l,d,h,t),g=u.length>0?gs(a,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){o.warn("Saving RT Struct with thin contour, not well supported");continue}const a=[];for(const t of n){const n=c.indexToWorld(new i([t.x,t.y,e]));a.push(n.get(0),n.get(1),n.get(2))}r.push({ContourGeometricType:v,NumberOfContourPoints:n.length,ContourData:a})}}C.push({ReferencedROINumber:t,ROIDisplayColor:[n.r,n.g,n.b],ContourSequence:{value:r}})}return a.StructureSetROISequence={value:v},a.ROIContourSequence={value:C},a.RTROIObservationsSequence={value:D},void 0!==r&&li(a,r),ci(a)}}const ps=["dataadd","dataremove","dataimageset","dataupdate"];function ms(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}),!L(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 fs{meta;image;annotationGroup;buffer;numberOfFiles;warn=[];#Di=!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.#Di}appendData(e){this.#Di||(void 0!==this.image&&void 0!==e.image&&this.#yi(e.image),this.#Ii(e.meta))}#yi(e){const t=this.image.getGeometry(),n=e.getGeometry();t.canAppendOrigin(n.getOrigin(),n.getInitialTime()).success||(this.#Di=!0),this.#Di||this.image.appendSlice(e)}#Ii(e){this.meta=ms(this.meta,e,Nt)}}class vs{#Ge=[];addClone(e){const t=new fs(structuredClone(e.meta));t.image=e.image.clone(),this.add(t)}add(e){this.#Ge.push(e)}buildData(){const e=this.#wi(),t=this.#Ti(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.#Li(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.#Ge[t[0]].meta;r=void 0===r?a:ms(r,a,i);for(const n of t){const t=this.#Ge[n].image;t.getGeometry().setInitialTime(e),void 0===o?o=t:o.appendSlice(t)}}return{image:o,meta:r}}#Li(e,t){if(void 0!==Xe.getPostLoadVolumeIdTagValue){const n=Xe.getPostLoadVolumeIdTagValue;return{volsIndices:this.#Pi(e,t,n),volumeIndexGetter:n}}const n=void 0!==Xe.postLoadVolumeIdCandidates?Xe.postLoadVolumeIdCandidates:kt;for(const i of n){const n=this.#Pi(e,t,i.getter);if(void 0!==n)return o.debug(`Using '${i.name}' as temporal position identifier`),{volsIndices:n,volumeIndexGetter:i.getter}}return{volsIndices:void 0,volumeIndexGetter:void 0}}#Pi(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.#Ge[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.#Ge[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}#Ti(e){if(0===e.length)return 0;const t=e[0].count;for(const n of e)if(n.count!==t)return;return t}#wi(){const e=function(e){return function(t){return t.pos.equals(e)}},t=[];for(let n=0;n<this.#Ge.length;++n){const i=this.#Ge[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 Cs extends EventTarget{#Ai={};#Oi={};#bi={};#xi=-1;constructor(){super()}getNextDataId(){return++this.#xi,this.#xi.toString()}getDataIds(){return Object.keys(this.#Ai)}reset(){this.#Ai={}}get(e){return this.#Ai[e]}getDataIdsFromSopUids(e){const t=[];if(void 0===e||0===e.length)return t;const n=Object.keys(this.#Ai);for(const i of n)void 0!==this.#Ai[i].image&&this.#Ai[i].image.containsImageUids(e)&&t.push(i);return t}getDataIdFromSeriesUid(e){let t;const n=Object.keys(this.#Ai);for(const i of n){const n=this.#Ai[i].image;if(void 0!==n&&e===n.getMeta().SeriesInstanceUID){t=i;break}}return t}setImage(e,t){this.#Ai[e].image=t;for(const n of ji)t.addEventListener(n,this.#Ei(e));this.dispatchEvent(new CustomEvent("dataimageset",{detail:{value:[t],dataid:e}}))}#Ri(e){const t=re(e.meta,"00080060");let n;if(B(e.meta))if("SEG"===t){const t=gt(e.meta);if(void 0===t)throw new Error("Cannot create mask image: the DICOM seg does not have a referenced series UID");const i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create mask image: the DICOM seg referenced series is not loaded");n=new Ni,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,this.#Ai[i].image))}else n=new ri,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,e.numberOfFiles));else if("SR"===t)n=new _a,void 0===n.checkElements(e.meta)&&(e.annotationGroup=n.create(e.meta));else if("RTSTRUCT"===t){const t=St(e.meta),i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create RT struct: referenced series is not loaded");n=new Ss,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,this.#Ai[i].image))}void 0!==n&&void 0!==n.getWarning()&&e.warn.push(n.getWarning())}add(e,t){if(void 0===e||void 0!==this.#Ai[e])return!1;if(this.#Ai[e]=t,void 0===t.image&&void 0===t.annotationGroup&&(this.#Ri(t),void 0!==t.numberOfFiles&&t.numberOfFiles>1&&(this.#Oi[e]=new vs,this.#Oi[e].addClone(t))),void 0!==t.image)for(const n of ji)t.image.addEventListener(n,this.#Ei(e));if(void 0!==t.annotationGroup)for(const n of Ji)t.annotationGroup.addEventListener(n,this.#Ei(e));return this.dispatchEvent(new CustomEvent("dataadd",{detail:{dataid:e}})),!0}remove(e){if(void 0!==this.#Ai[e]){const t=this.#Ai[e].image;if(void 0!==t)for(const n of ji)t.removeEventListener(n,this.#Ei(e));const n=this.#Ai[e].annotationGroup;if(void 0!==n)for(const t of Ji)n.removeEventListener(t,this.#Ei(e));delete this.#Ai[e],this.dispatchEvent(new CustomEvent("dataremove",{detail:{dataid:e}}))}}stash(e){void 0!==this.#Ai[e]&&(this.#bi[e]=this.#Ai[e],this.remove(e))}unstash(e){void 0!==this.#bi[e]&&(this.add(e,this.#bi[e]),delete this.#bi[e])}getStashedDataIds(){return Object.keys(this.#bi)}getStashed(e){return this.#bi[e]}update(e,t){if(void 0===this.#Ai[e])throw new Error(`Cannot find data to update: ${e}`);const n=this.#Ai[e];this.#Ri(t),void 0!==this.#Oi[e]&&this.#Oi[e].add(t),n.hasDuplicateOrigin()||n.appendData(t),this.dispatchEvent(new CustomEvent("dataupdate",{detail:{dataid:e}}))}markDataAsComplete(e){const t=this.#Ai[e];if(void 0===t)throw new Error(`Cannot find data to mark as complete: ${e}`);const n={imageHasChanged:!1};if(void 0!==this.#Oi[e]&&t.hasDuplicateOrigin()){const i=this.#Oi[e].buildData();this.setImage(e,i.image),t.meta=i.meta,delete this.#Oi[e],n.imageHasChanged=!0}return t.setComplete(!0),n}#Ei(e){return t=>{const n=Object.assign({},t.detail,{dataid:e});this.dispatchEvent(new CustomEvent(t.type,{detail:n}))}}}class Ds{#Fi;setOptions(e){this.#Fi=e}#Mi;#qi=[];#Ui=[];#Qi=[];#Vi=!1;#Ni(e,t){const n=this.#qi[e].getDicomElements(),i=new fs(n);void 0!==this.#Qi[e]&&(i.buffer=this.#Qi[e]),i.numberOfFiles=this.#Fi.numberOfFiles,this.onloaditem({data:i,source:t})}#Bi(e,t){this.#Vi||(this.onprogress({lengthComputable:!0,loaded:100,total:100,index:e,source:t}),this.onload({source:t}),this.onloadend({source:t}))}#ki(e){this.#Mi=new Ao(e),this.#Mi.ondecodeditem=e=>{this.#Gi(e),e.itemNumber+1===e.numberOfItems&&(this.onload(e),this.onloadend(e))},this.#Mi.onerror=this.onerror,this.#Mi.onabort=this.onabort}#zi(e){const t=this.#qi[e].getDicomElements(),n={missing:[]},i=re(t,"00280100");void 0!==i?n.bitsAllocated=i:n.missing.push("bitsAllocated");const o=re(t,"00280103");void 0!==o?n.isSigned=1===o:n.missing.push("pixelRepresentation");const r=re(t,"00280011"),a=re(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=re(t,"00280002");if(void 0!==s){if(n.samplesPerPixel=s,1!==s){const e=re(t,"00280006");void 0!==e?n.planarConfiguration=e:n.missing.push("planarConfiguration")}}else n.missing.push("samplesPerPixel");return n}#Hi(e,t,n){const i=this.#zi(e);if(0!==i.missing.length)return this.#Mi.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.#Mi.decode(n[r],i,{itemNumber:r,numberOfItems:o,index:e,indexOrigin:t})}#Gi(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.#Ui[t]){this.#Ui[t]=i.length;const r=e.numberOfItems*this.#Ui[t];try{this.#Qi[t]=new i.constructor(r)}catch(e){if(e instanceof RangeError){const e=Math.floor(Math.log(r)/Math.log(2));o.error(`Cannot allocate ${i.constructor.name} of size: ${r} (>2^${e}) for decompressed data.`)}return this.#Mi.abort(),this.onerror({error:e,source:n}),void this.onloadend({source:n})}}i.length!==this.#Ui[t]&&o.warn(`Unsupported varying decompressed data size: ${i.length} != ${this.#Ui[t]}`),this.#Qi[t].set(i,this.#Ui[t]*e.itemNumber)}else this.#Qi[t]=i;0===e.itemNumber&&this.#Ni(t,n)}convert(e,t,n){this.#Vi=!1,this.onloadstart({source:t,index:n});const i=new Ae;void 0!==this.#Fi.defaultCharacterSet&&i.setDefaultCharacterSet(this.#Fi.defaultCharacterSet);try{i.parse(e)}catch(e){return this.onerror({error:e,source:t}),void this.onloadend({source:t})}this.#qi[n]=i;const o=i.getDicomElements(),r=N(o);if(void 0!==r){const e=r.value,i=function(e){let t;return ye(e)?t="jpeg2000":Ce(e)?t="jpeg-baseline":De(e)?t="jpeg-lossless":Ie(e)&&(t="rle"),t}(re(o,"00020010"));void 0!==i?(void 0===this.#Mi&&this.#ki(i),this.#Hi(n,t,e)):(this.#Qi[n]=e[0],this.#Ni(n,t),this.#Bi(n,t))}else this.#Ni(n,t),this.#Bi(n,t)}abort(){this.#Vi=!0,void 0!==this.#Mi?this.#Mi.abort():this.onabort({})}onloadstart(e){}onloaditem(e){}onprogress(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class ys extends yo{#Fi={};#Yi=!1;getOptions(){return this.#Fi}setOptions(e){this.#Fi=e}isLoading(){return this.#Yi}setLoading(e){this.#Yi=e}canLoadFile(e){if(void 0!==e.type&&this.canLoadMediaType(e.type))return!0;const t=D(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=D(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 Is extends ys{#Xi=new Ds;load(e,t,n){this.isLoading()||(this.#Xi.setOptions(this.getOptions()),this.#Xi.onloadstart=this.onloadstart,this.#Xi.onprogress=this.onprogress,this.#Xi.onloaditem=this.onloaditem,this.#Xi.onload=this.onload,this.#Xi.onloadend=e=>{this.setLoading(!1),this.onloadend(e)},this.#Xi.onerror=e=>{e.source=t,this.onerror(e)},this.#Xi.onabort=this.onabort),this.setLoading(!0),this.#Xi.convert(e,t,n)}abort(){this.setLoading(!1),this.#Xi.abort()}canLoadExtension(e){return void 0===e||"dcm"===e}isLoaderName(e){return"dicom"===e}canLoadMediaType(e){return"application/dicom"===e}loadFileAs(){return Ms.ArrayBuffer}loadUrlAs(){return 1}}class ws extends ys{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 Ms.Text}loadUrlAs(){return 0}}class Ts extends yo{#yt=null;#wt=null;#Tt=0;#Lt=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#At(e){this.#yt=e,this.#Tt=0,this.#Lt=0,this.#bt()}#Et(e){this.#wt=e}#bt(){this.#wt=null}#Rt=e=>{this.#Tt++,this.#Tt===this.#yt.length&&this.onload({source:this.#yt})};#Ft=e=>{this.#Lt++,this.#Lt===this.#yt.length&&this.onloadend({source:this.#yt})};load(e){if(void 0===e||0===e.length)return;this.#At(e),this.onloadstart({source:e});const t=new Do(this.onprogress);t.setNToLoad(e.length),t.setNumberOfDimensions(1);const n=Fs(),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.#Rt,r.onloadend=this.#Ft,r.onerror=this.onerror,r.onabort=this.onabort,this.#Et(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.#wt&&this.#wt.isLoading()&&this.#wt.abort()}}class Ls extends ys{#Wi=0;#$i=0;#ji=[];load(e,t,n){0===this.#$i&&(this.#Wi=this.getOptions().numberOfFiles??1,this.#ji=[],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=O(new Uint8Array([13,10,13,10]));let o=A(t,i,0);if(void 0===o)throw new Error("Can't find the end of the first multipart header");const r=P(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=O(y(a)),l=a.length;let c=A(t,s,0);for(;void 0!==o;){const e={},r=P(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=A(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=A(t,i,c+l)}return n}(e);if(this.#ji.push(...i),this.#$i++,this.#$i<this.#Wi)return;const o=new Ts;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.#Wi;t++)this.onload(e)},o.onloadend=e=>{this.setLoading(!1),this.#$i=0;const t=this.#Wi;for(let n=0;n<t;n++)this.onloadend(e)},o.onerror=this.onerror,o.onabort=this.onabort,o.load(this.#ji)}abort(){this.setLoading(!1),this.#$i=0,this.onabort({}),this.onloadend({})}isLoaderName(e){return"multipart"===e}canLoadMediaType(e){return"multipart/related"===e}loadFileAs(){return Ms.ArrayBuffer}loadUrlAs(){return 1}}function Ps(e){return parseInt(e,36).toString()}function As(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 Os(e,t,n,i,o,r){const a=new pt([e,t,1]),s=new ot([1,1,1]),l=new S(0,0,n),c=new yt([l],a,s),u=new Ki(c,i,[r]);u.setPhotometricInterpretation("RGB");const d={BitsStored:8};return void 0!==o&&(d.numberOfFiles=o),u.setMeta(d),u}class bs extends ys{#Zi(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=Ps(t)):(l.fileName={value:[t.name]},c=Ps(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=Os(i,o,u,As(s),1,u.toString()),h=d.getMeta();h.SeriesInstanceUID=c,d.setMeta(h);const g=new fs(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.#Zi(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 Ms.DataURL}loadUrlAs(){return 1}}class xs extends ys{#Zi(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.#Zi(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=Ps(r)):(u.fileName={value:[r.name]},d=Ps(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=As(g.getImageData(0,0,s,l));if(0===S){p=Os(s,l,1,n,c,a.toString());const e=p.getMeta();e.SeriesInstanceUID=d,p.setMeta(e);const i=new fs(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 Ms.DataURL}loadUrlAs(){return 1}}class Es extends ys{#_i="";#Ki=[];#Ji=null;#eo(e,t,n){this.#Ki.push({filename:this.#_i,data:e});const i=100*this.#Ki.length/this.#Ji.length;if(this.onprogress({lengthComputable:!0,loaded:i/2,total:100,index:n,item:{loaded:i,total:100,source:t}}),this.#Ki.length<this.#Ji.length){const e=this.#Ki.length;this.#_i=this.#Ji[e].name,this.#Ji[e].async("arrayBuffer").then((e=>{this.#eo(e,t,n)})).catch((e=>{this.setLoading(!1),this.onerror({error:e}),this.onloadend({})}))}else{const e=new Ts;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.#Ki)}}load(e,n,i){this.onloadstart({source:n}),this.setLoading(!0),t.loadAsync(e).then((e=>{if(this.#Ki=[],this.#Ji=e.file(/.*\.dcm/),0===this.#Ji.length)return this.setLoading(!1),this.onerror({error:new Error("No DICOM file found in ZIP")}),void this.onloadend({});this.#_i=this.#Ji[0].name,this.#Ji[0].async("arrayBuffer").then((e=>{this.#eo(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 Ms.ArrayBuffer}loadUrlAs(){return 1}}let Rs=null;function Fs(){return null===Rs&&(Rs=[Is,ws,Ls,bs,xs,Es]),Rs}const Ms={Text:0,ArrayBuffer:1,DataURL:2};class qs extends yo{#yt=null;#to=[];#wt=null;#Tt=0;#Lt=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#At(e){this.#yt=e,this.#Tt=0,this.#Lt=0,this.#no(),this.#bt()}#io(e){this.#to.push(e)}#no(){this.#to=[]}#Et(e){this.#wt=e}#bt(){this.#wt=null}#Rt=e=>{this.#Tt++,this.#Tt===this.#yt.length&&this.onload({source:this.#yt})};#Ft=e=>{this.#Lt++,this.#Lt===this.#yt.length&&this.onloadend({source:this.#yt})};#Mt(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.#At(e),this.onloadstart({source:e});const t=new Do(this.onprogress);t.setNToLoad(e.length);const n=Fs(),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.#Rt,r.onloadend=this.#Ft,r.onerror=this.onerror,r.onabort=this.onabort,this.#Et(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.#io(i),i.onprogress=this.#Mt(t.getMonoProgressHandler(n,0),o),i.onload=this.#Qt(r,o,n);const a=this.#Mt(this.onerror,o);i.onerror=e=>{this.#Ft(),a(e)};const s=this.#Mt(this.onabort,o);i.onabort=e=>{this.#Ft(),s(e)},r.loadFileAs()===Ms.Text?i.readAsText(o):r.loadFileAs()===Ms.DataURL?i.readAsDataURL(o):r.loadFileAs()===Ms.ArrayBuffer&&i.readAsArrayBuffer(o)}}abort(){for(let e=0;e<this.#to.length;++e)1===this.#to[e].readyState&&this.#to[e].abort();this.#wt&&this.#wt.isLoading()&&this.#wt.abort()}}const Us=["loadstart","loadprogress","loaditem","load","loadend","error","abort","timeout"];class Qs extends EventTarget{#f;#oo={};constructor(e){super(),this.#f=e}loadFiles(e,t){"json"===e[0].name.split(".").pop().toLowerCase()?this.#ro(e[0],t):this.#ao(e,t)}loadURLs(e,t,n){"json"===e[0].split(".").pop().toLowerCase()?this.#so(e[0],t,n):this.#lo(e,t,n)}loadImageObject(e,t){const n=new Ts;this.#co(e,n,"image",t)}getLoadingDataIds(){return Object.keys(this.#oo)}abort(e){void 0!==this.#oo[e]&&(this.#oo[e].loader.abort(),delete this.#oo[e])}#ao(e,t){const n=new qs;n.setDefaultCharacterSet(this.#f),this.#co(e,n,"image",t)}#lo(e,t,n){const i=new Io;i.setDefaultCharacterSet(this.#f),this.#co(e,i,"image",t,n)}#ro(e,t){const n=new qs;this.#co([e],n,"state",t)}#so(e,t,n){const i=new Io;this.#co([e],i,"state",t,n)}#co(e,t,n,i,o){const r={dataid:i,loadtype:n};t.onloadstart=e=>{this.#oo[i]={loader:t,isFirstItem:!0},this.#Ei("loadstart",r)(e)},t.onprogress=this.#Ei("loadprogress",r),t.onloaditem=e=>{const t={dataid:i,loadtype:n};void 0!==this.#oo[i]&&(t.isfirstitem=this.#oo[i].isFirstItem),this.#Ei("loaditem",t)(e),void 0!==this.#oo[i]&&this.#oo[i].isFirstItem&&(this.#oo[i].isFirstItem=!1)},t.onload=this.#Ei("load",r),t.onloadend=e=>{delete this.#oo[i],this.#Ei("loadend",r)(e)},t.onerror=this.#Ei("error",r),t.onabort=this.#Ei("abort",r),void 0!==t.ontimeout&&(t.ontimeout=this.#Ei("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}}))}}#Ei(e,t){return n=>{const i=Object.assign({},n,t);this.dispatchEvent(new CustomEvent(e,{detail:i}))}}}const Vs=["undoadd","undoremove","undo","redo"];class Ns extends EventTarget{#uo=new Pa;constructor(){super(),this.#do()}addToUndoStack=e=>{this.#uo.add(e)};removeFromUndoStack=e=>this.#uo.remove(e);undo(){this.#uo.undo()}redo(){this.#uo.redo()}getStackSize(){return this.#uo.getStackSize()}getCurrentStackIndex(){return this.#uo.getCurrentStackIndex()}reset(){this.#uo=new Pa,this.#do()}#do(){for(const e of Vs)this.#uo.addEventListener(e,(t=>{const n=Object.assign({},t.detail);this.dispatchEvent(new CustomEvent(e,{detail:n}))}))}}class Bs{tags;event;pos;format;precision;value}function ks(e){return function(t){return Number(t).toPrecision(e)}}function Gs(e){let t="";for(let n=0;n<e;++n)0!==n&&(t+=", "),t+=`{v${n}}`;return t}function zs(e,t){let n=e;for(let e=0;e<t.length;++e)n=n.replace(`{v${e}}`,t[e]);return n}class Hs extends EventTarget{#rn;#tt;#ho;#go=[];#So;#po={};#mo;constructor(e,t,n){super(),this.#rn=e,this.#tt=t,this.#ho=n;const i=Object.keys(this.#ho);for(let e=0;e<i.length;++e){const t=this.#ho[i[e]];for(const e of t){const t=e.event;void 0!==t&&(this.#go.includes(t)||this.#go.push(t))}}this.addAppListeners()}reset(){this.#po={},this.#mo=void 0}addItemMeta(e){let t;void 0!==e["00020010"]?void 0!==e["00080018"]?(t=e["00080018"].value[0],this.#po[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=jt(Wt(i));void 0!==e&&t.push(e.toLocaleDateString())}else if("TM"===i.vr){const e=jt({year:1900,monthIndex:0,day:1},$t(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=Gs(t.length)),i.value=zs(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:me(e),format:"{v0}"}),n.push({pos:"bc",value:t,format:"{v0}"}),n.push({pos:"tc",value:me(t),format:"{v0}"})}return n}(e,this.#ho)):o.warn("Missing DICOM SOP instance UID for info data indexing"):void 0!==e.imageUid?(t=e.imageUid.value[0],this.#po[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=Gs(t.length)),i.value=zs(i.format,t).trim()}n.push(i)}return n}(e,this.#ho)):o.warn("Missing DOM image UID for info data indexing"),void 0!==t&&(this.#mo=t)}onSliceChange=e=>{const t=e.detail?.dataid;if(t!==this.#tt)return;const n=e.detail?.data;void 0!==n&&void 0!==n.imageUid&&this.#mo!==n.imageUid&&(this.#mo=n.imageUid,this.#fo(e))};#fo=e=>{const t=e.detail?.dataid;if(void 0!==t&&t!==this.#tt)return;const n=this.#po[this.#mo];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:ks(parseInt(t.precision,10)),o=o.map(e)}n=zs(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.#mo}`)};isListening(){return this.#So}addAppListeners(){this.#rn.addEventListener("positionchange",this.onSliceChange);for(const e of this.#go)this.#rn.addEventListener(e,this.#fo);this.#So=!0}removeAppListeners(){this.#rn.removeEventListener("positionchange",this.onSliceChange);for(const e of this.#go)this.#rn.removeEventListener(e,this.#fo);this.#So=!1}}function Ys(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 Xs(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 Ws{onWheel(e,t){}onWheelTick(e,t){}}class $s extends Ws{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 js extends Ws{onWheel(e,t){if(void 0===t)return;const n=-e.deltaY/500,i=fo(e),r=Xs(t);if(void 0===r)return void o.warn("No view layer to do wheel zoom behavior");const a=r.getViewController(),s=r.displayToMainPlanePos(i),l=a.getPlanePositionFromPlanePoint(s);t.addScale(n,l),t.draw()}}class Zs{#ye;#vo;#Co;#Do;constructor(e,t){if(this.#ye=e,this.#vo=e.isID(),this.#Co=Math.pow(2,t),!this.#vo){this.#Do=new Float32Array(this.#Co);for(let e=0;e<this.#Co;++e)this.#Do[e]=this.#ye.apply(e)}}getRSI(){return this.#ye}getLength(){return this.#Co}getValue(e){return this.#vo?e:this.#Do[e]}}class _s{#yo;#Io;#Do;#wo=0;#To=!0;constructor(e,t,n){if(this.#yo=e,t){const e=this.#yo.getLength();this.#wo=e/2}else this.#wo=0;this.#To=n}getVoiLut(){return this.#Io}getModalityLut(){return this.#yo}setVoiLut(e){if(this.#Io=e,this.#Io.setSignedOffset(this.#yo.getRSI().getSlope()*this.#wo),this.#To){const e=this.#yo.getLength();this.#Do=new Uint8ClampedArray(e);for(let t=0;t<e;++t)this.#Do[t]=this.#Io.apply(this.#yo.getValue(t))}}getValue(e){return this.#To?this.#Do[e+this.#wo]:Math.floor(this.#Io.apply(e+this.#wo))}}const Ks={CT:{mediastinum:new Qe(40,400),lung:new Qe(-500,1500),bone:new Qe(500,2e3),brain:new Qe(40,80),head:new Qe(90,350)}};class Js{create(e,t){const n=new il(t);"MONOCHROME1"===t.getPhotometricInterpretation()&&n.setColourMap("invPlain");let i={};void 0!==t.getMeta().windowPresets&&(i=t.getMeta().windowPresets),i.minmax=new Be("minmax");const o=t.getMeta().Modality;let r;r=void 0!==Xe.wlPresets&&void 0!==Xe.wlPresets[o]?Xe.wlPresets[o]:Ks[o];for(const e in r){const t=r[e];i[e]=new Be(e,[new Qe(t.center,t.width)])}return n.setWindowPresets(i),n}}class el{#Lo=[];#Po(e){return this.#Lo.indexOf(e)}isHidden(e){return-1!==this.#Po(e)}addToHidden(e){this.isHidden(e)?o.warn(`Not hidding segment, it is allready in the hidden list: ${e}`):this.#Lo.push(e)}removeFromHidden(e){const t=this.#Po(e);-1!==t?this.#Lo.splice(t,1):o.warn(`Cannot remove segment, it is not in the hidden list: ${e}`)}}const tl=["wlchange","wlpresetadd","colourmapchange","positionchange","opacitychange","alphafuncchange","maskviewchange"];function nl(e,t){return(new Js).create(e,t)}class il extends EventTarget{#Ao;#Oo;#Te;#bo={minmax:new Be("minmax")};#xo;#Eo;#Ro="plain";#Fo;#$;#Mo=.33;#qo=1;#Uo;#Qo=function(e,t){return 255};#Vo=(e,t)=>0===e||this.#No.isHidden(e)?0:0!==this.getContourThickness()&&this.#Ao.getContour().getDistance(t,this.getOrientation())<=this.getContourThickness()?255:255*this.getFillOpacity();#No;constructor(e){super(),this.setImage(e)}getImage(){return this.#Ao}setImage(e){this.#Ao=e;const t=e.getMeta().windowPresets;if(void 0!==t)for(const e of Object.keys(t))this.#bo[e]=t[e];void 0===this.getCurrentPosition()&&this.setCurrentIndex(this.#Bo(),!0),this.isMask()?(this.#No=new el,this.#Uo=this.#Vo):(this.#Uo=this.#Qo,this.#Ao.addEventListener("appendframe",(()=>{const e=this.getCurrentIndex();if(3===e.length()){const t=e.getValues();t.push(0),this.setCurrentIndex(new i(t),!0)}})))}isMask(){return this.#Ao.isMask()}setMaskViewHelper(e){this.#No=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}getOrientation(){return this.#$}setOrientation(e){this.#$=e}getFillOpacity(){return this.#Mo}setFillOpacity(e){this.#Mo=e>1?1:e<0?0:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#Mo,this.#qo]}}))}getContourThickness(){return this.#qo}setContourThickness(e){this.#qo=e<0?0:e>10?10:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#Mo,this.#qo]}}))}#Bo(){const e=this.#Ao.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 i(t))}getPlaybackMilliseconds(e){return e||(e=10),Math.round(1e3/e)}getAlphaFunction(){return this.#Uo}setAlphaFunction(e){this.#Uo=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}#ko(){if(void 0!==this.#xo&&void 0!==this.#bo[this.#xo]&&void 0!==this.#bo[this.#xo].perslice&&!0===this.#bo[this.#xo].perslice&&!this.#Ao.isResampled()){const e=this.getCurrentIndex();if(void 0===e)throw new Error("Cannot get window lut with no current index");const t=this.#Ao.getSecondaryOffset(e),n=this.#bo[this.#xo].wl[t];void 0!==n&&this.setWindowLevel(n,this.#xo,!0)}if(void 0===this.#Eo&&this.setWindowLevelPresetById(0,!0),void 0===this.#Te||this.#Ao.isConstantRSI()!==this.#Te){let e,t;this.#Te=this.#Ao.isConstantRSI(),this.#Te?(e=this.#Ao.getRescaleSlopeAndIntercept(),t=!0):(e=new Re(1,0),t=!1);const n=new Zs(e,this.#Ao.getMeta().BitsStored);this.#Oo=new _s(n,1===this.#Ao.getMeta().PixelRepresentation,t)}const e=this.#Oo.getVoiLut();let t;if(void 0!==e&&(t=e.getWindowLevel()),void 0===e||!Ve(this.#Eo,t)){const e=new Ue(this.#Eo,this.#Ao.getMeta().VOILUTFunction);this.#Oo.setVoiLut(e)}return this.#Oo}getWindowPresets(){return this.#bo}getWindowPresetsNames(){return Object.keys(this.#bo)}setWindowPresets(e){this.#bo=e}addWindowPresets(e){const t=Object.keys(e);for(const n of t)if(void 0!==this.#bo[n]){if(void 0!==this.#bo[n].perslice&&!0===this.#bo[n].perslice)throw new Error("Cannot add perslice preset");this.#bo[n]=e[n]}else this.#bo[n]=e[n],this.dispatchEvent(new CustomEvent("wlpresetadd",{detail:{name:n}}))}getCurrentWindowPresetName(){return this.#xo}getColourMap(){return this.#Ro}#Go(){return Ye[this.#Ro]}setColourMap(e){if(!Ye[e])throw new Error(`Unknown colour map: '${e}'`);this.#Ro=e,this.dispatchEvent(new CustomEvent("colourmapchange",{detail:{value:[e]}}))}getCurrentPosition(){return this.#Fo}getCurrentIndex(){const e=this.getCurrentPosition();if(void 0!==e)return this.getImage().getGeometry().worldToIndex(e)}getCurrentImageUid(){return this.#Ao.getImageUid(this.getCurrentIndex())}getOriginForImageUid(e){return this.#Ao.getOriginForImageUid(e)}includesImageUid(e){return this.#Ao.includesImageUid(e)}isPositionInBounds(e){void 0===e&&(e=this.#Fo);const t=this.#Ao.getGeometry(),n=t.worldToIndex(e),i=[this.getScrollDimIndex()];return 4===n.length()&&i.push(3),t.isIndexInBounds(n,i)}getOrigin(e){const t=this.#Ao.getGeometry();let n=0;return void 0!==e&&(n=t.worldToIndex(e).get(2)),t.getOrigins()[n]}setCurrentIndex(e,t){const n=this.#Ao.getGeometry().indexToWorld(e);return this.setCurrentPosition(n,t)}setCurrentPosition(e,t){void 0===t&&(t=!1);const n=this.#Ao.getGeometry(),i=n.getSize().normalisePoint(e,this.#Fo),o=n.worldToIndex(i),r=[this.getScrollDimIndex()];if(4===o.length()&&r.push(3),!n.isIndexInBounds(o,r))return this.#Fo=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.#Fo=i,!t){const t=[o.getValues(),e.getValues()];if(this.#Ao.canQuantify()){const e=this.#Ao.getRescaledValueAtIndex(o);t.push(e)}this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:t,diffDims:a,data:{imageUid:this.#Ao.getImageUid(o)}}}))}return!0}setWindowLevel(e,t,n){if(void 0===t&&(t="manual"),"manual"!==t&&void 0===this.#bo[t])throw new Error(`Unknown window level preset: '${t}'`);void 0===n&&(n=!1);const i=Ne(e,this.#Ao.getRescaledDataRange(),this.#Ao.getMeta().VOILUTFunction),o=!Ve(i,this.#Eo),r=this.#xo!==t;(o||r)&&(this.#Eo=i,this.#xo=t,"manual"===t&&(void 0!==this.#bo[t]?this.#bo[t].wl[0]=i:this.addWindowPresets({manual:new Be("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.#ko().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.#Ao.isResampled()){const e=this.#Ao.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 Ne(new Qe(n,t),e,this.#Ao.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(),r=xe(n,t,i,this.getOrientation()),a=n.getPhotometricInterpretation();switch(a){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,r,this.getAlphaFunction(),this.#ko(),this.#Go());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,r,n.getPaletteColourMap(),n.getSegmentCollection(),n.getGeometry().getSize().getDimSize(2),n.getGeometry().getSize(),this.getOrientation(),this.getContourThickness(),this.getFillOpacity(),this.#No):function(e,t,n,i,r){const a=function(e){return e>>8};r&&o.info("Scaling 16bits data to 8bits.");let s,l=0,c=t.next();for(;!c.done;)s=c.value,r?(e.data[l]=a(i.red[s]),e.data[l+1]=a(i.green[s]),e.data[l+2]=a(i.blue[s])):(e.data[l]=i.red[s],e.data[l+1]=i.green[s],e.data[l+2]=i.blue[s]),e.data[l+3]=n(s,c.index),l+=4,c=t.next()}(e,r,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,r,this.getAlphaFunction());break;case"YBR_FULL":!function(e,t,n){let i,o=0,r=t.next();for(;!r.done;)a=r.value[0],s=r.value[1],i={r:a+1.402*((l=r.value[2])-128),g:a-.34414*(s-128)-.71414*(l-128),b:a+1.772*(s-128)},e.data[o]=i.r,e.data[o+1]=i.g,e.data[o+2]=i.b,e.data[o+3]=n(r.value,r.index),o+=4,r=t.next();var a,s,l}(e,r,this.getAlphaFunction());break;default:throw new Error(`Unsupported photometric interpretation: ${a}`)}}getScrollDimIndex(){let e=2;const t=this.getOrientation();return void 0!==t&&(e=t.getThirdColMajorDirection()),e}isAquisitionOrientation(){return je(this.#$)}}class ol{#zo={};add(e,t){void 0===this.#zo[e]&&(this.#zo[e]=[]),this.#zo[e].push(t)}remove(e,t){if(void 0===this.#zo[e])return;let n=0;for(let i=0;i<this.#zo[e].length;++i)this.#zo[e][i]===t&&(++n,this.#zo[e].splice(i,1));0===n&&o.debug(`No callback found on remove listener for type ${e}`)}fireEvent=e=>{if(void 0===this.#zo[e.type])return;const t=this.#zo[e.type].slice();for(let n=0;n<t.length;++n)t[n](e)}}class rl{#Ho;#Y;#Yo;#Xo;#Wo;constructor(e,t){this.#Ho=e,this.#Y=e.getRealSpacing(),this.#Yo=e.getOrientation(),this.#Xo=t,this.#Wo=function(e,t){let n=e.asOneAndZeros().multiply(t);return e.asOneAndZeros().getAbs().isSimilar(Ze().getAbs())&&(n=n.getAbs()),n}(this.#Yo,t)}getViewOrientation(){return this.#Xo}getTargetOrientation(){return this.#Wo}getOffset3DFromPlaneOffset(e){const t=new h(e.x,e.y,0),n=this.getTargetDeOrientedVector3D(t);return new h(n.getX()*this.#Y.get(0),n.getY()*this.#Y.get(1),n.getZ()*this.#Y.get(2))}getPlaneOffsetFromOffset3D(e){const t=new h(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.#Wo&&(t=this.#Wo.getInverse().multiplyVector3D(e)),t}getTargetDeOrientedVector3D(e){let t=e;return void 0!==this.#Wo&&(t=this.#Wo.multiplyVector3D(e)),t}getTargetDeOrientedPoint3D(e){let t=e;return void 0!==this.#Wo&&(t=this.#Wo.multiplyPoint3D(e)),t}getImageOrientedVector3D(e){let t=e;if(void 0!==this.#Xo){const n=wt([e.getX(),e.getY(),e.getZ()],this.#Xo);t=new h(n[0],n[1],n[2])}return t}getImageOrientedPoint3D(e){let t=e;if(void 0!==this.#Xo){const n=wt([e.getX(),e.getY(),e.getZ()],this.#Xo);t=new S(n[0],n[1],n[2])}return t}getImageDeOrientedVector3D(e){let t=e;if(void 0!==this.#Xo){const n=It([e.getX(),e.getY(),e.getZ()],this.#Xo);t=new h(n[0],n[1],n[2])}return t}getImageDeOrientedPoint3D(e){let t=e;if(void 0!==this.#Xo){const n=It([e.getX(),e.getY(),e.getZ()],this.#Xo);t=new S(n[0],n[1],n[2])}return t}getPositionFromPlanePoint(e,t){const n=new S(e.getX(),e.getY(),t),i=this.getImageOrientedPoint3D(n);return this.#Ho.pointToWorld(i)}getPlanePointFromPosition(e){const t=this.#Ho.worldToPoint(e);return this.getImageDeOrientedPoint3D(t)}getCosines(){return[(e=this.#Wo).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 g(0,0),i.getZ()),r=this.#Ho.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 S(s[0],s[1],s[2]),new S(u[0],u[1],u[2]),new S(u[3],u[4],u[5])]}worldToIndex(e){return this.#Ho.worldToIndex(e)}indexToWorld(e){return this.#Ho.indexToWorld(e)}isAquisitionOrientation(){return je(this.#Xo)}getTargetOrientedPositiveXYZ(e){const t=It([e.x,e.y,e.z],this.#Wo);return{x:t[0],y:t[1],z:t[2]}}getScrollDimIndex(){let e;return e=void 0!==this.#Xo?this.#Xo.getThirdColMajorDirection():2,e}getNativeScrollDimIndex(){let e;return e=void 0!==this.#Yo?this.#Yo.getThirdColMajorDirection():2,e}}class al{#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 sl{#$o;#ie;#Fo;#jo;constructor(e){this.#$o=new al(e),this.#ie=e.getImage().getGeometry(),this.#Fo=e.getCurrentPosition(),this.#jo=e.getScrollDimIndex()}getGeometry(){return this.#ie}getScrollDimIndex(){return this.#jo}getMaximumDimValue(e){return this.#ie.getSize().get(e)-1}getMaximumScrollValue(){return this.getMaximumDimValue(this.#jo)}getCurrentPosition(){return this.#ie.getSize().normalisePoint(this.#$o.getCurrentPosition(),this.#Fo)}getCurrentPositionDimValue(e){return this.getCurrentIndex().get(e)}getCurrentPositionScrollValue(){return this.getCurrentPositionDimValue(this.#jo)}getCurrentPositionAtDimValue(e,t){const n=this.getCurrentIndex().getValues();return n[e]=t,this.#ie.indexToWorld(new i(n))}getCurrentPositionAtScrollValue(e){return this.getCurrentPositionAtDimValue(this.#jo,e)}getCurrentIndex(){return this.#ie.worldToIndex(this.getCurrentPosition())}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(this.#Fo=this.#ie.getSize().normalisePoint(e,this.#Fo),n=this.#$o.setCurrentPosition(e,t)),n}setCurrentPositionSafe(e,t){let n=!1;return this.isPositionInBounds(e)&&(n=this.setCurrentPosition(e,t)),n}merge(e){if(this.#jo!==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(),Dt))throw new Error("Cannot merge geometries with different orientation");const i=n.getInverse(),o=function(e,t){return w(e,t,Math.min)},r=function(e,t){return w(e,t,Math.max)},a=new ot(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 p=new pt(h),m=[];for(let e=0;e<p.get(2);++e){const t=u.slice();t[2]=u[2]+e*a.get(2);const i=new S(t[0],t[1],t[2]);m.push(n.multiplyPoint3D(i))}return new yt(m,p,a,n)}(this.#ie,e.getGeometry()),this.#Fo=this.#ie.getSize().normalisePoint(this.#Fo,e.getCurrentPosition())}isPositionInBounds(e){const t=this.#ie.worldToIndex(e),n=[this.#jo];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.#jo)}decrementPositionAlongScroll(){return this.decrementPosition(this.#jo)}}class ll{#p;#Zo;#_o;constructor(e){if(void 0===e.getImage())throw new Error("View does not have an image, cannot setup controller");this.#p=e,this.#Zo=new rl(e.getImage().getGeometry(),e.getOrientation())}getPlaneHelper(){return this.#Zo}updatePlaneHelper(){this.#Zo=new rl(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 g(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.#_o}getPositionHelper(){return new sl(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.#Zo.getImageDeOrientedVector3D(new h(e.get(0),e.get(1),e.get(2)));e=new i([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.#Zo.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}#Ko(e,t,n,i){const o=be(xe(e,t,n,i)),r=e.getGeometry().getSize(i).getValues();r[2]=1;const a=new pt(r),s=e.getGeometry().getSpacing(i).getValues();s[2]=1;const l=new ot(s),c=new S(0,0,0),u=new yt([c],a,l);return new Ki(u,o)}getImageRegionValues(e,t,n){let o=this.#p.getImage();const r=this.#p.getOrientation();let a=n,s=!0;je(r)||(o=this.#Ko(o,a,s,r),a=new i([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 g(0,0)),void 0===o&&(o=new g(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)}(o,a,s,e,t);let c=[];return l&&(c=be(l)),c}getImageVariableRegionValues(e,t){let n=this.#p.getImage();const o=this.#p.getOrientation();let r=t,a=!0;je(o)||(n=this.#Ko(n,r,a,o),r=new i([0,0,0]),a=!1);const s=function(e,t,n,i){if(1!==e.getNumberOfComponents())throw new Error(`Unsupported number of components for region iterator: ${e.getNumberOfComponents()}`);let o;void 0===n&&(n=!1),o=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const r=e.getGeometry().getSize(),a=[];let s,l=null,c=null,u=null;for(let e=0;e<i.length;++e){s=i[e];const t=s[1][0]-s[0][0];0!==t&&(u=e,l||(l=s[0]),a.push([s[0][0],t,r.get(0)-s[1][0]]))}if(null!==u&&(c=i[u][1]),0!==a.length)return function(e,t,n,i,o){let r=t,a=0,s=0;return{next(){if(r<n){const t={value:e(r),done:!1,index:r};return s+=1,r+=1,s===o[a][1]&&(s=0,r+=o[a][2],a+=1,a<o.length&&(r+=o[a][0])),t}return{done:!0,index:n}}}}(o,r.indexToOffset(t.getWithNew2D(l[0],l[1])),r.indexToOffset(t.getWithNew2D(c[0],c[1]))+1,0,a)}(n,r,a,e);let l=[];return s&&(l=be(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 S(e.getX(),e.getY(),t),i=this.#Zo.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.#Zo.getImageDeOrientedPoint3D(t);return new g(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 S(e.getX(),e.getY(),t),i=this.#Zo.getTargetDeOrientedPoint3D(n),o=this.#p.getImage().getGeometry().getRealSpacing();return new S(i.getX()*o.get(0),i.getY()*o.get(1),i.getZ()*o.get(2))}getOffset3DFromPlaneOffset(e){return this.#Zo.getOffset3DFromPlaneOffset(e)}play(){if(this.canScroll())if(void 0===this.#_o){const e=this.#p.getImage(),t=e.getMeta().RecommendedDisplayFrameRate,n=this.#p.getPlaybackMilliseconds(t),o=e.getGeometry().getSize().canScroll3D(),r=this.getPositionHelper();this.#_o=window.setInterval((()=>{let e;if(e=o?r.incrementPositionAlongScroll():r.incrementPosition(3),!e){const e=this.getCurrentIndex().getValues(),t=this.#p.getOrientation();o?e[t.getThirdColMajorDirection()]=0:e[3]=0;const n=new i(e),r=this.#p.getImage().getGeometry();this.setCurrentPosition(r.indexToWorld(n))}}),n)}else this.stop()}stop(){void 0!==this.#_o&&(clearInterval(this.#_o),this.#_o=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{#Jo;#Rn=null;#er=null;#tr=null;#nr=null;#ir=!0;#or;#rr;#ar;#sr=1;#lr={x:1,y:1};#cr={x:1,y:1};#ur={x:1,y:1,z:1};#dr={x:1,y:1};#hr=1;#gr={x:1,y:1};#Sr={x:0,y:0};#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=null;#tt;#yr=new ol;#Ir=!1;#wr;#Tr;constructor(e){this.#Jo=e,this.#Jo.className+=" viewLayer"}getDataId(){return this.#tt}getScale(){return this.#lr}getAbsoluteZoomOffset(){return{x:this.#fr.x*this.#cr.x,y:this.#fr.y*this.#cr.y}}setImageSmoothing(e){this.#Ir=e}setView(e,t){this.#tt=t,e.addEventListener("wlchange",this.#Lr),e.addEventListener("colourmapchange",this.#Pr),e.addEventListener("positionchange",this.#Ar),e.addEventListener("alphafuncchange",this.#Or),e.addEventListener("maskviewchange",this.#br);for(const t of tl)e.addEventListener(t,this.#xr);this.#Rn=new ll(e),this.bindImage()}getViewController(){return this.#Rn}getImageData(){return this.#or}onimageset=e=>{const t=e.detail?.dataid,n=e.detail?.value;this.#tt===t&&(this.#Rn.setImage(n[0]),this.#Er(this.#Rn.getImageSize().get2D()),this.#Dr=!0)};bindImage(){this.#Rn&&this.#Rn.bindImageAndLayer(this)}unbindImage(){this.#Rn&&this.#Rn.unbindImageAndLayer(this)}onimagecontentchange=e=>{const t=e.detail?.dataid;void 0!==t&&this.#tt!==t||(this.#ir=this.#Rn.isPositionInBounds(),this.#Dr=!0,this.draw())};onimagegeometrychange=e=>{const t=e.detail?.dataid;if(void 0===t||this.#tt===t){const e=this.#Rn.getImageSize().get2D(),t=this.#Rn.getImageSpacing().get2D(),n=this.#rr.x!==e.x||this.#rr.y!==e.y,i=this.#ar.x!==t.x||this.#ar.y!==t.y;if(i&&(this.#Rn.updatePlaneHelper(),this.#Rr(t)),n){if(void 0!==this.#wr&&void 0!==this.#Tr){const e=this.#Rn.getOrigin(),t=this.#Tr.minus(e),n=this.#Rn.getOrigin(this.#Rn.getCurrentPosition());if(void 0!==n){const e=this.#wr.minus(n);this.setBaseOffset(t,e)}}this.#Er(e)}(i||n)&&(this.#Dr=!0,this.draw())}};onimageresampled=e=>{const t=this.#Rn.getCurrentIndex().get(3),n=void 0===t||t===e.detail?.frame,i=e.detail?.dataid;void 0!==i&&this.#tt!==i||!n||(this.#Dr=!0,this.draw())};getId(){return this.#Jo.id}removeFromDOM(){this.#Jo.remove()}getBaseSize(){return this.#rr}getImageWorldSize(){return this.#Rn.getImageWorldSize()}getOpacity(){return this.#sr}setOpacity(e){e!==this.#sr&&(this.#sr=Math.min(Math.max(e,0),1),this.#xr(new CustomEvent("opacitychange",{detail:{value:[this.#sr]}})))}getFillOpacity(){return this.#Rn.getFillOpacity()}setFillOpacity(e){this.#Rn.setFillOpacity(e)}getContourThickness(){return this.#Rn.getContourThickness()}setContourThickness(e){this.#Rn.setContourThickness(e)}addFlipOffsetX(){this.#Cr.x+=this.#er.width/this.#lr.x,this.#Sr.x+=this.#Cr.x}addFlipOffsetY(){this.#Cr.y+=this.#er.height/this.#lr.y,this.#Sr.y+=this.#Cr.y}flipScaleX(){this.#ur.x*=-1}flipScaleY(){this.#ur.y*=-1}flipScaleZ(){this.#ur.z*=-1}setScale(e,t){const n=this.#Rn.getPlaneHelper(),i=n.getTargetOrientedPositiveXYZ({x:e.x*this.#ur.x,y:e.y*this.#ur.y,z:e.z*this.#ur.z}),o={x:this.#cr.x*i.x,y:this.#cr.y*i.y};if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:this.#Sr.x-this.#fr.x,y:this.#Sr.y-this.#fr.y};this.#fr={x:0,y:0},this.#Sr=e}else if(void 0!==t){let e=n.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#pr.x,y:e.y+this.#pr.y};const i=yl(this.#Sr,this.#lr,o,e),r={x:this.#fr.x+i.x-this.#Sr.x,y:this.#fr.y+i.y-this.#Sr.y};this.#fr=r,this.#Sr=i}this.#lr=o}initScale(e,t){const n=this.#Rn.getPlaneHelper().getTargetOrientedPositiveXYZ({x:e.x*this.#ur.x,y:e.y*this.#ur.y,z:e.z*this.#ur.z}),i={x:this.#cr.x*n.x,y:this.#cr.y*n.y};this.#lr=i,this.#fr={x:t.x/this.#cr.x,y:t.y/this.#cr.y},this.#Sr={x:this.#Sr.x+this.#fr.x,y:this.#Sr.y+this.#fr.y}}setBaseOffset(e,t,n,i){const o=this.#Rn.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.#pr.x!==a.x||this.#pr.y!==a.y;return void 0!==n&&void 0!==i&&(this.#wr=n,this.#Tr=i),s&&(this.#Sr={x:this.#Sr.x-this.#pr.x+a.x,y:this.#Sr.y-this.#pr.y+a.y},this.#pr=a),s}setOffset(e){const t=this.#Rn.getPlaneHelper().getPlaneOffsetFromOffset3D(e);this.#Sr={x:this.#Sr.x-this.#vr.x+t.x,y:this.#Sr.y-this.#vr.y+t.y},this.#vr=t}displayToPlaneIndex(e){const t=this.displayToPlanePos(e);return new i([Math.floor(t.getX()),Math.floor(t.getY())])}displayToPlaneScale(e){return new g(e.getX()/this.#lr.x,e.getY()/this.#lr.y)}displayToPlanePos(e){const t=this.displayToPlaneScale(e);return new g(t.getX()+this.#Sr.x,t.getY()+this.#Sr.y)}planePosToDisplay(e){let t=(e.getX()-this.#Sr.x+this.#pr.x)*this.#lr.x,n=(e.getY()-this.#Sr.y+this.#pr.y)*this.#lr.y;return(t<0||t>=this.#er.width)&&(t=void 0),(n<0||n>=this.#er.height)&&(n=void 0),new g(t,n)}displayToMainPlanePos(e){const t=this.displayToPlanePos(e);return new g(t.getX()-this.#pr.x,t.getY()-this.#pr.y)}display(e){this.#Jo.style.display=e?"":"none"}isVisible(){return""===this.#Jo.style.display}draw(){this.#ir&&(this.#xr(new CustomEvent("renderstart",{detail:{layerid:this.getId()}})),this.#Dr&&this.#Fr(),this.#nr.globalAlpha=this.#sr,this.clear(),this.#nr.setTransform(this.#lr.x,0,0,this.#lr.y,-1*this.#Sr.x*this.#lr.x,-1*this.#Sr.y*this.#lr.y),this.#nr.imageSmoothingEnabled=this.#Ir,this.#nr.drawImage(this.#tr,0,0),this.#xr(new CustomEvent("renderend",{detail:{layerid:this.getId()}})))}initialise(e,t,n){this.#ar=t,this.#sr=Math.min(Math.max(n,0),1),this.#er=document.createElement("canvas"),this.#Jo.appendChild(this.#er),this.#er.getContext?(this.#nr=this.#er.getContext("2d"),this.#nr?(this.#tr=document.createElement("canvas"),this.#Er(e),this.#Dr=!0):alert("Error: failed to get the 2D context.")):alert("Error: no canvas.getContext method.")}#Er(e){if(!vo(e.x,e.y))throw new Error(`Cannot create canvas with size ${e.x}, ${e.y}`);this.#rr=e,this.#tr.width=this.#rr.x,this.#tr.height=this.#rr.y,this.#nr.clearRect(0,0,this.#rr.x,this.#rr.y),this.#or=this.#nr.createImageData(this.#rr.x,this.#rr.y)}#Rr(e){this.#ar=e,this.fitToContainer(this.#dr,this.#hr,this.#gr)}fitToContainer(e,t,n){let i=!1;const o={x:t*this.#ar.x,y:t*this.#ar.y},r=o.x/this.#cr.x,a=o.y/this.#cr.y,s=e.x/(this.#er.width*r),l=e.y/(this.#er.height*a);if(this.#er.width!==e.x||this.#er.height!==e.y){if(!vo(e.x,e.y))throw new Error(`Cannot resize canvas ${e.x}, ${e.y}`);this.#er.width=e.x,this.#er.height=e.y,i=!0}const c={x:this.#lr.x*r,y:this.#lr.y*a};this.#lr.x===c.x&&this.#lr.y===c.y||(this.#cr=o,this.#lr=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.#Cr.x?d.x:0,y:0!==this.#Cr.y?d.y:0};if(this.#mr.x!==u.x||this.#mr.y!==u.y||this.#Cr.x!==h.x||this.#Cr.y!==h.y){const e={x:this.#fr.x*s,y:this.#fr.y*l};this.#Sr={x:this.#Sr.x+u.x-this.#mr.x+h.x-this.#Cr.x+e.x-this.#fr.x,y:this.#Sr.y+u.y-this.#mr.y+h.y-this.#Cr.y+e.y-this.#fr.y},this.#Cr=h,this.#mr=u,this.#fr=e,i=!0}this.#dr=e,this.#hr=t,this.#gr=n,i&&this.draw()}bindInteraction(){this.#Jo.style.pointerEvents="auto";const e=So;for(let t=0;t<e.length;++t){const n=e[t],i="wheel"!==n&&"touchstart"!==n;this.#Jo.addEventListener(n,this.#Mr,{passive:i})}}unbindInteraction(){this.#Jo.style.pointerEvents="none";const e=So;for(let t=0;t<e.length;++t)this.#Jo.removeEventListener(e[t],this.#Mr)}addEventListener(e,t){this.#yr.add(e,t)}removeEventListener(e,t){this.#yr.remove(e,t)}#xr=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#tt});this.#yr.fireEvent(new CustomEvent(e.type,{detail:t}))};#Mr=e=>{e.srclayerid=this.getId(),e.dataid=this.#tt,this.#yr.fireEvent(e)};#Fr(){this.#Rn.generateImageData(this.#or),this.#tr.getContext("2d").putImageData(this.#or,0,0),this.#Dr=!1}#Lr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#Dr=!0,this.draw())};#Pr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#Dr=!0,this.draw())};#Ar=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.#Rn.getScrollDimIndex());t.splice(n,1);const i=e.detail?.diffDims?.filter((function(e){return-1===t.indexOf(e)}));0===i.length&&this.#ir||(this.#ir=!0,this.#Dr=!0,this.draw())}else this.#ir&&(this.#ir=!1,this.clear())}};isValidPosition(){return this.#ir}#Or=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#Dr=!0,this.draw())};#br=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#Dr=!0,this.draw())};setCurrentPosition(e,t){return this.#Rn.setCurrentPosition(e)}clear(){this.#nr.save(),this.#nr.setTransform(1,0,0,1,0,0),this.#nr.clearRect(0,0,this.#er.width,this.#er.height),this.#nr.restore()}}class ul extends La{#qr;#Ur;constructor(e,t){super(),this.#qr=e,this.#Ur=t}getName(){return`AddAnnotation-${this.#qr.trackingUid}`}execute(){this.#Ur.addAnnotation(this.#qr)}undo(){this.#Ur.removeAnnotation(this.#qr.trackingUid)}}class dl extends La{#qr;#Ur;constructor(e,t){super(),this.#qr=e,this.#Ur=t}getName(){return`RemoveAnnotation-${this.#qr.trackingUid}`}execute(){this.#Ur.removeAnnotation(this.#qr.trackingUid)}undo(){this.#Ur.addAnnotation(this.#qr)}}class hl extends La{#qr;#Ur;#Qr;#Vr;constructor(e,t,n,i){super(),this.#qr=e,this.#Ur=i,this.#Qr=t,this.#Vr=n}getName(){return`UpdateAnnotation-${this.#qr.trackingUid}`}execute(){const e=Object.keys(this.#Vr);for(const t of e)this.#qr[t]=this.#Vr[t];this.#Ur.updateAnnotation(this.#qr,e)}undo(){const e=Object.keys(this.#Qr);for(const t of e)this.#qr[t]=this.#Qr[t];this.#Ur.updateAnnotation(this.#qr,e)}}class gl{#Nr;getAnnotation(e){return this.#Nr.find(e)}getAnnotationGroup(){return this.#Nr}isAnnotationGroupEditable(){return this.#Nr.isEditable()}setAnnotationGroupEditable(e){this.#Nr.setEditable(e)}addAnnotation(e){this.#Nr.add(e)}updateAnnotation(e,t,n){this.#Nr.update(e,t,n)}removeAnnotation(e){this.#Nr.remove(e)}removeAnnotationWithCommand(e,t){const n=this.getAnnotation(e);if(void 0===n)return void o.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 r=this.getAnnotation(e);if(void 0===r)return void o.warn(`Cannot create update command for undefined annotation: ${e}`);const a=new hl(r,t,n,this);i(a),a.execute()}removeAllAnnotationsWithCommand(e){for(const t of this.#Nr.getList())this.removeAnnotationWithCommand(t.trackingUid,e)}constructor(e){this.#Nr=void 0!==e?e:new eo}hasAnnotationMeta(e){return this.#Nr.hasMeta(e)}setAnnotationMeta(e,t){this.#Nr.setMetaValue(e,t)}}class Sl{#Jo;#Br=null;#rr;#ar;#cr={x:1,y:1};#ur={x:1,y:1,z: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};#Ur;#Zo;#tt;#kr;#Gr;#zr;#Hr=!0;constructor(e){this.#Jo=e,this.#Jo.className+=" drawLayer"}setShapeHandler(e){this.#zr=e}getDataId(){return this.#tt}getReferenceLayerId(){return this.#kr}#yr=new ol;getKonvaStage(){return this.#Br}getKonvaLayer(){return this.#Br.getLayers()[0]}getDrawController(){return this.#Ur}setPlaneHelper(e){this.#Zo=e}getId(){return this.#Jo.id}removeFromDOM(){this.#Jo.remove()}getBaseSize(){return this.#rr}getOpacity(){return this.#Br.opacity()}setOpacity(e){this.#Br.opacity(Math.min(Math.max(e,0),1))}addFlipOffsetX(){const e=this.#Br.scale(),t=this.#Br.size();this.#Cr.x+=t.width/e.x;const n=this.#Br.offset();n.x+=this.#Cr.x,this.#Br.offset(n)}addFlipOffsetY(){const e=this.#Br.scale(),t=this.#Br.size();this.#Cr.y+=t.height/e.y;const n=this.#Br.offset();n.y+=this.#Cr.y,this.#Br.offset(n)}flipScaleX(){this.#ur.x*=-1}flipScaleY(){this.#ur.y*=-1}flipScaleZ(){this.#ur.z*=-1}setScale(e,t){const n=this.#Zo.getTargetOrientedPositiveXYZ({x:e.x*this.#ur.x,y:e.y*this.#ur.y,z:e.z*this.#ur.z}),i={x:this.#cr.x*n.x,y:this.#cr.y*n.y},o=this.#Br.offset();if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:o.x-this.#fr.x,y:o.y-this.#fr.y};this.#fr={x:0,y:0},this.#Br.offset(e)}else if(void 0!==t){let e=this.#Zo.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#pr.x,y:e.y+this.#pr.y};const n=yl(o,this.#Br.scale(),i,e),r={x:this.#fr.x+n.x-o.x,y:this.#fr.y+n.y-o.y};this.#fr=r,this.#Br.offset(n)}this.#Br.scale(i),this.#Yr(i)}initScale(e,t){const n=this.#Zo.getTargetOrientedPositiveXYZ({x:e.x*this.#ur.x,y:e.y*this.#ur.y,z:e.z*this.#ur.z}),i={x:this.#cr.x*n.x,y:this.#cr.y*n.y};this.#Br.scale(i),this.#fr={x:t.x/this.#cr.x,y:t.y/this.#cr.y};const o=this.#Br.offset();this.#Br.offset({x:o.x+this.#fr.x,y:o.y+this.#fr.y})}setOffset(e){const t=this.#Zo.getPlaneOffsetFromOffset3D(e),n=this.#Br.offset();this.#Br.offset({x:n.x-this.#vr.x+t.x,y:n.y-this.#vr.y+t.y}),this.#vr=t}setBaseOffset(e,t){const n=this.#Zo.getNativeScrollDimIndex(),i=this.#Zo.getPlaneOffsetFromOffset3D({x:0===n?e.getX():t.getX(),y:1===n?e.getY():t.getY(),z:2===n?e.getZ():t.getZ()}),o=this.#pr.x!==i.x||this.#pr.y!==i.y;if(o){const e=this.#Br.offset();this.#Br.offset({x:e.x-this.#pr.x+i.x,y:e.y-this.#pr.y+i.y}),this.#pr=i}return o}display(e){this.#Jo.style.display=e?"":"none"}isVisible(){return""===this.#Jo.style.display}draw(){this.#Br.draw()}initialise(t,n,i){this.#rr=t,this.#ar=n,this.#kr=i,this.#Br=new e.Stage({container:this.#Jo,width:this.#rr.x,height:this.#rr.y,listening:!1}),this.#Br.getContent().setAttribute("style","");const o=new e.Layer({listening:!1,visible:!0});this.#Br.add(o)}setAnnotationGroup(e,t,n){if(this.#tt=t,e.addEventListener("annotationadd",(e=>{this.#Xr(e.detail.data,!0),this.getKonvaLayer().draw()})),e.addEventListener("annotationupdate",(e=>{this.#Wr(e.detail.data),this.getKonvaLayer().draw()})),e.addEventListener("annotationremove",(e=>{this.#$r(e.detail.data),this.getKonvaLayer().draw()})),e.addEventListener("annotationgroupeditablechange",(e=>{this.activateCurrentPositionShapes(e.detail.data)})),this.#Ur=new gl(e),0!==e.getLength())for(const t of e.getList())this.#Xr(t,!1),n(new ul(t,this.getDrawController()))}activateCurrentPositionShapes(t){const n=this.getKonvaLayer();if(this.#Br.listening(!1),void 0!==this.#zr){this.#zr.disableAndResetEditor();const t=n.getChildren();for(const n of t)n instanceof e.Group&&n.getChildren().forEach((t=>{t instanceof e.Group&&this.#zr.removeShapeListeners(t)}))}const i=this.getDrawController();if(t&&i.getAnnotationGroup().isEditable()){this.#Br.listening(!0);const t=this.#jr().getChildren();0!==t.length&&n.listening(!0),void 0!==this.#zr&&t.forEach((t=>{if(t instanceof e.Group){const e=i.getAnnotation(t.id());this.#zr.addShapeGroupListeners(t,e,this)}}))}n.draw()}#Zr(e){let t,n;return void 0!==e.planePoints?t=e.planePoints:void 0!==e.planeOrigin&&(t=[e.planeOrigin]),void 0!==t&&(n=this.#_r(t,e.referencedFrameNumber)),n}#_r(e,t){let n="";for(const t of e)0!==n.length&&(n+="-"),n+=I([d(t.getX(),2),d(t.getY(),2),d(t.getZ(),2)]);return void 0!==t&&(n+=`-${t}`),n}#Kr(t){let n;const i=this.#Zr(t),o=this.getKonvaLayer().getChildren(ia(i));if(0!==o.length){const i=o[0];if(!(i instanceof e.Group))return;const r=i.getChildren(ia(t.trackingUid));0!==r.length&&r[0]instanceof e.Group&&(n=r[0])}return n}#Xr(t,n){if(!t.canView()||!t.isCompatibleView(this.#Zo))return;const i=this.#Zr(t);let o=this.getKonvaLayer().getChildren(ia(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 to,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.#zr&&this.#zr.addShapeGroupListeners(l,t,this),this.setLabelVisibility(l)}#$r(t){const n=this.#Kr(t);return n instanceof e.Group?(n.remove(),!0):(o.debug("No shape group to remove"),!1)}#Wr(e){this.#$r(e)&&this.#Xr(e,!0)}fitToContainer(e,t,n){const i={x:t*this.#ar.x,y:t*this.#ar.y},o=i.x/this.#cr.x,r=i.y/this.#cr.y,a=e.x/(this.#Br.width()*o),s=e.y/(this.#Br.height()*r);this.#Br.width()===e.x&&this.#Br.height()===e.y||(this.#Br.width(e.x),this.#Br.height(e.y));const l={x:this.#Br.scale().x*o,y:this.#Br.scale().y*r};this.#Br.scale().x===l.x&&this.#Br.scale().y===l.y||(this.#cr=i,this.#Br.scale(l),this.#Yr(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.#Cr.x?u.x:0,y:0!==this.#Cr.y?u.y:0};if(this.#mr.x!==c.x||this.#mr.y!==c.y||this.#Cr.x!==d.x||this.#Cr.y!==d.y){const e={x:this.#fr.x*a,y:this.#fr.y*s};this.#Br.offset({x:this.#Br.offset().x+c.x-this.#mr.x+d.x-this.#Cr.x+e.x-this.#fr.x,y:this.#Br.offset().y+c.y-this.#mr.y+d.y-this.#Cr.y+e.y-this.#fr.y}),this.#Cr=d,this.#mr=c,this.#fr=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.#Hr=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.#ea(i,t)}}#ea(t,n){const i=t.getChildren(Jr)[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.#ea(e,this.#Hr)}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.#Br.listening(!0),this.#Jo.style.pointerEvents="auto";const e=So;for(let t=0;t<e.length;++t)this.#Jo.addEventListener(e[t],this.#Mr)}unbindInteraction(){this.#Br.listening(!1),this.#Jo.style.pointerEvents="none";const e=So;for(let t=0;t<e.length;++t)this.#Jo.removeEventListener(e[t],this.#Mr)}setCurrentPosition(e,t){void 0===t&&(t=this.#Zo.worldToIndex(e));const n=this.#Zo.getPlanePoints(e);let i,o;i=this.#Zo.isAquisitionOrientation()?[n[0]]:n,e.length()>3&&(o=e.get(3));const r=this.#_r(i,o);return this.#ta(r),this.#xr(new CustomEvent("positionchange",{detail:{value:[t.getValues(),e.getValues()],valid:!0}})),!0}#ta(e){this.#Gr=e;const t=this.getKonvaLayer().getChildren(ta);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()}#jr(){if(void 0===this.#Gr)return;const t=this.getKonvaLayer().getChildren((e=>e.id()===this.#Gr));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.#Gr),n.visible(!0),this.getKonvaLayer().add(n)):o.warn("Unexpected number of draw position groups"),n}#Jr(e){return this.getKonvaLayer().findOne(`#${e}`)}addEventListener(e,t){this.#yr.add(e,t)}removeEventListener(e,t){this.#yr.remove(e,t)}#xr=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#tt});this.#yr.fireEvent(new CustomEvent(e.type,{detail:t}))};#Mr=e=>{e.srclayerid=this.getId(),e.dataid=this.#tt,this.#yr.fireEvent(e)};#Yr(e){const t=2/e.x,n=2/e.y,i=this.#Br.find("Label");for(let e=0;e<i.length;++e)i[e].scale({x:t,y:n})}}function pl(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 ml(e){return`info-${e}`}function fl(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,""),`${ml(e.pos)}-${t}-${n}`}class vl{#na=!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=Cl(e.detail.srclayerid),i={groupDivId:(n=this.#Jo.id).substring(0,n.length-10)};if(t.groupDivId!==i.groupDivId)return}var n;this.#na||this.#ia(t),this.#oa(t)}};#ia(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=fl(i),void 0!==i.tags&&e.appendChild(document.createTextNode(i.value)),t.appendChild(e)}const i=document.createElement("div");i.id=ml(n),i.className=`info-${n} info`,i.appendChild(t),this.#Jo.appendChild(i)}this.#na=!0}#oa(e){for(const t of e){const e=`#${fl(t)}`,n=this.#Jo.querySelector(e),i=t.value;i&&n&&n.replaceChildren(document.createTextNode(i))}}}function Cl(e){const t=e.split("-layer-");return 2!==t.length&&o.warn("Not the expected layer div id format..."),{groupDivId:t[0],layerIndex:t[1],layerId:e}}function Dl(e){let t=null;const n=e.target.closest(".layer");return n&&void 0!==n.id&&(t=Cl(n.id)),t}function yl(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 Il extends EventTarget{#Jo;#ra=[];#lr={x:1,y:1,z:1};#je={x:1,y:1,z:1};#Sr={x:0,y:0,z:0};#aa=void 0;#sa=!1;#la=[];#ca;#Ir=!1;#ua;#da;#ha=[];#ga;getPositionHelper(){if(void 0===this.#ua)for(const e of this.#ra)if(e instanceof cl){const t=e.getViewController().getPositionHelper();void 0===this.#ua?this.#ua=t:this.#ua.merge(t)}return this.#ua}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.#da=new vl(t)}}getShowCrosshair(){return this.#sa}setShowCrosshair(e){this.#sa=e,e?(this.addEventListener("offsetchange",this.#Sa),this.addEventListener("zoomchange",this.#Sa),this.#pa()):(this.removeEventListener("offsetchange",this.#Sa),this.removeEventListener("zoomchange",this.#Sa),this.#ma())}setImageSmoothing(e){this.#Ir=e;for(const t of this.#ra)t instanceof cl&&t.setImageSmoothing(e)}#Sa=e=>{this.#pa()};getDivId(){let e;return null!==this.#Jo&&(e=this.#Jo.id),e}getScale(){return this.#lr}getBaseScale(){return this.#je}getAddedScale(){return{x:this.#lr.x/this.#je.x,y:this.#lr.y/this.#je.y,z:this.#lr.z/this.#je.z}}getOffset(){return this.#Sr}getNumberOfLayers(){let e=0;return this.#ra.forEach((t=>{void 0!==t&&e++})),e}includes(e){if(void 0===e)return!1;for(const t of this.#ra)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.#ra)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.#aa&&(t=this.#aa);const n=[];for(let e=t;e>=0;e--)n.push(e);for(let e=this.#ra.length-1;e>t;e--)n.push(e);const i=[];for(const t of n){const n=this.#ra[t];n instanceof cl&&e(n)&&i.push(n)}return i}someViewLayer(e){let t=!1;for(const n of this.#ra)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.#ra)n instanceof Sl&&e(n)&&t.push(n);return t}getNumberOfViewLayers(){let e=0;return this.#ra.forEach((t=>{void 0!==t&&t instanceof cl&&e++})),e}getActiveLayer(){let e;return void 0!==this.#aa&&(e=this.#ra[this.#aa]),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.#ra)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.#ra)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.#ra)t instanceof cl&&e.push(t.getDataId());return e}getActiveDrawLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof Sl&&(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.#aa=e;const t=this.#ra[e];if(void 0!==this.#da){this.unbindInfoData();const e=t.getDataId();this.bindInfoData(e)}this.dispatchEvent(new CustomEvent("activelayerchange",{detail:{value:[this.#ra[e]]}}))}setActiveLayerById(e){let t;for(let n=0;n<this.#ra.length;++n)if(void 0!==this.#ra[n]&&this.#ra[n].getId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):o.warn(`No layer to set as active with id: ${e}`)}setActiveLayerByDataId(e){let t;for(let n=0;n<this.#ra.length;++n)if(void 0!==this.#ra[n]&&this.#ra[n].getDataId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):o.warn(`No layer to set as active with dataId: ${e}`)}addViewLayer(){const e=this.#ra.length,t=this.#fa();this.#Jo.append(t);const n=new cl(t);return n.setImageSmoothing(this.#Ir),this.#ra.push(n),this.setActiveLayer(e),this.#va(n),this.#ua=void 0,n}addDrawLayer(){this.#aa=this.#ra.length;const e=this.#fa();this.#Jo.append(e);const t=new Sl(e);return this.#ra.push(t),this.#Ca(t),t}#va(e){e.addEventListener("positionchange",this.updateLayersToPositionChange);for(const t of tl)e.addEventListener(t,this.#xr);e.addEventListener("renderstart",this.#xr),e.addEventListener("renderend",this.#xr)}#Da(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange);for(const t of tl)e.removeEventListener(t,this.#xr);e.removeEventListener("renderstart",this.#xr),e.removeEventListener("renderend",this.#xr),e.unbindImage()}#Ca(e){e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#xr)}#ya(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#xr)}addInfoData(e,t){this.#ha[t]=e}bindInfoData(e){if(void 0!==this.#ga)return;const t=this.#ha[e];void 0!==t&&t.addEventListener("valuechange",this.#da.onDataChange),this.#ga=e}unbindInfoData(){const e=this.#ha[this.#ga];void 0!==e&&e.removeEventListener("valuechange",this.#da.onDataChange),this.#ga=void 0}#fa(){const e=document.createElement("div");return e.id=`${this.getDivId()}-layer-${this.#ra.length}`,e.className="layer",e.style.pointerEvents="none",e}empty(){for(const e of this.#ra)void 0!==e&&this.removeLayer(e);this.#ra=[],this.#ma()}removeLayersByDataId(e){for(const t of this.#ra)void 0!==t&&t.getDataId()===e&&this.removeLayer(t)}removeLayer(e){const t=this.#ra.findIndex((t=>t===e));if(-1===t)throw new Error("Cannot find layer to remove");this.#aa===t&&(this.#aa=void 0),e instanceof cl?this.#Da(e):this.#ya(e),this.#ra[t]=void 0,this.#ua=void 0,e.removeFromDOM(),this.dispatchEvent(new CustomEvent("layerremove",{detail:{layerid:e.getId(),layergroupid:this.getDivId()}}))}#pa(){let e;this.#ma();for(const t of this.#ra)if(t instanceof cl){e=t;break}if(void 0===e)return void o.warn("No layer to show crosshair");if(this.#Ia(e))return void o.warn("Not enabling crosshair for secondary capture");const t=e.getViewController(),n=t.getCurrentPosition(),i=t.getPlanePositionFromPosition(n),r=e.planePosToDisplay(i);if(void 0!==r.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=`${r.getY()}px`,this.#la.push(e),this.#Jo.appendChild(e)}if(void 0!==r.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=`${r.getX()}px`,e.style.top="0px",this.#la.push(e),this.#Jo.appendChild(e)}}#ma(){for(const e of this.#la)e.remove();this.#la=[]}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=d(r,3).toString();void 0!==n.getPixelUnit()&&(i+=` ${n.getPixelUnit()}`),t.appendChild(document.createTextNode(i)),this.#ca=t,this.#Jo.appendChild(t)}}removeTooltipDiv(){void 0!==this.#ca&&(this.#ca.remove(),this.#ca=void 0)}isPositionInBounds(e){return this.someViewLayer((function(t){return t.getViewController().isPositionInBounds(e)}))}canScroll(){return this.someViewLayer((function(e){return e.getViewController().canScroll()}))}#Ia(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.#Ia(e)}moreThanOne(e){return this.someViewLayer((function(t){return t.getViewController().moreThanOne(e)}))}hasAnyLayerWithValidPosition(){return this.someViewLayer((function(e){return e.isValidPosition()}))}#wa=e=>{const t=e.detail?.dataid,n=this.#ha[t];void 0!==n&&n.onSliceChange(e)};updateLayersToPositionChange=e=>{for(const e of this.#ra)void 0!==e&&(e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#xr),e.addEventListener("positionchange",this.#wa));const t=e.detail?.value,n=new i(t[0]),o=new m(t[1]),r={};let a,s;for(const t of this.#ra){if(void 0===t)continue;let i=!1;if(t instanceof cl){const e=t.getViewController(),n=e.getOrigin(),l=e.getOrigin(o);let c,u;if(void 0===s)a=n,s=l,c=new h(0,0,0),u=new h(0,0,0);else if(e.isPositionInBounds(o)&&void 0!==l){const e=a.minus(n);c=new h(e.getX(),e.getY(),e.getZ());const t=s.minus(l);u=new h(t.getX(),t.getY(),t.getZ())}void 0!==c&&void 0!==u&&(i=t.setBaseOffset(c,u,s,a),r[t.getId()]={scroll:c,plane:u})}if(t instanceof Sl){const e=r[t.getReferenceLayerId()];void 0!==e&&(i=t.setBaseOffset(e.scroll,e.plane))}let l=!1;const c=e.detail?.srclayerid;t.getId()!==c&&(l=t.setCurrentPosition(o,n)),!l&&i&&t.draw()}const l=this.hasAnyLayerWithValidPosition();this.dispatchEvent(new CustomEvent("outofrange",{detail:{layergroupid:this.getDivId(),value:[!l]}})),this.#sa&&this.#pa();for(const e of this.#ra)void 0!==e&&(e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#xr),e.removeEventListener("positionchange",this.#wa))};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.#ra)void 0!==t&&t.fitToContainer(n,e,i);this.#sa&&this.#pa()}getMaxWorldSize(){let e={x:0,y:0};for(const t of this.#ra)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.#je.z*=-1,this.setScale(this.#je)}addScale(e,t){const n={x:this.#lr.x*(1+e),y:this.#lr.y*(1+e),z:this.#lr.z*(1+e)};this.setScale(n,t)}setScale(e,t){this.#lr=e;for(const e of this.#ra)void 0!==e&&e.setScale(this.#lr,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.#Sr.x-e.x,y:this.#Sr.y-e.y,z:this.#Sr.z-e.z})}setOffset(e){this.#Sr=e;for(const e of this.#ra)void 0!==e&&e.setOffset(this.#Sr);this.dispatchEvent(new CustomEvent("offsetchange",{detail:{value:[this.#Sr.x,this.#Sr.y,this.#Sr.z]}}))}reset(){this.setScale(this.#je),this.setOffset({x:0,y:0,z:0})}resetZoomPan(){this.setScale(this.#je),this.setOffset({x:0,y:0,z:0})}resetViews(){let e=!0;for(const t of this.#ra)if(void 0!==t&&t instanceof cl){const n=t.getViewController();e&&(n.resetPosition(),e=!1),n.resetWindowLevel()}}draw(){for(const e of this.#ra)void 0!==e&&e.draw()}display(e){for(const t of this.#ra)void 0!==t&&t.display(e)}#xr=e=>{const t=null!==e.detail&&"object"==typeof e.detail?Object.assign({},e.detail):{};this.dispatchEvent(new CustomEvent(e.type,{detail:t}))}}class wl{#Ta=0;add(e){this.#Ta+=function(e){return void 0===e.wheelDeltaY?-e.deltaY:e.wheelDeltaY>45?1:e.wheelDeltaY<-45?-1:-e.deltaY/60}(e)}getSum(){return this.#Ta}isTick(){return Math.abs(this.#Ta)>=1}clear(){this.#Ta=0}}class Tl extends EventTarget{#La;#Pa;#Aa;#Oa;#ba=new wl;#xa;#Ea;#Ra;#Fa;#Ma;#qa=!1;#Ua=!1;constructor({stageController:e,dragBehavior:t,hoverBehavior:n,wheelBehavior:i,doubleClickBehavior:o,twoTouchBehavior:r,tapBehavior:a,longTouchToDblClickMs:s=500}){super(),this.#La=e,this.#Pa=t,this.#Aa=n,this.#Oa=i,this.#xa=o,this.#Ea=r,this.#Ra=a,this.#Fa=s}#Qa(e){return this.#La.getLayerGroupByDivId(e)}#Va(e){const t=Dl(e),n=this.#Qa(t.groupDivId);return{point:fo(e),layerGroup:n}}#Na(e){const t=Dl(e),n=this.#Qa(t.groupDivId);return{point:mo(e)[0],layerGroup:n}}getEventNames(){return[]}wheel=e=>{if(void 0===this.#Oa)return;e.preventDefault();const t=Dl(e),n=this.#Qa(t.groupDivId);this.#Oa.onWheel(e,n),this.#ba.add(e);const i=this.#ba.getSum()>=0;this.#ba.isTick()&&(this.#ba.clear(),this.#Oa.onWheelTick(i,n))};dblclick=e=>{const{point:t,layerGroup:n}=this.#Va(e);void 0!==this.#xa?this.#xa.onDoubleClick(t,n):this.#Ra?.isActive()&&this.#Ra.onEnd()};#Ba(e,t){void 0!==this.#xa?this.#xa.onDoubleClick(e,t):this.#Ra?.isActive()&&(this.#Ra.onTap(e,t),this.#Ra.onEnd()),this.#qa=!1,this.#Ma=void 0}cancel(){this.#qa=!1,this.#Ua=!1,this.#ka(),this.#Pa?.isActive()&&this.#Pa.reset(),this.#Ra?.isActive()&&this.#Ra.reset(),this.#Ea?.isActive()&&this.#Ea?.reset(),this.#Aa?.reset()}mousedown=e=>{this.#Pa?.isActive()&&this.#Pa.reset(),this.#Ua=!1,this.#qa=!0;const{point:t,layerGroup:n}=this.#Va(e);!this.#Ra?.isActive()&&this.#Pa?.canStart(t,n)&&this.#Pa.onStart(t,n,{mouseDownButton:e.button})};mousemove=e=>{this.#Ua=!0;const{point:t,layerGroup:n}=this.#Va(e);this.#qa?(this.#Aa?.onEnd(),this.#Pa?.isActive()&&this.#Pa.onUpdate(t,n)):(this.#Ra?.isActive()&&this.#Ra.onUpdate(t,n),this.#Aa?.onUpdate(t,n))};mouseup=e=>{if(this.#Pa?.isActive()&&(this.#Ua?this.#Pa.onEnd():this.#Pa.reset()),this.#Ra&&(this.#Ra.isActive()||this.#qa&&!this.#Ua)){const{point:t,layerGroup:n}=this.#Va(e);this.#Ra.onTap(t,n)}this.#qa=!1};mouseout=e=>{this.#Pa?.isActive()&&this.#Pa.onEnd(),this.#Ra?.isActive()&&this.#Ra.onEnd(),this.#Aa?.onEnd(),this.#qa=!1,this.#Ua=!1};touchstart=e=>{this.#Pa?.isActive()&&this.#Pa.reset(),this.#Ua=!1,this.#ka(),this.#qa=!0;const t=mo(e);if(1===t.length){const{point:t,layerGroup:n}=this.#Na(e);this.#Pa?.canStart(t,n)&&this.#Pa.onStart(t,n,{});const i=this.#Fa;null!=i&&i>0&&(e.preventDefault(),this.#Ma=setTimeout((()=>{this.#Ba(t,n)}),i))}else 2===t.length&&this.#Ea?.onStart(t)};touchmove=e=>{this.#ka(),this.#Ua=!0;const{point:t,layerGroup:n}=this.#Na(e),i=mo(e);1===i.length?this.#Pa?.isActive()&&this.#Pa.onUpdate(t,n):2===i.length&&(this.#Pa?.isActive()&&this.#Pa.reset(),this.#Ea?.isActive()&&this.#Ea.onUpdate(i,n))};touchend=e=>{if(this.#ka(),this.#Ea?.isActive())this.#Ea.onEnd();else{if(this.#Pa?.isActive()&&(this.#Ua?this.#Pa.onEnd():this.#Pa.reset()),this.#Ra&&(this.#Ra.isActive()||this.#qa&&!this.#Ua)){const{point:t,layerGroup:n}=this.#Na(e);this.#Ra.onTap(t,n)}this.#qa=!1}};#ka(){void 0!==this.#Ma&&(clearTimeout(this.#Ma),this.#Ma=void 0)}}function Ll(e){return{x:"number"==typeof e?.x?e.x:0,y:"number"==typeof e?.y?e.y:0}}class Pl{#Ga;#za;constructor(e,t,{threshold:n}={}){this.#Ga={x:t.getX()-e.getX(),y:t.getY()-e.getY()},this.#za=Ll(n)}get delta(){return this.#Ga}passesThresholdX(){const e=this.#za.x;return e<=0||Math.abs(this.#Ga.x)>=e}passesThresholdY(){const e=this.#za.y;return e<=0||Math.abs(this.#Ga.y)>=e}passesThreshold(){return this.passesThresholdX()||this.passesThresholdY()}}class Al extends EventTarget{#Ha;#Ya;#Xa;constructor({threshold:e}={}){super(),this.setDragThreshold(e)}get startPoint(){return this.#Ha}get prevPoint(){return this.#Ya}setDragThreshold(e){this.#Xa=Ll(e)}isActive(){return void 0!==this.#Ya}canStart(e,t){return!0}reset(){this.#Ha=void 0,this.#Ya=void 0}onStart(e,t,n){this.#Ha=e,this.#Ya=e}onUpdate(e,t){const n=new Pl(this.#Ya,e,{threshold:this.#Xa});n.passesThreshold()&&(this.#Ya=e,this.onDrag(n,t))}onDrag(e,t){}onEnd(){this.#Ya=void 0,this.reset()}}class Ol extends Al{#Wa;constructor({activeViewLayerOnly:e=!0}={}){super(),this.#Wa=e}setActiveViewLayerOnly(e){this.#Wa=e}canStart(e,t){const n=Ys(t,this.#Wa);return void 0!==n&&!!n.getViewController().isMonochrome()}onDrag(e,t){const n=Ys(t,this.#Wa);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 Qe(l+r*s,c+o*s);i.setWindowLevel(u)}}class bl extends Al{constructor(){super({threshold:{x:15,y:15}})}canStart(e,t){return void 0!==Xs(t)||(o.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 xl extends Al{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 El extends Al{onDrag(e,t){const n=Xs(t);if(void 0===n)return void o.warn("No view layer to update pan drag behavior");const i=n.getViewController(),r=n.displayToPlaneScale(new g(e.delta.x,e.delta.y)),a=i.getOffset3DFromPlaneOffset({x:r.getX(),y:r.getY()});t.addTranslation({x:a.getX(),y:a.getY(),z:a.getZ()}),t.draw()}}class Rl{onDoubleClick(e,t){}}class Fl extends Rl{#$a;#Wa;constructor({dataController:e,activeViewLayerOnly:t=!0}){super(),this.#$a=e,this.#Wa=t}setActiveViewLayerOnly(e){this.#Wa=e}onDoubleClick(e,t){const n=Ys(t,this.#Wa);if(void 0===n)return;const i=n.displayToPlaneIndex(e),o=n.getViewController();if(!o.isMonochrome())return;const r=this.#$a.get(n.getDataId()).image,a=new Qe(r.getRescaledValueAtIndex(o.getCurrentIndex().getWithNew2D(i.get(0),i.get(1))),o.getWindowLevel().width);o.setWindowLevel(a)}}class Ml extends Rl{onDoubleClick(e,t){const n=Xs(t);void 0!==n?n.getViewController().play():o.warn("No view layer to play double click behavior")}}class ql{reset(){}onUpdate(e,t){}onEnd(){this.reset()}}class Ul extends ql{#ja=!1;#Za;constructor({tooltipEnabled:e=!1}={}){super(),this.#ja=e}setTooltipEnabled(e){this.#ja=e}reset(){void 0!==this.#Za&&(this.#Za.removeTooltipDiv(),this.#Za=void 0)}onUpdate(e,t){this.#ja&&this.#_a(e,t)}#_a(e,t){this.#Za=t,t.showTooltip(e)}}class Ql extends EventTarget{#zt=[];#Ka=1;setNumberOfTaps(e){this.#zt=[],this.#Ka=e}isActive(){return 0!==this.#zt.length}reset(){this.#zt=[]}getPointList(){return this.#zt.slice()}onUpdate(e,t){}onTap(e,t){this.#zt.push(e),this.#zt.length===this.#Ka&&this.onEnd()}onEnd(){this.#zt=[],this.reset()}}class Vl extends Ql{onTap(e,t){super.onTap(e,t);const n=Xs(t);if(void 0===n)return void o.warn("No view layer to set current position");const i=n.getViewController(),r=n.displayToPlanePos(e),a=i.getPositionFromPlanePoint(r);i.setCurrentPosition(a)}}class Nl{isActive(){return!1}reset(){}onStart(e){}onUpdate(e,t){return!1}onEnd(){this.reset()}}class Bl extends Nl{#Ja;#es;isActive(){return void 0!==this.#Ja}reset(){this.#Ja=void 0,this.#es=void 0}onStart(e){this.#Ja=new jo(e[0],e[1]),this.#es=this.#Ja.getCentroid()}onUpdate(e,t){if(void 0===this.#Ja)return!1;const n=new jo(e[0],e[1]).getLength()/this.#Ja.getLength(),i=t.getPositionHelper();if(1===n){const n=e[0].getY()-this.#Ja.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.#es){const n=Xs(t);if(void 0===n)return o.warn("No view layer to do touch zoom behavior"),!0;const i=n.getViewController(),r=n.displayToMainPlanePos(this.#es),a=i.getPlanePositionFromPlanePoint(r);t.addScale(e,a),t.draw()}}return!0}onEnd(){this.#Ja=void 0,this.reset()}}function kl(e,t){const n=t.getActiveDrawLayer();if(void 0===n)return o.warn("No draw layer to check point"),!1;const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return o.warn("No view layer to check point"),!1;const r=i.displayToPlanePos(e);return i.getViewController().validatePlanePoint(r)}class Gl{#rn;#ts;#ns;#is;#os;#rs;#as;#ss;#ls;#cs=!1;constructor(e){this.#rn=e,this.#ts=e.getStyle()}setOptions(e){this.#ns=e}setFeatures(e){if(void 0!==e.autoShapeColour&&(this.#cs=e.autoShapeColour),void 0!==e.shapeColour&&(this.#ts.setLineColour(e.shapeColour),this.#cs=!1),void 0!==e.refMetaValidator&&(this.#as=e.refMetaValidator),void 0!==e.annotationGroupMeta&&(this.#ss=e.annotationGroupMeta),void 0!==e.annotationMeta&&(this.#ls=e.annotationMeta),void 0!==e.shapeName){if(!this.hasShape(e.shapeName))throw new Error(`Unknown shape: '${e.shapeName}'`);this.#is=e.shapeName,void 0!==this.#ns&&(this.#os=new this.#ns[this.#is])}}hasShape(e){return void 0!==this.#ns?.[e]}tryBeginPlacement(e){let t=e.getActiveDrawLayer();return void 0===t&&this.#us(e)&&this.#ds(e)&&(t=this.#hs(e)),!(void 0===t||!this.#gs())}#gs(){return!(!this.#ns||!this.#is)||(o.warn("DrawPreview: missing factory list or shape name"),!1)}getNPoints(){let e=0;return void 0!==this.#os&&(e=this.#os.getNPoints()),e}resetPlacement(){if(this.#rs){const e=this.#rs.getLayer();this.#rs.destroy(),this.#rs=void 0,e.draw()}}#us(e){let t=!0;const n=this.#as;if(void 0!==n){const i=e.getActiveViewLayer().getDataId();t=n(this.#rn.getDataController().get(i).image.getMeta())}return t}#ds(e){const t=e.getBaseViewLayer().getDataId();return!this.#rn.getDataController().get(t).image.isResampled()}getCannotCreateReason(e){let t;return this.#us(e)||(t="reference data is invalid"),this.#ds(e)||(t="base data is invalid"),t}#hs(e){const t=e.getActiveViewLayer().getDataId(),n=this.#rn.createAnnotationData(t),i=this.#ss;if(void 0!==i)for(const e of i)n.annotationGroup.setMetaValue(e.concept,e.value);this.#rn.addAndRenderAnnotationData(n,e.getDivId(),t);const o=e.getActiveDrawLayer();e.setActiveLayerByDataId(o.getDataId());const r=o.getKonvaStage();return this.#ts.setZoomScale(r.scale()),o}#Ss(e){if(this.#cs){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.#ts.setLineColour(o)}}#ps(e,t){const n=t.getActiveDrawLayer(),i=n.getDrawController(),r=t.getViewLayerById(n.getReferenceLayerId());if(void 0===r)return void o.warn("No view layer to handle new points");const a=r.getViewController(),s=new $a,l=i.getAnnotationGroup().getColour();s.colour=void 0!==l?l:this.#ts.getLineColour(),s.init(a);const c=this.#ls;if(void 0!==c)for(const e of c)s.addMetaItem(e.concept,e.value);const u=e.map((e=>r.displayToPlanePos(e)));return this.#os.setAnnotationMathShape(s,u),s}onNewPoints(e,t){this.#rs&&(this.#rs.destroy(),this.#rs=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void o.warn("No draw layer to handle new points");const i=n.getKonvaLayer();this.#Ss(n);const r=this.#ps(e,t);void 0!==r&&(this.#rs=this.#os.createShapeGroup(r,this.#ts),n.setLabelVisibility(this.#rs),this.#rs.getChildren(ea)[0].listening(!1),i.listening(!1),i.add(this.#rs),i.draw())}onFinalPoints(e,t){this.#rs&&(this.#rs.destroy(),this.#rs=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void o.warn("No draw layer to handle final points");const i=n.getKonvaLayer(),r=n.getDrawController(),a=this.#ps(e,t);if(void 0===a)return;const s=new ul(a,r);this.#rn.getUndoController().addToUndoStack(s),s.execute(),i.listening(!0)}}class zl extends Ql{#ms;#fs;#vs;#Cs;constructor(e,t){super(),this.#vs=new Gl(e),this.#Cs=t}setOptions(e){this.#vs.setOptions(e)}setFeatures(e){this.#vs.setFeatures(e),this.#Cs.setFeatures(e)}hasShape(e){return this.#vs.hasShape(e)}#Ds(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Cs.checkCanEdit(n)?this.#Cs.trySelectShapeGroup(e,n):(this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:"Cannot edit draw, data meta is invalid"}})),!1))}#ys(){const e=this.#vs.getNPoints();void 0===e?super.setNumberOfTaps(65535):super.setNumberOfTaps(e)}resetPlacement(){this.#vs.resetPlacement(),super.onEnd()}#Is(e){const t=this.getPointList();return t.length>0&&t[t.length-1].equals(e)}onUpdate(e,t){if(!this.isActive())return;if(this.#Is(e))return;if(!kl(e,t))return;this.#ms=e,this.#fs=t;const n=this.getPointList();n.push(e),this.#vs.onNewPoints(n,t)}onTap(e,t){if(!this.isActive()){if(this.#Ds(e,t))return;if(!this.#vs.tryBeginPlacement(t)){const e=this.#vs.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#Cs.disableAndResetEditor(),this.#ys()}if(this.#Is(e))return;this.#fs=t,super.onTap(e,t);const n=this.getPointList();n.length>1&&this.#vs.onNewPoints(n,t)}onEnd(){const e=this.getPointList(),t=this.#fs,n=this.#vs.getNPoints();e.length>0&&t&&(void 0!==n?e.length===n?this.#vs.onFinalPoints(e,t):e.length!==n-1||void 0===this.#ms||this.#Is(this.#ms)?this.#vs.resetPlacement():(e.push(this.#ms),this.#vs.onFinalPoints(e,t)):e.length>2?this.#vs.onFinalPoints(e,t):this.#vs.resetPlacement()),this.#ms=void 0,this.#fs=void 0,super.onEnd()}}class Hl extends Al{#Cs;#ms;#fs;#vs;constructor(e,t){super(),this.#Cs=t,this.#vs=new Gl(e)}setOptions(e){this.#vs.setOptions(e)}setFeatures(e){this.#vs.setFeatures(e)}resetPlacement(){this.#vs.resetPlacement(),super.onEnd()}#ws(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.#vs.getNPoints()}onStart(e,t,n){if(!this.isActive()){const n=t.getActiveDrawLayer();if(void 0!==n&&this.#ws(e,n))return;if(!this.#vs.tryBeginPlacement(t)){const e=this.#vs.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#Cs.disableAndResetEditor()}this.#fs=t,super.onStart(e,t,n)}onDrag(e,t){if(!this.isActive())return;if(!kl(this.prevPoint,t))return;this.#ms=this.prevPoint,this.#fs=t;const n=[this.startPoint,this.#ms];this.#vs.onNewPoints(n,t)}onEnd(){const e=this.#fs;if(e&&void 0!==this.#ms){const t=[this.startPoint,this.#ms];this.#vs.onFinalPoints(t,e)}this.#ms=void 0,this.#fs=void 0,super.onEnd()}}class Yl{#rn;#zr;#ct=[];#Ts;#Ls;constructor(e,t){this.#rn=e,this.#zr=t}setFeatures(e){void 0!==e.drawMetaValidator&&(this.#Ls=e.drawMetaValidator)}disableAndResetEditor(){this.#zr.disableAndResetEditor()}checkCanEdit(e){return this.#Ps(e)}#Ps(e){let t=!0;const n=this.#Ls;if(void 0!==n){const i=e.getDataId();t=n(this.#rn.getDataController().get(i).annotationGroup.getMeta())}return t}#ws(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}#As(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.#zr.setEditorShape(o,n),!0)}trySelectShapeGroup(e,t){const n=this.#ws(e,t);return void 0!==n&&this.#As(n,t)}#Os(e){const t=e.getId();return void 0===this.#ct[t]&&(this.#ct[t]=()=>{e.activateCurrentPositionShapes(!0)}),this.#ct[t]}#bs(){return e=>{const t=e.detail?.layerid,n=this.#rn.getStageController().getDrawLayers((function(e){return e.getId()===t}));1===n.length&&this.#xs(n[0],!0)}}#Es(){void 0===this.#Ts&&(this.#Ts=this.#bs(),this.#rn.addEventListener("drawlayeradd",this.#Ts))}#Rs(){void 0!==this.#Ts&&(this.#rn.removeEventListener("drawlayeradd",this.#Ts),this.#Ts=void 0)}#xs(e,t){e.setShapeHandler(this.#zr),e.activateCurrentPositionShapes(t),t?this.#rn.addEventListener("positionchange",this.#Os(e)):this.#rn.removeEventListener("positionchange",this.#Os(e))}activate(e){e||this.#zr.onMouseOutShapeGroup();const t=this.#rn.getStageController().getDrawLayers();for(const n of t)void 0!==n&&this.#xs(n,e);e?this.#Es():this.#Rs()}}class Xl{#rn;#Fs;constructor(e,t){this.#rn=e,this.#Fs=t}#os;#Ms;#qs;#qr;#Us=!1;setShape(e,t,n){if(this.#Ms=e,this.#qs=t,this.#qr=n,void 0!==this.#Ms){if(this.#Qs(),this.#os=n.getFactory(),void 0===this.#os)throw new Error("Could not find a factory to update shape.");this.#Vs()}}getShape(){return this.#Ms}getAnnotation(){return this.#qr}isActive(){return this.#Us}enable(){this.#Us=!0,void 0!==this.#Ms&&(this.#Ns(!0),this.#Ms.getLayer()&&this.#Ms.getLayer().draw())}disable(){this.#Us=!1,void 0!==this.#Ms&&(this.#Ns(!1),this.#Ms.getLayer()&&this.#Ms.getLayer().draw())}reset(){this.#Ms=void 0,this.#qs=void 0,this.#qr=void 0}resetAnchors(){this.#Qs(),this.#Vs(),this.#Ns(!0)}#Bs(e){void 0!==this.#Ms&&this.#Ms.getParent()&&this.#Ms.getParent().find(".anchor").forEach(e)}#Ns(e){this.#Bs((function(t){t.visible(e)}))}setAnchorsActive(e){let t;t=e?e=>{this.#ks(e)}:e=>{this.#Gs(e)},this.#Bs(t)}#Qs(){this.#Bs((function(e){e.remove()}))}#Vs(){if(void 0===this.#Ms||!this.#Ms.getLayer())return;if(void 0===this.#os)return;const e=this.#Ms.getParent(),t=this.#os.getAnchors(this.#qr,this.#rn.getStyle());for(let n=0;n<t.length;++n)this.#ks(t[n]),e.add(t[n])}#ks(t){let n;t.on("dragstart.edit",(e=>{e.cancelBubble=!0,n={mathShape:this.#qr.mathShape,referencePoints:this.#qr.referencePoints}})),t.on("dragmove.edit",(t=>{const n=t.target;n instanceof e.Shape&&void 0!==this.#os&&(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 g(-n.x(),-n.y()),new g(e.x-n.x(),e.y-n.y()))}(this.#qs.getBaseSize(),n),void 0!==this.#os.constrainAnchorMove&&this.#os.constrainAnchorMove(n,this.#qr),this.#os.updateAnnotationOnAnchorMove(this.#qr,n),this.#os.updateShapeGroupOnAnchorMove(this.#qr,n,this.#rn.getStyle()),n.getLayer()?n.getLayer().draw():o.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.#os?.onAnchorMoveEnd(i,this.#qr);const o={mathShape:this.#qr.mathShape,referencePoints:this.#qr.referencePoints},r=new hl(this.#qr,n,o,this.#qs.getDrawController());this.#rn.getUndoController().addToUndoStack(r),this.#Fs({type:"annotationupdate",data:this.#qr,dataid:this.#qs.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():o.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():o.warn("No layer to draw the anchor!"))}))}#Gs(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 Wl{#zs;constructor(){this.createTrashIcon()}createTrashIcon(){this.#zs=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.#zs.width(20),this.#zs.height(20),this.#zs.add(t),this.#zs.add(n)}activate(e){const t=e.getKonvaStage(),n=t.scale(),i=e.getKonvaLayer(),o={x:1/n.x,y:1/n.y};this.#zs.x(t.offset().x+t.width()/(2*n.x)),this.#zs.y(t.offset().y+t.height()/(15*n.y)),this.#zs.scale(o),i.add(this.#zs),i.draw()}changeChildrenColourOnTrashHover(e,t,n){if(this.isOverTrash(e))return this.changeGroupChildrenColour(this.#zs,"orange"),void this.changeGroupChildrenColour(t,"red");this.changeGroupChildrenColour(this.#zs,"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.#zs.remove()}isOverTrash(e){const t=this.#zs.width()*Math.abs(this.#zs.scaleX())/2,n=this.#zs.height()*Math.abs(this.#zs.scaleY())/2;return Math.abs(e.x-this.#zs.x())<t&&Math.abs(e.y-this.#zs.y())<n}}class $l extends EventTarget{#rn;#Hs;#zs;#Ys="pointer";#Xs;#Ws;#Fs=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))};constructor(e){super(),this.#rn=e,this.#Hs=new Xl(e,this.#Fs),this.#zs=new Wl}setEditorShape(t,n){const i=n.getDrawController();if(t&&t instanceof e.Shape&&t!==this.#Hs.getShape()&&i.isAnnotationGroupEditable()){this.#Hs.disable();const e=t.getParent().id();this.#Hs.setShape(t,n,i.getAnnotation(e)),this.#Fs({type:"annotationselect",annotationid:e,dataid:n.getDataId()}),this.#Hs.enable()}}getEditorShapeGroup(){let t;if(!this.#Hs.isActive()||(t=this.#Hs.getShape().getParent(),t instanceof e.Group))return t}getEditorAnnotation(){let e;return this.#Hs.isActive()&&(e=this.#Hs.getAnnotation()),e}disableAndResetEditor(){this.#Hs.disable(),this.#Hs.reset()}#$s(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.#Ys=e}#js(){this.#Xs=document.body.style.cursor,document.body.style.cursor=this.#Ys,this.#Ws.opacity(.75)}onMouseOutShapeGroup(){void 0!==this.#Xs&&(document.body.style.cursor=this.#Xs,this.#Xs=void 0),void 0!==this.#Ws&&this.#Ws.opacity(1)}#Zs(e){e.on("mouseover",(()=>{this.#Ws=e,this.#js()})),e.on("mouseout",(()=>{this.onMouseOutShapeGroup(),this.#Ws=void 0}))}#_s(e){e.off("mouseover"),e.off("mouseout")}addShapeGroupListeners(e,t,n){this.#Zs(e),this.#Ks(e,t,n),this.#Js(e,t,n),e.on("dblclick",(()=>{const e=t.textExpr,i=t=>{const i=t.textExpr,o=new hl(t,{textExpr:e},{textExpr:i},n.getDrawController());this.#rn.getUndoController().addToUndoStack(o),o.execute()};void 0!==Xe.openRoiDialog?Xe.openRoiDialog(t,i):function(e,t){const n=prompt("Label",e.textExpr);null!==n&&(e.textExpr=n,t(e))}(t,i)}))}#Ks(t,n,i){const o=i.getKonvaLayer(),r=t.getChildren(ea)[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.#zs.activate(i),this.#Hs.setAnchorsActive(!1),o.draw()})),r.on("dragmove.draw",(e=>{const a=function(e,t){return{min:new g(0,0),max:new g(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.#rn.getStyle()),h.updateConnector(n,t);const S=fo(e.evt),p={x:S.getX(),y:S.getY()},m=this.#$s(p,i);this.#zs.changeChildrenColourOnTrashHover(m,t,c),o.draw()})),r.on("dragend.draw",(e=>{const s=this.#rn.getUndoController();if(this.#zs.remove(),void 0===e||void 0===e.evt)return;const u=r.x(),d=r.y(),h=fo(e.evt),g={x:h.getX(),y:h.getY()},S=this.#$s(g,i);if(this.#zs.isOverTrash(S)){t.x(a.x),t.y(a.y),this.#Hs.disable(),this.#Hs.reset(),this.#zs.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 hl(n,l,e,i.getDrawController());s.addToUndoStack(t),this.#Fs({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:Object.keys(e)}),l={mathShape:e.mathShape,referencePoints:e.referencePoints}}this.#Hs.setAnchorsActive(!0),this.#Hs.resetAnchors()}o.draw(),a={x:r.x(),y:r.y()}}))}#Js(t,n,i){const o=t.getChildren(Jr)[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.#rn.getUndoController(),t=o.x()-r.x,s=o.y()-r.y;if(0!==t||0!==s){const t=new g(o.x(),o.y());n.labelPosition=t;const r=new hl(n,{labelPosition:a},{labelPosition:t},i.getDrawController());e.addToUndoStack(r),this.#Fs({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(ea)[0];n instanceof e.Shape&&(n.draggable(!1),n.off("dragstart.draw"),n.off("dragmove.draw"),n.off("dragend.draw"));const i=t.getChildren(Jr)[0];i instanceof e.Label&&(i.draggable(!1),i.off("dragstart.draw"),i.off("dragend.draw"))}}class jl{mask;dataId;offsetsLists;mode;segmentNumber;srclayerid;originalValuesLists;isSilent}class Zl extends La{#el;#tt;#tl;#nl;#il;#ol;#rl;#al;#sl;#ll;constructor(e){super(),this.#el=e.mask,this.#tt=e.dataId,this.#tl=e.offsetsLists,this.#nl=e.mode,this.#il=e.segmentNumber,this.#ol=e.srclayerid,void 0!==e.originalValuesLists&&(this.#rl=e.originalValuesLists),this.#al=e.isSilent??!1,this.#sl="del"===this.#nl?"brushremove":"brushdraw",this.#ll="brushdraw"===this.#sl?"brushremove":"brushdraw"}getOriginalValuesLists(){return this.#rl}getExecuteEvent(){const e="brushdraw"===this.#sl?this.#il:void 0;return new CustomEvent(this.#sl,{detail:{segmentnumber:e,dataid:this.#tt,srclayerid:this.#ol}})}getName(){return"Draw-brush"}execute(){if(void 0===this.#il)return;let e=this.#il;"brushremove"===this.#sl&&(e=0),void 0===this.#rl?this.#rl=this.#el.setAtOffsetsAndGetOriginals(this.#tl,e):this.#el.setAtOffsetsWithIterator(this.#tl,e),this.#al||this.onExecute(this.getExecuteEvent())}undo(){void 0===this.#rl?this.#rl=this.#el.setAtOffsetsAndGetOriginals(this.#tl,0):this.#el.setAtOffsetsWithIterator(this.#tl,this.#rl);const e="brushdraw"===this.#ll?this.#il:void 0,t=new CustomEvent(this.#ll,{detail:{segmentnumber:e,dataid:this.#tt,srclayerid:this.#ol}});this.onUndo(t)}onExecute(e){}onUndo(e){}}const _l="No source image to create mask",Kl="No source image to get offsets, ID: {0}",Jl="No brush origins",ec="No mask defined when adding mask slices",tc="No created mask image",nc="No mask image for temporary draw command, ID: {0}",ic="No mask image to get offsets from",oc="No mask image for draw command, ID: {0}",rc="No mask ID to apply mask index",ac="No mask view layers",sc="No selected segment number",lc="Too many mask view layers: {0}",cc="More mask layers than expected",uc="Cannot display mask with no mask ID",dc="Cannot draw with no mask data ID",hc="Cannot draw with no offsets",gc="Cannot draw with no colour list",Sc="Cannot get mask layers with no mask ID",pc="Cannot get mask view controller: no mask ID",mc="Cannot get mask view controller: no mask layers",fc="Cannot find source data for an existing mask, ID: {0}",vc="Unsupported scroll index: {0}";function Cc(e,...t){return e.replace(/{(\d+)}/g,((e,n)=>t[n]||""))}const Dc="del";function yc(e,t,n,i){return rr(e.worldToIndex(t),n,i)}class Ic extends EventTarget{#rn;#cl=10;#ul={min:1,max:20};#dl="del";#hl;#el;#gl;#Za;#Sl=0;#pl;#ml;constructor(e){super(),this.#rn=e.app}#fl(e){const t=this.#ul.min,n=this.#ul.max;return Math.min(Math.max(e,t),n-1)}getBrushSize(){return this.#cl}getBrushMode(){return this.#dl}getSelectedSegmentNumber(){return this.#hl}setBrushMode(e){this.setFeatures({brushMode:e})}setFeatures(e){if(void 0!==e.brushSizeRange&&(this.#ul=e.brushSizeRange,this.#cl=this.#fl(this.#cl)),void 0!==e.brushSize&&(this.#cl=this.#fl(e.brushSize)),void 0!==e.brushSizeAdd){const t=this.#fl(this.#cl+e.brushSizeAdd);if(t!==this.#cl){this.#cl=t;const e=new CustomEvent("brushsizechange",{detail:{value:this.#cl}});this.dispatchEvent(e)}}void 0!==e.brushMode&&(this.#dl=e.brushMode),void 0!==e.selectedSegmentNumber&&(this.#hl=e.selectedSegmentNumber),e.createMask?this.#gl=void 0:void 0!==e.maskDataId&&(this.#gl=e.maskDataId)}#vl(e,t,n){const i=e.getSize().getValues();i[2]=1;const o=new pt(i),r=new yt([t],o,e.getSpacing(),e.getOrientation()),a=new Uint8Array(o.getDimSize(2));a.fill(0),++this.#Sl;const s=[this.#Sl.toString()],l=new Ki(r,a,s);return l.setMeta(n),l.setPhotometricInterpretation("PALETTE COLOR"),l.setPaletteColourMap(new He([0],[0],[0])),l}#Cl(e,t,n,r,a,s){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 r=n[0].get(2);if(void 0===r)return[];const a=new i([0,0,r]),s=e.indexToWorld(a),l=n.at(-1).get(2);if(void 0===l)return[];const c=new i([0,0,l]),u=e.indexToWorld(c),d=e.getOrigins(),h=.1*e.getSpacing().get(2),g=s.get3D().getClosest(d),S=d[g],p=s.get3D().getDistance(S);p>h&&o.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&&o.warn(`Large distance between origin and origin for last index: ${v}`),[g,m]}(e,yc(e,n,a,r));if(void 0===l||0===l.length)throw new Error(Jl);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.#el)throw new Error(ec);const p=this.#el.getMeta();for(const e of S)p.numberOfFiles+=1,this.#el.appendSlice(this.#vl(t,e,s))}#Dl(e,t){if(!t)throw new Error(Cc(_l));const n=t.getGeometry(),o=n.worldToIndex(e).get(2);if(void 0===o)throw new Error("Z position is undefined");const r=new i([0,0,o]),a=n.getOrigins()[o],s=Vi(),l=function(){const e="1.2.826.0.1.3680043.9.7278.1681051091011101.1";return{indices:{value:[{DimensionOrganizationUID:e,DimensionDescriptionLabel:"ReferencedSegmentNumber",DimensionIndexPointer:"(0062,000B)",FunctionalGroupPointer:"(0062,000A)"},{DimensionOrganizationUID:e,DimensionDescriptionLabel:"ImagePositionPatient",DimensionIndexPointer:"(0020,0032)",FunctionalGroupPointer:"(0020,9113)"}]},organizations:{value:[{DimensionOrganizationUID:e}]}}}();s.DimensionOrganizationSequence=l.organizations,s.DimensionIndexSequence=l.indices,s.PixelRepresentation=0,s.numberOfFiles=1;const c=t.getMeta();s.PatientID=c.PatientID,s.StudyInstanceUID=c.StudyInstanceUID,s.SeriesInstanceUID=c.SeriesInstanceUID;const u=[{referencedSOPClassUID:c.SOPClassUID,referencedSOPInstanceUID:t.getImageUid(r)}],d=[];d.push({ReferencedInstanceSequence:{value:u},SeriesInstanceUID:c.SeriesInstanceUID}),s.ReferencedSeriesSequence={value:d},s.custom={referencedSeriesUID:c.SeriesInstanceUID,frameInfos:[{dimIndex:[1,1],refSegmentNumber:1,imagePosPat:a.getValues(),derivationImages:[{sourceImages:u}]}]},s.lengthUnit=t.getMeta().lengthUnit,this.#el=this.#vl(n,a,s),this.#el.setupSegmentCollection();const h=ci(s),g=new fs(h);g.image=this.#el;const S=this.#rn.getDataController(),p=S.getNextDataId();if(!S.add(p,g))throw new Error("Cannot add mask data");return p}#yl(e){const t=this.#rn.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}#Il(e){if(void 0===this.#gl)throw new Error(uc);const t=new Vc(e);t.orientation=this.#yl(e);const n=this.#rn.getStageController();n.addDataViewConfig(this.#gl,t),n.render(this.#gl)}#wl(e){const t=e.getMaskReferencedSeriesUID();let n;return"undefined"!==t&&(n=this.#rn.getDataController().getDataIdFromSeriesUid(t)),void 0===n&&o.warn(Cc(fc,t)),n}#Tl(e){if(void 0===this.#gl)throw new Error(Sc);const t=e.getViewLayersByDataId(this.#gl);if(0===t.length)throw new Error(ac);return 1!==t.length&&o.warn(Cc(lc,t.length)),t[0]}#Ll(e){if(void 0===e)throw new Error(rc);const t=this.#rn.getDataController().get(e);if(void 0===t)throw new Error(ic);return t.image}#Pl(e,t){if(void 0===t)throw new Error("No layergroup to get mask offsets");let n;if(this.#Za=t,n=void 0===this.#gl?t.getBaseViewLayer():t.getViewLayersByDataId(this.#gl)[0],void 0===n)return[];const i=n.getViewController(),r=i.getCurrentPosition();let a,s,l,c;if(i.equalImageMeta({Modality:"SEG"})||i.equalImageMeta({Modality:"RTSTRUCT"})){this.#el=this.#Ll(this.#gl);const t=this.#wl(this.#el),r=this.#rn.getDataController().get(t);if(!r)throw new Error(Cc(Kl,t));if(c=r.image,c.isResampled())return o.warn("Cannot update mask with resampled reference image."),[];const u=this.#rn.getStageController().getViewLayersByDataId(t)[0],d=u.getViewController(),h=u.displayToPlanePos(e);l=d.getPositionFromPlanePoint(h),a=n,s=i}else{const u=n.getDataId(),d=this.#rn.getDataController().get(u);if(!d)throw new Error(Cc(Kl,u));if(c=d.image,c.isResampled())return o.warn("Cannot create mask on resampled image."),[];const h=n.displayToPlanePos(e);if(l=i.getPositionFromPlanePoint(h),this.#gl=this.#Dl(r,c),void 0===this.#el)throw new Error(tc);const g=t.getDivId(),S=void 0!==g;S&&this.#Il(g),a=this.#Tl(t),s=a.getViewController(),S&&s.setCurrentPosition(r)}const u=c.getGeometry(),d=this.#el.getMeta(),h=this.#el.getGeometry(),g=i.get2DSpacing(),S=[Math.round(this.#cl/g.x),Math.round(this.#cl/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(Cc(vc,m))}this.#Cl(u,h,l,p,S,d);const f=a.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,yc(h,s.getPositionFromPlanePoint(f),S,p))}#Al(e){const t=this.#Ol().getId();if(void 0===this.#gl)throw new Error(rc);const n=this.#rn.getDataController().get(this.#gl);if(!n)throw new Error(Cc(nc,this.#gl));const i=new jl;i.mask=n.image,i.dataId=this.#gl,i.offsetsLists=[e],i.mode=this.#dl,i.segmentNumber=this.#hl,i.srclayerid=t;const o=new Zl(i);o.execute();const r=o.getOriginalValuesLists();if(void 0!==r)return r[0]}beginStroke(e,t){this.#pl=[],this.#ml=[];const n=this.#Pl(e,t);if(n.length>0){this.#pl.push(n);const e=this.#Al(n);return void 0!==e&&this.#ml.push(e),!0}return!1}paintStep(e,t){const n=this.#Pl(e,t);if(n.length>0){this.#pl.push(n);const e=this.#Al(n);void 0!==e&&this.#ml.push(e)}}finalizeStroke(){if(void 0===this.#gl)throw new Error(dc);if(void 0===this.#pl)throw new Error(hc);if(void 0===this.#ml)throw new Error(gc);this.#pl.reverse(),this.#ml.reverse();const e=this.#Ol().getId(),t=this.#rn.getDataController().get(this.#gl);if(!t)throw new Error(Cc(oc,this.#gl));const n=new jl;n.mask=t.image,n.dataId=this.#gl,n.offsetsLists=this.#pl,n.mode=this.#dl,n.segmentNumber=this.#hl,n.srclayerid=e,n.originalValuesLists=this.#ml;const i=new Zl(n);i.onExecute=e=>{this.dispatchEvent(e)},i.onUndo=e=>{this.dispatchEvent(e),this.#el.recalculateLabels()},this.#rn.getUndoController().addToUndoStack(i),this.dispatchEvent(i.getExecuteEvent()),this.#el.recalculateLabels()}#Ol(){if(void 0===this.#gl)throw new Error(pc);if(void 0===this.#Za)throw new Error("No current layer group");const e=this.#Za.getViewLayersByDataId(this.#gl);if(0===e.length)throw new Error(mc);return 1!==e.length&&o.warn(cc),e[0]}}const wc=["brushsizechange","brushdraw","brushremove"];class Tc extends Al{#rn;#bl;#xl=!1;#El=[];constructor(e){super(),this.#rn=e,this.#bl=new Ic({app:e});for(const e of wc)this.#bl.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}))}setFeatures(e){void 0!==e.blacklist&&(this.#El=e.blacklist),this.#bl.setFeatures(e)}canStart(e,t){return!(!this.#Rl(t)||this.#Fl(t)||(this.#re(t)?(o.warn("Cannot paint on series with overlapping slices"),1):void 0===this.#bl.getSelectedSegmentNumber()&&(o.warn(sc),1)))}onStart(e,t,n){super.onStart(e,t,n);const i=this.#bl.getBrushSize()/2;this.setDragThreshold({x:i,y:i}),this.#xl=!1,2===n?.mouseDownButton&&this.#Ml(),this.#bl.beginStroke(e,t)||(this.#ql(),super.onEnd())}onDrag(e,t){const n=this.prevPoint;void 0!==n&&this.#bl.paintStep(n,t)}onEnd(){this.isActive()&&(this.#bl.finalizeStroke(),this.#ql()),super.onEnd()}reset(){this.isActive()&&(this.#bl.finalizeStroke(),this.#ql()),super.reset()}#Rl(e){if(void 0===e)throw new Error("No layergroup to check for view layer");return e.getActiveLayer()instanceof cl}#Fl(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.#rn.getDataController().get(t).image.getMeta().SeriesInstanceUID;if(this.#El.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.#rn.getDataController().get(n).image.getHasOverlap()}#Ml(){this.#xl=!0,this.#bl.setBrushMode(Dc),this.dispatchEvent(new CustomEvent("erasingactivated"))}#ql(){this.#xl&&this.#bl.getBrushMode()===Dc&&(this.#bl.setBrushMode("add"),this.dispatchEvent(new CustomEvent("erasingdeactivated"))),this.#xl=!1}}class Lc extends Al{#rn;#qr;#Ul;#Ql;#Vl=[];#Nl;#Bl=10;#kl=5;#Gl=0;#zl=2e3;#Hl=[];#ts;#Cs;constructor(e,t,n){super(),this.#rn=e,this.#ts=t,this.#Cs=n}setFeatures(e){this.#Cs.setFeatures(e)}#Yl(e){const t=e.getActiveDrawLayer();if(void 0!==t)return e.getViewLayerById(t.getReferenceLayerId());o.warn("No draw layer to do floodfill")}#Xl=(e,t)=>{const n=this.#Yl(t);if(void 0===n)return void o.warn("No view layer to get index");const i=n.displayToPlaneIndex(e);return{x:i.get(0),y:i.get(1)}};#Wl(e,t,i){this.#Hl=[];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.#kl);let s=n.traceContours(a);if(s=n.simplifyContours(s,this.#Gl,this.#zl),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.#Hl.push(new g(s[0].points[e].x,s[0].points[e].y));return this.#Hl}return[]}#$l(e,t,n){if(this.#Vl=this.#Wl(e,t,!1),0!==this.#Vl.length){const e=n.getActiveDrawLayer();if(void 0===e)return o.warn("No draw layer to paint border"),!1;const t=e.getDrawController(),i=new nr(this.#Vl);let r;if(void 0===this.#qr){this.#qr=new $a,this.#qr.colour=this.#ts.getLineColour();const a=n.getViewLayerById(e.getReferenceLayerId());if(void 0===a)return o.warn("No view layer to paint border"),!1;const s=a.getViewController();this.#qr.init(s),this.#qr.mathShape=i,r=new ul(this.#qr,t)}else{const e=this.#qr.mathShape;r=new hl(this.#qr,{mathShape:e},{mathShape:i},t)}this.#rn.getUndoController().addToUndoStack(r),r.execute()}return 0!==this.#Vl.length}#jl(e){const t=e.getBaseViewLayer().getDataId();return this.#rn.getDataController().get(t).image.isResampled()}#Ds(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Cs.checkCanEdit(n)?this.#Cs.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.#jl(t))return;if(!this.isActive()&&this.#Ds(e,t))return;let i;this.#qr=void 0;let r=t.getActiveDrawLayer();if(void 0===r){i=t.getActiveViewLayer();const e=i.getDataId(),n=this.#rn.createAnnotationData(e),o=t.getDivId().replace("-layer-0","");this.#rn.addAndRenderAnnotationData(n,o,e),r=t.getActiveDrawLayer(),r.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(r.getDataId())}else if(i=t.getViewLayerById(r.getReferenceLayerId()),void 0===i)return void o.warn("No view layer to start floodfill");this.#Ql=i.getImageData(),void 0!==this.#Ql?(this.#ts.setZoomScale(r.getKonvaLayer().getAbsoluteScale()),this.#Ul=this.#Xl(e,t),this.#$l(this.#Ul,this.#Bl,t),super.onStart(e,t,n)):o.error("No image info found")}onUpdate(e,t){if(!this.isActive())return;const n=this.#Xl(e,t);this.#Nl=Math.round(Math.sqrt(Math.pow(this.#Ul.x-n.x,2)+Math.pow(this.#Ul.y-n.y,2))/2),this.#Nl=this.#Nl<this.#Bl?this.#Bl:this.#Nl-this.#Bl,this.#$l(this.#Ul,this.#Nl,t),super.onUpdate(e,t)}}class Pc{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 Ac{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 Oc=2/(3*Math.PI);function bc(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 xc{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++){bc(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};bc(e,t,n,i,a),bc(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),Oc*(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}#Zl=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 Ac(this.searchGranBits,this.#Zl),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 Ec extends Ql{#rn;#ts;#Ha;#qr;#_l=new Pc;#Kl=new Pc;#Hl=[];#Jl=5;#ec=new xc;#Cs;constructor(e,t,n){super(),this.#rn=e,this.#ts=t,this.#Cs=n,super.setNumberOfTaps(500)}setFeatures(e){this.#Cs.setFeatures(e)}#tc(e){const t=e.get(1);for(let e=0;e<t;++e)this.#Hl[e]=[]}#nc(){this.#_l=new Pc,this.#Kl=new Pc}#jl(e){const t=e.getBaseViewLayer().getDataId();return this.#rn.getDataController().get(t).image.isResampled()}#Ds(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#Cs.checkCanEdit(n)?this.#Cs.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.#jl(t))return;if(!this.isActive()&&this.#Ds(e,t))return;let n,i=t.getActiveDrawLayer();n=void 0===i?t.getActiveViewLayer():t.getViewLayerById(i.getReferenceLayerId());const o=n.getViewController().getImageSize();this.#ec.setDimensions(o.get(0),o.get(1)),this.#ec.setData(n.getImageData().data);const r=n.displayToPlaneIndex(e);if(this.isActive()){const e=Math.abs(r.get(0)-this.#Ha.getX()),t=Math.abs(r.get(1)-this.#Ha.getY());if(e<this.#Jl&&t<this.#Jl)this.onEnd();else{this.#_l=this.#Kl,this.#tc(o);const e={x:r.get(0),y:r.get(1)};this.#ec.doTraining(e),this.#_l.addControlPoint(this.#Kl.getPoint(0))}}else{if(this.#qr=void 0,this.#Ha=new g(r.get(0),r.get(1)),this.#nc(),this.#tc(o),void 0===i){const e=n.getDataId(),o=this.#rn.createAnnotationData(e);this.#rn.addAndRenderAnnotationData(o,t.getDivId(),e),i=t.getActiveDrawLayer(),i.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(i.getDataId())}this.#ts.setZoomScale(i.getKonvaLayer().getAbsoluteScale());const e={x:r.get(0),y:r.get(1)};this.#ec.doTraining(e);const a=new g(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 o.warn("No draw layer to update livewire");const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return void o.warn("No view layer to update livewire");const r=i.displayToPlaneIndex(e);let a,s={x:r.get(0),y:r.get(1)};this.#ec.setPoint(s);let l=!1;for(;!this.#Hl[s.y][s.x]&&!l;)if(a=this.#ec.doWork(),0===a.length)l=!0;else for(let e=0;e<a.length-1;e+=2){const t=a[e],n=a[e+1];this.#Hl[t.y][t.x]=n}for(this.#Kl=new Pc,l=!1;s&&!l;)this.#Kl.addPoint(new g(s.x,s.y)),this.#Hl[s.y]&&this.#Hl[s.y][s.x]?s=this.#Hl[s.y][s.x]:l=!0;this.#Kl.appenPath(this.#_l);const c=n.getDrawController(),u=new nr(this.#Kl.pointArray);let d;if(void 0===this.#qr){this.#qr=new $a,this.#qr.colour=this.#ts.getLineColour();const e=i.getViewController();this.#qr.init(e),this.#qr.mathShape=u,d=new ul(this.#qr,c)}else{const e=this.#qr.mathShape;d=new hl(this.#qr,{mathShape:e},{mathShape:u},c)}this.#rn.getUndoController().addToUndoStack(d),d.execute(),super.onUpdate(e,t)}reset(){this.#qr=void 0,this.#nc(),this.#Hl=[],super.reset()}}const Rc={},Fc={WindowLevel:class extends Tl{#rn;#Pa;#xa;constructor(e){const t=new Ol,n=new Fl({dataController:e.getDataController()});super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new $s,doubleClickBehavior:n}),this.#rn=e,this.#Pa=t,this.#xa=n}keydown=e=>{e.context="WindowLevel",this.#rn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){void 0!==e.strictViewLayer&&(o.warn("strictViewLayer is deprecated, use activeViewLayerOnly instead"),this.#Pa.setActiveViewLayerOnly(e.strictViewLayer),this.#xa.setActiveViewLayerOnly(e.strictViewLayer)),void 0!==e.activeViewLayerOnly&&(this.#Pa.setActiveViewLayerOnly(e.activeViewLayerOnly),this.#xa.setActiveViewLayerOnly(e.activeViewLayerOnly))}},Scroll:class extends Tl{#rn;#ic;constructor(e){const t=new Ul;super({stageController:e.getStageController(),dragBehavior:new bl,hoverBehavior:t,wheelBehavior:new $s,doubleClickBehavior:new Ml,tapBehavior:new Vl}),this.#rn=e,this.#ic=t}keydown=e=>{e.context="Scroll",this.#rn.onKeydown(e)};activate(e){e||this.cancel()}setFeatures(e){void 0!==e.displayTooltip&&this.#ic.setTooltipEnabled(Boolean(e.displayTooltip))}init(){}},ZoomAndPan:class extends Tl{#rn;constructor(e){super({stageController:e.getStageController(),dragBehavior:new El,wheelBehavior:new js,twoTouchBehavior:new Bl,tapBehavior:new Vl}),this.#rn=e}keydown=e=>{e.context="ZoomAndPan",this.#rn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Opacity:class extends Tl{#rn;constructor(e){super({stageController:e.getStageController(),dragBehavior:new xl,wheelBehavior:new $s}),this.#rn=e}keydown=e=>{e.context="Opacity",this.#rn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Draw:class extends Tl{#rn;#Cs;#oc;#rc;#zr;constructor(e){const t=new $l(e),n=new Yl(e,t),i=new zl(e,n),o=new Hl(e,n);super({stageController:e.getStageController(),dragBehavior:o,tapBehavior:i,wheelBehavior:new $s}),this.#rn=e,this.#Cs=n,this.#oc=o,this.#rc=i,this.#zr=t;for(const e of this.getEventNames())this.#oc.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})),this.#rc.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})),this.#zr.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}))}keydown=e=>{this.#rc.isActive()||(e.context="Draw",this.#rn.onKeydown(e));const t=this.#zr.getEditorAnnotation();if(("Delete"===e.key||"Backspace"===e.key)&&void 0!==t){const e=this.#rn.getStageController().getActiveLayerGroup().getActiveDrawLayer();if(void 0===e)return void o.warn("No draw layer to handle key down");const n=e.getDrawController(),i=this.#rn.getUndoController(),r=new dl(t,n);i.addToUndoStack(r),r.execute(),this.#zr.onMouseOutShapeGroup()}"Escape"===e.key&&(this.#oc.resetPlacement(),this.#rc.resetPlacement(),this.#Cs.disableAndResetEditor())};activate(e){e||this.cancel(),this.#Cs.activate(e)}setOptions(e){this.#oc.setOptions(e),this.#rc.setOptions(e)}getOptionsType(){return"factory"}setFeatures(e){void 0!==e.mouseOverCursor&&this.#zr.storeMouseOverCursor(e.mouseOverCursor),this.#oc.setFeatures(e),this.#rc.setFeatures(e)}init(){}getEventNames(){return["annotationupdate","annotationselect","warn"]}hasShape(e){return this.#rc.hasShape(e)}},Brush:class extends Tl{#ac;#rn;constructor(e){const t=new Tc(e);super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new $s,longTouchToDblClickMs:null}),this.#ac=t,this.#rn=e;for(const e of this.getEventNames())this.#ac.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}))}keydown=e=>{e.context="Brush",this.#rn.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.#ac.setFeatures({brushMode:Dc}):this.#ac.setFeatures({brushMode:"add"})):this.#ac.setFeatures({brushSizeAdd:-1}):this.#ac.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.#rn.getStageController().getDataViewConfigs());e?this.#sc(t):(this.cancel(),this.#lc(t))}#sc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",(e=>{e.preventDefault(),e.stopPropagation()}))}}#lc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",(e=>{}))}}setFeatures(e){this.#ac.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:Oa,Floodfill:class extends Tl{#rn;#Cs;#Pa;#ts=new to;constructor(e){const t=new to,n=new $l(e),i=new Yl(e,n),o=new Lc(e,t,i);super({stageController:e.getStageController(),dragBehavior:o,wheelBehavior:new $s}),this.#rn=e,this.#Cs=i,this.#Pa=o,this.#ts=t}keydown=e=>{e.context="Floodfill",this.#rn.onKeydown(e),"Escape"===e.key&&this.#Cs.disableAndResetEditor()};activate(e){if(e){const e=this.#rn.getStageController().getActiveLayerGroup();this.#ts.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#ts.getLineColour()})}else this.cancel();this.#Cs.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#ts.setLineColour(e.shapeColour),this.#Pa.setFeatures(e)}},Livewire:class extends Tl{#rn;#Cs;#Ra;#ts;constructor(e){const t=new to,n=new $l(e),i=new Yl(e,n),o=new Ec(e,t,i);super({stageController:e.getStageController(),tapBehavior:o,wheelBehavior:new $s}),this.#rn=e,this.#Cs=i,this.#Ra=o,this.#ts=t}keydown=e=>{e.context="Livewire",this.#rn.onKeydown(e),"Escape"===e.key&&this.#Cs.disableAndResetEditor()};activate(e){if(e){const e=this.#rn.getStageController().getActiveLayerGroup();this.#ts.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#ts.getLineColour()})}else this.cancel();this.#Cs.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#ts.setLineColour(e.shapeColour),this.#Ra.setFeatures(e)}}},Mc={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 Qe(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 m(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 S(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 qc{#cc=[];#uc;#Ir=!1;#dc=[];#ct=null;getLayerGroup(e){return this.#cc[e]}getNumberOfLayerGroups(){return this.#cc.length}getActiveLayerGroup(){return this.getLayerGroup(this.#uc)}setActiveLayerGroup(e){void 0!==this.getLayerGroup(e)?this.#uc=e:o.warn(`No layer group to set as active with index: ${e}`)}getViewLayersByDataId(e){let t=[];for(const n of this.#cc)t=t.concat(n.getViewLayersByDataId(e));return t}getViewLayers(e){let t=[];for(const n of this.#cc)t=t.concat(n.getViewLayers(e));return t}getDrawLayersByDataId(e){let t=[];for(const n of this.#cc)t=t.concat(n.getDrawLayersByDataId(e));return t}getDrawLayers(e){let t=[];for(const n of this.#cc)t=t.concat(n.getDrawLayers(e));return t}addLayerGroup(e,t){this.#uc=this.#cc.length;const n=new Il(e,t);n.setImageSmoothing(this.#Ir);const i=this.#ct&&0!==this.#ct.length;return i&&this.unbindLayerGroups(),this.#cc.push(n),i&&this.bindLayerGroups(),n}getLayerGroupByDivId(e){return this.#cc.find((function(t){return t.getDivId()===e}))}setBinders(e){if(null==e)throw new Error("Cannot set null or undefined binders");0!==this.#dc.length&&this.unbindLayerGroups(),this.#dc=e.slice(),this.bindLayerGroups()}empty(){this.unbindLayerGroups();for(const e of this.#cc)e.empty();this.#cc=[],this.#uc=void 0}removeLayersByDataId(e){for(const t of this.#cc)t.removeLayersByDataId(e)}removeLayerGroup(e){const t=this.#cc.findIndex((t=>t===e));if(-1===t)throw new Error("Cannot find layerGroup to remove");this.unbindLayerGroups(),e.empty(),this.#cc.splice(t,1),this.#uc===t&&(this.#uc=void 0),this.bindLayerGroups()}reset(){for(const e of this.#cc)e.reset()}resetZoomPan(){for(const e of this.#cc)e.resetZoomPan()}resetViews(){for(const e of this.#cc)e.resetViews()}draw(){for(const e of this.#cc)e.draw()}fitToContainer(){let e;const t=[];for(let n=0;n<this.#cc.length;++n){const i=this.#cc[n].getDivToWorldSizeRatio();void 0!==i&&this.#cc[n].shouldBind()&&(t.push(n),(void 0===e||i<e)&&(e=i))}for(let n=0;n<this.#cc.length;++n)if(t.includes(n)&&this.#cc[n].shouldBind())this.#cc[n].fitToContainer(e);else{const e=this.#cc[n].getDivToWorldSizeRatio();this.#cc[n].fitToContainer(e)}}bindLayerGroups(){if(0!==this.#cc.length&&1!==this.#cc.length&&0!==this.#dc.length){this.#ct=new Array(this.#cc.length);for(let e=0;e<this.#cc.length;++e)if(this.#cc[e].shouldBind())for(let t=0;t<this.#dc.length;++t)this.#hc(e,this.#dc[t])}}unbindLayerGroups(){if(0!==this.#cc.length&&0!==this.#dc.length&&this.#ct){for(let e=0;e<this.#cc.length;++e)if(this.#cc[e].shouldBind())for(let t=0;t<this.#dc.length;++t)this.#gc(e,this.#dc[t]);this.#ct=null}}setImageSmoothing(e){this.#Ir=e;for(const t of this.#cc)t.setImageSmoothing(e)}#Sc(e,t){if(!this.#ct)return;void 0===this.#ct[t]&&(this.#ct[t]=[]);let n=this.#ct[t].find((function(t){return t.binder===e}));return void 0===n&&(n={binder:e,callback:n=>{this.#gc(t,e),e.getCallback(this.#cc[t])(n),this.#hc(t,e)}},this.#ct[t].push(n)),n.callback}#hc(e,t){for(let n=0;n<this.#cc.length;++n)n!==e&&this.#cc[n].shouldBind()&&this.#cc[e].addEventListener(t.getEventType(),this.#Sc(t,n))}#gc(e,t){if(this.#ct)for(const n in this.#ct)if(parseInt(n,10)!==e)for(const i of this.#ct[n])i.binder.getEventType()===t.getEventType()&&this.#cc[e].removeEventListener(t.getEventType(),i.callback)}}const Uc=["viewlayeradd","drawlayeradd","error","zoomchange","offsetchange","layerremove","outofrange","renderstart","renderend",...tl];class Qc extends EventTarget{#pc=null;#$a;#Fi;#mc;#fc;#vc;constructor(e,t){super(),this.#$a=e,this.#Fi=t,this.#pc=new qc,void 0!==t.binders&&this.#pc.setBinders(t.binders)}setToolboxController(e){this.#mc=e}setAddToUndoStack(e){this.#fc=e}setGetInfoData(e){this.#vc=e}getViewConfigs(e,t){if(void 0===t&&(t=!1),null===this.#Fi.dataViewConfigs||void 0===this.#Fi.dataViewConfigs)throw new Error("No available data view configuration");let n=[];return void 0!==this.#Fi.dataViewConfigs[e]?n=this.#Fi.dataViewConfigs[e]:t||void 0===this.#Fi.dataViewConfigs["*"]||(n=this.#Fi.dataViewConfigs["*"]),n}getViewConfig(e,t,n){return this.getViewConfigs(e,n).find((function(e){return e.divId===t}))}getDataViewConfigs(){return this.#Fi.dataViewConfigs}setDataViewConfigs(e){this.#pc.empty(),this.#Fi.dataViewConfigs=e,this.#Cc(e)}addDataViewConfig(e,t,n){void 0===n&&(n=!0);const i=this.#Fi.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.#Fi.dataViewConfigs[e].push(t),void 0===this.#pc.getLayerGroupByDivId(t.divId)&&this.#Dc(t),void 0!==this.#$a.get(e)&&n&&this.render(e,[t])}removeDataViewConfig(e,t){const n=this.#Fi.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.#pc.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.#pc.removeLayerGroup(o)}}updateDataViewConfig(e,t,n){const i=this.#Fi.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.#pc.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.#$a.get(e)&&this.render(e,[r])}getActiveLayerGroup(){return this.#pc.getActiveLayerGroup()}setActiveLayerGroup(e){this.#pc.setActiveLayerGroup(e)}getLayerGroup(e){return this.#pc.getLayerGroup(e)}getNumberOfLayerGroups(){return this.#pc.getNumberOfLayerGroups()}getViewLayersByDataId(e){return this.#pc.getViewLayersByDataId(e)}getViewLayers(e){return this.#pc.getViewLayers(e)}getDrawLayersByDataId(e){return this.#pc.getDrawLayersByDataId(e)}getDrawLayers(e){return this.#pc.getDrawLayers(e)}getLayerGroupByDivId(e){return this.#pc.getLayerGroupByDivId(e)}getAddedScale(){return this.#pc.getActiveLayerGroup().getAddedScale()}getBaseScale(){return this.#pc.getActiveLayerGroup().getBaseScale()}getOffset(){return this.#pc.getActiveLayerGroup().getOffset()}empty(){this.#pc.empty()}removeLayersByDataId(e){this.#pc.removeLayersByDataId(e)}setBinders(e){this.#pc.setBinders(e)}fitToContainer(){this.#pc.fitToContainer()}draw(){this.#pc.draw()}resetLayout(){this.#pc.reset(),this.#pc.draw()}resetZoomPan(){this.#pc.resetZoomPan(),this.#pc.draw()}resetViews(){this.#pc.resetViews()}setImageSmoothing(e){this.#pc.setImageSmoothing(e),this.#pc.draw()}zoom(e,t,n){const i=this.#pc.getActiveLayerGroup(),o=i.getBaseViewLayer().getViewController().getCurrentScrollPosition(),r=new S(t,n,o);i.addScale(e,r),i.draw()}translate(e,t){const n=this.#pc.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.#$a.get(e),i=void 0!==n&&void 0!==n.image,r=void 0!==n&&void 0!==n.annotationGroup;if(0===this.#pc.getNumberOfLayerGroups()&&this.#Cc(this.#Fi.dataViewConfigs),void 0===t&&(t=this.getViewConfigs(e)),0!==t.length)for(let n=0;n<t.length;++n){const o=t[n],a=this.#pc.getLayerGroupByDivId(o.divId);if(!a)throw new Error(`No layer group for ${o.divId}`);!i||this.#yc(e,a)?(i&&0===a.getViewLayersByDataId(e).length?this.#Ic(e,o):r&&0===a.getDrawLayersByDataId(e).length&&this.#wc(e,o),a.draw()):this.dispatchEvent(new CustomEvent("error",{detail:{error:new Error("Render error: incompatible geometries for overlay"),dataid:e}}))}else o.info(`Not rendering data: ${e} (no data view config)`)}#Tc=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#Cc(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.#Dc(t),n.push(t.divId))}}}#Dc(e){const t=this.#Fi.rootDocument.getElementById(e.divId),n=void 0!==this.#Fi.overlayConfig,i=this.#pc.addLayerGroup(t,n);this.#Lc(i)}#Lc(e){e.addEventListener("zoomchange",this.#Tc),e.addEventListener("offsetchange",this.#Tc),e.addEventListener("layerremove",this.#Tc),e.addEventListener("outofrange",this.#Tc),e.addEventListener("renderstart",this.#Tc),e.addEventListener("renderend",this.#Tc);for(const t of tl)e.addEventListener(t,this.#Tc);e.addEventListener("wlchange",(e=>{const t=e.detail?.srclayerid,n=e.detail?.dataid,i=e.detail?.value,o=Cl(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=Cl(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=Cl(t).groupDivId,r=this.getViewConfig(n,o,!0);void 0!==r&&(r.colourMap=i[0])}))}#yc(e,t){let n=!1;const i=t.getBaseViewLayer();if(void 0!==i){const t=this.#$a.get(i.getDataId()).image,o=this.#$a.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}#Ic(e,t){const n=this.#$a.get(e);if(!n)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const i=this.#pc.getLayerGroupByDivId(t.divId);if(!i)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const o=n.image.getGeometry();this.#pc.unbindLayerGroups();const r=(new Js).create(n.meta,n.image),a=it(o.getOrientation(),Ke(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 Qe(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.#$a.addEventListener("dataimageset",c.onimageset),s&&void 0!==this.#Fi.overlayConfig&&void 0!==this.#vc&&(i.addInfoData(this.#vc(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.#pc.fitToContainer(),c.setOffset(i.getOffset());const S=this.#Pc(o.getOrientation(),t.orientation);if(this.#Ac(S,c),s)c.setScale(i.getScale());else{const e=i.getBaseViewLayer();c.initScale(i.getScale(),e.getAbsoluteZoomOffset())}this.#pc.bindLayerGroups(),this.#mc&&this.#mc.bindLayerGroup(i,c),this.dispatchEvent(new CustomEvent("viewlayeradd",{detail:{layerid:c.getId(),layergroupid:i.getDivId(),dataid:e}})),s&&this.#mc&&this.#mc.init()}#wc(e,t){const n=this.#pc.getLayerGroupByDivId(t.divId);if(!n)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const i=this.#$a.get(e);if(!i)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const o=i.annotationGroup,r=this.#Oc(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.#pc.unbindLayerGroups();const s=r.getViewController();i.annotationGroup.setViewController(s);const l=this.#$a.get(a);if(!l)throw new Error(`Cannot initialise layer without reference data, id: ${a}`);const c=l.image.getGeometry(),u=it(c.getOrientation(),Ke(t.orientation)),d=c.getSize(u).get2D(),h=c.getSpacing(u).get2D(),g=n.addDrawLayer();g.initialise(d,h,r.getId());const S=new rl(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.#pc.fitToContainer(),g.setOffset(n.getOffset());const m=this.#Pc(c.getOrientation(),t.orientation);this.#Ac(m,g),g.initScale(n.getScale(),r.getAbsoluteZoomOffset()),g.setAnnotationGroup(i.annotationGroup,e,this.#fc),g.setCurrentPosition(s.getCurrentPosition(),s.getCurrentIndex()),this.#pc.bindLayerGroups(),this.#mc&&this.#mc.bindLayerGroup(n,g),this.dispatchEvent(new CustomEvent("drawlayeradd",{detail:{layerid:g.getId(),layergroupid:n.getDivId(),dataid:e}}))}#Oc(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}#Pc(e,t){const n=Je(e.asOneAndZeros());if(void 0===n)throw new Error("Unsupported undefined orientation code");const i=void 0===t,r=!i&&t===_e.Axial,a=!i&&t===_e.Coronal,s=!i&&t===_e.Sagittal,l={x:!1,y:!1},c={x:!1,y:!1,z:!1};return"LPS"===n?(a||s)&&(c.z=!0,l.y=!0):"LAI"===n?i||r?l.y=!0:a?c.z=!0:s&&(c.z=!0,l.x=!0):"RPI"===n?i||r?l.x=!0:a?(c.z=!0,l.x=!0):s&&(c.z=!0):"RAS"===n?(l.x=!0,l.y=!0,(a||s)&&(c.z=!0)):"LSA"===n?(l.y=!0,i||a?c.z=!0:r?c.y=!0:s&&(l.x=!0,c.y=!0,c.z=!0)):"RSP"===n?i||a?(l.x=!0,l.y=!0,c.x=!0,c.z=!0):r?(l.x=!0,c.x=!0):s&&(l.y=!0,c.z=!0):"RIA"===n?(l.x=!0,i||a?c.x=!0:r?(l.y=!0,c.x=!0,c.y=!0):s&&(c.y=!0)):"PSL"===n?(c.z=!0,(i||s||a)&&(l.y=!0)):"PIR"===n?(c.z=!0,(r||a)&&(l.x=!0)):"ASR"===n?(l.x=!0,l.y=!0,(i||s||a)&&(c.z=!0)):"AIL"===n?i||s?(l.x=!0,c.z=!0):r?l.y=!0:a&&(c.z=!0):"LIP"!==n&&o.warn(`Unsupported orientation code: ${n}, display could be incorrect`),{scale:c,offset:l}}#Ac(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 Vc{divId;orientation;colourMap;opacity;fillOpacity;contourThickness;wlPresetName;windowCenter;windowWidth;constructor(e){this.divId=e}}class Nc{options;constructor(e){this.options=e}}class Bc{dataViewConfigs;tools;binders;viewOnFirstLoadItem;defaultCharacterSet;overlayConfig;rootDocument;constructor(e){this.dataViewConfigs=e}}class kc extends EventTarget{#Fi=null;#$a=null;#mc=null;#bc=null;#La=null;#xc=null;#ts=new to;#ha={};getDataController(){return this.#$a}getData(e){return o.debug("App.getData: deprecated since v0.37, please use via app.getDataController."),this.#$a.get(e)}getImage(e){let t;return o.debug("App.getImage: deprecated since v0.34, please use the getData method."),void 0!==this.#$a.get(e)&&(t=this.#$a.get(e).image),t}setImage(e,t){o.debug("App.setImage: deprecated since v0.37, please use via app.getDataController."),this.#$a.setImage(e,t)}getNextDataId(){return o.debug("App.getNextDataId: deprecated since v0.37, please use via app.getDataController."),this.#$a.getNextDataId()}addData(e,t){return o.debug("App.addData: deprecated since v0.37, please use via app.getDataController."),this.#$a.add(e,t)}getMetaData(e){let t;return o.debug("App.getMetaData: deprecated since v0.37, please use via app.getDataController."),void 0!==this.#$a.get(e)&&(t=this.#$a.get(e).meta),t}getDataIds(){return o.debug("App.getDataIds: deprecated since v0.37, please use via app.getDataController."),this.#$a.getDataIds()}getDataIdsFromSopUids(e){return o.debug("App.getDataIdsFromSopUids: deprecated since v0.37, please use via app.getDataController."),this.#$a.getDataIdsFromSopUids(e)}getDataIdFromSeriesUid(e){return o.debug("App.getDataIdFromSeriesUid: deprecated since v0.37, please use via app.getDataController."),this.#$a.getDataIdFromSeriesUid(e)}canScroll(){return o.debug("App.canScroll: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#La.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()}canWindowLevel(){return o.debug("App.canWindowLevel: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#La.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()}getAddedScale(){return o.debug("App.getAddedScale: deprecated since v0.37, please access from the active layer group."),this.#La.getAddedScale()}getBaseScale(){return o.debug("App.getBaseScale: deprecated since v0.37, please access from the active layer group."),this.#La.getBaseScale()}getOffset(){return o.debug("App.getOffset: deprecated since v0.37, please access from the active layer group."),this.#La.getOffset()}getToolboxController(){return this.#mc}getStageController(){return this.#La}getUndoController(){return this.#xc}getActiveLayerGroup(){return o.debug("App.getActiveLayerGroup: deprecated since v0.37, use app.getStageController().getActiveLayerGroup()"),this.#La.getActiveLayerGroup()}setActiveLayerGroup(e){o.debug("App.setActiveLayerGroup: deprecated since v0.37, use app.getStageController().setActiveLayerGroup()"),this.#La.setActiveLayerGroup(e)}getViewLayersByDataId(e){return o.debug("App.getViewLayersByDataId: deprecated since v0.37, use app.getStageController().getViewLayersByDataId()"),this.#La.getViewLayersByDataId(e)}getViewLayers(e){return o.debug("App.getViewLayers: deprecated since v0.37, use app.getStageController().getViewLayers()"),this.#La.getViewLayers(e)}getDrawLayersByDataId(e){return o.debug("App.getDrawLayersByDataId: deprecated since v0.37, use app.getStageController().getDrawLayersByDataId()"),this.#La.getDrawLayersByDataId(e)}getDrawLayers(e){return o.debug("App.getDrawLayers: deprecated since v0.37, use app.getStageController().getDrawLayers()"),this.#La.getDrawLayers(e)}getLayerGroupByDivId(e){return o.debug("App.getLayerGroupByDivId: deprecated since v0.37, use app.getStageController().getLayerGroupByDivId()"),this.#La.getLayerGroupByDivId(e)}getNumberOfLayerGroups(){return o.debug("App.getNumberOfLayerGroups: deprecated since v0.37, use app.getStageController().getNumberOfLayerGroups()"),this.#La.getNumberOfLayerGroups()}getStyle(){return this.#ts}addToUndoStack=e=>{o.debug("App.addToUndoStack: deprecated since v0.37, please use via app.getUndoController."),null!==this.#xc&&this.#xc.addToUndoStack(e)};removeFromUndoStack=e=>{o.debug("App.removeFromUndoStack: deprecated since v0.37, please use via app.getUndoController.");let t=!1;return null!==this.#xc&&(t=this.#xc.removeFromUndoStack(e)),t};init(e){this.#Fi=e,void 0===this.#Fi.viewOnFirstLoadItem&&(this.#Fi.viewOnFirstLoadItem=!0),void 0===this.#Fi.dataViewConfigs&&(this.#Fi.dataViewConfigs={}),void 0===this.#Fi.rootDocument&&"undefined"!=typeof document&&(this.#Fi.rootDocument=document),this.#bc=new Qs(this.#Fi.defaultCharacterSet),this.#bc.addEventListener("loadstart",this.#Ec),this.#bc.addEventListener("loaditem",this.#Rc),this.#bc.addEventListener("load",this.#Fc);for(const e of Us)"loadstart"!==e&&"loaditem"!==e&&"load"!==e&&this.#bc.addEventListener(e,this.#xr);this.#$a=new Cs;for(const e of ps)this.#$a.addEventListener(e,this.#xr);for(const e of ji)this.#$a.addEventListener(e,this.#xr);for(const e of Ji)this.#$a.addEventListener(e,this.#xr);this.#xc=new Ns;for(const e of Vs)this.#xc.addEventListener(e,this.#xr);this.#La=new Qc(this.#$a,this.#Fi),this.#La.setAddToUndoStack((e=>this.#xc.addToUndoStack(e))),this.#La.setGetInfoData((e=>this.getInfoData(e)));for(const e of Uc)this.#La.addEventListener(e,this.#xr);if(void 0!==this.#Fi.tools){const e={},t=Object.keys(this.#Fi.tools);for(let n=0;n<t.length;++n){const i=t[n];let r=Fc[i];if(void 0===r&&(r=Rc[i]),void 0!==r){if(e[i]=new r(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.#xr)}const t=this.#Fi.tools[i];if(void 0!==t.options&&0!==t.options.length){let n,r="raw";if(void 0!==e[i].getOptionsType&&(r=e[i].getOptionsType()),"instance"===r||"factory"===r){n={};for(let e=0;e<t.options.length;++e){const a=t.options[e];let s=a;"factory"===r&&(s+="Factory");const l=i.charAt(0).toLowerCase()+i.slice(1);let c,u=Ra[l];void 0!==u&&(c=u[s]),void 0===c&&(u=Fa[l],void 0!==u&&(c=u[s])),void 0!==c?n[a]=c:o.warn(`Could not find option class for: ${a}`)}}else n=t.options;e[i].setOptions(n)}}else o.warn(`Could not initialise unknown tool: ${i}`)}this.#mc=new Co(e),this.#La.setToolboxController(this.#mc)}}reset(){this.#La.empty(),this.#ha={},this.#xc&&this.#xc.reset()}resetLayout(){o.debug("App.resetLayout: deprecated since v0.35, prefer resetZoomPan."),this.#La.resetLayout()}resetZoomPan(){o.debug("App.resetZoomPan: deprecated since v0.37, use app.getStageController().resetZoomPan()"),this.#La.resetZoomPan()}resetViews(){o.debug("App.resetViews: deprecated since v0.37, use app.getStageController().resetViews()"),this.#La.resetViews()}loadFiles=e=>{if(0===e.length)return o.warn("Ignoring empty input file list."),"-1";const t=this.#$a.getNextDataId();return this.#bc.loadFiles(e,t),t};loadURLs=(e,t)=>{if(0===e.length)return o.warn("Ignoring empty input url list."),"-1";const n=this.#$a.getNextDataId();return this.#bc.loadURLs(e,n,t),n};loadFromUri=(e,t)=>{o.debug("App.loadFromUri: deprecated since v0.36, please extract the file list and pass it to loadURLs.");const n=lo(e);n&&void 0!==n.input&&function(e,t,n){e.type&&"manifest"===e.type?go(e.input,e.nslices,t):t(ho(e.input,e.dwvReplaceMode),n)}(n,this.loadURLs,t)};loadImageObject=e=>{const t=this.#$a.getNextDataId();return this.#bc.loadImageObject(e,t),t};abortAllLoads(){const e=this.#bc.getLoadingDataIds();for(const t of e)this.abortLoad(t)}abortLoad(e){this.#bc.abort(e),this.#$a.remove(e),this.#La.removeLayersByDataId(e)}fitToContainer(){o.debug("App.fitToContainer: deprecated since v0.37, use app.getStageController().fitToContainer()"),this.#La.fitToContainer()}initWLDisplay(){o.debug("App.initWLDisplay: deprecated since v0.33, please set the opacity of the desired view layer directly."),this.#La.getActiveLayerGroup().getActiveViewLayer().getViewController().initialise()}setImageSmoothing(e){o.debug("App.setImageSmoothing: deprecated since v0.37, use app.getStageController().setImageSmoothing()"),this.#La.setImageSmoothing(e)}getViewConfigs(e,t){return o.debug("App.getViewConfigs: deprecated since v0.37, use app.getStageController().getViewConfigs()"),this.#La.getViewConfigs(e,t)}getViewConfig(e,t,n){return o.debug("App.getViewConfig: deprecated since v0.37, use app.getStageController().getViewConfig()"),this.#La.getViewConfig(e,t,n)}getDataViewConfigs(){return o.debug("App.getDataViewConfigs: deprecated since v0.37, use app.getStageController().getDataViewConfigs()"),this.#La.getDataViewConfigs()}setDataViewConfigs(e){o.debug("App.setDataViewConfigs: deprecated since v0.37, use app.getStageController().setDataViewConfigs()"),this.#La.setDataViewConfigs(e)}addDataViewConfig(e,t,n){o.debug("App.addDataViewConfig: deprecated since v0.37, use app.getStageController().addDataViewConfig()"),this.#La.addDataViewConfig(e,t,n)}removeDataViewConfig(e,t){o.debug("App.removeDataViewConfig: deprecated since v0.37, use app.getStageController().removeDataViewConfig()"),this.#La.removeDataViewConfig(e,t)}updateDataViewConfig(e,t,n){o.debug("App.updateDataViewConfig: deprecated since v0.37, use app.getStageController().updateDataViewConfig()"),this.#La.updateDataViewConfig(e,t,n)}setLayerGroupsBinders(e){const t=[];for(let n=0;n<e.length;++n)void 0!==Mc[e[n]]&&t.push(new Mc[e[n]]);this.#La.setBinders(t)}render(e,t){o.debug("App.render: deprecated since v0.37, use app.getStageController().render()"),this.#La.render(e,t)}zoom(e,t,n){o.debug("App.zoom: deprecated since v0.37, please access from the active layer group."),this.#La.zoom(e,t,n)}translate(e,t){o.debug("App.translate: deprecated since v0.37, please access from the active layer group."),this.#La.translate(e,t)}resampleMatch(e,t){const n=this.#$a.get(e);if(void 0===n)return void o.debug(`Cannot resample match, target data '${e}' is undefined`);if(void 0===n.image)return void o.debug(`Cannot resample match, target image '${e}' is undefined`);const i=this.#$a.get(t);if(void 0===i)return void o.debug(`Cannot resample match, source data '${t}' is undefined`);if(void 0===i.image)return void o.debug(`Cannot resample match, source image '${t}' is undefined`);const r=n.image.getGeometry().getOrientation(),a=i.image.getGeometry().getOrientation();r.equals(a)?o.info(`Same orientation, no resample match for data '${e}' and '${t}'`):this.resample(e,a)}resample(e,t){const n=this.#$a.get(e);if(void 0===n)return void o.debug(`Cannot resample, target data '${e}' is undefined`);if(void 0===n.image)return void o.debug(`Cannot resample, target image '${e}' is undefined`);if(n.image.getGeometry().getOrientation().equals(t))return void o.info(`Same orientation, no resample for data '${e}'`);n.image.resample(t);const i=this.#Fi.dataViewConfigs,r=n.image.getMeta(),a=this.#$a.getDataIds();for(let e=0;e<a.length;e++){const t=this.#$a.get(a[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===r.SeriesInstanceUID&&this.#$a.stash(a[e])}const s=this.getStageController();s.setDataViewConfigs(i);const l=this.#$a.getDataIds();for(let e=0;e<l.length;++e)s.render(l[e])}revertResample(e){const t=this.#$a.get(e);if(void 0===t)return void o.debug(`Cannot revert resample, target data '${e}' is undefined`);if(void 0===t.image)return void o.debug(`Cannot revert resample, target image '${e}' is undefined`);if(!t.image.isResampled())return void o.info(`No revert resample needed for data '${e}'`);t.image.revert();const n=this.#Fi.dataViewConfigs,i=t.image.getMeta(),r=this.#$a.getStashedDataIds();for(let e=0;e<r.length;e++){const t=this.#$a.getStashed(r[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===i.SeriesInstanceUID&&this.#$a.unstash(r[e])}const a=this.getStageController();a.setDataViewConfigs(n);const s=this.#$a.getDataIds();for(let e=0;e<s.length;++e)a.render(s[e])}setOpacity(e){o.debug("App.setOpacity: deprecated since v0.33, please set the opacity of the desired view layer directly.");const t=this.#La.getActiveLayerGroup().getActiveViewLayer();t.setOpacity(e),t.draw()}setDrawings(t,n,r){o.debug("App.setDrawings: deprecated since v0.34, please switch to DICOM SR annotations.");const a=this.#La.getActiveLayerGroup().getBaseViewLayer(),s=a.getDataId(),l=this.#$a.get(s),c=a.getViewController(),u=function(t,n,r){const a=[],s=e.Node.create(t).getChildren(ta);for(let e=0,t=s.length;e<t;++e){const t=s[e],l=t.getChildren();for(let e=0,s=l.length;e<s;++e){const e=new $a,s=new i(pl(t.id()));e.referencedSopInstanceUID=r.getImageUid(s);const c=l[0];e.trackingId=c.id(),e.trackingUid=c.id();const u=c.getChildren(ea)[0];if(e.colour=u.stroke(),"line-group"===c.name()){const t=u.points();e.mathShape=new g(t[0],t[1]),e.referencePoints=[new g(t[2],t[3])]}else if("ruler-group"===c.name()){const t=u.points();e.mathShape=new jo(new g(t[0],t[1]),new g(t[2],t[3]))}else if("rectangle-group"===c.name())e.mathShape=new ar(new g(u.x(),u.y()),new g(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 g(t[e],t[e+1]));e.mathShape=new nr(n)}else if("freeHand-group"===c.name()){o.warn("Converting freehand into ROI shape");const t=u.points(),n=[];for(let e=0;e<t.length;e+=2)n.push(new g(t[e],t[e+1]));e.mathShape=new nr(n)}else if("protractor-group"===c.name()){const t=u.points();e.mathShape=new tr([new g(t[0],t[1]),new g(t[2],t[3]),new g(t[4],t[5])])}else if("ellipse-group"===c.name()){const t=u.absolutePosition();e.mathShape=new or(new g(t.x,t.y),u.radiusX(),u.radiusY())}else if("circle-group"===c.name()){const t=u.absolutePosition();e.mathShape=new ir(new g(t.x,t.y),u.radius())}else if("bidimensional-group"===c.name()){const t=u.points(),i=new lr(new g(t[0],t[1]),new g(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 lr.restorePropertiesFromQuantification?lr.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}a.push(e)}}return a}(t,n,l.image),d=this.createAnnotationData(s);for(const e of u)e.setViewController(c),d.annotationGroup.add(e);this.#$a.add(r,d),this.#La.render(r)}applyJsonState(e,t){o.debug("App.applyJsonState: deprecated since v0.34, please switch to DICOM SR for annotations.");const n=new no(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.#La.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.#xc.redo();else if("z"===e.key)this.#xc.undo();else if(" "===e.key){const e=this.#La.getNumberOfLayerGroups();for(let t=0;t<e;++t)this.#La.getLayerGroup(t).setShowCrosshair(!this.#La.getLayerGroup(t).getShowCrosshair())}};resetDisplay(){this.resetLayout(),this.initWLDisplay()}resetZoom(){this.resetLayout()}setColourMap(e){o.debug("App.setColourMap: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#La.getActiveLayerGroup().getActiveViewLayer().getViewController().setColourMap(e)}setWindowLevelPreset(e){o.debug("App.setWindowLevelPreset: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#La.getActiveLayerGroup().getActiveViewLayer().getViewController().setWindowLevelPreset(e)}setTool(e){for(let e=0;e<this.#La.getNumberOfLayerGroups();++e){const t=this.#La.getLayerGroup(e),n=t.getActiveLayer();void 0!==n&&this.#mc.bindLayerGroup(t,n)}this.#mc.setSelectedTool(e)}setToolFeatures(e){this.#mc.setToolFeatures(e)}undo(){o.debug("App.undo: deprecated since v0.37, please use via app.getUndoController."),this.#xc.undo()}redo(){o.debug("App.redo: deprecated since v0.37, please use via app.getUndoController."),this.#xc.redo()}getStackSize(){return o.debug("App.getStackSize: deprecated since v0.37, please use via app.getUndoController."),this.#xc.getStackSize()}getCurrentStackIndex(){return o.debug("App.getCurrentStackIndex: deprecated since v0.37, please use via app.getUndoController."),this.#xc.getCurrentStackIndex()}getInfoData(e){let t;return void 0!==this.#ha&&(t=this.#ha[e]),t}toggleInfoDataListeners(e){const t=this.getInfoData(e);void 0!==t&&(t.isListening()?t.removeAppListeners():t.addAppListeners())}createAnnotationData(e){const t=this.#$a.get(e).image.getMeta(),n=new fs({});n.annotationGroup=new eo,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.#$a,o=i.getNextDataId();if(!i.add(o,e))throw new Error("Cannot add annotation data");const r=this.#La.getViewConfigs(n).find((e=>e.divId===t));if(void 0===r)throw new Error("No reference data view config for draw");const a=new Vc(t);a.orientation=r.orientation,this.#La.addDataViewConfig(o,a),this.#La.render(o)}#xr=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#Ec=e=>{void 0!==this.#Fi.overlayConfig&&0===Object.keys(this.#ha).length&&(this.#ha[e.detail.dataid]=new Hs(this,e.detail.dataid,this.#Fi.overlayConfig)),this.#xr(e)};#Rc=e=>{void 0===e.detail.data&&o.error("Missing loaditem event data."),void 0===e.detail.loadtype&&o.error("Missing loaditem event load type.");const t=e.detail.isfirstitem;if("image"===e.detail.loadtype)try{t?this.#$a.add(e.detail.dataid,e.detail.data):this.#$a.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.#xr(e),void 0!==this.#ha&&void 0!==this.#ha[e.detail.dataid]&&this.#ha[e.detail.dataid].addItemMeta(e.detail.data.meta),"image"===e.detail.loadtype&&0!==this.#La.getViewConfigs(e.detail.dataid).length&&t&&this.#Fi.viewOnFirstLoadItem&&this.#La.render(e.detail.dataid)};#Fc=e=>{const t=this.#$a.markDataAsComplete(e.detail.dataid);this.#Fi.viewOnFirstLoadItem&&void 0!==t.imageHasChanged&&t.imageHasChanged&&this.#La.render(e.detail.dataid),this.#xr(e)}}class Gc{#el;#oe;constructor(e){this.#el=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.#el}#Mc(e){return this.#oe.findIndex((function(t){return t.number===e}))}hasSegment(e){return-1!==this.#Mc(e)}getNumberOfSegments(){return this.#oe.length}maskHasSegments(e){const t=[],n=[];for(let i=0;i<e.length;++i){const r=this.getSegment(e[i]);void 0!==r?void 0!==r.displayValue?t.push(r.displayValue):t.push(r.number):(o.warn(`Unknown segment in maskHasSegments: ${e[i]}`),n.push(i))}const i=this.#el.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.#Mc(e);return-1!==n&&(t=this.#oe[n]),t}addSegment(e){-1===this.#Mc(e.number)?(this.#oe.push(e),void 0!==e.displayRGBValue&&this.#el.updatePaletteColourMap(e.number,e.displayRGBValue)):o.warn(`Not adding segment, it is allready in the segments list: ${e.number}`)}removeSegment(e){const t=this.#Mc(e);-1!==t?this.#oe.splice(t,1):o.warn(`Cannot remove segment, it is not in the segments list: ${e}`)}updateSegment(e){const t=this.#Mc(e.number);-1!==t?this.#oe[t]=e:o.warn(`Cannot update segment, it is not in the segments list: ${e.number}`)}findOverlap(e){const t=this.#el.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.#el.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 zc extends La{#el;#qc;#al;#Uc;constructor(e,t,n){super(),this.#el=e,this.#qc=t,this.#al=void 0!==n&&n,void 0!==t.displayRGBValue?this.#Uc=e.getOffsets(t.number):this.#Uc=e.getOffsets(t.displayValue)}getName(){return"Delete-segment"}isValid(){return this.#el.getMeta().custom.segments.some((e=>e.number===this.#qc.number))}execute(){0!==this.#Uc.length&&this.#el.setAtOffsets(this.#Uc,0),new Gc(this.#el).removeSegment(this.#qc.number),this.#al||this.onExecute({type:"masksegmentdelete",segmentnumber:this.#qc.number})}undo(){0!==this.#Uc.length&&(void 0!==this.#qc.displayRGBValue?this.#el.setAtOffsets(this.#Uc,this.#qc.number):this.#el.setAtOffsets(this.#Uc,this.#qc.displayValue)),new Gc(this.#el).addSegment(this.#qc),this.onUndo({type:"masksegmentredraw",segmentnumber:this.#qc.number})}onExecute(e){}onUndo(e){}}class Hc extends La{#el;#qc;#Qc;#Vc;#al;#Uc;constructor(e,t,n,i){super(),this.#el=e,this.#qc=t,this.#Qc=n,this.#al=void 0!==i&&i,void 0!==t.displayRGBValue?this.#Vc=t.displayRGBValue:(this.#Vc=t.displayValue,this.#Uc=e.getOffsets(this.#Vc))}getName(){return"Change-segment-colour"}isValid(){let e=!0;return void 0!==this.#Uc&&(e=0!==this.#Uc.length),e}execute(){"number"==typeof this.#Qc?(this.#el.setAtOffsets(this.#Uc,this.#Qc),this.#qc.displayValue=this.#Qc):(this.#el.updatePaletteColourMap(this.#qc.number,this.#Qc),this.#qc.displayRGBValue=this.#Qc),this.#al||this.onExecute({type:"changemasksegmentcolour",segmentnumber:this.#qc.number,value:[this.#Qc]})}undo(){"number"==typeof this.#Vc?(this.#el.setAtOffsets(this.#Uc,this.#Vc),this.#qc.displayValue=this.#Vc):(this.#el.updatePaletteColourMap(this.#qc.number,this.#Vc),this.#qc.displayRGBValue=this.#Vc),this.onUndo({type:"changemasksegmentcolour",segmentnumber:this.#qc.number,value:[this.#Vc]})}onExecute(e){}onUndo(e){}}class Yc{diameter;offset1;offset2}class Xc{major;minor}class Wc{centroid;centroidIndex;volume;count;diameters;height;id;largestSliceZ}class $c{x;y}class jc{x;y;z}export{$a as Annotation,eo as AnnotationGroup,_a as AnnotationGroupFactory,kc as App,Bc as AppOptions,r as BooleanResult,Za as CADReport,Hc as ChangeSegmentColourCommand,ir as Circle,He as ColourMap,La as Command,Cs as DataController,ie as DataElement,zc as DeleteSegmentCommand,Yc as Diameter,Xc as Diameters,rn as DicomCode,fs as DicomData,Ae as DicomParser,Wr as DicomSRContent,Ya as DicomWriter,Zl as DrawBrushCommand,jl as DrawBrushCommandProperties,gl as DrawController,Sl as DrawLayer,$l as DrawShapeHandler,or as Ellipse,yt as Geometry,Ki as Image,Ri as ImageContour,i as Index,Hs as InfoData,Bs as InfoDataItem,Wc as Label,Il as LayerGroup,Ni as MaskFactory,bi as MaskSegment,Gc as MaskSegmentHelper,el as MaskSegmentViewHelper,We as Matrix33,Tt as NormalisedManufacturers,s as NumberRange,a as NumberValue,_e as Orientation,rl as PlaneHelper,m as Point,g as Point2D,S as Point3D,sl as PositionHelper,tr as Protractor,ui as RGB,nr as ROI,es as RTROI,Ja as RTROIContour,ar as Rectangle,Re as RescaleSlopeAndIntercept,ja as ResponseEvaluation,Ss as RtStructFactory,Aa as RunFilterCommand,$c as Scalar2D,jc as Scalar3D,$s as ScrollWheelBehavior,Mi as SegmentCollection,pt as Size,ot as Spacing,Qc as StageController,x as Tag,J as TagInfo,Nc as ToolConfig,Co as ToolboxController,Ns as UndoController,h as Vector3D,il as View,Vc as ViewConfig,ll as ViewController,cl as ViewLayer,Ws as WheelBehavior,Qe as WindowLevel,Be as WindowPreset,Ua as WriterRule,G as addTagsToDictionary,cs as bufferToPolygons,b as buildMultipart,Zi as createImage,_i as createMaskImage,nl as createView,Xe as custom,Fc as defaultToolList,Fa as defaultToolOptions,Ve as equalWl,si as getAsSimpleTagValues,os as getDefaultDicomRTStructJson,Vi as getDefaultDicomSegJson,jr as getDicomSRContentItem,te as getDicomTagGroupName,ee as getDicomTagInfo,ue as getDwvVersion,ci as getElementsFromSimpleTagValues,rr as getEllipseIndices,Dl as getLayerDetailsFromEvent,Lt as getManufacturer,fo as getMousePoint,Pt as getNormalisedManufacturer,tt as getOrientationName,Q as getPixelDataTag,ts as getRTStructFromElements,sr as getRectangleIndices,gt as getReferencedSeriesUID,St as getReferencedSeriesUIDFromRTStruct,me as getReverseOrientation,$r as getSRContent,Qn as getSegmentationCode,R as getTagFromKey,mo as getTouchPoints,we as getTypedArray,Va as getUID,co as getURLsFromKeyValueUri,uo as handleURLsFromWeasisXMLManifest,ge as hasDicomPrefix,hi as hexToRgb,f as i18n,di as isEqualRgb,pi as labToUintLab,o as logger,Ye as luts,Bi as mergeMaskImages,li as mergeTagValues,d as precisionRound,gi as rgbToHex,ds as simplifyPolygon,vi as srgbToCielab,Rc as toolList,Ra as toolOptions};
1
+ import{default as e}from"konva";import{default as t}from"jszip";import{default as n}from"magic-wand-tool";class i{#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 i(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 i(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 i(n)}}const o={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 r{success;message;constructor(e){this.success=e}}Number.EPSILON;class a{value;unit}class s{min;max;constructor(e,t){this.min=e,this.max=t}}function l(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)<n}function c(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,a=new r(o);return o||(a.message=`${d(i,2)}`),a}(e-t,n,i)}function u(e){let t=e>1e-4;return t&&(t=e>.001,t?(t=e>.01,t||o.warn("Using larger+ real world epsilon")):o.warn("Using larger real world epsilon")),t}function d(e,t){const n=Math.pow(10,t),i=.01/n;return Math.round(e*n+i)/n}class h{#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 h(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 g{#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 S{#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&&l(this.#n,e.getX(),t)&&l(this.#i,e.getY(),t)&&l(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 h(this.#n-e.getX(),this.#i-e.getY(),this.#o-e.getZ())}}function p(e,t){return e.some(function(e){return t.equals(e)})}function m(e){return new S(e[0],e[1],e[2])}class f{#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 S(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 f(t)}mergeWith3D(e){const t=this.getValues();return t[0]=e.getX(),t[1]=e.getY(),t[2]=e.getZ(),new f(t)}}const v={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 C(e,t){return null!=e&&null!=t&&e.substring(e.length-t.length)===t}function D(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 y(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 I(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 w(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 T(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 L(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&P(e.slice().sort(),t.slice().sort())}function P(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 A(e){return String.fromCharCode(...e)}function O(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 b(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 x(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=I(a);o.push(l),i+=l.byteLength+e[r].data.byteLength}const r=I(`${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 E{#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 R(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 F(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 E(e.substring(0,4),e.substring(4,8))}function M(){return new E("FFFE","E000")}function q(e){return"FFFEE000"===e.getKey()}function U(){return new E("FFFE","E00D")}function V(e){return"FFFEE00D"===e.getKey()}function Q(e){return"FFFEE0DD"===e.getKey()}function N(){return new E("7FE0","0010")}function B(e){return["7FE00010","7FE00009","7FE00008"].includes(e.getKey())}function k(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 G(e){return void 0!==k(e)}const z=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 H(e,t){z[e]=t}const Y={"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"},X={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 W(e){return void 0!==X[e]}const $={SH:!0,LO:!0,UC:!0,ST:!0,LT:!0,UT:!0,PN:!0};function j(e){return void 0!==$[e]}const Z={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"},_={"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)"},K="1.2.840.10008.1.2",J="1.2.840.10008.1.2.1",ee="1.2.840.10008.1.2.2";class te{#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 ne(e){if(void 0===e)return;let t;const n=e.getGroup(),i=e.getElement();if(void 0!==z[n]&&void 0!==z[n][i]){const e=z[n][i];t=new te(e[0],parseInt(e[1],10),e[2])}return t}function ie(e){return Y[e.getGroup()]}function oe(e){if(null==e)return;const t=Object.keys(z);for(const n of t){const t=Object.keys(z[n]);for(const i of t)if(z[n][i][2]===e)return new E(n,i)}}class re{vr;value;tag;vl;undefinedLength;startOffset;endOffset;items;constructor(e){this.vr=e}}function ae(e){return void 0!==e&&void 0!==e.value&&0!==e.value.length}function se(e,t){let n;return ae(e[t])&&(n=e[t].value[0]),n}function le(e,t){let n;return ae(e[t])&&(n=e[t].value),n}function ce(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 ue(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 de{#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&&ue(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&&ue(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&&ue(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&&ue(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&&ue(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&&ue(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&&ue(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&&ue(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 he(){return"0.37.0-beta.13"}function ge(e){const t=e.split("-");let n=[];for(const e of t)n=n.concat(e.split("."));return n}function Se(e,t){let n=0;const i=ge(e),o=ge(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 pe(e){return!(e.byteLength<132)&&"DICM"===new Uint8Array(e,128,4).reduce(function(e,t){return e+String.fromCharCode(t)},"")}const me=String.fromCharCode("u200B");class fe{decode(e){let t="";for(let n=0,i=e.length;n<i;++n)t+=String.fromCharCode(e[n]);return t}}function ve(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 Ce(e){return e===K}function De(e){return e===ee}function ye(e){return"1.2.840.10008.1.2.4.50"===e||"1.2.840.10008.1.2.4.51"===e}function Ie(e){return"1.2.840.10008.1.2.4.57"===e||"1.2.840.10008.1.2.4.70"===e}function we(e){return null!==e.match(/1.2.840.10008.1.2.4.9/)}function Te(e){return"1.2.840.10008.1.2.5"===e}function Le(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));o.error(`Cannot allocate array of size: ${n} (>2^${e}).`)}}return i}function Pe(e,t){return t?8:W(e)?12:8}const Ae="00280100",Oe="00280103";class be{#m={};#f;#v=new fe;#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 se(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 E(n,i),endOffset:t}}#w(e,t,n){const i={};let o=this.#T(e,t,n);if(t=o.endOffset,Q(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=V(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=Q(o.tag),a||(o.vr="OB",i.push(o));return{data:i,endOffset:t,offsetTableVl:r}}#T(e,t,n,i){const r=this.#I(e,t),a=r.tag;if(void 0!==i&&a.equals(i)){const e=new re("");return e.tag=a,e}t=r.endOffset;let s,l="NONE",c=!0;a.isWithVR()&&(n?(l=ne(a)?.getVr(),void 0===l&&(l="UN"),c=!0):(l=this.#D(e.readUint8Array(t,2)),t+=2*Uint8Array.BYTES_PER_ELEMENT,c=W(l),c&&(t+=2*Uint8Array.BYTES_PER_ELEMENT))),function(e){return Object.keys(Z).concat(["NONE","ox","xx","xs"]).includes(e)}(l)||(o.warn(`Unknown VR: ${l} (for tag ${a.getKey()}), treating as 'UN'`),l="UN"),c?(s=e.readUint32(t),t+=Uint32Array.BYTES_PER_ELEMENT):(s=e.readUint16(t),t+=Uint16Array.BYTES_PER_ELEMENT);let u=!1;4294967295===s&&(u=!0,s=0),a.isPrivate()&&"UN"===l&&0===s&&(l="SQ");let d,h=t,g=h+s;if(B(a)&&u){const i=this.#L(e,t,n);t=i.endOffset,h+=i.offsetTableVl,d=i.data,g=t,s=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,s=t-h}else if(0!==s){const o=t+s;for(;t<o;)i=this.#w(e,t,n),d.push(i.data),t=i.endOffset;g=t,s=t-h}}const S=new re(l);return S.tag=a,S.vl=s,S.startOffset=h,S.endOffset=g,u&&(S.undefinedLength=u),d&&(S.items=d),S}#P(e,t,n){const i=e.tag,r=e.vl,a=e.vr,s=e.startOffset;let l,c,u;void 0!==n&&(l=n.bitsAllocated,c=n.pixelRepresentation);const d=Z[a];if(B(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"===a&&(o.warn("Reading DICOM pixel data with bitsAllocated>8 and OB VR, treating as OW"),e.vr="OW"),u=[],1===l)u.push(t.readBinaryArray(s,r,n.imageBufferSize));else if(8===l)0===c?u.push(t.readUint8Array(s,r)):u.push(t.readInt8Array(s,r));else if(16===l)0===c?u.push(t.readUint16Array(s,r)):u.push(t.readInt16Array(s,r));else if(32===l)u.push(t.readFloat32Array(s,r));else{if(64!==l)throw new Error(`Unsupported bits allocated: ${l}`);u.push(t.readFloat64Array(s,r))}else if(void 0!==d)if("Uint8"===d)u=t.readUint8Array(s,r);else if("Uint16"===d)u=t.readUint16Array(s,r),"O"!==a[0]&&(u=Array.from(u));else if("Uint32"===d)u=t.readUint32Array(s,r),"O"!==a[0]&&(u=Array.from(u));else if("Uint64"===d)u=t.readUint64Array(s,r);else if("Int16"===d)u=Array.from(t.readInt16Array(s,r));else if("Int32"===d)u=Array.from(t.readInt32Array(s,r));else if("Int64"===d)u=t.readInt64Array(s,r);else if("Float32"===d)u=Array.from(t.readFloat32Array(s,r));else if("Float64"===d)u=Array.from(t.readFloat64Array(s,r));else{if("string"!==d)throw new Error(`Unknown VR type: ${d}`);{const e=t.readUint8Array(s,r);u=j(a)?this.#y(e):this.#D(e),u=function(e){let t=e;const n=e.length-1;return e[n]===me&&(t=e.substring(0,n)),t=t.trim(),t}(u).split("\\")}}else if("xx"===a)u=Array.from(t.readUint16Array(s,r));else if("ox"===a)u=8===l?0===c?Array.from(t.readUint8Array(s,r)):Array.from(t.readInt8Array(s,r)):0===c?Array.from(t.readUint16Array(s,r)):Array.from(t.readInt16Array(s,r));else if("xs"===a)u=0===c?Array.from(t.readUint16Array(s,r)):Array.from(t.readInt16Array(s,r));else if("AT"===a){const e=t.readUint16Array(s,r);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"===a){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[Ae];void 0!==n&&void 0!==n.value&&(a=n.value[0]),n=i[Oe],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"===a||o.warn(`Unknown VR: ${a} (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,r;const a=new de(e);let s=new de(e);n=128;const l=this.#D(a.readUint8Array(n,4));if(n+=4*Uint8Array.BYTES_PER_ELEMENT,"DICM"===l){r=this.#T(a,n,!1),r.value=this.#P(r,a),n=r.endOffset,this.#m[r.tag.getKey()]=r;const e=n+r.value[0];for(;n<e;)r=this.#T(a,n,!1),n=r.endOffset,this.#m[r.tag.getKey()]=r;if(r=this.#m["00020010"],void 0===r)throw new Error("Not a valid DICOM file (no TransferSyntaxUID found)");r.value=this.#P(r,a),i=r.value[0]}else{o.warn(`Invalid DICM prefix (${l}), trying to guess tansfer syntax.`),r=this.#T(s,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?K:J;else{if(a)throw new Error("Not a valid DICOM file (no magic DICM word foundand implicit VR big endian detected)");s=ee}const l=new re("UI");return l.tag=new E("0002","0010"),l.value=[s],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(r);this.#m[e.tag.getKey()]=e,i=e.value[0],n=0}if(!function(e){return e===K||e===J||e===ee||ye(e)||Ie(e)||we(e)||Te(e)}(i))throw new Error(`Unsupported DICOM transfer syntax: '${i}' (${function(e){let t="Unknown";return void 0!==_[e]&&(t=_[e]),t}(i)})`);let c=!1;Ce(i)&&(c=!0),De(i)&&(s=new de(e,!1));let u,d=!1;for(;n<e.byteLength;){if(r=this.#T(s,n,c,t),void 0!==t&&r.tag.equals(t)){d=!0;break}n=r.endOffset;const e=r.tag.getKey();void 0===this.#m[e]?this.#m[e]=r:o.warn(`Not saving duplicate tag: ${e}`)}if(isNaN(n))throw new Error("Problem while parsing, bad offset");if(d||e.byteLength===n||o.warn(`Did not reach the end of the buffer: ${n} != ${e.byteLength}`),G(this.#m)){let e=0;r=this.#m[Oe],void 0!==r?(r.value=this.#P(r,s),e=r.value[0]):o.warn("Reading DICOM pixel data with default pixelRepresentation.");let t=16;r=this.#m[Ae],void 0!==r?(r.value=this.#P(r,s),t=r.value[0]):o.warn("Reading DICOM pixel data with default bitsAllocated.");let n,i,a=1;r=this.#m["00280008"],void 0!==r&&(r.value=this.#P(r,s),a=parseInt(r.value[0],10)),u={pixelRepresentation:e,bitsAllocated:t,numberOfFrames:a,imageBufferSize:void 0},r=this.#m["00280010"],void 0!==r&&(r.value=this.#P(r,s),n=parseInt(r.value[0],10)),r=this.#m["00280011"],void 0!==r&&(r.value=this.#P(r,s),i=parseInt(r.value[0],10)),void 0!==n&&void 0!==i&&(u.imageBufferSize=n*i*a)}if(void 0!==this.#f&&this.setDecoderCharacterSet(this.#f),r=this.#m["00080005"],void 0!==r){let e;r.value=this.#P(r,s),1===r.value.length?e=r.value[0]:(e=r.value[1],o.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,s,u),r=this.#m["7FE00010"],void 0!==r&&r.undefinedLength){const e=u.numberOfFrames,t=r.value;if(t.length>1&&t.length>e){const n=t.length/e,i=[];let o;for(let r=0;r<e;++r){o=r*n;let e=0;for(let i=0;i<n;++i)e+=t[o+i].length;const a=new t[0].constructor(e);let s=0;for(let e=0;e<n;++e)a.set(t[o+e],s),s+=t[o+e].length;i[r]=a}r.value=i}}}}function xe(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 Ee(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function Re(e,t,n,o){const r=e.getGeometry().getSize();let a=2;o&&void 0!==o&&(a=o.getColAbsMax(2).index);const s=t.getValues(),l=new i(s.map(function(e,t){return t===a||t>2?e:0}));let c,u=r.indexToOffset(l);void 0===n&&(n=!1),c=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const d=r.get(0),h=r.get(1),g=r.get(2);let S=r.getDimSize(2);const p=e.getNumberOfComponents(),m=1===e.getPlanarConfiguration(),f=function(e,t,n,i,o,r,a,s){return 1===p?xe(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(xe(e,t,n,i,o,r,a,s)),c.push(xe(e,t+n*i,n,i,o,r,a,s)),c.push(xe(e,t+2*n*i,n,i,o,r,a,s))):(i*=3,r*=3,c.push(xe(e,t,n,i,o,r,a,s)),c.push(xe(e,t+1,n,i,o,r,a,s)),c.push(xe(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(o&&void 0!==o){const e=o.getColAbsMax(0),t=o.getColAbsMax(2),n=!1,i=!1;if(2===t.index){const t=d*h;v=0===e.index?f(c,u,t,1,d,d,n,i):f(c,u,t,d,h,1,n,i)}else if(0===t.index){const t=g*h;v=1===e.index?f(c,u,t,d,h,S,n,i):f(c,u,t,S,g,d,n,i)}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,i):f(c,u,t,S,g,1,n,i)}}}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 Fe(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 Me{#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 Ue{#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 Ve{#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 Qe{#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:o.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 Ue(n,t,!0):this.#N===qe.sigmoid?this.#Q=new Ve(n,t):this.#Q=new Ue(n,t)}setSignedOffset(e){this.#V=e,this.#B()}apply(e){return this.#Q.getY(e)}}class Ne{center;width;constructor(e,t){this.center=e,this.width=t}}function Be(e,t){return null!=e&&null!=t&&e.center===t.center&&e.width===t.width}function ke(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 Ne(i,r)}class Ge{name;wl;perslice;constructor(e,t,n){this.name=e,this.wl=t,this.perslice=n}}function ze(e){const t=[];for(let n=0;n<256;++n)t.push(e(n));return t}function He(e){return e}function Ye(e){return 255-e}class Xe{red;green;blue;constructor(e,t,n){this.red=e,this.green=t,this.blue=n}}const We={plain:{red:ze(He),green:ze(He),blue:ze(He)},invPlain:{red:ze(Ye),green:ze(Ye),blue:ze(Ye)},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:ze(function(e){const t=3*e;return t>255?255:t}),green:ze(function(e){const t=256/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n}),blue:ze(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 je{#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),r=e.get(1,0),a=e.get(1,1),s=e.get(1,2),l=e.get(2,0),c=e.get(2,1),u=e.get(2,2),d=a*u-s*c,h=s*l-r*u,g=r*c-a*l;let S=t*d+n*h+i*g;if(0!==S)return S=1/S,new je([S*d,S*(i*c-n*u),S*(n*s-i*a),S*h,S*(t*u-i*l),S*(i*r-t*s),S*g,S*(n*l-t*c),S*(t*a-n*r)]);o.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(!l(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=c(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&&o.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 je(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 je(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 h(t[0],t[1],t[2])}multiplyPoint3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new S(t[0],t[1],t[2])}multiplyIndex3D(e){const t=this.multiplyArray3D(e.getValues());return new i(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 je(e)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}getValues(){return this.#e.slice()}}function Ze(){return new je([1,0,0,0,1,0,0,0,1])}function _e(e){return e.equals(Ze())}function Ke(){return new je([1,0,0,0,0,1,0,-1,0])}const Je={Axial:"axial",Coronal:"coronal",Sagittal:"sagittal"};function et(e){let t;return e===Je.Axial?t=Ze():e===Je.Coronal?t=Ke():e===Je.Sagittal&&(t=new je([0,0,-1,1,0,0,0,-1,0])),t}function tt(e){const t=new h(e.get(0,0),e.get(1,0),e.get(2,0)),n=new h(e.get(0,1),e.get(1,1),e.get(2,1)),i=new h(e.get(0,2),e.get(1,2),e.get(2,2));return nt(t)+nt(n)+nt(i)}function nt(e){let t=new h(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 h(0,t.getY(),t.getZ());else if(t.getY()>a&&t.getY()>t.getX()&&t.getY()>t.getZ())n+=o,t=new h(t.getX(),0,t.getZ());else{if(!(t.getZ()>a&&t.getZ()>t.getX()&&t.getZ()>t.getY()))break;n+=r,t=new h(t.getX(),t.getY(),0)}return n}function it(e){let t;const n=ot(e);return void 0!==n&&(t=function(e){let t;return["LPS","LAI","RPI","RAS","ALS","ARI","PLI","PRS"].includes(e)?t=Je.Axial:["LSA","LIP","RSP","RIA","ILA","IRP","SLP","SRA"].includes(e)?t=Je.Coronal:["PSL","PIR","ASR","AIL","IAR","IPL","SAL","SPR"].includes(e)&&(t=Je.Sagittal),t}(tt(n.asOneAndZeros()))),t}function ot(e){let t;if(void 0!==e&&6===e.length){const n=new h(e[0],e[1],e[2]),i=new h(e[3],e[4],e[5]),o=n.crossProduct(i);t=new je([n.getX(),i.getX(),o.getX(),n.getY(),i.getY(),o.getY(),n.getZ(),i.getZ(),o.getZ()])}return t}function rt(e,t){let n=Ze();return void 0!==t&&(n=e.asOneAndZeros().getInverse().multiply(t)),n.getAbs()}class at{#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 st={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 lt(e){let t;const n=se(e,st.Rows),i=se(e,st.Columns);return void 0!==n&&void 0!==i&&(t=[i,n]),t}function ct(e,t){let n;const i=le(e,t);return void 0!==i&&2===i.length&&(n=[parseFloat(i[1]),parseFloat(i[0])]),n}function ut(e){let t;const n=le(e,st.PixelMeasuresSequence);return void 0!==n&&(t=ct(n[0],st.PixelSpacing)),t}function dt(e){let t=ct(e,st.PixelSpacing);return void 0===t&&(t=function(e){let t=ct(e,st.ImagerPixelSpacing);if(void 0!==t){let n;const i=parseFloat(se(e,st.EstimatedRadiographicMagnificationFactor));if(isNaN(i)){const t=parseFloat(se(e,st.DistanceSourceToDetector)),i=parseFloat(se(e,st.DistanceSourceToPatient));isNaN(t)||isNaN(i)||0===i||(n=t/i)}else n=i;void 0!==n?(t=t.map(e=>e/n),o.warn("Got pixel spacing from corrected ImagerPixelSpacing tag")):o.warn("Got pixel spacing from raw ImagerPixelSpacing tag")}return t}(e)),void 0===t&&(t=function(e){const t=ct(e,st.NominalScannedPixelSpacing);return void 0!==t&&o.warn("Got pixel spacing from NominalScannedPixelSpacing tag"),t}(e)),void 0===t&&(t=function(e){let t;const n=le(e,st.SharedFunctionalGroupsSequence);if(void 0!==n&&(t=ut(n[0])),void 0===t){const n=le(e,st.PerFrameFunctionalGroupsSequence);void 0!==n&&(t=ut(n[0]))}return t}(e)),t}function ht(e){const t=ct(e,st.PixelSpacing);if(void 0===t)return;const n=se(e,st.SpacingBetweenSlices);return void 0!==n&&t.push(parseFloat(n)),new at(t)}function gt(e){const t=se(e,st.PhotometricInterpretation),n=se(e,st.TransferSyntax);if(void 0!==t&&void 0!==n){let i=t.toUpperCase();(we(n)||ye(n)||Ie(n))&&!St(i)&&(i="RGB");let o=se(e,st.SamplesPerPixel);return void 0===o&&(o=1),"RGB"===i&&1===o&&(i="PALETTE COLOR"),i}}function St(e){return void 0!==e&&null!==e.match(/MONOCHROME/)}function pt(e){let t;const n=le(e,st.ReferencedSeriesSequence);return void 0!==n&&(t=se(n[0],st.SeriesInstanceUID)),t}function mt(e){const t=le(e,st.ReferencedFrameOfReferenceSequence);if(void 0===t)return;const n=le(t[0],st.RTReferencedStudySequence);if(void 0===n)return;const i=le(n[0],st.RTReferencedSeriesSequence);return void 0!==i?se(i[0],st.SeriesInstanceUID):void 0}class ft{#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,o=e;for(let e=this.length()-1;e>0;--e)n=this.getDimSize(e),t[e]=Math.floor(o/n),o-=t[e]*n;return t[0]=o,new i(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 f(i)}normaliseIndex(e,t){let n;void 0!==t&&(n=t.getValues());const o=this.#G(e.getValues(),n);return new i(o)}}class vt{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 Ct(e,t){return function(e){return null!=e&&(e.includes("median")||e.includes("p25")||e.includes("p75"))}(t)?function(e){const t=Dt(e);return e.sort(function(e,t){return e-t}),t.median=yt(e,.5),t.p25=yt(e,.25),t.p75=yt(e,.75),t}(e):Dt(e)}function Dt(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 vt(t,n,a,l)}function yt(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 It=1e-6;class wt{#z;#H;#Y;#X={};#W;#$=Ze();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 wt(this.#z.slice(),new ft(this.#H.getValues()),new at(this.#Y.getValues()),new je(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=Tt([this.#H.get(0),this.#H.get(1),this.#H.get(2)],e);n=n.map(Math.abs),t=new ft(n.concat(this.#H.getValues().slice(3)))}return t}updateSliceSpacing(){const e=Pt(this.#z);if(void 0!==e){1!==this.#Y.get(2)&&this.#Y.get(2)!==e&&o.debug(`Using geometric spacing ${e} instead of tag spacing ${this.#Y.get(2)}`);const t=this.#Y.getValues();t[2]=e,this.#Y=new at(t)}}getSpacing(e){let t=this.#Y;if(e&&void 0!==e){let n=Tt([this.#Y.get(0),this.#Y.get(1),this.#Y.get(2)],e);n=n.map(Math.abs),t=new at(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 h(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(),It))return{success:!1,message:"Cannot append a slice with different orientation"};const i=this.canAppendOrigin(e.getOrigin(),e.getInitialTime());return i.success?new r(!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(),It)?new r(!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 r(!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 ft(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 ft(n),this.#Y=new at(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 ft(n),this.#Y=new at(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 i(t),o=new i(this.getSize().getValues());return[this.indexToWorld(n),this.indexToWorld(o)]}indexToWorld(e){const t=this.getSpacing(),n=new S(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 f(o)}pointToWorld(e){const t=this.getSpacing(),n=new S(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 S(o.getX()+i.getX(),o.getY()+i.getY(),o.getZ()+i.getZ())}worldToIndex(e){const t=this.getOrigin(),n=new S(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),o=this.getOrientation().getInverse().multiplyPoint3D(n),r=e.getValues(),a=this.getSpacing();return r[0]=Math.floor(d(o.getX()/a.get(0),5)),r[1]=Math.floor(d(o.getY()/a.get(1),5)),r[2]=Math.floor(d(o.getZ()/a.get(2),5)),new i(r)}worldToPoint(e){const t=this.getOrigin(),n=new S(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 S(o[0],o[1],o[2])}}function Tt(e,t){return t.getInverse().multiplyArray3D(e)}function Lt(e,t){return t.multiplyArray3D(e)}function Pt(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=Dt(t),i=d(n.mean,4);return n.stdDev>1e-4&&o.warn(`Varying slice spacing, value: ${i} (mean: ${n.mean}, min: ${n.min}, max: ${n.max}, stdDev: ${n.stdDev})`),i}const At={GE:"ge",SIEMENS:"siemens",PHILIPS:"philips",HITASHI:"hitashi"};function Ot(e){return se(e,"00080070")}function bt(e){let t;const n=Ot(e);return void 0!==n&&(t=n.toUpperCase().startsWith("SIEMENS")?At.SIEMENS:n.startsWith("GE")?At.GE:n.startsWith("Philips")?At.PHILIPS:n.toLowerCase()),t}const xt="00080016",Et="52009230",Rt="00189087",Ft="00209111",Mt=[{manufacturer:At.SIEMENS,key:"0019100C"},{manufacturer:At.GE,key:"00431039"},{manufacturer:At.HITASHI,key:"00291030"}],qt="1.2.840.10008.5.1.4.1.1.4",Ut="1.2.840.10008.5.1.4.1.1.4.1",Vt="1.2.840.10008.5.1.4.1.1.4.2",Qt="1.2.840.10008.5.1.4.1.1.4.3";function Nt(e){let t;const n=le(e,"00189117");return void 0!==n&&(t=se(n[0],Rt)),t}function Bt(e){let t;const n=le(e,"52009229");if(void 0!==n&&(t=Nt(n[0])),void 0===t){const n=le(e,Et);if(void 0!==n)for(const e of n)if(t=Nt(e),void 0!==t)break}return t}function kt(e){let t;const n=se(e,xt);return n===Ut||n===Vt||n===Qt?(t=Bt(e),void 0===t&&(t=function(e){let t;const n=bt(e);return void 0!==n&&n===At.PHILIPS&&(t=function(e){let t,n=!1;const i=le(e,"00209222");if(void 0!==i)for(const e of i){const t=se(e,"00209165");if(void 0!==t&&"(0018,9087)"===t){n=!0;break}}if(n){const n=le(e,Et);if(void 0!==n){const e=le(n[0],Ft);if(void 0!==e){const n=le(e[0],"00209157");void 0!==n&&(t=n[2])}}}return t}(e)),t}(e),void 0!==t&&o.debug("Got b-value for enhanced MR from non standard tag"))):n===qt&&(t=function(e){let t;if(void 0===t){const n=bt(e),i=se(e,"00080018");let o;o=void 0!==$e.privateBValueRules?$e.privateBValueRules:Mt;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=se(e,r.key)),void 0!==t&&!isNaN(parseInt(t,10)))break}return void 0===t&&(t=se(e,Rt)),t}(e),void 0===t&&void 0===t&&(t=Bt(e))),void 0!==t&&(t=parseInt(t,10)),t}function Gt(e){let t;const n=se(e,xt);if(n===qt||n===Ut||n===Vt||n===Qt){const n=kt(e);void 0!==n&&(t=n)}return t}function zt(e){let t;const n=le(e,Et);if(void 0!==n){for(const e of n){const n=le(e,Ft);if(void 0===n)continue;const i=se(n[0],"00209128");if(void 0!==i){const e=parseInt(i,10);if(void 0===t)t=e;else if(t!==e)return void o.debug("Unhandled varying TemporalPositionIndex")}}return t}}function Ht(e,t){return function(n){let i;const o=se(n,e);return void 0!==o&&(i=t(o)),i}}const Yt=Ht("00200100",e=>parseInt(e,10));function Xt(e){let t;if(void 0!==$e.getVolumeIdTagValue)t=$e.getVolumeIdTagValue(e);else if(t=Yt(e),void 0===t&&(t=zt(e)),void 0===t){const n=Gt(e);void 0!==n&&(t=n)}return t}const Wt=[{name:"TemporalPositionIdentifier",getter:Yt},{name:"TemporalPositionIndex",getter:zt},{name:"DiffusionBValue",getter:Gt},{name:"EchoTime",getter:Ht("00180081",parseFloat)},{name:"TriggerTime",getter:Ht("00181060",parseFloat)},{name:"InversionTime",getter:Ht("00180082",parseFloat)},{name:"AcquisitionTime",getter:Ht("00080032",parseFloat)}],$t="00209116",jt="00289110";function Zt(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}`);o.warn(`Frame origin ${n} is far from reference origin (${i}).`)}}function _t(e,t,n,r){const a=lt(e),s=new ft([a[0],a[1],1]);let l,c;const d=le(e,"52009229");if(void 0!==d){const e=d[0];if(void 0!==e[$t]){const t=e[$t];0!==t.value.length?c=t.value[0]["00200037"].value:o.warn("No shared functional group plane orientation sequence items.")}if(void 0!==e[jt]){const t=e[jt];0!==t.value.length?l=ht(t.value[0]):o.warn("No shared functional group pixel measure sequence items.")}}const h=[];for(let e=0;e<t.length;++e){const n=m(t[e].imagePosPat);if(p(h,n)||h.push(n),void 0!==t[e].imageOrientationPatient)if(void 0===c)c=t[e].imageOrientationPatient;else if(!L(c,t[e].imageOrientationPatient))throw new Error("Unsupported multi orientation frames geometry.");if(void 0!==t[e].spacing)if(void 0===l)l=t[e].spacing;else if(!l.equals(t[e].spacing))throw new Error("Unsupported multi resolution frames geometry.")}if(void 0===l)throw new Error("No spacing found for frames geometry");if(void 0===c)throw new Error("No imageOrientationPatient found for frames geometry");const g=ot(c.map(e=>parseFloat(e)));if(void 0===g)throw new Error("Invalid imageOrientationPatient found for frames geometry");let S;if(void 0===n||!1===n){S=h;const e=Pt(S);2===l.length()?l=new at([l.get(0),l.get(1),e]):l.get(2)!==e&&o.debug(`Different tag spacing from geo spacing: ${l.get(2)} - ${e}`)}else S=void 0!==r?function(e,t){const n=[];n.push(e[0]);let i=e[0].getClosest(t);Zt(e[0],t[i],0);for(let o=1;o<e.length;++o){const r=e[o],a=r.getClosest(t);if(Zt(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}(h,r):function(e,t){const n=[];n.push(e[0]);let r=0;for(let a=1;a<e.length;++a){++r;let s=new i([0,0,r]),l=t.indexToWorld(s).get3D();const c=e[a];let d=c.getDistance(l);const h=d;for(;u(d);)if(o.debug(`Adding intermediate pos pats at ${l.toString()}`),n.push(l),++r,s=new i([0,0,r]),l=t.indexToWorld(s).get3D(),d=c.getDistance(l),d>h)throw new Error("Test distance is increasing when adding intermediate pos pats");n.push(c)}return n}(h,new wt([h[0]],s,l,g));if(3!==l.length())throw new Error("Incomplete spacing found for frames geometry");const f=new wt([S[0]],s,l,g);for(let e=1;e<S.length;++e)f.appendOrigin(S[e],e);const v=Xt(e);return void 0!==v&&f.setInitialTime(v),f}function Kt(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0];let n=4,i=6;return 10===t.length&&(n=5,i=8),{year:parseInt(t.substring(0,4),10),monthIndex:t.length>=n+2?parseInt(t.substring(n,n+2),10)-1:0,day:t.length===i+2?parseInt(t.substring(i,i+2),10):0}}function Jt(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0],n=parseInt(t.substring(0,2),10),i=t.length>=4?parseInt(t.substring(2,4),10):0,o=t.length>=6?parseInt(t.substring(4,6),10):0,r=t.length>=8?t.substring(7,10):0;return{hours:n,minutes:i,seconds:o,milliseconds:0===r?0:parseInt(r,10)*Math.pow(10,3-r.length)}}function en(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 tn(e){let t;return void 0!==e&&(t={year:e.getFullYear(),monthIndex:e.getMonth(),day:e.getDate()}),t}function nn(e){let t;return void 0!==e&&(t={hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}),t}function on(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 rn(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 an="00080100",sn="00080102",ln="00080119",cn="00080120";class un{meaning;value;longValue;urnValue;schemeDesignator;constructor(e){this.meaning=e}toString(){return`(${this.value}, ${this.schemeDesignator}, '${this.meaning}')`}}function dn(e,t){return void 0!==e&&void 0!==t&&e.schemeDesignator===t.schemeDesignator&&e.value===t.value}function hn(e){const t=new un(e["00080104"].value[0]);if(void 0!==e[an])t.value=e[an].value[0];else if(void 0!==e[ln])t.longValue=e[ln].value[0];else{if(void 0===e[cn])throw new Error("Invalid code with no value, no long value and no urn value.");t.urnValue=e[cn].value[0]}if(void 0!==t.value||void 0!==t.longValue){if(void 0===e[sn])throw new Error("No coding sheme designator when code value or long value is present");t.schemeDesignator=e[sn].value[0]}return t}function gn(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 Sn={value:"111017",meaning:"CAD Processing and Findings Summary"},pn={value:"111030",meaning:"Image Region"},mn={value:"111059",meaning:"Single Image Finding"},fn={value:"111099",meaning:"Selected region"},vn={value:"111242",meaning:"All algorithms succeeded; with findings"},Cn={value:"112000",meaning:"Chest CAD Report"},Dn={value:"112020",meaning:"Response Evaluation"},yn={value:"112021",meaning:"Response Evaluation Method"},In={value:"112022",meaning:"RECIST"},wn={value:"112039",meaning:"Tracking Identifier"},Tn={value:"112051",meaning:"Measurement of Response"},Ln={value:"112040",meaning:"Tracking Unique Identifier"},Pn={value:"112048",meaning:"Current Response"},An={value:"113076",meaning:"Segmentation"},On={value:"121055",meaning:"Path"},bn={value:"121106",meaning:"Comment"},xn={value:"121322",meaning:"Source image for image processing operation"},En={value:"121324",meaning:"Source Image"},Rn={value:"122438",meaning:"Reference Points"},Fn={value:"125007",meaning:"Measurement Group"},Mn={value:"125309",meaning:"Short Label"},qn={value:"126000",meaning:"Imaging Measurement Report"},Un={value:"126010",meaning:"Imaging Measurements"},Vn={value:"128773",meaning:"Reference Geometry"},Qn={1483009:"Angle",42798e3:"Area",103355008:"Width",103339001:"Long axis",103340004:"Short axis",131190003:"Radius",261665006:"Unknown",410668003:"Length",718499004:"Color"},Nn={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 Bn(e){const t=new un(e.meaning);return t.schemeDesignator="DCM",t.value=e.value,t}function kn(e,t){let n,i;return"SCT"===t?n=Qn[e]:"UCUM"===t&&(n=Nn[e]),void 0!==n&&(i=new un(n),i.schemeDesignator=t,i.value=e),i}function Gn(){return Bn(An)}function zn(){return kn("718499004","SCT")}const Hn={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"}},Yn={"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 Xn(e){const t=Yn[e];let n;return void 0!==t?n=kn(t,"UCUM"):void 0===t&&(n=kn("1","UCUM")),n}const Wn="00089124",$n="00082112",jn="00081150",Zn="00081155",_n="00209111",Kn="00209164",Jn="00209113",ei="00209116",ti="00289110";class ni{dimIndex;imagePosPat;derivationImages;refSegmentNumber;imageOrientationPatient;spacing;constructor(e,t,n,i){this.dimIndex=e,this.imagePosPat=t,this.derivationImages=n,this.refSegmentNumber=i}}function ii(e){const t=[];if(void 0!==e[Wn]){const n=e[Wn].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][jn]&&(n.referencedSOPClassUID=t[e][jn].value[0]),void 0!==t[e][Zn]&&(n.referencedSOPInstanceUID=t[e][Zn].value[0]),i.push(n)}}t.push({sourceImages:i})}}if(void 0===e[_n])return void o.info("Missing frame content sequence");const n=e[_n].value;if(0===n.length)return void o.info("Empty frame content sequence");const i=n[0]["00209157"].value;let r;const a=e["0062000A"];if(void 0!==a){const e=a.value[0];r=parseInt(e["0062000B"].value[0],10)}if(void 0===e[Jn])return void o.info("Missing plane position sequence");const s=e[Jn].value;if(0===s.length)return void o.info("Empty plane position sequence");const l=s[0]["00200032"].value;for(let e=0;e<l.length;++e)l[e]=parseFloat(l[e]);const c=new ni(i,l,t,r);if(void 0!==e[ei]){const t=e[ei];if(0!==t.value.length){const e=t.value[0]["00200037"].value;void 0!==e&&(c.imageOrientationPatient=e)}}if(void 0!==e[ti]){const t=e[ti];if(0!==t.value.length){const e=ht(t.value[0]);void 0!==e&&(c.spacing=e)}else o.warn("No shared functional group pixel measure sequence items.")}return c}function oi(e,t){const n=le(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(ii(e))}return i}function ri(e){const t={FrameContentSequence:{value:[{DimensionIndexValues:e.dimIndex}]},PlanePositionSequence:{value:[{ImagePositionPatient:e.imagePosPat}]},SegmentIdentificationSequence:{value:[{ReferencedSegmentNumber:e.refSegmentNumber}]}};if(void 0!==e.derivationImages){const n=gn(Bn(xn)),i=gn(Bn(An)),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 ai="00080016",si="00080060",li="00280002",ci="00280100",ui={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 di{#j;#Z;getWarning(){return this.#j}checkElements(e){if(this.#j=void 0,void 0===lt(e))throw new Error("No image rows or columns in DICOM file");if(!G(e))throw new Error("No pixel data in DICOM file");const t=se(e,si);if(void 0!==t&&"PT"===t){const t=gt(e);if(void 0!==(n=se(e,ai))&&/^1\.2\.840\.10008\.5\.1\.4\.1\.1\.7/.test(n)||!St(t))return this.#j;const i=function(e){let t="";const n={};let i;t+=ce(e["00280051"],"Corrected Image (00280051)",["ATTN","DECY"]),t+=ce(e["00541102"],"Decay Correction (00541102)",["START"]),t+=ce(e["00541001"],"Units (00541001)",["BQML"]);const r=e["00101030"],a=ce(r," PatientWeight (00101030)");if(0===a.length){const e=parseFloat(r.value[0]);isNaN(e)?t+=" PatientWeight is not a number":i=e}else t+=a;const s=function(e){let t,n="";const i=Kt(e["00080021"]);let r,a,s;const l=e["00540016"];if(n+=ce(l,"RadiopharmaceuticalInformationSequence (00540016)"),void 0!==l){1!==l.value.length&&o.warn("Found more than 1 istopes in RadiopharmaceuticalInformation Sequence.");const e="RadionuclideTotalDose (00181074)",c=l.value[0]["00181074"];if(t=ce(c,e),0===t.length){const e=parseFloat(c.value[0]);isNaN(e)?n+=" TotalDose is not a number":r=e}else n+=t;const u="RadionuclideHalfLife (00181075)",d=l.value[0]["00181075"];if(t=ce(d,u),0===t.length){const e=parseFloat(d.value[0]);isNaN(e)?n+=" HalfLife is not a number":a=e}else n+=t;const h=l.value[0]["00181078"];let g,S;if(void 0===h)g=i,S=Jt(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 re("DA");n.value=[t.substring(0,8)];const i=Kt(n),o=new re("TM");return o.value=[t.substring(8)],{date:i,time:t.length>=9?Jt(o):void 0}}(h);g=e.date,S=e.time}s=en(g,S)}let c=en(i,Jt(e["00080031"]));const u=e["00080022"],d=e["00080032"];if(void 0!==u&&void 0!==d){const t=Kt(u),i=Jt(d),r=en(t,i);if(c>r){const s=`Series date/time is after Aquisition date/time (diff=${(c.getTime()-r.getTime()).toString()}ms) `;o.debug(s);let l=0;const u="FrameReferenceTime (00541300)",d=e["00541300"];n+=ce(d,u),void 0!==d&&(l=d.value[0]);let h=0;const g="ActualFrameDuration (00181242)",S=e["00181242"];if(n+=ce(S,g),void 0!==S&&(h=S.value[0]),l>0&&h>0){h/=1e3,l/=1e3;const e=Math.log(2)/a,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!==s&&void 0!==r&&void 0!==a){const e=(c.getTime()-s.getTime())/1e3;h=r*Math.pow(2,-e/a)}return{value:h,warning:n}}(e);return t+=s.warning,0!==t.length?n.warning=`Cannot calculate PET SUV: ${t}`:n.value=1e3*i/s.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 se(e,t)};let r,a=i(li);void 0===a&&(a=1);const s=oi(e);if(void 0!==s){const n=[];let i=!0;for(const e of s){const t=m(e.imagePosPat);if(p(n,t)){i=!1;break}n.push(t)}if(i){o.debug("Using frame infos for geometry"),r=_t(e,s),r.sortOrigins();const i=r.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=lt(e),i=n[0]*n[1]*a,o=t.slice();for(let e=0;e<s.length;++e)o.set(t.subarray(e*i,(e+1)*i),l[e]*i);t=o}}}void 0===r&&(r=function(e){const t=lt(e),n=[t[0],t[1],1],i=se(e,"00280008");if(void 0!==i){const e=parseInt(i,10);e>1&&n.push(e)}const r=new ft(n);let a=[1,1,1];const s=dt(e);if(void 0!==s)a=[s[0],s[1],1];else{const t=ct(e,st.PixelAspectRatio);void 0!==t&&(a=[t[0],t[1],1],o.warn("Use pixel aspect ratio as spacing"))}const l=new at(a),c=le(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=le(e,st.ImageOrientationPatient);let n;return void 0!==t&&(n=ot(t.map(e=>parseFloat(e)))),n}(e),h=new S(u[0],u[1],u[2]),g=Xt(e);return new wt([h],r,l,d,g)}(e));const l=r.getSize().getTotalSize(),c=dt(e),u=i("00080018"),d=l*a;if(d!==t.length){if(o.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 ro(r,t,[u]),g=gt(e);void 0!==g&&h.setPhotometricInterpretation(g);const f=i("00280006");void 0!==f&&h.setPlanarConfiguration(f);let v=1;const C=i("00281053");if(void 0!==C){const e=parseFloat(C);isNaN(e)||(v=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,o.info(`Applying PET SUV calibration: ${w}`),v*=w,D*=w);const T=new Me(v,D);if(h.setRescaleSlopeAndIntercept(T),"PALETTE COLOR"===h.getPhotometricInterpretation()){const t=function(e){let t;const n=le(e,"00281101");if(void 0!==n&&3===n.length){let i,r,a;const s=e["00281201"],l=e["00281202"],c=e["00281203"];if(16===n[2]){let t=!1,u=n[0];0===u&&(u=65536);const d=s.vl;if(d!==2*u&&(t=!0,o.info(`16bits lut but size is not double. desc: ${u} vl: ${d}`)),8===parseInt(se(e,ci),10)&&(t=!0,o.info("Scaling 16bits color lut since bits allocated is 8.")),t){const e=function(e){return e>>8};i=s.value.map(e),r=l.value.map(e),a=c.value.map(e)}}else if(8===n[2]){o.info("Scaling 16bits color lut since the lut descriptor is 8.");let e=s.value.slice(0);i=Array.from(new Uint8Array(e.buffer)),e=l.value.slice(0),r=Array.from(new Uint8Array(e.buffer)),e=c.value.slice(0),a=Array.from(new Uint8Array(e.buffer))}t=new Xe(i,r,a)}return t}(e);void 0!==t&&h.setPaletteColourMap(t)}const L={numberOfFiles:n};L.TransferSyntaxUID=i("00020010"),L.MediaStorageSOPClassUID=i("00020002"),L.SOPClassUID=i(ai),L.Modality=i(si),L.ImageType=i("00080008"),L.SamplesPerPixel=i(li),L.PhotometricInterpretation=i("00280004"),L.PixelRepresentation=i("00280103"),L.BitsAllocated=i(ci),L.BitsStored=i("00280101"),L.HighBit=i("00280102");const P=Object.keys(ui);for(const e of P)L[e]=i(ui[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=se(e,st[i]),void 0!==t)break;if(void 0===t){const n=se(e,st.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=le(e,"00281050"),r=le(e,"00281051");if(void 0!==i&&void 0!==r){n={};const a=le(e,"00281055");let s;for(let e=0;e<i.length;++e){const l=parseFloat(i[e]);let c=parseFloat(r[e]);l&&c&&0!==c&&(s="",void 0!==a&&(s=a[e]),""===s&&(s=`Default${e}`),c*=t,c<1&&(c=1),n[s]=new Ge(s,[new Ne(l*t,c)])),0===c&&o.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 hi(e){return function(t,n){if("mergeId"===n)return t;const i=F(n),o=ne(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(hi(t),{}))}}else s=1===a.value.length?a.value[0]:a.value;return t[r]=s,t}}function gi(e){const t=structuredClone(e);return Object.keys(t).reduce(hi(t),{})}function Si(e,t){const n=Object.keys(t);for(const i of n)void 0!==e[i]&&o.debug(`Overwritting tag: ${i}`),e[i]=t[i]}function pi(e){const t=Object.keys(e),n={};for(const i of t){const t=oe(i);if(void 0===t)continue;const r=ne(t),a=r?.getVr();let s,l=!1;const c=e[i];if("SQ"===a){const e=[],t=c;if(void 0!==t.undefinedLength&&(l=t.undefinedLength),Array.isArray(t.value))for(const n of t.value)e.push(pi(n));else o.debug("Non array simpleTag SQ value");s=e}else s=Array.isArray(c)?c:[c];const u=new re(a);u.tag=t,u.value=s,l&&(u.undefinedLength=l),n[t.getKey()]=u}return n}class mi{r;g;b;constructor(e,t,n){this.r=e,this.g=t,this.b=n}}function fi(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 vi(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 Ci(e){return{r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)}}function Di(e){return`#${((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)}`}function yi(e){return{l:.001525902*e.l,a:.003891051*e.a-128,b:.003891051*e.b-128}}function Ii(e){return{l:655.35*e.l,a:257*e.a+32896,b:257*e.b+32896}}const wi={x:95.0489,y:100,z:108.884};function Ti(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=wi,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 Li(e){return function(e){function t(e){let t;return t=e>.008856452?Math.pow(e,.333333333):7.787037037*e+.137931034,t}const n=wi,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 Pi(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 Ai=[new mi(0,0,0),new mi(255,0,0),new mi(0,255,0),new mi(0,0,255),new mi(255,255,0),new mi(0,255,255),new mi(255,0,255),new mi(255,239,213),new mi(0,0,205),new mi(205,133,63),new mi(210,180,140),new mi(102,205,170),new mi(0,0,128),new mi(0,139,139),new mi(46,139,87),new mi(255,228,225)];function Oi(e){let t;return t=e<Ai.length?Ai[e]:new mi(255*Math.random(),255*Math.random(),255*Math.random()),t}const bi="00620005",xi="00620009",Ei="0062000C",Ri="0062000D",Fi="00620003",Mi="0062000F",qi="00620020";class Ui{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 Vi(e){const t=new Ui(e["00620004"].value[0],e[bi]?e[bi].value[0]:"n/a",e["00620008"].value[0]);if(void 0!==e[xi]&&(t.algorithmName=e[xi].value[0]),void 0!==e[Ei])t.displayValue=e[Ei].value[0];else if(void 0!==e[Ri]){const n=e[Ri].value,i=Ti(yi({l:n[0],a:n[1],b:n[2]}));t.displayRGBValue=i}else o.warn("No recommended colour for segment, using default"),t.displayRGBValue=Oi(t.number);if(void 0===e[Fi])throw new Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=hn(e[Fi].value[0]),void 0===e[Mi])throw new Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=hn(e[Mi].value[0]),void 0!==e[qi]&&(t.trackingId=e[qi].value[0],t.trackingUid=e["00620021"].value[0]),t}function Qi(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=Ii(Li(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:[gn(e.propertyCategoryCode)]}),e.propertyTypeCode&&(n.SegmentedPropertyTypeCodeSequence={value:[gn(e.propertyTypeCode)]}),e.trackingId&&(n.TrackingID=e.trackingId,n.TrackingUID=e.trackingUid),n}class Ni{#_=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 Bi(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 ki{#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&&o.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=Bi(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 Ni,this.#se.initialize(r,t),this.#le=i,this.#se}}const Gi={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 zi(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(L(t.enum[e],i)){o=!0;break}}else o=t.enum.includes(i);if(!o)throw new Error(`Unsupported ${t.name} value: ${i}`)}const Hi=[{name:"TransferSyntaxUID",tag:"00020010",type:"1",enum:[K,J,ee]},{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 Yi(){const e={};for(const t of Hi)e[t.name]=t.enum[0];return e}class Xi{#j;getWarning(){return this.#j}checkElements(e){}create(e,t,n){const i=function(t){return se(e,t)};for(const t of Hi)zi(e,t);const o=lt(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][Kn].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][Kn].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=le(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=Vi(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 Xe(u,d,h));const p=function(e,t){return e.findIndex(function(e){return t.equals(e)})},f=oi(e,a);if(void 0===f)throw new Error("Missing or empty per frame functional sequence");let v;void 0!==n&&(v=n.getGeometry().getOrigins());const C=_t(e,f,!0,v);C.sortOrigins();const D=C.getSize().get(2),y=function(e){return function(t){return t.number===e}},I=new ki(C),w=C.getOrigins();let T;for(let e=0;e<f.length;++e){if(T=p(w,m(f[e].imagePosPat)),-1===T)throw new Error("Cannot find frame origin in mask origins");const n=c.find(y(f[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 ro(C,I.getLabelMap(),L);P.setSegmentCollection(I),S&&(P.setPhotometricInterpretation("PALETTE COLOR"),P.setPaletteColourMap(g));const A=Yi(),O=Object.keys(Gi);for(const e of O)A[e]=i(Gi[e]);return A.DimensionOrganizationSequence=s.organizations,A.DimensionIndexSequence=s.indices,A.custom={segments:c,frameInfos:f,SOPInstanceUID:i("00080018"),referencedSeriesUID:pt(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=on(tn(s)),o.ContentTime=rn(nn(s)),void 0!==n&&(o.StudyInstanceUID=n.getMeta().StudyInstanceUID);const l=[];for(const e of t)l.push(Qi(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 ni([t,r.length-i],l,void 0,t);if(void 0!==n){const e=n.getGeometry().worldToIndex(new f([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(ri(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&&Si(o,i);const m=pi(o),v=a.getDimSize(2),C=g.length*v/8,D=new re("OB");return D.tag=new E("7FE0","0010"),D.vl=C,D.value=g,m["7FE00010"]=D,m}}function Wi(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 r=i.getSize().get(2)>n.getSize().get(2),a=r?i:n,s=a.getOrigins(),l=a.getSize().getDimSize(2),c=function(e,t){return e.getOrigins().map((e,n)=>{let i=-1,r=1/0;for(let t=0;t<s.length;++t){const n=e.getDistance(s[t]);n<r&&(r=n,i=t)}if(r>.01)throw new Error(`mergeMaskImages: mask${t} slice ${n} has no matching slice in the merged geometry`);return r>1e-4&&o.warn(`mergeMaskImages: mask${t} slice ${n} is far from its closest merged-geometry slice (${r}).`),i})},u=r?c(n,"1"):void 0,d=r?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++;o.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 ki(a),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=s.map((e,t)=>t.toString()),P=new ro(a,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 Xe(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 ji(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 ji{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 Zi{constructor(e,t){this.startMessage=e,this.info=t}getWorker(){}}function _i(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 Ki extends Zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/labeling.worker.min.js",import.meta.url),{name:"labeling.worker",type:"module"})}}class Ji{#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 Ki(function(e,t){return{imageBuffer:e,..._i(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=_i(i,t.getSpacing());this.#Se.addWorkerTask(new Ki({segmentSlice:{segNumber:n,slices:o},...e},{}))}}ondone(e){}}class eo extends Zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/resampling.worker.min.js",import.meta.url),{name:"resampling.worker",type:"module"})}}class to{#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 S(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),p=[u[0]*g,u[1]*g,u[2]*g],m=a.length();for(let e=3;e<m;e++)p.push(a.get(e));const f=new at(p),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 S(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])/f.get(0))),Math.round(Math.abs((D[1]-y[1])/f.get(1))),Math.round(Math.abs((D[2]-y[2])/f.get(2)))],w=r.length();for(let e=3;e<w;e++)I.push(r.get(e));const T=new ft(I),L=void 0===n?new S(r.get(0)/2,r.get(1)/2,r.get(2)/2):e.worldToPoint(n),P=[0,0,0];if(void 0===n)P[0]=T.get(0)/2,P[1]=T.get(1)/2,P[2]=T.get(2)/2;else{const e=[(L.getX()-r.get(0)/2)*a.get(0),(L.getY()-r.get(1)/2)*a.get(1),(L.getZ()-r.get(2)/2)*a.get(2)],t=o.multiplyArray3D(e);P[0]=t[0]/f.get(0)+T.get(0)/2,P[1]=t[1]/f.get(1)+T.get(1)/2,P[2]=t[2]/f.get(2)+T.get(2)/2}const A=new S(P[0]*f.get(0),P[1]*f.get(1),P[2]*f.get(2)),O=t.multiplyPoint3D(A),b=e.pointToWorld(L),x=new S(b.getX()-O.getX(),b.getY()-O.getY(),b.getZ()-O.getZ()),E=[0,0,f.get(2)],R=t.multiplyArray3D(E),F=[];for(let e=0;e<T.get(2);e++)F.push(new S(x.getX()+R[0]*e,x.getY()+R[1]*e,x.getZ()+R[2]*e));return new wt(F,T,f,t)}(t,i,r),l=function(e,t,n){const i=Le(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 eo(e,{});this.#Se.addWorkerTask(t)}),{buffer:l,geometry:s,jobId:a}}ondoneframe(e){}ondone(e){}}const no=["imagecontentchange","imagegeometrychange","imageresamplingstart","imageresamplingcomplete","imageresampled","labelingstart","labelschanged"];function io(e){return(new di).create(e,e["7FE00010"].value[0],1)}function oo(e){return(new Xi).create(e,e["7FE00010"].value[0])}class ro extends EventTarget{#ie;#d;#pe;#me;#fe;#ve;#Ce;#De;#ye=new Me(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 Ni,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 ki(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 St(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]:o.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 ro(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=Le(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 r(!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(),o=this.getDataRange();this.#xe={min:Math.min(n.min,o.min),max:Math.max(n.max,o.max)};const r=e.getRescaledDataRange(),a=this.getRescaledDataRange();this.#Ee={min:Math.min(r.min,a.min),max:Math.max(r.max,a.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(),o=[];return o.push(0),o.push(0),o.push(e.getSliceIndex(t.getOrigin(),n)),void 0!==n&&o.push(n),new i(o)}(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)&&!Be(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)&&!Be(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 r=i*this.#be.numberOfFiles;this.#d.length!==r&&(this.#Ne(r),this.#pe.isInitialized()&&this.#pe.realloc(this.#d,this.#ie.getSize())),t>=this.#be.numberOfFiles?o.warn(`Ignoring frame at index ${t} (size: ${this.#be.numberOfFiles})`):(this.#d.set(e,i*t),this.appendFrame(t,new S(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=Fe(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,o){const r=[e,t,n];void 0!==o&&r.push(o);const a=new i(r);return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(a))}getValueAtIndex(e){return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValue(e,t,n,o){let r=this.getValue(e,t,n,o);if(!this.isIdentityRSI())if(this.isConstantRSI())r=this.getRescaleSlopeAndIntercept().apply(r);else{const a=[e,t,n];void 0!==o&&a.push(o);const s=new i(a);r=this.getRescaleSlopeAndIntercept(s).apply(r)}return r}getRescaledValueAtIndex(e){return this.getRescaledValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValueAtOffset(e){let t=this.getValueAtOffset(e);if(!this.isIdentityRSI())if(this.isConstantRSI())t=this.getRescaleSlopeAndIntercept().apply(t);else{const n=this.getGeometry().getSize().offsetToIndex(e);t=this.getRescaleSlopeAndIntercept(n).apply(t)}return t}calculateDataRange(){let e,t=this.getValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();i.length()>=3&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateRescaledDataRange(){if(this.isIdentityRSI())return this.getDataRange();if(this.isConstantRSI()){const e=this.getDataRange(),t=this.getRescaleSlopeAndIntercept().apply(e.min),n=this.getRescaleSlopeAndIntercept().apply(e.max);return{min:t<n?t:n,max:t>n?t:n}}let e,t=this.getRescaledValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();3===i.length()&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getRescaledValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateHistogram(){const e=this.getGeometry().getSize(),t=[];let n,i,o=this.getValueAtOffset(0),r=o,a=this.getRescaledValueAtOffset(0),s=a;for(let l=0,c=e.getTotalSize();l<c;++l)n=this.getValueAtOffset(l),n>r&&(r=n),n<o&&(o=n),i=this.getRescaledValueAtOffset(l),i>s&&(s=i),i<a&&(a=i),t[i]=(t[i]||0)+1;const l={min:o,max:r},c={min:a,max:s},u=[];for(let e=a;e<=s;++e)u.push([e,t[e]||0]);return{dataRange:l,rescaledDataRange:c,histogram:u}}convolute2D(e){if(9!==e.length)throw new Error(`The convolution matrix does not have a length of 9; it has ${e.length}`);const t=this.clone(),n=t.getBuffer(),i=this.getGeometry().getSize(),o=i.getDimSize(2)*this.getNumberOfComponents();for(let t=0;t<i.get(2);++t)this.convoluteBuffer(e,n,t*o);return t}convoluteBuffer(e,t,n){const i=this.getGeometry().getSize(),o=i.get(0),r=i.get(1),a=this.getNumberOfComponents();let s=1,l=1;3===a&&(0===this.getPlanarConfiguration()?s=3:l=i.getDimSize(2));const c=[];c[0]=(-o-1)*s,c[1]=-o*s,c[2]=(1-o)*s,c[3]=-s,c[4]=0,c[5]=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 o=1,r="unit.pixel";"unit.mm"===n&&(o=t.get(0)*t.get(1)*t.get(2)*.001,r="unit.ml");for(const t of e){let e,a;t.centroid=this.#ie.indexToWorld(new i(t.centroidIndex)),t.volume={value:t.count*o,unit:r},void 0!==t.diameters&&(void 0!==t.diameters.major&&(e=t.diameters.major.diameter),void 0!==t.diameters.minor&&(a=t.diameters.minor.diameter)),t.diameters={major:{diameter:{value:e,unit:n}},minor:{diameter:{value:a,unit:n}}},t.height={value:t.height,unit:n}}const a=e.sort((e,t)=>t.volume.value-e.volume.value).sort((e,t)=>e.id-t.id);this.dispatchEvent(new CustomEvent("labelschanged",{detail:{labels:a}}))}#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 ft([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 Ji,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 to,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 ao=["annotationgroupeditablechange","annotationadd","annotationupdate","annotationremove"];class so 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}}))):o.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 o.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 lo{#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=Ci(e)).r+.002301961*t.g+447059e-9*t.b<.5;var t}(this.getLineColour())?"#fff":"#000"}}class co{#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 Ne(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(Pi(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=uo(n.drawings).toObject(),t.drawingsDetails=ho(n.drawingsDetails),(t=go(t)).drawings=So(t.drawings),t}#ot(e){return e.drawings=uo(e.drawings).toObject(),e.drawingsDetails=ho(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=go(e)).drawings=So(e.drawings),e}#rt(e){return e.drawingsDetails=ho(e.drawingsDetails),(e=go(e)).drawings=So(e.drawings),e}#at(e){return(e=go(e)).drawings=So(e.drawings),e}#st(e){return e}}function uo(t){let n,o,r;function a(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(o=l[t][c],0!==o.length){r=new e.Group({id:a(new i([1,1,t,c])),name:"position-group",visible:!1});for(let t=0,i=o.length;t<i;++t)n=e.Node.create(o[t]),n.draggable(!0),n.getChildren().forEach(function(e){e.draggable(!1)}),r.add(n);s.add(r)}return s}function ho(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 go(e){const t=e.position;return e.position=[t.i,t.j,t.k],e}function So(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 po(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 mo(e){const t=po(e);return 0===Object.keys(t).length?null:t.query}function fo(e){let t;const n=mo(e);return n&&void 0!==n.input&&(t=Co(n.input,n.dwvReplaceMode)),t}function vo(e,t){const n=mo(e);n&&void 0!==n.input&&Do(n.input,n.nslices,t)}function Co(e,t){const n=[];let i="key";t&&(i=t);const o=decodeURIComponent(e),r=po(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 Do(e,t,n){let i="";"/"===e[0]&&(i=`${window.location.protocol}//${window.location.host}`),i+=e;const r=new XMLHttpRequest;r.open("GET",decodeURIComponent(i),!0),r.responseType="document",r.onload=function(e){n(function(e,t){const n=[],i=`${e.getElementsByTagName("wado_query")[0].getAttribute("wadoURL")}?requestType=WADO&contentType=application/dicom&`,r=e.getElementsByTagName("Patient");r.length>1&&o.warn("More than one patient, loading first one.");const a=r[0].getElementsByTagName("Study");a.length>1&&o.warn("More than one study, loading first one.");const s=a[0].getAttribute("StudyInstanceUID"),l=a[0].getElementsByTagName("Series");l.length>1&&o.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=${s}&seriesUID=${c}&objectUID=${u[e].getAttribute("SOPInstanceUID")}`;n.push(t)}return n}(e.target.responseXML,t))},r.onerror=function(e){o.warn(`RequestError while receiving manifest: ${e.target.status}`)},r.send(null)}const yo=["mousedown","mousemove","mouseup","mouseout","wheel","dblclick","touchstart","touchmove","touchend"];function Io(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 g(e[t].clientX-n,e[t].clientY-i));return o}function wo(e){const t=e.currentTarget.getBoundingClientRect();let n=[];return void 0!==e.targetTouches&&0!==e.targetTouches.length?n=Io(e.targetTouches,t):void 0!==e.changedTouches&&0!==e.changedTouches.length&&(n=Io(e.changedTouches,t)),n}function To(e){return new g(e.offsetX,e.offsetY)}function Lo(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 Po{#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=yo;for(let n=0;n<t.length;++n)e.addEventListener(t[n],this.#ht(e.getId(),t[n]))}#pt(e){e.unbindInteraction();const t=yo;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 Ao{#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 Oo{onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class bo extends Oo{#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&&(C(e[0],"DICOMDIR")||C(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 Ao(this.onprogress);n.setNToLoad(e.length);const i=Bs(),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 be;return t.parse(e),function(e){const t=e["00041220"];if(void 0===t||void 0===t.value)return void o.warn("No Directory Record Sequence found in DICOMDIR.");const n=t.value;if(0===n.length)return void o.warn("The Directory Record Sequence of the DICOMDIR is empty.");const i=[];let r=null,a=null;for(let e=0;e<n.length;++e){const t=n[e]["00041430"];if(void 0===t||void 0===t.value)continue;const o=t.value[0];if("STUDY"===o)a=[],i.push(a);else if("SERIES"===o)r=[],a.push(r);else if("IMAGE"===o){const t=n[e]["00041500"];if(void 0===t||void 0===t.value)continue;const i=t.value;r.push(i.join("/"))}}return i}(t.getDicomElements())}(n.target.response)[0][0],r=e.split("/").slice(0,-1).join("/"),a=[];for(let e=0;e<i.length;++e)a.push(`${r}/${i[e]}`);this.#Vt(a,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 xo extends Zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/jpegbaseline.worker.min.js",import.meta.url),{name:"jpegbaseline.worker",type:"module"})}}class Eo extends Zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/jpegloss.worker.min.js",import.meta.url),{name:"jpegloss.worker",type:"module"})}}class Ro extends Zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/jpeg2000.worker.min.js",import.meta.url),{name:"jpeg2000.worker",type:"module"})}}class Fo extends Zi{constructor(e,t){super(e,t)}getWorker(){return new Worker(new URL("./assets/workers/rle.worker.min.js",import.meta.url),{name:"rle.worker",type:"module"})}}class Mo{#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 xo(i,n):"jpeg-lossless"===this.#Nt?o=new Eo(i,n):"jpeg2000"===this.#Nt?o=new Ro(i,n):"rle"===this.#Nt&&(o=new Fo(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",Uo="0040A161",Vo="0040A162",Qo="0040A163",No="004008EA";class Bo{numericValue;floatingPointValue;rationalNumeratorValue;rationalDenominatorValue;measurementUnitsCode;toString(){return`${this.numericValue} ${this.measurementUnitsCode.toString()}`}}function ko(e){const t={};return void 0!==e.measurementUnitsCode&&(t.MeasurementUnitsCodeSequence={value:[gn(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 Go="0040A300",zo="0040A301";class Ho{measuredValue;numericValueQualifierCode;toString(){let e="";return void 0!==this.measuredValue&&(e+=this.measuredValue.toString()),void 0!==this.numericValueQualifierCode&&(e+=` ${this.numericValueQualifierCode.toString()}`),e}}function Yo(e){const t={};return void 0!==e.measuredValue&&(t.MeasuredValueSequence={value:[ko(e.measuredValue)]}),void 0!==e.numericValueQualifierCode&&(t.NumericValueQualifierCodeSequence={value:[gn(e.numericValueQualifierCode)]}),t}const Xo="00081150",Wo="00081155";class $o{referencedSOPClassUID;referencedSOPInstanceUID;toString(){return`${this.referencedSOPInstanceUID} (class: ${this.referencedSOPClassUID})`}}function jo(e){const t=new $o;return void 0!==e[Xo]&&(t.referencedSOPClassUID=e[Xo].value[0]),void 0!==e[Wo]&&(t.referencedSOPInstanceUID=e[Wo].value[0]),t}function Zo(e){const t={};return void 0!==e.referencedSOPClassUID&&(t.ReferencedSOPClassUID=e.referencedSOPClassUID),void 0!==e.referencedSOPInstanceUID&&(t.ReferencedSOPInstanceUID=e.referencedSOPInstanceUID),t}const _o="00081160",Ko="00081199",Jo="0062000B";class er{referencedSOPSequence;referencedFrameNumber;referencedSegmentNumber;toString(){let e=this.referencedSOPSequence.toString();return void 0!==this.referencedFrameNumber&&(e+=`, frame: ${this.referencedFrameNumber}`),e}}function tr(e){const t={};return void 0!==e.referencedFrameNumber&&(t.ReferencedFrameNumber=e.referencedFrameNumber),void 0!==e.referencedSOPSequence&&(t.ReferencedSOPSequence={value:[Zo(e.referencedSOPSequence)]}),void 0!==e.referencedSegmentNumber&&(t.ReferencedSegmentNumber=e.referencedSegmentNumber),t}class nr{#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 g((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 nr(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 ir(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 or(e,t){const n=e.getDeltaX(),i=e.getDeltaY();return n*t.getDeltaX()+i*t.getDeltaY()===0}function rr(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 sr(o,t.getY()-o*t.getX(),t,n,i)}function ar(e,t,n,i){const o=sr(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(),rr(e,r,n,i)}function sr(e,t,n,i,o){let r,a,s,c;if(void 0===o&&(o={x:1,y:1}),l(e,0,1e-4))r=n.getX()-i/(2*o.x),a=n.getY(),s=n.getX()+i/(2*o.x),c=n.getY();else if(Math.abs(e)>1e6)r=n.getX(),a=n.getY()-i/(2*o.y),s=n.getX(),c=n.getY()+i/(2*o.y);else{const l=o.x*o.x,u=o.y*o.y,d=i/(2*Math.sqrt(l+u*e*e));r=n.getX()-d,a=e*r+t,s=n.getX()+d,c=e*s+t}return new nr(new g(r,a),new g(s,c))}class lr{#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=ir(new nr(this.#Ht[0],this.#Ht[1]),new nr(this.#Ht[1],this.#Ht[2]));e>180&&(e=360-e),n={value:e,unit:"unit.degree"}}return{angle:n}}}class cr{#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 g(o*n,o*i)}return e}}class ur{#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=Ct(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 dr{#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=Ct(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 hr(e,t,n){const o=e.getValues(),r=o.slice(),a=[],s=t[0],l=t[1],c=s/l,u=Math.pow(l,2),d=n[0],h=n[1];for(let e=0;e<l;++e){const t=Math.round(c*Math.sqrt(u-Math.pow(e,2))),n=o[h]+e,s=o[h]-e;for(let e=0;e<t;++e){const t=o[d]+e,l=o[d]-e;r[d]=t,r[h]=n,a.push(new i(r.slice())),s!==n&&(r[h]=s,a.push(new i(r.slice()))),l!==t&&(r[d]=l,r[h]=n,a.push(new i(r.slice())),s!==n&&(r[h]=s,a.push(new i(r.slice()))))}}return a}class gr{#Gt;#zt;constructor(e,t){this.#Gt=new g(Math.min(e.getX(),t.getX()),Math.min(e.getY(),t.getY())),this.#zt=new g(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 g(Math.round(this.getBegin().getX()),Math.round(this.getBegin().getY())),max:new g(Math.round(this.getEnd().getX()),Math.round(this.getEnd().getY()))}}getCentroid(){return new g(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=Ct(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 Sr(e,t,n){const o=e.getValues(),r=o.slice(),a=[],s=t[0],l=Math.floor(s/2),c=t[1],u=Math.floor(c/2),d=n[0],h=n[1];for(let e=0;e<c;++e){r[h]=o[h]-u+e;for(let e=0;e<s;++e)r[d]=o[d]-l+e,a.push(new i(r.slice()))}return a}class pr{#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 g((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 nr(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 g(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,S=new g(l.getX()+c*d,l.getY()+u*d),p=new g(l.getX()-c*h,l.getY()-u*h);i=new nr(S,p).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 mr="00480301",fr="00700022",vr="00700023",Cr="0070031A",Dr="POINT",yr="MULTIPOINT",Ir="POLYLINE",wr="CIRCLE",Tr="ELLIPSE";class Lr{graphicData;graphicType;pixelOriginInterpretation;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Pr(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 Ar(e){const t=new Lr;if(e instanceof g)t.graphicData=[e.getX().toString(),e.getY().toString()],t.graphicType=Dr;else if(e instanceof nr)t.graphicData=[e.getBegin().getX().toString(),e.getBegin().getY().toString(),e.getEnd().getX().toString(),e.getEnd().getY().toString()],t.graphicType=Ir;else if(e instanceof lr){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=Ir}else if(e instanceof cr){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=Ir}else if(e instanceof ur){const n=e.getCenter(),i=new g(n.getX()+e.getRadius(),n.getY());t.graphicData=[n.getX().toString(),n.getY().toString(),i.getX().toString(),i.getY().toString()],t.graphicType=wr}else if(e instanceof dr){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=Tr}else if(e instanceof gr){const n=e.getBegin(),i=e.getEnd();t.graphicData=[n.getX().toString(),n.getY().toString(),n.getX().toString(),i.getY().toString(),i.getX().toString(),i.getY().toString(),i.getX().toString(),n.getY().toString(),n.getX().toString(),n.getY().toString()],t.graphicType=Ir}else if(e instanceof pr){let n=0,i=0;const o=e.getBegin(),r=e.getEnd(),a=e.shortAxisCenter instanceof g?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 g(a.getX()+n*u,a.getY()+i*u),S=new g(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(),S.getX().toString(),S.getY().toString()],t.graphicType=Ir}return t}function Or(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 g(parseFloat(e.graphicData[i]),parseFloat(e.graphicData[i+1])));let i=!1;const r=n.length;if(r>2){const e=n[0],t=n[r-1];i=e.equals(t)}let a;if(e.graphicType===Dr)n.length>1&&o.warn(`Expecting 1 point for point, got ${r}`),a=n[0];else if(e.graphicType===wr){if(n.length<2)throw new Error(`Expecting 2 points for circles, got ${r}`);n.length>2&&o.warn(`Expecting 2 points for circles, got ${r}`);const e=n[0],t=n[1].getDistance(e);a=new ur(e,t)}else if(e.graphicType===Tr){if(n.length<4)throw new Error(`Expecting 4 points for ellipses, got ${r}`);n.length>4&&o.warn(`Expecting 4 points for ellipses, got ${r}`);const e=n[0].getDistance(n[1])/2,t=n[2].getDistance(n[3])/2,i=new g(n[0].getX()+e,n[0].getY());a=new dr(i,e,t)}else if(e.graphicType===Ir)if(i)if(5===n.length){const e=new nr(n[0],n[1]),t=new nr(n[1],n[2]),i=new nr(n[2],n[3]),o=new nr(n[3],n[4]);a=or(e,t)&&or(t,i)&&or(i,o)?new gr(n[0],n[2]):new cr(n.slice(0,-1))}else a=new cr(n.slice(0,-1));else if(2===n.length)a=new nr(n[0],n[1]);else if(3===n.length)a=new lr([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 r=.5;a=new pr(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(),S=Math.sqrt(c*c+u*u),p=Math.sqrt(d*d+h*h),m=S+p,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&&(r=(t*f+n*v)/i),D=Math.max(0,Math.min(1,r))}a.shortAxisLength=m,a.shortAxisT=D,a.shortAxisL1=S,a.shortAxisL2=p,a.shortAxisCenter=new g(s,l),a.hasShortAxisInteraction=!0}return a}const br="00700022",xr="00700023",Er="30060024",Rr="0070031A";class Fr{graphicData;graphicType;referencedFrameofReferenceUID;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Mr(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"},Ur="CONTAINS",Vr="HAS PROPERTIES",Qr="HAS OBS CONTEXT",Nr="INFERRED FROM",Br="SELECTED FROM",kr="HAS CONCEPT MOD",Gr="TEXT",zr="NUM",Hr="CODE",Yr="UIDREF",Xr="COMPOSITE",Wr="IMAGE",$r="SCOORD",jr="SCOORD3D",Zr="CONTAINER",_r="SEPARATE",Kr={TEXT:"TextValue",DATE:"Date",TIME:"Time",DATETIME:"DateTime",UIDREF:"UID",PNAME:"PersonName",CONTAINER:"ContinuityOfContent"};function Jr(e){let t;const n=se(e,qr.ContentTemplateSequence);if(void 0!==n){const e=se(n,qr.MappingResource),i=se(n,qr.TemplateIdentifier);void 0!==e&&void 0!==i&&(t=`${e}-${i}`)}return t}class ea{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&&dn(this.conceptNameCode,t)&&this.relationshipType===n}}function ta(e){let t=se(e,qr.ValueType);void 0===t&&(t="");const n=new ea(t);n.relationshipType=se(e,qr.RelationshipType);const i=se(e,qr.ConceptNameCodeSequence);if(void 0!==i&&(n.conceptNameCode=hn(i)),t===Hr)n.value=hn(se(e,qr.ConceptCodeSequence));else if(t===zr)n.value=function(e){const t=new Ho;return void 0!==e[Go]&&(t.measuredValue=function(e){const t=new Bo;return void 0!==e[qo]&&(t.numericValue=parseFloat(e[qo].value[0])),void 0!==e[Uo]&&(t.floatingPointValue=parseFloat(e[Uo].value[0])),void 0!==e[Vo]&&(t.rationalNumeratorValue=parseInt(e[Vo].value[0],10)),void 0!==e[Qo]&&(t.rationalDenominatorValue=parseInt(e[Qo].value[0],10)),void 0!==e[No]&&(t.measurementUnitsCode=hn(e[No].value[0])),t}(e[Go].value[0])),void 0!==e[zo]&&(t.numericValueQualifierCode=hn(e[zo].value[0])),t}(e);else if(t===Wr)n.value=function(e){const t=new er;return void 0!==e[_o]&&(t.referencedFrameNumber=e[_o].value[0]),void 0!==e[Ko]&&(t.referencedSOPSequence=jo(e[Ko].value[0])),void 0!==e[Jo]&&(t.referencedSegmentNumber=e[Jo].value[0]),t}(e);else if(t===Xr)n.value=jo(se(e,qr.ReferencedSOPSequence));else if(t===$r)n.value=function(e){const t=new Lr;return void 0!==e[fr]&&(t.graphicData=e[fr].value),void 0!==e[vr]&&(t.graphicType=e[vr].value[0]),void 0!==e[mr]&&(t.pixelOriginInterpretation=e[mr].value[0]),void 0!==e[Cr]&&(t.fiducialUID=e[Cr].value[0]),t}(e);else if(t===jr)n.value=function(e){const t=new Fr;return void 0!==e[br]&&(t.graphicData=e[br].value),void 0!==e[xr]&&(t.graphicType=e[xr].value[0]),void 0!==e[Er]&&(t.referencedFrameofReferenceUID=e[Er].value[0]),void 0!==e[Rr]&&(t.fiducialUID=e[Rr].value[0]),t}(e);else{const i=Kr[t];void 0!==i?n.value=se(e,qr[i]):console.warn(`Unsupported input ValueType: ${t}`)}const o=le(e,qr.ContentSequence);if(void 0!==o)for(const e of o)n.contentSequence.push(ta(e));return n}function na(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:[gn(e.conceptNameCode)]}),"CODE"===e.valueType)t.ConceptCodeSequence={value:[gn(e.value)]};else if(e.valueType===zr)t={...t,...Yo(e.value)};else if(e.valueType===Wr)t={...t,...tr(e.value)};else if(e.valueType===Xr)t={...t,...Zo(e.value)};else if(e.valueType===$r)t={...t,...Pr(e.value)};else if(e.valueType===jr)t={...t,...Mr(e.value)};else{const n=Kr[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(na(n))}return t}function ia(e,t,n,i){const o=function(e){const t=Hn[e];let n;return void 0!==t&&(n="DCM"===t.scheme?Bn({meaning:e,value:t.key}):kn(t.key,t.scheme)),n}(e);if(void 0===o)return;let r=Ur;void 0!==i&&(r=i);const a=new ea(zr);a.relationshipType=r,a.conceptNameCode=o;const s=new Bo;s.numericValue=t,s.measurementUnitsCode=Xn(n);const l=new Ho;return l.measuredValue=s,a.value=l,a}class oa{#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 oa(oa.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 ra={arrow:{"*":""},circle:{"*":"{surface}"},ellipse:{"*":"{surface}"},protractor:{"*":"{angle}"},rectangle:{"*":"{surface}"},roi:{"*":""},ruler:{"*":"{length}"},bidimensional:{"*":"{longAxis} x {shortAxis}"},bidimensionalDrawing:{"*":"{longAxis}"}};function aa(e){return"label"===e.name()}function sa(e){return"shape"===e.name()}function la(e){return"position-group"===e.name()}function ca(t,n){const i=t.getChildren(function(e){return e.id()===`anchor${n}`})[0];if(i instanceof e.Ellipse)return i}function ua(e){return function(t){return t.id()===e}}function da(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 ha(e){return void 0!==$e.labelTexts&&void 0!==$e.labelTexts[e]?$e.labelTexts[e]:ra[e]}class ga{#u="rectangle";#Zt;static supports(e){return e instanceof gr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new gr(t[0],t[1]),e.setTextExpr(ha(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=oa.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 gr(new g(a.getX(),a.getY()),new g(t.getX(),t.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new gr(new g(i.getX()+t.x,i.getY()+t.y),new g(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[oa.fromIndex(0,n,i),oa.fromIndex(1,n+o,i),oa.fromIndex(2,n+o,i+r),oa.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 g(n+o/2,i),new g(n,i+r/2),new g(n+o/2,i+r),new g(n+o,i+r/2)]}getDefaultLabelPosition(e){const t=e.mathShape;return new g(t.getBegin().getX(),t.getEnd().getY())}}class Sa{#u="circle";static supports(e){return e instanceof ur}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 ur(t[0],Math.round(Math.sqrt(n*n+i*i))),e.setTextExpr(ha(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=new g(n.getCenter().getX(),n.getCenter().getY()),o=new g(t.getX(),t.getY());e.mathShape=new ur(i,i.getDistance(o)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new ur(new g(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:o.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[oa.fromIndex(0,n-o,i),oa.fromIndex(1,n+o,i),oa.fromIndex(2,n,i+o),oa.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 g(n-o,i-o),new g(n+o,i-o),new g(n-o,i+o),new g(n+o,i+o)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter(),i=t.getRadius();return new g(n.getX()-i,n.getY()+i)}}class pa{#u="ellipse";static supports(e){return e instanceof dr}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 dr(t[0],n,i),e.setTextExpr(ha(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=n.getCenter();let r=n.getA(),a=n.getB();switch(t.getId()){case"anchor0":r=i.getX()-t.getX();break;case"anchor1":r=t.getX()-i.getX();break;case"anchor2":a=t.getY()-i.getY();break;case"anchor3":a=i.getY()-t.getY();break;default:o.error(`Unhandled anchor id: ${t.getId()}`)}e.mathShape=new dr(i,Math.abs(r),Math.abs(a)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new dr(new g(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:o.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[oa.fromIndex(0,n-o,i),oa.fromIndex(1,n+o,i),oa.fromIndex(2,n,i+r),oa.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 g(n-o,i-r),new g(n+o,i-r),new g(n-o,i+r),new g(n+o,i+r)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter();return new g(n.getX()-t.getA(),n.getY()+t.getB())}}class ma{#u="ruler";static supports(e){return e instanceof nr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new nr(t[0],t[1]),e.setTextExpr(ha(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[oa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new nr(new g(i.getX(),i.getY()),new g(o.getX(),o.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new nr(new g(i.getX()+t.x,i.getY()+t.y),new g(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[oa.fromIndex(0,n.getX(),n.getY()),oa.fromIndex(1,i.getX(),i.getY())]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[new g((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 fa{#u="arrow";static supports(e){return e instanceof g}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(ha(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[oa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new g(i.getX(),i.getY()),e.referencePoints=[new g(o.getX(),o.getY())],e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=e.referencePoints[0];e.mathShape=new g(n.getX()+t.x,n.getY()+t.y),e.referencePoints=[new g(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[oa.fromIndex(0,t.getX(),t.getY()),oa.fromIndex(1,n.getX(),n.getY())]}getConnectorPositions(e){const t=e.mathShape,n=e.referencePoints[0];return[new g((t.getX()+n.getX())/2,(t.getY()+n.getY())/2)]}getDefaultLabelPosition(e){return e.mathShape}}class va{#u="roi";static supports(e){return e instanceof cr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new cr(t),e.setTextExpr(ha(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape.getPoints().slice();n[oa.indexFromId(t.getId())]=new g(t.getX(),t.getY()),e.mathShape=new cr(n),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<n.getLength();++e)i.push(new g(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new cr(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(oa.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 g((o.getX()+r.getX())/2,(o.getY()+r.getY())/2))}return i}getDefaultLabelPosition(e){return e.mathShape.getPoint(0)}}class Ca{#u="protractor";static supports(e){return e instanceof lr}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 lr(t),e.setTextExpr(ha(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[oa.indexFromId(t.getId())]=t;const i=n[0],o=n[1],r=n[2];e.mathShape=new lr([new g(i.getX(),i.getY()),new g(o.getX(),o.getY()),new g(r.getX(),r.getY())]),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<3;++e)i.push(new g(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new lr(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(oa.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){return[e.mathShape.getPoint(1)]}getDefaultLabelPosition(e){const t=e.mathShape,n=new nr(t.getPoint(0),t.getPoint(1)),i=new nr(t.getPoint(1),t.getPoint(2));return new g((n.getCentroid().getX()+i.getCentroid().getX())/2,(n.getCentroid().getY()+i.getCentroid().getY())/2)}}function Da(e,t,n,i=20){const o=rr(t,t.getBegin(),i,n),r=rr(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 ya{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 Ia(e){const t=new nr(e.getPoint(0),e.getPoint(1)),n=new nr(e.getPoint(1),e.getPoint(2));let i=ir(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 wa(t,n,i){const{radius:o,angle:r,inclination:a}=Ia(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 Ta(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 La={rectangle:new class extends ya{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 ya{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 ya{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 ya{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 Da(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()]),Da(e,i,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=n.getZoomScale(),r=rr(i,i.getBegin(),20,o),a=rr(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=rr(o,o.getBegin(),20,r),s=rr(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 ya{createShape(t,n){const i=t.mathShape,o=t.referencePoints[0],r=new nr(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 Da(a,r,n.getZoomScale()),a}updateShape(e,t,n){const i=t.mathShape,o=t.referencePoints[0],r=new nr(i,o);e.position({x:0,y:0}),e.points([i.getX(),i.getY(),o.getX(),o.getY()]),Da(e,r,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=t.referencePoints[0],r=ar(new nr(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=ar(new nr(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 ya{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 ya{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()&&Ta(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()]),Ta(e,n)}createExtras(e,t){const n=e.mathShape;return 3!==n.getLength()?[]:[wa(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}=Ia(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 Pa(e){const t=La[e];return t||o.error(`shapePainters: no painter for shape '${e}'`),t}class Aa{#_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 g(t+i/2,n),new g(t,n+o/2),new g(t+i/2,n+o),new g(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 Oa{#Kt;#Jt;constructor(e){this.#Kt=e,this.#Jt=new Aa(t=>e.getDefaultLabelPosition(t))}createShapeGroup(t,n){const i=Pa(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=>da(e.getX(),e.getY(),e.getId(),t)):[]}constrainAnchorMove(e,t){const n=new oa(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 oa(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=Pa(this.#Kt.getName()),a=o.getChildren(sa)[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 ba{#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 xa{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 Ea{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 Ra{getName(){return""}execute(){}undo(){}}class Fa 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 Ma extends Ra{#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 Ua extends EventTarget{#an;constructor(e){super(),this.#an=e}#rn=new ba;#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 Ma(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 Va 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 xa,n=this.#an.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Ma(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 Qa 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 Ea,n=this.#an.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Ma(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 Na={},Ba={draw:{ArrowFactory:class{#Kt=new fa;#dn=new Oa(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)}},CircleFactory:class{#Kt=new Sa;#dn=new Oa(this.#Kt);static supports(e){return Sa.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 pa;#dn=new Oa(this.#Kt);static supports(e){return pa.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 Ca;#dn=new Oa(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)}},RectangleFactory:class{#Kt=new ga;#dn=new Oa(this.#Kt);static supports(e){return ga.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 va;#dn=new Oa(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)}},RulerFactory:class{#Kt=new ma;#dn=new Oa(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)}},BidimensionalFactory:class{#u="bidimensional";#Jt=new Aa(this.#hn);static supports(e){return e instanceof pr}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?ra[this.#u]:ra[`${this.#u}Drawing`]}setAnnotationMathShape(e,t){const n=new pr(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 Da(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=rr(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=rr(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 g(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(da(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()]),Da(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=rr(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=rr(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=ca(r,2),m=ca(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 g(i.getX()+t.x,i.getY()+t.y),a=new g(o.getX()+t.x,o.getY()+t.y),s=new pr(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 g(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=ca(i,0),a=ca(i,1),s=new g(r.x()-o.x(),r.y()-o.y()),l=new g(a.x()-o.x(),a.y()-o.y()),c=new pr(s,l),u=t.mathShape;if(u.shortAxisCenter instanceof g){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 g(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 g(n.getX()-l*o/2,n.getY()-c*o/2),d=new g(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 S=new g(i.getX()-l*o/2,i.getY()-c*o/2),p=new g(i.getX()+l*o/2,i.getY()+c*o/2),m=t.findOne(".short-axis-tick1");m&&m instanceof e.Line&&(m.position({x:0,y:0}),m.points([S.getX(),S.getY(),p.getX(),p.getY()]),m.opacity(.5))}getShortAxisEndpoints(e){const t=e.mathShape;let n;if(e.mathShape.shortAxisCenter instanceof g){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 g(n.getX()+l*u,n.getY()+c*u),new g(n.getX()-l*d,n.getY()-c*d)]}getPointAlongLine(e,t){const n=e.getBegin(),i=e.getEnd();return new g(n.getX()+(i.getX()-n.getX())*t,n.getY()+(i.getY()-n.getY())*t)}}},filter:{Threshold:Ua,Sobel:Qa,Sharpen:Va}};class ka{#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 Ga=0;class za{action;value;constructor(e){this.action=e}}const Ha={copy:e=>e,remove:()=>null,clear:e=>(e.value=[],e),replace:(e,t)=>(e.value=[t],e)};function Ya(e){const t=`.${(new Date).toISOString().replace(/\D/g,"").substring(0,14)}`;Ga+=1;const n=`.${Ga}`;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 Xa(e){return e%2==0}function Wa(e){const t=Z[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 ja{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 Za="00080005",_a="00280100";class Ka{#Cn=!1;#Dn=!0;#yn={default:{action:"copy",value:null}};#In=this.#yn;#wn=[];#Tn=new ja;#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=ne(F(n));t=void 0!==e?.getName()}if(t)e=n;else{const t=oe(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=ie(e.tag),n=ne(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,Ha[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 re("NONE");l.vl=n?4294967295:s.vl,l.tag=M(),l.value=[],t=this.#bn(e,l,t,i);for(const n of a)r(n)||V(n.tag)||(t=this.#bn(e,n,t,i,o));if(n){const n=new re("NONE");n.vl=0,n.tag=U(),n.value=[],t=this.#bn(e,n,t,i)}}return t}#xn(e,t,n,i,r,a){const s=n;if("NONE"===t.vr);else if(i instanceof Uint8Array)if(void 0!==a&&1===a){if(i.length%8!=0){o.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 a=Z[t.vr];if(void 0!==a)if("Uint8"===a)n=e.writeUint8Array(n,i);else if("Uint16"===a)n=e.writeUint16Array(n,i);else if("Int16"===a)n=e.writeInt16Array(n,i);else if("Uint32"===a)n=e.writeUint32Array(n,i);else if("Int32"===a)n=e.writeInt32Array(n,i);else if("Uint64"===a)n=e.writeUint64Array(n,i);else if("Int64"===a)n=e.writeInt64Array(n,i);else if("Float32"===a)n=e.writeFloat32Array(n,i);else if("Float64"===a)n=e.writeFloat64Array(n,i);else{if("string"!==a)throw new Error(`Unknown VR type: ${a}`);n=e.writeUint8Array(n,i)}else if("SQ"===t.vr)n=this.#On(e,n,i,r);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):o.warn(`Unknown VR: ${t.vr}`)}if("SQ"!==t.vr&&"NONE"!==t.vr){const e=n-s;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})`,o.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:M(),vr:"NONE",vl:0,value:[]});for(const e of i)a.push({tag:M(),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,r){const a=t.tag.isWithVR(),s=!(!i&&a)||W(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&&(o.warn("Write element using VR=UN for private sequence."),l="UN"),a&&!i&&(n=e.writeUint8Array(n,this.#Pn(l)),s&&(n+=2));let c=!1;("SQ"===t.vr||B(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=s?e.writeUint32(n,d):e.writeUint16(n,d);let h=t.value;if(void 0===h&&(h=[]),n=B(t.tag)?this.#En(e,t,n,h,i,r):this.#xn(e,t,n,h,i),c){const t=new re("NONE");t.vl=0,t.tag=new E("FFFE","E0DD"),t.value=[],n=this.#bn(e,t,n,i)}return n}getBuffer(e){const t=e["00020010"].value[0],n=Ce(t),i=De(t);if(void 0!==e[Za]){const t=e[Za].value[0];void 0!==t&&"ISO-IR 6"!==t&&(o.debug(`Change charset to UTF, was: ${t}`),this.useSpecialTextEncoder(),e[Za].value=["ISO_IR 192"])}let r;void 0!==e[_a]&&(r=e[_a].value[0]);let a,s=132;const l=[],c=[];let u,d,h=0;const g=new E("0002","0000"),S=new E("0002","0001"),p=new E("0002","0012"),m=new E("0002","0013"),f=this.#wn.slice(),v=Object.keys(e);for(const t of v){const o=e[t];if(o.tag=F(t),u=this.getElementToWrite(o),!(null===u||g.equals(u.tag)||S.equals(u.tag)||p.equals(u.tag)||m.equals(u.tag))){a=0;const e=f.indexOf(u.tag.getKey());-1!==e&&f.splice(e,1),this.#Dn&&Ja(u,!i),this.#Rn(u,u.value,n,r),d=ie(u.tag),a+=Pe(u.vr,"Meta Element"!==d&&n),a+=u.vl,"Meta Element"===d?(l.push(u),h+=a):c.push(u),s+=a}}for(const e of f){const t=F(e),i=ne(t),o=new re(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 a=Pe(o.vr,n);a+=this.#Rn(o,[r],n),c.push(o),s+=a}const C=es("FileMetaInformationVersion");let D=Pe(C.vr,!1);D+=this.#Rn(C,[0,1],!1),l.push(C),h+=D,s+=D;const y=es("ImplementationClassUID");let I=Pe(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,s+=I;const T=es("ImplementationVersionName");let L=Pe(T.vr,!1);L+=this.#Rn(T,["DWV_0.37.0-beta.13"],!1),l.push(T),h+=L,s+=L;const P=function(e,t){return R(e.tag,t.tag)};l.sort(P),c.sort(P);const A=es("FileMetaInformationGroupLength");let O=Pe(A.vr,!1);O+=this.#Rn(A,new Uint32Array([h]),!1),s+=O;const b=new ArrayBuffer(s),x=new ka(b),M=new ka(b,!i);let q=128;q=x.writeUint8Array(q,this.#Pn("DICM")),q=this.#bn(x,A,q,!1);for(const e of l)q=this.#bn(x,e,q,!1);const U=132+O+h;q!==U&&o.warn(`Bad size calculation... meta offset: ${q}, calculated size:${U} (diff:${q-U})`);for(const e of c)q=this.#bn(M,e,q,n,r);return q!==s&&o.warn(`Bad size calculation... final offset: ${q}, calculated size:${s} (diff:${q-s})`),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[_a];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=F(e),q(i.tag)||(l+=this.#Rn(i,i.value,n,c),s.push(i),l+=Pe(i.vr,n))}const h={tag:M(),vr:"NONE",vl:l,value:[]};a&&(h.undefinedLength=a),s.push(h),l+=Pe(h.vr,n),a&&(l+=Pe("NONE",n));const g=function(e,t){return R(e.tag,t.tag)};s.sort(g),o+=l,r.push(s)}a&&(o+=Pe("NONE",n)),e.value=r,e.vl=o,a&&(e.undefinedLength=a)}}else{if(Wa(r=e.vr)||"OB"===r){const n=function(e){let t="";return Wa(e)&&(t="UI"===e?"\0":" "),t}(e.vr);if(Wa(e.vr)){let i;j(e.vr)?(t=this.#An(t.join("\\")),i=this.#An(n)):(t=this.#Pn(t.join("\\")),i=this.#Pn(n)),Xa(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;Xa(t)||(e[e.length-1]=$a(e[e.length-1],[0]))}else Xa(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=Z[e];return void 0!==t&&"string"!==t}(e.vr)||"ox"===e.vr){if(B(e.tag)&&Array.isArray(t)){o=0;for(const e of t)o+=e.length}else o=t.length;const r=Z[e.vr];if(B(e.tag)||"ox"===e.vr)if(e.undefinedLength){const e=Pe("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 Ja(e,t){if("UN"===e.vr){const n=ne(e.tag)?.getVr();if(void 0!==n&&e.vr!==n){e.vr=n;const i=Z[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 de(e.buffer,n),r=e.byteOffset,a=e.length,s=Z[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)}o.info(`Element ${e.tag.getGroup()} ${e.tag.getElement()} VR changed from UN to ${e.vr}`)}}}function es(e){const t=oe(e),n=ne(t),i=new re(n?.getVr());return i.tag=t,i}class ts{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=Ya("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]&&o.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=it(this.planePoints[1].getValues().concat(this.planePoints[2].getValues()))),e}init(e){if(void 0!==this.referencedSopInstanceUID)return void o.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 S(n[0],n[1],n[2]),o=new S(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)):o.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 f(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 f(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 o.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=D(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+=v.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(),D(this.textExpr)))}getFactory(){let e;if(void 0===this.mathShape)return e;if(void 0!==Na.draw)for(const t in Na.draw){const n=Na.draw[t];if(n.supports(this.mathShape)){e=new n;break}}if(void 0===e)for(const t in Ba.draw){const n=Ba.draw[t];if(n.supports(this.mathShape)){e=new n;break}}return void 0===e&&o.warn("No shape factory found for math shape"),e}}class ns{current;measure}class is{annotationGroups;responseEvaluations;comment}class os{#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}(se(e,"00020012")),n=void 0!==t&&function(e){const t=Se(e,"0.34.0"),n=Se(e,"0.35.0-beta.21");return t>=0&&n<=0}(t),i=Jr(e);let o;const r=ta(e);return void 0!==r.conceptNameCode&&(o=r.conceptNameCode.value),n&&void 0===i&&o===Fn.value}#Un(e){const t="DCMR-1500"===Jr(e);let n;const i=ta(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"===Jr(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===Wr&&t.relationshipType===Br&&(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(Yr,Bn(wn),Vr)&&(e.trackingId=t.value,e.trackingUid=t.value)}#Hn(e,t){t.hasHeader(Gr,Bn(wn),Qr)&&(e.trackingId=t.value),t.hasHeader(Yr,Bn(Ln),Qr)&&(e.trackingUid=t.value)}#Yn(e,t,n){void 0===n&&(n=!1);let i=kr;if(n&&(i=Vr),t.hasHeader(Gr,Bn(Mn),i)){e.textExpr=t.value;const n=t.contentSequence.find(function(e){return e.hasHeader($r,Bn(Rn),Vr)});void 0!==n&&(e.labelPosition=new g(n.value.graphicData[0],n.value.graphicData[1]))}if(t.hasHeader(Gr,zn(),i)&&(e.colour=t.value),t.hasHeader($r,Bn(Rn),i)&&t.value.graphicType===yr){const n=[];for(let e=0;e<t.value.graphicData.length;e+=2)n.push(new g(t.value.graphicData[e],t.value.graphicData[e+1]));e.referencePoints=n}if(t.hasHeader(jr,Bn(Vn),Ur)&&t.value.graphicType===yr){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 S(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=Ur),t.valueType===zr&&t.relationshipType===i){const n=function(e){let t;for(const n in Hn){const i=Hn[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 Yn){const i=Yn[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!==Hr&&t.valueType!==Gr||t.relationshipType!==Ur||e.addMetaItem(t.conceptNameCode,t.value)}#Vn(e){return e.hasHeader(Zr,Bn(Un),Ur)}#Qn(e){return e.hasHeader(Zr,Bn(Fn),Ur)}#$n(e){return e.hasHeader(Hr,Bn(mn),Nr)}#jn(e){return e.hasHeader(Zr,Bn(Dn),Vr)}#Zn(e){return e.hasHeader(Gr,Bn(bn),Ur)}#_n(e){return e.hasHeader(Hr,Bn(Pn),Ur)}#Kn(e){return e.hasHeader(zr,Bn(Tn),Ur)}#Jn(e){return e.hasHeader(Hr,Bn(Sn),Ur)}#Nn(e){return e.hasHeader($r,Bn(pn),Ur)}#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 ts,t.mathShape=Or(n.value);const i=n.contentSequence.find(function(e){return e.valueType===Wr&&e.relationshipType===Br});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===zr&&e.relationshipType===Ur&&(t=e.contentSequence.find(function(e){return e.valueType===$r&&e.relationshipType===Nr})),void 0!==t}#ni(e){let t;return e.valueType===zr&&e.relationshipType===Vr&&(t=e.contentSequence.find(function(e){return e.valueType===$r&&e.relationshipType===Nr})),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 ts;const e=n.contentSequence.find(function(e){return e.valueType===$r&&e.relationshipType===Nr});t.mathShape=Or(e.value),t.mathShape instanceof g&&e.value.graphicData.length>=4&&(t.referencePoints=[new g(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===Wr&&e.relationshipType===Br});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 ts;const e=n.contentSequence.find(function(e){return e.valueType===$r&&e.relationshipType===Nr});t.mathShape=Or(e.value),t.mathShape instanceof g&&e.value.graphicData.length>=4&&(t.referencePoints=[new g(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===Wr&&e.relationshipType===Br});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,Vr),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 r=[];let a,s=!1;for(const t of e.contentSequence)if(this.#Qn(t)){let e;s=!0,n?e=this.#ti(t):i&&(e=this.#oi(t)),void 0!==e&&r.push(e)}return s?0!==r.length?a=new so(r):o.warn("No valid measurement groups in TID 1500 SR"):o.warn("No measurement groups in TID 1500 SR"),a}#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 so(t)):o.warn("No valid measurement groups in TID 4100 SR"):o.warn("No image findings in TID 4100 SR"),i}#li(e){const t=new ts;t.mathShape=Or(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===Zr&&dn(e.conceptNameCode,Bn(qn))||o.warn("Not the expected TID 1500 SR content header");const n=e.contentSequence.find(this.#Vn);return void 0!==n?t=this.#ai(n):o.warn("No imaging measurements in TID 1500 SR"),t}#ui(e){return e.valueType===Zr&&dn(e.conceptNameCode,Bn(Cn))||o.warn("Not the expected TID 4100 SR content header"),e.contentSequence.find(this.#Jn)}#di(e){e.valueType===Zr&&dn(e.conceptNameCode,Bn(Fn))||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 so(t)}#hi(e,t){const n=function(e){return se(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=gi({[i]:o});e.setMetaValue("CurrentRequestedProcedureEvidenceSequence",t.CurrentRequestedProcedureEvidenceSequence)}}create(e){const t=ta(e);let n,i;if(this.#Un(e)?(i="TID 1500 SR",n=this.#ci(t)):this.#qn(e)&&(o.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=ta(e),n=this.#ui(t);if(void 0===n)return void o.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 r=[];let a;for(const e of n.contentSequence)if(this.#jn(e)){const t=this.#gi(e);void 0!==t&&r.push(t)}else this.#Zn(e)&&(a=e.value);const s=new is;return s.annotationGroups=i,s.responseEvaluations=r,s.comment=a,s}#Si(e){const t=new ea(Wr);t.relationshipType=Br,t.conceptNameCode=Bn(En);const n=new $o;n.referencedSOPClassUID=e.referencedSopClassUID,n.referencedSOPInstanceUID=e.referencedSopInstanceUID;const i=new er;return i.referencedSOPSequence=n,void 0!==e.referencedFrameNumber&&(i.referencedFrameNumber=e.referencedFrameNumber.toString()),t.value=i,t}#pi(e){const t=[],n=new ea(Gr);n.relationshipType=Qr,n.conceptNameCode=Bn(wn),n.value=e.trackingId,t.push(n);const i=new ea(Yr);if(i.relationshipType=Qr,i.conceptNameCode=Bn(Ln),i.value=e.trackingUid,t.push(i),void 0!==e.textExpr&&0!==e.textExpr.length){const n=new ea(Gr);if(n.relationshipType=kr,n.conceptNameCode=Bn(Mn),n.value=e.textExpr,void 0!==e.labelPosition){const t=new ea($r);t.relationshipType=Vr,t.conceptNameCode=Bn(Rn);const i=new Lr;i.graphicType=Dr;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 ea(Gr);if(o.relationshipType=kr,o.conceptNameCode=zn(),o.value=e.colour,t.push(o),void 0!==e.referencePoints){const n=new ea($r);n.relationshipType=kr,n.conceptNameCode=Bn(Rn);const i=new Lr;i.graphicType=yr;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 ea(jr);n.relationshipType=Ur,n.conceptNameCode=Bn(Vn);const i=new Fr;i.graphicType=yr;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=ia(n,d(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=Gr;i.value instanceof un&&(o=Hr);const r=new ea(o);r.relationshipType=Ur,r.conceptNameCode=i.concept,r.value=i.value,t.push(r)}return t}#mi(e){const t=new ea(Zr);t.relationshipType=Ur,t.conceptNameCode=Bn(Fn),t.value=_r;const n=new ea($r);n.relationshipType=Ur,n.conceptNameCode=Bn(pn),n.value=Ar(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 ea(Zr);n.conceptNameCode=Bn(Un),n.relationshipType=Ur,n.value=_r;const i=[];for(const t of e.getList())i.push(this.#mi(t));n.contentSequence=i,t=new ea(Zr),t.conceptNameCode=Bn(qn),t.value=_r,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=on(tn(i)),n.ContentTime=rn(nn(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,...na(s)},void 0!==t&&Si(n,t),pi(n)}#vi(e){const t=new ea(Hr);t.relationshipType=Nr,t.conceptNameCode=Bn(mn),t.value=Bn(fn),t.contentSequence=[];const n=new ea(Gr);n.relationshipType=Qr,n.conceptNameCode=Bn(wn),n.value=e.trackingId,t.contentSequence.push(n);const i=new ea(Yr);if(i.relationshipType=Qr,i.conceptNameCode=Bn(Ln),i.value=e.trackingUid,t.contentSequence.push(i),void 0!==e.quantification)for(const n in e.quantification){const i=ia(n,d(e.quantification[n].value,12),e.quantification[n].unit,Vr);if(void 0!==i){const n=new ea($r);n.relationshipType=Nr,n.conceptNameCode=Bn(On),n.value=Ar(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=Gr;i.value instanceof un&&(o=Hr);const r=new ea(o);r.relationshipType=Ur,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 ea(Zr);t.relationshipType=Vr,t.conceptNameCode=Bn(Dn),t.value=_r,t.contentSequence=[];const n=new ea(Hr);if(n.relationshipType=Qr,n.conceptNameCode=Bn(yn),n.value=Bn(In),t.contentSequence.push(n),void 0!==e){if(void 0!==e.current){const n=new ea(Hr);n.relationshipType=Ur,n.conceptNameCode=Bn(Pn),n.value=e.current,t.contentSequence.push(n)}if(void 0!==e.measure){const n=new ea(zr);n.relationshipType=Ur,n.conceptNameCode=Bn(Tn);const i=new Bo;i.numericValue=e.measure,i.measurementUnitsCode=Xn("unit.mm");const o=new Ho;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 ns,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=on(tn(i)),n.ContentTime=rn(nn(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 ea(Hr);s.relationshipType=Ur,s.conceptNameCode=Bn(Sn),s.value=Bn(vn),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 ea(Gr);t.relationshipType=Ur,t.conceptNameCode=Bn(bn),t.value=e.comment,s.contentSequence.push(t)}const l=new ea(Zr);if(l.conceptNameCode=Bn(Cn),l.value=_r,l.contentSequence.push(s),void 0===l)throw new Error("No annotation group SR content");return n={...n,...na(l)},void 0!==t&&Si(n,t),pi(n)}}const rs="30060084";class as{type;points3D}class ss{number;name;colour;generationAlgorithm;interpretedType;roiInterpreter;contours}function ls(e){const t={},n={},i=le(e,"30060020");if(void 0!==i)for(const e of i){const i=se(e,"30060022"),o=se(e,"30060026"),r=se(e,"30060036");void 0!==i&&(t[i]=o??`ROI ${i}`,n[i]=r)}const r={},a=le(e,"30060080");if(void 0!==a)for(const e of a){const t=se(e,rs);void 0!==t&&(r[t]={interpretedType:se(e,"300600A4"),roiInterpreter:se(e,"300600A6")})}const s=[],l=le(e,"30060039");if(void 0===l)return s;for(const e of l){const i=se(e,rs),a=le(e,"3006002A"),l=le(e,"0062000D");let c;void 0!==a&&3===a.length?c={r:parseInt(a[0],10),g:parseInt(a[1],10),b:parseInt(a[2],10)}:void 0!==l&&3===l.length?c=Ti(yi({l:l[0],a:l[1],b:l[2]})):(o.warn("No recommended colour for contour, using default"),c=Oi(i));const u=[],d=le(e,"30060040");if(void 0!==d)for(const e of d){const t=se(e,"30060042"),n=le(e,"30060050");if(void 0===n)continue;const i=new as;i.type=t??"CLOSED_PLANAR",i.points3D=n.map(e=>parseFloat(e)),u.push(i)}const h=new ss;h.number=void 0!==i?parseInt(i,10):0,h.name=t[h.number]??`ROI ${h.number}`,h.generationAlgorithm=n[h.number],h.interpretedType=r[h.number]?.interpretedType,h.roiInterpreter=r[h.number]?.roiInterpreter,h.colour=c,h.contours=u,s.push(h)}return s}const cs={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyInstanceUID:"0020000D",StudyID:"00200010",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052"},us=[{name:"TransferSyntaxUID",enum:[J]},{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 ds(){const e={};for(const t of us)e[t.name]=t.enum[0];return e}const hs=[[-1,0],[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1]],gs={};for(let e=0;e<8;e++)gs[`${hs[e][0]},${hs[e][1]}`]=e;function Ss(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 ps(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=gs[`${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+hs[a][0],l=d+hs[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+hs[e][0],m=d+hs[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 ms(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;Ss(e,t,n,i,o,l,a);const u=ps(e,t,n,i,o,r,c);u.length>=3&&s.push(u)}return s}function fs(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 vs(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=fs(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 Cs(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 Ds(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?ms(s,0,n,i,1):[]}class ys{#j;getWarning(){return this.#j}checkElements(e){return this.#j=void 0,this.#j}create(e,t){const n=ls(e),o=t.getGeometry(),r=o.getSize(),a=r.get(0),s=r.get(1),l=r.get(2),c=a*s,u=new ki(o),d=[],h=[0],g=[0],S=[0];for(let e=0;e<n.length;++e){const t=n[e],i=e+1,r=new Ui(i,t.name,t.generationAlgorithm??"MANUAL");r.interpretedType=t.interpretedType,r.roiInterpreter=t.roiInterpreter,r.displayRGBValue=new mi(t.colour.r,t.colour.g,t.colour.b),d.push(r),h[i]=t.colour.r,g[i]=t.colour.g,S[i]=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 i=o.worldToPoint(new f([t[e],t[e+1],t[e+2]]));n.push({x:i.getX(),y:i.getY(),z:i.getZ()})}const i=Math.round(n[0].z);i<0||i>=l||(p.has(i)||p.set(i,[]),p.get(i).push(n))}for(const[e,t]of p){const n=new Uint8Array(c);Cs(n,0,a,s,t,1),u.addFrame(i,n,0,e,c,i)}}const p=[];for(let e=0;e<l;++e)p.push(t.getImageUid(new i([0,0,e])));const m=new ro(o,u.getLabelMap(),p);m.setSegmentCollection(u),m.setPhotometricInterpretation("PALETTE COLOR"),m.setPaletteColourMap(new Xe(h,g,S));const v=t=>se(e,t),C={Modality:"RTSTRUCT"};for(const e of Object.keys(cs)){const t=v(cs[e]);void 0!==t&&(C[e]=t)}C.custom={segments:d,referencedSeriesUID:mt(e)};const D=t.getMeta();return void 0!==D.lengthUnit&&(C.lengthUnit=D.lengthUnit),m.setMeta(C),m}toDicom(e,t,n,r){const a=ds(),s=e.getMeta();for(const e of Object.keys(cs)){const t=s[e];void 0!==t&&(a[e]=t)}if(void 0===t&&(t=s.custom?.segments??[]),void 0!==n){const e=n.getMeta();a.StudyInstanceUID=e.StudyInstanceUID,a.ReferencedFrameOfReferenceSequence={value:[{FrameOfReferenceUID:a.FrameOfReferenceUID??"",RTReferencedStudySequence:{value:[{ReferencedSOPInstanceUID:e.StudyInstanceUID??"",RTReferencedSeriesSequence:{value:[{SeriesInstanceUID:e.SeriesInstanceUID??""}]}}]}}]}}const l=new Date;a.StructureSetDate=on(tn(l)),a.StructureSetTime=rn(nn(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:a.FrameOfReferenceUID??"",ROIGenerationAlgorithm:e.algorithmType??"MANUAL"}),D.push({ObservationNumber:t,ReferencedROINumber:t,RTROIInterpretedType:e.interpretedType??"ORGAN",ROIInterpreter:e.roiInterpreter??""});const r=[],s=f?.get(t);for(let e=0;e<g;e++){const n=m&&s?.has(e),a=n?s.get(e):p,l=n?0:e*S,u=ms(a,l,d,h,t),g=u.length>0?Ds(a,l,d,h,t):[],f=u.concat(g),v=g.length>0?"CLOSEDPLANAR_XOR":"CLOSED_PLANAR";for(const t of f){const n=vs(t,1);if(n.length<3){o.warn("Saving RT Struct with thin contour, not well supported");continue}const a=[];for(const t of n){const n=c.indexToWorld(new i([t.x,t.y,e]));a.push(n.get(0),n.get(1),n.get(2))}r.push({ContourGeometricType:v,NumberOfContourPoints:n.length,ContourData:a})}}C.push({ReferencedROINumber:t,ROIDisplayColor:[n.r,n.g,n.b],ContourSequence:{value:r}})}return a.StructureSetROISequence={value:v},a.ROIContourSequence={value:C},a.RTROIObservationsSequence={value:D},void 0!==r&&Si(a,r),pi(a)}}const Is=["dataadd","dataremove","dataimageset","dataupdate"];function ws(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}),!P(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 Ts{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=ws(this.meta,e,Xt)}}class Ls{#ze=[];addClone(e){const t=new Ts(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:ws(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:Wt;for(const i of n){const n=this.#Ai(e,t,i.getter);if(void 0!==n)return o.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 Ps 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 no)t.addEventListener(n,this.#Ri(e));this.dispatchEvent(new CustomEvent("dataimageset",{detail:{value:[t],dataid:e}}))}#Fi(e){const t=se(e.meta,"00080060");let n;if(G(e.meta))if("SEG"===t){const t=pt(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 Xi,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,this.#Oi[i].image))}else n=new di,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,e.numberOfFiles));else if("SR"===t)n=new os,void 0===n.checkElements(e.meta)&&(e.annotationGroup=n.create(e.meta));else if("RTSTRUCT"===t){const t=mt(e.meta),i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create RT struct: referenced series is not loaded");n=new ys,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 Ls,this.#bi[e].addClone(t))),void 0!==t.image)for(const n of no)t.image.addEventListener(n,this.#Ri(e));if(void 0!==t.annotationGroup)for(const n of ao)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 no)t.removeEventListener(n,this.#Ri(e));const n=this.#Oi[e].annotationGroup;if(void 0!==n)for(const t of ao)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 As{#Mi;setOptions(e){this.#Mi=e}#qi;#Ui=[];#Vi=[];#Qi=[];#Ni=!1;#Bi(e,t){const n=this.#Ui[e].getDicomElements(),i=new Ts(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 Mo(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=se(t,"00280100");void 0!==i?n.bitsAllocated=i:n.missing.push("bitsAllocated");const o=se(t,"00280103");void 0!==o?n.isSigned=1===o:n.missing.push("pixelRepresentation");const r=se(t,"00280011"),a=se(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=se(t,"00280002");if(void 0!==s){if(n.samplesPerPixel=s,1!==s){const e=se(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 r=e.numberOfItems*this.#Vi[t];try{this.#Qi[t]=new i.constructor(r)}catch(e){if(e instanceof RangeError){const e=Math.floor(Math.log(r)/Math.log(2));o.error(`Cannot allocate ${i.constructor.name} of size: ${r} (>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]&&o.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 be;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=k(o);if(void 0!==r){const e=r.value,i=function(e){let t;return we(e)?t="jpeg2000":ye(e)?t="jpeg-baseline":Ie(e)?t="jpeg-lossless":Te(e)&&(t="rle"),t}(se(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 Os extends Oo{#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=y(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=y(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 bs extends Os{#Wi=new As;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 ks.ArrayBuffer}loadUrlAs(){return 1}}class xs extends Os{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 ks.Text}loadUrlAs(){return 0}}class Es extends Oo{#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 Ao(this.onprogress);t.setNToLoad(e.length),t.setNumberOfDimensions(1);const n=Bs(),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 Rs extends Os{#$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=b(new Uint8Array([13,10,13,10]));let o=O(t,i,0);if(void 0===o)throw new Error("Can't find the end of the first multipart header");const r=A(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=b(I(a)),l=a.length;let c=O(t,s,0);for(;void 0!==o;){const e={},r=A(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=O(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=O(t,i,c+l)}return n}(e);if(this.#Zi.push(...i),this.#ji++,this.#ji<this.#$i)return;const o=new Es;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 ks.ArrayBuffer}loadUrlAs(){return 1}}function Fs(e){return parseInt(e,36).toString()}function Ms(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 ft([e,t,1]),s=new at([1,1,1]),l=new S(0,0,n),c=new wt([l],a,s),u=new ro(c,i,[r]);u.setPhotometricInterpretation("RGB");const d={BitsStored:8};return void 0!==o&&(d.numberOfFiles=o),u.setMeta(d),u}class Us extends Os{#_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=Fs(t)):(l.fileName={value:[t.name]},c=Fs(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,Ms(s),1,u.toString()),h=d.getMeta();h.SeriesInstanceUID=c,d.setMeta(h);const g=new Ts(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 ks.DataURL}loadUrlAs(){return 1}}class Vs extends Os{#_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=Fs(r)):(u.fileName={value:[r.name]},d=Fs(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=Ms(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 Ts(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 ks.DataURL}loadUrlAs(){return 1}}class Qs extends Os{#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 Es;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 ks.ArrayBuffer}loadUrlAs(){return 1}}let Ns=null;function Bs(){return null===Ns&&(Ns=[bs,xs,Rs,Us,Vs,Qs]),Ns}const ks={Text:0,ArrayBuffer:1,DataURL:2};class Gs extends Oo{#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 Ao(this.onprogress);t.setNToLoad(e.length);const n=Bs(),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()===ks.Text?i.readAsText(o):r.loadFileAs()===ks.DataURL?i.readAsDataURL(o):r.loadFileAs()===ks.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 zs=["loadstart","loadprogress","loaditem","load","loadend","error","abort","timeout"];class Hs 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 Es;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 Gs;n.setDefaultCharacterSet(this.#f),this.#uo(e,n,"image",t)}#co(e,t,n){const i=new bo;i.setDefaultCharacterSet(this.#f),this.#uo(e,i,"image",t,n)}#ao(e,t){const n=new Gs;this.#uo([e],n,"state",t)}#lo(e,t,n){const i=new bo;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 Ys=["undoadd","undoremove","undo","redo"];class Xs extends EventTarget{#do=new Fa;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 Fa,this.#ho()}#ho(){for(const e of Ys)this.#do.addEventListener(e,t=>{const n=Object.assign({},t.detail);this.dispatchEvent(new CustomEvent(e,{detail:n}))})}}class Ws{tags;event;pos;format;precision;value}function $s(e){return function(t){return Number(t).toPrecision(e)}}function js(e){let t="";for(let n=0;n<e;++n)0!==n&&(t+=", "),t+=`{v${n}}`;return t}function Zs(e,t){let n=e;for(let e=0;e<t.length;++e)n=n.replace(`{v${e}}`,t[e]);return n}class _s 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=en(Kt(i));void 0!==e&&t.push(e.toLocaleDateString())}else if("TM"===i.vr){const e=en({year:1900,monthIndex:0,day:1},Jt(i));void 0!==e&&t.push(e.toLocaleTimeString())}else t.push(i.value);else t.push("undefined")}void 0!==i.format&&null!==i.format||(i.format=js(t.length)),i.value=Zs(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:ve(e),format:"{v0}"}),n.push({pos:"bc",value:t,format:"{v0}"}),n.push({pos:"tc",value:ve(t),format:"{v0}"})}return n}(e,this.#go)):o.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=js(t.length)),i.value=Zs(i.format,t).trim()}n.push(i)}return n}(e,this.#go)):o.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=Zs(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 Ks(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 Js(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 el{onWheel(e,t){}onWheelTick(e,t){}}class tl extends el{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 nl extends el{onWheel(e,t){if(void 0===t)return;const n=-e.deltaY/500,i=To(e),r=Js(t);if(void 0===r)return void o.warn("No view layer to do wheel zoom behavior");const a=r.getViewController(),s=r.displayToMainPlanePos(i),l=a.getPlanePositionFromPlanePoint(s);t.addScale(n,l),t.draw()}}class il{#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 ol{#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 rl={CT:{mediastinum:new Ne(40,400),lung:new Ne(-500,1500),bone:new Ne(500,2e3),brain:new Ne(40,80),head:new Ne(90,350)}};class al{create(e,t){const n=new ul(t);"MONOCHROME1"===t.getPhotometricInterpretation()&&n.setColourMap("invPlain");let i={};void 0!==t.getMeta().windowPresets&&(i=t.getMeta().windowPresets),i.minmax=new Ge("minmax");const o=t.getMeta().Modality;let r;r=void 0!==$e.wlPresets&&void 0!==$e.wlPresets[o]?$e.wlPresets[o]:rl[o];for(const e in r){const t=r[e];i[e]=new Ge(e,[new Ne(t.center,t.width)])}return n.setWindowPresets(i),n}}class sl{#Po=[];#Ao(e){return this.#Po.indexOf(e)}isHidden(e){return-1!==this.#Ao(e)}addToHidden(e){this.isHidden(e)?o.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):o.warn(`Cannot remove segment, it is not in the hidden list: ${e}`)}}const ll=["wlchange","wlpresetadd","colourmapchange","positionchange","opacitychange","alphafuncchange","maskviewchange"];function cl(e,t){return(new al).create(e,t)}class ul extends EventTarget{#Oo;#bo;#Te;#xo={minmax:new Ge("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 sl,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 i(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 i(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 Me(1,0),t=!1);const n=new il(e,this.#Oo.getMeta().BitsStored);this.#bo=new ol(n,1===this.#Oo.getMeta().PixelRepresentation,t)}const e=this.#bo.getVoiLut();let t;if(void 0!==e&&(t=e.getWindowLevel()),void 0===e||!Be(this.#Ro,t)){const e=new Qe(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 We[this.#Fo]}setColourMap(e){if(!We[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=ke(e,this.#Oo.getRescaledDataRange(),this.#Oo.getMeta().VOILUTFunction),o=!Be(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 Ge("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 ke(new Ne(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(),r=Re(n,t,i,this.getOrientation()),a=n.getPhotometricInterpretation();switch(a){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,r,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,r,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,r){const a=function(e){return e>>8};r&&o.info("Scaling 16bits data to 8bits.");let s,l=0,c=t.next();for(;!c.done;)s=c.value,r?(e.data[l]=a(i.red[s]),e.data[l+1]=a(i.green[s]),e.data[l+2]=a(i.blue[s])):(e.data[l]=i.red[s],e.data[l+1]=i.green[s],e.data[l+2]=i.blue[s]),e.data[l+3]=n(s,c.index),l+=4,c=t.next()}(e,r,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,r,this.getAlphaFunction());break;case"YBR_FULL":!function(e,t,n){let i,o=0,r=t.next();for(;!r.done;)i=vi(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,r,this.getAlphaFunction());break;default:throw new Error(`Unsupported photometric interpretation: ${a}`)}}getScrollDimIndex(){let e=2;const t=this.getOrientation();return void 0!==t&&(e=t.getThirdColMajorDirection()),e}isAquisitionOrientation(){return _e(this.#$)}}class dl{#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&&o.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 hl{#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(Ke().getAbs())&&(n=n.getAbs()),n}(this.#Xo,t)}getViewOrientation(){return this.#Wo}getTargetOrientation(){return this.#$o}getOffset3DFromPlaneOffset(e){const t=new h(e.x,e.y,0),n=this.getTargetDeOrientedVector3D(t);return new h(n.getX()*this.#Y.get(0),n.getY()*this.#Y.get(1),n.getZ()*this.#Y.get(2))}getPlaneOffsetFromOffset3D(e){const t=new h(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=Lt([e.getX(),e.getY(),e.getZ()],this.#Wo);t=new h(n[0],n[1],n[2])}return t}getImageOrientedPoint3D(e){let t=e;if(void 0!==this.#Wo){const n=Lt([e.getX(),e.getY(),e.getZ()],this.#Wo);t=new S(n[0],n[1],n[2])}return t}getImageDeOrientedVector3D(e){let t=e;if(void 0!==this.#Wo){const n=Tt([e.getX(),e.getY(),e.getZ()],this.#Wo);t=new h(n[0],n[1],n[2])}return t}getImageDeOrientedPoint3D(e){let t=e;if(void 0!==this.#Wo){const n=Tt([e.getX(),e.getY(),e.getZ()],this.#Wo);t=new S(n[0],n[1],n[2])}return t}getPositionFromPlanePoint(e,t){const n=new S(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 g(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 S(s[0],s[1],s[2]),new S(u[0],u[1],u[2]),new S(u[3],u[4],u[5])]}worldToIndex(e){return this.#Yo.worldToIndex(e)}indexToWorld(e){return this.#Yo.indexToWorld(e)}isAquisitionOrientation(){return _e(this.#Wo)}getTargetOrientedPositiveXYZ(e){const t=Tt([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 gl{#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 Sl{#jo;#ie;#Mo;#Zo;constructor(e){this.#jo=new gl(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 i(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(),It))throw new Error("Cannot merge geometries with different orientation");const i=n.getInverse(),o=function(e,t){return T(e,t,Math.min)},r=function(e,t){return T(e,t,Math.max)},a=new at(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 p=new ft(h),m=[];for(let e=0;e<p.get(2);++e){const t=u.slice();t[2]=u[2]+e*a.get(2);const i=new S(t[0],t[1],t[2]);m.push(n.multiplyPoint3D(i))}return new wt(m,p,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 pl{#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 hl(e.getImage().getGeometry(),e.getOrientation())}getPlaneHelper(){return this.#_o}updatePlaneHelper(){this.#_o=new hl(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 g(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 Sl(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 h(e.get(0),e.get(1),e.get(2)));e=new i([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=Ee(Re(e,t,n,i)),r=e.getGeometry().getSize(i).getValues();r[2]=1;const a=new ft(r),s=e.getGeometry().getSpacing(i).getValues();s[2]=1;const l=new at(s),c=new S(0,0,0),u=new wt([c],a,l);return new ro(u,o)}getImageRegionValues(e,t,n){let o=this.#p.getImage();const r=this.#p.getOrientation();let a=n,s=!0;_e(r)||(o=this.#Jo(o,a,s,r),a=new i([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 g(0,0)),void 0===o&&(o=new g(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)}(o,a,s,e,t);let c=[];return l&&(c=Ee(l)),c}getImageVariableRegionValues(e,t){let n=this.#p.getImage();const o=this.#p.getOrientation();let r=t,a=!0;_e(o)||(n=this.#Jo(n,r,a,o),r=new i([0,0,0]),a=!1);const s=function(e,t,n,i){if(1!==e.getNumberOfComponents())throw new Error(`Unsupported number of components for region iterator: ${e.getNumberOfComponents()}`);let o;void 0===n&&(n=!1),o=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const r=e.getGeometry().getSize(),a=[];let s,l=null,c=null,u=null;for(let e=0;e<i.length;++e){s=i[e];const t=s[1][0]-s[0][0];0!==t&&(u=e,l||(l=s[0]),a.push([s[0][0],t,r.get(0)-s[1][0]]))}if(null!==u&&(c=i[u][1]),0!==a.length)return function(e,t,n,i,o){let r=t,a=0,s=0;return{next(){if(r<n){const t={value:e(r),done:!1,index:r};return s+=1,r+=1,s===o[a][1]&&(s=0,r+=o[a][2],a+=1,a<o.length&&(r+=o[a][0])),t}return{done:!0,index:n}}}}(o,r.indexToOffset(t.getWithNew2D(l[0],l[1])),r.indexToOffset(t.getWithNew2D(c[0],c[1]))+1,0,a)}(n,r,a,e);let l=[];return s&&(l=Ee(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 S(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 g(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 S(e.getX(),e.getY(),t),i=this.#_o.getTargetDeOrientedPoint3D(n),o=this.#p.getImage().getGeometry().getRealSpacing();return new S(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),o=e.getGeometry().getSize().canScroll3D(),r=this.getPositionHelper();this.#Ko=window.setInterval(()=>{let e;if(e=o?r.incrementPositionAlongScroll():r.incrementPosition(3),!e){const e=this.getCurrentIndex().getValues(),t=this.#p.getOrientation();o?e[t.getThirdColMajorDirection()]=0:e[3]=0;const n=new i(e),r=this.#p.getImage().getGeometry();this.setCurrentPosition(r.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 ml{#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 dl;#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 ll)e.addEventListener(t,this.#Er);this.#Fn=new pl(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=Ol(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 i([Math.floor(t.getX()),Math.floor(t.getY())])}displayToPlaneScale(e){return new g(e.getX()/this.#cr.x,e.getY()/this.#cr.y)}displayToPlanePos(e){const t=this.displayToPlaneScale(e);return new g(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 g(t,n)}displayToMainPlanePos(e){const t=this.displayToPlanePos(e);return new g(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(!Lo(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(!Lo(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=yo;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=yo;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 fl extends Ra{#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 vl extends Ra{#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 Cl extends Ra{#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 Dl{#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 o.warn(`Cannot create remove command for undefined annotation: ${e}`);const i=new vl(n,this);t(i),i.execute()}updateAnnotationWithCommand(e,t,n,i){const r=this.getAnnotation(e);if(void 0===r)return void o.warn(`Cannot create update command for undefined annotation: ${e}`);const a=new Cl(r,t,n,this);i(a),a.execute()}removeAllAnnotationsWithCommand(e){for(const t of this.#Br.getList())this.removeAnnotationWithCommand(t.trackingUid,e)}constructor(e){this.#Br=void 0!==e?e:new so}hasAnnotationMeta(e){return this.#Br.hasMeta(e)}setAnnotationMeta(e,t){this.#Br.setMetaValue(e,t)}}class yl{#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 dl;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=Ol(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 Dl(e),0!==e.getLength())for(const t of e.getList())this.#Wr(t,!1),n(new fl(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+=w([d(t.getX(),2),d(t.getY(),2),d(t.getZ(),2)]);return void 0!==t&&(n+=`-${t}`),n}#Jr(t){let n;const i=this.#_r(t),o=this.getKonvaLayer().getChildren(ua(i));if(0!==o.length){const i=o[0];if(!(i instanceof e.Group))return;const r=i.getChildren(ua(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(ua(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 lo,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):(o.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(aa)[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=yo;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=yo;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(la);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)):o.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 Il(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 wl(e){return`info-${e}`}function Tl(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,""),`${wl(e.pos)}-${t}-${n}`}class Ll{#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=Pl(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=Tl(i),void 0!==i.tags&&e.appendChild(document.createTextNode(i.value)),t.appendChild(e)}const i=document.createElement("div");i.id=wl(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=`#${Tl(t)}`,n=this.#er.querySelector(e),i=t.value;i&&n&&n.replaceChildren(document.createTextNode(i))}}}function Pl(e){const t=e.split("-layer-");return 2!==t.length&&o.warn("Not the expected layer div id format..."),{groupDivId:t[0],layerIndex:t[1],layerId:e}}function Al(e){let t=null;const n=e.target.closest(".layer");return n&&void 0!==n.id&&(t=Pl(n.id)),t}function Ol(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 bl 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 ml){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 Ll(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 ml&&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 ml&&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 ml&&e(n)&&i.push(n)}return i}someViewLayer(e){let t=!1;for(const n of this.#aa)if(n instanceof ml&&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 yl&&e(n)&&t.push(n);return t}getNumberOfViewLayers(){let e=0;return this.#aa.forEach(t=>{void 0!==t&&t instanceof ml&&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 ml&&(e=t),e}getBaseViewLayer(){let e;for(const t of this.#aa)if(t instanceof ml){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 ml){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 ml&&e.push(t.getDataId());return e}getActiveDrawLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof yl&&(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):o.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):o.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 ml(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 yl(e);return this.#aa.push(t),this.#Da(t),t}#Ca(e){e.addEventListener("positionchange",this.updateLayersToPositionChange);for(const t of ll)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 ll)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 ml?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 ml){e=t;break}if(void 0===e)return void o.warn("No layer to show crosshair");if(this.#wa(e))return void o.warn("Not enabling crosshair for secondary capture");const t=e.getViewController(),n=t.getCurrentPosition(),i=t.getPlanePositionFromPosition(n),r=e.planePosToDisplay(i);if(void 0!==r.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=`${r.getY()}px`,this.#ca.push(e),this.#er.appendChild(e)}if(void 0!==r.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=`${r.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=d(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 i(t[0]),o=new f(t[1]),r={};let a,s;for(const t of this.#aa){if(void 0===t)continue;let i=!1;if(t instanceof ml){const e=t.getViewController(),n=e.getOrigin(),l=e.getOrigin(o);let c,u;if(void 0===s)a=n,s=l,c=new h(0,0,0),u=new h(0,0,0);else if(e.isPositionInBounds(o)&&void 0!==l){const e=a.minus(n);c=new h(e.getX(),e.getY(),e.getZ());const t=s.minus(l);u=new h(t.getX(),t.getY(),t.getZ())}void 0!==c&&void 0!==u&&(i=t.setBaseOffset(c,u,s,a),r[t.getId()]={scroll:c,plane:u})}if(t instanceof yl){const e=r[t.getReferenceLayerId()];void 0!==e&&(i=t.setBaseOffset(e.scroll,e.plane))}let l=!1;const c=e.detail?.srclayerid;t.getId()!==c&&(l=t.setCurrentPosition(o,n)),!l&&i&&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 ml){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 ml){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 xl{#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 El extends EventTarget{#Pa;#Aa;#Oa;#ba;#xa=new xl;#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=Al(e),n=this.#Qa(t.groupDivId);return{point:To(e),layerGroup:n}}#Ba(e){const t=Al(e),n=this.#Qa(t.groupDivId);return{point:wo(e)[0],layerGroup:n}}getEventNames(){return[]}wheel=e=>{if(void 0===this.#ba)return;e.preventDefault();const t=Al(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=wo(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=wo(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 Rl(e){return{x:"number"==typeof e?.x?e.x:0,y:"number"==typeof e?.y?e.y:0}}class Fl{#za;#Ha;constructor(e,t,{threshold:n}={}){this.#za={x:t.getX()-e.getX(),y:t.getY()-e.getY()},this.#Ha=Rl(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 Ml 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=Rl(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 Fl(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 Ml{#$a;constructor({activeViewLayerOnly:e=!0}={}){super(),this.#$a=e}setActiveViewLayerOnly(e){this.#$a=e}canStart(e,t){const n=Ks(t,this.#$a);return void 0!==n&&!!n.getViewController().isMonochrome()}onDrag(e,t){const n=Ks(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 Ne(l+r*s,c+o*s);i.setWindowLevel(u)}}class Ul extends Ml{constructor(){super({threshold:{x:15,y:15}})}canStart(e,t){return void 0!==Js(t)||(o.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 Ml{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 Ql extends Ml{onDrag(e,t){const n=Js(t);if(void 0===n)return void o.warn("No view layer to update pan drag behavior");const i=n.getViewController(),r=n.displayToPlaneScale(new g(e.delta.x,e.delta.y)),a=i.getOffset3DFromPlaneOffset({x:r.getX(),y:r.getY()});t.addTranslation({x:a.getX(),y:a.getY(),z:a.getZ()}),t.draw()}}class Nl{onDoubleClick(e,t){}}class Bl extends Nl{#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=Ks(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 Ne(r.getRescaledValueAtIndex(o.getCurrentIndex().getWithNew2D(i.get(0),i.get(1))),o.getWindowLevel().width);o.setWindowLevel(a)}}class kl extends Nl{onDoubleClick(e,t){const n=Js(t);void 0!==n?n.getViewController().play():o.warn("No view layer to play double click behavior")}}class Gl{reset(){}onUpdate(e,t){}onEnd(){this.reset()}}class zl extends Gl{#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 Hl 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 Yl extends Hl{onTap(e,t){super.onTap(e,t);const n=Js(t);if(void 0===n)return void o.warn("No view layer to set current position");const i=n.getViewController(),r=n.displayToPlanePos(e),a=i.getPositionFromPlanePoint(r);i.setCurrentPosition(a)}}class Xl{isActive(){return!1}reset(){}onStart(e){}onUpdate(e,t){return!1}onEnd(){this.reset()}}class Wl extends Xl{#es;#ts;isActive(){return void 0!==this.#es}reset(){this.#es=void 0,this.#ts=void 0}onStart(e){this.#es=new nr(e[0],e[1]),this.#ts=this.#es.getCentroid()}onUpdate(e,t){if(void 0===this.#es)return!1;const n=new nr(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=Js(t);if(void 0===n)return o.warn("No view layer to do touch zoom behavior"),!0;const i=n.getViewController(),r=n.displayToMainPlanePos(this.#ts),a=i.getPlanePositionFromPlanePoint(r);t.addScale(e,a),t.draw()}}return!0}onEnd(){this.#es=void 0,this.reset()}}function $l(e,t){const n=t.getActiveDrawLayer();if(void 0===n)return o.warn("No draw layer to check point"),!1;const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return o.warn("No view layer to check point"),!1;const r=i.displayToPlanePos(e);return i.getViewController().validatePlanePoint(r)}class jl{#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)||(o.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(),r=t.getViewLayerById(n.getReferenceLayerId());if(void 0===r)return void o.warn("No view layer to handle new points");const a=r.getViewController(),s=new ts,l=i.getAnnotationGroup().getColour();s.colour=void 0!==l?l:this.#ns.getLineColour(),s.init(a);const c=this.#cs;if(void 0!==c)for(const e of c)s.addMetaItem(e.concept,e.value);const u=e.map(e=>r.displayToPlanePos(e));return this.#rs.setAnnotationMathShape(s,u),s}onNewPoints(e,t){this.#as&&(this.#as.destroy(),this.#as=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void o.warn("No draw layer to handle new points");const i=n.getKonvaLayer();this.#ps(n);const r=this.#ms(e,t);void 0!==r&&(this.#as=this.#rs.createShapeGroup(r,this.#ns),n.setLabelVisibility(this.#as),this.#as.getChildren(sa)[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 o.warn("No draw layer to handle final points");const i=n.getKonvaLayer(),r=n.getDrawController(),a=this.#ms(e,t);if(void 0===a)return;const s=new fl(a,r);this.#an.getUndoController().addToUndoStack(s),s.execute(),i.listening(!0)}}class Zl extends Hl{#fs;#vs;#Cs;#Ds;constructor(e,t){super(),this.#Cs=new jl(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 _l extends Ml{#Ds;#fs;#vs;#Cs;constructor(e,t){super(),this.#Ds=t,this.#Cs=new jl(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 Kl{#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 Jl{#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 g(-n.x(),-n.y()),new g(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():o.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 Cl(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():o.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():o.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 ec{#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 tc 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 Jl(e,this.#Ms),this.#Hs=new ec}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 Cl(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(sa)[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 g(0,0),max:new g(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 S=To(e.evt),p={x:S.getX(),y:S.getY()},m=this.#js(p,i);this.#Hs.changeChildrenColourOnTrashHover(m,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=To(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 vl(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 Cl(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(aa)[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 g(o.x(),o.y());n.labelPosition=t;const r=new Cl(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(sa)[0];n instanceof e.Shape&&(n.draggable(!1),n.off("dragstart.draw"),n.off("dragmove.draw"),n.off("dragend.draw"));const i=t.getChildren(aa)[0];i instanceof e.Label&&(i.draggable(!1),i.off("dragstart.draw"),i.off("dragend.draw"))}}class nc{mask;dataId;offsetsLists;mode;segmentNumber;srclayerid;originalValuesLists;isSilent}class ic extends Ra{#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 oc="No source image to create mask",rc="No source image to get offsets, ID: {0}",ac="No brush origins",sc="No mask defined when adding mask slices",lc="No created mask image",cc="No mask image for temporary draw command, ID: {0}",uc="No mask image to get offsets from",dc="No mask image for draw command, ID: {0}",hc="No mask ID to apply mask index",gc="No mask view layers",Sc="No selected segment number",pc="Too many mask view layers: {0}",mc="More mask layers than expected",fc="Cannot display mask with no mask ID",vc="Cannot draw with no mask data ID",Cc="Cannot draw with no offsets",Dc="Cannot draw with no colour list",yc="Cannot get mask layers with no mask ID",Ic="Cannot get mask view controller: no mask ID",wc="Cannot get mask view controller: no mask layers",Tc="Cannot find source data for an existing mask, ID: {0}",Lc="Unsupported scroll index: {0}";function Pc(e,...t){return e.replace(/{(\d+)}/g,(e,n)=>t[n]||"")}const Ac="del";function Oc(e,t,n,i){return hr(e.worldToIndex(t),n,i)}class bc 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 ft(i),r=new wt([t],o,e.getSpacing(),e.getOrientation()),a=new Uint8Array(o.getDimSize(2));a.fill(0),++this.#pl;const s=[this.#pl.toString()],l=new ro(r,a,s);return l.setMeta(n),l.setPhotometricInterpretation("PALETTE COLOR"),l.setPaletteColourMap(new Xe([0],[0],[0])),l}#Dl(e,t,n,r,a,s){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 r=n[0].get(2);if(void 0===r)return[];const a=new i([0,0,r]),s=e.indexToWorld(a),l=n.at(-1).get(2);if(void 0===l)return[];const c=new i([0,0,l]),u=e.indexToWorld(c),d=e.getOrigins(),h=.1*e.getSpacing().get(2),g=s.get3D().getClosest(d),S=d[g],p=s.get3D().getDistance(S);p>h&&o.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&&o.warn(`Large distance between origin and origin for last index: ${v}`),[g,m]}(e,Oc(e,n,a,r));if(void 0===l||0===l.length)throw new Error(ac);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(sc);const p=this.#tl.getMeta();for(const e of S)p.numberOfFiles+=1,this.#tl.appendSlice(this.#Cl(t,e,s))}#yl(e,t){if(!t)throw new Error(Pc(oc));const n=t.getGeometry(),o=n.worldToIndex(e).get(2);if(void 0===o)throw new Error("Z position is undefined");const r=new i([0,0,o]),a=n.getOrigins()[o],s=Yi(),l=function(){const e="1.2.826.0.1.3680043.9.7278.1681051091011101.1";return{indices:{value:[{DimensionOrganizationUID:e,DimensionDescriptionLabel:"ReferencedSegmentNumber",DimensionIndexPointer:"(0062,000B)",FunctionalGroupPointer:"(0062,000A)"},{DimensionOrganizationUID:e,DimensionDescriptionLabel:"ImagePositionPatient",DimensionIndexPointer:"(0020,0032)",FunctionalGroupPointer:"(0020,9113)"}]},organizations:{value:[{DimensionOrganizationUID:e}]}}}();s.DimensionOrganizationSequence=l.organizations,s.DimensionIndexSequence=l.indices,s.PixelRepresentation=0,s.numberOfFiles=1;const c=t.getMeta();s.PatientID=c.PatientID,s.StudyInstanceUID=c.StudyInstanceUID,s.SeriesInstanceUID=c.SeriesInstanceUID;const u=[{referencedSOPClassUID:c.SOPClassUID,referencedSOPInstanceUID:t.getImageUid(r)}],d=[];d.push({ReferencedInstanceSequence:{value:u},SeriesInstanceUID:c.SeriesInstanceUID}),s.ReferencedSeriesSequence={value:d},s.custom={referencedSeriesUID:c.SeriesInstanceUID,frameInfos:[{dimIndex:[1,1],refSegmentNumber:1,imagePosPat:a.getValues(),derivationImages:[{sourceImages:u}]}]},s.lengthUnit=t.getMeta().lengthUnit,this.#tl=this.#Cl(n,a,s),this.#tl.setupSegmentCollection();const h=pi(s),g=new Ts(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(fc);const t=new Yc(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&&o.warn(Pc(Tc,t)),n}#Ll(e){if(void 0===this.#Sl)throw new Error(yc);const t=e.getViewLayersByDataId(this.#Sl);if(0===t.length)throw new Error(gc);return 1!==t.length&&o.warn(Pc(pc,t.length)),t[0]}#Pl(e){if(void 0===e)throw new Error(hc);const t=this.#an.getDataController().get(e);if(void 0===t)throw new Error(uc);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(),r=i.getCurrentPosition();let a,s,l,c;if(i.equalImageMeta({Modality:"SEG"})||i.equalImageMeta({Modality:"RTSTRUCT"})){this.#tl=this.#Pl(this.#Sl);const t=this.#Tl(this.#tl),r=this.#an.getDataController().get(t);if(!r)throw new Error(Pc(rc,t));if(c=r.image,c.isResampled())return o.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),a=n,s=i}else{const u=n.getDataId(),d=this.#an.getDataController().get(u);if(!d)throw new Error(Pc(rc,u));if(c=d.image,c.isResampled())return o.warn("Cannot create mask on resampled image."),[];const h=n.displayToPlanePos(e);if(l=i.getPositionFromPlanePoint(h),this.#Sl=this.#yl(r,c),void 0===this.#tl)throw new Error(lc);const g=t.getDivId(),S=void 0!==g;S&&this.#wl(g),a=this.#Ll(t),s=a.getViewController(),S&&s.setCurrentPosition(r)}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(Pc(Lc,m))}this.#Dl(u,h,l,p,S,d);const f=a.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,Oc(h,s.getPositionFromPlanePoint(f),S,p))}#Ol(e){const t=this.#bl().getId();if(void 0===this.#Sl)throw new Error(hc);const n=this.#an.getDataController().get(this.#Sl);if(!n)throw new Error(Pc(cc,this.#Sl));const i=new nc;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 ic(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(vc);if(void 0===this.#ml)throw new Error(Cc);if(void 0===this.#fl)throw new Error(Dc);this.#ml.reverse(),this.#fl.reverse();const e=this.#bl().getId(),t=this.#an.getDataController().get(this.#Sl);if(!t)throw new Error(Pc(dc,this.#Sl));const n=new nc;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 ic(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(Ic);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(wc);return 1!==e.length&&o.warn(mc),e[0]}}const xc=["brushsizechange","brushdraw","brushremove"];class Ec extends Ml{#an;#xl;#El=!1;#Rl=[];constructor(e){super(),this.#an=e,this.#xl=new bc({app:e});for(const e of xc)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)?(o.warn("Cannot paint on series with overlapping slices"),1):void 0===this.#xl.getSelectedSegmentNumber()&&(o.warn(Sc),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 ml}#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(Ac),this.dispatchEvent(new CustomEvent("erasingactivated"))}#Ul(){this.#El&&this.#xl.getBrushMode()===Ac&&(this.#xl.setBrushMode("add"),this.dispatchEvent(new CustomEvent("erasingdeactivated"))),this.#El=!1}}class Rc extends Ml{#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());o.warn("No draw layer to do floodfill")}#Wl=(e,t)=>{const n=this.#Xl(t);if(void 0===n)return void o.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 g(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 o.warn("No draw layer to paint border"),!1;const t=e.getDrawController(),i=new cr(this.#Nl);let r;if(void 0===this.#Ur){this.#Ur=new ts,this.#Ur.colour=this.#ns.getLineColour();const a=n.getViewLayerById(e.getReferenceLayerId());if(void 0===a)return o.warn("No view layer to paint border"),!1;const s=a.getViewController();this.#Ur.init(s),this.#Ur.mathShape=i,r=new fl(this.#Ur,t)}else{const e=this.#Ur.mathShape;r=new Cl(this.#Ur,{mathShape:e},{mathShape:i},t)}this.#an.getUndoController().addToUndoStack(r),r.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 r=t.getActiveDrawLayer();if(void 0===r){i=t.getActiveViewLayer();const e=i.getDataId(),n=this.#an.createAnnotationData(e),o=t.getDivId().replace("-layer-0","");this.#an.addAndRenderAnnotationData(n,o,e),r=t.getActiveDrawLayer(),r.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(r.getDataId())}else if(i=t.getViewLayerById(r.getReferenceLayerId()),void 0===i)return void o.warn("No view layer to start floodfill");this.#Ql=i.getImageData(),void 0!==this.#Ql?(this.#ns.setZoomScale(r.getKonvaLayer().getAbsoluteScale()),this.#Vl=this.#Wl(e,t),this.#jl(this.#Vl,this.#kl,t),super.onStart(e,t,n)):o.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 Fc{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 Mc{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 Uc(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++){Uc(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};Uc(e,t,n,i,a),Uc(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 Mc(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 Qc extends Hl{#an;#ns;#Ya;#Ur;#Kl=new Fc;#Jl=new Fc;#Yl=[];#ec=5;#tc=new Vc;#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 Fc,this.#Jl=new Fc}#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 g(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 g(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 o.warn("No draw layer to update livewire");const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return void o.warn("No view layer to update livewire");const r=i.displayToPlaneIndex(e);let a,s={x:r.get(0),y:r.get(1)};this.#tc.setPoint(s);let l=!1;for(;!this.#Yl[s.y][s.x]&&!l;)if(a=this.#tc.doWork(),0===a.length)l=!0;else for(let e=0;e<a.length-1;e+=2){const t=a[e],n=a[e+1];this.#Yl[t.y][t.x]=n}for(this.#Jl=new Fc,l=!1;s&&!l;)this.#Jl.addPoint(new g(s.x,s.y)),this.#Yl[s.y]&&this.#Yl[s.y][s.x]?s=this.#Yl[s.y][s.x]:l=!0;this.#Jl.appenPath(this.#Kl);const c=n.getDrawController(),u=new cr(this.#Jl.pointArray);let d;if(void 0===this.#Ur){this.#Ur=new ts,this.#Ur.colour=this.#ns.getLineColour();const e=i.getViewController();this.#Ur.init(e),this.#Ur.mathShape=u,d=new fl(this.#Ur,c)}else{const e=this.#Ur.mathShape;d=new Cl(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 Nc={},Bc={WindowLevel:class extends El{#an;#Aa;#Ea;constructor(e){const t=new ql,n=new Bl({dataController:e.getDataController()});super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new tl,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&&(o.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 El{#an;#oc;constructor(e){const t=new zl;super({stageController:e.getStageController(),dragBehavior:new Ul,hoverBehavior:t,wheelBehavior:new tl,doubleClickBehavior:new kl,tapBehavior:new Yl}),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 El{#an;constructor(e){super({stageController:e.getStageController(),dragBehavior:new Ql,wheelBehavior:new nl,twoTouchBehavior:new Wl,tapBehavior:new Yl}),this.#an=e}keydown=e=>{e.context="ZoomAndPan",this.#an.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Opacity:class extends El{#an;constructor(e){super({stageController:e.getStageController(),dragBehavior:new Vl,wheelBehavior:new tl}),this.#an=e}keydown=e=>{e.context="Opacity",this.#an.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Draw:class extends El{#an;#Ds;#rc;#ac;#Hr;constructor(e){const t=new tc(e),n=new Kl(e,t),i=new Zl(e,n),o=new _l(e,n);super({stageController:e.getStageController(),dragBehavior:o,tapBehavior:i,wheelBehavior:new tl}),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 o.warn("No draw layer to handle key down");const n=e.getDrawController(),i=this.#an.getUndoController(),r=new vl(t,n);i.addToUndoStack(r),r.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 El{#sc;#an;constructor(e){const t=new Ec(e);super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new tl,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:Ac}):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 El{#an;#Ds;#Aa;#ns=new lo;constructor(e){const t=new lo,n=new tc(e),i=new Kl(e,n),o=new Rc(e,t,i);super({stageController:e.getStageController(),dragBehavior:o,wheelBehavior:new tl}),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 El{#an;#Ds;#Fa;#ns;constructor(e){const t=new lo,n=new tc(e),i=new Kl(e,n),o=new Qc(e,t,i);super({stageController:e.getStageController(),tapBehavior:o,wheelBehavior:new tl}),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)}}},kc={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 Ne(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 f(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 S(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 Gc{#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:o.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 bl(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 zc=["viewlayeradd","drawlayeradd","error","zoomchange","offsetchange","layerremove","outofrange","renderstart","renderend",...ll];class Hc extends EventTarget{#mc=null;#ja;#Mi;#fc;#vc;#Cc;constructor(e,t){super(),this.#ja=e,this.#Mi=t,this.#mc=new Gc,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 S(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,r=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 o=t[n],a=this.#mc.getLayerGroupByDivId(o.divId);if(!a)throw new Error(`No layer group for ${o.divId}`);!i||this.#Ic(e,a)?(i&&0===a.getViewLayersByDataId(e).length?this.#wc(e,o):r&&0===a.getDrawLayersByDataId(e).length&&this.#Tc(e,o),a.draw()):this.dispatchEvent(new CustomEvent("error",{detail:{error:new Error("Render error: incompatible geometries for overlay"),dataid:e}}))}else o.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 ll)e.addEventListener(t,this.#Lc);e.addEventListener("wlchange",e=>{const t=e.detail?.srclayerid,n=e.detail?.dataid,i=e.detail?.value,o=Pl(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=Pl(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=Pl(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,It)}}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 al).create(n.meta,n.image),a=rt(o.getOrientation(),et(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 Ne(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=rt(c.getOrientation(),et(t.orientation)),d=c.getSize(u).get2D(),h=c.getSpacing(u).get2D(),g=n.addDrawLayer();g.initialise(d,h,r.getId());const S=new hl(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=tt(e.asOneAndZeros());if(void 0===n)throw new Error("Unsupported undefined orientation code");const i=void 0===t,r=!i&&t===Je.Axial,a=!i&&t===Je.Coronal,s=!i&&t===Je.Sagittal,l={x:!1,y:!1},c={x:!1,y:!1,z:!1};return"LPS"===n?(a||s)&&(c.z=!0,l.y=!0):"LAI"===n?i||r?l.y=!0:a?c.z=!0:s&&(c.z=!0,l.x=!0):"RPI"===n?i||r?l.x=!0:a?(c.z=!0,l.x=!0):s&&(c.z=!0):"RAS"===n?(l.x=!0,l.y=!0,(a||s)&&(c.z=!0)):"LSA"===n?(l.y=!0,i||a?c.z=!0:r?c.y=!0:s&&(l.x=!0,c.y=!0,c.z=!0)):"RSP"===n?i||a?(l.x=!0,l.y=!0,c.x=!0,c.z=!0):r?(l.x=!0,c.x=!0):s&&(l.y=!0,c.z=!0):"RIA"===n?(l.x=!0,i||a?c.x=!0:r?(l.y=!0,c.x=!0,c.y=!0):s&&(c.y=!0)):"PSL"===n?(c.z=!0,(i||s||a)&&(l.y=!0)):"PIR"===n?(c.z=!0,(r||a)&&(l.x=!0)):"ASR"===n?(l.x=!0,l.y=!0,(i||s||a)&&(c.z=!0)):"AIL"===n?i||s?(l.x=!0,c.z=!0):r?l.y=!0:a&&(c.z=!0):"LIP"!==n&&o.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 Yc{divId;orientation;colourMap;opacity;fillOpacity;contourThickness;wlPresetName;windowCenter;windowWidth;constructor(e){this.divId=e}}class Xc{options;constructor(e){this.options=e}}class Wc{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 lo;#ga={};getDataController(){return this.#ja}getData(e){return o.debug("App.getData: deprecated since v0.37, please use via app.getDataController."),this.#ja.get(e)}getImage(e){let t;return o.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){o.debug("App.setImage: deprecated since v0.37, please use via app.getDataController."),this.#ja.setImage(e,t)}getNextDataId(){return o.debug("App.getNextDataId: deprecated since v0.37, please use via app.getDataController."),this.#ja.getNextDataId()}addData(e,t){return o.debug("App.addData: deprecated since v0.37, please use via app.getDataController."),this.#ja.add(e,t)}getMetaData(e){let t;return o.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 o.debug("App.getDataIds: deprecated since v0.37, please use via app.getDataController."),this.#ja.getDataIds()}getDataIdsFromSopUids(e){return o.debug("App.getDataIdsFromSopUids: deprecated since v0.37, please use via app.getDataController."),this.#ja.getDataIdsFromSopUids(e)}getDataIdFromSeriesUid(e){return o.debug("App.getDataIdFromSeriesUid: deprecated since v0.37, please use via app.getDataController."),this.#ja.getDataIdFromSeriesUid(e)}canScroll(){return o.debug("App.canScroll: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Pa.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()}canWindowLevel(){return o.debug("App.canWindowLevel: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Pa.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()}getAddedScale(){return o.debug("App.getAddedScale: deprecated since v0.37, please access from the active layer group."),this.#Pa.getAddedScale()}getBaseScale(){return o.debug("App.getBaseScale: deprecated since v0.37, please access from the active layer group."),this.#Pa.getBaseScale()}getOffset(){return o.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 o.debug("App.getActiveLayerGroup: deprecated since v0.37, use app.getStageController().getActiveLayerGroup()"),this.#Pa.getActiveLayerGroup()}setActiveLayerGroup(e){o.debug("App.setActiveLayerGroup: deprecated since v0.37, use app.getStageController().setActiveLayerGroup()"),this.#Pa.setActiveLayerGroup(e)}getViewLayersByDataId(e){return o.debug("App.getViewLayersByDataId: deprecated since v0.37, use app.getStageController().getViewLayersByDataId()"),this.#Pa.getViewLayersByDataId(e)}getViewLayers(e){return o.debug("App.getViewLayers: deprecated since v0.37, use app.getStageController().getViewLayers()"),this.#Pa.getViewLayers(e)}getDrawLayersByDataId(e){return o.debug("App.getDrawLayersByDataId: deprecated since v0.37, use app.getStageController().getDrawLayersByDataId()"),this.#Pa.getDrawLayersByDataId(e)}getDrawLayers(e){return o.debug("App.getDrawLayers: deprecated since v0.37, use app.getStageController().getDrawLayers()"),this.#Pa.getDrawLayers(e)}getLayerGroupByDivId(e){return o.debug("App.getLayerGroupByDivId: deprecated since v0.37, use app.getStageController().getLayerGroupByDivId()"),this.#Pa.getLayerGroupByDivId(e)}getNumberOfLayerGroups(){return o.debug("App.getNumberOfLayerGroups: deprecated since v0.37, use app.getStageController().getNumberOfLayerGroups()"),this.#Pa.getNumberOfLayerGroups()}getStyle(){return this.#ns}addToUndoStack=e=>{o.debug("App.addToUndoStack: deprecated since v0.37, please use via app.getUndoController."),null!==this.#Ec&&this.#Ec.addToUndoStack(e)};removeFromUndoStack=e=>{o.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 Hs(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 zs)"loadstart"!==e&&"loaditem"!==e&&"load"!==e&&this.#xc.addEventListener(e,this.#Er);this.#ja=new Ps;for(const e of Is)this.#ja.addEventListener(e,this.#Er);for(const e of no)this.#ja.addEventListener(e,this.#Er);for(const e of ao)this.#ja.addEventListener(e,this.#Er);this.#Ec=new Xs;for(const e of Ys)this.#Ec.addEventListener(e,this.#Er);this.#Pa=new Hc(this.#ja,this.#Mi),this.#Pa.setAddToUndoStack(e=>this.#Ec.addToUndoStack(e)),this.#Pa.setGetInfoData(e=>this.getInfoData(e));for(const e of zc)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 r=Bc[i];if(void 0===r&&(r=Nc[i]),void 0!==r){if(e[i]=new r(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,r="raw";if(void 0!==e[i].getOptionsType&&(r=e[i].getOptionsType()),"instance"===r||"factory"===r){n={};for(let e=0;e<t.options.length;++e){const a=t.options[e];let s=a;"factory"===r&&(s+="Factory");const l=i.charAt(0).toLowerCase()+i.slice(1);let c,u=Na[l];void 0!==u&&(c=u[s]),void 0===c&&(u=Ba[l],void 0!==u&&(c=u[s])),void 0!==c?n[a]=c:o.warn(`Could not find option class for: ${a}`)}}else n=t.options;e[i].setOptions(n)}}else o.warn(`Could not initialise unknown tool: ${i}`)}this.#fc=new Po(e),this.#Pa.setToolboxController(this.#fc)}}reset(){this.#Pa.empty(),this.#ga={},this.#Ec&&this.#Ec.reset()}resetLayout(){o.debug("App.resetLayout: deprecated since v0.35, prefer resetZoomPan."),this.#Pa.resetLayout()}resetZoomPan(){o.debug("App.resetZoomPan: deprecated since v0.37, use app.getStageController().resetZoomPan()"),this.#Pa.resetZoomPan()}resetViews(){o.debug("App.resetViews: deprecated since v0.37, use app.getStageController().resetViews()"),this.#Pa.resetViews()}loadFiles=e=>{if(0===e.length)return o.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 o.warn("Ignoring empty input url list."),"-1";const n=this.#ja.getNextDataId();return this.#xc.loadURLs(e,n,t),n};loadFromUri=(e,t)=>{o.debug("App.loadFromUri: deprecated since v0.36, please extract the file list and pass it to loadURLs.");const n=mo(e);n&&void 0!==n.input&&function(e,t,n){e.type&&"manifest"===e.type?Do(e.input,e.nslices,t):t(Co(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(){o.debug("App.fitToContainer: deprecated since v0.37, use app.getStageController().fitToContainer()"),this.#Pa.fitToContainer()}initWLDisplay(){o.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){o.debug("App.setImageSmoothing: deprecated since v0.37, use app.getStageController().setImageSmoothing()"),this.#Pa.setImageSmoothing(e)}getViewConfigs(e,t){return o.debug("App.getViewConfigs: deprecated since v0.37, use app.getStageController().getViewConfigs()"),this.#Pa.getViewConfigs(e,t)}getViewConfig(e,t,n){return o.debug("App.getViewConfig: deprecated since v0.37, use app.getStageController().getViewConfig()"),this.#Pa.getViewConfig(e,t,n)}getDataViewConfigs(){return o.debug("App.getDataViewConfigs: deprecated since v0.37, use app.getStageController().getDataViewConfigs()"),this.#Pa.getDataViewConfigs()}setDataViewConfigs(e){o.debug("App.setDataViewConfigs: deprecated since v0.37, use app.getStageController().setDataViewConfigs()"),this.#Pa.setDataViewConfigs(e)}addDataViewConfig(e,t,n){o.debug("App.addDataViewConfig: deprecated since v0.37, use app.getStageController().addDataViewConfig()"),this.#Pa.addDataViewConfig(e,t,n)}removeDataViewConfig(e,t){o.debug("App.removeDataViewConfig: deprecated since v0.37, use app.getStageController().removeDataViewConfig()"),this.#Pa.removeDataViewConfig(e,t)}updateDataViewConfig(e,t,n){o.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!==kc[e[n]]&&t.push(new kc[e[n]]);this.#Pa.setBinders(t)}render(e,t){o.debug("App.render: deprecated since v0.37, use app.getStageController().render()"),this.#Pa.render(e,t)}zoom(e,t,n){o.debug("App.zoom: deprecated since v0.37, please access from the active layer group."),this.#Pa.zoom(e,t,n)}translate(e,t){o.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 o.debug(`Cannot resample match, target data '${e}' is undefined`);if(void 0===n.image)return void o.debug(`Cannot resample match, target image '${e}' is undefined`);const i=this.#ja.get(t);if(void 0===i)return void o.debug(`Cannot resample match, source data '${t}' is undefined`);if(void 0===i.image)return void o.debug(`Cannot resample match, source image '${t}' is undefined`);const r=n.image.getGeometry().getOrientation(),a=i.image.getGeometry().getOrientation();r.equals(a)?o.info(`Same orientation, no resample match for data '${e}' and '${t}'`):this.resample(e,a)}resample(e,t){const n=this.#ja.get(e);if(void 0===n)return void o.debug(`Cannot resample, target data '${e}' is undefined`);if(void 0===n.image)return void o.debug(`Cannot resample, target image '${e}' is undefined`);if(n.image.getGeometry().getOrientation().equals(t))return void o.info(`Same orientation, no resample for data '${e}'`);n.image.resample(t);const i=this.#Mi.dataViewConfigs,r=n.image.getMeta(),a=this.#ja.getDataIds();for(let e=0;e<a.length;e++){const t=this.#ja.get(a[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===r.SeriesInstanceUID&&this.#ja.stash(a[e])}const s=this.getStageController();s.setDataViewConfigs(i);const l=this.#ja.getDataIds();for(let e=0;e<l.length;++e)s.render(l[e])}revertResample(e){const t=this.#ja.get(e);if(void 0===t)return void o.debug(`Cannot revert resample, target data '${e}' is undefined`);if(void 0===t.image)return void o.debug(`Cannot revert resample, target image '${e}' is undefined`);if(!t.image.isResampled())return void o.info(`No revert resample needed for data '${e}'`);t.image.revert();const n=this.#Mi.dataViewConfigs,i=t.image.getMeta(),r=this.#ja.getStashedDataIds();for(let e=0;e<r.length;e++){const t=this.#ja.getStashed(r[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===i.SeriesInstanceUID&&this.#ja.unstash(r[e])}const a=this.getStageController();a.setDataViewConfigs(n);const s=this.#ja.getDataIds();for(let e=0;e<s.length;++e)a.render(s[e])}setOpacity(e){o.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,r){o.debug("App.setDrawings: deprecated since v0.34, please switch to DICOM SR annotations.");const a=this.#Pa.getActiveLayerGroup().getBaseViewLayer(),s=a.getDataId(),l=this.#ja.get(s),c=a.getViewController(),u=function(t,n,r){const a=[],s=e.Node.create(t).getChildren(la);for(let e=0,t=s.length;e<t;++e){const t=s[e],l=t.getChildren();for(let e=0,s=l.length;e<s;++e){const e=new ts,s=new i(Il(t.id()));e.referencedSopInstanceUID=r.getImageUid(s);const c=l[0];e.trackingId=c.id(),e.trackingUid=c.id();const u=c.getChildren(sa)[0];if(e.colour=u.stroke(),"line-group"===c.name()){const t=u.points();e.mathShape=new g(t[0],t[1]),e.referencePoints=[new g(t[2],t[3])]}else if("ruler-group"===c.name()){const t=u.points();e.mathShape=new nr(new g(t[0],t[1]),new g(t[2],t[3]))}else if("rectangle-group"===c.name())e.mathShape=new gr(new g(u.x(),u.y()),new g(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 g(t[e],t[e+1]));e.mathShape=new cr(n)}else if("freeHand-group"===c.name()){o.warn("Converting freehand into ROI shape");const t=u.points(),n=[];for(let e=0;e<t.length;e+=2)n.push(new g(t[e],t[e+1]));e.mathShape=new cr(n)}else if("protractor-group"===c.name()){const t=u.points();e.mathShape=new lr([new g(t[0],t[1]),new g(t[2],t[3]),new g(t[4],t[5])])}else if("ellipse-group"===c.name()){const t=u.absolutePosition();e.mathShape=new dr(new g(t.x,t.y),u.radiusX(),u.radiusY())}else if("circle-group"===c.name()){const t=u.absolutePosition();e.mathShape=new ur(new g(t.x,t.y),u.radius())}else if("bidimensional-group"===c.name()){const t=u.points(),i=new pr(new g(t[0],t[1]),new g(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 pr.restorePropertiesFromQuantification?pr.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}a.push(e)}}return a}(t,n,l.image),d=this.createAnnotationData(s);for(const e of u)e.setViewController(c),d.annotationGroup.add(e);this.#ja.add(r,d),this.#Pa.render(r)}applyJsonState(e,t){o.debug("App.applyJsonState: deprecated since v0.34, please switch to DICOM SR for annotations.");const n=new co(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){o.debug("App.setColourMap: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Pa.getActiveLayerGroup().getActiveViewLayer().getViewController().setColourMap(e)}setWindowLevelPreset(e){o.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(){o.debug("App.undo: deprecated since v0.37, please use via app.getUndoController."),this.#Ec.undo()}redo(){o.debug("App.redo: deprecated since v0.37, please use via app.getUndoController."),this.#Ec.redo()}getStackSize(){return o.debug("App.getStackSize: deprecated since v0.37, please use via app.getUndoController."),this.#Ec.getStackSize()}getCurrentStackIndex(){return o.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 Ts({});n.annotationGroup=new so,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 Yc(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 _s(this,e.detail.dataid,this.#Mi.overlayConfig)),this.#Er(e)};#Fc=e=>{void 0===e.detail.data&&o.error("Missing loaditem event data."),void 0===e.detail.loadtype&&o.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 jc{#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 r=this.getSegment(e[i]);void 0!==r?void 0!==r.displayValue?t.push(r.displayValue):t.push(r.number):(o.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)):o.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):o.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:o.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 Zc extends Ra{#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 jc(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 jc(this.#tl).addSegment(this.#Uc),this.onUndo({type:"masksegmentredraw",segmentnumber:this.#Uc.number})}onExecute(e){}onUndo(e){}}class _c extends Ra{#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 Kc{diameter;offset1;offset2}class Jc{major;minor}class eu{centroid;centroidIndex;volume;count;diameters;height;id;largestSliceZ}class tu{x;y}class nu{x;y;z}export{ts as Annotation,so as AnnotationGroup,os as AnnotationGroupFactory,$c as App,Wc as AppOptions,r as BooleanResult,is as CADReport,_c as ChangeSegmentColourCommand,ur as Circle,Xe as ColourMap,Ra as Command,Ps as DataController,re as DataElement,Zc as DeleteSegmentCommand,Kc as Diameter,Jc as Diameters,un as DicomCode,Ts as DicomData,be as DicomParser,ea as DicomSRContent,Ka as DicomWriter,ic as DrawBrushCommand,nc as DrawBrushCommandProperties,Dl as DrawController,yl as DrawLayer,tc as DrawShapeHandler,dr as Ellipse,wt as Geometry,ro as Image,Ni as ImageContour,i as Index,_s as InfoData,Ws as InfoDataItem,eu as Label,bl as LayerGroup,Xi as MaskFactory,Ui as MaskSegment,jc as MaskSegmentHelper,sl as MaskSegmentViewHelper,je as Matrix33,At as NormalisedManufacturers,s as NumberRange,a as NumberValue,Je as Orientation,hl as PlaneHelper,f as Point,g as Point2D,S as Point3D,Sl as PositionHelper,lr as Protractor,mi as RGB,cr as ROI,ss as RTROI,as as RTROIContour,gr as Rectangle,Me as RescaleSlopeAndIntercept,ns as ResponseEvaluation,ys as RtStructFactory,Ma as RunFilterCommand,tu as Scalar2D,nu as Scalar3D,tl as ScrollWheelBehavior,ki as SegmentCollection,ft as Size,at as Spacing,Hc as StageController,E as Tag,te as TagInfo,Xc as ToolConfig,Po as ToolboxController,Xs as UndoController,h as Vector3D,ul as View,Yc as ViewConfig,pl as ViewController,ml as ViewLayer,el as WheelBehavior,Ne as WindowLevel,Ge as WindowPreset,za as WriterRule,H as addTagsToDictionary,ms as bufferToPolygons,x as buildMultipart,io as createImage,oo as createMaskImage,cl as createView,$e as custom,Bc as defaultToolList,Ba as defaultToolOptions,Be as equalWl,gi as getAsSimpleTagValues,ds as getDefaultDicomRTStructJson,Yi as getDefaultDicomSegJson,na as getDicomSRContentItem,ie as getDicomTagGroupName,ne as getDicomTagInfo,he as getDwvVersion,pi as getElementsFromSimpleTagValues,hr as getEllipseIndices,Al as getLayerDetailsFromEvent,Ot as getManufacturer,To as getMousePoint,bt as getNormalisedManufacturer,it as getOrientationName,N as getPixelDataTag,ls as getRTStructFromElements,Sr as getRectangleIndices,pt as getReferencedSeriesUID,mt as getReferencedSeriesUIDFromRTStruct,ve as getReverseOrientation,ta as getSRContent,Gn as getSegmentationCode,F as getTagFromKey,wo as getTouchPoints,Le as getTypedArray,Ya as getUID,fo as getURLsFromKeyValueUri,vo as handleURLsFromWeasisXMLManifest,pe as hasDicomPrefix,Ci as hexToRgb,v as i18n,fi as isEqualRgb,Ii as labToUintLab,o as logger,We as luts,Wi as mergeMaskImages,Si as mergeTagValues,d as precisionRound,Di as rgbToHex,vs as simplifyPolygon,Li as srgbToCielab,Nc as toolList,Na as toolOptions};
2
2
  //# sourceMappingURL=dwv.min.js.map