dwv 0.37.0-beta.9 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/workers/jpeg2000.worker.min.js +1 -1
- package/dist/assets/workers/jpeg2000.worker.min.js.map +1 -1
- package/dist/assets/workers/jpegbaseline.worker.min.js +1 -1
- package/dist/assets/workers/jpegbaseline.worker.min.js.map +1 -1
- package/dist/assets/workers/jpegloss.worker.min.js +1 -1
- package/dist/assets/workers/jpegloss.worker.min.js.map +1 -1
- package/dist/assets/workers/labeling.worker.min.js +1 -1
- package/dist/assets/workers/labeling.worker.min.js.map +1 -1
- package/dist/assets/workers/resampling.worker.min.js +1 -1
- package/dist/assets/workers/resampling.worker.min.js.map +1 -1
- package/dist/assets/workers/rle.worker.min.js +1 -1
- package/dist/assets/workers/rle.worker.min.js.map +1 -1
- package/dist/dwv.d.ts +1320 -331
- package/dist/dwv.min.js +1 -1
- package/dist/dwv.min.js.map +1 -1
- package/dist/dwv.node.min.js +1 -1
- package/dist/dwv.node.min.js.map +1 -1
- package/package.json +21 -23
- package/readme.md +7 -3
package/dist/dwv.node.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as e}from"konva";import{default as t}from"jszip";import{default as n}from"magic-wand-tool";const i={m:{},d:(e,t)=>{if(Array.isArray(t))for(var n=0;n<t.length;){var o=t[n++],r=t[n++];i.o(e,o)?0===r&&n++:0===r?Object.defineProperty(e,o,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,o,{enumerable:!0,get:r})}else for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},u:e=>"assets/workers/"+{112:"jpegloss.worker",201:"resampling.worker",326:"rle.worker",391:"labeling.worker",557:"jpeg2000.worker",968:"jpegbaseline.worker"}[e]+".min.js",o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};i.wc="undefined"!=typeof Worker?Worker:"undefined"!=typeof process&&"function"==typeof process.getBuiltinModule&&process.getBuiltinModule("node:worker_threads").Worker,(()=>{let e;if("string"==typeof import.meta.url&&(e=import.meta.url),!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=e})(),i.b=new URL("./",import.meta.url);class o{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create index with no values.");if(0===e.length)throw new Error("Cannot create index with empty values.");if(!e.every((function(e){return!isNaN(e)})))throw new Error("Cannot create index with non number values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return`(${this.#e.toString()})`}getValues(){return this.#e.slice()}canCompare(e){return!!e&&this.length()===e.length()}equals(e){if(!this.canCompare(e))return!1;for(let t=0,n=this.length();t<n;++t)if(this.get(t)!==e.get(t))return!1;return!0}compare(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)this.get(n)!==e.get(n)&&t.push(n);return t}add(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)t.push(this.get(n)+e.get(n));return new o(t)}#t(e,t){const n=this.#e.slice();return e<n.length?n[e]+=t:console.warn("Cannot add to given dimension: ",e,n.length),new o(n)}next(e){return this.#t(e,1)}previous(e){return this.#t(e,-1)}getWithNew2D(e,t){const n=[e,t];for(let e=2,t=this.length();e<t;++e)n.push(this.get(e));return new o(n)}}const r={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 a{success;message;constructor(e){this.success=e}}Number.EPSILON;class s{value;unit}class l{min;max;constructor(e,t){this.min=e,this.max=t}}function c(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)<n}function u(e,t,n,i){return function(e,t,n){void 0===t&&(t=Number.EPSILON),void 0===n&&(n=1);const i=Math.abs(e)/t,o=i<n,r=new a(o);return o||(r.message=`${h(i,2)}`),r}(e-t,n,i)}function d(e){let t=e>1e-4;return t&&(t=e>.001,t?(t=e>.01,t||r.warn("Using larger+ real world epsilon")):r.warn("Using larger real world epsilon")),t}function h(e,t){const n=Math.pow(10,t),i=.01/n;return Math.round(e*n+i)/n}class g{#n;#i;#o;constructor(e,t,n){this.#n=e,this.#i=t,this.#o=n}getX(){return this.#n}getY(){return this.#i}getZ(){return this.#o}equals(e){return null!==e&&this.#n===e.getX()&&this.#i===e.getY()&&this.#o===e.getZ()}toString(){return`(${this.#n}, ${this.#i}, ${this.#o})`}norm(){return Math.sqrt(this.#n*this.#n+this.#i*this.#i+this.#o*this.#o)}crossProduct(e){return new g(this.#i*e.getZ()-e.getY()*this.#o,this.#o*e.getX()-e.getZ()*this.#n,this.#n*e.getY()-e.getX()*this.#i)}dotProduct(e){return this.#n*e.getX()+this.#i*e.getY()+this.#o*e.getZ()}isCodirectional(e){return this.dotProduct(e)>0}}class S{#n;#i;constructor(e,t){this.#n=e,this.#i=t}getX(){return this.#n}getY(){return this.#i}getValues(){return[this.#n,this.#i]}getCentroid(){return this}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 p{#n;#i;#o;constructor(e,t,n){this.#n=e,this.#i=t,this.#o=n}getX(){return this.#n}getY(){return this.#i}getZ(){return this.#o}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&&c(this.#n,e.getX(),t)&&c(this.#i,e.getY(),t)&&c(this.#o,e.getZ(),t)}toString(){return`(${this.#n}, ${this.#i}, ${this.#o})`}getDistance(e){return Math.sqrt(this.#r(e))}#r(e){const t=this.#n-e.getX(),n=this.#i-e.getY(),i=this.#o-e.getZ();return t*t+n*n+i*i}getClosest(e){let t=0,n=this.#r(e[t]);for(let i=0;i<e.length;++i){const o=this.#r(e[i]);o<n&&(t=i,n=o)}return t}minus(e){return new g(this.#n-e.getX(),this.#i-e.getY(),this.#o-e.getZ())}}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 p(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}const x={"0000":{"0000":["UL","1","CommandGroupLength"],"0001":["UL","1","CommandLengthToEnd"],"0002":["UI","1","AffectedSOPClassUID"],"0003":["UI","1","RequestedSOPClassUID"],"0010":["SH","1","CommandRecognitionCode"],"0100":["US","1","CommandField"],"0110":["US","1","MessageID"],"0120":["US","1","MessageIDBeingRespondedTo"],"0200":["AE","1","Initiator"],"0300":["AE","1","Receiver"],"0400":["AE","1","FindLocation"],"0600":["AE","1","MoveDestination"],"0700":["US","1","Priority"],"0800":["US","1","CommandDataSetType"],"0850":["US","1","NumberOfMatches"],"0860":["US","1","ResponseSequenceNumber"],"0900":["US","1","Status"],"0901":["AT","1-n","OffendingElement"],"0902":["LO","1","ErrorComment"],"0903":["US","1","ErrorID"],1e3:["UI","1","AffectedSOPInstanceUID"],1001:["UI","1","RequestedSOPInstanceUID"],1002:["US","1","EventTypeID"],1005:["AT","1-n","AttributeIdentifierList"],1008:["US","1","ActionTypeID"],1020:["US","1","NumberOfRemainingSuboperations"],1021:["US","1","NumberOfCompletedSuboperations"],1022:["US","1","NumberOfFailedSuboperations"],1023:["US","1","NumberOfWarningSuboperations"],1030:["AE","1","MoveOriginatorApplicationEntityTitle"],1031:["US","1","MoveOriginatorMessageID"],4e3:["LT","1","DialogReceiver"],4010:["LT","1","TerminalType"],5010:["SH","1","MessageSetID"],5020:["SH","1","EndMessageID"],5110:["LT","1","DisplayFormat"],5120:["LT","1","PagePositionID"],5130:["CS","1","TextFormatID"],5140:["CS","1","NormalReverse"],5150:["CS","1","AddGrayScale"],5160:["CS","1","Borders"],5170:["IS","1","Copies"],5180:["CS","1","CommandMagnificationType"],5190:["CS","1","Erase"],"51A0":["CS","1","Print"],"51B0":["US","1-n","Overlays"]},"0002":{"0000":["UL","1","FileMetaInformationGroupLength"],"0001":["OB","1","FileMetaInformationVersion"],"0002":["UI","1","MediaStorageSOPClassUID"],"0003":["UI","1","MediaStorageSOPInstanceUID"],"0010":["UI","1","TransferSyntaxUID"],"0012":["UI","1","ImplementationClassUID"],"0013":["SH","1","ImplementationVersionName"],"0016":["AE","1","SourceApplicationEntityTitle"],"0017":["AE","1","SendingApplicationEntityTitle"],"0018":["AE","1","ReceivingApplicationEntityTitle"],"0026":["UR","1","SourcePresentationAddress"],"0027":["UR","1","SendingPresentationAddress"],"0028":["UR","1","ReceivingPresentationAddress"],"0031":["OB","1","RTVMetaInformationVersion"],"0032":["UI","1","RTVCommunicationSOPClassUID"],"0033":["UI","1","RTVCommunicationSOPInstanceUID"],"0035":["OB","1","RTVSourceIdentifier"],"0036":["OB","1","RTVFlowIdentifier"],"0037":["UL","1","RTVFlowRTPSamplingRate"],"0038":["FD","1","RTVFlowActualFrameDuration"],"0100":["UI","1","PrivateInformationCreatorUID"],"0102":["OB","1","PrivateInformation"]},"0004":{"0000":["UL","1","GenericGroupLength"],1130:["CS","1","FileSetID"],1141:["CS","1-8","FileSetDescriptorFileID"],1142:["CS","1","SpecificCharacterSetOfFileSetDescriptorFile"],1200:["UL","1","OffsetOfTheFirstDirectoryRecordOfTheRootDirectoryEntity"],1202:["UL","1","OffsetOfTheLastDirectoryRecordOfTheRootDirectoryEntity"],1212:["US","1","FileSetConsistencyFlag"],1220:["SQ","1","DirectoryRecordSequence"],1400:["UL","1","OffsetOfTheNextDirectoryRecord"],1410:["US","1","RecordInUseFlag"],1420:["UL","1","OffsetOfReferencedLowerLevelDirectoryEntity"],1430:["CS","1","DirectoryRecordType"],1432:["UI","1","PrivateRecordUID"],1500:["CS","1-8","ReferencedFileID"],1504:["UL","1","MRDRDirectoryRecordOffset"],1510:["UI","1","ReferencedSOPClassUIDInFile"],1511:["UI","1","ReferencedSOPInstanceUIDInFile"],1512:["UI","1","ReferencedTransferSyntaxUIDInFile"],"151A":["UI","1-n","ReferencedRelatedGeneralSOPClassUIDInFile"],1600:["UL","1","NumberOfReferences"]},"0008":{"0000":["UL","1","GenericGroupLength"],"0001":["UL","1","LengthToEnd"],"0005":["CS","1-n","SpecificCharacterSet"],"0006":["SQ","1","LanguageCodeSequence"],"0008":["CS","2-n","ImageType"],"0010":["SH","1","RecognitionCode"],"0012":["DA","1","InstanceCreationDate"],"0013":["TM","1","InstanceCreationTime"],"0014":["UI","1","InstanceCreatorUID"],"0015":["DT","1","InstanceCoercionDateTime"],"0016":["UI","1","SOPClassUID"],"0018":["UI","1","SOPInstanceUID"],"001A":["UI","1-n","RelatedGeneralSOPClassUID"],"001B":["UI","1","OriginalSpecializedSOPClassUID"],"0020":["DA","1","StudyDate"],"0021":["DA","1","SeriesDate"],"0022":["DA","1","AcquisitionDate"],"0023":["DA","1","ContentDate"],"0024":["DA","1","OverlayDate"],"0025":["DA","1","CurveDate"],"002A":["DT","1","AcquisitionDateTime"],"0030":["TM","1","StudyTime"],"0031":["TM","1","SeriesTime"],"0032":["TM","1","AcquisitionTime"],"0033":["TM","1","ContentTime"],"0034":["TM","1","OverlayTime"],"0035":["TM","1","CurveTime"],"0040":["US","1","DataSetType"],"0041":["LO","1","DataSetSubtype"],"0042":["CS","1","NuclearMedicineSeriesType"],"0050":["SH","1","AccessionNumber"],"0051":["SQ","1","IssuerOfAccessionNumberSequence"],"0052":["CS","1","QueryRetrieveLevel"],"0053":["CS","1","QueryRetrieveView"],"0054":["AE","1-n","RetrieveAETitle"],"0055":["AE","1","StationAETitle"],"0056":["CS","1","InstanceAvailability"],"0058":["UI","1-n","FailedSOPInstanceUIDList"],"0060":["CS","1","Modality"],"0061":["CS","1-n","ModalitiesInStudy"],"0062":["UI","1-n","SOPClassesInStudy"],"0063":["SQ","1","AnatomicRegionsInStudyCodeSequence"],"0064":["CS","1","ConversionType"],"0068":["CS","1","PresentationIntentType"],"0070":["LO","1","Manufacturer"],"0080":["LO","1","InstitutionName"],"0081":["ST","1","InstitutionAddress"],"0082":["SQ","1","InstitutionCodeSequence"],"0090":["PN","1","ReferringPhysicianName"],"0092":["ST","1","ReferringPhysicianAddress"],"0094":["SH","1-n","ReferringPhysicianTelephoneNumbers"],"0096":["SQ","1","ReferringPhysicianIdentificationSequence"],"009C":["PN","1-n","ConsultingPhysicianName"],"009D":["SQ","1","ConsultingPhysicianIdentificationSequence"],"0100":["SH","1","CodeValue"],"0101":["LO","1","ExtendedCodeValue"],"0102":["SH","1","CodingSchemeDesignator"],"0103":["SH","1","CodingSchemeVersion"],"0104":["LO","1","CodeMeaning"],"0105":["CS","1","MappingResource"],"0106":["DT","1","ContextGroupVersion"],"0107":["DT","1","ContextGroupLocalVersion"],"0108":["LT","1","ExtendedCodeMeaning"],"0109":["SQ","1","CodingSchemeResourcesSequence"],"010A":["CS","1","CodingSchemeURLType"],"010B":["CS","1","ContextGroupExtensionFlag"],"010C":["UI","1","CodingSchemeUID"],"010D":["UI","1","ContextGroupExtensionCreatorUID"],"010E":["UR","1","CodingSchemeURL"],"010F":["CS","1","ContextIdentifier"],"0110":["SQ","1","CodingSchemeIdentificationSequence"],"0112":["LO","1","CodingSchemeRegistry"],"0114":["ST","1","CodingSchemeExternalID"],"0115":["ST","1","CodingSchemeName"],"0116":["ST","1","CodingSchemeResponsibleOrganization"],"0117":["UI","1","ContextUID"],"0118":["UI","1","MappingResourceUID"],"0119":["UC","1","LongCodeValue"],"0120":["UR","1","URNCodeValue"],"0121":["SQ","1","EquivalentCodeSequence"],"0122":["LO","1","MappingResourceName"],"0123":["SQ","1","ContextGroupIdentificationSequence"],"0124":["SQ","1","MappingResourceIdentificationSequence"],"0201":["SH","1","TimezoneOffsetFromUTC"],"0202":["","",""],"0220":["SQ","1","ResponsibleGroupCodeSequence"],"0221":["CS","1","EquipmentModality"],"0222":["LO","1","ManufacturerRelatedModelGroup"],"0300":["SQ","1","PrivateDataElementCharacteristicsSequence"],"0301":["US","1","PrivateGroupReference"],"0302":["LO","1","PrivateCreatorReference"],"0303":["CS","1","BlockIdentifyingInformationStatus"],"0304":["US","1-n","NonidentifyingPrivateElements"],"0305":["SQ","1","DeidentificationActionSequence"],"0306":["US","1-n","IdentifyingPrivateElements"],"0307":["CS","1","DeidentificationAction"],"0308":["US","1","PrivateDataElement"],"0309":["UL","1-3","PrivateDataElementValueMultiplicity"],"030A":["CS","1","PrivateDataElementValueRepresentation"],"030B":["UL","1-2","PrivateDataElementNumberOfItems"],"030C":["UC","1","PrivateDataElementName"],"030D":["UC","1","PrivateDataElementKeyword"],"030E":["UT","1","PrivateDataElementDescription"],"030F":["UT","1","PrivateDataElementEncoding"],"0310":["SQ","1","PrivateDataElementDefinitionSequence"],1e3:["AE","1","NetworkID"],1010:["SH","1","StationName"],1030:["LO","1","StudyDescription"],1032:["SQ","1","ProcedureCodeSequence"],"103E":["LO","1","SeriesDescription"],"103F":["SQ","1","SeriesDescriptionCodeSequence"],1040:["LO","1","InstitutionalDepartmentName"],1041:["SQ","1","InstitutionalDepartmentTypeCodeSequence"],1048:["PN","1-n","PhysiciansOfRecord"],1049:["SQ","1","PhysiciansOfRecordIdentificationSequence"],1050:["PN","1-n","PerformingPhysicianName"],1052:["SQ","1","PerformingPhysicianIdentificationSequence"],1060:["PN","1-n","NameOfPhysiciansReadingStudy"],1062:["SQ","1","PhysiciansReadingStudyIdentificationSequence"],1070:["PN","1-n","OperatorsName"],1072:["SQ","1","OperatorIdentificationSequence"],1080:["LO","1-n","AdmittingDiagnosesDescription"],1084:["SQ","1","AdmittingDiagnosesCodeSequence"],1090:["LO","1","ManufacturerModelName"],1100:["SQ","1","ReferencedResultsSequence"],1110:["SQ","1","ReferencedStudySequence"],1111:["SQ","1","ReferencedPerformedProcedureStepSequence"],1115:["SQ","1","ReferencedSeriesSequence"],1120:["SQ","1","ReferencedPatientSequence"],1125:["SQ","1","ReferencedVisitSequence"],1130:["SQ","1","ReferencedOverlaySequence"],1134:["SQ","1","ReferencedStereometricInstanceSequence"],"113A":["SQ","1","ReferencedWaveformSequence"],1140:["SQ","1","ReferencedImageSequence"],1145:["SQ","1","ReferencedCurveSequence"],"114A":["SQ","1","ReferencedInstanceSequence"],"114B":["SQ","1","ReferencedRealWorldValueMappingInstanceSequence"],1150:["UI","1","ReferencedSOPClassUID"],1155:["UI","1","ReferencedSOPInstanceUID"],1156:["SQ","1","DefinitionSourceSequence"],"115A":["UI","1-n","SOPClassesSupported"],1160:["IS","1-n","ReferencedFrameNumber"],1161:["UL","1-n","SimpleFrameList"],1162:["UL","3-3n","CalculatedFrameList"],1163:["FD","2","TimeRange"],1164:["SQ","1","FrameExtractionSequence"],1167:["UI","1","MultiFrameSourceSOPInstanceUID"],1190:["UR","1","RetrieveURL"],1195:["UI","1","TransactionUID"],1196:["US","1","WarningReason"],1197:["US","1","FailureReason"],1198:["SQ","1","FailedSOPSequence"],1199:["SQ","1","ReferencedSOPSequence"],"119A":["SQ","1","OtherFailuresSequence"],1200:["SQ","1","StudiesContainingOtherReferencedInstancesSequence"],1250:["SQ","1","RelatedSeriesSequence"],2110:["CS","1","LossyImageCompressionRetired"],2111:["ST","1","DerivationDescription"],2112:["SQ","1","SourceImageSequence"],2120:["SH","1","StageName"],2122:["IS","1","StageNumber"],2124:["IS","1","NumberOfStages"],2127:["SH","1","ViewName"],2128:["IS","1","ViewNumber"],2129:["IS","1","NumberOfEventTimers"],"212A":["IS","1","NumberOfViewsInStage"],2130:["DS","1-n","EventElapsedTimes"],2132:["LO","1-n","EventTimerNames"],2133:["SQ","1","EventTimerSequence"],2134:["FD","1","EventTimeOffset"],2135:["SQ","1","EventCodeSequence"],2142:["IS","1","StartTrim"],2143:["IS","1","StopTrim"],2144:["IS","1","RecommendedDisplayFrameRate"],2200:["CS","1","TransducerPosition"],2204:["CS","1","TransducerOrientation"],2208:["CS","1","AnatomicStructure"],2218:["SQ","1","AnatomicRegionSequence"],2220:["SQ","1","AnatomicRegionModifierSequence"],2228:["SQ","1","PrimaryAnatomicStructureSequence"],2229:["SQ","1","AnatomicStructureSpaceOrRegionSequence"],2230:["SQ","1","PrimaryAnatomicStructureModifierSequence"],2240:["SQ","1","TransducerPositionSequence"],2242:["SQ","1","TransducerPositionModifierSequence"],2244:["SQ","1","TransducerOrientationSequence"],2246:["SQ","1","TransducerOrientationModifierSequence"],2251:["SQ","1","AnatomicStructureSpaceOrRegionCodeSequenceTrial"],2253:["SQ","1","AnatomicPortalOfEntranceCodeSequenceTrial"],2255:["SQ","1","AnatomicApproachDirectionCodeSequenceTrial"],2256:["ST","1","AnatomicPerspectiveDescriptionTrial"],2257:["SQ","1","AnatomicPerspectiveCodeSequenceTrial"],2258:["ST","1","AnatomicLocationOfExaminingInstrumentDescriptionTrial"],2259:["SQ","1","AnatomicLocationOfExaminingInstrumentCodeSequenceTrial"],"225A":["SQ","1","AnatomicStructureSpaceOrRegionModifierCodeSequenceTrial"],"225C":["SQ","1","OnAxisBackgroundAnatomicStructureCodeSequenceTrial"],3001:["SQ","1","AlternateRepresentationSequence"],3002:["UI","1-n","AvailableTransferSyntaxUID"],3010:["UI","1-n","IrradiationEventUID"],3011:["SQ","1","SourceIrradiationEventSequence"],3012:["UI","1","RadiopharmaceuticalAdministrationEventUID"],4e3:["LT","1","IdentifyingComments"],9007:["CS","4","FrameType"],9092:["SQ","1","ReferencedImageEvidenceSequence"],9121:["SQ","1","ReferencedRawDataSequence"],9123:["UI","1","CreatorVersionUID"],9124:["SQ","1","DerivationImageSequence"],9154:["SQ","1","SourceImageEvidenceSequence"],9205:["CS","1","PixelPresentation"],9206:["CS","1","VolumetricProperties"],9207:["CS","1","VolumeBasedCalculationTechnique"],9208:["CS","1","ComplexImageComponent"],9209:["CS","1","AcquisitionContrast"],9215:["SQ","1","DerivationCodeSequence"],9237:["SQ","1","ReferencedPresentationStateSequence"],9410:["SQ","1","ReferencedOtherPlaneSequence"],9458:["SQ","1","FrameDisplaySequence"],9459:["FL","1","RecommendedDisplayFrameRateInFloat"],9460:["CS","1","SkipFrameRangeFlag"]},"0010":{"0000":["UL","1","GenericGroupLength"],"0010":["PN","1","PatientName"],"0020":["LO","1","PatientID"],"0021":["LO","1","IssuerOfPatientID"],"0022":["CS","1","TypeOfPatientID"],"0024":["SQ","1","IssuerOfPatientIDQualifiersSequence"],"0026":["SQ","1","SourcePatientGroupIdentificationSequence"],"0027":["SQ","1","GroupOfPatientsIdentificationSequence"],"0028":["US","3","SubjectRelativePositionInImage"],"0030":["DA","1","PatientBirthDate"],"0032":["TM","1","PatientBirthTime"],"0033":["LO","1","PatientBirthDateInAlternativeCalendar"],"0034":["LO","1","PatientDeathDateInAlternativeCalendar"],"0035":["CS","1","PatientAlternativeCalendar"],"0040":["CS","1","PatientSex"],"0050":["SQ","1","PatientInsurancePlanCodeSequence"],"0101":["SQ","1","PatientPrimaryLanguageCodeSequence"],"0102":["SQ","1","PatientPrimaryLanguageModifierCodeSequence"],"0200":["CS","1","QualityControlSubject"],"0201":["SQ","1","QualityControlSubjectTypeCodeSequence"],"0212":["UC","1","StrainDescription"],"0213":["LO","1","StrainNomenclature"],"0214":["LO","1","StrainStockNumber"],"0215":["SQ","1","StrainSourceRegistryCodeSequence"],"0216":["SQ","1","StrainStockSequence"],"0217":["LO","1","StrainSource"],"0218":["UT","1","StrainAdditionalInformation"],"0219":["SQ","1","StrainCodeSequence"],"0221":["SQ","1","GeneticModificationsSequence"],"0222":["UC","1","GeneticModificationsDescription"],"0223":["LO","1","GeneticModificationsNomenclature"],"0229":["SQ","1","GeneticModificationsCodeSequence"],1e3:["LO","1-n","OtherPatientIDs"],1001:["PN","1-n","OtherPatientNames"],1002:["SQ","1","OtherPatientIDsSequence"],1005:["PN","1","PatientBirthName"],1010:["AS","1","PatientAge"],1020:["DS","1","PatientSize"],1021:["SQ","1","PatientSizeCodeSequence"],1022:["DS","1","PatientBodyMassIndex"],1023:["DS","1","MeasuredAPDimension"],1024:["DS","1","MeasuredLateralDimension"],1030:["DS","1","PatientWeight"],1040:["LO","1","PatientAddress"],1050:["LO","1-n","InsurancePlanIdentification"],1060:["PN","1","PatientMotherBirthName"],1080:["LO","1","MilitaryRank"],1081:["LO","1","BranchOfService"],1090:["LO","1","MedicalRecordLocator"],1100:["SQ","1","ReferencedPatientPhotoSequence"],2e3:["LO","1-n","MedicalAlerts"],2110:["LO","1-n","Allergies"],2150:["LO","1","CountryOfResidence"],2152:["LO","1","RegionOfResidence"],2154:["SH","1-n","PatientTelephoneNumbers"],2155:["LT","1","PatientTelecomInformation"],2160:["SH","1","EthnicGroup"],2180:["SH","1","Occupation"],"21A0":["CS","1","SmokingStatus"],"21B0":["LT","1","AdditionalPatientHistory"],"21C0":["US","1","PregnancyStatus"],"21D0":["DA","1","LastMenstrualDate"],"21F0":["LO","1","PatientReligiousPreference"],2201:["LO","1","PatientSpeciesDescription"],2202:["SQ","1","PatientSpeciesCodeSequence"],2203:["CS","1","PatientSexNeutered"],2210:["CS","1","AnatomicalOrientationType"],2292:["LO","1","PatientBreedDescription"],2293:["SQ","1","PatientBreedCodeSequence"],2294:["SQ","1","BreedRegistrationSequence"],2295:["LO","1","BreedRegistrationNumber"],2296:["SQ","1","BreedRegistryCodeSequence"],2297:["PN","1","ResponsiblePerson"],2298:["CS","1","ResponsiblePersonRole"],2299:["LO","1","ResponsibleOrganization"],4e3:["LT","1","PatientComments"],9431:["FL","1","ExaminedBodyThickness"]},"0012":{"0000":["UL","1","GenericGroupLength"],"0010":["LO","1","ClinicalTrialSponsorName"],"0020":["LO","1","ClinicalTrialProtocolID"],"0021":["LO","1","ClinicalTrialProtocolName"],"0030":["LO","1","ClinicalTrialSiteID"],"0031":["LO","1","ClinicalTrialSiteName"],"0040":["LO","1","ClinicalTrialSubjectID"],"0042":["LO","1","ClinicalTrialSubjectReadingID"],"0050":["LO","1","ClinicalTrialTimePointID"],"0051":["ST","1","ClinicalTrialTimePointDescription"],"0052":["FD","1","LongitudinalTemporalOffsetFromEvent"],"0053":["CS","1","LongitudinalTemporalEventType"],"0060":["LO","1","ClinicalTrialCoordinatingCenterName"],"0062":["CS","1","PatientIdentityRemoved"],"0063":["LO","1-n","DeidentificationMethod"],"0064":["SQ","1","DeidentificationMethodCodeSequence"],"0071":["LO","1","ClinicalTrialSeriesID"],"0072":["LO","1","ClinicalTrialSeriesDescription"],"0081":["LO","1","ClinicalTrialProtocolEthicsCommitteeName"],"0082":["LO","1","ClinicalTrialProtocolEthicsCommitteeApprovalNumber"],"0083":["SQ","1","ConsentForClinicalTrialUseSequence"],"0084":["CS","1","DistributionType"],"0085":["CS","1","ConsentForDistributionFlag"],"0086":["DA","1","EthicsCommitteeApprovalEffectivenessStartDate"],"0087":["DA","1","EthicsCommitteeApprovalEffectivenessEndDate"]},"0014":{"0000":["UL","1","GenericGroupLength"],"0023":["ST","1","CADFileFormat"],"0024":["ST","1","ComponentReferenceSystem"],"0025":["ST","1","ComponentManufacturingProcedure"],"0028":["ST","1","ComponentManufacturer"],"0030":["DS","1-n","MaterialThickness"],"0032":["DS","1-n","MaterialPipeDiameter"],"0034":["DS","1-n","MaterialIsolationDiameter"],"0042":["ST","1","MaterialGrade"],"0044":["ST","1","MaterialPropertiesDescription"],"0045":["ST","1","MaterialPropertiesFileFormatRetired"],"0046":["LT","1","MaterialNotes"],"0050":["CS","1","ComponentShape"],"0052":["CS","1","CurvatureType"],"0054":["DS","1","OuterDiameter"],"0056":["DS","1","InnerDiameter"],"0100":["LO","1-n","ComponentWelderIDs"],"0101":["CS","1","SecondaryApprovalStatus"],"0102":["DA","1","SecondaryReviewDate"],"0103":["TM","1","SecondaryReviewTime"],"0104":["PN","1","SecondaryReviewerName"],"0105":["ST","1","RepairID"],"0106":["SQ","1","MultipleComponentApprovalSequence"],"0107":["CS","1-n","OtherApprovalStatus"],"0108":["CS","1-n","OtherSecondaryApprovalStatus"],1010:["ST","1","ActualEnvironmentalConditions"],1020:["DA","1","ExpiryDate"],1040:["ST","1","EnvironmentalConditions"],2002:["SQ","1","EvaluatorSequence"],2004:["IS","1","EvaluatorNumber"],2006:["PN","1","EvaluatorName"],2008:["IS","1","EvaluationAttempt"],2012:["SQ","1","IndicationSequence"],2014:["IS","1","IndicationNumber"],2016:["SH","1","IndicationLabel"],2018:["ST","1","IndicationDescription"],"201A":["CS","1-n","IndicationType"],"201C":["CS","1","IndicationDisposition"],"201E":["SQ","1","IndicationROISequence"],2030:["SQ","1","IndicationPhysicalPropertySequence"],2032:["SH","1","PropertyLabel"],2202:["IS","1","CoordinateSystemNumberOfAxes"],2204:["SQ","1","CoordinateSystemAxesSequence"],2206:["ST","1","CoordinateSystemAxisDescription"],2208:["CS","1","CoordinateSystemDataSetMapping"],"220A":["IS","1","CoordinateSystemAxisNumber"],"220C":["CS","1","CoordinateSystemAxisType"],"220E":["CS","1","CoordinateSystemAxisUnits"],2210:["OB","1","CoordinateSystemAxisValues"],2220:["SQ","1","CoordinateSystemTransformSequence"],2222:["ST","1","TransformDescription"],2224:["IS","1","TransformNumberOfAxes"],2226:["IS","1-n","TransformOrderOfAxes"],2228:["CS","1","TransformedAxisUnits"],"222A":["DS","1-n","CoordinateSystemTransformRotationAndScaleMatrix"],"222C":["DS","1-n","CoordinateSystemTransformTranslationMatrix"],3011:["DS","1","InternalDetectorFrameTime"],3012:["DS","1","NumberOfFramesIntegrated"],3020:["SQ","1","DetectorTemperatureSequence"],3022:["ST","1","SensorName"],3024:["DS","1","HorizontalOffsetOfSensor"],3026:["DS","1","VerticalOffsetOfSensor"],3028:["DS","1","SensorTemperature"],3040:["SQ","1","DarkCurrentSequence"],3050:["ox","1","DarkCurrentCounts"],3060:["SQ","1","GainCorrectionReferenceSequence"],3070:["ox","1","AirCounts"],3071:["DS","1","KVUsedInGainCalibration"],3072:["DS","1","MAUsedInGainCalibration"],3073:["DS","1","NumberOfFramesUsedForIntegration"],3074:["LO","1","FilterMaterialUsedInGainCalibration"],3075:["DS","1","FilterThicknessUsedInGainCalibration"],3076:["DA","1","DateOfGainCalibration"],3077:["TM","1","TimeOfGainCalibration"],3080:["OB","1","BadPixelImage"],3099:["LT","1","CalibrationNotes"],3100:["LT","1","LinearityCorrectionTechnique"],3101:["LT","1","BeamHardeningCorrectionTechnique"],4002:["SQ","1","PulserEquipmentSequence"],4004:["CS","1","PulserType"],4006:["LT","1","PulserNotes"],4008:["SQ","1","ReceiverEquipmentSequence"],"400A":["CS","1","AmplifierType"],"400C":["LT","1","ReceiverNotes"],"400E":["SQ","1","PreAmplifierEquipmentSequence"],"400F":["LT","1","PreAmplifierNotes"],4010:["SQ","1","TransmitTransducerSequence"],4011:["SQ","1","ReceiveTransducerSequence"],4012:["US","1","NumberOfElements"],4013:["CS","1","ElementShape"],4014:["DS","1","ElementDimensionA"],4015:["DS","1","ElementDimensionB"],4016:["DS","1","ElementPitchA"],4017:["DS","1","MeasuredBeamDimensionA"],4018:["DS","1","MeasuredBeamDimensionB"],4019:["DS","1","LocationOfMeasuredBeamDiameter"],"401A":["DS","1","NominalFrequency"],"401B":["DS","1","MeasuredCenterFrequency"],"401C":["DS","1","MeasuredBandwidth"],"401D":["DS","1","ElementPitchB"],4020:["SQ","1","PulserSettingsSequence"],4022:["DS","1","PulseWidth"],4024:["DS","1","ExcitationFrequency"],4026:["CS","1","ModulationType"],4028:["DS","1","Damping"],4030:["SQ","1","ReceiverSettingsSequence"],4031:["DS","1","AcquiredSoundpathLength"],4032:["CS","1","AcquisitionCompressionType"],4033:["IS","1","AcquisitionSampleSize"],4034:["DS","1","RectifierSmoothing"],4035:["SQ","1","DACSequence"],4036:["CS","1","DACType"],4038:["DS","1-n","DACGainPoints"],"403A":["DS","1-n","DACTimePoints"],"403C":["DS","1-n","DACAmplitude"],4040:["SQ","1","PreAmplifierSettingsSequence"],4050:["SQ","1","TransmitTransducerSettingsSequence"],4051:["SQ","1","ReceiveTransducerSettingsSequence"],4052:["DS","1","IncidentAngle"],4054:["ST","1","CouplingTechnique"],4056:["ST","1","CouplingMedium"],4057:["DS","1","CouplingVelocity"],4058:["DS","1","ProbeCenterLocationX"],4059:["DS","1","ProbeCenterLocationZ"],"405A":["DS","1","SoundPathLength"],"405C":["ST","1","DelayLawIdentifier"],4060:["SQ","1","GateSettingsSequence"],4062:["DS","1","GateThreshold"],4064:["DS","1","VelocityOfSound"],4070:["SQ","1","CalibrationSettingsSequence"],4072:["ST","1","CalibrationProcedure"],4074:["SH","1","ProcedureVersion"],4076:["DA","1","ProcedureCreationDate"],4078:["DA","1","ProcedureExpirationDate"],"407A":["DA","1","ProcedureLastModifiedDate"],"407C":["TM","1-n","CalibrationTime"],"407E":["DA","1-n","CalibrationDate"],4080:["SQ","1","ProbeDriveEquipmentSequence"],4081:["CS","1","DriveType"],4082:["LT","1","ProbeDriveNotes"],4083:["SQ","1","DriveProbeSequence"],4084:["DS","1","ProbeInductance"],4085:["DS","1","ProbeResistance"],4086:["SQ","1","ReceiveProbeSequence"],4087:["SQ","1","ProbeDriveSettingsSequence"],4088:["DS","1","BridgeResistors"],4089:["DS","1","ProbeOrientationAngle"],"408B":["DS","1","UserSelectedGainY"],"408C":["DS","1","UserSelectedPhase"],"408D":["DS","1","UserSelectedOffsetX"],"408E":["DS","1","UserSelectedOffsetY"],4091:["SQ","1","ChannelSettingsSequence"],4092:["DS","1","ChannelThreshold"],"409A":["SQ","1","ScannerSettingsSequence"],"409B":["ST","1","ScanProcedure"],"409C":["DS","1","TranslationRateX"],"409D":["DS","1","TranslationRateY"],"409F":["DS","1","ChannelOverlap"],"40A0":["LO","1-n","ImageQualityIndicatorType"],"40A1":["LO","1-n","ImageQualityIndicatorMaterial"],"40A2":["LO","1-n","ImageQualityIndicatorSize"],5002:["IS","1","LINACEnergy"],5004:["IS","1","LINACOutput"],5100:["US","1","ActiveAperture"],5101:["DS","1","TotalAperture"],5102:["DS","1","ApertureElevation"],5103:["DS","1","MainLobeAngle"],5104:["DS","1","MainRoofAngle"],5105:["CS","1","ConnectorType"],5106:["SH","1","WedgeModelNumber"],5107:["DS","1","WedgeAngleFloat"],5108:["DS","1","WedgeRoofAngle"],5109:["CS","1","WedgeElement1Position"],"510A":["DS","1","WedgeMaterialVelocity"],"510B":["SH","1","WedgeMaterial"],"510C":["DS","1","WedgeOffsetZ"],"510D":["DS","1","WedgeOriginOffsetX"],"510E":["DS","1","WedgeTimeDelay"],"510F":["SH","1","WedgeName"],5110:["SH","1","WedgeManufacturerName"],5111:["LO","1","WedgeDescription"],5112:["DS","1","NominalBeamAngle"],5113:["DS","1","WedgeOffsetX"],5114:["DS","1","WedgeOffsetY"],5115:["DS","1","WedgeTotalLength"],5116:["DS","1","WedgeInContactLength"],5117:["DS","1","WedgeFrontGap"],5118:["DS","1","WedgeTotalHeight"],5119:["DS","1","WedgeFrontHeight"],"511A":["DS","1","WedgeRearHeight"],"511B":["DS","1","WedgeTotalWidth"],"511C":["DS","1","WedgeInContactWidth"],"511D":["DS","1","WedgeChamferHeight"],"511E":["CS","1","WedgeCurve"],"511F":["DS","1","RadiusAlongWedge"]},"0016":{"0000":["UL","1","GenericGroupLength"],"0001":["DS","1","WhitePoint"],"0002":["DS","3","PrimaryChromaticities"],"0003":["UT","1","BatteryLevel"],"0004":["DS","1","ExposureTimeInSeconds"],"0005":["DS","1","FNumber"],"0006":["IS","1","OECFRows"],"0007":["IS","1","OECFColumns"],"0008":["UC","1-n","OECFColumnNames"],"0009":["DS","1-n","OECFValues"],"000A":["IS","1","SpatialFrequencyResponseRows"],"000B":["IS","1","SpatialFrequencyResponseColumns"],"000C":["UC","1-n","SpatialFrequencyResponseColumnNames"],"000D":["DS","1-n","SpatialFrequencyResponseValues"],"000E":["IS","1","ColorFilterArrayPatternRows"],"000F":["IS","1","ColorFilterArrayPatternColumns"],"0010":["DS","1-n","ColorFilterArrayPatternValues"],"0011":["US","1","FlashFiringStatus"],"0012":["US","1","FlashReturnStatus"],"0013":["US","1","FlashMode"],"0014":["US","1","FlashFunctionPresent"],"0015":["US","1","FlashRedEyeMode"],"0016":["US","1","ExposureProgram"],"0017":["UT","1","SpectralSensitivity"],"0018":["IS","1","PhotographicSensitivity"],"0019":["IS","1","SelfTimerMode"],"001A":["US","1","SensitivityType"],"001B":["IS","1","StandardOutputSensitivity"],"001C":["IS","1","RecommendedExposureIndex"],"001D":["IS","1","ISOSpeed"],"001E":["IS","1","ISOSpeedLatitudeyyy"],"001F":["IS","1","ISOSpeedLatitudezzz"],"0020":["UT","1","EXIFVersion"],"0021":["DS","1","ShutterSpeedValue"],"0022":["DS","1","ApertureValue"],"0023":["DS","1","BrightnessValue"],"0024":["DS","1","ExposureBiasValue"],"0025":["DS","1","MaxApertureValue"],"0026":["DS","1","SubjectDistance"],"0027":["US","1","MeteringMode"],"0028":["US","1","LightSource"],"0029":["DS","1","FocalLength"],"002A":["IS","2-4","SubjectArea"],"002B":["OB","1","MakerNote"],"0030":["DS","1","Temperature"],"0031":["DS","1","Humidity"],"0032":["DS","1","Pressure"],"0033":["DS","1","WaterDepth"],"0034":["DS","1","Acceleration"],"0035":["DS","1","CameraElevationAngle"],"0036":["DS","1-2","FlashEnergy"],"0037":["IS","2","SubjectLocation"],"0038":["DS","1","PhotographicExposureIndex"],"0039":["US","1","SensingMethod"],"003A":["US","1","FileSource"],"003B":["US","1","SceneType"],"0041":["US","1","CustomRendered"],"0042":["US","1","ExposureMode"],"0043":["US","1","WhiteBalance"],"0044":["DS","1","DigitalZoomRatio"],"0045":["IS","1","FocalLengthIn35mmFilm"],"0046":["US","1","SceneCaptureType"],"0047":["US","1","GainControl"],"0048":["US","1","Contrast"],"0049":["US","1","Saturation"],"004A":["US","1","Sharpness"],"004B":["OB","1","DeviceSettingDescription"],"004C":["US","1","SubjectDistanceRange"],"004D":["UT","1","CameraOwnerName"],"004E":["DS","4","LensSpecification"],"004F":["UT","1","LensMake"],"0050":["UT","1","LensModel"],"0051":["UT","1","LensSerialNumber"],"0061":["CS","1","InteroperabilityIndex"],"0062":["OB","1","InteroperabilityVersion"],"0070":["OB","1","GPSVersionID"],"0071":["CS","1","GPSLatitudeRef"],"0072":["DS","3","GPSLatitude"],"0073":["CS","1","GPSLongitudeRef"],"0074":["DS","3","GPSLongitude"],"0075":["US","1","GPSAltitudeRef"],"0076":["DS","1","GPSAltitude"],"0077":["DT","1","GPSTimeStamp"],"0078":["UT","1","GPSSatellites"],"0079":["CS","1","GPSStatus"],"007A":["CS","1","GPSMeasureMode"],"007B":["DS","1","GPSDOP"],"007C":["CS","1","GPSSpeedRef"],"007D":["DS","1","GPSSpeed"],"007E":["CS","1","GPSTrackRef"],"007F":["DS","1","GPSTrack"],"0080":["CS","1","GPSImgDirectionRef"],"0081":["DS","1","GPSImgDirection"],"0082":["UT","1","GPSMapDatum"],"0083":["CS","1","GPSDestLatitudeRef"],"0084":["DS","3","GPSDestLatitude"],"0085":["CS","1","GPSDestLongitudeRef"],"0086":["DS","3","GPSDestLongitude"],"0087":["CS","1","GPSDestBearingRef"],"0088":["DS","1","GPSDestBearing"],"0089":["CS","1","GPSDestDistanceRef"],"008A":["DS","1","GPSDestDistance"],"008B":["OB","1","GPSProcessingMethod"],"008C":["OB","1","GPSAreaInformation"],"008D":["DT","1","GPSDateStamp"],"008E":["IS","1","GPSDifferential"],1001:["CS","1","LightSourcePolarization"],1002:["DS","1","EmitterColorTemperature"],1003:["CS","1","ContactMethod"],1004:["CS","1-n","ImmersionMedia"],1005:["DS","1","OpticalMagnificationFactor"]},"0018":{"0000":["UL","1","GenericGroupLength"],"0010":["LO","1","ContrastBolusAgent"],"0012":["SQ","1","ContrastBolusAgentSequence"],"0013":["FL","1","ContrastBolusT1Relaxivity"],"0014":["SQ","1","ContrastBolusAdministrationRouteSequence"],"0015":["CS","1","BodyPartExamined"],"0020":["CS","1-n","ScanningSequence"],"0021":["CS","1-n","SequenceVariant"],"0022":["CS","1-n","ScanOptions"],"0023":["CS","1","MRAcquisitionType"],"0024":["SH","1","SequenceName"],"0025":["CS","1","AngioFlag"],"0026":["SQ","1","InterventionDrugInformationSequence"],"0027":["TM","1","InterventionDrugStopTime"],"0028":["DS","1","InterventionDrugDose"],"0029":["SQ","1","InterventionDrugCodeSequence"],"002A":["SQ","1","AdditionalDrugSequence"],"0030":["LO","1-n","Radionuclide"],"0031":["LO","1","Radiopharmaceutical"],"0032":["DS","1","EnergyWindowCenterline"],"0033":["DS","1-n","EnergyWindowTotalWidth"],"0034":["LO","1","InterventionDrugName"],"0035":["TM","1","InterventionDrugStartTime"],"0036":["SQ","1","InterventionSequence"],"0037":["CS","1","TherapyType"],"0038":["CS","1","InterventionStatus"],"0039":["CS","1","TherapyDescription"],"003A":["ST","1","InterventionDescription"],"0040":["IS","1","CineRate"],"0042":["CS","1","InitialCineRunState"],"0050":["DS","1","SliceThickness"],"0060":["DS","1","KVP"],"0061":["DS","1",""],"0070":["IS","1","CountsAccumulated"],"0071":["CS","1","AcquisitionTerminationCondition"],"0072":["DS","1","EffectiveDuration"],"0073":["CS","1","AcquisitionStartCondition"],"0074":["IS","1","AcquisitionStartConditionData"],"0075":["IS","1","AcquisitionTerminationConditionData"],"0080":["DS","1","RepetitionTime"],"0081":["DS","1","EchoTime"],"0082":["DS","1","InversionTime"],"0083":["DS","1","NumberOfAverages"],"0084":["DS","1","ImagingFrequency"],"0085":["SH","1","ImagedNucleus"],"0086":["IS","1-n","EchoNumbers"],"0087":["DS","1","MagneticFieldStrength"],"0088":["DS","1","SpacingBetweenSlices"],"0089":["IS","1","NumberOfPhaseEncodingSteps"],"0090":["DS","1","DataCollectionDiameter"],"0091":["IS","1","EchoTrainLength"],"0093":["DS","1","PercentSampling"],"0094":["DS","1","PercentPhaseFieldOfView"],"0095":["DS","1","PixelBandwidth"],1e3:["LO","1","DeviceSerialNumber"],1002:["UI","1","DeviceUID"],1003:["LO","1","DeviceID"],1004:["LO","1","PlateID"],1005:["LO","1","GeneratorID"],1006:["LO","1","GridID"],1007:["LO","1","CassetteID"],1008:["LO","1","GantryID"],1009:["UT","1","UniqueDeviceIdentifier"],"100A":["SQ","1","UDISequence"],"100B":["UI","1-n","ManufacturerDeviceClassUID"],1010:["LO","1","SecondaryCaptureDeviceID"],1011:["LO","1","HardcopyCreationDeviceID"],1012:["DA","1","DateOfSecondaryCapture"],1014:["TM","1","TimeOfSecondaryCapture"],1016:["LO","1","SecondaryCaptureDeviceManufacturer"],1017:["LO","1","HardcopyDeviceManufacturer"],1018:["LO","1","SecondaryCaptureDeviceManufacturerModelName"],1019:["LO","1-n","SecondaryCaptureDeviceSoftwareVersions"],"101A":["LO","1-n","HardcopyDeviceSoftwareVersion"],"101B":["LO","1","HardcopyDeviceManufacturerModelName"],1020:["LO","1-n","SoftwareVersions"],1022:["SH","1","VideoImageFormatAcquired"],1023:["LO","1","DigitalImageFormatAcquired"],1030:["LO","1","ProtocolName"],1040:["LO","1","ContrastBolusRoute"],1041:["DS","1","ContrastBolusVolume"],1042:["TM","1","ContrastBolusStartTime"],1043:["TM","1","ContrastBolusStopTime"],1044:["DS","1","ContrastBolusTotalDose"],1045:["IS","1","SyringeCounts"],1046:["DS","1-n","ContrastFlowRate"],1047:["DS","1-n","ContrastFlowDuration"],1048:["CS","1","ContrastBolusIngredient"],1049:["DS","1","ContrastBolusIngredientConcentration"],1050:["DS","1","SpatialResolution"],1060:["DS","1","TriggerTime"],1061:["LO","1","TriggerSourceOrType"],1062:["IS","1","NominalInterval"],1063:["DS","1","FrameTime"],1064:["LO","1","CardiacFramingType"],1065:["DS","1-n","FrameTimeVector"],1066:["DS","1","FrameDelay"],1067:["DS","1","ImageTriggerDelay"],1068:["DS","1","MultiplexGroupTimeOffset"],1069:["DS","1","TriggerTimeOffset"],"106A":["CS","1","SynchronizationTrigger"],"106C":["US","2","SynchronizationChannel"],"106E":["UL","1","TriggerSamplePosition"],1070:["LO","1","RadiopharmaceuticalRoute"],1071:["DS","1","RadiopharmaceuticalVolume"],1072:["TM","1","RadiopharmaceuticalStartTime"],1073:["TM","1","RadiopharmaceuticalStopTime"],1074:["DS","1","RadionuclideTotalDose"],1075:["DS","1","RadionuclideHalfLife"],1076:["DS","1","RadionuclidePositronFraction"],1077:["DS","1","RadiopharmaceuticalSpecificActivity"],1078:["DT","1","RadiopharmaceuticalStartDateTime"],1079:["DT","1","RadiopharmaceuticalStopDateTime"],1080:["CS","1","BeatRejectionFlag"],1081:["IS","1","LowRRValue"],1082:["IS","1","HighRRValue"],1083:["IS","1","IntervalsAcquired"],1084:["IS","1","IntervalsRejected"],1085:["LO","1","PVCRejection"],1086:["IS","1","SkipBeats"],1088:["IS","1","HeartRate"],1090:["IS","1","CardiacNumberOfImages"],1094:["IS","1","TriggerWindow"],1100:["DS","1","ReconstructionDiameter"],1110:["DS","1","DistanceSourceToDetector"],1111:["DS","1","DistanceSourceToPatient"],1114:["DS","1","EstimatedRadiographicMagnificationFactor"],1120:["DS","1","GantryDetectorTilt"],1121:["DS","1","GantryDetectorSlew"],1130:["DS","1","TableHeight"],1131:["DS","1","TableTraverse"],1134:["CS","1","TableMotion"],1135:["DS","1-n","TableVerticalIncrement"],1136:["DS","1-n","TableLateralIncrement"],1137:["DS","1-n","TableLongitudinalIncrement"],1138:["DS","1","TableAngle"],"113A":["CS","1","TableType"],1140:["CS","1","RotationDirection"],1141:["DS","1","AngularPosition"],1142:["DS","1-n","RadialPosition"],1143:["DS","1","ScanArc"],1144:["DS","1","AngularStep"],1145:["DS","1","CenterOfRotationOffset"],1146:["DS","1-n","RotationOffset"],1147:["CS","1","FieldOfViewShape"],1149:["IS","1-2","FieldOfViewDimensions"],1150:["IS","1","ExposureTime"],1151:["IS","1","XRayTubeCurrent"],1152:["IS","1","Exposure"],1153:["IS","1","ExposureInuAs"],1154:["DS","1","AveragePulseWidth"],1155:["CS","1","RadiationSetting"],1156:["CS","1","RectificationType"],"115A":["CS","1","RadiationMode"],"115E":["DS","1","ImageAndFluoroscopyAreaDoseProduct"],1160:["SH","1","FilterType"],1161:["LO","1-n","TypeOfFilters"],1162:["DS","1","IntensifierSize"],1164:["DS","2","ImagerPixelSpacing"],1166:["CS","1-n","Grid"],1170:["IS","1","GeneratorPower"],1180:["SH","1","CollimatorGridName"],1181:["CS","1","CollimatorType"],1182:["IS","1-2","FocalDistance"],1183:["DS","1-2","XFocusCenter"],1184:["DS","1-2","YFocusCenter"],1190:["DS","1-n","FocalSpots"],1191:["CS","1","AnodeTargetMaterial"],"11A0":["DS","1","BodyPartThickness"],"11A2":["DS","1","CompressionForce"],"11A3":["DS","1","CompressionPressure"],"11A4":["LO","1","PaddleDescription"],"11A5":["DS","1","CompressionContactArea"],"11B0":["LO","1","AcquisitionMode"],"11B1":["LO","1","DoseModeName"],"11B2":["CS","1","AcquiredSubtractionMaskFlag"],"11B3":["CS","1","FluoroscopyPersistenceFlag"],"11B4":["CS","1","FluoroscopyLastImageHoldPersistenceFlag"],"11B5":["IS","1","UpperLimitNumberOfPersistentFluoroscopyFrames"],"11B6":["CS","1","ContrastBolusAutoInjectionTriggerFlag"],"11B7":["FD","1","ContrastBolusInjectionDelay"],"11B8":["SQ","1","XAAcquisitionPhaseDetailsSequence"],"11B9":["FD","1","XAAcquisitionFrameRate"],"11BA":["SQ","1","XAPlaneDetailsSequence"],"11BB":["LO","1","AcquisitionFieldOfViewLabel"],"11BC":["SQ","1","XRayFilterDetailsSequence"],"11BD":["FD","1","XAAcquisitionDuration"],"11BE":["CS","1","ReconstructionPipelineType"],"11BF":["SQ","1","ImageFilterDetailsSequence"],"11C0":["CS","1","AppliedMaskSubtractionFlag"],"11C1":["SQ","1","RequestedSeriesDescriptionCodeSequence"],1200:["DA","1-n","DateOfLastCalibration"],1201:["TM","1-n","TimeOfLastCalibration"],1202:["DT","1","DateTimeOfLastCalibration"],1203:["DT","1","CalibrationDateTime"],1210:["SH","1-n","ConvolutionKernel"],1240:["IS","1-n","UpperLowerPixelValues"],1242:["IS","1","ActualFrameDuration"],1243:["IS","1","CountRate"],1244:["US","1","PreferredPlaybackSequencing"],1250:["SH","1","ReceiveCoilName"],1251:["SH","1","TransmitCoilName"],1260:["SH","1","PlateType"],1261:["LO","1","PhosphorType"],1271:["FD","1","WaterEquivalentDiameter"],1272:["SQ","1","WaterEquivalentDiameterCalculationMethodCodeSequence"],1300:["DS","1","ScanVelocity"],1301:["CS","1-n","WholeBodyTechnique"],1302:["IS","1","ScanLength"],1310:["US","4","AcquisitionMatrix"],1312:["CS","1","InPlanePhaseEncodingDirection"],1314:["DS","1","FlipAngle"],1315:["CS","1","VariableFlipAngleFlag"],1316:["DS","1","SAR"],1318:["DS","1","dBdt"],1320:["FL","1","B1rms"],1400:["LO","1","AcquisitionDeviceProcessingDescription"],1401:["LO","1","AcquisitionDeviceProcessingCode"],1402:["CS","1","CassetteOrientation"],1403:["CS","1","CassetteSize"],1404:["US","1","ExposuresOnPlate"],1405:["IS","1","RelativeXRayExposure"],1411:["DS","1","ExposureIndex"],1412:["DS","1","TargetExposureIndex"],1413:["DS","1","DeviationIndex"],1450:["DS","1","ColumnAngulation"],1460:["DS","1","TomoLayerHeight"],1470:["DS","1","TomoAngle"],1480:["DS","1","TomoTime"],1490:["CS","1","TomoType"],1491:["CS","1","TomoClass"],1495:["IS","1","NumberOfTomosynthesisSourceImages"],1500:["CS","1","PositionerMotion"],1508:["CS","1","PositionerType"],1510:["DS","1","PositionerPrimaryAngle"],1511:["DS","1","PositionerSecondaryAngle"],1520:["DS","1-n","PositionerPrimaryAngleIncrement"],1521:["DS","1-n","PositionerSecondaryAngleIncrement"],1530:["DS","1","DetectorPrimaryAngle"],1531:["DS","1","DetectorSecondaryAngle"],1600:["CS","1-3","ShutterShape"],1602:["IS","1","ShutterLeftVerticalEdge"],1604:["IS","1","ShutterRightVerticalEdge"],1606:["IS","1","ShutterUpperHorizontalEdge"],1608:["IS","1","ShutterLowerHorizontalEdge"],1610:["IS","2","CenterOfCircularShutter"],1612:["IS","1","RadiusOfCircularShutter"],1620:["IS","2-2n","VerticesOfThePolygonalShutter"],1622:["US","1","ShutterPresentationValue"],1623:["US","1","ShutterOverlayGroup"],1624:["US","3","ShutterPresentationColorCIELabValue"],1630:["CS","1","OutlineShapeType"],1631:["FD","1","OutlineLeftVerticalEdge"],1632:["FD","1","OutlineRightVerticalEdge"],1633:["FD","1","OutlineUpperHorizontalEdge"],1634:["FD","1","OutlineLowerHorizontalEdge"],1635:["FD","2","CenterOfCircularOutline"],1636:["FD","1","DiameterOfCircularOutline"],1637:["UL","1","NumberOfPolygonalVertices"],1638:["OF","1","VerticesOfThePolygonalOutline"],1700:["CS","1-3","CollimatorShape"],1702:["IS","1","CollimatorLeftVerticalEdge"],1704:["IS","1","CollimatorRightVerticalEdge"],1706:["IS","1","CollimatorUpperHorizontalEdge"],1708:["IS","1","CollimatorLowerHorizontalEdge"],1710:["IS","2","CenterOfCircularCollimator"],1712:["IS","1","RadiusOfCircularCollimator"],1720:["IS","2-2n","VerticesOfThePolygonalCollimator"],1800:["CS","1","AcquisitionTimeSynchronized"],1801:["SH","1","TimeSource"],1802:["CS","1","TimeDistributionProtocol"],1803:["LO","1","NTPSourceAddress"],2001:["IS","1-n","PageNumberVector"],2002:["SH","1-n","FrameLabelVector"],2003:["DS","1-n","FramePrimaryAngleVector"],2004:["DS","1-n","FrameSecondaryAngleVector"],2005:["DS","1-n","SliceLocationVector"],2006:["SH","1-n","DisplayWindowLabelVector"],2010:["DS","2","NominalScannedPixelSpacing"],2020:["CS","1","DigitizingDeviceTransportDirection"],2030:["DS","1","RotationOfScannedFilm"],2041:["SQ","1","BiopsyTargetSequence"],2042:["UI","1","TargetUID"],2043:["FL","2","LocalizingCursorPosition"],2044:["FL","3","CalculatedTargetPosition"],2045:["SH","1","TargetLabel"],2046:["FL","1","DisplayedZValue"],3100:["CS","1","IVUSAcquisition"],3101:["DS","1","IVUSPullbackRate"],3102:["DS","1","IVUSGatedRate"],3103:["IS","1","IVUSPullbackStartFrameNumber"],3104:["IS","1","IVUSPullbackStopFrameNumber"],3105:["IS","1-n","LesionNumber"],4e3:["LT","1","AcquisitionComments"],5e3:["SH","1-n","OutputPower"],5010:["LO","1-n","TransducerData"],5011:["SQ","1","TransducerIdentificationSequence"],5012:["DS","1","FocusDepth"],5020:["LO","1","ProcessingFunction"],5021:["LO","1","PostprocessingFunction"],5022:["DS","1","MechanicalIndex"],5024:["DS","1","BoneThermalIndex"],5026:["DS","1","CranialThermalIndex"],5027:["DS","1","SoftTissueThermalIndex"],5028:["DS","1","SoftTissueFocusThermalIndex"],5029:["DS","1","SoftTissueSurfaceThermalIndex"],5030:["DS","1","DynamicRange"],5040:["DS","1","TotalGain"],5050:["IS","1","DepthOfScanField"],5100:["CS","1","PatientPosition"],5101:["CS","1","ViewPosition"],5104:["SQ","1","ProjectionEponymousNameCodeSequence"],5210:["DS","6","ImageTransformationMatrix"],5212:["DS","3","ImageTranslationVector"],6e3:["DS","1","Sensitivity"],6011:["SQ","1","SequenceOfUltrasoundRegions"],6012:["US","1","RegionSpatialFormat"],6014:["US","1","RegionDataType"],6016:["UL","1","RegionFlags"],6018:["UL","1","RegionLocationMinX0"],"601A":["UL","1","RegionLocationMinY0"],"601C":["UL","1","RegionLocationMaxX1"],"601E":["UL","1","RegionLocationMaxY1"],6020:["SL","1","ReferencePixelX0"],6022:["SL","1","ReferencePixelY0"],6024:["US","1","PhysicalUnitsXDirection"],6026:["US","1","PhysicalUnitsYDirection"],6028:["FD","1","ReferencePixelPhysicalValueX"],"602A":["FD","1","ReferencePixelPhysicalValueY"],"602C":["FD","1","PhysicalDeltaX"],"602E":["FD","1","PhysicalDeltaY"],6030:["UL","1","TransducerFrequency"],6031:["CS","1","TransducerType"],6032:["UL","1","PulseRepetitionFrequency"],6034:["FD","1","DopplerCorrectionAngle"],6036:["FD","1","SteeringAngle"],6038:["UL","1","DopplerSampleVolumeXPositionRetired"],6039:["SL","1","DopplerSampleVolumeXPosition"],"603A":["UL","1","DopplerSampleVolumeYPositionRetired"],"603B":["SL","1","DopplerSampleVolumeYPosition"],"603C":["UL","1","TMLinePositionX0Retired"],"603D":["SL","1","TMLinePositionX0"],"603E":["UL","1","TMLinePositionY0Retired"],"603F":["SL","1","TMLinePositionY0"],6040:["UL","1","TMLinePositionX1Retired"],6041:["SL","1","TMLinePositionX1"],6042:["UL","1","TMLinePositionY1Retired"],6043:["SL","1","TMLinePositionY1"],6044:["US","1","PixelComponentOrganization"],6046:["UL","1","PixelComponentMask"],6048:["UL","1","PixelComponentRangeStart"],"604A":["UL","1","PixelComponentRangeStop"],"604C":["US","1","PixelComponentPhysicalUnits"],"604E":["US","1","PixelComponentDataType"],6050:["UL","1","NumberOfTableBreakPoints"],6052:["UL","1-n","TableOfXBreakPoints"],6054:["FD","1-n","TableOfYBreakPoints"],6056:["UL","1","NumberOfTableEntries"],6058:["UL","1-n","TableOfPixelValues"],"605A":["FL","1-n","TableOfParameterValues"],6060:["FL","1-n","RWaveTimeVector"],6070:["US","1","ActiveImageAreaOverlayGroup"],7e3:["CS","1","DetectorConditionsNominalFlag"],7001:["DS","1","DetectorTemperature"],7004:["CS","1","DetectorType"],7005:["CS","1","DetectorConfiguration"],7006:["LT","1","DetectorDescription"],7008:["LT","1","DetectorMode"],"700A":["SH","1","DetectorID"],"700C":["DA","1","DateOfLastDetectorCalibration"],"700E":["TM","1","TimeOfLastDetectorCalibration"],7010:["IS","1","ExposuresOnDetectorSinceLastCalibration"],7011:["IS","1","ExposuresOnDetectorSinceManufactured"],7012:["DS","1","DetectorTimeSinceLastExposure"],7014:["DS","1","DetectorActiveTime"],7016:["DS","1","DetectorActivationOffsetFromExposure"],"701A":["DS","2","DetectorBinning"],7020:["DS","2","DetectorElementPhysicalSize"],7022:["DS","2","DetectorElementSpacing"],7024:["CS","1","DetectorActiveShape"],7026:["DS","1-2","DetectorActiveDimensions"],7028:["DS","2","DetectorActiveOrigin"],"702A":["LO","1","DetectorManufacturerName"],"702B":["LO","1","DetectorManufacturerModelName"],7030:["DS","2","FieldOfViewOrigin"],7032:["DS","1","FieldOfViewRotation"],7034:["CS","1","FieldOfViewHorizontalFlip"],7036:["FL","2","PixelDataAreaOriginRelativeToFOV"],7038:["FL","1","PixelDataAreaRotationAngleRelativeToFOV"],7040:["LT","1","GridAbsorbingMaterial"],7041:["LT","1","GridSpacingMaterial"],7042:["DS","1","GridThickness"],7044:["DS","1","GridPitch"],7046:["IS","2","GridAspectRatio"],7048:["DS","1","GridPeriod"],"704C":["DS","1","GridFocalDistance"],7050:["CS","1-n","FilterMaterial"],7052:["DS","1-n","FilterThicknessMinimum"],7054:["DS","1-n","FilterThicknessMaximum"],7056:["FL","1-n","FilterBeamPathLengthMinimum"],7058:["FL","1-n","FilterBeamPathLengthMaximum"],7060:["CS","1","ExposureControlMode"],7062:["LT","1","ExposureControlModeDescription"],7064:["CS","1","ExposureStatus"],7065:["DS","1","PhototimerSetting"],8150:["DS","1","ExposureTimeInuS"],8151:["DS","1","XRayTubeCurrentInuA"],9004:["CS","1","ContentQualification"],9005:["SH","1","PulseSequenceName"],9006:["SQ","1","MRImagingModifierSequence"],9008:["CS","1","EchoPulseSequence"],9009:["CS","1","InversionRecovery"],9010:["CS","1","FlowCompensation"],9011:["CS","1","MultipleSpinEcho"],9012:["CS","1","MultiPlanarExcitation"],9014:["CS","1","PhaseContrast"],9015:["CS","1","TimeOfFlightContrast"],9016:["CS","1","Spoiling"],9017:["CS","1","SteadyStatePulseSequence"],9018:["CS","1","EchoPlanarPulseSequence"],9019:["FD","1","TagAngleFirstAxis"],9020:["CS","1","MagnetizationTransfer"],9021:["CS","1","T2Preparation"],9022:["CS","1","BloodSignalNulling"],9024:["CS","1","SaturationRecovery"],9025:["CS","1","SpectrallySelectedSuppression"],9026:["CS","1","SpectrallySelectedExcitation"],9027:["CS","1","SpatialPresaturation"],9028:["CS","1","Tagging"],9029:["CS","1","OversamplingPhase"],9030:["FD","1","TagSpacingFirstDimension"],9032:["CS","1","GeometryOfKSpaceTraversal"],9033:["CS","1","SegmentedKSpaceTraversal"],9034:["CS","1","RectilinearPhaseEncodeReordering"],9035:["FD","1","TagThickness"],9036:["CS","1","PartialFourierDirection"],9037:["CS","1","CardiacSynchronizationTechnique"],9041:["LO","1","ReceiveCoilManufacturerName"],9042:["SQ","1","MRReceiveCoilSequence"],9043:["CS","1","ReceiveCoilType"],9044:["CS","1","QuadratureReceiveCoil"],9045:["SQ","1","MultiCoilDefinitionSequence"],9046:["LO","1","MultiCoilConfiguration"],9047:["SH","1","MultiCoilElementName"],9048:["CS","1","MultiCoilElementUsed"],9049:["SQ","1","MRTransmitCoilSequence"],9050:["LO","1","TransmitCoilManufacturerName"],9051:["CS","1","TransmitCoilType"],9052:["FD","1-2","SpectralWidth"],9053:["FD","1-2","ChemicalShiftReference"],9054:["CS","1","VolumeLocalizationTechnique"],9058:["US","1","MRAcquisitionFrequencyEncodingSteps"],9059:["CS","1","Decoupling"],9060:["CS","1-2","DecoupledNucleus"],9061:["FD","1-2","DecouplingFrequency"],9062:["CS","1","DecouplingMethod"],9063:["FD","1-2","DecouplingChemicalShiftReference"],9064:["CS","1","KSpaceFiltering"],9065:["CS","1-2","TimeDomainFiltering"],9066:["US","1-2","NumberOfZeroFills"],9067:["CS","1","BaselineCorrection"],9069:["FD","1","ParallelReductionFactorInPlane"],9070:["FD","1","CardiacRRIntervalSpecified"],9073:["FD","1","AcquisitionDuration"],9074:["DT","1","FrameAcquisitionDateTime"],9075:["CS","1","DiffusionDirectionality"],9076:["SQ","1","DiffusionGradientDirectionSequence"],9077:["CS","1","ParallelAcquisition"],9078:["CS","1","ParallelAcquisitionTechnique"],9079:["FD","1-n","InversionTimes"],9080:["ST","1","MetaboliteMapDescription"],9081:["CS","1","PartialFourier"],9082:["FD","1","EffectiveEchoTime"],9083:["SQ","1","MetaboliteMapCodeSequence"],9084:["SQ","1","ChemicalShiftSequence"],9085:["CS","1","CardiacSignalSource"],9087:["FD","1","DiffusionBValue"],9089:["FD","3","DiffusionGradientOrientation"],9090:["FD","3","VelocityEncodingDirection"],9091:["FD","1","VelocityEncodingMinimumValue"],9092:["SQ","1","VelocityEncodingAcquisitionSequence"],9093:["US","1","NumberOfKSpaceTrajectories"],9094:["CS","1","CoverageOfKSpace"],9095:["UL","1","SpectroscopyAcquisitionPhaseRows"],9096:["FD","1","ParallelReductionFactorInPlaneRetired"],9098:["FD","1-2","TransmitterFrequency"],9100:["CS","1-2","ResonantNucleus"],9101:["CS","1","FrequencyCorrection"],9103:["SQ","1","MRSpectroscopyFOVGeometrySequence"],9104:["FD","1","SlabThickness"],9105:["FD","3","SlabOrientation"],9106:["FD","3","MidSlabPosition"],9107:["SQ","1","MRSpatialSaturationSequence"],9112:["SQ","1","MRTimingAndRelatedParametersSequence"],9114:["SQ","1","MREchoSequence"],9115:["SQ","1","MRModifierSequence"],9117:["SQ","1","MRDiffusionSequence"],9118:["SQ","1","CardiacSynchronizationSequence"],9119:["SQ","1","MRAveragesSequence"],9125:["SQ","1","MRFOVGeometrySequence"],9126:["SQ","1","VolumeLocalizationSequence"],9127:["UL","1","SpectroscopyAcquisitionDataColumns"],9147:["CS","1","DiffusionAnisotropyType"],9151:["DT","1","FrameReferenceDateTime"],9152:["SQ","1","MRMetaboliteMapSequence"],9155:["FD","1","ParallelReductionFactorOutOfPlane"],9159:["UL","1","SpectroscopyAcquisitionOutOfPlanePhaseSteps"],9166:["CS","1","BulkMotionStatus"],9168:["FD","1","ParallelReductionFactorSecondInPlane"],9169:["CS","1","CardiacBeatRejectionTechnique"],9170:["CS","1","RespiratoryMotionCompensationTechnique"],9171:["CS","1","RespiratorySignalSource"],9172:["CS","1","BulkMotionCompensationTechnique"],9173:["CS","1","BulkMotionSignalSource"],9174:["CS","1","ApplicableSafetyStandardAgency"],9175:["LO","1","ApplicableSafetyStandardDescription"],9176:["SQ","1","OperatingModeSequence"],9177:["CS","1","OperatingModeType"],9178:["CS","1","OperatingMode"],9179:["CS","1","SpecificAbsorptionRateDefinition"],9180:["CS","1","GradientOutputType"],9181:["FD","1","SpecificAbsorptionRateValue"],9182:["FD","1","GradientOutput"],9183:["CS","1","FlowCompensationDirection"],9184:["FD","1","TaggingDelay"],9185:["ST","1","RespiratoryMotionCompensationTechniqueDescription"],9186:["SH","1","RespiratorySignalSourceID"],9195:["FD","1","ChemicalShiftMinimumIntegrationLimitInHz"],9196:["FD","1","ChemicalShiftMaximumIntegrationLimitInHz"],9197:["SQ","1","MRVelocityEncodingSequence"],9198:["CS","1","FirstOrderPhaseCorrection"],9199:["CS","1","WaterReferencedPhaseCorrection"],9200:["CS","1","MRSpectroscopyAcquisitionType"],9214:["CS","1","RespiratoryCyclePosition"],9217:["FD","1","VelocityEncodingMaximumValue"],9218:["FD","1","TagSpacingSecondDimension"],9219:["SS","1","TagAngleSecondAxis"],9220:["FD","1","FrameAcquisitionDuration"],9226:["SQ","1","MRImageFrameTypeSequence"],9227:["SQ","1","MRSpectroscopyFrameTypeSequence"],9231:["US","1","MRAcquisitionPhaseEncodingStepsInPlane"],9232:["US","1","MRAcquisitionPhaseEncodingStepsOutOfPlane"],9234:["UL","1","SpectroscopyAcquisitionPhaseColumns"],9236:["CS","1","CardiacCyclePosition"],9239:["SQ","1","SpecificAbsorptionRateSequence"],9240:["US","1","RFEchoTrainLength"],9241:["US","1","GradientEchoTrainLength"],9250:["CS","1","ArterialSpinLabelingContrast"],9251:["SQ","1","MRArterialSpinLabelingSequence"],9252:["LO","1","ASLTechniqueDescription"],9253:["US","1","ASLSlabNumber"],9254:["FD","1","ASLSlabThickness"],9255:["FD","3","ASLSlabOrientation"],9256:["FD","3","ASLMidSlabPosition"],9257:["CS","1","ASLContext"],9258:["UL","1","ASLPulseTrainDuration"],9259:["CS","1","ASLCrusherFlag"],"925A":["FD","1","ASLCrusherFlowLimit"],"925B":["LO","1","ASLCrusherDescription"],"925C":["CS","1","ASLBolusCutoffFlag"],"925D":["SQ","1","ASLBolusCutoffTimingSequence"],"925E":["LO","1","ASLBolusCutoffTechnique"],"925F":["UL","1","ASLBolusCutoffDelayTime"],9260:["SQ","1","ASLSlabSequence"],9295:["FD","1","ChemicalShiftMinimumIntegrationLimitInppm"],9296:["FD","1","ChemicalShiftMaximumIntegrationLimitInppm"],9297:["CS","1","WaterReferenceAcquisition"],9298:["IS","1","EchoPeakPosition"],9301:["SQ","1","CTAcquisitionTypeSequence"],9302:["CS","1","AcquisitionType"],9303:["FD","1","TubeAngle"],9304:["SQ","1","CTAcquisitionDetailsSequence"],9305:["FD","1","RevolutionTime"],9306:["FD","1","SingleCollimationWidth"],9307:["FD","1","TotalCollimationWidth"],9308:["SQ","1","CTTableDynamicsSequence"],9309:["FD","1","TableSpeed"],9310:["FD","1","TableFeedPerRotation"],9311:["FD","1","SpiralPitchFactor"],9312:["SQ","1","CTGeometrySequence"],9313:["FD","3","DataCollectionCenterPatient"],9314:["SQ","1","CTReconstructionSequence"],9315:["CS","1","ReconstructionAlgorithm"],9316:["CS","1","ConvolutionKernelGroup"],9317:["FD","2","ReconstructionFieldOfView"],9318:["FD","3","ReconstructionTargetCenterPatient"],9319:["FD","1","ReconstructionAngle"],9320:["SH","1","ImageFilter"],9321:["SQ","1","CTExposureSequence"],9322:["FD","2","ReconstructionPixelSpacing"],9323:["CS","1-n","ExposureModulationType"],9324:["FD","1","EstimatedDoseSaving"],9325:["SQ","1","CTXRayDetailsSequence"],9326:["SQ","1","CTPositionSequence"],9327:["FD","1","TablePosition"],9328:["FD","1","ExposureTimeInms"],9329:["SQ","1","CTImageFrameTypeSequence"],9330:["FD","1","XRayTubeCurrentInmA"],9332:["FD","1","ExposureInmAs"],9333:["CS","1","ConstantVolumeFlag"],9334:["CS","1","FluoroscopyFlag"],9335:["FD","1","DistanceSourceToDataCollectionCenter"],9337:["US","1","ContrastBolusAgentNumber"],9338:["SQ","1","ContrastBolusIngredientCodeSequence"],9340:["SQ","1","ContrastAdministrationProfileSequence"],9341:["SQ","1","ContrastBolusUsageSequence"],9342:["CS","1","ContrastBolusAgentAdministered"],9343:["CS","1","ContrastBolusAgentDetected"],9344:["CS","1","ContrastBolusAgentPhase"],9345:["FD","1","CTDIvol"],9346:["SQ","1","CTDIPhantomTypeCodeSequence"],9351:["FL","1","CalciumScoringMassFactorPatient"],9352:["FL","3","CalciumScoringMassFactorDevice"],9353:["FL","1","EnergyWeightingFactor"],9360:["SQ","1","CTAdditionalXRaySourceSequence"],9361:["CS","1","MultienergyCTAcquisition"],9362:["SQ","1","MultienergyCTAcquisitionSequence"],9363:["SQ","1","MultienergyCTProcessingSequence"],9364:["SQ","1","MultienergyCTCharacteristicsSequence"],9365:["SQ","1","MultienergyCTXRaySourceSequence"],9366:["US","1","XRaySourceIndex"],9367:["UC","1","XRaySourceID"],9368:["CS","1","MultienergySourceTechnique"],9369:["DT","1","SourceStartDateTime"],"936A":["DT","1","SourceEndDateTime"],"936B":["US","1","SwitchingPhaseNumber"],"936C":["DS","1","SwitchingPhaseNominalDuration"],"936D":["DS","1","SwitchingPhaseTransitionDuration"],"936E":["DS","1","EffectiveBinEnergy"],"936F":["SQ","1","MultienergyCTXRayDetectorSequence"],9370:["US","1","XRayDetectorIndex"],9371:["UC","1","XRayDetectorID"],9372:["CS","1","MultienergyDetectorType"],9373:["ST","1","XRayDetectorLabel"],9374:["DS","1","NominalMaxEnergy"],9375:["DS","1","NominalMinEnergy"],9376:["US","1-n","ReferencedXRayDetectorIndex"],9377:["US","1-n","ReferencedXRaySourceIndex"],9378:["US","1-n","ReferencedPathIndex"],9379:["SQ","1","MultienergyCTPathSequence"],"937A":["US","1","MultienergyCTPathIndex"],"937B":["UT","1","MultienergyAcquisitionDescription"],"937C":["FD","1","MonoenergeticEnergyEquivalent"],"937D":["SQ","1","MaterialCodeSequence"],"937E":["CS","1","DecompositionMethod"],"937F":["UT","1","DecompositionDescription"],9380:["SQ","1","DecompositionAlgorithmIdentificationSequence"],9381:["SQ","1","DecompositionMaterialSequence"],9382:["SQ","1","MaterialAttenuationSequence"],9383:["DS","1","PhotonEnergy"],9384:["DS","1","XRayMassAttenuationCoefficient"],9401:["SQ","1","ProjectionPixelCalibrationSequence"],9402:["FL","1","DistanceSourceToIsocenter"],9403:["FL","1","DistanceObjectToTableTop"],9404:["FL","2","ObjectPixelSpacingInCenterOfBeam"],9405:["SQ","1","PositionerPositionSequence"],9406:["SQ","1","TablePositionSequence"],9407:["SQ","1","CollimatorShapeSequence"],9410:["CS","1","PlanesInAcquisition"],9412:["SQ","1","XAXRFFrameCharacteristicsSequence"],9417:["SQ","1","FrameAcquisitionSequence"],9420:["CS","1","XRayReceptorType"],9423:["LO","1","AcquisitionProtocolName"],9424:["LT","1","AcquisitionProtocolDescription"],9425:["CS","1","ContrastBolusIngredientOpaque"],9426:["FL","1","DistanceReceptorPlaneToDetectorHousing"],9427:["CS","1","IntensifierActiveShape"],9428:["FL","1-2","IntensifierActiveDimensions"],9429:["FL","2","PhysicalDetectorSize"],9430:["FL","2","PositionOfIsocenterProjection"],9432:["SQ","1","FieldOfViewSequence"],9433:["LO","1","FieldOfViewDescription"],9434:["SQ","1","ExposureControlSensingRegionsSequence"],9435:["CS","1","ExposureControlSensingRegionShape"],9436:["SS","1","ExposureControlSensingRegionLeftVerticalEdge"],9437:["SS","1","ExposureControlSensingRegionRightVerticalEdge"],9438:["SS","1","ExposureControlSensingRegionUpperHorizontalEdge"],9439:["SS","1","ExposureControlSensingRegionLowerHorizontalEdge"],9440:["SS","2","CenterOfCircularExposureControlSensingRegion"],9441:["US","1","RadiusOfCircularExposureControlSensingRegion"],9442:["SS","2-n","VerticesOfThePolygonalExposureControlSensingRegion"],9445:["","",""],9447:["FL","1","ColumnAngulationPatient"],9449:["FL","1","BeamAngle"],9451:["SQ","1","FrameDetectorParametersSequence"],9452:["FL","1","CalculatedAnatomyThickness"],9455:["SQ","1","CalibrationSequence"],9456:["SQ","1","ObjectThicknessSequence"],9457:["CS","1","PlaneIdentification"],9461:["FL","1-2","FieldOfViewDimensionsInFloat"],9462:["SQ","1","IsocenterReferenceSystemSequence"],9463:["FL","1","PositionerIsocenterPrimaryAngle"],9464:["FL","1","PositionerIsocenterSecondaryAngle"],9465:["FL","1","PositionerIsocenterDetectorRotationAngle"],9466:["FL","1","TableXPositionToIsocenter"],9467:["FL","1","TableYPositionToIsocenter"],9468:["FL","1","TableZPositionToIsocenter"],9469:["FL","1","TableHorizontalRotationAngle"],9470:["FL","1","TableHeadTiltAngle"],9471:["FL","1","TableCradleTiltAngle"],9472:["SQ","1","FrameDisplayShutterSequence"],9473:["FL","1","AcquiredImageAreaDoseProduct"],9474:["CS","1","CArmPositionerTabletopRelationship"],9476:["SQ","1","XRayGeometrySequence"],9477:["SQ","1","IrradiationEventIdentificationSequence"],9504:["SQ","1","XRay3DFrameTypeSequence"],9506:["SQ","1","ContributingSourcesSequence"],9507:["SQ","1","XRay3DAcquisitionSequence"],9508:["FL","1","PrimaryPositionerScanArc"],9509:["FL","1","SecondaryPositionerScanArc"],9510:["FL","1","PrimaryPositionerScanStartAngle"],9511:["FL","1","SecondaryPositionerScanStartAngle"],9514:["FL","1","PrimaryPositionerIncrement"],9515:["FL","1","SecondaryPositionerIncrement"],9516:["DT","1","StartAcquisitionDateTime"],9517:["DT","1","EndAcquisitionDateTime"],9518:["SS","1","PrimaryPositionerIncrementSign"],9519:["SS","1","SecondaryPositionerIncrementSign"],9524:["LO","1","ApplicationName"],9525:["LO","1","ApplicationVersion"],9526:["LO","1","ApplicationManufacturer"],9527:["CS","1","AlgorithmType"],9528:["LO","1","AlgorithmDescription"],9530:["SQ","1","XRay3DReconstructionSequence"],9531:["LO","1","ReconstructionDescription"],9538:["SQ","1","PerProjectionAcquisitionSequence"],9541:["SQ","1","DetectorPositionSequence"],9542:["SQ","1","XRayAcquisitionDoseSequence"],9543:["FD","1","XRaySourceIsocenterPrimaryAngle"],9544:["FD","1","XRaySourceIsocenterSecondaryAngle"],9545:["FD","1","BreastSupportIsocenterPrimaryAngle"],9546:["FD","1","BreastSupportIsocenterSecondaryAngle"],9547:["FD","1","BreastSupportXPositionToIsocenter"],9548:["FD","1","BreastSupportYPositionToIsocenter"],9549:["FD","1","BreastSupportZPositionToIsocenter"],9550:["FD","1","DetectorIsocenterPrimaryAngle"],9551:["FD","1","DetectorIsocenterSecondaryAngle"],9552:["FD","1","DetectorXPositionToIsocenter"],9553:["FD","1","DetectorYPositionToIsocenter"],9554:["FD","1","DetectorZPositionToIsocenter"],9555:["SQ","1","XRayGridSequence"],9556:["SQ","1","XRayFilterSequence"],9557:["FD","3","DetectorActiveAreaTLHCPosition"],9558:["FD","6","DetectorActiveAreaOrientation"],9559:["CS","1","PositionerPrimaryAngleDirection"],9601:["SQ","1","DiffusionBMatrixSequence"],9602:["FD","1","DiffusionBValueXX"],9603:["FD","1","DiffusionBValueXY"],9604:["FD","1","DiffusionBValueXZ"],9605:["FD","1","DiffusionBValueYY"],9606:["FD","1","DiffusionBValueYZ"],9607:["FD","1","DiffusionBValueZZ"],9621:["SQ","1","FunctionalMRSequence"],9622:["CS","1","FunctionalSettlingPhaseFramesPresent"],9623:["DT","1","FunctionalSyncPulse"],9624:["CS","1","SettlingPhaseFrame"],9701:["DT","1","DecayCorrectionDateTime"],9715:["FD","1","StartDensityThreshold"],9716:["FD","1","StartRelativeDensityDifferenceThreshold"],9717:["FD","1","StartCardiacTriggerCountThreshold"],9718:["FD","1","StartRespiratoryTriggerCountThreshold"],9719:["FD","1","TerminationCountsThreshold"],9720:["FD","1","TerminationDensityThreshold"],9721:["FD","1","TerminationRelativeDensityThreshold"],9722:["FD","1","TerminationTimeThreshold"],9723:["FD","1","TerminationCardiacTriggerCountThreshold"],9724:["FD","1","TerminationRespiratoryTriggerCountThreshold"],9725:["CS","1","DetectorGeometry"],9726:["FD","1","TransverseDetectorSeparation"],9727:["FD","1","AxialDetectorDimension"],9729:["US","1","RadiopharmaceuticalAgentNumber"],9732:["SQ","1","PETFrameAcquisitionSequence"],9733:["SQ","1","PETDetectorMotionDetailsSequence"],9734:["SQ","1","PETTableDynamicsSequence"],9735:["SQ","1","PETPositionSequence"],9736:["SQ","1","PETFrameCorrectionFactorsSequence"],9737:["SQ","1","RadiopharmaceuticalUsageSequence"],9738:["CS","1","AttenuationCorrectionSource"],9739:["US","1","NumberOfIterations"],9740:["US","1","NumberOfSubsets"],9749:["SQ","1","PETReconstructionSequence"],9751:["SQ","1","PETFrameTypeSequence"],9755:["CS","1","TimeOfFlightInformationUsed"],9756:["CS","1","ReconstructionType"],9758:["CS","1","DecayCorrected"],9759:["CS","1","AttenuationCorrected"],9760:["CS","1","ScatterCorrected"],9761:["CS","1","DeadTimeCorrected"],9762:["CS","1","GantryMotionCorrected"],9763:["CS","1","PatientMotionCorrected"],9764:["CS","1","CountLossNormalizationCorrected"],9765:["CS","1","RandomsCorrected"],9766:["CS","1","NonUniformRadialSamplingCorrected"],9767:["CS","1","SensitivityCalibrated"],9768:["CS","1","DetectorNormalizationCorrection"],9769:["CS","1","IterativeReconstructionMethod"],9770:["CS","1","AttenuationCorrectionTemporalRelationship"],9771:["SQ","1","PatientPhysiologicalStateSequence"],9772:["SQ","1","PatientPhysiologicalStateCodeSequence"],9801:["FD","1-n","DepthsOfFocus"],9803:["SQ","1","ExcludedIntervalsSequence"],9804:["DT","1","ExclusionStartDateTime"],9805:["FD","1","ExclusionDuration"],9806:["SQ","1","USImageDescriptionSequence"],9807:["SQ","1","ImageDataTypeSequence"],9808:["CS","1","DataType"],9809:["SQ","1","TransducerScanPatternCodeSequence"],"980B":["CS","1","AliasedDataType"],"980C":["CS","1","PositionMeasuringDeviceUsed"],"980D":["SQ","1","TransducerGeometryCodeSequence"],"980E":["SQ","1","TransducerBeamSteeringCodeSequence"],"980F":["SQ","1","TransducerApplicationCodeSequence"],9810:["xs","1","ZeroVelocityPixelValue"],9900:["LO","1","ReferenceLocationLabel"],9901:["UT","1","ReferenceLocationDescription"],9902:["SQ","1","ReferenceBasisCodeSequence"],9903:["SQ","1","ReferenceGeometryCodeSequence"],9904:["DS","1","OffsetDistance"],9905:["CS","1","OffsetDirection"],9906:["SQ","1","PotentialScheduledProtocolCodeSequence"],9907:["SQ","1","PotentialRequestedProcedureCodeSequence"],9908:["UC","1-n","PotentialReasonsForProcedure"],9909:["SQ","1","PotentialReasonsForProcedureCodeSequence"],"990A":["UC","1-n","PotentialDiagnosticTasks"],"990B":["SQ","1","ContraindicationsCodeSequence"],"990C":["SQ","1","ReferencedDefinedProtocolSequence"],"990D":["SQ","1","ReferencedPerformedProtocolSequence"],"990E":["SQ","1","PredecessorProtocolSequence"],"990F":["UT","1","ProtocolPlanningInformation"],9910:["UT","1","ProtocolDesignRationale"],9911:["SQ","1","PatientSpecificationSequence"],9912:["SQ","1","ModelSpecificationSequence"],9913:["SQ","1","ParametersSpecificationSequence"],9914:["SQ","1","InstructionSequence"],9915:["US","1","InstructionIndex"],9916:["LO","1","InstructionText"],9917:["UT","1","InstructionDescription"],9918:["CS","1","InstructionPerformedFlag"],9919:["DT","1","InstructionPerformedDateTime"],"991A":["UT","1","InstructionPerformanceComment"],"991B":["SQ","1","PatientPositioningInstructionSequence"],"991C":["SQ","1","PositioningMethodCodeSequence"],"991D":["SQ","1","PositioningLandmarkSequence"],"991E":["UI","1","TargetFrameOfReferenceUID"],"991F":["SQ","1","AcquisitionProtocolElementSpecificationSequence"],9920:["SQ","1","AcquisitionProtocolElementSequence"],9921:["US","1","ProtocolElementNumber"],9922:["LO","1","ProtocolElementName"],9923:["UT","1","ProtocolElementCharacteristicsSummary"],9924:["UT","1","ProtocolElementPurpose"],9930:["CS","1","AcquisitionMotion"],9931:["SQ","1","AcquisitionStartLocationSequence"],9932:["SQ","1","AcquisitionEndLocationSequence"],9933:["SQ","1","ReconstructionProtocolElementSpecificationSequence"],9934:["SQ","1","ReconstructionProtocolElementSequence"],9935:["SQ","1","StorageProtocolElementSpecificationSequence"],9936:["SQ","1","StorageProtocolElementSequence"],9937:["LO","1","RequestedSeriesDescription"],9938:["US","1-n","SourceAcquisitionProtocolElementNumber"],9939:["US","1-n","SourceAcquisitionBeamNumber"],"993A":["US","1-n","SourceReconstructionProtocolElementNumber"],"993B":["SQ","1","ReconstructionStartLocationSequence"],"993C":["SQ","1","ReconstructionEndLocationSequence"],"993D":["SQ","1","ReconstructionAlgorithmSequence"],"993E":["SQ","1","ReconstructionTargetCenterLocationSequence"],9941:["UT","1","ImageFilterDescription"],9942:["FD","1","CTDIvolNotificationTrigger"],9943:["FD","1","DLPNotificationTrigger"],9944:["CS","1","AutoKVPSelectionType"],9945:["FD","1","AutoKVPUpperBound"],9946:["FD","1","AutoKVPLowerBound"],9947:["CS","1","ProtocolDefinedPatientPosition"],A001:["SQ","1","ContributingEquipmentSequence"],A002:["DT","1","ContributionDateTime"],A003:["ST","1","ContributionDescription"]},"0020":{"0000":["UL","1","GenericGroupLength"],"000D":["UI","1","StudyInstanceUID"],"000E":["UI","1","SeriesInstanceUID"],"0010":["SH","1","StudyID"],"0011":["IS","1","SeriesNumber"],"0012":["IS","1","AcquisitionNumber"],"0013":["IS","1","InstanceNumber"],"0014":["IS","1","IsotopeNumber"],"0015":["IS","1","PhaseNumber"],"0016":["IS","1","IntervalNumber"],"0017":["IS","1","TimeSlotNumber"],"0018":["IS","1","AngleNumber"],"0019":["IS","1","ItemNumber"],"0020":["CS","2","PatientOrientation"],"0022":["IS","1","OverlayNumber"],"0024":["IS","1","CurveNumber"],"0026":["IS","1","LUTNumber"],"0030":["DS","3","ImagePosition"],"0032":["DS","3","ImagePositionPatient"],"0035":["DS","6","ImageOrientation"],"0037":["DS","6","ImageOrientationPatient"],"0050":["DS","1","Location"],"0052":["UI","1","FrameOfReferenceUID"],"0060":["CS","1","Laterality"],"0062":["CS","1","ImageLaterality"],"0070":["LO","1","ImageGeometryType"],"0080":["CS","1-n","MaskingImage"],"00AA":["IS","1","ReportNumber"],"0100":["IS","1","TemporalPositionIdentifier"],"0105":["IS","1","NumberOfTemporalPositions"],"0110":["DS","1","TemporalResolution"],"0200":["UI","1","SynchronizationFrameOfReferenceUID"],"0242":["UI","1","SOPInstanceUIDOfConcatenationSource"],1e3:["IS","1","SeriesInStudy"],1001:["IS","1","AcquisitionsInSeries"],1002:["IS","1","ImagesInAcquisition"],1003:["IS","1","ImagesInSeries"],1004:["IS","1","AcquisitionsInStudy"],1005:["IS","1","ImagesInStudy"],1020:["LO","1-n","Reference"],"103F":["LO","1","TargetPositionReferenceIndicator"],1040:["LO","1","PositionReferenceIndicator"],1041:["DS","1","SliceLocation"],1070:["IS","1-n","OtherStudyNumbers"],1200:["IS","1","NumberOfPatientRelatedStudies"],1202:["IS","1","NumberOfPatientRelatedSeries"],1204:["IS","1","NumberOfPatientRelatedInstances"],1206:["IS","1","NumberOfStudyRelatedSeries"],1208:["IS","1","NumberOfStudyRelatedInstances"],1209:["IS","1","NumberOfSeriesRelatedInstances"],3100:["CS","1-n","SourceImageIDs"],3401:["CS","1","ModifyingDeviceID"],3402:["CS","1","ModifiedImageID"],3403:["DA","1","ModifiedImageDate"],3404:["LO","1","ModifyingDeviceManufacturer"],3405:["TM","1","ModifiedImageTime"],3406:["LO","1","ModifiedImageDescription"],4e3:["LT","1","ImageComments"],5e3:["AT","1-n","OriginalImageIdentification"],5002:["LO","1-n","OriginalImageIdentificationNomenclature"],9056:["SH","1","StackID"],9057:["UL","1","InStackPositionNumber"],9071:["SQ","1","FrameAnatomySequence"],9072:["CS","1","FrameLaterality"],9111:["SQ","1","FrameContentSequence"],9113:["SQ","1","PlanePositionSequence"],9116:["SQ","1","PlaneOrientationSequence"],9128:["UL","1","TemporalPositionIndex"],9153:["FD","1","NominalCardiacTriggerDelayTime"],9154:["FL","1","NominalCardiacTriggerTimePriorToRPeak"],9155:["FL","1","ActualCardiacTriggerTimePriorToRPeak"],9156:["US","1","FrameAcquisitionNumber"],9157:["UL","1-n","DimensionIndexValues"],9158:["LT","1","FrameComments"],9161:["UI","1","ConcatenationUID"],9162:["US","1","InConcatenationNumber"],9163:["US","1","InConcatenationTotalNumber"],9164:["UI","1","DimensionOrganizationUID"],9165:["AT","1","DimensionIndexPointer"],9167:["AT","1","FunctionalGroupPointer"],9170:["SQ","1","UnassignedSharedConvertedAttributesSequence"],9171:["SQ","1","UnassignedPerFrameConvertedAttributesSequence"],9172:["SQ","1","ConversionSourceAttributesSequence"],9213:["LO","1","DimensionIndexPrivateCreator"],9221:["SQ","1","DimensionOrganizationSequence"],9222:["SQ","1","DimensionIndexSequence"],9228:["UL","1","ConcatenationFrameOffsetNumber"],9238:["LO","1","FunctionalGroupPrivateCreator"],9241:["FL","1","NominalPercentageOfCardiacPhase"],9245:["FL","1","NominalPercentageOfRespiratoryPhase"],9246:["FL","1","StartingRespiratoryAmplitude"],9247:["CS","1","StartingRespiratoryPhase"],9248:["FL","1","EndingRespiratoryAmplitude"],9249:["CS","1","EndingRespiratoryPhase"],9250:["CS","1","RespiratoryTriggerType"],9251:["FD","1","RRIntervalTimeNominal"],9252:["FD","1","ActualCardiacTriggerDelayTime"],9253:["SQ","1","RespiratorySynchronizationSequence"],9254:["FD","1","RespiratoryIntervalTime"],9255:["FD","1","NominalRespiratoryTriggerDelayTime"],9256:["FD","1","RespiratoryTriggerDelayThreshold"],9257:["FD","1","ActualRespiratoryTriggerDelayTime"],9301:["FD","3","ImagePositionVolume"],9302:["FD","6","ImageOrientationVolume"],9307:["CS","1","UltrasoundAcquisitionGeometry"],9308:["FD","3","ApexPosition"],9309:["FD","16","VolumeToTransducerMappingMatrix"],"930A":["FD","16","VolumeToTableMappingMatrix"],"930B":["CS","1","VolumeToTransducerRelationship"],"930C":["CS","1","PatientFrameOfReferenceSource"],"930D":["FD","1","TemporalPositionTimeOffset"],"930E":["SQ","1","PlanePositionVolumeSequence"],"930F":["SQ","1","PlaneOrientationVolumeSequence"],9310:["SQ","1","TemporalPositionSequence"],9311:["CS","1","DimensionOrganizationType"],9312:["UI","1","VolumeFrameOfReferenceUID"],9313:["UI","1","TableFrameOfReferenceUID"],9421:["LO","1","DimensionDescriptionLabel"],9450:["SQ","1","PatientOrientationInFrameSequence"],9453:["LO","1","FrameLabel"],9518:["US","1-n","AcquisitionIndex"],9529:["SQ","1","ContributingSOPInstancesReferenceSequence"],9536:["US","1","ReconstructionIndex"]},"0022":{"0000":["UL","1","GenericGroupLength"],"0001":["US","1","LightPathFilterPassThroughWavelength"],"0002":["US","2","LightPathFilterPassBand"],"0003":["US","1","ImagePathFilterPassThroughWavelength"],"0004":["US","2","ImagePathFilterPassBand"],"0005":["CS","1","PatientEyeMovementCommanded"],"0006":["SQ","1","PatientEyeMovementCommandCodeSequence"],"0007":["FL","1","SphericalLensPower"],"0008":["FL","1","CylinderLensPower"],"0009":["FL","1","CylinderAxis"],"000A":["FL","1","EmmetropicMagnification"],"000B":["FL","1","IntraOcularPressure"],"000C":["FL","1","HorizontalFieldOfView"],"000D":["CS","1","PupilDilated"],"000E":["FL","1","DegreeOfDilation"],"0010":["FL","1","StereoBaselineAngle"],"0011":["FL","1","StereoBaselineDisplacement"],"0012":["FL","1","StereoHorizontalPixelOffset"],"0013":["FL","1","StereoVerticalPixelOffset"],"0014":["FL","1","StereoRotation"],"0015":["SQ","1","AcquisitionDeviceTypeCodeSequence"],"0016":["SQ","1","IlluminationTypeCodeSequence"],"0017":["SQ","1","LightPathFilterTypeStackCodeSequence"],"0018":["SQ","1","ImagePathFilterTypeStackCodeSequence"],"0019":["SQ","1","LensesCodeSequence"],"001A":["SQ","1","ChannelDescriptionCodeSequence"],"001B":["SQ","1","RefractiveStateSequence"],"001C":["SQ","1","MydriaticAgentCodeSequence"],"001D":["SQ","1","RelativeImagePositionCodeSequence"],"001E":["FL","1","CameraAngleOfView"],"0020":["SQ","1","StereoPairsSequence"],"0021":["SQ","1","LeftImageSequence"],"0022":["SQ","1","RightImageSequence"],"0028":["CS","1","StereoPairsPresent"],"0030":["FL","1","AxialLengthOfTheEye"],"0031":["SQ","1","OphthalmicFrameLocationSequence"],"0032":["FL","2-2n","ReferenceCoordinates"],"0035":["FL","1","DepthSpatialResolution"],"0036":["FL","1","MaximumDepthDistortion"],"0037":["FL","1","AlongScanSpatialResolution"],"0038":["FL","1","MaximumAlongScanDistortion"],"0039":["CS","1","OphthalmicImageOrientation"],"0041":["FL","1","DepthOfTransverseImage"],"0042":["SQ","1","MydriaticAgentConcentrationUnitsSequence"],"0048":["FL","1","AcrossScanSpatialResolution"],"0049":["FL","1","MaximumAcrossScanDistortion"],"004E":["DS","1","MydriaticAgentConcentration"],"0055":["FL","1","IlluminationWaveLength"],"0056":["FL","1","IlluminationPower"],"0057":["FL","1","IlluminationBandwidth"],"0058":["SQ","1","MydriaticAgentSequence"],1007:["SQ","1","OphthalmicAxialMeasurementsRightEyeSequence"],1008:["SQ","1","OphthalmicAxialMeasurementsLeftEyeSequence"],1009:["CS","1","OphthalmicAxialMeasurementsDeviceType"],1010:["CS","1","OphthalmicAxialLengthMeasurementsType"],1012:["SQ","1","OphthalmicAxialLengthSequence"],1019:["FL","1","OphthalmicAxialLength"],1024:["SQ","1","LensStatusCodeSequence"],1025:["SQ","1","VitreousStatusCodeSequence"],1028:["SQ","1","IOLFormulaCodeSequence"],1029:["LO","1","IOLFormulaDetail"],1033:["FL","1","KeratometerIndex"],1035:["SQ","1","SourceOfOphthalmicAxialLengthCodeSequence"],1036:["SQ","1","SourceOfCornealSizeDataCodeSequence"],1037:["FL","1","TargetRefraction"],1039:["CS","1","RefractiveProcedureOccurred"],1040:["SQ","1","RefractiveSurgeryTypeCodeSequence"],1044:["SQ","1","OphthalmicUltrasoundMethodCodeSequence"],1045:["SQ","1","SurgicallyInducedAstigmatismSequence"],1046:["CS","1","TypeOfOpticalCorrection"],1047:["SQ","1","ToricIOLPowerSequence"],1048:["SQ","1","PredictedToricErrorSequence"],1049:["CS","1","PreSelectedForImplantation"],"104A":["SQ","1","ToricIOLPowerForExactEmmetropiaSequence"],"104B":["SQ","1","ToricIOLPowerForExactTargetRefractionSequence"],1050:["SQ","1","OphthalmicAxialLengthMeasurementsSequence"],1053:["FL","1","IOLPower"],1054:["FL","1","PredictedRefractiveError"],1059:["FL","1","OphthalmicAxialLengthVelocity"],1065:["LO","1","LensStatusDescription"],1066:["LO","1","VitreousStatusDescription"],1090:["SQ","1","IOLPowerSequence"],1092:["SQ","1","LensConstantSequence"],1093:["LO","1","IOLManufacturer"],1094:["LO","1","LensConstantDescription"],1095:["LO","1","ImplantName"],1096:["SQ","1","KeratometryMeasurementTypeCodeSequence"],1097:["LO","1","ImplantPartNumber"],1100:["SQ","1","ReferencedOphthalmicAxialMeasurementsSequence"],1101:["SQ","1","OphthalmicAxialLengthMeasurementsSegmentNameCodeSequence"],1103:["SQ","1","RefractiveErrorBeforeRefractiveSurgeryCodeSequence"],1121:["FL","1","IOLPowerForExactEmmetropia"],1122:["FL","1","IOLPowerForExactTargetRefraction"],1125:["SQ","1","AnteriorChamberDepthDefinitionCodeSequence"],1127:["SQ","1","LensThicknessSequence"],1128:["SQ","1","AnteriorChamberDepthSequence"],"112A":["SQ","1","CalculationCommentSequence"],"112B":["CS","1","CalculationCommentType"],"112C":["LT","1","CalculationComment"],1130:["FL","1","LensThickness"],1131:["FL","1","AnteriorChamberDepth"],1132:["SQ","1","SourceOfLensThicknessDataCodeSequence"],1133:["SQ","1","SourceOfAnteriorChamberDepthDataCodeSequence"],1134:["SQ","1","SourceOfRefractiveMeasurementsSequence"],1135:["SQ","1","SourceOfRefractiveMeasurementsCodeSequence"],1140:["CS","1","OphthalmicAxialLengthMeasurementModified"],1150:["SQ","1","OphthalmicAxialLengthDataSourceCodeSequence"],1153:["SQ","1","OphthalmicAxialLengthAcquisitionMethodCodeSequence"],1155:["FL","1","SignalToNoiseRatio"],1159:["LO","1","OphthalmicAxialLengthDataSourceDescription"],1210:["SQ","1","OphthalmicAxialLengthMeasurementsTotalLengthSequence"],1211:["SQ","1","OphthalmicAxialLengthMeasurementsSegmentalLengthSequence"],1212:["SQ","1","OphthalmicAxialLengthMeasurementsLengthSummationSequence"],1220:["SQ","1","UltrasoundOphthalmicAxialLengthMeasurementsSequence"],1225:["SQ","1","OpticalOphthalmicAxialLengthMeasurementsSequence"],1230:["SQ","1","UltrasoundSelectedOphthalmicAxialLengthSequence"],1250:["SQ","1","OphthalmicAxialLengthSelectionMethodCodeSequence"],1255:["SQ","1","OpticalSelectedOphthalmicAxialLengthSequence"],1257:["SQ","1","SelectedSegmentalOphthalmicAxialLengthSequence"],1260:["SQ","1","SelectedTotalOphthalmicAxialLengthSequence"],1262:["SQ","1","OphthalmicAxialLengthQualityMetricSequence"],1265:["SQ","1","OphthalmicAxialLengthQualityMetricTypeCodeSequence"],1273:["LO","1","OphthalmicAxialLengthQualityMetricTypeDescription"],1300:["SQ","1","IntraocularLensCalculationsRightEyeSequence"],1310:["SQ","1","IntraocularLensCalculationsLeftEyeSequence"],1330:["SQ","1","ReferencedOphthalmicAxialLengthMeasurementQCImageSequence"],1415:["CS","1","OphthalmicMappingDeviceType"],1420:["SQ","1","AcquisitionMethodCodeSequence"],1423:["SQ","1","AcquisitionMethodAlgorithmSequence"],1436:["SQ","1","OphthalmicThicknessMapTypeCodeSequence"],1443:["SQ","1","OphthalmicThicknessMappingNormalsSequence"],1445:["SQ","1","RetinalThicknessDefinitionCodeSequence"],1450:["SQ","1","PixelValueMappingToCodedConceptSequence"],1452:["xs","1","MappedPixelValue"],1454:["LO","1","PixelValueMappingExplanation"],1458:["SQ","1","OphthalmicThicknessMapQualityThresholdSequence"],1460:["FL","1","OphthalmicThicknessMapThresholdQualityRating"],1463:["FL","2","AnatomicStructureReferencePoint"],1465:["SQ","1","RegistrationToLocalizerSequence"],1466:["CS","1","RegisteredLocalizerUnits"],1467:["FL","2","RegisteredLocalizerTopLeftHandCorner"],1468:["FL","2","RegisteredLocalizerBottomRightHandCorner"],1470:["SQ","1","OphthalmicThicknessMapQualityRatingSequence"],1472:["SQ","1","RelevantOPTAttributesSequence"],1512:["SQ","1","TransformationMethodCodeSequence"],1513:["SQ","1","TransformationAlgorithmSequence"],1515:["CS","1","OphthalmicAxialLengthMethod"],1517:["FL","1","OphthalmicFOV"],1518:["SQ","1","TwoDimensionalToThreeDimensionalMapSequence"],1525:["SQ","1","WideFieldOphthalmicPhotographyQualityRatingSequence"],1526:["SQ","1","WideFieldOphthalmicPhotographyQualityThresholdSequence"],1527:["FL","1","WideFieldOphthalmicPhotographyThresholdQualityRating"],1528:["FL","1","XCoordinatesCenterPixelViewAngle"],1529:["FL","1","YCoordinatesCenterPixelViewAngle"],1530:["UL","1","NumberOfMapPoints"],1531:["OF","1","TwoDimensionalToThreeDimensionalMapData"],1612:["SQ","1","DerivationAlgorithmSequence"],1615:["SQ","1","OphthalmicImageTypeCodeSequence"],1616:["LO","1","OphthalmicImageTypeDescription"],1618:["SQ","1","ScanPatternTypeCodeSequence"],1620:["SQ","1","ReferencedSurfaceMeshIdentificationSequence"],1622:["CS","1","OphthalmicVolumetricPropertiesFlag"],1624:["FL","1","OphthalmicAnatomicReferencePointXCoordinate"],1626:["FL","1","OphthalmicAnatomicReferencePointYCoordinate"],1628:["SQ","1","OphthalmicEnFaceImageQualityRatingSequence"],1630:["DS","1","QualityThreshold"],1640:["SQ","1","OCTBscanAnalysisAcquisitionParametersSequence"],1642:["UL","1","NumberOfBscansPerFrame"],1643:["FL","1","BscanSlabThickness"],1644:["FL","1","DistanceBetweenBscanSlabs"],1645:["FL","1","BscanCycleTime"],1646:["FL","1-n","BscanCycleTimeVector"],1649:["FL","1","AscanRate"],1650:["FL","1","BscanRate"],1658:["UL","1","SurfaceMeshZPixelOffset"]},"0024":{"0000":["UL","1","GenericGroupLength"],"0010":["FL","1","VisualFieldHorizontalExtent"],"0011":["FL","1","VisualFieldVerticalExtent"],"0012":["CS","1","VisualFieldShape"],"0016":["SQ","1","ScreeningTestModeCodeSequence"],"0018":["FL","1","MaximumStimulusLuminance"],"0020":["FL","1","BackgroundLuminance"],"0021":["SQ","1","StimulusColorCodeSequence"],"0024":["SQ","1","BackgroundIlluminationColorCodeSequence"],"0025":["FL","1","StimulusArea"],"0028":["FL","1","StimulusPresentationTime"],"0032":["SQ","1","FixationSequence"],"0033":["SQ","1","FixationMonitoringCodeSequence"],"0034":["SQ","1","VisualFieldCatchTrialSequence"],"0035":["US","1","FixationCheckedQuantity"],"0036":["US","1","PatientNotProperlyFixatedQuantity"],"0037":["CS","1","PresentedVisualStimuliDataFlag"],"0038":["US","1","NumberOfVisualStimuli"],"0039":["CS","1","ExcessiveFixationLossesDataFlag"],"0040":["CS","1","ExcessiveFixationLosses"],"0042":["US","1","StimuliRetestingQuantity"],"0044":["LT","1","CommentsOnPatientPerformanceOfVisualField"],"0045":["CS","1","FalseNegativesEstimateFlag"],"0046":["FL","1","FalseNegativesEstimate"],"0048":["US","1","NegativeCatchTrialsQuantity"],"0050":["US","1","FalseNegativesQuantity"],"0051":["CS","1","ExcessiveFalseNegativesDataFlag"],"0052":["CS","1","ExcessiveFalseNegatives"],"0053":["CS","1","FalsePositivesEstimateFlag"],"0054":["FL","1","FalsePositivesEstimate"],"0055":["CS","1","CatchTrialsDataFlag"],"0056":["US","1","PositiveCatchTrialsQuantity"],"0057":["CS","1","TestPointNormalsDataFlag"],"0058":["SQ","1","TestPointNormalsSequence"],"0059":["CS","1","GlobalDeviationProbabilityNormalsFlag"],"0060":["US","1","FalsePositivesQuantity"],"0061":["CS","1","ExcessiveFalsePositivesDataFlag"],"0062":["CS","1","ExcessiveFalsePositives"],"0063":["CS","1","VisualFieldTestNormalsFlag"],"0064":["SQ","1","ResultsNormalsSequence"],"0065":["SQ","1","AgeCorrectedSensitivityDeviationAlgorithmSequence"],"0066":["FL","1","GlobalDeviationFromNormal"],"0067":["SQ","1","GeneralizedDefectSensitivityDeviationAlgorithmSequence"],"0068":["FL","1","LocalizedDeviationFromNormal"],"0069":["LO","1","PatientReliabilityIndicator"],"0070":["FL","1","VisualFieldMeanSensitivity"],"0071":["FL","1","GlobalDeviationProbability"],"0072":["CS","1","LocalDeviationProbabilityNormalsFlag"],"0073":["FL","1","LocalizedDeviationProbability"],"0074":["CS","1","ShortTermFluctuationCalculated"],"0075":["FL","1","ShortTermFluctuation"],"0076":["CS","1","ShortTermFluctuationProbabilityCalculated"],"0077":["FL","1","ShortTermFluctuationProbability"],"0078":["CS","1","CorrectedLocalizedDeviationFromNormalCalculated"],"0079":["FL","1","CorrectedLocalizedDeviationFromNormal"],"0080":["CS","1","CorrectedLocalizedDeviationFromNormalProbabilityCalculated"],"0081":["FL","1","CorrectedLocalizedDeviationFromNormalProbability"],"0083":["SQ","1","GlobalDeviationProbabilitySequence"],"0085":["SQ","1","LocalizedDeviationProbabilitySequence"],"0086":["CS","1","FovealSensitivityMeasured"],"0087":["FL","1","FovealSensitivity"],"0088":["FL","1","VisualFieldTestDuration"],"0089":["SQ","1","VisualFieldTestPointSequence"],"0090":["FL","1","VisualFieldTestPointXCoordinate"],"0091":["FL","1","VisualFieldTestPointYCoordinate"],"0092":["FL","1","AgeCorrectedSensitivityDeviationValue"],"0093":["CS","1","StimulusResults"],"0094":["FL","1","SensitivityValue"],"0095":["CS","1","RetestStimulusSeen"],"0096":["FL","1","RetestSensitivityValue"],"0097":["SQ","1","VisualFieldTestPointNormalsSequence"],"0098":["FL","1","QuantifiedDefect"],"0100":["FL","1","AgeCorrectedSensitivityDeviationProbabilityValue"],"0102":["CS","1","GeneralizedDefectCorrectedSensitivityDeviationFlag"],"0103":["FL","1","GeneralizedDefectCorrectedSensitivityDeviationValue"],"0104":["FL","1","GeneralizedDefectCorrectedSensitivityDeviationProbabilityValue"],"0105":["FL","1","MinimumSensitivityValue"],"0106":["CS","1","BlindSpotLocalized"],"0107":["FL","1","BlindSpotXCoordinate"],"0108":["FL","1","BlindSpotYCoordinate"],"0110":["SQ","1","VisualAcuityMeasurementSequence"],"0112":["SQ","1","RefractiveParametersUsedOnPatientSequence"],"0113":["CS","1","MeasurementLaterality"],"0114":["SQ","1","OphthalmicPatientClinicalInformationLeftEyeSequence"],"0115":["SQ","1","OphthalmicPatientClinicalInformationRightEyeSequence"],"0117":["CS","1","FovealPointNormativeDataFlag"],"0118":["FL","1","FovealPointProbabilityValue"],"0120":["CS","1","ScreeningBaselineMeasured"],"0122":["SQ","1","ScreeningBaselineMeasuredSequence"],"0124":["CS","1","ScreeningBaselineType"],"0126":["FL","1","ScreeningBaselineValue"],"0202":["LO","1","AlgorithmSource"],"0306":["LO","1","DataSetName"],"0307":["LO","1","DataSetVersion"],"0308":["LO","1","DataSetSource"],"0309":["LO","1","DataSetDescription"],"0317":["SQ","1","VisualFieldTestReliabilityGlobalIndexSequence"],"0320":["SQ","1","VisualFieldGlobalResultsIndexSequence"],"0325":["SQ","1","DataObservationSequence"],"0338":["CS","1","IndexNormalsFlag"],"0341":["FL","1","IndexProbability"],"0344":["SQ","1","IndexProbabilitySequence"]},"0028":{"0000":["UL","1","GenericGroupLength"],"0002":["US","1","SamplesPerPixel"],"0003":["US","1","SamplesPerPixelUsed"],"0004":["CS","1","PhotometricInterpretation"],"0005":["US","1","ImageDimensions"],"0006":["US","1","PlanarConfiguration"],"0008":["IS","1","NumberOfFrames"],"0009":["AT","1-n","FrameIncrementPointer"],"000A":["AT","1-n","FrameDimensionPointer"],"0010":["US","1","Rows"],"0011":["US","1","Columns"],"0012":["US","1","Planes"],"0014":["US","1","UltrasoundColorDataPresent"],"0020":["","",""],"0030":["DS","2","PixelSpacing"],"0031":["DS","2","ZoomFactor"],"0032":["DS","2","ZoomCenter"],"0034":["IS","2","PixelAspectRatio"],"0040":["CS","1","ImageFormat"],"0050":["LO","1-n","ManipulatedImage"],"0051":["CS","1-n","CorrectedImage"],"005F":["LO","1","CompressionRecognitionCode"],"0060":["CS","1","CompressionCode"],"0061":["SH","1","CompressionOriginator"],"0062":["LO","1","CompressionLabel"],"0063":["SH","1","CompressionDescription"],"0065":["CS","1-n","CompressionSequence"],"0066":["AT","1-n","CompressionStepPointers"],"0068":["US","1","RepeatInterval"],"0069":["US","1","BitsGrouped"],"0070":["US","1-n","PerimeterTable"],"0071":["xs","1","PerimeterValue"],"0080":["US","1","PredictorRows"],"0081":["US","1","PredictorColumns"],"0082":["US","1-n","PredictorConstants"],"0090":["CS","1","BlockedPixels"],"0091":["US","1","BlockRows"],"0092":["US","1","BlockColumns"],"0093":["US","1","RowOverlap"],"0094":["US","1","ColumnOverlap"],"0100":["US","1","BitsAllocated"],"0101":["US","1","BitsStored"],"0102":["US","1","HighBit"],"0103":["US","1","PixelRepresentation"],"0104":["xs","1","SmallestValidPixelValue"],"0105":["xs","1","LargestValidPixelValue"],"0106":["xs","1","SmallestImagePixelValue"],"0107":["xs","1","LargestImagePixelValue"],"0108":["xs","1","SmallestPixelValueInSeries"],"0109":["xs","1","LargestPixelValueInSeries"],"0110":["xs","1","SmallestImagePixelValueInPlane"],"0111":["xs","1","LargestImagePixelValueInPlane"],"0120":["xs","1","PixelPaddingValue"],"0121":["xs","1","PixelPaddingRangeLimit"],"0122":["FL","1","FloatPixelPaddingValue"],"0123":["FD","1","DoubleFloatPixelPaddingValue"],"0124":["FL","1","FloatPixelPaddingRangeLimit"],"0125":["FD","1","DoubleFloatPixelPaddingRangeLimit"],"0200":["US","1","ImageLocation"],"0300":["CS","1","QualityControlImage"],"0301":["CS","1","BurnedInAnnotation"],"0302":["CS","1","RecognizableVisualFeatures"],"0303":["CS","1","LongitudinalTemporalInformationModified"],"0304":["UI","1","ReferencedColorPaletteInstanceUID"],"0400":["LO","1","TransformLabel"],"0401":["LO","1","TransformVersionNumber"],"0402":["US","1","NumberOfTransformSteps"],"0403":["LO","1-n","SequenceOfCompressedData"],"0404":["AT","1-n","DetailsOfCoefficients"],"04x0":["US","1","RowsForNthOrderCoefficients"],"04x1":["US","1","ColumnsForNthOrderCoefficients"],"04x2":["LO","1-n","CoefficientCoding"],"04x3":["AT","1-n","CoefficientCodingPointers"],"0700":["LO","1","DCTLabel"],"0701":["CS","1-n","DataBlockDescription"],"0702":["AT","1-n","DataBlock"],"0710":["US","1","NormalizationFactorFormat"],"0720":["US","1","ZonalMapNumberFormat"],"0721":["AT","1-n","ZonalMapLocation"],"0722":["US","1","ZonalMapFormat"],"0730":["US","1","AdaptiveMapFormat"],"0740":["US","1","CodeNumberFormat"],"08x0":["CS","1-n","CodeLabel"],"08x2":["US","1","NumberOfTables"],"08x3":["AT","1-n","CodeTableLocation"],"08x4":["US","1","BitsForCodeWord"],"08x8":["AT","1-n","ImageDataLocation"],"0A02":["CS","1","PixelSpacingCalibrationType"],"0A04":["LO","1","PixelSpacingCalibrationDescription"],1040:["CS","1","PixelIntensityRelationship"],1041:["SS","1","PixelIntensityRelationshipSign"],1050:["DS","1-n","WindowCenter"],1051:["DS","1-n","WindowWidth"],1052:["DS","1","RescaleIntercept"],1053:["DS","1","RescaleSlope"],1054:["LO","1","RescaleType"],1055:["LO","1-n","WindowCenterWidthExplanation"],1056:["CS","1","VOILUTFunction"],1080:["CS","1","GrayScale"],1090:["CS","1","RecommendedViewingMode"],1100:["xs","3","GrayLookupTableDescriptor"],1101:["xs","3","RedPaletteColorLookupTableDescriptor"],1102:["xs","3","GreenPaletteColorLookupTableDescriptor"],1103:["xs","3","BluePaletteColorLookupTableDescriptor"],1104:["US","3","AlphaPaletteColorLookupTableDescriptor"],1111:["xs","4","LargeRedPaletteColorLookupTableDescriptor"],1112:["xs","4","LargeGreenPaletteColorLookupTableDescriptor"],1113:["xs","4","LargeBluePaletteColorLookupTableDescriptor"],1199:["UI","1","PaletteColorLookupTableUID"],1200:["xs","1-n or 1","GrayLookupTableData"],1201:["OW","1","RedPaletteColorLookupTableData"],1202:["OW","1","GreenPaletteColorLookupTableData"],1203:["OW","1","BluePaletteColorLookupTableData"],1204:["OW","1","AlphaPaletteColorLookupTableData"],1211:["OW","1","LargeRedPaletteColorLookupTableData"],1212:["OW","1","LargeGreenPaletteColorLookupTableData"],1213:["OW","1","LargeBluePaletteColorLookupTableData"],1214:["UI","1","LargePaletteColorLookupTableUID"],1221:["OW","1","SegmentedRedPaletteColorLookupTableData"],1222:["OW","1","SegmentedGreenPaletteColorLookupTableData"],1223:["OW","1","SegmentedBluePaletteColorLookupTableData"],1224:["OW","1","SegmentedAlphaPaletteColorLookupTableData"],1230:["SQ","1","StoredValueColorRangeSequence"],1231:["FD","1","MinimumStoredValueMapped"],1232:["FD","1","MaximumStoredValueMapped"],1300:["CS","1","BreastImplantPresent"],1350:["CS","1","PartialView"],1351:["ST","1","PartialViewDescription"],1352:["SQ","1","PartialViewCodeSequence"],"135A":["CS","1","SpatialLocationsPreserved"],1401:["SQ","1","DataFrameAssignmentSequence"],1402:["CS","1","DataPathAssignment"],1403:["US","1","BitsMappedToColorLookupTable"],1404:["SQ","1","BlendingLUT1Sequence"],1405:["CS","1","BlendingLUT1TransferFunction"],1406:["FD","1","BlendingWeightConstant"],1407:["US","3","BlendingLookupTableDescriptor"],1408:["OW","1","BlendingLookupTableData"],"140B":["SQ","1","EnhancedPaletteColorLookupTableSequence"],"140C":["SQ","1","BlendingLUT2Sequence"],"140D":["CS","1","BlendingLUT2TransferFunction"],"140E":["CS","1","DataPathID"],"140F":["CS","1","RGBLUTTransferFunction"],1410:["CS","1","AlphaLUTTransferFunction"],2e3:["OB","1","ICCProfile"],2002:["CS","1","ColorSpace"],2110:["CS","1","LossyImageCompression"],2112:["DS","1-n","LossyImageCompressionRatio"],2114:["CS","1-n","LossyImageCompressionMethod"],3e3:["SQ","1","ModalityLUTSequence"],3002:["xs","3","LUTDescriptor"],3003:["LO","1","LUTExplanation"],3004:["LO","1","ModalityLUTType"],3006:["xx","1-n or 1","LUTData"],3010:["SQ","1","VOILUTSequence"],3110:["SQ","1","SoftcopyVOILUTSequence"],4e3:["LT","1","ImagePresentationComments"],5e3:["SQ","1","BiPlaneAcquisitionSequence"],6010:["US","1","RepresentativeFrameNumber"],6020:["US","1-n","FrameNumbersOfInterest"],6022:["LO","1-n","FrameOfInterestDescription"],6023:["CS","1-n","FrameOfInterestType"],6030:["US","1-n","MaskPointers"],6040:["US","1-n","RWavePointer"],6100:["SQ","1","MaskSubtractionSequence"],6101:["CS","1","MaskOperation"],6102:["US","2-2n","ApplicableFrameRange"],6110:["US","1-n","MaskFrameNumbers"],6112:["US","1","ContrastFrameAveraging"],6114:["FL","2","MaskSubPixelShift"],6120:["SS","1","TIDOffset"],6190:["ST","1","MaskOperationExplanation"],7e3:["SQ","1","EquipmentAdministratorSequence"],7001:["US","1","NumberOfDisplaySubsystems"],7002:["US","1","CurrentConfigurationID"],7003:["US","1","DisplaySubsystemID"],7004:["SH","1","DisplaySubsystemName"],7005:["LO","1","DisplaySubsystemDescription"],7006:["CS","1","SystemStatus"],7007:["LO","1","SystemStatusComment"],7008:["SQ","1","TargetLuminanceCharacteristicsSequence"],7009:["US","1","LuminanceCharacteristicsID"],"700A":["SQ","1","DisplaySubsystemConfigurationSequence"],"700B":["US","1","ConfigurationID"],"700C":["SH","1","ConfigurationName"],"700D":["LO","1","ConfigurationDescription"],"700E":["US","1","ReferencedTargetLuminanceCharacteristicsID"],"700F":["SQ","1","QAResultsSequence"],7010:["SQ","1","DisplaySubsystemQAResultsSequence"],7011:["SQ","1","ConfigurationQAResultsSequence"],7012:["SQ","1","MeasurementEquipmentSequence"],7013:["CS","1-n","MeasurementFunctions"],7014:["CS","1","MeasurementEquipmentType"],7015:["SQ","1","VisualEvaluationResultSequence"],7016:["SQ","1","DisplayCalibrationResultSequence"],7017:["US","1","DDLValue"],7018:["FL","2","CIExyWhitePoint"],7019:["CS","1","DisplayFunctionType"],"701A":["FL","1","GammaValue"],"701B":["US","1","NumberOfLuminancePoints"],"701C":["SQ","1","LuminanceResponseSequence"],"701D":["FL","1","TargetMinimumLuminance"],"701E":["FL","1","TargetMaximumLuminance"],"701F":["FL","1","LuminanceValue"],7020:["LO","1","LuminanceResponseDescription"],7021:["CS","1","WhitePointFlag"],7022:["SQ","1","DisplayDeviceTypeCodeSequence"],7023:["SQ","1","DisplaySubsystemSequence"],7024:["SQ","1","LuminanceResultSequence"],7025:["CS","1","AmbientLightValueSource"],7026:["CS","1-n","MeasuredCharacteristics"],7027:["SQ","1","LuminanceUniformityResultSequence"],7028:["SQ","1","VisualEvaluationTestSequence"],7029:["CS","1","TestResult"],"702A":["LO","1","TestResultComment"],"702B":["CS","1","TestImageValidation"],"702C":["SQ","1","TestPatternCodeSequence"],"702D":["SQ","1","MeasurementPatternCodeSequence"],"702E":["SQ","1","VisualEvaluationMethodCodeSequence"],"7FE0":["UR","1","PixelDataProviderURL"],9001:["UL","1","DataPointRows"],9002:["UL","1","DataPointColumns"],9003:["CS","1","SignalDomainColumns"],9099:["US","1","LargestMonochromePixelValue"],9108:["CS","1","DataRepresentation"],9110:["SQ","1","PixelMeasuresSequence"],9132:["SQ","1","FrameVOILUTSequence"],9145:["SQ","1","PixelValueTransformationSequence"],9235:["CS","1","SignalDomainRows"],9411:["FL","1","DisplayFilterPercentage"],9415:["SQ","1","FramePixelShiftSequence"],9416:["US","1","SubtractionItemID"],9422:["SQ","1","PixelIntensityRelationshipLUTSequence"],9443:["SQ","1","FramePixelDataPropertiesSequence"],9444:["CS","1","GeometricalProperties"],9445:["FL","1","GeometricMaximumDistortion"],9446:["CS","1-n","ImageProcessingApplied"],9454:["CS","1","MaskSelectionMode"],9474:["CS","1","LUTFunction"],9478:["FL","1","MaskVisibilityPercentage"],9501:["SQ","1","PixelShiftSequence"],9502:["SQ","1","RegionPixelShiftSequence"],9503:["SS","2-2n","VerticesOfTheRegion"],9505:["SQ","1","MultiFramePresentationSequence"],9506:["US","2-2n","PixelShiftFrameRange"],9507:["US","2-2n","LUTFrameRange"],9520:["DS","16","ImageToEquipmentMappingMatrix"],9537:["CS","1","EquipmentCoordinateSystemIdentification"]},"0032":{"0000":["UL","1","GenericGroupLength"],"000A":["CS","1","StudyStatusID"],"000C":["CS","1","StudyPriorityID"],"0012":["LO","1","StudyIDIssuer"],"0032":["DA","1","StudyVerifiedDate"],"0033":["TM","1","StudyVerifiedTime"],"0034":["DA","1","StudyReadDate"],"0035":["TM","1","StudyReadTime"],1e3:["DA","1","ScheduledStudyStartDate"],1001:["TM","1","ScheduledStudyStartTime"],1010:["DA","1","ScheduledStudyStopDate"],1011:["TM","1","ScheduledStudyStopTime"],1020:["LO","1","ScheduledStudyLocation"],1021:["AE","1-n","ScheduledStudyLocationAETitle"],1030:["LO","1","ReasonForStudy"],1031:["SQ","1","RequestingPhysicianIdentificationSequence"],1032:["PN","1","RequestingPhysician"],1033:["LO","1","RequestingService"],1034:["SQ","1","RequestingServiceCodeSequence"],1040:["DA","1","StudyArrivalDate"],1041:["TM","1","StudyArrivalTime"],1050:["DA","1","StudyCompletionDate"],1051:["TM","1","StudyCompletionTime"],1055:["CS","1","StudyComponentStatusID"],1060:["LO","1","RequestedProcedureDescription"],1064:["SQ","1","RequestedProcedureCodeSequence"],1065:["SQ","1","RequestedLateralityCodeSequence"],1066:["UT","1","ReasonForVisit"],1067:["SQ","1","ReasonForVisitCodeSequence"],1070:["LO","1","RequestedContrastAgent"],4e3:["LT","1","StudyComments"]},"0034":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","FlowIdentifierSequence"],"0002":["OB","1","FlowIdentifier"],"0003":["UI","1","FlowTransferSyntaxUID"],"0004":["UL","1","FlowRTPSamplingRate"],"0005":["OB","1","SourceIdentifier"],"0007":["OB","1","FrameOriginTimestamp"],"0008":["CS","1","IncludesImagingSubject"],"0009":["SQ","1","FrameUsefulnessGroupSequence"],"000A":["SQ","1","RealTimeBulkDataFlowSequence"],"000B":["SQ","1","CameraPositionGroupSequence"],"000C":["CS","1","IncludesInformation"],"000D":["SQ","1","TimeOfFrameGroupSequence"]},"0038":{"0000":["UL","1","GenericGroupLength"],"0004":["SQ","1","ReferencedPatientAliasSequence"],"0008":["CS","1","VisitStatusID"],"0010":["LO","1","AdmissionID"],"0011":["LO","1","IssuerOfAdmissionID"],"0014":["SQ","1","IssuerOfAdmissionIDSequence"],"0016":["LO","1","RouteOfAdmissions"],"001A":["DA","1","ScheduledAdmissionDate"],"001B":["TM","1","ScheduledAdmissionTime"],"001C":["DA","1","ScheduledDischargeDate"],"001D":["TM","1","ScheduledDischargeTime"],"001E":["LO","1","ScheduledPatientInstitutionResidence"],"0020":["DA","1","AdmittingDate"],"0021":["TM","1","AdmittingTime"],"0030":["DA","1","DischargeDate"],"0032":["TM","1","DischargeTime"],"0040":["LO","1","DischargeDiagnosisDescription"],"0044":["SQ","1","DischargeDiagnosisCodeSequence"],"0050":["LO","1","SpecialNeeds"],"0060":["LO","1","ServiceEpisodeID"],"0061":["LO","1","IssuerOfServiceEpisodeID"],"0062":["LO","1","ServiceEpisodeDescription"],"0064":["SQ","1","IssuerOfServiceEpisodeIDSequence"],"0100":["SQ","1","PertinentDocumentsSequence"],"0101":["SQ","1","PertinentResourcesSequence"],"0102":["LO","1","ResourceDescription"],"0300":["LO","1","CurrentPatientLocation"],"0400":["LO","1","PatientInstitutionResidence"],"0500":["LO","1","PatientState"],"0502":["SQ","1","PatientClinicalTrialParticipationSequence"],4e3:["LT","1","VisitComments"]},"003A":{"0000":["UL","1","GenericGroupLength"],"0004":["CS","1","WaveformOriginality"],"0005":["US","1","NumberOfWaveformChannels"],"0010":["UL","1","NumberOfWaveformSamples"],"001A":["DS","1","SamplingFrequency"],"0020":["SH","1","MultiplexGroupLabel"],"0200":["SQ","1","ChannelDefinitionSequence"],"0202":["IS","1","WaveformChannelNumber"],"0203":["SH","1","ChannelLabel"],"0205":["CS","1-n","ChannelStatus"],"0208":["SQ","1","ChannelSourceSequence"],"0209":["SQ","1","ChannelSourceModifiersSequence"],"020A":["SQ","1","SourceWaveformSequence"],"020C":["LO","1","ChannelDerivationDescription"],"0210":["DS","1","ChannelSensitivity"],"0211":["SQ","1","ChannelSensitivityUnitsSequence"],"0212":["DS","1","ChannelSensitivityCorrectionFactor"],"0213":["DS","1","ChannelBaseline"],"0214":["DS","1","ChannelTimeSkew"],"0215":["DS","1","ChannelSampleSkew"],"0218":["DS","1","ChannelOffset"],"021A":["US","1","WaveformBitsStored"],"0220":["DS","1","FilterLowFrequency"],"0221":["DS","1","FilterHighFrequency"],"0222":["DS","1","NotchFilterFrequency"],"0223":["DS","1","NotchFilterBandwidth"],"0230":["FL","1","WaveformDataDisplayScale"],"0231":["US","3","WaveformDisplayBackgroundCIELabValue"],"0240":["SQ","1","WaveformPresentationGroupSequence"],"0241":["US","1","PresentationGroupNumber"],"0242":["SQ","1","ChannelDisplaySequence"],"0244":["US","3","ChannelRecommendedDisplayCIELabValue"],"0245":["FL","1","ChannelPosition"],"0246":["CS","1","DisplayShadingFlag"],"0247":["FL","1","FractionalChannelDisplayScale"],"0248":["FL","1","AbsoluteChannelDisplayScale"],"0300":["SQ","1","MultiplexedAudioChannelsDescriptionCodeSequence"],"0301":["IS","1","ChannelIdentificationCode"],"0302":["CS","1","ChannelMode"],"0310":["UI","1","MultiplexGroupUID"],"0311":["DS","1","PowerlineFrequency"],"0312":["SQ","1","ChannelImpedanceSequence"],"0313":["DS","1","ImpedanceValue"],"0314":["DT","1","ImpedanceMeasurementDateTime"],"0315":["DS","1","ImpedanceMeasurementFrequency"],"0316":["CS","1","ImpedanceMeasurementCurrentType"]},"0040":{"0000":["UL","1","GenericGroupLength"],"0001":["AE","1-n","ScheduledStationAETitle"],"0002":["DA","1","ScheduledProcedureStepStartDate"],"0003":["TM","1","ScheduledProcedureStepStartTime"],"0004":["DA","1","ScheduledProcedureStepEndDate"],"0005":["TM","1","ScheduledProcedureStepEndTime"],"0006":["PN","1","ScheduledPerformingPhysicianName"],"0007":["LO","1","ScheduledProcedureStepDescription"],"0008":["SQ","1","ScheduledProtocolCodeSequence"],"0009":["SH","1","ScheduledProcedureStepID"],"000A":["SQ","1","StageCodeSequence"],"000B":["SQ","1","ScheduledPerformingPhysicianIdentificationSequence"],"0010":["SH","1-n","ScheduledStationName"],"0011":["SH","1","ScheduledProcedureStepLocation"],"0012":["LO","1","PreMedication"],"0020":["CS","1","ScheduledProcedureStepStatus"],"0026":["SQ","1","OrderPlacerIdentifierSequence"],"0027":["SQ","1","OrderFillerIdentifierSequence"],"0031":["UT","1","LocalNamespaceEntityID"],"0032":["UT","1","UniversalEntityID"],"0033":["CS","1","UniversalEntityIDType"],"0035":["CS","1","IdentifierTypeCode"],"0036":["SQ","1","AssigningFacilitySequence"],"0039":["SQ","1","AssigningJurisdictionCodeSequence"],"003A":["SQ","1","AssigningAgencyOrDepartmentCodeSequence"],"0100":["SQ","1","ScheduledProcedureStepSequence"],"0220":["SQ","1","ReferencedNonImageCompositeSOPInstanceSequence"],"0241":["AE","1","PerformedStationAETitle"],"0242":["SH","1","PerformedStationName"],"0243":["SH","1","PerformedLocation"],"0244":["DA","1","PerformedProcedureStepStartDate"],"0245":["TM","1","PerformedProcedureStepStartTime"],"0250":["DA","1","PerformedProcedureStepEndDate"],"0251":["TM","1","PerformedProcedureStepEndTime"],"0252":["CS","1","PerformedProcedureStepStatus"],"0253":["SH","1","PerformedProcedureStepID"],"0254":["LO","1","PerformedProcedureStepDescription"],"0255":["LO","1","PerformedProcedureTypeDescription"],"0260":["SQ","1","PerformedProtocolCodeSequence"],"0261":["CS","1","PerformedProtocolType"],"0270":["SQ","1","ScheduledStepAttributesSequence"],"0275":["SQ","1","RequestAttributesSequence"],"0280":["ST","1","CommentsOnThePerformedProcedureStep"],"0281":["SQ","1","PerformedProcedureStepDiscontinuationReasonCodeSequence"],"0293":["SQ","1","QuantitySequence"],"0294":["DS","1","Quantity"],"0295":["SQ","1","MeasuringUnitsSequence"],"0296":["SQ","1","BillingItemSequence"],"0300":["US","1","TotalTimeOfFluoroscopy"],"0301":["US","1","TotalNumberOfExposures"],"0302":["US","1","EntranceDose"],"0303":["US","1-2","ExposedArea"],"0306":["DS","1","DistanceSourceToEntrance"],"0307":["DS","1","DistanceSourceToSupport"],"030E":["SQ","1","ExposureDoseSequence"],"0310":["ST","1","CommentsOnRadiationDose"],"0312":["DS","1","XRayOutput"],"0314":["DS","1","HalfValueLayer"],"0316":["DS","1","OrganDose"],"0318":["CS","1","OrganExposed"],"0320":["SQ","1","BillingProcedureStepSequence"],"0321":["SQ","1","FilmConsumptionSequence"],"0324":["SQ","1","BillingSuppliesAndDevicesSequence"],"0330":["SQ","1","ReferencedProcedureStepSequence"],"0340":["SQ","1","PerformedSeriesSequence"],"0400":["LT","1","CommentsOnTheScheduledProcedureStep"],"0440":["SQ","1","ProtocolContextSequence"],"0441":["SQ","1","ContentItemModifierSequence"],"0500":["SQ","1","ScheduledSpecimenSequence"],"050A":["LO","1","SpecimenAccessionNumber"],"0512":["LO","1","ContainerIdentifier"],"0513":["SQ","1","IssuerOfTheContainerIdentifierSequence"],"0515":["SQ","1","AlternateContainerIdentifierSequence"],"0518":["SQ","1","ContainerTypeCodeSequence"],"051A":["LO","1","ContainerDescription"],"0520":["SQ","1","ContainerComponentSequence"],"0550":["SQ","1","SpecimenSequence"],"0551":["LO","1","SpecimenIdentifier"],"0552":["SQ","1","SpecimenDescriptionSequenceTrial"],"0553":["ST","1","SpecimenDescriptionTrial"],"0554":["UI","1","SpecimenUID"],"0555":["SQ","1","AcquisitionContextSequence"],"0556":["ST","1","AcquisitionContextDescription"],"0560":["SQ","1","SpecimenDescriptionSequence"],"0562":["SQ","1","IssuerOfTheSpecimenIdentifierSequence"],"059A":["SQ","1","SpecimenTypeCodeSequence"],"0600":["LO","1","SpecimenShortDescription"],"0602":["UT","1","SpecimenDetailedDescription"],"0610":["SQ","1","SpecimenPreparationSequence"],"0612":["SQ","1","SpecimenPreparationStepContentItemSequence"],"0620":["SQ","1","SpecimenLocalizationContentItemSequence"],"06FA":["LO","1","SlideIdentifier"],"0710":["SQ","1","WholeSlideMicroscopyImageFrameTypeSequence"],"071A":["SQ","1","ImageCenterPointCoordinatesSequence"],"072A":["DS","1","XOffsetInSlideCoordinateSystem"],"073A":["DS","1","YOffsetInSlideCoordinateSystem"],"074A":["DS","1","ZOffsetInSlideCoordinateSystem"],"08D8":["SQ","1","PixelSpacingSequence"],"08DA":["SQ","1","CoordinateSystemAxisCodeSequence"],"08EA":["SQ","1","MeasurementUnitsCodeSequence"],"09F8":["SQ","1","VitalStainCodeSequenceTrial"],1001:["SH","1","RequestedProcedureID"],1002:["LO","1","ReasonForTheRequestedProcedure"],1003:["SH","1","RequestedProcedurePriority"],1004:["LO","1","PatientTransportArrangements"],1005:["LO","1","RequestedProcedureLocation"],1006:["SH","1","PlacerOrderNumberProcedure"],1007:["SH","1","FillerOrderNumberProcedure"],1008:["LO","1","ConfidentialityCode"],1009:["SH","1","ReportingPriority"],"100A":["SQ","1","ReasonForRequestedProcedureCodeSequence"],1010:["PN","1-n","NamesOfIntendedRecipientsOfResults"],1011:["SQ","1","IntendedRecipientsOfResultsIdentificationSequence"],1012:["SQ","1","ReasonForPerformedProcedureCodeSequence"],1060:["LO","1","RequestedProcedureDescriptionTrial"],1101:["SQ","1","PersonIdentificationCodeSequence"],1102:["ST","1","PersonAddress"],1103:["LO","1-n","PersonTelephoneNumbers"],1104:["LT","1","PersonTelecomInformation"],1400:["LT","1","RequestedProcedureComments"],2001:["LO","1","ReasonForTheImagingServiceRequest"],2004:["DA","1","IssueDateOfImagingServiceRequest"],2005:["TM","1","IssueTimeOfImagingServiceRequest"],2006:["SH","1","PlacerOrderNumberImagingServiceRequestRetired"],2007:["SH","1","FillerOrderNumberImagingServiceRequestRetired"],2008:["PN","1","OrderEnteredBy"],2009:["SH","1","OrderEntererLocation"],2010:["SH","1","OrderCallbackPhoneNumber"],2011:["LT","1","OrderCallbackTelecomInformation"],2016:["LO","1","PlacerOrderNumberImagingServiceRequest"],2017:["LO","1","FillerOrderNumberImagingServiceRequest"],2400:["LT","1","ImagingServiceRequestComments"],3001:["LO","1","ConfidentialityConstraintOnPatientDataDescription"],4001:["CS","1","GeneralPurposeScheduledProcedureStepStatus"],4002:["CS","1","GeneralPurposePerformedProcedureStepStatus"],4003:["CS","1","GeneralPurposeScheduledProcedureStepPriority"],4004:["SQ","1","ScheduledProcessingApplicationsCodeSequence"],4005:["DT","1","ScheduledProcedureStepStartDateTime"],4006:["CS","1","MultipleCopiesFlag"],4007:["SQ","1","PerformedProcessingApplicationsCodeSequence"],4008:["DT","1","ScheduledProcedureStepExpirationDateTime"],4009:["SQ","1","HumanPerformerCodeSequence"],4010:["DT","1","ScheduledProcedureStepModificationDateTime"],4011:["DT","1","ExpectedCompletionDateTime"],4015:["SQ","1","ResultingGeneralPurposePerformedProcedureStepsSequence"],4016:["SQ","1","ReferencedGeneralPurposeScheduledProcedureStepSequence"],4018:["SQ","1","ScheduledWorkitemCodeSequence"],4019:["SQ","1","PerformedWorkitemCodeSequence"],4020:["CS","1","InputAvailabilityFlag"],4021:["SQ","1","InputInformationSequence"],4022:["SQ","1","RelevantInformationSequence"],4023:["UI","1","ReferencedGeneralPurposeScheduledProcedureStepTransactionUID"],4025:["SQ","1","ScheduledStationNameCodeSequence"],4026:["SQ","1","ScheduledStationClassCodeSequence"],4027:["SQ","1","ScheduledStationGeographicLocationCodeSequence"],4028:["SQ","1","PerformedStationNameCodeSequence"],4029:["SQ","1","PerformedStationClassCodeSequence"],4030:["SQ","1","PerformedStationGeographicLocationCodeSequence"],4031:["SQ","1","RequestedSubsequentWorkitemCodeSequence"],4032:["SQ","1","NonDICOMOutputCodeSequence"],4033:["SQ","1","OutputInformationSequence"],4034:["SQ","1","ScheduledHumanPerformersSequence"],4035:["SQ","1","ActualHumanPerformersSequence"],4036:["LO","1","HumanPerformerOrganization"],4037:["PN","1","HumanPerformerName"],4040:["CS","1","RawDataHandling"],4041:["CS","1","InputReadinessState"],4050:["DT","1","PerformedProcedureStepStartDateTime"],4051:["DT","1","PerformedProcedureStepEndDateTime"],4052:["DT","1","ProcedureStepCancellationDateTime"],4070:["SQ","1","OutputDestinationSequence"],4071:["SQ","1","DICOMStorageSequence"],4072:["SQ","1","STOWRSStorageSequence"],4073:["UR","1","StorageURL"],4074:["SQ","1","XDSStorageSequence"],8302:["DS","1","EntranceDoseInmGy"],8303:["CS","1","EntranceDoseDerivation"],9092:["SQ","1","ParametricMapFrameTypeSequence"],9094:["SQ","1","ReferencedImageRealWorldValueMappingSequence"],9096:["SQ","1","RealWorldValueMappingSequence"],9098:["SQ","1","PixelValueMappingCodeSequence"],9210:["SH","1","LUTLabel"],9211:["xs","1","RealWorldValueLastValueMapped"],9212:["FD","1-n","RealWorldValueLUTData"],9213:["FD","1","DoubleFloatRealWorldValueLastValueMapped"],9214:["FD","1","DoubleFloatRealWorldValueFirstValueMapped"],9216:["xs","1","RealWorldValueFirstValueMapped"],9220:["SQ","1","QuantityDefinitionSequence"],9224:["FD","1","RealWorldValueIntercept"],9225:["FD","1","RealWorldValueSlope"],A007:["CS","1","FindingsFlagTrial"],A010:["CS","1","RelationshipType"],A020:["SQ","1","FindingsSequenceTrial"],A021:["UI","1","FindingsGroupUIDTrial"],A022:["UI","1","ReferencedFindingsGroupUIDTrial"],A023:["DA","1","FindingsGroupRecordingDateTrial"],A024:["TM","1","FindingsGroupRecordingTimeTrial"],A026:["SQ","1","FindingsSourceCategoryCodeSequenceTrial"],A027:["LO","1","VerifyingOrganization"],A028:["SQ","1","DocumentingOrganizationIdentifierCodeSequenceTrial"],A030:["DT","1","VerificationDateTime"],A032:["DT","1","ObservationDateTime"],A033:["DT","1","ObservationStartDateTime"],A040:["CS","1","ValueType"],A043:["SQ","1","ConceptNameCodeSequence"],A047:["LO","1","MeasurementPrecisionDescriptionTrial"],A050:["CS","1","ContinuityOfContent"],A057:["CS","1-n","UrgencyOrPriorityAlertsTrial"],A060:["LO","1","SequencingIndicatorTrial"],A066:["SQ","1","DocumentIdentifierCodeSequenceTrial"],A067:["PN","1","DocumentAuthorTrial"],A068:["SQ","1","DocumentAuthorIdentifierCodeSequenceTrial"],A070:["SQ","1","IdentifierCodeSequenceTrial"],A073:["SQ","1","VerifyingObserverSequence"],A074:["OB","1","ObjectBinaryIdentifierTrial"],A075:["PN","1","VerifyingObserverName"],A076:["SQ","1","DocumentingObserverIdentifierCodeSequenceTrial"],A078:["SQ","1","AuthorObserverSequence"],A07A:["SQ","1","ParticipantSequence"],A07C:["SQ","1","CustodialOrganizationSequence"],A080:["CS","1","ParticipationType"],A082:["DT","1","ParticipationDateTime"],A084:["CS","1","ObserverType"],A085:["SQ","1","ProcedureIdentifierCodeSequenceTrial"],A088:["SQ","1","VerifyingObserverIdentificationCodeSequence"],A089:["OB","1","ObjectDirectoryBinaryIdentifierTrial"],A090:["SQ","1","EquivalentCDADocumentSequence"],A0B0:["US","2-2n","ReferencedWaveformChannels"],A110:["DA","1","DateOfDocumentOrVerbalTransactionTrial"],A112:["TM","1","TimeOfDocumentCreationOrVerbalTransactionTrial"],A120:["DT","1","DateTime"],A121:["DA","1","Date"],A122:["TM","1","Time"],A123:["PN","1","PersonName"],A124:["UI","1","UID"],A125:["CS","2","ReportStatusIDTrial"],A130:["CS","1","TemporalRangeType"],A132:["UL","1-n","ReferencedSamplePositions"],A136:["US","1-n","ReferencedFrameNumbers"],A138:["DS","1-n","ReferencedTimeOffsets"],A13A:["DT","1-n","ReferencedDateTime"],A160:["UT","1","TextValue"],A161:["FD","1-n","FloatingPointValue"],A162:["SL","1-n","RationalNumeratorValue"],A163:["UL","1-n","RationalDenominatorValue"],A167:["SQ","1","ObservationCategoryCodeSequenceTrial"],A168:["SQ","1","ConceptCodeSequence"],A16A:["ST","1","BibliographicCitationTrial"],A170:["SQ","1","PurposeOfReferenceCodeSequence"],A171:["UI","1","ObservationUID"],A172:["UI","1","ReferencedObservationUIDTrial"],A173:["CS","1","ReferencedObservationClassTrial"],A174:["CS","1","ReferencedObjectObservationClassTrial"],A180:["US","1","AnnotationGroupNumber"],A192:["DA","1","ObservationDateTrial"],A193:["TM","1","ObservationTimeTrial"],A194:["CS","1","MeasurementAutomationTrial"],A195:["SQ","1","ModifierCodeSequence"],A224:["ST","1","IdentificationDescriptionTrial"],A290:["CS","1","CoordinatesSetGeometricTypeTrial"],A296:["SQ","1","AlgorithmCodeSequenceTrial"],A297:["ST","1","AlgorithmDescriptionTrial"],A29A:["SL","2-2n","PixelCoordinatesSetTrial"],A300:["SQ","1","MeasuredValueSequence"],A301:["SQ","1","NumericValueQualifierCodeSequence"],A307:["PN","1","CurrentObserverTrial"],A30A:["DS","1-n","NumericValue"],A313:["SQ","1","ReferencedAccessionSequenceTrial"],A33A:["ST","1","ReportStatusCommentTrial"],A340:["SQ","1","ProcedureContextSequenceTrial"],A352:["PN","1","VerbalSourceTrial"],A353:["ST","1","AddressTrial"],A354:["LO","1","TelephoneNumberTrial"],A358:["SQ","1","VerbalSourceIdentifierCodeSequenceTrial"],A360:["SQ","1","PredecessorDocumentsSequence"],A370:["SQ","1","ReferencedRequestSequence"],A372:["SQ","1","PerformedProcedureCodeSequence"],A375:["SQ","1","CurrentRequestedProcedureEvidenceSequence"],A380:["SQ","1","ReportDetailSequenceTrial"],A385:["SQ","1","PertinentOtherEvidenceSequence"],A390:["SQ","1","HL7StructuredDocumentReferenceSequence"],A402:["UI","1","ObservationSubjectUIDTrial"],A403:["CS","1","ObservationSubjectClassTrial"],A404:["SQ","1","ObservationSubjectTypeCodeSequenceTrial"],A491:["CS","1","CompletionFlag"],A492:["LO","1","CompletionFlagDescription"],A493:["CS","1","VerificationFlag"],A494:["CS","1","ArchiveRequested"],A496:["CS","1","PreliminaryFlag"],A504:["SQ","1","ContentTemplateSequence"],A525:["SQ","1","IdenticalDocumentsSequence"],A600:["CS","1","ObservationSubjectContextFlagTrial"],A601:["CS","1","ObserverContextFlagTrial"],A603:["CS","1","ProcedureContextFlagTrial"],A730:["SQ","1","ContentSequence"],A731:["SQ","1","RelationshipSequenceTrial"],A732:["SQ","1","RelationshipTypeCodeSequenceTrial"],A744:["SQ","1","LanguageCodeSequenceTrial"],A801:["SQ","1","TabulatedValuesSequence"],A802:["UL","1","NumberOfTableRows"],A803:["UL","1","NumberOfTableColumns"],A804:["UL","1","TableRowNumber"],A805:["UL","1","TableColumnNumber"],A806:["SQ","1","TableRowDefinitionSequence"],A807:["SQ","1","TableColumnDefinitionSequence"],A808:["SQ","1","CellValuesSequence"],A992:["ST","1","UniformResourceLocatorTrial"],B020:["SQ","1","WaveformAnnotationSequence"],DB00:["CS","1","TemplateIdentifier"],DB06:["DT","1","TemplateVersion"],DB07:["DT","1","TemplateLocalVersion"],DB0B:["CS","1","TemplateExtensionFlag"],DB0C:["UI","1","TemplateExtensionOrganizationUID"],DB0D:["UI","1","TemplateExtensionCreatorUID"],DB73:["UL","1-n","ReferencedContentItemIdentifier"],E001:["ST","1","HL7InstanceIdentifier"],E004:["DT","1","HL7DocumentEffectiveTime"],E006:["SQ","1","HL7DocumentTypeCodeSequence"],E008:["SQ","1","DocumentClassCodeSequence"],E010:["UR","1","RetrieveURI"],E011:["UI","1","RetrieveLocationUID"],E020:["CS","1","TypeOfInstances"],E021:["SQ","1","DICOMRetrievalSequence"],E022:["SQ","1","DICOMMediaRetrievalSequence"],E023:["SQ","1","WADORetrievalSequence"],E024:["SQ","1","XDSRetrievalSequence"],E025:["SQ","1","WADORSRetrievalSequence"],E030:["UI","1","RepositoryUniqueID"],E031:["UI","1","HomeCommunityID"]},"0042":{"0000":["UL","1","GenericGroupLength"],"0010":["ST","1","DocumentTitle"],"0011":["OB","1","EncapsulatedDocument"],"0012":["LO","1","MIMETypeOfEncapsulatedDocument"],"0013":["SQ","1","SourceInstanceSequence"],"0014":["LO","1-n","ListOfMIMETypes"],"0015":["UL","1","EncapsulatedDocumentLength"]},"0044":{"0000":["UL","1","GenericGroupLength"],"0001":["ST","1","ProductPackageIdentifier"],"0002":["CS","1","SubstanceAdministrationApproval"],"0003":["LT","1","ApprovalStatusFurtherDescription"],"0004":["DT","1","ApprovalStatusDateTime"],"0007":["SQ","1","ProductTypeCodeSequence"],"0008":["LO","1-n","ProductName"],"0009":["LT","1","ProductDescription"],"000A":["LO","1","ProductLotIdentifier"],"000B":["DT","1","ProductExpirationDateTime"],"0010":["DT","1","SubstanceAdministrationDateTime"],"0011":["LO","1","SubstanceAdministrationNotes"],"0012":["LO","1","SubstanceAdministrationDeviceID"],"0013":["SQ","1","ProductParameterSequence"],"0019":["SQ","1","SubstanceAdministrationParameterSequence"],"0100":["SQ","1","ApprovalSequence"],"0101":["SQ","1","AssertionCodeSequence"],"0102":["UI","1","AssertionUID"],"0103":["SQ","1","AsserterIdentificationSequence"],"0104":["DT","1","AssertionDateTime"],"0105":["DT","1","AssertionExpirationDateTime"],"0106":["UT","1","AssertionComments"],"0107":["SQ","1","RelatedAssertionSequence"],"0108":["UI","1","ReferencedAssertionUID"],"0109":["SQ","1","ApprovalSubjectSequence"],"010A":["SQ","1","OrganizationalRoleCodeSequence"]},"0046":{"0000":["UL","1","GenericGroupLength"],"0012":["LO","1","LensDescription"],"0014":["SQ","1","RightLensSequence"],"0015":["SQ","1","LeftLensSequence"],"0016":["SQ","1","UnspecifiedLateralityLensSequence"],"0018":["SQ","1","CylinderSequence"],"0028":["SQ","1","PrismSequence"],"0030":["FD","1","HorizontalPrismPower"],"0032":["CS","1","HorizontalPrismBase"],"0034":["FD","1","VerticalPrismPower"],"0036":["CS","1","VerticalPrismBase"],"0038":["CS","1","LensSegmentType"],"0040":["FD","1","OpticalTransmittance"],"0042":["FD","1","ChannelWidth"],"0044":["FD","1","PupilSize"],"0046":["FD","1","CornealSize"],"0047":["SQ","1","CornealSizeSequence"],"0050":["SQ","1","AutorefractionRightEyeSequence"],"0052":["SQ","1","AutorefractionLeftEyeSequence"],"0060":["FD","1","DistancePupillaryDistance"],"0062":["FD","1","NearPupillaryDistance"],"0063":["FD","1","IntermediatePupillaryDistance"],"0064":["FD","1","OtherPupillaryDistance"],"0070":["SQ","1","KeratometryRightEyeSequence"],"0071":["SQ","1","KeratometryLeftEyeSequence"],"0074":["SQ","1","SteepKeratometricAxisSequence"],"0075":["FD","1","RadiusOfCurvature"],"0076":["FD","1","KeratometricPower"],"0077":["FD","1","KeratometricAxis"],"0080":["SQ","1","FlatKeratometricAxisSequence"],"0092":["CS","1","BackgroundColor"],"0094":["CS","1","Optotype"],"0095":["CS","1","OptotypePresentation"],"0097":["SQ","1","SubjectiveRefractionRightEyeSequence"],"0098":["SQ","1","SubjectiveRefractionLeftEyeSequence"],"0100":["SQ","1","AddNearSequence"],"0101":["SQ","1","AddIntermediateSequence"],"0102":["SQ","1","AddOtherSequence"],"0104":["FD","1","AddPower"],"0106":["FD","1","ViewingDistance"],"0110":["SQ","1","CorneaMeasurementsSequence"],"0111":["SQ","1","SourceOfCorneaMeasurementDataCodeSequence"],"0112":["SQ","1","SteepCornealAxisSequence"],"0113":["SQ","1","FlatCornealAxisSequence"],"0114":["FD","1","CornealPower"],"0115":["FD","1","CornealAxis"],"0116":["SQ","1","CorneaMeasurementMethodCodeSequence"],"0117":["FL","1","RefractiveIndexOfCornea"],"0118":["FL","1","RefractiveIndexOfAqueousHumor"],"0121":["SQ","1","VisualAcuityTypeCodeSequence"],"0122":["SQ","1","VisualAcuityRightEyeSequence"],"0123":["SQ","1","VisualAcuityLeftEyeSequence"],"0124":["SQ","1","VisualAcuityBothEyesOpenSequence"],"0125":["CS","1","ViewingDistanceType"],"0135":["SS","2","VisualAcuityModifiers"],"0137":["FD","1","DecimalVisualAcuity"],"0139":["LO","1","OptotypeDetailedDefinition"],"0145":["SQ","1","ReferencedRefractiveMeasurementsSequence"],"0146":["FD","1","SpherePower"],"0147":["FD","1","CylinderPower"],"0201":["CS","1","CornealTopographySurface"],"0202":["FL","2","CornealVertexLocation"],"0203":["FL","1","PupilCentroidXCoordinate"],"0204":["FL","1","PupilCentroidYCoordinate"],"0205":["FL","1","EquivalentPupilRadius"],"0207":["SQ","1","CornealTopographyMapTypeCodeSequence"],"0208":["IS","2-2n","VerticesOfTheOutlineOfPupil"],"0210":["SQ","1","CornealTopographyMappingNormalsSequence"],"0211":["SQ","1","MaximumCornealCurvatureSequence"],"0212":["FL","1","MaximumCornealCurvature"],"0213":["FL","2","MaximumCornealCurvatureLocation"],"0215":["SQ","1","MinimumKeratometricSequence"],"0218":["SQ","1","SimulatedKeratometricCylinderSequence"],"0220":["FL","1","AverageCornealPower"],"0224":["FL","1","CornealISValue"],"0227":["FL","1","AnalyzedArea"],"0230":["FL","1","SurfaceRegularityIndex"],"0232":["FL","1","SurfaceAsymmetryIndex"],"0234":["FL","1","CornealEccentricityIndex"],"0236":["FL","1","KeratoconusPredictionIndex"],"0238":["FL","1","DecimalPotentialVisualAcuity"],"0242":["CS","1","CornealTopographyMapQualityEvaluation"],"0244":["SQ","1","SourceImageCornealProcessedDataSequence"],"0247":["FL","3","CornealPointLocation"],"0248":["CS","1","CornealPointEstimated"],"0249":["FL","1","AxialPower"],"0250":["FL","1","TangentialPower"],"0251":["FL","1","RefractivePower"],"0252":["FL","1","RelativeElevation"],"0253":["FL","1","CornealWavefront"]},"0048":{"0000":["UL","1","GenericGroupLength"],"0001":["FL","1","ImagedVolumeWidth"],"0002":["FL","1","ImagedVolumeHeight"],"0003":["FL","1","ImagedVolumeDepth"],"0006":["UL","1","TotalPixelMatrixColumns"],"0007":["UL","1","TotalPixelMatrixRows"],"0008":["SQ","1","TotalPixelMatrixOriginSequence"],"0010":["CS","1","SpecimenLabelInImage"],"0011":["CS","1","FocusMethod"],"0012":["CS","1","ExtendedDepthOfField"],"0013":["US","1","NumberOfFocalPlanes"],"0014":["FL","1","DistanceBetweenFocalPlanes"],"0015":["US","3","RecommendedAbsentPixelCIELabValue"],"0100":["SQ","1","IlluminatorTypeCodeSequence"],"0102":["DS","6","ImageOrientationSlide"],"0105":["SQ","1","OpticalPathSequence"],"0106":["SH","1","OpticalPathIdentifier"],"0107":["ST","1","OpticalPathDescription"],"0108":["SQ","1","IlluminationColorCodeSequence"],"0110":["SQ","1","SpecimenReferenceSequence"],"0111":["DS","1","CondenserLensPower"],"0112":["DS","1","ObjectiveLensPower"],"0113":["DS","1","ObjectiveLensNumericalAperture"],"0120":["SQ","1","PaletteColorLookupTableSequence"],"0200":["SQ","1","ReferencedImageNavigationSequence"],"0201":["US","2","TopLeftHandCornerOfLocalizerArea"],"0202":["US","2","BottomRightHandCornerOfLocalizerArea"],"0207":["SQ","1","OpticalPathIdentificationSequence"],"021A":["SQ","1","PlanePositionSlideSequence"],"021E":["SL","1","ColumnPositionInTotalImagePixelMatrix"],"021F":["SL","1","RowPositionInTotalImagePixelMatrix"],"0301":["CS","1","PixelOriginInterpretation"],"0302":["UL","1","NumberOfOpticalPaths"],"0303":["UL","1","TotalPixelMatrixFocalPlanes"]},"0050":{"0000":["UL","1","GenericGroupLength"],"0004":["CS","1","CalibrationImage"],"0010":["SQ","1","DeviceSequence"],"0012":["SQ","1","ContainerComponentTypeCodeSequence"],"0013":["FD","1","ContainerComponentThickness"],"0014":["DS","1","DeviceLength"],"0015":["FD","1","ContainerComponentWidth"],"0016":["DS","1","DeviceDiameter"],"0017":["CS","1","DeviceDiameterUnits"],"0018":["DS","1","DeviceVolume"],"0019":["DS","1","InterMarkerDistance"],"001A":["CS","1","ContainerComponentMaterial"],"001B":["LO","1","ContainerComponentID"],"001C":["FD","1","ContainerComponentLength"],"001D":["FD","1","ContainerComponentDiameter"],"001E":["LO","1","ContainerComponentDescription"],"0020":["LO","1","DeviceDescription"],"0021":["ST","1","LongDeviceDescription"]},"0052":{"0000":["UL","1","GenericGroupLength"],"0001":["FL","1","ContrastBolusIngredientPercentByVolume"],"0002":["FD","1","OCTFocalDistance"],"0003":["FD","1","BeamSpotSize"],"0004":["FD","1","EffectiveRefractiveIndex"],"0006":["CS","1","OCTAcquisitionDomain"],"0007":["FD","1","OCTOpticalCenterWavelength"],"0008":["FD","1","AxialResolution"],"0009":["FD","1","RangingDepth"],"0011":["FD","1","ALineRate"],"0012":["US","1","ALinesPerFrame"],"0013":["FD","1","CatheterRotationalRate"],"0014":["FD","1","ALinePixelSpacing"],"0016":["SQ","1","ModeOfPercutaneousAccessSequence"],"0025":["SQ","1","IntravascularOCTFrameTypeSequence"],"0026":["CS","1","OCTZOffsetApplied"],"0027":["SQ","1","IntravascularFrameContentSequence"],"0028":["FD","1","IntravascularLongitudinalDistance"],"0029":["SQ","1","IntravascularOCTFrameContentSequence"],"0030":["SS","1","OCTZOffsetCorrection"],"0031":["CS","1","CatheterDirectionOfRotation"],"0033":["FD","1","SeamLineLocation"],"0034":["FD","1","FirstALineLocation"],"0036":["US","1","SeamLineIndex"],"0038":["US","1","NumberOfPaddedALines"],"0039":["CS","1","InterpolationType"],"003A":["CS","1","RefractiveIndexApplied"]},"0054":{"0000":["UL","1","GenericGroupLength"],"0010":["US","1-n","EnergyWindowVector"],"0011":["US","1","NumberOfEnergyWindows"],"0012":["SQ","1","EnergyWindowInformationSequence"],"0013":["SQ","1","EnergyWindowRangeSequence"],"0014":["DS","1","EnergyWindowLowerLimit"],"0015":["DS","1","EnergyWindowUpperLimit"],"0016":["SQ","1","RadiopharmaceuticalInformationSequence"],"0017":["IS","1","ResidualSyringeCounts"],"0018":["SH","1","EnergyWindowName"],"0020":["US","1-n","DetectorVector"],"0021":["US","1","NumberOfDetectors"],"0022":["SQ","1","DetectorInformationSequence"],"0030":["US","1-n","PhaseVector"],"0031":["US","1","NumberOfPhases"],"0032":["SQ","1","PhaseInformationSequence"],"0033":["US","1","NumberOfFramesInPhase"],"0036":["IS","1","PhaseDelay"],"0038":["IS","1","PauseBetweenFrames"],"0039":["CS","1","PhaseDescription"],"0050":["US","1-n","RotationVector"],"0051":["US","1","NumberOfRotations"],"0052":["SQ","1","RotationInformationSequence"],"0053":["US","1","NumberOfFramesInRotation"],"0060":["US","1-n","RRIntervalVector"],"0061":["US","1","NumberOfRRIntervals"],"0062":["SQ","1","GatedInformationSequence"],"0063":["SQ","1","DataInformationSequence"],"0070":["US","1-n","TimeSlotVector"],"0071":["US","1","NumberOfTimeSlots"],"0072":["SQ","1","TimeSlotInformationSequence"],"0073":["DS","1","TimeSlotTime"],"0080":["US","1-n","SliceVector"],"0081":["US","1","NumberOfSlices"],"0090":["US","1-n","AngularViewVector"],"0100":["US","1-n","TimeSliceVector"],"0101":["US","1","NumberOfTimeSlices"],"0200":["DS","1","StartAngle"],"0202":["CS","1","TypeOfDetectorMotion"],"0210":["IS","1-n","TriggerVector"],"0211":["US","1","NumberOfTriggersInPhase"],"0220":["SQ","1","ViewCodeSequence"],"0222":["SQ","1","ViewModifierCodeSequence"],"0300":["SQ","1","RadionuclideCodeSequence"],"0302":["SQ","1","AdministrationRouteCodeSequence"],"0304":["SQ","1","RadiopharmaceuticalCodeSequence"],"0306":["SQ","1","CalibrationDataSequence"],"0308":["US","1","EnergyWindowNumber"],"0400":["SH","1","ImageID"],"0410":["SQ","1","PatientOrientationCodeSequence"],"0412":["SQ","1","PatientOrientationModifierCodeSequence"],"0414":["SQ","1","PatientGantryRelationshipCodeSequence"],"0500":["CS","1","SliceProgressionDirection"],"0501":["CS","1","ScanProgressionDirection"],1e3:["CS","2","SeriesType"],1001:["CS","1","Units"],1002:["CS","1","CountsSource"],1004:["CS","1","ReprojectionMethod"],1006:["CS","1","SUVType"],1100:["CS","1","RandomsCorrectionMethod"],1101:["LO","1","AttenuationCorrectionMethod"],1102:["CS","1","DecayCorrection"],1103:["LO","1","ReconstructionMethod"],1104:["LO","1","DetectorLinesOfResponseUsed"],1105:["LO","1","ScatterCorrectionMethod"],1200:["DS","1","AxialAcceptance"],1201:["IS","2","AxialMash"],1202:["IS","1","TransverseMash"],1203:["DS","2","DetectorElementSize"],1210:["DS","1","CoincidenceWindowWidth"],1220:["CS","1-n","SecondaryCountsType"],1300:["DS","1","FrameReferenceTime"],1310:["IS","1","PrimaryPromptsCountsAccumulated"],1311:["IS","1-n","SecondaryCountsAccumulated"],1320:["DS","1","SliceSensitivityFactor"],1321:["DS","1","DecayFactor"],1322:["DS","1","DoseCalibrationFactor"],1323:["DS","1","ScatterFractionFactor"],1324:["DS","1","DeadTimeFactor"],1330:["US","1","ImageIndex"],1400:["CS","1-n","CountsIncluded"],1401:["CS","1","DeadTimeCorrectionFlag"]},"0060":{"0000":["UL","1","GenericGroupLength"],3e3:["SQ","1","HistogramSequence"],3002:["US","1","HistogramNumberOfBins"],3004:["xs","1","HistogramFirstBinValue"],3006:["xs","1","HistogramLastBinValue"],3008:["US","1","HistogramBinWidth"],3010:["LO","1","HistogramExplanation"],3020:["UL","1-n","HistogramData"]},"0062":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","SegmentationType"],"0002":["SQ","1","SegmentSequence"],"0003":["SQ","1","SegmentedPropertyCategoryCodeSequence"],"0004":["US","1","SegmentNumber"],"0005":["LO","1","SegmentLabel"],"0006":["ST","1","SegmentDescription"],"0007":["SQ","1","SegmentationAlgorithmIdentificationSequence"],"0008":["CS","1","SegmentAlgorithmType"],"0009":["LO","1-n","SegmentAlgorithmName"],"000A":["SQ","1","SegmentIdentificationSequence"],"000B":["US","1-n","ReferencedSegmentNumber"],"000C":["US","1","RecommendedDisplayGrayscaleValue"],"000D":["US","3","RecommendedDisplayCIELabValue"],"000E":["US","1","MaximumFractionalValue"],"000F":["SQ","1","SegmentedPropertyTypeCodeSequence"],"0010":["CS","1","SegmentationFractionalType"],"0011":["SQ","1","SegmentedPropertyTypeModifierCodeSequence"],"0012":["SQ","1","UsedSegmentsSequence"],"0013":["CS","1","SegmentsOverlap"],"0020":["UT","1","TrackingID"],"0021":["UI","1","TrackingUID"]},"0064":{"0000":["UL","1","GenericGroupLength"],"0002":["SQ","1","DeformableRegistrationSequence"],"0003":["UI","1","SourceFrameOfReferenceUID"],"0005":["SQ","1","DeformableRegistrationGridSequence"],"0007":["UL","3","GridDimensions"],"0008":["FD","3","GridResolution"],"0009":["OF","1","VectorGridData"],"000F":["SQ","1","PreDeformationMatrixRegistrationSequence"],"0010":["SQ","1","PostDeformationMatrixRegistrationSequence"]},"0066":{"0000":["UL","1","GenericGroupLength"],"0001":["UL","1","NumberOfSurfaces"],"0002":["SQ","1","SurfaceSequence"],"0003":["UL","1","SurfaceNumber"],"0004":["LT","1","SurfaceComments"],"0009":["CS","1","SurfaceProcessing"],"000A":["FL","1","SurfaceProcessingRatio"],"000B":["LO","1","SurfaceProcessingDescription"],"000C":["FL","1","RecommendedPresentationOpacity"],"000D":["CS","1","RecommendedPresentationType"],"000E":["CS","1","FiniteVolume"],"0010":["CS","1","Manifold"],"0011":["SQ","1","SurfacePointsSequence"],"0012":["SQ","1","SurfacePointsNormalsSequence"],"0013":["SQ","1","SurfaceMeshPrimitivesSequence"],"0015":["UL","1","NumberOfSurfacePoints"],"0016":["OF","1","PointCoordinatesData"],"0017":["FL","3","PointPositionAccuracy"],"0018":["FL","1","MeanPointDistance"],"0019":["FL","1","MaximumPointDistance"],"001A":["FL","6","PointsBoundingBoxCoordinates"],"001B":["FL","3","AxisOfRotation"],"001C":["FL","3","CenterOfRotation"],"001E":["UL","1","NumberOfVectors"],"001F":["US","1","VectorDimensionality"],"0020":["FL","1-n","VectorAccuracy"],"0021":["OF","1","VectorCoordinateData"],"0022":["OD","1","DoublePointCoordinatesData"],"0023":["OW","1","TrianglePointIndexList"],"0024":["OW","1","EdgePointIndexList"],"0025":["OW","1","VertexPointIndexList"],"0026":["SQ","1","TriangleStripSequence"],"0027":["SQ","1","TriangleFanSequence"],"0028":["SQ","1","LineSequence"],"0029":["OW","1","PrimitivePointIndexList"],"002A":["UL","1","SurfaceCount"],"002B":["SQ","1","ReferencedSurfaceSequence"],"002C":["UL","1","ReferencedSurfaceNumber"],"002D":["SQ","1","SegmentSurfaceGenerationAlgorithmIdentificationSequence"],"002E":["SQ","1","SegmentSurfaceSourceInstanceSequence"],"002F":["SQ","1","AlgorithmFamilyCodeSequence"],"0030":["SQ","1","AlgorithmNameCodeSequence"],"0031":["LO","1","AlgorithmVersion"],"0032":["LT","1","AlgorithmParameters"],"0034":["SQ","1","FacetSequence"],"0035":["SQ","1","SurfaceProcessingAlgorithmIdentificationSequence"],"0036":["LO","1","AlgorithmName"],"0037":["FL","1","RecommendedPointRadius"],"0038":["FL","1","RecommendedLineThickness"],"0040":["OL","1","LongPrimitivePointIndexList"],"0041":["OL","1","LongTrianglePointIndexList"],"0042":["OL","1","LongEdgePointIndexList"],"0043":["OL","1","LongVertexPointIndexList"],"0101":["SQ","1","TrackSetSequence"],"0102":["SQ","1","TrackSequence"],"0103":["OW","1","RecommendedDisplayCIELabValueList"],"0104":["SQ","1","TrackingAlgorithmIdentificationSequence"],"0105":["UL","1","TrackSetNumber"],"0106":["LO","1","TrackSetLabel"],"0107":["UT","1","TrackSetDescription"],"0108":["SQ","1","TrackSetAnatomicalTypeCodeSequence"],"0121":["SQ","1","MeasurementsSequence"],"0124":["SQ","1","TrackSetStatisticsSequence"],"0125":["OF","1","FloatingPointValues"],"0129":["OL","1","TrackPointIndexList"],"0130":["SQ","1","TrackStatisticsSequence"],"0132":["SQ","1","MeasurementValuesSequence"],"0133":["SQ","1","DiffusionAcquisitionCodeSequence"],"0134":["SQ","1","DiffusionModelCodeSequence"]},"0068":{"0000":["UL","1","GenericGroupLength"],6210:["LO","1","ImplantSize"],6221:["LO","1","ImplantTemplateVersion"],6222:["SQ","1","ReplacedImplantTemplateSequence"],6223:["CS","1","ImplantType"],6224:["SQ","1","DerivationImplantTemplateSequence"],6225:["SQ","1","OriginalImplantTemplateSequence"],6226:["DT","1","EffectiveDateTime"],6230:["SQ","1","ImplantTargetAnatomySequence"],6260:["SQ","1","InformationFromManufacturerSequence"],6265:["SQ","1","NotificationFromManufacturerSequence"],6270:["DT","1","InformationIssueDateTime"],6280:["ST","1","InformationSummary"],"62A0":["SQ","1","ImplantRegulatoryDisapprovalCodeSequence"],"62A5":["FD","1","OverallTemplateSpatialTolerance"],"62C0":["SQ","1","HPGLDocumentSequence"],"62D0":["US","1","HPGLDocumentID"],"62D5":["LO","1","HPGLDocumentLabel"],"62E0":["SQ","1","ViewOrientationCodeSequence"],"62F0":["SQ","1","ViewOrientationModifierCodeSequence"],"62F2":["FD","1","HPGLDocumentScaling"],6300:["OB","1","HPGLDocument"],6310:["US","1","HPGLContourPenNumber"],6320:["SQ","1","HPGLPenSequence"],6330:["US","1","HPGLPenNumber"],6340:["LO","1","HPGLPenLabel"],6345:["ST","1","HPGLPenDescription"],6346:["FD","2","RecommendedRotationPoint"],6347:["FD","4","BoundingRectangle"],6350:["US","1-n","ImplantTemplate3DModelSurfaceNumber"],6360:["SQ","1","SurfaceModelDescriptionSequence"],6380:["LO","1","SurfaceModelLabel"],6390:["FD","1","SurfaceModelScalingFactor"],"63A0":["SQ","1","MaterialsCodeSequence"],"63A4":["SQ","1","CoatingMaterialsCodeSequence"],"63A8":["SQ","1","ImplantTypeCodeSequence"],"63AC":["SQ","1","FixationMethodCodeSequence"],"63B0":["SQ","1","MatingFeatureSetsSequence"],"63C0":["US","1","MatingFeatureSetID"],"63D0":["LO","1","MatingFeatureSetLabel"],"63E0":["SQ","1","MatingFeatureSequence"],"63F0":["US","1","MatingFeatureID"],6400:["SQ","1","MatingFeatureDegreeOfFreedomSequence"],6410:["US","1","DegreeOfFreedomID"],6420:["CS","1","DegreeOfFreedomType"],6430:["SQ","1","TwoDMatingFeatureCoordinatesSequence"],6440:["US","1","ReferencedHPGLDocumentID"],6450:["FD","2","TwoDMatingPoint"],6460:["FD","4","TwoDMatingAxes"],6470:["SQ","1","TwoDDegreeOfFreedomSequence"],6490:["FD","3","ThreeDDegreeOfFreedomAxis"],"64A0":["FD","2","RangeOfFreedom"],"64C0":["FD","3","ThreeDMatingPoint"],"64D0":["FD","9","ThreeDMatingAxes"],"64F0":["FD","3","TwoDDegreeOfFreedomAxis"],6500:["SQ","1","PlanningLandmarkPointSequence"],6510:["SQ","1","PlanningLandmarkLineSequence"],6520:["SQ","1","PlanningLandmarkPlaneSequence"],6530:["US","1","PlanningLandmarkID"],6540:["LO","1","PlanningLandmarkDescription"],6545:["SQ","1","PlanningLandmarkIdentificationCodeSequence"],6550:["SQ","1","TwoDPointCoordinatesSequence"],6560:["FD","2","TwoDPointCoordinates"],6590:["FD","3","ThreeDPointCoordinates"],"65A0":["SQ","1","TwoDLineCoordinatesSequence"],"65B0":["FD","4","TwoDLineCoordinates"],"65D0":["FD","6","ThreeDLineCoordinates"],"65E0":["SQ","1","TwoDPlaneCoordinatesSequence"],"65F0":["FD","4","TwoDPlaneIntersection"],6610:["FD","3","ThreeDPlaneOrigin"],6620:["FD","3","ThreeDPlaneNormal"],7001:["CS","1","ModelModification"],7002:["CS","1","ModelMirroring"],7003:["SQ","1","ModelUsageCodeSequence"],7004:["UI","1","ModelGroupUID"],7005:["UR","1","RelativeURIReferenceWithinEncapsulatedDocument"]},"006A":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","AnnotationCoordinateType"],"0002":["SQ","1","AnnotationGroupSequence"],"0003":["UI","1","AnnotationGroupUID"],"0005":["LO","1","AnnotationGroupLabel"],"0006":["UT","1","AnnotationGroupDescription"],"0007":["CS","1","AnnotationGroupGenerationType"],"0008":["SQ","1","AnnotationGroupAlgorithmIdentificationSequence"],"0009":["SQ","1","AnnotationPropertyCategoryCodeSequence"],"000A":["SQ","1","AnnotationPropertyTypeCodeSequence"],"000B":["SQ","1","AnnotationPropertyTypeModifierCodeSequence"],"000C":["UL","1","NumberOfAnnotations"],"000D":["CS","1","AnnotationAppliesToAllOpticalPaths"],"000E":["SH","1-n","ReferencedOpticalPathIdentifier"],"000F":["CS","1","AnnotationAppliesToAllZPlanes"],"0010":["FD","1-n","CommonZCoordinateValue"],"0011":["OL","1","AnnotationIndexList"]},"0070":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","GraphicAnnotationSequence"],"0002":["CS","1","GraphicLayer"],"0003":["CS","1","BoundingBoxAnnotationUnits"],"0004":["CS","1","AnchorPointAnnotationUnits"],"0005":["CS","1","GraphicAnnotationUnits"],"0006":["ST","1","UnformattedTextValue"],"0008":["SQ","1","TextObjectSequence"],"0009":["SQ","1","GraphicObjectSequence"],"0010":["FL","2","BoundingBoxTopLeftHandCorner"],"0011":["FL","2","BoundingBoxBottomRightHandCorner"],"0012":["CS","1","BoundingBoxTextHorizontalJustification"],"0014":["FL","2","AnchorPoint"],"0015":["CS","1","AnchorPointVisibility"],"0020":["US","1","GraphicDimensions"],"0021":["US","1","NumberOfGraphicPoints"],"0022":["FL","2-n","GraphicData"],"0023":["CS","1","GraphicType"],"0024":["CS","1","GraphicFilled"],"0040":["IS","1","ImageRotationRetired"],"0041":["CS","1","ImageHorizontalFlip"],"0042":["US","1","ImageRotation"],"0050":["US","2","DisplayedAreaTopLeftHandCornerTrial"],"0051":["US","2","DisplayedAreaBottomRightHandCornerTrial"],"0052":["SL","2","DisplayedAreaTopLeftHandCorner"],"0053":["SL","2","DisplayedAreaBottomRightHandCorner"],"005A":["SQ","1","DisplayedAreaSelectionSequence"],"0060":["SQ","1","GraphicLayerSequence"],"0062":["IS","1","GraphicLayerOrder"],"0066":["US","1","GraphicLayerRecommendedDisplayGrayscaleValue"],"0067":["US","3","GraphicLayerRecommendedDisplayRGBValue"],"0068":["LO","1","GraphicLayerDescription"],"0080":["CS","1","ContentLabel"],"0081":["LO","1","ContentDescription"],"0082":["DA","1","PresentationCreationDate"],"0083":["TM","1","PresentationCreationTime"],"0084":["PN","1","ContentCreatorName"],"0086":["SQ","1","ContentCreatorIdentificationCodeSequence"],"0087":["SQ","1","AlternateContentDescriptionSequence"],"0100":["CS","1","PresentationSizeMode"],"0101":["DS","2","PresentationPixelSpacing"],"0102":["IS","2","PresentationPixelAspectRatio"],"0103":["FL","1","PresentationPixelMagnificationRatio"],"0207":["LO","1","GraphicGroupLabel"],"0208":["ST","1","GraphicGroupDescription"],"0209":["SQ","1","CompoundGraphicSequence"],"0226":["UL","1","CompoundGraphicInstanceID"],"0227":["LO","1","FontName"],"0228":["CS","1","FontNameType"],"0229":["LO","1","CSSFontName"],"0230":["FD","1","RotationAngle"],"0231":["SQ","1","TextStyleSequence"],"0232":["SQ","1","LineStyleSequence"],"0233":["SQ","1","FillStyleSequence"],"0234":["SQ","1","GraphicGroupSequence"],"0241":["US","3","TextColorCIELabValue"],"0242":["CS","1","HorizontalAlignment"],"0243":["CS","1","VerticalAlignment"],"0244":["CS","1","ShadowStyle"],"0245":["FL","1","ShadowOffsetX"],"0246":["FL","1","ShadowOffsetY"],"0247":["US","3","ShadowColorCIELabValue"],"0248":["CS","1","Underlined"],"0249":["CS","1","Bold"],"0250":["CS","1","Italic"],"0251":["US","3","PatternOnColorCIELabValue"],"0252":["US","3","PatternOffColorCIELabValue"],"0253":["FL","1","LineThickness"],"0254":["CS","1","LineDashingStyle"],"0255":["UL","1","LinePattern"],"0256":["OB","1","FillPattern"],"0257":["CS","1","FillMode"],"0258":["FL","1","ShadowOpacity"],"0261":["FL","1","GapLength"],"0262":["FL","1","DiameterOfVisibility"],"0273":["FL","2","RotationPoint"],"0274":["CS","1","TickAlignment"],"0278":["CS","1","ShowTickLabel"],"0279":["CS","1","TickLabelAlignment"],"0282":["CS","1","CompoundGraphicUnits"],"0284":["FL","1","PatternOnOpacity"],"0285":["FL","1","PatternOffOpacity"],"0287":["SQ","1","MajorTicksSequence"],"0288":["FL","1","TickPosition"],"0289":["SH","1","TickLabel"],"0294":["CS","1","CompoundGraphicType"],"0295":["UL","1","GraphicGroupID"],"0306":["CS","1","ShapeType"],"0308":["SQ","1","RegistrationSequence"],"0309":["SQ","1","MatrixRegistrationSequence"],"030A":["SQ","1","MatrixSequence"],"030B":["FD","16","FrameOfReferenceToDisplayedCoordinateSystemTransformationMatrix"],"030C":["CS","1","FrameOfReferenceTransformationMatrixType"],"030D":["SQ","1","RegistrationTypeCodeSequence"],"030F":["ST","1","FiducialDescription"],"0310":["SH","1","FiducialIdentifier"],"0311":["SQ","1","FiducialIdentifierCodeSequence"],"0312":["FD","1","ContourUncertaintyRadius"],"0314":["SQ","1","UsedFiducialsSequence"],"0318":["SQ","1","GraphicCoordinatesDataSequence"],"031A":["UI","1","FiducialUID"],"031B":["UI","1","ReferencedFiducialUID"],"031C":["SQ","1","FiducialSetSequence"],"031E":["SQ","1","FiducialSequence"],"031F":["SQ","1","FiducialsPropertyCategoryCodeSequence"],"0401":["US","3","GraphicLayerRecommendedDisplayCIELabValue"],"0402":["SQ","1","BlendingSequence"],"0403":["FL","1","RelativeOpacity"],"0404":["SQ","1","ReferencedSpatialRegistrationSequence"],"0405":["CS","1","BlendingPosition"],1101:["UI","1","PresentationDisplayCollectionUID"],1102:["UI","1","PresentationSequenceCollectionUID"],1103:["US","1","PresentationSequencePositionIndex"],1104:["SQ","1","RenderedImageReferenceSequence"],1201:["SQ","1","VolumetricPresentationStateInputSequence"],1202:["CS","1","PresentationInputType"],1203:["US","1","InputSequencePositionIndex"],1204:["CS","1","Crop"],1205:["US","1-n","CroppingSpecificationIndex"],1206:["CS","1","CompositingMethod"],1207:["US","1","VolumetricPresentationInputNumber"],1208:["CS","1","ImageVolumeGeometry"],1209:["UI","1","VolumetricPresentationInputSetUID"],"120A":["SQ","1","VolumetricPresentationInputSetSequence"],"120B":["CS","1","GlobalCrop"],"120C":["US","1-n","GlobalCroppingSpecificationIndex"],"120D":["CS","1","RenderingMethod"],1301:["SQ","1","VolumeCroppingSequence"],1302:["CS","1","VolumeCroppingMethod"],1303:["FD","6","BoundingBoxCrop"],1304:["SQ","1","ObliqueCroppingPlaneSequence"],1305:["FD","4","Plane"],1306:["FD","3","PlaneNormal"],1309:["US","1","CroppingSpecificationNumber"],1501:["CS","1","MultiPlanarReconstructionStyle"],1502:["CS","1","MPRThicknessType"],1503:["FD","1","MPRSlabThickness"],1505:["FD","3","MPRTopLeftHandCorner"],1507:["FD","3","MPRViewWidthDirection"],1508:["FD","1","MPRViewWidth"],"150C":["UL","1","NumberOfVolumetricCurvePoints"],"150D":["OD","1","VolumetricCurvePoints"],1511:["FD","3","MPRViewHeightDirection"],1512:["FD","1","MPRViewHeight"],1602:["CS","1","RenderProjection"],1603:["FD","3","ViewpointPosition"],1604:["FD","3","ViewpointLookAtPoint"],1605:["FD","3","ViewpointUpDirection"],1606:["FD","6","RenderFieldOfView"],1607:["FD","1","SamplingStepSize"],1701:["CS","1","ShadingStyle"],1702:["FD","1","AmbientReflectionIntensity"],1703:["FD","3","LightDirection"],1704:["FD","1","DiffuseReflectionIntensity"],1705:["FD","1","SpecularReflectionIntensity"],1706:["FD","1","Shininess"],1801:["SQ","1","PresentationStateClassificationComponentSequence"],1802:["CS","1","ComponentType"],1803:["SQ","1","ComponentInputSequence"],1804:["US","1","VolumetricPresentationInputIndex"],1805:["SQ","1","PresentationStateCompositorComponentSequence"],1806:["SQ","1","WeightingTransferFunctionSequence"],1807:["US","3","WeightingLookupTableDescriptor"],1808:["OB","1","WeightingLookupTableData"],1901:["SQ","1","VolumetricAnnotationSequence"],1903:["SQ","1","ReferencedStructuredContextSequence"],1904:["UI","1","ReferencedContentItem"],1905:["SQ","1","VolumetricPresentationInputAnnotationSequence"],1907:["CS","1","AnnotationClipping"],"1A01":["CS","1","PresentationAnimationStyle"],"1A03":["FD","1","RecommendedAnimationRate"],"1A04":["SQ","1","AnimationCurveSequence"],"1A05":["FD","1","AnimationStepSize"],"1A06":["FD","1","SwivelRange"],"1A07":["OD","1","VolumetricCurveUpDirections"],"1A08":["SQ","1","VolumeStreamSequence"],"1A09":["LO","1","RGBATransferFunctionDescription"],"1B01":["SQ","1","AdvancedBlendingSequence"],"1B02":["US","1","BlendingInputNumber"],"1B03":["SQ","1","BlendingDisplayInputSequence"],"1B04":["SQ","1","BlendingDisplaySequence"],"1B06":["CS","1","BlendingMode"],"1B07":["CS","1","TimeSeriesBlending"],"1B08":["CS","1","GeometryForDisplay"],"1B11":["SQ","1","ThresholdSequence"],"1B12":["SQ","1","ThresholdValueSequence"],"1B13":["CS","1","ThresholdType"],"1B14":["FD","1","ThresholdValue"]},"0072":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","HangingProtocolName"],"0004":["LO","1","HangingProtocolDescription"],"0006":["CS","1","HangingProtocolLevel"],"0008":["LO","1","HangingProtocolCreator"],"000A":["DT","1","HangingProtocolCreationDateTime"],"000C":["SQ","1","HangingProtocolDefinitionSequence"],"000E":["SQ","1","HangingProtocolUserIdentificationCodeSequence"],"0010":["LO","1","HangingProtocolUserGroupName"],"0012":["SQ","1","SourceHangingProtocolSequence"],"0014":["US","1","NumberOfPriorsReferenced"],"0020":["SQ","1","ImageSetsSequence"],"0022":["SQ","1","ImageSetSelectorSequence"],"0024":["CS","1","ImageSetSelectorUsageFlag"],"0026":["AT","1","SelectorAttribute"],"0028":["US","1","SelectorValueNumber"],"0030":["SQ","1","TimeBasedImageSetsSequence"],"0032":["US","1","ImageSetNumber"],"0034":["CS","1","ImageSetSelectorCategory"],"0038":["US","2","RelativeTime"],"003A":["CS","1","RelativeTimeUnits"],"003C":["SS","2","AbstractPriorValue"],"003E":["SQ","1","AbstractPriorCodeSequence"],"0040":["LO","1","ImageSetLabel"],"0050":["CS","1","SelectorAttributeVR"],"0052":["AT","1-n","SelectorSequencePointer"],"0054":["LO","1-n","SelectorSequencePointerPrivateCreator"],"0056":["LO","1","SelectorAttributePrivateCreator"],"005E":["AE","1-n","SelectorAEValue"],"005F":["AS","1-n","SelectorASValue"],"0060":["AT","1-n","SelectorATValue"],"0061":["DA","1-n","SelectorDAValue"],"0062":["CS","1-n","SelectorCSValue"],"0063":["DT","1-n","SelectorDTValue"],"0064":["IS","1-n","SelectorISValue"],"0065":["OB","1","SelectorOBValue"],"0066":["LO","1-n","SelectorLOValue"],"0067":["OF","1","SelectorOFValue"],"0068":["LT","1","SelectorLTValue"],"0069":["OW","1","SelectorOWValue"],"006A":["PN","1-n","SelectorPNValue"],"006B":["TM","1-n","SelectorTMValue"],"006C":["SH","1-n","SelectorSHValue"],"006D":["UN","1","SelectorUNValue"],"006E":["ST","1","SelectorSTValue"],"006F":["UC","1-n","SelectorUCValue"],"0070":["UT","1","SelectorUTValue"],"0071":["UR","1","SelectorURValue"],"0072":["DS","1-n","SelectorDSValue"],"0073":["OD","1","SelectorODValue"],"0074":["FD","1-n","SelectorFDValue"],"0075":["OL","1","SelectorOLValue"],"0076":["FL","1-n","SelectorFLValue"],"0078":["UL","1-n","SelectorULValue"],"007A":["US","1-n","SelectorUSValue"],"007C":["SL","1-n","SelectorSLValue"],"007E":["SS","1-n","SelectorSSValue"],"007F":["UI","1-n","SelectorUIValue"],"0080":["SQ","1","SelectorCodeSequenceValue"],"0081":["OV","1","SelectorOVValue"],"0082":["SV","1-n","SelectorSVValue"],"0083":["UV","1-n","SelectorUVValue"],"0100":["US","1","NumberOfScreens"],"0102":["SQ","1","NominalScreenDefinitionSequence"],"0104":["US","1","NumberOfVerticalPixels"],"0106":["US","1","NumberOfHorizontalPixels"],"0108":["FD","4","DisplayEnvironmentSpatialPosition"],"010A":["US","1","ScreenMinimumGrayscaleBitDepth"],"010C":["US","1","ScreenMinimumColorBitDepth"],"010E":["US","1","ApplicationMaximumRepaintTime"],"0200":["SQ","1","DisplaySetsSequence"],"0202":["US","1","DisplaySetNumber"],"0203":["LO","1","DisplaySetLabel"],"0204":["US","1","DisplaySetPresentationGroup"],"0206":["LO","1","DisplaySetPresentationGroupDescription"],"0208":["CS","1","PartialDataDisplayHandling"],"0210":["SQ","1","SynchronizedScrollingSequence"],"0212":["US","2-n","DisplaySetScrollingGroup"],"0214":["SQ","1","NavigationIndicatorSequence"],"0216":["US","1","NavigationDisplaySet"],"0218":["US","1-n","ReferenceDisplaySets"],"0300":["SQ","1","ImageBoxesSequence"],"0302":["US","1","ImageBoxNumber"],"0304":["CS","1","ImageBoxLayoutType"],"0306":["US","1","ImageBoxTileHorizontalDimension"],"0308":["US","1","ImageBoxTileVerticalDimension"],"0310":["CS","1","ImageBoxScrollDirection"],"0312":["CS","1","ImageBoxSmallScrollType"],"0314":["US","1","ImageBoxSmallScrollAmount"],"0316":["CS","1","ImageBoxLargeScrollType"],"0318":["US","1","ImageBoxLargeScrollAmount"],"0320":["US","1","ImageBoxOverlapPriority"],"0330":["FD","1","CineRelativeToRealTime"],"0400":["SQ","1","FilterOperationsSequence"],"0402":["CS","1","FilterByCategory"],"0404":["CS","1","FilterByAttributePresence"],"0406":["CS","1","FilterByOperator"],"0420":["US","3","StructuredDisplayBackgroundCIELabValue"],"0421":["US","3","EmptyImageBoxCIELabValue"],"0422":["SQ","1","StructuredDisplayImageBoxSequence"],"0424":["SQ","1","StructuredDisplayTextBoxSequence"],"0427":["SQ","1","ReferencedFirstFrameSequence"],"0430":["SQ","1","ImageBoxSynchronizationSequence"],"0432":["US","2-n","SynchronizedImageBoxList"],"0434":["CS","1","TypeOfSynchronization"],"0500":["CS","1","BlendingOperationType"],"0510":["CS","1","ReformattingOperationType"],"0512":["FD","1","ReformattingThickness"],"0514":["FD","1","ReformattingInterval"],"0516":["CS","1","ReformattingOperationInitialViewDirection"],"0520":["CS","1-n","ThreeDRenderingType"],"0600":["SQ","1","SortingOperationsSequence"],"0602":["CS","1","SortByCategory"],"0604":["CS","1","SortingDirection"],"0700":["CS","2","DisplaySetPatientOrientation"],"0702":["CS","1","VOIType"],"0704":["CS","1","PseudoColorType"],"0705":["SQ","1","PseudoColorPaletteInstanceReferenceSequence"],"0706":["CS","1","ShowGrayscaleInverted"],"0710":["CS","1","ShowImageTrueSizeFlag"],"0712":["CS","1","ShowGraphicAnnotationFlag"],"0714":["CS","1","ShowPatientDemographicsFlag"],"0716":["CS","1","ShowAcquisitionTechniquesFlag"],"0717":["CS","1","DisplaySetHorizontalJustification"],"0718":["CS","1","DisplaySetVerticalJustification"]},"0074":{"0000":["UL","1","GenericGroupLength"],"0120":["FD","1","ContinuationStartMeterset"],"0121":["FD","1","ContinuationEndMeterset"],1e3:["CS","1","ProcedureStepState"],1002:["SQ","1","ProcedureStepProgressInformationSequence"],1004:["DS","1","ProcedureStepProgress"],1006:["ST","1","ProcedureStepProgressDescription"],1007:["SQ","1","ProcedureStepProgressParametersSequence"],1008:["SQ","1","ProcedureStepCommunicationsURISequence"],"100A":["UR","1","ContactURI"],"100C":["LO","1","ContactDisplayName"],"100E":["SQ","1","ProcedureStepDiscontinuationReasonCodeSequence"],1020:["SQ","1","BeamTaskSequence"],1022:["CS","1","BeamTaskType"],1024:["IS","1","BeamOrderIndexTrial"],1025:["CS","1","AutosequenceFlag"],1026:["FD","1","TableTopVerticalAdjustedPosition"],1027:["FD","1","TableTopLongitudinalAdjustedPosition"],1028:["FD","1","TableTopLateralAdjustedPosition"],"102A":["FD","1","PatientSupportAdjustedAngle"],"102B":["FD","1","TableTopEccentricAdjustedAngle"],"102C":["FD","1","TableTopPitchAdjustedAngle"],"102D":["FD","1","TableTopRollAdjustedAngle"],1030:["SQ","1","DeliveryVerificationImageSequence"],1032:["CS","1","VerificationImageTiming"],1034:["CS","1","DoubleExposureFlag"],1036:["CS","1","DoubleExposureOrdering"],1038:["DS","1","DoubleExposureMetersetTrial"],"103A":["DS","4","DoubleExposureFieldDeltaTrial"],1040:["SQ","1","RelatedReferenceRTImageSequence"],1042:["SQ","1","GeneralMachineVerificationSequence"],1044:["SQ","1","ConventionalMachineVerificationSequence"],1046:["SQ","1","IonMachineVerificationSequence"],1048:["SQ","1","FailedAttributesSequence"],"104A":["SQ","1","OverriddenAttributesSequence"],"104C":["SQ","1","ConventionalControlPointVerificationSequence"],"104E":["SQ","1","IonControlPointVerificationSequence"],1050:["SQ","1","AttributeOccurrenceSequence"],1052:["AT","1","AttributeOccurrencePointer"],1054:["UL","1","AttributeItemSelector"],1056:["LO","1","AttributeOccurrencePrivateCreator"],1057:["IS","1-n","SelectorSequencePointerItems"],1200:["CS","1","ScheduledProcedureStepPriority"],1202:["LO","1","WorklistLabel"],1204:["LO","1","ProcedureStepLabel"],1210:["SQ","1","ScheduledProcessingParametersSequence"],1212:["SQ","1","PerformedProcessingParametersSequence"],1216:["SQ","1","UnifiedProcedureStepPerformedProcedureSequence"],1220:["SQ","1","RelatedProcedureStepSequence"],1222:["LO","1","ProcedureStepRelationshipType"],1224:["SQ","1","ReplacedProcedureStepSequence"],1230:["LO","1","DeletionLock"],1234:["AE","1","ReceivingAE"],1236:["AE","1","RequestingAE"],1238:["LT","1","ReasonForCancellation"],1242:["CS","1","SCPStatus"],1244:["CS","1","SubscriptionListStatus"],1246:["CS","1","UnifiedProcedureStepListStatus"],1324:["UL","1","BeamOrderIndex"],1338:["FD","1","DoubleExposureMeterset"],"133A":["FD","4","DoubleExposureFieldDelta"],1401:["SQ","1","BrachyTaskSequence"],1402:["DS","1","ContinuationStartTotalReferenceAirKerma"],1403:["DS","1","ContinuationEndTotalReferenceAirKerma"],1404:["IS","1","ContinuationPulseNumber"],1405:["SQ","1","ChannelDeliveryOrderSequence"],1406:["IS","1","ReferencedChannelNumber"],1407:["DS","1","StartCumulativeTimeWeight"],1408:["DS","1","EndCumulativeTimeWeight"],1409:["SQ","1","OmittedChannelSequence"],"140A":["CS","1","ReasonForChannelOmission"],"140B":["LO","1","ReasonForChannelOmissionDescription"],"140C":["IS","1","ChannelDeliveryOrderIndex"],"140D":["SQ","1","ChannelDeliveryContinuationSequence"],"140E":["SQ","1","OmittedApplicationSetupSequence"]},"0076":{"0000":["UL","1","GenericGroupLength"],"0001":["LO","1","ImplantAssemblyTemplateName"],"0003":["LO","1","ImplantAssemblyTemplateIssuer"],"0006":["LO","1","ImplantAssemblyTemplateVersion"],"0008":["SQ","1","ReplacedImplantAssemblyTemplateSequence"],"000A":["CS","1","ImplantAssemblyTemplateType"],"000C":["SQ","1","OriginalImplantAssemblyTemplateSequence"],"000E":["SQ","1","DerivationImplantAssemblyTemplateSequence"],"0010":["SQ","1","ImplantAssemblyTemplateTargetAnatomySequence"],"0020":["SQ","1","ProcedureTypeCodeSequence"],"0030":["LO","1","SurgicalTechnique"],"0032":["SQ","1","ComponentTypesSequence"],"0034":["SQ","1","ComponentTypeCodeSequence"],"0036":["CS","1","ExclusiveComponentType"],"0038":["CS","1","MandatoryComponentType"],"0040":["SQ","1","ComponentSequence"],"0055":["US","1","ComponentID"],"0060":["SQ","1","ComponentAssemblySequence"],"0070":["US","1","Component1ReferencedID"],"0080":["US","1","Component1ReferencedMatingFeatureSetID"],"0090":["US","1","Component1ReferencedMatingFeatureID"],"00A0":["US","1","Component2ReferencedID"],"00B0":["US","1","Component2ReferencedMatingFeatureSetID"],"00C0":["US","1","Component2ReferencedMatingFeatureID"]},"0078":{"0000":["UL","1","GenericGroupLength"],"0001":["LO","1","ImplantTemplateGroupName"],"0010":["ST","1","ImplantTemplateGroupDescription"],"0020":["LO","1","ImplantTemplateGroupIssuer"],"0024":["LO","1","ImplantTemplateGroupVersion"],"0026":["SQ","1","ReplacedImplantTemplateGroupSequence"],"0028":["SQ","1","ImplantTemplateGroupTargetAnatomySequence"],"002A":["SQ","1","ImplantTemplateGroupMembersSequence"],"002E":["US","1","ImplantTemplateGroupMemberID"],"0050":["FD","3","ThreeDImplantTemplateGroupMemberMatchingPoint"],"0060":["FD","9","ThreeDImplantTemplateGroupMemberMatchingAxes"],"0070":["SQ","1","ImplantTemplateGroupMemberMatching2DCoordinatesSequence"],"0090":["FD","2","TwoDImplantTemplateGroupMemberMatchingPoint"],"00A0":["FD","4","TwoDImplantTemplateGroupMemberMatchingAxes"],"00B0":["SQ","1","ImplantTemplateGroupVariationDimensionSequence"],"00B2":["LO","1","ImplantTemplateGroupVariationDimensionName"],"00B4":["SQ","1","ImplantTemplateGroupVariationDimensionRankSequence"],"00B6":["US","1","ReferencedImplantTemplateGroupMemberID"],"00B8":["US","1","ImplantTemplateGroupVariationDimensionRank"]},"0080":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","SurfaceScanAcquisitionTypeCodeSequence"],"0002":["SQ","1","SurfaceScanModeCodeSequence"],"0003":["SQ","1","RegistrationMethodCodeSequence"],"0004":["FD","1","ShotDurationTime"],"0005":["FD","1","ShotOffsetTime"],"0006":["US","1-n","SurfacePointPresentationValueData"],"0007":["US","3-3n","SurfacePointColorCIELabValueData"],"0008":["SQ","1","UVMappingSequence"],"0009":["SH","1","TextureLabel"],"0010":["OF","1","UValueData"],"0011":["OF","1","VValueData"],"0012":["SQ","1","ReferencedTextureSequence"],"0013":["SQ","1","ReferencedSurfaceDataSequence"]},"0082":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","AssessmentSummary"],"0003":["UT","1","AssessmentSummaryDescription"],"0004":["SQ","1","AssessedSOPInstanceSequence"],"0005":["SQ","1","ReferencedComparisonSOPInstanceSequence"],"0006":["UL","1","NumberOfAssessmentObservations"],"0007":["SQ","1","AssessmentObservationsSequence"],"0008":["CS","1","ObservationSignificance"],"000A":["UT","1","ObservationDescription"],"000C":["SQ","1","StructuredConstraintObservationSequence"],"0010":["SQ","1","AssessedAttributeValueSequence"],"0016":["LO","1","AssessmentSetID"],"0017":["SQ","1","AssessmentRequesterSequence"],"0018":["LO","1","SelectorAttributeName"],"0019":["LO","1","SelectorAttributeKeyword"],"0021":["SQ","1","AssessmentTypeCodeSequence"],"0022":["SQ","1","ObservationBasisCodeSequence"],"0023":["LO","1","AssessmentLabel"],"0032":["CS","1","ConstraintType"],"0033":["UT","1","SpecificationSelectionGuidance"],"0034":["SQ","1","ConstraintValueSequence"],"0035":["SQ","1","RecommendedDefaultValueSequence"],"0036":["CS","1","ConstraintViolationSignificance"],"0037":["UT","1","ConstraintViolationCondition"],"0038":["CS","1","ModifiableConstraintFlag"]},"0088":{"0000":["UL","1","GenericGroupLength"],"0130":["SH","1","StorageMediaFileSetID"],"0140":["UI","1","StorageMediaFileSetUID"],"0200":["SQ","1","IconImageSequence"],"0904":["LO","1","TopicTitle"],"0906":["ST","1","TopicSubject"],"0910":["LO","1","TopicAuthor"],"0912":["LO","1-32","TopicKeywords"]},"0100":{"0000":["UL","1","GenericGroupLength"],"0410":["CS","1","SOPInstanceStatus"],"0420":["DT","1","SOPAuthorizationDateTime"],"0424":["LT","1","SOPAuthorizationComment"],"0426":["LO","1","AuthorizationEquipmentCertificationNumber"]},"0400":{"0000":["UL","1","GenericGroupLength"],"0005":["US","1","MACIDNumber"],"0010":["UI","1","MACCalculationTransferSyntaxUID"],"0015":["CS","1","MACAlgorithm"],"0020":["AT","1-n","DataElementsSigned"],"0100":["UI","1","DigitalSignatureUID"],"0105":["DT","1","DigitalSignatureDateTime"],"0110":["CS","1","CertificateType"],"0115":["OB","1","CertificateOfSigner"],"0120":["OB","1","Signature"],"0305":["CS","1","CertifiedTimestampType"],"0310":["OB","1","CertifiedTimestamp"],"0315":["FL","1",""],"0401":["SQ","1","DigitalSignaturePurposeCodeSequence"],"0402":["SQ","1","ReferencedDigitalSignatureSequence"],"0403":["SQ","1","ReferencedSOPInstanceMACSequence"],"0404":["OB","1","MAC"],"0500":["SQ","1","EncryptedAttributesSequence"],"0510":["UI","1","EncryptedContentTransferSyntaxUID"],"0520":["OB","1","EncryptedContent"],"0550":["SQ","1","ModifiedAttributesSequence"],"0551":["SQ","1","NonconformingModifiedAttributesSequence"],"0552":["OB","1","NonconformingDataElementValue"],"0561":["SQ","1","OriginalAttributesSequence"],"0562":["DT","1","AttributeModificationDateTime"],"0563":["LO","1","ModifyingSystem"],"0564":["LO","1","SourceOfPreviousValues"],"0565":["CS","1","ReasonForTheAttributeModification"],"0600":["CS","1","InstanceOriginStatus"]},1e3:{"0000":["UL","1","GenericGroupLength"],"0010":["US","3","EscapeTriplet"],"0011":["US","3","RunLengthTriplet"],"0012":["US","1","HuffmanTableSize"],"0013":["US","3","HuffmanTableTriplet"],"0014":["US","1","ShiftTableSize"],"0015":["US","3","ShiftTableTriplet"]},1010:{"0000":["UL","1","GenericGroupLength"],"0004":["US","1-n","ZonalMap"]},2e3:{"0000":["UL","1","GenericGroupLength"],"0010":["IS","1","NumberOfCopies"],"001E":["SQ","1","PrinterConfigurationSequence"],"0020":["CS","1","PrintPriority"],"0030":["CS","1","MediumType"],"0040":["CS","1","FilmDestination"],"0050":["LO","1","FilmSessionLabel"],"0060":["IS","1","MemoryAllocation"],"0061":["IS","1","MaximumMemoryAllocation"],"0062":["CS","1","ColorImagePrintingFlag"],"0063":["CS","1","CollationFlag"],"0065":["CS","1","AnnotationFlag"],"0067":["CS","1","ImageOverlayFlag"],"0069":["CS","1","PresentationLUTFlag"],"006A":["CS","1","ImageBoxPresentationLUTFlag"],"00A0":["US","1","MemoryBitDepth"],"00A1":["US","1","PrintingBitDepth"],"00A2":["SQ","1","MediaInstalledSequence"],"00A4":["SQ","1","OtherMediaAvailableSequence"],"00A8":["SQ","1","SupportedImageDisplayFormatsSequence"],"0500":["SQ","1","ReferencedFilmBoxSequence"],"0510":["SQ","1","ReferencedStoredPrintSequence"]},2010:{"0000":["UL","1","GenericGroupLength"],"0010":["ST","1","ImageDisplayFormat"],"0030":["CS","1","AnnotationDisplayFormatID"],"0040":["CS","1","FilmOrientation"],"0050":["CS","1","FilmSizeID"],"0052":["CS","1","PrinterResolutionID"],"0054":["CS","1","DefaultPrinterResolutionID"],"0060":["CS","1","MagnificationType"],"0080":["CS","1","SmoothingType"],"00A6":["CS","1","DefaultMagnificationType"],"00A7":["CS","1-n","OtherMagnificationTypesAvailable"],"00A8":["CS","1","DefaultSmoothingType"],"00A9":["CS","1-n","OtherSmoothingTypesAvailable"],"0100":["CS","1","BorderDensity"],"0110":["CS","1","EmptyImageDensity"],"0120":["US","1","MinDensity"],"0130":["US","1","MaxDensity"],"0140":["CS","1","Trim"],"0150":["ST","1","ConfigurationInformation"],"0152":["LT","1","ConfigurationInformationDescription"],"0154":["IS","1","MaximumCollatedFilms"],"015E":["US","1","Illumination"],"0160":["US","1","ReflectedAmbientLight"],"0376":["DS","2","PrinterPixelSpacing"],"0500":["SQ","1","ReferencedFilmSessionSequence"],"0510":["SQ","1","ReferencedImageBoxSequence"],"0520":["SQ","1","ReferencedBasicAnnotationBoxSequence"]},2020:{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","ImageBoxPosition"],"0020":["CS","1","Polarity"],"0030":["DS","1","RequestedImageSize"],"0040":["CS","1","RequestedDecimateCropBehavior"],"0050":["CS","1","RequestedResolutionID"],"00A0":["CS","1","RequestedImageSizeFlag"],"00A2":["CS","1","DecimateCropResult"],"0110":["SQ","1","BasicGrayscaleImageSequence"],"0111":["SQ","1","BasicColorImageSequence"],"0130":["SQ","1","ReferencedImageOverlayBoxSequence"],"0140":["SQ","1","ReferencedVOILUTBoxSequence"]},2030:{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","AnnotationPosition"],"0020":["LO","1","TextString"]},2040:{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","ReferencedOverlayPlaneSequence"],"0011":["US","1-99","ReferencedOverlayPlaneGroups"],"0020":["SQ","1","OverlayPixelDataSequence"],"0060":["CS","1","OverlayMagnificationType"],"0070":["CS","1","OverlaySmoothingType"],"0072":["CS","1","OverlayOrImageMagnification"],"0074":["US","1","MagnifyToNumberOfColumns"],"0080":["CS","1","OverlayForegroundDensity"],"0082":["CS","1","OverlayBackgroundDensity"],"0090":["CS","1","OverlayMode"],"0100":["CS","1","ThresholdDensity"],"0500":["SQ","1","ReferencedImageBoxSequenceRetired"]},2050:{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","PresentationLUTSequence"],"0020":["CS","1","PresentationLUTShape"],"0500":["SQ","1","ReferencedPresentationLUTSequence"]},2100:{"0000":["UL","1","GenericGroupLength"],"0010":["SH","1","PrintJobID"],"0020":["CS","1","ExecutionStatus"],"0030":["CS","1","ExecutionStatusInfo"],"0040":["DA","1","CreationDate"],"0050":["TM","1","CreationTime"],"0070":["AE","1","Originator"],"0140":["AE","1","DestinationAE"],"0160":["SH","1","OwnerID"],"0170":["IS","1","NumberOfFilms"],"0500":["SQ","1","ReferencedPrintJobSequencePullStoredPrint"]},2110:{"0000":["UL","1","GenericGroupLength"],"0010":["CS","1","PrinterStatus"],"0020":["CS","1","PrinterStatusInfo"],"0030":["LO","1","PrinterName"],"0099":["SH","1","PrintQueueID"]},2120:{"0000":["UL","1","GenericGroupLength"],"0010":["CS","1","QueueStatus"],"0050":["SQ","1","PrintJobDescriptionSequence"],"0070":["SQ","1","ReferencedPrintJobSequence"]},2130:{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","PrintManagementCapabilitiesSequence"],"0015":["SQ","1","PrinterCharacteristicsSequence"],"0030":["SQ","1","FilmBoxContentSequence"],"0040":["SQ","1","ImageBoxContentSequence"],"0050":["SQ","1","AnnotationContentSequence"],"0060":["SQ","1","ImageOverlayBoxContentSequence"],"0080":["SQ","1","PresentationLUTContentSequence"],"00A0":["SQ","1","ProposedStudySequence"],"00C0":["SQ","1","OriginalImageSequence"]},2200:{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","LabelUsingInformationExtractedFromInstances"],"0002":["UT","1","LabelText"],"0003":["CS","1","LabelStyleSelection"],"0004":["LT","1","MediaDisposition"],"0005":["LT","1","BarcodeValue"],"0006":["CS","1","BarcodeSymbology"],"0007":["CS","1","AllowMediaSplitting"],"0008":["CS","1","IncludeNonDICOMObjects"],"0009":["CS","1","IncludeDisplayApplication"],"000A":["CS","1","PreserveCompositeInstancesAfterMediaCreation"],"000B":["US","1","TotalNumberOfPiecesOfMediaCreated"],"000C":["LO","1","RequestedMediaApplicationProfile"],"000D":["SQ","1","ReferencedStorageMediaSequence"],"000E":["AT","1-n","FailureAttributes"],"000F":["CS","1","AllowLossyCompression"],"0020":["CS","1","RequestPriority"]},3002:{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","RTImageLabel"],"0003":["LO","1","RTImageName"],"0004":["ST","1","RTImageDescription"],"000A":["CS","1","ReportedValuesOrigin"],"000C":["CS","1","RTImagePlane"],"000D":["DS","3","XRayImageReceptorTranslation"],"000E":["DS","1","XRayImageReceptorAngle"],"0010":["DS","6","RTImageOrientation"],"0011":["DS","2","ImagePlanePixelSpacing"],"0012":["DS","2","RTImagePosition"],"0020":["SH","1","RadiationMachineName"],"0022":["DS","1","RadiationMachineSAD"],"0024":["DS","1","RadiationMachineSSD"],"0026":["DS","1","RTImageSID"],"0028":["DS","1","SourceToReferenceObjectDistance"],"0029":["IS","1","FractionNumber"],"0030":["SQ","1","ExposureSequence"],"0032":["DS","1","MetersetExposure"],"0034":["DS","4","DiaphragmPosition"],"0040":["SQ","1","FluenceMapSequence"],"0041":["CS","1","FluenceDataSource"],"0042":["DS","1","FluenceDataScale"],"0050":["SQ","1","PrimaryFluenceModeSequence"],"0051":["CS","1","FluenceMode"],"0052":["SH","1","FluenceModeID"]},3004:{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","DVHType"],"0002":["CS","1","DoseUnits"],"0004":["CS","1","DoseType"],"0005":["CS","1","SpatialTransformOfDose"],"0006":["LO","1","DoseComment"],"0008":["DS","3","NormalizationPoint"],"000A":["CS","1","DoseSummationType"],"000C":["DS","2-n","GridFrameOffsetVector"],"000E":["DS","1","DoseGridScaling"],"0010":["SQ","1","RTDoseROISequence"],"0012":["DS","1","DoseValue"],"0014":["CS","1-3","TissueHeterogeneityCorrection"],"0040":["DS","3","DVHNormalizationPoint"],"0042":["DS","1","DVHNormalizationDoseValue"],"0050":["SQ","1","DVHSequence"],"0052":["DS","1","DVHDoseScaling"],"0054":["CS","1","DVHVolumeUnits"],"0056":["IS","1","DVHNumberOfBins"],"0058":["DS","2-2n","DVHData"],"0060":["SQ","1","DVHReferencedROISequence"],"0062":["CS","1","DVHROIContributionType"],"0070":["DS","1","DVHMinimumDose"],"0072":["DS","1","DVHMaximumDose"],"0074":["DS","1","DVHMeanDose"]},3006:{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","StructureSetLabel"],"0004":["LO","1","StructureSetName"],"0006":["ST","1","StructureSetDescription"],"0008":["DA","1","StructureSetDate"],"0009":["TM","1","StructureSetTime"],"0010":["SQ","1","ReferencedFrameOfReferenceSequence"],"0012":["SQ","1","RTReferencedStudySequence"],"0014":["SQ","1","RTReferencedSeriesSequence"],"0016":["SQ","1","ContourImageSequence"],"0018":["SQ","1","PredecessorStructureSetSequence"],"0020":["SQ","1","StructureSetROISequence"],"0022":["IS","1","ROINumber"],"0024":["UI","1","ReferencedFrameOfReferenceUID"],"0026":["LO","1","ROIName"],"0028":["ST","1","ROIDescription"],"002A":["IS","3","ROIDisplayColor"],"002C":["DS","1","ROIVolume"],"0030":["SQ","1","RTRelatedROISequence"],"0033":["CS","1","RTROIRelationship"],"0036":["CS","1","ROIGenerationAlgorithm"],"0037":["SQ","1","ROIDerivationAlgorithmIdentificationSequence"],"0038":["LO","1","ROIGenerationDescription"],"0039":["SQ","1","ROIContourSequence"],"0040":["SQ","1","ContourSequence"],"0042":["CS","1","ContourGeometricType"],"0044":["DS","1","ContourSlabThickness"],"0045":["DS","3","ContourOffsetVector"],"0046":["IS","1","NumberOfContourPoints"],"0048":["IS","1","ContourNumber"],"0049":["IS","1-n","AttachedContours"],"004A":["SQ","1","SourcePixelPlanesCharacteristicsSequence"],"0050":["DS","3-3n","ContourData"],"0080":["SQ","1","RTROIObservationsSequence"],"0082":["IS","1","ObservationNumber"],"0084":["IS","1","ReferencedROINumber"],"0085":["SH","1","ROIObservationLabel"],"0086":["SQ","1","RTROIIdentificationCodeSequence"],"0088":["ST","1","ROIObservationDescription"],"00A0":["SQ","1","RelatedRTROIObservationsSequence"],"00A4":["CS","1","RTROIInterpretedType"],"00A6":["PN","1","ROIInterpreter"],"00B0":["SQ","1","ROIPhysicalPropertiesSequence"],"00B2":["CS","1","ROIPhysicalProperty"],"00B4":["DS","1","ROIPhysicalPropertyValue"],"00B6":["SQ","1","ROIElementalCompositionSequence"],"00B7":["US","1","ROIElementalCompositionAtomicNumber"],"00B8":["FL","1","ROIElementalCompositionAtomicMassFraction"],"00B9":["SQ","1","AdditionalRTROIIdentificationCodeSequence"],"00C0":["SQ","1","FrameOfReferenceRelationshipSequence"],"00C2":["UI","1","RelatedFrameOfReferenceUID"],"00C4":["CS","1","FrameOfReferenceTransformationType"],"00C6":["DS","16","FrameOfReferenceTransformationMatrix"],"00C8":["LO","1","FrameOfReferenceTransformationComment"],"00C9":["SQ","1","PatientLocationCoordinatesSequence"],"00CA":["SQ","1","PatientLocationCoordinatesCodeSequence"],"00CB":["SQ","1","PatientSupportPositionSequence"]},3008:{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","MeasuredDoseReferenceSequence"],"0012":["ST","1","MeasuredDoseDescription"],"0014":["CS","1","MeasuredDoseType"],"0016":["DS","1","MeasuredDoseValue"],"0020":["SQ","1","TreatmentSessionBeamSequence"],"0021":["SQ","1","TreatmentSessionIonBeamSequence"],"0022":["IS","1","CurrentFractionNumber"],"0024":["DA","1","TreatmentControlPointDate"],"0025":["TM","1","TreatmentControlPointTime"],"002A":["CS","1","TreatmentTerminationStatus"],"002B":["SH","1","TreatmentTerminationCode"],"002C":["CS","1","TreatmentVerificationStatus"],"0030":["SQ","1","ReferencedTreatmentRecordSequence"],"0032":["DS","1","SpecifiedPrimaryMeterset"],"0033":["DS","1","SpecifiedSecondaryMeterset"],"0036":["DS","1","DeliveredPrimaryMeterset"],"0037":["DS","1","DeliveredSecondaryMeterset"],"003A":["DS","1","SpecifiedTreatmentTime"],"003B":["DS","1","DeliveredTreatmentTime"],"0040":["SQ","1","ControlPointDeliverySequence"],"0041":["SQ","1","IonControlPointDeliverySequence"],"0042":["DS","1","SpecifiedMeterset"],"0044":["DS","1","DeliveredMeterset"],"0045":["FL","1","MetersetRateSet"],"0046":["FL","1","MetersetRateDelivered"],"0047":["FL","1-n","ScanSpotMetersetsDelivered"],"0048":["DS","1","DoseRateDelivered"],"0050":["SQ","1","TreatmentSummaryCalculatedDoseReferenceSequence"],"0052":["DS","1","CumulativeDoseToDoseReference"],"0054":["DA","1","FirstTreatmentDate"],"0056":["DA","1","MostRecentTreatmentDate"],"005A":["IS","1","NumberOfFractionsDelivered"],"0060":["SQ","1","OverrideSequence"],"0061":["AT","1","ParameterSequencePointer"],"0062":["AT","1","OverrideParameterPointer"],"0063":["IS","1","ParameterItemIndex"],"0064":["IS","1","MeasuredDoseReferenceNumber"],"0065":["AT","1","ParameterPointer"],"0066":["ST","1","OverrideReason"],"0067":["US","1","ParameterValueNumber"],"0068":["SQ","1","CorrectedParameterSequence"],"006A":["FL","1","CorrectionValue"],"0070":["SQ","1","CalculatedDoseReferenceSequence"],"0072":["IS","1","CalculatedDoseReferenceNumber"],"0074":["ST","1","CalculatedDoseReferenceDescription"],"0076":["DS","1","CalculatedDoseReferenceDoseValue"],"0078":["DS","1","StartMeterset"],"007A":["DS","1","EndMeterset"],"0080":["SQ","1","ReferencedMeasuredDoseReferenceSequence"],"0082":["IS","1","ReferencedMeasuredDoseReferenceNumber"],"0090":["SQ","1","ReferencedCalculatedDoseReferenceSequence"],"0092":["IS","1","ReferencedCalculatedDoseReferenceNumber"],"00A0":["SQ","1","BeamLimitingDeviceLeafPairsSequence"],"00B0":["SQ","1","RecordedWedgeSequence"],"00C0":["SQ","1","RecordedCompensatorSequence"],"00D0":["SQ","1","RecordedBlockSequence"],"00D1":["SQ","1","RecordedBlockSlabSequence"],"00E0":["SQ","1","TreatmentSummaryMeasuredDoseReferenceSequence"],"00F0":["SQ","1","RecordedSnoutSequence"],"00F2":["SQ","1","RecordedRangeShifterSequence"],"00F4":["SQ","1","RecordedLateralSpreadingDeviceSequence"],"00F6":["SQ","1","RecordedRangeModulatorSequence"],"0100":["SQ","1","RecordedSourceSequence"],"0105":["LO","1","SourceSerialNumber"],"0110":["SQ","1","TreatmentSessionApplicationSetupSequence"],"0116":["CS","1","ApplicationSetupCheck"],"0120":["SQ","1","RecordedBrachyAccessoryDeviceSequence"],"0122":["IS","1","ReferencedBrachyAccessoryDeviceNumber"],"0130":["SQ","1","RecordedChannelSequence"],"0132":["DS","1","SpecifiedChannelTotalTime"],"0134":["DS","1","DeliveredChannelTotalTime"],"0136":["IS","1","SpecifiedNumberOfPulses"],"0138":["IS","1","DeliveredNumberOfPulses"],"013A":["DS","1","SpecifiedPulseRepetitionInterval"],"013C":["DS","1","DeliveredPulseRepetitionInterval"],"0140":["SQ","1","RecordedSourceApplicatorSequence"],"0142":["IS","1","ReferencedSourceApplicatorNumber"],"0150":["SQ","1","RecordedChannelShieldSequence"],"0152":["IS","1","ReferencedChannelShieldNumber"],"0160":["SQ","1","BrachyControlPointDeliveredSequence"],"0162":["DA","1","SafePositionExitDate"],"0164":["TM","1","SafePositionExitTime"],"0166":["DA","1","SafePositionReturnDate"],"0168":["TM","1","SafePositionReturnTime"],"0171":["SQ","1","PulseSpecificBrachyControlPointDeliveredSequence"],"0172":["US","1","PulseNumber"],"0173":["SQ","1","BrachyPulseControlPointDeliveredSequence"],"0200":["CS","1","CurrentTreatmentStatus"],"0202":["ST","1","TreatmentStatusComment"],"0220":["SQ","1","FractionGroupSummarySequence"],"0223":["IS","1","ReferencedFractionNumber"],"0224":["CS","1","FractionGroupType"],"0230":["CS","1","BeamStopperPosition"],"0240":["SQ","1","FractionStatusSummarySequence"],"0250":["DA","1","TreatmentDate"],"0251":["TM","1","TreatmentTime"]},"300A":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","RTPlanLabel"],"0003":["LO","1","RTPlanName"],"0004":["ST","1","RTPlanDescription"],"0006":["DA","1","RTPlanDate"],"0007":["TM","1","RTPlanTime"],"0009":["LO","1-n","TreatmentProtocols"],"000A":["CS","1","PlanIntent"],"000B":["LO","1-n","TreatmentSites"],"000C":["CS","1","RTPlanGeometry"],"000E":["ST","1","PrescriptionDescription"],"0010":["SQ","1","DoseReferenceSequence"],"0012":["IS","1","DoseReferenceNumber"],"0013":["UI","1","DoseReferenceUID"],"0014":["CS","1","DoseReferenceStructureType"],"0015":["CS","1","NominalBeamEnergyUnit"],"0016":["LO","1","DoseReferenceDescription"],"0018":["DS","3","DoseReferencePointCoordinates"],"001A":["DS","1","NominalPriorDose"],"0020":["CS","1","DoseReferenceType"],"0021":["DS","1","ConstraintWeight"],"0022":["DS","1","DeliveryWarningDose"],"0023":["DS","1","DeliveryMaximumDose"],"0025":["DS","1","TargetMinimumDose"],"0026":["DS","1","TargetPrescriptionDose"],"0027":["DS","1","TargetMaximumDose"],"0028":["DS","1","TargetUnderdoseVolumeFraction"],"002A":["DS","1","OrganAtRiskFullVolumeDose"],"002B":["DS","1","OrganAtRiskLimitDose"],"002C":["DS","1","OrganAtRiskMaximumDose"],"002D":["DS","1","OrganAtRiskOverdoseVolumeFraction"],"0040":["SQ","1","ToleranceTableSequence"],"0042":["IS","1","ToleranceTableNumber"],"0043":["SH","1","ToleranceTableLabel"],"0044":["DS","1","GantryAngleTolerance"],"0046":["DS","1","BeamLimitingDeviceAngleTolerance"],"0048":["SQ","1","BeamLimitingDeviceToleranceSequence"],"004A":["DS","1","BeamLimitingDevicePositionTolerance"],"004B":["FL","1","SnoutPositionTolerance"],"004C":["DS","1","PatientSupportAngleTolerance"],"004E":["DS","1","TableTopEccentricAngleTolerance"],"004F":["FL","1","TableTopPitchAngleTolerance"],"0050":["FL","1","TableTopRollAngleTolerance"],"0051":["DS","1","TableTopVerticalPositionTolerance"],"0052":["DS","1","TableTopLongitudinalPositionTolerance"],"0053":["DS","1","TableTopLateralPositionTolerance"],"0055":["CS","1","RTPlanRelationship"],"0070":["SQ","1","FractionGroupSequence"],"0071":["IS","1","FractionGroupNumber"],"0072":["LO","1","FractionGroupDescription"],"0078":["IS","1","NumberOfFractionsPlanned"],"0079":["IS","1","NumberOfFractionPatternDigitsPerDay"],"007A":["IS","1","RepeatFractionCycleLength"],"007B":["LT","1","FractionPattern"],"0080":["IS","1","NumberOfBeams"],"0082":["DS","3","BeamDoseSpecificationPoint"],"0083":["UI","1","ReferencedDoseReferenceUID"],"0084":["DS","1","BeamDose"],"0086":["DS","1","BeamMeterset"],"0088":["FL","1","BeamDosePointDepth"],"0089":["FL","1","BeamDosePointEquivalentDepth"],"008A":["FL","1","BeamDosePointSSD"],"008B":["CS","1","BeamDoseMeaning"],"008C":["SQ","1","BeamDoseVerificationControlPointSequence"],"008D":["FL","1","AverageBeamDosePointDepth"],"008E":["FL","1","AverageBeamDosePointEquivalentDepth"],"008F":["FL","1","AverageBeamDosePointSSD"],"0090":["CS","1","BeamDoseType"],"0091":["DS","1","AlternateBeamDose"],"0092":["CS","1","AlternateBeamDoseType"],"0093":["CS","1","DepthValueAveragingFlag"],"0094":["DS","1","BeamDosePointSourceToExternalContourDistance"],"00A0":["IS","1","NumberOfBrachyApplicationSetups"],"00A2":["DS","3","BrachyApplicationSetupDoseSpecificationPoint"],"00A4":["DS","1","BrachyApplicationSetupDose"],"00B0":["SQ","1","BeamSequence"],"00B2":["SH","1","TreatmentMachineName"],"00B3":["CS","1","PrimaryDosimeterUnit"],"00B4":["DS","1","SourceAxisDistance"],"00B6":["SQ","1","BeamLimitingDeviceSequence"],"00B8":["CS","1","RTBeamLimitingDeviceType"],"00BA":["DS","1","SourceToBeamLimitingDeviceDistance"],"00BB":["FL","1","IsocenterToBeamLimitingDeviceDistance"],"00BC":["IS","1","NumberOfLeafJawPairs"],"00BE":["DS","3-n","LeafPositionBoundaries"],"00C0":["IS","1","BeamNumber"],"00C2":["LO","1","BeamName"],"00C3":["ST","1","BeamDescription"],"00C4":["CS","1","BeamType"],"00C5":["FD","1","BeamDeliveryDurationLimit"],"00C6":["CS","1","RadiationType"],"00C7":["CS","1","HighDoseTechniqueType"],"00C8":["IS","1","ReferenceImageNumber"],"00CA":["SQ","1","PlannedVerificationImageSequence"],"00CC":["LO","1-n","ImagingDeviceSpecificAcquisitionParameters"],"00CE":["CS","1","TreatmentDeliveryType"],"00D0":["IS","1","NumberOfWedges"],"00D1":["SQ","1","WedgeSequence"],"00D2":["IS","1","WedgeNumber"],"00D3":["CS","1","WedgeType"],"00D4":["SH","1","WedgeID"],"00D5":["IS","1","WedgeAngle"],"00D6":["DS","1","WedgeFactor"],"00D7":["FL","1","TotalWedgeTrayWaterEquivalentThickness"],"00D8":["DS","1","WedgeOrientation"],"00D9":["FL","1","IsocenterToWedgeTrayDistance"],"00DA":["DS","1","SourceToWedgeTrayDistance"],"00DB":["FL","1","WedgeThinEdgePosition"],"00DC":["SH","1","BolusID"],"00DD":["ST","1","BolusDescription"],"00DE":["DS","1","EffectiveWedgeAngle"],"00E0":["IS","1","NumberOfCompensators"],"00E1":["SH","1","MaterialID"],"00E2":["DS","1","TotalCompensatorTrayFactor"],"00E3":["SQ","1","CompensatorSequence"],"00E4":["IS","1","CompensatorNumber"],"00E5":["SH","1","CompensatorID"],"00E6":["DS","1","SourceToCompensatorTrayDistance"],"00E7":["IS","1","CompensatorRows"],"00E8":["IS","1","CompensatorColumns"],"00E9":["DS","2","CompensatorPixelSpacing"],"00EA":["DS","2","CompensatorPosition"],"00EB":["DS","1-n","CompensatorTransmissionData"],"00EC":["DS","1-n","CompensatorThicknessData"],"00ED":["IS","1","NumberOfBoli"],"00EE":["CS","1","CompensatorType"],"00EF":["SH","1","CompensatorTrayID"],"00F0":["IS","1","NumberOfBlocks"],"00F2":["DS","1","TotalBlockTrayFactor"],"00F3":["FL","1","TotalBlockTrayWaterEquivalentThickness"],"00F4":["SQ","1","BlockSequence"],"00F5":["SH","1","BlockTrayID"],"00F6":["DS","1","SourceToBlockTrayDistance"],"00F7":["FL","1","IsocenterToBlockTrayDistance"],"00F8":["CS","1","BlockType"],"00F9":["LO","1","AccessoryCode"],"00FA":["CS","1","BlockDivergence"],"00FB":["CS","1","BlockMountingPosition"],"00FC":["IS","1","BlockNumber"],"00FE":["LO","1","BlockName"],"0100":["DS","1","BlockThickness"],"0102":["DS","1","BlockTransmission"],"0104":["IS","1","BlockNumberOfPoints"],"0106":["DS","2-2n","BlockData"],"0107":["SQ","1","ApplicatorSequence"],"0108":["SH","1","ApplicatorID"],"0109":["CS","1","ApplicatorType"],"010A":["LO","1","ApplicatorDescription"],"010C":["DS","1","CumulativeDoseReferenceCoefficient"],"010E":["DS","1","FinalCumulativeMetersetWeight"],"0110":["IS","1","NumberOfControlPoints"],"0111":["SQ","1","ControlPointSequence"],"0112":["IS","1","ControlPointIndex"],"0114":["DS","1","NominalBeamEnergy"],"0115":["DS","1","DoseRateSet"],"0116":["SQ","1","WedgePositionSequence"],"0118":["CS","1","WedgePosition"],"011A":["SQ","1","BeamLimitingDevicePositionSequence"],"011C":["DS","2-2n","LeafJawPositions"],"011E":["DS","1","GantryAngle"],"011F":["CS","1","GantryRotationDirection"],"0120":["DS","1","BeamLimitingDeviceAngle"],"0121":["CS","1","BeamLimitingDeviceRotationDirection"],"0122":["DS","1","PatientSupportAngle"],"0123":["CS","1","PatientSupportRotationDirection"],"0124":["DS","1","TableTopEccentricAxisDistance"],"0125":["DS","1","TableTopEccentricAngle"],"0126":["CS","1","TableTopEccentricRotationDirection"],"0128":["DS","1","TableTopVerticalPosition"],"0129":["DS","1","TableTopLongitudinalPosition"],"012A":["DS","1","TableTopLateralPosition"],"012C":["DS","3","IsocenterPosition"],"012E":["DS","3","SurfaceEntryPoint"],"0130":["DS","1","SourceToSurfaceDistance"],"0131":["FL","1","AverageBeamDosePointSourceToExternalContourDistance"],"0132":["FL","1","SourceToExternalContourDistance"],"0133":["FL","3","ExternalContourEntryPoint"],"0134":["DS","1","CumulativeMetersetWeight"],"0140":["FL","1","TableTopPitchAngle"],"0142":["CS","1","TableTopPitchRotationDirection"],"0144":["FL","1","TableTopRollAngle"],"0146":["CS","1","TableTopRollRotationDirection"],"0148":["FL","1","HeadFixationAngle"],"014A":["FL","1","GantryPitchAngle"],"014C":["CS","1","GantryPitchRotationDirection"],"014E":["FL","1","GantryPitchAngleTolerance"],"0150":["CS","1","FixationEye"],"0151":["DS","1","ChairHeadFramePosition"],"0152":["DS","1","HeadFixationAngleTolerance"],"0153":["DS","1","ChairHeadFramePositionTolerance"],"0154":["DS","1","FixationLightAzimuthalAngleTolerance"],"0155":["DS","1","FixationLightPolarAngleTolerance"],"0180":["SQ","1","PatientSetupSequence"],"0182":["IS","1","PatientSetupNumber"],"0183":["LO","1","PatientSetupLabel"],"0184":["LO","1","PatientAdditionalPosition"],"0190":["SQ","1","FixationDeviceSequence"],"0192":["CS","1","FixationDeviceType"],"0194":["SH","1","FixationDeviceLabel"],"0196":["ST","1","FixationDeviceDescription"],"0198":["SH","1","FixationDevicePosition"],"0199":["FL","1","FixationDevicePitchAngle"],"019A":["FL","1","FixationDeviceRollAngle"],"01A0":["SQ","1","ShieldingDeviceSequence"],"01A2":["CS","1","ShieldingDeviceType"],"01A4":["SH","1","ShieldingDeviceLabel"],"01A6":["ST","1","ShieldingDeviceDescription"],"01A8":["SH","1","ShieldingDevicePosition"],"01B0":["CS","1","SetupTechnique"],"01B2":["ST","1","SetupTechniqueDescription"],"01B4":["SQ","1","SetupDeviceSequence"],"01B6":["CS","1","SetupDeviceType"],"01B8":["SH","1","SetupDeviceLabel"],"01BA":["ST","1","SetupDeviceDescription"],"01BC":["DS","1","SetupDeviceParameter"],"01D0":["ST","1","SetupReferenceDescription"],"01D2":["DS","1","TableTopVerticalSetupDisplacement"],"01D4":["DS","1","TableTopLongitudinalSetupDisplacement"],"01D6":["DS","1","TableTopLateralSetupDisplacement"],"0200":["CS","1","BrachyTreatmentTechnique"],"0202":["CS","1","BrachyTreatmentType"],"0206":["SQ","1","TreatmentMachineSequence"],"0210":["SQ","1","SourceSequence"],"0212":["IS","1","SourceNumber"],"0214":["CS","1","SourceType"],"0216":["LO","1","SourceManufacturer"],"0218":["DS","1","ActiveSourceDiameter"],"021A":["DS","1","ActiveSourceLength"],"021B":["SH","1","SourceModelID"],"021C":["LO","1","SourceDescription"],"0222":["DS","1","SourceEncapsulationNominalThickness"],"0224":["DS","1","SourceEncapsulationNominalTransmission"],"0226":["LO","1","SourceIsotopeName"],"0228":["DS","1","SourceIsotopeHalfLife"],"0229":["CS","1","SourceStrengthUnits"],"022A":["DS","1","ReferenceAirKermaRate"],"022B":["DS","1","SourceStrength"],"022C":["DA","1","SourceStrengthReferenceDate"],"022E":["TM","1","SourceStrengthReferenceTime"],"0230":["SQ","1","ApplicationSetupSequence"],"0232":["CS","1","ApplicationSetupType"],"0234":["IS","1","ApplicationSetupNumber"],"0236":["LO","1","ApplicationSetupName"],"0238":["LO","1","ApplicationSetupManufacturer"],"0240":["IS","1","TemplateNumber"],"0242":["SH","1","TemplateType"],"0244":["LO","1","TemplateName"],"0250":["DS","1","TotalReferenceAirKerma"],"0260":["SQ","1","BrachyAccessoryDeviceSequence"],"0262":["IS","1","BrachyAccessoryDeviceNumber"],"0263":["SH","1","BrachyAccessoryDeviceID"],"0264":["CS","1","BrachyAccessoryDeviceType"],"0266":["LO","1","BrachyAccessoryDeviceName"],"026A":["DS","1","BrachyAccessoryDeviceNominalThickness"],"026C":["DS","1","BrachyAccessoryDeviceNominalTransmission"],"0271":["DS","1","ChannelEffectiveLength"],"0272":["DS","1","ChannelInnerLength"],"0273":["SH","1","AfterloaderChannelID"],"0274":["DS","1","SourceApplicatorTipLength"],"0280":["SQ","1","ChannelSequence"],"0282":["IS","1","ChannelNumber"],"0284":["DS","1","ChannelLength"],"0286":["DS","1","ChannelTotalTime"],"0288":["CS","1","SourceMovementType"],"028A":["IS","1","NumberOfPulses"],"028C":["DS","1","PulseRepetitionInterval"],"0290":["IS","1","SourceApplicatorNumber"],"0291":["SH","1","SourceApplicatorID"],"0292":["CS","1","SourceApplicatorType"],"0294":["LO","1","SourceApplicatorName"],"0296":["DS","1","SourceApplicatorLength"],"0298":["LO","1","SourceApplicatorManufacturer"],"029C":["DS","1","SourceApplicatorWallNominalThickness"],"029E":["DS","1","SourceApplicatorWallNominalTransmission"],"02A0":["DS","1","SourceApplicatorStepSize"],"02A1":["IS","1","ApplicatorShapeReferencedROINumber"],"02A2":["IS","1","TransferTubeNumber"],"02A4":["DS","1","TransferTubeLength"],"02B0":["SQ","1","ChannelShieldSequence"],"02B2":["IS","1","ChannelShieldNumber"],"02B3":["SH","1","ChannelShieldID"],"02B4":["LO","1","ChannelShieldName"],"02B8":["DS","1","ChannelShieldNominalThickness"],"02BA":["DS","1","ChannelShieldNominalTransmission"],"02C8":["DS","1","FinalCumulativeTimeWeight"],"02D0":["SQ","1","BrachyControlPointSequence"],"02D2":["DS","1","ControlPointRelativePosition"],"02D4":["DS","3","ControlPoint3DPosition"],"02D6":["DS","1","CumulativeTimeWeight"],"02E0":["CS","1","CompensatorDivergence"],"02E1":["CS","1","CompensatorMountingPosition"],"02E2":["DS","1-n","SourceToCompensatorDistance"],"02E3":["FL","1","TotalCompensatorTrayWaterEquivalentThickness"],"02E4":["FL","1","IsocenterToCompensatorTrayDistance"],"02E5":["FL","1","CompensatorColumnOffset"],"02E6":["FL","1-n","IsocenterToCompensatorDistances"],"02E7":["FL","1","CompensatorRelativeStoppingPowerRatio"],"02E8":["FL","1","CompensatorMillingToolDiameter"],"02EA":["SQ","1","IonRangeCompensatorSequence"],"02EB":["LT","1","CompensatorDescription"],"0302":["IS","1","RadiationMassNumber"],"0304":["IS","1","RadiationAtomicNumber"],"0306":["SS","1","RadiationChargeState"],"0308":["CS","1","ScanMode"],"0309":["CS","1","ModulatedScanModeType"],"030A":["FL","2","VirtualSourceAxisDistances"],"030C":["SQ","1","SnoutSequence"],"030D":["FL","1","SnoutPosition"],"030F":["SH","1","SnoutID"],"0312":["IS","1","NumberOfRangeShifters"],"0314":["SQ","1","RangeShifterSequence"],"0316":["IS","1","RangeShifterNumber"],"0318":["SH","1","RangeShifterID"],"0320":["CS","1","RangeShifterType"],"0322":["LO","1","RangeShifterDescription"],"0330":["IS","1","NumberOfLateralSpreadingDevices"],"0332":["SQ","1","LateralSpreadingDeviceSequence"],"0334":["IS","1","LateralSpreadingDeviceNumber"],"0336":["SH","1","LateralSpreadingDeviceID"],"0338":["CS","1","LateralSpreadingDeviceType"],"033A":["LO","1","LateralSpreadingDeviceDescription"],"033C":["FL","1","LateralSpreadingDeviceWaterEquivalentThickness"],"0340":["IS","1","NumberOfRangeModulators"],"0342":["SQ","1","RangeModulatorSequence"],"0344":["IS","1","RangeModulatorNumber"],"0346":["SH","1","RangeModulatorID"],"0348":["CS","1","RangeModulatorType"],"034A":["LO","1","RangeModulatorDescription"],"034C":["SH","1","BeamCurrentModulationID"],"0350":["CS","1","PatientSupportType"],"0352":["SH","1","PatientSupportID"],"0354":["LO","1","PatientSupportAccessoryCode"],"0355":["LO","1","TrayAccessoryCode"],"0356":["FL","1","FixationLightAzimuthalAngle"],"0358":["FL","1","FixationLightPolarAngle"],"035A":["FL","1","MetersetRate"],"0360":["SQ","1","RangeShifterSettingsSequence"],"0362":["LO","1","RangeShifterSetting"],"0364":["FL","1","IsocenterToRangeShifterDistance"],"0366":["FL","1","RangeShifterWaterEquivalentThickness"],"0370":["SQ","1","LateralSpreadingDeviceSettingsSequence"],"0372":["LO","1","LateralSpreadingDeviceSetting"],"0374":["FL","1","IsocenterToLateralSpreadingDeviceDistance"],"0380":["SQ","1","RangeModulatorSettingsSequence"],"0382":["FL","1","RangeModulatorGatingStartValue"],"0384":["FL","1","RangeModulatorGatingStopValue"],"0386":["FL","1","RangeModulatorGatingStartWaterEquivalentThickness"],"0388":["FL","1","RangeModulatorGatingStopWaterEquivalentThickness"],"038A":["FL","1","IsocenterToRangeModulatorDistance"],"038F":["FL","1-n","ScanSpotTimeOffset"],"0390":["SH","1","ScanSpotTuneID"],"0391":["IS","1-n","ScanSpotPrescribedIndices"],"0392":["IS","1","NumberOfScanSpotPositions"],"0393":["CS","1","ScanSpotReordered"],"0394":["FL","1-n","ScanSpotPositionMap"],"0395":["CS","1","ScanSpotReorderingAllowed"],"0396":["FL","1-n","ScanSpotMetersetWeights"],"0398":["FL","2","ScanningSpotSize"],"0399":["FL","2-2n","ScanSpotSizesDelivered"],"039A":["IS","1","NumberOfPaintings"],"03A0":["SQ","1","IonToleranceTableSequence"],"03A2":["SQ","1","IonBeamSequence"],"03A4":["SQ","1","IonBeamLimitingDeviceSequence"],"03A6":["SQ","1","IonBlockSequence"],"03A8":["SQ","1","IonControlPointSequence"],"03AA":["SQ","1","IonWedgeSequence"],"03AC":["SQ","1","IonWedgePositionSequence"],"0401":["SQ","1","ReferencedSetupImageSequence"],"0402":["ST","1","SetupImageComment"],"0410":["SQ","1","MotionSynchronizationSequence"],"0412":["FL","3","ControlPointOrientation"],"0420":["SQ","1","GeneralAccessorySequence"],"0421":["SH","1","GeneralAccessoryID"],"0422":["ST","1","GeneralAccessoryDescription"],"0423":["CS","1","GeneralAccessoryType"],"0424":["IS","1","GeneralAccessoryNumber"],"0425":["FL","1","SourceToGeneralAccessoryDistance"],"0426":["DS","1","IsocenterToGeneralAccessoryDistance"],"0431":["SQ","1","ApplicatorGeometrySequence"],"0432":["CS","1","ApplicatorApertureShape"],"0433":["FL","1","ApplicatorOpening"],"0434":["FL","1","ApplicatorOpeningX"],"0435":["FL","1","ApplicatorOpeningY"],"0436":["FL","1","SourceToApplicatorMountingPositionDistance"],"0440":["IS","1","NumberOfBlockSlabItems"],"0441":["SQ","1","BlockSlabSequence"],"0442":["DS","1","BlockSlabThickness"],"0443":["US","1","BlockSlabNumber"],"0450":["SQ","1","DeviceMotionControlSequence"],"0451":["CS","1","DeviceMotionExecutionMode"],"0452":["CS","1","DeviceMotionObservationMode"],"0453":["SQ","1","DeviceMotionParameterCodeSequence"],"0501":["FL","1","DistalDepthFraction"],"0502":["FL","1","DistalDepth"],"0503":["FL","2","NominalRangeModulationFractions"],"0504":["FL","2","NominalRangeModulatedRegionDepths"],"0505":["SQ","1","DepthDoseParametersSequence"],"0506":["SQ","1","DeliveredDepthDoseParametersSequence"],"0507":["FL","1","DeliveredDistalDepthFraction"],"0508":["FL","1","DeliveredDistalDepth"],"0509":["FL","2","DeliveredNominalRangeModulationFractions"],"0510":["FL","2","DeliveredNominalRangeModulatedRegionDepths"],"0511":["CS","1","DeliveredReferenceDoseDefinition"],"0512":["CS","1","ReferenceDoseDefinition"],"0600":["US","1","RTControlPointIndex"],"0601":["US","1","RadiationGenerationModeIndex"],"0602":["US","1","ReferencedDefinedDeviceIndex"],"0603":["US","1","RadiationDoseIdentificationIndex"],"0604":["US","1","NumberOfRTControlPoints"],"0605":["US","1","ReferencedRadiationGenerationModeIndex"],"0606":["US","1","TreatmentPositionIndex"],"0607":["US","1","ReferencedDeviceIndex"],"0608":["LO","1","TreatmentPositionGroupLabel"],"0609":["UI","1","TreatmentPositionGroupUID"],"060A":["SQ","1","TreatmentPositionGroupSequence"],"060B":["US","1","ReferencedTreatmentPositionIndex"],"060C":["US","1","ReferencedRadiationDoseIdentificationIndex"],"060D":["FD","1","RTAccessoryHolderWaterEquivalentThickness"],"060E":["US","1","ReferencedRTAccessoryHolderDeviceIndex"],"060F":["CS","1","RTAccessoryHolderSlotExistenceFlag"],"0610":["SQ","1","RTAccessoryHolderSlotSequence"],"0611":["LO","1","RTAccessoryHolderSlotID"],"0612":["FD","1","RTAccessoryHolderSlotDistance"],"0613":["FD","1","RTAccessorySlotDistance"],"0614":["SQ","1","RTAccessoryHolderDefinitionSequence"],"0615":["LO","1","RTAccessoryDeviceSlotID"],"0616":["SQ","1","RTRadiationSequence"],"0617":["SQ","1","RadiationDoseSequence"],"0618":["SQ","1","RadiationDoseIdentificationSequence"],"0619":["LO","1","RadiationDoseIdentificationLabel"],"061A":["CS","1","ReferenceDoseType"],"061B":["CS","1","PrimaryDoseValueIndicator"],"061C":["SQ","1","DoseValuesSequence"],"061D":["CS","1-n","DoseValuePurpose"],"061E":["FD","3","ReferenceDosePointCoordinates"],"061F":["SQ","1","RadiationDoseValuesParametersSequence"],"0620":["SQ","1","MetersetToDoseMappingSequence"],"0621":["SQ","1","ExpectedInVivoMeasurementValuesSequence"],"0622":["US","1","ExpectedInVivoMeasurementValueIndex"],"0623":["LO","1","RadiationDoseInVivoMeasurementLabel"],"0624":["FD","2","RadiationDoseCentralAxisDisplacement"],"0625":["FD","1","RadiationDoseValue"],"0626":["FD","1","RadiationDoseSourceToSkinDistance"],"0627":["FD","3","RadiationDoseMeasurementPointCoordinates"],"0628":["FD","1","RadiationDoseSourceToExternalContourDistance"],"0629":["SQ","1","RTToleranceSetSequence"],"062A":["LO","1","RTToleranceSetLabel"],"062B":["SQ","1","AttributeToleranceValuesSequence"],"062C":["FD","1","ToleranceValue"],"062D":["SQ","1","PatientSupportPositionToleranceSequence"],"062E":["FD","1","TreatmentTimeLimit"],"062F":["SQ","1","CArmPhotonElectronControlPointSequence"],"0630":["SQ","1","ReferencedRTRadiationSequence"],"0631":["SQ","1","ReferencedRTInstanceSequence"],"0632":["SQ","1","ReferencedRTPatientSetupSequence"],"0634":["FD","1","SourceToPatientSurfaceDistance"],"0635":["SQ","1","TreatmentMachineSpecialModeCodeSequence"],"0636":["US","1","IntendedNumberOfFractions"],"0637":["CS","1","RTRadiationSetIntent"],"0638":["CS","1","RTRadiationPhysicalAndGeometricContentDetailFlag"],"0639":["CS","1","RTRecordFlag"],"063A":["SQ","1","TreatmentDeviceIdentificationSequence"],"063B":["SQ","1","ReferencedRTPhysicianIntentSequence"],"063C":["FD","1","CumulativeMeterset"],"063D":["FD","1","DeliveryRate"],"063E":["SQ","1","DeliveryRateUnitSequence"],"063F":["SQ","1","TreatmentPositionSequence"],"0640":["FD","1","RadiationSourceAxisDistance"],"0641":["US","1","NumberOfRTBeamLimitingDevices"],"0642":["FD","1","RTBeamLimitingDeviceProximalDistance"],"0643":["FD","1","RTBeamLimitingDeviceDistalDistance"],"0644":["SQ","1","ParallelRTBeamDelimiterDeviceOrientationLabelCodeSequence"],"0645":["FD","1","BeamModifierOrientationAngle"],"0646":["SQ","1","FixedRTBeamDelimiterDeviceSequence"],"0647":["SQ","1","ParallelRTBeamDelimiterDeviceSequence"],"0648":["US","1","NumberOfParallelRTBeamDelimiters"],"0649":["FD","2-n","ParallelRTBeamDelimiterBoundaries"],"064A":["FD","2-n","ParallelRTBeamDelimiterPositions"],"064B":["FD","2","RTBeamLimitingDeviceOffset"],"064C":["SQ","1","RTBeamDelimiterGeometrySequence"],"064D":["SQ","1","RTBeamLimitingDeviceDefinitionSequence"],"064E":["CS","1","ParallelRTBeamDelimiterOpeningMode"],"064F":["CS","1-n","ParallelRTBeamDelimiterLeafMountingSide"],"0650":["UI","1","PatientSetupUID"],"0651":["SQ","1","WedgeDefinitionSequence"],"0652":["FD","1","RadiationBeamWedgeAngle"],"0653":["FD","1","RadiationBeamWedgeThinEdgeDistance"],"0654":["FD","1","RadiationBeamEffectiveWedgeAngle"],"0655":["US","1","NumberOfWedgePositions"],"0656":["SQ","1","RTBeamLimitingDeviceOpeningSequence"],"0657":["US","1","NumberOfRTBeamLimitingDeviceOpenings"],"0658":["SQ","1","RadiationDosimeterUnitSequence"],"0659":["SQ","1","RTDeviceDistanceReferenceLocationCodeSequence"],"065A":["SQ","1","RadiationDeviceConfigurationAndCommissioningKeySequence"],"065B":["SQ","1","PatientSupportPositionParameterSequence"],"065C":["CS","1","PatientSupportPositionSpecificationMethod"],"065D":["SQ","1","PatientSupportPositionDeviceParameterSequence"],"065E":["US","1","DeviceOrderIndex"],"065F":["US","1","PatientSupportPositionParameterOrderIndex"],"0660":["SQ","1","PatientSupportPositionDeviceToleranceSequence"],"0661":["US","1","PatientSupportPositionToleranceOrderIndex"],"0662":["SQ","1","CompensatorDefinitionSequence"],"0663":["CS","1","CompensatorMapOrientation"],"0664":["OF","1","CompensatorProximalThicknessMap"],"0665":["OF","1","CompensatorDistalThicknessMap"],"0666":["FD","1","CompensatorBasePlaneOffset"],"0667":["SQ","1","CompensatorShapeFabricationCodeSequence"],"0668":["SQ","1","CompensatorShapeSequence"],"0669":["FD","1","RadiationBeamCompensatorMillingToolDiameter"],"066A":["SQ","1","BlockDefinitionSequence"],"066B":["OF","1","BlockEdgeData"],"066C":["CS","1","BlockOrientation"],"066D":["FD","1","RadiationBeamBlockThickness"],"066E":["FD","1","RadiationBeamBlockSlabThickness"],"066F":["SQ","1","BlockEdgeDataSequence"],"0670":["US","1","NumberOfRTAccessoryHolders"],"0671":["SQ","1","GeneralAccessoryDefinitionSequence"],"0672":["US","1","NumberOfGeneralAccessories"],"0673":["SQ","1","BolusDefinitionSequence"],"0674":["US","1","NumberOfBoluses"],"0675":["UI","1","EquipmentFrameOfReferenceUID"],"0676":["ST","1","EquipmentFrameOfReferenceDescription"],"0677":["SQ","1","EquipmentReferencePointCoordinatesSequence"],"0678":["SQ","1","EquipmentReferencePointCodeSequence"],"0679":["FD","1","RTBeamLimitingDeviceAngle"],"067A":["FD","1","SourceRollAngle"],"067B":["SQ","1","RadiationGenerationModeSequence"],"067C":["SH","1","RadiationGenerationModeLabel"],"067D":["ST","1","RadiationGenerationModeDescription"],"067E":["SQ","1","RadiationGenerationModeMachineCodeSequence"],"067F":["SQ","1","RadiationTypeCodeSequence"],"0680":["DS","1","NominalEnergy"],"0681":["DS","1","MinimumNominalEnergy"],"0682":["DS","1","MaximumNominalEnergy"],"0683":["SQ","1","RadiationFluenceModifierCodeSequence"],"0684":["SQ","1","EnergyUnitCodeSequence"],"0685":["US","1","NumberOfRadiationGenerationModes"],"0686":["SQ","1","PatientSupportDevicesSequence"],"0687":["US","1","NumberOfPatientSupportDevices"],"0688":["FD","1","RTBeamModifierDefinitionDistance"],"0689":["SQ","1","BeamAreaLimitSequence"],"068A":["SQ","1","ReferencedRTPrescriptionSequence"],"0700":["UI","1","TreatmentSessionUID"],"0701":["CS","1","RTRadiationUsage"],"0702":["SQ","1","ReferencedRTRadiationSetSequence"],"0703":["SQ","1","ReferencedRTRadiationRecordSequence"],"0704":["US","1","RTRadiationSetDeliveryNumber"],"0705":["US","1","ClinicalFractionNumber"],"0706":["CS","1","RTTreatmentFractionCompletionStatus"],"0707":["CS","1","RTRadiationSetUsage"],"0708":["CS","1","TreatmentDeliveryContinuationFlag"],"0709":["CS","1","TreatmentRecordContentOrigin"],"0714":["CS","1","RTTreatmentTerminationStatus"],"0715":["SQ","1","RTTreatmentTerminationReasonCodeSequence"],"0716":["SQ","1","MachineSpecificTreatmentTerminationCodeSequence"],"0722":["SQ","1","RTRadiationSalvageRecordControlPointSequence"],"0723":["CS","1","StartingMetersetValueKnownFlag"],"0730":["ST","1","TreatmentTerminationDescription"],"0731":["SQ","1","TreatmentToleranceViolationSequence"],"0732":["CS","1","TreatmentToleranceViolationCategory"],"0733":["SQ","1","TreatmentToleranceViolationAttributeSequence"],"0734":["ST","1","TreatmentToleranceViolationDescription"],"0735":["ST","1","TreatmentToleranceViolationIdentification"],"0736":["DT","1","TreatmentToleranceViolationDateTime"],"073A":["DT","1","RecordedRTControlPointDateTime"],"073B":["US","1","ReferencedRadiationRTControlPointIndex"],"073E":["SQ","1","AlternateValueSequence"],"073F":["SQ","1","ConfirmationSequence"],"0740":["SQ","1","InterlockSequence"],"0741":["DT","1","InterlockDateTime"],"0742":["ST","1","InterlockDescription"],"0743":["SQ","1","InterlockOriginatingDeviceSequence"],"0744":["SQ","1","InterlockCodeSequence"],"0745":["SQ","1","InterlockResolutionCodeSequence"],"0746":["SQ","1","InterlockResolutionUserSequence"],"0760":["DT","1","OverrideDateTime"],"0761":["SQ","1","TreatmentToleranceViolationTypeCodeSequence"],"0762":["SQ","1","TreatmentToleranceViolationCauseCodeSequence"],"0772":["SQ","1","MeasuredMetersetToDoseMappingSequence"],"0773":["US","1","ReferencedExpectedInVivoMeasurementValueIndex"],"0774":["SQ","1","DoseMeasurementDeviceCodeSequence"],"0780":["SQ","1","AdditionalParameterRecordingInstanceSequence"],"0782":["US","1",""],"0783":["ST","1","InterlockOriginDescription"],"0784":["SQ","1","RTPatientPositionScopeSequence"],"0785":["UI","1","ReferencedTreatmentPositionGroupUID"],"0786":["US","1","RadiationOrderIndex"],"0787":["SQ","1","OmittedRadiationSequence"],"0788":["SQ","1","ReasonForOmissionCodeSequence"],"0789":["SQ","1","RTDeliveryStartPatientPositionSequence"],"078A":["SQ","1","RTTreatmentPreparationPatientPositionSequence"],"078B":["SQ","1","ReferencedRTTreatmentPreparationSequence"],"078C":["SQ","1","ReferencedPatientSetupPhotoSequence"],"078D":["SQ","1","PatientTreatmentPreparationMethodCodeSequence"],"078E":["LT","1","PatientTreatmentPreparationProcedureParameterDescription"],"078F":["SQ","1","PatientTreatmentPreparationDeviceSequence"],"0790":["SQ","1","PatientTreatmentPreparationProcedureSequence"],"0791":["SQ","1","PatientTreatmentPreparationProcedureCodeSequence"],"0792":["LT","1","PatientTreatmentPreparationMethodDescription"],"0793":["SQ","1","PatientTreatmentPreparationProcedureParameterSequence"],"0794":["LT","1","PatientSetupPhotoDescription"],"0795":["US","1","PatientTreatmentPreparationProcedureIndex"],"0796":["US","1","ReferencedPatientSetupProcedureIndex"],"0797":["SQ","1","RTRadiationTaskSequence"],"0798":["SQ","1","RTPatientPositionDisplacementSequence"],"0799":["SQ","1","RTPatientPositionSequence"],"079A":["LO","1","DisplacementReferenceLabel"],"079B":["FD","16","DisplacementMatrix"],"079C":["SQ","1","PatientSupportDisplacementSequence"],"079D":["SQ","1","DisplacementReferenceLocationCodeSequence"],"079E":["CS","1","RTRadiationSetDeliveryUsage"]},"300C":{"0000":["UL","1","GenericGroupLength"],"0002":["SQ","1","ReferencedRTPlanSequence"],"0004":["SQ","1","ReferencedBeamSequence"],"0006":["IS","1","ReferencedBeamNumber"],"0007":["IS","1","ReferencedReferenceImageNumber"],"0008":["DS","1","StartCumulativeMetersetWeight"],"0009":["DS","1","EndCumulativeMetersetWeight"],"000A":["SQ","1","ReferencedBrachyApplicationSetupSequence"],"000C":["IS","1","ReferencedBrachyApplicationSetupNumber"],"000E":["IS","1","ReferencedSourceNumber"],"0020":["SQ","1","ReferencedFractionGroupSequence"],"0022":["IS","1","ReferencedFractionGroupNumber"],"0040":["SQ","1","ReferencedVerificationImageSequence"],"0042":["SQ","1","ReferencedReferenceImageSequence"],"0050":["SQ","1","ReferencedDoseReferenceSequence"],"0051":["IS","1","ReferencedDoseReferenceNumber"],"0055":["SQ","1","BrachyReferencedDoseReferenceSequence"],"0060":["SQ","1","ReferencedStructureSetSequence"],"006A":["IS","1","ReferencedPatientSetupNumber"],"0080":["SQ","1","ReferencedDoseSequence"],"00A0":["IS","1","ReferencedToleranceTableNumber"],"00B0":["SQ","1","ReferencedBolusSequence"],"00C0":["IS","1","ReferencedWedgeNumber"],"00D0":["IS","1","ReferencedCompensatorNumber"],"00E0":["IS","1","ReferencedBlockNumber"],"00F0":["IS","1","ReferencedControlPointIndex"],"00F2":["SQ","1","ReferencedControlPointSequence"],"00F4":["IS","1","ReferencedStartControlPointIndex"],"00F6":["IS","1","ReferencedStopControlPointIndex"],"0100":["IS","1","ReferencedRangeShifterNumber"],"0102":["IS","1","ReferencedLateralSpreadingDeviceNumber"],"0104":["IS","1","ReferencedRangeModulatorNumber"],"0111":["SQ","1","OmittedBeamTaskSequence"],"0112":["CS","1","ReasonForOmission"],"0113":["LO","1","ReasonForOmissionDescription"],"0114":["SQ","1","PrescriptionOverviewSequence"],"0115":["FL","1","TotalPrescriptionDose"],"0116":["SQ","1","PlanOverviewSequence"],"0117":["US","1","PlanOverviewIndex"],"0118":["US","1","ReferencedPlanOverviewIndex"],"0119":["US","1","NumberOfFractionsIncluded"],"0120":["SQ","1","DoseCalibrationConditionsSequence"],"0121":["FD","1","AbsorbedDoseToMetersetRatio"],"0122":["FD","2","DelineatedRadiationFieldSize"],"0123":["CS","1","DoseCalibrationConditionsVerifiedFlag"],"0124":["FD","1","CalibrationReferencePointDepth"],"0125":["SQ","1","GatingBeamHoldTransitionSequence"],"0126":["CS","1","BeamHoldTransition"],"0127":["DT","1","BeamHoldTransitionDateTime"],"0128":["SQ","1","BeamHoldOriginatingDeviceSequence"]},"300E":{"0000":["UL","1","GenericGroupLength"],"0002":["CS","1","ApprovalStatus"],"0004":["DA","1","ReviewDate"],"0005":["TM","1","ReviewTime"],"0008":["PN","1","ReviewerName"]},3010:{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","RadiobiologicalDoseEffectSequence"],"0002":["CS","1","RadiobiologicalDoseEffectFlag"],"0003":["SQ","1","EffectiveDoseCalculationMethodCategoryCodeSequence"],"0004":["SQ","1","EffectiveDoseCalculationMethodCodeSequence"],"0005":["LO","1","EffectiveDoseCalculationMethodDescription"],"0006":["UI","1","ConceptualVolumeUID"],"0007":["SQ","1","OriginatingSOPInstanceReferenceSequence"],"0008":["SQ","1","ConceptualVolumeConstituentSequence"],"0009":["SQ","1","EquivalentConceptualVolumeInstanceReferenceSequence"],"000A":["SQ","1","EquivalentConceptualVolumesSequence"],"000B":["UI","1","ReferencedConceptualVolumeUID"],"000C":["UT","1","ConceptualVolumeCombinationExpression"],"000D":["US","1","ConceptualVolumeConstituentIndex"],"000E":["CS","1","ConceptualVolumeCombinationFlag"],"000F":["ST","1","ConceptualVolumeCombinationDescription"],"0010":["CS","1","ConceptualVolumeSegmentationDefinedFlag"],"0011":["SQ","1","ConceptualVolumeSegmentationReferenceSequence"],"0012":["SQ","1","ConceptualVolumeConstituentSegmentationReferenceSequence"],"0013":["UI","1","ConstituentConceptualVolumeUID"],"0014":["SQ","1","DerivationConceptualVolumeSequence"],"0015":["UI","1","SourceConceptualVolumeUID"],"0016":["SQ","1","ConceptualVolumeDerivationAlgorithmSequence"],"0017":["ST","1","ConceptualVolumeDescription"],"0018":["SQ","1","SourceConceptualVolumeSequence"],"0019":["SQ","1","AuthorIdentificationSequence"],"001A":["LO","1","ManufacturerModelVersion"],"001B":["UC","1","DeviceAlternateIdentifier"],"001C":["CS","1","DeviceAlternateIdentifierType"],"001D":["LT","1","DeviceAlternateIdentifierFormat"],"001E":["LO","1","SegmentationCreationTemplateLabel"],"001F":["UI","1","SegmentationTemplateUID"],"0020":["US","1","ReferencedSegmentReferenceIndex"],"0021":["SQ","1","SegmentReferenceSequence"],"0022":["US","1","SegmentReferenceIndex"],"0023":["SQ","1","DirectSegmentReferenceSequence"],"0024":["SQ","1","CombinationSegmentReferenceSequence"],"0025":["SQ","1","ConceptualVolumeSequence"],"0026":["SQ","1","SegmentedRTAccessoryDeviceSequence"],"0027":["SQ","1","SegmentCharacteristicsSequence"],"0028":["SQ","1","RelatedSegmentCharacteristicsSequence"],"0029":["US","1","SegmentCharacteristicsPrecedence"],"002A":["SQ","1","RTSegmentAnnotationSequence"],"002B":["SQ","1","SegmentAnnotationCategoryCodeSequence"],"002C":["SQ","1","SegmentAnnotationTypeCodeSequence"],"002D":["LO","1","DeviceLabel"],"002E":["SQ","1","DeviceTypeCodeSequence"],"002F":["SQ","1","SegmentAnnotationTypeModifierCodeSequence"],"0030":["SQ","1","PatientEquipmentRelationshipCodeSequence"],"0031":["UI","1","ReferencedFiducialsUID"],"0032":["SQ","1","PatientTreatmentOrientationSequence"],"0033":["SH","1","UserContentLabel"],"0034":["LO","1","UserContentLongLabel"],"0035":["SH","1","EntityLabel"],"0036":["LO","1","EntityName"],"0037":["ST","1","EntityDescription"],"0038":["LO","1","EntityLongLabel"],"0039":["US","1","DeviceIndex"],"003A":["US","1","RTTreatmentPhaseIndex"],"003B":["UI","1","RTTreatmentPhaseUID"],"003C":["US","1","RTPrescriptionIndex"],"003D":["US","1","RTSegmentAnnotationIndex"],"003E":["US","1","BasisRTTreatmentPhaseIndex"],"003F":["US","1","RelatedRTTreatmentPhaseIndex"],"0040":["US","1","ReferencedRTTreatmentPhaseIndex"],"0041":["US","1","ReferencedRTPrescriptionIndex"],"0042":["US","1","ReferencedParentRTPrescriptionIndex"],"0043":["ST","1","ManufacturerDeviceIdentifier"],"0044":["SQ","1","InstanceLevelReferencedPerformedProcedureStepSequence"],"0045":["CS","1","RTTreatmentPhaseIntentPresenceFlag"],"0046":["CS","1","RadiotherapyTreatmentType"],"0047":["CS","1-n","TeletherapyRadiationType"],"0048":["CS","1-n","BrachytherapySourceType"],"0049":["SQ","1","ReferencedRTTreatmentPhaseSequence"],"004A":["SQ","1","ReferencedDirectSegmentInstanceSequence"],"004B":["SQ","1","IntendedRTTreatmentPhaseSequence"],"004C":["DA","1","IntendedPhaseStartDate"],"004D":["DA","1","IntendedPhaseEndDate"],"004E":["SQ","1","RTTreatmentPhaseIntervalSequence"],"004F":["CS","1","TemporalRelationshipIntervalAnchor"],"0050":["FD","1","MinimumNumberOfIntervalDays"],"0051":["FD","1","MaximumNumberOfIntervalDays"],"0052":["UI","1-n","PertinentSOPClassesInStudy"],"0053":["UI","1-n","PertinentSOPClassesInSeries"],"0054":["LO","1","RTPrescriptionLabel"],"0055":["SQ","1","RTPhysicianIntentPredecessorSequence"],"0056":["LO","1","RTTreatmentApproachLabel"],"0057":["SQ","1","RTPhysicianIntentSequence"],"0058":["US","1","RTPhysicianIntentIndex"],"0059":["CS","1","RTTreatmentIntentType"],"005A":["UT","1","RTPhysicianIntentNarrative"],"005B":["SQ","1","RTProtocolCodeSequence"],"005C":["ST","1","ReasonForSuperseding"],"005D":["SQ","1","RTDiagnosisCodeSequence"],"005E":["US","1","ReferencedRTPhysicianIntentIndex"],"005F":["SQ","1","RTPhysicianIntentInputInstanceSequence"],"0060":["SQ","1","RTAnatomicPrescriptionSequence"],"0061":["UT","1","PriorTreatmentDoseDescription"],"0062":["SQ","1","PriorTreatmentReferenceSequence"],"0063":["CS","1","DosimetricObjectiveEvaluationScope"],"0064":["SQ","1","TherapeuticRoleCategoryCodeSequence"],"0065":["SQ","1","TherapeuticRoleTypeCodeSequence"],"0066":["US","1","ConceptualVolumeOptimizationPrecedence"],"0067":["SQ","1","ConceptualVolumeCategoryCodeSequence"],"0068":["CS","1","ConceptualVolumeBlockingConstraint"],"0069":["SQ","1","ConceptualVolumeTypeCodeSequence"],"006A":["SQ","1","ConceptualVolumeTypeModifierCodeSequence"],"006B":["SQ","1","RTPrescriptionSequence"],"006C":["SQ","1","DosimetricObjectiveSequence"],"006D":["SQ","1","DosimetricObjectiveTypeCodeSequence"],"006E":["UI","1","DosimetricObjectiveUID"],"006F":["UI","1","ReferencedDosimetricObjectiveUID"],"0070":["SQ","1","DosimetricObjectiveParameterSequence"],"0071":["SQ","1","ReferencedDosimetricObjectivesSequence"],"0073":["CS","1","AbsoluteDosimetricObjectiveFlag"],"0074":["FD","1","DosimetricObjectiveWeight"],"0075":["CS","1","DosimetricObjectivePurpose"],"0076":["SQ","1","PlanningInputInformationSequence"],"0077":["LO","1","TreatmentSite"],"0078":["SQ","1","TreatmentSiteCodeSequence"],"0079":["SQ","1","FractionPatternSequence"],"007A":["UT","1","TreatmentTechniqueNotes"],"007B":["UT","1","PrescriptionNotes"],"007C":["IS","1","NumberOfIntervalFractions"],"007D":["US","1","NumberOfFractions"],"007E":["US","1","IntendedDeliveryDuration"],"007F":["UT","1","FractionationNotes"],"0080":["SQ","1","RTTreatmentTechniqueCodeSequence"],"0081":["SQ","1","PrescriptionNotesSequence"],"0082":["SQ","1","FractionBasedRelationshipSequence"],"0083":["CS","1","FractionBasedRelationshipIntervalAnchor"],"0084":["FD","1","MinimumHoursBetweenFractions"],"0085":["TM","1-n","IntendedFractionStartTime"],"0086":["LT","1","IntendedStartDayOfWeek"],"0087":["SQ","1","WeekdayFractionPatternSequence"],"0088":["SQ","1","DeliveryTimeStructureCodeSequence"],"0089":["SQ","1","TreatmentSiteModifierCodeSequence"],"0090":["CS","1","RoboticBaseLocationIndicator"],"0091":["SQ","1","RoboticPathNodeSetCodeSequence"],"0092":["UL","1","RoboticNodeIdentifier"],"0093":["FD","3","RTTreatmentSourceCoordinates"],"0094":["FD","1","RadiationSourceCoordinateSystemYawAngle"],"0095":["FD","1","RadiationSourceCoordinateSystemRollAngle"],"0096":["FD","1","RadiationSourceCoordinateSystemPitchAngle"],"0097":["SQ","1","RoboticPathControlPointSequence"],"0098":["SQ","1","TomotherapeuticControlPointSequence"],"0099":["FD","1-n","TomotherapeuticLeafOpenDurations"],"009A":["FD","1-n","TomotherapeuticLeafInitialClosedDurations"]},4e3:{"0000":["UL","1","GenericGroupLength"],"0010":["LT","1","Arbitrary"],4e3:["LT","1","TextComments"]},4008:{"0000":["UL","1","GenericGroupLength"],"0040":["SH","1","ResultsID"],"0042":["LO","1","ResultsIDIssuer"],"0050":["SQ","1","ReferencedInterpretationSequence"],"00FF":["CS","1","ReportProductionStatusTrial"],"0100":["DA","1","InterpretationRecordedDate"],"0101":["TM","1","InterpretationRecordedTime"],"0102":["PN","1","InterpretationRecorder"],"0103":["LO","1","ReferenceToRecordedSound"],"0108":["DA","1","InterpretationTranscriptionDate"],"0109":["TM","1","InterpretationTranscriptionTime"],"010A":["PN","1","InterpretationTranscriber"],"010B":["ST","1","InterpretationText"],"010C":["PN","1","InterpretationAuthor"],"0111":["SQ","1","InterpretationApproverSequence"],"0112":["DA","1","InterpretationApprovalDate"],"0113":["TM","1","InterpretationApprovalTime"],"0114":["PN","1","PhysicianApprovingInterpretation"],"0115":["LT","1","InterpretationDiagnosisDescription"],"0117":["SQ","1","InterpretationDiagnosisCodeSequence"],"0118":["SQ","1","ResultsDistributionListSequence"],"0119":["PN","1","DistributionName"],"011A":["LO","1","DistributionAddress"],"0200":["SH","1","InterpretationID"],"0202":["LO","1","InterpretationIDIssuer"],"0210":["CS","1","InterpretationTypeID"],"0212":["CS","1","InterpretationStatusID"],"0300":["ST","1","Impressions"],4e3:["ST","1","ResultsComments"]},4010:{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","LowEnergyDetectors"],"0002":["CS","1","HighEnergyDetectors"],"0004":["SQ","1","DetectorGeometrySequence"],1001:["SQ","1","ThreatROIVoxelSequence"],1004:["FL","3","ThreatROIBase"],1005:["FL","3","ThreatROIExtents"],1006:["OB","1","ThreatROIBitmap"],1007:["SH","1","RouteSegmentID"],1008:["CS","1","GantryType"],1009:["CS","1","OOIOwnerType"],"100A":["SQ","1","RouteSegmentSequence"],1010:["US","1","PotentialThreatObjectID"],1011:["SQ","1","ThreatSequence"],1012:["CS","1","ThreatCategory"],1013:["LT","1","ThreatCategoryDescription"],1014:["CS","1","ATDAbilityAssessment"],1015:["CS","1","ATDAssessmentFlag"],1016:["FL","1","ATDAssessmentProbability"],1017:["FL","1","Mass"],1018:["FL","1","Density"],1019:["FL","1","ZEffective"],"101A":["SH","1","BoardingPassID"],"101B":["FL","3","CenterOfMass"],"101C":["FL","3","CenterOfPTO"],"101D":["FL","6-n","BoundingPolygon"],"101E":["SH","1","RouteSegmentStartLocationID"],"101F":["SH","1","RouteSegmentEndLocationID"],1020:["CS","1","RouteSegmentLocationIDType"],1021:["CS","1-n","AbortReason"],1023:["FL","1","VolumeOfPTO"],1024:["CS","1","AbortFlag"],1025:["DT","1","RouteSegmentStartTime"],1026:["DT","1","RouteSegmentEndTime"],1027:["CS","1","TDRType"],1028:["CS","1","InternationalRouteSegment"],1029:["LO","1-n","ThreatDetectionAlgorithmAndVersion"],"102A":["SH","1","AssignedLocation"],"102B":["DT","1","AlarmDecisionTime"],1031:["CS","1","AlarmDecision"],1033:["US","1","NumberOfTotalObjects"],1034:["US","1","NumberOfAlarmObjects"],1037:["SQ","1","PTORepresentationSequence"],1038:["SQ","1","ATDAssessmentSequence"],1039:["CS","1","TIPType"],"103A":["CS","1","DICOSVersion"],1041:["DT","1","OOIOwnerCreationTime"],1042:["CS","1","OOIType"],1043:["FL","3","OOISize"],1044:["CS","1","AcquisitionStatus"],1045:["SQ","1","BasisMaterialsCodeSequence"],1046:["CS","1","PhantomType"],1047:["SQ","1","OOIOwnerSequence"],1048:["CS","1","ScanType"],1051:["LO","1","ItineraryID"],1052:["SH","1","ItineraryIDType"],1053:["LO","1","ItineraryIDAssigningAuthority"],1054:["SH","1","RouteID"],1055:["SH","1","RouteIDAssigningAuthority"],1056:["CS","1","InboundArrivalType"],1058:["SH","1","CarrierID"],1059:["CS","1","CarrierIDAssigningAuthority"],1060:["FL","3","SourceOrientation"],1061:["FL","3","SourcePosition"],1062:["FL","1","BeltHeight"],1064:["SQ","1","AlgorithmRoutingCodeSequence"],1067:["CS","1","TransportClassification"],1068:["LT","1","OOITypeDescriptor"],1069:["FL","1","TotalProcessingTime"],"106C":["OB","1","DetectorCalibrationData"],"106D":["CS","1","AdditionalScreeningPerformed"],"106E":["CS","1","AdditionalInspectionSelectionCriteria"],"106F":["SQ","1","AdditionalInspectionMethodSequence"],1070:["CS","1","AITDeviceType"],1071:["SQ","1","QRMeasurementsSequence"],1072:["SQ","1","TargetMaterialSequence"],1073:["FD","1","SNRThreshold"],1075:["DS","1","ImageScaleRepresentation"],1076:["SQ","1","ReferencedPTOSequence"],1077:["SQ","1","ReferencedTDRInstanceSequence"],1078:["ST","1","PTOLocationDescription"],1079:["SQ","1","AnomalyLocatorIndicatorSequence"],"107A":["FL","3","AnomalyLocatorIndicator"],"107B":["SQ","1","PTORegionSequence"],"107C":["CS","1","InspectionSelectionCriteria"],"107D":["SQ","1","SecondaryInspectionMethodSequence"],"107E":["DS","6","PRCSToRCSOrientation"]},"4FFE":{"0000":["UL","1","GenericGroupLength"],"0001":["SQ","1","MACParametersSequence"]},5e3:{"0000":["UL","1","GenericGroupLength"],"0005":["US","1","CurveDimensions"],"0010":["US","1","NumberOfPoints"],"0020":["CS","1","TypeOfData"],"0022":["LO","1","CurveDescription"],"0030":["SH","1-n","AxisUnits"],"0040":["SH","1-n","AxisLabels"],"0103":["US","1","DataValueRepresentation"],"0104":["US","1-n","MinimumCoordinateValue"],"0105":["US","1-n","MaximumCoordinateValue"],"0106":["SH","1-n","CurveRange"],"0110":["US","1-n","CurveDataDescriptor"],"0112":["US","1-n","CoordinateStartValue"],"0114":["US","1-n","CoordinateStepValue"],1001:["CS","1","CurveActivationLayer"],2e3:["US","1","AudioType"],2002:["US","1","AudioSampleFormat"],2004:["US","1","NumberOfChannels"],2006:["UL","1","NumberOfSamples"],2008:["UL","1","SampleRate"],"200A":["UL","1","TotalTime"],"200C":["ox","1","AudioSampleData"],"200E":["LT","1","AudioComments"],2500:["LO","1","CurveLabel"],2600:["SQ","1","CurveReferencedOverlaySequence"],2610:["US","1","CurveReferencedOverlayGroup"],3e3:["ox","1","CurveData"]},5200:{"0000":["UL","1","GenericGroupLength"],9229:["SQ","1","SharedFunctionalGroupsSequence"],9230:["SQ","1","PerFrameFunctionalGroupsSequence"]},5400:{"0000":["UL","1","GenericGroupLength"],"0100":["SQ","1","WaveformSequence"],"0110":["ox","1","ChannelMinimumValue"],"0112":["ox","1","ChannelMaximumValue"],1004:["US","1","WaveformBitsAllocated"],1006:["CS","1","WaveformSampleInterpretation"],"100A":["ox","1","WaveformPaddingValue"],1010:["ox","1","WaveformData"]},5600:{"0000":["UL","1","GenericGroupLength"],"0010":["OF","1","FirstOrderPhaseCorrectionAngle"],"0020":["OF","1","SpectroscopyData"]},6e3:{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","OverlayRows"],"0011":["US","1","OverlayColumns"],"0012":["US","1","OverlayPlanes"],"0015":["IS","1","NumberOfFramesInOverlay"],"0022":["LO","1","OverlayDescription"],"0040":["CS","1","OverlayType"],"0045":["LO","1","OverlaySubtype"],"0050":["SS","2","OverlayOrigin"],"0051":["US","1","ImageFrameOrigin"],"0052":["US","1","OverlayPlaneOrigin"],"0060":["CS","1","OverlayCompressionCode"],"0061":["SH","1","OverlayCompressionOriginator"],"0062":["SH","1","OverlayCompressionLabel"],"0063":["CS","1","OverlayCompressionDescription"],"0066":["AT","1-n","OverlayCompressionStepPointers"],"0068":["US","1","OverlayRepeatInterval"],"0069":["US","1","OverlayBitsGrouped"],"0100":["US","1","OverlayBitsAllocated"],"0102":["US","1","OverlayBitPosition"],"0110":["CS","1","OverlayFormat"],"0200":["US","1","OverlayLocation"],"0800":["CS","1-n","OverlayCodeLabel"],"0802":["US","1","OverlayNumberOfTables"],"0803":["AT","1-n","OverlayCodeTableLocation"],"0804":["US","1","OverlayBitsForCodeWord"],1001:["CS","1","OverlayActivationLayer"],1100:["US","1","OverlayDescriptorGray"],1101:["US","1","OverlayDescriptorRed"],1102:["US","1","OverlayDescriptorGreen"],1103:["US","1","OverlayDescriptorBlue"],1200:["US","1-n","OverlaysGray"],1201:["US","1-n","OverlaysRed"],1202:["US","1-n","OverlaysGreen"],1203:["US","1-n","OverlaysBlue"],1301:["IS","1","ROIArea"],1302:["DS","1","ROIMean"],1303:["DS","1","ROIStandardDeviation"],1500:["LO","1","OverlayLabel"],3e3:["ox","1","OverlayData"],4e3:["LT","1","OverlayComments"]},"7F00":{"0000":["UL","1","GenericGroupLength"],"0010":["ox","1","VariablePixelData"],"0011":["US","1","VariableNextDataGroup"],"0020":["OW","1","VariableCoefficientsSDVN"],"0030":["OW","1","VariableCoefficientsSDHN"],"0040":["OW","1","VariableCoefficientsSDDN"]},"7FE0":{"0000":["UL","1","GenericGroupLength"],"0001":["OV","1","ExtendedOffsetTable"],"0002":["OV","1","ExtendedOffsetTableLengths"],"0008":["OF","1","FloatPixelData"],"0009":["OD","1","DoubleFloatPixelData"],"0010":["ox","1","PixelData"],"0020":["OW","1","CoefficientsSDVN"],"0030":["OW","1","CoefficientsSDHN"],"0040":["OW","1","CoefficientsSDDN"]},FFFA:{"0000":["UL","1","GenericGroupLength"],FFFA:["SQ","1","DigitalSignaturesSequence"]},FFFC:{"0000":["UL","1","GenericGroupLength"],FFFC:["OB","1","DataSetTrailingPadding"]},FFFE:{"0000":["UL","1","GenericGroupLength"],E000:["NONE","1","Item"],E00D:["NONE","1","ItemDelimitationItem"],E0DD:["NONE","1","SequenceDelimitationItem"]}};function E(e,t){x[e]=t}const R={"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"},F={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 M(e){return void 0!==F[e]}const q={SH:!0,LO:!0,UC:!0,ST:!0,LT:!0,UT:!0,PN:!0};function U(e){return void 0!==q[e]}const Q={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"},V={"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)"},N="1.2.840.10008.1.2",B="1.2.840.10008.1.2.1",k="1.2.840.10008.1.2.2";class G{#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.getKey()}: ${this.getNameFromDictionary()}`}equals(e){return null!=e&&this.#a===e.getGroup()&&this.#s===e.getElement()}getKey(){return this.#a+this.#s}getGroupName(){return R[this.#a]}isWithVR(){return!("FFFE"===this.#a&&("E000"===this.#s||"E00D"===this.#s||"E0DD"===this.#s))}isPrivate(){return parseInt(this.#a,16)%2==1}#l(){let e;return void 0!==x[this.#a]&&void 0!==x[this.#a][this.#s]&&(e=x[this.#a][this.#s]),e}getVrFromDictionary(){let e;const t=this.#l();return void 0!==t&&(e=t[0]),e}getMultiplicityFromDictionary(){let e;const t=this.#l();return void 0!==t&&(e=parseInt(t[1],10)),e}getNameFromDictionary(){let e;const t=this.#l();return void 0!==t&&(e=t[2]),e}}function z(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 H(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 G(e.substring(0,4),e.substring(4,8))}function Y(){return new G("FFFE","E000")}function X(e){return"FFFEE000"===e.getKey()}function W(e){return"FFFEE00D"===e.getKey()}function $(e){return"FFFEE0DD"===e.getKey()}function j(){return new G("7FE0","0010")}function Z(e){return["7FE00010","7FE00009","7FE00008"].includes(e.getKey())}function _(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 K(e){return void 0!==_(e)}function J(e){if(null==e)return null;let t=null,n=null;const i=x,o=Object.keys(i);let r,a,s=!1;for(let a=0,l=o.length;a<l;++a){t=o[a],r=Object.keys(i[t]);for(let o=0,a=r.length;o<a;++o)if(n=r[o],i[t][n][2]===e){s=!0;break}if(s)break}return s&&(a=new G(t,n)),a}function ee(e){return function(t,n){if("mergeId"===n)return t;const i=H(n);let o=i.getNameFromDictionary();void 0===o&&(o=`x${i.getKey()}`);const r=e[n];for(const e in r)void 0===r[e]&&delete r[e];let a;if("SQ"===r.vr){a={value:[]};for(let e=0;e<r.value.length;++e){const t=r.value[e];a.value.push(Object.keys(t).reduce(ee(t),{}))}}else a=1===r.value.length?r.value[0]:r.value;return t[o]=a,t}}function te(e){const t=structuredClone(e);return Object.keys(t).reduce(ee(t),{})}class ne{vr;value;tag;vl;undefinedLength;startOffset;endOffset;items;constructor(e){this.vr=e}}function ie(e){return void 0!==e&&void 0!==e.value&&0!==e.value.length}function oe(e,t){let n;return ie(e[t])&&(n=e[t].value[0]),n}function re(e,t){let n;return ie(e[t])&&(n=e[t].value),n}function ae(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 se(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 le{#c;#u=!0;#d=function(){return new Int8Array(new Int16Array([1]).buffer)[0]>0}();#h;#g;constructor(e,t){this.#c=e,void 0!==t&&(this.#u=t),this.#h=this.#u!==this.#d,this.#g=new DataView(e)}readUint16(e){return this.#g.getUint16(e,this.#u)}readInt16(e){return this.#g.getInt16(e,this.#u)}readUint32(e){return this.#g.getUint32(e,this.#u)}readBigUint64(e){return this.#g.getBigUint64(e,this.#u)}readInt32(e){return this.#g.getInt32(e,this.#u)}readBigInt64(e){return this.#g.getBigInt64(e,this.#u)}readFloat32(e){return this.#g.getFloat32(e,this.#u)}readFloat64(e){return this.#g.getFloat64(e,this.#u)}readBinaryArray(e,t,n){const i=new Uint8Array(this.#c,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.#c,e,t)}readInt8Array(e,t){return new Int8Array(this.#c,e,t)}readUint16Array(e,t){const n=Uint16Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n==0)o=new Uint16Array(this.#c,e,i),this.#h&&se(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.#c,e,i),this.#h&&se(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.#c,e,i),this.#h&&se(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.#c,e,i),this.#h&&se(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.#c,e,i),this.#h&&se(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.#c,e,i),this.#h&&se(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.#c,e,i),this.#h&&se(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.#c,e,i),this.#h&&se(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 ce(){return"0.37.0-beta.9"}function ue(e){const t=e.split("-");let n=[];for(const e of t)n=n.concat(e.split("."));return n}function de(e,t){let n=0;const i=ue(e),o=ue(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 he(e){return!(e.byteLength<132)&&"DICM"===new Uint8Array(e,128,4).reduce((function(e,t){return e+String.fromCharCode(t)}),"")}const ge=String.fromCharCode("u200B");class Se{decode(e){let t="";for(let n=0,i=e.length;n<i;++n)t+=String.fromCharCode(e[n]);return t}}function pe(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 me(e){return e===N}function fe(e){return e===k}function ve(e){return"1.2.840.10008.1.2.4.50"===e||"1.2.840.10008.1.2.4.51"===e}function Ce(e){return"1.2.840.10008.1.2.4.57"===e||"1.2.840.10008.1.2.4.70"===e}function De(e){return null!==e.match(/1.2.840.10008.1.2.4.9/)}function ye(e){return"1.2.840.10008.1.2.5"===e}function Ie(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));r.error(`Cannot allocate array of size: ${n} (>2^${e}).`)}}return i}function we(e,t){return t?8:M(e)?12:8}const Te="00280100",Le="00280103";class Pe{#S={};#p;#m=new Se;#f=this.#m;#v(e){return this.#m.decode(e)}#C(e){return this.#f.decode(e)}getDefaultCharacterSet(){return this.#p}setDefaultCharacterSet(e){this.#p=e}setDecoderCharacterSet(e){this.#f=new TextDecoder(e)}getDicomElements(){return this.#S}safeGet(e){return oe(this.#S,e)}#D(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 G(n,i),endOffset:t}}#y(e,t,n){const i={};let o=this.#I(e,t,n);if(t=o.endOffset,$(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.#I(e,t,n),t=o.endOffset,r=W(o.tag),r||(i[o.tag.getKey()]=o)}else{const r=t;for(t-=o.vl;t<r;)o=this.#I(e,t,n),t=o.endOffset,i[o.tag.getKey()]=o}return{data:i,endOffset:t,isSeqDelim:!1}}#w(e,t,n){const i=[];let o=this.#I(e,t,n);const r=o.vl;t=o.endOffset;let a=!1;for(;!a;)o=this.#I(e,t,n),t=o.endOffset,a=$(o.tag),a||(o.vr="OB",i.push(o));return{data:i,endOffset:t,offsetTableVl:r}}#I(e,t,n,i){const o=this.#D(e,t),a=o.tag;if(void 0!==i&&a.equals(i)){const e=new ne("");return e.tag=a,e}t=o.endOffset;let s,l="NONE",c=!0;a.isWithVR()&&(n?(l=a.getVrFromDictionary(),void 0===l&&(l="UN"),c=!0):(l=this.#v(e.readUint8Array(t,2)),t+=2*Uint8Array.BYTES_PER_ELEMENT,c=M(l),c&&(t+=2*Uint8Array.BYTES_PER_ELEMENT))),function(e){return Object.keys(Q).concat(["NONE","ox","xx","xs"]).includes(e)}(l)||(r.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(Z(a)&&u){const i=this.#w(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.#y(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.#y(e,t,n),d.push(i.data),t=i.endOffset;g=t,s=t-h}}const S=new ne(l);return S.tag=a,S.vl=s,S.startOffset=h,S.endOffset=g,u&&(S.undefinedLength=u),d&&(S.items=d),S}#T(e,t,n){const i=e.tag,o=e.vl,a=e.vr,s=e.startOffset;let l,c,u;void 0!==n&&(l=n.bitsAllocated,c=n.pixelRepresentation);const d=Q[a];if(Z(i))if(e.undefinedLength){u=[];for(let i=0;i<e.items.length;++i)u.push(this.#T(e.items[i],t,n));delete e.items}else if(l>8&&"OB"===a&&(r.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,o,n.imageBufferSize));else if(8===l)0===c?u.push(t.readUint8Array(s,o)):u.push(t.readInt8Array(s,o));else if(16===l)0===c?u.push(t.readUint16Array(s,o)):u.push(t.readInt16Array(s,o));else if(32===l)u.push(t.readFloat32Array(s,o));else{if(64!==l)throw new Error(`Unsupported bits allocated: ${l}`);u.push(t.readFloat64Array(s,o))}else if(void 0!==d)if("Uint8"===d)u=t.readUint8Array(s,o);else if("Uint16"===d)u=t.readUint16Array(s,o),"O"!==a[0]&&(u=Array.from(u));else if("Uint32"===d)u=t.readUint32Array(s,o),"O"!==a[0]&&(u=Array.from(u));else if("Uint64"===d)u=t.readUint64Array(s,o);else if("Int16"===d)u=Array.from(t.readInt16Array(s,o));else if("Int32"===d)u=Array.from(t.readInt32Array(s,o));else if("Int64"===d)u=t.readInt64Array(s,o);else if("Float32"===d)u=Array.from(t.readFloat32Array(s,o));else if("Float64"===d)u=Array.from(t.readFloat64Array(s,o));else{if("string"!==d)throw new Error(`Unknown VR type: ${d}`);{const e=t.readUint8Array(s,o);u=U(a)?this.#C(e):this.#v(e),u=function(e){let t=e;const n=e.length-1;return e[n]===ge&&(t=e.substring(0,n)),t=t.trim(),t}(u).split("\\")}}else if("xx"===a)u=Array.from(t.readUint16Array(s,o));else if("ox"===a)u=8===l?0===c?Array.from(t.readUint8Array(s,o)):Array.from(t.readInt8Array(s,o)):0===c?Array.from(t.readUint16Array(s,o)):Array.from(t.readInt16Array(s,o));else if("xs"===a)u=0===c?Array.from(t.readUint16Array(s,o)):Array.from(t.readInt16Array(s,o));else if("AT"===a){const e=t.readUint16Array(s,o);u=[];for(let t=0,n=e.length;t<n;t+=2){const n=e[t].toString(16),i=e[t+1].toString(16);let o="(";o+="0000".substring(0,4-n.length)+n.toUpperCase(),o+=",",o+="0000".substring(0,4-i.length)+i.toUpperCase(),o+=")",u.push(o)}}else if("SQ"===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[Te];void 0!==n&&void 0!==n.value&&(a=n.value[0]),n=i[Le],void 0!==n&&void 0!==n.value&&(s=n.value[0]);const l={bitsAllocated:a,pixelRepresentation:s},c=i[r[e]];c.value=this.#T(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||r.warn(`Unknown VR: ${a} (for tag ${e.tag.getKey()})`),u=[];return u}#L(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.#T(r,t,n)),delete r.tag,delete r.vl,delete r.startOffset,delete r.endOffset}}parse(e,t){let n,i,o;const a=new le(e);let s=new le(e);n=128;const l=this.#v(a.readUint8Array(n,4));if(n+=4*Uint8Array.BYTES_PER_ELEMENT,"DICM"===l){o=this.#I(a,n,!1),o.value=this.#T(o,a),n=o.endOffset,this.#S[o.tag.getKey()]=o;const e=n+o.value[0];for(;n<e;)o=this.#I(a,n,!1),n=o.endOffset,this.#S[o.tag.getKey()]=o;if(o=this.#S["00020010"],void 0===o)throw new Error("Not a valid DICOM file (no TransferSyntaxUID found)");o.value=this.#T(o,a),i=o.value[0]}else{r.warn(`Invalid DICM prefix (${l}), trying to guess tansfer syntax.`),o=this.#I(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?N:B;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 ne("UI");return l.tag=new G("0002","0010"),l.value=[s],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(o);this.#S[e.tag.getKey()]=e,i=e.value[0],n=0}if(!function(e){return e===N||e===B||e===k||ve(e)||Ce(e)||De(e)||ye(e)}(i))throw new Error(`Unsupported DICOM transfer syntax: '${i}' (${function(e){let t="Unknown";return void 0!==V[e]&&(t=V[e]),t}(i)})`);let c=!1;me(i)&&(c=!0),fe(i)&&(s=new le(e,!1));let u,d=!1;for(;n<e.byteLength;){if(o=this.#I(s,n,c,t),void 0!==t&&o.tag.equals(t)){d=!0;break}n=o.endOffset;const e=o.tag.getKey();void 0===this.#S[e]?this.#S[e]=o:r.warn(`Not saving duplicate tag: ${e}`)}if(isNaN(n))throw new Error("Problem while parsing, bad offset");if(d||e.byteLength===n||r.warn(`Did not reach the end of the buffer: ${n} != ${e.byteLength}`),K(this.#S)){let e=0;o=this.#S[Le],void 0!==o?(o.value=this.#T(o,s),e=o.value[0]):r.warn("Reading DICOM pixel data with default pixelRepresentation.");let t=16;o=this.#S[Te],void 0!==o?(o.value=this.#T(o,s),t=o.value[0]):r.warn("Reading DICOM pixel data with default bitsAllocated.");let n,i,a=1;o=this.#S["00280008"],void 0!==o&&(o.value=this.#T(o,s),a=parseInt(o.value[0],10)),u={pixelRepresentation:e,bitsAllocated:t,numberOfFrames:a,imageBufferSize:void 0},o=this.#S["00280010"],void 0!==o&&(o.value=this.#T(o,s),n=parseInt(o.value[0],10)),o=this.#S["00280011"],void 0!==o&&(o.value=this.#T(o,s),i=parseInt(o.value[0],10)),void 0!==n&&void 0!==i&&(u.imageBufferSize=n*i*a)}if(void 0!==this.#p&&this.setDecoderCharacterSet(this.#p),o=this.#S["00080005"],void 0!==o){let e;o.value=this.#T(o,s),1===o.value.length?e=o.value[0]:(e=o.value[1],r.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.#L(this.#S,s,u),o=this.#S["7FE00010"],void 0!==o&&o.undefinedLength){const e=u.numberOfFrames,t=o.value;if(t.length>1&&t.length>e){const n=t.length/e,i=[];let r;for(let o=0;o<e;++o){r=o*n;let e=0;for(let i=0;i<n;++i)e+=t[r+i].length;const a=new t[0].constructor(e);let s=0;for(let e=0;e<n;++e)a.set(t[r+e],s),s+=t[r+e].length;i[o]=a}o.value=i}}}}function Ae(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 Oe(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function be(e,t,n,i){const r=e.getGeometry().getSize();let a=2;i&&void 0!==i&&(a=i.getColAbsMax(2).index);const s=t.getValues(),l=new o(s.map((function(e,t){return t===a||t>2?e:0})));let c,u=r.indexToOffset(l);void 0===n&&(n=!1),c=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const d=r.get(0),h=r.get(1),g=r.get(2);let S=r.getDimSize(2);const p=e.getNumberOfComponents(),m=1===e.getPlanarConfiguration(),f=function(e,t,n,i,o,r,a,s){return 1===p?Ae(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(Ae(e,t,n,i,o,r,a,s)),c.push(Ae(e,t+n*i,n,i,o,r,a,s)),c.push(Ae(e,t+2*n*i,n,i,o,r,a,s))):(i*=3,r*=3,c.push(Ae(e,t,n,i,o,r,a,s)),c.push(Ae(e,t+1,n,i,o,r,a,s)),c.push(Ae(e,t+2,n,i,o,r,a,s))),{next(){const e=c[0].next(),t=c[1].next(),n=c[2].next();return e.done?{done:!0,index:n.index}:{value:[e.value,t.value,n.value],done:!1,index:[e.index,t.index,n.index]}}}}(e,3*t,n,i,o,r,a,s,m):void 0};let v;if(i&&void 0!==i){const e=i.getColAbsMax(0),t=i.getColAbsMax(2),n=!1,o=!1;if(2===t.index){const t=d*h;v=0===e.index?f(c,u,t,1,d,d,n,o):f(c,u,t,d,h,1,n,o)}else if(0===t.index){const t=g*h;v=1===e.index?f(c,u,t,d,h,S,n,o):f(c,u,t,S,g,d,n,o)}else{if(1!==t.index)throw new Error(`Unknown direction: ${t.index}`);{const t=g*d;v=0===e.index?f(c,u,t,1,d,S,n,o):f(c,u,t,S,g,1,n,o)}}}else if(1===e.getNumberOfComponents())v=function(e,t,n,i){void 0===i&&(i=1);let o=t;return{next(){if(o<n){const t={value:e(o),done:!1,index:o};return o+=i,t}return{done:!0,index:n}}}}(c,u,u+S);else{if(3!==e.getNumberOfComponents())throw new Error(`Unsupported number of components: ${e.getNumberOfComponents()}`);u*=3,S*=3,v=function(e,t,n,i,o){void 0===i&&(i=1),void 0===o&&(o=!1);let r=t,a=1;o?a=(n-t)/3:i*=3;let s=r+a,l=r+2*a;return{next(){if(r<n){const t={value:[e(r),e(s),e(l)],done:!1,index:[r,s,l]};return r+=i,s+=i,l+=i,t}return{done:!0,index:[n]}}}}(c,u,u+S,1,m)}return v}function xe(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 Ee{#P;#A;constructor(e,t){this.#P=e,this.#A=t}getSlope(){return this.#P}getIntercept(){return this.#A}apply(e){return e*this.#P+this.#A}equals(e){return null!=e&&this.getSlope()===e.getSlope()&&this.getIntercept()===e.getIntercept()}isID(){return 1===this.getSlope()&&0===this.getIntercept()}}class Re{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create size with no values.");if(0===e.length)throw new Error("Cannot create size with empty values.");if(!e.every((function(e){return!isNaN(e)&&0!==e})))throw new Error("Cannot create size with non number or zero values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return`(${this.#e.toString()})`}getValues(){return this.#e.slice()}moreThanOne(e){return this.length()>=e+1&&1!==this.get(e)}canScroll3D(e){let t=2;return void 0!==e&&(t=e.getThirdColMajorDirection()),this.moreThanOne(t)}canScroll(e){let t=this.canScroll3D(e);for(let e=3;e<this.length();++e)t=t||this.moreThanOne(e);return t}getDimSize(e,t){if(e>this.length())return null;if(void 0===t)t=0;else if(t<0||t>e)throw new Error("Invalid start value for getDimSize");let n=1;for(let i=t;i<e;++i)n*=this.get(i);return n}getTotalSize(e){return this.getDimSize(this.length(),e)}equals(e){if(!e)return!1;const t=this.length();if(t!==e.length())return!1;for(let n=0;n<t;++n)if(this.get(n)!==e.get(n))return!1;return!0}isInBounds(e,t){if(!e)return!1;const n=this.length();if(n!==e.length())return!1;if(void 0===t){t=[];for(let e=0;e<n;++e)t.push(e)}else for(let e=0;e<n;++e)if(t[e]>n-1)throw new Error(`Wrong input dir value: ${t[e]}`);for(let n=0;n<t.length;++n)if(i=e.get(t[n]),o=this.get(t[n]),!(i>=0&&i<o))return!1;var i,o;return!0}indexToOffset(e,t){if(e.length()>this.length())throw new Error("Incompatible index and size length");if(void 0===t)t=0;else if(t<0||t>this.length()-1)throw new Error("Invalid start value for indexToOffset");let n=0;for(let i=t;i<e.length();++i){const o=this.get(i),r=e.get(i);if(r>=o||r<0)return-1;n+=r*this.getDimSize(i,t)}return n}offsetToIndex(e){const t=new Array(this.length());let n,i=e;for(let e=this.length()-1;e>0;--e)n=this.getDimSize(e),t[e]=Math.floor(i/n),i-=t[e]*n;return t[0]=i,new o(t)}get2D(){return{x:this.get(0),y:this.get(1)}}#O(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.#O(e.getValues(),n);return new m(i)}normaliseIndex(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#O(e.getValues(),n);return new o(i)}}class Fe{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create spacing with no values.");if(0===e.length)throw new Error("Cannot create spacing with empty values.");if(!e.every((function(e){return!isNaN(e)&&0!==e})))throw new Error("Cannot create spacing with non number or zero values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return`(${this.#e.toString()})`}getValues(){return this.#e.slice()}equals(e){if(!e)return!1;const t=this.length();if(t!==e.length())return!1;for(let n=0;n<t;++n)if(this.get(n)!==e.get(n))return!1;return!0}get2D(){return{x:this.get(0),y:this.get(1)}}}class Me{#e;#b;constructor(e){this.#e=e}get(e,t){return this.#e[3*e+t]}getInverse(){return void 0===this.#b&&(this.#b=function(e){const t=e.get(0,0),n=e.get(0,1),i=e.get(0,2),o=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-o*u,g=o*c-a*l;let S=t*d+n*h+i*g;if(0!==S)return S=1/S,new Me([S*d,S*(i*c-n*u),S*(n*s-i*a),S*h,S*(t*u-i*l),S*(i*o-t*s),S*g,S*(n*l-t*c),S*(t*a-n*o)]);r.warn("Cannot invert 3*3 matrix with zero determinant.")}(this)),this.#b}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(!c(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=u(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&&r.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 Me(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 Me(e)}multiplyArray3D(e){if(3!==e.length)throw new Error(`Cannot multiply 3x3 matrix with non 3D array: ${e.length}`);const t=e[0],n=e[1],i=e[2],o=new Array(3);return o[0]=this.#e[0]*t+this.#e[1]*n+this.#e[2]*i,o[1]=this.#e[3]*t+this.#e[4]*n+this.#e[5]*i,o[2]=this.#e[6]*t+this.#e[7]*n+this.#e[8]*i,o}multiplyTypedArray3D(e,t){const n=e[0],i=e[1],o=e[2];t[0]=this.#e[0]*n+this.#e[1]*i+this.#e[2]*o,t[1]=this.#e[3]*n+this.#e[4]*i+this.#e[5]*o,t[2]=this.#e[6]*n+this.#e[7]*i+this.#e[8]*o}multiplyVector3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new g(t[0],t[1],t[2])}multiplyPoint3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new p(t[0],t[1],t[2])}multiplyIndex3D(e){const t=this.multiplyArray3D(e.getValues());return new o(t)}getRowAbsMax(e){const t=[Math.abs(this.get(e,0)),Math.abs(this.get(e,1)),Math.abs(this.get(e,2))],n=Math.max.apply(null,t),i=t.indexOf(n);return{value:this.get(e,i),index:i}}getColAbsMax(e){const t=[Math.abs(this.get(0,e)),Math.abs(this.get(1,e)),Math.abs(this.get(2,e))],n=Math.max.apply(null,t),i=t.indexOf(n);return{value:this.get(i,e),index:i}}asOneAndZeros(){const e=[];for(let t=0;t<3;++t){const n=this.getRowAbsMax(t),i=n.value>0?1:-1;for(let t=0;t<3;++t)t===n.index?e.push(i):e.push(0)}return new Me(e)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}getValues(){return this.#e.slice()}}function qe(){return new Me([1,0,0,0,1,0,0,0,1])}function Ue(e){return e.equals(qe())}class Qe{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 Ve(e,t){return function(e){return null!=e&&(e.includes("median")||e.includes("p25")||e.includes("p75"))}(t)?function(e){const t=Ne(e);return e.sort((function(e,t){return e-t})),t.median=Be(e,.5),t.p25=Be(e,.25),t.p75=Be(e,.75),t}(e):Ne(e)}function Ne(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 Qe(t,n,a,l)}function Be(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 ke=1e-6;class Ge{#x;#E;#R;#F={};#M;#q=qe();constructor(e,t,n,i,o){this.#x=e,this.#E=t,this.#R=n,void 0!==o&&(this.#M=o,this.#F[o]=e.slice()),void 0!==i&&(this.#q=i)}clone(){return new Ge(this.#x.slice(),new Re(this.#E.getValues()),new Fe(this.#R.getValues()),new Me(this.#q.getValues()),this.#M)}getInitialTime(){return this.#M}setInitialTime(e){void 0!==this.#F[this.#M]&&delete this.#F[this.#M],this.#M=e,this.#F[e]=this.#x.slice()}getCurrentTotalNumberOfSlices(){const e=Object.keys(this.#F);if(0===e.length)return this.#x.length;let t=0;for(let n=0;n<e.length;++n)t+=this.#F[e[n]].length;return t}hasSlicesAtTime(e){return void 0!==this.#F[e]}getCurrentNumberOfSlicesBeforeTime(e){const t=Object.keys(this.#F);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.#F[o].length}return n}getOrigin(){return this.#x[0]}getOrigins(){return this.#x}includesOrigin(e,t){for(let n=0;n<this.#x.length;++n)if(this.#x[n].isSimilar(e,t))return!0;return!1}getSize(e){let t=this.#E;if(e&&void 0!==e){let n=ze([this.#E.get(0),this.#E.get(1),this.#E.get(2)],e);n=n.map(Math.abs),t=new Re(n.concat(this.#E.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=Ne(t),i=h(n.mean,4);return n.stdDev>1e-4&&r.warn(`Varying slice spacing, value: ${i} (mean: ${n.mean}, min: ${n.min}, max: ${n.max}, stdDev: ${n.stdDev})`),i}(this.#x);if(void 0!==e){1!==this.#R.get(2)&&this.#R.get(2)!==e&&r.debug(`Using geometric spacing ${e} instead of tag spacing ${this.#R.get(2)}`);const t=this.#R.getValues();t[2]=e,this.#R=new Fe(t)}}getSpacing(e){let t=this.#R;if(e&&void 0!==e){let n=ze([this.#R.get(0),this.#R.get(1),this.#R.get(2)],e);n=n.map(Math.abs),t=new Fe(n)}return t}getRealSpacing(){return this.getSpacing(this.#q.getInverse().asOneAndZeros())}getOrientation(){return this.#q}getSliceIndex(e,t){let n=this.#x;void 0!==t&&(n=this.#F[t]);const i=e.getClosest(n),o=n[i],r=e.minus(o);return new g(this.#q.get(0,2),this.#q.get(1,2),this.#q.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(),ke))return{success:!1,message:"Cannot append a slice with different orientation"};const i=this.canAppendOrigin(e.getOrigin(),e.getInitialTime());return i.success?new a(!0):i}canAppendOrigin(e,t){const n=function(t){return t.equals(e)};if(void 0!==t&&t!==this.#M){if(void 0!==this.#F[t]&&void 0!==this.#F[t].find(n))return{success:!1,message:"Cannot append same time origin twice"}}else if(void 0!==this.#x.find(n))return{success:!1,message:"Cannot append same origin twice"};return new a(!0)}appendOrigin(e,t,n){const i=this.canAppendOrigin(e,n);if(!i.success)throw new Error(i.message);if(void 0!==n&&this.#F[n].splice(t,0,e),void 0===n||n===this.#M){this.#x.splice(t,0,e);const n=this.#E.getValues();n[2]+=1,this.#E=new Re(n)}}appendFrame(e,t){this.#F[t]=[e];const n=this.#E.getValues(),i=this.#R.getValues();4===n.length?n[3]+=1:(n.push(2),i.push(1)),this.#E=new Re(n),this.#R=new Fe(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 o(t),i=new o(this.getSize().getValues());return[this.indexToWorld(n),this.indexToWorld(i)]}indexToWorld(e){const t=this.getSpacing(),n=new p(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 p(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 p(o.getX()+i.getX(),o.getY()+i.getY(),o.getZ()+i.getZ())}worldToIndex(e){const t=this.getOrigin(),n=new p(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),i=this.getOrientation().getInverse().multiplyPoint3D(n),r=e.getValues(),a=this.getSpacing();return r[0]=Math.floor(h(i.getX()/a.get(0),5)),r[1]=Math.floor(h(i.getY()/a.get(1),5)),r[2]=Math.floor(h(i.getZ()/a.get(2),5)),new o(r)}worldToPoint(e){const t=this.getOrigin(),n=new p(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 p(o[0],o[1],o[2])}}function ze(e,t){return t.getInverse().multiplyArray3D(e)}function He(e,t){return t.multiplyArray3D(e)}const Ye={linear:"LINEAR",linear_exact:"LINEAR_EXACT",sigmoid:"SIGMOID"};class Xe{#U;#Q;#V=0;#N=255;#P;#A;constructor(e,t,n){void 0===n&&(n=!1);let i=e,o=t;n||(i-=.5,o-=1),this.#U=i-o/2,this.#Q=i+o/2,this.#P=(this.#N-this.#V)/o,this.#A=(-i/o+.5)*(this.#N-this.#V)+this.#V}getY(e){let t;return t=e<=this.#U?this.#V:e>this.#Q?this.#N:e*this.#P+this.#A,t}}class We{#V=0;#N=255;#B;#k;constructor(e,t){this.#B=e,this.#k=t}getY(e){return(this.#N-this.#V)/(1+Math.exp(-4*(e-this.#B)/this.#k))+this.#V}}class $e{#G;#z=0;#H;#Y=Ye.linear;constructor(e,t){if(this.#G=e,void 0!==t){const e=[];for(const t in Ye)e.push(Ye[t]);e.includes(t)?this.#Y=t:r.debug(`Unknown VOI LUT function: ${t}`)}this.#X()}getWindowLevel(){return this.#G}#X(){const e=this.#G.center,t=this.#G.width,n=e+this.#z;this.#Y===Ye.linear_exact?this.#H=new Xe(n,t,!0):this.#Y===Ye.sigmoid?this.#H=new We(n,t):this.#H=new Xe(n,t)}setSignedOffset(e){this.#z=e,this.#X()}apply(e){return this.#H.getY(e)}}class je{center;width;constructor(e,t){this.center=e,this.width=t}}function Ze(e,t){return null!=e&&null!=t&&e.center===t.center&&e.width===t.width}function _e(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!==Ye.linear_exact&&n!==Ye.sigmoid||(o=0);let r=e.width;return r=Math.max(r,o),r=Math.min(r,t.max-t.min),new je(i,r)}class Ke{name;wl;perslice;constructor(e,t,n){this.name=e,this.wl=t,this.perslice=n}}function Je(e){const t=[];for(let n=0;n<256;++n)t.push(e(n));return t}function et(e){return e}function tt(e){return 255-e}class nt{red;green;blue;constructor(e,t,n){this.red=e,this.green=t,this.blue=n}}const it={plain:{red:Je(et),green:Je(et),blue:Je(et)},invPlain:{red:Je(tt),green:Je(tt),blue:Je(tt)},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:Je((function(e){const t=3*e;return t>255?255:t})),green:Je((function(e){const t=256/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n})),blue:Je((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]}},ot={wlPresets:void 0,labelTexts:void 0,privateBValueRules:void 0,openRoiDialog:void 0,getVolumeIdTagValue:void 0,getPostLoadVolumeIdTagValue:void 0,postLoadVolumeIdCandidates:void 0,getTagPixelUnit:void 0};function rt(){return new Me([1,0,0,0,0,1,0,-1,0])}const at={Axial:"axial",Coronal:"coronal",Sagittal:"sagittal"};function st(e){let t;return e===at.Axial?t=qe():e===at.Coronal?t=rt():e===at.Sagittal&&(t=new Me([0,0,-1,1,0,0,0,-1,0])),t}function lt(e){const t=new g(e.get(0,0),e.get(1,0),e.get(2,0)),n=new g(e.get(0,1),e.get(1,1),e.get(2,1)),i=new g(e.get(0,2),e.get(1,2),e.get(2,2));return ct(t)+ct(n)+ct(i)}function ct(e){let t=new g(Math.abs(e.getX()),Math.abs(e.getY()),Math.abs(e.getZ())),n="";const i=e.getX()<0?"R":"L",o=e.getY()<0?"A":"P",r=e.getZ()<0?"I":"S",a=1e-4;for(let e=0;e<3;e++)if(t.getX()>a&&t.getX()>t.getY()&&t.getX()>t.getZ())n+=i,t=new g(0,t.getY(),t.getZ());else if(t.getY()>a&&t.getY()>t.getX()&&t.getY()>t.getZ())n+=o,t=new g(t.getX(),0,t.getZ());else{if(!(t.getZ()>a&&t.getZ()>t.getX()&&t.getZ()>t.getY()))break;n+=r,t=new g(t.getX(),t.getY(),0)}return n}function ut(e){let t;const n=dt(e);return void 0!==n&&(t=function(e){let t;return["LPS","LAI","RPI","RAS","ALS","ARI","PLI","PRS"].includes(e)?t=at.Axial:["LSA","LIP","RSP","RIA","ILA","IRP","SLP","SRA"].includes(e)?t=at.Coronal:["PSL","PIR","ASR","AIL","IAR","IPL","SAL","SPR"].includes(e)&&(t=at.Sagittal),t}(lt(n.asOneAndZeros()))),t}function dt(e){let t;if(void 0!==e&&6===e.length){const n=new g(e[0],e[1],e[2]),i=new g(e[3],e[4],e[5]),o=n.crossProduct(i);t=new Me([n.getX(),i.getX(),o.getX(),n.getY(),i.getY(),o.getY(),n.getZ(),i.getZ(),o.getZ()])}return t}function ht(e,t){let n=qe();return void 0!==t&&(n=e.asOneAndZeros().getInverse().multiply(t)),n.getAbs()}const gt={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 St(e){let t;const n=oe(e,gt.Rows),i=oe(e,gt.Columns);return void 0!==n&&void 0!==i&&(t=[i,n]),t}function pt(e,t){let n;const i=re(e,t);return void 0!==i&&2===i.length&&(n=[parseFloat(i[1]),parseFloat(i[0])]),n}function mt(e){let t;const n=re(e,gt.PixelMeasuresSequence);return void 0!==n&&(t=pt(n[0],gt.PixelSpacing)),t}function ft(e){const t=pt(e,gt.PixelSpacing);if(void 0===t)return;const n=oe(e,gt.SpacingBetweenSlices);return void 0!==n&&t.push(parseFloat(n)),new Fe(t)}function vt(e){const t=oe(e,gt.PhotometricInterpretation),n=oe(e,gt.TransferSyntax);if(void 0!==t&&void 0!==n){let i=t.toUpperCase();(De(n)||ve(n)||Ce(n))&&!Ct(i)&&(i="RGB");let o=oe(e,gt.SamplesPerPixel);return void 0===o&&(o=1),"RGB"===i&&1===o&&(i="PALETTE COLOR"),i}}function Ct(e){return void 0!==e&&null!==e.match(/MONOCHROME/)}function Dt(e){let t;const n=re(e,gt.ReferencedSeriesSequence);return void 0!==n&&(t=oe(n[0],gt.SeriesInstanceUID)),t}function yt(e){const t=re(e,gt.ReferencedFrameOfReferenceSequence);if(void 0===t)return;const n=re(t[0],gt.RTReferencedStudySequence);if(void 0===n)return;const i=re(n[0],gt.RTReferencedSeriesSequence);return void 0!==i?oe(i[0],gt.SeriesInstanceUID):void 0}const It={GE:"ge",SIEMENS:"siemens",PHILIPS:"philips",HITASHI:"hitashi"};function wt(e){return oe(e,"00080070")}function Tt(e){let t;const n=wt(e);return void 0!==n&&(t=n.toUpperCase().startsWith("SIEMENS")?It.SIEMENS:n.startsWith("GE")?It.GE:n.startsWith("Philips")?It.PHILIPS:n.toLowerCase()),t}const Lt="00080016",Pt="52009230",At="00189087",Ot=[{manufacturer:It.SIEMENS,key:"0019100C"},{manufacturer:It.GE,key:"00431039"},{manufacturer:It.HITASHI,key:"00291030"}],bt="1.2.840.10008.5.1.4.1.1.4",xt="1.2.840.10008.5.1.4.1.1.4.1",Et="1.2.840.10008.5.1.4.1.1.4.2",Rt="1.2.840.10008.5.1.4.1.1.4.3";function Ft(e){let t;const n=re(e,"00189117");return void 0!==n&&(t=oe(n[0],At)),t}function Mt(e){let t;const n=re(e,"52009229");if(void 0!==n&&(t=Ft(n[0])),void 0===t){const n=re(e,Pt);if(void 0!==n)for(const e of n)if(t=Ft(e),void 0!==t)break}return t}function qt(e){let t;const n=oe(e,Lt);return n===xt||n===Et||n===Rt?(t=Mt(e),void 0===t&&(t=function(e){let t;const n=Tt(e);return void 0!==n&&n===It.PHILIPS&&(t=function(e){let t,n=!1;const i=re(e,"00209222");if(void 0!==i)for(const e of i){const t=oe(e,"00209165");if(void 0!==t&&"(0018,9087)"===t){n=!0;break}}if(n){const n=re(e,Pt);if(void 0!==n){const e=re(n[0],"00209111");if(void 0!==e){const n=re(e[0],"00209157");void 0!==n&&(t=n[2])}}}return t}(e)),t}(e),void 0!==t&&r.debug("Got b-value for enhanced MR from non standard tag"))):n===bt&&(t=function(e){let t;if(void 0===t){const n=Tt(e),i=oe(e,"00080018");let o;o=void 0!==ot.privateBValueRules?ot.privateBValueRules:Ot;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=oe(e,r.key)),void 0!==t&&!isNaN(parseInt(t,10)))break}return void 0===t&&(t=oe(e,At)),t}(e),void 0===t&&void 0===t&&(t=Mt(e))),void 0!==t&&(t=parseInt(t,10)),t}function Ut(e){let t;const n=oe(e,Lt);if(n===bt||n===xt||n===Et||n===Rt){const n=qt(e);void 0!==n&&(t=n)}return t}function Qt(e){let t;if(void 0!==ot.getVolumeIdTagValue)t=ot.getVolumeIdTagValue(e);else{const n=Ut(e);void 0!==n&&(t=n)}return t}function Vt(e,t){return function(n){let i;const o=oe(n,e);return void 0!==o&&(i=t(o)),i}}const Nt=[{name:"TemporalPositionIdentifier",getter:Vt("00200100",(e=>parseInt(e,10)))},{name:"DiffusionBValue",getter:Ut},{name:"EchoTime",getter:Vt("00180081",parseFloat)},{name:"TriggerTime",getter:Vt("00181060",parseFloat)},{name:"InversionTime",getter:Vt("00180082",parseFloat)},{name:"AcquisitionTime",getter:Vt("00080032",parseFloat)}];function Bt(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 kt(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 Gt(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 Ht(e){let t;return void 0!==e&&(t={hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}),t}function Yt(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 Xt(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 Wt="00080016",$t="00080060",jt="00280002",Zt="00280100",_t={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 Kt{#W;#$;getWarning(){return this.#W}checkElements(e){if(this.#W=void 0,void 0===St(e))throw new Error("No image rows or columns in DICOM file");if(!K(e))throw new Error("No pixel data in DICOM file");const t=oe(e,$t);if(void 0!==t&&"PT"===t){const t=vt(e);if(void 0!==(n=oe(e,Wt))&&/^1\.2\.840\.10008\.5\.1\.4\.1\.1\.7/.test(n)||!Ct(t))return this.#W;const i=function(e){let t="";const n={};let i;t+=ae(e["00280051"],"Corrected Image (00280051)",["ATTN","DECY"]),t+=ae(e["00541102"],"Decay Correction (00541102)",["START"]),t+=ae(e["00541001"],"Units (00541001)",["BQML"]);const o=e["00101030"],a=ae(o," PatientWeight (00101030)");if(0===a.length){const e=parseFloat(o.value[0]);isNaN(e)?t+=" PatientWeight is not a number":i=e}else t+=a;const s=function(e){let t,n="";const i=Bt(e["00080021"]);let o,a,s;const l=e["00540016"];if(n+=ae(l,"RadiopharmaceuticalInformationSequence (00540016)"),void 0!==l){1!==l.value.length&&r.warn("Found more than 1 istopes in RadiopharmaceuticalInformation Sequence.");const e="RadionuclideTotalDose (00181074)",c=l.value[0]["00181074"];if(t=ae(c,e),0===t.length){const e=parseFloat(c.value[0]);isNaN(e)?n+=" TotalDose is not a number":o=e}else n+=t;const u="RadionuclideHalfLife (00181075)",d=l.value[0]["00181075"];if(t=ae(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=kt(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 ne("DA");n.value=[t.substring(0,8)];const i=Bt(n),o=new ne("TM");return o.value=[t.substring(8)],{date:i,time:t.length>=9?kt(o):void 0}}(h);g=e.date,S=e.time}s=Gt(g,S)}let c=Gt(i,kt(e["00080031"]));const u=e["00080022"],d=e["00080032"];if(void 0!==u&&void 0!==d){const t=Bt(u),i=kt(d),o=Gt(t,i);if(c>o){const s=`Series date/time is after Aquisition date/time (diff=${(c.getTime()-o.getTime()).toString()}ms) `;r.debug(s);let l=0;const u="FrameReferenceTime (00541300)",d=e["00541300"];n+=ae(d,u),void 0!==d&&(l=d.value[0]);let h=0;const g="ActualFrameDuration (00181242)",S=e["00181242"];if(n+=ae(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!==o&&void 0!==a){const e=(c.getTime()-s.getTime())/1e3;h=o*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.#$=i.value,this.#W=i.warning}var n;return this.#W}create(e,t,n){const i=function(t){return oe(e,t)},o=St(e),a=[o[0],o[1],1],s=i("00280008");if(void 0!==s){const e=parseInt(s,10);e>1&&a.push(e)}const l=new Re(a);let c=[1,1,1];const u=function(e){let t=pt(e,gt.PixelSpacing);return void 0===t&&(t=function(e){let t=pt(e,gt.ImagerPixelSpacing);if(void 0!==t){let n;const i=parseFloat(oe(e,gt.EstimatedRadiographicMagnificationFactor));if(isNaN(i)){const t=parseFloat(oe(e,gt.DistanceSourceToDetector)),i=parseFloat(oe(e,gt.DistanceSourceToPatient));isNaN(t)||isNaN(i)||0===i||(n=t/i)}else n=i;void 0!==n?(t=t.map((e=>e/n)),r.warn("Got pixel spacing from corrected ImagerPixelSpacing tag")):r.warn("Got pixel spacing from raw ImagerPixelSpacing tag")}return t}(e)),void 0===t&&(t=function(e){const t=pt(e,gt.NominalScannedPixelSpacing);return void 0!==t&&r.warn("Got pixel spacing from NominalScannedPixelSpacing tag"),t}(e)),void 0===t&&(t=function(e){let t;const n=re(e,gt.SharedFunctionalGroupsSequence);if(void 0!==n&&(t=mt(n[0])),void 0===t){const n=re(e,gt.PerFrameFunctionalGroupsSequence);void 0!==n&&(t=mt(n[0]))}return t}(e)),t}(e);if(void 0!==u)c=[u[0],u[1],1];else{const t=pt(e,gt.PixelAspectRatio);void 0!==t&&(c=[t[0],t[1],1],r.warn("Use pixel aspect ratio as spacing"))}const d=new Fe(c),h=re(e,"00200032");let g=new Array(0,0,0);void 0!==h&&(g=[parseFloat(h[0]),parseFloat(h[1]),parseFloat(h[2])]);const S=function(e){const t=re(e,gt.ImageOrientationPatient);let n;return void 0!==t&&(n=dt(t.map((e=>parseFloat(e))))),n}(e),m=new p(g[0],g[1],g[2]),f=Qt(e),v=new Ge([m],l,d,S,f),C=i("00080018");let D=i(jt);void 0===D&&(D=1);const y=l.getTotalSize()*D;if(y!==t.length){if(r.warn(`Badly sized pixel buffer: ${t.length} != ${y}`),!(y<t.length))throw new Error("Underestimated buffer size, can't fix it...");t=t.slice(0,l.getTotalSize())}const I=new to(v,t,[C]),w=vt(e);void 0!==w&&I.setPhotometricInterpretation(w);const T=i("00280006");void 0!==T&&I.setPlanarConfiguration(T);let L=1;const P=i("00281053");if(void 0!==P){const e=parseFloat(P);isNaN(e)||(L=e)}let A=0;const O=i("00281052");if(void 0!==O){const e=parseFloat(O);isNaN(e)||(A=e)}let b=!1,x=1;void 0!==this.#$&&(b=!0,x=this.#$,r.info(`Applying PET SUV calibration: ${x}`),L*=x,A*=x);const E=new Ee(L,A);if(I.setRescaleSlopeAndIntercept(E),"PALETTE COLOR"===I.getPhotometricInterpretation()){const t=function(e){let t;const n=re(e,"00281101");if(void 0!==n&&3===n.length){let i,o,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,r.info(`16bits lut but size is not double. desc: ${u} vl: ${d}`)),8===parseInt(oe(e,Zt),10)&&(t=!0,r.info("Scaling 16bits color lut since bits allocated is 8.")),t){const e=function(e){return e>>8};i=s.value.map(e),o=l.value.map(e),a=c.value.map(e)}}else if(8===n[2]){r.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),o=Array.from(new Uint8Array(e.buffer)),e=c.value.slice(0),a=Array.from(new Uint8Array(e.buffer))}t=new nt(i,o,a)}return t}(e);void 0!==t&&I.setPaletteColourMap(t)}const R={numberOfFiles:n};R.TransferSyntaxUID=i("00020010"),R.MediaStorageSOPClassUID=i("00020002"),R.SOPClassUID=i(Wt),R.Modality=i($t),R.ImageType=i("00080008"),R.SamplesPerPixel=i(jt),R.PhotometricInterpretation=i("00280004"),R.PixelRepresentation=i("00280103"),R.BitsAllocated=i(Zt),R.BitsStored=i("00280101"),R.HighBit=i("00280102");const F=Object.keys(_t);for(const e of F)R[e]=i(_t[e]);if(b)R.pixelUnit="SUV";else{const t=(M=e,void 0!==ot.getTagPixelUnit?ot.getTagPixelUnit(M):function(e){let t;const n=["RescaleType","Units"];for(const i of n)if(t=oe(e,gt[i]),void 0!==t)break;if(void 0===t){const n=oe(e,gt.Modality);void 0!==n&&"CT"===n&&(t="HU")}return t}(M));void 0!==t&&(R.pixelUnit=t)}var M;R.lengthUnit=void 0===u?"unit.pixel":"unit.mm";const q=function(e,t){let n;const i=re(e,"00281050"),o=re(e,"00281051");if(void 0!==i&&void 0!==o){n={};const a=re(e,"00281055");let s;for(let e=0;e<i.length;++e){const l=parseFloat(i[e]);let c=parseFloat(o[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 Ke(s,[new je(l*t,c)])),0===c&&r.warn("Zero window width found in DICOM.")}}return n}(e,x);return void 0!==q&&(R.windowPresets=q),R.VOILUTFunction=i("00281056"),I.setMeta(R),I}}class Jt{#u=!0;#g;constructor(e,t){void 0!==t&&(this.#u=t),this.#g=new DataView(e)}writeUint8(e,t){return this.#g.setUint8(e,t),e+Uint8Array.BYTES_PER_ELEMENT}writeInt8(e,t){return this.#g.setInt8(e,t),e+Int8Array.BYTES_PER_ELEMENT}writeUint16(e,t){return this.#g.setUint16(e,t,this.#u),e+Uint16Array.BYTES_PER_ELEMENT}writeInt16(e,t){return this.#g.setInt16(e,t,this.#u),e+Int16Array.BYTES_PER_ELEMENT}writeUint32(e,t){return this.#g.setUint32(e,t,this.#u),e+Uint32Array.BYTES_PER_ELEMENT}writeUint64(e,t){return this.#g.setBigUint64(e,t,this.#u),e+BigUint64Array.BYTES_PER_ELEMENT}writeInt32(e,t){return this.#g.setInt32(e,t,this.#u),e+Int32Array.BYTES_PER_ELEMENT}writeInt64(e,t){return this.#g.setBigInt64(e,t,this.#u),e+BigInt64Array.BYTES_PER_ELEMENT}writeFloat32(e,t){return this.#g.setFloat32(e,t,this.#u),e+Float32Array.BYTES_PER_ELEMENT}writeFloat64(e,t){return this.#g.setFloat64(e,t,this.#u),e+Float64Array.BYTES_PER_ELEMENT}writeHex(e,t){const n=parseInt(t,16);return this.#g.setUint16(e,n,this.#u),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 en=0;class tn{action;value;constructor(e){this.action=e}}const nn={copy:e=>e,remove:()=>null,clear:e=>(e.value=[],e),replace:(e,t)=>(e.value=[t],e)};function on(e){const t=`.${(new Date).toISOString().replace(/\D/g,"").substring(0,14)}`;en+=1;const n=`.${en}`;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 rn(e){return e%2==0}function an(e){const t=Q[e];return void 0!==t&&"string"===t}function sn(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}class ln{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 cn="00080005",un="00280100";class dn{#j=!1;#Z=!0;#_={default:{action:"copy",value:null}};#K=this.#_;#J=[];#ee=new ln;#te=this.#ee;setUseUnVrForPrivateSq(e){this.#j=e}setFixUnknownVR(e){this.#Z=e}setRules(e,t){if(this.#K=e,this.#J=[],t){const t=Object.keys(e);for(const n of t){const t=e[n];if("replace"===t.action&&void 0!==t.value&&null!==t.value){let e,t=!1;if(8===n.length&&(t=void 0!==H(n).getNameFromDictionary()),t)e=n;else{const t=J(n);void 0!==t&&(e=t.getKey())}void 0!==e&&this.#J.push(e)}}}}#ne(e){return this.#ee.encode(e)}#ie(e){return this.#te.encode(e)}useSpecialTextEncoder(){this.#te=new TextEncoder}getElementToWrite(e){const t=e.tag.getGroupName(),n=e.tag.getNameFromDictionary();let i;return i=void 0!==this.#K[e.tag.getKey()]?this.#K[e.tag.getKey()]:void 0!==n&&void 0!==this.#K[n]?this.#K[n]:void 0!==this.#K[t]?this.#K[t]:this.#K.default,nn[i.action](e,i.value)}#oe(e,t,n,i,o){const r=function(e){return X(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 ne("NONE");l.vl=n?4294967295:s.vl,l.tag=Y(),l.value=[],t=this.#re(e,l,t,i);for(const n of a)r(n)||W(n.tag)||(t=this.#re(e,n,t,i,o));if(n){const n=new ne("NONE");n.vl=0,n.tag=new G("FFFE","E00D"),n.value=[],t=this.#re(e,n,t,i)}}return t}#ae(e,t,n,i,o,a){const s=n;if("NONE"===t.vr);else if(i instanceof Uint8Array)if(void 0!==a&&1===a){if(i.length%8!=0){r.debug("Padding binary pixel data");const e=8*Math.ceil(i.length/8),t=new Array(e-i.length);t.fill(0),i=sn(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=Q[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.#oe(e,n,i,o);else if("AT"===t.vr)for(const t of i){const i=String(t),o=i.substring(1,5),r=i.substring(6,10),a=[parseInt(o,16),parseInt(r,16)];n=e.writeUint16Array(n,a)}else"xs"===t.vr?n=i instanceof Int16Array?e.writeInt16Array(n,i):e.writeUint16Array(n,i):r.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})`,r.warn(n)}}return n}#se(e,t,n,i,o,r){let a=!1;if(void 0!==t.undefinedLength&&(a=t.undefinedLength),a){const a=[];a.push({tag:Y(),vr:"NONE",vl:0,value:[]});for(const e of i)a.push({tag:Y(),vr:t.vr,vl:e.length,value:e});n=this.#oe(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.#ae(e,t,n,a,o,r)}return n}#re(e,t,n,i,o){const a=t.tag.isWithVR(),s=!(!i&&a)||M(t.vr);n=e.writeHex(n,t.tag.getGroup()),n=e.writeHex(n,t.tag.getElement());let l=t.vr;this.#j&&t.tag.isPrivate()&&"SQ"===l&&(r.warn("Write element using VR=UN for private sequence."),l="UN"),a&&!i&&(n=e.writeUint8Array(n,this.#ne(l)),s&&(n+=2));let c=!1;("SQ"===t.vr||Z(t.tag))&&void 0!==t.undefinedLength&&(c=t.undefinedLength);let u=!1;X(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=Z(t.tag)?this.#se(e,t,n,h,i,o):this.#ae(e,t,n,h,i),c){const t=new ne("NONE");t.vl=0,t.tag=new G("FFFE","E0DD"),t.value=[],n=this.#re(e,t,n,i)}return n}getBuffer(e){const t=e["00020010"].value[0],n=me(t),i=fe(t);if(void 0!==e[cn]){const t=e[cn].value[0];void 0!==t&&"ISO-IR 6"!==t&&(r.debug(`Change charset to UTF, was: ${t}`),this.useSpecialTextEncoder(),e[cn].value=["ISO_IR 192"])}let o;void 0!==e[un]&&(o=e[un].value[0]);let a,s=132;const l=[],c=[];let u,d,h=0;const g=new G("0002","0000"),S=new G("0002","0001"),p=new G("0002","0012"),m=new G("0002","0013"),f=this.#J.slice(),v=Object.keys(e);for(const t of v){const r=e[t];if(r.tag=H(t),u=this.getElementToWrite(r),!(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.#Z&&hn(u,!i),this.#le(u,u.value,n,o),d=u.tag.getGroupName(),a+=we(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=H(e),i=new ne(t.getVrFromDictionary());let o;if(i.tag=t,void 0!==this.#K[e])o=this.#K[e].value;else{const e=t.getNameFromDictionary();o=this.#K[e].value}let r=we(i.vr,n);r+=this.#le(i,[o],n),c.push(i),s+=r}const C=gn("FileMetaInformationVersion");let D=we(C.vr,!1);D+=this.#le(C,[0,1],!1),l.push(C),h+=D,s+=D;const y=gn("ImplementationClassUID");let I=we(y.vr,!1);const w=`1.2.826.0.1.3680043.9.7278.1.${"0.37.0-beta.9".replace("-beta",".99")}`;I+=this.#le(y,[w],!1),l.push(y),h+=I,s+=I;const T=gn("ImplementationVersionName");let L=we(T.vr,!1);L+=this.#le(T,["DWV_0.37.0-beta.9"],!1),l.push(T),h+=L,s+=L;const P=function(e,t){return z(e.tag,t.tag)};l.sort(P),c.sort(P);const A=gn("FileMetaInformationGroupLength");let O=we(A.vr,!1);O+=this.#le(A,new Uint32Array([h]),!1),s+=O;const b=new ArrayBuffer(s),x=new Jt(b),E=new Jt(b,!i);let R=128;R=x.writeUint8Array(R,this.#ne("DICM")),R=this.#re(x,A,R,!1);for(const e of l)R=this.#re(x,e,R,!1);const F=132+O+h;R!==F&&r.warn(`Bad size calculation... meta offset: ${R}, calculated size:${F} (diff:${R-F})`);for(const e of c)R=this.#re(E,e,R,n,o);return R!==s&&r.warn(`Bad size calculation... final offset: ${R}, calculated size:${s} (diff:${R-s})`),b}#le(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[un];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=H(e),X(i.tag)||(l+=this.#le(i,i.value,n,c),s.push(i),l+=we(i.vr,n))}const h={tag:Y(),vr:"NONE",vl:l,value:[]};a&&(h.undefinedLength=a),s.push(h),l+=we(h.vr,n),a&&(l+=we("NONE",n));const g=function(e,t){return z(e.tag,t.tag)};s.sort(g),o+=l,r.push(s)}a&&(o+=we("NONE",n)),e.value=r,e.vl=o,a&&(e.undefinedLength=a)}}else{if(an(r=e.vr)||"OB"===r){const n=function(e){let t="";return an(e)&&(t="UI"===e?"\0":" "),t}(e.vr);if(an(e.vr)){let i;U(e.vr)?(t=this.#ie(t.join("\\")),i=this.#ie(n)):(t=this.#ne(t.join("\\")),i=this.#ne(n)),rn(t.length)||(t=sn(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;rn(t)||(e[e.length-1]=sn(e[e.length-1],[0]))}else rn(e.length)||(e=sn(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=Q[e];return void 0!==t&&"string"!==t}(e.vr)||"ox"===e.vr){if(Z(e.tag)&&Array.isArray(t)){o=0;for(const e of t)o+=e.length}else o=t.length;const r=Q[e.vr];if(Z(e.tag)||"ox"===e.vr)if(e.undefinedLength){const e=we("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 hn(e,t){if("UN"===e.vr){const n=e.tag.getVrFromDictionary();if(void 0!==n&&e.vr!==n){e.vr=n;const i=Q[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 le(e.buffer,n),r=e.byteOffset,a=e.length,s=Q[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)}r.info(`Element ${e.tag.getGroup()} ${e.tag.getElement()} VR changed from UN to ${e.vr}`)}}}function gn(e){const t=J(e),n=new ne(t.getVrFromDictionary());return n.tag=t,n}function Sn(e){const t=Object.keys(e),n={};for(const i of t){const t=J(i);if(void 0===t)continue;const o=t.getVrFromDictionary();let a,s=!1;const l=e[i];if("SQ"===o){const e=[];if(void 0!==l.undefinedLength&&(s=l.undefinedLength),Array.isArray(l.value))for(const t of l.value)e.push(Sn(t));else r.debug("Non array simpleTag SQ value");a=e}else a=Array.isArray(l)?l:[l];const c=new ne(o);c.tag=t,c.value=a,s&&(c.undefinedLength=s),n[t.getKey()]=c}return n}class pn{r;g;b;constructor(e,t,n){this.r=e,this.g=t,this.b=n}}function mn(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 fn(e){return{r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)}}function vn(e){return`#${((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)}`}function Cn(e){return{l:.001525902*e.l,a:.003891051*e.a-128,b:.003891051*e.b-128}}function Dn(e){return{l:655.35*e.l,a:257*e.a+32896,b:257*e.b+32896}}const yn={x:95.0489,y:100,z:108.884};function In(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=yn,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 wn(e){return function(e){function t(e){let t;return t=e>.008856452?Math.pow(e,.333333333):7.787037037*e+.137931034,t}const n=yn,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 Tn(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 Ln=[new pn(0,0,0),new pn(255,0,0),new pn(0,255,0),new pn(0,0,255),new pn(255,255,0),new pn(0,255,255),new pn(255,0,255),new pn(255,239,213),new pn(0,0,205),new pn(205,133,63),new pn(210,180,140),new pn(102,205,170),new pn(0,0,128),new pn(0,139,139),new pn(46,139,87),new pn(255,228,225)];function Pn(e){let t;return t=e<Ln.length?Ln[e]:new pn(255*Math.random(),255*Math.random(),255*Math.random()),t}const An="00080100",On="00080102",bn="00080119",xn="00080120";class En{meaning;value;longValue;urnValue;schemeDesignator;constructor(e){this.meaning=e}toString(){return`(${this.value}, ${this.schemeDesignator}, '${this.meaning}')`}}function Rn(e,t){return void 0!==e&&void 0!==t&&e.schemeDesignator===t.schemeDesignator&&e.value===t.value}function Fn(e){const t=new En(e["00080104"].value[0]);if(void 0!==e[An])t.value=e[An].value[0];else if(void 0!==e[bn])t.longValue=e[bn].value[0];else{if(void 0===e[xn])throw new Error("Invalid code with no value, no long value and no urn value.");t.urnValue=e[xn].value[0]}if(void 0!==t.value||void 0!==t.longValue){if(void 0===e[On])throw new Error("No coding sheme designator when code value or long value is present");t.schemeDesignator=e[On].value[0]}return t}function Mn(e){const t={};return void 0!==e.value?t.CodeValue=e.value:void 0!==e.longValue?t.LongCodeValue=e.longValue:void 0!==e.urnValue&&(t.URNCodeValue=e.urnValue),void 0!==e.schemeDesignator&&(t.CodingSchemeDesignator=e.schemeDesignator),t.CodeMeaning=e.meaning,t}const qn={value:"111017",meaning:"CAD Processing and Findings Summary"},Un={value:"111030",meaning:"Image Region"},Qn={value:"111059",meaning:"Single Image Finding"},Vn={value:"111099",meaning:"Selected region"},Nn={value:"111242",meaning:"All algorithms succeeded; with findings"},Bn={value:"112000",meaning:"Chest CAD Report"},kn={value:"112020",meaning:"Response Evaluation"},Gn={value:"112021",meaning:"Response Evaluation Method"},zn={value:"112022",meaning:"RECIST"},Hn={value:"112039",meaning:"Tracking Identifier"},Yn={value:"112051",meaning:"Measurement of Response"},Xn={value:"112040",meaning:"Tracking Unique Identifier"},Wn={value:"112048",meaning:"Current Response"},$n={value:"113076",meaning:"Segmentation"},jn={value:"121055",meaning:"Path"},Zn={value:"121106",meaning:"Comment"},_n={value:"121322",meaning:"Source image for image processing operation"},Kn={value:"121324",meaning:"Source Image"},Jn={value:"122438",meaning:"Reference Points"},ei={value:"125007",meaning:"Measurement Group"},ti={value:"125309",meaning:"Short Label"},ni={value:"126000",meaning:"Imaging Measurement Report"},ii={value:"126010",meaning:"Imaging Measurements"},oi={value:"128773",meaning:"Reference Geometry"},ri={1483009:"Angle",42798e3:"Area",103355008:"Width",103339001:"Long axis",103340004:"Short axis",131190003:"Radius",261665006:"Unknown",410668003:"Length",718499004:"Color"},ai={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 si(e){const t=new En(e.meaning);return t.schemeDesignator="DCM",t.value=e.value,t}function li(e,t){let n,i;return"SCT"===t?n=ri[e]:"UCUM"===t&&(n=ai[e]),void 0!==n&&(i=new En(n),i.schemeDesignator=t,i.value=e),i}function ci(){return si($n)}function ui(){return li("718499004","SCT")}const di={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"}},hi={"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 gi(e){const t=hi[e];let n;return void 0!==t?n=li(t,"UCUM"):void 0===t&&(n=li("1","UCUM")),n}const Si="00620005",pi="00620009",mi="0062000C",fi="0062000D",vi="00620003",Ci="0062000F",Di="00620020";class yi{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 Ii(e){const t=new yi(e["00620004"].value[0],e[Si]?e[Si].value[0]:"n/a",e["00620008"].value[0]);if(void 0!==e[pi]&&(t.algorithmName=e[pi].value[0]),void 0!==e[mi])t.displayValue=e[mi].value[0];else if(void 0!==e[fi]){const n=e[fi].value,i=In(Cn({l:n[0],a:n[1],b:n[2]}));t.displayRGBValue=i}else r.warn("No recommended colour for segment, using default"),t.displayRGBValue=Pn(t.number);if(void 0===e[vi])throw new Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=Fn(e[vi].value[0]),void 0===e[Ci])throw new Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=Fn(e[Ci].value[0]),void 0!==e[Di]&&(t.trackingId=e[Di].value[0],t.trackingUid=e["00620021"].value[0]),t}function wi(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=Dn(wn(e.displayRGBValue));n.RecommendedDisplayCIELabValue=[Math.round(t.l),Math.round(t.a),Math.round(t.b)]}else n.RecommendedDisplayGrayscaleValue=e.displayValue;return e.propertyCategoryCode&&(n.SegmentedPropertyCategoryCodeSequence={value:[Mn(e.propertyCategoryCode)]}),e.propertyTypeCode&&(n.SegmentedPropertyTypeCodeSequence={value:[Mn(e.propertyTypeCode)]}),e.trackingId&&(n.TrackingID=e.trackingId,n.TrackingUID=e.trackingUid),n}const Ti="00089124",Li="00082112",Pi="00081150",Ai="00081155",Oi="00209116",bi="00289110";class xi{dimIndex;imagePosPat;derivationImages;refSegmentNumber;imageOrientationPatient;spacing;constructor(e,t,n,i){this.dimIndex=e,this.imagePosPat=t,this.derivationImages=n,this.refSegmentNumber=i}}function Ei(e){const t=[];if(void 0!==e[Ti]){const n=e[Ti].value;for(let e=0;e<n.length;++e){const i=[];if(void 0!==n[e][Li]){const t=n[e][Li].value;for(let e=0;e<t.length;++e){const n={};void 0!==t[e][Pi]&&(n.referencedSOPClassUID=t[e][Pi].value[0]),void 0!==t[e][Ai]&&(n.referencedSOPInstanceUID=t[e][Ai].value[0]),i.push(n)}}t.push({sourceImages:i})}}const n=e["00209111"].value[0]["00209157"].value,i=e["0062000A"].value,o=parseInt(i[0]["0062000B"].value[0],10),a=e["00209113"].value[0]["00200032"].value;for(let e=0;e<a.length;++e)a[e]=parseFloat(a[e]);const s=new xi(n,a,t,o);if(void 0!==e[Oi]){const t=e[Oi];if(0!==t.value.length){const e=t.value[0]["00200037"].value;void 0!==e&&(s.imageOrientationPatient=e)}}if(void 0!==e[bi]){const t=e[bi];if(0!==t.value.length){const e=ft(t.value[0]);void 0!==e&&(s.spacing=e)}else r.warn("No shared functional group pixel measure sequence items.")}return s}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=Mn(si(_n)),i=Mn(si($n)),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}class Fi{#ce=null;#ue=null;#de=null;initialize(e,t){this.#ue=e,this.#de=t,this.#ce=new Uint8Array(3*e.length)}isInitialized(){return null!==this.#ce}realloc(e,t){this.#ue=e,this.#de=t;let n=this.#ce;this.#ce=new Uint8Array(3*e.length),this.#ce.set(n),n=null}shiftSlice(e,t,n){this.#ce.set(this.#ce.subarray(e,n),e+t)}#he(e){this.#ce[3*e]=0,this.#ce[3*e+1]=0,this.#ce[3*e+2]=0}resetAroundOffset(e){if(!this.isInitialized())return;this.#he(e);const t=this.#de.getDimSize(0),n=this.#de.getDimSize(1),i=this.#de.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.#ue.length&&this.#he(s)}}#ge(e,t,n,i,o,r){return()=>{const a=t+n,s=e+1,l=this.#de.offsetToIndex(a);return a>=this.#ue.length||a<0||0===l.get(i)||l.get(i)===this.#de.get(i)-1||255===s?s:s>10?255:this.#ue[a]!==o?s:(r.push(this.#ge(s,a,n,i,o,r)),0)}}#Se(e,t,n,i,o,r,a,s){return()=>{const l=t+n,c=e+1,u=this.#de.offsetToIndex(l);return l>=this.#ue.length||l<0||0===u.get(o)||u.get(o)===this.#de.get(o)-1||255===c?c:c>10?255:this.#ue[l]!==a?c:(s.push(this.#ge(c,l,i,r,a,s)),s.push(this.#ge(c,l,-i,r,a,s)),s.push(this.#Se(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.#ce[r];if(a>0)return a;const s=this.#ue[e],l=[],c=this.#de.getDimSize(o),u=this.#de.getDimSize(i);l.push(this.#Se(0,e,c,u,o,i,s,l)),l.push(this.#ge(0,e,u,i,s,l)),l.push(this.#ge(0,e,-u,i,s,l)),l.push(this.#Se(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.#ce[r]=255,255;const e=l.shift()();if(e>0)return this.#ce[r]=e,e}return 1/0}}function Mi(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 qi{#pe;#me=new Map;#fe=!1;#ve;constructor(e){this.#pe=e}getAll(){return this.#me}setLabelMap(e){this.#ve=e}addFrame(e,t,n,i,o,r){this.#me.has(e)||this.#me.set(e,new Map);const a=this.#me.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.#ve)return this.#ve;const e=this.#pe.getSize().getDimSize(2),t=this.#pe.getSize().getTotalSize(),n=new Uint8Array(t);for(const[,t]of this.#me)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.#fe=!0),0===n[t+i]&&(n[t+i]=o[i]))}return this.#fe&&r.warn("SegmentCollection: detected overlapping segments"),this.#ve=n,n}getHasOverlap(){return this.getLabelMap(),this.#fe}getSegmentBuffers(e){if(0===this.#me.size){let t=e.map((e=>e.number));if(0===t.length&&void 0!==this.#ve){const e=new Set;for(let t=0;t<this.#ve.length;++t)0!==this.#ve[t]&&e.add(this.#ve[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=Mi(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.#ve,this.#pe,t)}const t={};for(const n of e){const e=n.number-1,i=this.#me.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}#Ce;#De="";getOrBuildUnionContour(e,t){const n=[];for(const[t]of this.#me)e?.isHidden(t)&&n.push(t);const i=n.sort().join(",");if(void 0!==this.#Ce&&i===this.#De)return this.#Ce;const o=t.getDimSize(2),r=new Uint8Array(t.getTotalSize());for(const[t,n]of this.#me)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.#Ce=new Fi,this.#Ce.initialize(r,t),this.#De=i,this.#Ce}}const Ui="00209116",Qi="00289110",Vi={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 Ni(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 Bi=[{name:"TransferSyntaxUID",tag:"00020010",type:"1",enum:[N,B,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 ki(){const e={};for(const t of Bi)e[t.name]=t.enum[0];return e}class Gi{#W;getWarning(){return this.#W}checkElements(e){}create(e,t,n){const i=function(t){return oe(e,t)},o=function(t){return re(e,t)};for(const t of Bi)Ni(e,t);const a=St(e),s=new Re([a[0],a[1],1]),l=s.getTotalSize();let c=i("00280008");if(c=void 0!==c?parseInt(c,10):1,c!==t.length/l)throw new Error(`Buffer and numberOfFrames meta are not equal ${c} ${t.length/l}`);const u=function(e){const t=e["00209221"];if(void 0===t||1!==t.value.length)throw new Error("Unsupported dimension organization sequence length");const n=t.value[0]["00209164"].value[0],i=[],o=e["00209222"];if(void 0!==o){const e=o.value;if(2!==e.length)throw new Error("Unsupported dimension index sequence length");let t;for(let o=0;o<e.length;++o){const r=e[o]["00209164"].value[0];if(r!==n)throw new Error("Dimension Index Sequence contains a unknown Dimension Organization");t=e[o]["00209165"].value[0];const a={DimensionOrganizationUID:r,DimensionIndexPointer:t};void 0!==e[o]["00209421"]&&(a.DimensionDescriptionLabel=e[o]["00209421"].value[0]),i.push(a)}if("(0020,0032)"!==t)throw new Error("Unsupported non image position as last index")}return{organizations:{value:[{DimensionOrganizationUID:n}]},indices:{value:i}}}(e),d=o("00620002");if(void 0===d)throw new Error("Missing or empty segmentation sequence");const h=[],g=[0],S=[0],m=[0];for(let e=0;e<d.length;++e){const t=Ii(d[e]);void 0!==t.displayRGBValue&&(g[t.number]=t.displayRGBValue.r,S[t.number]=t.displayRGBValue.g,m[t.number]=t.displayRGBValue.b),h.push(t)}let f,v,C,D=!1;g.length>1&&(D=!0,f=new nt(g,S,m));const y=o("52009229");if(void 0!==y){const e=y[0];if(void 0!==e[Ui]){const t=e[Ui];0!==t.value.length?C=t.value[0]["00200037"].value:r.warn("No shared functional group plane orientation sequence items.")}if(void 0!==e[Qi]){const t=e[Qi];0!==t.value.length?v=ft(t.value[0]):r.warn("No shared functional group pixel measure sequence items.")}}const I=function(e,t){return e.some((function(e){return n=t,i=e,JSON.stringify(n)===JSON.stringify(i);var n,i}))},w=function(e,t){return e.findIndex((function(e){return t.equals(e)}))},L=o("52009230");if(void 0===L)throw new Error("Missing or empty per frame functional sequence");if(c!==L.length)throw new Error("perFrameFuncGroupSequence meta and numberOfFrames are not equal.");const P=[];for(let e=0;e<L.length;++e)P.push(Ei(L[e]));const A=[];for(let e=0;e<P.length;++e){if(I(A,P[e].imagePosPat)||A.push(P[e].imagePosPat),void 0!==P[e].imageOrientationPatient)if(void 0===C)C=P[e].imageOrientationPatient;else if(!T(C,P[e].imageOrientationPatient))throw new Error("Unsupported multi orientation dicom seg.");if(void 0!==P[e].spacing)if(void 0===v)v=P[e].spacing;else if(!v.equals(P[e].spacing))throw new Error("Unsupported multi resolution dicom seg.")}if(void 0===v)throw new Error("No spacing found for DICOM SEG");if(3!==v.length())throw new Error("Incomplete spacing found for DICOM SEG");if(void 0===C)throw new Error("No imageOrientationPatient found for DICOM SEG");const O=dt(C.map((e=>parseFloat(e))));if(void 0===O)throw new Error("Invalid imageOrientationPatient found for DICOM SEG");A.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]}}(O));const b=function(e){return new p(e[0],e[1],e[2])},x=[];for(const e of A)x.push(b(e));let E;E=void 0!==n?this.#ye(x,s,v,O,n.getGeometry().getOrigins()):this.#Ie(x,s,v,O);const R=E.getSize().get(2),F=function(e){return function(t){return t.number===e}},M=new qi(E),q=E.getOrigins();let U;for(let e=0;e<P.length;++e){if(U=w(q,b(P[e].imagePosPat)),-1===U)throw new Error("Cannot find frame origin in mask origins");const n=h.find(F(P[e].refSegmentNumber)),i=D?n.number:n.displayValue;M.addFrame(n.number,t,l*e,U,l,i)}const Q=[];for(let e=0;e<R;++e)Q.push(e.toString());const V=new to(E,M.getLabelMap(),Q);V.setSegmentCollection(M),D&&(V.setPhotometricInterpretation("PALETTE COLOR"),V.setPaletteColourMap(f));const N=ki(),B=Object.keys(Vi);for(const e of B)N[e]=i(Vi[e]);return N.DimensionOrganizationSequence=u.organizations,N.DimensionIndexSequence=u.indices,N.custom={segments:h,frameInfos:P,SOPInstanceUID:i("00080018"),referencedSeriesUID:Dt(e)},N.lengthUnit=n.getMeta().lengthUnit,N.numberOfFiles=R,V.setMeta(N),V}#we(e,t,n){const i=e.getDistance(t);if(i>1e-4){if(!(i<.01))throw new Error(`No reference origin for mask frame origin ${n}`);r.warn(`Mask frame origin ${n} is far from reference origin (${i}).`)}}#ye(e,t,n,i,o){const r=[];r.push(e[0]);let a=e[0].getClosest(o);this.#we(e[0],o[a],0);for(let t=1;t<e.length;++t){const n=e[t],i=n.getClosest(o);if(this.#we(n,o[i],t),i!==a+1)for(let e=a+1;e<i;++e)r.push(o[e]);r.push(n),a=i}const s=new Ge([e[0]],t,n,i);for(let e=1;e<r.length;++e)s.appendOrigin(r[e],e);return s}#Ie(e,t,n,i){r.warn("Guessing image geometry for DICOM SEG");const a=new Ge([e[0]],t,n,i),s=[];s.push(e[0]);let l=0;for(let t=1;t<e.length;++t){++l;let n=new o([0,0,l]),i=a.indexToWorld(n).get3D();const c=e[t];let u=c.getDistance(i);const h=u;for(;d(u);)if(r.debug(`Adding intermediate pos pats for DICOM seg at ${i.toString()}`),s.push(i),++l,n=new o([0,0,l]),i=a.indexToWorld(n).get3D(),u=c.getDistance(i),u>h)throw new Error("Test distance is increasing when adding intermediate pos pats");s.push(c)}const c=new Ge([e[0]],t,n,i);for(let e=1;e<s.length;++e)c.appendOrigin(s[e],e);return c}toDicom(e,t,n,i){const o=e.getMeta();void 0===t&&(t=o.segments);const a=e.getGeometry(),s=a.getSize();o.Rows=s.get(1),o.Columns=s.get(0);const l=new Date;o.ContentDate=Yt(zt(l)),o.ContentTime=Xt(Ht(l)),void 0!==n&&(o.StudyInstanceUID=n.getMeta().StudyInstanceUID);const c=[];for(const e of t)c.push(wi(e));var u,d;o.SegmentSequence={value:c},o.SharedFunctionalGroupsSequence={value:[{PlaneOrientationSequence:{value:[(d=a.getOrientation(),{ImageOrientationPatient:[d.get(0,0),d.get(1,0),d.get(2,0),d.get(0,1),d.get(1,1),d.get(2,1)]})]},PixelMeasuresSequence:{value:[(u=a.getSpacing(),{SpacingBetweenSlices:u.get(2),PixelSpacing:[u.get(1),u.get(0)]})]}}]};const h=e.getSegmentCollection().getSegmentBuffers(t),g=[],S=[],p=[];for(const i of t){const t=i.number,o=t-1;if(void 0===h[o])continue;const r=Object.keys(h[o]);for(let i=r.length-1;i>=0;--i){const a=Number.parseInt(r[i],10);S.push(h[o][a]);const s=e.getGeometry().getOrigins()[a],l=[s.getX(),s.getY(),s.getZ()],c={dimIndex:[t,r.length-i],imagePosPat:l,refSegmentNumber:t};if(void 0!==n){const e=n.getGeometry().worldToIndex(new m([s.getX(),s.getY(),s.getZ()]));c.derivationImages=[{sourceImages:[{referencedSOPInstanceUID:n.getImageUid(e),referencedSOPClassUID:n.getMeta().SOPClassUID}]}],p.push({ReferencedSOPInstanceUID:n.getImageUid(e),ReferencedSOPClassUID:n.getMeta().SOPClassUID})}g.push(c)}}o.NumberOfFrames=S.length.toString();const f=[];for(const e of g)f.push(Ri(e));if(o.PerFrameFunctionalGroupsSequence={value:f},void 0!==n){const e=[];e.push({ReferencedInstanceSequence:{value:p},SeriesInstanceUID:n.getMeta().SeriesInstanceUID}),o.ReferencedSeriesSequence={value:e}}void 0!==i&&function(e,t){const n=Object.keys(t);for(const i of n)void 0!==e[i]&&r.debug(`Overwritting tag: ${i}`),e[i]=t[i]}(o,i);const v=Sn(o),C=s.getDimSize(2),D=S.length*C/8,y=new ne("OB");return y.tag=new G("7FE0","0010"),y.vl=D,y.value=S,v["7FE00010"]=y,v}}function zi(e,t){const n=e.getGeometry(),i=t.getGeometry();if(!n.getSpacing().equals(i.getSpacing()))throw new Error("mergeMaskImages: masks must have similar spacings");if(!n.getOrientation().isSimilar(i.getOrientation(),1e-4))throw new Error("mergeMaskImages: masks must have similar orientations");const o=n.getSize().getDimSize(2),a=e.getMeta().custom?.segments??[],s=t.getMeta().custom?.segments??[],l=e.getSegmentCollection().getSegmentBuffers(a),c=t.getSegmentCollection().getSegmentBuffers(s);let u,d;u=a.length>0?a.map((e=>e.number)):Object.keys(l).map((e=>Number(e)+1)),d=s.length>0?s.map((e=>e.number)):Object.keys(c).map((e=>Number(e)+1));const h=new Set(u);let g=h.size>0?Math.max(...h)+1:1;const S=new Map;for(const e of d)if(h.has(e)){const t=g++;r.warn(`mergeMaskImages: segment number conflict, remapping ${e} to ${t}`),S.set(e,t)}else S.set(e,e),h.add(e);const p=[...a,...s.map((e=>({...e,number:S.get(e.number)})))],m=new qi(n),f="PALETTE COLOR"===e.getPhotometricInterpretation();for(const[e,t]of Object.entries(l)){const n=Number(e)+1,i=a.find((e=>e.number===n)),r=f?n:i?.displayValue??n;for(const[e,i]of Object.entries(t))m.addFrame(n,i,0,Number(e),o,r)}const v="PALETTE COLOR"===t.getPhotometricInterpretation();for(const[e,t]of Object.entries(c)){const n=Number(e)+1,i=S.get(n),r=s.find((e=>e.number===n)),a=v?i:r?.displayValue??i;for(const[e,n]of Object.entries(t))m.addFrame(i,n,0,Number(e),o,a)}const C=n.getOrigins().map(((e,t)=>t.toString())),D=new to(n,m.getLabelMap(),C);if(D.setSegmentCollection(m),f||v){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 d){const t=S.get(e);i[t]=a.red[e],o[t]=a.green[e],r[t]=a.blue[e]}D.setPhotometricInterpretation("PALETTE COLOR"),D.setPaletteColourMap(new nt(i,o,r))}else D.setPhotometricInterpretation(e.getPhotometricInterpretation());const y=structuredClone(e.getMeta());return void 0===y.custom&&(y.custom={}),y.custom.segments=p,D.setMeta(y),D}class Hi{#Te;#Le;#Pe;#Ae;constructor(e){this.#Te=e,this.#X()}#X(){this.#Le=[],this.#Pe=[];for(let e=0;e<this.#Te;++e)this.#Pe.push(new Yi(this));this.#Ae=[]}addWorkerTask(e){if(this.#Pe.length===this.#Te&&this.onworkstart({type:"work-start"}),this.#Pe.length>0){const t=this.#Pe.shift();this.#Ae.push(t),t.run(e)}else this.#Le.push(e)}abort(){this.#Oe(),this.#X(),this.onabort({type:"work-abort"}),this.onworkend({type:"work-end"})}onTaskEnd(e){if(this.#Le.length>0){const t=this.#Le.shift();e.run(t)}else e.stop(),this.#Pe.push(e),this.#Ae=this.#Ae.filter((t=>t.getId()!==e.getId())),this.#Pe.length===this.#Te&&(this.onwork({type:"work"}),this.onworkend({type:"work-end"}))}handleWorkerError=e=>{this.#Oe(),this.onerror({error:e}),this.onworkend({type:"work-end"})};#Oe(){for(const e of this.#Ae)e.stop();this.#Ae=[]}onworkstart(e){}onworkitem(e){}onwork(e){}onworkend(e){}onerror(e){}onabort(e){}}class Yi{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 Xi{constructor(e,t){this.startMessage=e,this.info=t}getWorker(){}}function Wi(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 $i extends Xi{constructor(e,t){super(e,t)}getWorker(){return new i.wc(new URL("./"+i.u(391),i.b),{name:"labeling.worker",type:"module"})}}class ji{#be=new Hi(navigator?.hardwareConcurrency??4);constructor(){this.#be.onerror=e=>{console.error("Labeling failed!",e.error)}}run(e,t){this.#be.onworkitem=this.ondone,this.#be.onwork=()=>{};const n=new $i(function(e,t){return{imageBuffer:e,...Wi(t.getSize(),t.getSpacing())}}(e,t),{});this.#be.addWorkerTask(n)}runOverlap(e,t){const n=[],i=new Map(e.map((({segNumber:e,minSlice:t})=>[e,t??0])));this.#be.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.#be.onwork=()=>{this.ondone({data:{labels:n}})};for(const{segNumber:n,size:i,slices:o}of e){const e=Wi(i,t.getSpacing());this.#be.addWorkerTask(new $i({segmentSlice:{segNumber:n,slices:o},...e},{}))}}ondone(e){}}class Zi extends Xi{constructor(e,t){super(e,t)}getWorker(){return new i.wc(new URL("./"+i.u(201),i.b),{name:"resampling.worker",type:"module"})}}class _i{#be=new Hi(5);constructor(){this.#be.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 p(s[0]*e,s[1]*t,s[2]*n),r=o.multiplyPoint3D(i);l[0]=Math.max(l[0],r.getX()),l[1]=Math.max(l[1],r.getY()),l[2]=Math.max(l[2],r.getZ()),c[0]=Math.min(c[0],r.getX()),c[1]=Math.min(c[1],r.getY()),c[2]=Math.min(c[2],r.getZ())}const u=[Math.abs(l[0]-c[0]),Math.abs(l[1]-c[1]),Math.abs(l[2]-c[2])],d=u[0]*u[1]*u[2],h=s[0]*s[1]*s[2],g=Math.cbrt(h/d),S=[u[0]*g,u[1]*g,u[2]*g],m=a.length();for(let e=3;e<m;e++)S.push(a.get(e));const f=new Fe(S),v=[r.get(0)/2*a.get(0),r.get(1)/2*a.get(1),r.get(2)/2*a.get(2)];let C=!0;const D=[0,0,0],y=[0,0,0];for(let e=-1;e<=1;e+=2)for(let t=-1;t<=1;t+=2)for(let n=-1;n<=1;n+=2){const i=new p(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 Re(I),L=void 0===n?new p(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 p(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 p(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 p(x.getX()+R[0]*e,x.getY()+R[1]*e,x.getZ()+R[2]*e));return new Ge(F,T,f,t)}(t,i,r),l=function(e,t,n){const i=Ie(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.#be.onworkitem=this.ondoneframe,this.#be.onworkend=this.ondone,c.forEach((e=>{const t=new Zi(e,{});this.#be.addWorkerTask(t)})),{buffer:l,geometry:s,jobId:a}}ondoneframe(e){}ondone(e){}}const Ki=["imagecontentchange","imagegeometrychange","imageresamplingstart","imageresamplingcomplete","imageresampled","labelingstart","labelschanged"];function Ji(e){return(new Kt).create(e,e["7FE00010"].value[0],1)}function eo(e){return(new Gi).create(e,e["7FE00010"].value[0])}class to extends EventTarget{#pe;#c;#xe;#Ee;#Re;#Fe;#Me;#qe;#Ue=new Ee(1,0);#Qe=null;#Ve=!0;#Ne=!0;#Be="MONOCHROME2";#ke;#Ge=0;#ze;#He={};#Ye=null;#Xe=null;#We=null;#$e;#je;#Ze=!1;#_e;constructor(e,t,n){super(),this.#pe=e,this.#c=t,this.#Ee=!1,this.#Re="0",this.#Fe=null,this.#Me=null,this.#xe=new Fi,this.#qe=n,this.#$e=null,this.#je=null,this.#ze=this.#c.length/this.#pe.getSize().getTotalSize()}setComplete(e){this.#Ze=e,e&&this.#pe.updateSliceSpacing()}getComplete(){return this.#Ze}setupSegmentCollection(){this.#_e=new qi(this.#pe),this.#_e.setLabelMap(this.#c)}setSegmentCollection(e){this.#_e=e}getSegmentCollection(){return this.#_e}getHasOverlap(){return this.#_e?.getHasOverlap()??!1}getImageUid(e){let t=this.#qe[0];return 1!==this.#qe.length&&void 0!==e&&(t=this.#qe[this.getSecondaryOffset(e)]),t}getOriginForImageUid(e){let t;const n=this.#qe.indexOf(e);return-1!==n&&(t=this.getGeometry().getOrigins()[n]),t}includesImageUid(e){return this.#qe.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.#qe,e)}getGeometry(){return this.#pe}getBuffer(){return this.#c}canQuantify(){return 1===this.getNumberOfComponents()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return Ct(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.#He.numberOfFiles&&(n=this.#He.numberOfFiles),t.canScroll(e)||1!==n}#Ke(){return this.#pe.getSize().getTotalSize(2)}getSecondaryOffset(e){return this.#pe.getSize().indexToOffset(e,2)}getRescaleSlopeAndIntercept(e){let t=this.#Ue;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.#Qe[n]?t=this.#Qe[n]:r.warn(`undefined non constant rsi at ${n}`)}return t}#Je(e){return this.#Qe[e]}setRescaleSlopeAndIntercept(e,t){if(this.#Ve=this.#Ve&&e.isID(),this.#Ne){if(!this.#Ue.equals(e))if(void 0===t)this.#Ue=e;else{this.#Ne=!1,this.#Qe=[];for(let e=0,t=this.#Ke();e<t;++e)this.#Qe.push(this.#Ue);this.#Ue=null,this.#Qe.splice(t,0,e)}}else{if(void 0===t)throw new Error("Cannot store non constant RSI with empty slice index.");this.#Qe.splice(t,0,e)}}isIdentityRSI(){return this.#Ve}isConstantRSI(){return this.#Ne}getPhotometricInterpretation(){return this.#Be}setPhotometricInterpretation(e){this.#Be=e}setPaletteColourMap(e){this.#ke=e,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPaletteColourMap(){return this.#ke}updatePaletteColourMap(e,t){this.#ke.red[e]=t.r,this.#ke.green[e]=t.g,this.#ke.blue[e]=t.b,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPlanarConfiguration(){return this.#Ge}setPlanarConfiguration(e){this.#Ge=e}getNumberOfComponents(){return this.#ze}getMeta(){return this.#He}setMeta(e){this.#He=e}getValueAtOffset(e){return this.#c[e]}getOffsets(e){let t;if("number"==typeof e){if(1!==this.#ze)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.#ze)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.#c.length;e+=this.#ze){i=!0;for(let n=0;n<this.#ze;++n)if(this.#c[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.#ze?t.push([e[n]]):3===this.#ze&&t.push([e[n].r,e[n].g,e[n].b]);let n;1===this.#ze?n=function(e,t){return e[0]===t[0]}:3===this.#ze&&(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.#c.length;e<n;e+=this.#ze){s=[];for(let n=0;n<r.length;++n){a=!0;for(let t=0;t<this.#ze;++t)if(this.#c[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.#c.slice(0),t=new to(this.getGeometry().clone(),e,this.#qe);if(this.isConstantRSI())t.setRescaleSlopeAndIntercept(this.getRescaleSlopeAndIntercept());else for(let e=0;e<this.#Ke();++e)t.setRescaleSlopeAndIntercept(this.#Je(e),e);return t.setPhotometricInterpretation(this.getPhotometricInterpretation()),t.setPlanarConfiguration(this.getPlanarConfiguration()),t.setPaletteColourMap(structuredClone(this.#ke)),t.setMeta(structuredClone(this.getMeta())),t}#et(e){let t=this.#c;if(this.#c=Ie(8*this.#c.BYTES_PER_ELEMENT,this.#He.PixelRepresentation,e),null===this.#c)throw new Error("Cannot reallocate data for image.");this.#c.set(t),t=null}canAppend(e){if(null===e)return{success:!1,message:"Cannot append null slice"};const t=this.#pe.canAppend(e.getGeometry());if(!t.success)return t;if(this.#Be!==e.getPhotometricInterpretation())return{success:!1,message:"Cannot append a slice with different photometric interpretation"};for(const t in this.#He)if("windowPresets"!==t&&"numberOfFiles"!==t&&"custom"!==t&&"SeriesTime"!==t&&this.#He[t]!==e.getMeta()[t])return{success:!1,message:`Cannot append a slice with different ${t}: ${this.#He[t]} != ${e.getMeta()[t]}`};return new a(!0)}appendSlice(e){const t=this.canAppend(e);if(!t.success)throw new Error(t.message);const n=e.getDataRange(),i=this.getDataRange();this.#Ye={min:Math.min(n.min,i.min),max:Math.max(n.max,i.max)};const r=e.getRescaledDataRange(),a=this.getRescaledDataRange();this.#Xe={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.#pe.hasSlicesAtTime(l)||(this.appendFrame(l,e.getGeometry().getOrigin()),s=this.#pe.getSize(),c=!0);const u=function(e,t){const n=t.getInitialTime(),i=[];return i.push(0),i.push(0),i.push(e.getSliceIndex(t.getOrigin(),n)),void 0!==n&&i.push(n),new o(i)}(this.#pe,e.getGeometry()),d=this.#ze*s.getDimSize(2);if(void 0===this.#He.numberOfFiles)throw new Error("Missing number of files for buffer manipulation.");const h=d*this.#He.numberOfFiles;this.#c.length!==h&&(this.#et(h),this.#xe.isInitialized()&&this.#xe.realloc(this.#c,this.#pe.getSize()));const g=u.get(2);let S=g;void 0!==l&&(S+=this.#pe.getCurrentNumberOfSlicesBeforeTime(l));const p=S*d,m=this.#pe.getCurrentTotalNumberOfSlices(),f=m*d;if(p<f&&(this.#c.set(this.#c.subarray(p,f),p+d),this.#xe.isInitialized())){const e=3*s.getDimSize(2),t=S*e,n=m*e;this.#xe.shiftSlice(t,e,n)}this.#c.set(e.getBuffer(),p),c||this.#pe.appendOrigin(e.getGeometry().getOrigin(),g,l),this.setRescaleSlopeAndIntercept(e.getRescaleSlopeAndIntercept(),S);const v=this.#qe.length;if(this.#qe.splice(S,0,e.getImageUid()),void 0!==this.#He.windowPresets){const t=this.#He.windowPresets,n=e.getMeta().windowPresets,i=Object.keys(n);let o;for(let e=0;e<i.length;++e){o=i[e];const r=n[o],a=t[o];if(void 0!==a){if((void 0===a.perslice||!1===a.perslice)&&!Ze(a.wl[0],r.wl[0])){a.perslice=!0;for(let e=0;e<v-1;++e)a.wl.push(a.wl[0])}void 0!==a.perslice&&!0===a.perslice&&t[o].wl.splice(S,0,r.wl[0])}else t[o]=n[o]}}this.dispatchEvent(new CustomEvent("imagegeometrychange"))}appendFrameBuffer(e,t){const n=this.#pe.getSize(),i=this.#ze*n.getDimSize(2);if(void 0===this.#He.numberOfFiles)throw new Error("Missing number of files for frame buffer manipulation.");const o=i*this.#He.numberOfFiles;this.#c.length!==o&&(this.#et(o),this.#xe.isInitialized()&&this.#xe.realloc(this.#c,this.#pe.getSize())),t>=this.#He.numberOfFiles?r.warn(`Ignoring frame at index ${t} (size: ${this.#He.numberOfFiles})`):(this.#c.set(e,i*t),this.appendFrame(t,new p(0,0,0)))}appendFrame(e,t){this.#pe.appendFrame(t,e),this.dispatchEvent(new CustomEvent("appendframe"))}getDataRange(){return this.#Ye||(this.#Ye=this.calculateDataRange()),this.#Ye}getRescaledDataRange(){return this.#Xe||(this.#Xe=this.calculateRescaledDataRange()),this.#Xe}getHistogram(){if(!this.#We){const e=this.calculateHistogram();this.#Ye=e.dataRange,this.#Xe=e.rescaledDataRange,this.#We=e.histogram}return this.#We}setAtOffsets(e,t){let n,i;if("number"==typeof t){if(1!==this.#ze)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.#ze)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.#ze;++e)this.#c[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.#c[r];const s=[];s.push({index:0,value:a});for(let e=0;e<o.length;++e){r=o[e];const n=this.#c[r];a!==n&&(s.push({index:e,value:n}),a=n),this.#c[r]=t,this.#xe.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=xe(n?t[i]:[{index:0,value:t}],o.length);let a=r.next();for(;!a.done;){const e=o[a.index];this.#c[e]=a.value,this.#xe.resetAroundOffset(e),a=r.next()}}this.dispatchEvent(new CustomEvent("imagecontentchange"))}getValue(e,t,n,i){const r=[e,t,n];void 0!==i&&r.push(i);const a=new o(r);return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(a))}getValueAtIndex(e){return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValue(e,t,n,i){let r=this.getValue(e,t,n,i);if(!this.isIdentityRSI())if(this.isConstantRSI())r=this.getRescaleSlopeAndIntercept().apply(r);else{const a=[e,t,n];void 0!==i&&a.push(i);const s=new o(a);r=this.getRescaleSlopeAndIntercept(s).apply(r)}return r}getRescaledValueAtIndex(e){return this.getRescaledValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValueAtOffset(e){let t=this.getValueAtOffset(e);if(!this.isIdentityRSI())if(this.isConstantRSI())t=this.getRescaleSlopeAndIntercept().apply(t);else{const n=this.getGeometry().getSize().offsetToIndex(e);t=this.getRescaleSlopeAndIntercept(n).apply(t)}return t}calculateDataRange(){let e,t=this.getValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();i.length()>=3&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateRescaledDataRange(){if(this.isIdentityRSI())return this.getDataRange();if(this.isConstantRSI()){const e=this.getDataRange(),t=this.getRescaleSlopeAndIntercept().apply(e.min),n=this.getRescaleSlopeAndIntercept().apply(e.max);return{min:t<n?t:n,max:t>n?t:n}}let e,t=this.getRescaledValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();3===i.length()&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getRescaledValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateHistogram(){const e=this.getGeometry().getSize(),t=[];let n,i,o=this.getValueAtOffset(0),r=o,a=this.getRescaledValueAtOffset(0),s=a;for(let l=0,c=e.getTotalSize();l<c;++l)n=this.getValueAtOffset(l),n>r&&(r=n),n<o&&(o=n),i=this.getRescaledValueAtOffset(l),i>s&&(s=i),i<a&&(a=i),t[i]=(t[i]||0)+1;const l={min:o,max:r},c={min:a,max:s},u=[];for(let e=a;e<=s;++e)u.push([e,t[e]||0]);return{dataRange:l,rescaledDataRange:c,histogram:u}}convolute2D(e){if(9!==e.length)throw new Error(`The convolution matrix does not have a length of 9; it has ${e.length}`);const t=this.clone(),n=t.getBuffer(),i=this.getGeometry().getSize(),o=i.getDimSize(2)*this.getNumberOfComponents();for(let t=0;t<i.get(2);++t)this.convoluteBuffer(e,n,t*o);return t}convoluteBuffer(e,t,n){const i=this.getGeometry().getSize(),o=i.get(0),r=i.get(1),a=this.getNumberOfComponents();let s=1,l=1;3===a&&(0===this.getPlanarConfiguration()?s=3:l=i.getDimSize(2));const c=[];c[0]=(-o-1)*s,c[1]=-o*s,c[2]=(1-o)*s,c[3]=-s,c[4]=0,c[5]=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.#xe.initialize(this.#c,this.#pe.getSize())}getContour(){return this.#xe}#tt(e){const t=this.#pe.getSpacing(),n=this.getMeta().lengthUnit;let i=1,r="unit.pixel";"unit.mm"===n&&(i=t.get(0)*t.get(1)*t.get(2)*.001,r="unit.ml");for(const t of e){let e,a;t.centroid=this.#pe.indexToWorld(new o(t.centroidIndex)),t.volume={value:t.count*i,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}}))}#nt(){const e=this.#pe.getSize(),t=e.get(0),n=e.get(1),i=[];for(const[e,o]of this.#_e.getAll()){const r=[...o.keys()],a=Math.min(...r),s=new Re([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.#$e.runOverlap(i,this.#pe)}recalculateLabels(){this.dispatchEvent(new CustomEvent("labelingstart")),null===this.#$e&&(this.#$e=new ji,this.#$e.ondone=e=>{this.#tt(e.data.labels),e.data.buffer&&(this.#c=e.data.buffer,this.dispatchEvent(new CustomEvent("imagecontentchange")))});const e=this.#_e;e?.getHasOverlap()&&e.getAll().size>0?this.#nt():this.#$e.run(this.#c,this.#pe)}isResampled(){return this.#Ee}resample(e,t=void 0,n=void 0){null===this.#je&&(this.#je=new _i,this.#je.ondoneframe=e=>{const t=e.data;this.#Re===t.jobId&&(this.#c.set(t.targetImageBuffer,t.startOffset),this.dispatchEvent(new CustomEvent("imageresampled",{detail:{frame:t.frame}})))},this.#je.ondone=e=>{this.dispatchEvent(new CustomEvent("imageresamplingcomplete"))});const i=this.#Ee&&this.#Me&&this.#Fe?{buffer:this.#Me,geometry:this.#Fe}:{buffer:this.#c,geometry:this.#pe};this.dispatchEvent(new CustomEvent("imageresamplingstart"));const o=this.#je.run(i.buffer,i.geometry,this.#He.PixelRepresentation,e,void 0===t||t,n);this.#Ee||(this.#Ee=!0,this.#Me=this.#c,this.#Fe=this.#pe),this.#c=o.buffer,this.#pe=o.geometry,this.#Re=o.jobId,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange"))}revert(){this.#Ee&&(this.dispatchEvent(new CustomEvent("imageresamplingstart")),this.#Ee=!1,this.#c=this.#Me,this.#pe=this.#Fe,this.#Me=null,this.#Fe=null,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange")),this.dispatchEvent(new CustomEvent("imageresampled")))}}const no=["annotationgroupeditablechange","annotationadd","annotationupdate","annotationremove"];class io extends EventTarget{#it;#He={};#ot;#rt;constructor(e){super(),this.#it=void 0!==e?e:[],this.#ot=!0}getList(){return this.#it}getLength(){return this.#it.length}isEditable(){return this.#ot}setEditable(e){this.#ot=e,this.dispatchEvent(new CustomEvent("annotationgroupeditablechange",{detail:{data:e}}))}getColour(){return this.#rt}setColour(e){this.#rt=e}add(e,t){this.#it.push(e),this.dispatchEvent(new CustomEvent("annotationadd",{detail:{data:e,propagate:t}}))}update(e,t,n){const i=this.#it.findIndex((t=>t.trackingUid===e.trackingUid));-1!==i?((t.includes("mathShape")||t.includes("textExpr"))&&e.updateQuantification(),this.#it[i]=e,this.dispatchEvent(new CustomEvent("annotationupdate",{detail:{data:e,keys:t,propagate:n}}))):r.warn("Cannot find annotation to update")}remove(e,t){const n=this.#it.findIndex((t=>t.trackingUid===e));if(-1!==n){const e=this.#it.splice(n,1)[0];this.dispatchEvent(new CustomEvent("annotationremove",{detail:{data:e,propagate:t}}))}else r.warn("Cannot find annotation to remove")}setViewController(e){for(const t of this.#it)t.setViewController(e),t.updateQuantification()}find(e){return this.#it.find((t=>t.trackingUid===e))}getMeta(){return this.#He}hasMeta(e){return void 0!==this.#He[e]}getMetaValue(e){return this.#He[e]}setMetaValue(e,t){this.#He[e]=t}}class oo{#at=10;#st="Verdana";#lt="#fff";#ct="#ffff80";#ut={x:1,y:1};#dt={x:1,y:1};#ht=2;#gt={x:.25,y:.25};#St=.2;#pt=3;getFontFamily(){return this.#st}getFontSize(){return this.#at}getStrokeWidth(){return this.#ht}getTextColour(){return this.#lt}getLineColour(){return this.#ct}setLineColour(e){this.#ct=e}setBaseScale(e){this.#ut=e}setZoomScale(e){this.#dt=e}getBaseScale(){return this.#ut}getZoomScale(){return this.#dt}scale(e){return e/this.#ut.x}applyZoomScale(e){return{x:e/this.#dt.x,y:e/this.#dt.y}}applyZoomRatio(e){return e*this.#dt.x/this.#dt.y}getShadowOffset(){return this.#gt}getTagOpacity(){return this.#St}getTextPadding(){return this.#pt}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=fn(e)).r+.002301961*t.g+447059e-9*t.b<.5;var t}(this.getLineColour())?"#fff":"#000"}}class ro{#mt;constructor(e){this.#mt=e}fromJSON(e){const t=JSON.parse(e);let n;if("0.1"===t.version)n=this.#ft(t);else if("0.2"===t.version)n=this.#vt(t);else if("0.3"===t.version)n=this.#Ct(t);else if("0.4"===t.version)n=this.#Dt(t);else{if("0.5"!==t.version)throw new Error(`Unknown state file format version: '${t.version}'.`);n=this.#yt(t)}return n}apply(e,t){const n=e.getStageController(),i=n.getActiveLayerGroup().getBaseViewLayer().getViewController(),o=new je(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.#mt)}#ft(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(Tn(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=ao(n.drawings).toObject(),t.drawingsDetails=so(n.drawingsDetails),(t=lo(t)).drawings=co(t.drawings),t}#vt(e){return e.drawings=ao(e.drawings).toObject(),e.drawingsDetails=so(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=lo(e)).drawings=co(e.drawings),e}#Ct(e){return e.drawingsDetails=so(e.drawingsDetails),(e=lo(e)).drawings=co(e.drawings),e}#Dt(e){return(e=lo(e)).drawings=co(e.drawings),e}#yt(e){return e}}function ao(t){let n,i,r;const a=new e.Layer({listening:!1,visible:!0}),s="string"==typeof t?JSON.parse(t):t;for(let t=0,c=s.length;t<c;++t)for(let c=0,u=s[t].length;c<u;++c)if(i=s[t][c],0!==i.length){r=new e.Group({id:(l=new o([1,1,t,c]),`slice-${l.get(2)}_frame-${4===l.length()?l.get(3):0}`),name:"position-group",visible:!1});for(let t=0,o=i.length;t<o;++t)n=e.Node.create(i[t]),n.draggable(!0),n.getChildren().forEach((function(e){e.draggable(!1)})),r.add(n);a.add(r)}var l;return a}function so(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 lo(e){const t=e.position;return e.position=[t.i,t.j,t.k],e}function co(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 uo(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 ho(e){const t=uo(e);return 0===Object.keys(t).length?null:t.query}function go(e){let t;const n=ho(e);return n&&void 0!==n.input&&(t=po(n.input,n.dwvReplaceMode)),t}function So(e,t){const n=ho(e);n&&void 0!==n.input&&mo(n.input,n.nslices,t)}function po(e,t){const n=[];let i="key";t&&(i=t);const o=decodeURIComponent(e),r=uo(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 mo(e,t,n){let i="";"/"===e[0]&&(i=`${window.location.protocol}//${window.location.host}`),i+=e;const o=new XMLHttpRequest;o.open("GET",decodeURIComponent(i),!0),o.responseType="document",o.onload=function(e){n(function(e,t){const n=[],i=`${e.getElementsByTagName("wado_query")[0].getAttribute("wadoURL")}?requestType=WADO&contentType=application/dicom&`,o=e.getElementsByTagName("Patient");o.length>1&&r.warn("More than one patient, loading first one.");const a=o[0].getElementsByTagName("Study");a.length>1&&r.warn("More than one study, loading first one.");const s=a[0].getAttribute("StudyInstanceUID"),l=a[0].getElementsByTagName("Series");l.length>1&&r.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))},o.onerror=function(e){r.warn(`RequestError while receiving manifest: ${e.target.status}`)},o.send(null)}const fo=["mousedown","mousemove","mouseup","mouseout","wheel","dblclick","touchstart","touchmove","touchend"];function vo(e,t){let n=0,i=0;void 0!==t&&(n=t.left,i=t.top);const o=[];for(let t=0;t<e.length;++t)o.push(new S(e[t].clientX-n,e[t].clientY-i));return o}function Co(e){const t=e.currentTarget.getBoundingClientRect();let n=[];return void 0!==e.targetTouches&&0!==e.targetTouches.length?n=vo(e.targetTouches,t):void 0!==e.changedTouches&&0!==e.changedTouches.length&&(n=vo(e.changedTouches,t)),n}function Do(e){return new S(e.offsetX,e.offsetY)}function yo(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 Io{#It;#wt=null;#Tt=[];#Lt={};constructor(e){this.#It=e}init(){for(const e in this.#It)this.#It[e].init();this.enableShortcuts(!0)}enableShortcuts(e){e?window.addEventListener("keydown",this.#Pt("window","keydown"),!0):window.removeEventListener("keydown",this.#Pt("window","keydown"),!0)}getToolList(){return this.#It}hasTool(e){return void 0!==this.getToolList()[e]}getSelectedTool(){return this.#wt}getSelectedToolEventHandler(e){return this.getSelectedTool()[e]}setSelectedTool(e){if(!this.hasTool(e))throw new Error(`Unknown tool: '${e}'`);this.#wt&&this.#wt.activate(!1),this.#wt=this.#It[e],this.#wt.activate(!0)}setToolFeatures(e){this.getSelectedTool()&&this.getSelectedTool().setFeatures(e)}bindLayerGroup(e,t){const n=e.getDivId();e.addEventListener("activelayerchange",this.#At(n)),this.#Ot(n,t)}#Ot(e,t){void 0!==this.#Lt[e]&&this.#bt(this.#Lt[e]),this.#Lt[e]=t,this.#xt(t)}#At(e){return t=>{const n=t.detail?.value,i=n?.[0];void 0!==i&&this.#Ot(e,i)}}#xt(e){e.bindInteraction();const t=fo;for(let n=0;n<t.length;++n)e.addEventListener(t[n],this.#Pt(e.getId(),t[n]))}#bt(e){e.unbindInteraction();const t=fo;for(let n=0;n<t.length;++n)e.removeEventListener(t[n],this.#Pt(e.getId(),t[n]))}#Pt(e,t){if(void 0===this.#Tt[e]&&(this.#Tt[e]=[]),void 0===this.#Tt[e][t]){const n=e=>{if(this.#wt){const t=this.#wt[e.type];t&&t(e)}};this.#Tt[e][t]=n}return this.#Tt[e][t]}}class wo{#Et=[];#Rt=2;#Ft;constructor(e){this.#Ft=e}setNumberOfDimensions(e){this.#Rt=e}setNToLoad(e){for(let t=0;t<e;++t){this.#Et[t]=[];for(let e=0;e<this.#Rt;++e)this.#Et[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.#Et[e.index][e.subindex]=t,n=void 0!==e.item?e.item:{loaded:this.#Mt(e.index),total:100,source:e.source},this.#Ft({lengthComputable:!0,loaded:this.#qt(),total:100,item:n})};#Mt(e){let t=0;for(let n=0;n<this.#Rt;++n)t+=this.#Et[e][n];return t/this.#Rt}#qt(){let e=0;const t=this.#Et.length;for(let n=0;n<t;++n)e+=this.#Mt(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 To{onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class Lo extends To{#Ut=null;#Qt=[];#Vt=null;#Nt=0;#Bt=0;#kt;#p;getDefaultCharacterSet(){return this.#p}setDefaultCharacterSet(e){this.#p=e}#Gt(e){this.#Ut=e,this.#Nt=0,this.#Bt=0,this.#kt=!1,this.#zt(),this.#Ht()}#Yt(e){this.#Qt.push(e)}#zt(){this.#Qt=[]}#Xt(e){this.#Vt=e}#Ht(){this.#Vt=null}#Wt=e=>{this.#Nt++,this.#Nt===this.#Ut.length&&this.onload({source:this.#Ut})};#$t=e=>{this.#Bt++,this.#Bt===this.#Ut.length&&this.onloadend({source:this.#Ut})};#jt(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.#Zt(e[0],t):this.#_t(e,t)}#Kt(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.#$t()):e.load(i.target.response,t,n)}}#_t(e,t){if(void 0===e||0===e.length)return;this.#Gt(e);const n=new wo(this.onprogress);n.setNToLoad(e.length);const i=ws(),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.#Wt,a.onloadend=this.#$t,a.onerror=this.onerror,a.onabort=this.onabort,this.#Xt(a);break}if(!s)throw new Error(`No loader found for url: ${r}`);let l=0;const c=()=>{l<this.#Qt.length-1&&!this.#kt&&(++l,this.#Qt[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.#jt(n.getMonoProgressHandler(i,0),r),o.onload=this.#Kt(a,r,i),o.onloadend=c;const s=this.#jt(this.onerror,r);o.onerror=e=>{this.#$t(),s(e)};const l=this.#jt(this.ontimeout,r);o.ontimeout=e=>{this.#$t(),l(e)};const u=this.#jt(this.onabort,r);o.onabort=e=>{this.#$t(),u(e)},1===a.loadUrlAs()&&(o.responseType="arraybuffer"),this.#Yt(o)}let u=this.#Qt.length;void 0!==t&&void 0!==t.batchSize&&0!==u&&(u=Math.min(t.batchSize,this.#Qt.length));for(let e=0;e<u;++e)this.#kt||(l=e,this.#Qt[l].send(null))}#Zt(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 Pe;return t.parse(e),function(e){const t=e["00041220"];if(void 0===t||void 0===t.value)return void r.warn("No Directory Record Sequence found in DICOMDIR.");const n=t.value;if(0===n.length)return void r.warn("The Directory Record Sequence of the DICOMDIR is empty.");const i=[];let o=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 r=t.value[0];if("STUDY"===r)a=[],i.push(a);else if("SERIES"===r)o=[],a.push(o);else if("IMAGE"===r){const t=n[e]["00041500"];if(void 0===t||void 0===t.value)continue;const i=t.value;o.push(i.join("/"))}}return i}(t.getDicomElements())}(n.target.response)[0][0],o=e.split("/").slice(0,-1).join("/"),a=[];for(let e=0;e<i.length;++e)a.push(`${o}/${i[e]}`);this.#_t(a,t)}},n.onerror=t=>{this.#jt(this.onerror,e)(t),this.onloadend({})},n.onabort=t=>{this.#jt(this.onabort,e)(t),this.onloadend({})},n.send(null)}abort(){this.#kt=!0;for(let e=0;e<this.#Qt.length;++e)4!==this.#Qt[e].readyState&&this.#Qt[e].abort();this.#Vt&&this.#Vt.isLoading()&&this.#Vt.abort()}ontimeout(e){}}class Po extends Xi{constructor(e,t){super(e,t)}getWorker(){return new i.wc(new URL("./"+i.u(968),i.b),{name:"jpegbaseline.worker",type:"module"})}}class Ao extends Xi{constructor(e,t){super(e,t)}getWorker(){return new i.wc(new URL("./"+i.u(112),i.b),{name:"jpegloss.worker",type:"module"})}}class Oo extends Xi{constructor(e,t){super(e,t)}getWorker(){return new i.wc(new URL("./"+i.u(557),i.b),{name:"jpeg2000.worker",type:"module"})}}class bo extends Xi{constructor(e,t){super(e,t)}getWorker(){return new i.wc(new URL("./"+i.u(326),i.b),{name:"rle.worker",type:"module"})}}class xo{#Jt;#en;#tn=!1;constructor(e){this.#Jt=e,this.#en=new Hi(10)}decode(e,t,n){this.#tn||(this.#tn=!0,this.#en.onworkstart=this.ondecodestart,this.#en.onworkitem=this.ondecodeditem,this.#en.onwork=this.ondecoded,this.#en.onworkend=this.ondecodeend,this.#en.onerror=this.onerror,this.#en.onabort=this.onabort);const i={buffer:e,meta:t};let o;"jpeg-baseline"===this.#Jt?o=new Po(i,n):"jpeg-lossless"===this.#Jt?o=new Ao(i,n):"jpeg2000"===this.#Jt?o=new Oo(i,n):"rle"===this.#Jt&&(o=new bo(i,n)),void 0!==o&&this.#en.addWorkerTask(o)}abort(){this.#en.abort()}ondecodestart(e){}ondecodeditem(e){}ondecoded(e){}ondecodeend(e){}onerror(e){}onabort(e){}}const Eo="0040A30A",Ro="0040A161",Fo="0040A162",Mo="0040A163",qo="004008EA";class Uo{numericValue;floatingPointValue;rationalNumeratorValue;rationalDenominatorValue;measurementUnitsCode;toString(){return`${this.numericValue} ${this.measurementUnitsCode.toString()}`}}function Qo(e){const t={};return void 0!==e.measurementUnitsCode&&(t.MeasurementUnitsCodeSequence={value:[Mn(e.measurementUnitsCode)]}),void 0!==e.floatingPointValue&&(t.FloatingPointValue=e.floatingPointValue),void 0!==e.rationalNumeratorValue&&(t.RationalNumeratorValue=e.rationalNumeratorValue),void 0!==e.rationalDenominatorValue&&(t.RationalDenominatorValue=e.rationalDenominatorValue),void 0!==e.numericValue&&(t.NumericValue=e.numericValue),t}const Vo="0040A300",No="0040A301";class Bo{measuredValue;numericValueQualifierCode;toString(){let e="";return void 0!==this.measuredValue&&(e+=this.measuredValue.toString()),void 0!==this.numericValueQualifierCode&&(e+=` ${this.numericValueQualifierCode.toString()}`),e}}function ko(e){const t={};return void 0!==e.measuredValue&&(t.MeasuredValueSequence={value:[Qo(e.measuredValue)]}),void 0!==e.numericValueQualifierCode&&(t.NumericValueQualifierCodeSequence={value:[Mn(e.numericValueQualifierCode)]}),t}const Go="00081150",zo="00081155";class Ho{referencedSOPClassUID;referencedSOPInstanceUID;toString(){return`${this.referencedSOPInstanceUID} (class: ${this.referencedSOPClassUID})`}}function Yo(e){const t=new Ho;return void 0!==e[Go]&&(t.referencedSOPClassUID=e[Go].value[0]),void 0!==e[zo]&&(t.referencedSOPInstanceUID=e[zo].value[0]),t}function Xo(e){const t={};return void 0!==e.referencedSOPClassUID&&(t.ReferencedSOPClassUID=e.referencedSOPClassUID),void 0!==e.referencedSOPInstanceUID&&(t.ReferencedSOPInstanceUID=e.referencedSOPInstanceUID),t}const Wo="00081160",$o="00081199",jo="0062000B";class Zo{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:[Xo(e.referencedSOPSequence)]}),void 0!==e.referencedSegmentNumber&&(t.ReferencedSegmentNumber=e.referencedSegmentNumber),t}class Ko{#nn;#in;constructor(e,t){this.#nn=e,this.#in=t}getBegin(){return this.#nn}getEnd(){return this.#in}equals(e){return null!==e&&this.getBegin().equals(e.getBegin())&&this.getEnd().equals(e.getEnd())}getDeltaX(){return this.getEnd().getX()-this.getBegin().getX()}getDeltaY(){return this.getEnd().getY()-this.getBegin().getY()}getLength(){return Math.sqrt(this.getDeltaX()*this.getDeltaX()+this.getDeltaY()*this.getDeltaY())}getWorldLength(e){let t=null;if(null!==e){const n=this.getDeltaX()*e.x,i=this.getDeltaY()*e.y;t=Math.sqrt(n*n+i*i)}return t}getMidpoint(){return this.getCentroid()}getCentroid(){return new S((this.getBegin().getX()+this.getEnd().getX())/2,(this.getBegin().getY()+this.getEnd().getY())/2)}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 Ko(this.#in,this.#nn)}quantify(e){const t=e.get2DSpacing(),n=this.getWorldLength(t);let i;return null!==n&&(i={value:n,unit:e.getLengthUnit()}),{length:i}}}function Jo(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 er(e,t){const n=e.getDeltaX(),i=e.getDeltaY();return n*t.getDeltaX()+i*t.getDeltaY()==0}function tr(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 ir(o,t.getY()-o*t.getX(),t,n,i)}function nr(e,t,n,i){const o=ir(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(),tr(e,r,n,i)}function ir(e,t,n,i,o){let r,a,s,l;if(void 0===o&&(o={x:1,y:1}),c(e,0,1e-4))r=n.getX()-i/(2*o.x),a=n.getY(),s=n.getX()+i/(2*o.x),l=n.getY();else if(Math.abs(e)>1e6)r=n.getX(),a=n.getY()-i/(2*o.y),s=n.getX(),l=n.getY()+i/(2*o.y);else{const c=o.x*o.x,u=o.y*o.y,d=i/(2*Math.sqrt(c+u*e*e));r=n.getX()-d,a=e*r+t,s=n.getX()+d,l=e*s+t}return new Ko(new S(r,a),new S(s,l))}class or{#on;constructor(e){if(e.length>3)throw new Error("Too many points for a protractor");this.#on=e.slice(0,3)}getPoint(e){return this.#on[e]}getLength(){return this.#on.length}getCentroid(){return this.#on[1]}quantify(e,t){let n;if(3===this.#on.length){let e=Jo(new Ko(this.#on[0],this.#on[1]),new Ko(this.#on[1],this.#on[2]));e>180&&(e=360-e),n={value:e,unit:"unit.degree"}}return{angle:n}}}class rr{#on=[];constructor(e){void 0!==e&&(this.#on=e)}getPoint(e){return this.#on[e]}getPoints(){return this.#on}getLength(){return this.#on.length}addPoint(e){this.#on.push(e)}addPoints(e){this.#on=this.#on.concat(e)}getCentroid(){let e,t=0,n=0,i=0;for(let e=0;e<this.#on.length;++e){const o=this.#on[e];let r;r=e===this.#on.length-1?this.#on[0]:this.#on[e+1];const a=o.getX()*r.getY()-r.getX()*o.getY();t+=a,n+=(o.getX()+r.getX())*a,i+=(o.getY()+r.getY())*a}if(0!==t){const o=1/(3*t);e=new S(o*n,o*i)}return e}}class ar{#rn;#an;constructor(e,t){this.#rn=e,this.#an=t}getCenter(){return this.#rn}getCentroid(){return this.#rn}getRadius(){return this.#an}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=Ve(o,n);l.min={value:a.min,unit:r},l.max={value:a.max,unit:r},l.mean={value:a.mean,unit:r},l.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(l.median={value:a.median,unit:r}),void 0!==a.p25&&(l.p25={value:a.p25,unit:r}),void 0!==a.p75&&(l.p75={value:a.p75,unit:r})}}return l}}class sr{#rn;#sn;#ln;constructor(e,t,n){this.#rn=e,this.#sn=t,this.#ln=n}getCenter(){return this.#rn}getCentroid(){return this.#rn}getA(){return this.#sn}getB(){return this.#ln}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=Ve(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 lr(e,t,n){const i=e.getValues(),r=i.slice(),a=[],s=t[0],l=t[1],c=s/l,u=Math.pow(l,2),d=n[0],h=n[1];for(let e=0;e<l;++e){const t=Math.round(c*Math.sqrt(u-Math.pow(e,2))),n=i[h]+e,s=i[h]-e;for(let e=0;e<t;++e){const t=i[d]+e,l=i[d]-e;r[d]=t,r[h]=n,a.push(new o(r.slice())),s!==n&&(r[h]=s,a.push(new o(r.slice()))),l!==t&&(r[d]=l,r[h]=n,a.push(new o(r.slice())),s!==n&&(r[h]=s,a.push(new o(r.slice()))))}}return a}class cr{#nn;#in;constructor(e,t){this.#nn=new S(Math.min(e.getX(),t.getX()),Math.min(e.getY(),t.getY())),this.#in=new S(Math.max(e.getX(),t.getX()),Math.max(e.getY(),t.getY()))}getBegin(){return this.#nn}getEnd(){return this.#in}equals(e){return null!==e&&this.getBegin().equals(e.getBegin())&&this.getEnd().equals(e.getEnd())}getSurface(){const e=this.getBegin(),t=this.getEnd();return Math.abs(t.getX()-e.getX())*Math.abs(t.getY()-e.getY())}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRealWidth(){return this.getEnd().getX()-this.getBegin().getX()}getRealHeight(){return this.getEnd().getY()-this.getBegin().getY()}getWidth(){return Math.abs(this.getRealWidth())}getHeight(){return Math.abs(this.getRealHeight())}getRound(){return{min:new S(Math.round(this.getBegin().getX()),Math.round(this.getBegin().getY())),max:new S(Math.round(this.getEnd().getX()),Math.round(this.getEnd().getY()))}}getCentroid(){return new S(this.getBegin().getX()+this.getWidth()/2,this.getBegin().getY()+this.getHeight()/2)}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=Ve(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 ur(e,t,n){const i=e.getValues(),r=i.slice(),a=[],s=t[0],l=Math.floor(s/2),c=t[1],u=Math.floor(c/2),d=n[0],h=n[1];for(let e=0;e<c;++e){r[h]=i[h]-u+e;for(let e=0;e<s;++e)r[d]=i[d]-l+e,a.push(new o(r.slice()))}return a}class dr{#nn;#in;shortAxisLength;shortAxisCenter;shortAxisL1;shortAxisL2;shortAxisT;constructor(e,t){this.#nn=e,this.#in=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.#nn}getEnd(){return this.#in}getCentroid(){return new S((this.#nn.getX()+this.#in.getX())/2,(this.#nn.getY()+this.#in.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.#in.getX()-this.#nn.getX()}getDeltaY(){return this.#in.getY()-this.#nn.getY()}quantify(e){const t=e.get2DSpacing?.()??{x:1,y:1},n=new Ko(this.#nn,this.#in).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.#nn.getX()+e*r,s=this.#nn.getY()+n*r,l=new S(a,s),c=-n/o,u=e/o,d="number"==typeof this.shortAxisL1?this.shortAxisL1:this.shortAxisLength/2,h="number"==typeof this.shortAxisL2?this.shortAxisL2:this.shortAxisLength/2,g=new S(l.getX()+c*d,l.getY()+u*d),p=new S(l.getX()-c*h,l.getY()-u*h);i=new Ko(g,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 hr="00480301",gr="00700022",Sr="00700023",pr="0070031A",mr="POINT",fr="MULTIPOINT",vr="POLYLINE",Cr="CIRCLE",Dr="ELLIPSE";class yr{graphicData;graphicType;pixelOriginInterpretation;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Ir(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 wr(e){const t=new yr;if(e instanceof S)t.graphicData=[e.getX().toString(),e.getY().toString()],t.graphicType=mr;else if(e instanceof Ko)t.graphicData=[e.getBegin().getX().toString(),e.getBegin().getY().toString(),e.getEnd().getX().toString(),e.getEnd().getY().toString()],t.graphicType=vr;else if(e instanceof or){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=vr}else if(e instanceof rr){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=vr}else if(e instanceof ar){const n=e.getCenter(),i=new S(n.getX()+e.getRadius(),n.getY());t.graphicData=[n.getX().toString(),n.getY().toString(),i.getX().toString(),i.getY().toString()],t.graphicType=Cr}else if(e instanceof sr){const n=e.getCenter(),i=e.getA(),o=e.getB();t.graphicData=[(n.getX()-i).toString(),n.getY().toString(),(n.getX()+i).toString(),n.getY().toString(),n.getX().toString(),(n.getY()-o).toString(),n.getX().toString(),(n.getY()+o).toString()],t.graphicType=Dr}else if(e instanceof cr){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=vr}else if(e instanceof dr){let n=0,i=0;const o=e.getBegin(),r=e.getEnd(),a=e.shortAxisCenter instanceof S?e.shortAxisCenter:e.getCentroid(),s=r.getX()-o.getX(),l=r.getY()-o.getY(),c=Math.sqrt(s*s+l*l);0!==c&&(n=-l/c,i=s/c);const u=e.shortAxisL1??e.shortAxisLength/2,d=e.shortAxisL2??e.shortAxisLength/2,h=new S(a.getX()+n*u,a.getY()+i*u),g=new S(a.getX()-n*d,a.getY()-i*d);t.graphicData=[o.getX().toString(),o.getY().toString(),r.getX().toString(),r.getY().toString(),h.getX().toString(),h.getY().toString(),g.getX().toString(),g.getY().toString()],t.graphicType=vr}return t}function Tr(e){if(void 0===e.graphicData)return;const t=e.graphicData.length;if(0===t)throw new Error("No coordinates in scoord data");if(t%2!=0)throw new Error("Expecting even number of coordinates in scoord data");const n=[];for(let i=0;i<t;i+=2)n.push(new S(parseFloat(e.graphicData[i]),parseFloat(e.graphicData[i+1])));let i=!1;const o=n.length;if(o>2){const e=n[0],t=n[o-1];i=e.equals(t)}let a;if(e.graphicType===mr)n.length>1&&r.warn(`Expecting 1 point for point, got ${o}`),a=n[0];else if(e.graphicType===Cr){if(n.length<2)throw new Error(`Expecting 2 points for circles, got ${o}`);n.length>2&&r.warn(`Expecting 2 points for circles, got ${o}`);const e=n[0],t=n[1].getDistance(e);a=new ar(e,t)}else if(e.graphicType===Dr){if(n.length<4)throw new Error(`Expecting 4 points for ellipses, got ${o}`);n.length>4&&r.warn(`Expecting 4 points for ellipses, got ${o}`);const e=n[0].getDistance(n[1])/2,t=n[2].getDistance(n[3])/2,i=new S(n[0].getX()+e,n[0].getY());a=new sr(i,e,t)}else if(e.graphicType===vr)if(i)if(5===n.length){const e=new Ko(n[0],n[1]),t=new Ko(n[1],n[2]),i=new Ko(n[2],n[3]),o=new Ko(n[3],n[4]);a=er(e,t)&&er(t,i)&&er(i,o)?new cr(n[0],n[2]):new rr(n.slice(0,-1))}else a=new rr(n.slice(0,-1));else if(2===n.length)a=new Ko(n[0],n[1]);else if(3===n.length)a=new or([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 dr(e,t);const s=(i.getX()+o.getX())/2,l=(i.getY()+o.getY())/2,c=i.getX()-s,u=i.getY()-l,d=s-o.getX(),h=l-o.getY(),g=Math.sqrt(c*c+u*u),p=Math.sqrt(d*d+h*h),m=g+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=g,a.shortAxisL2=p,a.shortAxisCenter=new S(s,l),a.hasShortAxisInteraction=!0}return a}const Lr="00700022",Pr="00700023",Ar="30060024",Or="0070031A";class br{graphicData;graphicType;referencedFrameofReferenceUID;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function xr(e){const t={};return void 0!==e.graphicData&&(t.GraphicData=e.graphicData),void 0!==e.graphicType&&(t.GraphicType=e.graphicType),void 0!==e.referencedFrameofReferenceUID&&(t.ReferencedFrameofReferenceUID=e.referencedFrameofReferenceUID),void 0!==e.fiducialUID&&(t.FiducialUID=e.fiducialUID),t}const Er={ReferencedSOPSequence:"00081199",RelationshipType:"0040A010",ValueType:"0040A040",ConceptNameCodeSequence:"0040A043",ConceptCodeSequence:"0040A168",ContentSequence:"0040A730",DateTime:"0040A120",Date:"0040A121",Time:"0040A122",UID:"0040A124",PersonName:"0040A123",TextValue:"0040A160",ContinuityOfContent:"0040A050",ContentTemplateSequence:"0040A504",MappingResource:"00080105",TemplateIdentifier:"0040DB00"},Rr="CONTAINS",Fr="HAS PROPERTIES",Mr="HAS OBS CONTEXT",qr="INFERRED FROM",Ur="SELECTED FROM",Qr="HAS CONCEPT MOD",Vr="TEXT",Nr="NUM",Br="CODE",kr="UIDREF",Gr="COMPOSITE",zr="IMAGE",Hr="SCOORD",Yr="SCOORD3D",Xr="CONTAINER",Wr="SEPARATE",$r={TEXT:"TextValue",DATE:"Date",TIME:"Time",DATETIME:"DateTime",UIDREF:"UID",PNAME:"PersonName",CONTAINER:"ContinuityOfContent"};function jr(e){let t;const n=oe(e,Er.ContentTemplateSequence);if(void 0!==n){const e=oe(n,Er.MappingResource),i=oe(n,Er.TemplateIdentifier);void 0!==e&&void 0!==i&&(t=`${e}-${i}`)}return t}class Zr{valueType;conceptNameCode;relationshipType;contentSequence=[];value;constructor(e){this.valueType=e}toString(e){void 0===e&&(e="");let t="";void 0!==this.relationshipType&&(t+=`(${this.relationshipType}) `),t+=`${this.valueType}: `,void 0!==this.conceptNameCode&&(t+=this.conceptNameCode.toString()),t+=` = ${this.value.toString()}`;for(const n of this.contentSequence)t+=`\n${e}- ${n.toString(`${e}`)} `;return t}hasHeader(e,t,n){return this.valueType===e&&Rn(this.conceptNameCode,t)&&this.relationshipType===n}}function _r(e){let t=oe(e,Er.ValueType);void 0===t&&(t="");const n=new Zr(t);n.relationshipType=oe(e,Er.RelationshipType);const i=oe(e,Er.ConceptNameCodeSequence);if(void 0!==i&&(n.conceptNameCode=Fn(i)),t===Br)n.value=Fn(oe(e,Er.ConceptCodeSequence));else if(t===Nr)n.value=function(e){const t=new Bo;return void 0!==e[Vo]&&(t.measuredValue=function(e){const t=new Uo;return void 0!==e[Eo]&&(t.numericValue=parseFloat(e[Eo].value[0])),void 0!==e[Ro]&&(t.floatingPointValue=parseFloat(e[Ro].value[0])),void 0!==e[Fo]&&(t.rationalNumeratorValue=parseInt(e[Fo].value[0],10)),void 0!==e[Mo]&&(t.rationalDenominatorValue=parseInt(e[Mo].value[0],10)),void 0!==e[qo]&&(t.measurementUnitsCode=Fn(e[qo].value[0])),t}(e[Vo].value[0])),void 0!==e[No]&&(t.numericValueQualifierCode=Fn(e[No].value[0])),t}(e);else if(t===zr)n.value=function(e){const t=new Zo;return void 0!==e[Wo]&&(t.referencedFrameNumber=e[Wo].value[0]),void 0!==e[$o]&&(t.referencedSOPSequence=Yo(e[$o].value[0])),void 0!==e[jo]&&(t.referencedSegmentNumber=e[jo].value[0]),t}(e);else if(t===Gr)n.value=Yo(oe(e,Er.ReferencedSOPSequence));else if(t===Hr)n.value=function(e){const t=new yr;return void 0!==e[gr]&&(t.graphicData=e[gr].value),void 0!==e[Sr]&&(t.graphicType=e[Sr].value[0]),void 0!==e[hr]&&(t.pixelOriginInterpretation=e[hr].value[0]),void 0!==e[pr]&&(t.fiducialUID=e[pr].value[0]),t}(e);else if(t===Yr)n.value=function(e){const t=new br;return void 0!==e[Lr]&&(t.graphicData=e[Lr].value),void 0!==e[Pr]&&(t.graphicType=e[Pr].value[0]),void 0!==e[Ar]&&(t.referencedFrameofReferenceUID=e[Ar].value[0]),void 0!==e[Or]&&(t.fiducialUID=e[Or].value[0]),t}(e);else{const i=$r[t];void 0!==i?n.value=oe(e,Er[i]):console.warn(`Unsupported input ValueType: ${t}`)}const o=re(e,Er.ContentSequence);if(void 0!==o)for(const e of o)n.contentSequence.push(_r(e));return n}function Kr(e){let t={};if(void 0!==e.relationshipType&&(t.RelationshipType=e.relationshipType),void 0!==e.valueType&&(t.ValueType=e.valueType),void 0!==e.conceptNameCode&&(t.ConceptNameCodeSequence={value:[Mn(e.conceptNameCode)]}),"CODE"===e.valueType)t.ConceptCodeSequence={value:[Mn(e.value)]};else if(e.valueType===Nr)t={...t,...ko(e.value)};else if(e.valueType===zr)t={...t,..._o(e.value)};else if(e.valueType===Gr)t={...t,...Xo(e.value)};else if(e.valueType===Hr)t={...t,...Ir(e.value)};else if(e.valueType===Yr)t={...t,...xr(e.value)};else{const n=$r[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(Kr(n))}return t}function Jr(e,t,n,i){const o=function(e){const t=di[e];let n;return void 0!==t&&(n="DCM"===t.scheme?si({meaning:e,value:t.key}):li(t.key,t.scheme)),n}(e);if(void 0===o)return;let r=Rr;void 0!==i&&(r=i);const a=new Zr(Nr);a.relationshipType=r,a.conceptNameCode=o;const s=new Uo;s.numericValue=t,s.measurementUnitsCode=gi(n);const l=new Bo;return l.measuredValue=s,a.value=l,a}class ea{#cn;#n;#i;constructor(e,t,n){this.#cn=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 ea(ea.idFromIndex(e),t,n)}getId(){return this.#cn}getX(){return this.#n}getY(){return this.#i}setX(e){this.#n=e}setY(e){this.#i=e}}const ta={arrow:{"*":""},circle:{"*":"{surface}"},ellipse:{"*":"{surface}"},protractor:{"*":"{angle}"},rectangle:{"*":"{surface}"},roi:{"*":""},ruler:{"*":"{length}"},bidimensional:{"*":"{longAxis} x {shortAxis}"},bidimensionalDrawing:{"*":"{longAxis}"}};function na(e){return"label"===e.name()}function ia(e){return"shape"===e.name()}function oa(e){return"position-group"===e.name()}function ra(t,n){const i=t.getChildren((function(e){return e.id()===`anchor${n}`}))[0];if(i instanceof e.Ellipse)return i}function aa(e){return function(t){return t.id()===e}}function sa(t,n,i,o){const r=o.applyZoomScale(6),a={x:Math.abs(r.x),y:Math.abs(r.y)};return new e.Ellipse({x:t,y:n,stroke:"#999",fill:"rgba(100,100,100,0.7",strokeWidth:o.getStrokeWidth(),strokeScaleEnabled:!1,radius:a,radiusX:a.x,radiusY:a.y,name:"anchor",id:i.toString(),dragOnTop:!1,draggable:!0,visible:!1})}function la(e){return void 0!==ot.labelTexts&&void 0!==ot.labelTexts[e]?ot.labelTexts[e]:ta[e]}class ca{#un="rectangle";#dn;static supports(e){return e instanceof cr}getName(){return this.#un}getGroupName(){return`${this.#un}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new cr(t[0],t[1]),e.setTextExpr(la(this.#un)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=ea.indexFromId(t.getId()),i=(n+1)%4,o=(n+2)%4,r=(n+3)%4;void 0===this.#dn&&(this.#dn=this.getAnchors(e));const a=this.#dn[o];this.#dn[n]=t,n%2==0?(this.#dn[r].setX(t.getX()),this.#dn[i].setY(t.getY())):(this.#dn[r].setY(t.getY()),this.#dn[i].setX(t.getX())),e.mathShape=new cr(new S(a.getX(),a.getY()),new S(t.getX(),t.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new cr(new S(i.getX()+t.x,i.getY()+t.y),new S(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){this.#dn=void 0}getAnchors(e){if(void 0!==this.#dn)return this.#dn;const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[ea.fromIndex(0,n,i),ea.fromIndex(1,n+o,i),ea.fromIndex(2,n+o,i+r),ea.fromIndex(3,n,i+r)]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[new S(n+o/2,i),new S(n,i+r/2),new S(n+o/2,i+r),new S(n+o,i+r/2)]}getDefaultLabelPosition(e){const t=e.mathShape;return new S(t.getBegin().getX(),t.getEnd().getY())}}class ua{#un="circle";static supports(e){return e instanceof ar}getName(){return this.#un}getGroupName(){return`${this.#un}-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 ar(t[0],Math.round(Math.sqrt(n*n+i*i))),e.setTextExpr(la(this.#un)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=new S(n.getCenter().getX(),n.getCenter().getY()),o=new S(t.getX(),t.getY());e.mathShape=new ar(i,i.getDistance(o)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new ar(new S(i.getX()+t.x,i.getY()+t.y),n.getRadius()),e.updateQuantification()}constrainAnchorMove(e,t){const n=this.getAnchors(t);switch(e.getId()){case"anchor0":e.setY(n[1].getY());break;case"anchor1":e.setY(n[0].getY());break;case"anchor2":e.setX(n[3].getX());break;case"anchor3":e.setX(n[2].getX());break;default:r.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[ea.fromIndex(0,n-o,i),ea.fromIndex(1,n+o,i),ea.fromIndex(2,n,i+o),ea.fromIndex(3,n,i-o)]}getConnectorPositions(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getRadius()*Math.sqrt(2)/2;return[new S(n-o,i-o),new S(n+o,i-o),new S(n-o,i+o),new S(n+o,i+o)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter(),i=t.getRadius();return new S(n.getX()-i,n.getY()+i)}}class da{#un="ellipse";static supports(e){return e instanceof sr}getName(){return this.#un}getGroupName(){return`${this.#un}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){const n=Math.abs(t[0].getX()-t[1].getX()),i=Math.abs(t[0].getY()-t[1].getY());e.mathShape=new sr(t[0],n,i),e.setTextExpr(la(this.#un)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=n.getCenter();let o=n.getA(),a=n.getB();switch(t.getId()){case"anchor0":o=i.getX()-t.getX();break;case"anchor1":o=t.getX()-i.getX();break;case"anchor2":a=t.getY()-i.getY();break;case"anchor3":a=i.getY()-t.getY();break;default:r.error(`Unhandled anchor id: ${t.getId()}`)}e.mathShape=new sr(i,Math.abs(o),Math.abs(a)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new sr(new S(i.getX()+t.x,i.getY()+t.y),n.getA(),n.getB()),e.updateQuantification()}constrainAnchorMove(e,t){const n=this.getAnchors(t);switch(e.getId()){case"anchor0":e.setY(n[1].getY());break;case"anchor1":e.setY(n[0].getY());break;case"anchor2":e.setX(n[3].getX());break;case"anchor3":e.setX(n[2].getX());break;default:r.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[ea.fromIndex(0,n-o,i),ea.fromIndex(1,n+o,i),ea.fromIndex(2,n,i+r),ea.fromIndex(3,n,i-r)]}getConnectorPositions(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getA()*Math.sqrt(2)/2,r=t.getB()*Math.sqrt(2)/2;return[new S(n-o,i-r),new S(n+o,i-r),new S(n-o,i+r),new S(n+o,i+r)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter();return new S(n.getX()-t.getA(),n.getY()+t.getB())}}class ha{#un="ruler";static supports(e){return e instanceof Ko}getName(){return this.#un}getGroupName(){return`${this.#un}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new Ko(t[0],t[1]),e.setTextExpr(la(this.#un)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[ea.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new Ko(new S(i.getX(),i.getY()),new S(o.getX(),o.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new Ko(new S(i.getX()+t.x,i.getY()+t.y),new S(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[ea.fromIndex(0,n.getX(),n.getY()),ea.fromIndex(1,i.getX(),i.getY())]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[new S((n.getX()+i.getX())/2,(n.getY()+i.getY())/2)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return n.getY()>=i.getY()?n:i}}class ga{#un="arrow";static supports(e){return e instanceof S}getName(){return this.#un}getGroupName(){return`${this.#un}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=t[0],e.referencePoints=[t[1]],e.setTextExpr(la(this.#un)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[ea.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new S(i.getX(),i.getY()),e.referencePoints=[new S(o.getX(),o.getY())],e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=e.referencePoints[0];e.mathShape=new S(n.getX()+t.x,n.getY()+t.y),e.referencePoints=[new S(i.getX()+t.x,i.getY()+t.y)],e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=e.referencePoints[0];return[ea.fromIndex(0,t.getX(),t.getY()),ea.fromIndex(1,n.getX(),n.getY())]}getConnectorPositions(e){const t=e.mathShape,n=e.referencePoints[0];return[new S((t.getX()+n.getX())/2,(t.getY()+n.getY())/2)]}getDefaultLabelPosition(e){return e.mathShape}}class Sa{#un="roi";static supports(e){return e instanceof rr}getName(){return this.#un}getGroupName(){return`${this.#un}-group`}getNPoints(){}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new rr(t),e.setTextExpr(la(this.#un)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape.getPoints().slice();n[ea.indexFromId(t.getId())]=new S(t.getX(),t.getY()),e.mathShape=new rr(n),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<n.getLength();++e)i.push(new S(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new rr(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(ea.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){const t=e.mathShape,n=t.getLength(),i=[];for(let e=0;e<n;++e){const o=t.getPoint(e),r=t.getPoint((e+1)%n);i.push(new S((o.getX()+r.getX())/2,(o.getY()+r.getY())/2))}return i}getDefaultLabelPosition(e){return e.mathShape.getPoint(0)}}class pa{#un="protractor";static supports(e){return e instanceof or}getName(){return this.#un}getGroupName(){return`${this.#un}-group`}getNPoints(){return 3}isComplete(e){return e.mathShape.getLength()===this.getNPoints()}setAnnotationMathShape(e,t){e.mathShape=new or(t),e.setTextExpr(la(this.#un)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[ea.indexFromId(t.getId())]=t;const i=n[0],o=n[1],r=n[2];e.mathShape=new or([new S(i.getX(),i.getY()),new S(o.getX(),o.getY()),new S(r.getX(),r.getY())]),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<3;++e)i.push(new S(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new or(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(ea.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){return[e.mathShape.getPoint(1)]}getDefaultLabelPosition(e){const t=e.mathShape,n=new Ko(t.getPoint(0),t.getPoint(1)),i=new Ko(t.getPoint(1),t.getPoint(2));return new S((n.getCentroid().getX()+i.getCentroid().getX())/2,(n.getCentroid().getY()+i.getCentroid().getY())/2)}}function ma(e,t,n,i=20){const o=tr(t,t.getBegin(),i,n),r=tr(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 fa{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 va(e){const t=new Ko(e.getPoint(0),e.getPoint(1)),n=new Ko(e.getPoint(1),e.getPoint(2));let i=Jo(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 Ca(t,n,i){const{radius:o,angle:r,inclination:a}=va(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 Da(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 ya={rectangle:new class extends fa{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 fa{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 fa{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 fa{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 ma(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()]),ma(e,i,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=n.getZoomScale(),r=tr(i,i.getBegin(),20,o),a=tr(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=tr(o,o.getBegin(),20,r),s=tr(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 fa{createShape(t,n){const i=t.mathShape,o=t.referencePoints[0],r=new Ko(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 ma(a,r,n.getZoomScale()),a}updateShape(e,t,n){const i=t.mathShape,o=t.referencePoints[0],r=new Ko(i,o);e.position({x:0,y:0}),e.points([i.getX(),i.getY(),o.getX(),o.getY()]),ma(e,r,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=t.referencePoints[0],r=nr(new Ko(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=nr(new Ko(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 fa{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 fa{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()&&Da(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()]),Da(e,n)}createExtras(e,t){const n=e.mathShape;return 3!==n.getLength()?[]:[Ca(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}=va(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 Ia(e){const t=ya[e];return t||r.error(`shapePainters: no painter for shape '${e}'`),t}class wa{#hn;constructor(e){this.#hn=e}getPosition(e){let t=e.labelPosition;return void 0===t&&(t=this.#hn(e)),t}create(t,n){const i=new e.Text({fontSize:n.getFontSize(),fontFamily:n.getFontFamily(),fill:t.colour,padding:n.getTextPadding(),shadowColor:n.getShadowLineColour(),shadowOffset:n.getShadowOffset(),name:"text"}),o=t.getText();i.setText(o);const r=n.applyZoomScale(1),a={x:2*r.x,y:2*r.y},s=this.getPosition(t),l=new e.Label({x:s.getX(),y:s.getY(),scale:a,visible:0!==o.length,name:"label"});return l.add(i),l.add(new e.Tag({fill:t.colour,opacity:n.getTagOpacity()})),l}updatePosition(t,n){const i=n.getChildren((function(e){return"label"===e.name()}))[0];if(!(i instanceof e.Label))return;const o=this.getPosition(t);i.position({x:o.getX(),y:o.getY()})}getLabelAnchorsPosition(e){const t=e.x(),n=e.y(),i=e.width()*e.scale().x,o=e.height()*e.scale().y;return[new S(t+i/2,n),new S(t,n+o/2),new S(t+i/2,n+o),new S(t+i,n+o/2)]}getClosestPoints(e,t){let n=e[0].getDistance(t[0]),i=e[0],o=t[0];for(const r of e)for(const e of t){const t=r.getDistance(e);t<n&&(n=t,i=r,o=e)}return[i,o]}getConnector(t,n,i){const o=this.getLabelAnchorsPosition(n),r=this.getClosestPoints(t,o);return new e.Line({points:[r[0].getX(),r[0].getY(),r[1].getX(),r[1].getY()],stroke:n.getText().fill(),strokeWidth:i.getStrokeWidth(),strokeScaleEnabled:!1,visible:n.visible(),dash:[10,7],name:"connector"})}updateConnector(t,n){const i=t.getChildren((function(e){return"label"===e.name()}))[0];if(!(i instanceof e.Label))return;const o=this.getLabelAnchorsPosition(i),r=this.getClosestPoints(n,o),a=t.getChildren((function(e){return"connector"===e.name()}))[0];a instanceof e.Line&&a.points([r[0].getX(),r[0].getY(),r[1].getX(),r[1].getY()])}updateContent(t,n){const i=n.getChildren((function(e){return"label"===e.name()}))[0];if(!(i instanceof e.Label))return;const o=t.getText();i.getText().setText(o),i.visible()&&i.visible(0!==o.length)}}class Ta{#gn;#Sn;constructor(e){this.#gn=e,this.#Sn=new wa((t=>e.getDefaultLabelPosition(t)))}createShapeGroup(t,n){const i=Ia(this.#gn.getName()),o=new e.Group;if(o.name(this.#gn.getGroupName()),o.visible(!0),o.id(t.trackingUid),o.add(i.createShape(t,n)),this.#gn.isComplete(t)){for(const e of i.createExtras(t,n))o.add(e);const e=this.#Sn.create(t,n);o.add(e);const r=this.#gn.getConnectorPositions(t);o.add(this.#Sn.getConnector(r,e,n))}return o}getAnchors(e,t){return e?this.#gn.getAnchors(e).map((e=>sa(e.getX(),e.getY(),e.getId(),t))):[]}constrainAnchorMove(e,t){const n=new ea(e.id(),e.x(),e.y());this.#gn.constrainAnchorMove(n,t),e.x(n.getX()),e.y(n.getY())}onAnchorMoveEnd(t,n){this.#gn.onAnchorMoveEnd();const i=t.getParent();if(!(i instanceof e.Group))return;const o=this.#gn.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 ea(t.id(),t.x(),t.y());this.#gn.updateAnnotationOnAnchorMove(e,n)}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();if(!(o instanceof e.Group))return;const r=Ia(this.#gn.getName()),a=o.getChildren(ia)[0];r.updateShape(a,t,i),r.updateExtras(o,t,i);const s=this.#gn.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.#Sn.updatePosition(t,o),this.updateConnector(t,o)}updateLabelContent(e,t,n){this.#Sn.updateContent(e,t)}updateConnector(e,t){const n=this.#gn.getConnectorPositions(e);this.#Sn.updateConnector(t,n)}}class La{#pn=0;#mn=0;getMin(){return this.#pn}setMin(e){this.#pn=e}getMax(){return this.#mn}setMax(e){this.#mn=e}getName(){return"Threshold"}#fn=null;setOriginalImage(e){this.#fn=e}getOriginalImage(){return this.#fn}update(){const e=this.getOriginalImage(),t=e.getDataRange().min;return e.transform((e=>e<this.getMin()||e>this.getMax()?t:e))}}class Pa{getName(){return"Sharpen"}#fn=null;setOriginalImage(e){this.#fn=e}getOriginalImage(){return this.#fn}update(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])}}class Aa{getName(){return"Sobel"}#fn=null;setOriginalImage(e){this.#fn=e}getOriginalImage(){return this.#fn}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 Oa{getName(){return""}execute(){}undo(){}}class ba extends EventTarget{#vn=[];#Cn=0;getStackSize(){return this.#vn.length}getCurrentStackIndex(){return this.#Cn}getCurrentCommand(){return this.#vn[this.#Cn-1]}add(e){this.#vn=this.#vn.slice(0,this.#Cn),this.#vn.push(e),++this.#Cn,this.dispatchEvent(new Event("undoadd"))}remove(e){let t=!1;const n=this.#vn.findIndex((function(t){return t.getName()===e}));return-1!==n&&(t=!0,this.dispatchEvent(new CustomEvent("undoremove",{detail:{commandName:e}})),this.#vn.splice(n,1),--this.#Cn),t}undo(){this.#Cn>0&&(this.dispatchEvent(new Event("undo")),--this.#Cn,this.#vn[this.#Cn].undo())}redo(){this.#Cn<this.#vn.length&&(this.#vn[this.#Cn].execute(),++this.#Cn,this.dispatchEvent(new Event("redo")))}}class xa extends Oa{#Dn;#mt;#yn;constructor(e,t,n){super(),this.#Dn=e,this.#mt=t,this.#yn=n}getName(){return`Filter-${this.#Dn.getName()}`}execute(){this.#yn.getDataController().setImage(this.#mt,this.#Dn.update()),this.#yn.getStageController().render(this.#mt);const e={type:"filterrun",id:this.getName(),dataId:this.#mt};this.onExecute(e)}undo(){this.#yn.getDataController().setImage(this.#mt,this.#Dn.getOriginalImage()),this.#yn.getStageController().render(this.#mt);const e={type:"filterundo",id:this.getName(),dataid:this.#mt};this.onUndo(e)}onExecute(e){}onUndo(e){}}class Ea extends EventTarget{#yn;constructor(e){super(),this.#yn=e}#In;#wn=0;#Tn=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))};activate(e){for(const t in this.#In)e?(this.#In[t].addEventListener("filterrun",this.#Tn),this.#In[t].addEventListener("filterundo",this.#Tn)):(this.#In[t].removeEventListener("filterrun",this.#Tn),this.#In[t].removeEventListener("filterundo",this.#Tn))}setOptions(e){this.#In={};for(const t in e)this.#In[t]=new e[t](this.#yn)}getOptionsType(){return"instance"}init(){for(const e in this.#In)this.#In[e].init()}keydown=e=>{e.context="Filter",this.#yn.onKeydown(e)};getEventNames(){return["filterrun","filterundo"]}getSelectedFilter(){return this.#wn}setFeatures(e){if(void 0!==e.filterName){if(!this.hasFilter(e.filterName))throw new Error(`Unknown filter: '${e.filterName}'`);this.#wn&&this.#wn.activate(!1),this.#wn=this.#In[e.filterName],this.#wn.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.#In}hasFilter(e){return void 0!==this.#In?.[e]}}class Ra extends EventTarget{#yn;constructor(e){super(),this.#yn=e}#Dn=new La;#Ln=!0;activate(e){e&&(this.#Ln=!0)}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run threshod filter on.");if(this.#Dn.setMin(e.min),this.#Dn.setMax(e.max),this.#Ln){const t=this.#yn.getDataController().get(e.dataId).image;this.#Dn.setOriginalImage(t),this.#Ln=!1}const t=new xa(this.#Dn,e.dataId,this.#yn);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.#yn.getUndoController().addToUndoStack(t)}}class Fa extends EventTarget{#yn;constructor(e){super(),this.#yn=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sharpen filter on.");const t=new Pa,n=this.#yn.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new xa(t,e.dataId,this.#yn);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.#yn.getUndoController().addToUndoStack(i)}}class Ma extends EventTarget{#yn;constructor(e){super(),this.#yn=e}activate(e){}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run sobel filter on.");const t=new Aa,n=this.#yn.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new xa(t,e.dataId,this.#yn);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.#yn.getUndoController().addToUndoStack(i)}}const qa={},Ua={draw:{ArrowFactory:class{#gn=new ga;#Pn=new Ta(this.#gn);static supports(e){return ga.supports(e)}getName(){return this.#gn.getName()}getGroupName(){return this.#gn.getGroupName()}getNPoints(){return this.#gn.getNPoints()}setAnnotationMathShape(e,t){this.#gn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Pn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Pn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Pn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Pn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Pn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Pn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#gn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Pn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Pn.updateConnector(e,t)}},CircleFactory:class{#gn=new ua;#Pn=new Ta(this.#gn);static supports(e){return ua.supports(e)}getName(){return this.#gn.getName()}getGroupName(){return this.#gn.getGroupName()}getNPoints(){return this.#gn.getNPoints()}setAnnotationMathShape(e,t){this.#gn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Pn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Pn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Pn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Pn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Pn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Pn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#gn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Pn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Pn.updateConnector(e,t)}},EllipseFactory:class{#gn=new da;#Pn=new Ta(this.#gn);static supports(e){return da.supports(e)}getName(){return this.#gn.getName()}getGroupName(){return this.#gn.getGroupName()}getNPoints(){return this.#gn.getNPoints()}setAnnotationMathShape(e,t){this.#gn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Pn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Pn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Pn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Pn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Pn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Pn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#gn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Pn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Pn.updateConnector(e,t)}},ProtractorFactory:class{#gn=new pa;#Pn=new Ta(this.#gn);static supports(e){return pa.supports(e)}getName(){return this.#gn.getName()}getGroupName(){return this.#gn.getGroupName()}getNPoints(){return this.#gn.getNPoints()}setAnnotationMathShape(e,t){this.#gn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Pn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Pn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Pn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Pn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Pn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Pn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#gn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Pn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Pn.updateConnector(e,t)}},RectangleFactory:class{#gn=new ca;#Pn=new Ta(this.#gn);static supports(e){return ca.supports(e)}getName(){return this.#gn.getName()}getGroupName(){return this.#gn.getGroupName()}getNPoints(){return this.#gn.getNPoints()}setAnnotationMathShape(e,t){this.#gn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Pn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Pn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Pn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Pn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Pn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Pn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#gn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Pn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Pn.updateConnector(e,t)}},RoiFactory:class{#gn=new Sa;#Pn=new Ta(this.#gn);static supports(e){return Sa.supports(e)}getName(){return this.#gn.getName()}getGroupName(){return this.#gn.getGroupName()}getNPoints(){return this.#gn.getNPoints()}setAnnotationMathShape(e,t){this.#gn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Pn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Pn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Pn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Pn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Pn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Pn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#gn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Pn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Pn.updateConnector(e,t)}},RulerFactory:class{#gn=new ha;#Pn=new Ta(this.#gn);static supports(e){return ha.supports(e)}getName(){return this.#gn.getName()}getGroupName(){return this.#gn.getGroupName()}getNPoints(){return this.#gn.getNPoints()}setAnnotationMathShape(e,t){this.#gn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Pn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Pn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Pn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Pn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Pn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Pn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#gn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Pn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Pn.updateConnector(e,t)}},BidimensionalFactory:class{#un="bidimensional";#Sn=new wa(this.#An);static supports(e){return e instanceof dr}getName(){return this.#un}getGroupName(){return`${this.#un}-group`}getNPoints(){return 2}#On(e){return void 0!==ot.labelTexts&&void 0!==ot.labelTexts[this.#un]?ot.labelTexts[this.#un]:!0===e.mathShape.hasShortAxisInteraction&&null!==e.quantification?.shortAxis?.value?ta[this.#un]:ta[`${this.#un}Drawing`]}setAnnotationMathShape(e,t){const n=new dr(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.#On(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.#bn(t,n);i.add(o);const r=this.#xn(t,n);for(const e of r)i.add(e);const a=this.#Sn.create(t,n);i.add(a);const s=this.#En(o);i.add(this.#Sn.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}#bn(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 ma(o,i,n.getZoomScale?n.getZoomScale():{x:1,y:1}),o}#xn(t,n){const i=t.mathShape,o=10,r=n.getZoomScale?n.getZoomScale():{x:1,y:1},a=tr(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=tr(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"})]}#En(e){const t=e.points(),n=e.x(),i=e.y(),o=(t[0]+t[2])/2+n,r=(t[1]+t[3])/2+i;return[new S(o,r)]}#Rn(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.#Rn(e),i=[];for(let e=0;e<n.length;++e)i.push(sa(n[e].getX(),n[e].getY(),`anchor${e}`,t));return i}constrainAnchorMove(e,t){const n=t.mathShape;if("anchor2"===e.id()||"anchor3"===e.id()){const t=n.getBegin(),i=n.getEnd(),o=i.getX()-t.getX(),r=i.getY()-t.getY(),a=Math.hypot(o,r);if(0===a)return;const s=o/a,l=r/a,c=-l,u=s,d=e.x()-t.getX(),h=e.y()-t.getY(),g=d*s+h*l;n.shortAxisT=Math.max(0,Math.min(1,g/a));const S=this.getPointAlongLine(n,n.shortAxisT);n.shortAxisCenter=S;const p=d*c+h*u;"anchor2"===e.id()?n.shortAxisL1=Math.max(.1,p):n.shortAxisL2=Math.max(.1,-p),n.shortAxisLength=n.shortAxisL1+n.shortAxisL2;const m="anchor2"===e.id()?n.shortAxisL1:-n.shortAxisL2;e.x(S.getX()+c*m),e.y(S.getY()+u*m)}}onAnchorMoveEnd(e,t){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#Fn(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Sn.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()]),ma(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=tr(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=tr(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=ra(r,2),m=ra(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.#On(t)),t.updateQuantification?.(),r.getLayer()?.draw()}updateLabelContent(e,t,n){this.#Sn.updateContent(e,t)}updateConnector(t,n){const i=n.findOne(".shape");if(i&&i instanceof e.Line){const e=this.#En(i);this.#Sn.updateConnector(n,e)}}#An(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();let o=n;return n.getY()<i.getY()&&(o=i),o}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd(),r=new S(i.getX()+t.x,i.getY()+t.y),a=new S(o.getX()+t.x,o.getY()+t.y),s=new dr(r,a);s.shortAxisLength=n.shortAxisLength,s.shortAxisT=n.shortAxisT,s.shortAxisL1=n.shortAxisL1,s.shortAxisL2=n.shortAxisL2,n.shortAxisCenter instanceof Object&&"getX"in n.shortAxisCenter&&"getY"in n.shortAxisCenter&&(s.shortAxisCenter=new S(n.shortAxisCenter.getX()+t.x,n.shortAxisCenter.getY()+t.y)),s.hasShortAxisInteraction=n.hasShortAxisInteraction,e.mathShape=s,e.updateQuantification()}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=i.findOne(".shape"),r=ra(i,0),a=ra(i,1),s=new S(r.x()-o.x(),r.y()-o.y()),l=new S(a.x()-o.x(),a.y()-o.y()),c=new dr(s,l),u=t.mathShape;if(u.shortAxisCenter instanceof S){const e=u.shortAxisCenter,t=l.getX()-s.getX(),n=l.getY()-s.getY(),i=t*t+n*n;if(i>0){const o=((e.getX()-s.getX())*t+(e.getY()-s.getY())*n)/i;c.shortAxisT=Math.max(0,Math.min(1,o)),c.shortAxisCenter=new S(s.getX()+t*c.shortAxisT,s.getY()+n*c.shortAxisT)}else c.shortAxisT=.5,c.shortAxisCenter=e}else c.shortAxisT=u.shortAxisT??.5;c.shortAxisL1=u.shortAxisL1,c.shortAxisL2=u.shortAxisL2,c.shortAxisLength=u.shortAxisLength,c.hasShortAxisInteraction=u.hasShortAxisInteraction,t.mathShape=c,t.updateQuantification()}updateShortAxisToSolid(t){const n=t.findOne(".bidimensional-short-axis");n&&n instanceof e.Line&&(n.dash([]),n.getLayer()?.draw())}updateShortAxisTicks(t,n,i){const o=10,r=i.getX()-n.getX(),a=i.getY()-n.getY(),s=Math.hypot(r,a);let l,c;0===s?(l=1,c=0):(l=-a/s,c=r/s);const u=new S(n.getX()-l*o/2,n.getY()-c*o/2),d=new S(n.getX()+l*o/2,n.getY()+c*o/2),h=t.findOne(".short-axis-tick0");h&&h instanceof e.Line&&(h.position({x:0,y:0}),h.points([u.getX(),u.getY(),d.getX(),d.getY()]),h.opacity(.5));const g=new S(i.getX()-l*o/2,i.getY()-c*o/2),p=new S(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([g.getX(),g.getY(),p.getX(),p.getY()]),m.opacity(.5))}getShortAxisEndpoints(e){const t=e.mathShape;let n;if(e.mathShape.shortAxisCenter instanceof S){const i=t.getBegin(),o=t.getEnd(),r=o.getX()-i.getX(),a=o.getY()-i.getY(),s=Math.hypot(r,a);if(0===s)n=e.mathShape.shortAxisCenter;else{const o=r/s,l=a/s,c=(e.mathShape.shortAxisCenter.getX()-i.getX())*o+(e.mathShape.shortAxisCenter.getY()-i.getY())*l,u=Math.max(0,Math.min(1,c/s));e.mathShape.shortAxisT=u,n=this.getPointAlongLine(t,u)}}else{const i="number"==typeof e.mathShape.shortAxisT?e.mathShape.shortAxisT:.5;n=this.getPointAlongLine(t,i)}const i=t.getBegin(),o=t.getEnd(),r=o.getX()-i.getX(),a=o.getY()-i.getY(),s=Math.hypot(r,a);if(0===s||Number.isNaN(n.getX())||Number.isNaN(n.getY()))return[n,n];const l=-a/s,c=r/s;let u,d;return u="number"==typeof e.mathShape.shortAxisL1?e.mathShape.shortAxisL1:"number"==typeof e.mathShape.shortAxisLength?e.mathShape.shortAxisLength/2:0,d="number"==typeof e.mathShape.shortAxisL2?e.mathShape.shortAxisL2:"number"==typeof e.mathShape.shortAxisLength?e.mathShape.shortAxisLength/2:0,Number.isNaN(u)||Number.isNaN(d)?[n,n]:[new S(n.getX()+l*u,n.getY()+c*u),new S(n.getX()-l*d,n.getY()-c*d)]}getPointAlongLine(e,t){const n=e.getBegin(),i=e.getEnd();return new S(n.getX()+(i.getX()-n.getX())*t,n.getY()+(i.getY()-n.getY())*t)}}},filter:{Threshold:Ra,Sobel:Ma,Sharpen:Fa}};class Qa{trackingId;trackingUid;referencedSopInstanceUID;referencedSopClassUID;referencedFrameNumber;mathShape;referencePoints;colour="#ffff80";quantification;textExpr="";labelPosition;planeOrigin;planePoints;#Mn;#He={};constructor(){this.trackingId=Math.random().toString(36).substring(2,15),this.trackingUid=on("TrackingUniqueIdentifier")}getMetaConceptIds(){return Object.keys(this.#He)}getMetaItem(e){return this.#He[e]}addMetaItem(e,t){const n=e.value;void 0!==this.#He[n]&&r.warn(`Overwriting annotation meta with id=${n}`),this.#He[e.value]={concept:e,value:t}}removeMetaItem(e){void 0!==this.#He[e]&&delete this.#He[e]}getOrientationName(){let e;return void 0!==this.planePoints&&(e=ut(this.planePoints[1].getValues().concat(this.planePoints[2].getValues()))),e}init(e){if(void 0!==this.referencedSopInstanceUID)return void r.debug("Cannot initialise annotation twice");this.#Mn=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.#Mn}isCompatibleView(e){let t=!1;if(void 0===this.planePoints)e.isAquisitionOrientation()&&(t=!0);else{const n=e.getCosines(),i=new p(n[0],n[1],n[2]),o=new p(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.#Mn=e,this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID)):r.warn(`Cannot view annotation with reference UID: ${this.referencedSopInstanceUID}`)}#qn(){let e;if(void 0!==this.#Mn){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.#Mn.getIndexFromPosition(i)}return e}getCentroid(){let e;if(void 0!==this.#Mn&&void 0!==this.mathShape.getCentroid&&void 0!==this.mathShape.getCentroid()){const t=this.#qn(),n=this.#Mn.getScrollDimIndex(),i=t.getValues()[n],o=this.mathShape.getCentroid();if(e=this.#Mn.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.#Mn){const t=this.#Mn.getModality();void 0!==e[t]?this.textExpr=e[t]:this.textExpr=e["*"]}else r.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.#Mn&&void 0!==this.mathShape.quantify&&(this.quantification=this.mathShape.quantify(this.#Mn,this.#qn(),C(this.textExpr)))}getFactory(){let e;if(void 0===this.mathShape)return e;if(void 0!==qa.draw)for(const t in qa.draw){const n=qa.draw[t];if(n.supports(this.mathShape)){e=new n;break}}if(void 0===e)for(const t in Ua.draw){const n=Ua.draw[t];if(n.supports(this.mathShape)){e=new n;break}}return void 0===e&&r.warn("No shape factory found for math shape"),e}}function Va(e,t){const n=Object.keys(t);for(const i of n)void 0!==e[i]&&r.debug(`Overwritting tag: ${i}`),e[i]=t[i]}class Na{current;measure}class Ba{annotationGroups;responseEvaluations;comment}class ka{#W;getWarning(){return this.#W}#Un(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}(oe(e,"00020012")),n=void 0!==t&&function(e){const t=de(e,"0.34.0"),n=de(e,"0.35.0-beta.21");return t>=0&&n<=0}(t),i=jr(e);let o;const r=_r(e);return void 0!==r.conceptNameCode&&(o=r.conceptNameCode.value),n&&void 0===i&&o===ei.value}#Qn(e){const t="DCMR-1500"===jr(e);let n;const i=_r(e);void 0!==i.conceptNameCode&&(n=i.conceptNameCode.value);let o=!1;if(t&&n===ni.value){const e=i.contentSequence.find(this.#Vn);if(void 0!==e){const t=e.contentSequence.find(this.#Nn);if(void 0!==t){const e=t.contentSequence.find(this.#Bn),n=t.contentSequence.find(this.#kn);void 0===e&&void 0===n||(o=!0)}}}return o}#Gn(e){return"DCMR-4100"===jr(e)}checkElements(e){return this.#W=void 0,this.#Un(e)||this.#Qn(e)||this.#Gn(e)||(this.#W="Not a dwv supported annotation"),this.#W}#zn(e,t){t.valueType===zr&&t.relationshipType===Ur&&(e.referencedSopClassUID=t.value.referencedSOPSequence.referencedSOPClassUID,e.referencedSopInstanceUID=t.value.referencedSOPSequence.referencedSOPInstanceUID,void 0!==t.value.referencedFrameNumber&&(e.referencedFrameNumber=parseInt(t.value.referencedFrameNumber,10)))}#Hn(e,t){t.hasHeader(kr,si(Hn),Fr)&&(e.trackingId=t.value,e.trackingUid=t.value)}#Yn(e,t){t.hasHeader(Vr,si(Hn),Mr)&&(e.trackingId=t.value),t.hasHeader(kr,si(Xn),Mr)&&(e.trackingUid=t.value)}#Xn(e,t,n){void 0===n&&(n=!1);let i=Qr;if(n&&(i=Fr),t.hasHeader(Vr,si(ti),i)){e.textExpr=t.value;const n=t.contentSequence.find((function(e){return e.hasHeader(Hr,si(Jn),Fr)}));void 0!==n&&(e.labelPosition=new S(n.value.graphicData[0],n.value.graphicData[1]))}if(t.hasHeader(Vr,ui(),i)&&(e.colour=t.value),t.hasHeader(Hr,si(Jn),i)&&t.value.graphicType===fr){const n=[];for(let e=0;e<t.value.graphicData.length;e+=2)n.push(new S(t.value.graphicData[e],t.value.graphicData[e+1]));e.referencePoints=n}if(t.hasHeader(Yr,si(oi),Rr)&&t.value.graphicType===fr){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 p(n[t],n[t+1],n[t+2]))}e.planePoints=i}this.#Wn(e,t),this.#$n(e,t)}#Wn(e,t,n){let i;if(void 0===n&&(i=Rr),t.valueType===Nr&&t.relationshipType===i){const n=function(e){let t;for(const n in di){const i=di[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 hi){const i=hi[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}}}}#$n(e,t){t.valueType!==Br&&t.valueType!==Vr||t.relationshipType!==Rr||e.addMetaItem(t.conceptNameCode,t.value)}#Vn(e){return e.hasHeader(Xr,si(ii),Rr)}#Nn(e){return e.hasHeader(Xr,si(ei),Rr)}#jn(e){return e.hasHeader(Br,si(Qn),qr)}#Zn(e){return e.hasHeader(Xr,si(kn),Fr)}#_n(e){return e.hasHeader(Vr,si(Zn),Rr)}#Kn(e){return e.hasHeader(Br,si(Wn),Rr)}#Jn(e){return e.hasHeader(Nr,si(Yn),Rr)}#ei(e){return e.hasHeader(Br,si(qn),Rr)}#Bn(e){return e.hasHeader(Hr,si(Un),Rr)}#ti(e){return void 0!==e.contentSequence.find(this.#Bn)}#ni(e){let t;const n=e.contentSequence.find(this.#Bn);if(void 0!==n){t=new Qa,t.mathShape=Tr(n.value);const i=n.contentSequence.find((function(e){return e.valueType===zr&&e.relationshipType===Ur}));void 0!==i&&this.#zn(t,i);for(const n of e.contentSequence)this.#Yn(t,n),this.#Xn(t,n)}return t}#kn(e){let t;return e.valueType===Nr&&e.relationshipType===Rr&&(t=e.contentSequence.find((function(e){return e.valueType===Hr&&e.relationshipType===qr}))),void 0!==t}#ii(e){let t;return e.valueType===Nr&&e.relationshipType===Fr&&(t=e.contentSequence.find((function(e){return e.valueType===Hr&&e.relationshipType===qr}))),void 0!==t}#oi(e){return void 0!==e.contentSequence.find(this.#kn)}#ri(e){let t;const n=e.contentSequence.find(this.#kn);if(void 0!==n){t=new Qa;const e=n.contentSequence.find((function(e){return e.valueType===Hr&&e.relationshipType===qr}));t.mathShape=Tr(e.value),t.mathShape instanceof S&&e.value.graphicData.length>=4&&(t.referencePoints=[new S(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find((function(e){return e.valueType===zr&&e.relationshipType===Ur}));void 0!==i&&this.#zn(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#Yn(t,i),this.#Wn(t,n),this.#$n(t,i);return t}#ai(e){let t;const n=e.contentSequence.find(this.#ii);if(void 0!==n){t=new Qa;const e=n.contentSequence.find((function(e){return e.valueType===Hr&&e.relationshipType===qr}));t.mathShape=Tr(e.value),t.mathShape instanceof S&&e.value.graphicData.length>=4&&(t.referencePoints=[new S(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find((function(e){return e.valueType===zr&&e.relationshipType===Ur}));void 0!==i&&this.#zn(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#Yn(t,i),this.#Wn(t,n,Fr),this.#$n(t,i);return t}#si(e){if(0===e.contentSequence.length)return;const t=e.contentSequence[0];let n=!1,i=!1;this.#Nn(t)&&(n=this.#ti(t),i=this.#oi(t));const o=[];let a,s=!1;for(const t of e.contentSequence)if(this.#Nn(t)){let e;s=!0,n?e=this.#ni(t):i&&(e=this.#ri(t)),void 0!==e&&o.push(e)}return s?0!==o.length?a=new io(o):r.warn("No valid measurement groups in TID 1500 SR"):r.warn("No measurement groups in TID 1500 SR"),a}#li(e){const t=[];let n=!1;for(const i of e.contentSequence)if(this.#jn(i)){n=!0;const e=this.#ai(i);void 0!==e&&t.push(e)}const i=[];return n?0!==t.length?i.push(new io(t)):r.warn("No valid measurement groups in TID 4100 SR"):r.warn("No image findings in TID 4100 SR"),i}#ci(e){const t=new Qa;t.mathShape=Tr(e.value);for(const n of e.contentSequence)this.#zn(t,n),this.#Hn(t,n),this.#Xn(t,n,!0);return t}#ui(e){let t;e.valueType===Xr&&Rn(e.conceptNameCode,si(ni))||r.warn("Not the expected TID 1500 SR content header");const n=e.contentSequence.find(this.#Vn);return void 0!==n?t=this.#si(n):r.warn("No imaging measurements in TID 1500 SR"),t}#di(e){return e.valueType===Xr&&Rn(e.conceptNameCode,si(Bn))||r.warn("Not the expected TID 4100 SR content header"),e.contentSequence.find(this.#ei)}#hi(e){e.valueType===Xr&&Rn(e.conceptNameCode,si(ei))||console.warn("Not the expected dwv034 content header");const t=[];for(const n of e.contentSequence)n.valueType===Hr&&t.push(this.#ci(n));return new io(t)}#gi(e,t){const n=function(e){return oe(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=te({[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.#ui(t)):this.#Un(e)&&(r.warn("DWV v0.34 annotation"),i="DWV v0.34 SR",n=this.#hi(t)),this.#Gn(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.#gi(n,e),n}createCADReport(e){const t=_r(e),n=this.#di(t);if(void 0===n)return void r.warn("No CAD processing and Findings Summary in TID 4100 SR");let i=[];if(this.#Gn(e)&&(i=this.#li(n)),void 0===i)throw new Error("Cannot create annotation groups from TID 4100 SR");for(const t of i)this.#gi(t,e);const o=[];let a;for(const e of n.contentSequence)if(this.#Zn(e)){const t=this.#Si(e);void 0!==t&&o.push(t)}else this.#_n(e)&&(a=e.value);const s=new Ba;return s.annotationGroups=i,s.responseEvaluations=o,s.comment=a,s}#pi(e){const t=new Zr(zr);t.relationshipType=Ur,t.conceptNameCode=si(Kn);const n=new Ho;n.referencedSOPClassUID=e.referencedSopClassUID,n.referencedSOPInstanceUID=e.referencedSopInstanceUID;const i=new Zo;return i.referencedSOPSequence=n,void 0!==e.referencedFrameNumber&&(i.referencedFrameNumber=e.referencedFrameNumber.toString()),t.value=i,t}#mi(e){const t=[],n=new Zr(Vr);n.relationshipType=Mr,n.conceptNameCode=si(Hn),n.value=e.trackingId,t.push(n);const i=new Zr(kr);if(i.relationshipType=Mr,i.conceptNameCode=si(Xn),i.value=e.trackingUid,t.push(i),void 0!==e.textExpr&&0!==e.textExpr.length){const n=new Zr(Vr);if(n.relationshipType=Qr,n.conceptNameCode=si(ti),n.value=e.textExpr,void 0!==e.labelPosition){const t=new Zr(Hr);t.relationshipType=Fr,t.conceptNameCode=si(Jn);const i=new yr;i.graphicType=mr;const o=[e.labelPosition.getX().toString(),e.labelPosition.getY().toString()];i.graphicData=o,t.value=i;const r=this.#pi(e);t.contentSequence=[r],n.contentSequence=[t]}t.push(n)}const o=new Zr(Vr);if(o.relationshipType=Qr,o.conceptNameCode=ui(),o.value=e.colour,t.push(o),void 0!==e.referencePoints){const n=new Zr(Hr);n.relationshipType=Qr,n.conceptNameCode=si(Jn);const i=new yr;i.graphicType=fr;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.#pi(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.planePoints){const n=new Zr(Yr);n.relationshipType=Rr,n.conceptNameCode=si(oi);const i=new br;i.graphicType=fr;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.#pi(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.quantification)for(const n in e.quantification){const i=Jr(n,h(e.quantification[n].value,12),e.quantification[n].unit);void 0!==i&&t.push(i)}const r=e.getMetaConceptIds();for(const n of r){const i=e.getMetaItem(n);let o=Vr;i.value instanceof En&&(o=Br);const r=new Zr(o);r.relationshipType=Rr,r.conceptNameCode=i.concept,r.value=i.value,t.push(r)}return t}#fi(e){const t=new Zr(Xr);t.relationshipType=Rr,t.conceptNameCode=si(ei),t.value=Wr;const n=new Zr(Hr);n.relationshipType=Rr,n.conceptNameCode=si(Un),n.value=wr(e.mathShape);const i=this.#pi(e);return n.contentSequence=[i],t.contentSequence=[n].concat(this.#mi(e)),t}#vi(e){let t;if(0!==e.getList().length){const n=new Zr(Xr);n.conceptNameCode=si(ii),n.relationshipType=Rr,n.value=Wr;const i=[];for(const t of e.getList())i.push(this.#fi(t));n.contentSequence=i,t=new Zr(Xr),t.conceptNameCode=si(ni),t.value=Wr,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=Yt(zt(i)),n.ContentTime=Xt(Ht(i));const o=n.CurrentRequestedProcedureEvidenceSequence.value[0].ReferencedSeriesSequence.value[0];let r=o.ReferencedSOPSequence;void 0===r&&(o.ReferencedSOPSequence={value:[]},r=o.ReferencedSOPSequence);const a=r.value;for(const t of e.getList()){const e={ReferencedSOPInstanceUID:t.referencedSopInstanceUID,ReferencedSOPClassUID:t.referencedSopClassUID},n=function(t){return t.ReferencedSOPInstanceUID===e.ReferencedSOPInstanceUID&&t.ReferencedSOPClassUID===e.ReferencedSOPClassUID};void 0===a.find(n)&&a.push(e)}n.ContentTemplateSequence={value:[{MappingResource:"DCMR",TemplateIdentifier:"1500"}]};const s=this.#vi(e);if(void 0===s)throw new Error("No annotation group SR content");return n={...n,...Kr(s)},void 0!==t&&Va(n,t),Sn(n)}#Ci(e){const t=new Zr(Br);t.relationshipType=qr,t.conceptNameCode=si(Qn),t.value=si(Vn),t.contentSequence=[];const n=new Zr(Vr);n.relationshipType=Mr,n.conceptNameCode=si(Hn),n.value=e.trackingId,t.contentSequence.push(n);const i=new Zr(kr);if(i.relationshipType=Mr,i.conceptNameCode=si(Xn),i.value=e.trackingUid,t.contentSequence.push(i),void 0!==e.quantification)for(const n in e.quantification){const i=Jr(n,h(e.quantification[n].value,12),e.quantification[n].unit,Fr);if(void 0!==i){const n=new Zr(Hr);n.relationshipType=qr,n.conceptNameCode=si(jn),n.value=wr(e.mathShape);const o=this.#pi(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=Vr;i.value instanceof En&&(o=Br);const r=new Zr(o);r.relationshipType=Rr,r.conceptNameCode=i.concept,r.value=i.value,t.contentSequence.push(r)}return t}#Di(e,t){if(0!==e.getList().length)for(const n of e.getList())t.push(this.#Ci(n))}#yi(e){const t=new Zr(Xr);t.relationshipType=Fr,t.conceptNameCode=si(kn),t.value=Wr,t.contentSequence=[];const n=new Zr(Br);if(n.relationshipType=Mr,n.conceptNameCode=si(Gn),n.value=si(zn),t.contentSequence.push(n),void 0!==e){if(void 0!==e.current){const n=new Zr(Br);n.relationshipType=Rr,n.conceptNameCode=si(Wn),n.value=e.current,t.contentSequence.push(n)}if(void 0!==e.measure){const n=new Zr(Nr);n.relationshipType=Rr,n.conceptNameCode=si(Yn);const i=new Uo;i.numericValue=e.measure,i.measurementUnitsCode=gi("unit.mm");const o=new Bo;o.measuredValue=i,n.value=o,t.contentSequence.push(n)}}return t}#Si(e){let t,n,i;for(const i of e.contentSequence)this.#Kn(i)?t=i.value:this.#Jn(i)&&(n=i.value.measuredValue.numericValue);return void 0!==t&&(i=new Na,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=Yt(zt(i)),n.ContentTime=Xt(Ht(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 Zr(Br);s.relationshipType=Rr,s.conceptNameCode=si(qn),s.value=si(Nn),s.contentSequence=[];for(const t of e.responseEvaluations){const e=this.#yi(t);s.contentSequence.push(e)}for(const t of e.annotationGroups)this.#Di(t,s.contentSequence);if(void 0!==e.comment){const t=new Zr(Vr);t.relationshipType=Rr,t.conceptNameCode=si(Zn),t.value=e.comment,s.contentSequence.push(t)}const l=new Zr(Xr);if(l.conceptNameCode=si(Bn),l.value=Wr,l.contentSequence.push(s),void 0===l)throw new Error("No annotation group SR content");return n={...n,...Kr(l)},void 0!==t&&Va(n,t),Sn(n)}}const Ga="30060084";class za{type;points3D}class Ha{number;name;colour;generationAlgorithm;interpretedType;roiInterpreter;contours}function Ya(e){const t={},n={},i=re(e,"30060020");if(void 0!==i)for(const e of i){const i=oe(e,"30060022"),o=oe(e,"30060026"),r=oe(e,"30060036");void 0!==i&&(t[i]=o??`ROI ${i}`,n[i]=r)}const o={},a=re(e,"30060080");if(void 0!==a)for(const e of a){const t=oe(e,Ga);void 0!==t&&(o[t]={interpretedType:oe(e,"300600A4"),roiInterpreter:oe(e,"300600A6")})}const s=[],l=re(e,"30060039");if(void 0===l)return s;for(const e of l){const i=oe(e,Ga),a=re(e,"3006002A"),l=re(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=In(Cn({l:l[0],a:l[1],b:l[2]})):(r.warn("No recommended colour for contour, using default"),c=Pn(i));const u=[],d=re(e,"30060040");if(void 0!==d)for(const e of d){const t=oe(e,"30060042"),n=re(e,"30060050");if(void 0===n)continue;const i=new za;i.type=t??"CLOSED_PLANAR",i.points3D=n.map((e=>parseFloat(e))),u.push(i)}const h=new Ha;h.number=void 0!==i?parseInt(i,10):0,h.name=t[h.number]??`ROI ${h.number}`,h.generationAlgorithm=n[h.number],h.interpretedType=o[h.number]?.interpretedType,h.roiInterpreter=o[h.number]?.roiInterpreter,h.colour=c,h.contours=u,s.push(h)}return s}const Xa={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyInstanceUID:"0020000D",StudyID:"00200010",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052"},Wa=[{name:"TransferSyntaxUID",enum:[B]},{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 $a(){const e={};for(const t of Wa)e[t.name]=t.enum[0];return e}const ja=[[-1,0],[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1]],Za={};for(let e=0;e<8;e++)Za[`${ja[e][0]},${ja[e][1]}`]=e;function _a(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 Ka(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=Za[`${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+ja[a][0],l=d+ja[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+ja[e][0],m=d+ja[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 Ja(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;_a(e,t,n,i,o,l,a);const u=Ka(e,t,n,i,o,r,c);u.length>=3&&s.push(u)}return s}function es(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 ts(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=es(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 ns(e,t,n,i,o,r){const a=o.filter((e=>e.length>=3));if(0===a.length)return;const s=a.flatMap((e=>e.map((e=>e.y)))),l=Math.max(0,Math.floor(Math.min(...s))),c=Math.min(i-1,Math.ceil(Math.max(...s)));for(let i=l;i<=c;++i){const o=[];for(const e of a){const t=e.length;for(let n=0;n<t;++n){const r=e[n],a=e[(n+1)%t];(i<c?r.y<=i&&a.y>i||a.y<=i&&r.y>i:r.y!==a.y&&(r.y<=i&&a.y>=i||a.y<=i&&r.y>=i))&&o.push(r.x+(i-r.y)/(a.y-r.y)*(a.x-r.x))}}o.sort(((e,t)=>e-t));for(let a=0;a+1<o.length;a+=2){const s=Math.max(0,Math.ceil(o[a])),l=Math.min(n-1,Math.floor(o[a+1]));for(let o=s;o<=l;++o)e[t+i*n+o]=r}}}function is(e,t,n,i,o){const r=n*i,a=function(e,t,n,i,o){const r=new Uint8Array(n*i),a=[];function s(n){r[n]||e[t+n]===o||(r[n]=1,a.push(n))}for(let e=0;e<n;++e)s(e),s((i-1)*n+e);for(let e=0;e<i;++e)s(e*n),s(e*n+n-1);for(;a.length>0;){const e=a.shift(),t=e%n,o=e/n|0;t>0&&s(e-1),t<n-1&&s(e+1),o>0&&s(e-n),o<i-1&&s(e+n),t>0&&o>0&&s(e-n-1),t<n-1&&o>0&&s(e-n+1),t>0&&o<i-1&&s(e+n-1),t<n-1&&o<i-1&&s(e+n+1)}return r}(e,t,n,i,o),s=new Uint8Array(r);let l=!1;for(let n=0;n<r;++n)e[t+n]===o||a[n]||(s[n]=1,l=!0);return l?Ja(s,0,n,i,1):[]}class os{#W;getWarning(){return this.#W}checkElements(e){return this.#W=void 0,this.#W}create(e,t){const n=Ya(e),i=t.getGeometry(),r=i.getSize(),a=r.get(0),s=r.get(1),l=r.get(2),c=a*s,u=new qi(i),d=[],h=[0],g=[0],S=[0];for(let e=0;e<n.length;++e){const t=n[e],o=e+1,r=new yi(o,t.name,t.generationAlgorithm??"MANUAL");r.interpretedType=t.interpretedType,r.roiInterpreter=t.roiInterpreter,r.displayRGBValue=new pn(t.colour.r,t.colour.g,t.colour.b),d.push(r),h[o]=t.colour.r,g[o]=t.colour.g,S[o]=t.colour.b;const p=new Map;for(const e of t.contours){if("CLOSED_PLANAR"!==e.type&&"CLOSEDPLANAR_XOR"!==e.type)continue;const t=e.points3D;if(t.length<9)continue;const n=[];for(let e=0;e<t.length;e+=3){const o=i.worldToPoint(new m([t[e],t[e+1],t[e+2]]));n.push({x:o.getX(),y:o.getY(),z:o.getZ()})}const o=Math.round(n[0].z);o<0||o>=l||(p.has(o)||p.set(o,[]),p.get(o).push(n))}for(const[e,t]of p){const n=new Uint8Array(c);ns(n,0,a,s,t,1),u.addFrame(o,n,0,e,c,o)}}const p=[];for(let e=0;e<l;++e)p.push(t.getImageUid(new o([0,0,e])));const f=new to(i,u.getLabelMap(),p);f.setSegmentCollection(u),f.setPhotometricInterpretation("PALETTE COLOR"),f.setPaletteColourMap(new nt(h,g,S));const v=t=>oe(e,t),C={Modality:"RTSTRUCT"};for(const e of Object.keys(Xa)){const t=v(Xa[e]);void 0!==t&&(C[e]=t)}C.custom={segments:d,referencedSeriesUID:yt(e)};const D=t.getMeta();return void 0!==D.lengthUnit&&(C.lengthUnit=D.lengthUnit),f.setMeta(C),f}toDicom(e,t,n,i){const a=$a(),s=e.getMeta();for(const e of Object.keys(Xa)){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=Yt(zt(l)),a.StructureSetTime=Xt(Ht(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 i=[],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=Ja(a,l,d,h,t),g=u.length>0?is(a,l,d,h,t):[],f=u.concat(g),v=g.length>0?"CLOSEDPLANAR_XOR":"CLOSED_PLANAR";for(const t of f){const n=ts(t,1);if(n.length<3){r.warn("Saving RT Struct with thin contour, not well supported");continue}const a=[];for(const t of n){const n=c.indexToWorld(new o([t.x,t.y,e]));a.push(n.get(0),n.get(1),n.get(2))}i.push({ContourGeometricType:v,NumberOfContourPoints:n.length,ContourData:a})}}C.push({ReferencedROINumber:t,ROIDisplayColor:[n.r,n.g,n.b],ContourSequence:{value:i}})}return a.StructureSetROISequence={value:v},a.ROIContourSequence={value:C},a.RTROIObservationsSequence={value:D},void 0!==i&&function(e,t){for(const n of Object.keys(t))e[n]=t[n]}(a,i),Sn(a)}}const rs=["dataadd","dataremove","dataimageset","dataupdate"];function as(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 ss{meta;image;annotationGroup;buffer;numberOfFiles;warn=[];#Ii=!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.#Ii}appendData(e){this.#Ii||(void 0!==this.image&&void 0!==e.image&&this.#wi(e.image),this.#Ti(e.meta))}#wi(e){const t=this.image.getGeometry(),n=e.getGeometry();t.canAppendOrigin(n.getOrigin(),n.getInitialTime()).success||(this.#Ii=!0),this.#Ii||this.image.appendSlice(e)}#Ti(e){this.meta=as(this.meta,e,Qt)}}class ls{#it=[];addClone(e){const t=new ss(structuredClone(e.meta));t.image=e.image.clone(),this.add(t)}add(e){this.#it.push(e)}buildData(){const e=this.#Li(),t=this.#Pi(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.#Ai(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.#it[t[0]].meta;r=void 0===r?a:as(r,a,i);for(const n of t){const t=this.#it[n].image;t.getGeometry().setInitialTime(e),void 0===o?o=t:o.appendSlice(t)}}return{image:o,meta:r}}#Ai(e,t){if(void 0!==ot.getPostLoadVolumeIdTagValue){const n=ot.getPostLoadVolumeIdTagValue;return{volsIndices:this.#Oi(e,t,n),volumeIndexGetter:n}}const n=void 0!==ot.postLoadVolumeIdCandidates?ot.postLoadVolumeIdCandidates:Nt;for(const i of n){const n=this.#Oi(e,t,i.getter);if(void 0!==n)return r.debug(`Using '${i.name}' as temporal position identifier`),{volsIndices:n,volumeIndexGetter:i.getter}}return{volsIndices:void 0,volumeIndexGetter:void 0}}#Oi(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.#it[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.#it[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}#Pi(e){if(0===e.length)return 0;const t=e[0].count;for(const n of e)if(n.count!==t)return;return t}#Li(){const e=function(e){return function(t){return t.pos.equals(e)}},t=[];for(let n=0;n<this.#it.length;++n){const i=this.#it[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{#bi={};#xi={};#Ei={};#Ri=-1;constructor(){super()}getNextDataId(){return++this.#Ri,this.#Ri.toString()}getDataIds(){return Object.keys(this.#bi)}reset(){this.#bi={}}get(e){return this.#bi[e]}getDataIdsFromSopUids(e){const t=[];if(void 0===e||0===e.length)return t;const n=Object.keys(this.#bi);for(const i of n)void 0!==this.#bi[i].image&&this.#bi[i].image.containsImageUids(e)&&t.push(i);return t}getDataIdFromSeriesUid(e){let t;const n=Object.keys(this.#bi);for(const i of n){const n=this.#bi[i].image;if(void 0!==n&&e===n.getMeta().SeriesInstanceUID){t=i;break}}return t}setImage(e,t){this.#bi[e].image=t;for(const n of Ki)t.addEventListener(n,this.#Fi(e));this.dispatchEvent(new CustomEvent("dataimageset",{detail:{value:[t],dataid:e}}))}#Mi(e){const t=oe(e.meta,"00080060");let n;if(K(e.meta))if("SEG"===t){const t=Dt(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 Gi,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,this.#bi[i].image))}else n=new Kt,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,e.numberOfFiles));else if("SR"===t)n=new ka,void 0===n.checkElements(e.meta)&&(e.annotationGroup=n.create(e.meta));else if("RTSTRUCT"===t){const t=yt(e.meta),i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create RT struct: referenced series is not loaded");n=new os,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,this.#bi[i].image))}void 0!==n&&void 0!==n.getWarning()&&e.warn.push(n.getWarning())}add(e,t){if(void 0===e||void 0!==this.#bi[e])return!1;if(this.#bi[e]=t,void 0===t.image&&void 0===t.annotationGroup&&(this.#Mi(t),void 0!==t.numberOfFiles&&t.numberOfFiles>1&&(this.#xi[e]=new ls,this.#xi[e].addClone(t))),void 0!==t.image)for(const n of Ki)t.image.addEventListener(n,this.#Fi(e));if(void 0!==t.annotationGroup)for(const n of no)t.annotationGroup.addEventListener(n,this.#Fi(e));return this.dispatchEvent(new CustomEvent("dataadd",{detail:{dataid:e}})),!0}remove(e){if(void 0!==this.#bi[e]){const t=this.#bi[e].image;if(void 0!==t)for(const n of Ki)t.removeEventListener(n,this.#Fi(e));const n=this.#bi[e].annotationGroup;if(void 0!==n)for(const t of no)n.removeEventListener(t,this.#Fi(e));delete this.#bi[e],this.dispatchEvent(new CustomEvent("dataremove",{detail:{dataid:e}}))}}stash(e){void 0!==this.#bi[e]&&(this.#Ei[e]=this.#bi[e],this.remove(e))}unstash(e){void 0!==this.#Ei[e]&&(this.add(e,this.#Ei[e]),delete this.#Ei[e])}getStashedDataIds(){return Object.keys(this.#Ei)}getStashed(e){return this.#Ei[e]}update(e,t){if(void 0===this.#bi[e])throw new Error(`Cannot find data to update: ${e}`);const n=this.#bi[e];this.#Mi(t),void 0!==this.#xi[e]&&this.#xi[e].add(t),n.hasDuplicateOrigin()||n.appendData(t),this.dispatchEvent(new CustomEvent("dataupdate",{detail:{dataid:e}}))}markDataAsComplete(e){const t=this.#bi[e];if(void 0===t)throw new Error(`Cannot find data to mark as complete: ${e}`);const n={imageHasChanged:!1};if(void 0!==this.#xi[e]&&t.hasDuplicateOrigin()){const i=this.#xi[e].buildData();this.setImage(e,i.image),t.meta=i.meta,delete this.#xi[e],n.imageHasChanged=!0}return t.setComplete(!0),n}#Fi(e){return t=>{const n=Object.assign({},t.detail,{dataid:e});this.dispatchEvent(new CustomEvent(t.type,{detail:n}))}}}class us{#qi;setOptions(e){this.#qi=e}#Ui;#Qi=[];#Vi=[];#Ni=[];#Bi=!1;#ki(e,t){const n=this.#Qi[e].getDicomElements(),i=new ss(n);void 0!==this.#Ni[e]&&(i.buffer=this.#Ni[e]),i.numberOfFiles=this.#qi.numberOfFiles,this.onloaditem({data:i,source:t})}#Gi(e,t){this.#Bi||(this.onprogress({lengthComputable:!0,loaded:100,total:100,index:e,source:t}),this.onload({source:t}),this.onloadend({source:t}))}#zi(e){this.#Ui=new xo(e),this.#Ui.ondecodeditem=e=>{this.#Hi(e),e.itemNumber+1===e.numberOfItems&&(this.onload(e),this.onloadend(e))},this.#Ui.onerror=this.onerror,this.#Ui.onabort=this.onabort}#Yi(e){const t=this.#Qi[e].getDicomElements(),n={missing:[]},i=oe(t,"00280100");void 0!==i?n.bitsAllocated=i:n.missing.push("bitsAllocated");const o=oe(t,"00280103");void 0!==o?n.isSigned=1===o:n.missing.push("pixelRepresentation");const r=oe(t,"00280011"),a=oe(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=oe(t,"00280002");if(void 0!==s){if(n.samplesPerPixel=s,1!==s){const e=oe(t,"00280006");void 0!==e?n.planarConfiguration=e:n.missing.push("planarConfiguration")}}else n.missing.push("samplesPerPixel");return n}#Xi(e,t,n){const i=this.#Yi(e);if(0!==i.missing.length)return this.#Ui.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.#Ui.decode(n[r],i,{itemNumber:r,numberOfItems:o,index:e,indexOrigin:t})}#Hi(e){const t=e.index,n=e.indexOrigin;this.onprogress({lengthComputable:!0,loaded:e.itemNumber+1,total:e.numberOfItems,index:e.index,source:n});const i=e.data[0];if(1!==e.numberOfItems){if(void 0===this.#Vi[t]){this.#Vi[t]=i.length;const o=e.numberOfItems*this.#Vi[t];try{this.#Ni[t]=new i.constructor(o)}catch(e){if(e instanceof RangeError){const e=Math.floor(Math.log(o)/Math.log(2));r.error(`Cannot allocate ${i.constructor.name} of size: ${o} (>2^${e}) for decompressed data.`)}return this.#Ui.abort(),this.onerror({error:e,source:n}),void this.onloadend({source:n})}}i.length!==this.#Vi[t]&&r.warn(`Unsupported varying decompressed data size: ${i.length} != ${this.#Vi[t]}`),this.#Ni[t].set(i,this.#Vi[t]*e.itemNumber)}else this.#Ni[t]=i;0===e.itemNumber&&this.#ki(t,n)}convert(e,t,n){this.#Bi=!1,this.onloadstart({source:t,index:n});const i=new Pe;void 0!==this.#qi.defaultCharacterSet&&i.setDefaultCharacterSet(this.#qi.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=_(o);if(void 0!==r){const e=r.value,i=function(e){let t;return De(e)?t="jpeg2000":ve(e)?t="jpeg-baseline":Ce(e)?t="jpeg-lossless":ye(e)&&(t="rle"),t}(oe(o,"00020010"));void 0!==i?(void 0===this.#Ui&&this.#zi(i),this.#Xi(n,t,e)):(this.#Ni[n]=e[0],this.#ki(n,t),this.#Gi(n,t))}else this.#ki(n,t),this.#Gi(n,t)}abort(){this.#Bi=!0,void 0!==this.#Ui?this.#Ui.abort():this.onabort({})}onloadstart(e){}onloaditem(e){}onprogress(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class ds extends To{#qi={};#Wi=!1;getOptions(){return this.#qi}setOptions(e){this.#qi=e}isLoading(){return this.#Wi}setLoading(e){this.#Wi=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 hs extends ds{#$i=new us;load(e,t,n){this.isLoading()||(this.#$i.setOptions(this.getOptions()),this.#$i.onloadstart=this.onloadstart,this.#$i.onprogress=this.onprogress,this.#$i.onloaditem=this.onloaditem,this.#$i.onload=this.onload,this.#$i.onloadend=e=>{this.setLoading(!1),this.onloadend(e)},this.#$i.onerror=e=>{e.source=t,this.onerror(e)},this.#$i.onabort=this.onabort),this.setLoading(!0),this.#$i.convert(e,t,n)}abort(){this.setLoading(!1),this.#$i.abort()}canLoadExtension(e){return void 0===e||"dcm"===e}isLoaderName(e){return"dicom"===e}canLoadMediaType(e){return"application/dicom"===e}loadFileAs(){return Ts.ArrayBuffer}loadUrlAs(){return 1}}class gs extends ds{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 Ts.Text}loadUrlAs(){return 0}}class Ss extends To{#Ut=null;#Vt=null;#Nt=0;#Bt=0;#p;getDefaultCharacterSet(){return this.#p}setDefaultCharacterSet(e){this.#p=e}#Gt(e){this.#Ut=e,this.#Nt=0,this.#Bt=0,this.#Ht()}#Xt(e){this.#Vt=e}#Ht(){this.#Vt=null}#Wt=e=>{this.#Nt++,this.#Nt===this.#Ut.length&&this.onload({source:this.#Ut})};#$t=e=>{this.#Bt++,this.#Bt===this.#Ut.length&&this.onloadend({source:this.#Ut})};load(e){if(void 0===e||0===e.length)return;this.#Gt(e),this.onloadstart({source:e});const t=new wo(this.onprogress);t.setNToLoad(e.length),t.setNumberOfDimensions(1);const n=ws(),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.#Wt,r.onloadend=this.#$t,r.onerror=this.onerror,r.onabort=this.onabort,this.#Xt(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.#Vt&&this.#Vt.isLoading()&&this.#Vt.abort()}}class ps extends ds{#ji=0;#Zi=0;#_i=[];load(e,t,n){0===this.#Zi&&(this.#ji=this.getOptions().numberOfFiles??1,this.#_i=[],this.setLoading(!0),this.onloadstart({source:t}));const i=function(e){const t=new Uint8Array(e),n=[];if(0===t.length)return n;const i=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.#_i.push(...i),this.#Zi++,this.#Zi<this.#ji)return;const o=new Ss;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.#ji;t++)this.onload(e)},o.onloadend=e=>{this.setLoading(!1),this.#Zi=0;const t=this.#ji;for(let n=0;n<t;n++)this.onloadend(e)},o.onerror=this.onerror,o.onabort=this.onabort,o.load(this.#_i)}abort(){this.setLoading(!1),this.#Zi=0,this.onabort({}),this.onloadend({})}isLoaderName(e){return"multipart"===e}canLoadMediaType(e){return"multipart/related"===e}loadFileAs(){return Ts.ArrayBuffer}loadUrlAs(){return 1}}function ms(e){return parseInt(e,36).toString()}function fs(e){const t=e.data.length,n=new Uint8Array(t/4*3);let i=0;for(let o=0;o<t;o+=4)n[i]=e.data[o],n[i+1]=e.data[o+1],n[i+2]=e.data[o+2],i+=3;return n}function vs(e,t,n,i,o,r){const a=new Re([e,t,1]),s=new Fe([1,1,1]),l=new p(0,0,n),c=new Ge([l],a,s),u=new to(c,i,[r]);u.setPhotometricInterpretation("RGB");const d={BitsStored:8};return void 0!==o&&(d.numberOfFiles=o),u.setMeta(d),u}class Cs extends ds{#Ki(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=ms(t)):(l.fileName={value:[t.name]},c=ms(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=vs(i,o,u,fs(s),1,u.toString()),h=d.getMeta();h.SeriesInstanceUID=c,d.setMeta(h);const g=new ss(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.#Ki(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 Ts.DataURL}loadUrlAs(){return 1}}class Ds extends ds{#Ki(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.#Ki(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=ms(r)):(u.fileName={value:[r.name]},d=ms(r.name),u.fileType={value:[r.type]},u.fileLastModifiedDate={value:[r.lastModified]}),u.imageWidth={value:[s]},u.imageHeight={value:[l]},u.numberOfFrames={value:[c]},u.imageUid={value:[0]},u.seriesUid={value:[d]};const h=document.createElement("canvas");h.width=s,h.height=l;const g=h.getContext("2d");e.addEventListener("seeked",(function h(f){(function(){i({lengthComputable:!0,loaded:S,total:c,index:a,source:r}),g.drawImage(e,0,0);const n=fs(g.getImageData(0,0,s,l));if(0===S){p=vs(s,l,1,n,c,a.toString());const e=p.getMeta();e.SeriesInstanceUID=d,p.setMeta(e);const i=new ss(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 Ts.DataURL}loadUrlAs(){return 1}}class ys extends ds{#Ji="";#eo=[];#to=null;#no(e,t,n){this.#eo.push({filename:this.#Ji,data:e});const i=100*this.#eo.length/this.#to.length;if(this.onprogress({lengthComputable:!0,loaded:i/2,total:100,index:n,item:{loaded:i,total:100,source:t}}),this.#eo.length<this.#to.length){const e=this.#eo.length;this.#Ji=this.#to[e].name,this.#to[e].async("arrayBuffer").then((e=>{this.#no(e,t,n)})).catch((e=>{this.setLoading(!1),this.onerror({error:e}),this.onloadend({})}))}else{const e=new Ss;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.#eo)}}load(e,n,i){this.onloadstart({source:n}),this.setLoading(!0),t.loadAsync(e).then((e=>{if(this.#eo=[],this.#to=e.file(/.*\.dcm/),0===this.#to.length)return this.setLoading(!1),this.onerror({error:new Error("No DICOM file found in ZIP")}),void this.onloadend({});this.#Ji=this.#to[0].name,this.#to[0].async("arrayBuffer").then((e=>{this.#no(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 Ts.ArrayBuffer}loadUrlAs(){return 1}}let Is=null;function ws(){return null===Is&&(Is=[hs,gs,ps,Cs,Ds,ys]),Is}const Ts={Text:0,ArrayBuffer:1,DataURL:2};class Ls extends To{#Ut=null;#io=[];#Vt=null;#Nt=0;#Bt=0;#p;getDefaultCharacterSet(){return this.#p}setDefaultCharacterSet(e){this.#p=e}#Gt(e){this.#Ut=e,this.#Nt=0,this.#Bt=0,this.#oo(),this.#Ht()}#ro(e){this.#io.push(e)}#oo(){this.#io=[]}#Xt(e){this.#Vt=e}#Ht(){this.#Vt=null}#Wt=e=>{this.#Nt++,this.#Nt===this.#Ut.length&&this.onload({source:this.#Ut})};#$t=e=>{this.#Bt++,this.#Bt===this.#Ut.length&&this.onloadend({source:this.#Ut})};#jt(e,t){return n=>{n.source=t,e(n)}}#Kt(e,t,n){return i=>{e.load(i.target.result,t,n)}}load(e){if(void 0===e||0===e.length)return;this.#Gt(e),this.onloadstart({source:e});const t=new wo(this.onprogress);t.setNToLoad(e.length);const n=ws(),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.#Wt,r.onloadend=this.#$t,r.onerror=this.onerror,r.onabort=this.onabort,this.#Xt(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.#ro(i),i.onprogress=this.#jt(t.getMonoProgressHandler(n,0),o),i.onload=this.#Kt(r,o,n);const a=this.#jt(this.onerror,o);i.onerror=e=>{this.#$t(),a(e)};const s=this.#jt(this.onabort,o);i.onabort=e=>{this.#$t(),s(e)},r.loadFileAs()===Ts.Text?i.readAsText(o):r.loadFileAs()===Ts.DataURL?i.readAsDataURL(o):r.loadFileAs()===Ts.ArrayBuffer&&i.readAsArrayBuffer(o)}}abort(){for(let e=0;e<this.#io.length;++e)1===this.#io[e].readyState&&this.#io[e].abort();this.#Vt&&this.#Vt.isLoading()&&this.#Vt.abort()}}const Ps=["loadstart","loadprogress","loaditem","load","loadend","error","abort","timeout"];class As extends EventTarget{#p;#ao={};constructor(e){super(),this.#p=e}loadFiles(e,t){"json"===e[0].name.split(".").pop().toLowerCase()?this.#so(e[0],t):this.#lo(e,t)}loadURLs(e,t,n){"json"===e[0].split(".").pop().toLowerCase()?this.#co(e[0],t,n):this.#uo(e,t,n)}loadImageObject(e,t){const n=new Ss;this.#do(e,n,"image",t)}getLoadingDataIds(){return Object.keys(this.#ao)}abort(e){void 0!==this.#ao[e]&&(this.#ao[e].loader.abort(),delete this.#ao[e])}#lo(e,t){const n=new Ls;n.setDefaultCharacterSet(this.#p),this.#do(e,n,"image",t)}#uo(e,t,n){const i=new Lo;i.setDefaultCharacterSet(this.#p),this.#do(e,i,"image",t,n)}#so(e,t){const n=new Ls;this.#do([e],n,"state",t)}#co(e,t,n){const i=new Lo;this.#do([e],i,"state",t,n)}#do(e,t,n,i,o){const r={dataid:i,loadtype:n};t.onloadstart=e=>{this.#ao[i]={loader:t,isFirstItem:!0},this.#Fi("loadstart",r)(e)},t.onprogress=this.#Fi("loadprogress",r),t.onloaditem=e=>{const t={dataid:i,loadtype:n};void 0!==this.#ao[i]&&(t.isfirstitem=this.#ao[i].isFirstItem),this.#Fi("loaditem",t)(e),void 0!==this.#ao[i]&&this.#ao[i].isFirstItem&&(this.#ao[i].isFirstItem=!1)},t.onload=this.#Fi("load",r),t.onloadend=e=>{delete this.#ao[i],this.#Fi("loadend",r)(e)},t.onerror=this.#Fi("error",r),t.onabort=this.#Fi("abort",r),void 0!==t.ontimeout&&(t.ontimeout=this.#Fi("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}}))}}#Fi(e,t){return n=>{const i=Object.assign({},n,t);this.dispatchEvent(new CustomEvent(e,{detail:i}))}}}const Os=["undoadd","undoremove","undo","redo"];class bs extends EventTarget{#ho=new ba;constructor(){super(),this.#go()}addToUndoStack=e=>{this.#ho.add(e)};removeFromUndoStack=e=>this.#ho.remove(e);undo(){this.#ho.undo()}redo(){this.#ho.redo()}getStackSize(){return this.#ho.getStackSize()}getCurrentStackIndex(){return this.#ho.getCurrentStackIndex()}reset(){this.#ho=new ba,this.#go()}#go(){for(const e of Os)this.#ho.addEventListener(e,(t=>{const n=Object.assign({},t.detail);this.dispatchEvent(new CustomEvent(e,{detail:n}))}))}}class xs{tags;event;pos;format;precision;value}function Es(e){return function(t){return Number(t).toPrecision(e)}}function Rs(e){let t="";for(let n=0;n<e;++n)0!==n&&(t+=", "),t+=`{v${n}}`;return t}function Fs(e,t){let n=e;for(let e=0;e<t.length;++e)n=n.replace(`{v${e}}`,t[e]);return n}class Ms extends EventTarget{#yn;#mt;#So;#po=[];#mo;#fo={};#vo;constructor(e,t,n){super(),this.#yn=e,this.#mt=t,this.#So=n;const i=Object.keys(this.#So);for(let e=0;e<i.length;++e){const t=this.#So[i[e]];for(const e of t){const t=e.event;void 0!==t&&(this.#po.includes(t)||this.#po.push(t))}}this.addAppListeners()}reset(){this.#fo={},this.#vo=void 0}addItemMeta(e){let t;void 0!==e["00020010"]?void 0!==e["00080018"]?(t=e["00080018"].value[0],this.#fo[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=Gt(Bt(i));void 0!==e&&t.push(e.toLocaleDateString())}else if("TM"===i.vr){const e=Gt({year:1900,monthIndex:0,day:1},kt(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=Rs(t.length)),i.value=Fs(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:pe(e),format:"{v0}"}),n.push({pos:"bc",value:t,format:"{v0}"}),n.push({pos:"tc",value:pe(t),format:"{v0}"})}return n}(e,this.#So)):r.warn("Missing DICOM SOP instance UID for info data indexing"):void 0!==e.imageUid?(t=e.imageUid.value[0],this.#fo[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=Rs(t.length)),i.value=Fs(i.format,t).trim()}n.push(i)}return n}(e,this.#So)):r.warn("Missing DOM image UID for info data indexing"),void 0!==t&&(this.#vo=t)}onSliceChange=e=>{const t=e.detail?.dataid;if(t!==this.#mt)return;const n=e.detail?.data;void 0!==n&&void 0!==n.imageUid&&this.#vo!==n.imageUid&&(this.#vo=n.imageUid,this.#Co(e))};#Co=e=>{const t=e.detail?.dataid;if(void 0!==t&&t!==this.#mt)return;const n=this.#fo[this.#vo];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:Es(parseInt(t.precision,10)),o=o.map(e)}n=Fs(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.#vo}`)};isListening(){return this.#mo}addAppListeners(){this.#yn.addEventListener("positionchange",this.onSliceChange);for(const e of this.#po)this.#yn.addEventListener(e,this.#Co);this.#mo=!0}removeAppListeners(){this.#yn.removeEventListener("positionchange",this.onSliceChange);for(const e of this.#po)this.#yn.removeEventListener(e,this.#Co);this.#mo=!1}}function qs(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 Us(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 Qs{onWheel(e,t){}onWheelTick(e,t){}}class Vs extends Qs{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 Ns extends Qs{onWheel(e,t){if(void 0===t)return;const n=-e.deltaY/500,i=Do(e),o=Us(t);if(void 0===o)return void r.warn("No view layer to do wheel zoom behavior");const a=o.getViewController(),s=o.displayToMainPlanePos(i),l=a.getPlanePositionFromPlanePoint(s);t.addScale(n,l),t.draw()}}class Bs{#Ue;#Do;#yo;#Io;constructor(e,t){if(this.#Ue=e,this.#Do=e.isID(),this.#yo=Math.pow(2,t),!this.#Do){this.#Io=new Float32Array(this.#yo);for(let e=0;e<this.#yo;++e)this.#Io[e]=this.#Ue.apply(e)}}getRSI(){return this.#Ue}getLength(){return this.#yo}getValue(e){return this.#Do?e:this.#Io[e]}}class ks{#wo;#To;#Io;#Lo=0;#Po=!0;constructor(e,t,n){if(this.#wo=e,t){const e=this.#wo.getLength();this.#Lo=e/2}else this.#Lo=0;this.#Po=n}getVoiLut(){return this.#To}getModalityLut(){return this.#wo}setVoiLut(e){if(this.#To=e,this.#To.setSignedOffset(this.#wo.getRSI().getSlope()*this.#Lo),this.#Po){const e=this.#wo.getLength();this.#Io=new Uint8ClampedArray(e);for(let t=0;t<e;++t)this.#Io[t]=this.#To.apply(this.#wo.getValue(t))}}getValue(e){return this.#Po?this.#Io[e+this.#Lo]:Math.floor(this.#To.apply(e+this.#Lo))}}const Gs={CT:{mediastinum:new je(40,400),lung:new je(-500,1500),bone:new je(500,2e3),brain:new je(40,80),head:new je(90,350)}};class zs{create(e,t){const n=new Ws(t);"MONOCHROME1"===t.getPhotometricInterpretation()&&n.setColourMap("invPlain");let i={};void 0!==t.getMeta().windowPresets&&(i=t.getMeta().windowPresets),i.minmax=new Ke("minmax");const o=t.getMeta().Modality;let r;r=void 0!==ot.wlPresets&&void 0!==ot.wlPresets[o]?ot.wlPresets[o]:Gs[o];for(const e in r){const t=r[e];i[e]=new Ke(e,[new je(t.center,t.width)])}return n.setWindowPresets(i),n}}class Hs{#Ao=[];#Oo(e){return this.#Ao.indexOf(e)}isHidden(e){return-1!==this.#Oo(e)}addToHidden(e){this.isHidden(e)?r.warn(`Not hidding segment, it is allready in the hidden list: ${e}`):this.#Ao.push(e)}removeFromHidden(e){const t=this.#Oo(e);-1!==t?this.#Ao.splice(t,1):r.warn(`Cannot remove segment, it is not in the hidden list: ${e}`)}}const Ys=["wlchange","wlpresetadd","colourmapchange","positionchange","opacitychange","alphafuncchange","maskviewchange"];function Xs(e,t){return(new zs).create(e,t)}class Ws extends EventTarget{#bo;#xo;#Ne;#Eo={minmax:new Ke("minmax")};#Ro;#Fo;#Mo="plain";#qo;#q;#Uo=.33;#Qo=1;#Vo;#No=function(e,t){return 255};#Bo=(e,t)=>0===e||this.#ko.isHidden(e)?0:0!==this.getContourThickness()&&this.#bo.getContour().getDistance(t,this.getOrientation())<=this.getContourThickness()?255:255*this.getFillOpacity();#ko;constructor(e){super(),this.setImage(e)}getImage(){return this.#bo}setImage(e){this.#bo=e;const t=e.getMeta().windowPresets;if(void 0!==t)for(const e of Object.keys(t))this.#Eo[e]=t[e];void 0===this.getCurrentPosition()&&this.setCurrentIndex(this.#Go(),!0),this.isMask()?(this.#ko=new Hs,this.#Vo=this.#Bo):(this.#Vo=this.#No,this.#bo.addEventListener("appendframe",(()=>{const e=this.getCurrentIndex();if(3===e.length()){const t=e.getValues();t.push(0),this.setCurrentIndex(new o(t),!0)}})))}isMask(){return this.#bo.isMask()}setMaskViewHelper(e){this.#ko=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}getOrientation(){return this.#q}setOrientation(e){this.#q=e}getFillOpacity(){return this.#Uo}setFillOpacity(e){this.#Uo=e>1?1:e<0?0:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#Uo,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.#Uo,this.#Qo]}}))}#Go(){const e=this.#bo.getGeometry().getSize(),t=new Array(e.length());return t.fill(0),t[0]=Math.floor(e.get(0)/2),t[1]=Math.floor(e.get(1)/2),t[2]=Math.floor(e.get(2)/2),e.normaliseIndex(new o(t))}getPlaybackMilliseconds(e){return e||(e=10),Math.round(1e3/e)}getAlphaFunction(){return this.#Vo}setAlphaFunction(e){this.#Vo=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}#zo(){if(void 0!==this.#Ro&&void 0!==this.#Eo[this.#Ro]&&void 0!==this.#Eo[this.#Ro].perslice&&!0===this.#Eo[this.#Ro].perslice&&!this.#bo.isResampled()){const e=this.getCurrentIndex();if(void 0===e)throw new Error("Cannot get window lut with no current index");const t=this.#bo.getSecondaryOffset(e),n=this.#Eo[this.#Ro].wl[t];void 0!==n&&this.setWindowLevel(n,this.#Ro,!0)}if(void 0===this.#Fo&&this.setWindowLevelPresetById(0,!0),void 0===this.#Ne||this.#bo.isConstantRSI()!==this.#Ne){let e,t;this.#Ne=this.#bo.isConstantRSI(),this.#Ne?(e=this.#bo.getRescaleSlopeAndIntercept(),t=!0):(e=new Ee(1,0),t=!1);const n=new Bs(e,this.#bo.getMeta().BitsStored);this.#xo=new ks(n,1===this.#bo.getMeta().PixelRepresentation,t)}const e=this.#xo.getVoiLut();let t;if(void 0!==e&&(t=e.getWindowLevel()),void 0===e||!Ze(this.#Fo,t)){const e=new $e(this.#Fo,this.#bo.getMeta().VOILUTFunction);this.#xo.setVoiLut(e)}return this.#xo}getWindowPresets(){return this.#Eo}getWindowPresetsNames(){return Object.keys(this.#Eo)}setWindowPresets(e){this.#Eo=e}addWindowPresets(e){const t=Object.keys(e);for(const n of t)if(void 0!==this.#Eo[n]){if(void 0!==this.#Eo[n].perslice&&!0===this.#Eo[n].perslice)throw new Error("Cannot add perslice preset");this.#Eo[n]=e[n]}else this.#Eo[n]=e[n],this.dispatchEvent(new CustomEvent("wlpresetadd",{detail:{name:n}}))}getCurrentWindowPresetName(){return this.#Ro}getColourMap(){return this.#Mo}#Ho(){return it[this.#Mo]}setColourMap(e){if(!it[e])throw new Error(`Unknown colour map: '${e}'`);this.#Mo=e,this.dispatchEvent(new CustomEvent("colourmapchange",{detail:{value:[e]}}))}getCurrentPosition(){return this.#qo}getCurrentIndex(){const e=this.getCurrentPosition();if(void 0!==e)return this.getImage().getGeometry().worldToIndex(e)}getCurrentImageUid(){return this.#bo.getImageUid(this.getCurrentIndex())}getOriginForImageUid(e){return this.#bo.getOriginForImageUid(e)}includesImageUid(e){return this.#bo.includesImageUid(e)}isPositionInBounds(e){void 0===e&&(e=this.#qo);const t=this.#bo.getGeometry(),n=t.worldToIndex(e),i=[this.getScrollDimIndex()];return 4===n.length()&&i.push(3),t.isIndexInBounds(n,i)}getOrigin(e){const t=this.#bo.getGeometry();let n=0;return void 0!==e&&(n=t.worldToIndex(e).get(2)),t.getOrigins()[n]}setCurrentIndex(e,t){const n=this.#bo.getGeometry().indexToWorld(e);return this.setCurrentPosition(n,t)}setCurrentPosition(e,t){void 0===t&&(t=!1);const n=this.#bo.getGeometry(),i=n.getSize().normalisePoint(e,this.#qo),o=n.worldToIndex(i),r=[this.getScrollDimIndex()];if(4===o.length()&&r.push(3),!n.isIndexInBounds(o,r))return this.#qo=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.#qo=i,!t){const t=[o.getValues(),e.getValues()];if(this.#bo.canQuantify()){const e=this.#bo.getRescaledValueAtIndex(o);t.push(e)}this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:t,diffDims:a,data:{imageUid:this.#bo.getImageUid(o)}}}))}return!0}setWindowLevel(e,t,n){if(void 0===t&&(t="manual"),"manual"!==t&&void 0===this.#Eo[t])throw new Error(`Unknown window level preset: '${t}'`);void 0===n&&(n=!1);const i=_e(e,this.#bo.getRescaledDataRange(),this.#bo.getMeta().VOILUTFunction),o=!Ze(i,this.#Fo),r=this.#Ro!==t;(o||r)&&(this.#Fo=i,this.#Ro=t,"manual"===t&&(void 0!==this.#Eo[t]?this.#Eo[t].wl[0]=i:this.addWindowPresets({manual:new Ke("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.#zo().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.#bo.isResampled()){const e=this.#bo.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 _e(new je(n,t),e,this.#bo.getMeta().VOILUTFunction)}setWindowLevelMinMax(){const e=this.getWindowLevelMinMax();this.setWindowLevel(e,"minmax")}generateImageData(e,t){if(void 0===t&&void 0===(t=this.getCurrentIndex()))throw new Error("Cannot generate image data with no current index");const n=this.getImage(),i=!n.isConstantRSI(),o=be(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,o,this.getAlphaFunction(),this.#zo(),this.#Ho());break;case"PALETTE COLOR":n.getHasOverlap()?function(e,t,n,i,o,r,a,s,l,c){const u=i.getAll(),d=Math.round(255*l),h=s>0?i.getOrBuildUnionContour(c,r):null;let g=0,S=t.next();for(;!S.done;){const i=S.index;if(0===S.value)e.data[g]=0,e.data[g+1]=0,e.data[g+2]=0,e.data[g+3]=0;else{const t=Math.floor(i/o),r=i%o;let l=0,S=0,p=0,m=0;for(const[e,i]of u){if(c?.isHidden(e))continue;const o=i.get(t);void 0!==o&&0!==o[r]&&(l+=n.red[e],S+=n.green[e],p+=n.blue[e],++m)}if(0===m)e.data[g+3]=0;else{e.data[g]=Math.round(l/m),e.data[g+1]=Math.round(S/m),e.data[g+2]=Math.round(p/m);let t=d;null!==h&&h.getDistance(i,a)<=s&&(t=255),e.data[g+3]=t}}g+=4,S=t.next()}}(e,o,n.getPaletteColourMap(),n.getSegmentCollection(),n.getGeometry().getSize().getDimSize(2),n.getGeometry().getSize(),this.getOrientation(),this.getContourThickness(),this.getFillOpacity(),this.#ko):function(e,t,n,i,o){const a=function(e){return e>>8};o&&r.info("Scaling 16bits data to 8bits.");let s,l=0,c=t.next();for(;!c.done;)s=c.value,o?(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,o,this.getAlphaFunction(),n.getPaletteColourMap(),16===n.getMeta().BitsStored);break;case"RGB":!function(e,t,n){let i=0,o=t.next();for(;!o.done;)e.data[i]=o.value[0],e.data[i+1]=o.value[1],e.data[i+2]=o.value[2],e.data[i+3]=n(o.value,o.index),i+=4,o=t.next()}(e,o,this.getAlphaFunction());break;case"YBR_FULL":!function(e,t,n){let i,o=0,r=t.next();for(;!r.done;)a=r.value[0],s=r.value[1],i={r:a+1.402*((l=r.value[2])-128),g:a-.34414*(s-128)-.71414*(l-128),b:a+1.772*(s-128)},e.data[o]=i.r,e.data[o+1]=i.g,e.data[o+2]=i.b,e.data[o+3]=n(r.value,r.index),o+=4,r=t.next();var a,s,l}(e,o,this.getAlphaFunction());break;default:throw new Error(`Unsupported photometric interpretation: ${a}`)}}getScrollDimIndex(){let e=2;const t=this.getOrientation();return void 0!==t&&(e=t.getThirdColMajorDirection()),e}isAquisitionOrientation(){return Ue(this.#q)}}class $s{#Yo={};add(e,t){void 0===this.#Yo[e]&&(this.#Yo[e]=[]),this.#Yo[e].push(t)}remove(e,t){if(void 0===this.#Yo[e])return;let n=0;for(let i=0;i<this.#Yo[e].length;++i)this.#Yo[e][i]===t&&(++n,this.#Yo[e].splice(i,1));0===n&&r.debug(`No callback found on remove listener for type ${e}`)}fireEvent=e=>{if(void 0===this.#Yo[e.type])return;const t=this.#Yo[e.type].slice();for(let n=0;n<t.length;++n)t[n](e)}}class js{#Xo;#R;#Wo;#$o;#jo;constructor(e,t){this.#Xo=e,this.#R=e.getRealSpacing(),this.#Wo=e.getOrientation(),this.#$o=t,this.#jo=function(e,t){let n=e.asOneAndZeros().multiply(t);return e.asOneAndZeros().getAbs().isSimilar(rt().getAbs())&&(n=n.getAbs()),n}(this.#Wo,t)}getViewOrientation(){return this.#$o}getTargetOrientation(){return this.#jo}getOffset3DFromPlaneOffset(e){const t=new g(e.x,e.y,0),n=this.getTargetDeOrientedVector3D(t);return new g(n.getX()*this.#R.get(0),n.getY()*this.#R.get(1),n.getZ()*this.#R.get(2))}getPlaneOffsetFromOffset3D(e){const t=new g(e.x/this.#R.get(0),e.y/this.#R.get(1),e.z/this.#R.get(2)),n=this.getTargetOrientedVector3D(t);return{x:n.getX(),y:n.getY()}}getTargetOrientedVector3D(e){let t=e;return void 0!==this.#jo&&(t=this.#jo.getInverse().multiplyVector3D(e)),t}getTargetDeOrientedVector3D(e){let t=e;return void 0!==this.#jo&&(t=this.#jo.multiplyVector3D(e)),t}getTargetDeOrientedPoint3D(e){let t=e;return void 0!==this.#jo&&(t=this.#jo.multiplyPoint3D(e)),t}getImageOrientedVector3D(e){let t=e;if(void 0!==this.#$o){const n=He([e.getX(),e.getY(),e.getZ()],this.#$o);t=new g(n[0],n[1],n[2])}return t}getImageOrientedPoint3D(e){let t=e;if(void 0!==this.#$o){const n=He([e.getX(),e.getY(),e.getZ()],this.#$o);t=new p(n[0],n[1],n[2])}return t}getImageDeOrientedVector3D(e){let t=e;if(void 0!==this.#$o){const n=ze([e.getX(),e.getY(),e.getZ()],this.#$o);t=new g(n[0],n[1],n[2])}return t}getImageDeOrientedPoint3D(e){let t=e;if(void 0!==this.#$o){const n=ze([e.getX(),e.getY(),e.getZ()],this.#$o);t=new p(n[0],n[1],n[2])}return t}getPositionFromPlanePoint(e,t){const n=new p(e.getX(),e.getY(),t),i=this.getImageOrientedPoint3D(n);return this.#Xo.pointToWorld(i)}getPlanePointFromPosition(e){const t=this.#Xo.worldToPoint(e);return this.getImageDeOrientedPoint3D(t)}getCosines(){return[(e=this.#jo).get(0,0),e.get(1,0),e.get(2,0),e.get(0,1),e.get(1,1),e.get(2,1)];var e}getPlanePoints(e){const t=this.worldToIndex(e),n=this.indexToWorld(t),i=this.getPlanePointFromPosition(n),o=this.getPositionFromPlanePoint(new S(0,0),i.getZ()),r=this.#Xo.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 p(s[0],s[1],s[2]),new p(u[0],u[1],u[2]),new p(u[3],u[4],u[5])]}worldToIndex(e){return this.#Xo.worldToIndex(e)}indexToWorld(e){return this.#Xo.indexToWorld(e)}isAquisitionOrientation(){return Ue(this.#$o)}getTargetOrientedPositiveXYZ(e){const t=ze([e.x,e.y,e.z],this.#jo);return{x:t[0],y:t[1],z:t[2]}}getScrollDimIndex(){let e;return e=void 0!==this.#$o?this.#$o.getThirdColMajorDirection():2,e}getNativeScrollDimIndex(){let e;return e=void 0!==this.#Wo?this.#Wo.getThirdColMajorDirection():2,e}}class Zs{#g;constructor(e){this.#g=e}getCurrentPosition(){return this.#g.getCurrentPosition()}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(n=this.#g.setCurrentPosition(e,t)),n}}class _s{#Zo;#pe;#qo;#_o;constructor(e){this.#Zo=new Zs(e),this.#pe=e.getImage().getGeometry(),this.#qo=e.getCurrentPosition(),this.#_o=e.getScrollDimIndex()}getGeometry(){return this.#pe}getScrollDimIndex(){return this.#_o}getMaximumDimValue(e){return this.#pe.getSize().get(e)-1}getMaximumScrollValue(){return this.getMaximumDimValue(this.#_o)}getCurrentPosition(){return this.#pe.getSize().normalisePoint(this.#Zo.getCurrentPosition(),this.#qo)}getCurrentPositionDimValue(e){return this.getCurrentIndex().get(e)}getCurrentPositionScrollValue(){return this.getCurrentPositionDimValue(this.#_o)}getCurrentPositionAtDimValue(e,t){const n=this.getCurrentIndex().getValues();return n[e]=t,this.#pe.indexToWorld(new o(n))}getCurrentPositionAtScrollValue(e){return this.getCurrentPositionAtDimValue(this.#_o,e)}getCurrentIndex(){return this.#pe.worldToIndex(this.getCurrentPosition())}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(this.#qo=this.#pe.getSize().normalisePoint(e,this.#qo),n=this.#Zo.setCurrentPosition(e,t)),n}setCurrentPositionSafe(e,t){let n=!1;return this.isPositionInBounds(e)&&(n=this.setCurrentPosition(e,t)),n}merge(e){if(this.#_o!==e.getScrollDimIndex())throw new Error("Cannot merge helper of a view with different orientation");this.#pe=function(e,t){const n=e.getOrientation();if(!n.isSimilarProgressive(t.getOrientation(),ke))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 Fe(o(e.getSpacing().getValues(),t.getSpacing().getValues())),s=function(e){return i.multiplyPoint3D(e.get3D())},l=e.getRange().map(s),c=t.getRange().map(s),u=o(l[0].getValues(),c[0].getValues()),d=r(l[1].getValues(),c[1].getValues());let h=[];for(let e=0;e<u.length;++e)h.push(Math.round(Math.abs(d[e]-u[e])/a.get(e)));const g=r(e.getSize().getValues(),t.getSize().getValues());h=h.concat(g.slice(3));const S=new Re(h),m=[];for(let e=0;e<S.get(2);++e){const t=u.slice();t[2]=u[2]+e*a.get(2);const i=new p(t[0],t[1],t[2]);m.push(n.multiplyPoint3D(i))}return new Ge(m,S,a,n)}(this.#pe,e.getGeometry()),this.#qo=this.#pe.getSize().normalisePoint(this.#qo,e.getCurrentPosition())}isPositionInBounds(e){const t=this.#pe.worldToIndex(e),n=[this.#_o];return 4===t.length()&&n.push(3),this.#pe.isIndexInBounds(t,n)}getIncrementPosition(e){const t=this.getCurrentIndex().next(e);return this.#pe.indexToWorld(t)}getDecrementPosition(e){const t=this.getCurrentIndex().previous(e);return this.#pe.indexToWorld(t)}incrementPosition(e){return this.setCurrentPositionSafe(this.getIncrementPosition(e))}decrementPosition(e){return this.setCurrentPositionSafe(this.getDecrementPosition(e))}incrementPositionAlongScroll(){return this.incrementPosition(this.#_o)}decrementPositionAlongScroll(){return this.decrementPosition(this.#_o)}}class Ks{#g;#Ko;#Jo;constructor(e){if(void 0===e.getImage())throw new Error("View does not have an image, cannot setup controller");this.#g=e,this.#Ko=new js(e.getImage().getGeometry(),e.getOrientation())}getPlaneHelper(){return this.#Ko}updatePlaneHelper(){this.#Ko=new js(this.#g.getImage().getGeometry(),this.#g.getOrientation())}isMask(){return this.#g.isMask()}initialise(){this.resetWindowLevel(),this.resetPosition()}resetWindowLevel(){this.setWindowLevelPresetById(0)}resetPosition(){this.setCurrentPosition(this.getPositionFromPlanePoint(new S(0,0)))}getModality(){return this.#g.getImage().getMeta().Modality}getSopClassUid(){return this.#g.getImage().getMeta().SOPClassUID}getWindowLevelPresetsNames(){return this.#g.getWindowPresetsNames()}addWindowLevelPresets(e){return this.#g.addWindowPresets(e)}setWindowLevelPreset(e){this.#g.setWindowLevelPreset(e)}setWindowLevelPresetById(e){this.#g.setWindowLevelPresetById(e)}isPlaying(){return void 0!==this.#Jo}getPositionHelper(){return new _s(this.#g)}getCurrentPosition(){return this.#g.getCurrentPosition()}getCurrentIndex(){return this.#g.getCurrentIndex()}getCurrentImageUid(){return this.#g.getCurrentImageUid()}getOriginForImageUid(e){return this.#g.getOriginForImageUid(e)}includesImageUid(e){return this.#g.includesImageUid(e)}getCurrentOrientedIndex(){let e=this.getCurrentIndex();if(void 0!==this.#g.getOrientation()){const t=this.#Ko.getImageDeOrientedVector3D(new g(e.get(0),e.get(1),e.get(2)));e=new o([t.getX(),t.getY(),t.getZ()])}return e}getScrollDimIndex(){return this.#g.getScrollDimIndex()}getCurrentIndexScrollValue(){return this.getCurrentIndex().get(this.#g.getScrollDimIndex())}getOrigin(e){return this.#g.getOrigin(e)}isAquisitionOrientation(){return this.#g.isAquisitionOrientation()}getPlanePoints(e){return this.#Ko.getPlanePoints(e)}getCurrentScrollPosition(){const e=this.#g.getScrollDimIndex();return this.#g.getCurrentPosition().get(e)}generateImageData(e,t){this.#g.generateImageData(e,t)}setImage(e){const t=this.#g.getImage().getGeometry(),n=e.getGeometry();this.#g.setImage(e),t.equals(n)||this.updatePlaneHelper()}get2DSpacing(){return this.#g.getImage().getGeometry().getSpacing(this.#g.getOrientation()).get2D()}getRescaledImageValue(e){const t=this.#g.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.#g.getImage().getMeta().pixelUnit}getLengthUnit(){return this.#g.getImage().getMeta().lengthUnit}#er(e,t,n,i){const o=Oe(be(e,t,n,i)),r=e.getGeometry().getSize(i).getValues();r[2]=1;const a=new Re(r),s=e.getGeometry().getSpacing(i).getValues();s[2]=1;const l=new Fe(s),c=new p(0,0,0),u=new Ge([c],a,l);return new to(u,o)}getImageRegionValues(e,t,n){let i=this.#g.getImage();const r=this.#g.getOrientation();let a=n,s=!0;Ue(r)||(i=this.#er(i,a,s,r),a=new o([0,0,0]),s=!1);const l=function(e,t,n,i,o){if(1!==e.getNumberOfComponents())throw new Error(`Unsupported number of components for region iterator: ${e.getNumberOfComponents()}`);let r;void 0===n&&(n=!1),r=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const a=e.getGeometry().getSize();void 0===i&&(i=new S(0,0)),void 0===o&&(o=new S(a.get(0)-1,a.get(1)));const s=a.indexToOffset(t.getWithNew2D(i.getX(),i.getY())),l=a.indexToOffset(t.getWithNew2D(o.getX(),o.getY()-1)),c=Math.max(1,o.getX()-i.getX());return function(e,t,n,i,o,r){let a=t,s=0;return{next(){if(a<n){const t={value:e(a),done:!1,index:a};return s+=1,a+=1,s===o&&(s=0,a+=r),t}return{done:!0,index:n}}}}(r,s,l+1,0,c,a.get(0)-c)}(i,a,s,e,t);let c=[];return l&&(c=Oe(l)),c}getImageVariableRegionValues(e,t){let n=this.#g.getImage();const i=this.#g.getOrientation();let r=t,a=!0;Ue(i)||(n=this.#er(n,r,a,i),r=new o([0,0,0]),a=!1);const s=function(e,t,n,i){if(1!==e.getNumberOfComponents())throw new Error(`Unsupported number of components for region iterator: ${e.getNumberOfComponents()}`);let o;void 0===n&&(n=!1),o=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const r=e.getGeometry().getSize(),a=[];let s,l=null,c=null,u=null;for(let e=0;e<i.length;++e){s=i[e];const t=s[1][0]-s[0][0];0!==t&&(u=e,l||(l=s[0]),a.push([s[0][0],t,r.get(0)-s[1][0]]))}if(null!==u&&(c=i[u][1]),0!==a.length)return function(e,t,n,i,o){let r=t,a=0,s=0;return{next(){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=Oe(s)),l}canQuantifyImage(){return this.#g.getImage().canQuantify()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return this.#g.getImage().isMonochrome()}canScroll(){return this.#g.getImage().canScroll(this.#g.getOrientation())}getImageSize(){return this.#g.getImage().getGeometry().getSize(this.#g.getOrientation())}getImageSpacing(){return this.#g.getImage().getGeometry().getSpacing(this.#g.getOrientation())}moreThanOne(e){return this.getImageSize().moreThanOne(e)}getImageWorldSize(){const e=this.#g.getImage().getGeometry(),t=e.getSize(this.#g.getOrientation()).get2D(),n=e.getSpacing(this.#g.getOrientation()).get2D();return{x:t.x*n.x,y:t.y*n.y}}getImageRescaledDataRange(){return this.#g.getImage().getRescaledDataRange()}equalImageMeta(e){const t=this.#g.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.#g.isPositionInBounds(e)}setCurrentPosition(e,t){return this.#g.setCurrentPosition(e,t)}getPositionFromPlanePoint(e,t){void 0===t&&(t=this.getCurrentIndexScrollValue());const n=new p(e.getX(),e.getY(),t),i=this.#Ko.getImageOrientedPoint3D(n),o=this.#g.getImage().getGeometry().pointToWorld(i);return this.getCurrentPosition().mergeWith3D(o)}validatePlanePoint(e){const t=this.getPositionFromPlanePoint(e);return this.#g.getImage().getGeometry().isInBounds(t)}getPlanePositionFromPosition(e){const t=this.#g.getImage().getGeometry().worldToPoint(e),n=this.#Ko.getImageDeOrientedPoint3D(t);return new S(n.getX(),n.getY())}getIndexFromPosition(e){return this.#g.getImage().getGeometry().worldToIndex(e)}setCurrentIndex(e,t){return this.#g.setCurrentIndex(e,t)}getPlanePositionFromPlanePoint(e){const t=this.getCurrentIndexScrollValue(),n=new p(e.getX(),e.getY(),t),i=this.#Ko.getTargetDeOrientedPoint3D(n),o=this.#g.getImage().getGeometry().getRealSpacing();return new p(i.getX()*o.get(0),i.getY()*o.get(1),i.getZ()*o.get(2))}getOffset3DFromPlaneOffset(e){return this.#Ko.getOffset3DFromPlaneOffset(e)}play(){if(this.canScroll())if(void 0===this.#Jo){const e=this.#g.getImage(),t=e.getMeta().RecommendedDisplayFrameRate,n=this.#g.getPlaybackMilliseconds(t),i=e.getGeometry().getSize().canScroll3D(),r=this.getPositionHelper();this.#Jo=window.setInterval((()=>{let e;if(e=i?r.incrementPositionAlongScroll():r.incrementPosition(3),!e){const e=this.getCurrentIndex().getValues(),t=this.#g.getOrientation();i?e[t.getThirdColMajorDirection()]=0:e[3]=0;const n=new o(e),r=this.#g.getImage().getGeometry();this.setCurrentPosition(r.indexToWorld(n))}}),n)}else this.stop()}stop(){void 0!==this.#Jo&&(clearInterval(this.#Jo),this.#Jo=void 0)}getWindowLevel(){return this.#g.getWindowLevel()}getCurrentWindowPresetName(){return this.#g.getCurrentWindowPresetName()}setWindowLevel(e){this.#g.setWindowLevel(e)}getColourMap(){return this.#g.getColourMap()}setColourMap(e){this.#g.setColourMap(e)}setViewAlphaFunction(e){this.#g.setAlphaFunction(e)}setMaskViewHelper(e){this.#g.setMaskViewHelper(e)}getFillOpacity(){return this.#g.getFillOpacity()}setFillOpacity(e){this.#g.setFillOpacity(e)}getContourThickness(){return this.#g.getContourThickness()}setContourThickness(e){this.#g.setContourThickness(e)}bindImageAndLayer(e){const t=this.#g.getImage();t.addEventListener("imagecontentchange",e.onimagecontentchange),t.addEventListener("imagegeometrychange",e.onimagegeometrychange),t.addEventListener("imageresampled",e.onimageresampled)}unbindImageAndLayer(e){const t=this.#g.getImage();t.removeEventListener("imagecontentchange",e.onimagecontentchange),t.removeEventListener("imagegeometrychange",e.onimagegeometrychange),t.removeEventListener("imageresampled",e.onimageresampled)}}class Js{#tr;#Mn=null;#nr=null;#ir=null;#or=null;#rr=!0;#ar;#sr;#lr;#cr=1;#ur={x:1,y:1};#dr={x:1,y:1};#hr={x:1,y:1,z:1};#gr={x:1,y:1};#Sr=1;#pr={x:1,y: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};#yr={x:0,y:0};#Ir=null;#mt;#wr=new $s;#Tr=!1;#Lr;#Pr;constructor(e){this.#tr=e,this.#tr.className+=" viewLayer"}getDataId(){return this.#mt}getScale(){return this.#ur}getAbsoluteZoomOffset(){return{x:this.#Cr.x*this.#dr.x,y:this.#Cr.y*this.#dr.y}}setImageSmoothing(e){this.#Tr=e}setView(e,t){this.#mt=t,e.addEventListener("wlchange",this.#Ar),e.addEventListener("colourmapchange",this.#Or),e.addEventListener("positionchange",this.#br),e.addEventListener("alphafuncchange",this.#xr),e.addEventListener("maskviewchange",this.#Er);for(const t of Ys)e.addEventListener(t,this.#Rr);this.#Mn=new Ks(e),this.bindImage()}getViewController(){return this.#Mn}getImageData(){return this.#ar}onimageset=e=>{const t=e.detail?.dataid,n=e.detail?.value;this.#mt===t&&(this.#Mn.setImage(n[0]),this.#Fr(this.#Mn.getImageSize().get2D()),this.#Ir=!0)};bindImage(){this.#Mn&&this.#Mn.bindImageAndLayer(this)}unbindImage(){this.#Mn&&this.#Mn.unbindImageAndLayer(this)}onimagecontentchange=e=>{const t=e.detail?.dataid;void 0!==t&&this.#mt!==t||(this.#rr=this.#Mn.isPositionInBounds(),this.#Ir=!0,this.draw())};onimagegeometrychange=e=>{const t=e.detail?.dataid;if(void 0===t||this.#mt===t){const e=this.#Mn.getImageSize().get2D(),t=this.#Mn.getImageSpacing().get2D(),n=this.#sr.x!==e.x||this.#sr.y!==e.y,i=this.#lr.x!==t.x||this.#lr.y!==t.y;if(i&&(this.#Mn.updatePlaneHelper(),this.#Mr(t)),n){if(void 0!==this.#Lr&&void 0!==this.#Pr){const e=this.#Mn.getOrigin(),t=this.#Pr.minus(e),n=this.#Mn.getOrigin(this.#Mn.getCurrentPosition());if(void 0!==n){const e=this.#Lr.minus(n);this.setBaseOffset(t,e)}}this.#Fr(e)}(i||n)&&(this.#Ir=!0,this.draw())}};onimageresampled=e=>{const t=this.#Mn.getCurrentIndex().get(3),n=void 0===t||t===e.detail?.frame,i=e.detail?.dataid;void 0!==i&&this.#mt!==i||!n||(this.#Ir=!0,this.draw())};getId(){return this.#tr.id}removeFromDOM(){this.#tr.remove()}getBaseSize(){return this.#sr}getImageWorldSize(){return this.#Mn.getImageWorldSize()}getOpacity(){return this.#cr}setOpacity(e){e!==this.#cr&&(this.#cr=Math.min(Math.max(e,0),1),this.#Rr(new CustomEvent("opacitychange",{detail:{value:[this.#cr]}})))}getFillOpacity(){return this.#Mn.getFillOpacity()}setFillOpacity(e){this.#Mn.setFillOpacity(e)}getContourThickness(){return this.#Mn.getContourThickness()}setContourThickness(e){this.#Mn.setContourThickness(e)}addFlipOffsetX(){this.#yr.x+=this.#nr.width/this.#ur.x,this.#mr.x+=this.#yr.x}addFlipOffsetY(){this.#yr.y+=this.#nr.height/this.#ur.y,this.#mr.y+=this.#yr.y}flipScaleX(){this.#hr.x*=-1}flipScaleY(){this.#hr.y*=-1}flipScaleZ(){this.#hr.z*=-1}setScale(e,t){const n=this.#Mn.getPlaneHelper(),i=n.getTargetOrientedPositiveXYZ({x:e.x*this.#hr.x,y:e.y*this.#hr.y,z:e.z*this.#hr.z}),o={x:this.#dr.x*i.x,y:this.#dr.y*i.y};if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:this.#mr.x-this.#Cr.x,y:this.#mr.y-this.#Cr.y};this.#Cr={x:0,y:0},this.#mr=e}else if(void 0!==t){let e=n.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#fr.x,y:e.y+this.#fr.y};const i=dl(this.#mr,this.#ur,o,e),r={x:this.#Cr.x+i.x-this.#mr.x,y:this.#Cr.y+i.y-this.#mr.y};this.#Cr=r,this.#mr=i}this.#ur=o}initScale(e,t){const n=this.#Mn.getPlaneHelper().getTargetOrientedPositiveXYZ({x:e.x*this.#hr.x,y:e.y*this.#hr.y,z:e.z*this.#hr.z}),i={x:this.#dr.x*n.x,y:this.#dr.y*n.y};this.#ur=i,this.#Cr={x:t.x/this.#dr.x,y:t.y/this.#dr.y},this.#mr={x:this.#mr.x+this.#Cr.x,y:this.#mr.y+this.#Cr.y}}setBaseOffset(e,t,n,i){const o=this.#Mn.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.#fr.x!==a.x||this.#fr.y!==a.y;return void 0!==n&&void 0!==i&&(this.#Lr=n,this.#Pr=i),s&&(this.#mr={x:this.#mr.x-this.#fr.x+a.x,y:this.#mr.y-this.#fr.y+a.y},this.#fr=a),s}setOffset(e){const t=this.#Mn.getPlaneHelper().getPlaneOffsetFromOffset3D(e);this.#mr={x:this.#mr.x-this.#Dr.x+t.x,y:this.#mr.y-this.#Dr.y+t.y},this.#Dr=t}displayToPlaneIndex(e){const t=this.displayToPlanePos(e);return new o([Math.floor(t.getX()),Math.floor(t.getY())])}displayToPlaneScale(e){return new S(e.getX()/this.#ur.x,e.getY()/this.#ur.y)}displayToPlanePos(e){const t=this.displayToPlaneScale(e);return new S(t.getX()+this.#mr.x,t.getY()+this.#mr.y)}planePosToDisplay(e){let t=(e.getX()-this.#mr.x+this.#fr.x)*this.#ur.x,n=(e.getY()-this.#mr.y+this.#fr.y)*this.#ur.y;return(t<0||t>=this.#nr.width)&&(t=void 0),(n<0||n>=this.#nr.height)&&(n=void 0),new S(t,n)}displayToMainPlanePos(e){const t=this.displayToPlanePos(e);return new S(t.getX()-this.#fr.x,t.getY()-this.#fr.y)}display(e){this.#tr.style.display=e?"":"none"}isVisible(){return""===this.#tr.style.display}draw(){this.#rr&&(this.#Rr(new CustomEvent("renderstart",{detail:{layerid:this.getId()}})),this.#Ir&&this.#qr(),this.#or.globalAlpha=this.#cr,this.clear(),this.#or.setTransform(this.#ur.x,0,0,this.#ur.y,-1*this.#mr.x*this.#ur.x,-1*this.#mr.y*this.#ur.y),this.#or.imageSmoothingEnabled=this.#Tr,this.#or.drawImage(this.#ir,0,0),this.#Rr(new CustomEvent("renderend",{detail:{layerid:this.getId()}})))}initialise(e,t,n){this.#lr=t,this.#cr=Math.min(Math.max(n,0),1),this.#nr=document.createElement("canvas"),this.#tr.appendChild(this.#nr),this.#nr.getContext?(this.#or=this.#nr.getContext("2d"),this.#or?(this.#ir=document.createElement("canvas"),this.#Fr(e),this.#Ir=!0):alert("Error: failed to get the 2D context.")):alert("Error: no canvas.getContext method.")}#Fr(e){if(!yo(e.x,e.y))throw new Error(`Cannot create canvas with size ${e.x}, ${e.y}`);this.#sr=e,this.#ir.width=this.#sr.x,this.#ir.height=this.#sr.y,this.#or.clearRect(0,0,this.#sr.x,this.#sr.y),this.#ar=this.#or.createImageData(this.#sr.x,this.#sr.y)}#Mr(e){this.#lr=e,this.fitToContainer(this.#gr,this.#Sr,this.#pr)}fitToContainer(e,t,n){let i=!1;const o={x:t*this.#lr.x,y:t*this.#lr.y},r=o.x/this.#dr.x,a=o.y/this.#dr.y,s=e.x/(this.#nr.width*r),l=e.y/(this.#nr.height*a);if(this.#nr.width!==e.x||this.#nr.height!==e.y){if(!yo(e.x,e.y))throw new Error(`Cannot resize canvas ${e.x}, ${e.y}`);this.#nr.width=e.x,this.#nr.height=e.y,i=!0}const c={x:this.#ur.x*r,y:this.#ur.y*a};this.#ur.x===c.x&&this.#ur.y===c.y||(this.#dr=o,this.#ur=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.#yr.x?d.x:0,y:0!==this.#yr.y?d.y:0};if(this.#vr.x!==u.x||this.#vr.y!==u.y||this.#yr.x!==h.x||this.#yr.y!==h.y){const e={x:this.#Cr.x*s,y:this.#Cr.y*l};this.#mr={x:this.#mr.x+u.x-this.#vr.x+h.x-this.#yr.x+e.x-this.#Cr.x,y:this.#mr.y+u.y-this.#vr.y+h.y-this.#yr.y+e.y-this.#Cr.y},this.#yr=h,this.#vr=u,this.#Cr=e,i=!0}this.#gr=e,this.#Sr=t,this.#pr=n,i&&this.draw()}bindInteraction(){this.#tr.style.pointerEvents="auto";const e=fo;for(let t=0;t<e.length;++t){const n=e[t],i="wheel"!==n&&"touchstart"!==n;this.#tr.addEventListener(n,this.#Ur,{passive:i})}}unbindInteraction(){this.#tr.style.pointerEvents="none";const e=fo;for(let t=0;t<e.length;++t)this.#tr.removeEventListener(e[t],this.#Ur)}addEventListener(e,t){this.#wr.add(e,t)}removeEventListener(e,t){this.#wr.remove(e,t)}#Rr=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#mt});this.#wr.fireEvent(new CustomEvent(e.type,{detail:t}))};#Ur=e=>{e.srclayerid=this.getId(),e.dataid=this.#mt,this.#wr.fireEvent(e)};#qr(){this.#Mn.generateImageData(this.#ar),this.#ir.getContext("2d").putImageData(this.#ar,0,0),this.#Ir=!1}#Ar=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#Ir=!0,this.draw())};#Or=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#Ir=!0,this.draw())};#br=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.#Mn.getScrollDimIndex());t.splice(n,1);const i=e.detail?.diffDims?.filter((function(e){return-1===t.indexOf(e)}));0===i.length&&this.#rr||(this.#rr=!0,this.#Ir=!0,this.draw())}else this.#rr&&(this.#rr=!1,this.clear())}};isValidPosition(){return this.#rr}#xr=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#Ir=!0,this.draw())};#Er=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#Ir=!0,this.draw())};setCurrentPosition(e,t){return this.#Mn.setCurrentPosition(e)}clear(){this.#or.save(),this.#or.setTransform(1,0,0,1,0,0),this.#or.clearRect(0,0,this.#nr.width,this.#nr.height),this.#or.restore()}}class el extends Oa{#Qr;#Vr;constructor(e,t){super(),this.#Qr=e,this.#Vr=t}getName(){return`AddAnnotation-${this.#Qr.trackingUid}`}execute(){this.#Vr.addAnnotation(this.#Qr)}undo(){this.#Vr.removeAnnotation(this.#Qr.trackingUid)}}class tl extends Oa{#Qr;#Vr;constructor(e,t){super(),this.#Qr=e,this.#Vr=t}getName(){return`RemoveAnnotation-${this.#Qr.trackingUid}`}execute(){this.#Vr.removeAnnotation(this.#Qr.trackingUid)}undo(){this.#Vr.addAnnotation(this.#Qr)}}class nl extends Oa{#Qr;#Vr;#Nr;#Br;constructor(e,t,n,i){super(),this.#Qr=e,this.#Vr=i,this.#Nr=t,this.#Br=n}getName(){return`UpdateAnnotation-${this.#Qr.trackingUid}`}execute(){const e=Object.keys(this.#Br);for(const t of e)this.#Qr[t]=this.#Br[t];this.#Vr.updateAnnotation(this.#Qr,e)}undo(){const e=Object.keys(this.#Nr);for(const t of e)this.#Qr[t]=this.#Nr[t];this.#Vr.updateAnnotation(this.#Qr,e)}}class il{#kr;getAnnotation(e){return this.#kr.find(e)}getAnnotationGroup(){return this.#kr}isAnnotationGroupEditable(){return this.#kr.isEditable()}setAnnotationGroupEditable(e){this.#kr.setEditable(e)}addAnnotation(e){this.#kr.add(e)}updateAnnotation(e,t,n){this.#kr.update(e,t,n)}removeAnnotation(e){this.#kr.remove(e)}removeAnnotationWithCommand(e,t){const n=this.getAnnotation(e);if(void 0===n)return void r.warn(`Cannot create remove command for undefined annotation: ${e}`);const i=new tl(n,this);t(i),i.execute()}updateAnnotationWithCommand(e,t,n,i){const o=this.getAnnotation(e);if(void 0===o)return void r.warn(`Cannot create update command for undefined annotation: ${e}`);const a=new nl(o,t,n,this);i(a),a.execute()}removeAllAnnotationsWithCommand(e){for(const t of this.#kr.getList())this.removeAnnotationWithCommand(t.trackingUid,e)}constructor(e){this.#kr=void 0!==e?e:new io}hasAnnotationMeta(e){return this.#kr.hasMeta(e)}setAnnotationMeta(e,t){this.#kr.setMetaValue(e,t)}}class ol{#tr;#Gr=null;#sr;#lr;#dr={x:1,y:1};#hr={x:1,y:1,z:1};#fr={x:0,y:0};#vr={x:0,y:0};#Cr={x:0,y:0};#Dr={x:0,y:0};#yr={x:0,y:0};#Vr;#Ko;#mt;#zr;#Hr;#Yr;#Xr=!0;constructor(e){this.#tr=e,this.#tr.className+=" drawLayer"}setShapeHandler(e){this.#Yr=e}getDataId(){return this.#mt}getReferenceLayerId(){return this.#zr}#wr=new $s;getKonvaStage(){return this.#Gr}getKonvaLayer(){return this.#Gr.getLayers()[0]}getDrawController(){return this.#Vr}setPlaneHelper(e){this.#Ko=e}getId(){return this.#tr.id}removeFromDOM(){this.#tr.remove()}getBaseSize(){return this.#sr}getOpacity(){return this.#Gr.opacity()}setOpacity(e){this.#Gr.opacity(Math.min(Math.max(e,0),1))}addFlipOffsetX(){const e=this.#Gr.scale(),t=this.#Gr.size();this.#yr.x+=t.width/e.x;const n=this.#Gr.offset();n.x+=this.#yr.x,this.#Gr.offset(n)}addFlipOffsetY(){const e=this.#Gr.scale(),t=this.#Gr.size();this.#yr.y+=t.height/e.y;const n=this.#Gr.offset();n.y+=this.#yr.y,this.#Gr.offset(n)}flipScaleX(){this.#hr.x*=-1}flipScaleY(){this.#hr.y*=-1}flipScaleZ(){this.#hr.z*=-1}setScale(e,t){const n=this.#Ko.getTargetOrientedPositiveXYZ({x:e.x*this.#hr.x,y:e.y*this.#hr.y,z:e.z*this.#hr.z}),i={x:this.#dr.x*n.x,y:this.#dr.y*n.y},o=this.#Gr.offset();if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:o.x-this.#Cr.x,y:o.y-this.#Cr.y};this.#Cr={x:0,y:0},this.#Gr.offset(e)}else if(void 0!==t){let e=this.#Ko.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#fr.x,y:e.y+this.#fr.y};const n=dl(o,this.#Gr.scale(),i,e),r={x:this.#Cr.x+n.x-o.x,y:this.#Cr.y+n.y-o.y};this.#Cr=r,this.#Gr.offset(n)}this.#Gr.scale(i),this.#Wr(i)}initScale(e,t){const n=this.#Ko.getTargetOrientedPositiveXYZ({x:e.x*this.#hr.x,y:e.y*this.#hr.y,z:e.z*this.#hr.z}),i={x:this.#dr.x*n.x,y:this.#dr.y*n.y};this.#Gr.scale(i),this.#Cr={x:t.x/this.#dr.x,y:t.y/this.#dr.y};const o=this.#Gr.offset();this.#Gr.offset({x:o.x+this.#Cr.x,y:o.y+this.#Cr.y})}setOffset(e){const t=this.#Ko.getPlaneOffsetFromOffset3D(e),n=this.#Gr.offset();this.#Gr.offset({x:n.x-this.#Dr.x+t.x,y:n.y-this.#Dr.y+t.y}),this.#Dr=t}setBaseOffset(e,t){const n=this.#Ko.getNativeScrollDimIndex(),i=this.#Ko.getPlaneOffsetFromOffset3D({x:0===n?e.getX():t.getX(),y:1===n?e.getY():t.getY(),z:2===n?e.getZ():t.getZ()}),o=this.#fr.x!==i.x||this.#fr.y!==i.y;if(o){const e=this.#Gr.offset();this.#Gr.offset({x:e.x-this.#fr.x+i.x,y:e.y-this.#fr.y+i.y}),this.#fr=i}return o}display(e){this.#tr.style.display=e?"":"none"}isVisible(){return""===this.#tr.style.display}draw(){this.#Gr.draw()}initialise(t,n,i){this.#sr=t,this.#lr=n,this.#zr=i,this.#Gr=new e.Stage({container:this.#tr,width:this.#sr.x,height:this.#sr.y,listening:!1}),this.#Gr.getContent().setAttribute("style","");const o=new e.Layer({listening:!1,visible:!0});this.#Gr.add(o)}setAnnotationGroup(e,t,n){if(this.#mt=t,e.addEventListener("annotationadd",(e=>{this.#$r(e.detail.data,!0),this.getKonvaLayer().draw()})),e.addEventListener("annotationupdate",(e=>{this.#jr(e.detail.data),this.getKonvaLayer().draw()})),e.addEventListener("annotationremove",(e=>{this.#Zr(e.detail.data),this.getKonvaLayer().draw()})),e.addEventListener("annotationgroupeditablechange",(e=>{this.activateCurrentPositionShapes(e.detail.data)})),this.#Vr=new il(e),0!==e.getLength())for(const t of e.getList())this.#$r(t,!1),n(new el(t,this.getDrawController()))}activateCurrentPositionShapes(t){const n=this.getKonvaLayer();if(this.#Gr.listening(!1),void 0!==this.#Yr){this.#Yr.disableAndResetEditor();const t=n.getChildren();for(const n of t)n instanceof e.Group&&n.getChildren().forEach((t=>{t instanceof e.Group&&this.#Yr.removeShapeListeners(t)}))}const i=this.getDrawController();if(t&&i.getAnnotationGroup().isEditable()){this.#Gr.listening(!0);const t=this.#_r().getChildren();0!==t.length&&n.listening(!0),void 0!==this.#Yr&&t.forEach((t=>{if(t instanceof e.Group){const e=i.getAnnotation(t.id());this.#Yr.addShapeGroupListeners(t,e,this)}}))}n.draw()}#Kr(e){let t,n;return void 0!==e.planePoints?t=e.planePoints:void 0!==e.planeOrigin&&(t=[e.planeOrigin]),void 0!==t&&(n=this.#Jr(t,e.referencedFrameNumber)),n}#Jr(e,t){let n="";for(const t of e)0!==n.length&&(n+="-"),n+=I([h(t.getX(),2),h(t.getY(),2),h(t.getZ(),2)]);return void 0!==t&&(n+=`-${t}`),n}#ea(t){let n;const i=this.#Kr(t),o=this.getKonvaLayer().getChildren(aa(i));if(0!==o.length){const i=o[0];if(!(i instanceof e.Group))return;const r=i.getChildren(aa(t.trackingUid));0!==r.length&&r[0]instanceof e.Group&&(n=r[0])}return n}#$r(t,n){if(!t.canView()||!t.isCompatibleView(this.#Ko))return;const i=this.#Kr(t);let o=this.getKonvaLayer().getChildren(aa(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 oo,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.#Yr&&this.#Yr.addShapeGroupListeners(l,t,this),this.setLabelVisibility(l)}#Zr(t){const n=this.#ea(t);return n instanceof e.Group?(n.remove(),!0):(r.debug("No shape group to remove"),!1)}#jr(e){this.#Zr(e)&&this.#$r(e,!0)}fitToContainer(e,t,n){const i={x:t*this.#lr.x,y:t*this.#lr.y},o=i.x/this.#dr.x,r=i.y/this.#dr.y,a=e.x/(this.#Gr.width()*o),s=e.y/(this.#Gr.height()*r);this.#Gr.width()===e.x&&this.#Gr.height()===e.y||(this.#Gr.width(e.x),this.#Gr.height(e.y));const l={x:this.#Gr.scale().x*o,y:this.#Gr.scale().y*r};this.#Gr.scale().x===l.x&&this.#Gr.scale().y===l.y||(this.#dr=i,this.#Gr.scale(l),this.#Wr(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.#yr.x?u.x:0,y:0!==this.#yr.y?u.y:0};if(this.#vr.x!==c.x||this.#vr.y!==c.y||this.#yr.x!==d.x||this.#yr.y!==d.y){const e={x:this.#Cr.x*a,y:this.#Cr.y*s};this.#Gr.offset({x:this.#Gr.offset().x+c.x-this.#vr.x+d.x-this.#yr.x+e.x-this.#Cr.x,y:this.#Gr.offset().y+c.y-this.#vr.y+d.y-this.#yr.y+e.y-this.#Cr.y}),this.#yr=d,this.#vr=c,this.#Cr=e}}isAnnotationVisible(e){const t=this.#ta(e);return void 0!==t&&t.isVisible()}setAnnotationVisibility(e,t){const n=this.#ta(e);return void 0!==n&&(void 0===t&&(t=!n.isVisible()),n.visible(t),this.draw(),!0)}setLabelsVisibility(t){this.#Xr=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.#na(i,t)}}#na(t,n){const i=t.getChildren(na)[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.#na(e,this.#Xr)}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.#Gr.listening(!0),this.#tr.style.pointerEvents="auto";const e=fo;for(let t=0;t<e.length;++t)this.#tr.addEventListener(e[t],this.#Ur)}unbindInteraction(){this.#Gr.listening(!1),this.#tr.style.pointerEvents="none";const e=fo;for(let t=0;t<e.length;++t)this.#tr.removeEventListener(e[t],this.#Ur)}setCurrentPosition(e,t){void 0===t&&(t=this.#Ko.worldToIndex(e));const n=this.#Ko.getPlanePoints(e);let i,o;i=this.#Ko.isAquisitionOrientation()?[n[0]]:n,e.length()>3&&(o=e.get(3));const r=this.#Jr(i,o);return this.#ia(r),this.#Rr(new CustomEvent("positionchange",{detail:{value:[t.getValues(),e.getValues()],valid:!0}})),!0}#ia(e){this.#Hr=e;const t=this.getKonvaLayer().getChildren(oa);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()}#_r(){if(void 0===this.#Hr)return;const t=this.getKonvaLayer().getChildren((e=>e.id()===this.#Hr));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.#Hr),n.visible(!0),this.getKonvaLayer().add(n)):r.warn("Unexpected number of draw position groups"),n}#ta(e){return this.getKonvaLayer().findOne(`#${e}`)}addEventListener(e,t){this.#wr.add(e,t)}removeEventListener(e,t){this.#wr.remove(e,t)}#Rr=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#mt});this.#wr.fireEvent(new CustomEvent(e.type,{detail:t}))};#Ur=e=>{e.srclayerid=this.getId(),e.dataid=this.#mt,this.#wr.fireEvent(e)};#Wr(e){const t=2/e.x,n=2/e.y,i=this.#Gr.find("Label");for(let e=0;e<i.length;++e)i[e].scale({x:t,y:n})}}function rl(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 al(e){return`info-${e}`}function sl(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,""),`${al(e.pos)}-${t}-${n}`}class ll{#oa=!1;#tr;constructor(e){this.#tr=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.#tr.id).substring(0,n.length-10)};if(t.groupDivId!==i.groupDivId)return}var n;this.#oa||this.#ra(t),this.#aa(t)}};#ra(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=sl(i),void 0!==i.tags&&e.appendChild(document.createTextNode(i.value)),t.appendChild(e)}const i=document.createElement("div");i.id=al(n),i.className=`info-${n} info`,i.appendChild(t),this.#tr.appendChild(i)}this.#oa=!0}#aa(e){for(const t of e){const e=`#${sl(t)}`,n=this.#tr.querySelector(e),i=t.value;i&&n&&n.replaceChildren(document.createTextNode(i))}}}function cl(e){const t=e.split("-layer-");return 2!==t.length&&r.warn("Not the expected layer div id format..."),{groupDivId:t[0],layerIndex:t[1],layerId:e}}function ul(e){let t=null;const n=e.target.closest(".layer");return n&&void 0!==n.id&&(t=cl(n.id)),t}function dl(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 hl extends EventTarget{#tr;#sa=[];#ur={x:1,y:1,z:1};#ut={x:1,y:1,z:1};#mr={x:0,y:0,z:0};#la=void 0;#ca=!1;#ua=[];#da;#Tr=!1;#ha;#ga;#Sa=[];#pa;getPositionHelper(){if(void 0===this.#ha)for(const e of this.#sa)if(e instanceof Js){const t=e.getViewController().getPositionHelper();void 0===this.#ha?this.#ha=t:this.#ha.merge(t)}return this.#ha}constructor(e,t){if(super(),this.#tr=e,void 0!==t&&!0===t){const t=document.createElement("div");t.id=`${e.id}-infolayer`,t.className="infoLayer",e.appendChild(t),this.#ga=new ll(t)}}getShowCrosshair(){return this.#ca}setShowCrosshair(e){this.#ca=e,e?(this.addEventListener("offsetchange",this.#ma),this.addEventListener("zoomchange",this.#ma),this.#fa()):(this.removeEventListener("offsetchange",this.#ma),this.removeEventListener("zoomchange",this.#ma),this.#va())}setImageSmoothing(e){this.#Tr=e;for(const t of this.#sa)t instanceof Js&&t.setImageSmoothing(e)}#ma=e=>{this.#fa()};getDivId(){let e;return null!==this.#tr&&(e=this.#tr.id),e}getScale(){return this.#ur}getBaseScale(){return this.#ut}getAddedScale(){return{x:this.#ur.x/this.#ut.x,y:this.#ur.y/this.#ut.y,z:this.#ur.z/this.#ut.z}}getOffset(){return this.#mr}getNumberOfLayers(){let e=0;return this.#sa.forEach((t=>{void 0!==t&&e++})),e}includes(e){if(void 0===e)return!1;for(const t of this.#sa)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.#sa)n instanceof Js&&e(n)&&t.push(n);return t}getViewLayersFromActive(e){void 0===e&&(e=function(){return!0});let t=0;void 0!==this.#la&&(t=this.#la);const n=[];for(let e=t;e>=0;e--)n.push(e);for(let e=this.#sa.length-1;e>t;e--)n.push(e);const i=[];for(const t of n){const n=this.#sa[t];n instanceof Js&&e(n)&&i.push(n)}return i}someViewLayer(e){let t=!1;for(const n of this.#sa)if(n instanceof Js&&e(n)){t=!0;break}return t}getDrawLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#sa)n instanceof ol&&e(n)&&t.push(n);return t}getNumberOfViewLayers(){let e=0;return this.#sa.forEach((t=>{void 0!==t&&t instanceof Js&&e++})),e}getActiveLayer(){let e;return void 0!==this.#la&&(e=this.#sa[this.#la]),e}getActiveViewLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof Js&&(e=t),e}getBaseViewLayer(){let e;for(const t of this.#sa)if(t instanceof Js){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.#sa)if(e instanceof Js){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.#sa)t instanceof Js&&e.push(t.getDataId());return e}getActiveDrawLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof ol&&(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.#la=e;const t=this.#sa[e];if(void 0!==this.#ga){this.unbindInfoData();const e=t.getDataId();this.bindInfoData(e)}this.dispatchEvent(new CustomEvent("activelayerchange",{detail:{value:[this.#sa[e]]}}))}setActiveLayerById(e){let t;for(let n=0;n<this.#sa.length;++n)if(void 0!==this.#sa[n]&&this.#sa[n].getId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):r.warn(`No layer to set as active with id: ${e}`)}setActiveLayerByDataId(e){let t;for(let n=0;n<this.#sa.length;++n)if(void 0!==this.#sa[n]&&this.#sa[n].getDataId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):r.warn(`No layer to set as active with dataId: ${e}`)}addViewLayer(){const e=this.#sa.length,t=this.#Ca();this.#tr.append(t);const n=new Js(t);return n.setImageSmoothing(this.#Tr),this.#sa.push(n),this.setActiveLayer(e),this.#Da(n),this.#ha=void 0,n}addDrawLayer(){this.#la=this.#sa.length;const e=this.#Ca();this.#tr.append(e);const t=new ol(e);return this.#sa.push(t),this.#ya(t),t}#Da(e){e.addEventListener("positionchange",this.updateLayersToPositionChange);for(const t of Ys)e.addEventListener(t,this.#Rr);e.addEventListener("renderstart",this.#Rr),e.addEventListener("renderend",this.#Rr)}#Ia(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange);for(const t of Ys)e.removeEventListener(t,this.#Rr);e.removeEventListener("renderstart",this.#Rr),e.removeEventListener("renderend",this.#Rr),e.unbindImage()}#ya(e){e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#Rr)}#wa(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#Rr)}addInfoData(e,t){this.#Sa[t]=e}bindInfoData(e){if(void 0!==this.#pa)return;const t=this.#Sa[e];void 0!==t&&t.addEventListener("valuechange",this.#ga.onDataChange),this.#pa=e}unbindInfoData(){const e=this.#Sa[this.#pa];void 0!==e&&e.removeEventListener("valuechange",this.#ga.onDataChange),this.#pa=void 0}#Ca(){const e=document.createElement("div");return e.id=`${this.getDivId()}-layer-${this.#sa.length}`,e.className="layer",e.style.pointerEvents="none",e}empty(){for(const e of this.#sa)void 0!==e&&this.removeLayer(e);this.#sa=[],this.#va()}removeLayersByDataId(e){for(const t of this.#sa)void 0!==t&&t.getDataId()===e&&this.removeLayer(t)}removeLayer(e){const t=this.#sa.findIndex((t=>t===e));if(-1===t)throw new Error("Cannot find layer to remove");this.#la===t&&(this.#la=void 0),e instanceof Js?this.#Ia(e):this.#wa(e),this.#sa[t]=void 0,this.#ha=void 0,e.removeFromDOM(),this.dispatchEvent(new CustomEvent("layerremove",{detail:{layerid:e.getId(),layergroupid:this.getDivId()}}))}#fa(){let e;this.#va();for(const t of this.#sa)if(t instanceof Js){e=t;break}if(void 0===e)return void r.warn("No layer to show crosshair");if(this.#Ta(e))return void r.warn("Not enabling crosshair for secondary capture");const t=e.getViewController(),n=t.getCurrentPosition(),i=t.getPlanePositionFromPosition(n),o=e.planePosToDisplay(i);if(void 0!==o.getY()){const e=document.createElement("hr");e.id=`${this.getDivId()}-scroll-crosshair-horizontal`,e.className="horizontal",e.style.width=`${this.#tr.offsetWidth}px`,e.style.left="0px",e.style.top=`${o.getY()}px`,this.#ua.push(e),this.#tr.appendChild(e)}if(void 0!==o.getX()){const e=document.createElement("hr");e.id=`${this.getDivId()}-scroll-crosshair-vertical`,e.className="vertical",e.style.width=`${this.#tr.offsetHeight}px`,e.style.left=`${o.getX()}px`,e.style.top="0px",this.#ua.push(e),this.#tr.appendChild(e)}}#va(){for(const e of this.#ua)e.remove();this.#ua=[]}showTooltip(e){this.removeTooltipDiv();const t=this.getBaseViewLayer(),n=t.getViewController(),i=t.displayToPlanePos(e),o=n.getPositionFromPlanePoint(i),r=n.getRescaledImageValue(o);if(void 0!==r){const t=document.createElement("span");t.id="scroll-tooltip",t.style.left=`${e.getX()+10}px`,t.style.top=`${e.getY()+10}px`;let i=h(r,3).toString();void 0!==n.getPixelUnit()&&(i+=` ${n.getPixelUnit()}`),t.appendChild(document.createTextNode(i)),this.#da=t,this.#tr.appendChild(t)}}removeTooltipDiv(){void 0!==this.#da&&(this.#da.remove(),this.#da=void 0)}isPositionInBounds(e){return this.someViewLayer((function(t){return t.getViewController().isPositionInBounds(e)}))}canScroll(){return this.someViewLayer((function(e){return e.getViewController().canScroll()}))}#Ta(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.#Ta(e)}moreThanOne(e){return this.someViewLayer((function(t){return t.getViewController().moreThanOne(e)}))}hasAnyLayerWithValidPosition(){return this.someViewLayer((function(e){return e.isValidPosition()}))}#La=e=>{const t=e.detail?.dataid,n=this.#Sa[t];void 0!==n&&n.onSliceChange(e)};updateLayersToPositionChange=e=>{for(const e of this.#sa)void 0!==e&&(e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#Rr),e.addEventListener("positionchange",this.#La));const t=e.detail?.value,n=new o(t[0]),i=new m(t[1]),r={};let a,s;for(const t of this.#sa){if(void 0===t)continue;let o=!1;if(t instanceof Js){const e=t.getViewController(),n=e.getOrigin(),l=e.getOrigin(i);let c,u;if(void 0===s)a=n,s=l,c=new g(0,0,0),u=new g(0,0,0);else if(e.isPositionInBounds(i)&&void 0!==l){const e=a.minus(n);c=new g(e.getX(),e.getY(),e.getZ());const t=s.minus(l);u=new g(t.getX(),t.getY(),t.getZ())}void 0!==c&&void 0!==u&&(o=t.setBaseOffset(c,u,s,a),r[t.getId()]={scroll:c,plane:u})}if(t instanceof ol){const e=r[t.getReferenceLayerId()];void 0!==e&&(o=t.setBaseOffset(e.scroll,e.plane))}let l=!1;const c=e.detail?.srclayerid;t.getId()!==c&&(l=t.setCurrentPosition(i,n)),!l&&o&&t.draw()}const l=this.hasAnyLayerWithValidPosition();this.dispatchEvent(new CustomEvent("outofrange",{detail:{layergroupid:this.getDivId(),value:[!l]}})),this.#ca&&this.#fa();for(const e of this.#sa)void 0!==e&&(e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#Rr),e.removeEventListener("positionchange",this.#La))};getDivToWorldSizeRatio(){if(0===this.#tr.offsetWidth&&0===this.#tr.offsetHeight)throw new Error(`Cannot fit to zero sized container with id '${this.#tr.id}'.`);const e=this.getMaxWorldSize();if(void 0!==e){if(0===this.#tr.offsetHeight){const t=this.#tr.offsetWidth/e.x,n=e.y*t;this.#tr.style.height=`${n}px`}return Math.min(this.#tr.offsetWidth/e.x,this.#tr.offsetHeight/e.y)}}fitToContainer(e){const t=this.getMaxWorldSize();if(void 0===t)return;const n={x:this.#tr.offsetWidth,y:this.#tr.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.#sa)void 0!==t&&t.fitToContainer(n,e,i);this.#ca&&this.#fa()}getMaxWorldSize(){let e={x:0,y:0};for(const t of this.#sa)if(t instanceof Js){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.#ut.z*=-1,this.setScale(this.#ut)}addScale(e,t){const n={x:this.#ur.x*(1+e),y:this.#ur.y*(1+e),z:this.#ur.z*(1+e)};this.setScale(n,t)}setScale(e,t){this.#ur=e;for(const e of this.#sa)void 0!==e&&e.setScale(this.#ur,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.#mr.x-e.x,y:this.#mr.y-e.y,z:this.#mr.z-e.z})}setOffset(e){this.#mr=e;for(const e of this.#sa)void 0!==e&&e.setOffset(this.#mr);this.dispatchEvent(new CustomEvent("offsetchange",{detail:{value:[this.#mr.x,this.#mr.y,this.#mr.z]}}))}reset(){this.setScale(this.#ut),this.setOffset({x:0,y:0,z:0})}resetZoomPan(){this.setScale(this.#ut),this.setOffset({x:0,y:0,z:0})}resetViews(){let e=!0;for(const t of this.#sa)if(void 0!==t&&t instanceof Js){const n=t.getViewController();e&&(n.resetPosition(),e=!1),n.resetWindowLevel()}}draw(){for(const e of this.#sa)void 0!==e&&e.draw()}display(e){for(const t of this.#sa)void 0!==t&&t.display(e)}#Rr=e=>{const t=null!==e.detail&&"object"==typeof e.detail?Object.assign({},e.detail):{};this.dispatchEvent(new CustomEvent(e.type,{detail:t}))}}class gl{#Pa=0;add(e){this.#Pa+=function(e){return void 0===e.wheelDeltaY?-e.deltaY:e.wheelDeltaY>45?1:e.wheelDeltaY<-45?-1:-e.deltaY/60}(e)}getSum(){return this.#Pa}isTick(){return Math.abs(this.#Pa)>=1}clear(){this.#Pa=0}}class Sl extends EventTarget{#Aa;#Oa;#ba;#xa;#Ea=new gl;#Ra;#Fa;#Ma;#qa;#Ua;#Qa=!1;#Va=!1;constructor({stageController:e,dragBehavior:t,hoverBehavior:n,wheelBehavior:i,doubleClickBehavior:o,twoTouchBehavior:r,tapBehavior:a,longTouchToDblClickMs:s=500}){super(),this.#Aa=e,this.#Oa=t,this.#ba=n,this.#xa=i,this.#Ra=o,this.#Fa=r,this.#Ma=a,this.#qa=s}#Na(e){return this.#Aa.getLayerGroupByDivId(e)}#Ba(e){const t=ul(e),n=this.#Na(t.groupDivId);return{point:Do(e),layerGroup:n}}#ka(e){const t=ul(e),n=this.#Na(t.groupDivId);return{point:Co(e)[0],layerGroup:n}}getEventNames(){return[]}wheel=e=>{if(void 0===this.#xa)return;e.preventDefault();const t=ul(e),n=this.#Na(t.groupDivId);this.#xa.onWheel(e,n),this.#Ea.add(e);const i=this.#Ea.getSum()>=0;this.#Ea.isTick()&&(this.#Ea.clear(),this.#xa.onWheelTick(i,n))};dblclick=e=>{const{point:t,layerGroup:n}=this.#Ba(e);void 0!==this.#Ra?this.#Ra.onDoubleClick(t,n):this.#Ma?.isActive()&&this.#Ma.onEnd()};#Ga(e,t){void 0!==this.#Ra?this.#Ra.onDoubleClick(e,t):this.#Ma?.isActive()&&(this.#Ma.onTap(e,t),this.#Ma.onEnd()),this.#Qa=!1,this.#Ua=void 0}cancel(){this.#Qa=!1,this.#Va=!1,this.#za(),this.#Oa?.isActive()&&this.#Oa.reset(),this.#Ma?.isActive()&&this.#Ma.reset(),this.#Fa?.isActive()&&this.#Fa?.reset(),this.#ba?.reset()}mousedown=e=>{this.#Oa?.isActive()&&this.#Oa.reset(),this.#Va=!1,this.#Qa=!0;const{point:t,layerGroup:n}=this.#Ba(e);!this.#Ma?.isActive()&&this.#Oa?.canStart(t,n)&&this.#Oa.onStart(t,n,{mouseDownButton:e.button})};mousemove=e=>{this.#Va=!0;const{point:t,layerGroup:n}=this.#Ba(e);this.#Qa?(this.#ba?.onEnd(),this.#Oa?.isActive()&&this.#Oa.onUpdate(t,n)):(this.#Ma?.isActive()&&this.#Ma.onUpdate(t,n),this.#ba?.onUpdate(t,n))};mouseup=e=>{if(this.#Oa?.isActive()&&(this.#Va?this.#Oa.onEnd():this.#Oa.reset()),this.#Ma&&(this.#Ma.isActive()||this.#Qa&&!this.#Va)){const{point:t,layerGroup:n}=this.#Ba(e);this.#Ma.onTap(t,n)}this.#Qa=!1};mouseout=e=>{this.#Oa?.isActive()&&this.#Oa.onEnd(),this.#Ma?.isActive()&&this.#Ma.onEnd(),this.#ba?.onEnd(),this.#Qa=!1,this.#Va=!1};touchstart=e=>{this.#Oa?.isActive()&&this.#Oa.reset(),this.#Va=!1,this.#za(),this.#Qa=!0;const t=Co(e);if(1===t.length){const{point:t,layerGroup:n}=this.#ka(e);this.#Oa?.canStart(t,n)&&this.#Oa.onStart(t,n,{});const i=this.#qa;null!=i&&i>0&&(e.preventDefault(),this.#Ua=setTimeout((()=>{this.#Ga(t,n)}),i))}else 2===t.length&&this.#Fa?.onStart(t)};touchmove=e=>{this.#za(),this.#Va=!0;const{point:t,layerGroup:n}=this.#ka(e),i=Co(e);1===i.length?this.#Oa?.isActive()&&this.#Oa.onUpdate(t,n):2===i.length&&(this.#Oa?.isActive()&&this.#Oa.reset(),this.#Fa?.isActive()&&this.#Fa.onUpdate(i,n))};touchend=e=>{if(this.#za(),this.#Fa?.isActive())this.#Fa.onEnd();else{if(this.#Oa?.isActive()&&(this.#Va?this.#Oa.onEnd():this.#Oa.reset()),this.#Ma&&(this.#Ma.isActive()||this.#Qa&&!this.#Va)){const{point:t,layerGroup:n}=this.#ka(e);this.#Ma.onTap(t,n)}this.#Qa=!1}};#za(){void 0!==this.#Ua&&(clearTimeout(this.#Ua),this.#Ua=void 0)}}function pl(e){return{x:"number"==typeof e?.x?e.x:0,y:"number"==typeof e?.y?e.y:0}}class ml{#Ha;#Ya;constructor(e,t,{threshold:n}={}){this.#Ha={x:t.getX()-e.getX(),y:t.getY()-e.getY()},this.#Ya=pl(n)}get delta(){return this.#Ha}passesThresholdX(){const e=this.#Ya.x;return e<=0||Math.abs(this.#Ha.x)>=e}passesThresholdY(){const e=this.#Ya.y;return e<=0||Math.abs(this.#Ha.y)>=e}passesThreshold(){return this.passesThresholdX()||this.passesThresholdY()}}class fl extends EventTarget{#Xa;#Wa;#$a;constructor({threshold:e}={}){super(),this.setDragThreshold(e)}get startPoint(){return this.#Xa}get prevPoint(){return this.#Wa}setDragThreshold(e){this.#$a=pl(e)}isActive(){return void 0!==this.#Wa}canStart(e,t){return!0}reset(){this.#Xa=void 0,this.#Wa=void 0}onStart(e,t,n){this.#Xa=e,this.#Wa=e}onUpdate(e,t){const n=new ml(this.#Wa,e,{threshold:this.#$a});n.passesThreshold()&&(this.#Wa=e,this.onDrag(n,t))}onDrag(e,t){}onEnd(){this.#Wa=void 0,this.reset()}}class vl extends fl{#ja;constructor({activeViewLayerOnly:e=!0}={}){super(),this.#ja=e}setActiveViewLayerOnly(e){this.#ja=e}canStart(e,t){const n=qs(t,this.#ja);return void 0!==n&&!!n.getViewController().isMonochrome()}onDrag(e,t){const n=qs(t,this.#ja);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 je(l+r*s,c+o*s);i.setWindowLevel(u)}}class Cl extends fl{constructor(){super({threshold:{x:15,y:15}})}canStart(e,t){return void 0!==Us(t)||(r.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 Dl extends fl{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 yl extends fl{onDrag(e,t){const n=Us(t);if(void 0===n)return void r.warn("No view layer to update pan drag behavior");const i=n.getViewController(),o=n.displayToPlaneScale(new S(e.delta.x,e.delta.y)),a=i.getOffset3DFromPlaneOffset({x:o.getX(),y:o.getY()});t.addTranslation({x:a.getX(),y:a.getY(),z:a.getZ()}),t.draw()}}class Il{onDoubleClick(e,t){}}class wl extends Il{#Za;#ja;constructor({dataController:e,activeViewLayerOnly:t=!0}){super(),this.#Za=e,this.#ja=t}setActiveViewLayerOnly(e){this.#ja=e}onDoubleClick(e,t){const n=qs(t,this.#ja);if(void 0===n)return;const i=n.displayToPlaneIndex(e),o=n.getViewController();if(!o.isMonochrome())return;const r=this.#Za.get(n.getDataId()).image,a=new je(r.getRescaledValueAtIndex(o.getCurrentIndex().getWithNew2D(i.get(0),i.get(1))),o.getWindowLevel().width);o.setWindowLevel(a)}}class Tl extends Il{onDoubleClick(e,t){const n=Us(t);void 0!==n?n.getViewController().play():r.warn("No view layer to play double click behavior")}}class Ll{reset(){}onUpdate(e,t){}onEnd(){this.reset()}}class Pl extends Ll{#_a=!1;#Ka;constructor({tooltipEnabled:e=!1}={}){super(),this.#_a=e}setTooltipEnabled(e){this.#_a=e}reset(){void 0!==this.#Ka&&(this.#Ka.removeTooltipDiv(),this.#Ka=void 0)}onUpdate(e,t){this.#_a&&this.#Ja(e,t)}#Ja(e,t){this.#Ka=t,t.showTooltip(e)}}class Al extends EventTarget{#on=[];#es=1;setNumberOfTaps(e){this.#on=[],this.#es=e}isActive(){return 0!==this.#on.length}reset(){this.#on=[]}getPointList(){return this.#on.slice()}onUpdate(e,t){}onTap(e,t){this.#on.push(e),this.#on.length===this.#es&&this.onEnd()}onEnd(){this.#on=[],this.reset()}}class Ol extends Al{onTap(e,t){super.onTap(e,t);const n=Us(t);if(void 0===n)return void r.warn("No view layer to set current position");const i=n.getViewController(),o=n.displayToPlanePos(e),a=i.getPositionFromPlanePoint(o);i.setCurrentPosition(a)}}class bl{isActive(){return!1}reset(){}onStart(e){}onUpdate(e,t){return!1}onEnd(){this.reset()}}class xl extends bl{#ts;#ns;isActive(){return void 0!==this.#ts}reset(){this.#ts=void 0,this.#ns=void 0}onStart(e){this.#ts=new Ko(e[0],e[1]),this.#ns=this.#ts.getCentroid()}onUpdate(e,t){if(void 0===this.#ts)return!1;const n=new Ko(e[0],e[1]).getLength()/this.#ts.getLength(),i=t.getPositionHelper();if(1===n){const n=e[0].getY()-this.#ts.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.#ns){const n=Us(t);if(void 0===n)return r.warn("No view layer to do touch zoom behavior"),!0;const i=n.getViewController(),o=n.displayToMainPlanePos(this.#ns),a=i.getPlanePositionFromPlanePoint(o);t.addScale(e,a),t.draw()}}return!0}onEnd(){this.#ts=void 0,this.reset()}}function El(e,t){const n=t.getActiveDrawLayer();if(void 0===n)return r.warn("No draw layer to check point"),!1;const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return r.warn("No view layer to check point"),!1;const o=i.displayToPlanePos(e);return i.getViewController().validatePlanePoint(o)}class Rl{#yn;#is;#os;#rs;#as;#ss;#ls;#cs;#us;#ds=!1;constructor(e){this.#yn=e,this.#is=e.getStyle()}setOptions(e){this.#os=e}setFeatures(e){if(void 0!==e.autoShapeColour&&(this.#ds=e.autoShapeColour),void 0!==e.shapeColour&&(this.#is.setLineColour(e.shapeColour),this.#ds=!1),void 0!==e.refMetaValidator&&(this.#ls=e.refMetaValidator),void 0!==e.annotationGroupMeta&&(this.#cs=e.annotationGroupMeta),void 0!==e.annotationMeta&&(this.#us=e.annotationMeta),void 0!==e.shapeName){if(!this.hasShape(e.shapeName))throw new Error(`Unknown shape: '${e.shapeName}'`);this.#rs=e.shapeName,void 0!==this.#os&&(this.#as=new this.#os[this.#rs])}}hasShape(e){return void 0!==this.#os?.[e]}tryBeginPlacement(e){let t=e.getActiveDrawLayer();return void 0===t&&this.#hs(e)&&this.#gs(e)&&(t=this.#Ss(e)),!(void 0===t||!this.#ps())}#ps(){return!(!this.#os||!this.#rs)||(r.warn("DrawPreview: missing factory list or shape name"),!1)}getNPoints(){let e=0;return void 0!==this.#as&&(e=this.#as.getNPoints()),e}resetPlacement(){if(this.#ss){const e=this.#ss.getLayer();this.#ss.destroy(),this.#ss=void 0,e.draw()}}#hs(e){let t=!0;const n=this.#ls;if(void 0!==n){const i=e.getActiveViewLayer().getDataId();t=n(this.#yn.getDataController().get(i).image.getMeta())}return t}#gs(e){const t=e.getBaseViewLayer().getDataId();return!this.#yn.getDataController().get(t).image.isResampled()}getCannotCreateReason(e){let t;return this.#hs(e)||(t="reference data is invalid"),this.#gs(e)||(t="base data is invalid"),t}#Ss(e){const t=e.getActiveViewLayer().getDataId(),n=this.#yn.createAnnotationData(t),i=this.#cs;if(void 0!==i)for(const e of i)n.annotationGroup.setMetaValue(e.concept,e.value);this.#yn.addAndRenderAnnotationData(n,e.getDivId(),t);const o=e.getActiveDrawLayer();e.setActiveLayerByDataId(o.getDataId());const r=o.getKonvaStage();return this.#is.setZoomScale(r.scale()),o}#ms(e){if(this.#ds){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.#is.setLineColour(o)}}#fs(e,t){const n=t.getActiveDrawLayer(),i=n.getDrawController(),o=t.getViewLayerById(n.getReferenceLayerId());if(void 0===o)return void r.warn("No view layer to handle new points");const a=o.getViewController(),s=new Qa,l=i.getAnnotationGroup().getColour();s.colour=void 0!==l?l:this.#is.getLineColour(),s.init(a);const c=this.#us;if(void 0!==c)for(const e of c)s.addMetaItem(e.concept,e.value);const u=e.map((e=>o.displayToPlanePos(e)));return this.#as.setAnnotationMathShape(s,u),s}onNewPoints(e,t){this.#ss&&(this.#ss.destroy(),this.#ss=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void r.warn("No draw layer to handle new points");const i=n.getKonvaLayer();this.#ms(n);const o=this.#fs(e,t);void 0!==o&&(this.#ss=this.#as.createShapeGroup(o,this.#is),n.setLabelVisibility(this.#ss),this.#ss.getChildren(ia)[0].listening(!1),i.listening(!1),i.add(this.#ss),i.draw())}onFinalPoints(e,t){this.#ss&&(this.#ss.destroy(),this.#ss=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void r.warn("No draw layer to handle final points");const i=n.getKonvaLayer(),o=n.getDrawController(),a=this.#fs(e,t);if(void 0===a)return;const s=new el(a,o);this.#yn.getUndoController().addToUndoStack(s),s.execute(),i.listening(!0)}}class Fl extends Al{#vs;#Cs;#Ds;#ys;constructor(e,t){super(),this.#Ds=new Rl(e),this.#ys=t}setOptions(e){this.#Ds.setOptions(e)}setFeatures(e){this.#Ds.setFeatures(e),this.#ys.setFeatures(e)}hasShape(e){return this.#Ds.hasShape(e)}#Is(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ys.checkCanEdit(n)?this.#ys.trySelectShapeGroup(e,n):(this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:"Cannot edit draw, data meta is invalid"}})),!1))}#ws(){const e=this.#Ds.getNPoints();void 0===e?super.setNumberOfTaps(65535):super.setNumberOfTaps(e)}resetPlacement(){this.#Ds.resetPlacement(),super.onEnd()}#Ts(e){const t=this.getPointList();return t.length>0&&t[t.length-1].equals(e)}onUpdate(e,t){if(!this.isActive())return;if(this.#Ts(e))return;if(!El(e,t))return;this.#vs=e,this.#Cs=t;const n=this.getPointList();n.push(e),this.#Ds.onNewPoints(n,t)}onTap(e,t){if(!this.isActive()){if(this.#Is(e,t))return;if(!this.#Ds.tryBeginPlacement(t)){const e=this.#Ds.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#ys.disableAndResetEditor(),this.#ws()}if(this.#Ts(e))return;this.#Cs=t,super.onTap(e,t);const n=this.getPointList();n.length>1&&this.#Ds.onNewPoints(n,t)}onEnd(){const e=this.getPointList(),t=this.#Cs,n=this.#Ds.getNPoints();e.length>0&&t&&(void 0!==n?e.length===n?this.#Ds.onFinalPoints(e,t):e.length!==n-1||void 0===this.#vs||this.#Ts(this.#vs)?this.#Ds.resetPlacement():(e.push(this.#vs),this.#Ds.onFinalPoints(e,t)):e.length>2?this.#Ds.onFinalPoints(e,t):this.#Ds.resetPlacement()),this.#vs=void 0,this.#Cs=void 0,super.onEnd()}}class Ml extends fl{#ys;#vs;#Cs;#Ds;constructor(e,t){super(),this.#ys=t,this.#Ds=new Rl(e)}setOptions(e){this.#Ds.setOptions(e)}setFeatures(e){this.#Ds.setFeatures(e)}resetPlacement(){this.#Ds.resetPlacement(),super.onEnd()}#Ls(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.#Ds.getNPoints()}onStart(e,t,n){if(!this.isActive()){const n=t.getActiveDrawLayer();if(void 0!==n&&this.#Ls(e,n))return;if(!this.#Ds.tryBeginPlacement(t)){const e=this.#Ds.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#ys.disableAndResetEditor()}this.#Cs=t,super.onStart(e,t,n)}onDrag(e,t){if(!this.isActive())return;if(!El(this.prevPoint,t))return;this.#vs=this.prevPoint,this.#Cs=t;const n=[this.startPoint,this.#vs];this.#Ds.onNewPoints(n,t)}onEnd(){const e=this.#Cs;if(e&&void 0!==this.#vs){const t=[this.startPoint,this.#vs];this.#Ds.onFinalPoints(t,e)}this.#vs=void 0,this.#Cs=void 0,super.onEnd()}}class ql{#yn;#Yr;#Tt=[];#Ps;#As;constructor(e,t){this.#yn=e,this.#Yr=t}setFeatures(e){void 0!==e.drawMetaValidator&&(this.#As=e.drawMetaValidator)}disableAndResetEditor(){this.#Yr.disableAndResetEditor()}checkCanEdit(e){return this.#Os(e)}#Os(e){let t=!0;const n=this.#As;if(void 0!==n){const i=e.getDataId();t=n(this.#yn.getDataController().get(i).annotationGroup.getMeta())}return t}#Ls(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}#bs(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.#Yr.setEditorShape(o,n),!0)}trySelectShapeGroup(e,t){const n=this.#Ls(e,t);return void 0!==n&&this.#bs(n,t)}#xs(e){const t=e.getId();return void 0===this.#Tt[t]&&(this.#Tt[t]=()=>{e.activateCurrentPositionShapes(!0)}),this.#Tt[t]}#Es(){return e=>{const t=e.detail?.layerid,n=this.#yn.getStageController().getDrawLayers((function(e){return e.getId()===t}));1===n.length&&this.#Rs(n[0],!0)}}#Fs(){void 0===this.#Ps&&(this.#Ps=this.#Es(),this.#yn.addEventListener("drawlayeradd",this.#Ps))}#Ms(){void 0!==this.#Ps&&(this.#yn.removeEventListener("drawlayeradd",this.#Ps),this.#Ps=void 0)}#Rs(e,t){e.setShapeHandler(this.#Yr),e.activateCurrentPositionShapes(t),t?this.#yn.addEventListener("positionchange",this.#xs(e)):this.#yn.removeEventListener("positionchange",this.#xs(e))}activate(e){e||this.#Yr.onMouseOutShapeGroup();const t=this.#yn.getStageController().getDrawLayers();for(const n of t)void 0!==n&&this.#Rs(n,e);e?this.#Fs():this.#Ms()}}class Ul{#yn;#qs;constructor(e,t){this.#yn=e,this.#qs=t}#as;#Us;#Qs;#Qr;#Vs=!1;setShape(e,t,n){if(this.#Us=e,this.#Qs=t,this.#Qr=n,void 0!==this.#Us){if(this.#Ns(),this.#as=n.getFactory(),void 0===this.#as)throw new Error("Could not find a factory to update shape.");this.#Bs()}}getShape(){return this.#Us}getAnnotation(){return this.#Qr}isActive(){return this.#Vs}enable(){this.#Vs=!0,void 0!==this.#Us&&(this.#ks(!0),this.#Us.getLayer()&&this.#Us.getLayer().draw())}disable(){this.#Vs=!1,void 0!==this.#Us&&(this.#ks(!1),this.#Us.getLayer()&&this.#Us.getLayer().draw())}reset(){this.#Us=void 0,this.#Qs=void 0,this.#Qr=void 0}resetAnchors(){this.#Ns(),this.#Bs(),this.#ks(!0)}#Gs(e){void 0!==this.#Us&&this.#Us.getParent()&&this.#Us.getParent().find(".anchor").forEach(e)}#ks(e){this.#Gs((function(t){t.visible(e)}))}setAnchorsActive(e){let t;t=e?e=>{this.#zs(e)}:e=>{this.#Hs(e)},this.#Gs(t)}#Ns(){this.#Gs((function(e){e.remove()}))}#Bs(){if(void 0===this.#Us||!this.#Us.getLayer())return;if(void 0===this.#as)return;const e=this.#Us.getParent(),t=this.#as.getAnchors(this.#Qr,this.#yn.getStyle());for(let n=0;n<t.length;++n)this.#zs(t[n]),e.add(t[n])}#zs(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.#as&&(function(e,t){const n=t.getParent();!function(e,t,n){let i=!1;e.x()<t.getX()?(e.x(t.getX()),i=!0):e.x()>n.getX()&&(e.x(n.getX()),i=!0),e.y()<t.getY()?(e.y(t.getY()),i=!0):e.y()>n.getY()&&(e.y(n.getY()),i=!0)}(t,new S(-n.x(),-n.y()),new S(e.x-n.x(),e.y-n.y()))}(this.#Qs.getBaseSize(),n),void 0!==this.#as.constrainAnchorMove&&this.#as.constrainAnchorMove(n,this.#Qr),this.#as.updateAnnotationOnAnchorMove(this.#Qr,n),this.#as.updateShapeGroupOnAnchorMove(this.#Qr,n,this.#yn.getStyle()),n.getLayer()?n.getLayer().draw():r.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.#as?.onAnchorMoveEnd(i,this.#Qr);const o={mathShape:this.#Qr.mathShape,referencePoints:this.#Qr.referencePoints},r=new nl(this.#Qr,n,o,this.#Qs.getDrawController());this.#yn.getUndoController().addToUndoStack(r),this.#qs({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():r.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():r.warn("No layer to draw the anchor!"))}))}#Hs(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 Ql{#Ys;constructor(){this.createTrashIcon()}createTrashIcon(){this.#Ys=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.#Ys.width(20),this.#Ys.height(20),this.#Ys.add(t),this.#Ys.add(n)}activate(e){const t=e.getKonvaStage(),n=t.scale(),i=e.getKonvaLayer(),o={x:1/n.x,y:1/n.y};this.#Ys.x(t.offset().x+t.width()/(2*n.x)),this.#Ys.y(t.offset().y+t.height()/(15*n.y)),this.#Ys.scale(o),i.add(this.#Ys),i.draw()}changeChildrenColourOnTrashHover(e,t,n){if(this.isOverTrash(e))return this.changeGroupChildrenColour(this.#Ys,"orange"),void this.changeGroupChildrenColour(t,"red");this.changeGroupChildrenColour(this.#Ys,"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.#Ys.remove()}isOverTrash(e){const t=this.#Ys.width()*Math.abs(this.#Ys.scaleX())/2,n=this.#Ys.height()*Math.abs(this.#Ys.scaleY())/2;return Math.abs(e.x-this.#Ys.x())<t&&Math.abs(e.y-this.#Ys.y())<n}}class Vl extends EventTarget{#yn;#Xs;#Ys;#Ws="pointer";#$s;#js;#qs=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))};constructor(e){super(),this.#yn=e,this.#Xs=new Ul(e,this.#qs),this.#Ys=new Ql}setEditorShape(t,n){const i=n.getDrawController();if(t&&t instanceof e.Shape&&t!==this.#Xs.getShape()&&i.isAnnotationGroupEditable()){this.#Xs.disable();const e=t.getParent().id();this.#Xs.setShape(t,n,i.getAnnotation(e)),this.#qs({type:"annotationselect",annotationid:e,dataid:n.getDataId()}),this.#Xs.enable()}}getEditorShapeGroup(){let t;if(!this.#Xs.isActive()||(t=this.#Xs.getShape().getParent(),t instanceof e.Group))return t}getEditorAnnotation(){let e;return this.#Xs.isActive()&&(e=this.#Xs.getAnnotation()),e}disableAndResetEditor(){this.#Xs.disable(),this.#Xs.reset()}#Zs(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.#Ws=e}#_s(){this.#$s=document.body.style.cursor,document.body.style.cursor=this.#Ws,this.#js.opacity(.75)}onMouseOutShapeGroup(){void 0!==this.#$s&&(document.body.style.cursor=this.#$s,this.#$s=void 0),void 0!==this.#js&&this.#js.opacity(1)}#Ks(e){e.on("mouseover",(()=>{this.#js=e,this.#_s()})),e.on("mouseout",(()=>{this.onMouseOutShapeGroup(),this.#js=void 0}))}#Js(e){e.off("mouseover"),e.off("mouseout")}addShapeGroupListeners(e,t,n){this.#Ks(e),this.#el(e,t,n),this.#tl(e,t,n),e.on("dblclick",(()=>{const e=t.textExpr,i=t=>{const i=t.textExpr,o=new nl(t,{textExpr:e},{textExpr:i},n.getDrawController());this.#yn.getUndoController().addToUndoStack(o),o.execute()};void 0!==ot.openRoiDialog?ot.openRoiDialog(t,i):function(e,t){const n=prompt("Label",e.textExpr);null!==n&&(e.textExpr=n,t(e))}(t,i)}))}#el(t,n,i){const o=i.getKonvaLayer(),r=t.getChildren(ia)[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.#Ys.activate(i),this.#Xs.setAnchorsActive(!1),o.draw()})),r.on("dragmove.draw",(e=>{const a=function(e,t){return{min:new S(0,0),max:new S(e.x-Math.abs(t.width()),e.y-Math.abs(t.height()))}}(i.getBaseSize(),r);if(a&&!function(e,t,n){const i=e.getClientRect({relativeTo:e.getParent()});return i.x>t.getX()&&i.x<n.getX()&&i.y>t.getY()&&i.y<n.getY()}(r,a.min,a.max))return r.x(s.x),void r.y(s.y);const l={x:e.target.x()-s.x,y:e.target.y()-s.y},u=t.getChildren(),d=void 0===n.labelPosition;for(const t of u)t===e.target||"label"===t.name()&&!d||"connector"===t.name()||t.move(l);s={x:e.target.x(),y:e.target.y()};const h=n.getFactory();if(void 0===h)throw new Error("Cannot follow drag move without factory");h.updateAnnotationOnTranslation(n,l),h.updateLabelContent(n,t,this.#yn.getStyle()),h.updateConnector(n,t);const g=Do(e.evt),p={x:g.getX(),y:g.getY()},m=this.#Zs(p,i);this.#Ys.changeChildrenColourOnTrashHover(m,t,c),o.draw()})),r.on("dragend.draw",(e=>{const s=this.#yn.getUndoController();if(this.#Ys.remove(),void 0===e||void 0===e.evt)return;const u=r.x(),d=r.y(),h=Do(e.evt),g={x:h.getX(),y:h.getY()},S=this.#Zs(g,i);if(this.#Ys.isOverTrash(S)){t.x(a.x),t.y(a.y),this.#Xs.disable(),this.#Xs.reset(),this.#Ys.changeGroupChildrenColour(t,c),n.mathShape=l.mathShape,n.referencePoints=l.referencePoints;const e=new tl(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 nl(n,l,e,i.getDrawController());s.addToUndoStack(t),this.#qs({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:Object.keys(e)}),l={mathShape:e.mathShape,referencePoints:e.referencePoints}}this.#Xs.setAnchorsActive(!0),this.#Xs.resetAnchors()}o.draw(),a={x:r.x(),y:r.y()}}))}#tl(t,n,i){const o=t.getChildren(na)[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.#yn.getUndoController(),t=o.x()-r.x,s=o.y()-r.y;if(0!==t||0!==s){const t=new S(o.x(),o.y());n.labelPosition=t;const r=new nl(n,{labelPosition:a},{labelPosition:t},i.getDrawController());e.addToUndoStack(r),this.#qs({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:["labelPosition"]}),a=t}r={x:o.x(),y:o.y()}}))}removeShapeListeners(t){this.#Js(t),t.off("dblclick");const n=t.getChildren(ia)[0];n instanceof e.Shape&&(n.draggable(!1),n.off("dragstart.draw"),n.off("dragmove.draw"),n.off("dragend.draw"));const i=t.getChildren(na)[0];i instanceof e.Label&&(i.draggable(!1),i.off("dragstart.draw"),i.off("dragend.draw"))}}class Nl{mask;dataId;offsetsLists;mode;segmentNumber;srclayerid;originalValuesLists;isSilent}class Bl extends Oa{#nl;#mt;#il;#ol;#rl;#al;#sl;#ll;#cl;#ul;constructor(e){super(),this.#nl=e.mask,this.#mt=e.dataId,this.#il=e.offsetsLists,this.#ol=e.mode,this.#rl=e.segmentNumber,this.#al=e.srclayerid,void 0!==e.originalValuesLists&&(this.#sl=e.originalValuesLists),this.#ll=e.isSilent??!1,this.#cl="del"===this.#ol?"brushremove":"brushdraw",this.#ul="brushdraw"===this.#cl?"brushremove":"brushdraw"}getOriginalValuesLists(){return this.#sl}getExecuteEvent(){const e="brushdraw"===this.#cl?this.#rl:void 0;return new CustomEvent(this.#cl,{detail:{segmentnumber:e,dataid:this.#mt,srclayerid:this.#al}})}getName(){return"Draw-brush"}execute(){if(void 0===this.#rl)return;let e=this.#rl;"brushremove"===this.#cl&&(e=0),void 0===this.#sl?this.#sl=this.#nl.setAtOffsetsAndGetOriginals(this.#il,e):this.#nl.setAtOffsetsWithIterator(this.#il,e),this.#ll||this.onExecute(this.getExecuteEvent())}undo(){void 0===this.#sl?this.#sl=this.#nl.setAtOffsetsAndGetOriginals(this.#il,0):this.#nl.setAtOffsetsWithIterator(this.#il,this.#sl);const e="brushdraw"===this.#ul?this.#rl:void 0,t=new CustomEvent(this.#ul,{detail:{segmentnumber:e,dataid:this.#mt,srclayerid:this.#al}});this.onUndo(t)}onExecute(e){}onUndo(e){}}const kl="No source image to create mask",Gl="No source image to get offsets, ID: {0}",zl="No brush origins",Hl="No mask defined when adding mask slices",Yl="No created mask image",Xl="No mask image for temporary draw command, ID: {0}",Wl="No mask image to get offsets from",$l="No mask image for draw command, ID: {0}",jl="No mask ID to apply mask index",Zl="No mask view layers",_l="No selected segment number",Kl="Too many mask view layers: {0}",Jl="More mask layers than expected",ec="Cannot display mask with no mask ID",tc="Cannot draw with no mask data ID",nc="Cannot draw with no offsets",ic="Cannot draw with no colour list",oc="Cannot get mask layers with no mask ID",rc="Cannot get mask view controller: no mask ID",ac="Cannot get mask view controller: no mask layers",sc="Cannot find source data for an existing mask, ID: {0}",lc="Unsupported scroll index: {0}";function cc(e,...t){return e.replace(/{(\d+)}/g,((e,n)=>t[n]||""))}const uc="del";function dc(e,t,n,i){return lr(e.worldToIndex(t),n,i)}class hc extends EventTarget{#yn;#dl=10;#hl={min:1,max:20};#gl="del";#Sl;#nl;#pl;#Ka;#ml=0;#fl;#vl;constructor(e){super(),this.#yn=e.app}#Cl(e){const t=this.#hl.min,n=this.#hl.max;return Math.min(Math.max(e,t),n-1)}getBrushSize(){return this.#dl}getBrushMode(){return this.#gl}getSelectedSegmentNumber(){return this.#Sl}setBrushMode(e){this.setFeatures({brushMode:e})}setFeatures(e){if(void 0!==e.brushSizeRange&&(this.#hl=e.brushSizeRange,this.#dl=this.#Cl(this.#dl)),void 0!==e.brushSize&&(this.#dl=this.#Cl(e.brushSize)),void 0!==e.brushSizeAdd){const t=this.#Cl(this.#dl+e.brushSizeAdd);if(t!==this.#dl){this.#dl=t;const e=new CustomEvent("brushsizechange",{detail:{value:this.#dl}});this.dispatchEvent(e)}}void 0!==e.brushMode&&(this.#gl=e.brushMode),void 0!==e.selectedSegmentNumber&&(this.#Sl=e.selectedSegmentNumber),e.createMask?this.#pl=void 0:void 0!==e.maskDataId&&(this.#pl=e.maskDataId)}#Dl(e,t,n){const i=e.getSize().getValues();i[2]=1;const o=new Re(i),r=new Ge([t],o,e.getSpacing(),e.getOrientation()),a=new Uint8Array(o.getDimSize(2));a.fill(0),++this.#ml;const s=[this.#ml.toString()],l=new to(r,a,s);return l.setMeta(n),l.setPhotometricInterpretation("PALETTE COLOR"),l.setPaletteColourMap(new nt([0],[0],[0])),l}#yl(e,t,n,i,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 i=n[0].get(2);if(void 0===i)return[];const a=new o([0,0,i]),s=e.indexToWorld(a),l=n.at(-1).get(2);if(void 0===l)return[];const c=new o([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&&r.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&&r.warn(`Large distance between origin and origin for last index: ${v}`),[g,m]}(e,dc(e,n,a,i));if(void 0===l||0===l.length)throw new Error(zl);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.#nl)throw new Error(Hl);const p=this.#nl.getMeta();for(const e of S)p.numberOfFiles+=1,this.#nl.appendSlice(this.#Dl(t,e,s))}#Il(e,t){if(!t)throw new Error(cc(kl));const n=t.getGeometry(),i=n.worldToIndex(e).get(2);if(void 0===i)throw new Error("Z position is undefined");const r=new o([0,0,i]),a=n.getOrigins()[i],s=ki(),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.#nl=this.#Dl(n,a,s),this.#nl.setupSegmentCollection();const h=Sn(s),g=new ss(h);g.image=this.#nl;const S=this.#yn.getDataController(),p=S.getNextDataId();if(!S.add(p,g))throw new Error("Cannot add mask data");return p}#wl(e){const t=this.#yn.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}#Tl(e){if(void 0===this.#pl)throw new Error(ec);const t=new Oc(e);t.orientation=this.#wl(e);const n=this.#yn.getStageController();n.addDataViewConfig(this.#pl,t),n.render(this.#pl)}#Ll(e){const t=e.getMaskReferencedSeriesUID();let n;return"undefined"!==t&&(n=this.#yn.getDataController().getDataIdFromSeriesUid(t)),void 0===n&&r.warn(cc(sc,t)),n}#Pl(e){if(void 0===this.#pl)throw new Error(oc);const t=e.getViewLayersByDataId(this.#pl);if(0===t.length)throw new Error(Zl);return 1!==t.length&&r.warn(cc(Kl,t.length)),t[0]}#Al(e){if(void 0===e)throw new Error(jl);const t=this.#yn.getDataController().get(e);if(void 0===t)throw new Error(Wl);return t.image}#Ol(e,t){if(void 0===t)throw new Error("No layergroup to get mask offsets");let n;if(this.#Ka=t,n=void 0===this.#pl?t.getBaseViewLayer():t.getViewLayersByDataId(this.#pl)[0],void 0===n)return[];const i=n.getViewController(),o=i.getCurrentPosition();let a,s,l,c;if(i.equalImageMeta({Modality:"SEG"})||i.equalImageMeta({Modality:"RTSTRUCT"})){this.#nl=this.#Al(this.#pl);const t=this.#Ll(this.#nl),o=this.#yn.getDataController().get(t);if(!o)throw new Error(cc(Gl,t));if(c=o.image,c.isResampled())return r.warn("Cannot update mask with resampled reference image."),[];const u=this.#yn.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.#yn.getDataController().get(u);if(!d)throw new Error(cc(Gl,u));if(c=d.image,c.isResampled())return r.warn("Cannot create mask on resampled image."),[];const h=n.displayToPlanePos(e);if(l=i.getPositionFromPlanePoint(h),this.#pl=this.#Il(o,c),void 0===this.#nl)throw new Error(Yl);const g=t.getDivId(),S=void 0!==g;S&&this.#Tl(g),a=this.#Pl(t),s=a.getViewController(),S&&s.setCurrentPosition(o)}const u=c.getGeometry(),d=this.#nl.getMeta(),h=this.#nl.getGeometry(),g=i.get2DSpacing(),S=[Math.round(this.#dl/g.x),Math.round(this.#dl/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(lc,m))}this.#yl(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,dc(h,s.getPositionFromPlanePoint(f),S,p))}#bl(e){const t=this.#xl().getId();if(void 0===this.#pl)throw new Error(jl);const n=this.#yn.getDataController().get(this.#pl);if(!n)throw new Error(cc(Xl,this.#pl));const i=new Nl;i.mask=n.image,i.dataId=this.#pl,i.offsetsLists=[e],i.mode=this.#gl,i.segmentNumber=this.#Sl,i.srclayerid=t;const o=new Bl(i);o.execute();const r=o.getOriginalValuesLists();if(void 0!==r)return r[0]}beginStroke(e,t){this.#fl=[],this.#vl=[];const n=this.#Ol(e,t);if(n.length>0){this.#fl.push(n);const e=this.#bl(n);return void 0!==e&&this.#vl.push(e),!0}return!1}paintStep(e,t){const n=this.#Ol(e,t);if(n.length>0){this.#fl.push(n);const e=this.#bl(n);void 0!==e&&this.#vl.push(e)}}finalizeStroke(){if(void 0===this.#pl)throw new Error(tc);if(void 0===this.#fl)throw new Error(nc);if(void 0===this.#vl)throw new Error(ic);this.#fl.reverse(),this.#vl.reverse();const e=this.#xl().getId(),t=this.#yn.getDataController().get(this.#pl);if(!t)throw new Error(cc($l,this.#pl));const n=new Nl;n.mask=t.image,n.dataId=this.#pl,n.offsetsLists=this.#fl,n.mode=this.#gl,n.segmentNumber=this.#Sl,n.srclayerid=e,n.originalValuesLists=this.#vl;const i=new Bl(n);i.onExecute=e=>{this.dispatchEvent(e)},i.onUndo=e=>{this.dispatchEvent(e),this.#nl.recalculateLabels()},this.#yn.getUndoController().addToUndoStack(i),this.dispatchEvent(i.getExecuteEvent()),this.#nl.recalculateLabels()}#xl(){if(void 0===this.#pl)throw new Error(rc);if(void 0===this.#Ka)throw new Error("No current layer group");const e=this.#Ka.getViewLayersByDataId(this.#pl);if(0===e.length)throw new Error(ac);return 1!==e.length&&r.warn(Jl),e[0]}}const gc=["brushsizechange","brushdraw","brushremove"];class Sc extends fl{#yn;#El;#Rl=!1;#Fl=[];constructor(e){super(),this.#yn=e,this.#El=new hc({app:e});for(const e of gc)this.#El.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}))}setFeatures(e){void 0!==e.blacklist&&(this.#Fl=e.blacklist),this.#El.setFeatures(e)}canStart(e,t){return!(!this.#Ml(t)||this.#ql(t)||(this.#fe(t)?(r.warn("Cannot paint on series with overlapping slices"),1):void 0===this.#El.getSelectedSegmentNumber()&&(r.warn(_l),1)))}onStart(e,t,n){super.onStart(e,t,n);const i=this.#El.getBrushSize()/2;this.setDragThreshold({x:i,y:i}),this.#Rl=!1,2===n?.mouseDownButton&&this.#Ul(),this.#El.beginStroke(e,t)||(this.#Ql(),super.onEnd())}onDrag(e,t){const n=this.prevPoint;void 0!==n&&this.#El.paintStep(n,t)}onEnd(){this.isActive()&&(this.#El.finalizeStroke(),this.#Ql()),super.onEnd()}reset(){this.isActive()&&(this.#El.finalizeStroke(),this.#Ql()),super.reset()}#Ml(e){if(void 0===e)throw new Error("No layergroup to check for view layer");return e.getActiveLayer()instanceof Js}#ql(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.#yn.getDataController().get(t).image.getMeta().SeriesInstanceUID;if(this.#Fl.includes(n))return!0}return!1}#fe(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.#yn.getDataController().get(n).image.getHasOverlap()}#Ul(){this.#Rl=!0,this.#El.setBrushMode(uc),this.dispatchEvent(new CustomEvent("erasingactivated"))}#Ql(){this.#Rl&&this.#El.getBrushMode()===uc&&(this.#El.setBrushMode("add"),this.dispatchEvent(new CustomEvent("erasingdeactivated"))),this.#Rl=!1}}class pc extends fl{#yn;#Qr;#Vl;#Nl;#Bl=[];#kl;#Gl=10;#zl=5;#Hl=0;#Yl=2e3;#Xl=[];#is;#ys;constructor(e,t,n){super(),this.#yn=e,this.#is=t,this.#ys=n}setFeatures(e){this.#ys.setFeatures(e)}#Wl(e){const t=e.getActiveDrawLayer();if(void 0!==t)return e.getViewLayerById(t.getReferenceLayerId());r.warn("No draw layer to do floodfill")}#$l=(e,t)=>{const n=this.#Wl(t);if(void 0===n)return void r.warn("No view layer to get index");const i=n.displayToPlaneIndex(e);return{x:i.get(0),y:i.get(1)}};#jl(e,t,i){this.#Xl=[];const o={data:this.#Nl?.data,width:this.#Nl?.width,height:this.#Nl?.height,bytes:4},r=n.floodFill(o,e.x,e.y,t),a=n.gaussBlurOnlyBorder(r,this.#zl);let s=n.traceContours(a);if(s=n.simplifyContours(s,this.#Hl,this.#Yl),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.#Xl.push(new S(s[0].points[e].x,s[0].points[e].y));return this.#Xl}return[]}#Zl(e,t,n){if(this.#Bl=this.#jl(e,t,!1),0!==this.#Bl.length){const e=n.getActiveDrawLayer();if(void 0===e)return r.warn("No draw layer to paint border"),!1;const t=e.getDrawController(),i=new rr(this.#Bl);let o;if(void 0===this.#Qr){this.#Qr=new Qa,this.#Qr.colour=this.#is.getLineColour();const a=n.getViewLayerById(e.getReferenceLayerId());if(void 0===a)return r.warn("No view layer to paint border"),!1;const s=a.getViewController();this.#Qr.init(s),this.#Qr.mathShape=i,o=new el(this.#Qr,t)}else{const e=this.#Qr.mathShape;o=new nl(this.#Qr,{mathShape:e},{mathShape:i},t)}this.#yn.getUndoController().addToUndoStack(o),o.execute()}return 0!==this.#Bl.length}#_l(e){const t=e.getBaseViewLayer().getDataId();return this.#yn.getDataController().get(t).image.isResampled()}#Is(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ys.checkCanEdit(n)?this.#ys.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.#_l(t))return;if(!this.isActive()&&this.#Is(e,t))return;let i;this.#Qr=void 0;let o=t.getActiveDrawLayer();if(void 0===o){i=t.getActiveViewLayer();const e=i.getDataId(),n=this.#yn.createAnnotationData(e),r=t.getDivId().replace("-layer-0","");this.#yn.addAndRenderAnnotationData(n,r,e),o=t.getActiveDrawLayer(),o.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(o.getDataId())}else if(i=t.getViewLayerById(o.getReferenceLayerId()),void 0===i)return void r.warn("No view layer to start floodfill");this.#Nl=i.getImageData(),void 0!==this.#Nl?(this.#is.setZoomScale(o.getKonvaLayer().getAbsoluteScale()),this.#Vl=this.#$l(e,t),this.#Zl(this.#Vl,this.#Gl,t),super.onStart(e,t,n)):r.error("No image info found")}onUpdate(e,t){if(!this.isActive())return;const n=this.#$l(e,t);this.#kl=Math.round(Math.sqrt(Math.pow(this.#Vl.x-n.x,2)+Math.pow(this.#Vl.y-n.y,2))/2),this.#kl=this.#kl<this.#Gl?this.#Gl:this.#kl-this.#Gl,this.#Zl(this.#Vl,this.#kl,t),super.onUpdate(e,t)}}class mc{constructor(e,t){this.pointArray=e?e.slice():[],this.controlPointIndexArray=t?t.slice():[]}getPoint(e){return this.pointArray[e]}isControlPoint(e){const t=this.pointArray.indexOf(e);if(-1===t)throw new Error("Error: isControlPoint called with not in list point.");return-1!==this.controlPointIndexArray.indexOf(t)}getLength(){return this.pointArray.length}addPoint(e){this.pointArray.push(e)}addControlPoint(e){const t=this.pointArray.indexOf(e);if(-1===t)throw new Error("Cannot mark a non registered point as control point.");this.controlPointIndexArray.push(t)}addPoints(e){this.pointArray=this.pointArray.concat(e)}appenPath(e){const t=this.pointArray.length;this.pointArray=this.pointArray.concat(e.pointArray);const n=[];for(let i=0;i<e.controlPointIndexArray.length;++i)n[i]=e.controlPointIndexArray[i]+t;this.controlPointIndexArray=this.controlPointIndexArray.concat(n)}}class fc{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 vc=2/(3*Math.PI);function Cc(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 Dc{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++){Cc(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};Cc(e,t,n,i,a),Cc(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),vc*(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}#Kl=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 fc(this.searchGranBits,this.#Kl),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 yc extends Al{#yn;#is;#Xa;#Qr;#Jl=new mc;#ec=new mc;#Xl=[];#tc=5;#nc=new Dc;#ys;constructor(e,t,n){super(),this.#yn=e,this.#is=t,this.#ys=n,super.setNumberOfTaps(500)}setFeatures(e){this.#ys.setFeatures(e)}#ic(e){const t=e.get(1);for(let e=0;e<t;++e)this.#Xl[e]=[]}#oc(){this.#Jl=new mc,this.#ec=new mc}#_l(e){const t=e.getBaseViewLayer().getDataId();return this.#yn.getDataController().get(t).image.isResampled()}#Is(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ys.checkCanEdit(n)?this.#ys.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.#_l(t))return;if(!this.isActive()&&this.#Is(e,t))return;let n,i=t.getActiveDrawLayer();n=void 0===i?t.getActiveViewLayer():t.getViewLayerById(i.getReferenceLayerId());const o=n.getViewController().getImageSize();this.#nc.setDimensions(o.get(0),o.get(1)),this.#nc.setData(n.getImageData().data);const r=n.displayToPlaneIndex(e);if(this.isActive()){const e=Math.abs(r.get(0)-this.#Xa.getX()),t=Math.abs(r.get(1)-this.#Xa.getY());if(e<this.#tc&&t<this.#tc)this.onEnd();else{this.#Jl=this.#ec,this.#ic(o);const e={x:r.get(0),y:r.get(1)};this.#nc.doTraining(e),this.#Jl.addControlPoint(this.#ec.getPoint(0))}}else{if(this.#Qr=void 0,this.#Xa=new S(r.get(0),r.get(1)),this.#oc(),this.#ic(o),void 0===i){const e=n.getDataId(),o=this.#yn.createAnnotationData(e);this.#yn.addAndRenderAnnotationData(o,t.getDivId(),e),i=t.getActiveDrawLayer(),i.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(i.getDataId())}this.#is.setZoomScale(i.getKonvaLayer().getAbsoluteScale());const e={x:r.get(0),y:r.get(1)};this.#nc.doTraining(e);const a=new S(r.get(0),r.get(1));this.#Jl.addPoint(a),this.#Jl.addControlPoint(a)}super.onTap(e,t)}onUpdate(e,t){if(!this.isActive())return;const n=t.getActiveDrawLayer();if(void 0===n)return void r.warn("No draw layer to update livewire");const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return void r.warn("No view layer to update livewire");const o=i.displayToPlaneIndex(e);let a,s={x:o.get(0),y:o.get(1)};this.#nc.setPoint(s);let l=!1;for(;!this.#Xl[s.y][s.x]&&!l;)if(a=this.#nc.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.#Xl[t.y][t.x]=n}for(this.#ec=new mc,l=!1;s&&!l;)this.#ec.addPoint(new S(s.x,s.y)),this.#Xl[s.y]&&this.#Xl[s.y][s.x]?s=this.#Xl[s.y][s.x]:l=!0;this.#ec.appenPath(this.#Jl);const c=n.getDrawController(),u=new rr(this.#ec.pointArray);let d;if(void 0===this.#Qr){this.#Qr=new Qa,this.#Qr.colour=this.#is.getLineColour();const e=i.getViewController();this.#Qr.init(e),this.#Qr.mathShape=u,d=new el(this.#Qr,c)}else{const e=this.#Qr.mathShape;d=new nl(this.#Qr,{mathShape:e},{mathShape:u},c)}this.#yn.getUndoController().addToUndoStack(d),d.execute(),super.onUpdate(e,t)}reset(){this.#Qr=void 0,this.#oc(),this.#Xl=[],super.reset()}}const Ic={},wc={WindowLevel:class extends Sl{#yn;#Oa;#Ra;constructor(e){const t=new vl,n=new wl({dataController:e.getDataController()});super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new Vs,doubleClickBehavior:n}),this.#yn=e,this.#Oa=t,this.#Ra=n}keydown=e=>{e.context="WindowLevel",this.#yn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){void 0!==e.strictViewLayer&&(r.warn("strictViewLayer is deprecated, use activeViewLayerOnly instead"),this.#Oa.setActiveViewLayerOnly(e.strictViewLayer),this.#Ra.setActiveViewLayerOnly(e.strictViewLayer)),void 0!==e.activeViewLayerOnly&&(this.#Oa.setActiveViewLayerOnly(e.activeViewLayerOnly),this.#Ra.setActiveViewLayerOnly(e.activeViewLayerOnly))}},Scroll:class extends Sl{#yn;#rc;constructor(e){const t=new Pl;super({stageController:e.getStageController(),dragBehavior:new Cl,hoverBehavior:t,wheelBehavior:new Vs,doubleClickBehavior:new Tl,tapBehavior:new Ol}),this.#yn=e,this.#rc=t}keydown=e=>{e.context="Scroll",this.#yn.onKeydown(e)};activate(e){e||this.cancel()}setFeatures(e){void 0!==e.displayTooltip&&this.#rc.setTooltipEnabled(Boolean(e.displayTooltip))}init(){}},ZoomAndPan:class extends Sl{#yn;constructor(e){super({stageController:e.getStageController(),dragBehavior:new yl,wheelBehavior:new Ns,twoTouchBehavior:new xl,tapBehavior:new Ol}),this.#yn=e}keydown=e=>{e.context="ZoomAndPan",this.#yn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Opacity:class extends Sl{#yn;constructor(e){super({stageController:e.getStageController(),dragBehavior:new Dl,wheelBehavior:new Vs}),this.#yn=e}keydown=e=>{e.context="Opacity",this.#yn.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Draw:class extends Sl{#yn;#ys;#ac;#sc;#Yr;constructor(e){const t=new Vl(e),n=new ql(e,t),i=new Fl(e,n),o=new Ml(e,n);super({stageController:e.getStageController(),dragBehavior:o,tapBehavior:i,wheelBehavior:new Vs}),this.#yn=e,this.#ys=n,this.#ac=o,this.#sc=i,this.#Yr=t;for(const e of this.getEventNames())this.#ac.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})),this.#sc.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})),this.#Yr.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}))}keydown=e=>{this.#sc.isActive()||(e.context="Draw",this.#yn.onKeydown(e));const t=this.#Yr.getEditorAnnotation();if(("Delete"===e.key||"Backspace"===e.key)&&void 0!==t){const e=this.#yn.getStageController().getActiveLayerGroup().getActiveDrawLayer();if(void 0===e)return void r.warn("No draw layer to handle key down");const n=e.getDrawController(),i=this.#yn.getUndoController(),o=new tl(t,n);i.addToUndoStack(o),o.execute(),this.#Yr.onMouseOutShapeGroup()}"Escape"===e.key&&(this.#ac.resetPlacement(),this.#sc.resetPlacement(),this.#ys.disableAndResetEditor())};activate(e){e||this.cancel(),this.#ys.activate(e)}setOptions(e){this.#ac.setOptions(e),this.#sc.setOptions(e)}getOptionsType(){return"factory"}setFeatures(e){void 0!==e.mouseOverCursor&&this.#Yr.storeMouseOverCursor(e.mouseOverCursor),this.#ac.setFeatures(e),this.#sc.setFeatures(e)}init(){}getEventNames(){return["annotationupdate","annotationselect","warn"]}hasShape(e){return this.#sc.hasShape(e)}},Brush:class extends Sl{#lc;#yn;constructor(e){const t=new Sc(e);super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new Vs,longTouchToDblClickMs:null}),this.#lc=t,this.#yn=e;for(const e of this.getEventNames())this.#lc.addEventListener(e,(t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}))}keydown=e=>{e.context="Brush",this.#yn.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.#lc.setFeatures({brushMode:uc}):this.#lc.setFeatures({brushMode:"add"})):this.#lc.setFeatures({brushSizeAdd:-1}):this.#lc.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.#yn.getStageController().getDataViewConfigs());e?this.#cc(t):(this.cancel(),this.#uc(t))}#cc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",(e=>{e.preventDefault(),e.stopPropagation()}))}}#uc(e){for(const t of e){const e=document.querySelector(`#${t}`);if(!e)return;e.addEventListener("contextmenu",(e=>{}))}}setFeatures(e){this.#lc.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:Ea,Floodfill:class extends Sl{#yn;#ys;#Oa;#is=new oo;constructor(e){const t=new oo,n=new Vl(e),i=new ql(e,n),o=new pc(e,t,i);super({stageController:e.getStageController(),dragBehavior:o,wheelBehavior:new Vs}),this.#yn=e,this.#ys=i,this.#Oa=o,this.#is=t}keydown=e=>{e.context="Floodfill",this.#yn.onKeydown(e),"Escape"===e.key&&this.#ys.disableAndResetEditor()};activate(e){if(e){const e=this.#yn.getStageController().getActiveLayerGroup();this.#is.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#is.getLineColour()})}else this.cancel();this.#ys.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#is.setLineColour(e.shapeColour),this.#Oa.setFeatures(e)}},Livewire:class extends Sl{#yn;#ys;#Ma;#is;constructor(e){const t=new oo,n=new Vl(e),i=new ql(e,n),o=new yc(e,t,i);super({stageController:e.getStageController(),tapBehavior:o,wheelBehavior:new Vs}),this.#yn=e,this.#ys=i,this.#Ma=o,this.#is=t}keydown=e=>{e.context="Livewire",this.#yn.onKeydown(e),"Escape"===e.key&&this.#ys.disableAndResetEditor()};activate(e){if(e){const e=this.#yn.getStageController().getActiveLayerGroup();this.#is.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#is.getLineColour()})}else this.cancel();this.#ys.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#is.setLineColour(e.shapeColour),this.#Ma.setFeatures(e)}}},Tc={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 je(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 p(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 Lc{#dc=[];#hc;#Tr=!1;#gc=[];#Tt=null;getLayerGroup(e){return this.#dc[e]}getNumberOfLayerGroups(){return this.#dc.length}getActiveLayerGroup(){return this.getLayerGroup(this.#hc)}setActiveLayerGroup(e){void 0!==this.getLayerGroup(e)?this.#hc=e:r.warn(`No layer group to set as active with index: ${e}`)}getViewLayersByDataId(e){let t=[];for(const n of this.#dc)t=t.concat(n.getViewLayersByDataId(e));return t}getViewLayers(e){let t=[];for(const n of this.#dc)t=t.concat(n.getViewLayers(e));return t}getDrawLayersByDataId(e){let t=[];for(const n of this.#dc)t=t.concat(n.getDrawLayersByDataId(e));return t}getDrawLayers(e){let t=[];for(const n of this.#dc)t=t.concat(n.getDrawLayers(e));return t}addLayerGroup(e,t){this.#hc=this.#dc.length;const n=new hl(e,t);n.setImageSmoothing(this.#Tr);const i=this.#Tt&&0!==this.#Tt.length;return i&&this.unbindLayerGroups(),this.#dc.push(n),i&&this.bindLayerGroups(),n}getLayerGroupByDivId(e){return this.#dc.find((function(t){return t.getDivId()===e}))}setBinders(e){if(null==e)throw new Error("Cannot set null or undefined binders");0!==this.#gc.length&&this.unbindLayerGroups(),this.#gc=e.slice(),this.bindLayerGroups()}empty(){this.unbindLayerGroups();for(const e of this.#dc)e.empty();this.#dc=[],this.#hc=void 0}removeLayersByDataId(e){for(const t of this.#dc)t.removeLayersByDataId(e)}removeLayerGroup(e){const t=this.#dc.findIndex((t=>t===e));if(-1===t)throw new Error("Cannot find layerGroup to remove");this.unbindLayerGroups(),e.empty(),this.#dc.splice(t,1),this.#hc===t&&(this.#hc=void 0),this.bindLayerGroups()}reset(){for(const e of this.#dc)e.reset()}resetZoomPan(){for(const e of this.#dc)e.resetZoomPan()}resetViews(){for(const e of this.#dc)e.resetViews()}draw(){for(const e of this.#dc)e.draw()}fitToContainer(){let e;const t=[];for(let n=0;n<this.#dc.length;++n){const i=this.#dc[n].getDivToWorldSizeRatio();void 0!==i&&this.#dc[n].shouldBind()&&(t.push(n),(void 0===e||i<e)&&(e=i))}for(let n=0;n<this.#dc.length;++n)if(t.includes(n)&&this.#dc[n].shouldBind())this.#dc[n].fitToContainer(e);else{const e=this.#dc[n].getDivToWorldSizeRatio();this.#dc[n].fitToContainer(e)}}bindLayerGroups(){if(0!==this.#dc.length&&1!==this.#dc.length&&0!==this.#gc.length){this.#Tt=new Array(this.#dc.length);for(let e=0;e<this.#dc.length;++e)if(this.#dc[e].shouldBind())for(let t=0;t<this.#gc.length;++t)this.#Sc(e,this.#gc[t])}}unbindLayerGroups(){if(0!==this.#dc.length&&0!==this.#gc.length&&this.#Tt){for(let e=0;e<this.#dc.length;++e)if(this.#dc[e].shouldBind())for(let t=0;t<this.#gc.length;++t)this.#pc(e,this.#gc[t]);this.#Tt=null}}setImageSmoothing(e){this.#Tr=e;for(const t of this.#dc)t.setImageSmoothing(e)}#mc(e,t){if(!this.#Tt)return;void 0===this.#Tt[t]&&(this.#Tt[t]=[]);let n=this.#Tt[t].find((function(t){return t.binder===e}));return void 0===n&&(n={binder:e,callback:n=>{this.#pc(t,e),e.getCallback(this.#dc[t])(n),this.#Sc(t,e)}},this.#Tt[t].push(n)),n.callback}#Sc(e,t){for(let n=0;n<this.#dc.length;++n)n!==e&&this.#dc[n].shouldBind()&&this.#dc[e].addEventListener(t.getEventType(),this.#mc(t,n))}#pc(e,t){if(this.#Tt)for(const n in this.#Tt)if(parseInt(n,10)!==e)for(const i of this.#Tt[n])i.binder.getEventType()===t.getEventType()&&this.#dc[e].removeEventListener(t.getEventType(),i.callback)}}const Pc=["viewlayeradd","drawlayeradd","error","zoomchange","offsetchange","layerremove","outofrange","renderstart","renderend",...Ys];class Ac extends EventTarget{#fc=null;#Za;#qi;#vc;#Cc;#Dc;constructor(e,t){super(),this.#Za=e,this.#qi=t,this.#fc=new Lc,void 0!==t.binders&&this.#fc.setBinders(t.binders)}setToolboxController(e){this.#vc=e}setAddToUndoStack(e){this.#Cc=e}setGetInfoData(e){this.#Dc=e}getViewConfigs(e,t){if(void 0===t&&(t=!1),null===this.#qi.dataViewConfigs||void 0===this.#qi.dataViewConfigs)throw new Error("No available data view configuration");let n=[];return void 0!==this.#qi.dataViewConfigs[e]?n=this.#qi.dataViewConfigs[e]:t||void 0===this.#qi.dataViewConfigs["*"]||(n=this.#qi.dataViewConfigs["*"]),n}getViewConfig(e,t,n){return this.getViewConfigs(e,n).find((function(e){return e.divId===t}))}getDataViewConfigs(){return this.#qi.dataViewConfigs}setDataViewConfigs(e){this.#fc.empty(),this.#qi.dataViewConfigs=e,this.#yc(e)}addDataViewConfig(e,t,n){void 0===n&&(n=!0);const i=this.#qi.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.#qi.dataViewConfigs[e].push(t),void 0===this.#fc.getLayerGroupByDivId(t.divId)&&this.#Ic(t),void 0!==this.#Za.get(e)&&n&&this.render(e,[t])}removeDataViewConfig(e,t){const n=this.#qi.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.#fc.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.#fc.removeLayerGroup(o)}}updateDataViewConfig(e,t,n){const i=this.#qi.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.#fc.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.#Za.get(e)&&this.render(e,[r])}getActiveLayerGroup(){return this.#fc.getActiveLayerGroup()}setActiveLayerGroup(e){this.#fc.setActiveLayerGroup(e)}getLayerGroup(e){return this.#fc.getLayerGroup(e)}getNumberOfLayerGroups(){return this.#fc.getNumberOfLayerGroups()}getViewLayersByDataId(e){return this.#fc.getViewLayersByDataId(e)}getViewLayers(e){return this.#fc.getViewLayers(e)}getDrawLayersByDataId(e){return this.#fc.getDrawLayersByDataId(e)}getDrawLayers(e){return this.#fc.getDrawLayers(e)}getLayerGroupByDivId(e){return this.#fc.getLayerGroupByDivId(e)}getAddedScale(){return this.#fc.getActiveLayerGroup().getAddedScale()}getBaseScale(){return this.#fc.getActiveLayerGroup().getBaseScale()}getOffset(){return this.#fc.getActiveLayerGroup().getOffset()}empty(){this.#fc.empty()}removeLayersByDataId(e){this.#fc.removeLayersByDataId(e)}setBinders(e){this.#fc.setBinders(e)}fitToContainer(){this.#fc.fitToContainer()}draw(){this.#fc.draw()}resetLayout(){this.#fc.reset(),this.#fc.draw()}resetZoomPan(){this.#fc.resetZoomPan(),this.#fc.draw()}resetViews(){this.#fc.resetViews()}setImageSmoothing(e){this.#fc.setImageSmoothing(e),this.#fc.draw()}zoom(e,t,n){const i=this.#fc.getActiveLayerGroup(),o=i.getBaseViewLayer().getViewController().getCurrentScrollPosition(),r=new p(t,n,o);i.addScale(e,r),i.draw()}translate(e,t){const n=this.#fc.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.#Za.get(e),i=void 0!==n&&void 0!==n.image,o=void 0!==n&&void 0!==n.annotationGroup;if(0===this.#fc.getNumberOfLayerGroups()&&this.#yc(this.#qi.dataViewConfigs),void 0===t&&(t=this.getViewConfigs(e)),0!==t.length)for(let n=0;n<t.length;++n){const r=t[n],a=this.#fc.getLayerGroupByDivId(r.divId);if(!a)throw new Error(`No layer group for ${r.divId}`);!i||this.#wc(e,a)?(i&&0===a.getViewLayersByDataId(e).length?this.#Tc(e,r):o&&0===a.getDrawLayersByDataId(e).length&&this.#Lc(e,r),a.draw()):this.dispatchEvent(new CustomEvent("error",{detail:{error:new Error("Render error: incompatible geometries for overlay"),dataid:e}}))}else r.info(`Not rendering data: ${e} (no data view config)`)}#Pc=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#yc(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.#Ic(t),n.push(t.divId))}}}#Ic(e){const t=this.#qi.rootDocument.getElementById(e.divId),n=void 0!==this.#qi.overlayConfig,i=this.#fc.addLayerGroup(t,n);this.#Ac(i)}#Ac(e){e.addEventListener("zoomchange",this.#Pc),e.addEventListener("offsetchange",this.#Pc),e.addEventListener("layerremove",this.#Pc),e.addEventListener("outofrange",this.#Pc),e.addEventListener("renderstart",this.#Pc),e.addEventListener("renderend",this.#Pc);for(const t of Ys)e.addEventListener(t,this.#Pc);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])}))}#wc(e,t){let n=!1;const i=t.getBaseViewLayer();if(void 0!==i){const t=this.#Za.get(i.getDataId()).image,o=this.#Za.get(e).image;if(void 0!==t&&void 0!==o){const e=t.getGeometry().getOrientation();n=o.getGeometry().getOrientation().isSimilarProgressive(e,ke)}}else n=!0;return n}#Tc(e,t){const n=this.#Za.get(e);if(!n)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const i=this.#fc.getLayerGroupByDivId(t.divId);if(!i)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const o=n.image.getGeometry();this.#fc.unbindLayerGroups();const r=(new zs).create(n.meta,n.image),a=ht(o.getOrientation(),st(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 je(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.#Za.addEventListener("dataimageset",c.onimageset),s&&void 0!==this.#qi.overlayConfig&&void 0!==this.#Dc&&(i.addInfoData(this.#Dc(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.#fc.fitToContainer(),c.setOffset(i.getOffset());const S=this.#Oc(o.getOrientation(),t.orientation);if(this.#bc(S,c),s)c.setScale(i.getScale());else{const e=i.getBaseViewLayer();c.initScale(i.getScale(),e.getAbsoluteZoomOffset())}this.#fc.bindLayerGroups(),this.#vc&&this.#vc.bindLayerGroup(i,c),this.dispatchEvent(new CustomEvent("viewlayeradd",{detail:{layerid:c.getId(),layergroupid:i.getDivId(),dataid:e}})),s&&this.#vc&&this.#vc.init()}#Lc(e,t){const n=this.#fc.getLayerGroupByDivId(t.divId);if(!n)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const i=this.#Za.get(e);if(!i)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const o=i.annotationGroup,r=this.#xc(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.#fc.unbindLayerGroups();const s=r.getViewController();i.annotationGroup.setViewController(s);const l=this.#Za.get(a);if(!l)throw new Error(`Cannot initialise layer without reference data, id: ${a}`);const c=l.image.getGeometry(),u=ht(c.getOrientation(),st(t.orientation)),d=c.getSize(u).get2D(),h=c.getSpacing(u).get2D(),g=n.addDrawLayer();g.initialise(d,h,r.getId());const S=new js(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.#fc.fitToContainer(),g.setOffset(n.getOffset());const m=this.#Oc(c.getOrientation(),t.orientation);this.#bc(m,g),g.initScale(n.getScale(),r.getAbsoluteZoomOffset()),g.setAnnotationGroup(i.annotationGroup,e,this.#Cc),g.setCurrentPosition(s.getCurrentPosition(),s.getCurrentIndex()),this.#fc.bindLayerGroups(),this.#vc&&this.#vc.bindLayerGroup(n,g),this.dispatchEvent(new CustomEvent("drawlayeradd",{detail:{layerid:g.getId(),layergroupid:n.getDivId(),dataid:e}}))}#xc(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}#Oc(e,t){const n=lt(e.asOneAndZeros());if(void 0===n)throw new Error("Unsupported undefined orientation code");const i=void 0===t,o=!i&&t===at.Axial,a=!i&&t===at.Coronal,s=!i&&t===at.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||o?l.y=!0:a?c.z=!0:s&&(c.z=!0,l.x=!0):"RPI"===n?i||o?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:o?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):o?(l.x=!0,c.x=!0):s&&(l.y=!0,c.z=!0):"RIA"===n?(l.x=!0,i||a?c.x=!0:o?(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,(o||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):o?l.y=!0:a&&(c.z=!0):"LIP"!==n&&r.warn(`Unsupported orientation code: ${n}, display could be incorrect`),{scale:c,offset:l}}#bc(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 Oc{divId;orientation;colourMap;opacity;fillOpacity;contourThickness;wlPresetName;windowCenter;windowWidth;constructor(e){this.divId=e}}class bc{options;constructor(e){this.options=e}}class xc{dataViewConfigs;tools;binders;viewOnFirstLoadItem;defaultCharacterSet;overlayConfig;rootDocument;constructor(e){this.dataViewConfigs=e}}class Ec extends EventTarget{#qi=null;#Za=null;#vc=null;#Ec=null;#Aa=null;#Rc=null;#is=new oo;#Sa={};getDataController(){return this.#Za}getData(e){return r.debug("App.getData: deprecated since v0.37, please use via app.getDataController."),this.#Za.get(e)}getImage(e){let t;return r.debug("App.getImage: deprecated since v0.34, please use the getData method."),void 0!==this.#Za.get(e)&&(t=this.#Za.get(e).image),t}setImage(e,t){r.debug("App.setImage: deprecated since v0.37, please use via app.getDataController."),this.#Za.setImage(e,t)}getNextDataId(){return r.debug("App.getNextDataId: deprecated since v0.37, please use via app.getDataController."),this.#Za.getNextDataId()}addData(e,t){return r.debug("App.addData: deprecated since v0.37, please use via app.getDataController."),this.#Za.add(e,t)}getMetaData(e){let t;return r.debug("App.getMetaData: deprecated since v0.37, please use via app.getDataController."),void 0!==this.#Za.get(e)&&(t=this.#Za.get(e).meta),t}getDataIds(){return r.debug("App.getDataIds: deprecated since v0.37, please use via app.getDataController."),this.#Za.getDataIds()}getDataIdsFromSopUids(e){return r.debug("App.getDataIdsFromSopUids: deprecated since v0.37, please use via app.getDataController."),this.#Za.getDataIdsFromSopUids(e)}getDataIdFromSeriesUid(e){return r.debug("App.getDataIdFromSeriesUid: deprecated since v0.37, please use via app.getDataController."),this.#Za.getDataIdFromSeriesUid(e)}canScroll(){return r.debug("App.canScroll: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Aa.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()}canWindowLevel(){return r.debug("App.canWindowLevel: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Aa.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()}getAddedScale(){return r.debug("App.getAddedScale: deprecated since v0.37, please access from the active layer group."),this.#Aa.getAddedScale()}getBaseScale(){return r.debug("App.getBaseScale: deprecated since v0.37, please access from the active layer group."),this.#Aa.getBaseScale()}getOffset(){return r.debug("App.getOffset: deprecated since v0.37, please access from the active layer group."),this.#Aa.getOffset()}getToolboxController(){return this.#vc}getStageController(){return this.#Aa}getUndoController(){return this.#Rc}getActiveLayerGroup(){return r.debug("App.getActiveLayerGroup: deprecated since v0.37, use app.getStageController().getActiveLayerGroup()"),this.#Aa.getActiveLayerGroup()}setActiveLayerGroup(e){r.debug("App.setActiveLayerGroup: deprecated since v0.37, use app.getStageController().setActiveLayerGroup()"),this.#Aa.setActiveLayerGroup(e)}getViewLayersByDataId(e){return r.debug("App.getViewLayersByDataId: deprecated since v0.37, use app.getStageController().getViewLayersByDataId()"),this.#Aa.getViewLayersByDataId(e)}getViewLayers(e){return r.debug("App.getViewLayers: deprecated since v0.37, use app.getStageController().getViewLayers()"),this.#Aa.getViewLayers(e)}getDrawLayersByDataId(e){return r.debug("App.getDrawLayersByDataId: deprecated since v0.37, use app.getStageController().getDrawLayersByDataId()"),this.#Aa.getDrawLayersByDataId(e)}getDrawLayers(e){return r.debug("App.getDrawLayers: deprecated since v0.37, use app.getStageController().getDrawLayers()"),this.#Aa.getDrawLayers(e)}getLayerGroupByDivId(e){return r.debug("App.getLayerGroupByDivId: deprecated since v0.37, use app.getStageController().getLayerGroupByDivId()"),this.#Aa.getLayerGroupByDivId(e)}getNumberOfLayerGroups(){return r.debug("App.getNumberOfLayerGroups: deprecated since v0.37, use app.getStageController().getNumberOfLayerGroups()"),this.#Aa.getNumberOfLayerGroups()}getStyle(){return this.#is}addToUndoStack=e=>{r.debug("App.addToUndoStack: deprecated since v0.37, please use via app.getUndoController."),null!==this.#Rc&&this.#Rc.addToUndoStack(e)};removeFromUndoStack=e=>{r.debug("App.removeFromUndoStack: deprecated since v0.37, please use via app.getUndoController.");let t=!1;return null!==this.#Rc&&(t=this.#Rc.removeFromUndoStack(e)),t};init(e){this.#qi=e,void 0===this.#qi.viewOnFirstLoadItem&&(this.#qi.viewOnFirstLoadItem=!0),void 0===this.#qi.dataViewConfigs&&(this.#qi.dataViewConfigs={}),void 0===this.#qi.rootDocument&&"undefined"!=typeof document&&(this.#qi.rootDocument=document),this.#Ec=new As(this.#qi.defaultCharacterSet),this.#Ec.addEventListener("loadstart",this.#Fc),this.#Ec.addEventListener("loaditem",this.#Mc),this.#Ec.addEventListener("load",this.#qc);for(const e of Ps)"loadstart"!==e&&"loaditem"!==e&&"load"!==e&&this.#Ec.addEventListener(e,this.#Rr);this.#Za=new cs;for(const e of rs)this.#Za.addEventListener(e,this.#Rr);for(const e of Ki)this.#Za.addEventListener(e,this.#Rr);for(const e of no)this.#Za.addEventListener(e,this.#Rr);this.#Rc=new bs;for(const e of Os)this.#Rc.addEventListener(e,this.#Rr);this.#Aa=new Ac(this.#Za,this.#qi),this.#Aa.setAddToUndoStack((e=>this.#Rc.addToUndoStack(e))),this.#Aa.setGetInfoData((e=>this.getInfoData(e)));for(const e of Pc)this.#Aa.addEventListener(e,this.#Rr);if(void 0!==this.#qi.tools){const e={},t=Object.keys(this.#qi.tools);for(let n=0;n<t.length;++n){const i=t[n];let o=wc[i];if(void 0===o&&(o=Ic[i]),void 0!==o){if(e[i]=new o(this),void 0!==e[i].addEventListener){const t=e[i].getEventNames();for(let n=0;n<t.length;++n)e[i].addEventListener(t[n],this.#Rr)}const t=this.#qi.tools[i];if(void 0!==t.options&&0!==t.options.length){let n,o="raw";if(void 0!==e[i].getOptionsType&&(o=e[i].getOptionsType()),"instance"===o||"factory"===o){n={};for(let e=0;e<t.options.length;++e){const a=t.options[e];let s=a;"factory"===o&&(s+="Factory");const l=i.charAt(0).toLowerCase()+i.slice(1);let c,u=qa[l];void 0!==u&&(c=u[s]),void 0===c&&(u=Ua[l],void 0!==u&&(c=u[s])),void 0!==c?n[a]=c:r.warn(`Could not find option class for: ${a}`)}}else n=t.options;e[i].setOptions(n)}}else r.warn(`Could not initialise unknown tool: ${i}`)}this.#vc=new Io(e),this.#Aa.setToolboxController(this.#vc)}}reset(){this.#Aa.empty(),this.#Sa={},this.#Rc&&this.#Rc.reset()}resetLayout(){r.debug("App.resetLayout: deprecated since v0.35, prefer resetZoomPan."),this.#Aa.resetLayout()}resetZoomPan(){r.debug("App.resetZoomPan: deprecated since v0.37, use app.getStageController().resetZoomPan()"),this.#Aa.resetZoomPan()}resetViews(){r.debug("App.resetViews: deprecated since v0.37, use app.getStageController().resetViews()"),this.#Aa.resetViews()}loadFiles=e=>{if(0===e.length)return r.warn("Ignoring empty input file list."),"-1";const t=this.#Za.getNextDataId();return this.#Ec.loadFiles(e,t),t};loadURLs=(e,t)=>{if(0===e.length)return r.warn("Ignoring empty input url list."),"-1";const n=this.#Za.getNextDataId();return this.#Ec.loadURLs(e,n,t),n};loadFromUri=(e,t)=>{r.debug("App.loadFromUri: deprecated since v0.36, please extract the file list and pass it to loadURLs.");const n=ho(e);n&&void 0!==n.input&&function(e,t,n){e.type&&"manifest"===e.type?mo(e.input,e.nslices,t):t(po(e.input,e.dwvReplaceMode),n)}(n,this.loadURLs,t)};loadImageObject=e=>{const t=this.#Za.getNextDataId();return this.#Ec.loadImageObject(e,t),t};abortAllLoads(){const e=this.#Ec.getLoadingDataIds();for(const t of e)this.abortLoad(t)}abortLoad(e){this.#Ec.abort(e),this.#Za.remove(e),this.#Aa.removeLayersByDataId(e)}fitToContainer(){r.debug("App.fitToContainer: deprecated since v0.37, use app.getStageController().fitToContainer()"),this.#Aa.fitToContainer()}initWLDisplay(){r.debug("App.initWLDisplay: deprecated since v0.33, please set the opacity of the desired view layer directly."),this.#Aa.getActiveLayerGroup().getActiveViewLayer().getViewController().initialise()}setImageSmoothing(e){r.debug("App.setImageSmoothing: deprecated since v0.37, use app.getStageController().setImageSmoothing()"),this.#Aa.setImageSmoothing(e)}getViewConfigs(e,t){return r.debug("App.getViewConfigs: deprecated since v0.37, use app.getStageController().getViewConfigs()"),this.#Aa.getViewConfigs(e,t)}getViewConfig(e,t,n){return r.debug("App.getViewConfig: deprecated since v0.37, use app.getStageController().getViewConfig()"),this.#Aa.getViewConfig(e,t,n)}getDataViewConfigs(){return r.debug("App.getDataViewConfigs: deprecated since v0.37, use app.getStageController().getDataViewConfigs()"),this.#Aa.getDataViewConfigs()}setDataViewConfigs(e){r.debug("App.setDataViewConfigs: deprecated since v0.37, use app.getStageController().setDataViewConfigs()"),this.#Aa.setDataViewConfigs(e)}addDataViewConfig(e,t,n){r.debug("App.addDataViewConfig: deprecated since v0.37, use app.getStageController().addDataViewConfig()"),this.#Aa.addDataViewConfig(e,t,n)}removeDataViewConfig(e,t){r.debug("App.removeDataViewConfig: deprecated since v0.37, use app.getStageController().removeDataViewConfig()"),this.#Aa.removeDataViewConfig(e,t)}updateDataViewConfig(e,t,n){r.debug("App.updateDataViewConfig: deprecated since v0.37, use app.getStageController().updateDataViewConfig()"),this.#Aa.updateDataViewConfig(e,t,n)}setLayerGroupsBinders(e){const t=[];for(let n=0;n<e.length;++n)void 0!==Tc[e[n]]&&t.push(new Tc[e[n]]);this.#Aa.setBinders(t)}render(e,t){r.debug("App.render: deprecated since v0.37, use app.getStageController().render()"),this.#Aa.render(e,t)}zoom(e,t,n){r.debug("App.zoom: deprecated since v0.37, please access from the active layer group."),this.#Aa.zoom(e,t,n)}translate(e,t){r.debug("App.translate: deprecated since v0.37, please access from the active layer group."),this.#Aa.translate(e,t)}resampleMatch(e,t){const n=this.#Za.get(e);if(void 0===n)return void r.debug(`Cannot resample match, target data '${e}' is undefined`);if(void 0===n.image)return void r.debug(`Cannot resample match, target image '${e}' is undefined`);const i=this.#Za.get(t);if(void 0===i)return void r.debug(`Cannot resample match, source data '${t}' is undefined`);if(void 0===i.image)return void r.debug(`Cannot resample match, source image '${t}' is undefined`);const o=n.image.getGeometry().getOrientation(),a=i.image.getGeometry().getOrientation();o.equals(a)?r.info(`Same orientation, no resample match for data '${e}' and '${t}'`):this.resample(e,a)}resample(e,t){const n=this.#Za.get(e);if(void 0===n)return void r.debug(`Cannot resample, target data '${e}' is undefined`);if(void 0===n.image)return void r.debug(`Cannot resample, target image '${e}' is undefined`);if(n.image.getGeometry().getOrientation().equals(t))return void r.info(`Same orientation, no resample for data '${e}'`);n.image.resample(t);const i=this.#qi.dataViewConfigs,o=n.image.getMeta(),a=this.#Za.getDataIds();for(let e=0;e<a.length;e++){const t=this.#Za.get(a[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===o.SeriesInstanceUID&&this.#Za.stash(a[e])}const s=this.getStageController();s.setDataViewConfigs(i);const l=this.#Za.getDataIds();for(let e=0;e<l.length;++e)s.render(l[e])}revertResample(e){const t=this.#Za.get(e);if(void 0===t)return void r.debug(`Cannot revert resample, target data '${e}' is undefined`);if(void 0===t.image)return void r.debug(`Cannot revert resample, target image '${e}' is undefined`);if(!t.image.isResampled())return void r.info(`No revert resample needed for data '${e}'`);t.image.revert();const n=this.#qi.dataViewConfigs,i=t.image.getMeta(),o=this.#Za.getStashedDataIds();for(let e=0;e<o.length;e++){const t=this.#Za.getStashed(o[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===i.SeriesInstanceUID&&this.#Za.unstash(o[e])}const a=this.getStageController();a.setDataViewConfigs(n);const s=this.#Za.getDataIds();for(let e=0;e<s.length;++e)a.render(s[e])}setOpacity(e){r.debug("App.setOpacity: deprecated since v0.33, please set the opacity of the desired view layer directly.");const t=this.#Aa.getActiveLayerGroup().getActiveViewLayer();t.setOpacity(e),t.draw()}setDrawings(t,n,i){r.debug("App.setDrawings: deprecated since v0.34, please switch to DICOM SR annotations.");const a=this.#Aa.getActiveLayerGroup().getBaseViewLayer(),s=a.getDataId(),l=this.#Za.get(s),c=a.getViewController(),u=function(t,n,i){const a=[],s=e.Node.create(t).getChildren(oa);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 Qa,s=new o(rl(t.id()));e.referencedSopInstanceUID=i.getImageUid(s);const c=l[0];e.trackingId=c.id(),e.trackingUid=c.id();const u=c.getChildren(ia)[0];if(e.colour=u.stroke(),"line-group"===c.name()){const t=u.points();e.mathShape=new S(t[0],t[1]),e.referencePoints=[new S(t[2],t[3])]}else if("ruler-group"===c.name()){const t=u.points();e.mathShape=new Ko(new S(t[0],t[1]),new S(t[2],t[3]))}else if("rectangle-group"===c.name())e.mathShape=new cr(new S(u.x(),u.y()),new S(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 S(t[e],t[e+1]));e.mathShape=new rr(n)}else if("freeHand-group"===c.name()){r.warn("Converting freehand into ROI shape");const t=u.points(),n=[];for(let e=0;e<t.length;e+=2)n.push(new S(t[e],t[e+1]));e.mathShape=new rr(n)}else if("protractor-group"===c.name()){const t=u.points();e.mathShape=new or([new S(t[0],t[1]),new S(t[2],t[3]),new S(t[4],t[5])])}else if("ellipse-group"===c.name()){const t=u.absolutePosition();e.mathShape=new sr(new S(t.x,t.y),u.radiusX(),u.radiusY())}else if("circle-group"===c.name()){const t=u.absolutePosition();e.mathShape=new ar(new S(t.x,t.y),u.radius())}else if("bidimensional-group"===c.name()){const t=u.points(),i=new dr(new S(t[0],t[1]),new S(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 dr.restorePropertiesFromQuantification?dr.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.#Za.add(i,d),this.#Aa.render(i)}applyJsonState(e,t){r.debug("App.applyJsonState: deprecated since v0.34, please switch to DICOM SR for annotations.");const n=new ro(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.#Aa.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.#Rc.redo();else if("z"===e.key)this.#Rc.undo();else if(" "===e.key){const e=this.#Aa.getNumberOfLayerGroups();for(let t=0;t<e;++t)this.#Aa.getLayerGroup(t).setShowCrosshair(!this.#Aa.getLayerGroup(t).getShowCrosshair())}};resetDisplay(){this.resetLayout(),this.initWLDisplay()}resetZoom(){this.resetLayout()}setColourMap(e){r.debug("App.setColourMap: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Aa.getActiveLayerGroup().getActiveViewLayer().getViewController().setColourMap(e)}setWindowLevelPreset(e){r.debug("App.setWindowLevelPreset: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#Aa.getActiveLayerGroup().getActiveViewLayer().getViewController().setWindowLevelPreset(e)}setTool(e){for(let e=0;e<this.#Aa.getNumberOfLayerGroups();++e){const t=this.#Aa.getLayerGroup(e),n=t.getActiveLayer();void 0!==n&&this.#vc.bindLayerGroup(t,n)}this.#vc.setSelectedTool(e)}setToolFeatures(e){this.#vc.setToolFeatures(e)}undo(){r.debug("App.undo: deprecated since v0.37, please use via app.getUndoController."),this.#Rc.undo()}redo(){r.debug("App.redo: deprecated since v0.37, please use via app.getUndoController."),this.#Rc.redo()}getStackSize(){return r.debug("App.getStackSize: deprecated since v0.37, please use via app.getUndoController."),this.#Rc.getStackSize()}getCurrentStackIndex(){return r.debug("App.getCurrentStackIndex: deprecated since v0.37, please use via app.getUndoController."),this.#Rc.getCurrentStackIndex()}getInfoData(e){let t;return void 0!==this.#Sa&&(t=this.#Sa[e]),t}toggleInfoDataListeners(e){const t=this.getInfoData(e);void 0!==t&&(t.isListening()?t.removeAppListeners():t.addAppListeners())}createAnnotationData(e){const t=this.#Za.get(e).image.getMeta(),n=new ss({});n.annotationGroup=new io,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.#Za,o=i.getNextDataId();if(!i.add(o,e))throw new Error("Cannot add annotation data");const r=this.#Aa.getViewConfigs(n).find((e=>e.divId===t));if(void 0===r)throw new Error("No reference data view config for draw");const a=new Oc(t);a.orientation=r.orientation,this.#Aa.addDataViewConfig(o,a),this.#Aa.render(o)}#Rr=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#Fc=e=>{void 0!==this.#qi.overlayConfig&&0===Object.keys(this.#Sa).length&&(this.#Sa[e.detail.dataid]=new Ms(this,e.detail.dataid,this.#qi.overlayConfig)),this.#Rr(e)};#Mc=e=>{void 0===e.detail.data&&r.error("Missing loaditem event data."),void 0===e.detail.loadtype&&r.error("Missing loaditem event load type.");const t=e.detail.isfirstitem;if("image"===e.detail.loadtype)try{t?this.#Za.add(e.detail.dataid,e.detail.data):this.#Za.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.#Rr(e),void 0!==this.#Sa&&void 0!==this.#Sa[e.detail.dataid]&&this.#Sa[e.detail.dataid].addItemMeta(e.detail.data.meta),"image"===e.detail.loadtype&&0!==this.#Aa.getViewConfigs(e.detail.dataid).length&&t&&this.#qi.viewOnFirstLoadItem&&this.#Aa.render(e.detail.dataid)};#qc=e=>{const t=this.#Za.markDataAsComplete(e.detail.dataid);this.#qi.viewOnFirstLoadItem&&void 0!==t.imageHasChanged&&t.imageHasChanged&&this.#Aa.render(e.detail.dataid),this.#Rr(e)}}class Rc{#nl;#me;constructor(e){this.#nl=e;const t=e.getMeta();void 0===t.custom&&(t.custom={}),void 0===t.custom.segments&&(t.custom.segments=[]),this.#me=t.custom.segments}getMask(){return this.#nl}#Uc(e){return this.#me.findIndex((function(t){return t.number===e}))}hasSegment(e){return-1!==this.#Uc(e)}getNumberOfSegments(){return this.#me.length}maskHasSegments(e){const t=[],n=[];for(let i=0;i<e.length;++i){const o=this.getSegment(e[i]);void 0!==o?void 0!==o.displayValue?t.push(o.displayValue):t.push(o.number):(r.warn(`Unknown segment in maskHasSegments: ${e[i]}`),n.push(i))}const i=this.#nl.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.#Uc(e);return-1!==n&&(t=this.#me[n]),t}addSegment(e){-1===this.#Uc(e.number)?(this.#me.push(e),void 0!==e.displayRGBValue&&this.#nl.updatePaletteColourMap(e.number,e.displayRGBValue)):r.warn(`Not adding segment, it is allready in the segments list: ${e.number}`)}removeSegment(e){const t=this.#Uc(e);-1!==t?this.#me.splice(t,1):r.warn(`Cannot remove segment, it is not in the segments list: ${e}`)}updateSegment(e){const t=this.#Uc(e.number);-1!==t?this.#me[t]=e:r.warn(`Cannot update segment, it is not in the segments list: ${e.number}`)}findOverlap(e){const t=this.#nl.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.#nl.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 Fc extends Oa{#nl;#Qc;#ll;#Vc;constructor(e,t,n){super(),this.#nl=e,this.#Qc=t,this.#ll=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.#nl.getMeta().custom.segments.some((e=>e.number===this.#Qc.number))}execute(){0!==this.#Vc.length&&this.#nl.setAtOffsets(this.#Vc,0),new Rc(this.#nl).removeSegment(this.#Qc.number),this.#ll||this.onExecute({type:"masksegmentdelete",segmentnumber:this.#Qc.number})}undo(){0!==this.#Vc.length&&(void 0!==this.#Qc.displayRGBValue?this.#nl.setAtOffsets(this.#Vc,this.#Qc.number):this.#nl.setAtOffsets(this.#Vc,this.#Qc.displayValue)),new Rc(this.#nl).addSegment(this.#Qc),this.onUndo({type:"masksegmentredraw",segmentnumber:this.#Qc.number})}onExecute(e){}onUndo(e){}}class Mc extends Oa{#nl;#Qc;#Nc;#Bc;#ll;#Vc;constructor(e,t,n,i){super(),this.#nl=e,this.#Qc=t,this.#Nc=n,this.#ll=void 0!==i&&i,void 0!==t.displayRGBValue?this.#Bc=t.displayRGBValue:(this.#Bc=t.displayValue,this.#Vc=e.getOffsets(this.#Bc))}getName(){return"Change-segment-colour"}isValid(){let e=!0;return void 0!==this.#Vc&&(e=0!==this.#Vc.length),e}execute(){"number"==typeof this.#Nc?(this.#nl.setAtOffsets(this.#Vc,this.#Nc),this.#Qc.displayValue=this.#Nc):(this.#nl.updatePaletteColourMap(this.#Qc.number,this.#Nc),this.#Qc.displayRGBValue=this.#Nc),this.#ll||this.onExecute({type:"changemasksegmentcolour",segmentnumber:this.#Qc.number,value:[this.#Nc]})}undo(){"number"==typeof this.#Bc?(this.#nl.setAtOffsets(this.#Vc,this.#Bc),this.#Qc.displayValue=this.#Bc):(this.#nl.updatePaletteColourMap(this.#Qc.number,this.#Bc),this.#Qc.displayRGBValue=this.#Bc),this.onUndo({type:"changemasksegmentcolour",segmentnumber:this.#Qc.number,value:[this.#Bc]})}onExecute(e){}onUndo(e){}}class qc{diameter;offset1;offset2}class Uc{major;minor}class Qc{centroid;centroidIndex;volume;count;diameters;height;id;largestSliceZ}class Vc{x;y}class Nc{x;y;z}export{Qa as Annotation,io as AnnotationGroup,ka as AnnotationGroupFactory,Ec as App,xc as AppOptions,a as BooleanResult,Ba as CADReport,Mc as ChangeSegmentColourCommand,ar as Circle,nt as ColourMap,Oa as Command,cs as DataController,ne as DataElement,Fc as DeleteSegmentCommand,qc as Diameter,Uc as Diameters,En as DicomCode,ss as DicomData,Pe as DicomParser,Zr as DicomSRContent,dn as DicomWriter,Bl as DrawBrushCommand,Nl as DrawBrushCommandProperties,il as DrawController,ol as DrawLayer,Vl as DrawShapeHandler,sr as Ellipse,Ge as Geometry,to as Image,Fi as ImageContour,o as Index,Ms as InfoData,xs as InfoDataItem,Qc as Label,hl as LayerGroup,Gi as MaskFactory,yi as MaskSegment,Rc as MaskSegmentHelper,Hs as MaskSegmentViewHelper,Me as Matrix33,It as NormalisedManufacturers,l as NumberRange,s as NumberValue,at as Orientation,js as PlaneHelper,m as Point,S as Point2D,p as Point3D,_s as PositionHelper,or as Protractor,pn as RGB,rr as ROI,Ha as RTROI,za as RTROIContour,cr as Rectangle,Ee as RescaleSlopeAndIntercept,Na as ResponseEvaluation,os as RtStructFactory,xa as RunFilterCommand,Vc as Scalar2D,Nc as Scalar3D,Vs as ScrollWheelBehavior,qi as SegmentCollection,Re as Size,Fe as Spacing,Ac as StageController,G as Tag,bc as ToolConfig,Io as ToolboxController,bs as UndoController,g as Vector3D,Ws as View,Oc as ViewConfig,Ks as ViewController,Js as ViewLayer,Qs as WheelBehavior,je as WindowLevel,Ke as WindowPreset,tn as WriterRule,E as addTagsToDictionary,Ja as bufferToPolygons,b as buildMultipart,Ji as createImage,eo as createMaskImage,Xs as createView,ot as custom,wc as defaultToolList,Ua as defaultToolOptions,Ze as equalWl,te as getAsSimpleElements,$a as getDefaultDicomRTStructJson,ki as getDefaultDicomSegJson,Kr as getDicomSRContentItem,ce as getDwvVersion,Sn as getElementsFromJSONTags,lr as getEllipseIndices,ul as getLayerDetailsFromEvent,wt as getManufacturer,Do as getMousePoint,Tt as getNormalisedManufacturer,ut as getOrientationName,j as getPixelDataTag,Ya as getRTStructFromElements,ur as getRectangleIndices,Dt as getReferencedSeriesUID,yt as getReferencedSeriesUIDFromRTStruct,pe as getReverseOrientation,_r as getSRContent,ci as getSegmentationCode,H as getTagFromKey,Co as getTouchPoints,Ie as getTypedArray,on as getUID,go as getURLsFromKeyValueUri,So as handleURLsFromWeasisXMLManifest,he as hasDicomPrefix,fn as hexToRgb,f as i18n,mn as isEqualRgb,Dn as labToUintLab,r as logger,it as luts,zi as mergeMaskImages,h as precisionRound,vn as rgbToHex,ts as simplifyPolygon,wn as srgbToCielab,Ic as toolList,qa as toolOptions};
|
|
1
|
+
import{default as e}from"konva";import{default as t}from"jszip";import{default as n}from"magic-wand-tool";var i={};const o={};function r(e){const t=o[e];if(void 0!==t)return t.exports;const n=o[e]={exports:{}};return i[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.wc="undefined"!=typeof Worker?Worker:"undefined"!=typeof process&&"function"==typeof process.getBuiltinModule&&process.getBuiltinModule("node:worker_threads").Worker;class a{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create index with no values.");if(0===e.length)throw new Error("Cannot create index with empty values.");if(!e.every(function(e){return!isNaN(e)}))throw new Error("Cannot create index with non number values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return`(${this.#e.toString()})`}getValues(){return this.#e.slice()}canCompare(e){return!!e&&this.length()===e.length()}equals(e){if(!this.canCompare(e))return!1;for(let t=0,n=this.length();t<n;++t)if(this.get(t)!==e.get(t))return!1;return!0}compare(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)this.get(n)!==e.get(n)&&t.push(n);return t}add(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)t.push(this.get(n)+e.get(n));return new a(t)}#t(e,t){const n=this.#e.slice();return e<n.length?n[e]+=t:console.warn("Cannot add to given dimension: ",e,n.length),new a(n)}next(e){return this.#t(e,1)}previous(e){return this.#t(e,-1)}getWithNew2D(e,t){const n=[e,t];for(let e=2,t=this.length();e<t;++e)n.push(this.get(e));return new a(n)}}const s={levels:{TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},level:3,trace(e){this.level<=this.levels.TRACE&&console.trace(e)},debug(e){this.level<=this.levels.DEBUG&&console.debug(e)},info(e){this.level<=this.levels.INFO&&console.info(e)},warn(e){this.level<=this.levels.WARN&&console.warn(e)},error(e){this.level<=this.levels.ERROR&&console.error(e)}},l=(Number.EPSILON,1e-4);class c{min;max;constructor(e,t){this.min=e,this.max=t}}function u(e,t,n){return void 0===n&&(n=Number.EPSILON),Math.abs(e-t)<n}function d(e){let t=e>l;return t&&(t=e>.001,t?(t=e>.01,t||s.warn("Using larger+ real world epsilon")):s.warn("Using larger real world epsilon")),t}function h(e,t){const n=Math.pow(10,t),i=.01/n;return Math.round(e*n+i)/n}class g{#n;#i;#o;constructor(e,t,n){this.#n=e,this.#i=t,this.#o=n}getX(){return this.#n}getY(){return this.#i}getZ(){return this.#o}equals(e){return null!==e&&this.#n===e.getX()&&this.#i===e.getY()&&this.#o===e.getZ()}toString(){return`(${this.#n}, ${this.#i}, ${this.#o})`}norm(){return Math.sqrt(this.#n*this.#n+this.#i*this.#i+this.#o*this.#o)}crossProduct(e){return new g(this.#i*e.getZ()-e.getY()*this.#o,this.#o*e.getX()-e.getZ()*this.#n,this.#n*e.getY()-e.getX()*this.#i)}dotProduct(e){return this.#n*e.getX()+this.#i*e.getY()+this.#o*e.getZ()}isCodirectional(e){return this.dotProduct(e)>0}}class S{#n;#i;constructor(e,t){this.#n=e,this.#i=t}getX(){return this.#n}getY(){return this.#i}getValues(){return[this.#n,this.#i]}getCentroid(){return this}contains(e,t=0){return this.getDistance(e)<=t}equals(e){return null!=e&&this.#n===e.getX()&&this.#i===e.getY()}toString(){return`(${this.#n}, ${this.#i})`}getDistance(e){const t=this.#n-e.getX(),n=this.#i-e.getY();return Math.sqrt(t*t+n*n)}}class m{#n;#i;#o;constructor(e,t,n){this.#n=e,this.#i=t,this.#o=n}getX(){return this.#n}getY(){return this.#i}getZ(){return this.#o}getValues(){return[this.#n,this.#i,this.#o]}equals(e){return null!==e&&this.#n===e.getX()&&this.#i===e.getY()&&this.#o===e.getZ()}isSimilar(e,t){return null!==e&&u(this.#n,e.getX(),t)&&u(this.#i,e.getY(),t)&&u(this.#o,e.getZ(),t)}toString(){return`(${this.#n}, ${this.#i}, ${this.#o})`}getDistance(e){return Math.sqrt(this.#r(e))}#r(e){const t=this.#n-e.getX(),n=this.#i-e.getY(),i=this.#o-e.getZ();return t*t+n*n+i*i}getClosest(e){let t=0,n=this.#r(e[t]);for(let i=0;i<e.length;++i){const o=this.#r(e[i]);o<n&&(t=i,n=o)}return t}minus(e){return new g(this.#n-e.getX(),this.#i-e.getY(),this.#o-e.getZ())}}function p(e){return function(t){return t.equals(e)}}function f(e,t){return e.some(function(e){return t.equals(e)})}function v(e){return new m(e[0],e[1],e[2])}class C{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create point with no values.");if(0===e.length)throw new Error("Cannot create point with empty values.");if(!e.every(function(e){return!isNaN(e)}))throw new Error("Cannot create point with non number values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return`(${this.#e.toString()})`}getValues(){return this.#e.slice()}canCompare(e){return!!e&&this.length()===e.length()}equals(e){if(!this.canCompare(e))return!1;for(let t=0,n=this.length();t<n;++t)if(this.get(t)!==e.get(t))return!1;return!0}compare(e){if(!this.canCompare(e))return null;const t=[];for(let n=0,i=this.length();n<i;++n)this.get(n)!==e.get(n)&&t.push(n);return t}get3D(){return new m(this.get(0),this.get(1),this.get(2))}add(e){if(!this.canCompare(e))return null;const t=[],n=this.getValues(),i=e.getValues();for(let e=0;e<n.length;++e)t.push(n[e]+i[e]);return new C(t)}mergeWith3D(e){const t=this.getValues();return t[0]=e.getX(),t[1]=e.getY(),t[2]=e.getZ(),new C(t)}}const D={t(e){let t=e;const n=e.split(".");return 2===n.length&&"unit"===n[0]&&(t={mm:"mm",cm2:"cm²",ml:"ml",degree:"°",pixel:"pixels",ms:"ms",s:"s",smm2:"s/mm²"}[n[1]]),t}};function y(e,t){return null!=e&&null!=t&&e.substring(e.length-t.length)===t}function I(e){const t=[];if(null==e)return t;const n=/{(\w+)}/g;let i=n.exec(e);for(;i;)t.push(i[1]),i=n.exec(e);return t}function T(e){let t;if(null!=e&&"."!==e[0]){const n=e.toLowerCase().split(".");1!==n.length&&(t=n.pop(),/[a-z]/.test(t)&&!t.includes("/")||(t=void 0))}return t}function w(e){const t=new Uint8Array(e.length);for(let n=0,i=e.length;n<i;n++)t[n]=e.charCodeAt(n);return t}function L(e,t){if(void 0===t){t=[];for(let n=0;n<e.length;++n)t.push(n)}for(let n=0;n<t.length;++n)if(t[n]>=e.length)throw new Error("Non valid dimension for toStringId");let n="";for(let i=0;i<t.length;++i)0!==i&&(n+="_"),n+=`#${t[i]}-${e[t[i]]}`;return n}function P(e,t,n){let i=e.map((e,i)=>function(e,t,n){return void 0===e?t:void 0===t?e:n(e,t)}(e,t[i],n));return t.length>e.length&&(i=i.concat(t.slice(e.length))),i}function A(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&O(e.slice().sort(),t.slice().sort())}function O(e,t){return null!==e&&null!==t&&void 0!==e&&void 0!==t&&e.length===t.length&&e.every(function(e,n){return e===t[n]})}function b(e){return String.fromCharCode(...e)}function x(e,t,n,i){(void 0===n||n<0||n>=e.length)&&(n=0),(void 0===i||i<=n||i>e.length)&&(i=e.length);for(let o=n;o<i;++o)if(t(e[o],o,e))return o}function E(e){return function(t,n,i){for(let t=0;t<e.length;++t)if(i[n+t]!==e[t])return!1;return!0}}function R(e,t){const n="\r\n";let i=0;const o=[];for(let r=0;r<e.length;++r){let a="";0!==r&&(a+=n),a+=`--${t}${n}`;const s=Object.keys(e[r]);for(let t=0;t<s.length;++t){const i=s[t];"data"!==i&&(a+=`${i}: ${e[r][i]}${n}`)}a+=n;const l=w(a);o.push(l),i+=l.byteLength+e[r].data.byteLength}const r=w(`${n}--${t}--${n}`),a=new Uint8Array(i+r.byteLength);let s=0;for(let t=0;t<e.length;++t)a.set(o[t],s),s+=o[t].byteLength,a.set(new Uint8Array(e[t].data),s),s+=e[t].data.byteLength;return a.set(r,s),a}class F{#a;#s;constructor(e,t){if(!e||void 0===e)throw new Error("Cannot create tag with no group.");if(4!==e.length)throw new Error(`Cannot create tag with badly sized group: ${e}`);if(!t||void 0===t)throw new Error("Cannot create tag with no element.");if(4!==t.length)throw new Error(`Cannot create tag with badly sized element: ${t}`);this.#a=e,this.#s=t}getGroup(){return this.#a}getElement(){return this.#s}toString(){return`(${this.#a},${this.#s})`}equals(e){return null!=e&&this.#a===e.getGroup()&&this.#s===e.getElement()}getKey(){return this.#a+this.#s}isWithVR(){return!("FFFE"===this.#a&&("E000"===this.#s||"E00D"===this.#s||"E0DD"===this.#s))}isPrivate(){return parseInt(this.#a,16)%2==1}}function M(e,t){let n=parseInt(e.getGroup(),16)-parseInt(t.getGroup(),16);return 0===n&&(n=parseInt(e.getElement(),16)-parseInt(t.getElement(),16)),n}function q(e){if(!e||void 0===e)throw new Error("Cannot create tag with no key.");if(8!==e.length)throw new Error(`Cannot create tag with badly sized key: ${e}`);return new F(e.substring(0,4),e.substring(4,8))}function U(){return new F("FFFE","E000")}function Q(e){return"FFFEE000"===e.getKey()}function V(){return new F("FFFE","E00D")}function N(e){return"FFFEE00D"===e.getKey()}function B(){return new F("FFFE","E0DD")}function k(e){return"FFFEE0DD"===e.getKey()}function G(){return new F("7FE0","0010")}function z(e){return["7FE00010","7FE00009","7FE00008"].includes(e.getKey())}function H(e){const t=["7FE00010","7FE00009","7FE00008"];let n;for(const i of t)if(void 0!==e[i]){n=e[i];break}return n}function X(e){return void 0!==H(e)}const Y=/*#__PURE__*/JSON.parse('{"1000":{"0000":["UL","1","GenericGroupLength"],"0010":["US","3","EscapeTriplet"],"0011":["US","3","RunLengthTriplet"],"0012":["US","1","HuffmanTableSize"],"0013":["US","3","HuffmanTableTriplet"],"0014":["US","1","ShiftTableSize"],"0015":["US","3","ShiftTableTriplet"]},"1010":{"0000":["UL","1","GenericGroupLength"],"0004":["US","1-n","ZonalMap"]},"2000":{"0000":["UL","1","GenericGroupLength"],"0010":["IS","1","NumberOfCopies"],"001E":["SQ","1","PrinterConfigurationSequence"],"0020":["CS","1","PrintPriority"],"0030":["CS","1","MediumType"],"0040":["CS","1","FilmDestination"],"0050":["LO","1","FilmSessionLabel"],"0060":["IS","1","MemoryAllocation"],"0061":["IS","1","MaximumMemoryAllocation"],"0062":["CS","1","ColorImagePrintingFlag"],"0063":["CS","1","CollationFlag"],"0065":["CS","1","AnnotationFlag"],"0067":["CS","1","ImageOverlayFlag"],"0069":["CS","1","PresentationLUTFlag"],"006A":["CS","1","ImageBoxPresentationLUTFlag"],"00A0":["US","1","MemoryBitDepth"],"00A1":["US","1","PrintingBitDepth"],"00A2":["SQ","1","MediaInstalledSequence"],"00A4":["SQ","1","OtherMediaAvailableSequence"],"00A8":["SQ","1","SupportedImageDisplayFormatsSequence"],"0500":["SQ","1","ReferencedFilmBoxSequence"],"0510":["SQ","1","ReferencedStoredPrintSequence"]},"2010":{"0000":["UL","1","GenericGroupLength"],"0010":["ST","1","ImageDisplayFormat"],"0030":["CS","1","AnnotationDisplayFormatID"],"0040":["CS","1","FilmOrientation"],"0050":["CS","1","FilmSizeID"],"0052":["CS","1","PrinterResolutionID"],"0054":["CS","1","DefaultPrinterResolutionID"],"0060":["CS","1","MagnificationType"],"0080":["CS","1","SmoothingType"],"00A6":["CS","1","DefaultMagnificationType"],"00A7":["CS","1-n","OtherMagnificationTypesAvailable"],"00A8":["CS","1","DefaultSmoothingType"],"00A9":["CS","1-n","OtherSmoothingTypesAvailable"],"0100":["CS","1","BorderDensity"],"0110":["CS","1","EmptyImageDensity"],"0120":["US","1","MinDensity"],"0130":["US","1","MaxDensity"],"0140":["CS","1","Trim"],"0150":["ST","1","ConfigurationInformation"],"0152":["LT","1","ConfigurationInformationDescription"],"0154":["IS","1","MaximumCollatedFilms"],"015E":["US","1","Illumination"],"0160":["US","1","ReflectedAmbientLight"],"0376":["DS","2","PrinterPixelSpacing"],"0500":["SQ","1","ReferencedFilmSessionSequence"],"0510":["SQ","1","ReferencedImageBoxSequence"],"0520":["SQ","1","ReferencedBasicAnnotationBoxSequence"]},"2020":{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","ImageBoxPosition"],"0020":["CS","1","Polarity"],"0030":["DS","1","RequestedImageSize"],"0040":["CS","1","RequestedDecimateCropBehavior"],"0050":["CS","1","RequestedResolutionID"],"00A0":["CS","1","RequestedImageSizeFlag"],"00A2":["CS","1","DecimateCropResult"],"0110":["SQ","1","BasicGrayscaleImageSequence"],"0111":["SQ","1","BasicColorImageSequence"],"0130":["SQ","1","ReferencedImageOverlayBoxSequence"],"0140":["SQ","1","ReferencedVOILUTBoxSequence"]},"2030":{"0000":["UL","1","GenericGroupLength"],"0010":["US","1","AnnotationPosition"],"0020":["LO","1","TextString"]},"2040":{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","ReferencedOverlayPlaneSequence"],"0011":["US","1-99","ReferencedOverlayPlaneGroups"],"0020":["SQ","1","OverlayPixelDataSequence"],"0060":["CS","1","OverlayMagnificationType"],"0070":["CS","1","OverlaySmoothingType"],"0072":["CS","1","OverlayOrImageMagnification"],"0074":["US","1","MagnifyToNumberOfColumns"],"0080":["CS","1","OverlayForegroundDensity"],"0082":["CS","1","OverlayBackgroundDensity"],"0090":["CS","1","OverlayMode"],"0100":["CS","1","ThresholdDensity"],"0500":["SQ","1","ReferencedImageBoxSequenceRetired"]},"2050":{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","PresentationLUTSequence"],"0020":["CS","1","PresentationLUTShape"],"0500":["SQ","1","ReferencedPresentationLUTSequence"]},"2100":{"0000":["UL","1","GenericGroupLength"],"0010":["SH","1","PrintJobID"],"0020":["CS","1","ExecutionStatus"],"0030":["CS","1","ExecutionStatusInfo"],"0040":["DA","1","CreationDate"],"0050":["TM","1","CreationTime"],"0070":["AE","1","Originator"],"0140":["AE","1","DestinationAE"],"0160":["SH","1","OwnerID"],"0170":["IS","1","NumberOfFilms"],"0500":["SQ","1","ReferencedPrintJobSequencePullStoredPrint"]},"2110":{"0000":["UL","1","GenericGroupLength"],"0010":["CS","1","PrinterStatus"],"0020":["CS","1","PrinterStatusInfo"],"0030":["LO","1","PrinterName"],"0099":["SH","1","PrintQueueID"]},"2120":{"0000":["UL","1","GenericGroupLength"],"0010":["CS","1","QueueStatus"],"0050":["SQ","1","PrintJobDescriptionSequence"],"0070":["SQ","1","ReferencedPrintJobSequence"]},"2130":{"0000":["UL","1","GenericGroupLength"],"0010":["SQ","1","PrintManagementCapabilitiesSequence"],"0015":["SQ","1","PrinterCharacteristicsSequence"],"0030":["SQ","1","FilmBoxContentSequence"],"0040":["SQ","1","ImageBoxContentSequence"],"0050":["SQ","1","AnnotationContentSequence"],"0060":["SQ","1","ImageOverlayBoxContentSequence"],"0080":["SQ","1","PresentationLUTContentSequence"],"00A0":["SQ","1","ProposedStudySequence"],"00C0":["SQ","1","OriginalImageSequence"]},"2200":{"0000":["UL","1","GenericGroupLength"],"0001":["CS","1","LabelUsingInformationExtractedFromInstances"],"0002":["UT","1","LabelText"],"0003":["CS","1","LabelStyleSelection"],"0004":["LT","1","MediaDisposition"],"0005":["LT","1","BarcodeValue"],"0006":["CS","1","BarcodeSymbology"],"0007":["CS","1","AllowMediaSplitting"],"0008":["CS","1","IncludeNonDICOMObjects"],"0009":["CS","1","IncludeDisplayApplication"],"000A":["CS","1","PreserveCompositeInstancesAfterMediaCreation"],"000B":["US","1","TotalNumberOfPiecesOfMediaCreated"],"000C":["LO","1","RequestedMediaApplicationProfile"],"000D":["SQ","1","ReferencedStorageMediaSequence"],"000E":["AT","1-n","FailureAttributes"],"000F":["CS","1","AllowLossyCompression"],"0020":["CS","1","RequestPriority"]},"3002":{"0000":["UL","1","GenericGroupLength"],"0002":["SH","1","RTImageLabel"],"0003":["LO","1","RTImageName"],"0004":["ST","1","RTImageDescription"],"000A":["CS","1","ReportedValuesOrigin"],"000C":["CS","1","RTImagePlane"],"000D":["DS","3","XRayImageReceptorTranslation"],"000E":["DS","1","XRayImageReceptorAngle"],"0010":["DS","6","RTImageOrientation"],"0011":["DS","2","ImagePlanePixelSpacing"],"0012":["DS","2","RTImagePosition"],"0020":["SH","1","RadiationMachineName"],"0022":["DS","1","RadiationMachineSAD"],"0024":["DS","1","RadiationMachineSSD"],"0026":["DS","1","RTImageSID"],"0028":["DS","1","SourceToReferenceObjectDistance"],"0029":["IS","1","FractionNumber"],"0030":["SQ","1","ExposureSequence"],"0032":["DS","1","MetersetExposure"],"0034":["DS","4","DiaphragmPosition"],"0040":["SQ","1","FluenceMapSequence"],"0041":["CS","1","FluenceDataSource"],"0042":["DS","1","FluenceDataScale"],"0050":["SQ","1","PrimaryFluenceModeSequence"],"0051":["CS","1","FluenceMode"],"0052":["SH","1","FluenceModeID"],"0100":["IS","1","SelectedFrameNumber"],"0101":["SQ","1","SelectedFrameFunctionalGroupsSequence"],"0102":["SQ","1","RTImageFrameGeneralContentSequence"],"0103":["SQ","1","RTImageFrameContextSequence"],"0104":["SQ","1","RTImageScopeSequence"],"0105":["CS","1","BeamModifierCoordinatesPresenceFlag"],"0106":["FD","1","StartCumulativeMeterset"],"0107":["FD","1","StopCumulativeMeterset"],"0108":["SQ","1","RTAcquisitionPatientPositionSequence"],"0109":["SQ","1","RTImageFrameImagingDevicePositionSequence"],"010A":["SQ","1","RTImageFramekVRadiationAcquisitionSequence"],"010B":["SQ","1","RTImageFrameMVRadiationAcquisitionSequence"],"010C":["SQ","1","RTImageFrameRadiationAcquisitionSequence"],"010D":["SQ","1","ImagingSourcePositionSequence"],"010E":["SQ","1","ImageReceptorPositionSequence"],"010F":["FD","16","DevicePositionToEquipmentMappingMatrix"],"0110":["SQ","1","DevicePositionParameterSequence"],"0111":["CS","1","ImagingSourceLocationSpecificationType"],"0112":["SQ","1","ImagingDeviceLocationMatrixSequence"],"0113":["SQ","1","ImagingDeviceLocationParameterSequence"],"0114":["SQ","1","ImagingApertureSequence"],"0115":["CS","1","ImagingApertureSpecificationType"],"0116":["US","1","NumberOfAcquisitionDevices"],"0117":["SQ","1","AcquisitionDeviceSequence"],"0118":["SQ","1","AcquisitionTaskSequence"],"0119":["SQ","1","AcquisitionTaskWorkitemCodeSequence"],"011A":["SQ","1","AcquisitionSubtaskSequence"],"011B":["SQ","1","SubtaskWorkitemCodeSequence"],"011C":["US","1","AcquisitionTaskIndex"],"011D":["US","1","AcquisitionSubtaskIndex"],"011E":["SQ","1","ReferencedBaselineParametersRTRadiationInstanceSequence"],"011F":["SQ","1","PositionAcquisitionTemplateIdentificationSequence"],"0120":["ST","1","PositionAcquisitionTemplateID"],"0121":["LO","1","PositionAcquisitionTemplateName"],"0122":["SQ","1","PositionAcquisitionTemplateCodeSequence"],"0123":["LT","1","PositionAcquisitionTemplateDescription"],"0124":["SQ","1","AcquisitionTaskApplicabilitySequence"],"0125":["SQ","1","ProjectionImagingAcquisitionParameterSequence"],"0126":["SQ","1","CTImagingAcquisitionParameterSequence"],"0127":["SQ","1","KVImagingGenerationParametersSequence"],"0128":["SQ","1","MVImagingGenerationParametersSequence"],"0129":["CS","1","AcquisitionSignalType"],"012A":["CS","1","AcquisitionMethod"],"012B":["SQ","1","ScanStartPositionSequence"],"012C":["SQ","1","ScanStopPositionSequence"],"012D":["FD","1","ImagingSourceToBeamModifierDefinitionPlaneDistance"],"012E":["CS","1","ScanArcType"],"012F":["CS","1","DetectorPositioningType"],"0130":["SQ","1","AdditionalRTAccessoryDeviceSequence"],"0131":["SQ","1","DeviceSpecificAcquisitionParameterSequence"],"0132":["SQ","1","ReferencedPositionReferenceInstanceSequence"],"0133":["SQ","1","EnergyDerivationCodeSequence"],"0134":["FD","1","MaximumCumulativeMetersetExposure"],"0135":["SQ","1","AcquisitionInitiationSequence"]},"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"],"002D":["DT","1","ROIDateTime"],"002E":["DT","1","ROIObservationDateTime"],"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"],"004B":["SQ","1","SourceSeriesSequence"],"004C":["SQ","1","SourceSeriesInformationSequence"],"004D":["SQ","1","ROICreatorSequence"],"004E":["SQ","1","ROIInterpreterSequence"],"004F":["SQ","1","ROIObservationContextCodeSequence"],"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"],"00A1":["SQ","1","EnhancedRTBeamLimitingDeviceSequence"],"00A2":["SQ","1","EnhancedRTBeamLimitingOpeningSequence"],"00A3":["CS","1","EnhancedRTBeamLimitingDeviceDefinitionFlag"],"00A4":["FD","2-2n","ParallelRTBeamDelimiterOpeningExtents"],"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"],"00A0":["SQ","1","ConceptualVolumeIdentificationSequence"]},"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"],"1088":["LO","1","PyramidDescription"],"1090":["LO","1","ManufacturerModelName"],"1100":["SQ","1","ReferencedResultsSequence"],"1110":["SQ","1","ReferencedStudySequence"],"1111":["SQ","1","ReferencedPerformedProcedureStepSequence"],"1112":["SQ","1","ReferencedInstancesBySOPClassSequence"],"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-5","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"],"0017":["UI","1","AcquisitionUID"],"0018":["UI","1","SOPInstanceUID"],"0019":["UI","1","PyramidUID"],"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"],"0400":["SQ","1","ScopeOfInventorySequence"],"0401":["LT","1","InventoryPurpose"],"0402":["LT","1","InventoryInstanceDescription"],"0403":["CS","1","InventoryLevel"],"0404":["DT","1","ItemInventoryDateTime"],"0405":["CS","1","RemovedFromOperationalUse"],"0406":["SQ","1","ReasonForRemovalCodeSequence"],"0407":["UR","1","StoredInstanceBaseURI"],"0408":["UR","1","FolderAccessURI"],"0409":["UR","1","FileAccessURI"],"040A":["CS","1","ContainerFileType"],"040B":["UR","1","FilenameInContainer"],"040C":["UV","1","FileOffsetInContainer"],"040D":["UV","1","FileLengthInContainer"],"040E":["UI","1","StoredInstanceTransferSyntaxUID"],"040F":["CS","1-n","ExtendedMatchingMechanisms"],"0410":["SQ","1","RangeMatchingSequence"],"0411":["SQ","1","ListOfUIDMatchingSequence"],"0412":["SQ","1","EmptyValueMatchingSequence"],"0413":["SQ","1","GeneralMatchingSequence"],"0414":["US","1","RequestedStatusInterval"],"0415":["CS","1","RetainInstances"],"0416":["DT","1","ExpirationDateTime"],"0417":["CS","1","TransactionStatus"],"0418":["LT","1","TransactionStatusComment"],"0419":["SQ","1","FileSetAccessSequence"],"041A":["SQ","1","FileAccessSequence"],"041B":["OB","1","RecordKey"],"041C":["OB","1","PriorRecordKey"],"041D":["SQ","1","MetadataSequence"],"041E":["SQ","1","UpdatedMetadataSequence"],"041F":["DT","1","StudyUpdateDateTime"],"0420":["SQ","1","InventoryAccessEndPointsSequence"],"0421":["SQ","1","StudyAccessEndPointsSequence"],"0422":["SQ","1","IncorporatedInventoryInstanceSequence"],"0423":["SQ","1","InventoriedStudiesSequence"],"0424":["SQ","1","InventoriedSeriesSequence"],"0425":["SQ","1","InventoriedInstancesSequence"],"0426":["CS","1","InventoryCompletionStatus"],"0427":["UL","1","NumberOfStudyRecordsInInstance"],"0428":["UV","1","TotalNumberOfStudyRecords"],"0429":["UV","1","MaximumNumberOfRecords"],"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"],"119B":["SQ","1","FailedStudySequence"],"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"],"0054":["SQ","1","ClinicalTrialTimePointTypeCodeSequence"],"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"],"0200":["SQ","1","DataElementLabelSequence"],"0201":["SQ","1","DataElementLabelItemSequence"],"0202":["AT","1","DataElement"],"0203":["LO","1","DataElementName"],"0204":["LO","1","DataElementDescription"],"0205":["CS","1","DataElementConditionality"],"0206":["IS","1","DataElementMinimumCharacters"],"0207":["IS","1","DataElementMaximumCharacters"],"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"],"1204":["DA","1","DateOfManufacture"],"1205":["DA","1","DateOfInstallation"],"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"],"9821":["SQ","1","PhotoacousticExcitationCharacteristicsSequence"],"9822":["FD","1","ExcitationSpectralWidth"],"9823":["FD","1","ExcitationEnergy"],"9824":["FD","1","ExcitationPulseDuration"],"9825":["SQ","1","ExcitationWavelengthSequence"],"9826":["FD","1","ExcitationWavelength"],"9828":["CS","1","IlluminationTranslationFlag"],"9829":["CS","1","AcousticCouplingMediumFlag"],"9830":["FD","1","UpperCutoffFrequency"],"9831":["SQ","1","TransducerTechnologySequence"],"9832":["SQ","1","SoundSpeedCorrectionMechanismCodeSequence"],"9833":["FD","1","ObjectSoundSpeed"],"9834":["FD","1","AcousticCouplingMediumSoundSpeed"],"9835":["SQ","1","PhotoacousticImageFrameTypeSequence"],"9836":["SQ","1","ImageDataTypeCodeSequence"],"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"],"982A":["SQ","1","AcousticCouplingMediumCodeSequence"],"982B":["FD","1","AcousticCouplingMediumTemperature"],"982C":["SQ","1","TransducerResponseSequence"],"982D":["FD","1","CenterFrequency"],"982E":["FD","1","FractionalBandwidth"],"982F":["FD","1","LowerCutoffFrequency"],"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"],"0027":["LO","1","PyramidLabel"],"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"],"3001":["SQ","1","VariableModalityLUTSequence"],"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"],"0317":["CS","1","WaveformAmplifierType"],"0318":["SQ","1","FilterLowFrequencyCharacteristicsSequence"],"0319":["SQ","1","FilterHighFrequencyCharacteristicsSequence"],"0320":["SQ","1","SummarizedFilterLookupTable"],"0321":["SQ","1","NotchFilterCharacteristicsSequence"],"0322":["CS","1","WaveformFilterType"],"0323":["SQ","1","AnalogFilterCharacteristicsSequence"],"0324":["DS","1","AnalogFilterRollOff"],"0325":["SQ","1","AnalogFilterType"],"0326":["SQ","1","DigitalFilterCharacteristicsSequence"],"0327":["IS","1","DigitalFilterOrder"],"0328":["SQ","1","DigitalFilterTypeCodeSequence"],"0329":["ST","1","WaveformFilterDescription"],"032A":["SQ","1","FilterLookupTableSequence"],"032B":["ST","1","FilterLookupTableDescription"],"032C":["SQ","1","FrequencyEncodingCodeSequence"],"032D":["SQ","1","MagnitudeEncodingCodeSequence"],"032E":["OD","1","FilterLookupTableData"]},"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"],"0114":["CS","1","ConfocalMode"],"0115":["CS","1","TissueLocation"],"0116":["SQ","1","ConfocalMicroscopyImageFrameTypeSequence"],"0117":["FD","1","ImageAcquisitionDepth"],"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"],"0315":["SQ","1","UsedRTStructureSetROISequence"],"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"],"068B":["CS","1","DoseValueInterpretation"],"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"],"0129":["CS","1","BeamHoldTransitionTriggerSource"]},"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"],"0003":["UV","1","EncapsulatedPixelDataValueTotalLength"],"0008":["OF","1","FloatPixelData"],"0009":["OD","1","DoubleFloatPixelData"],"0010":["ox","1","PixelData"],"0020":["OW","1","CoefficientsSDVN"],"0030":["OW","1","CoefficientsSDHN"],"0040":["OW","1","CoefficientsSDDN"]},"FFFA":{"0000":["UL","1","GenericGroupLength"],"FFFA":["SQ","1","DigitalSignaturesSequence"]},"FFFC":{"0000":["UL","1","GenericGroupLength"],"FFFC":["OB","1","DataSetTrailingPadding"]},"FFFE":{"0000":["UL","1","GenericGroupLength"],"E000":["NONE","1","Item"],"E00D":["NONE","1","ItemDelimitationItem"],"E0DD":["NONE","1","SequenceDelimitationItem"]}}');function W(e,t){Y[e]=t}const $={"0000":"Command","0002":"Meta Element","0004":"File Set","0008":"Identifying","0009":"SPI Identifying","0010":"Patient","0012":"Clinical Trial","0018":"Acquisition","0019":"SPI Acquisition","0020":"Image","0021":"SPI Image","0022":"Ophthalmology","0028":"Image Presentation","0032":"Study","0038":"Visit","003A":"Waveform","0040":"Procedure","0042":"Encapsulated Document","0050":"Device Information","0054":"Nuclear Medicine","0060":"Histogram","0070":"Presentation State","0072":"Hanging Protocol","0088":"Storage","0100":"Authorization","0400":"Digital Signature",1e3:"Code Table",1010:"Zonal Map",2e3:"Film Session",2010:"Film Box",2020:"Image Box",2030:"Annotation",2040:"Overlay Box",2050:"Presentation LUT",2100:"Print Job",2110:"Printer",2120:"Queue",2130:"Print Content",2200:"Media Creation",3002:"RT Image",3004:"RT Dose",3006:"RT StructureSet",3008:"RT Treatment","300A":"RT Plan","300C":"RT Relationship","300E":"RT Approval",4e3:"Text",4008:"Results","4FFE":"MAC Parameters",5e3:"Curve",5002:"Curve",5004:"Curve",5006:"Curve",5008:"Curve","500A":"Curve","500C":"Curve","500E":"Curve",5010:"Curve",5012:"Curve",5014:"Curve",5016:"Curve",5018:"Curve","501A":"Curve","501C":"Curve","501E":"Curve",5400:"Waveform Data",6e3:"Overlays",6002:"Overlays",6004:"Overlays",6006:"Overlays",6008:"Overlays","600A":"Overlays","600C":"Overlays","600E":"Overlays",6010:"Overlays",6012:"Overlays",6014:"Overlays",6016:"Overlays",6018:"Overlays","601A":"Overlays","601C":"Overlays","601E":"Overlays",FFFC:"Generic","7FE0":"Pixel Data",FFFF:"Unknown"},j={OB:!0,OD:!0,OF:!0,OL:!0,OV:!0,OW:!0,SQ:!0,SV:!0,UC:!0,UN:!0,UR:!0,UT:!0,UV:!0,ox:!0};function Z(e){return void 0!==j[e]}const K={SH:!0,LO:!0,UC:!0,ST:!0,LT:!0,UT:!0,PN:!0};function _(e){return void 0!==K[e]}const J={AE:"string",AS:"string",AT:void 0,CS:"string",DA:"string",DS:"string",DT:"string",FL:"Float32",FD:"Float64",IS:"string",LO:"string",LT:"string",OB:"Uint8",OD:"Uint64",OF:"Uint32",OL:"Uint32",OV:"Uint64",OW:"Uint16",PN:"string",SH:"string",SL:"Int32",SQ:void 0,SS:"Int16",ST:"string",SV:"Int64",TM:"string",UC:"string",UI:"string",UL:"Uint32",UN:"Uint8",UR:"string",US:"Uint16",UT:"string",UV:"Uint64"},ee={"1.2.840.10008.1.2":"Implicit VR Little Endian","1.2.840.10008.1.2.1":"Explicit VR Little Endian","1.2.840.10008.1.2.1.98":"Encapsulated Uncompressed Explicit VR Little Endian","1.2.840.10008.1.2.1.99":"Deflated Explicit VR Little Endian","1.2.840.10008.1.2.2":"Explicit VR Big Endian (Retired)","1.2.840.10008.1.2.4.50":"JPEG Baseline (Process 1)","1.2.840.10008.1.2.4.51":"JPEG Extended (Process 2 & 4)","1.2.840.10008.1.2.4.52":"JPEG Extended (Process 3 & 5) (Retired)","1.2.840.10008.1.2.4.53":"JPEG Spectral Selection, Non-Hierarchical (Process 6 & 8) (Retired)","1.2.840.10008.1.2.4.54":"JPEG Spectral Selection, Non-Hierarchical (Process 7 & 9) (Retired)","1.2.840.10008.1.2.4.55":"JPEG Full Progression, Non-Hierarchical (Process 10 & 12) (Retired)","1.2.840.10008.1.2.4.56":"JPEG Full Progression, Non-Hierarchical (Process 11 & 13) (Retired)","1.2.840.10008.1.2.4.57":"JPEG Lossless, Non-Hierarchical (Process 14)","1.2.840.10008.1.2.4.58":"JPEG Lossless, Non-Hierarchical (Process 15) (Retired)","1.2.840.10008.1.2.4.59":"JPEG Extended, Hierarchical (Process 16 & 18) (Retired)","1.2.840.10008.1.2.4.60":"JPEG Extended, Hierarchical (Process 17 & 19) (Retired)","1.2.840.10008.1.2.4.61":"JPEG Spectral Selection, Hierarchical (Process 20 & 22) (Retired)","1.2.840.10008.1.2.4.62":"JPEG Spectral Selection, Hierarchical (Process 21 & 23) (Retired)","1.2.840.10008.1.2.4.63":"JPEG Full Progression, Hierarchical (Process 24 & 26) (Retired)","1.2.840.10008.1.2.4.64":"JPEG Full Progression, Hierarchical (Process 25 & 27) (Retired)","1.2.840.10008.1.2.4.65":"JPEG Lossless, Hierarchical (Process 28) (Retired)","1.2.840.10008.1.2.4.66":"JPEG Lossless, Hierarchical (Process 29) (Retired)","1.2.840.10008.1.2.4.70":"JPEG Lossless, Non-Hierarchical, First-Order Prediction (Process 14 [Selection Value 1])","1.2.840.10008.1.2.4.80":"JPEG-LS Lossless Image Compression","1.2.840.10008.1.2.4.81":"JPEG-LS Lossy (Near-Lossless) Image Compression","1.2.840.10008.1.2.4.90":"JPEG 2000 Image Compression (Lossless Only)","1.2.840.10008.1.2.4.91":"JPEG 2000 Image Compression","1.2.840.10008.1.2.4.92":"JPEG 2000 Part 2 Multi-component Image Compression (Lossless Only)","1.2.840.10008.1.2.4.93":"JPEG 2000 Part 2 Multi-component Image Compression","1.2.840.10008.1.2.4.94":"JPIP Referenced","1.2.840.10008.1.2.4.95":"JPIP Referenced Deflate","1.2.840.10008.1.2.4.100":"MPEG2 Main Profile / Main Level","1.2.840.10008.1.2.4.100.1":"Fragmentable 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.101.1":"Fragmentable 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.102.1":"Fragmentable 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.103.1":"Fragmentable 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.104.1":"Fragmentable 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.105.1":"Fragmentable 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.106.1":"Fragmentable 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.4.201":"High-Throughput JPEG 2000 Image Compression (Lossless Only)","1.2.840.10008.1.2.4.202":"High-Throughput JPEG 2000 with RPCL Options Image Compression (Lossless Only)","1.2.840.10008.1.2.4.203":"High-Throughput JPEG 2000 Image Compression","1.2.840.10008.1.2.4.204":"JPIP HTJ2K Referenced","1.2.840.10008.1.2.4.205":"JPIP HTJ2K Referenced Deflate","1.2.840.10008.1.2.5":"RLE Lossless","1.2.840.10008.1.2.6.1":"RFC 2557 MIME encapsulation (Retired)","1.2.840.10008.1.2.6.2":"XML Encoding (Retired)","1.2.840.10008.1.2.7.1":"SMPTE ST 2110-20 Uncompressed Progressive Active Video","1.2.840.10008.1.2.7.2":"SMPTE ST 2110-20 Uncompressed Interlaced Active Video","1.2.840.10008.1.2.7.3":"SMPTE ST 2110-30 PCM Digital Audio","1.2.840.10008.1.20":"Papyrus 3 Implicit VR Little Endian (Retired)"},te="1.2.840.10008.1.2",ne="1.2.840.10008.1.2.1",ie="1.2.840.10008.1.2.2";class oe{#l;#c;#u;constructor(e,t,n){this.#l=e,this.#c=t,this.#u=n}getVr(){return this.#l}getMultiplicity(){return this.#c}getName(){return this.#u}}function re(e){if(void 0===e)return;let t;const n=e.getGroup(),i=e.getElement();if(void 0!==Y[n]&&void 0!==Y[n][i]){const e=Y[n][i];t=new oe(e[0],parseInt(e[1],10),e[2])}return t}function ae(e){return $[e.getGroup()]}function se(e){if(null==e)return;const t=Object.keys(Y);for(const n of t){const t=Object.keys(Y[n]);for(const i of t)if(Y[n][i][2]===e)return new F(n,i)}}class le{vr;value;tag;vl;undefinedLength;startOffset;endOffset;items;constructor(e){this.vr=e}}function ce(e){return void 0!==e&&void 0!==e.value&&0!==e.value.length}function ue(e,t){let n;return ce(e[t])&&(n=e[t].value[0]),n}function de(e,t){let n;return ce(e[t])&&(n=e[t].value),n}function he(e,t,n){let i="";if(void 0===e)i+=` ${t} is undefined,`;else if(void 0===e.value)i+=` ${t} has undefined value,`;else if(0===e.value.length)i+=` ${t} is empty,`;else if(void 0!==n)for(let o=0;o<n.length;++o)e.value.includes(n[o])||(i+=` ${t} does not contain ${n[o]} (value: ${e.value}),`);return i}function ge(){return new Int8Array(new Int16Array([1]).buffer)[0]>0}function Se(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 me{#d;#h=!0;#g=ge();#S;#m;constructor(e,t){this.#d=e,void 0!==t&&(this.#h=t),this.#S=this.#h!==this.#g,this.#m=new DataView(e)}readUint16(e){return this.#m.getUint16(e,this.#h)}readInt16(e){return this.#m.getInt16(e,this.#h)}readUint32(e){return this.#m.getUint32(e,this.#h)}readBigUint64(e){return this.#m.getBigUint64(e,this.#h)}readInt32(e){return this.#m.getInt32(e,this.#h)}readBigInt64(e){return this.#m.getBigInt64(e,this.#h)}readFloat32(e){return this.#m.getFloat32(e,this.#h)}readFloat64(e){return this.#m.getFloat64(e,this.#h)}readBinaryArray(e,t,n){const i=new Uint8Array(this.#d,e,t);let o;o=void 0!==n?n:8*i.length;const r=new Uint8Array(o);let a,s;for(let e=0;e<o;++e)a=e%8,s=Math.floor(e/8),r[e]=255*!!(i[s]&1<<a);return r}readUint8Array(e,t){return new Uint8Array(this.#d,e,t)}readInt8Array(e,t){return new Int8Array(this.#d,e,t)}readUint16Array(e,t){const n=Uint16Array.BYTES_PER_ELEMENT,i=t/n;let o;if(e%n===0)o=new Uint16Array(this.#d,e,i),this.#S&&Se(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&&Se(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&&Se(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&&Se(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&&Se(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&&Se(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&&Se(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&&Se(o);else{o=new Float64Array(i);let t=e;for(let e=0;e<i;++e)o[e]=this.readFloat64(t),t+=n}return o}readHex(e){const t=this.readUint16(e).toString(16);return"0000".substring(0,4-t.length)+t.toUpperCase()}}function pe(){return"0.37.0"}function fe(e){let t;return e.startsWith("1.2.826.0.1.3680043.9.7278.1")&&(t=e.substring(29).replace(".99","-beta")),t}function ve(e){const t=e.split("-");let n=[];for(const e of t)n=n.concat(e.split("."));return n}function Ce(e,t){let n=0;const i=ve(e),o=ve(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 De(e,t,n){const i=Ce(e,t),o=Ce(e,n);return i>=0&&o<=0}function ye(e){return!(e.byteLength<132)&&"DICM"===new Uint8Array(e,128,4).reduce(function(e,t){return e+String.fromCharCode(t)},"")}function Ie(e){return e.replace(/\0/g,"").trim()}class Te{decode(e){let t="";for(let n=0,i=e.length;n<i;++n)t+=String.fromCharCode(e[n]);return t}}function we(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 Le(e){return e===te}function Pe(e){return e===ie}function Ae(e){return"1.2.840.10008.1.2.4.50"===e||"1.2.840.10008.1.2.4.51"===e}function Oe(e){return"1.2.840.10008.1.2.4.57"===e||"1.2.840.10008.1.2.4.70"===e}function be(e){return null!==e.match(/1.2.840.10008.1.2.4.9/)}function xe(e){return"1.2.840.10008.1.2.5"===e}function Ee(e){let t="Unknown";return void 0!==ee[e]&&(t=ee[e]),t}function Re(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){Me(e,n)}return i}function Fe(e,t){let n=null;try{n=new(0,e.constructor)(t)}catch(e){Me(e,t)}return n}function Me(e,t){if(e instanceof RangeError){const e=Math.floor(Math.log(t)/Math.log(2));s.error(`Cannot allocate array of size: ${t} (>2^${e}).`)}}function qe(e,t){return t?8:Z(e)?12:8}const Ue="00280100",Qe="00280103",Ve="7FE00010";class Ne{#p={};#f;#v=new Te;#C=this.#v;#D=!1;#y(e){return this.#v.decode(e)}#I(e){return this.#D&&(e=function(e){if(!e.includes(27))return e;const t=[];let n=0;for(;n<e.length;)if(27===e[n]){for(++n;n<e.length&&e[n]>=32&&e[n]<=47;)++n;++n}else t.push(e[n]),++n;return new Uint8Array(t)}(e)),this.#C.decode(e)}getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}setDecoderCharacterSet(e){this.#C=new TextDecoder(e)}getDicomElements(){return this.#p}safeGet(e){return ue(this.#p,e)}#T(e,t){const n=e.readHex(t);t+=Uint16Array.BYTES_PER_ELEMENT;const i=e.readHex(t);return t+=Uint16Array.BYTES_PER_ELEMENT,{tag:new F(n,i),endOffset:t}}#w(e,t,n){const i={};let o=this.#L(e,t,n);if(t=o.endOffset,k(o.tag))return{data:i,endOffset:o.endOffset,isSeqDelim:!0};if(i[o.tag.getKey()]={tag:o.tag,vr:"NONE",vl:o.vl,undefinedLength:o.undefinedLength},o.undefinedLength){let r=!1;for(;!r;)o=this.#L(e,t,n),t=o.endOffset,r=N(o.tag),r||(i[o.tag.getKey()]=o)}else{const r=t;for(t-=o.vl;t<r;)o=this.#L(e,t,n),t=o.endOffset,i[o.tag.getKey()]=o}return{data:i,endOffset:t,isSeqDelim:!1}}#P(e,t,n){const i=[];let o=this.#L(e,t,n);const r=o.vl;t=o.endOffset;let a=!1;for(;!a;)o=this.#L(e,t,n),t=o.endOffset,a=k(o.tag),a||(o.vr="OB",i.push(o));return{data:i,endOffset:t,offsetTableVl:r}}#L(e,t,n,i){const o=this.#T(e,t),r=o.tag;if(void 0!==i&&r.equals(i)){const e=new le("");return e.tag=r,e}t=o.endOffset;let a,l="NONE",c=!0;r.isWithVR()&&(n?(l=re(r)?.getVr(),void 0===l&&(l="UN"),c=!0):(l=this.#y(e.readUint8Array(t,2)),t+=2*Uint8Array.BYTES_PER_ELEMENT,c=Z(l),c&&(t+=2*Uint8Array.BYTES_PER_ELEMENT))),function(e){return Object.keys(J).concat(["NONE","ox","xx","xs"]).includes(e)}(l)||(s.warn(`Unknown VR: ${l} (for tag ${r.getKey()}), treating as 'UN'`),l="UN"),c?(a=e.readUint32(t),t+=Uint32Array.BYTES_PER_ELEMENT):(a=e.readUint16(t),t+=Uint16Array.BYTES_PER_ELEMENT);let u=!1;4294967295===a&&(u=!0,a=0),r.isPrivate()&&"UN"===l&&0===a&&(l="SQ");let d,h=t,g=h+a;if(z(r)&&u){const i=this.#P(e,t,n);t=i.endOffset,h+=i.offsetTableVl,d=i.data,g=t,a=t-h}else if("SQ"===l){let i;if(d=[],u){let o=!1;for(;!o;)i=this.#w(e,t,n),o=i.isSeqDelim,t=i.endOffset,o||d.push(i.data);g=t,a=t-h}else if(0!==a){const o=t+a;for(;t<o;)i=this.#w(e,t,n),d.push(i.data),t=i.endOffset;g=t,a=t-h}}const S=new le(l);return S.tag=r,S.vl=a,S.startOffset=h,S.endOffset=g,u&&(S.undefinedLength=u),d&&(S.items=d),S}#A(e,t,n){const i=e.tag,o=e.vl,r=e.vr,a=e.startOffset;let l,c,u;void 0!==n&&(l=n.bitsAllocated,c=n.pixelRepresentation);const d=J[r];if(z(i))if(e.undefinedLength){u=[];for(let i=0;i<e.items.length;++i)u.push(this.#A(e.items[i],t,n));delete e.items}else{l>8&&"OB"===r&&(s.warn("Reading DICOM pixel data with bitsAllocated>8 and OB VR, treating as OW"),e.vr="OW"),u=[];const d=i.getKey();if("7FE00008"===d)u.push(t.readFloat32Array(a,o));else if("7FE00009"===d)u.push(t.readFloat64Array(a,o));else if(1===l)u.push(t.readBinaryArray(a,o,n.imageBufferSize));else if(8===l)0===c?u.push(t.readUint8Array(a,o)):u.push(t.readInt8Array(a,o));else if(16===l)0===c?u.push(t.readUint16Array(a,o)):u.push(t.readInt16Array(a,o));else{if(32!==l)throw new Error(`Unsupported bits allocated: ${l}`);0===c?u.push(t.readUint32Array(a,o)):u.push(t.readInt32Array(a,o))}}else if(void 0!==d)if("Uint8"===d)u=t.readUint8Array(a,o);else if("Uint16"===d)u=t.readUint16Array(a,o),"O"!==r[0]&&(u=Array.from(u));else if("Uint32"===d)u=t.readUint32Array(a,o),"O"!==r[0]&&(u=Array.from(u));else if("Uint64"===d)u=t.readUint64Array(a,o);else if("Int16"===d)u=Array.from(t.readInt16Array(a,o));else if("Int32"===d)u=Array.from(t.readInt32Array(a,o));else if("Int64"===d)u=t.readInt64Array(a,o);else if("Float32"===d)u=Array.from(t.readFloat32Array(a,o));else if("Float64"===d)u=Array.from(t.readFloat64Array(a,o));else{if("string"!==d)throw new Error(`Unknown VR type: ${d}`);{const e=t.readUint8Array(a,o);u=_(r)?this.#I(e):this.#y(e),u=Ie(u).split("\\")}}else if("xx"===r)u=Array.from(t.readUint16Array(a,o));else if("ox"===r)u=8===l?0===c?Array.from(t.readUint8Array(a,o)):Array.from(t.readInt8Array(a,o)):0===c?Array.from(t.readUint16Array(a,o)):Array.from(t.readInt16Array(a,o));else if("xs"===r)u=0===c?Array.from(t.readUint16Array(a,o)):Array.from(t.readInt16Array(a,o));else if("AT"===r){const e=t.readUint16Array(a,o);u=[];for(let t=0,n=e.length;t<n;t+=2){const n=e[t].toString(16),i=e[t+1].toString(16);let o="(";o+="0000".substring(0,4-n.length)+n.toUpperCase(),o+=",",o+="0000".substring(0,4-i.length)+i.toUpperCase(),o+=")",u.push(o)}}else if("SQ"===r){u=[];for(let n=0;n<e.items.length;++n){const i=e.items[n],o={},r=Object.keys(i);let a=l,s=c;for(let e=0;e<r.length;++e){let n=i[Ue];void 0!==n&&void 0!==n.value&&(a=n.value[0]),n=i[Qe],void 0!==n&&void 0!==n.value&&(s=n.value[0]);const l={bitsAllocated:a,pixelRepresentation:s},c=i[r[e]];c.value=this.#A(c,t,l),delete c.tag,delete c.vl,delete c.startOffset,delete c.endOffset,o[r[e]]=c}u.push(o)}delete e.items}else"NONE"===r||s.warn(`Unknown VR: ${r} (for tag ${e.tag.getKey()})`),u=[];return u}#O(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.#A(r,t,n)),delete r.tag,delete r.vl,delete r.startOffset,delete r.endOffset}}parse(e,t){let n,i,o;const r=new me(e);let a=new me(e);n=128;const l=this.#y(r.readUint8Array(n,4));if(n+=4*Uint8Array.BYTES_PER_ELEMENT,"DICM"===l){o=this.#L(r,n,!1),o.value=this.#A(o,r),n=o.endOffset,this.#p[o.tag.getKey()]=o;const e=n+o.value[0];for(;n<e;)o=this.#L(r,n,!1),n=o.endOffset,this.#p[o.tag.getKey()]=o;if(o=this.#p["00020010"],void 0===o)throw new Error("Not a valid DICOM file (no TransferSyntaxUID found)");o.value=this.#A(o,r),i=o.value[0]}else{s.warn(`Invalid DICM prefix (${l}), trying to guess tansfer syntax.`),o=this.#L(a,0,!1);const e=function(e){const t="0008",n=e.tag.getGroup();if("0800"!==n&&n!==t)throw new Error("Not a valid DICOM file (invalid DICM word found and first element not in 0008 group)");const i=e.vr,o=i.charCodeAt(0),r=i.charCodeAt(1),a=!(o>=65&&o<=90&&r>=65&&r<=90);let s;if(n===t)s=a?te:ne;else{if(a)throw new Error("Not a valid DICOM file (no magic DICM word foundand implicit VR big endian detected)");s=ie}const l=new le("UI");return l.tag=new F("0002","0010"),l.value=[s],l.vl=l.value[0].length,l.startOffset=e.startOffset,l.endOffset=l.startOffset+l.vl,l}(o);this.#p[e.tag.getKey()]=e,i=e.value[0],n=0}if(!function(e){return e===te||e===ne||e===ie||Ae(e)||Oe(e)||be(e)||xe(e)}(i))throw new Error(`Unsupported DICOM transfer syntax: '${i}' (${Ee(i)})`);let c=!1;Le(i)&&(c=!0),Pe(i)&&(a=new me(e,!1));let u,d=!1;for(;n<e.byteLength;){if(o=this.#L(a,n,c,t),void 0!==t&&o.tag.equals(t)){d=!0;break}n=o.endOffset;const e=o.tag.getKey();void 0===this.#p[e]?this.#p[e]=o:s.warn(`Not saving duplicate tag: ${e}`)}if(isNaN(n))throw new Error("Problem while parsing, bad offset");if(d||e.byteLength===n||s.warn(`Did not reach the end of the buffer: ${n} != ${e.byteLength}`),X(this.#p)){let e;void 0!==this.#p[Ve]&&(o=this.#p[Qe],void 0!==o?(o.value=this.#A(o,a),e=o.value[0]):(s.warn("Reading DICOM pixel data with default pixelRepresentation."),e=0));let t=16;o=this.#p[Ue],void 0!==o?(o.value=this.#A(o,a),t=o.value[0]):s.warn("Reading DICOM pixel data with default bitsAllocated.");let n,i,r=1;o=this.#p["00280008"],void 0!==o&&(o.value=this.#A(o,a),r=parseInt(o.value[0],10)),u={pixelRepresentation:e,bitsAllocated:t,numberOfFrames:r,imageBufferSize:void 0},o=this.#p["00280010"],void 0!==o&&(o.value=this.#A(o,a),n=parseInt(o.value[0],10)),o=this.#p["00280011"],void 0!==o&&(o.value=this.#A(o,a),i=parseInt(o.value[0],10)),void 0!==n&&void 0!==i&&(u.imageBufferSize=n*i*r)}if(void 0!==this.#f&&this.setDecoderCharacterSet(this.#f),o=this.#p["00080005"],void 0!==o){let e;o.value=this.#A(o,a),1===o.value.length?e=o.value[0]:(e=o.value[1],"ISO 2022 IR 149"!==e&&s.warn(`Unsupported character set with code extensions: '${e}'.`)),this.setDecoderCharacterSet(function(e){let t="utf-8";return"ISO_IR 100"===e?t="iso-8859-1":"ISO_IR 101"===e?t="iso-8859-2":"ISO_IR 109"===e?t="iso-8859-3":"ISO_IR 110"===e?t="iso-8859-4":"ISO_IR 144"===e?t="iso-8859-5":"ISO_IR 127"===e?t="iso-8859-6":"ISO_IR 126"===e?t="iso-8859-7":"ISO_IR 138"===e?t="iso-8859-8":"ISO_IR 148"===e?t="iso-8859-9":"ISO_IR 13"===e?t="shift-jis":"ISO_IR 166"===e?t="iso-8859-11":"ISO 2022 IR 87"===e?t="iso-2022-jp":"ISO 2022 IR 149"===e?t="euc-kr":"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)),this.#D="ISO 2022 IR 149"===e}if(this.#O(this.#p,a,u),o=this.#p[Ve],void 0!==o&&o.undefinedLength){const e=u.numberOfFrames,t=o.value;if(t.length>1&&t.length>e){const n=t.length/e,i=[];let r;for(let o=0;o<e;++o){r=o*n;let e=0;for(let i=0;i<n;++i)e+=t[r+i].length;const a=new t[0].constructor(e);let s=0;for(let e=0;e<n;++e)a.set(t[r+e],s),s+=t[r+e].length;i[o]=a}o.value=i}}}}class Be{#b;#x;constructor(e,t){this.#b=e,this.#x=t}getSlope(){return this.#b}getIntercept(){return this.#x}apply(e){return e*this.#b+this.#x}equals(e){return null!=e&&this.getSlope()===e.getSlope()&&this.getIntercept()===e.getIntercept()}isID(){return 1===this.getSlope()&&0===this.getIntercept()}}const ke={wlPresets:void 0,labelTexts:void 0,privateBValueRules:void 0,openRoiDialog:void 0,highlightAnnotation:void 0,highlightSegment:void 0,getVolumeIdTagValue:void 0,getPostLoadVolumeIdTagValue:void 0,volumeIdCandidates:void 0,getTagPixelUnit:void 0};class Ge{#e;#E;constructor(e){this.#e=e}get(e,t){return this.#e[3*e+t]}getInverse(){return void 0===this.#E&&(this.#E=function(e){const t=e.get(0,0),n=e.get(0,1),i=e.get(0,2),o=e.get(1,0),r=e.get(1,1),a=e.get(1,2),l=e.get(2,0),c=e.get(2,1),u=e.get(2,2),d=r*u-a*c,h=a*l-o*u,g=o*c-r*l;let S=t*d+n*h+i*g;if(0!==S)return S=1/S,new Ge([S*d,S*(i*c-n*u),S*(n*a-i*r),S*h,S*(t*u-i*l),S*(i*o-t*a),S*g,S*(n*l-t*c),S*(t*r-n*o)]);s.warn("Cannot invert 3*3 matrix with zero determinant.")}(this)),this.#E}equals(e){for(let t=0;t<3;++t)for(let n=0;n<3;++n)if(this.get(t,n)!==e.get(t,n))return!1;return!0}isSimilar(e,t){for(let n=0;n<3;++n)for(let i=0;i<3;++i)if(!u(this.get(n,i),e.get(n,i),t))return!1;return!0}toString(){let e="[";for(let t=0;t<3;++t){0!==t&&(e+=", \n ");for(let n=0;n<3;++n)0!==n&&(e+=", "),e+=this.get(t,n)}return e+="]",e}multiply(e){const t=[];for(let n=0;n<3;++n)for(let i=0;i<3;++i){let o=0;for(let t=0;t<3;++t)o+=this.get(n,t)*e.get(t,i);t.push(o)}return new Ge(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 Ge(e)}multiplyArray3D(e){if(3!==e.length)throw new Error(`Cannot multiply 3x3 matrix with non 3D array: ${e.length}`);const t=e[0],n=e[1],i=e[2],o=new Array(3);return o[0]=this.#e[0]*t+this.#e[1]*n+this.#e[2]*i,o[1]=this.#e[3]*t+this.#e[4]*n+this.#e[5]*i,o[2]=this.#e[6]*t+this.#e[7]*n+this.#e[8]*i,o}multiplyTypedArray3D(e,t){const n=e[0],i=e[1],o=e[2];t[0]=this.#e[0]*n+this.#e[1]*i+this.#e[2]*o,t[1]=this.#e[3]*n+this.#e[4]*i+this.#e[5]*o,t[2]=this.#e[6]*n+this.#e[7]*i+this.#e[8]*o}multiplyVector3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new g(t[0],t[1],t[2])}multiplyPoint3D(e){const t=this.multiplyArray3D([e.getX(),e.getY(),e.getZ()]);return new m(t[0],t[1],t[2])}multiplyIndex3D(e){const t=this.multiplyArray3D(e.getValues());return new a(t)}getRowAbsMax(e){const t=[Math.abs(this.get(e,0)),Math.abs(this.get(e,1)),Math.abs(this.get(e,2))],n=Math.max.apply(null,t),i=t.indexOf(n);return{value:this.get(e,i),index:i}}getColAbsMax(e){const t=[Math.abs(this.get(0,e)),Math.abs(this.get(1,e)),Math.abs(this.get(2,e))],n=Math.max.apply(null,t),i=t.indexOf(n);return{value:this.get(i,e),index:i}}asOneAndZeros(){const e=[];for(let t=0;t<3;++t){const n=this.getRowAbsMax(t),i=n.value>0?1:-1;for(let t=0;t<3;++t)t===n.index?e.push(i):e.push(0)}return new Ge(e)}getThirdColMajorDirection(){return this.getColAbsMax(2).index}getValues(){return this.#e.slice()}}function ze(){return new Ge([1,0,0,0,1,0,0,0,1])}function He(e){return e.equals(ze())}function Xe(){return new Ge([1,0,0,0,0,1,0,-1,0])}const Ye={Axial:"axial",Coronal:"coronal",Sagittal:"sagittal"};function We(e){let t;return e===Ye.Axial?t=ze():e===Ye.Coronal?t=Xe():e===Ye.Sagittal&&(t=new Ge([0,0,-1,1,0,0,0,-1,0])),t}function $e(e){let t=new g(Math.abs(e.getX()),Math.abs(e.getY()),Math.abs(e.getZ())),n="";const i=e.getX()<0?"R":"L",o=e.getY()<0?"A":"P",r=e.getZ()<0?"I":"S",a=1e-4;for(let e=0;e<3;e++)if(t.getX()>a&&t.getX()>t.getY()&&t.getX()>t.getZ())n+=i,t=new g(0,t.getY(),t.getZ());else if(t.getY()>a&&t.getY()>t.getX()&&t.getY()>t.getZ())n+=o,t=new g(t.getX(),0,t.getZ());else{if(!(t.getZ()>a&&t.getZ()>t.getX()&&t.getZ()>t.getY()))break;n+=r,t=new g(t.getX(),t.getY(),0)}return n}function je(e){let t;const n=Ze(e);return void 0!==n&&(t=function(e){let t;return["LPS","LAI","RPI","RAS","ALS","ARI","PLI","PRS"].includes(e)?t=Ye.Axial:["LSA","LIP","RSP","RIA","ILA","IRP","SLP","SRA"].includes(e)?t=Ye.Coronal:["PSL","PIR","ASR","AIL","IAR","IPL","SAL","SPR"].includes(e)&&(t=Ye.Sagittal),t}(function(e){const t=new g(e.get(0,0),e.get(1,0),e.get(2,0)),n=new g(e.get(0,1),e.get(1,1),e.get(2,1)),i=new g(e.get(0,2),e.get(1,2),e.get(2,2));return $e(t)+$e(n)+$e(i)}(n.asOneAndZeros()))),t}function Ze(e){let t;if(void 0!==e&&6===e.length){const n=new g(e[0],e[1],e[2]),i=new g(e[3],e[4],e[5]),o=n.crossProduct(i);t=new Ge([n.getX(),i.getX(),o.getX(),n.getY(),i.getY(),o.getY(),n.getZ(),i.getZ(),o.getZ()])}return t}function Ke(e){return[e.get(0,0),e.get(1,0),e.get(2,0),e.get(0,1),e.get(1,1),e.get(2,1)]}function _e(e,t){let n=ze();return void 0!==t&&(n=e.asOneAndZeros().getInverse().multiply(t)),n.getAbs()}function Je(e,t){let n=We(t);return void 0===n&&(n=We([Ye.Sagittal,Ye.Coronal,Ye.Axial][e.getThirdColMajorDirection()])),n}function et(e,t,n){const i=_e(e,t),o=e.asOneAndZeros().multiply(i),r=[];for(let e=0;e<3;++e){let n=0;for(let i=0;i<3;++i)n+=o.get(i,e)*t.get(i,e);r.push(n<0?-1:1)}r[2]=n.getColAbsMax(2).value<0?-1:1;const a=n.multiplyArray3D(r);return{scale:{x:a[0]<0,y:a[1]<0,z:a[2]<0},offset:{x:r[0]<0,y:r[1]<0}}}class tt{#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 nt={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 it(e){let t;const n=ue(e,nt.Rows),i=ue(e,nt.Columns);return void 0!==n&&void 0!==i&&(t=[i,n]),t}function ot(e,t){let n;const i=de(e,t);return void 0!==i&&2===i.length&&(n=[parseFloat(i[1]),parseFloat(i[0])]),n}function rt(e){let t;const n=de(e,nt.PixelMeasuresSequence);return void 0!==n&&(t=ot(n[0],nt.PixelSpacing)),t}function at(e){let t=ot(e,nt.PixelSpacing);return void 0===t&&(t=function(e){let t=ot(e,nt.ImagerPixelSpacing);if(void 0!==t){let n;const i=parseFloat(ue(e,nt.EstimatedRadiographicMagnificationFactor));if(isNaN(i)){const t=parseFloat(ue(e,nt.DistanceSourceToDetector)),i=parseFloat(ue(e,nt.DistanceSourceToPatient));isNaN(t)||isNaN(i)||0===i||(n=t/i)}else n=i;void 0!==n?(t=t.map(e=>e/n),s.warn("Got pixel spacing from corrected ImagerPixelSpacing tag")):s.warn("Got pixel spacing from raw ImagerPixelSpacing tag")}return t}(e)),void 0===t&&(t=function(e){const t=ot(e,nt.NominalScannedPixelSpacing);return void 0!==t&&s.warn("Got pixel spacing from NominalScannedPixelSpacing tag"),t}(e)),void 0===t&&(t=function(e){let t;const n=de(e,nt.SharedFunctionalGroupsSequence);if(void 0!==n&&(t=rt(n[0])),void 0===t){const n=de(e,nt.PerFrameFunctionalGroupsSequence);void 0!==n&&(t=rt(n[0]))}return t}(e)),t}function st(e){const t=ot(e,nt.PixelSpacing);if(void 0===t)return;const n=ue(e,nt.SpacingBetweenSlices);return void 0!==n&&t.push(parseFloat(n)),new tt(t)}function lt(e){const t=ue(e,nt.PhotometricInterpretation),n=ue(e,nt.TransferSyntax);if(void 0!==t&&void 0!==n){let i=t.toUpperCase();(be(n)||Ae(n)||Oe(n))&&!ct(i)&&(i="RGB");let o=ue(e,nt.SamplesPerPixel);return void 0===o&&(o=1),"RGB"===i&&1===o&&(i="PALETTE COLOR"),i}}function ct(e){return void 0!==e&&null!==e.match(/MONOCHROME/)}function ut(e){let t;const n=de(e,nt.ReferencedSeriesSequence);return void 0!==n&&(t=ue(n[0],nt.SeriesInstanceUID)),t}function dt(e){const t=de(e,nt.ReferencedFrameOfReferenceSequence);if(void 0===t)return;const n=de(t[0],nt.RTReferencedStudySequence);if(void 0===n)return;const i=de(n[0],nt.RTReferencedSeriesSequence);return void 0!==i?ue(i[0],nt.SeriesInstanceUID):void 0}function ht(){let e;return"undefined"!=typeof navigator&&void 0!==navigator.hardwareConcurrency&&navigator.hardwareConcurrency>0&&(e=navigator.hardwareConcurrency),e}class gt{#R;#F;#M;#q;constructor(e){if(void 0===e&&(e=function(){const e=ht();let t=4;return void 0!==e&&(t=Math.max(1,Math.floor(e/2))),t}()),!Number.isInteger(e)||e<1)throw new Error(`Thread pool size must be a positive integer: ${e}`);this.#R=function(e){const t=ht();return void 0!==t&&e>t&&(e=t),e}(e),this.#U()}#U(){this.#F=[],this.#M=[];for(let e=0;e<this.#R;++e)this.#M.push(new St(this));this.#q=[]}addWorkerTask(e){if(this.#M.length===this.#R&&this.onworkstart({type:"work-start"}),this.#M.length>0){const t=this.#M.shift();this.#q.push(t),t.run(e)}else this.#F.push(e)}abort(){this.#Q(),this.#U(),this.onabort({type:"work-abort"}),this.onworkend({type:"work-end"})}onTaskEnd(e){if(this.#F.length>0){const t=this.#F.shift();e.run(t)}else e.stop(),this.#M.push(e),this.#q=this.#q.filter(t=>t.getId()!==e.getId()),this.#M.length===this.#R&&(this.onwork({type:"work"}),this.onworkend({type:"work-end"}))}handleWorkerError=e=>{this.#Q(),this.onerror({error:e}),this.onworkend({type:"work-end"})};#Q(){for(const e of this.#q)e.stop();this.#q=[]}onworkstart(e){}onworkitem(e){}onwork(e){}onworkend(e){}onerror(e){}onabort(e){}}class St{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);const{message:t,transfer:n}=this.runningTask.getStartMessage();this.worker.postMessage(t,n)}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 mt{constructor(e,t){this.startMessage=e,this.info=t}getStartMessage(){return{message:this.startMessage,transfer:[]}}getWorker(){}}class pt{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);if(void 0===t)return;const n=e.slice().sort(function(e,t){return e-t});return t.median=Ct(n,.5),t.p25=Ct(n,.25),t.p75=Ct(n,.75),t}(e):vt(e)}function vt(e){const t=e.length;if(0===t)return;let n=e[0],i=n,o=0;for(const t of e)t<n?n=t:t>i&&(i=t),o+=t;const r=o/t;let a=0;for(const t of e){const e=t-r;a+=e*e}const s=Math.sqrt(a/t);return new pt(n,i,r,s)}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}`);const n=(e.length-1)*t,i=Math.floor(n),o=e[i];return n===i?o:o+(e[i+1]-o)*(n-i)}class Dt{#e;constructor(e){if(!e||void 0===e)throw new Error("Cannot create size with no values.");if(0===e.length)throw new Error("Cannot create size with empty values.");if(!e.every(function(e){return!isNaN(e)&&0!==e}))throw new Error("Cannot create size with non number or zero values.");this.#e=e}get(e){return this.#e[e]}length(){return this.#e.length}toString(){return`(${this.#e.toString()})`}getValues(){return this.#e.slice()}moreThanOne(e){return this.length()>=e+1&&1!==this.get(e)}canScroll3D(e){let t=2;return void 0!==e&&(t=e.getThirdColMajorDirection()),this.moreThanOne(t)}canScroll(e){let t=this.canScroll3D(e);for(let e=3;e<this.length();++e)t=t||this.moreThanOne(e);return t}getDimSize(e,t){if(e>this.length())return null;if(void 0===t)t=0;else if(t<0||t>e)throw new Error("Invalid start value for getDimSize");let n=1;for(let i=t;i<e;++i)n*=this.get(i);return n}getTotalSize(e){return this.getDimSize(this.length(),e)}equals(e){if(!e)return!1;const t=this.length();if(t!==e.length())return!1;for(let n=0;n<t;++n)if(this.get(n)!==e.get(n))return!1;return!0}isInBounds(e,t){if(!e)return!1;const n=this.length();if(n!==e.length())return!1;if(void 0===t){t=[];for(let e=0;e<n;++e)t.push(e)}else for(let e=0;e<n;++e)if(t[e]>n-1)throw new Error(`Wrong input dir value: ${t[e]}`);const i=function(e,t){return e>=0&&e<t};for(let n=0;n<t.length;++n)if(!i(e.get(t[n]),this.get(t[n])))return!1;return!0}indexToOffset(e,t){if(e.length()>this.length())throw new Error("Incompatible index and size length");if(void 0===t)t=0;else if(t<0||t>this.length()-1)throw new Error("Invalid start value for indexToOffset");let n=0;for(let i=t;i<e.length();++i){const o=this.get(i),r=e.get(i);if(r>=o||r<0)return-1;n+=r*this.getDimSize(i,t)}return n}offsetToIndex(e){const t=new Array(this.length());let n,i=e;for(let e=this.length()-1;e>0;--e)n=this.getDimSize(e),t[e]=Math.floor(i/n),i-=t[e]*n;return t[0]=i,new a(t)}get2D(){return{x:this.get(0),y:this.get(1)}}#V(e,t){const n=e.slice(0,this.length());for(let i=e.length;i<this.length();++i)void 0!==t&&void 0!==t[i]?n.push(t[i]):n.push(0);return n}normalisePoint(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#V(e.getValues(),n);return new C(i)}normaliseIndex(e,t){let n;void 0!==t&&(n=t.getValues());const i=this.#V(e.getValues(),n);return new a(i)}}class yt{success;message;constructor(e){this.success=e}}const It=1e-4;function Tt(e){const t=e.getInverse();return function(e,n){const i=t.multiplyPoint3D(e),o=t.multiplyPoint3D(n);return i.getZ()-o.getZ()}}function wt(e,t,n){const i=e.getClosest(t),o=new g(n.get(0,2),n.get(1,2),n.get(2,2));return{index:i,normalResidual:e.minus(t[i]).dotProduct(o)}}class Lt{#N;#B;#k;#G=new Map;#z;#H=null;#X=ze();constructor(e,t,n,i,o){this.#N=e,this.#B=t,this.#k=n,void 0!==o&&(this.#Y(o,e.slice()),this.#z=o),void 0!==i&&(this.#X=i)}#Y(e,t){if("number"!=typeof e?.id?.value)throw new Error("Geometry time must be an object with a number id, for example {id: {value: 2}}");this.#G.set(e.id.value,{time:e,origins:t}),this.#H=null}clone(){return new Lt(this.#N.slice(),new Dt(this.#B.getValues()),new tt(this.#k.getValues()),new Ge(this.#X.getValues()),this.#z)}getInitialTime(){return this.#z}setInitialTime(e){void 0!==this.#z&&this.#G.delete(this.#z.id.value),this.#Y(e,this.#N.slice()),this.#z=e}setVolumeValues(e){const t=this.#W()?.volumeIds;if(t?.length!==e.length)throw new Error("Expected one value per volume id");for(let n=0;n<t.length;++n){const i=t[n],o={...i,value:e[n]};this.#G.set(i.id.value,{time:o,origins:this.#G.get(i.id.value).origins}),this.#z===i&&(this.#z=o)}this.#H=null}getVolumeIds(){return this.#W()?.volumeIds.slice()}#W(){if(null!==this.#H)return this.#H;const e=[...this.#G.values()].map(e=>e.time).sort((e,t)=>e.id.value-t.id.value);if(0===e.length||e.some(e=>void 0===e.id.source))this.#H=void 0;else{const t=e.map(e=>e.id.value);let n=1/0;for(let e=1;e<t.length;++e)n=Math.min(n,t[e]-t[e-1]);this.#H={volumeIds:e,values:t,tolerance:t.length>1?n/2:.5}}return this.#H}setVolumeIds(e){this.#G.clear();for(const t of e)this.#Y(t,this.#N.slice());this.#z=e[0]}getVolumeIndex(e){const t=this.#W();if(void 0===t)return-1;const n=1e-9*Math.max(1,Math.abs(e));return t.values.findIndex(t=>Math.abs(t-e)<=n)}canSyncVolume(e,t){const n=e.getVolumeIds()?.[0],i=this.getVolumeIds()?.[0];return void 0!==n&&void 0!==i&&n.id.source===i.id.source&&n.id.tagKey===i.id.tagKey&&-1!==this.getVolumeIndex(t)}#$(){const e=this.#W();if(!(void 0===e||this.#B.length()<4||e.values.length!==this.#B.get(3)))return e}#j(e,t){const n=t.values,i=n.length-1;let o;if(e<0){const t=i>0?n[1]-n[0]:1;o=n[0]+e*t}else if(e>i){const t=i>0?n[i]-n[i-1]:1;o=n[i]+(e-i)*t}else o=n[e];return o}#Z(e,t){const n=t.values;return e<=n[0]-t.tolerance?-1:e>=n[n.length-1]+t.tolerance?n.length:function(e,t){let n=0;for(let i=1;i<e.length;++i)Math.abs(e[i]-t)<Math.abs(e[n]-t)&&(n=i);return n}(n,e)}getCurrentTotalNumberOfSlices(){if(0===this.#G.size)return this.#N.length;let e=0;for(const t of this.#G.values())e+=t.origins.length;return e}hasSlicesAtTime(e){return this.#G.has(e)}getCurrentNumberOfSlicesBeforeTime(e){if(0===this.#G.size)return;let t=0;for(const[n,i]of this.#G)n<e&&(t+=i.origins.length);return t}checkTimeOrigins(){if(void 0===this.#z)return new yt(!0);for(const[e,t]of this.#G){const n=t.origins;if(n.length!==this.#N.length)return{success:!1,message:`Different number of slices for time ${e}: ${n.length} vs ${this.#N.length}`};for(let t=0;t<n.length;++t)if(!n[t].equals(this.#N[t]))return{success:!1,message:`Different origin for time ${e} at slice ${t}`}}return new yt(!0)}getOrigin(){return this.#N[0]}getOrigins(){return this.#N}sortOrigins(){this.#N.sort(Tt(this.#X))}includesOrigin(e,t){for(let n=0;n<this.#N.length;++n)if(this.#N[n].isSimilar(e,t))return!0;return!1}getSize(e){let t=this.#B;if(e&&void 0!==e){let n=Pt([this.#B.get(0),this.#B.get(1),this.#B.get(2)],e);n=n.map(Math.abs),t=new Dt(n.concat(this.#B.getValues().slice(3)))}return t}updateSliceSpacing(){const e=Ot(this.#N);if(void 0!==e){1!==this.#k.get(2)&&this.#k.get(2)!==e&&s.debug(`Using geometric spacing ${e} instead of tag spacing ${this.#k.get(2)}`);const t=this.#k.getValues();t[2]=e,this.#k=new tt(t)}}getSpacing(e){let t=this.#k;if(e&&void 0!==e){let n=Pt([this.#k.get(0),this.#k.get(1),this.#k.get(2)],e);n=n.map(Math.abs),t=new tt(n)}return t}getRealSpacing(){return this.getSpacing(this.#X.getInverse().asOneAndZeros())}getOrientation(){return this.#X}getSliceIndex(e,t){let n=this.#N;void 0!==t&&(n=this.#G.get(t).origins);const i=wt(e,n,this.#X);return i.normalResidual>0?i.index+1:i.index}canAppendSlice(e){const t=e.getSize();if(1!==t.get(2))return{success:!1,message:"Cannot append more than one slice"};const n=this.getSize();if(n.get(0)!==t.get(0))return{success:!1,message:"Cannot append a slice with different number of columns"};if(n.get(1)!==t.get(1))return{success:!1,message:"Cannot append a slice with different number of rows"};if(!this.getOrientation().isSimilar(e.getOrientation(),It))return{success:!1,message:"Cannot append a slice with different orientation"};const i=this.canAppendOrigin(e.getOrigin(),e.getInitialTime()?.id.value);return i.success?new yt(!0):i}canAppendOrigin(e,t){const n=function(t){return t.equals(e)},i=this.#z?.id.value;if(void 0!==t&&t!==i){if(this.#G.has(t)&&void 0!==this.#G.get(t).origins.find(n))return{success:!1,message:"Cannot append same time origin twice"}}else if(void 0!==this.#N.find(n))return{success:!1,message:"Cannot append same origin twice"};return new yt(!0)}appendOrigin(e,t,n){const i=this.canAppendOrigin(e,n);if(!i.success)throw new Error(i.message);if(void 0!==n&&this.#G.get(n).origins.splice(t,0,e),void 0===n||n===this.#z?.id.value){this.#N.splice(t,0,e);const n=this.#B.getValues();n[2]+=1,this.#B=new Dt(n)}}appendFrame(e,t){this.#Y(t,[e]);const n=this.#B.getValues(),i=this.#k.getValues();4===n.length?n[3]+=1:(n.push(2),i.push(1)),this.#B=new Dt(n),this.#k=new tt(i)}toString(){return`Origin: ${this.getOrigin()}, Size: ${this.getSize()}, Spacing: ${this.getSpacing()}, Orientation: ${this.getOrientation()}`}equals(e){return null!=e&&this.getOrigin().equals(e.getOrigin())&&this.getSize().equals(e.getSize())&&this.getSpacing().equals(e.getSpacing())&&this.getOrientation().equals(e.getOrientation())}isSimilar(e,t){return null!=e&&this.getOrigin().isSimilar(e.getOrigin(),t)&&this.getSize().equals(e.getSize())&&this.getSpacing().equals(e.getSpacing())&&this.getOrientation().isSimilar(e.getOrientation(),t)}isInBounds(e){return this.isIndexInBounds(this.worldToIndex(e))}isIndexInBounds(e,t){return this.getSize().isInBounds(e,t)}getRange(){const e=this.getSize().length(),t=new Array(e);t.fill(0);const n=new a(t),i=new a(this.getSize().getValues());return[this.indexToWorld(n),this.indexToWorld(i)]}indexToWorld(e){const t=this.getSpacing(),n=new m(e.get(0)*t.get(0),e.get(1)*t.get(1),e.get(2)*t.get(2)),i=this.getOrientation().multiplyPoint3D(n),o=e.getValues(),r=this.#$();o.length>3&&void 0!==r&&(o[3]=this.#j(o[3],r));const a=this.getOrigin();return o[0]=a.getX()+i.getX(),o[1]=a.getY()+i.getY(),o[2]=a.getZ()+i.getZ(),new C(o)}pointToWorld(e){const t=this.getSpacing(),n=new m(e.getX()*t.get(0),e.getY()*t.get(1),e.getZ()*t.get(2)),i=this.getOrientation().multiplyPoint3D(n),o=this.getOrigin();return new m(o.getX()+i.getX(),o.getY()+i.getY(),o.getZ()+i.getZ())}worldToIndex(e){const t=this.getOrigin(),n=new m(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),i=this.getOrientation().getInverse().multiplyPoint3D(n),o=e.getValues(),r=this.#$();o.length>3&&void 0!==r&&(o[3]=this.#Z(o[3],r));const s=this.getSpacing();o[0]=Math.floor(h(i.getX()/s.get(0),5)),o[1]=Math.floor(h(i.getY()/s.get(1),5));const l=Math.floor(h(i.getZ()/s.get(2),5));o[2]=l;const c=this.getOrigins();if(c.length>0){const t=wt(e.get3D(),c,this.getOrientation());Math.abs(t.normalResidual)<s.get(2)/2?o[2]=t.index:t.index===c.length-1&&t.normalResidual>0&&o[2]<c.length?o[2]=c.length:0===t.index&&t.normalResidual<0&&o[2]>=0&&(o[2]=-1)}return new a(o)}worldToPoint(e){const t=this.getOrigin(),n=new m(e.get(0)-t.getX(),e.get(1)-t.getY(),e.get(2)-t.getZ()),i=this.getOrientation().getInverse().multiplyPoint3D(n),o=e.getValues(),r=this.getSpacing();return o[0]=i.getX()/r.get(0),o[1]=i.getY()/r.get(1),o[2]=i.getZ()/r.get(2),new m(o[0],o[1],o[2])}}function Pt(e,t){return t.getInverse().multiplyArray3D(e)}function At(e,t){return t.multiplyArray3D(e)}function Ot(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=h(n.mean,4);return n.stdDev>1e-4&&s.warn(`Varying slice spacing, value: ${i} (mean: ${n.mean}, min: ${n.min}, max: ${n.max}, stdDev: ${n.stdDev})`),i}function bt(e,t){if("number"!=typeof t||e.getSize().length()<4||e.getSize().get(3)!==t)return;const n=e.getVolumeIds();return void 0!==n&&n.length===t?n:void 0}class xt extends mt{getStartMessage(){const e=this.startMessage.sourceImageBuffer.slice();return{message:{...this.startMessage,sourceImageBuffer:e},transfer:[e.buffer]}}getWorker(){return new r.wc(new URL("./assets/workers/resampling.worker.min.js",import.meta.url),{name:"resampling.worker",type:"module"})}}class Et{#K=new gt(5);constructor(){this.#K.onerror=e=>{console.error("Resampling failed!",e.error)}}run(e,t,n,i,o,r=void 0){const a=String(Date.now())+Math.random(),s=function(e,t,n){const i=e.getOrientation(),o=t.getInverse().multiply(i),r=e.getSize(),a=e.getSpacing(),s=a.getValues(),l=[0,0,0],c=[0,0,0];for(let e=0;e<=1;e++)for(let t=0;t<=1;t++)for(let n=0;n<=1;n++){const i=new m(s[0]*e,s[1]*t,s[2]*n),r=o.multiplyPoint3D(i);l[0]=Math.max(l[0],r.getX()),l[1]=Math.max(l[1],r.getY()),l[2]=Math.max(l[2],r.getZ()),c[0]=Math.min(c[0],r.getX()),c[1]=Math.min(c[1],r.getY()),c[2]=Math.min(c[2],r.getZ())}const u=[Math.abs(l[0]-c[0]),Math.abs(l[1]-c[1]),Math.abs(l[2]-c[2])],d=u[0]*u[1]*u[2],h=s[0]*s[1]*s[2],g=Math.cbrt(h/d),S=[u[0]*g,u[1]*g,u[2]*g],p=a.length();for(let e=3;e<p;e++)S.push(a.get(e));const f=new tt(S),v=[r.get(0)/2*a.get(0),r.get(1)/2*a.get(1),r.get(2)/2*a.get(2)];let C=!0;const D=[0,0,0],y=[0,0,0];for(let e=-1;e<=1;e+=2)for(let t=-1;t<=1;t+=2)for(let n=-1;n<=1;n+=2){const i=new m(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)))],T=r.length();for(let e=3;e<T;e++)I.push(r.get(e));const w=new Dt(I),L=void 0===n?new m(r.get(0)/2,r.get(1)/2,r.get(2)/2):e.worldToPoint(n),P=[0,0,0];if(void 0===n)P[0]=w.get(0)/2,P[1]=w.get(1)/2,P[2]=w.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)+w.get(0)/2,P[1]=t[1]/f.get(1)+w.get(1)/2,P[2]=t[2]/f.get(2)+w.get(2)/2}const A=new m(P[0]*f.get(0),P[1]*f.get(1),P[2]*f.get(2)),O=t.multiplyPoint3D(A),b=e.pointToWorld(L),x=new m(b.getX()-O.getX(),b.getY()-O.getY(),b.getZ()-O.getZ()),E=[0,0,f.get(2)],R=t.multiplyArray3D(E),F=[];for(let e=0;e<w.get(2);e++)F.push(new m(x.getX()+R[0]*e,x.getY()+R[1]*e,x.getZ()+R[2]*e));return new Lt(F,w,f,t)}(t,i,r),l=function(e,t){const n=Fe(e,t.getTotalSize());if(null===n)throw new Error("Cannot reallocate data for image resampling.");return n.fill(0),n}(e,s.getSize()),c=function(e,t,n,i,o,r){const a=t.getSize(),s=a.length(),l=n.getSize(),c=l.length(),u=Array(s).fill(0);for(let e=0;e<s;e++)u[e]=a.getDimSize(e);const d=Array(c).fill(0);for(let e=0;e<c;e++)d[e]=l.getDimSize(e);const h=a.getTotalSize(),g=l.getTotalSize(),S=(e,a,s)=>({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,targetStartOffset:a,jobId:r,frame:s});if(c<=3)return[S(e,0,0)];const m=l.get(3),p=a.getDimSize(3),f=l.getDimSize(3),v=[];for(let t=0;t<m;t++){const n=p*t,i=f*t,o=e.subarray(n,n+p);v.push(S(o,i,t))}return v}(e,t,s,n,o,a);return this.#K.onworkitem=this.ondoneframe,this.#K.onworkend=this.ondone,c.forEach(e=>{const t=new xt(e,{});this.#K.addWorkerTask(t)}),{buffer:l,geometry:s,jobId:a}}ondoneframe(e){}ondone(e){}}const Rt={linear:"LINEAR",linear_exact:"LINEAR_EXACT",sigmoid:"SIGMOID"};class Ft{#_;#J;#ee=0;#te=255;#b;#x;constructor(e,t,n){void 0===n&&(n=!1);let i=e,o=t;n||(i-=.5,o-=1),this.#_=i-o/2,this.#J=i+o/2,this.#b=(this.#te-this.#ee)/o,this.#x=(-i/o+.5)*(this.#te-this.#ee)+this.#ee}getY(e){let t;return t=e<=this.#_?this.#ee:e>this.#J?this.#te:e*this.#b+this.#x,t}}class Mt{#ee=0;#te=255;#ne;#ie;constructor(e,t){this.#ne=e,this.#ie=t}getY(e){return(this.#te-this.#ee)/(1+Math.exp(-4*(e-this.#ne)/this.#ie))+this.#ee}}class qt{#oe;#re=0;#ae;#se=Rt.linear;constructor(e,t){if(this.#oe=e,void 0!==t){const e=[];for(const t in Rt)e.push(Rt[t]);e.includes(t)?this.#se=t:s.debug(`Unknown VOI LUT function: ${t}`)}this.#U()}getWindowLevel(){return this.#oe}#U(){const e=this.#oe.center,t=this.#oe.width,n=e+this.#re;this.#se===Rt.linear_exact?this.#ae=new Ft(n,t,!0):this.#se===Rt.sigmoid?this.#ae=new Mt(n,t):this.#ae=new Ft(n,t)}setSignedOffset(e){this.#re=e,this.#U()}apply(e){return this.#ae.getY(e)}}class Ut{center;width;constructor(e,t){this.center=e,this.width=t}}function Qt(e,t){return null!=e&&null!=t&&e.center===t.center&&e.width===t.width}function Vt(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=e.width;return o=Math.min(o,t.max-t.min),o=Math.max(o,function(e){let t=1;return e!==Rt.linear_exact&&e!==Rt.sigmoid||(t=Number.EPSILON),t}(n)),new Ut(i,o)}class Nt{#le=new Map;add(e,t=1){this.#le.set(e,(this.#le.get(e)??0)+t)}getTotal(){let e=0;for(const t of this.#le.values())e+=t;return e}getEntries(){return Array.from(this.#le,([e,t])=>({value:e,count:t})).sort((e,t)=>e.value-t.value)}getRange(){let e,t;for(const n of this.#le.keys())(void 0===e||n<e)&&(e=n),(void 0===t||n>t)&&(t=n);if(void 0!==e)return{min:e,max:t}}getCountInRange(e,t){let n=0;for(const[i,o]of this.#le)(void 0===e||i>=e)&&(void 0===t||i<t)&&(n+=o);return n}getIntervalPercentages(e){const t=[];for(let n=0;n<e.length-1;++n)t.push(this.getCountInRange(e[n],e[n+1]));const n=t.reduce((e,t)=>e+t,0);return t.map(e=>0===n?0:100*e/n)}getStats(){const e=this.getEntries();if(0===e.length)return;let t=0,n=0;for(const i of e)t+=i.count,n+=i.value*i.count;const i=n/t;let o=0;for(const t of e){const e=t.value-i;o+=e*e*t.count}const r=o/t,a=new pt(e[0].value,e[e.length-1].value,i,Math.sqrt(r));return a.median=kt(e,t,.5),a.p25=kt(e,t,.25),a.p75=kt(e,t,.75),a}}function Bt(e,t){let n=0;for(const i of e)if(n+=i.count,t<n)return i.value;return e[e.length-1].value}function kt(e,t,n){const i=(t-1)*n,o=Math.floor(i),r=Bt(e,o);return i===o?r:r+(Bt(e,o+1)-r)*(i-o)}class Gt{#ce=[];#ue;constructor(e){this.#ue=e}getUnit(){return this.#ue}getHistogram(e){let t=this.#ce.find(t=>t.rsi.equals(e));return void 0===t&&(t={rsi:e,histogram:new Nt},this.#ce.push(t)),t.histogram}add(e,t){this.getHistogram(t).add(e)}getTotal(){let e=0;for(const t of this.#ce)e+=t.histogram.getTotal();return e}getRange(){let e,t;for(const n of this.#ce){const i=n.histogram.getRange();void 0!==i&&((void 0===e||i.min<e)&&(e=i.min),(void 0===t||i.max>t)&&(t=i.max))}if(void 0!==e)return{min:e,max:t}}getRescaledHistogram(){const e=new Nt;for(const t of this.#ce)for(const n of t.histogram.getEntries())e.add(t.rsi.apply(n.value),n.count);return e}getRescaledRange(){return this.getRescaledHistogram().getRange()}getIntervalPercentages(e){return this.getRescaledHistogram().getIntervalPercentages(e)}getStats(){return this.getRescaledHistogram().getStats()}}const zt=["imagecontentchange","imagegeometrychange","imageresamplingstart","imageresamplingcomplete","imageresampled","labelingstart","labelschanged"];class Ht extends EventTarget{#de;#d;#he;#ge;#Se;#me;#pe;#fe=new Be(1,0);#ve=null;#Ce=!0;#De=!0;#ye="MONOCHROME2";#Ie;#Te=0;#we;#Le={};#Pe=null;#Ae=null;#Oe=null;#be;#xe=!1;constructor(e,t,n){super(),this.#de=e,this.#d=t,this.#he=!1,this.#ge="0",this.#Se=null,this.#me=null,this.#pe=n,this.#be=null,this.#we=this.#d.length/this.#de.getSize().getTotalSize()}setComplete(e){this.#xe=e,e&&this.#de.updateSliceSpacing()}getComplete(){return this.#xe}getInitialIndex(){const e=this.#de.getSize(),t=new Array(e.length()).fill(0);for(let n=0;n<Math.min(3,t.length);++n)t[n]=Math.floor(e.get(n)/2);return new a(t)}getHasOverlap(){return!1}getImageUid(e){let t=this.#pe[0];return 1!==this.#pe.length&&void 0!==e&&(t=this.#pe[this.getSecondaryOffset(e)]),t}getOriginForImageUid(e){let t;const n=this.#pe.indexOf(e);if(-1!==n){const e=this.getGeometry().getOrigins();t=e[n%e.length]}return t}includesImageUid(e){return this.#pe.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.#pe,e)}getGeometry(){return this.#de}getBuffer(){return this.#d}canQuantify(){return 1===this.getNumberOfComponents()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return ct(this.getPhotometricInterpretation())}isMask(){return!1}canScroll(e){const t=this.getGeometry().getSize();let n=1;return void 0!==this.#Le.sliceCapacity&&(n=this.#Le.sliceCapacity),t.canScroll(e)||1!==n}#Ee(){return this.#de.getSize().getTotalSize(2)}getSecondaryOffset(e){return this.#de.getSize().indexToOffset(e,2)}getRescaleSlopeAndIntercept(e){let t=this.#fe;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.#ve[n]?t=this.#ve[n]:s.warn(`undefined non constant rsi at ${n}`)}return t}#Re(e){return this.#ve[e]}setRescaleSlopeAndIntercept(e,t){if(this.#Ce=this.#Ce&&e.isID(),this.#De){if(!this.#fe.equals(e))if(void 0===t)this.#fe=e;else{this.#De=!1,this.#ve=[];for(let e=0,t=this.#Ee();e<t;++e)this.#ve.push(this.#fe);this.#fe=null,this.#ve.splice(t,0,e)}}else{if(void 0===t)throw new Error("Cannot store non constant RSI with empty slice index.");this.#ve.splice(t,0,e)}}isIdentityRSI(){return this.#Ce}isConstantRSI(){return this.#De}getPhotometricInterpretation(){return this.#ye}setPhotometricInterpretation(e){this.#ye=e}setPaletteColourMap(e){this.#Ie=e,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPaletteColourMap(){return this.#Ie}updatePaletteColourMap(e,t){this.#Ie.red[e]=t.r,this.#Ie.green[e]=t.g,this.#Ie.blue[e]=t.b,this.dispatchEvent(new CustomEvent("imagecontentchange"))}getPlanarConfiguration(){return this.#Te}setPlanarConfiguration(e){this.#Te=e}getNumberOfComponents(){return this.#we}getMeta(){return this.#Le}setMeta(e){this.#Le=e}getValueAtOffset(e){return this.#d[e]}hasValues(e){if(void 0===e||0===e.length)return[];const t=[];for(let n=0;n<e.length;++n)1===this.#we?t.push([e[n]]):3===this.#we&&t.push([e[n].r,e[n].g,e[n].b]);let n;1===this.#we?n=function(e,t){return e[0]===t[0]}:3===this.#we&&(n=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]});const i=function(e){return function(t){return n(t,e)}},o=new Array(e.length);o.fill(!1);const r=t.slice();let a,s;for(let e=0,n=this.#d.length;e<n;e+=this.#we){s=[];for(let n=0;n<r.length;++n){a=!0;for(let t=0;t<this.#we;++t)if(this.#d[e+t]!==r[n][t]){a=!1;break}a&&(o[t.findIndex(i(r[n]))]=!0,s.push(n))}for(let e=0;e<s.length;++e)r.splice(s[e],1);if(0===r.length)break}return o}clone(){const e=this.#d.slice(0),t=new(0,this.constructor)(this.getGeometry().clone(),e,this.#pe);if(this.isConstantRSI())t.setRescaleSlopeAndIntercept(this.getRescaleSlopeAndIntercept());else for(let e=0;e<this.#Ee();++e)t.setRescaleSlopeAndIntercept(this.#Re(e),e);return t.setPhotometricInterpretation(this.getPhotometricInterpretation()),t.setPlanarConfiguration(this.getPlanarConfiguration()),t.setPaletteColourMap(structuredClone(this.#Ie)),t.setMeta(structuredClone(this.getMeta())),t}replaceBuffer(e){this.#d=e,this.dispatchEvent(new CustomEvent("imagecontentchange"))}#Fe(e){let t=this.#d;if(this.#d=Fe(this.#d,e),null===this.#d)throw new Error("Cannot reallocate data for image.");this.#d.set(t),t=null,this.dispatchEvent(new CustomEvent("imagebufferrealloc"))}#Me(e,t,n){e>=n||(this.#d.set(this.#d.subarray(e,n),e+t),this.dispatchEvent(new CustomEvent("imagesliceshift",{detail:{indexOffset:e,insertSize:t,maxOffset:n}})))}canAppendSlice(e){if(null===e)return{success:!1,message:"Cannot append null slice"};const t=this.#de.canAppendSlice(e.getGeometry());return t.success?this.#qe(e):t}#qe(e){if(this.#ye!==e.getPhotometricInterpretation())return{success:!1,message:"Cannot append a slice with different photometric interpretation"};for(const t in this.#Le)if("windowPresets"!==t&&"sliceCapacity"!==t&&"custom"!==t&&"SeriesTime"!==t&&this.#Le[t]!==e.getMeta()[t])return{success:!1,message:`Cannot append a slice with different ${t}: ${this.#Le[t]} != ${e.getMeta()[t]}`};return new yt(!0)}appendSlice(e){const t=this.canAppendSlice(e);if(!t.success)throw new Error(t.message);const n=e.getDataRange(),i=this.getDataRange();this.#Pe={min:Math.min(n.min,i.min),max:Math.max(n.max,i.max)};const o=e.getRescaledDataRange(),r=this.getRescaledDataRange();this.#Ae={min:Math.min(o.min,r.min),max:Math.max(o.max,r.max)};let s=this.getGeometry().getSize();const l=e.getGeometry().getInitialTime(),c=l?.id.value,u=this.#de.getCurrentTotalNumberOfSlices();let d=!1;void 0===c||this.#de.hasSlicesAtTime(c)||(this.appendFrame(l,e.getGeometry().getOrigin()),s=this.#de.getSize(),d=!0);const h=function(e,t){const n=t.getInitialTime()?.id.value,i=[];if(i.push(0),i.push(0),i.push(e.getSliceIndex(t.getOrigin(),n)),void 0!==n){const t=e.getVolumeIndex(n);i.push(-1!==t?t:n)}return new a(i)}(this.#de,e.getGeometry()),g=this.#we*s.getDimSize(2);if(void 0===this.#Le.sliceCapacity)throw new Error("Missing slice capacity for buffer manipulation.");const S=g*this.#Le.sliceCapacity;this.#d.length!==S&&this.#Fe(S);const m=h.get(2);let p=m;void 0!==c&&(p+=this.#de.getCurrentNumberOfSlicesBeforeTime(c));const f=p*g,v=u*g;this.#Me(f,g,v),this.#d.set(e.getBuffer(),f),d||this.#de.appendOrigin(e.getGeometry().getOrigin(),m,c),this.setRescaleSlopeAndIntercept(e.getRescaleSlopeAndIntercept(),p);const C=this.#pe.length;if(this.#pe.splice(p,0,e.getImageUid()),void 0!==this.#Le.windowPresets){const t=this.#Le.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)&&!Qt(a.wl[0],r.wl[0])){a.perslice=!0;for(let e=0;e<C-1;++e)a.wl.push(a.wl[0])}void 0!==a.perslice&&!0===a.perslice&&t[o].wl.splice(p,0,r.wl[0])}else t[o]=n[o]}}this.dispatchEvent(new CustomEvent("imagegeometrychange"))}appendFrameBuffer(e,t){const n=this.#de.getSize(),i=this.#we*n.getDimSize(2);if(void 0===this.#Le.sliceCapacity)throw new Error("Missing slice capacity for frame buffer manipulation.");const o=i*this.#Le.sliceCapacity;this.#d.length!==o&&this.#Fe(o),t>=this.#Le.sliceCapacity?s.warn(`Ignoring frame at index ${t} (size: ${this.#Le.sliceCapacity})`):(this.#d.set(e,i*t),this.appendFrame({id:{value:t}},new m(0,0,0)))}appendFrame(e,t){this.#de.appendFrame(t,e),this.dispatchEvent(new CustomEvent("appendframe"))}getDataRange(){return this.#Pe||(this.#Pe=this.calculateDataRange()),this.#Pe}getRescaledDataRange(){return this.#Ae||(this.#Ae=this.calculateRescaledDataRange()),this.#Ae}getHistogram(){return this.#Oe||(this.#Oe=this.#Ue(),this.#Pe=this.#Oe.getRange(),this.#Ae=this.#Oe.getRescaledRange()),this.#Oe}getValue(e,t,n,i){const o=[e,t,n];void 0!==i&&o.push(i);const r=new a(o);return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(r))}getValueAtIndex(e){return this.getValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValue(e,t,n,i){let o=this.getValue(e,t,n,i);if(!this.isIdentityRSI())if(this.isConstantRSI())o=this.getRescaleSlopeAndIntercept().apply(o);else{const r=[e,t,n];void 0!==i&&r.push(i);const s=new a(r);o=this.getRescaleSlopeAndIntercept(s).apply(o)}return o}getRescaledValueAtIndex(e){return this.getRescaledValueAtOffset(this.getGeometry().getSize().indexToOffset(e))}getRescaledValueAtOffset(e){let t=this.getValueAtOffset(e);if(!this.isIdentityRSI())if(this.isConstantRSI())t=this.getRescaleSlopeAndIntercept().apply(t);else{const n=this.getGeometry().getSize().offsetToIndex(e);t=this.getRescaleSlopeAndIntercept(n).apply(t)}return t}getRescaledValuesAtPosition(e){const t=[];if(!this.canQuantify())return t;const n=this.getGeometry(),i=n.getSize(),o=this.getMeta().pixelUnit,r=n.worldToIndex(e).getValues().slice(0,3),s=i.length()>3;if(s&&r.push(0),!n.isIndexInBounds(new a(r)))return t;const l=s?i.get(3):1;let c=n.getVolumeIds();c?.length!==l&&(c=void 0);for(let e=0;e<l;++e){s&&(r[3]=e);const n=void 0!==c?{...c[e]}:{id:{value:e}};t.push({volumeId:n,pixValue:{value:this.getRescaledValueAtIndex(new a(r)),unit:o}})}return t}calculateDataRange(){let e,t=this.getValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();i.length()>=3&&(o=i.getDimSize(3));for(let i=0;i<o;++i)e=this.getValueAtOffset(i),e>n&&(n=e),e<t&&(t=e);return{min:t,max:n}}calculateRescaledDataRange(){if(this.isIdentityRSI())return this.getDataRange();if(this.isConstantRSI()){const e=this.getDataRange(),t=this.getRescaleSlopeAndIntercept().apply(e.min),n=this.getRescaleSlopeAndIntercept().apply(e.max);return{min:t<n?t:n,max:t>n?t:n}}let e,t=this.getRescaledValueAtOffset(0),n=t;const i=this.getGeometry().getSize();let o=i.getTotalSize();i.length()>=3&&(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}}#Ue(){const e=this.getGeometry().getSize(),t=e.getDimSize(2),n=new Gt(this.getMeta().pixelUnit);for(let i=0,o=e.getTotalSize();i<o;i+=t){const o=n.getHistogram(this.getRescaleSlopeAndIntercept(e.offsetToIndex(i)));for(let e=i;e<i+t;++e)o.add(this.getValueAtOffset(e))}return n}convolute2D(e){if(9!==e.length)throw new Error(`The convolution matrix does not have a length of 9; it has ${e.length}`);const t=this.clone(),n=t.getBuffer(),i=this.getGeometry().getSize(),o=i.getDimSize(2)*this.getNumberOfComponents();for(let t=0;t<i.get(2);++t)this.convoluteBuffer(e,n,t*o);return t}convoluteBuffer(e,t,n){const i=this.getGeometry().getSize(),o=i.get(0),r=i.get(1),a=this.getNumberOfComponents();let s=1,l=1;3===a&&(0===this.getPlanarConfiguration()?s=3:l=i.getDimSize(2));const c=[];c[0]=(-o-1)*s,c[1]=-o*s,c[2]=(1-o)*s,c[3]=-s,c[4]=0,c[5]=s,c[6]=(o-1)*s,c[7]=o*s,c[8]=(o+1)*s;const u=[];u[0]=c[4],u[1]=c[4],u[2]=c[5],u[3]=c[4],u[4]=c[4],u[5]=c[5],u[6]=c[7],u[7]=c[7],u[8]=c[8];const d=[];d[0]=c[1],d[1]=c[1],d[2]=c[2],d[3]=c[4],d[4]=c[4],d[5]=c[5],d[6]=c[7],d[7]=c[7],d[8]=c[8];const h=[];h[0]=c[1],h[1]=c[1],h[2]=c[2],h[3]=c[4],h[4]=c[4],h[5]=c[5],h[6]=c[4],h[7]=c[4],h[8]=c[5];const g=[];g[0]=c[3],g[1]=c[4],g[2]=c[5],g[3]=c[3],g[4]=c[4],g[5]=c[5],g[6]=c[6],g[7]=c[7],g[8]=c[8];const S=[];S[0]=c[0],S[1]=c[1],S[2]=c[2],S[3]=c[3],S[4]=c[4],S[5]=c[5],S[6]=c[3],S[7]=c[4],S[8]=c[5];const m=[];m[0]=c[3],m[1]=c[4],m[2]=c[4],m[3]=c[3],m[4]=c[4],m[5]=c[4],m[6]=c[6],m[7]=c[7],m[8]=c[7];const p=[];p[0]=c[0],p[1]=c[1],p[2]=c[1],p[3]=c[3],p[4]=c[4],p[5]=c[4],p[6]=c[6],p[7]=c[7],p[8]=c[7];const f=[];f[0]=c[0],f[1]=c[1],f[2]=c[1],f[3]=c[3],f[4]=c[4],f[5]=c[4],f[6]=c[3],f[7]=c[4],f[8]=c[4];let v,C,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=m:i===o-1&&n===r-1?C=f:0===i&&n!==r-1&&0!==n?C=d:i===o-1&&n!==r-1&&0!==n?C=p:0!==i&&i!==o-1&&0===n?C=g:0!==i&&i!==o-1&&n===r-1&&(C=S),v=0;for(let t=0;t<9;++t)v+=this.getValueAtOffset(D+C[t])*e[t];t[D]=v,D+=s}}}transform(e){const t=this.clone(),n=t.getBuffer();for(let i=0,o=n.length;i<o;++i)n[i]=e(t.getValueAtOffset(i));return t}compose(e,t){const n=this.clone(),i=n.getBuffer();for(let n=0,o=i.length;n<o;++n)i[n]=Math.floor(t(this.getValueAtOffset(n),e.getValueAtOffset(n)));return n}isResampled(){return this.#he}resample(e,t=void 0,n=void 0){null===this.#be&&(this.#be=new Et,this.#be.ondoneframe=e=>{const t=e.data;this.#ge===t.jobId&&(this.#d.set(t.targetImageBuffer,t.startOffset),this.dispatchEvent(new CustomEvent("imageresampled",{detail:{frame:t.frame}})))},this.#be.ondone=e=>{this.dispatchEvent(new CustomEvent("imageresamplingcomplete"))});const i=this.#he&&this.#me&&this.#Se?{buffer:this.#me,geometry:this.#Se}:{buffer:this.#d,geometry:this.#de};this.dispatchEvent(new CustomEvent("imageresamplingstart"));const o=this.#be.run(i.buffer,i.geometry,this.#Le.PixelRepresentation,e,void 0===t||t,n);this.#he||(this.#he=!0,this.#me=this.#d,this.#Se=this.#de),this.#d=o.buffer,this.#de=o.geometry;const r=i.geometry.getVolumeIds();void 0!==r&&this.#de.setVolumeIds(r),this.#ge=o.jobId,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange"))}revert(){this.#he&&(this.dispatchEvent(new CustomEvent("imageresamplingstart")),this.#he=!1,this.#d=this.#me,this.#de=this.#Se,this.#me=null,this.#Se=null,this.dispatchEvent(new CustomEvent("imagecontentchange")),this.dispatchEvent(new CustomEvent("imagegeometrychange")),this.dispatchEvent(new CustomEvent("imageresampled")))}}const Xt=["annotationgroupeditablechange","annotationadd","annotationupdate","annotationremove"];class Yt extends EventTarget{#Qe;#Le={};#Ve;#Ne;constructor(e){super(),this.#Qe=void 0!==e?e:[],this.#Ve=!0}getList(){return this.#Qe}getLength(){return this.#Qe.length}isEditable(){return this.#Ve}setEditable(e){this.#Ve=e,this.dispatchEvent(new CustomEvent("annotationgroupeditablechange",{detail:{data:e}}))}getColour(){return this.#Ne}setColour(e){this.#Ne=e}add(e,t){this.#Qe.push(e),this.dispatchEvent(new CustomEvent("annotationadd",{detail:{data:e,propagate:t}}))}update(e,t,n){const i=this.#Qe.findIndex(t=>t.trackingUid===e.trackingUid);-1!==i?((t.includes("mathShape")||t.includes("textExpr"))&&e.updateQuantification(),this.#Qe[i]=e,this.dispatchEvent(new CustomEvent("annotationupdate",{detail:{data:e,keys:t,propagate:n}}))):s.warn("Cannot find annotation to update")}remove(e,t){const n=this.#Qe.findIndex(t=>t.trackingUid===e);if(-1!==n){const e=this.#Qe.splice(n,1)[0];this.dispatchEvent(new CustomEvent("annotationremove",{detail:{data:e,propagate:t}}))}else s.warn("Cannot find annotation to remove")}setViewController(e){for(const t of this.#Qe)t.setViewController(e),t.updateQuantification()}find(e){return this.#Qe.find(t=>t.trackingUid===e)}getMeta(){return this.#Le}hasMeta(e){return void 0!==this.#Le[e]}getMetaValue(e){return this.#Le[e]}setMetaValue(e,t){this.#Le[e]=t}}class Wt{r;g;b;constructor(e,t,n){this.r=e,this.g=t,this.b=n}}function $t(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 jt(e,t,n){return{r:e+1.402*(n-128),g:e-.34414*(t-128)-.71414*(n-128),b:e+1.772*(t-128)}}function Zt(e){return{r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)}}function Kt(e){return`#${((1<<24)+(e.r<<16)+(e.g<<8)+e.b).toString(16).slice(1)}`}function _t(e){return{l:.001525902*e.l,a:.003891051*e.a-128,b:.003891051*e.b-128}}function Jt(e){return{l:655.35*e.l,a:257*e.a+32896,b:257*e.b+32896}}const en={x:95.0489,y:100,z:108.884};function tn(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=en,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 nn(e){return function(e){function t(e){let t;return t=e>.008856452?Math.pow(e,.333333333):7.787037037*e+.137931034,t}const n=en,i=t(e.y/n.y);return{l:116*i-16,a:500*(t(e.x/n.x)-i),b:200*(i-t(e.z/n.z))}}(function(e){function t(e){let t;return t=e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4),t}const n=t(e.r/255),i=t(e.g/255),o=t(e.b/255);return{x:100*(.4124*n+.3576*i+.1805*o),y:100*(.2126*n+.7152*i+.0722*o),z:100*(.0193*n+.1192*i+.9505*o)}}(e))}const on=[new Wt(0,0,0),new Wt(255,0,0),new Wt(0,255,0),new Wt(0,0,255),new Wt(255,255,0),new Wt(0,255,255),new Wt(255,0,255),new Wt(255,239,213),new Wt(0,0,205),new Wt(205,133,63),new Wt(210,180,140),new Wt(102,205,170),new Wt(0,0,128),new Wt(0,139,139),new Wt(46,139,87),new Wt(255,228,225)];function rn(e){let t;return t=e<on.length?on[e]:new Wt(255*Math.random(),255*Math.random(),255*Math.random()),t}class an{#Be=10;#ke="Verdana";#Ge="#fff";#ze="#ffff80";#He={x:1,y:1};#Xe={x:1,y:1};#Ye=2;#We={x:.25,y:.25};#$e=.2;#je=3;getFontFamily(){return this.#ke}getFontSize(){return this.#Be}getStrokeWidth(){return this.#Ye}getTextColour(){return this.#Ge}getLineColour(){return this.#ze}setLineColour(e){this.#ze=e}setBaseScale(e){this.#He=e}setZoomScale(e){this.#Xe=e}getBaseScale(){return this.#He}getZoomScale(){return this.#Xe}scale(e){return e/this.#He.x}applyZoomScale(e){return{x:e/this.#Xe.x,y:e/this.#Xe.y}}applyZoomRatio(e){return e*this.#Xe.x/this.#Xe.y}getShadowOffset(){return this.#We}getTagOpacity(){return this.#$e}getTextPadding(){return this.#je}getFontStr(){return`normal ${this.getFontSize()}px sans-serif`}getLineHeight(){return this.getFontSize()+this.getFontSize()/5}getScaledFontSize(){return this.scale(this.getFontSize())}getScaledStrokeWidth(){return this.scale(this.getStrokeWidth())}getShadowLineColour(){return function(e){return.001172549*(t=Zt(e)).r+.002301961*t.g+447059e-9*t.b<.5;var t}(this.getLineColour())?"#fff":"#000"}}function sn(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 ln(e){const t=sn(e);return 0===Object.keys(t).length?null:t.query}function cn(e){let t;const n=ln(e);return n&&void 0!==n.input&&(t=dn(n.input,n.dwvReplaceMode)),t}function un(e,t){const n=ln(e);n&&void 0!==n.input&&hn(n.input,n.nslices,t)}function dn(e,t){const n=[];let i="key";t&&(i=t);const o=decodeURIComponent(e),r=sn(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 hn(e,t,n){let i="";"/"===e[0]&&"undefined"!=typeof location&&"null"!==location.origin&&(i=location.origin),i+=e;const o=new XMLHttpRequest;o.open("GET",decodeURIComponent(i),!0),o.responseType="document",o.onload=function(e){n(function(e,t){const n=[],i=`${e.getElementsByTagName("wado_query")[0].getAttribute("wadoURL")}?requestType=WADO&contentType=application/dicom&`,o=e.getElementsByTagName("Patient");o.length>1&&s.warn("More than one patient, loading first one.");const r=o[0].getElementsByTagName("Study");r.length>1&&s.warn("More than one study, loading first one.");const a=r[0].getAttribute("StudyInstanceUID"),l=r[0].getElementsByTagName("Series");l.length>1&&s.warn("More than one series, loading first one.");const c=l[0].getAttribute("SeriesInstanceUID"),u=l[0].getElementsByTagName("Instance");let d=u.length;t<d&&(d=t);for(let e=0;e<d;++e){const t=`${i}&studyUID=${a}&seriesUID=${c}&objectUID=${u[e].getAttribute("SOPInstanceUID")}`;n.push(t)}return n}(e.target.responseXML,t))},o.onerror=function(e){s.warn(`RequestError while receiving manifest: ${e.target.status}`)},o.send(null)}const gn=["mousedown","mousemove","mouseup","mouseout","wheel","dblclick","contextmenu","touchstart","touchmove","touchend","touchcancel"],Sn=["wheel","contextmenu","touchstart"];function mn(e){return{passive:!Sn.includes(e)}}function pn(e,t){let n=0,i=0;void 0!==t&&(n=t.left,i=t.top);const o=[];for(let t=0;t<e.length;++t)o.push(new S(e[t].clientX-n,e[t].clientY-i));return o}function fn(e){const t=e.currentTarget.getBoundingClientRect();let n=[];return void 0!==e.targetTouches&&0!==e.targetTouches.length?n=pn(e.targetTouches,t):void 0!==e.changedTouches&&0!==e.changedTouches.length&&(n=pn(e.changedTouches,t)),n}function vn(e){return new S(e.offsetX,e.offsetY)}function Cn(e,t){return e.x<=t.x&&e.y<=t.y}class Dn{#Ze=[];#Ke=[];canCreate(e,t){if(e.x<1||e.y<1)return!1;if(this.#Ze.some(t=>Cn(e,t)))return!0;if(this.#Ke.some(t=>Cn(t,e)))return!1;const n=function(e,t,n){if(e<1||t<1)return!1;const i=n.createElement("canvas");i.width=e,i.height=t;const o=n.createElement("canvas");o.width=1,o.height=1;const r=i.getContext("2d"),a=o.getContext("2d");let s=!1;return r&&a&&(r.fillRect(e-1,t-1,1,1),a.drawImage(i,e-1,t-1,1,1,0,0,1,1),s=0!==a.getImageData(0,0,1,1).data[3]),i.width=0,i.height=0,o.width=0,o.height=0,s}(e.x,e.y,t),i={x:e.x,y:e.y};return n?(this.#Ze=this.#Ze.filter(e=>!Cn(e,i)),this.#Ze.push(i)):(this.#Ke=this.#Ke.filter(e=>!Cn(i,e)),this.#Ke.push(i)),n}}class yn{#_e;#Je=null;#et=[];#tt={};#nt=new Set;#it={};#ot;constructor(e,t){this.#_e=e,this.#ot=t,void 0===this.#ot&&"undefined"!=typeof document&&(this.#ot=document)}init(){for(const e in this.#_e)this.#_e[e].init();this.enableShortcuts(!0)}enableShortcuts(e){void 0!==this.#ot&&(e?this.#ot.addEventListener("keydown",this.#rt):this.#ot.removeEventListener("keydown",this.#rt))}#rt=e=>{if(e.defaultPrevented||function(e){if(null===e||"object"!=typeof e)return!1;const t=e;return!0===t.isContentEditable||["INPUT","SELECT","TEXTAREA"].includes(t.tagName)}(e.target))return;const t=this.#Je?.keydown;t&&t(e)};getToolList(){return this.#_e}hasTool(e){return void 0!==this.getToolList()[e]}getSelectedTool(){return this.#Je}getSelectedToolEventHandler(e){if(this.getSelectedTool())return this.getSelectedTool()[e]}setSelectedTool(e){if(!this.hasTool(e))throw new Error(`Unknown tool: '${e}'`);this.#Je&&this.#Je.activate(!1),this.#Je=this.#_e[e],this.#Je.activate(!0)}setToolFeatures(e){this.getSelectedTool()&&this.getSelectedTool().setFeatures(e)}bindLayerGroup(e,t){const n=e.getDivId();e.addEventListener("activelayerchange",this.#at(n)),this.#st(n,t)}#st(e,t){const n=this.#tt[e];void 0!==n&&(this.#nt.has(n.getId())?this.#it[n.getId()]=n:this.#lt(n)),this.#tt[e]=t,void 0!==this.#it[t.getId()]?delete this.#it[t.getId()]:this.#ct(t)}#ut(e,t){if(t.targetTouches?.length>0)return;this.#nt.delete(e);const n=this.#it[e];void 0!==n&&(delete this.#it[e],this.#lt(n))}#at(e){return t=>{const n=t.detail?.value,i=n?.[0];void 0!==i&&this.#st(e,i)}}#ct(e){e.bindInteraction();const t=gn;for(let n=0;n<t.length;++n)e.addEventListener(t[n],this.#dt(e.getId(),t[n]))}#lt(e){e.unbindInteraction();const t=gn;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.#et[e]&&(this.#et[e]=[]),void 0===this.#et[e][t]){const n=t=>{if("touchstart"===t.type&&this.#nt.add(e),this.#Je){const e=this.#Je[t.type];e&&e(t)}"touchend"!==t.type&&"touchcancel"!==t.type||this.#ut(e,t)};this.#et[e][t]=n}return this.#et[e][t]}}class In{#ht=[];#gt=2;#St;constructor(e){this.#St=e}setNumberOfDimensions(e){this.#gt=e}setNToLoad(e){for(let t=0;t<e;++t){this.#ht[t]=[];for(let e=0;e<this.#gt;++e)this.#ht[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.#ht[e.index][e.subindex]=t,n=void 0!==e.item?e.item:{loaded:this.#mt(e.index),total:100,source:e.source},this.#St({lengthComputable:!0,loaded:this.#pt(),total:100,item:n})};#mt(e){let t=0;for(let n=0;n<this.#gt;++n)t+=this.#ht[e][n];return t/this.#gt}#pt(){let e=0;const t=this.#ht.length;for(let n=0;n<t;++n)e+=this.#mt(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 Tn{onloadstart(e){}onprogress(e){}onloaditem(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class wn extends Tn{#ft=null;#vt=[];#Ct=null;#Dt=0;#yt=0;#It;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#Tt(e){this.#ft=e,this.#Dt=0,this.#yt=0,this.#It=!1,this.#wt(),this.#Lt()}#Pt(e){this.#vt.push(e)}#wt(){this.#vt=[]}#At(e){this.#Ct=e}#Lt(){this.#Ct=null}#Ot=e=>{this.#Dt++,this.#Dt===this.#ft.length&&this.onload({source:this.#ft})};#bt=e=>{this.#yt++,this.#yt===this.#ft.length&&this.onloadend({source:this.#ft})};#xt(e,t){return n=>{n.source=t,e(n)}}load(e,t){this.onloadstart({source:e}),1===e.length&&(y(e[0],"DICOMDIR")||y(e[0],".dcmdir"))?this.#Et(e[0],t):this.#Rt(e,t)}#Ft(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.#bt()):e.load(i.target.response,t,n)}}#Rt(e,t){if(void 0===e||0===e.length)return;this.#Tt(e);const n=new In(this.onprogress);n.setNToLoad(e.length);const i=Vl(),o=[];for(let e=0;e<i.length;++e)o.push(new i[e]);let r=e[0],a=null,s=!1;for(let i=0;i<o.length;++i)if(a=o[i],a.canLoadUrl(r,t)){s=!0,a.setOptions({numberOfItems:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),a.onprogress=n.getUndefinedMonoProgressHandler(1),a.onloaditem=this.onloaditem,a.onload=this.#Ot,a.onloadend=this.#bt,a.onerror=this.onerror,a.onabort=this.onabort,this.#At(a);break}if(!s)throw new Error(`No loader found for url: ${r}`);let l=0;const c=()=>{l<this.#vt.length-1&&!this.#It&&(++l,this.#vt[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.#xt(n.getMonoProgressHandler(i,0),r),o.onload=this.#Ft(a,r,i),o.onloadend=c;const s=this.#xt(this.onerror,r);o.onerror=e=>{this.#bt(),s(e)};const l=this.#xt(this.ontimeout,r);o.ontimeout=e=>{this.#bt(),l(e)};const u=this.#xt(this.onabort,r);o.onabort=e=>{this.#bt(),u(e)},1===a.loadUrlAs()&&(o.responseType="arraybuffer"),this.#Pt(o)}let u=this.#vt.length;void 0!==t&&void 0!==t.batchSize&&0!==u&&(u=Math.min(t.batchSize,this.#vt.length));for(let e=0;e<u;++e)this.#It||(l=e,this.#vt[l].send(null))}#Et(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 Ne;return t.parse(e),function(e){const t=e["00041220"];if(void 0===t||void 0===t.value)return void s.warn("No Directory Record Sequence found in DICOMDIR.");const n=t.value;if(0===n.length)return void s.warn("The Directory Record Sequence of the DICOMDIR is empty.");const i=[];let o=null,r=null;for(let e=0;e<n.length;++e){const t=n[e]["00041430"];if(void 0===t||void 0===t.value)continue;const a=t.value[0];if("STUDY"===a)r=[],i.push(r);else if("SERIES"===a)o=[],r.push(o);else if("IMAGE"===a){const t=n[e]["00041500"];if(void 0===t||void 0===t.value)continue;const i=t.value;o.push(i.join("/"))}}return i}(t.getDicomElements())}(n.target.response)[0][0],o=e.split("/").slice(0,-1).join("/"),r=[];for(let e=0;e<i.length;++e)r.push(`${o}/${i[e]}`);this.#Rt(r,t)}},n.onerror=t=>{this.#xt(this.onerror,e)(t),this.onloadend({})},n.onabort=t=>{this.#xt(this.onabort,e)(t),this.onloadend({})},n.send(null)}abort(){this.#It=!0;for(let e=0;e<this.#vt.length;++e)4!==this.#vt[e].readyState&&this.#vt[e].abort();this.#Ct&&this.#Ct.isLoading()&&this.#Ct.abort()}ontimeout(e){}}class Ln extends mt{getStartMessage(){const e=this.startMessage.buffer.slice();return{message:{...this.startMessage,buffer:e},transfer:[e.buffer]}}}class Pn extends Ln{getWorker(){return new r.wc(new URL("./assets/workers/jpegbaseline.worker.min.js",import.meta.url),{name:"jpegbaseline.worker",type:"module"})}}class An extends Ln{getWorker(){return new r.wc(new URL("./assets/workers/jpegloss.worker.min.js",import.meta.url),{name:"jpegloss.worker",type:"module"})}}class On extends Ln{getWorker(){return new r.wc(new URL("./assets/workers/jpeg2000.worker.min.js",import.meta.url),{name:"jpeg2000.worker",type:"module"})}}class bn extends Ln{getWorker(){return new r.wc(new URL("./assets/workers/rle.worker.min.js",import.meta.url),{name:"rle.worker",type:"module"})}}class xn{#Mt;#qt;#Ut=!1;constructor(e){this.#Mt=e,this.#qt=new gt}decode(e,t,n){this.#Ut||(this.#Ut=!0,this.#qt.onworkstart=this.ondecodestart,this.#qt.onworkitem=this.ondecodeditem,this.#qt.onwork=this.ondecoded,this.#qt.onworkend=this.ondecodeend,this.#qt.onerror=this.onerror,this.#qt.onabort=this.onabort);const i={buffer:e,meta:t};let o;"jpeg-baseline"===this.#Mt?o=new Pn(i,n):"jpeg-lossless"===this.#Mt?o=new An(i,n):"jpeg2000"===this.#Mt?o=new On(i,n):"rle"===this.#Mt&&(o=new bn(i,n)),void 0!==o&&this.#qt.addWorkerTask(o)}abort(){this.#qt.abort()}ondecodestart(e){}ondecodeditem(e){}ondecoded(e){}ondecodeend(e){}onerror(e){}onabort(e){}}const En="00080100",Rn="00080102",Fn="00080119",Mn="00080120";class qn{meaning;value;longValue;urnValue;schemeDesignator;constructor(e){this.meaning=e}toString(){return`(${this.value}, ${this.schemeDesignator}, '${this.meaning}')`}}function Un(e,t){return void 0!==e&&void 0!==t&&e.schemeDesignator===t.schemeDesignator&&e.value===t.value}function Qn(e){const t=new qn(e["00080104"].value[0]);if(void 0!==e[En])t.value=e[En].value[0];else if(void 0!==e[Fn])t.longValue=e[Fn].value[0];else{if(void 0===e[Mn])throw new Error("Invalid code with no value, no long value and no urn value.");t.urnValue=e[Mn].value[0]}if(void 0!==t.value||void 0!==t.longValue){if(void 0===e[Rn])throw new Error("No coding sheme designator when code value or long value is present");t.schemeDesignator=e[Rn].value[0]}return t}function Vn(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 Nn={value:"111017",meaning:"CAD Processing and Findings Summary"},Bn={value:"111030",meaning:"Image Region"},kn={value:"111059",meaning:"Single Image Finding"},Gn={value:"111099",meaning:"Selected region"},zn={value:"111242",meaning:"All algorithms succeeded; with findings"},Hn={value:"112000",meaning:"Chest CAD Report"},Xn={value:"112020",meaning:"Response Evaluation"},Yn={value:"112021",meaning:"Response Evaluation Method"},Wn={value:"112022",meaning:"RECIST"},$n={value:"112039",meaning:"Tracking Identifier"},jn={value:"112051",meaning:"Measurement of Response"},Zn={value:"112040",meaning:"Tracking Unique Identifier"},Kn={value:"112048",meaning:"Current Response"},_n={value:"113076",meaning:"Segmentation"},Jn={value:"121055",meaning:"Path"},ei={value:"121106",meaning:"Comment"},ti={value:"121322",meaning:"Source image for image processing operation"},ni={value:"121324",meaning:"Source Image"},ii={value:"122438",meaning:"Reference Points"},oi={value:"125007",meaning:"Measurement Group"},ri={value:"125309",meaning:"Short Label"},ai={value:"126000",meaning:"Imaging Measurement Report"},si={value:"126010",meaning:"Imaging Measurements"},li={value:"128773",meaning:"Reference Geometry"},ci={1483009:"Angle",42798e3:"Area",103355008:"Width",103339001:"Long axis",103340004:"Short axis",131190003:"Radius",261665006:"Unknown",410668003:"Length",718499004:"Color"},ui={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 di(e){const t=new qn(e.meaning);return t.schemeDesignator="DCM",t.value=e.value,t}function hi(e,t){let n,i;return"SCT"===t?n=ci[e]:"UCUM"===t&&(n=ui[e]),void 0!==n&&(i=new qn(n),i.schemeDesignator=t,i.value=e),i}function gi(){return di(_n)}function Si(){return hi("718499004","SCT")}const mi={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"}},pi={"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 fi(e){const t=pi[e];let n;return void 0!==t?n=hi(t,"UCUM"):void 0===t&&(n=hi("1","UCUM")),n}const vi="00089124",Ci="00082112",Di="00081150",yi="00081155",Ii="00209111",Ti="00209164",wi="00209113",Li="00209116",Pi="00289110",Ai="52009230";class Oi{dimIndex;imagePosPat;derivationImages;refSegmentNumber;imageOrientationPatient;spacing;constructor(e,t,n,i){this.dimIndex=e,this.imagePosPat=t,this.derivationImages=n,this.refSegmentNumber=i}}function bi(e){const t=[];if(void 0!==e[vi]){const n=e[vi].value;for(let e=0;e<n.length;++e){const i=[];if(void 0!==n[e][Ci]){const t=n[e][Ci].value;for(let e=0;e<t.length;++e){const n={};void 0!==t[e][Di]&&(n.referencedSOPClassUID=t[e][Di].value[0]),void 0!==t[e][yi]&&(n.referencedSOPInstanceUID=t[e][yi].value[0]),i.push(n)}}t.push({sourceImages:i})}}if(void 0===e[Ii])return void s.info("Missing frame content sequence");const n=e[Ii].value;if(0===n.length)return void s.info("Empty frame content sequence");const i=n[0]["00209157"].value;let o;const r=e["0062000A"];if(void 0!==r){const e=r.value[0];o=parseInt(e["0062000B"].value[0],10)}if(void 0===e[wi])return void s.info("Missing plane position sequence");const a=e[wi].value;if(0===a.length)return void s.info("Empty plane position sequence");const l=a[0]["00200032"].value;for(let e=0;e<l.length;++e)l[e]=parseFloat(l[e]);const c=new Oi(i,l,t,o);if(void 0!==e[Li]){const t=e[Li];if(0!==t.value.length){const e=t.value[0]["00200037"].value;void 0!==e&&(c.imageOrientationPatient=e)}}if(void 0!==e[Pi]){const t=e[Pi];if(0!==t.value.length){const e=st(t.value[0]);void 0!==e&&(c.spacing=e)}else s.warn("No shared functional group pixel measure sequence items.")}return c}function xi(e,t){const n=de(e,Ai);let i;if(void 0!==n){if(void 0!==t&&t!==n.length)throw new Error("perFrameFuncGroupSequence meta and numberOfFrames are not equal.");i=[];for(const e of n)i.push(bi(e))}return i}function Ei(e){const t={FrameContentSequence:{value:[{DimensionIndexValues:e.dimIndex}]},PlanePositionSequence:{value:[{ImagePositionPatient:e.imagePosPat}]},SegmentIdentificationSequence:{value:[{ReferencedSegmentNumber:e.refSegmentNumber}]}};if(void 0!==e.derivationImages){const n=Vn(di(ti)),i=Vn(di(_n)),o=[];for(const t of e.derivationImages){const e=[];for(const i of t.sourceImages)e.push({PurposeOfReferenceCodeSequence:{value:[n]},ReferencedSOPClassUID:i.referencedSOPClassUID,ReferencedSOPInstanceUID:i.referencedSOPInstanceUID});o.push({DerivationCodeSequence:{value:[i]},SourceImageSequence:{value:e}})}t.DerivationImageSequence={value:o}}return t}function Ri(e,t,n){let i;const o=de(e,Ai);if(void 0!==o){for(const e of o){const o=t(e);if(void 0!==o)if(void 0===i)i=o;else if(i!==o)return void s.debug(`Unhandled varying ${n}`)}return i}}function Fi(e,t){const n=de(e,Ai),i=new le("SQ");return i.value=[n[t]],{...e,[Ai]:i}}function Mi(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0].replaceAll(".","");return{year:parseInt(t.substring(0,4),10),monthIndex:t.length>=6?parseInt(t.substring(4,6),10)-1:0,day:8===t.length?parseInt(t.substring(6,8),10):0}}function qi(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0].replaceAll(":",""),n=parseInt(t.substring(0,2),10),i=t.length>=4?parseInt(t.substring(2,4),10):0,o=t.length>=6?parseInt(t.substring(4,6),10):0;let r=0;const a=t.indexOf(".");if(-1!==a&&a+1<t.length){const e=t.substring(a+1),n=parseInt(e,10),i=3-e.length;r=i>=0?n*Math.pow(10,i):n/Math.pow(10,-i)}return{hours:n,minutes:i,seconds:o,milliseconds:r}}function Ui(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 Qi(e){let t;return void 0!==e&&(t={year:e.getFullYear(),monthIndex:e.getMonth(),day:e.getDate()}),t}function Vi(e){let t;return void 0!==e&&(t={hours:e.getHours(),minutes:e.getMinutes(),seconds:e.getSeconds(),milliseconds:e.getMilliseconds()}),t}function Ni(e){let t;return void 0!==e&&(t=e.year.toString()+(e.monthIndex+1).toString().padStart(2,"0")+e.day.toString().padStart(2,"0")),t}function Bi(e){let t;return void 0!==e&&(t=e.hours.toString().padStart(2,"0")+e.minutes.toString().padStart(2,"0")+e.seconds.toString().padStart(2,"0")),t}function ki(e){return function(t,n){if("mergeId"===n)return t;const i=q(n),o=re(i);let r=o?.getName();void 0===r&&(r=`x${i.getKey()}`);const a=e[n];for(const e in a)void 0===a[e]&&delete a[e];let s;if("SQ"===a.vr){s={value:[]};for(let e=0;e<a.value.length;++e){const t=a.value[e];s.value.push(Object.keys(t).reduce(ki(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(ki(t),{})}function zi(e,t){const n=Object.keys(t);for(const i of n)void 0!==e[i]&&s.debug(`Overwritting tag: ${i}`),e[i]=t[i]}function Hi(e){const t=Object.keys(e),n={};for(const i of t){const t=se(i);if(void 0===t)continue;const o=re(t),r=o?.getVr();let a,l=!1;const c=e[i];if("SQ"===r){const e=[],t=c;if(void 0!==t.undefinedLength&&(l=t.undefinedLength),Array.isArray(t.value))for(const n of t.value)e.push(Hi(n));else s.debug("Non array simpleTag SQ value");a=e}else a=Array.isArray(c)?c:[c];const u=new le(r);u.tag=t,u.value=a,l&&(u.undefinedLength=l),n[t.getKey()]=u}return n}const Xi="00620005",Yi="00620009",Wi="0062000C",$i="0062000D",ji="00620003",Zi="0062000F",Ki="00620020";class _i{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 Ji(e){const t=new _i(e["00620004"].value[0],e[Xi]?e[Xi].value[0]:"n/a",e["00620008"].value[0]);if(void 0!==e[Yi]&&(t.algorithmName=e[Yi].value[0]),void 0!==e[Wi])t.displayValue=e[Wi].value[0];else if(void 0!==e[$i]){const n=e[$i].value,i=tn(_t({l:n[0],a:n[1],b:n[2]}));t.displayRGBValue=i}else s.warn("No recommended colour for segment, using default"),t.displayRGBValue=rn(t.number);if(void 0===e[ji])throw new Error("Missing Segmented Property Category Code Sequence.");if(t.propertyCategoryCode=Qn(e[ji].value[0]),void 0===e[Zi])throw new Error("Missing Segmented Property Type Code Sequence.");return t.propertyTypeCode=Qn(e[Zi].value[0]),void 0!==e[Ki]&&(t.trackingId=e[Ki].value[0],t.trackingUid=e["00620021"].value[0]),t}function eo(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=Jt(nn(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:[Vn(e.propertyCategoryCode)]}),e.propertyTypeCode&&(n.SegmentedPropertyTypeCodeSequence={value:[Vn(e.propertyTypeCode)]}),e.trackingId&&(n.TrackingID=e.trackingId,n.TrackingUID=e.trackingUid),n}const to={GE:"ge",SIEMENS:"siemens",PHILIPS:"philips",HITACHI:"hitachi"};function no(e){return ue(e,"00080070")}function io(e){let t;const n=no(e);return void 0!==n&&(t=n.toUpperCase().startsWith("SIEMENS")?to.SIEMENS:n.startsWith("GE")?to.GE:n.startsWith("Philips")?to.PHILIPS:n.toUpperCase().startsWith("HITACHI")?to.HITACHI:n.toLowerCase()),t}const oo="00080016",ro="00189087",ao="00209111",so="00209157",lo="00209128",co="0020930D",uo="1.2.840.10008.5.1.4.1.1.4",ho="1.2.840.10008.5.1.4.1.1.4.1",go="1.2.840.10008.5.1.4.1.1.4.3",So="1.2.840.10008.5.1.4.1.1.4.4",mo=[{manufacturer:to.SIEMENS,key:"0019100C"},{manufacturer:to.GE,key:"00431039"},{manufacturer:to.HITACHI,key:"00291030"}],po=[{name:"TemporalPositionIdentifier",getter:Po("00200100",e=>parseInt(e,10)),preLoad:!0},{name:"TemporalPositionIndex",getter:function(e){return vo(Ri(e,wo,"TemporalPositionIndex"),lo)},preLoad:!0},{name:"DiffusionBValue",getter:function(e){let t;const n=ue(e,oo);return n!==uo&&n!==ho&&n!==go&&n!==So||(t=function(e){let t;const n=ue(e,oo);if(n===ho||n===go||n===So){const n=Do(e);if(void 0!==n)t={value:n,tagKey:ro};else{const n=function(e){let t;return io(e)===to.PHILIPS&&(t=function(e){let t;return function(e){const t=de(e,"00209222");return void 0!==t&&t.some(e=>"(0018,9087)"===ue(e,"00209165"))}(e)&&(t=Ri(e,Io,"DimensionIndexValues b-value")),t}(e)),t}(e);void 0!==n&&(s.debug("Got b-value for enhanced MR from non standard tag"),t={value:n,tagKey:so})}}else if(n===uo){const n=function(e){let t;const n=io(e),i=ue(e,"00080018");let o;o=void 0!==ke.privateBValueRules?ke.privateBValueRules:mo;for(const r of o){let o;if((void 0!==r.uidPrefix&&void 0!==i&&i.startsWith(r.uidPrefix)||void 0!==r.manufacturer&&void 0!==n&&r.manufacturer===n)&&(o=yo(e,r.key)),void 0!==o&&!isNaN(parseFloat(o))){t={value:o,key:r.key};break}}if(void 0===t){const n=ue(e,ro);void 0!==n&&(t={value:n,key:ro})}return t}(e);if(void 0!==n)t={value:n.value,tagKey:n.key};else{const n=Do(e);void 0!==n&&(t={value:n,tagKey:ro})}}if(void 0===t)return;const i=To(t.value,parseFloat),o=t.tagKey!==so?"unit.smm2":void 0;return vo(i,t.tagKey,o)}(e)),t},preLoad:!0},{name:"EchoTime",getter:Po("00180081",parseFloat,"unit.ms")},{name:"TriggerTime",getter:Po("00181060",parseFloat,"unit.ms")},{name:"InversionTime",getter:Po("00180082",parseFloat,"unit.ms")},{name:"AcquisitionTime",getter:Mo,relative:!0}],fo=[{name:"TemporalPositionTimeOffset",getter:function(e){return vo(Ri(e,Lo,"TemporalPositionTimeOffset"),co,"unit.s")}},{name:"AcquisitionTime",getter:Mo,relative:!0},{name:"ContentTime",getter:function(e){return Fo(e,"00080023","00080033")},relative:!0}];function vo(e,t,n){if(void 0===e)return;const i={value:e,tagKey:t};return void 0!==n&&(i.unit=n),i}function Co(e){let t;const n=de(e,"00189117");return void 0!==n&&(t=ue(n[0],ro)),t}function Do(e){let t;const n=de(e,"52009229");return void 0!==n&&(t=Co(n[0])),void 0===t&&(t=Ri(e,Co,"DiffusionBValue")),t}function yo(e,t){const n=e[t];if(void 0!==n&&"UN"===n.vr&&void 0!==n.value){const e=Ie(String.fromCharCode(...n.value));return 0!==e.length?e.split("\\")[0]:void 0}return ue(e,t)}function Io(e){let t;const n=de(e,ao);if(void 0!==n){const e=de(n[0],so);void 0!==e&&4===e.length&&(t=To(e[2],parseFloat))}return t}function To(e,t){let n;if(void 0!==e){const i=t(e);isNaN(i)||(n=i)}return n}function wo(e){let t;const n=de(e,ao);return void 0!==n&&(t=To(ue(n[0],lo),e=>parseInt(e,10))),t}function Lo(e){let t;const n=de(e,"00209310");return void 0!==n&&(t=To(ue(n[0],co),parseFloat)),t}function Po(e,t,n){return function(i){return vo(To(ue(i,e),t),e,n)}}const Ao=[];function Oo(e){Ao.includes(e)||(Ao.push(e),s.warn(e))}function bo(e,t){const n=e.getter(t);if("number"==typeof n?.value)return{id:{...n,source:e.name}}}function xo(e){return{name:"custom",getter(t){const n=e(t);return void 0!==n?{value:n}:void 0}}}function Eo(e){if(void 0!==ke.getVolumeIdTagValue)return Oo("custom.getVolumeIdTagValue: deprecated since v0.37, please use custom.volumeIdCandidates with a preLoad candidate."),bo(xo(ke.getVolumeIdTagValue),e);for(const t of qo())if(!0===t.preLoad){const n=bo(t,e);if(void 0!==n)return n}}function Ro(e){return Eo(e)?.id.value}function Fo(e,t,n){if(void 0===ue(e,n))return;let i=function(e){const t=qi(e);if(void 0===t)return;const n=3600*t.hours+60*t.minutes+t.seconds+t.milliseconds/1e3;return isNaN(n)?void 0:n}(e[n]);if(void 0!==i&&void 0!==ue(e,t)){const n=Mi(e[t]),o=Date.UTC(n.year,n.monthIndex,n.day);isNaN(o)||(i+=o/1e3)}return vo(i,n,"unit.s")}function Mo(e){return Fo(e,"00080022","00080032")}function qo(){return void 0!==ke.volumeIdCandidates?ke.volumeIdCandidates:po}function Uo(e,t,n){if(e.length!==t.length)return;const i=[];for(const t of e){if("number"!=typeof t||isNaN(t))return;i.includes(t)||i.push(t)}if(i.length<2||i.length*n!==e.length)return;i.sort((e,t)=>e-t);const o=[],r=new Set;for(let a=0;a<e.length;++a){const s=i.indexOf(e[a]),l=s*n+t[a];if(r.has(l))return;r.add(l),o.push(s)}return o}function Qo(e,t,n){const i=[],o=[];for(let r=0;r<t.length;++r){const a=e.getter(t[r]),s=n[r];if("number"!=typeof a?.value||isNaN(a.value)||s<0)return;(void 0===i[s]||a.value<i[s].value)&&(i[s]=a),(void 0===o[s]||a.value>o[s])&&(o[s]=a.value)}for(let e=0;e<i.length;++e)if(void 0===i[e]||e>0&&o[e-1]>=i[e].value)return;const r=!0===e.relative?i[0].value:0;return i.map(t=>({...t,value:t.value-r,source:e.name}))}function Vo(e,t,n){let i;void 0!==ke.getPostLoadVolumeIdTagValue?(Oo("custom.getPostLoadVolumeIdTagValue: deprecated since v0.37, please use custom.volumeIdCandidates."),i=[xo(ke.getPostLoadVolumeIdTagValue)]):i=qo();for(const o of i){const i=e.map(e=>bo(o,e)),r=Uo(i.map(e=>e?.id.value),t,n);if(void 0!==r)return s.debug(`Using '${o.name}' as volume id`),{volumeIndices:r,volumeIds:i,getter:e=>bo(o,e)?.id.value}}}const No="00209116",Bo="00289110";function ko(e){const t=it(e),n=[t[0],t[1],1],i=ue(e,"00280008");if(void 0!==i){const e=parseInt(i,10);e>1&&n.push(e)}const o=new Dt(n);let r=[1,1,1];const a=at(e);if(void 0!==a)r=[a[0],a[1],1];else{const t=ot(e,nt.PixelAspectRatio);void 0!==t&&(r=[t[0],t[1],1],s.warn("Use pixel aspect ratio as spacing"))}const l=new tt(r),c=de(e,"00200032");let u=new Array(0,0,0);void 0!==c&&(u=[parseFloat(c[0]),parseFloat(c[1]),parseFloat(c[2])]);const d=function(e){const t=de(e,nt.ImageOrientationPatient);let n;return void 0!==t&&(n=Ze(t.map(e=>parseFloat(e)))),n}(e),h=new m(u[0],u[1],u[2]),g=Eo(e);return new Lt([h],o,l,d,g)}function Go(e,t,n){const i=e.getDistance(t);if(i>1e-4){if(!(i<.01))throw new Error(`No reference origin for frame origin ${n}`);s.warn(`Frame origin ${n} is far from reference origin (${i}).`)}}function zo(e,t,n,i){const o=it(e),r=new Dt([o[0],o[1],1]);let l,c;const u=de(e,"52009229");if(void 0!==u){const e=u[0];if(void 0!==e[No]){const t=e[No];0!==t.value.length?c=t.value[0]["00200037"].value:s.warn("No shared functional group plane orientation sequence items.")}if(void 0!==e[Bo]){const t=e[Bo];0!==t.value.length?l=st(t.value[0]):s.warn("No shared functional group pixel measure sequence items.")}}const h=[];for(let e=0;e<t.length;++e){const n=v(t[e].imagePosPat);if(f(h,n)||h.push(n),void 0!==t[e].imageOrientationPatient)if(void 0===c)c=t[e].imageOrientationPatient;else if(!A(c,t[e].imageOrientationPatient))throw new Error("Unsupported multi orientation frames geometry.");if(void 0!==t[e].spacing)if(void 0===l)l=t[e].spacing;else if(!l.equals(t[e].spacing))throw new Error("Unsupported multi resolution frames geometry.")}if(void 0===l)throw new Error("No spacing found for frames geometry");if(void 0===c)throw new Error("No imageOrientationPatient found for frames geometry");const g=Ze(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=Ot(S.slice().sort(Tt(g)));2===l.length()?l=new tt([l.get(0),l.get(1),e]):l.get(2)!==e&&s.debug(`Different tag spacing from geo spacing: ${l.get(2)} - ${e}`)}else S=void 0!==i?function(e,t){const n=new Map;for(let i=0;i<e.length;++i){const o=e[i],r=o.getClosest(t);Go(o,t[r],i),n.set(r,o)}const i=[...n.keys()],o=Math.min(...i),r=Math.max(...i),a=[];for(let e=o;e<=r;++e)a.push(n.has(e)?n.get(e):t[e]);return a}(h,i):function(e,t){const n=[];n.push(e[0]);let i=0;for(let o=1;o<e.length;++o){++i;let r=new a([0,0,i]),l=t.indexToWorld(r).get3D();const c=e[o];let u=c.getDistance(l);const h=u;for(;d(u);)if(s.debug(`Adding intermediate pos pats at ${l.toString()}`),n.push(l),++i,r=new a([0,0,i]),l=t.indexToWorld(r).get3D(),u=c.getDistance(l),u>h)throw new Error("Test distance is increasing when adding intermediate pos pats");n.push(c)}return n}(h,new Lt([h[0]],r,l,g));if(3!==l.length())throw new Error("Incomplete spacing found for frames geometry");const m=new Lt([S[0]],r,l,g);for(let e=1;e<S.length;++e)m.appendOrigin(S[e],e);const p=Eo(e);return void 0!==p&&m.setInitialTime(p),m}function Ho(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 Xo(e){const t=[];let n=e.next();for(;!n.done;)t.push(n.value),n=e.next();return t}function Yo(e,t,n,i){const o=e.getGeometry().getSize();let r=2;i&&void 0!==i&&(r=i.getColAbsMax(2).index);const s=t.getValues(),l=new a(s.map(function(e,t){return t===r||t>2?e:0}));let c,u=o.indexToOffset(l);void 0===n&&(n=!1),c=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const d=o.get(0),h=o.get(1),g=o.get(2);let S=o.getDimSize(2);const m=e.getNumberOfComponents(),p=1===e.getPlanarConfiguration(),f=function(e,t,n,i,o,r,a,s){return 1===m?Ho(e,t,n,i,o,r,a,s):3===m?function(e,t,n,i,o,r,a,s,l){const c=[];return l?(c.push(Ho(e,t,n,i,o,r,a,s)),c.push(Ho(e,t+n*i,n,i,o,r,a,s)),c.push(Ho(e,t+2*n*i,n,i,o,r,a,s))):(i*=3,r*=3,c.push(Ho(e,t,n,i,o,r,a,s)),c.push(Ho(e,t+1,n,i,o,r,a,s)),c.push(Ho(e,t+2,n,i,o,r,a,s))),{next(){const e=c[0].next(),t=c[1].next(),n=c[2].next();return e.done?{done:!0,index:n.index}:{value:[e.value,t.value,n.value],done:!1,index:[e.index,t.index,n.index]}}}}(e,3*t,n,i,o,r,a,s,p):void 0};let v;if(i&&void 0!==i){const e=i.getColAbsMax(0),t=i.getColAbsMax(2),n=!1,o=!1;if(2===t.index){const t=d*h;v=0===e.index?f(c,u,t,1,d,d,n,o):f(c,u,t,d,h,1,n,o)}else if(0===t.index){const t=g*h;v=1===e.index?f(c,u,t,d,h,S,n,o):f(c,u,t,S,g,d,n,o)}else{if(1!==t.index)throw new Error(`Unknown direction: ${t.index}`);{const t=g*d;v=0===e.index?f(c,u,t,1,d,S,n,o):f(c,u,t,S,g,1,n,o)}}}else if(1===e.getNumberOfComponents())v=function(e,t,n,i){void 0===i&&(i=1);let o=t;return{next(){if(o<n){const t={value:e(o),done:!1,index:o};return o+=i,t}return{done:!0,index:n}}}}(c,u,u+S);else{if(3!==e.getNumberOfComponents())throw new Error(`Unsupported number of components: ${e.getNumberOfComponents()}`);u*=3,S*=3,v=function(e,t,n,i,o){void 0===i&&(i=1),void 0===o&&(o=!1);let r=t,a=1;o?a=(n-t)/3:i*=3;let s=r+a,l=r+2*a;return{next(){if(r<n){const t={value:[e(r),e(s),e(l)],done:!1,index:[r,s,l]};return r+=i,s+=i,l+=i,t}return{done:!0,index:[n]}}}}(c,u,u+S,1,p)}return v}function Wo(e,t){let n=0,i=0;return{next(){if(n<t){i+1<e.length&&n>=e[i+1].index&&++i;const t={value:e[i].value,done:!1,index:n};return++n,t}return{done:!0,index:t}}}}function $o(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 jo extends mt{getWorker(){return new r.wc(new URL("./assets/workers/labeling.worker.min.js",import.meta.url),{name:"labeling.worker",type:"module"})}}class Zo{#K=new gt(5);constructor(){this.#K.onerror=e=>{console.error("Labeling failed!",e.error)}}run(e,t){this.#K.onworkitem=this.ondone,this.#K.onwork=()=>{};const n=new jo(function(e,t){return{imageBuffer:e,...$o(t.getSize(),t.getSpacing())}}(e,t),{});this.#K.addWorkerTask(n)}runOverlap(e,t){const n=[],i=new Map(e.map(({segNumber:e,minSlice:t})=>[e,t??0]));this.#K.onworkitem=e=>{for(const t of e.data.labels){const e=i.get(t.id)??0;t.centroidIndex[2]+=e,t.largestSliceZ+=e,t.minZ+=e,t.maxZ+=e}n.push(...e.data.labels)},this.#K.onwork=()=>{this.ondone({data:{labels:n}})};for(const{segNumber:n,size:i,slices:o}of e){const e=$o(i,t.getSpacing());this.#K.addWorkerTask(new jo({segmentSlice:{segNumber:n,slices:o},...e},{}))}}ondone(e){}}class Ko{#Qt=null;#Vt=null;#Nt=null;initialize(e,t){this.#Vt=e,this.#Nt=t,this.#Qt=new Uint8Array(3*e.length)}isInitialized(){return null!==this.#Qt}realloc(e,t){this.#Vt=e,this.#Nt=t;let n=this.#Qt;this.#Qt=new Uint8Array(3*e.length),this.#Qt.set(n),n=null}shiftSlice(e,t,n){this.#Qt.set(this.#Qt.subarray(e,n),e+t)}#Bt(e){this.#Qt[3*e]=0,this.#Qt[3*e+1]=0,this.#Qt[3*e+2]=0}resetAroundOffset(e){if(!this.isInitialized())return;this.#Bt(e);const t=this.#Nt.getDimSize(0),n=this.#Nt.getDimSize(1),i=this.#Nt.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.#Vt.length&&this.#Bt(s)}}#kt(e,t,n,i,o,r){return()=>{const a=t+n,s=e+1,l=this.#Nt.offsetToIndex(a);return a>=this.#Vt.length||a<0||0===l.get(i)||l.get(i)===this.#Nt.get(i)-1||255===s?s:s>10?255:this.#Vt[a]!==o?s:(r.push(this.#kt(s,a,n,i,o,r)),0)}}#Gt(e,t,n,i,o,r,a,s){return()=>{const l=t+n,c=e+1,u=this.#Nt.offsetToIndex(l);return l>=this.#Vt.length||l<0||0===u.get(o)||u.get(o)===this.#Nt.get(o)-1||255===c?c:c>10?255:this.#Vt[l]!==a?c:(s.push(this.#kt(c,l,i,r,a,s)),s.push(this.#kt(c,l,-i,r,a,s)),s.push(this.#Gt(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.#Qt[r];if(a>0)return a;const s=this.#Vt[e],l=[],c=this.#Nt.getDimSize(o),u=this.#Nt.getDimSize(i);l.push(this.#Gt(0,e,c,u,o,i,s,l)),l.push(this.#kt(0,e,u,i,s,l)),l.push(this.#kt(0,e,-u,i,s,l)),l.push(this.#Gt(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.#Qt[r]=255,255;const e=l.shift()();if(e>0)return this.#Qt[r]=e,e}return 1/0}}function _o(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 Jo{#de;#zt=new Map;#Ht=!1;#Xt;constructor(e){this.#de=e}getAll(){return this.#zt}setLabelMap(e){this.#Xt=e}addFrame(e,t,n,i,o,r){this.#zt.has(e)||this.#zt.set(e,new Map);const a=this.#zt.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.#Xt)return this.#Xt;const e=this.#de.getSize().getDimSize(2),t=this.#de.getSize().getTotalSize(),n=new Uint8Array(t);for(const[,t]of this.#zt)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.#Ht=!0),0===n[t+i]&&(n[t+i]=o[i]))}return this.#Ht&&s.warn("SegmentCollection: detected overlapping segments"),this.#Xt=n,n}#Yt(e){const t=this.#de.getSize().getDimSize(2),n=Math.floor(e/t);return{sliceIndex:n,localOffset:e-n*t}}updateAtOffset(e,t,n){if(0===this.#zt.size||t===n)return;const i=this.#de.getSize().getDimSize(2),{sliceIndex:o,localOffset:r}=this.#Yt(e);if(0!==t){const e=this.#zt.get(t)?.get(o);void 0!==e&&(e[r]=0)}if(0!==n){this.#zt.has(n)||this.#zt.set(n,new Map);const e=this.#zt.get(n);e.has(o)||e.set(o,new Uint8Array(i)),e.get(o)[r]=n}}shiftSlices(e,t){if(0!==this.#zt.size&&0!==t){for(const n of this.#zt.values()){const i=[...n.keys()].filter(t=>t>=e);for(const e of i){const i=n.get(e);n.delete(e),n.set(e+t,i)}}this.#Wt=void 0,this.#$t=""}}getOtherValueAtOffset(e,t){if(0===this.#zt.size)return 0;const{sliceIndex:n,localOffset:i}=this.#Yt(e);for(const[e,o]of this.#zt){if(e===t)continue;const r=o.get(n);if(void 0!==r&&0!==r[i])return r[i]}return 0}clone(){const e=new Jo(this.#de);for(const[t,n]of this.#zt){const i=new Map;for(const[e,t]of n)i.set(e,t.slice());e.#zt.set(t,i)}return e.#Ht=this.#Ht,e}getHasOverlap(){return this.getLabelMap(),this.#Ht}getSegmentBuffers(e){if(0===this.#zt.size){let t=e.map(e=>e.number);if(0===t.length&&void 0!==this.#Xt){const e=new Set;for(let t=0;t<this.#Xt.length;++t)0!==this.#Xt[t]&&e.add(this.#Xt[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=_o(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.#Xt,this.#de,t)}const t={};for(const n of e){const e=n.number-1,i=this.#zt.get(n.number);if(void 0!==i)for(const[n,o]of i){const i=new Uint8Array(o.length);let r=!0;for(let e=0;e<o.length;++e)0!==o[e]&&(i[e]=1,r=!1);r||(void 0===t[e]&&(t[e]={}),t[e][n]=i)}}return t}#Wt;#$t="";getOrBuildUnionContour(e,t){const n=[];for(const[t]of this.#zt)e?.isHidden(t)&&n.push(t);const i=n.sort().join(",");if(void 0!==this.#Wt&&i===this.#$t)return this.#Wt;const o=t.getDimSize(2),r=new Uint8Array(t.getTotalSize());for(const[t,n]of this.#zt)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.#Wt=new Ko,this.#Wt.initialize(r,t),this.#$t=i,this.#Wt}}class er{#jt;#zt;constructor(e){this.#jt=e;const t=e.getMeta();void 0===t.custom&&(t.custom={}),void 0===t.custom.segments&&(t.custom.segments=[]),this.#zt=t.custom.segments}getMask(){return this.#jt}#Zt(e){return this.#zt.findIndex(function(t){return t.number===e})}hasSegment(e){return-1!==this.#Zt(e)}getNumberOfSegments(){return this.#zt.length}maskHasSegments(e){const t=[],n=[];for(let i=0;i<e.length;++i){const o=this.getSegment(e[i]);void 0!==o?void 0!==o.displayValue?t.push(o.displayValue):t.push(o.number):(s.warn(`Unknown segment in maskHasSegments: ${e[i]}`),n.push(i))}const i=this.#jt.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.#Zt(e);return-1!==n&&(t=this.#zt[n]),t}addSegment(e){-1===this.#Zt(e.number)?(this.#zt.push(e),void 0!==e.displayRGBValue&&this.#jt.updatePaletteColourMap(e.number,e.displayRGBValue)):s.warn(`Not adding segment, it is allready in the segments list: ${e.number}`)}removeSegment(e){const t=this.#Zt(e);-1!==t?this.#zt.splice(t,1):s.warn(`Cannot remove segment, it is not in the segments list: ${e}`)}updateSegment(e){const t=this.#Zt(e.number);-1!==t?this.#zt[t]=e:s.warn(`Cannot update segment, it is not in the segments list: ${e.number}`)}findOverlap(e){const t=this.#jt.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.#jt.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 tr extends Ht{#Kt;#_t=new Ko;#Jt=null;#en;constructor(e,t,n,i){super(e,t,n),void 0===i&&(i=new Jo(e)).setLabelMap(t),this.#Kt=i,this.addEventListener("imagebufferrealloc",()=>{this.#Kt?.setLabelMap(this.getBuffer()),this.#_t.isInitialized()&&this.#_t.realloc(this.getBuffer(),this.getGeometry().getSize())}),this.addEventListener("imagesliceshift",e=>{const{indexOffset:t,insertSize:n,maxOffset:i}=e.detail,o=this.getGeometry().getSize().getDimSize(2);if(this.#Kt?.shiftSlices(t/o,n/o),this.#_t.isInitialized()){const e=3/this.getNumberOfComponents();this.#_t.shiftSlice(t*e,n*e,i*e)}})}initializeContour(){this.#_t.initialize(this.getBuffer(),this.getGeometry().getSize())}getContour(){return this.#_t}getSegmentCollection(){return this.#Kt}getHasOverlap(){return this.#Kt?.getHasOverlap()??!1}getMaskReferencedSeriesUID(){return this.getMeta().custom.referencedSeriesUID}isMask(){return!0}getSegmentNumbersAtIndex(e){const t=new Set,n=this.getValueAtIndex(e);if(0!==n&&t.add(n),this.getHasOverlap()){const n=this.getGeometry().getSize(),i=e.get(0)+e.get(1)*n.get(0),o=this.#Kt.getAll();for(const[n,r]of o){const o=r.get(e.get(2));void 0!==o&&0!==o[i]&&t.add(n)}}return[...t].sort((e,t)=>e-t)}getOffsets(e){const t=this.getBuffer(),n=this.getNumberOfComponents();let i;if("number"==typeof e){if(1!==n)throw new Error("Number of components is not 1 for getting single value.");i=[e]}else if(void 0!==e.r&&void 0!==e.g&&void 0!==e.b){if(3!==n)throw new Error("Number of components is not 3 for getting RGB value.");i=[e.r,e.g,e.b]}const o=[];let r;for(let e=0;e<t.length;e+=n){r=!0;for(let o=0;o<n;++o)if(t[e+o]!==i[o]){r=!1;break}r&&o.push(e)}return o}setAtOffsets(e,t){const n=this.getBuffer(),i=this.getNumberOfComponents();let o,r;if("number"==typeof t){if(1!==i)throw new Error("Number of components is not 1 for setting single value.");o=[t]}else if(void 0!==t.r&&void 0!==t.g&&void 0!==t.b){if(3!==i)throw new Error("Number of components is not 3 for setting RGB value.");o=[t.r,t.g,t.b]}for(let t=0,a=e.length;t<a;++t)if(r=e[t],1===i){const e=n[r];n[r]=o[0],this.#Kt?.updateAtOffset(r,e,o[0])}else for(let e=0;e<i;++e)n[r+e]=o[e];this.dispatchEvent(new CustomEvent("imagecontentchange"))}setAtOffsetsWithValues(e,t){const n=this.getBuffer();for(let i=0;i<e.length;++i){const o=e[i],r=t[i],a=n[o];n[o]=r,this.getContour().resetAroundOffset(o),this.#Kt?.updateAtOffset(o,a,r)}this.dispatchEvent(new CustomEvent("imagecontentchange"))}setAtOffsetsAndGetOriginals(e,t){const n=this.getBuffer(),i=[];for(let o=0;o<e.length;++o){const r=e[o];let a=r[0],s=n[a];const l=[];l.push({index:0,value:s});for(let e=0;e<r.length;++e){a=r[e];const i=n[a];s!==i&&(l.push({index:e,value:i}),s=i),n[a]=t,this.getContour().resetAroundOffset(a),this.#Kt?.updateAtOffset(a,i,t)}i.push(l)}return this.dispatchEvent(new CustomEvent("imagecontentchange")),i}setAtOffsetsWithIterator(e,t){const n=this.getBuffer(),i=Array.isArray(t);for(let o=0;o<e.length;++o){const r=e[o];let a;a=Wo(i?t[o]:[{index:0,value:t}],r.length);let s=a.next();for(;!s.done;){const e=r[s.index],t=n[e];n[e]=s.value,this.getContour().resetAroundOffset(e),this.#Kt?.updateAtOffset(e,t,s.value),s=a.next()}}this.dispatchEvent(new CustomEvent("imagecontentchange"))}#tn(e){const t=this.getGeometry(),n=t.getSpacing(),i=this.getMeta().lengthUnit;let o=1,r="unit.pixel";"unit.mm"===i&&(o=n.get(0)*n.get(1)*n.get(2)*.001,r="unit.ml");for(const n of e){let e,s;n.centroid=t.indexToWorld(new a(n.centroidIndex)),n.volume={value:n.count*o,unit:r},void 0!==n.diameters&&(void 0!==n.diameters.major&&(e=n.diameters.major.diameter),void 0!==n.diameters.minor&&(s=n.diameters.minor.diameter)),n.diameters={major:{diameter:{value:e,unit:i}},minor:{diameter:{value:s,unit:i}}},n.height={value:n.height,unit:i}}const s=e.sort((e,t)=>t.volume.value-e.volume.value).sort((e,t)=>e.id-t.id);this.#en=s,this.dispatchEvent(new CustomEvent("labelschanged",{detail:{labels:s}}))}#nn(){const e=this.getGeometry(),t=e.getSize(),n=t.get(0),i=t.get(1),o=[];for(const[e,t]of this.#Kt.getAll()){const r=[...t.keys()],a=Math.min(...r),s=new Dt([n,i,Math.max(...r)-a+1]),l=[];for(const[e,n]of t)l.push({sliceIndex:e-a,data:new Uint8Array(n)});o.push({segNumber:e,size:s,slices:l,minSlice:a})}this.#Jt.runOverlap(o,e)}getLabels(){return this.#en}recalculateLabels(){this.dispatchEvent(new CustomEvent("labelingstart")),null===this.#Jt&&(this.#Jt=new Zo,this.#Jt.ondone=e=>{this.#tn(e.data.labels),e.data.buffer&&this.replaceBuffer(e.data.buffer)});const e=this.#Kt;e?.getHasOverlap()&&e.getAll().size>0?this.#nn():this.#Jt.run(this.getBuffer(),this.getGeometry())}clone(){const e=super.clone(),t=this.#Kt.clone();return t.setLabelMap(e.getBuffer()),e.#Kt=t,e}getHistogramBySegment(e,t){const n=this.#in(t);if(void 0===n)return s.warn(`getHistogramBySegment: unknown segment id: ${t}`),[];const i=e.getGeometry();if(!this.#on(i))throw new Error("getHistogramBySegment: mask and image geometries are not compatible.");const o=i.getSize(),r=i.getOrigins(),a=this.getGeometry().getOrigins().map(e=>r.findIndex(t=>e.isSimilar(t,1e-4))),l=void 0!==n.displayValue?n.displayValue:n.number,c=4===o.length()?o.get(3):1,u=o.getDimSize(3),d=o.getDimSize(2),h=this.getBuffer(),g=e.getMeta().pixelUnit,S=(t,n,i,r)=>{for(let s=i;s<=r;++s){const i=s*d,r=n*u+a[s]*d,c=e.getRescaleSlopeAndIntercept(o.offsetToIndex(r)),g=t.getHistogram(c);for(let t=0;t<d;++t)h[i+t]===l&&g.add(e.getValueAtOffset(r+t))}};let m=this.#en?.filter(e=>e.id===l);void 0!==m&&this.#rn(m)&&(s.debug("getHistogramBySegment: labels share slices, no label histograms."),m=void 0);const p=[];for(let e=0;e<c;++e){const t=new Gt(g);S(t,e,0,a.length-1);const n={volume:e,histogram:t};void 0!==m&&(n.labelHistograms=m.map(t=>{const n=new Gt(g);return S(n,e,t.minZ,t.maxZ),{label:t,histogram:n}})),p.push(n)}return p}#rn(e){const t=e.slice().sort((e,t)=>e.minZ-t.minZ);for(let e=1;e<t.length;++e)if(t[e].minZ<=t[e-1].maxZ)return!0;return!1}#in(e){const t=new er(this),n=this.getMeta()?.custom?.segments??[];for(const t of n)if(t.trackingUid===e)return t;for(const t of n)if(String(t.number)===e)return t;const i=Number(e);if(!Number.isNaN(i)&&t.hasSegment(i))return t.getSegment(i)}#on(e){const t=this.getGeometry(),n=t.getSize(),i=e.getSize();for(let e=0;e<2;++e)if(n.get(e)!==i.get(e))return!1;if(!t.getOrientation().isSimilar(e.getOrientation(),1e-4))return!1;const o=e.getOrigins();return t.getOrigins().every(e=>o.some(t=>e.isSimilar(t,1e-4)))}}function nr(e){const t=[];for(let n=0;n<256;++n)t.push(e(n));return t}function ir(e){return e}function or(e){return 255-e}class rr{red;green;blue;constructor(e,t,n){this.red=e,this.green=t,this.blue=n}}const ar={plain:{red:nr(ir),green:nr(ir),blue:nr(ir)},invPlain:{red:nr(or),green:nr(or),blue:nr(or)},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:nr(function(e){const t=3*e;return t>255?255:t}),green:nr(function(e){const t=256/3;let n=0;return e>=t&&(n=3*(e-t),n>255)?255:n}),blue:nr(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]}},sr={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 lr(e,t){const n=e[t.tag];if(1===t.type||2===t.type){if(void 0===n)throw new Error(`Missing or empty ${t.name}`)}else if(void 0===n)return;let i,o=!1;if(i=1===n.value.length?n.value[0]:n.value,Array.isArray(i))for(let e=0;e<t.enum.length;++e){if(!Array.isArray(t.enum[e]))throw new Error("Cannot compare array and non array tag value.");if(A(t.enum[e],i)){o=!0;break}}else o=t.enum.includes(i);if(!o)throw new Error(`Unsupported ${t.name} value: ${i}`)}const cr=[{name:"TransferSyntaxUID",tag:"00020010",type:"1",enum:[te,ne,ie]},{name:"MediaStorageSOPClassUID",tag:"00020002",type:"1",enum:["1.2.840.10008.5.1.4.1.1.66.4"]},{name:"SOPClassUID",tag:"00020002",type:"1",enum:["1.2.840.10008.5.1.4.1.1.66.4"]},{name:"Modality",tag:"00080060",type:"1",enum:["SEG"]},{name:"SegmentationType",tag:"00620001",type:"1",enum:["BINARY"]},{name:"DimensionOrganizationType",tag:"00209311",type:"3",enum:["3D"]},{name:"ImageType",tag:"00080008",type:"1",enum:[["DERIVED","PRIMARY"]]},{name:"SamplesPerPixel",tag:"00280002",type:"1",enum:[1]},{name:"PhotometricInterpretation",tag:"00280004",type:"1",enum:["MONOCHROME2"]},{name:"PixelRepresentation",tag:"00280103",type:"1",enum:[0]},{name:"BitsAllocated",tag:"00280100",type:"1",enum:[1]},{name:"BitsStored",tag:"00280101",type:"1",enum:[1]},{name:"HighBit",tag:"00280102",type:"1",enum:[0]}];function ur(){const e={};for(const t of cr)e[t.name]=t.enum[0];return e}class dr{#an;getWarning(){return this.#an}checkElements(e){}create(e,t,n){const i=function(t){return ue(e,t)};for(const t of cr)lr(e,t);const o=it(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 l=function(e){const t=e["00209221"];if(void 0===t||1!==t.value.length)throw new Error("Unsupported dimension organization sequence length");const n=t.value[0][Ti].value[0],i=[],o=e["00209222"];if(void 0!==o){const e=o.value;if(2!==e.length)throw new Error("Unsupported dimension index sequence length");let t;for(let o=0;o<e.length;++o){const r=e[o][Ti].value[0];if(r!==n)throw new Error("Dimension Index Sequence contains a unknown Dimension Organization");t=e[o]["00209165"].value[0];const a={DimensionOrganizationUID:r,DimensionIndexPointer:t},s=e[o]["00209421"];void 0!==s&&(a.DimensionDescriptionLabel=s.value[0]),i.push(a)}if("(0020,0032)"!==t)throw new Error("Unsupported non image position as last index")}return{organizations:{value:[{DimensionOrganizationUID:n}]},indices:{value:i}}}(e),c=de(e,"00620002");if(void 0===c)throw new Error("Missing or empty segmentation sequence");const u=[],d=[0],h=[0],g=[0];for(let e=0;e<c.length;++e){const t=Ji(c[e]);void 0!==t.displayRGBValue&&(d[t.number]=t.displayRGBValue.r,h[t.number]=t.displayRGBValue.g,g[t.number]=t.displayRGBValue.b),u.push(t)}let S,m=!1;d.length>1&&(m=!0,S=new rr(d,h,g));const p=function(e,t){return e.findIndex(function(e){return t.equals(e)})},f=xi(e,a);if(void 0===f)throw new Error("Missing or empty per frame functional sequence");if(f.some(e=>void 0===e))throw new Error("Incomplete per frame functional groups");let C;void 0!==n&&(C=n.getGeometry().getOrigins());const D=zo(e,f,!0,C);D.sortOrigins();const y=D.getSize().get(2),I=function(e){return function(t){return t.number===e}},T=new Jo(D),w=D.getOrigins();let L;for(let e=0;e<f.length;++e){if(L=p(w,v(f[e].imagePosPat)),-1===L)throw new Error("Cannot find frame origin in mask origins");const n=u.find(I(f[e].refSegmentNumber)),i=m?n.number:n.displayValue;T.addFrame(n.number,t,r*e,L,r,i)}const P=[];for(let e=0;e<y;++e)P.push(e.toString());const A=new tr(D,T.getLabelMap(),P,T);m&&(A.setPhotometricInterpretation("PALETTE COLOR"),A.setPaletteColourMap(S));const O=ur(),b=Object.keys(sr);for(const e of b)O[e]=i(sr[e]);return void 0===O.FrameOfReferenceUID&&s.warn("Loaded DICOM SEG has no FrameOfReferenceUID."),O.DimensionOrganizationSequence=l.organizations,O.DimensionIndexSequence=l.indices,O.custom={segments:u,frameInfos:f,SOPInstanceUID:i("00080018"),referencedSeriesUID:ut(e)},O.lengthUnit=n.getMeta().lengthUnit,O.sliceCapacity=y,A.setMeta(O),A}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=Ni(Qi(s)),o.ContentTime=Bi(Vi(s)),void 0!==n&&(o.StudyInstanceUID=n.getMeta().StudyInstanceUID);const l=[];for(const e of t)l.push(eo(e));var c,u;o.SegmentSequence={value:l},o.SharedFunctionalGroupsSequence={value:[{PlaneOrientationSequence:{value:[(u=r.getOrientation(),{ImageOrientationPatient:[u.get(0,0),u.get(1,0),u.get(2,0),u.get(0,1),u.get(1,1),u.get(2,1)]})]},PixelMeasuresSequence:{value:[(c=r.getSpacing(),{SpacingBetweenSlices:c.get(2),PixelSpacing:[c.get(1),c.get(0)]})]}}]};const d=e.getSegmentCollection().getSegmentBuffers(t),h=[],g=[],S=[];for(const i of t){const t=i.number,o=t-1;if(void 0===d[o])continue;const r=Object.keys(d[o]);for(let i=r.length-1;i>=0;--i){const a=Number.parseInt(r[i],10);g.push(d[o][a]);const s=e.getGeometry().getOrigins()[a],l=[s.getX(),s.getY(),s.getZ()],c=new Oi([t,r.length-i],l,void 0,t);if(void 0!==n){const e=n.getGeometry().worldToIndex(new C([s.getX(),s.getY(),s.getZ()]));c.derivationImages=[{sourceImages:[{referencedSOPInstanceUID:n.getImageUid(e),referencedSOPClassUID:n.getMeta().SOPClassUID}]}],S.push({ReferencedSOPInstanceUID:n.getImageUid(e),ReferencedSOPClassUID:n.getMeta().SOPClassUID})}h.push(c)}}o.NumberOfFrames=g.length.toString();const m=[];for(const e of h)m.push(Ei(e));if(o.PerFrameFunctionalGroupsSequence={value:m},void 0!==n){const e=[];e.push({ReferencedInstanceSequence:{value:S},SeriesInstanceUID:n.getMeta().SeriesInstanceUID}),o.ReferencedSeriesSequence={value:e}}void 0!==i&&zi(o,i);const p=Hi(o),f=a.getDimSize(2),v=g.length*f/8,D=new le("OB");return D.tag=new F("7FE0","0010"),D.vl=v,D.value=g,p["7FE00010"]=D,p}}function hr(e,t){const n=e.getGeometry(),i=t.getGeometry();if(!n.getSpacing().equals(i.getSpacing()))throw new Error("mergeMaskImages: masks must have similar spacings");if(!n.getOrientation().isSimilar(i.getOrientation(),1e-4))throw new Error("mergeMaskImages: masks must have similar orientations");const o=i.getSize().get(2)>n.getSize().get(2),r=o?i:n,a=r.getOrigins(),l=r.getSize().getDimSize(2),c=function(e,t){return e.getOrigins().map((e,n)=>{let i=-1,o=1/0;for(let t=0;t<a.length;++t){const n=e.getDistance(a[t]);n<o&&(o=n,i=t)}if(o>.01)throw new Error(`mergeMaskImages: mask${t} slice ${n} has no matching slice in the merged geometry`);return o>1e-4&&s.warn(`mergeMaskImages: mask${t} slice ${n} is far from its closest merged-geometry slice (${o}).`),i})},u=o?c(n,"1"):void 0,d=o?void 0:c(i,"2"),h=e.getMeta().custom?.segments??[],g=t.getMeta().custom?.segments??[],S=e.getSegmentCollection().getSegmentBuffers(h),m=t.getSegmentCollection().getSegmentBuffers(g);let p,f;p=h.length>0?h.map(e=>e.number):Object.keys(S).map(e=>Number(e)+1),f=g.length>0?g.map(e=>e.number):Object.keys(m).map(e=>Number(e)+1);const v=new Set(p);let C=v.size>0?Math.max(...v)+1:1;const D=new Map;for(const e of f)if(v.has(e)){const t=C++;s.warn(`mergeMaskImages: segment number conflict, remapping ${e} to ${t}`),D.set(e,t)}else D.set(e,e),v.add(e);const y=[...h,...g.map(e=>({...e,number:D.get(e.number)}))],I=new Jo(r),T="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=T?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 w="PALETTE COLOR"===t.getPhotometricInterpretation();for(const[e,t]of Object.entries(m)){const n=Number(e)+1,i=D.get(n),o=g.find(e=>e.number===n),r=w?i:o?.displayValue??i;for(const[e,n]of Object.entries(t)){const t=Number(e),o=d?d[t]:t;I.addFrame(i,n,0,o,l,r)}}const L=a.map((e,t)=>t.toString()),P=new tr(r,I.getLabelMap(),L,I);if(T||w){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 rr(i,o,r))}else P.setPhotometricInterpretation(e.getPhotometricInterpretation());const A=structuredClone(e.getMeta());return void 0===A.custom&&(A.custom={}),A.custom.segments=y,P.setMeta(A),P}function gr(e){return(new dr).create(e,e["7FE00010"].value[0])}class Sr{name;wl;perslice;constructor(e,t,n){this.name=e,this.wl=t,this.perslice=n}}const mr="00080016",pr="00080060",fr="00280002",vr="00280100",Cr={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",VOILUTFunction:"00281056"},Dr=new WeakMap;class yr{#an;#sn;getWarning(){return this.#an}checkElements(e){if(this.#an=void 0,void 0===it(e))throw new Error("No image rows or columns in DICOM file");if(!X(e))throw new Error("No pixel data in DICOM file");const t=ue(e,pr);if(void 0!==t&&"PT"===t){const t=lt(e);if(void 0!==(n=ue(e,mr))&&/^1\.2\.840\.10008\.5\.1\.4\.1\.1\.7/.test(n)||!ct(t))return this.#an;const i=function(e){let t="";const n={};let i;t+=he(e["00280051"],"Corrected Image (00280051)",["ATTN","DECY"]),t+=he(e["00541102"],"Decay Correction (00541102)",["START"]),t+=he(e["00541001"],"Units (00541001)",["BQML"]);const o=e["00101030"],r=he(o," PatientWeight (00101030)");if(0===r.length){const e=parseFloat(o.value[0]);isNaN(e)?t+=" PatientWeight is not a number":i=e}else t+=r;const a=function(e){let t,n="";const i=Mi(e["00080021"]);let o,r,a;const l=e["00540016"];if(n+=he(l,"RadiopharmaceuticalInformationSequence (00540016)"),void 0!==l){1!==l.value.length&&s.warn("Found more than 1 istopes in RadiopharmaceuticalInformation Sequence.");const e="RadionuclideTotalDose (00181074)",c=l.value[0]["00181074"];if(t=he(c,e),0===t.length){const e=parseFloat(c.value[0]);isNaN(e)?n+=" TotalDose is not a number":o=e}else n+=t;const u="RadionuclideHalfLife (00181075)",d=l.value[0]["00181075"];if(t=he(d,u),0===t.length){const e=parseFloat(d.value[0]);isNaN(e)?n+=" HalfLife is not a number":r=e}else n+=t;const h=l.value[0]["00181078"];let g,S;if(void 0===h)g=i,S=qi(l.value[0]["00181072"]);else{const e=function(e){if(void 0===e)return;if(1!==e.value.length)return;const t=e.value[0].split("&")[0],n=new le("DA");n.value=[t.substring(0,8)];const i=Mi(n),o=new le("TM");return o.value=[t.substring(8)],{date:i,time:t.length>=9?qi(o):void 0}}(h);g=e.date,S=e.time}a=Ui(g,S)}let c=Ui(i,qi(e["00080031"]));const u=e["00080022"],d=e["00080032"];if(void 0!==u&&void 0!==d){const t=Mi(u),i=qi(d),o=Ui(t,i);if(c>o){const a=`Series date/time is after Aquisition date/time (diff=${(c.getTime()-o.getTime()).toString()}ms) `;s.debug(a);let l=0;const u="FrameReferenceTime (00541300)",d=e["00541300"];n+=he(d,u),void 0!==d&&(l=d.value[0]);let h=0;const g="ActualFrameDuration (00181242)",S=e["00181242"];if(n+=he(S,g),void 0!==S&&(h=S.value[0]),l>0&&h>0){h/=1e3,l/=1e3;const e=Math.log(2)/r,n=e*h,o=1/e*Math.log(n/(1-Math.exp(-n)))-l;c=new Date(t.year,t.monthIndex,t.day,i.hours,i.minutes,i.seconds+o,i.milliseconds)}}}let h;if(void 0!==c&&void 0!==a&&void 0!==o&&void 0!==r){const e=(c.getTime()-a.getTime())/1e3;h=o*Math.pow(2,-e/r)}return{value:h,warning:n}}(e);return t+=a.warning,0!==t.length?n.warning=`Cannot calculate PET SUV: ${t}`:n.value=1e3*i/a.value,n}(e);this.#sn=i.value,this.#an=i.warning}var n;return this.#an}create(e,t,n,i){const o=function(t){return ue(e,t)};let r,a=o(fr);void 0===a&&(a=1),r=void 0!==i?function(e,t){Dr.has(e)||Dr.set(e,function(e){const t=xi(e);if(void 0===t)return;if(t.some(e=>void 0===e))return void s.warn("Incomplete per-frame functional groups, not using them for geometry");const n=[],i=[],o=[];for(const e of t){const t=v(e.imagePosPat);let r=i.findIndex(p(t));-1===r&&(r=i.length,i.push(t)),n.push(t),o.push(r)}let r;if(i.length!==n.length){const t=[];for(let i=0;i<n.length;++i)t.push(Fi(e,i));const a=Vo(t,o,i.length);if(void 0===a)return void s.warn("Duplicate frame origins without volume ids, not using them for geometry");r=a.volumeIds}const a=zo(e,t),l=a.getSize(),c=new Dt([l.get(0),l.get(1),1]),u=[];for(let e=0;e<n.length;++e)u.push(new Lt([n[e]],c,a.getSpacing(),a.getOrientation(),void 0!==r?r[e]:a.getInitialTime()));return u}(e));const n=Dr.get(e);let i;if(void 0!==n)i=n[t].clone();else{const n=ko(e),o=it(e);i=new Lt([n.getOrigin()],new Dt([o[0],o[1],1]),n.getSpacing(),n.getOrientation(),{id:{value:t}})}return i}(e,i):ko(e);const l=r.getSize().getTotalSize(),c=at(e),u=o("00080018"),d=l*a;if(d!==t.length){if(s.warn(`Badly sized pixel buffer: ${t.length} != ${d}`),!(d<t.length))throw new Error("Underestimated buffer size, can't fix it...");t=t.slice(0,l)}const h=new Ht(r,t,[u]),g=lt(e);void 0!==g&&h.setPhotometricInterpretation(g);const S=o("00280006");void 0!==S&&h.setPlanarConfiguration(S);let m=1;const f=o("00281053");if(void 0!==f){const e=parseFloat(f);isNaN(e)||(m=e)}let C=0;const D=o("00281052");if(void 0!==D){const e=parseFloat(D);isNaN(e)||(C=e)}let y=!1,I=1;void 0!==this.#sn&&(y=!0,I=this.#sn,s.info(`Applying PET SUV calibration: ${I}`),m*=I,C*=I);const T=new Be(m,C);if(h.setRescaleSlopeAndIntercept(T),"PALETTE COLOR"===h.getPhotometricInterpretation()){const t=function(e){let t;const n=de(e,"00281101");if(void 0!==n&&3===n.length){let i,o,r;const a=e["00281201"],l=e["00281202"],c=e["00281203"];if(16===n[2]){let t=!1,u=n[0];0===u&&(u=65536);const d=a.vl;if(d!==2*u&&(t=!0,s.info(`16bits lut but size is not double. desc: ${u} vl: ${d}`)),8===parseInt(ue(e,vr),10)&&(t=!0,s.info("Scaling 16bits color lut since bits allocated is 8.")),t){const e=function(e){return e>>8};i=a.value.map(e),o=l.value.map(e),r=c.value.map(e)}}else if(8===n[2]){s.info("Scaling 16bits color lut since the lut descriptor is 8.");let e=a.value.slice(0);i=Array.from(new Uint8Array(e.buffer)),e=l.value.slice(0),o=Array.from(new Uint8Array(e.buffer)),e=c.value.slice(0),r=Array.from(new Uint8Array(e.buffer))}t=new rr(i,o,r)}return t}(e);void 0!==t&&h.setPaletteColourMap(t)}const w={sliceCapacity:n};if(void 0!==i){const e=parseInt(o("00280008"),10);w.sliceCapacity*=e}w.TransferSyntaxUID=o("00020010"),w.MediaStorageSOPClassUID=o("00020002"),w.SOPClassUID=o(mr),w.Modality=o(pr),w.ImageType=o("00080008"),w.SamplesPerPixel=o(fr),w.PhotometricInterpretation=o("00280004"),w.PixelRepresentation=o("00280103"),w.BitsAllocated=o(vr),w.BitsStored=o("00280101"),w.HighBit=o("00280102");const L=Object.keys(Cr);for(const e of L)w[e]=o(Cr[e]);if(y)w.pixelUnit="SUV";else{const t=(P=e,void 0!==ke.getTagPixelUnit?ke.getTagPixelUnit(P):function(e){let t;const n=["RescaleType","Units"];for(const i of n)if(t=ue(e,nt[i]),void 0!==t)break;if(void 0===t){const n=ue(e,nt.Modality);void 0!==n&&"CT"===n&&(t="HU")}return t}(P));void 0!==t&&(w.pixelUnit=t)}var P;w.lengthUnit=void 0===c?"unit.pixel":"unit.mm";const A=function(e,t){let n;const i=de(e,"00281050"),o=de(e,"00281051");if(void 0!==i&&void 0!==o){n={};const r=de(e,"00281055");let a;for(let e=0;e<i.length;++e){const l=parseFloat(i[e]);let c=parseFloat(o[e]);isNaN(l)||isNaN(c)||0===c||(a="",void 0!==r&&(a=r[e]),""===a&&(a=`Default${e}`),c*=t,n[a]=new Sr(a,[new Ut(l*t,c)])),0===c&&s.warn("Zero window width found in DICOM.")}}return n}(e,I);return void 0!==A&&(w.windowPresets=A),h.setMeta(w),h}}function Ir(e){return(new yr).create(e,e["7FE00010"].value[0],1)}const Tr="0040A30A",wr="0040A161",Lr="0040A162",Pr="0040A163",Ar="004008EA";class Or{numericValue;floatingPointValue;rationalNumeratorValue;rationalDenominatorValue;measurementUnitsCode;toString(){return`${this.numericValue} ${this.measurementUnitsCode.toString()}`}}function br(e){const t={};return void 0!==e.measurementUnitsCode&&(t.MeasurementUnitsCodeSequence={value:[Vn(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 xr="0040A300",Er="0040A301";class Rr{measuredValue;numericValueQualifierCode;toString(){let e="";return void 0!==this.measuredValue&&(e+=this.measuredValue.toString()),void 0!==this.numericValueQualifierCode&&(e+=` ${this.numericValueQualifierCode.toString()}`),e}}function Fr(e){const t={};return void 0!==e.measuredValue&&(t.MeasuredValueSequence={value:[br(e.measuredValue)]}),void 0!==e.numericValueQualifierCode&&(t.NumericValueQualifierCodeSequence={value:[Vn(e.numericValueQualifierCode)]}),t}const Mr="00081150",qr="00081155";class Ur{referencedSOPClassUID;referencedSOPInstanceUID;toString(){return`${this.referencedSOPInstanceUID} (class: ${this.referencedSOPClassUID})`}}function Qr(e){const t=new Ur;return void 0!==e[Mr]&&(t.referencedSOPClassUID=e[Mr].value[0]),void 0!==e[qr]&&(t.referencedSOPInstanceUID=e[qr].value[0]),t}function Vr(e){const t={};return void 0!==e.referencedSOPClassUID&&(t.ReferencedSOPClassUID=e.referencedSOPClassUID),void 0!==e.referencedSOPInstanceUID&&(t.ReferencedSOPInstanceUID=e.referencedSOPInstanceUID),t}const Nr="00081160",Br="00081199",kr="0062000B";class Gr{referencedSOPSequence;referencedFrameNumber;referencedSegmentNumber;toString(){let e=this.referencedSOPSequence.toString();return void 0!==this.referencedFrameNumber&&(e+=`, frame: ${this.referencedFrameNumber}`),e}}function zr(e){const t={};return void 0!==e.referencedFrameNumber&&(t.ReferencedFrameNumber=e.referencedFrameNumber),void 0!==e.referencedSOPSequence&&(t.ReferencedSOPSequence={value:[Vr(e.referencedSOPSequence)]}),void 0!==e.referencedSegmentNumber&&(t.ReferencedSegmentNumber=e.referencedSegmentNumber),t}class Hr{#ln;#cn;constructor(e,t){this.#ln=e,this.#cn=t}getBegin(){return this.#ln}getEnd(){return this.#cn}equals(e){return null!==e&&this.getBegin().equals(e.getBegin())&&this.getEnd().equals(e.getEnd())}getDeltaX(){return this.getEnd().getX()-this.getBegin().getX()}getDeltaY(){return this.getEnd().getY()-this.getBegin().getY()}getLength(){return Math.sqrt(this.getDeltaX()*this.getDeltaX()+this.getDeltaY()*this.getDeltaY())}getWorldLength(e){let t=null;if(null!==e){const n=this.getDeltaX()*e.x,i=this.getDeltaY()*e.y;t=Math.sqrt(n*n+i*i)}return t}getMidpoint(){return this.getCentroid()}getCentroid(){return new S((this.getBegin().getX()+this.getEnd().getX())/2,(this.getBegin().getY()+this.getEnd().getY())/2)}contains(e,t=0){return Wr(e,this.getBegin(),this.getEnd())<=t}getSlope(){return this.getDeltaY()/this.getDeltaX()}getIntercept(){return(this.getEnd().getX()*this.getBegin().getY()-this.getBegin().getX()*this.getEnd().getY())/this.getDeltaX()}getInclination(){return 180-180*Math.atan2(this.getDeltaY(),this.getDeltaX())/Math.PI}getFlipped(){return new Hr(this.#cn,this.#ln)}quantify(e){const t=e.get2DSpacing(),n=this.getWorldLength(t);let i;return null!==n&&(i={value:n,unit:e.getLengthUnit()}),{length:i}}}function Xr(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 Yr(e,t){const n=e.getDeltaX(),i=e.getDeltaY();return n*t.getDeltaX()+i*t.getDeltaY()===0}function Wr(e,t,n){const i=n.getX()-t.getX(),o=n.getY()-t.getY(),r=i*i+o*o;let a=0;return 0!==r&&(a=((e.getX()-t.getX())*i+(e.getY()-t.getY())*o)/r,a=Math.max(0,Math.min(1,a))),Math.hypot(e.getX()-(t.getX()+a*i),e.getY()-(t.getY()+a*o))}function $r(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 Zr(o,t.getY()-o*t.getX(),t,n,i)}function jr(e,t,n,i){const o=Zr(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(),$r(e,r,n,i)}function Zr(e,t,n,i,o){let r,a,s,l;if(void 0===o&&(o={x:1,y:1}),u(e,0,1e-4))r=n.getX()-i/(2*o.x),a=n.getY(),s=n.getX()+i/(2*o.x),l=n.getY();else if(Math.abs(e)>1e6)r=n.getX(),a=n.getY()-i/(2*o.y),s=n.getX(),l=n.getY()+i/(2*o.y);else{const c=o.x*o.x,u=o.y*o.y,d=i/(2*Math.sqrt(c+u*e*e));r=n.getX()-d,a=e*r+t,s=n.getX()+d,l=e*s+t}return new Hr(new S(r,a),new S(s,l))}class Kr{#un;constructor(e){if(e.length>3)throw new Error("Too many points for a protractor");this.#un=e.slice(0,3)}getPoint(e){return this.#un[e]}getLength(){return this.#un.length}getCentroid(){return this.#un[1]}contains(e,t=0){for(let n=0;n<this.#un.length-1;++n)if(Wr(e,this.#un[n],this.#un[n+1])<=t)return!0;return!1}quantify(e,t){let n;if(3===this.#un.length){let e=Xr(new Hr(this.#un[0],this.#un[1]),new Hr(this.#un[1],this.#un[2]));e>180&&(e=360-e),n={value:e,unit:"unit.degree"}}return{angle:n}}}class _r{#un=[];constructor(e){void 0!==e&&(this.#un=e)}getPoint(e){return this.#un[e]}getPoints(){return this.#un}getLength(){return this.#un.length}addPoint(e){this.#un.push(e)}addPoints(e){this.#un=this.#un.concat(e)}getCentroid(){let e,t=0,n=0,i=0;for(let e=0;e<this.#un.length;++e){const o=this.#un[e];let r;r=e===this.#un.length-1?this.#un[0]:this.#un[e+1];const a=o.getX()*r.getY()-r.getX()*o.getY();t+=a,n+=(o.getX()+r.getX())*a,i+=(o.getY()+r.getY())*a}if(0!==t){const o=1/(3*t);e=new S(o*n,o*i)}return e}contains(e,t=0){const n=this.#un,i=e.getX(),o=e.getY();let r=!1;for(let a=0,s=n.length-1;a<n.length;s=a++){const l=n[a],c=n[s];if(Wr(e,c,l)<=t)return!0;l.getY()>o!=c.getY()>o&&i<l.getX()+(c.getX()-l.getX())*(o-l.getY())/(c.getY()-l.getY())&&(r=!r)}return r}}class Jr{#dn;#hn;constructor(e,t){this.#dn=e,this.#hn=t}getCenter(){return this.#dn}getCentroid(){return this.#dn}getRadius(){return this.#hn}contains(e,t=0){return e.getDistance(this.#dn)<=this.#hn+t}equals(e){return null!==e&&this.getCenter().equals(e.getCenter())&&this.getRadius()===e.getRadius()}getSurface(){return Math.PI*this.getRadius()*this.getRadius()}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRound(){const e=this.getCenter().getX(),t=this.getCenter().getY(),n=this.getRadius(),i=Math.pow(n,2),o=t+n,r=[];for(let a=t-n;a<o;++a){const n=i-Math.pow(a-t,2);if(Math.abs(n)<1e-7)continue;const o=Math.sqrt(n);o<.5||r.push([[Math.round(e-o),Math.round(a)],[Math.round(e+o),Math.round(a)]])}return r}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r={value:this.getRadius()*i.x,unit:o},a=this.getWorldSurface(i);let s;null!==a&&(s="unit.mm"===o?{value:a/100,unit:"unit.cm2"}:{value:a,unit:o});const l={radius:r,surface:s};if(e.canQuantifyImage()){const i=this.getRound();if(0!==i.length){const o=e.getImageVariableRegionValues(i,t),r=e.getPixelUnit(),a=ft(o,n);void 0!==a&&(l.min={value:a.min,unit:r},l.max={value:a.max,unit:r},l.mean={value:a.mean,unit:r},l.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(l.median={value:a.median,unit:r}),void 0!==a.p25&&(l.p25={value:a.p25,unit:r}),void 0!==a.p75&&(l.p75={value:a.p75,unit:r}))}}return l}}class ea{#dn;#gn;#Sn;constructor(e,t,n){this.#dn=e,this.#gn=t,this.#Sn=n}getCenter(){return this.#dn}getCentroid(){return this.#dn}getA(){return this.#gn}getB(){return this.#Sn}contains(e,t=0){const n=this.#gn+t,i=this.#Sn+t;if(n<=0||i<=0)return!1;const o=(e.getX()-this.#dn.getX())/n,r=(e.getY()-this.#dn.getY())/i;return o*o+r*r<=1}equals(e){return null!==e&&this.getCenter().equals(e.getCenter())&&this.getA()===e.getA()&&this.getB()===e.getB()}getSurface(){return Math.PI*this.getA()*this.getB()}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRound(){const e=this.getCenter().getX(),t=this.getCenter().getY(),n=this.getA(),i=this.getB(),o=n/i,r=Math.pow(i,2),a=t+i,s=[];for(let n=t-i;n<a;++n){const i=r-Math.pow(n-t,2);if(Math.abs(i)<1e-7)continue;const a=o*Math.sqrt(i);a<.5||s.push([[Math.round(e-a),Math.round(n)],[Math.round(e+a),Math.round(n)]])}return s}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r=2*this.getA()*i.x,a=2*this.getB()*i.y,s={value:Math.max(r,a),unit:o},l={value:Math.min(r,a),unit:o},c=this.getWorldSurface(i);let u;null!==c&&(u="unit.mm"===o?{value:c/100,unit:"unit.cm2"}:{value:c,unit:o});const d={longAxis:s,shortAxis:l,surface:u};if(e.canQuantifyImage()){const i=this.getRound();if(0!==i.length){const o=e.getImageVariableRegionValues(i,t),r=e.getPixelUnit(),a=ft(o,n);void 0!==a&&(d.min={value:a.min,unit:r},d.max={value:a.max,unit:r},d.mean={value:a.mean,unit:r},d.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(d.median={value:a.median,unit:r}),void 0!==a.p25&&(d.p25={value:a.p25,unit:r}),void 0!==a.p75&&(d.p75={value:a.p75,unit:r}))}}return d}}function ta(e,t,n){const i=e.getValues(),o=i.slice(),r=[],s=t[0],l=t[1],c=s/l,u=Math.pow(l,2),d=n[0],h=n[1];for(let e=0;e<l;++e){const t=Math.round(c*Math.sqrt(u-Math.pow(e,2))),n=i[h]+e,s=i[h]-e;for(let e=0;e<t;++e){const t=i[d]+e,l=i[d]-e;o[d]=t,o[h]=n,r.push(new a(o.slice())),s!==n&&(o[h]=s,r.push(new a(o.slice()))),l!==t&&(o[d]=l,o[h]=n,r.push(new a(o.slice())),s!==n&&(o[h]=s,r.push(new a(o.slice()))))}}return r}class na{#ln;#cn;constructor(e,t){this.#ln=new S(Math.min(e.getX(),t.getX()),Math.min(e.getY(),t.getY())),this.#cn=new S(Math.max(e.getX(),t.getX()),Math.max(e.getY(),t.getY()))}getBegin(){return this.#ln}getEnd(){return this.#cn}equals(e){return null!==e&&this.getBegin().equals(e.getBegin())&&this.getEnd().equals(e.getEnd())}getSurface(){const e=this.getBegin(),t=this.getEnd();return Math.abs(t.getX()-e.getX())*Math.abs(t.getY()-e.getY())}getWorldSurface(e){return function(e,t,n){let i=null;return null!==t&&null!==n&&(i=e*t*n),i}(this.getSurface(),e.x,e.y)}getRealWidth(){return this.getEnd().getX()-this.getBegin().getX()}getRealHeight(){return this.getEnd().getY()-this.getBegin().getY()}getWidth(){return Math.abs(this.getRealWidth())}getHeight(){return Math.abs(this.getRealHeight())}getRound(){return{min:new S(Math.round(this.getBegin().getX()),Math.round(this.getBegin().getY())),max:new S(Math.round(this.getEnd().getX()),Math.round(this.getEnd().getY()))}}getCentroid(){return new S(this.getBegin().getX()+this.getWidth()/2,this.getBegin().getY()+this.getHeight()/2)}contains(e,t=0){return e.getX()>=this.getBegin().getX()-t&&e.getX()<=this.getEnd().getX()+t&&e.getY()>=this.getBegin().getY()-t&&e.getY()<=this.getEnd().getY()+t}quantify(e,t,n){const i=e.get2DSpacing(),o=e.getLengthUnit(),r={value:this.getWidth()*i.x,unit:o},a={value:this.getHeight()*i.y,unit:o},s=this.getWorldSurface(i);let l;null!==s&&(l="unit.mm"===o?{value:s/100,unit:"unit.cm2"}:{value:s,unit:o});const c={width:r,height:a,surface:l};if(e.canQuantifyImage()){const i=this.getRound(),o=e.getImageRegionValues(i.min,i.max,t),r=e.getPixelUnit(),a=ft(o,n);void 0!==a&&(c.min={value:a.min,unit:r},c.max={value:a.max,unit:r},c.mean={value:a.mean,unit:r},c.stdDev={value:a.stdDev,unit:r},void 0!==a.median&&(c.median={value:a.median,unit:r}),void 0!==a.p25&&(c.p25={value:a.p25,unit:r}),void 0!==a.p75&&(c.p75={value:a.p75,unit:r}))}return c}}function ia(e,t,n){const i=e.getValues(),o=i.slice(),r=[],s=t[0],l=Math.floor(s/2),c=t[1],u=Math.floor(c/2),d=n[0],h=n[1];for(let e=0;e<c;++e){o[h]=i[h]-u+e;for(let e=0;e<s;++e)o[d]=i[d]-l+e,r.push(new a(o.slice()))}return r}class oa{#ln;#cn;shortAxisLength;shortAxisCenter;shortAxisL1;shortAxisL2;shortAxisT;constructor(e,t){this.#ln=e,this.#cn=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.#ln}getEnd(){return this.#cn}getCentroid(){return new S((this.#ln.getX()+this.#cn.getX())/2,(this.#ln.getY()+this.#cn.getY())/2)}contains(e,t=0){if(Wr(e,this.#ln,this.#cn)<=t)return!0;const n=this.getLength();if(void 0===this.shortAxisCenter||0===n)return!1;const i=-this.getDeltaY()/n,o=this.getDeltaX()/n,r=this.shortAxisCenter,a=this.shortAxisL1??0,s=this.shortAxisL2??0;return Wr(e,new S(r.getX()+i*a,r.getY()+o*a),new S(r.getX()-i*s,r.getY()-o*s))<=t}getLength(){const e=this.getDeltaX(),t=this.getDeltaY();return Math.hypot(e,t)}getSlope(){const e=this.getDeltaX(),t=this.getDeltaY();return 0===e?1/0:t/e}getDeltaX(){return this.#cn.getX()-this.#ln.getX()}getDeltaY(){return this.#cn.getY()-this.#ln.getY()}quantify(e){const t=e.get2DSpacing?.()??{x:1,y:1},n=new Hr(this.#ln,this.#cn).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.#ln.getX()+e*r,s=this.#ln.getY()+n*r,l=new S(a,s),c=-n/o,u=e/o,d="number"==typeof this.shortAxisL1?this.shortAxisL1:this.shortAxisLength/2,h="number"==typeof this.shortAxisL2?this.shortAxisL2:this.shortAxisLength/2,g=new S(l.getX()+c*d,l.getY()+u*d),m=new S(l.getX()-c*h,l.getY()-u*h);i=new Hr(g,m).getWorldLength(t),this.shortAxisCenter=l}}const o="number"==typeof i&&!Number.isNaN(i);let r;return null!==n&&(r={longAxis:{value:o?Math.max(n,i):n,unit:e.getLengthUnit()},shortAxis:{value:o?Math.min(n,i):null,unit:e.getLengthUnit()}}),r}static restorePropertiesFromQuantification(e,t,n){if("number"==typeof n.shortAxisLength&&(t.shortAxisLength=n.shortAxisLength),"number"==typeof n.shortAxisT&&(t.shortAxisT=n.shortAxisT),e.mathShape=t,"function"==typeof e.getFactory&&"function"==typeof e.getFactory().getShortAxisEndpoints){const n=e.getFactory(),[i,o]=n.getShortAxisEndpoints(e);if(i&&o){const n=t.getBegin(),r=t.getEnd(),a=(i.getX()+o.getX())/2,s=(i.getY()+o.getY())/2;e.mathShape.shortAxisCenter={x:a,y:s};const l=r.getX()-n.getX(),c=r.getY()-n.getY(),u=Math.sqrt(l*l+c*c);let d=.5;if(u>0){const e=l/u,t=c/u,i=a-n.getX(),o=s-n.getY();d=Math.max(0,Math.min(1,(i*e+o*t)/u))}e.mathShape.shortAxisT=d;const h=Math.sqrt(Math.pow(i.getX()-a,2)+Math.pow(i.getY()-s,2)),g=Math.sqrt(Math.pow(o.getX()-a,2)+Math.pow(o.getY()-s,2));e.mathShape.shortAxisL1=h,e.mathShape.shortAxisL2=g,e.mathShape.shortAxisLength=h+g}}}}const ra="00480301",aa="00700022",sa="00700023",la="0070031A",ca="POINT",ua="MULTIPOINT",da="POLYLINE",ha="CIRCLE",ga="ELLIPSE";class Sa{graphicData;graphicType;pixelOriginInterpretation;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function ma(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 pa(e){const t=new Sa;if(e instanceof S)t.graphicData=[e.getX().toString(),e.getY().toString()],t.graphicType=ca;else if(e instanceof Hr)t.graphicData=[e.getBegin().getX().toString(),e.getBegin().getY().toString(),e.getEnd().getX().toString(),e.getEnd().getY().toString()],t.graphicType=da;else if(e instanceof Kr){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=da}else if(e instanceof _r){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=da}else if(e instanceof Jr){const n=e.getCenter(),i=new S(n.getX()+e.getRadius(),n.getY());t.graphicData=[n.getX().toString(),n.getY().toString(),i.getX().toString(),i.getY().toString()],t.graphicType=ha}else if(e instanceof ea){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=ga}else if(e instanceof na){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=da}else if(e instanceof oa){let n=0,i=0;const o=e.getBegin(),r=e.getEnd(),a=e.shortAxisCenter instanceof S?e.shortAxisCenter:e.getCentroid(),s=r.getX()-o.getX(),l=r.getY()-o.getY(),c=Math.sqrt(s*s+l*l);0!==c&&(n=-l/c,i=s/c);const u=e.shortAxisL1??e.shortAxisLength/2,d=e.shortAxisL2??e.shortAxisLength/2,h=new S(a.getX()+n*u,a.getY()+i*u),g=new S(a.getX()-n*d,a.getY()-i*d);t.graphicData=[o.getX().toString(),o.getY().toString(),r.getX().toString(),r.getY().toString(),h.getX().toString(),h.getY().toString(),g.getX().toString(),g.getY().toString()],t.graphicType=da}return t}function fa(e){if(void 0===e.graphicData)return;const t=e.graphicData.length;if(0===t)throw new Error("No coordinates in scoord data");if(t%2!=0)throw new Error("Expecting even number of coordinates in scoord data");const n=[];for(let i=0;i<t;i+=2)n.push(new S(parseFloat(e.graphicData[i]),parseFloat(e.graphicData[i+1])));let i=!1;const o=n.length;if(o>2){const e=n[0],t=n[o-1];i=e.equals(t)}let r;if(e.graphicType===ca)n.length>1&&s.warn(`Expecting 1 point for point, got ${o}`),r=n[0];else if(e.graphicType===ha){if(n.length<2)throw new Error(`Expecting 2 points for circles, got ${o}`);n.length>2&&s.warn(`Expecting 2 points for circles, got ${o}`);const e=n[0],t=n[1].getDistance(e);r=new Jr(e,t)}else if(e.graphicType===ga){if(n.length<4)throw new Error(`Expecting 4 points for ellipses, got ${o}`);n.length>4&&s.warn(`Expecting 4 points for ellipses, got ${o}`);const e=n[0].getDistance(n[1])/2,t=n[2].getDistance(n[3])/2,i=new S(n[0].getX()+e,n[0].getY());r=new ea(i,e,t)}else if(e.graphicType===da)if(i)if(5===n.length){const e=new Hr(n[0],n[1]),t=new Hr(n[1],n[2]),i=new Hr(n[2],n[3]),o=new Hr(n[3],n[4]);r=Yr(e,t)&&Yr(t,i)&&Yr(i,o)?new na(n[0],n[2]):new _r(n.slice(0,-1))}else r=new _r(n.slice(0,-1));else if(2===n.length)r=new Hr(n[0],n[1]);else if(3===n.length)r=new Kr([n[0],n[1],n[2]]);else if(4===n.length){const e=n[0],t=n[1],i=n[2],o=n[3];let a=.5;r=new oa(e,t);const s=(i.getX()+o.getX())/2,l=(i.getY()+o.getY())/2,c=i.getX()-s,u=i.getY()-l,d=s-o.getX(),h=l-o.getY(),g=Math.sqrt(c*c+u*u),m=Math.sqrt(d*d+h*h),p=g+m,f=t.getX()-e.getX(),v=t.getY()-e.getY(),C=Math.sqrt(f*f+v*v);let D=.5;if(C>0){const t=s-e.getX(),n=l-e.getY(),i=C*C;0!==i&&(a=(t*f+n*v)/i),D=Math.max(0,Math.min(1,a))}r.shortAxisLength=p,r.shortAxisT=D,r.shortAxisL1=g,r.shortAxisL2=m,r.shortAxisCenter=new S(s,l),r.hasShortAxisInteraction=!0}return r}const va="00700022",Ca="00700023",Da="30060024",ya="0070031A";class Ia{graphicData;graphicType;referencedFrameofReferenceUID;fiducialUID;toString(){return`${this.graphicType} {${this.graphicData}}`}}function Ta(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 wa={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"},La="CONTAINS",Pa="HAS PROPERTIES",Aa="HAS OBS CONTEXT",Oa="INFERRED FROM",ba="SELECTED FROM",xa="HAS CONCEPT MOD",Ea="TEXT",Ra="NUM",Fa="CODE",Ma="UIDREF",qa="COMPOSITE",Ua="IMAGE",Qa="SCOORD",Va="SCOORD3D",Na="CONTAINER",Ba="SEPARATE",ka={TEXT:"TextValue",DATE:"Date",TIME:"Time",DATETIME:"DateTime",UIDREF:"UID",PNAME:"PersonName",CONTAINER:"ContinuityOfContent"};function Ga(e){let t;const n=ue(e,wa.ContentTemplateSequence);if(void 0!==n){const e=ue(n,wa.MappingResource),i=ue(n,wa.TemplateIdentifier);void 0!==e&&void 0!==i&&(t=`${e}-${i}`)}return t}class za{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&&Un(this.conceptNameCode,t)&&this.relationshipType===n}}function Ha(e){let t=ue(e,wa.ValueType);void 0===t&&(t="");const n=new za(t);n.relationshipType=ue(e,wa.RelationshipType);const i=ue(e,wa.ConceptNameCodeSequence);if(void 0!==i&&(n.conceptNameCode=Qn(i)),t===Fa)n.value=Qn(ue(e,wa.ConceptCodeSequence));else if(t===Ra)n.value=function(e){const t=new Rr;return void 0!==e[xr]&&(t.measuredValue=function(e){const t=new Or;return void 0!==e[Tr]&&(t.numericValue=parseFloat(e[Tr].value[0])),void 0!==e[wr]&&(t.floatingPointValue=parseFloat(e[wr].value[0])),void 0!==e[Lr]&&(t.rationalNumeratorValue=parseInt(e[Lr].value[0],10)),void 0!==e[Pr]&&(t.rationalDenominatorValue=parseInt(e[Pr].value[0],10)),void 0!==e[Ar]&&(t.measurementUnitsCode=Qn(e[Ar].value[0])),t}(e[xr].value[0])),void 0!==e[Er]&&(t.numericValueQualifierCode=Qn(e[Er].value[0])),t}(e);else if(t===Ua)n.value=function(e){const t=new Gr;return void 0!==e[Nr]&&(t.referencedFrameNumber=e[Nr].value[0]),void 0!==e[Br]&&(t.referencedSOPSequence=Qr(e[Br].value[0])),void 0!==e[kr]&&(t.referencedSegmentNumber=e[kr].value[0]),t}(e);else if(t===qa)n.value=Qr(ue(e,wa.ReferencedSOPSequence));else if(t===Qa)n.value=function(e){const t=new Sa;return void 0!==e[aa]&&(t.graphicData=e[aa].value),void 0!==e[sa]&&(t.graphicType=e[sa].value[0]),void 0!==e[ra]&&(t.pixelOriginInterpretation=e[ra].value[0]),void 0!==e[la]&&(t.fiducialUID=e[la].value[0]),t}(e);else if(t===Va)n.value=function(e){const t=new Ia;return void 0!==e[va]&&(t.graphicData=e[va].value),void 0!==e[Ca]&&(t.graphicType=e[Ca].value[0]),void 0!==e[Da]&&(t.referencedFrameofReferenceUID=e[Da].value[0]),void 0!==e[ya]&&(t.fiducialUID=e[ya].value[0]),t}(e);else{const i=ka[t];void 0!==i?n.value=ue(e,wa[i]):console.warn(`Unsupported input ValueType: ${t}`)}const o=de(e,wa.ContentSequence);if(void 0!==o)for(const e of o)n.contentSequence.push(Ha(e));return n}function Xa(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:[Vn(e.conceptNameCode)]}),"CODE"===e.valueType)t.ConceptCodeSequence={value:[Vn(e.value)]};else if(e.valueType===Ra)t={...t,...Fr(e.value)};else if(e.valueType===Ua)t={...t,...zr(e.value)};else if(e.valueType===qa)t={...t,...Vr(e.value)};else if(e.valueType===Qa)t={...t,...ma(e.value)};else if(e.valueType===Va)t={...t,...Ta(e.value)};else{const n=ka[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(Xa(n))}return t}function Ya(e,t,n,i){const o=function(e){const t=mi[e];let n;return void 0!==t&&(n="DCM"===t.scheme?di({meaning:e,value:t.key}):hi(t.key,t.scheme)),n}(e);if(void 0===o)return;let r=La;void 0!==i&&(r=i);const a=new za(Ra);a.relationshipType=r,a.conceptNameCode=o;const s=new Or;s.numericValue=t,s.measurementUnitsCode=fi(n);const l=new Rr;return l.measuredValue=s,a.value=l,a}class Wa{#mn;#n;#i;constructor(e,t,n){this.#mn=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 Wa(Wa.idFromIndex(e),t,n)}getId(){return this.#mn}getX(){return this.#n}getY(){return this.#i}setX(e){this.#n=e}setY(e){this.#i=e}}const $a={arrow:{"*":""},circle:{"*":"{surface}"},ellipse:{"*":"{surface}"},protractor:{"*":"{angle}"},rectangle:{"*":"{surface}"},roi:{"*":""},ruler:{"*":"{length}"},bidimensional:{"*":"{longAxis} x {shortAxis}"},bidimensionalDrawing:{"*":"{longAxis}"}};function ja(e){return"label"===e.name()}function Za(e){return"shape"===e.name()}function Ka(e){return"position-group"===e.name()}function _a(t,n){const i=t.getChildren(function(e){return e.id()===`anchor${n}`})[0];if(i instanceof e.Ellipse)return i}function Ja(e){return function(t){return t.id()===e}}function es(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 ts(e){return void 0!==ke.labelTexts&&void 0!==ke.labelTexts[e]?ke.labelTexts[e]:$a[e]}class ns{#u="rectangle";#pn;static supports(e){return e instanceof na}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new na(t[0],t[1]),e.setTextExpr(ts(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=Wa.indexFromId(t.getId()),i=(n+1)%4,o=(n+2)%4,r=(n+3)%4;void 0===this.#pn&&(this.#pn=this.getAnchors(e));const a=this.#pn[o];this.#pn[n]=t,n%2==0?(this.#pn[r].setX(t.getX()),this.#pn[i].setY(t.getY())):(this.#pn[r].setY(t.getY()),this.#pn[i].setX(t.getX())),e.mathShape=new na(new S(a.getX(),a.getY()),new S(t.getX(),t.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new na(new S(i.getX()+t.x,i.getY()+t.y),new S(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){this.#pn=void 0}getAnchors(e){if(void 0!==this.#pn)return this.#pn;const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[Wa.fromIndex(0,n,i),Wa.fromIndex(1,n+o,i),Wa.fromIndex(2,n+o,i+r),Wa.fromIndex(3,n,i+r)]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin().getX(),i=t.getBegin().getY(),o=t.getWidth(),r=t.getHeight();return[new S(n+o/2,i),new S(n,i+r/2),new S(n+o/2,i+r),new S(n+o,i+r/2)]}getDefaultLabelPosition(e){const t=e.mathShape;return new S(t.getBegin().getX(),t.getEnd().getY())}}class is{#u="circle";static supports(e){return e instanceof Jr}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 Jr(t[0],Math.round(Math.sqrt(n*n+i*i))),e.setTextExpr(ts(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=new S(n.getCenter().getX(),n.getCenter().getY()),o=new S(t.getX(),t.getY());e.mathShape=new Jr(i,i.getDistance(o)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new Jr(new S(i.getX()+t.x,i.getY()+t.y),n.getRadius()),e.updateQuantification()}constrainAnchorMove(e,t){const n=this.getAnchors(t);switch(e.getId()){case"anchor0":e.setY(n[1].getY());break;case"anchor1":e.setY(n[0].getY());break;case"anchor2":e.setX(n[3].getX());break;case"anchor3":e.setX(n[2].getX());break;default:s.error(`Unhandled anchor id: ${e.getId()}`)}}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getRadius();return[Wa.fromIndex(0,n-o,i),Wa.fromIndex(1,n+o,i),Wa.fromIndex(2,n,i+o),Wa.fromIndex(3,n,i-o)]}getConnectorPositions(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getRadius()*Math.sqrt(2)/2;return[new S(n-o,i-o),new S(n+o,i-o),new S(n-o,i+o),new S(n+o,i+o)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter(),i=t.getRadius();return new S(n.getX()-i,n.getY()+i)}}class os{#u="ellipse";static supports(e){return e instanceof ea}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 ea(t[0],n,i),e.setTextExpr(ts(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape,i=n.getCenter();let o=n.getA(),r=n.getB();switch(t.getId()){case"anchor0":o=i.getX()-t.getX();break;case"anchor1":o=t.getX()-i.getX();break;case"anchor2":r=t.getY()-i.getY();break;case"anchor3":r=i.getY()-t.getY();break;default:s.error(`Unhandled anchor id: ${t.getId()}`)}e.mathShape=new ea(i,Math.abs(o),Math.abs(r)),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getCenter();e.mathShape=new ea(new S(i.getX()+t.x,i.getY()+t.y),n.getA(),n.getB()),e.updateQuantification()}constrainAnchorMove(e,t){const n=this.getAnchors(t);switch(e.getId()){case"anchor0":e.setY(n[1].getY());break;case"anchor1":e.setY(n[0].getY());break;case"anchor2":e.setX(n[3].getX());break;case"anchor3":e.setX(n[2].getX());break;default:s.error(`Unhandled anchor id: ${e.getId()}`)}}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getA(),r=t.getB();return[Wa.fromIndex(0,n-o,i),Wa.fromIndex(1,n+o,i),Wa.fromIndex(2,n,i+r),Wa.fromIndex(3,n,i-r)]}getConnectorPositions(e){const t=e.mathShape,n=t.getCenter().getX(),i=t.getCenter().getY(),o=t.getA()*Math.sqrt(2)/2,r=t.getB()*Math.sqrt(2)/2;return[new S(n-o,i-r),new S(n+o,i-r),new S(n-o,i+r),new S(n+o,i+r)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getCenter();return new S(n.getX()-t.getA(),n.getY()+t.getB())}}class rs{#u="ruler";static supports(e){return e instanceof Hr}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new Hr(t[0],t[1]),e.setTextExpr(ts(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[Wa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new Hr(new S(i.getX(),i.getY()),new S(o.getX(),o.getY())),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd();e.mathShape=new Hr(new S(i.getX()+t.x,i.getY()+t.y),new S(o.getX()+t.x,o.getY()+t.y)),e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[Wa.fromIndex(0,n.getX(),n.getY()),Wa.fromIndex(1,i.getX(),i.getY())]}getConnectorPositions(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return[new S((n.getX()+i.getX())/2,(n.getY()+i.getY())/2)]}getDefaultLabelPosition(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();return n.getY()>=i.getY()?n:i}}class as{#u="arrow";static supports(e){return e instanceof S}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=t[0],e.referencePoints=[t[1]],e.setTextExpr(ts(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[Wa.indexFromId(t.getId())]=t;const i=n[0],o=n[1];e.mathShape=new S(i.getX(),i.getY()),e.referencePoints=[new S(o.getX(),o.getY())],e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=e.referencePoints[0];e.mathShape=new S(n.getX()+t.x,n.getY()+t.y),e.referencePoints=[new S(i.getX()+t.x,i.getY()+t.y)],e.updateQuantification()}constrainAnchorMove(e,t){}onAnchorMoveEnd(){}getAnchors(e){const t=e.mathShape,n=e.referencePoints[0];return[Wa.fromIndex(0,t.getX(),t.getY()),Wa.fromIndex(1,n.getX(),n.getY())]}getConnectorPositions(e){const t=e.mathShape,n=e.referencePoints[0];return[new S((t.getX()+n.getX())/2,(t.getY()+n.getY())/2)]}getDefaultLabelPosition(e){return e.mathShape}}class ss{#u="roi";static supports(e){return e instanceof _r}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){}isComplete(){return!0}setAnnotationMathShape(e,t){e.mathShape=new _r(t),e.setTextExpr(ts(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=e.mathShape.getPoints().slice();n[Wa.indexFromId(t.getId())]=new S(t.getX(),t.getY()),e.mathShape=new _r(n),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<n.getLength();++e)i.push(new S(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new _r(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(Wa.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){const t=e.mathShape,n=t.getLength(),i=[];for(let e=0;e<n;++e){const o=t.getPoint(e),r=t.getPoint((e+1)%n);i.push(new S((o.getX()+r.getX())/2,(o.getY()+r.getY())/2))}return i}getDefaultLabelPosition(e){return e.mathShape.getPoint(0)}}class ls{#u="protractor";static supports(e){return e instanceof Kr}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 Kr(t),e.setTextExpr(ts(this.#u)),e.updateQuantification()}updateAnnotationOnAnchorMove(e,t){const n=this.getAnchors(e);n[Wa.indexFromId(t.getId())]=t;const i=n[0],o=n[1],r=n[2];e.mathShape=new Kr([new S(i.getX(),i.getY()),new S(o.getX(),o.getY()),new S(r.getX(),r.getY())]),e.updateQuantification()}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=[];for(let e=0;e<3;++e)i.push(new S(n.getPoint(e).getX()+t.x,n.getPoint(e).getY()+t.y));e.mathShape=new Kr(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(Wa.fromIndex(e,i.getX(),i.getY()))}return n}getConnectorPositions(e){return[e.mathShape.getPoint(1)]}getDefaultLabelPosition(e){const t=e.mathShape,n=new Hr(t.getPoint(0),t.getPoint(1)),i=new Hr(t.getPoint(1),t.getPoint(2));return new S((n.getCentroid().getX()+i.getCentroid().getX())/2,(n.getCentroid().getY()+i.getCentroid().getY())/2)}}function cs(e,t,n,i=20){const o=$r(t,t.getBegin(),i,n),r=$r(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 us{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 ds(e){const t=new Hr(e.getPoint(0),e.getPoint(1)),n=new Hr(e.getPoint(1),e.getPoint(2));let i=Xr(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 hs(t,n,i){const{radius:o,angle:r,inclination:a}=ds(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 gs(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 Ss={rectangle:new class extends us{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 us{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 us{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 us{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 cs(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()]),cs(e,i,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=n.getZoomScale(),r=$r(i,i.getBegin(),20,o),a=$r(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=$r(o,o.getBegin(),20,r),s=$r(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 us{createShape(t,n){const i=t.mathShape,o=t.referencePoints[0],r=new Hr(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 cs(a,r,n.getZoomScale()),a}updateShape(e,t,n){const i=t.mathShape,o=t.referencePoints[0],r=new Hr(i,o);e.position({x:0,y:0}),e.points([i.getX(),i.getY(),o.getX(),o.getY()]),cs(e,r,n.getZoomScale())}createExtras(t,n){const i=t.mathShape,o=t.referencePoints[0],r=jr(new Hr(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=jr(new Hr(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 us{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 us{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()&&gs(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()]),gs(e,n)}createExtras(e,t){const n=e.mathShape;return 3!==n.getLength()?[]:[hs(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}=ds(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 ms(e){const t=Ss[e];return t||s.error(`shapePainters: no painter for shape '${e}'`),t}class ps{#fn;constructor(e){this.#fn=e}getPosition(e){let t=e.labelPosition;return void 0===t&&(t=this.#fn(e)),t}create(t,n){const i=new e.Text({fontSize:n.getFontSize(),fontFamily:n.getFontFamily(),fill:t.colour,padding:n.getTextPadding(),shadowColor:n.getShadowLineColour(),shadowOffset:n.getShadowOffset(),name:"text"}),o=t.getText();i.setText(o);const r=n.applyZoomScale(1),a={x:2*r.x,y:2*r.y},s=this.getPosition(t),l=new e.Label({x:s.getX(),y:s.getY(),scale:a,visible:0!==o.length,name:"label"});return l.add(i),l.add(new e.Tag({fill:t.colour,opacity:n.getTagOpacity()})),l}updatePosition(t,n){const i=n.getChildren(function(e){return"label"===e.name()})[0];if(!(i instanceof e.Label))return;const o=this.getPosition(t);i.position({x:o.getX(),y:o.getY()})}getLabelAnchorsPosition(e){const t=e.x(),n=e.y(),i=e.width()*e.scale().x,o=e.height()*e.scale().y;return[new S(t+i/2,n),new S(t,n+o/2),new S(t+i/2,n+o),new S(t+i,n+o/2)]}getClosestPoints(e,t){let n=e[0].getDistance(t[0]),i=e[0],o=t[0];for(const r of e)for(const e of t){const t=r.getDistance(e);t<n&&(n=t,i=r,o=e)}return[i,o]}getConnector(t,n,i){const o=this.getLabelAnchorsPosition(n),r=this.getClosestPoints(t,o);return new e.Line({points:[r[0].getX(),r[0].getY(),r[1].getX(),r[1].getY()],stroke:n.getText().fill(),strokeWidth:i.getStrokeWidth(),strokeScaleEnabled:!1,visible:n.visible(),dash:[10,7],name:"connector"})}updateConnector(t,n){const i=t.getChildren(function(e){return"label"===e.name()})[0];if(!(i instanceof e.Label))return;const o=this.getLabelAnchorsPosition(i),r=this.getClosestPoints(n,o),a=t.getChildren(function(e){return"connector"===e.name()})[0];a instanceof e.Line&&a.points([r[0].getX(),r[0].getY(),r[1].getX(),r[1].getY()])}updateContent(t,n){const i=n.getChildren(function(e){return"label"===e.name()})[0];if(!(i instanceof e.Label))return;const o=t.getText();i.getText().setText(o),i.visible()&&i.visible(0!==o.length)}}class fs{#vn;#Cn;constructor(e){this.#vn=e,this.#Cn=new ps(t=>e.getDefaultLabelPosition(t))}createShapeGroup(t,n){const i=ms(this.#vn.getName()),o=new e.Group;if(o.name(this.#vn.getGroupName()),o.visible(!0),o.id(t.trackingUid),o.add(i.createShape(t,n)),this.#vn.isComplete(t)){for(const e of i.createExtras(t,n))o.add(e);const e=this.#Cn.create(t,n);o.add(e);const r=this.#vn.getConnectorPositions(t);o.add(this.#Cn.getConnector(r,e,n))}return o}getAnchors(e,t){return e?this.#vn.getAnchors(e).map(e=>es(e.getX(),e.getY(),e.getId(),t)):[]}constrainAnchorMove(e,t){const n=new Wa(e.id(),e.x(),e.y());this.#vn.constrainAnchorMove(n,t),e.x(n.getX()),e.y(n.getY())}onAnchorMoveEnd(t,n){this.#vn.onAnchorMoveEnd();const i=t.getParent();if(!(i instanceof e.Group))return;const o=this.#vn.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 Wa(t.id(),t.x(),t.y());this.#vn.updateAnnotationOnAnchorMove(e,n)}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();if(!(o instanceof e.Group))return;const r=ms(this.#vn.getName()),a=o.getChildren(Za)[0];r.updateShape(a,t,i),r.updateExtras(o,t,i);const s=this.#vn.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.#Cn.updatePosition(t,o),this.updateConnector(t,o)}updateLabelContent(e,t,n){this.#Cn.updateContent(e,t)}updateConnector(e,t){const n=this.#vn.getConnectorPositions(e);this.#Cn.updateConnector(t,n)}}class vs{#Dn=0;#yn=0;getMin(){return this.#Dn}setMin(e){this.#Dn=e}getMax(){return this.#yn}setMax(e){this.#yn=e}getName(){return"Threshold"}#In=null;setOriginalImage(e){this.#In=e}getOriginalImage(){return this.#In}update(){const e=this.getOriginalImage(),t=e.getDataRange().min;return e.transform(e=>e<this.getMin()||e>this.getMax()?t:e)}}class Cs{getName(){return"Sharpen"}#In=null;setOriginalImage(e){this.#In=e}getOriginalImage(){return this.#In}update(){return this.getOriginalImage().convolute2D([0,-1,0,-1,5,-1,0,-1,0])}}class Ds{getName(){return"Sobel"}#In=null;setOriginalImage(e){this.#In=e}getOriginalImage(){return this.#In}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 ys{getName(){return""}execute(){}undo(){}}class Is extends EventTarget{#Tn=[];#wn=0;getStackSize(){return this.#Tn.length}getCurrentStackIndex(){return this.#wn}getCurrentCommand(){return this.#Tn[this.#wn-1]}add(e){this.#Tn=this.#Tn.slice(0,this.#wn),this.#Tn.push(e),++this.#wn,this.dispatchEvent(new Event("undoadd"))}remove(e){let t=!1;const n=this.#Tn.findIndex(function(t){return t.getName()===e});return-1!==n&&(t=!0,this.dispatchEvent(new CustomEvent("undoremove",{detail:{commandName:e}})),this.#Tn.splice(n,1),--this.#wn),t}undo(){this.#wn>0&&(this.dispatchEvent(new Event("undo")),--this.#wn,this.#Tn[this.#wn].undo())}redo(){this.#wn<this.#Tn.length&&(this.#Tn[this.#wn].execute(),++this.#wn,this.dispatchEvent(new Event("redo")))}}class Ts extends ys{#Ln;#Pn;#An;constructor(e,t,n){super(),this.#Ln=e,this.#Pn=t,this.#An=n}getName(){return`Filter-${this.#Ln.getName()}`}execute(){this.#An.getDataController().setImage(this.#Pn,this.#Ln.update()),this.#An.getStageController().render(this.#Pn);const e={type:"filterrun",id:this.getName(),dataId:this.#Pn};this.onExecute(e)}undo(){this.#An.getDataController().setImage(this.#Pn,this.#Ln.getOriginalImage()),this.#An.getStageController().render(this.#Pn);const e={type:"filterundo",id:this.getName(),dataid:this.#Pn};this.onUndo(e)}onExecute(e){}onUndo(e){}}class ws extends EventTarget{#An;constructor(e){super(),this.#An=e}#On;#bn=0;#xn=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))};activate(e){for(const t in this.#On)e?(this.#On[t].addEventListener("filterrun",this.#xn),this.#On[t].addEventListener("filterundo",this.#xn)):(this.#On[t].removeEventListener("filterrun",this.#xn),this.#On[t].removeEventListener("filterundo",this.#xn))}setOptions(e){this.#On={};for(const t in e)this.#On[t]=new e[t](this.#An)}getOptionsType(){return"instance"}init(){for(const e in this.#On)this.#On[e].init()}keydown=e=>{e.context="Filter",this.#An.onKeydown(e)};getEventNames(){return["filterrun","filterundo"]}getSelectedFilter(){return this.#bn}setFeatures(e){if(void 0!==e.filterName){if(!this.hasFilter(e.filterName))throw new Error(`Unknown filter: '${e.filterName}'`);this.#bn&&this.#bn.activate(!1),this.#bn=this.#On[e.filterName],this.#bn.activate(!0)}if(void 0!==e.run&&e.run){let t={};void 0!==e.runArgs&&(t=e.runArgs),this.getSelectedFilter().run(t)}}getFilterList(){return this.#On}hasFilter(e){return void 0!==this.#On?.[e]}}class Ls extends EventTarget{#An;constructor(e){super(),this.#An=e}#Ln=new vs;#En=!0;activate(e){e&&(this.#En=!0)}init(){}run(e){if(void 0===e.dataId)throw new Error("No dataId to run threshod filter on.");if(this.#Ln.setMin(e.min),this.#Ln.setMax(e.max),this.#En){const t=this.#An.getDataController().get(e.dataId).image;this.#Ln.setOriginalImage(t),this.#En=!1}const t=new Ts(this.#Ln,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 Ps 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 Cs,n=this.#An.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Ts(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 As 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 Ds,n=this.#An.getDataController().get(e.dataId).image;t.setOriginalImage(n);const i=new Ts(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 Os={},bs={draw:{ArrowFactory:class{#vn=new as;#Rn=new fs(this.#vn);static supports(e){return as.supports(e)}getName(){return this.#vn.getName()}getGroupName(){return this.#vn.getGroupName()}getNPoints(){return this.#vn.getNPoints()}setAnnotationMathShape(e,t){this.#vn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Rn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Rn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Rn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Rn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Rn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Rn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#vn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Rn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Rn.updateConnector(e,t)}},CircleFactory:class{#vn=new is;#Rn=new fs(this.#vn);static supports(e){return is.supports(e)}getName(){return this.#vn.getName()}getGroupName(){return this.#vn.getGroupName()}getNPoints(){return this.#vn.getNPoints()}setAnnotationMathShape(e,t){this.#vn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Rn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Rn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Rn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Rn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Rn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Rn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#vn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Rn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Rn.updateConnector(e,t)}},EllipseFactory:class{#vn=new os;#Rn=new fs(this.#vn);static supports(e){return os.supports(e)}getName(){return this.#vn.getName()}getGroupName(){return this.#vn.getGroupName()}getNPoints(){return this.#vn.getNPoints()}setAnnotationMathShape(e,t){this.#vn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Rn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Rn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Rn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Rn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Rn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Rn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#vn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Rn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Rn.updateConnector(e,t)}},ProtractorFactory:class{#vn=new ls;#Rn=new fs(this.#vn);static supports(e){return ls.supports(e)}getName(){return this.#vn.getName()}getGroupName(){return this.#vn.getGroupName()}getNPoints(){return this.#vn.getNPoints()}setAnnotationMathShape(e,t){this.#vn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Rn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Rn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Rn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Rn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Rn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Rn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#vn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Rn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Rn.updateConnector(e,t)}},RectangleFactory:class{#vn=new ns;#Rn=new fs(this.#vn);static supports(e){return ns.supports(e)}getName(){return this.#vn.getName()}getGroupName(){return this.#vn.getGroupName()}getNPoints(){return this.#vn.getNPoints()}setAnnotationMathShape(e,t){this.#vn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Rn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Rn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Rn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Rn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Rn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Rn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#vn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Rn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Rn.updateConnector(e,t)}},RoiFactory:class{#vn=new ss;#Rn=new fs(this.#vn);static supports(e){return ss.supports(e)}getName(){return this.#vn.getName()}getGroupName(){return this.#vn.getGroupName()}getNPoints(){return this.#vn.getNPoints()}setAnnotationMathShape(e,t){this.#vn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Rn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Rn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Rn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Rn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Rn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Rn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#vn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Rn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Rn.updateConnector(e,t)}},RulerFactory:class{#vn=new rs;#Rn=new fs(this.#vn);static supports(e){return rs.supports(e)}getName(){return this.#vn.getName()}getGroupName(){return this.#vn.getGroupName()}getNPoints(){return this.#vn.getNPoints()}setAnnotationMathShape(e,t){this.#vn.setAnnotationMathShape(e,t)}createShapeGroup(e,t){return this.#Rn.createShapeGroup(e,t)}getAnchors(e,t){return this.#Rn.getAnchors(e,t)}constrainAnchorMove(e,t){this.#Rn.constrainAnchorMove(e,t)}onAnchorMoveEnd(e,t){this.#Rn.onAnchorMoveEnd(e,t)}updateShapeGroupOnAnchorMove(e,t,n){this.#Rn.updateShapeGroupOnAnchorMove(e,t,n)}updateAnnotationOnAnchorMove(e,t){this.#Rn.updateAnnotationOnAnchorMove(e,t)}updateAnnotationOnTranslation(e,t){this.#vn.updateAnnotationOnTranslation(e,t)}updateLabelContent(e,t,n){this.#Rn.updateLabelContent(e,t,n)}updateConnector(e,t){this.#Rn.updateConnector(e,t)}},BidimensionalFactory:class{#u="bidimensional";#Cn=new ps(this.#Fn);static supports(e){return e instanceof oa}getName(){return this.#u}getGroupName(){return`${this.#u}-group`}getNPoints(){return 2}#Mn(e){return void 0!==ke.labelTexts&&void 0!==ke.labelTexts[this.#u]?ke.labelTexts[this.#u]:!0===e.mathShape.hasShortAxisInteraction&&null!==e.quantification?.shortAxis?.value?$a[this.#u]:$a[`${this.#u}Drawing`]}setAnnotationMathShape(e,t){const n=new oa(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.#Mn(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.#qn(t,n);i.add(o);const r=this.#Un(t,n);for(const e of r)i.add(e);const a=this.#Cn.create(t,n);i.add(a);const s=this.#Qn(o);i.add(this.#Cn.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}#qn(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 cs(o,i,n.getZoomScale?n.getZoomScale():{x:1,y:1}),o}#Un(t,n){const i=t.mathShape,o=10,r=n.getZoomScale?n.getZoomScale():{x:1,y:1},a=$r(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=$r(i,i.getEnd(),20,r),c=new e.Line({points:[l.getBegin().getX(),l.getBegin().getY(),l.getEnd().getX(),l.getEnd().getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,name:"shape-tick1"}),[u,d]=this.getShortAxisEndpoints(t),h=new e.Line({points:[u.getX(),u.getY(),d.getX(),d.getY()],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,dash:t.mathShape.hasShortAxisInteraction?[]:[8,8],opacity:.5,name:"bidimensional-short-axis"}),g=d.getX()-u.getX(),S=d.getY()-u.getY(),m=Math.hypot(g,S);let p,f;return 0===m?(p=1,f=0):(p=-S/m,f=g/m),[s,c,h,new e.Line({points:[u.getX()-p*o/2,u.getY()-f*o/2,u.getX()+p*o/2,u.getY()+f*o/2],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,opacity:.5,name:"short-axis-tick0"}),new e.Line({points:[d.getX()-p*o/2,d.getY()-f*o/2,d.getX()+p*o/2,d.getY()+f*o/2],stroke:t.colour,strokeWidth:n.getStrokeWidth(),strokeScaleEnabled:!1,opacity:.5,name:"short-axis-tick1"})]}#Qn(e){const t=e.points(),n=e.x(),i=e.y(),o=(t[0]+t[2])/2+n,r=(t[1]+t[3])/2+i;return[new S(o,r)]}#Vn(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.#Vn(e),i=[];for(let e=0;e<n.length;++e)i.push(es(n[e].getX(),n[e].getY(),`anchor${e}`,t));return i}constrainAnchorMove(e,t){const n=t.mathShape;if("anchor2"===e.id()||"anchor3"===e.id()){const t=n.getBegin(),i=n.getEnd(),o=i.getX()-t.getX(),r=i.getY()-t.getY(),a=Math.hypot(o,r);if(0===a)return;const s=o/a,l=r/a,c=-l,u=s,d=e.x()-t.getX(),h=e.y()-t.getY(),g=d*s+h*l;n.shortAxisT=Math.max(0,Math.min(1,g/a));const S=this.getPointAlongLine(n,n.shortAxisT);n.shortAxisCenter=S;const m=d*c+h*u;"anchor2"===e.id()?n.shortAxisL1=Math.max(.1,m):n.shortAxisL2=Math.max(.1,-m),n.shortAxisLength=n.shortAxisL1+n.shortAxisL2;const p="anchor2"===e.id()?n.shortAxisL1:-n.shortAxisL2;e.x(S.getX()+c*p),e.y(S.getY()+u*p)}}onAnchorMoveEnd(e,t){}updateShapeGroupOnAnchorMove(t,n,i){const o=n.getParent();o instanceof e.Group&&(this.#Nn(t,n,i),this.updateLabelContent(t,o,i),void 0===t.labelPosition&&this.#Cn.updatePosition(t,o),this.updateConnector(t,o))}#Nn(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()]),cs(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=$r(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=$r(o,o.getEnd(),20,c);l&&l instanceof e.Line&&(l.position({x:0,y:0}),l.points([d.getBegin().getX(),d.getBegin().getY(),d.getEnd().getX(),d.getEnd().getY()])),"anchor2"!==n.id()&&"anchor3"!==n.id()||(o.shortAxisLength=t.mathShape.shortAxisLength,o.shortAxisT=t.mathShape.shortAxisT);const[h,g]=this.getShortAxisEndpoints(t),S=r.findOne(".bidimensional-short-axis");S&&S instanceof e.Line&&(S.position({x:0,y:0}),S.points([h.getX(),h.getY(),g.getX(),g.getY()])),this.updateShortAxisTicks(r,h,g);const m=_a(r,2),p=_a(r,3);m&&p&&(m.x(h.getX()),m.y(h.getY()),p.x(g.getX()),p.y(g.getY())),t.mathShape.hasShortAxisInteraction=!0,t.setTextExpr(this.#Mn(t)),t.updateQuantification?.(),r.getLayer()?.draw()}updateLabelContent(e,t,n){this.#Cn.updateContent(e,t)}updateConnector(t,n){const i=n.findOne(".shape");if(i&&i instanceof e.Line){const e=this.#Qn(i);this.#Cn.updateConnector(n,e)}}#Fn(e){const t=e.mathShape,n=t.getBegin(),i=t.getEnd();let o=n;return n.getY()<i.getY()&&(o=i),o}updateAnnotationOnTranslation(e,t){const n=e.mathShape,i=n.getBegin(),o=n.getEnd(),r=new S(i.getX()+t.x,i.getY()+t.y),a=new S(o.getX()+t.x,o.getY()+t.y),s=new oa(r,a);s.shortAxisLength=n.shortAxisLength,s.shortAxisT=n.shortAxisT,s.shortAxisL1=n.shortAxisL1,s.shortAxisL2=n.shortAxisL2,n.shortAxisCenter instanceof Object&&"getX"in n.shortAxisCenter&&"getY"in n.shortAxisCenter&&(s.shortAxisCenter=new S(n.shortAxisCenter.getX()+t.x,n.shortAxisCenter.getY()+t.y)),s.hasShortAxisInteraction=n.hasShortAxisInteraction,e.mathShape=s,e.updateQuantification()}updateAnnotationOnAnchorMove(t,n){const i=n.getParent();if(!(i instanceof e.Group))return;const o=i.findOne(".shape"),r=_a(i,0),a=_a(i,1),s=new S(r.x()-o.x(),r.y()-o.y()),l=new S(a.x()-o.x(),a.y()-o.y()),c=new oa(s,l),u=t.mathShape;if(u.shortAxisCenter instanceof S){const e=u.shortAxisCenter,t=l.getX()-s.getX(),n=l.getY()-s.getY(),i=t*t+n*n;if(i>0){const o=((e.getX()-s.getX())*t+(e.getY()-s.getY())*n)/i;c.shortAxisT=Math.max(0,Math.min(1,o)),c.shortAxisCenter=new S(s.getX()+t*c.shortAxisT,s.getY()+n*c.shortAxisT)}else c.shortAxisT=.5,c.shortAxisCenter=e}else c.shortAxisT=u.shortAxisT??.5;c.shortAxisL1=u.shortAxisL1,c.shortAxisL2=u.shortAxisL2,c.shortAxisLength=u.shortAxisLength,c.hasShortAxisInteraction=u.hasShortAxisInteraction,t.mathShape=c,t.updateQuantification()}updateShortAxisToSolid(t){const n=t.findOne(".bidimensional-short-axis");n&&n instanceof e.Line&&(n.dash([]),n.getLayer()?.draw())}updateShortAxisTicks(t,n,i){const o=10,r=i.getX()-n.getX(),a=i.getY()-n.getY(),s=Math.hypot(r,a);let l,c;0===s?(l=1,c=0):(l=-a/s,c=r/s);const u=new S(n.getX()-l*o/2,n.getY()-c*o/2),d=new S(n.getX()+l*o/2,n.getY()+c*o/2),h=t.findOne(".short-axis-tick0");h&&h instanceof e.Line&&(h.position({x:0,y:0}),h.points([u.getX(),u.getY(),d.getX(),d.getY()]),h.opacity(.5));const g=new S(i.getX()-l*o/2,i.getY()-c*o/2),m=new S(i.getX()+l*o/2,i.getY()+c*o/2),p=t.findOne(".short-axis-tick1");p&&p instanceof e.Line&&(p.position({x:0,y:0}),p.points([g.getX(),g.getY(),m.getX(),m.getY()]),p.opacity(.5))}getShortAxisEndpoints(e){const t=e.mathShape;let n;if(e.mathShape.shortAxisCenter instanceof S){const i=t.getBegin(),o=t.getEnd(),r=o.getX()-i.getX(),a=o.getY()-i.getY(),s=Math.hypot(r,a);if(0===s)n=e.mathShape.shortAxisCenter;else{const o=r/s,l=a/s,c=(e.mathShape.shortAxisCenter.getX()-i.getX())*o+(e.mathShape.shortAxisCenter.getY()-i.getY())*l,u=Math.max(0,Math.min(1,c/s));e.mathShape.shortAxisT=u,n=this.getPointAlongLine(t,u)}}else{const i="number"==typeof e.mathShape.shortAxisT?e.mathShape.shortAxisT:.5;n=this.getPointAlongLine(t,i)}const i=t.getBegin(),o=t.getEnd(),r=o.getX()-i.getX(),a=o.getY()-i.getY(),s=Math.hypot(r,a);if(0===s||Number.isNaN(n.getX())||Number.isNaN(n.getY()))return[n,n];const l=-a/s,c=r/s;let u,d;return u="number"==typeof e.mathShape.shortAxisL1?e.mathShape.shortAxisL1:"number"==typeof e.mathShape.shortAxisLength?e.mathShape.shortAxisLength/2:0,d="number"==typeof e.mathShape.shortAxisL2?e.mathShape.shortAxisL2:"number"==typeof e.mathShape.shortAxisLength?e.mathShape.shortAxisLength/2:0,Number.isNaN(u)||Number.isNaN(d)?[n,n]:[new S(n.getX()+l*u,n.getY()+c*u),new S(n.getX()-l*d,n.getY()-c*d)]}getPointAlongLine(e,t){const n=e.getBegin(),i=e.getEnd();return new S(n.getX()+(i.getX()-n.getX())*t,n.getY()+(i.getY()-n.getY())*t)}}},filter:{Threshold:Ls,Sobel:As,Sharpen:Ps}};class xs{#h=!0;#m;constructor(e,t){void 0!==t&&(this.#h=t),this.#m=new DataView(e)}writeUint8(e,t){return this.#m.setUint8(e,t),e+Uint8Array.BYTES_PER_ELEMENT}writeInt8(e,t){return this.#m.setInt8(e,t),e+Int8Array.BYTES_PER_ELEMENT}writeUint16(e,t){return this.#m.setUint16(e,t,this.#h),e+Uint16Array.BYTES_PER_ELEMENT}writeInt16(e,t){return this.#m.setInt16(e,t,this.#h),e+Int16Array.BYTES_PER_ELEMENT}writeUint32(e,t){return this.#m.setUint32(e,t,this.#h),e+Uint32Array.BYTES_PER_ELEMENT}writeUint64(e,t){return this.#m.setBigUint64(e,t,this.#h),e+BigUint64Array.BYTES_PER_ELEMENT}writeInt32(e,t){return this.#m.setInt32(e,t,this.#h),e+Int32Array.BYTES_PER_ELEMENT}writeInt64(e,t){return this.#m.setBigInt64(e,t,this.#h),e+BigInt64Array.BYTES_PER_ELEMENT}writeFloat32(e,t){return this.#m.setFloat32(e,t,this.#h),e+Float32Array.BYTES_PER_ELEMENT}writeFloat64(e,t){return this.#m.setFloat64(e,t,this.#h),e+Float64Array.BYTES_PER_ELEMENT}writeHex(e,t){const n=parseInt(t,16);return this.#m.setUint16(e,n,this.#h),e+Uint16Array.BYTES_PER_ELEMENT}writeBinaryArray(e,t){if(t.length%8!=0)throw new Error("Cannot write boolean array as binary.");let n,i;for(let o=0,r=t.length;o<r;o+=8){n=0;for(let e=0;e<8;++e)i=0===t[o+e]?0:1,n+=i<<e;e=this.writeUint8(e,n)}return e}writeUint8Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint8(e,t[n]);return e}writeInt8Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt8(e,t[n]);return e}writeUint16Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint16(e,t[n]);return e}writeInt16Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt16(e,t[n]);return e}writeUint32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint32(e,t[n]);return e}writeUint64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeUint64(e,t[n]);return e}writeInt32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt32(e,t[n]);return e}writeInt64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeInt64(e,t[n]);return e}writeFloat32Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeFloat32(e,t[n]);return e}writeFloat64Array(e,t){for(let n=0,i=t.length;n<i;++n)e=this.writeFloat64(e,t[n]);return e}}let Es=0;const Rs={copy:"copy",remove:"remove",clear:"clear",replace:"replace"};class Fs{action;value;constructor(e){this.action=e}}const Ms={[Rs.copy]:e=>e,[Rs.remove]:()=>null,[Rs.clear]:e=>(e.value=[],e),[Rs.replace]:(e,t)=>(e.value=qs(t),e)};function qs(e){const t=Us(e);return Array.isArray(t)?t:[t]}function Us(e){if(Array.isArray(e))return e.map(Us);if(ArrayBuffer.isView(e)&&!(e instanceof DataView))return e.slice();if(e instanceof le||null!==e&&"object"==typeof e&&Object.getPrototypeOf(e)===Object.prototype){const t=e instanceof le?new le(e.vr):{};for(const n of Object.keys(e))t[n]=Us(e[n]);return t}return e}function Qs(e){const t={},n={};for(const i of Object.keys(e)){const o=e[i];if("default"===i){n[i]=o;continue}if(Vs(i)){n[Ns(i)]=o;continue}const r=se(i);if(void 0!==r){t[r.getKey()]=o;continue}const a=Object.keys($).filter(e=>$[e]===i);if(0===a.length)s.warn(`Cannot translate unknown writer rule name: ${i}`);else for(const e of a)t[e]=o}return{...t,...n}}function Vs(e){return/^([0-9A-FX]{4}){1,2}$/i.test(e)}function Ns(e){return e.toUpperCase().replaceAll("X","x")}function Bs(e){return e.toLowerCase().includes("x")}function ks(e,t){const n=e=>e.split("x").length-1;return Object.keys(e).filter(e=>e.length===t&&Vs(e)&&Bs(e)).map(t=>({range:Ns(t),rule:e[t]})).sort((e,t)=>n(e.range)-n(t.range))}function Gs(e,t){return e.find(e=>(e=>{for(let n=0;n<e.length;++n)if("x"!==e[n]&&e[n]!==t[n])return!1;return!0})(e.range))?.rule}function zs(e){const t=`.${(new Date).toISOString().replace(/\D/g,"").substring(0,14)}`;Es+=1;const n=`.${Es}`;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 Hs(e){return e%2==0}function Xs(e){const t=J[e];return void 0!==t&&"string"===t}function Ys(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}class Ws{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 $s="00080005",js="00280100";class Zs{#Bn=!1;#kn=!0;#Gn;#zn={default:{action:Rs.copy,value:null}};#Hn=this.#zn;#Xn=[];#Yn=[];#Wn=[];#$n=new Ws;#jn=this.#$n;setUseUnVrForPrivateSq(e){this.#Bn=e}setFixUnknownVR(e){this.#kn=e}setPrivateTagsWhitelist(e){if(void 0!==e){this.#Gn=new Set;for(const t of e){this.#Gn.add(t);const e=q(t),n=e.getElement();parseInt(n,16)>=4096&&this.#Gn.add(`${e.getGroup()}00${n.substring(0,2)}`)}}else this.#Gn=void 0}setRules(e,t){const n=Object.keys(e).filter(e=>"default"!==e&&!Vs(e));0!==n.length&&s.warn(`Writer rules not indexed by tag or group key: ${n.join(", ")} (they will be ignored, use translateWriterRules for name based rules)`);const i=Object.values(Rs),o={},r=[];for(const t of Object.keys(e))i.includes(e[t]?.action)?o[t]=e[t]:r.push(t);if(0!==r.length&&s.warn(`Writer rules with unknown action: ${r.join(", ")} (they will be ignored, expected one of: ${i.join(", ")})`),e=o,this.#Hn=e,this.#Xn=ks(e,8),this.#Yn=ks(e,4),this.#Wn=[],t){const t=Object.keys(e);for(const n of t){const t=e[n];t.action===Rs.replace&&void 0!==t.value&&null!==t.value&&8===n.length&&Vs(n)&&!Bs(n)&&void 0!==re(q(n))&&this.#Wn.push(n)}}}#Zn(e){return this.#$n.encode(e)}#Kn(e){return this.#jn.encode(e)}useSpecialTextEncoder(){this.#jn=new TextEncoder}getElementToWrite(e){if(void 0!==this.#Gn&&e.tag.isPrivate()&&!this.#Gn.has(e.tag.getKey()))return null;const t=e.tag.getKey(),n=e.tag.getGroup();let i=this.#Hn[t];void 0===i&&(i=Gs(this.#Xn,t)),void 0===i&&(i=this.#Hn[n]),void 0===i&&(i=Gs(this.#Yn,n)),void 0===i&&(i=this.#Hn.default??this.#zn.default);const o=Ms[i.action](e,i.value);return null!==o&&"SQ"===o.vr&&Array.isArray(o.value)&&(o.value=o.value.map(e=>this.#_n(e))),o}#_n(e){if(null===e||"object"!=typeof e)return e;const t={};for(const n of Object.keys(e)){const i=e[n];if(i.tag=q(n),Q(i.tag)){t[n]=i;continue}const o=this.getElementToWrite(i);null!==o&&(t[n]=o)}return t}#Jn(e,t,n,i,o){const r=function(e){return Q(e.tag)&&"NONE"===e.vr};for(const a of n){if(0===a.length)continue;let n=!1;const s=a.find(e=>r(e));void 0!==s&&void 0!==s.undefinedLength&&(n=s.undefinedLength);const l=new le("NONE");l.vl=n?4294967295:s.vl,l.tag=U(),l.value=[],t=this.#ei(e,l,t,i);for(const n of a)r(n)||N(n.tag)||(t=this.#ei(e,n,t,i,o));if(n){const n=new le("NONE");n.vl=0,n.tag=V(),n.value=[],t=this.#ei(e,n,t,i)}}return t}#ti(e,t,n,i,o,r){const a=n;if("NONE"===t.vr);else if(i instanceof Uint8Array)if(void 0!==r&&1===r){if(i.length%8!=0){s.debug("Padding binary pixel data");const e=8*Math.ceil(i.length/8),t=new Array(e-i.length);t.fill(0),i=Ys(i,t)}n=e.writeBinaryArray(n,i)}else n=e.writeUint8Array(n,i);else if(i instanceof Int8Array)n=e.writeInt8Array(n,i);else if(i instanceof Uint16Array)n=e.writeUint16Array(n,i);else if(i instanceof Int16Array)n=e.writeInt16Array(n,i);else if(i instanceof Uint32Array)n=e.writeUint32Array(n,i);else if(i instanceof Int32Array)n=e.writeInt32Array(n,i);else if(i instanceof Float32Array)n=e.writeFloat32Array(n,i);else if(i instanceof Float64Array)n=e.writeFloat64Array(n,i);else if(i instanceof BigUint64Array)n=e.writeUint64Array(n,i);else if(i instanceof BigInt64Array)n=e.writeInt64Array(n,i);else{const r=J[t.vr];if(void 0!==r)if("Uint8"===r)n=e.writeUint8Array(n,i);else if("Uint16"===r)n=e.writeUint16Array(n,i);else if("Int16"===r)n=e.writeInt16Array(n,i);else if("Uint32"===r)n=e.writeUint32Array(n,i);else if("Int32"===r)n=e.writeInt32Array(n,i);else if("Uint64"===r)n=e.writeUint64Array(n,i);else if("Int64"===r)n=e.writeInt64Array(n,i);else if("Float32"===r)n=e.writeFloat32Array(n,i);else if("Float64"===r)n=e.writeFloat64Array(n,i);else{if("string"!==r)throw new Error(`Unknown VR type: ${r}`);n=e.writeUint8Array(n,i)}else if("SQ"===t.vr)n=this.#Jn(e,n,i,o);else if("AT"===t.vr)for(const t of i){const i=String(t),o=i.substring(1,5),r=i.substring(6,10),a=[parseInt(o,16),parseInt(r,16)];n=e.writeUint16Array(n,a)}else"xs"===t.vr?n=i instanceof Int16Array?e.writeInt16Array(n,i):e.writeUint16Array(n,i):s.warn(`Unknown VR: ${t.vr}`)}if("SQ"!==t.vr&&"NONE"!==t.vr){const e=n-a;if(e!==t.vl){let n=`Offset difference and VL are not equal: ${e} != ${t.vl}`;n+=" (",void 0!==t.tag&&(n+=`${t.tag}, `),n+=`vr:${t.vr})`,s.warn(n)}}return n}#ni(e,t,n,i,o,r){let a=!1;if(void 0!==t.undefinedLength&&(a=t.undefinedLength),a){const a=[];a.push({tag:U(),vr:"NONE",vl:0,value:[]});for(const e of i)a.push({tag:U(),vr:t.vr,vl:e.length,value:e});n=this.#Jn(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.#ti(e,t,n,a,o,r)}return n}#ei(e,t,n,i,o){const r=t.tag.isWithVR(),a=!(!i&&r)||Z(t.vr);n=e.writeHex(n,t.tag.getGroup()),n=e.writeHex(n,t.tag.getElement());let l=t.vr;this.#Bn&&t.tag.isPrivate()&&"SQ"===l&&(s.warn("Write element using VR=UN for private sequence."),l="UN"),r&&!i&&(n=e.writeUint8Array(n,this.#Zn(l)),a&&(n+=2));let c=!1;("SQ"===t.vr||z(t.tag))&&void 0!==t.undefinedLength&&(c=t.undefinedLength);let u=!1;Q(t.tag)&&void 0!==t.undefinedLength&&(u=t.undefinedLength);let d=t.vl;(c||u)&&(d=4294967295),n=a?e.writeUint32(n,d):e.writeUint16(n,d);let h=t.value;if(void 0===h&&(h=[]),n=z(t.tag)?this.#ni(e,t,n,h,i,o):this.#ti(e,t,n,h,i),c){const t=new le("NONE");t.vl=0,t.tag=B(),t.value=[],n=this.#ei(e,t,n,i)}return n}getBuffer(e){const t=e["00020010"].value[0],n=Le(t),i=Pe(t);if(void 0!==e[$s]){const t=e[$s].value[0];void 0!==t&&"ISO-IR 6"!==t&&(s.debug(`Change charset to UTF, was: ${t}`),this.useSpecialTextEncoder(),e[$s].value=["ISO_IR 192"])}let o;void 0!==e[js]&&(o=e[js].value[0]);let r,a=132;const l=[],c=[];let u,d,h=0;const g=new F("0002","0000"),S=new F("0002","0001"),m=new F("0002","0012"),p=new F("0002","0013"),f=this.#Wn.slice(),v=Object.keys(e);for(const t of v){const s=e[t];if(s.tag=q(t),u=this.getElementToWrite(s),!(null===u||g.equals(u.tag)||S.equals(u.tag)||m.equals(u.tag)||p.equals(u.tag))){r=0;const e=f.indexOf(u.tag.getKey());-1!==e&&f.splice(e,1),this.#kn&&Ks(u,!i),this.#ii(u,u.value,n,o),d=ae(u.tag),r+=qe(u.vr,"Meta Element"!==d&&n),r+=u.vl,"Meta Element"===d?(l.push(u),h+=r):c.push(u),a+=r}}for(const e of f){const t=q(e),i=re(t),o=new le(i?.getVr());o.tag=t;const r=qs(this.#Hn[e].value);let s=qe(o.vr,n);s+=this.#ii(o,r,n),c.push(o),a+=s}const C=_s("FileMetaInformationVersion");let D=qe(C.vr,!1);D+=this.#ii(C,[0,1],!1),l.push(C),h+=D,a+=D;const y=_s("ImplementationClassUID");let I=qe(y.vr,!1);const T=`1.2.826.0.1.3680043.9.7278.1.${"0.37.0".replace("-beta",".99")}`;I+=this.#ii(y,[T],!1),l.push(y),h+=I,a+=I;const w=_s("ImplementationVersionName");let L=qe(w.vr,!1);L+=this.#ii(w,["DWV_0.37.0"],!1),l.push(w),h+=L,a+=L;const P=function(e,t){return M(e.tag,t.tag)};l.sort(P),c.sort(P);const A=_s("FileMetaInformationGroupLength");let O=qe(A.vr,!1);O+=this.#ii(A,new Uint32Array([h]),!1),a+=O;const b=new ArrayBuffer(a),x=new xs(b),E=new xs(b,!i);let R=128;R=x.writeUint8Array(R,this.#Zn("DICM")),R=this.#ei(x,A,R,!1);for(const e of l)R=this.#ei(x,e,R,!1);const U=132+O+h;R!==U&&s.warn(`Bad size calculation... meta offset: ${R}, calculated size:${U} (diff:${R-U})`);for(const e of c)R=this.#ei(E,e,R,n,o);return R!==a&&s.warn(`Bad size calculation... final offset: ${R}, calculated size:${a} (diff:${R-a})`),b}#ii(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[js];void 0!==u&&void 0!==u.value&&(c=u.value[0]);const d=Object.keys(t);for(const e of d){const i=t[e];i.tag=q(e),Q(i.tag)||(l+=this.#ii(i,i.value,n,c),s.push(i),l+=qe(i.vr,n))}const h={tag:U(),vr:"NONE",vl:l,value:[]};a&&(h.undefinedLength=a),s.push(h),l+=qe(h.vr,n),a&&(l+=qe("NONE",n));const g=function(e,t){return M(e.tag,t.tag)};s.sort(g),o+=l,r.push(s)}a&&(o+=qe("NONE",n)),e.value=r,e.vl=o,a&&(e.undefinedLength=a)}}else{if(Xs(r=e.vr)||"OB"===r){const n=function(e){let t="";return Xs(e)&&(t="UI"===e?"\0":" "),t}(e.vr);if(Xs(e.vr)){let i;_(e.vr)?(t=this.#Kn(t.join("\\")),i=this.#Kn(n)):(t=this.#Zn(t.join("\\")),i=this.#Zn(n)),Hs(t.length)||(t=Ys(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;Hs(t)||(e[e.length-1]=Ys(e[e.length-1],[0]))}else Hs(e.length)||(e=Ys(e,[0]));return e}(t))}if("AT"===e.vr)o=4*t.length;else if("xs"===e.vr)o=t.length*Uint16Array.BYTES_PER_ELEMENT;else if(function(e){const t=J[e];return void 0!==t&&"string"!==t}(e.vr)||"ox"===e.vr){if(z(e.tag)&&Array.isArray(t)){o=0;for(const e of t)o+=e.length}else o=t.length;const r=J[e.vr];if(z(e.tag)||"ox"===e.vr)if(e.undefinedLength){const e=qe("NONE",n);o+=e,o+=e*t.length,o+=e}else void 0!==i&&(1===i?o=Math.ceil(o/8):16===i?o*=Uint16Array.BYTES_PER_ELEMENT:32===i?o*=Uint32Array.BYTES_PER_ELEMENT:64===i&&(o*=Float64Array.BYTES_PER_ELEMENT));else{if(void 0===r)throw new Error(`Unsupported element: ${e.vr}`);{const e=function(e){let t;return"Uint8"===e?t=Uint8Array.BYTES_PER_ELEMENT:"Uint16"===e?t=Uint16Array.BYTES_PER_ELEMENT:"Int16"===e?t=Int16Array.BYTES_PER_ELEMENT:"Uint32"===e?t=Uint32Array.BYTES_PER_ELEMENT:"Int32"===e?t=Int32Array.BYTES_PER_ELEMENT:"Float32"===e?t=Float32Array.BYTES_PER_ELEMENT:"Float64"===e?t=Float64Array.BYTES_PER_ELEMENT:"Uint64"===e?t=BigUint64Array.BYTES_PER_ELEMENT:"Int64"===e&&(t=BigInt64Array.BYTES_PER_ELEMENT),t}(r);if(void 0===e)throw new Error(`Unknown bytes per element for VR type: ${r}`);o*=e}}}else o=t.length;e.value=t,e.vl=o}var r;return o}}function Ks(e,t){if("UN"===e.vr){const n=re(e.tag)?.getVr();if(void 0!==n&&e.vr!==n){e.vr=n;const i=J[e.vr];if(void 0!==i&&"Uint8"!==i&&"string"!==i){const n=function(e,t,n){let i;if(void 0===e.buffer)return i;const o=new me(e.buffer,n),r=e.byteOffset,a=e.length,s=J[t];return"Uint16"===s?i=o.readUint16Array(r,a):"Uint32"===s?i=o.readUint32Array(r,a):"Uint64"===s?i=o.readUint64Array(r,a):"Int16"===s?i=Array.from(o.readInt16Array(r,a)):"Int32"===s?i=Array.from(o.readInt32Array(r,a)):"Int64"===s?i=o.readInt64Array(r,a):"Float32"===s?i=Array.from(o.readFloat32Array(r,a)):"Float64"===s&&(i=Array.from(o.readFloat64Array(r,a))),i}(e.value,e.vr,t);void 0!==n&&(e.value=n)}s.info(`Element ${e.tag.getGroup()} ${e.tag.getElement()} VR changed from UN to ${e.vr}`)}}}function _s(e){const t=se(e),n=re(t),i=new le(n?.getVr());return i.tag=t,i}class Js{trackingId;trackingUid;referencedSopInstanceUID;referencedSopClassUID;referencedFrameNumber;mathShape;referencePoints;colour="#ffff80";quantification;textExpr="";labelPosition;planeOrigin;planePoints;#oi;#Le={};constructor(){this.trackingId=Math.random().toString(36).substring(2,15),this.trackingUid=zs("TrackingUniqueIdentifier")}getMetaConceptIds(){return Object.keys(this.#Le)}getMetaItem(e){return this.#Le[e]}addMetaItem(e,t){const n=e.value;void 0!==this.#Le[n]&&s.warn(`Overwriting annotation meta with id=${n}`),this.#Le[e.value]={concept:e,value:t}}removeMetaItem(e){void 0!==this.#Le[e]&&delete this.#Le[e]}getOrientationName(){let e;return void 0!==this.planePoints&&(e=je(this.planePoints[1].getValues().concat(this.planePoints[2].getValues()))),e}init(e){if(void 0!==this.referencedSopInstanceUID)return void s.debug("Cannot initialise annotation twice");this.#oi=e;const t=e.getCurrentPosition();if(this.referencedSopInstanceUID=e.getCurrentImageUid(),this.referencedSopClassUID=e.getSopClassUid(),t.length()>3){const n=e.getIndexFromPosition(t);this.referencedFrameNumber=n.get(3)+1}this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID),e.isAquisitionOrientation()||(this.planePoints=e.getPlanePoints(t))}canView(){return void 0!==this.#oi}isCompatibleView(e){let t=!1;return void 0===this.planePoints?e.isAquisitionOrientation()&&(t=!0):t=this.#ri(e.getCosines())||this.#ri(e.getLegacyCosines()),t}#ri(e){const t=new m(e[0],e[1],e[2]),n=new m(e[3],e[4],e[5]);return t.equals(this.planePoints[1])&&n.equals(this.planePoints[2])}setViewController(e){if(!e.includesImageUid(this.referencedSopInstanceUID))return void s.warn(`Cannot view annotation with reference UID: ${this.referencedSopInstanceUID}`);const t=e.getPlaneHelper();if(this.isCompatibleView(t)){if(this.#oi=e,void 0!==this.planePoints){const e=t.getCosines();this.#ri(e)||(this.planePoints=[this.planePoints[0],new m(e[0],e[1],e[2]),new m(e[3],e[4],e[5])])}this.planeOrigin=e.getOriginForImageUid(this.referencedSopInstanceUID)}}#ai(){let e;if(void 0!==this.#oi){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.#si());const i=new C(n);e=this.#oi.getIndexFromPosition(i)}return e}getCentroid(){let e;if(void 0!==this.#oi&&void 0!==this.mathShape.getCentroid&&void 0!==this.mathShape.getCentroid()){const t=this.#ai(),n=this.#oi.getScrollDimIndex(),i=t.getValues()[n],o=this.mathShape.getCentroid();if(e=this.#oi.getPositionFromPlanePoint(o,i),void 0!==this.referencedFrameNumber){const t=e.getValues();t[3]=this.#si(),e=new C(t)}}return e}#si(){const e=this.#oi.getCurrentIndex().getValues();return e[3]=this.referencedFrameNumber-1,this.#oi.getPositionFromIndex(new a(e)).get(3)}contains(e,t=0){return this.mathShape instanceof S&&void 0!==this.referencePoints?.[0]?Wr(e,this.mathShape,this.referencePoints[0])<=t:"function"==typeof this.mathShape?.contains&&this.mathShape.contains(e,t)}setTextExpr(e){if(void 0!==this.#oi){const t=this.#oi.getModality();void 0!==e[t]?this.textExpr=e[t]:this.textExpr=e["*"]}else s.warn("Cannot set text expr without a view controller")}getText(){return function(e,t){let n="";if(null==e)return n;if(n=e,null==t)return n;const i=I(e);for(let e=0;e<i.length;++e){const o=t[i[e]];if(null!=o&&null!==o.value&&void 0!==o.value){let t=o.value.toPrecision(4);null!==o.unit&&void 0!==o.unit&&0!==o.unit.length&&("unit.degree"!==o.unit&&(t+=" "),t+=D.t(o.unit));const r=`{${i[e]}}`;n=n.replace(r,t)}}return n}(this.textExpr,this.quantification)}updateQuantification(){void 0!==this.#oi&&void 0!==this.mathShape.quantify&&(this.quantification=this.mathShape.quantify(this.#oi,this.#ai(),I(this.textExpr)))}getFactory(){let e;if(void 0===this.mathShape)return e;if(void 0!==Os.draw)for(const t in Os.draw){const n=Os.draw[t];if(n.supports(this.mathShape)){e=new n;break}}if(void 0===e)for(const t in bs.draw){const n=bs.draw[t];if(n.supports(this.mathShape)){e=new n;break}}return void 0===e&&s.warn("No shape factory found for math shape"),e}}const el="00020012";class tl{current;measure}class nl{annotationGroups;responseEvaluations;comment}class il{#an;#li=!1;getWarning(){return this.#an}#ci(e){const t=fe(ue(e,el)),n=void 0!==t&&De(t,"0.34.0","0.35.0-beta.21"),i=Ga(e);let o;const r=Ha(e);return void 0!==r.conceptNameCode&&(o=r.conceptNameCode.value),n&&void 0===i&&o===oi.value}#ui(e){const t=ue(e,el);let n;return void 0!==t&&(n=fe(t)),void 0!==n&&De(n,"0.34.0","0.37.0-beta.17")}#di(e){const t="DCMR-1500"===Ga(e);let n;const i=Ha(e);void 0!==i.conceptNameCode&&(n=i.conceptNameCode.value);let o=!1;if(t&&n===ai.value){const e=i.contentSequence.find(this.#hi);if(void 0!==e){const t=e.contentSequence.find(this.#gi);if(void 0!==t){const e=t.contentSequence.find(this.#Si),n=t.contentSequence.find(this.#mi);void 0===e&&void 0===n||(o=!0)}}}return o}#pi(e){return"DCMR-4100"===Ga(e)}checkElements(e){return this.#an=void 0,this.#ci(e)||this.#di(e)||this.#pi(e)||(this.#an="Not a dwv supported annotation"),this.#an}#fi(e,t){if(t.valueType===Ua&&t.relationshipType===ba&&(e.referencedSopClassUID=t.value.referencedSOPSequence.referencedSOPClassUID,e.referencedSopInstanceUID=t.value.referencedSOPSequence.referencedSOPInstanceUID,void 0!==t.value.referencedFrameNumber)){let n=parseInt(t.value.referencedFrameNumber,10);this.#li&&(n+=1),e.referencedFrameNumber=n}}#vi(e,t){t.hasHeader(Ma,di($n),Pa)&&(e.trackingId=t.value,e.trackingUid=t.value)}#Ci(e,t){t.hasHeader(Ea,di($n),Aa)&&(e.trackingId=t.value),t.hasHeader(Ma,di(Zn),Aa)&&(e.trackingUid=t.value)}#Di(e,t,n){void 0===n&&(n=!1);let i=xa;if(n&&(i=Pa),t.hasHeader(Ea,di(ri),i)){e.textExpr=t.value;const n=t.contentSequence.find(function(e){return e.hasHeader(Qa,di(ii),Pa)});void 0!==n&&(e.labelPosition=new S(n.value.graphicData[0],n.value.graphicData[1]))}if(t.hasHeader(Ea,Si(),i)&&(e.colour=t.value),t.hasHeader(Qa,di(ii),i)&&t.value.graphicType===ua){const n=[];for(let e=0;e<t.value.graphicData.length;e+=2)n.push(new S(t.value.graphicData[e],t.value.graphicData[e+1]));e.referencePoints=n}if(t.hasHeader(Va,di(li),La)&&t.value.graphicType===ua){const n=t.value.graphicData,i=[],o=Math.floor(n.length/3);for(let e=0;e<o;++e){const t=3*e;i.push(new m(n[t],n[t+1],n[t+2]))}e.planePoints=i}this.#yi(e,t),this.#Ii(e,t)}#yi(e,t,n){let i;if(void 0===n&&(i=La),t.valueType===Ra&&t.relationshipType===i){const n=function(e){let t;for(const n in mi){const i=mi[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 pi){const i=pi[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}}}}#Ii(e,t){t.valueType!==Fa&&t.valueType!==Ea||t.relationshipType!==La||e.addMetaItem(t.conceptNameCode,t.value)}#hi(e){return e.hasHeader(Na,di(si),La)}#gi(e){return e.hasHeader(Na,di(oi),La)}#Ti(e){return e.hasHeader(Fa,di(kn),Oa)}#wi(e){return e.hasHeader(Na,di(Xn),Pa)}#Li(e){return e.hasHeader(Ea,di(ei),La)}#Pi(e){return e.hasHeader(Fa,di(Kn),La)}#Ai(e){return e.hasHeader(Ra,di(jn),La)}#Oi(e){return e.hasHeader(Fa,di(Nn),La)}#Si(e){return e.hasHeader(Qa,di(Bn),La)}#bi(e){return void 0!==e.contentSequence.find(this.#Si)}#xi(e){let t;const n=e.contentSequence.find(this.#Si);if(void 0!==n){t=new Js,t.mathShape=fa(n.value);const i=n.contentSequence.find(function(e){return e.valueType===Ua&&e.relationshipType===ba});void 0!==i&&this.#fi(t,i);for(const n of e.contentSequence)this.#Ci(t,n),this.#Di(t,n)}return t}#mi(e){let t;return e.valueType===Ra&&e.relationshipType===La&&(t=e.contentSequence.find(function(e){return e.valueType===Qa&&e.relationshipType===Oa})),void 0!==t}#Ei(e){let t;return e.valueType===Ra&&e.relationshipType===Pa&&(t=e.contentSequence.find(function(e){return e.valueType===Qa&&e.relationshipType===Oa})),void 0!==t}#Ri(e){return void 0!==e.contentSequence.find(this.#mi)}#Fi(e){let t;const n=e.contentSequence.find(this.#mi);if(void 0!==n){t=new Js;const e=n.contentSequence.find(function(e){return e.valueType===Qa&&e.relationshipType===Oa});t.mathShape=fa(e.value),t.mathShape instanceof S&&e.value.graphicData.length>=4&&(t.referencePoints=[new S(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===Ua&&e.relationshipType===ba});void 0!==i&&this.#fi(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#Ci(t,i),this.#yi(t,n),this.#Ii(t,i);return t}#Mi(e){let t;const n=e.contentSequence.find(this.#Ei);if(void 0!==n){t=new Js;const e=n.contentSequence.find(function(e){return e.valueType===Qa&&e.relationshipType===Oa});t.mathShape=fa(e.value),t.mathShape instanceof S&&e.value.graphicData.length>=4&&(t.referencePoints=[new S(e.value.graphicData[2],e.value.graphicData[3])]);const i=e.contentSequence.find(function(e){return e.valueType===Ua&&e.relationshipType===ba});void 0!==i&&this.#fi(t,i)}if(void 0!==t)for(const i of e.contentSequence)this.#Ci(t,i),this.#yi(t,n,Pa),this.#Ii(t,i);return t}#qi(e){if(0===e.contentSequence.length)return;const t=e.contentSequence[0];let n=!1,i=!1;this.#gi(t)&&(n=this.#bi(t),i=this.#Ri(t));const o=[];let r,a=!1;for(const t of e.contentSequence)if(this.#gi(t)){let e;a=!0,n?e=this.#xi(t):i&&(e=this.#Fi(t)),void 0!==e&&o.push(e)}return a?0!==o.length?r=new Yt(o):s.warn("No valid measurement groups in TID 1500 SR"):s.warn("No measurement groups in TID 1500 SR"),r}#Ui(e){const t=[];let n=!1;for(const i of e.contentSequence)if(this.#Ti(i)){n=!0;const e=this.#Mi(i);void 0!==e&&t.push(e)}const i=[];return n?0!==t.length?i.push(new Yt(t)):s.warn("No valid measurement groups in TID 4100 SR"):s.warn("No image findings in TID 4100 SR"),i}#Qi(e){const t=new Js;t.mathShape=fa(e.value);for(const n of e.contentSequence)this.#fi(t,n),this.#vi(t,n),this.#Di(t,n,!0);return t}#Vi(e){let t;e.valueType===Na&&Un(e.conceptNameCode,di(ai))||s.warn("Not the expected TID 1500 SR content header");const n=e.contentSequence.find(this.#hi);return void 0!==n?t=this.#qi(n):s.warn("No imaging measurements in TID 1500 SR"),t}#Ni(e){return e.valueType===Na&&Un(e.conceptNameCode,di(Hn))||s.warn("Not the expected TID 4100 SR content header"),e.contentSequence.find(this.#Oi)}#Bi(e){e.valueType===Na&&Un(e.conceptNameCode,di(oi))||console.warn("Not the expected dwv034 content header");const t=[];for(const n of e.contentSequence)n.valueType===Qa&&t.push(this.#Qi(n));return new Yt(t)}#ki(e,t){const n=function(e){return ue(t,e)};e.setMetaValue("StudyInstanceUID",n("0020000D")),e.setMetaValue("StudyID",n("00200010")),e.setMetaValue("SeriesInstanceUID",n("0020000E")),e.setMetaValue("SeriesNumber",n("00200011")),e.setMetaValue("Modality",n("00080060")),e.setMetaValue("PatientName",n("00100010")),e.setMetaValue("PatientID",n("00100020")),e.setMetaValue("PatientBirthDate",n("00100030")),e.setMetaValue("PatientSex",n("00100040"));const i="0040A375",o=t[i];if(void 0!==o){const t=Gi({[i]:o});e.setMetaValue("CurrentRequestedProcedureEvidenceSequence",t.CurrentRequestedProcedureEvidenceSequence)}}create(e){this.#li=this.#ui(e);const t=Ha(e);let n,i;if(this.#di(e)?(i="TID 1500 SR",n=this.#Vi(t)):this.#ci(e)&&(s.warn("DWV v0.34 annotation"),i="DWV v0.34 SR",n=this.#Bi(t)),this.#pi(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.#ki(n,e),n}createCADReport(e){this.#li=this.#ui(e);const t=Ha(e),n=this.#Ni(t);if(void 0===n)return void s.warn("No CAD processing and Findings Summary in TID 4100 SR");let i=[];if(this.#pi(e)&&(i=this.#Ui(n)),void 0===i)throw new Error("Cannot create annotation groups from TID 4100 SR");for(const t of i)this.#ki(t,e);const o=[];let r;for(const e of n.contentSequence)if(this.#wi(e)){const t=this.#Gi(e);void 0!==t&&o.push(t)}else this.#Li(e)&&(r=e.value);const a=new nl;return a.annotationGroups=i,a.responseEvaluations=o,a.comment=r,a}#zi(e){const t=new za(Ua);t.relationshipType=ba,t.conceptNameCode=di(ni);const n=new Ur;n.referencedSOPClassUID=e.referencedSopClassUID,n.referencedSOPInstanceUID=e.referencedSopInstanceUID;const i=new Gr;return i.referencedSOPSequence=n,void 0!==e.referencedFrameNumber&&(i.referencedFrameNumber=e.referencedFrameNumber.toString()),t.value=i,t}#Hi(e){const t=[],n=new za(Ea);n.relationshipType=Aa,n.conceptNameCode=di($n),n.value=e.trackingId,t.push(n);const i=new za(Ma);if(i.relationshipType=Aa,i.conceptNameCode=di(Zn),i.value=e.trackingUid,t.push(i),void 0!==e.textExpr&&0!==e.textExpr.length){const n=new za(Ea);if(n.relationshipType=xa,n.conceptNameCode=di(ri),n.value=e.textExpr,void 0!==e.labelPosition){const t=new za(Qa);t.relationshipType=Pa,t.conceptNameCode=di(ii);const i=new Sa;i.graphicType=ca;const o=[e.labelPosition.getX().toString(),e.labelPosition.getY().toString()];i.graphicData=o,t.value=i;const r=this.#zi(e);t.contentSequence=[r],n.contentSequence=[t]}t.push(n)}const o=new za(Ea);if(o.relationshipType=xa,o.conceptNameCode=Si(),o.value=e.colour,t.push(o),void 0!==e.referencePoints){const n=new za(Qa);n.relationshipType=xa,n.conceptNameCode=di(ii);const i=new Sa;i.graphicType=ua;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.#zi(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.planePoints){const n=new za(Va);n.relationshipType=La,n.conceptNameCode=di(li);const i=new Ia;i.graphicType=ua;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.#zi(e);n.contentSequence=[r],t.push(n)}if(void 0!==e.quantification)for(const n in e.quantification){const i=Ya(n,h(e.quantification[n].value,12),e.quantification[n].unit);void 0!==i&&t.push(i)}const r=e.getMetaConceptIds();for(const n of r){const i=e.getMetaItem(n);let o=Ea;i.value instanceof qn&&(o=Fa);const r=new za(o);r.relationshipType=La,r.conceptNameCode=i.concept,r.value=i.value,t.push(r)}return t}#Xi(e){const t=new za(Na);t.relationshipType=La,t.conceptNameCode=di(oi),t.value=Ba;const n=new za(Qa);n.relationshipType=La,n.conceptNameCode=di(Bn),n.value=pa(e.mathShape);const i=this.#zi(e);return n.contentSequence=[i],t.contentSequence=[n].concat(this.#Hi(e)),t}#Yi(e){let t;if(0!==e.getList().length){const n=new za(Na);n.conceptNameCode=di(si),n.relationshipType=La,n.value=Ba;const i=[];for(const t of e.getList())i.push(this.#Xi(t));n.contentSequence=i,t=new za(Na),t.conceptNameCode=di(ai),t.value=Ba,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=Ni(Qi(i)),n.ContentTime=Bi(Vi(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.#Yi(e);if(void 0===s)throw new Error("No annotation group SR content");return n={...n,...Xa(s)},void 0!==t&&zi(n,t),Hi(n)}#Wi(e){const t=new za(Fa);t.relationshipType=Oa,t.conceptNameCode=di(kn),t.value=di(Gn),t.contentSequence=[];const n=new za(Ea);n.relationshipType=Aa,n.conceptNameCode=di($n),n.value=e.trackingId,t.contentSequence.push(n);const i=new za(Ma);if(i.relationshipType=Aa,i.conceptNameCode=di(Zn),i.value=e.trackingUid,t.contentSequence.push(i),void 0!==e.quantification)for(const n in e.quantification){const i=Ya(n,h(e.quantification[n].value,12),e.quantification[n].unit,Pa);if(void 0!==i){const n=new za(Qa);n.relationshipType=Oa,n.conceptNameCode=di(Jn),n.value=pa(e.mathShape);const o=this.#zi(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=Ea;i.value instanceof qn&&(o=Fa);const r=new za(o);r.relationshipType=La,r.conceptNameCode=i.concept,r.value=i.value,t.contentSequence.push(r)}return t}#$i(e,t){if(0!==e.getList().length)for(const n of e.getList())t.push(this.#Wi(n))}#ji(e){const t=new za(Na);t.relationshipType=Pa,t.conceptNameCode=di(Xn),t.value=Ba,t.contentSequence=[];const n=new za(Fa);if(n.relationshipType=Aa,n.conceptNameCode=di(Yn),n.value=di(Wn),t.contentSequence.push(n),void 0!==e){if(void 0!==e.current){const n=new za(Fa);n.relationshipType=La,n.conceptNameCode=di(Kn),n.value=e.current,t.contentSequence.push(n)}if(void 0!==e.measure){const n=new za(Ra);n.relationshipType=La,n.conceptNameCode=di(jn);const i=new Or;i.numericValue=e.measure,i.measurementUnitsCode=fi("unit.mm");const o=new Rr;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.#Pi(i)?t=i.value:this.#Ai(i)&&(n=i.value.measuredValue.numericValue);return void 0!==t&&(i=new tl,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=Ni(Qi(i)),n.ContentTime=Bi(Vi(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 za(Fa);s.relationshipType=La,s.conceptNameCode=di(Nn),s.value=di(zn),s.contentSequence=[];for(const t of e.responseEvaluations){const e=this.#ji(t);s.contentSequence.push(e)}for(const t of e.annotationGroups)this.#$i(t,s.contentSequence);if(void 0!==e.comment){const t=new za(Ea);t.relationshipType=La,t.conceptNameCode=di(ei),t.value=e.comment,s.contentSequence.push(t)}const l=new za(Na);if(l.conceptNameCode=di(Hn),l.value=Ba,l.contentSequence.push(s),void 0===l)throw new Error("No annotation group SR content");return n={...n,...Xa(l)},void 0!==t&&zi(n,t),Hi(n)}}const ol="30060084";class rl{type;points3D}class al{number;name;colour;generationAlgorithm;interpretedType;roiInterpreter;contours}function sl(e){const t={},n={},i=de(e,"30060020");if(void 0!==i)for(const e of i){const i=ue(e,"30060022"),o=ue(e,"30060026"),r=ue(e,"30060036");void 0!==i&&(t[i]=o??`ROI ${i}`,n[i]=r)}const o={},r=de(e,"30060080");if(void 0!==r)for(const e of r){const t=ue(e,ol);void 0!==t&&(o[t]={interpretedType:ue(e,"300600A4"),roiInterpreter:ue(e,"300600A6")})}const a=[],l=de(e,"30060039");if(void 0===l)return a;for(const e of l){const i=ue(e,ol),r=de(e,"3006002A"),l=de(e,"0062000D");let c;void 0!==r&&3===r.length?c={r:parseInt(r[0],10),g:parseInt(r[1],10),b:parseInt(r[2],10)}:void 0!==l&&3===l.length?c=tn(_t({l:l[0],a:l[1],b:l[2]})):(s.warn("No recommended colour for contour, using default"),c=rn(i));const u=[],d=de(e,"30060040");if(void 0!==d)for(const e of d){const t=ue(e,"30060042"),n=de(e,"30060050");if(void 0===n)continue;const i=new rl;i.type=t??"CLOSED_PLANAR",i.points3D=n.map(e=>parseFloat(e)),u.push(i)}const h=new al;h.number=void 0!==i?parseInt(i,10):0,h.name=t[h.number]??`ROI ${h.number}`,h.generationAlgorithm=n[h.number],h.interpretedType=o[h.number]?.interpretedType,h.roiInterpreter=o[h.number]?.roiInterpreter,h.colour=c,h.contours=u,a.push(h)}return a}const ll={PatientName:"00100010",PatientID:"00100020",PatientBirthDate:"00100030",PatientSex:"00100040",StudyDate:"00080020",StudyInstanceUID:"0020000D",StudyID:"00200010",SeriesInstanceUID:"0020000E",SeriesNumber:"00200011",FrameOfReferenceUID:"00200052"},cl=[{name:"TransferSyntaxUID",enum:[ne]},{name:"MediaStorageSOPClassUID",enum:["1.2.840.10008.5.1.4.1.1.481.3"]},{name:"SOPClassUID",enum:["1.2.840.10008.5.1.4.1.1.481.3"]},{name:"Modality",enum:["RTSTRUCT"]},{name:"StructureSetLabel",enum:["RT Structure Set"]}];function ul(){const e={};for(const t of cl)e[t.name]=t.enum[0];return e}const dl=[[-1,0],[-1,-1],[0,-1],[1,-1],[1,0],[1,1],[0,1],[-1,1]],hl={};for(let e=0;e<8;e++)hl[`${dl[e][0]},${dl[e][1]}`]=e;function gl(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 Sl(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=hl[`${l-u},${c-d}`];let g=-1,S=-1,m=l,p=c;for(let r=1;r<=8;r++){const a=(h+r)%8,s=u+dl[a][0],l=d+dl[a][1];if(s>=0&&s<n&&l>=0&&l<i&&e[t+l*n+s]===o){g=s,S=l;const e=(h+r-1)%8;m=u+dl[e][0],p=d+dl[e][1];break}}if(-1===g)break;if(l=m,c=p,u=g,d=S,u===r&&d===a)break;s.push({x:u,y:d})}return s}function ml(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;gl(e,t,n,i,o,l,a);const u=Sl(e,t,n,i,o,r,c);u.length>=3&&s.push(u)}return s}function pl(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 fl(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=pl(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 vl(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 Cl(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?ml(s,0,n,i,1):[]}class Dl{#an;getWarning(){return this.#an}checkElements(e){return this.#an=void 0,this.#an}create(e,t){const n=sl(e),i=t.getGeometry(),o=i.getSize(),r=o.get(0),l=o.get(1),c=o.get(2),u=r*l,d=new Jo(i),h=[],g=[0],S=[0],m=[0];for(let e=0;e<n.length;++e){const t=n[e],o=e+1,a=new _i(o,t.name,t.generationAlgorithm??"MANUAL");a.interpretedType=t.interpretedType,a.roiInterpreter=t.roiInterpreter,a.displayRGBValue=new Wt(t.colour.r,t.colour.g,t.colour.b),h.push(a),g[o]=t.colour.r,S[o]=t.colour.g,m[o]=t.colour.b;const s=new Map;for(const e of t.contours){if("CLOSED_PLANAR"!==e.type&&"CLOSEDPLANAR_XOR"!==e.type)continue;const t=e.points3D;if(t.length<9)continue;const n=[];for(let e=0;e<t.length;e+=3){const o=i.worldToPoint(new C([t[e],t[e+1],t[e+2]]));n.push({x:o.getX(),y:o.getY(),z:o.getZ()})}const o=Math.round(n[0].z);o<0||o>=c||(s.has(o)||s.set(o,[]),s.get(o).push(n))}for(const[e,t]of s){const n=new Uint8Array(u);vl(n,0,r,l,t,1),d.addFrame(o,n,0,e,u,o)}}const p=[];for(let e=0;e<c;++e)p.push(t.getImageUid(new a([0,0,e])));const f=new tr(i,d.getLabelMap(),p,d);f.setPhotometricInterpretation("PALETTE COLOR"),f.setPaletteColourMap(new rr(g,S,m));const v=t=>ue(e,t),D={Modality:"RTSTRUCT"};for(const e of Object.keys(ll)){const t=v(ll[e]);void 0!==t&&(D[e]=t)}void 0===D.FrameOfReferenceUID&&(D.FrameOfReferenceUID=function(e){const t=de(e,"30060010");if(void 0!==t)return ue(t[0],ll.FrameOfReferenceUID)}(e)),void 0===D.FrameOfReferenceUID&&s.warn("Loaded RT STRUCT has no FrameOfReferenceUID."),D.custom={segments:h,referencedSeriesUID:dt(e)};const y=t.getMeta();return void 0!==y.lengthUnit&&(D.lengthUnit=y.lengthUnit),f.setMeta(D),f}toDicom(e,t,n,i){const o=ul(),r=e.getMeta();for(const e of Object.keys(ll)){const t=r[e];void 0!==t&&(o[e]=t)}if(void 0===t&&(t=r.custom?.segments??[]),void 0!==n){const e=n.getMeta();o.StudyInstanceUID=e.StudyInstanceUID,o.ReferencedFrameOfReferenceSequence={value:[{FrameOfReferenceUID:o.FrameOfReferenceUID??"",RTReferencedStudySequence:{value:[{ReferencedSOPInstanceUID:e.StudyInstanceUID??"",RTReferencedSeriesSequence:{value:[{SeriesInstanceUID:e.SeriesInstanceUID??""}]}}]}}]}}const l=new Date;o.StructureSetDate=Ni(Qi(l)),o.StructureSetTime=Bi(Vi(l));const c=e.getGeometry(),u=c.getSize(),d=u.get(0),h=u.get(1),g=u.get(2),S=d*h,m=e.getBuffer(),p=e.getHasOverlap(),f=p?e.getSegmentCollection()?.getAll():void 0,v=[],C=[],D=[];for(const e of t){const t=e.number,n=e.displayRGBValue??{r:255,g:0,b:0};v.push({ROINumber:t,ROIName:e.label,ReferencedFrameOfReferenceUID:o.FrameOfReferenceUID??"",ROIGenerationAlgorithm:e.algorithmType??"MANUAL"}),D.push({ObservationNumber:t,ReferencedROINumber:t,RTROIInterpretedType:e.interpretedType??"ORGAN",ROIInterpreter:e.roiInterpreter??""});const i=[],r=f?.get(t);for(let e=0;e<g;e++){const n=p&&r?.has(e),o=n?r.get(e):m,l=n?0:e*S,u=ml(o,l,d,h,t),g=u.length>0?Cl(o,l,d,h,t):[],f=u.concat(g),v=g.length>0?"CLOSEDPLANAR_XOR":"CLOSED_PLANAR";for(const t of f){const n=fl(t,1);if(n.length<3){s.warn("Saving RT Struct with thin contour, not well supported");continue}const o=[];for(const t of n){const n=c.indexToWorld(new a([t.x,t.y,e]));o.push(n.get(0),n.get(1),n.get(2))}i.push({ContourGeometricType:v,NumberOfContourPoints:n.length,ContourData:o})}}C.push({ReferencedROINumber:t,ROIDisplayColor:[n.r,n.g,n.b],ContourSequence:{value:i}})}return o.StructureSetROISequence={value:v},o.ROIContourSequence={value:C},o.RTROIObservationsSequence={value:D},void 0!==i&&zi(o,i),Hi(o)}}const yl=["dataadd","dataremove","dataimageset","dataupdate"];function Il(e,t,n){let i;return i=void 0!==t["00020010"]?"00200013":"imageUid",function(e,t,n,i,o=()=>{}){const r={};if(!n)throw new Error(`Cannot merge object with an undefined id key: ${n}`);if(void 0===e[n])throw new Error(`Id key not found in first object while merging: ${n}, obj: ${e}`);if(void 0===t[n])throw new Error(`Id key not found in second object while merging: ${n}, obj: ${t}`);if(!i)throw new Error(`Cannot merge object with an undefined value key: ${i}`);if(void 0===e[n][i])throw new Error(`Id value not found in first object while merging: ${n}, valueKey: ${i}, ojb: ${e}`);if(void 0===t[n][i])throw new Error(`Id value not found in second object while merging: ${n}, valueKey: ${i}, ojb: ${t}`);const a=void 0!==e.mergeId,s=function(e){const t=o(e);return void 0!==t?`-${t}`:""},l=t[n][i][0]+s(t);let c;if(a){if(e.mergeId.includes(l))throw new Error(`The first object already contains id2: ${l}, id1: ${e.mergeId}`);c=e.mergeId,r.mergeId=[...e.mergeId,l]}else{if(c=e[n][i][0]+s(e),c===l)throw new Error(`Cannot merge object with same ids: ${c}, id2: ${l}`);r.mergeId=[c,l]}const u=Object.keys(e).filter(e=>"mergeId"!==e),d=[...new Set([...u,...Object.keys(t)])];for(const n of d){const o=e[n];let s;void 0!==o&&(s=o[i]);const u=t[n];let d,h;if(void 0!==u&&(d=u[i]),void 0!==o?h={...o}:void 0!==u&&(h={...u}),!O(s,d))if(a){if(Array.isArray(s)){h[i]={};for(let e=0;e<c.length;++e)h[i][c[e]]=s}else h[i]={...s};h[i][l]=d}else h[i]={[c]:s,[l]:d};r[n]=h}return r}(e,t,i,"value",n)}class Tl{meta;image;annotationGroup;buffer;numberOfItems;frameNumber;warn=[];#Zi=!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.#Zi}appendData(e){if(!this.#Zi){let t=!0;if(void 0!==e.frameNumber&&void 0!==this.image){const n=ue(e.meta,"00080018");t=!this.image.includesImageUid(n)}void 0!==this.image&&void 0!==e.image&&this.#Ki(e.image),t&&this.#_i(e.meta)}}#Ki(e){const t=e.getGeometry();this.image.getGeometry().canAppendOrigin(t.getOrigin(),t.getInitialTime()?.id.value).success||(this.#Zi=!0),this.#Zi||this.image.appendSlice(e)}#_i(e){this.meta=Il(this.meta,e,Ro)}}class wl{#Qe=[];addClone(e){const t=["7FE00010","7FE00009","7FE00008"],n={};for(const i of Object.keys(e.meta))t.includes(i)||(n[i]=e.meta[i]);const i=new Tl(structuredClone(n));i.image=e.image.clone(),i.frameNumber=e.frameNumber,this.add(i)}add(e){this.#Qe.push(e)}getElementsList(){return this.#Qe.map(e=>void 0!==e.frameNumber?Fi(e.meta,e.frameNumber):e.meta)}buildData(){const e=this.#Ji(),t=this.#eo(e);if(void 0===t)throw new Error("Non constant number of slices per volumes");if(0===t)throw new Error("Duplicate origins but no volumes");if(1===t)throw new Error("Duplicate origins but just one slice per volume");const{volsIndices:n,volumeIds:i,volumeIndexGetter:o}=this.#to(e);if(void 0===n)throw new Error("Cannot create image for multi-volume");let r,a;for(let e=0;e<n.length;++e){const t=n[e],s=this.#Qe[t[0]],l=void 0!==s.frameNumber?Fi(s.meta,s.frameNumber):s.meta;a=void 0===a?l:Il(a,l,o);for(const n of t){const t=this.#Qe[n].image;t.getGeometry().setInitialTime(i[e]),void 0===r?r=t:r.appendSlice(t)}}return{image:r,meta:a}}#to(e){const t=[];for(let n=0;n<e.length;++n)for(const i of e[n].indices)t[i]=n;const n=Vo(this.getElementsList(),t,e.length);if(void 0===n)return{volsIndices:void 0,volumeIds:void 0,volumeIndexGetter:void 0};const i=[],o=[];for(const t of e)for(const e of t.indices){const t=n.volumeIndices[e];void 0===i[t]&&(i[t]=[],o[t]=n.volumeIds[e]),i[t].push(e)}return{volsIndices:i,volumeIds:o,volumeIndexGetter:n.getter}}#eo(e){if(0===e.length)return 0;const t=e[0].count;for(const n of e)if(n.count!==t)return;return t}#Ji(){const e=new Map;for(let t=0;t<this.#Qe.length;++t){const n=this.#Qe[t].image.getGeometry().getOrigin(),i=n.toString();let o=e.get(i);void 0===o&&(o={pos:n,indices:[],count:0},e.set(i,o)),++o.count,o.indices.push(t)}return[...e.values()]}}class Ll extends EventTarget{#no={};#io={};#oo={};#ro=-1;getNextDataId(){return++this.#ro,this.#ro.toString()}getDataIds(){return Object.keys(this.#no)}reset(){this.#no={},this.#io={},this.#oo={}}get(e){return this.#no[e]}getDataIdsFromSopUids(e){const t=[];if(void 0===e||0===e.length)return t;const n=Object.keys(this.#no);for(const i of n)void 0!==this.#no[i].image&&this.#no[i].image.containsImageUids(e)&&t.push(i);return t}getDataIdFromSeriesUid(e){let t;const n=Object.keys(this.#no);for(const i of n){const n=this.#no[i].image;if(void 0!==n&&e===n.getMeta().SeriesInstanceUID){t=i;break}}return t}setImage(e,t){this.#no[e].image=t;for(const n of zt)t.addEventListener(n,this.#ao(e));this.dispatchEvent(new CustomEvent("dataimageset",{detail:{value:[t],dataid:e}}))}#so(e){const t=ue(e.meta,"00080060");let n;if(X(e.meta))if("SEG"===t){const t=ut(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 dr,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,this.#no[i].image))}else n=new yr,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,e.buffer,e.numberOfItems,e.frameNumber));else if("SR"===t)n=new il,void 0===n.checkElements(e.meta)&&(e.annotationGroup=n.create(e.meta));else if("RTSTRUCT"===t){const t=dt(e.meta),i=this.getDataIdFromSeriesUid(t);if(void 0===i)throw new Error("Cannot create RT struct: referenced series is not loaded");n=new Dl,void 0===n.checkElements(e.meta)&&(e.image=n.create(e.meta,this.#no[i].image))}void 0!==n&&void 0!==n.getWarning()&&e.warn.push(n.getWarning())}add(e,t){if(void 0===e||void 0!==this.#no[e])return!1;if(this.#no[e]=t,void 0===t.image&&void 0===t.annotationGroup&&(this.#so(t),void 0!==t.numberOfItems&&t.numberOfItems>1&&(this.#io[e]=new wl,this.#io[e].addClone(t))),void 0!==t.image)for(const n of zt)t.image.addEventListener(n,this.#ao(e));if(void 0!==t.annotationGroup)for(const n of Xt)t.annotationGroup.addEventListener(n,this.#ao(e));return this.dispatchEvent(new CustomEvent("dataadd",{detail:{dataid:e}})),!0}remove(e){if(void 0!==this.#no[e]){const t=this.#no[e].image;if(void 0!==t)for(const n of zt)t.removeEventListener(n,this.#ao(e));const n=this.#no[e].annotationGroup;if(void 0!==n)for(const t of Xt)n.removeEventListener(t,this.#ao(e));delete this.#no[e],delete this.#io[e],this.dispatchEvent(new CustomEvent("dataremove",{detail:{dataid:e}}))}}stash(e){void 0!==this.#no[e]&&(this.#oo[e]=this.#no[e],this.remove(e))}unstash(e){void 0!==this.#oo[e]&&(this.add(e,this.#oo[e]),delete this.#oo[e])}getStashedDataIds(){return Object.keys(this.#oo)}getStashed(e){return this.#oo[e]}update(e,t){if(void 0===this.#no[e])throw new Error(`Cannot find data to update: ${e}`);const n=this.#no[e];this.#so(t),void 0!==this.#io[e]&&this.#io[e].add(t),n.hasDuplicateOrigin()||n.appendData(t),this.dispatchEvent(new CustomEvent("dataupdate",{detail:{dataid:e}}))}markDataAsComplete(e){const t=this.#no[e];if(void 0===t)throw new Error(`Cannot find data to mark as complete: ${e}`);const n={imageHasChanged:!1};if(void 0!==this.#io[e]&&t.hasDuplicateOrigin()){const i=this.#io[e].buildData();this.setImage(e,i.image),t.meta=i.meta,n.imageHasChanged=!0}else if(void 0!==t.image){const e=t.image.getGeometry().checkTimeOrigins();if(!e.success)throw new Error(`Inconsistent volumes: ${e.message}`)}return this.#lo(e),delete this.#io[e],t.setComplete(!0),n}#lo(e){const t=this.#no[e],n=t.image?.getGeometry(),i=n?.getVolumeIds();if(void 0===i||i.length<2)return;const o=function(e,t){const n=function(e){const t=[...qo()];for(const e of[ke.getVolumeIdTagValue,ke.getPostLoadVolumeIdTagValue])void 0!==e&&t.unshift(xo(e));return t.find(t=>t.name===e)}(e[0].id.source);if(void 0===n)return;if(!0===n.relative){const t=e[0].id.value;return e.map(e=>({...e.id,value:e.id.value-t}))}if(void 0!==e[0].id.unit)return;const i=e.map(e=>e.id.value);return function(e,t){for(const n of fo){const i=Qo(n,e,t);if(void 0!==i)return s.debug(`Using '${n.name}' as volume value`),i}}(t,t.map(e=>i.indexOf(bo(n,e)?.id.value)))}(i,this.#io[e]?.getElementsList()??function(e){const t=de(e,Ai);return void 0===t?[e]:t.map((t,n)=>Fi(e,n))}(t.meta));void 0!==o&&n.setVolumeValues(o)}#ao(e){return t=>{const n=Object.assign({},t.detail,{dataid:e});this.dispatchEvent(new CustomEvent(t.type,{detail:n}))}}}class Pl{#co;setOptions(e){this.#co=e}#uo;#do=[];#ho=[];#go=[];#So=!1;#mo(e,t,n,i){const o=this.#do[e].getDicomElements(),r=new Tl(o);r.buffer=n,r.numberOfItems=this.#co.numberOfItems,r.frameNumber=i,this.onloaditem({data:r,source:t})}#po(e,t){const n=this.#do[e].getDicomElements();return t>1&&"SEG"!==ue(n,"00080060")}#fo(e,t){this.#So||(this.onprogress({lengthComputable:!0,loaded:100,total:100,index:e,source:t}),this.onload({source:t}),this.onloadend({source:t}))}#vo(e){this.#uo=new xn(e),this.#uo.ondecodeditem=e=>{this.#Co(e)},this.#uo.onerror=this.onerror,this.#uo.onabort=this.onabort}#Do(e){const t=this.#do[e].getDicomElements(),n={missing:[]},i=ue(t,"00280100");void 0!==i?n.bitsAllocated=i:n.missing.push("bitsAllocated");const o=ue(t,"00280103");if(void 0!==o)n.isSigned=1===o;else{const e=ue(t,"7FE00008"),i=ue(t,"7FE00009");void 0!==e||void 0!==i?n.isSigned=!0:n.missing.push("pixelRepresentation")}const r=ue(t,"00280011"),a=ue(t,"00280010");void 0!==r&&void 0!==a?n.sliceSize=r*a:(void 0===r&&n.missing.push("columns"),void 0===a&&n.missing.push("rows"));const s=ue(t,"00280002");if(void 0!==s){if(n.samplesPerPixel=s,1!==s){const e=ue(t,"00280006");void 0!==e?n.planarConfiguration=e:n.missing.push("planarConfiguration")}}else n.missing.push("samplesPerPixel");return n}#yo(e,t,n){const i=this.#Do(e);if(0!==i.missing.length)return this.#uo.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.#uo.decode(n[r],i,{itemNumber:r,numberOfItems:o,index:e,indexOrigin:t})}#Co(e){if(this.#So)return;const t=e.index,n=e.indexOrigin;++this.#ho[t];const i=this.#ho[t];this.onprogress({lengthComputable:!0,loaded:i,total:e.numberOfItems,index:e.index,source:n});const o=e.data[0];if(this.#po(t,e.numberOfItems))this.#mo(t,n,o,e.itemNumber);else if(1===e.numberOfItems)this.#mo(t,n,o);else{if(void 0===this.#go[t]){const i=e.numberOfItems*o.length;try{this.#go[t]=new o.constructor(i)}catch(e){if(e instanceof RangeError){const e=Math.floor(Math.log(i)/Math.log(2));s.error(`Cannot allocate ${o.constructor.name} of size: ${i} (>2^${e}) for decompressed data.`)}return this.#uo.abort(),this.onerror({error:e,source:n}),void this.onloadend({source:n})}}this.#go[t].set(o,o.length*e.itemNumber),i===e.numberOfItems&&(this.#mo(t,n,this.#go[t]),this.#go[t]=void 0)}i===e.numberOfItems&&(this.onload(e),this.onloadend(e))}convert(e,t,n){this.#So=!1,this.onloadstart({source:t,index:n});const i=new Ne;void 0!==this.#co.defaultCharacterSet&&i.setDefaultCharacterSet(this.#co.defaultCharacterSet);try{i.parse(e)}catch(e){return this.onerror({error:e,source:t}),void this.onloadend({source:t})}this.#do[n]=i;const o=i.getDicomElements(),r=H(o);if(void 0!==r){const e=r.value,i=function(e){let t;return be(e)?t="jpeg2000":Ae(e)?t="jpeg-baseline":Oe(e)?t="jpeg-lossless":xe(e)&&(t="rle"),t}(ue(o,"00020010"));if(void 0!==i)void 0===this.#uo&&this.#vo(i),this.#ho[n]=0,this.#go[n]=void 0,this.#yo(n,t,e);else{const i=e[0];let r=parseInt(ue(o,"00280008"),10);if(isNaN(r)&&(r=1),this.#po(n,r)){const e=i.length/r;for(let o=0;o<r&&!this.#So;++o)this.#mo(n,t,i.subarray(o*e,(o+1)*e),o)}else this.#mo(n,t,i);this.#fo(n,t)}}else this.#mo(n,t),this.#fo(n,t)}abort(){this.#So=!0,void 0!==this.#uo?this.#uo.abort():this.onabort({})}onloadstart(e){}onloaditem(e){}onprogress(e){}onload(e){}onloadend(e){}onerror(e){}onabort(e){}}class Al extends Tn{#co={};#Io=!1;getOptions(){return this.#co}setOptions(e){this.#co=e}isLoading(){return this.#Io}setLoading(e){this.#Io=e}canLoadFile(e){if(void 0!==e.type&&this.canLoadMediaType(e.type))return!0;const t=T(e.name);return this.canLoadExtension(t)}canLoadUrl(e,t){if(void 0!==t){if(void 0!==t.forceLoader&&this.isLoaderName(t.forceLoader))return!0;if(void 0!==t.requestHeaders){const e=t.requestHeaders.find(e=>"Accept"===e.name);if(void 0!==e)return e.value.split(",").map(e=>e.split(";")[0].trim()).some(e=>this.canLoadMediaType(e))}}const n=function(e){let t;return"undefined"!=typeof location&&"null"!==location.origin&&(t=location.origin),new URL(e,t)}(e),i=T(n.pathname),o=this.canLoadExtension(i),r=n.searchParams.get("contentType"),a=null!=r,s=a?r.split(";")[0].trim():void 0,l=a&&this.canLoadMediaType(s);return a?l:o}canLoadMemory(e){const t=e["Content-Type"];if(void 0!==t){const e=t.split(";")[0].trim();if(this.canLoadMediaType(e))return!0}if(void 0!==e.filename){const t=new File(["from memory"],e.filename);return this.canLoadFile(t)}return!1}isLoaderName(e){return!1}canLoadExtension(e){return!1}canLoadMediaType(e){return!1}}class Ol extends Al{#To=new Pl;load(e,t,n){this.isLoading()||(this.#To.setOptions(this.getOptions()),this.#To.onloadstart=this.onloadstart,this.#To.onprogress=this.onprogress,this.#To.onloaditem=this.onloaditem,this.#To.onload=this.onload,this.#To.onloadend=e=>{this.setLoading(!1),this.onloadend(e)},this.#To.onerror=e=>{e.source=t,this.onerror(e)},this.#To.onabort=this.onabort),this.setLoading(!0),this.#To.convert(e,t,n)}abort(){this.setLoading(!1),this.#To.abort()}canLoadExtension(e){return void 0===e||"dcm"===e}isLoaderName(e){return"dicom"===e}canLoadMediaType(e){return"application/dicom"===e}loadFileAs(){return Nl.ArrayBuffer}loadUrlAs(){return 1}}class bl extends Tn{#ft=null;#Ct=null;#Dt=0;#yt=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#Tt(e){this.#ft=e,this.#Dt=0,this.#yt=0,this.#Lt()}#At(e){this.#Ct=e}#Lt(){this.#Ct=null}#Ot=e=>{this.#Dt++,this.#Dt===this.#ft.length&&this.onload({source:this.#ft})};#bt=e=>{this.#yt++,this.#yt===this.#ft.length&&this.onloadend({source:this.#ft})};load(e){if(void 0===e||0===e.length)return;this.#Tt(e),this.onloadstart({source:e});const t=new In(this.onprogress);t.setNToLoad(e.length),t.setNumberOfDimensions(1);const n=Vl(),i=[];for(let e=0;e<n.length;++e)i.push(new n[e]);let o=e[0],r=null,a=!1;for(let n=0;n<i.length;++n)if(r=i[n],r.canLoadMemory(o)){a=!0,r.setOptions({numberOfItems:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=t.getUndefinedMonoProgressHandler(0),r.onloaditem=this.onloaditem,r.onload=this.#Ot,r.onloadend=this.#bt,r.onerror=this.onerror,r.onabort=this.onabort,this.#At(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.#Ct&&this.#Ct.isLoading()&&this.#Ct.abort()}}class xl extends Al{#wo=0;#Lo=0;#Po=[];load(e,t,n){0===this.#Lo&&(this.#wo=this.getOptions().numberOfItems??1,this.#Po=[],this.setLoading(!0),this.onloadstart({source:t}));const i=function(e){const t=new Uint8Array(e),n=[];if(0===t.length)return n;const i=E(new Uint8Array([13,10,13,10]));let o=x(t,i,0);if(void 0===o)throw new Error("Can't find the end of the first multipart header");const r=b(t.slice(0,o)).split("\r\n");let a;for(let e=0;e<r.length;++e)if("-"===r[e][0]&&"-"===r[e][1]){a=r[e];break}if(void 0===a)throw new Error("Can't find the boundary between multi-parts");const s=E(w(a)),l=a.length;let c=x(t,s,0);for(;void 0!==o;){const e={},r=b(t.slice(c+l,o)).split("\r\n");for(let t=0;t<r.length;++t){const n=r[t],i=n.indexOf(":");if(-1!==i){const t=n.substring(0,i).trim(),o=n.substring(i+1).trim();e[t]=o}}if(c=x(t,s,o),void 0===c)break;const a=o+4,u=c-2;e.data=a<u?t.slice(a,u).buffer:new Uint8Array,n.push(e),o=x(t,i,c+l)}return n}(e);if(this.#Po.push(...i),this.#Lo++,this.#Lo<this.#wo)return;const o=new bl;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.#wo;t++)this.onload(e)},o.onloadend=e=>{this.setLoading(!1),this.#Lo=0;const t=this.#wo;for(let n=0;n<t;n++)this.onloadend(e)},o.onerror=this.onerror,o.onabort=this.onabort,o.load(this.#Po)}abort(){this.setLoading(!1),this.#Lo=0,this.onabort({}),this.onloadend({})}isLoaderName(e){return"multipart"===e}canLoadMediaType(e){return"multipart/related"===e}loadFileAs(){return Nl.ArrayBuffer}loadUrlAs(){return 1}}function El(e){return parseInt(e,36).toString()}function Rl(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 Fl(e,t,n,i,o,r){const a=new Dt([e,t,1]),s=new tt([1,1,1]),l=new m(0,0,n),c=new Lt([l],a,s),u=new Ht(c,i,[r]);u.setPhotometricInterpretation("RGB");const d={BitsStored:8};return void 0!==o&&(d.sliceCapacity=o),u.setMeta(d),u}class Ml extends Al{#Ao(e,t){let n=t;n&&"jpg"!==n||(n="jpeg");const i=new Blob([e],{type:`image/${n}`});return 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=e.ownerDocument.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=El(t)):(l.fileName={value:[t.name]},c=El(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=Fl(i,o,u,Rl(s),1,u.toString()),h=d.getMeta();h.SeriesInstanceUID=c,d.setMeta(h);const g=new Tl(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.#Ao(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 Nl.DataURL}loadUrlAs(){return 1}}class ql extends Al{#Ao(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,${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.#Ao(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=El(r)):(u.fileName={value:[r.name]},d=El(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=e.ownerDocument.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=Rl(g.getImageData(0,0,s,l));if(0===S){m=Fl(s,l,1,n,c,a.toString());const e=m.getMeta();e.SeriesInstanceUID=d,m.setMeta(e);const i=new Tl(u);i.image=m,t({data:i,source:r})}else m.appendFrameBuffer(n,S);++S})(),p+=1/30,p<=f.target.duration?this.currentTime=p:(n({source:r}),o({source:r}),e.removeEventListener("seeked",h))},!1);let S=0,m=null,p=0;e.currentTime=p}(e.target,this.onloaditem,this.onload,this.onprogress,this.onloadend,t,n)}catch(e){this.onerror({error:e,source:t}),this.onloadend({source:t})}}}abort(){this.setLoading(!1),this.onabort({}),this.onloadend({})}canLoadExtension(e){return"mp4"===e||"ogg"===e||"webm"===e}isLoaderName(e){return"rawvideo"===e}canLoadMediaType(e){return e.startsWith("video/")}loadFileAs(){return Nl.DataURL}loadUrlAs(){return 1}}class Ul extends Al{#Oo="";#bo=[];#xo=null;#Eo(e,t,n){this.#bo.push({filename:this.#Oo,data:e});const i=100*this.#bo.length/this.#xo.length;if(this.onprogress({lengthComputable:!0,loaded:i/2,total:100,index:n,item:{loaded:i,total:100,source:t}}),this.#bo.length<this.#xo.length){const e=this.#bo.length;this.#Oo=this.#xo[e].name,this.#xo[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 bl;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.#bo)}}load(e,n,i){this.onloadstart({source:n}),this.setLoading(!0),t.loadAsync(e).then(e=>{if(this.#bo=[],this.#xo=e.file(/.*\.dcm/),0===this.#xo.length)return this.setLoading(!1),this.onerror({error:new Error("No DICOM file found in ZIP")}),void this.onloadend({});this.#Oo=this.#xo[0].name,this.#xo[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 Nl.ArrayBuffer}loadUrlAs(){return 1}}let Ql=null;function Vl(){return null===Ql&&(Ql=[Ol,xl,Ml,ql,Ul]),Ql}const Nl={Text:0,ArrayBuffer:1,DataURL:2};class Bl extends Tn{#ft=null;#Ro=[];#Ct=null;#Dt=0;#yt=0;#f;getDefaultCharacterSet(){return this.#f}setDefaultCharacterSet(e){this.#f=e}#Tt(e){this.#ft=e,this.#Dt=0,this.#yt=0,this.#Fo(),this.#Lt()}#Mo(e){this.#Ro.push(e)}#Fo(){this.#Ro=[]}#At(e){this.#Ct=e}#Lt(){this.#Ct=null}#Ot=e=>{this.#Dt++,this.#Dt===this.#ft.length&&this.onload({source:this.#ft})};#bt=e=>{this.#yt++,this.#yt===this.#ft.length&&this.onloadend({source:this.#ft})};#xt(e,t){return n=>{n.source=t,e(n)}}#Ft(e,t,n){return i=>{e.load(i.target.result,t,n)}}load(e){if(void 0===e||0===e.length)return;this.#Tt(e),this.onloadstart({source:e});const t=new In(this.onprogress);t.setNToLoad(e.length);const n=Vl(),i=[];for(let e=0;e<n.length;++e)i.push(new n[e]);let o=e[0],r=null,a=!1;for(let n=0;n<i.length;++n)if(r=i[n],r.canLoadFile(o)){a=!0,r.setOptions({numberOfItems:e.length,defaultCharacterSet:this.getDefaultCharacterSet()}),r.onprogress=t.getUndefinedMonoProgressHandler(1),r.onloaditem=this.onloaditem,r.onload=this.#Ot,r.onloadend=this.#bt,r.onerror=this.onerror,r.onabort=this.onabort,this.#At(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.#Mo(i),i.onprogress=this.#xt(t.getMonoProgressHandler(n,0),o),i.onload=this.#Ft(r,o,n);const a=this.#xt(this.onerror,o);i.onerror=e=>{this.#bt(),a(e)};const s=this.#xt(this.onabort,o);i.onabort=e=>{this.#bt(),s(e)},r.loadFileAs()===Nl.Text?i.readAsText(o):r.loadFileAs()===Nl.DataURL?i.readAsDataURL(o):r.loadFileAs()===Nl.ArrayBuffer&&i.readAsArrayBuffer(o)}}abort(){for(let e=0;e<this.#Ro.length;++e)1===this.#Ro[e].readyState&&this.#Ro[e].abort();this.#Ct&&this.#Ct.isLoading()&&this.#Ct.abort()}}const kl=["loadstart","loadprogress","loaditem","load","loadend","error","abort","timeout"];class Gl extends EventTarget{#f;#qo={};constructor(e){super(),this.#f=e}loadFiles(e,t){this.#Uo(e,t)}loadURLs(e,t,n){this.#Qo(e,t,n)}loadImageObject(e,t){const n=new bl;this.#Vo(e,n,t)}getLoadingDataIds(){return Object.keys(this.#qo)}abort(e){void 0!==this.#qo[e]&&(this.#qo[e].loader.abort(),delete this.#qo[e])}#Uo(e,t){const n=new Bl;n.setDefaultCharacterSet(this.#f),this.#Vo(e,n,t)}#Qo(e,t,n){const i=new wn;i.setDefaultCharacterSet(this.#f),this.#Vo(e,i,t,n)}#Vo(e,t,n,i){const o={dataid:n};t.onloadstart=e=>{this.#qo[n]={loader:t,isFirstItem:!0},this.#ao("loadstart",o)(e)},t.onprogress=this.#ao("loadprogress",o),t.onloaditem=e=>{const t={dataid:n};void 0!==this.#qo[n]&&(t.isfirstitem=this.#qo[n].isFirstItem),this.#ao("loaditem",t)(e),void 0!==this.#qo[n]&&this.#qo[n].isFirstItem&&(this.#qo[n].isFirstItem=!1)},t.onload=this.#ao("load",o),t.onloadend=e=>{delete this.#qo[n],this.#ao("loadend",o)(e)},t.onerror=this.#ao("error",o),t.onabort=this.#ao("abort",o),void 0!==t.ontimeout&&(t.ontimeout=this.#ao("timeout",o));try{t.load(e,i)}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{dataid:n,error:e}})),this.dispatchEvent(new CustomEvent("loadend",{detail:{dataid:n}}))}}#ao(e,t){return n=>{const i=Object.assign({},n,t);this.dispatchEvent(new CustomEvent(e,{detail:i}))}}}const zl=["undoadd","undoremove","undo","redo"];class Hl extends EventTarget{#No=new Is;constructor(){super(),this.#Bo()}addToUndoStack=e=>{this.#No.add(e)};removeFromUndoStack=e=>this.#No.remove(e);undo(){this.#No.undo()}redo(){this.#No.redo()}getStackSize(){return this.#No.getStackSize()}getCurrentStackIndex(){return this.#No.getCurrentStackIndex()}reset(){this.#No=new Is,this.#Bo()}#Bo(){for(const e of zl)this.#No.addEventListener(e,t=>{const n=Object.assign({},t.detail);this.dispatchEvent(new CustomEvent(e,{detail:n}))})}}class Xl{tags;event;pos;format;precision;value}function Yl(e){return function(t){return Number(t).toPrecision(e)}}function Wl(e){let t="";for(let n=0;n<e;++n)0!==n&&(t+=", "),t+=`{v${n}}`;return t}function $l(e,t){let n=e;for(let e=0;e<t.length;++e)n=n.replace(`{v${e}}`,t[e]);return n}class jl extends EventTarget{#An;#Pn;#ko;#Go=[];#zo;#Ho={};#Xo;constructor(e,t,n){super(),this.#An=e,this.#Pn=t,this.#ko=n;const i=Object.keys(this.#ko);for(let e=0;e<i.length;++e){const t=this.#ko[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.#Ho={},this.#Xo=void 0}addItemMeta(e){let t;void 0!==e["00020010"]?void 0!==e["00080018"]?(t=e["00080018"].value[0],void 0===this.#Ho[t]&&(this.#Ho[t]=function(e,t){const n=[];let i;const o=e["00080060"];if(void 0===o)return n;i=o.value[0];const r=t[i]||t["*"];if(!r)return n;for(const t of r){const i=JSON.parse(JSON.stringify(t)),o=i.tags;if(void 0!==o&&0!==o.length){const t=[];for(const n of o){const i=e[n];if(void 0!==i)if("DA"===i.vr){const e=Ui(Mi(i));void 0!==e&&t.push(e.toLocaleDateString())}else if("TM"===i.vr){const e=Ui({year:1900,monthIndex:0,day:1},qi(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=Wl(t.length)),i.value=$l(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:we(e),format:"{v0}"}),n.push({pos:"bc",value:t,format:"{v0}"}),n.push({pos:"tc",value:we(t),format:"{v0}"})}return n}(e,this.#ko))):s.warn("Missing DICOM SOP instance UID for info data indexing"):void 0!==e.imageUid?(t=e.imageUid.value[0],this.#Ho[t]=function(e,t){const n=[],i=t.DOM;if(!i)return n;for(const t of i){const i=JSON.parse(JSON.stringify(t)),o=i.tags;if(void 0!==o&&0!==o.length){const t=[];for(const n of o){const i=e[n];void 0!==i&&t.push(i.value)}void 0!==i.format&&null!==i.format||(i.format=Wl(t.length)),i.value=$l(i.format,t).trim()}n.push(i)}return n}(e,this.#ko)):s.warn("Missing DOM image UID for info data indexing"),void 0!==t&&(this.#Xo=t)}onSliceChange=e=>{s.debug("InfoData.onSliceChange: deprecated since v0.37, please use onPositionChange."),this.onPositionChange(e)};onPositionChange=e=>{const t=e.detail?.dataid;if(t!==this.#Pn)return;let n=!1;const i=e.detail?.data;void 0!==i&&void 0!==i.imageUid&&this.#Xo!==i.imageUid&&(this.#Xo=i.imageUid,n=!0),(n||this.#Go.includes(e.type))&&this.#Yo(e)};#Yo=e=>{const t=e.detail?.dataid;if(void 0!==t&&t!==this.#Pn)return;const n=this.#Ho[this.#Xo];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:Yl(parseInt(t.precision,10)),o=o.map(e)}n=$l(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.#Xo}`)};isListening(){return this.#zo}addAppListeners(){this.#An.addEventListener("positionchange",this.onPositionChange);for(const e of this.#Go)"positionchange"!==e&&this.#An.addEventListener(e,this.#Yo);this.#zo=!0}removeAppListeners(){this.#An.removeEventListener("positionchange",this.onPositionChange);for(const e of this.#Go)"positionchange"!==e&&this.#An.removeEventListener(e,this.#Yo);this.#zo=!1}}function Zl(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 Kl(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 _l{onWheel(e,t){}onWheelTick(e,t){}}class Jl extends _l{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 ec extends _l{onWheel(e,t){if(void 0===t)return;const n=-e.deltaY/500,i=vn(e),o=Kl(t);if(void 0===o)return void s.warn("No view layer to do wheel zoom behavior");const r=o.getViewController(),a=o.displayToMainPlanePos(i),l=r.getPlanePositionFromPlanePoint(a);t.addScale(n,l),t.draw()}}function tc(e){return Number.isInteger(e)&&e>0&&e<=16}class nc{#fe;#Wo;#$o;#jo;constructor(e,t){if(this.#fe=e,this.#Wo=e.isID(),tc(t)&&(this.#$o=Math.pow(2,t)),!this.#Wo){if(void 0===this.#$o)throw new Error(`Cannot create modality LUT for bits stored: ${t}`);this.#jo=new Float32Array(this.#$o);for(let e=0;e<this.#$o;++e)this.#jo[e]=this.#fe.apply(e)}}getRSI(){return this.#fe}getLength(){return this.#$o}getValue(e){return this.#Wo?e:this.#jo[e]}}class ic{#Zo;#Ko;#jo;#_o=0;#Jo=!0;constructor(e,t,n){if(this.#Zo=e,n&&void 0===this.#Zo.getLength())throw new Error("Cannot create window LUT without LUT length");const i=this.#Zo.getLength();this.#_o=t&&void 0!==i?i/2:0,this.#Jo=n}getVoiLut(){return this.#Ko}getModalityLut(){return this.#Zo}setVoiLut(e){if(this.#Ko=e,this.#Ko.setSignedOffset(this.#Zo.getRSI().getSlope()*this.#_o),this.#Jo){const e=this.#Zo.getLength();this.#jo=new Uint8ClampedArray(e);for(let t=0;t<e;++t)this.#jo[t]=this.#Ko.apply(this.#Zo.getValue(t))}}getValue(e){return this.#Jo?this.#jo[e+this.#_o]:Math.floor(this.#Ko.apply(e+this.#_o))}}const oc={CT:{mediastinum:new Ut(40,400),lung:new Ut(-500,1500),bone:new Ut(500,2e3),brain:new Ut(40,80),head:new Ut(90,350)}};class rc{create(e,t){const n=new cc(t);"MONOCHROME1"===t.getPhotometricInterpretation()&&n.setColourMap("invPlain");let i={};void 0!==t.getMeta().windowPresets&&(i=t.getMeta().windowPresets),i.minmax=new Sr("minmax");const o=t.getMeta().Modality;let r;r=void 0!==ke.wlPresets&&void 0!==ke.wlPresets[o]?ke.wlPresets[o]:oc[o];for(const e in r){const t=r[e];i[e]=new Sr(e,[new Ut(t.center,t.width)])}return n.setWindowPresets(i),n}}class ac{#er=[];#tr(e){return this.#er.indexOf(e)}isHidden(e){return-1!==this.#tr(e)}addToHidden(e){this.isHidden(e)?s.warn(`Not hidding segment, it is allready in the hidden list: ${e}`):this.#er.push(e)}removeFromHidden(e){const t=this.#tr(e);-1!==t?this.#er.splice(t,1):s.warn(`Cannot remove segment, it is not in the hidden list: ${e}`)}}const sc=["wlchange","wlpresetadd","colourmapchange","positionchange","opacitychange","alphafuncchange","maskviewchange"];function lc(e,t){return(new rc).create(e,t)}class cc extends EventTarget{#nr;#ir;#De;#or;#rr={minmax:new Sr("minmax")};#ar;#sr;#lr="plain";#cr;#X;#ur=.33;#dr=1;#hr;#gr=function(e,t){return 255};#Sr=(e,t)=>{if(0===e||this.#mr.isHidden(e))return 0;let n=this.#pr(t);return void 0!==this.#fr&&e===this.#fr.segmentNumber&&(n*=this.#fr.opacity),n};#pr(e){return 0!==this.getContourThickness()&&this.#nr.getContour().getDistance(e,this.getOrientation())<=this.getContourThickness()?255:255*this.getFillOpacity()}#fr;#mr;constructor(e){super(),this.setImage(e)}getImage(){return this.#nr}setImage(e){this.#nr=e;const t=e.getMeta().windowPresets;if(void 0!==t)for(const e of Object.keys(t))this.#rr[e]=t[e];void 0===this.getCurrentPosition()&&this.setCurrentIndex(e.getInitialIndex(),!0),this.isMask()?(this.#mr=new ac,this.#hr=this.#Sr):(this.#hr=this.#gr,this.#nr.addEventListener("appendframe",()=>{const e=this.getCurrentIndex();if(3===e.length()){const t=e.getValues();t.push(0),this.setCurrentIndex(new a(t),!0)}}))}isMask(){return this.#nr instanceof tr}setMaskViewHelper(e){this.#mr=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}getSegmentHighlight(){return this.#fr}setSegmentHighlight(e,t){void 0===e?this.#fr=void 0:(void 0===t&&(t=1),this.#fr={segmentNumber:e,opacity:Math.min(Math.max(t,0),1)}),this.dispatchEvent(new CustomEvent("segmenthighlightchange"))}getOrientation(){return this.#X}setOrientation(e){this.#X=e}getFillOpacity(){return this.#ur}setFillOpacity(e){this.#ur=e>1?1:e<0?0:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#ur,this.#dr]}}))}getContourThickness(){return this.#dr}setContourThickness(e){this.#dr=e<0?0:e>10?10:e,this.dispatchEvent(new CustomEvent("maskviewchange",{detail:{value:[this.#ur,this.#dr]}}))}getPlaybackMilliseconds(e){return e||(e=10),Math.round(1e3/e)}getAlphaFunction(){return this.#hr}setAlphaFunction(e){this.#hr=e,this.dispatchEvent(new CustomEvent("alphafuncchange"))}#vr(){const e=this.#nr.getBuffer();return e instanceof Float32Array||e instanceof Float64Array}#Cr(){let e=this.#nr.getMeta().VOILUTFunction;return void 0===e&&this.#vr()&&(e=Rt.linear_exact),e}#Dr(){return!this.#vr()&&tc(this.#nr.getMeta().BitsStored)}#yr(){if(void 0!==this.#ar&&void 0!==this.#rr[this.#ar]&&void 0!==this.#rr[this.#ar].perslice&&!0===this.#rr[this.#ar].perslice&&!this.#nr.isResampled()){const e=this.getCurrentIndex();if(void 0===e)throw new Error("Cannot get window lut with no current index");const t=this.#nr.getSecondaryOffset(e),n=this.#rr[this.#ar].wl[t];void 0!==n&&this.setWindowLevel(n,this.#ar,!0)}if(void 0===this.#sr&&this.setWindowLevelPresetById(0,!0),void 0===this.#De||this.#nr.isConstantRSI()!==this.#De||this.#Dr()!==this.#or){let e,t;this.#De=this.#nr.isConstantRSI(),this.#or=this.#Dr(),this.#De&&this.#or?(e=this.#nr.getRescaleSlopeAndIntercept(),t=!0):(e=new Be(1,0),t=!1);const n=new nc(e,this.#nr.getMeta().BitsStored);this.#ir=new ic(n,!this.#vr()&&1===this.#nr.getMeta().PixelRepresentation,t)}const e=this.#ir.getVoiLut();let t;if(void 0!==e&&(t=e.getWindowLevel()),void 0===e||!Qt(this.#sr,t)){const e=new qt(this.#sr,this.#Cr());this.#ir.setVoiLut(e)}return this.#ir}getWindowPresets(){return this.#rr}getWindowPresetsNames(){return Object.keys(this.#rr)}setWindowPresets(e){this.#rr=e}addWindowPresets(e){const t=Object.keys(e);for(const n of t)if(void 0!==this.#rr[n]){if(void 0!==this.#rr[n].perslice&&!0===this.#rr[n].perslice)throw new Error("Cannot add perslice preset");this.#rr[n]=e[n]}else this.#rr[n]=e[n],this.dispatchEvent(new CustomEvent("wlpresetadd",{detail:{name:n}}))}getCurrentWindowPresetName(){return this.#ar}getColourMap(){return this.#lr}#Ir(){return ar[this.#lr]}setColourMap(e){if(!ar[e])throw new Error(`Unknown colour map: '${e}'`);this.#lr=e,this.dispatchEvent(new CustomEvent("colourmapchange",{detail:{value:[e]}}))}getCurrentPosition(){return this.#cr}getCurrentIndex(){const e=this.getCurrentPosition();if(void 0!==e)return this.getImage().getGeometry().worldToIndex(e)}getCurrentImageUid(){return this.#nr.getImageUid(this.getCurrentIndex())}getOriginForImageUid(e){return this.#nr.getOriginForImageUid(e)}includesImageUid(e){return this.#nr.includesImageUid(e)}isPositionInBounds(e){void 0===e&&(e=this.#cr);const t=this.#nr.getGeometry(),n=t.worldToIndex(e),i=[this.getScrollDimIndex()];return 4===n.length()&&i.push(3),t.isIndexInBounds(n,i)}getOrigin(e){const t=this.#nr.getGeometry();let n=0;return void 0!==e&&(n=t.worldToIndex(e).get(2)),t.getOrigins()[n]}setCurrentIndex(e,t){const n=this.#nr.getGeometry().indexToWorld(e);return this.setCurrentPosition(n,t)}setCurrentPosition(e,t){void 0===t&&(t=!1);const n=this.#nr.getGeometry(),i=n.getSize().normalisePoint(e,this.#cr),o=n.worldToIndex(i),r=[this.getScrollDimIndex()];if(4===o.length()&&r.push(3),!n.isIndexInBounds(o,r))return this.#cr=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.#cr=i,!t){const t=[o.getValues(),e.getValues()];if(this.#nr.canQuantify()){const e=this.#nr.getRescaledValueAtIndex(o);t.push(e)}this.dispatchEvent(new CustomEvent("positionchange",{detail:{value:t,diffDims:a,data:{imageUid:this.#nr.getImageUid(o)}}}))}return!0}setWindowLevel(e,t,n){if(void 0===t&&(t="manual"),"manual"!==t&&void 0===this.#rr[t])throw new Error(`Unknown window level preset: '${t}'`);void 0===n&&(n=!1);const i=Vt(e,this.#nr.getRescaledDataRange(),this.#Cr()),o=!Qt(i,this.#sr),r=this.#ar!==t;(o||r)&&(this.#sr=i,this.#ar=t,"manual"===t&&(void 0!==this.#rr[t]?this.#rr[t].wl[0]=i:this.addWindowPresets({manual:new Sr("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.#yr().getVoiLut().getWindowLevel()}setWindowLevelPreset(e,t){const n=this.getWindowPresets()[e];if(void 0===n)throw new Error(`Unknown window level preset: '${e}'`);"minmax"===e&&(n.wl=[this.getWindowLevelMinMax()]);let i=n.wl[0];if(void 0!==n.perslice&&!0===n.perslice&&!this.#nr.isResampled()){const e=this.#nr.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 Vt(new Ut(n,t),e,this.#Cr())}setWindowLevelMinMax(){const e=this.getWindowLevelMinMax();this.setWindowLevel(e,"minmax")}generateImageData(e,t){if(void 0===t&&void 0===(t=this.getCurrentIndex()))throw new Error("Cannot generate image data with no current index");const n=this.getImage(),i=!n.isConstantRSI()||!this.#Dr(),o=Yo(n,t,i,this.getOrientation()),r=n.getPhotometricInterpretation();switch(r){case"MONOCHROME1":case"MONOCHROME2":!function(e,t,n,i,o){let r,a=0,s=t.next();for(;!s.done;)r=i.getValue(s.value),e.data[a]=o.red[r],e.data[a+1]=o.green[r],e.data[a+2]=o.blue[r],e.data[a+3]=n(s.value,s.index),a+=4,s=t.next()}(e,o,this.getAlphaFunction(),this.#yr(),this.#Ir());break;case"PALETTE COLOR":n instanceof tr&&n.getHasOverlap()?function(e,t,n,i,o,r,a,s,l,c){const u=i.getAll(),d=Math.round(255*l),h=s>0?i.getOrBuildUnionContour(c,r):null;let g=0,S=t.next();for(;!S.done;){const i=S.index;if(0===S.value)e.data[g]=0,e.data[g+1]=0,e.data[g+2]=0,e.data[g+3]=0;else{const t=Math.floor(i/o),r=i%o;let l=0,S=0,m=0,p=0;for(const[e,i]of u){if(c?.isHidden(e))continue;const o=i.get(t);void 0!==o&&0!==o[r]&&(l+=n.red[e],S+=n.green[e],m+=n.blue[e],++p)}if(0===p)e.data[g+3]=0;else{e.data[g]=Math.round(l/p),e.data[g+1]=Math.round(S/p),e.data[g+2]=Math.round(m/p);let t=d;null!==h&&h.getDistance(i,a)<=s&&(t=255),e.data[g+3]=t}}g+=4,S=t.next()}}(e,o,n.getPaletteColourMap(),n.getSegmentCollection(),n.getGeometry().getSize().getDimSize(2),n.getGeometry().getSize(),this.getOrientation(),this.getContourThickness(),this.getFillOpacity(),this.#mr):function(e,t,n,i,o){const r=function(e){return e>>8};o&&s.info("Scaling 16bits data to 8bits.");let a,l=0,c=t.next();for(;!c.done;)a=c.value,o?(e.data[l]=r(i.red[a]),e.data[l+1]=r(i.green[a]),e.data[l+2]=r(i.blue[a])):(e.data[l]=i.red[a],e.data[l+1]=i.green[a],e.data[l+2]=i.blue[a]),e.data[l+3]=n(a,c.index),l+=4,c=t.next()}(e,o,this.getAlphaFunction(),n.getPaletteColourMap(),16===n.getMeta().BitsStored);break;case"RGB":!function(e,t,n){let i=0,o=t.next();for(;!o.done;)e.data[i]=o.value[0],e.data[i+1]=o.value[1],e.data[i+2]=o.value[2],e.data[i+3]=n(o.value,o.index),i+=4,o=t.next()}(e,o,this.getAlphaFunction());break;case"YBR_FULL":!function(e,t,n){let i,o=0,r=t.next();for(;!r.done;)i=jt(r.value[0],r.value[1],r.value[2]),e.data[o]=i.r,e.data[o+1]=i.g,e.data[o+2]=i.b,e.data[o+3]=n(r.value,r.index),o+=4,r=t.next()}(e,o,this.getAlphaFunction());break;default:throw new Error(`Unsupported photometric interpretation: ${r}`)}}getScrollDimIndex(){let e=2;const t=this.getOrientation();return void 0!==t&&(e=t.getThirdColMajorDirection()),e}isAquisitionOrientation(){return He(this.#X)}}class uc{#Tr={};add(e,t){void 0===this.#Tr[e]&&(this.#Tr[e]=[]),this.#Tr[e].push(t)}remove(e,t){if(void 0===this.#Tr[e])return;let n=0;for(let i=0;i<this.#Tr[e].length;++i)this.#Tr[e][i]===t&&(++n,this.#Tr[e].splice(i,1));0===n&&s.debug(`No callback found on remove listener for type ${e}`)}fireEvent=e=>{if(void 0===this.#Tr[e.type])return;const t=this.#Tr[e.type].slice();for(let n=0;n<t.length;++n)t[n](e)}}class dc{#wr;#k;#Lr;#Pr;#Ar;constructor(e,t){this.#wr=e,this.#k=e.getRealSpacing(),this.#Lr=e.getOrientation(),this.#Pr=t,this.#Ar=function(e,t){return e.asOneAndZeros().multiply(t)}(this.#Lr,t)}getViewOrientation(){return this.#Pr}getTargetOrientation(){return this.#Ar}getOffset3DFromPlaneOffset(e){const t=new g(e.x,e.y,0),n=this.getTargetDeOrientedVector3D(t);return new g(n.getX()*this.#k.get(0),n.getY()*this.#k.get(1),n.getZ()*this.#k.get(2))}getPlaneOffsetFromOffset3D(e){const t=new g(e.x/this.#k.get(0),e.y/this.#k.get(1),e.z/this.#k.get(2)),n=this.getTargetOrientedVector3D(t);return{x:n.getX(),y:n.getY()}}getTargetOrientedVector3D(e){let t=e;return void 0!==this.#Ar&&(t=this.#Ar.getInverse().multiplyVector3D(e)),t}getTargetDeOrientedVector3D(e){let t=e;return void 0!==this.#Ar&&(t=this.#Ar.multiplyVector3D(e)),t}getTargetDeOrientedPoint3D(e){let t=e;return void 0!==this.#Ar&&(t=this.#Ar.multiplyPoint3D(e)),t}getImageOrientedVector3D(e){let t=e;if(void 0!==this.#Pr){const n=At([e.getX(),e.getY(),e.getZ()],this.#Pr);t=new g(n[0],n[1],n[2])}return t}getImageOrientedPoint3D(e){let t=e;if(void 0!==this.#Pr){const n=At([e.getX(),e.getY(),e.getZ()],this.#Pr);t=new m(n[0],n[1],n[2])}return t}getImageDeOrientedVector3D(e){let t=e;if(void 0!==this.#Pr){const n=Pt([e.getX(),e.getY(),e.getZ()],this.#Pr);t=new g(n[0],n[1],n[2])}return t}getImageDeOrientedPoint3D(e){let t=e;if(void 0!==this.#Pr){const n=Pt([e.getX(),e.getY(),e.getZ()],this.#Pr);t=new m(n[0],n[1],n[2])}return t}getPositionFromPlanePoint(e,t){const n=new m(e.getX(),e.getY(),t),i=this.getImageOrientedPoint3D(n);return this.#wr.pointToWorld(i)}getPlanePointFromPosition(e){const t=this.#wr.worldToPoint(e);return this.getImageDeOrientedPoint3D(t)}getCosines(){return Ke(this.#Ar)}getLegacyCosines(){return Ke(function(e,t){let n=t;return e.asOneAndZeros().getAbs().isSimilar(Xe().getAbs())&&(n=n.getAbs()),n}(this.#Lr,this.#Ar))}getPlanePoints(e){const t=this.worldToIndex(e),n=this.indexToWorld(t),i=this.getPlanePointFromPosition(n),o=this.getPositionFromPlanePoint(new S(0,0),i.getZ()),r=this.#wr.getOrigins(),a=r[o.getClosest(r)],s=o.getValues(),l=a.getValues(),c=this.getNativeScrollDimIndex();s[c]=l[c];const u=this.getCosines();return[new m(s[0],s[1],s[2]),new m(u[0],u[1],u[2]),new m(u[3],u[4],u[5])]}worldToIndex(e){return this.#wr.worldToIndex(e)}indexToWorld(e){return this.#wr.indexToWorld(e)}isAquisitionOrientation(){return He(this.#Pr)}getTargetOrientedPositiveXYZ(e){const t=Pt([e.x,e.y,e.z],this.#Ar);return{x:t[0],y:t[1],z:t[2]}}getScrollDimIndex(){let e;return e=void 0!==this.#Pr?this.#Pr.getThirdColMajorDirection():2,e}getNativeScrollDimIndex(){let e;return e=void 0!==this.#Lr?this.#Lr.getThirdColMajorDirection():2,e}}class hc{#m;constructor(e){this.#m=e}getCurrentPosition(){return this.#m.getCurrentPosition()}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(n=this.#m.setCurrentPosition(e,t)),n}}class gc{#Or;#de;#cr;#br;constructor(e){this.#Or=new hc(e),this.#de=e.getImage().getGeometry(),this.#cr=e.getCurrentPosition(),this.#br=e.getScrollDimIndex()}getGeometry(){return this.#de}getScrollDimIndex(){return this.#br}getMaximumDimValue(e){return this.#de.getSize().get(e)-1}getMaximumScrollValue(){return this.getMaximumDimValue(this.#br)}getCurrentPosition(){return this.#de.getSize().normalisePoint(this.#Or.getCurrentPosition(),this.#cr)}getCurrentPositionDimValue(e){return this.getCurrentIndex().get(e)}getCurrentPositionScrollValue(){return this.getCurrentPositionDimValue(this.#br)}getCurrentPositionAtDimValue(e,t){const n=this.getCurrentIndex().getValues();return n[e]=t,this.#de.indexToWorld(new a(n))}getCurrentPositionAtScrollValue(e){return this.getCurrentPositionAtDimValue(this.#br,e)}getCurrentIndex(){return this.#de.worldToIndex(this.getCurrentPosition())}setCurrentPosition(e,t){let n=!1;return void 0!==e&&(this.#cr=this.#de.getSize().normalisePoint(e,this.#cr),n=this.#Or.setCurrentPosition(e,t)),n}setCurrentPositionSafe(e,t){let n=!1;return this.isPositionInBounds(e)&&(n=this.setCurrentPosition(e,t)),n}merge(e){if(this.#br!==e.getScrollDimIndex())throw new Error("Cannot merge helper of a view with different orientation");this.#de=function(e,t){const n=e.getOrientation();if(!n.isSimilar(t.getOrientation(),It))throw new Error("Cannot merge geometries with different orientation");const i=n.getInverse(),o=function(e,t){return P(e,t,Math.min)},r=function(e,t){return P(e,t,Math.max)},a=new tt(o(e.getSpacing().getValues(),t.getSpacing().getValues())),s=function(e){return i.multiplyPoint3D(e.get3D())},l=e.getRange().map(s),c=t.getRange().map(s),u=o(l[0].getValues(),c[0].getValues()),d=r(l[1].getValues(),c[1].getValues());let h=[];for(let e=0;e<u.length;++e)h.push(Math.round(Math.abs(d[e]-u[e])/a.get(e)));const g=r(e.getSize().getValues(),t.getSize().getValues());h=h.concat(g.slice(3));const S=new Dt(h),p=[];for(let e=0;e<S.get(2);++e){const t=u.slice();t[2]=u[2]+e*a.get(2);const i=new m(t[0],t[1],t[2]);p.push(n.multiplyPoint3D(i))}const f=new Lt(p,S,a,n),v=S.length()>3?S.get(3):void 0,C=bt(e,v),D=bt(t,v);return void 0!==C&&void 0!==D?function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n){const i=e[n].id,o=t[n].id;if(i.value!==o.value||i.source!==o.source||i.tagKey!==o.tagKey)return!1}return!0}(C,D)&&f.setVolumeIds(C):void 0!==C?f.setVolumeIds(C):void 0!==D&&f.setVolumeIds(D),f}(this.#de,e.getGeometry()),this.#cr=this.#de.getSize().normalisePoint(this.#cr,e.getCurrentPosition())}isPositionInBounds(e){const t=this.#de.worldToIndex(e),n=[this.#br];return 4===t.length()&&n.push(3),this.#de.isIndexInBounds(t,n)}getIncrementPosition(e){const t=this.getCurrentIndex().next(e);return this.#de.indexToWorld(t)}getDecrementPosition(e){const t=this.getCurrentIndex().previous(e);return this.#de.indexToWorld(t)}incrementPosition(e){return this.setCurrentPositionSafe(this.getIncrementPosition(e))}decrementPosition(e){return this.setCurrentPositionSafe(this.getDecrementPosition(e))}incrementPositionAlongScroll(){return this.incrementPosition(this.#br)}decrementPositionAlongScroll(){return this.decrementPosition(this.#br)}}class Sc{#m;#xr;#Er;constructor(e){if(void 0===e.getImage())throw new Error("View does not have an image, cannot setup controller");this.#m=e,this.#xr=new dc(e.getImage().getGeometry(),e.getOrientation())}getPlaneHelper(){return this.#xr}updatePlaneHelper(){this.#xr=new dc(this.#m.getImage().getGeometry(),this.#m.getOrientation())}isMask(){return this.#m.isMask()}initialise(){this.resetWindowLevel(),this.resetPosition()}resetWindowLevel(){this.setWindowLevelPresetById(0)}resetPosition(){this.setCurrentPosition(this.getPositionFromPlanePoint(new S(0,0)))}getModality(){return this.#m.getImage().getMeta().Modality}getSopClassUid(){return this.#m.getImage().getMeta().SOPClassUID}getWindowLevelPresetsNames(){return this.#m.getWindowPresetsNames()}addWindowLevelPresets(e){return this.#m.addWindowPresets(e)}setWindowLevelPreset(e){this.#m.setWindowLevelPreset(e)}setWindowLevelPresetById(e){this.#m.setWindowLevelPresetById(e)}isPlaying(){return void 0!==this.#Er}getPositionHelper(){return new gc(this.#m)}getCurrentPosition(){return this.#m.getCurrentPosition()}getCurrentIndex(){return this.#m.getCurrentIndex()}canSyncVolume(e,t){return this.#m.getImage().getGeometry().canSyncVolume(e.#m.getImage().getGeometry(),t)}getCurrentImageUid(){return this.#m.getCurrentImageUid()}getOriginForImageUid(e){return this.#m.getOriginForImageUid(e)}includesImageUid(e){return this.#m.includesImageUid(e)}getCurrentOrientedIndex(){let e=this.getCurrentIndex();if(void 0!==this.#m.getOrientation()){const t=this.#xr.getImageDeOrientedVector3D(new g(e.get(0),e.get(1),e.get(2)));e=new a([t.getX(),t.getY(),t.getZ()])}return e}getScrollDimIndex(){return this.#m.getScrollDimIndex()}getCurrentIndexScrollValue(){return this.getCurrentIndex().get(this.#m.getScrollDimIndex())}getOrigin(e){return this.#m.getOrigin(e)}isAquisitionOrientation(){return this.#m.isAquisitionOrientation()}getPlanePoints(e){return this.#xr.getPlanePoints(e)}getCurrentScrollPosition(){const e=this.#m.getScrollDimIndex();return this.#m.getCurrentPosition().get(e)}generateImageData(e,t){this.#m.generateImageData(e,t)}setImage(e){const t=this.#m.getImage().getGeometry(),n=e.getGeometry();this.#m.setImage(e),t.equals(n)||this.updatePlaneHelper()}get2DSpacing(){return this.#m.getImage().getGeometry().getSpacing(this.#m.getOrientation()).get2D()}getRescaledImageValue(e){const t=this.#m.getImage();if(!t.canQuantify())return;const n=t.getGeometry(),i=n.worldToIndex(e);let o;return n.isIndexInBounds(i)&&(o=t.getRescaledValueAtIndex(i)),o}getSegmentNumbersAtPosition(e){const t=this.#m.getImage();if(!(t instanceof tr))return[];const n=t.getGeometry(),i=n.worldToIndex(e);return n.isIndexInBounds(i)?t.getSegmentNumbersAtIndex(i):[]}getPixelUnit(){return this.#m.getImage().getMeta().pixelUnit}getLengthUnit(){return this.#m.getImage().getMeta().lengthUnit}#Rr(e,t,n,i){const o=Xo(Yo(e,t,n,i)),r=e.getGeometry().getSize(i).getValues();r[2]=1;const a=new Dt(r),s=e.getGeometry().getSpacing(i).getValues();s[2]=1;const l=new tt(s),c=new m(0,0,0),u=new Lt([c],a,l);return new Ht(u,o)}getImageRegionValues(e,t,n){let i=this.#m.getImage();const o=this.#m.getOrientation();let r=n,s=!0;He(o)||(i=this.#Rr(i,r,s,o),r=new a([0,0,0]),s=!1);const l=function(e,t,n,i,o){if(1!==e.getNumberOfComponents())throw new Error(`Unsupported number of components for region iterator: ${e.getNumberOfComponents()}`);let r;void 0===n&&(n=!1),r=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const a=e.getGeometry().getSize();void 0===i&&(i=new S(0,0)),void 0===o&&(o=new S(a.get(0)-1,a.get(1)));const s=a.indexToOffset(t.getWithNew2D(i.getX(),i.getY())),l=a.indexToOffset(t.getWithNew2D(o.getX(),o.getY()-1)),c=Math.max(1,o.getX()-i.getX());return function(e,t,n,i,o,r){let a=t,s=0;return{next(){if(a<n){const t={value:e(a),done:!1,index:a};return s+=1,a+=1,s===o&&(s=0,a+=r),t}return{done:!0,index:n}}}}(r,s,l+1,0,c,a.get(0)-c)}(i,r,s,e,t);let c=[];return l&&(c=Xo(l)),c}getImageVariableRegionValues(e,t){let n=this.#m.getImage();const i=this.#m.getOrientation();let o=t,r=!0;He(i)||(n=this.#Rr(n,o,r,i),o=new a([0,0,0]),r=!1);const s=function(e,t,n,i){if(1!==e.getNumberOfComponents())throw new Error(`Unsupported number of components for region iterator: ${e.getNumberOfComponents()}`);let o;void 0===n&&(n=!1),o=n?function(t){return e.getRescaledValueAtOffset(t)}:function(t){return e.getValueAtOffset(t)};const r=e.getGeometry().getSize(),a=[];let s,l=null,c=null,u=null;for(let e=0;e<i.length;++e){s=i[e];const t=s[1][0]-s[0][0];0!==t&&(u=e,l||(l=s[0]),a.push([s[0][0],t,r.get(0)-s[1][0]]))}if(null!==u&&(c=i[u][1]),0!==a.length)return function(e,t,n,i,o){let r=t,a=0,s=0;return{next(){if(r<n){const t={value:e(r),done:!1,index:r};return s+=1,r+=1,s===o[a][1]&&(s=0,r+=o[a][2],a+=1,a<o.length&&(r+=o[a][0])),t}return{done:!0,index:n}}}}(o,r.indexToOffset(t.getWithNew2D(l[0],l[1])),r.indexToOffset(t.getWithNew2D(c[0],c[1]))+1,0,a)}(n,o,r,e);let l=[];return s&&(l=Xo(s)),l}canQuantifyImage(){return this.#m.getImage().canQuantify()}canWindowLevel(){return this.isMonochrome()}isMonochrome(){return this.#m.getImage().isMonochrome()}canScroll(){return this.#m.getImage().canScroll(this.#m.getOrientation())}getImageSize(){return this.#m.getImage().getGeometry().getSize(this.#m.getOrientation())}getImageSpacing(){return this.#m.getImage().getGeometry().getSpacing(this.#m.getOrientation())}moreThanOne(e){return this.getImageSize().moreThanOne(e)}getImageWorldSize(){const e=this.#m.getImage().getGeometry(),t=e.getSize(this.#m.getOrientation()).get2D(),n=e.getSpacing(this.#m.getOrientation()).get2D();return{x:t.x*n.x,y:t.y*n.y}}getImageRescaledDataRange(){return this.#m.getImage().getRescaledDataRange()}equalImageMeta(e){const t=this.#m.getImage().getMeta(),n=Object.keys(e);for(let i=0;i<n.length;++i){const o=n[i];if(void 0===t[o])return!1;if(t[o]!==e[o])return!1}return!0}isPositionInBounds(e){return this.#m.isPositionInBounds(e)}setCurrentPosition(e,t){return this.#m.setCurrentPosition(e,t)}getPositionFromPlanePoint(e,t){void 0===t&&(t=this.getCurrentIndexScrollValue());const n=new m(e.getX(),e.getY(),t),i=this.#xr.getImageOrientedPoint3D(n),o=this.#m.getImage().getGeometry().pointToWorld(i);return this.getCurrentPosition().mergeWith3D(o)}validatePlanePoint(e){const t=this.getPositionFromPlanePoint(e);return this.#m.getImage().getGeometry().isInBounds(t)}getPlanePositionFromPosition(e){const t=this.#m.getImage().getGeometry().worldToPoint(e),n=this.#xr.getImageDeOrientedPoint3D(t);return new S(n.getX(),n.getY())}getIndexFromPosition(e){return this.#m.getImage().getGeometry().worldToIndex(e)}getPositionFromIndex(e){return this.#m.getImage().getGeometry().indexToWorld(e)}setCurrentIndex(e,t){return this.#m.setCurrentIndex(e,t)}getPlanePositionFromPlanePoint(e){const t=this.getCurrentIndexScrollValue(),n=new m(e.getX(),e.getY(),t),i=this.#xr.getTargetDeOrientedPoint3D(n),o=this.#m.getImage().getGeometry().getRealSpacing();return new m(i.getX()*o.get(0),i.getY()*o.get(1),i.getZ()*o.get(2))}getOffset3DFromPlaneOffset(e){return this.#xr.getOffset3DFromPlaneOffset(e)}play(){if(this.canScroll())if(void 0===this.#Er){const e=this.#m.getImage(),t=e.getMeta().RecommendedDisplayFrameRate,n=this.#m.getPlaybackMilliseconds(t),i=e.getGeometry().getSize().canScroll3D(),o=this.getPositionHelper();this.#Er=setInterval(()=>{let e;if(e=i?o.incrementPositionAlongScroll():o.incrementPosition(3),!e){const e=this.getCurrentIndex().getValues(),t=this.#m.getOrientation();i?e[t.getThirdColMajorDirection()]=0:e[3]=0;const n=new a(e),o=this.#m.getImage().getGeometry();this.setCurrentPosition(o.indexToWorld(n))}},n)}else this.stop()}stop(){void 0!==this.#Er&&(clearInterval(this.#Er),this.#Er=void 0)}getWindowLevel(){return this.#m.getWindowLevel()}getCurrentWindowPresetName(){return this.#m.getCurrentWindowPresetName()}setWindowLevel(e){this.#m.setWindowLevel(e)}getColourMap(){return this.#m.getColourMap()}setColourMap(e){this.#m.setColourMap(e)}setViewAlphaFunction(e){this.#m.setAlphaFunction(e)}setMaskViewHelper(e){this.#m.setMaskViewHelper(e)}getSegmentHighlight(){return this.#m.getSegmentHighlight()}setSegmentHighlight(e,t){this.#m.setSegmentHighlight(e,t)}getFillOpacity(){return this.#m.getFillOpacity()}setFillOpacity(e){this.#m.setFillOpacity(e)}getContourThickness(){return this.#m.getContourThickness()}setContourThickness(e){this.#m.setContourThickness(e)}bindImageAndLayer(e){const t=this.#m.getImage();t.addEventListener("imagecontentchange",e.onimagecontentchange),t.addEventListener("imagegeometrychange",e.onimagegeometrychange),t.addEventListener("imageresampled",e.onimageresampled)}unbindImageAndLayer(e){const t=this.#m.getImage();t.removeEventListener("imagecontentchange",e.onimagecontentchange),t.removeEventListener("imagegeometrychange",e.onimagegeometrychange),t.removeEventListener("imageresampled",e.onimageresampled)}}class mc{#Fr;#Mr;#oi=null;#qr=null;#Ur=null;#Qr=null;#Vr=!0;#Nr;#Br;#kr;#Gr=1;#zr={x:1,y:1};#Hr={x:1,y:1};#Xr={x:1,y:1,z:1};#Yr={x:1,y:1};#Wr=1;#$r={x:1,y:1};#jr={x:0,y:0};#Zr={x:0,y:0};#Kr={x:0,y:0};#_r={x:0,y:0};#Jr={x:0,y:0};#ea={x:0,y:0};#ta=null;#na;#Pn;#ia=new uc;#oa=!1;#ra;#aa;constructor(e,t){this.#Fr=e,void 0===t&&(t=new Dn),this.#Mr=t,this.#Fr.className+=" viewLayer"}getDataId(){return this.#Pn}getScale(){return this.#zr}getAbsoluteZoomOffset(){return{x:this.#_r.x*this.#Hr.x,y:this.#_r.y*this.#Hr.y}}setImageSmoothing(e){this.#oa=e}setView(e,t){this.#Pn=t,e.addEventListener("wlchange",this.#sa),e.addEventListener("colourmapchange",this.#la),e.addEventListener("positionchange",this.#ca),e.addEventListener("alphafuncchange",this.#ua),e.addEventListener("maskviewchange",this.#da),e.addEventListener("segmenthighlightchange",this.#ha);for(const t of sc)e.addEventListener(t,this.#ga);this.#oi=new Sc(e),this.bindImage()}getViewController(){return this.#oi}getImageData(){return this.#Nr}onimageset=e=>{const t=e.detail?.dataid,n=e.detail?.value;this.#Pn===t&&(this.#oi.setImage(n[0]),this.#Sa(this.#oi.getImageSize().get2D()),this.#ta=!0)};bindImage(){this.#oi&&this.#oi.bindImageAndLayer(this)}unbindImage(){this.#oi&&this.#oi.unbindImageAndLayer(this)}onimagecontentchange=e=>{const t=e.detail?.dataid;void 0!==t&&this.#Pn!==t||(this.#Vr=this.#oi.isPositionInBounds(),this.#ta=!0,this.draw())};onimagegeometrychange=e=>{const t=e.detail?.dataid;if(void 0===t||this.#Pn===t){const e=this.#oi.getImageSize().get2D(),t=this.#oi.getImageSpacing().get2D(),n=this.#Br.x!==e.x||this.#Br.y!==e.y,i=this.#kr.x!==t.x||this.#kr.y!==t.y;if(i&&(this.#oi.updatePlaneHelper(),this.#ma(t)),n){if(void 0!==this.#ra&&void 0!==this.#aa){const e=this.#oi.getOrigin(),t=this.#aa.minus(e),n=this.#oi.getOrigin(this.#oi.getCurrentPosition());if(void 0!==n){const e=this.#ra.minus(n);this.setBaseOffset(t,e)}}this.#Sa(e)}(i||n)&&(this.#ta=!0,this.draw()),n&&this.#ga(new CustomEvent("basesizechange",{detail:{value:[e.x,e.y]}}))}};onimageresampled=e=>{const t=this.#oi.getCurrentIndex().get(3),n=void 0===t||t===e.detail?.frame,i=e.detail?.dataid;void 0!==i&&this.#Pn!==i||!n||(this.#ta=!0,this.draw())};getId(){return this.#Fr.id}removeFromDOM(){this.#Fr.remove()}getBaseSize(){return this.#Br}getImageWorldSize(){return this.#oi.getImageWorldSize()}getOpacity(){return this.#Gr}setOpacity(e){e!==this.#Gr&&(this.#Gr=Math.min(Math.max(e,0),1),this.#ga(new CustomEvent("opacitychange",{detail:{value:[this.#Gr]}})))}highlightSegment(e,t){if(void 0===t&&(t=750),void 0!==this.#na&&this.#na(),!this.#oi.isMask())return!1;if(void 0!==ke.highlightSegment)return this.#na=ke.highlightSegment(this,e,t),!0;let n;const i=()=>{cancelAnimationFrame(n),this.#oi.setSegmentHighlight(),this.#na===i&&(this.#na=void 0)};let o;const r=a=>{void 0===o&&(o=a);const s=a-o;if(s>=t)return void i();const l=.8*Math.sin(Math.PI*s/t);this.#oi.setSegmentHighlight(e,1-l),n=requestAnimationFrame(r)};return this.#na=i,n=requestAnimationFrame(r),!0}getFillOpacity(){return this.#oi.getFillOpacity()}setFillOpacity(e){this.#oi.setFillOpacity(e)}getContourThickness(){return this.#oi.getContourThickness()}setContourThickness(e){this.#oi.setContourThickness(e)}addFlipOffsetX(){this.#ea.x+=this.#qr.width/this.#zr.x,this.#jr.x+=this.#ea.x}addFlipOffsetY(){this.#ea.y+=this.#qr.height/this.#zr.y,this.#jr.y+=this.#ea.y}flipScaleX(){this.#Xr.x*=-1}flipScaleY(){this.#Xr.y*=-1}flipScaleZ(){this.#Xr.z*=-1}setScale(e,t){const n=this.#oi.getPlaneHelper(),i=n.getTargetOrientedPositiveXYZ({x:e.x*this.#Xr.x,y:e.y*this.#Xr.y,z:e.z*this.#Xr.z}),o={x:this.#Hr.x*i.x,y:this.#Hr.y*i.y};if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:this.#jr.x-this.#_r.x,y:this.#jr.y-this.#_r.y};this.#_r={x:0,y:0},this.#jr=e}else if(void 0!==t){let e=n.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#Zr.x,y:e.y+this.#Zr.y};const i=Lc(this.#jr,this.#zr,o,e),r={x:this.#_r.x+i.x-this.#jr.x,y:this.#_r.y+i.y-this.#jr.y};this.#_r=r,this.#jr=i}this.#zr=o}initScale(e,t){const n=this.#oi.getPlaneHelper().getTargetOrientedPositiveXYZ({x:e.x*this.#Xr.x,y:e.y*this.#Xr.y,z:e.z*this.#Xr.z}),i={x:this.#Hr.x*n.x,y:this.#Hr.y*n.y};this.#zr=i,this.#_r={x:t.x/this.#Hr.x,y:t.y/this.#Hr.y},this.#jr={x:this.#jr.x+this.#_r.x,y:this.#jr.y+this.#_r.y}}setBaseOffset(e,t,n,i){const o=this.#oi.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.#Zr.x!==a.x||this.#Zr.y!==a.y;return void 0!==n&&void 0!==i&&(this.#ra=n,this.#aa=i),s&&(this.#jr={x:this.#jr.x-this.#Zr.x+a.x,y:this.#jr.y-this.#Zr.y+a.y},this.#Zr=a),s}setOffset(e){const t=this.#oi.getPlaneHelper().getPlaneOffsetFromOffset3D(e);this.#jr={x:this.#jr.x-this.#Jr.x+t.x,y:this.#jr.y-this.#Jr.y+t.y},this.#Jr=t}displayToPlaneIndex(e){const t=this.displayToPlanePos(e);return new a([Math.floor(t.getX()),Math.floor(t.getY())])}displayToPlaneScale(e){return new S(e.getX()/this.#zr.x,e.getY()/this.#zr.y)}displayToPlanePos(e){const t=this.displayToPlaneScale(e);return new S(t.getX()+this.#jr.x,t.getY()+this.#jr.y)}planePosToDisplay(e){let t=(e.getX()-this.#jr.x+this.#Zr.x)*this.#zr.x,n=(e.getY()-this.#jr.y+this.#Zr.y)*this.#zr.y;return(t<0||t>=this.#qr.width)&&(t=void 0),(n<0||n>=this.#qr.height)&&(n=void 0),new S(t,n)}displayToMainPlanePos(e){const t=this.displayToPlanePos(e);return new S(t.getX()-this.#Zr.x,t.getY()-this.#Zr.y)}display(e){this.#Fr.style.display=e?"":"none"}isVisible(){return""===this.#Fr.style.display}draw(){this.#Vr&&(this.#ga(new CustomEvent("renderstart",{detail:{layerid:this.getId()}})),this.#ta&&this.#pa(),this.#Qr.globalAlpha=this.#Gr,this.clear(),this.#Qr.setTransform(this.#zr.x,0,0,this.#zr.y,-1*this.#jr.x*this.#zr.x,-1*this.#jr.y*this.#zr.y),this.#Qr.imageSmoothingEnabled=this.#oa,this.#Qr.drawImage(this.#Ur,0,0),this.#ga(new CustomEvent("renderend",{detail:{layerid:this.getId()}})))}initialise(e,t,n){this.#kr=t,this.#Gr=Math.min(Math.max(n,0),1);const i=this.#Fr.ownerDocument;if(this.#qr=i.createElement("canvas"),this.#Fr.appendChild(this.#qr),!this.#qr.getContext)throw new Error("No canvas.getContext method.");if(this.#Qr=this.#qr.getContext("2d"),!this.#Qr)throw new Error("Failed to get the canvas 2D context.");this.#Ur=i.createElement("canvas"),this.#Sa(e),this.#ta=!0}#Sa(e){const t=this.#Fr.ownerDocument;if(!this.#Mr.canCreate(e,t))throw new Error(`Cannot create canvas with size ${e.x}, ${e.y}`);this.#Br=e,this.#Ur.width=this.#Br.x,this.#Ur.height=this.#Br.y,this.#Qr.clearRect(0,0,this.#Br.x,this.#Br.y),this.#Nr=this.#Qr.createImageData(this.#Br.x,this.#Br.y)}#ma(e){this.#kr=e,this.fitToContainer(this.#Yr,this.#Wr,this.#$r)}fitToContainer(e,t,n){let i=!1;const o={x:t*this.#kr.x,y:t*this.#kr.y},r=o.x/this.#Hr.x,a=o.y/this.#Hr.y,s=e.x/(this.#qr.width*r),l=e.y/(this.#qr.height*a);if(this.#qr.width!==e.x||this.#qr.height!==e.y){const t=this.#Fr.ownerDocument;if(!this.#Mr.canCreate(e,t))throw new Error(`Cannot resize canvas ${e.x}, ${e.y}`);this.#qr.width=e.x,this.#qr.height=e.y,i=!0}const c={x:this.#zr.x*r,y:this.#zr.y*a};this.#zr.x===c.x&&this.#zr.y===c.y||(this.#Hr=o,this.#zr=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.#ea.x?d.x:0,y:0!==this.#ea.y?d.y:0};if(this.#Kr.x!==u.x||this.#Kr.y!==u.y||this.#ea.x!==h.x||this.#ea.y!==h.y){const e={x:this.#_r.x*s,y:this.#_r.y*l};this.#jr={x:this.#jr.x+u.x-this.#Kr.x+h.x-this.#ea.x+e.x-this.#_r.x,y:this.#jr.y+u.y-this.#Kr.y+h.y-this.#ea.y+e.y-this.#_r.y},this.#ea=h,this.#Kr=u,this.#_r=e,i=!0}this.#Yr=e,this.#Wr=t,this.#$r=n,i&&this.draw()}bindInteraction(){this.#Fr.style.pointerEvents="auto";const e=gn;for(let t=0;t<e.length;++t)this.#Fr.addEventListener(e[t],this.#fa,mn(e[t]))}unbindInteraction(){this.#Fr.style.pointerEvents="none";const e=gn;for(let t=0;t<e.length;++t)this.#Fr.removeEventListener(e[t],this.#fa)}addEventListener(e,t){this.#ia.add(e,t)}removeEventListener(e,t){this.#ia.remove(e,t)}#ga=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#Pn});this.#ia.fireEvent(new CustomEvent(e.type,{detail:t}))};#fa=e=>{e.srclayerid=this.getId(),e.dataid=this.#Pn,this.#ia.fireEvent(e)};#pa(){this.#oi.generateImageData(this.#Nr),this.#Ur.getContext("2d").putImageData(this.#Nr,0,0),this.#ta=!1}#sa=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#ta=!0,this.draw())};#la=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#ta=!0,this.draw())};#ca=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.#oi.getScrollDimIndex());t.splice(n,1);const i=e.detail?.diffDims?.filter(function(e){return-1===t.indexOf(e)});0===i.length&&this.#Vr||(this.#Vr=!0,this.#ta=!0,this.draw())}else this.#Vr&&(this.#Vr=!1,this.clear())}};isValidPosition(){return this.#Vr}#ua=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#ta=!0,this.draw())};#ha=()=>{this.#ta=!0,this.draw()};#da=e=>{void 0!==e.detail?.skipGenerate&&!0===e.detail?.skipGenerate||(this.#ta=!0,this.draw())};setCurrentPosition(e,t){return this.#oi.setCurrentPosition(e)}clear(){this.#Qr.save(),this.#Qr.setTransform(1,0,0,1,0,0),this.#Qr.clearRect(0,0,this.#qr.width,this.#qr.height),this.#Qr.restore()}}class pc extends ys{#va;#Ca;constructor(e,t){super(),this.#va=e,this.#Ca=t}getName(){return`AddAnnotation-${this.#va.trackingUid}`}execute(){this.#Ca.addAnnotation(this.#va)}undo(){this.#Ca.removeAnnotation(this.#va.trackingUid)}}class fc extends ys{#va;#Ca;constructor(e,t){super(),this.#va=e,this.#Ca=t}getName(){return`RemoveAnnotation-${this.#va.trackingUid}`}execute(){this.#Ca.removeAnnotation(this.#va.trackingUid)}undo(){this.#Ca.addAnnotation(this.#va)}}class vc extends ys{#va;#Ca;#Da;#ya;constructor(e,t,n,i){super(),this.#va=e,this.#Ca=i,this.#Da=t,this.#ya=n}getName(){return`UpdateAnnotation-${this.#va.trackingUid}`}execute(){const e=Object.keys(this.#ya);for(const t of e)this.#va[t]=this.#ya[t];this.#Ca.updateAnnotation(this.#va,e)}undo(){const e=Object.keys(this.#Da);for(const t of e)this.#va[t]=this.#Da[t];this.#Ca.updateAnnotation(this.#va,e)}}class Cc{#Ia;getAnnotation(e){return this.#Ia.find(e)}getAnnotationGroup(){return this.#Ia}isAnnotationGroupEditable(){return this.#Ia.isEditable()}setAnnotationGroupEditable(e){this.#Ia.setEditable(e)}addAnnotation(e){this.#Ia.add(e)}updateAnnotation(e,t,n){this.#Ia.update(e,t,n)}removeAnnotation(e){this.#Ia.remove(e)}removeAnnotationWithCommand(e,t){const n=this.getAnnotation(e);if(void 0===n)return void s.warn(`Cannot create remove command for undefined annotation: ${e}`);const i=new fc(n,this);t(i),i.execute()}updateAnnotationWithCommand(e,t,n,i){const o=this.getAnnotation(e);if(void 0===o)return void s.warn(`Cannot create update command for undefined annotation: ${e}`);const r=new vc(o,t,n,this);i(r),r.execute()}removeAllAnnotationsWithCommand(e){for(const t of[...this.#Ia.getList()])this.removeAnnotationWithCommand(t.trackingUid,e)}constructor(e){this.#Ia=void 0!==e?e:new Yt}hasAnnotationMeta(e){return this.#Ia.hasMeta(e)}setAnnotationMeta(e,t){this.#Ia.setMetaValue(e,t)}}class Dc{#Fr;#Ta=null;#Br;#kr;#Hr={x:1,y:1};#Xr={x:1,y:1,z:1};#Zr={x:0,y:0};#Kr={x:0,y:0};#_r={x:0,y:0};#Jr={x:0,y:0};#ea={x:0,y:0};#na;#Ca;#xr;#Pn;#wa;#La;#Pa;#Aa;#Oa=!0;constructor(e){this.#Fr=e,this.#Fr.className+=" drawLayer"}setShapeHandler(e){this.#Aa=e}getDataId(){return this.#Pn}getReferenceLayerId(){return this.#wa}#ia=new uc;getKonvaStage(){return this.#Ta}getKonvaLayer(){return this.#Ta.getLayers()[0]}getDrawController(){return this.#Ca}setPlaneHelper(e){this.#xr=e}getId(){return this.#Fr.id}removeFromDOM(){this.#Fr.remove()}getBaseSize(){return this.#Br}getOpacity(){return this.#Ta.opacity()}setOpacity(e){const t=Math.min(Math.max(e,0),1);t!==this.#Ta.opacity()&&(this.#Ta.opacity(t),this.#ga(new CustomEvent("opacitychange",{detail:{value:[t]}})))}addFlipOffsetX(){const e=this.#Ta.scale(),t=this.#Ta.size();this.#ea.x+=t.width/e.x;const n=this.#Ta.offset();n.x+=this.#ea.x,this.#Ta.offset(n)}addFlipOffsetY(){const e=this.#Ta.scale(),t=this.#Ta.size();this.#ea.y+=t.height/e.y;const n=this.#Ta.offset();n.y+=this.#ea.y,this.#Ta.offset(n)}flipScaleX(){this.#Xr.x*=-1}flipScaleY(){this.#Xr.y*=-1}flipScaleZ(){this.#Xr.z*=-1}setScale(e,t){const n=this.#xr.getTargetOrientedPositiveXYZ({x:e.x*this.#Xr.x,y:e.y*this.#Xr.y,z:e.z*this.#Xr.z}),i={x:this.#Hr.x*n.x,y:this.#Hr.y*n.y},o=this.#Ta.offset();if(1===Math.abs(e.x)&&1===Math.abs(e.y)&&1===Math.abs(e.z)){const e={x:o.x-this.#_r.x,y:o.y-this.#_r.y};this.#_r={x:0,y:0},this.#Ta.offset(e)}else if(void 0!==t){let e=this.#xr.getPlaneOffsetFromOffset3D({x:t.getX(),y:t.getY(),z:t.getZ()});e={x:e.x+this.#Zr.x,y:e.y+this.#Zr.y};const n=Lc(o,this.#Ta.scale(),i,e),r={x:this.#_r.x+n.x-o.x,y:this.#_r.y+n.y-o.y};this.#_r=r,this.#Ta.offset(n)}this.#Ta.scale(i),this.#ba(i)}initScale(e,t){const n=this.#xr.getTargetOrientedPositiveXYZ({x:e.x*this.#Xr.x,y:e.y*this.#Xr.y,z:e.z*this.#Xr.z}),i={x:this.#Hr.x*n.x,y:this.#Hr.y*n.y};this.#Ta.scale(i),this.#_r={x:t.x/this.#Hr.x,y:t.y/this.#Hr.y};const o=this.#Ta.offset();this.#Ta.offset({x:o.x+this.#_r.x,y:o.y+this.#_r.y})}setOffset(e){const t=this.#xr.getPlaneOffsetFromOffset3D(e),n=this.#Ta.offset();this.#Ta.offset({x:n.x-this.#Jr.x+t.x,y:n.y-this.#Jr.y+t.y}),this.#Jr=t}setBaseOffset(e,t){const n=this.#xr.getNativeScrollDimIndex(),i=this.#xr.getPlaneOffsetFromOffset3D({x:0===n?e.getX():t.getX(),y:1===n?e.getY():t.getY(),z:2===n?e.getZ():t.getZ()}),o=this.#Zr.x!==i.x||this.#Zr.y!==i.y;if(o){const e=this.#Ta.offset();this.#Ta.offset({x:e.x-this.#Zr.x+i.x,y:e.y-this.#Zr.y+i.y}),this.#Zr=i}return o}display(e){this.#Fr.style.display=e?"":"none"}isVisible(){return""===this.#Fr.style.display}draw(){this.#Ta.draw()}initialise(t,n,i){this.#Br=t,this.#kr=n,this.#wa=i,this.#Ta=new e.Stage({container:this.#Fr,width:this.#Br.x,height:this.#Br.y,listening:!1}),this.#Ta.getContent().setAttribute("style","");const o=new e.Layer({listening:!1,visible:!0});this.#Ta.add(o)}setAnnotationGroup(e,t,n){if(this.#Pn=t,e.addEventListener("annotationadd",e=>{this.#xa(e.detail.data,!0),this.getKonvaLayer().draw()}),e.addEventListener("annotationupdate",e=>{this.#Ea(e.detail.data),this.getKonvaLayer().draw()}),e.addEventListener("annotationremove",e=>{this.#Ra(e.detail.data),this.getKonvaLayer().draw()}),e.addEventListener("annotationgroupeditablechange",e=>{this.activateCurrentPositionShapes(e.detail.data)}),this.#Ca=new Cc(e),0!==e.getLength())for(const t of e.getList())this.#xa(t,!1),n(new pc(t,this.getDrawController()))}activateCurrentPositionShapes(t){const n=this.getKonvaLayer(),i=this.getDrawController(),o=t&&i.getAnnotationGroup().isEditable();if(this.#Ta.listening(!1),void 0!==this.#Aa){const t=this.#Aa.getEditorShapeGroup();o&&void 0!==t&&t.getParent()===this.#Fa()||this.#Aa.disableAndResetEditor();const i=n.getChildren();for(const t of i)t instanceof e.Group&&t.getChildren().forEach(t=>{t instanceof e.Group&&this.#Aa.removeShapeListeners(t)})}if(o){this.#Ta.listening(!0);const t=this.#Fa().getChildren();0!==t.length&&n.listening(!0),void 0!==this.#Aa&&t.forEach(t=>{if(t instanceof e.Group){const e=i.getAnnotation(t.id());this.#Aa.addShapeGroupListeners(t,e,this)}})}n.draw()}#Ma(e){let t,n;if(void 0!==e.planePoints?t=e.planePoints:void 0!==e.planeOrigin&&(t=[e.planeOrigin]),void 0!==t){let i;void 0!==e.referencedFrameNumber&&(i=e.referencedFrameNumber-1),n=this.#qa(t,i)}return n}#qa(e,t){let n="";for(const t of e)0!==n.length&&(n+="-"),n+=L([h(t.getX(),2),h(t.getY(),2),h(t.getZ(),2)]);return void 0!==t&&(n+=`-${t}`),n}#Ua(t){let n;const i=this.#Ma(t),o=this.getKonvaLayer().getChildren(Ja(i));if(0!==o.length){const i=o[0];if(!(i instanceof e.Group))return;const r=i.getChildren(Ja(t.trackingUid));0!==r.length&&r[0]instanceof e.Group&&(n=r[0])}return n}#xa(t,n){if(!t.canView()||!t.isCompatibleView(this.#xr))return;const i=this.#Ma(t);let o=this.getKonvaLayer().getChildren(Ja(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 an,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.#Aa&&this.#Aa.addShapeGroupListeners(l,t,this),this.setLabelVisibility(l)}#Ra(t){const n=this.#Ua(t);return n instanceof e.Group?(n.remove(),!0):(s.debug("No shape group to remove"),!1)}#Ea(e){this.#Ra(e)&&this.#xa(e,!0)}fitToContainer(e,t,n){const i={x:t*this.#kr.x,y:t*this.#kr.y},o=i.x/this.#Hr.x,r=i.y/this.#Hr.y,a=e.x/(this.#Ta.width()*o),s=e.y/(this.#Ta.height()*r);this.#Ta.width()===e.x&&this.#Ta.height()===e.y||(this.#Ta.width(e.x),this.#Ta.height(e.y));const l={x:this.#Ta.scale().x*o,y:this.#Ta.scale().y*r};this.#Ta.scale().x===l.x&&this.#Ta.scale().y===l.y||(this.#Hr=i,this.#Ta.scale(l),this.#ba(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.#ea.x?u.x:0,y:0!==this.#ea.y?u.y:0};if(this.#Kr.x!==c.x||this.#Kr.y!==c.y||this.#ea.x!==d.x||this.#ea.y!==d.y){const e={x:this.#_r.x*a,y:this.#_r.y*s};this.#Ta.offset({x:this.#Ta.offset().x+c.x-this.#Kr.x+d.x-this.#ea.x+e.x-this.#_r.x,y:this.#Ta.offset().y+c.y-this.#Kr.y+d.y-this.#ea.y+e.y-this.#_r.y}),this.#ea=d,this.#Kr=c,this.#_r=e}}getAnnotationAt(t,n=0){const i=this.getKonvaLayer().getChildren(Ja(this.#La))[0];if(!(i instanceof e.Group&&i.isVisible()))return;const o=this.getDrawController(),r=i.getChildren().slice().reverse();for(const e of r){if(!e.isVisible())continue;const i=o.getAnnotation(e.id());if(i?.contains(t,n))return i}}isAnnotationVisible(e){const t=this.#Qa(e);return void 0!==t&&t.isVisible()}setAnnotationVisibility(e,t){const n=this.#Qa(e);return void 0!==n&&(void 0===t&&(t=!n.isVisible()),n.visible(t),this.draw(),!0)}highlightAnnotation(t,n){void 0===n&&(n=500),void 0!==this.#na&&this.#na();const i=this.#Qa(t);if(void 0===i)return!1;if(void 0!==ke.highlightAnnotation)return this.#na=ke.highlightAnnotation(i,this.getKonvaLayer(),n),!0;const o=i.opacity(),r=()=>{a.stop(),i.opacity(o),this.draw(),this.#na===r&&(this.#na=void 0)},a=new e.Animation(e=>{if(e.time>=n)return r(),!1;const t=.8*Math.sin(Math.PI*e.time/n);i.opacity(o*(1-t))},this.getKonvaLayer());return this.#na=r,a.start(),!0}setLabelsVisibility(t){this.#Oa=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.#Va(i,t)}}#Va(t,n){const i=t.getChildren(ja)[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.#Va(e,this.#Oa)}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.#Ta.listening(!0),this.#Fr.style.pointerEvents="auto";const e=gn;for(let t=0;t<e.length;++t)this.#Fr.addEventListener(e[t],this.#fa,mn(e[t]))}unbindInteraction(){this.#Ta.listening(!1),this.#Fr.style.pointerEvents="none";const e=gn;for(let t=0;t<e.length;++t)this.#Fr.removeEventListener(e[t],this.#fa)}setCurrentPosition(e,t){void 0===t&&(t=this.#xr.worldToIndex(e));const n=this.#xr.getPlanePoints(e);let i;i=this.#xr.isAquisitionOrientation()?[n[0]]:n,t.length()>3&&(this.#Pa=t.get(3));const o=this.#qa(i,this.#Pa);return this.#Na(o),this.#ga(new CustomEvent("positionchange",{detail:{value:[t.getValues(),e.getValues()],valid:!0}})),!0}#Na(e){this.#La=e;const t=this.getKonvaLayer().getChildren(Ka);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()}#Fa(){if(void 0===this.#La)return;const t=this.getKonvaLayer().getChildren(e=>e.id()===this.#La);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.#La),n.visible(!0),this.getKonvaLayer().add(n)):s.warn("Unexpected number of draw position groups"),n}#Qa(e){return this.getKonvaLayer().findOne(`#${e}`)}addEventListener(e,t){this.#ia.add(e,t)}removeEventListener(e,t){this.#ia.remove(e,t)}#ga=e=>{const t=Object.assign({},e.detail,{srclayerid:this.getId(),dataid:this.#Pn});this.#ia.fireEvent(new CustomEvent(e.type,{detail:t}))};#fa=e=>{e.srclayerid=this.getId(),e.dataid=this.#Pn,this.#ia.fireEvent(e)};#ba(e){const t=2/e.x,n=2/e.y,i=this.#Ta.find("Label");for(let e=0;e<i.length;++e)i[e].scale({x:t,y:n})}}function yc(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,""),`${e.pos}-${t}-${n}`}class Ic{#Ba=!1;#Fr;#ka;#Ga=new Map;constructor(e,t){this.#Fr=e,this.#ka=t}onDataChange=e=>{const t=e.detail?.data;if(void 0!==t){if(void 0!==e.detail?.srclayerid&&Tc(e.detail.srclayerid).groupDivId!==this.#ka)return;this.#Ba||this.#za(t),this.#Ha(t)}};#za(e){const t=this.#Fr.ownerDocument,n=[];for(const t of e){const e=t.pos;n.includes(e)||n.push(e)}for(const i of n){const n=t.createElement("ul");for(const o of e)if(o.pos===i){const e=t.createElement("li"),i=yc(o);this.#Ga.has(i)||this.#Ga.set(i,e),void 0!==o.tags&&e.appendChild(t.createTextNode(o.value)),n.appendChild(e)}const o=t.createElement("div");o.className=`info-${i} info`,o.appendChild(n),this.#Fr.appendChild(o)}this.#Ba=!0}#Ha(e){const t=this.#Fr.ownerDocument;for(const n of e){const e=this.#Ga.get(yc(n)),i=n.value;i&&e&&e.replaceChildren(t.createTextNode(i))}}}function Tc(e){const t=e.split("-layer-");return 2!==t.length&&s.warn("Not the expected layer div id format..."),{groupDivId:t[0],layerIndex:t[1],layerId:e}}function wc(e){let t=null;const n=e.target.closest(".layer");return n&&void 0!==n.id&&(t=Tc(n.id)),t}function Lc(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 Pc extends EventTarget{#Fr;#Mr;#Xa=[];#zr={x:1,y:1,z:1};#He={x:1,y:1,z:1};#jr={x:0,y:0,z:0};#Ya=void 0;#Wa=!1;#$a=[];#ja;#oa=!1;#Za;#Ka;#_a=[];#Ja;getPositionHelper(){if(void 0===this.#Za)for(const e of this.#Xa)if(e instanceof mc){const t=e.getViewController().getPositionHelper();void 0===this.#Za?this.#Za=t:this.#Za.merge(t)}return this.#Za}constructor(e,t,n){super(),this.#Fr=e,void 0===n&&(n=new Dn),this.#Mr=n;const i=e.ownerDocument;if(void 0!==t&&!0===t){const t=i.createElement("div");t.className="infoLayer",e.appendChild(t),this.#Ka=new Ic(t,e.id)}}getShowCrosshair(){return this.#Wa}setShowCrosshair(e){this.#Wa=e,e?(this.addEventListener("offsetchange",this.#es),this.addEventListener("zoomchange",this.#es),this.#ts()):(this.removeEventListener("offsetchange",this.#es),this.removeEventListener("zoomchange",this.#es),this.#ns())}setImageSmoothing(e){this.#oa=e;for(const t of this.#Xa)t instanceof mc&&t.setImageSmoothing(e)}#es=e=>{this.#ts()};getDivId(){let e;return null!==this.#Fr&&(e=this.#Fr.id),e}getScale(){return this.#zr}getBaseScale(){return this.#He}getAddedScale(){return{x:this.#zr.x/this.#He.x,y:this.#zr.y/this.#He.y,z:this.#zr.z/this.#He.z}}getOffset(){return this.#jr}getNumberOfLayers(){let e=0;return this.#Xa.forEach(t=>{void 0!==t&&e++}),e}includes(e){if(void 0===e)return!1;for(const t of this.#Xa)if(void 0!==t&&t.getId()===e)return!0;return!1}getViewLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#Xa)n instanceof mc&&e(n)&&t.push(n);return t}getViewLayersFromActive(e){void 0===e&&(e=function(){return!0});let t=0;void 0!==this.#Ya&&(t=this.#Ya);const n=[];for(let e=t;e>=0;e--)n.push(e);for(let e=this.#Xa.length-1;e>t;e--)n.push(e);const i=[];for(const t of n){const n=this.#Xa[t];n instanceof mc&&e(n)&&i.push(n)}return i}someViewLayer(e){let t=!1;for(const n of this.#Xa)if(n instanceof mc&&e(n)){t=!0;break}return t}getDrawLayers(e){void 0===e&&(e=function(){return!0});const t=[];for(const n of this.#Xa)n instanceof Dc&&e(n)&&t.push(n);return t}getNumberOfViewLayers(){let e=0;return this.#Xa.forEach(t=>{void 0!==t&&t instanceof mc&&e++}),e}getActiveLayer(){let e;return void 0!==this.#Ya&&(e=this.#Xa[this.#Ya]),e}getActiveViewLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof mc&&(e=t),e}getBaseViewLayer(){let e;for(const t of this.#Xa)if(t instanceof mc){e=t;break}return e}getViewLayerById(e){const t=this.getViewLayers(function(t){return t.getId()===e});let n;return 1===t.length&&(n=t[0]),n}getViewLayersByDataId(e){return this.getViewLayers(function(t){return t.getDataId()===e})}searchViewLayers(e){const t=structuredClone(e);let n;void 0!==t.SOPInstanceUID&&(n=t.SOPInstanceUID,delete t.SOPInstanceUID);const i=void 0!==n,o=0!==Object.keys(t).length,r=[];for(const e of this.#Xa)if(e instanceof mc){let a=!1;o&&(a=e.getViewController().equalImageMeta(t));let s=!1;i&&(s=e.getViewController().includesImageUid(n));let l=!1;o&&i?l=a&&s:o?l=a:i&&(l=s),l&&r.push(e)}return r}getViewDataIndices(){const e=[];for(const t of this.#Xa)t instanceof mc&&e.push(t.getDataId());return e}getActiveDrawLayer(){let e;const t=this.getActiveLayer();return void 0!==t&&t instanceof Dc&&(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.#Ya=e;const t=this.#Xa[e];if(void 0!==this.#Ka){let e=t;t instanceof Dc&&(e=this.getViewLayerById(t.getReferenceLayerId()));const n=e?.getDataId();void 0!==this.#_a[n]&&n!==this.#Ja&&(this.unbindInfoData(),this.bindInfoData(n))}this.dispatchEvent(new CustomEvent("activelayerchange",{detail:{value:[this.#Xa[e]]}}))}setActiveLayerById(e){let t;for(let n=0;n<this.#Xa.length;++n)if(void 0!==this.#Xa[n]&&this.#Xa[n].getId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):s.warn(`No layer to set as active with id: ${e}`)}setActiveLayerByDataId(e){let t;for(let n=0;n<this.#Xa.length;++n)if(void 0!==this.#Xa[n]&&this.#Xa[n].getDataId()===e){t=n;break}void 0!==t?this.setActiveLayer(t):s.warn(`No layer to set as active with dataId: ${e}`)}addViewLayer(){const e=this.#Xa.length,t=this.#is();this.#Fr.append(t);const n=new mc(t,this.#Mr);return n.setImageSmoothing(this.#oa),this.#Xa.push(n),this.setActiveLayer(e),this.#os(n),this.#Za=void 0,n}addDrawLayer(){this.#Ya=this.#Xa.length;const e=this.#is();this.#Fr.append(e);const t=new Dc(e);return this.#Xa.push(t),this.#rs(t),t}#os(e){e.addEventListener("positionchange",this.updateLayersToPositionChange);for(const t of sc)e.addEventListener(t,this.#ga);e.addEventListener("renderstart",this.#ga),e.addEventListener("renderend",this.#ga),e.addEventListener("basesizechange",this.#ga)}#as(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange);for(const t of sc)e.removeEventListener(t,this.#ga);e.removeEventListener("renderstart",this.#ga),e.removeEventListener("renderend",this.#ga),e.removeEventListener("basesizechange",this.#ga),e.unbindImage()}#rs(e){e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#ga),e.addEventListener("opacitychange",this.#ga)}#ss(e){e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#ga),e.removeEventListener("opacitychange",this.#ga)}addInfoData(e,t){this.#_a[t]=e}bindInfoData(e){if(void 0!==this.#Ja)return;const t=this.#_a[e];void 0!==t&&t.addEventListener("valuechange",this.#Ka.onDataChange),this.#Ja=e}unbindInfoData(){const e=this.#_a[this.#Ja];void 0!==e&&e.removeEventListener("valuechange",this.#Ka.onDataChange),this.#Ja=void 0}#is(){const e=this.#Fr.ownerDocument.createElement("div");return e.id=`${this.getDivId()}-layer-${this.#Xa.length}`,e.className="layer",e.style.pointerEvents="none",e}empty(){for(const e of this.#Xa)void 0!==e&&this.removeLayer(e);this.#Xa=[],this.#ns()}removeLayersByDataId(e){for(const t of this.#Xa)void 0!==t&&t.getDataId()===e&&this.removeLayer(t)}removeLayer(e){const t=this.#Xa.findIndex(t=>t===e);if(-1===t)throw new Error("Cannot find layer to remove");this.#Ya===t&&(this.#Ya=void 0),e instanceof mc?this.#as(e):this.#ss(e),this.#Xa[t]=void 0,this.#Za=void 0,e.removeFromDOM(),this.dispatchEvent(new CustomEvent("layerremove",{detail:{layerid:e.getId(),layergroupid:this.getDivId()}}))}#ts(){let e;this.#ns();for(const t of this.#Xa)if(t instanceof mc){e=t;break}if(void 0===e)return void s.warn("No layer to show crosshair");if(this.#ls(e))return void s.warn("Not enabling crosshair for secondary capture");const t=e.getViewController(),n=t.getCurrentPosition(),i=t.getPlanePositionFromPosition(n),o=e.planePosToDisplay(i),r=this.#Fr.ownerDocument;if(void 0!==o.getY()){const e=r.createElement("hr");e.className="horizontal",e.style.width=`${this.#Fr.offsetWidth}px`,e.style.left="0px",e.style.top=`${o.getY()}px`,this.#$a.push(e),this.#Fr.appendChild(e)}if(void 0!==o.getX()){const e=r.createElement("hr");e.className="vertical",e.style.width=`${this.#Fr.offsetHeight}px`,e.style.left=`${o.getX()}px`,e.style.top="0px",this.#$a.push(e),this.#Fr.appendChild(e)}}#ns(){for(const e of this.#$a)e.remove();this.#$a=[]}showTooltip(e){this.removeTooltipDiv();const t=this.#Fr.ownerDocument,n=this.getBaseViewLayer(),i=n.getViewController(),o=n.displayToPlanePos(e),r=i.getPositionFromPlanePoint(o),a=i.getRescaledImageValue(r);if(void 0!==a){const n=t.createElement("span");n.className="scroll-tooltip",n.style.left=`${e.getX()+10}px`,n.style.top=`${e.getY()+10}px`;let o=h(a,3).toString();void 0!==i.getPixelUnit()&&(o+=` ${i.getPixelUnit()}`),n.appendChild(t.createTextNode(o)),this.#ja=n,this.#Fr.appendChild(n)}}removeTooltipDiv(){void 0!==this.#ja&&(this.#ja.remove(),this.#ja=void 0)}isPositionInBounds(e){return this.someViewLayer(function(t){return t.getViewController().isPositionInBounds(e)})}canScroll(){return this.someViewLayer(function(e){return e.getViewController().canScroll()})}#ls(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.#ls(e)}moreThanOne(e){return this.someViewLayer(function(t){return t.getViewController().moreThanOne(e)})}hasAnyLayerWithValidPosition(){return this.someViewLayer(function(e){return e.isValidPosition()})}#cs=e=>{const t=e.detail?.dataid,n=this.#_a[t];void 0!==n&&n.onPositionChange(e)};updateLayersToPositionChange=e=>{for(const e of this.#Xa)void 0!==e&&(e.removeEventListener("positionchange",this.updateLayersToPositionChange),e.removeEventListener("positionchange",this.#ga),e.addEventListener("positionchange",this.#cs));const t=e.detail?.value,n=new a(t[0]),i=new C(t[1]),o={};let r,s;for(const t of this.#Xa){if(void 0===t)continue;let a=!1;if(t instanceof mc){const e=t.getViewController(),n=e.getOrigin(),l=e.getOrigin(i);let c,u;if(void 0===s)r=n,s=l,c=new g(0,0,0),u=new g(0,0,0);else if(e.isPositionInBounds(i)&&void 0!==l){const e=r.minus(n);c=new g(e.getX(),e.getY(),e.getZ());const t=s.minus(l);u=new g(t.getX(),t.getY(),t.getZ())}void 0!==c&&void 0!==u&&(a=t.setBaseOffset(c,u,s,r),o[t.getId()]={scroll:c,plane:u})}if(t instanceof Dc){const e=o[t.getReferenceLayerId()];void 0!==e&&(a=t.setBaseOffset(e.scroll,e.plane))}let l=!1;const c=e.detail?.srclayerid;t.getId()!==c&&(l=t.setCurrentPosition(i,n)),!l&&a&&t.draw()}const l=this.hasAnyLayerWithValidPosition();this.dispatchEvent(new CustomEvent("outofrange",{detail:{layergroupid:this.getDivId(),value:[!l]}})),this.#Wa&&this.#ts();for(const e of this.#Xa)void 0!==e&&(e.addEventListener("positionchange",this.updateLayersToPositionChange),e.addEventListener("positionchange",this.#ga),e.removeEventListener("positionchange",this.#cs))};getDivToWorldSizeRatio(){if(0===this.#Fr.offsetWidth&&0===this.#Fr.offsetHeight)throw new Error(`Cannot fit to zero sized container with id '${this.#Fr.id}'.`);const e=this.getMaxWorldSize();if(void 0!==e){if(0===this.#Fr.offsetHeight){const t=this.#Fr.offsetWidth/e.x,n=e.y*t;this.#Fr.style.height=`${n}px`}return Math.min(this.#Fr.offsetWidth/e.x,this.#Fr.offsetHeight/e.y)}}fitToContainer(e){const t=this.getMaxWorldSize();if(void 0===t)return;const n={x:this.#Fr.offsetWidth,y:this.#Fr.offsetHeight},i={x:-.5*(n.x-Math.floor(t.x*e)),y:-.5*(n.y-Math.floor(t.y*e))};for(const t of this.#Xa)void 0!==t&&t.fitToContainer(n,e,i);this.#Wa&&this.#ts()}getMaxWorldSize(){let e={x:0,y:0};for(const t of this.#Xa)if(t instanceof mc){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.#He.z*=-1,this.setScale(this.#He)}addScale(e,t){const n={x:this.#zr.x*(1+e),y:this.#zr.y*(1+e),z:this.#zr.z*(1+e)};this.setScale(n,t)}setScale(e,t){this.#zr=e;for(const e of this.#Xa)void 0!==e&&e.setScale(this.#zr,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.#jr.x-e.x,y:this.#jr.y-e.y,z:this.#jr.z-e.z})}setOffset(e){this.#jr=e;for(const e of this.#Xa)void 0!==e&&e.setOffset(this.#jr);this.dispatchEvent(new CustomEvent("offsetchange",{detail:{value:[this.#jr.x,this.#jr.y,this.#jr.z]}}))}reset(){this.setScale(this.#He),this.setOffset({x:0,y:0,z:0})}resetZoomPan(){this.setScale(this.#He),this.setOffset({x:0,y:0,z:0})}resetViews(){let e=!0;for(const t of this.#Xa)if(void 0!==t&&t instanceof mc){const n=t.getViewController();e&&(n.resetPosition(),e=!1),n.resetWindowLevel()}}draw(){for(const e of this.#Xa)void 0!==e&&e.draw()}display(e){for(const t of this.#Xa)void 0!==t&&t.display(e)}#ga=e=>{const t=null!==e.detail&&"object"==typeof e.detail?Object.assign({},e.detail):{};this.dispatchEvent(new CustomEvent(e.type,{detail:t}))}}class Ac{#us=0;add(e){this.#us+=function(e){return void 0===e.wheelDeltaY?-e.deltaY:e.wheelDeltaY>45?1:e.wheelDeltaY<-45?-1:-e.deltaY/60}(e)}getSum(){return this.#us}isTick(){return Math.abs(this.#us)>=1}clear(){this.#us=0}}class Oc extends EventTarget{#ds;#hs;#gs;#Ss;#ms=new Ac;#ps;#fs;#vs;#Cs;#Ds;#ys=!1;#Is;constructor({stageController:e,dragBehavior:t,hoverBehavior:n,wheelBehavior:i,doubleClickBehavior:o,twoTouchBehavior:r,tapBehavior:a,longTouchToDblClickMs:s=500}){super(),this.#ds=e,this.#hs=t,this.#gs=n,this.#Ss=i,this.#ps=o,this.#fs=r,this.#vs=a,this.#Cs=s}#Ts(e){return this.#ds.getLayerGroupByDivId(e)}#ws(e){const t=wc(e),n=this.#Ts(t.groupDivId);return{point:vn(e),layerGroup:n}}#Ls(e){return void 0===this.#Is||this.#Is.getDistance(e)>5}#Ps(e){const t=wc(e),n=this.#Ts(t.groupDivId);return{point:fn(e)[0],layerGroup:n}}getEventNames(){return[]}wheel=e=>{if(void 0===this.#Ss)return;e.preventDefault();const t=wc(e),n=this.#Ts(t.groupDivId);this.#Ss.onWheel(e,n),this.#ms.add(e);const i=this.#ms.getSum()>=0;this.#ms.isTick()&&(this.#ms.clear(),this.#Ss.onWheelTick(i,n))};dblclick=e=>{const{point:t,layerGroup:n}=this.#ws(e);void 0!==this.#ps?this.#ps.onDoubleClick(t,n):this.#vs?.isActive()&&this.#vs.onEnd()};#As(e,t){void 0!==this.#ps?this.#ps.onDoubleClick(e,t):this.#vs?.isActive()&&(this.#vs.onTap(e,t),this.#vs.onEnd()),this.#ys=!1,this.#Ds=void 0}cancel(){this.#ys=!1,this.#Is=void 0,this.#Os(),this.#hs?.isActive()&&this.#hs.reset(),this.#vs?.isActive()&&this.#vs.reset(),this.#fs?.isActive()&&this.#fs?.reset(),this.#gs?.reset()}mousedown=e=>{this.#hs?.isActive()&&this.#hs.reset();const{point:t,layerGroup:n}=this.#ws(e);this.#ys=!0,this.#Is=t,!this.#vs?.isActive()&&this.#hs?.canStart(t,n)&&this.#hs.onStart(t,n,{mouseDownButton:e.button})};mousemove=e=>{const{point:t,layerGroup:n}=this.#ws(e);this.#ys?(this.#gs?.onEnd(),this.#hs?.isActive()&&this.#hs.onUpdate(t,n)):(this.#vs?.isActive()&&this.#vs.onUpdate(t,n),this.#gs?.onUpdate(t,n))};mouseup=e=>{const{point:t,layerGroup:n}=this.#ws(e),i=this.#Ls(t);this.#hs?.isActive()&&(i?this.#hs.onEnd():this.#hs.reset()),this.#vs&&(this.#vs.isActive()||this.#ys&&!i)&&this.#vs.onTap(t,n),this.#ys=!1};mouseout=e=>{this.#hs?.isActive()&&this.#hs.onEnd(),this.#vs?.isActive()&&this.#vs.onEnd(),this.#gs?.onEnd(),this.#ys=!1,this.#Is=void 0};touchstart=e=>{e.preventDefault(),this.#hs?.isActive()&&this.#hs.reset(),this.#Os();const t=fn(e);if(this.#ys=!0,this.#Is=t[0],1===t.length){const{point:t,layerGroup:n}=this.#Ps(e);this.#hs?.canStart(t,n)&&this.#hs.onStart(t,n,{});const i=this.#Cs;null!=i&&i>0&&(this.#Ds=setTimeout(()=>{this.#As(t,n)},i))}else 2===t.length&&this.#fs?.onStart(t)};touchmove=e=>{this.#Os();const{point:t,layerGroup:n}=this.#Ps(e),i=fn(e);1===i.length?this.#hs?.isActive()&&this.#hs.onUpdate(t,n):2===i.length&&(this.#hs?.isActive()&&this.#hs.reset(),this.#fs?.isActive()&&this.#fs.onUpdate(i,n))};touchend=e=>{if(this.#Os(),this.#fs?.isActive())return void this.#fs.onEnd();const{point:t,layerGroup:n}=this.#Ps(e),i=this.#Ls(t);this.#hs?.isActive()&&(i?this.#hs.onEnd():this.#hs.reset()),this.#vs&&(this.#vs.isActive()||this.#ys&&!i)&&this.#vs.onTap(t,n),this.#ys=!1};touchcancel=e=>{this.cancel()};#Os(){void 0!==this.#Ds&&(clearTimeout(this.#Ds),this.#Ds=void 0)}}function bc(e){return{x:"number"==typeof e?.x?e.x:0,y:"number"==typeof e?.y?e.y:0}}class xc{#bs;#xs;constructor(e,t,{threshold:n}={}){this.#bs={x:t.getX()-e.getX(),y:t.getY()-e.getY()},this.#xs=bc(n)}get delta(){return this.#bs}passesThresholdX(){const e=this.#xs.x;return e<=0||Math.abs(this.#bs.x)>=e}passesThresholdY(){const e=this.#xs.y;return e<=0||Math.abs(this.#bs.y)>=e}passesThreshold(){return this.passesThresholdX()||this.passesThresholdY()}}class Ec extends EventTarget{#Es;#Rs;#Fs;constructor({threshold:e}={}){super(),this.setDragThreshold(e)}get startPoint(){return this.#Es}get prevPoint(){return this.#Rs}setDragThreshold(e){this.#Fs=bc(e)}isActive(){return void 0!==this.#Rs}canStart(e,t){return!0}reset(){this.#Es=void 0,this.#Rs=void 0}onStart(e,t,n){this.#Es=e,this.#Rs=e}onUpdate(e,t){const n=new xc(this.#Rs,e,{threshold:this.#Fs});n.passesThreshold()&&(this.#Rs=e,this.onDrag(n,t))}onDrag(e,t){}onEnd(){this.#Rs=void 0,this.reset()}}class Rc extends Ec{#Ms;constructor({activeViewLayerOnly:e=!0}={}){super(),this.#Ms=e}setActiveViewLayerOnly(e){this.#Ms=e}canStart(e,t){const n=Zl(t,this.#Ms);return void 0!==n&&!!n.getViewController().isMonochrome()}onDrag(e,t){const n=Zl(t,this.#Ms);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 Ut(l+r*s,c+o*s);i.setWindowLevel(u)}}class Fc extends Ec{constructor(){super({threshold:{x:15,y:15}})}canStart(e,t){return void 0!==Kl(t)||(s.warn("No view layer to start scroll"),!1)}onDrag(e,t){const n=t.getPositionHelper();e.passesThresholdY()&&t.canScroll()?e.delta.y>0?n.decrementPositionAlongScroll():n.incrementPositionAlongScroll():e.passesThresholdX()&&t.moreThanOne(3)&&(e.delta.x>0?n.incrementPosition(3):n.decrementPosition(3))}}class Mc extends Ec{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 qc extends Ec{onDrag(e,t){const n=Kl(t);if(void 0===n)return void s.warn("No view layer to update pan drag behavior");const i=n.getViewController(),o=n.displayToPlaneScale(new S(e.delta.x,e.delta.y)),r=i.getOffset3DFromPlaneOffset({x:o.getX(),y:o.getY()});t.addTranslation({x:r.getX(),y:r.getY(),z:r.getZ()}),t.draw()}}class Uc{onDoubleClick(e,t){}}class Qc extends Uc{#qs;#Ms;constructor({dataController:e,activeViewLayerOnly:t=!0}){super(),this.#qs=e,this.#Ms=t}setActiveViewLayerOnly(e){this.#Ms=e}onDoubleClick(e,t){const n=Zl(t,this.#Ms);if(void 0===n)return;const i=n.displayToPlaneIndex(e),o=n.getViewController();if(!o.isMonochrome())return;const r=this.#qs.get(n.getDataId()).image,a=new Ut(r.getRescaledValueAtIndex(o.getCurrentIndex().getWithNew2D(i.get(0),i.get(1))),o.getWindowLevel().width);o.setWindowLevel(a)}}class Vc extends Uc{onDoubleClick(e,t){const n=Kl(t);void 0!==n?n.getViewController().play():s.warn("No view layer to play double click behavior")}}class Nc{reset(){}onUpdate(e,t){}onEnd(){this.reset()}}class Bc extends Nc{#Us=!1;#Qs;constructor({tooltipEnabled:e=!1}={}){super(),this.#Us=e}setTooltipEnabled(e){this.#Us=e}reset(){void 0!==this.#Qs&&(this.#Qs.removeTooltipDiv(),this.#Qs=void 0)}onUpdate(e,t){this.#Us&&this.#Vs(e,t)}#Vs(e,t){this.#Qs=t,t.showTooltip(e)}}class kc extends EventTarget{#un=[];#Ns=1;setNumberOfTaps(e){this.#un=[],this.#Ns=e}isActive(){return 0!==this.#un.length}reset(){this.#un=[]}getPointList(){return this.#un.slice()}onUpdate(e,t){}onTap(e,t){this.#un.push(e),this.#un.length===this.#Ns&&this.onEnd()}onEnd(){this.#un=[],this.reset()}}class Gc extends kc{onTap(e,t){super.onTap(e,t);const n=Kl(t);if(void 0===n)return void s.warn("No view layer to set current position");const i=n.getViewController(),o=n.displayToPlanePos(e),r=i.getPositionFromPlanePoint(o);i.setCurrentPosition(r),this.dispatchEvent(new CustomEvent("tap",{detail:{position:r.getValues(),annotations:this.#Bs(e,t),segments:this.#ks(e,t)}}))}#Bs(e,t){const n=[];for(const i of t.getDrawLayers()){if(!i.isVisible())continue;const o=t.getViewLayerById(i.getReferenceLayerId());if(void 0===o)continue;const r=o.displayToPlanePos(e),a=o.displayToPlaneScale(new S(5,5)).getX(),s=i.getAnnotationAt(r,a);void 0!==s&&n.push({annotationid:s.trackingUid,dataid:i.getDataId()})}return n}#ks(e,t){const n=[],i=t.getViewLayers(e=>e.isVisible()&&e.getViewController().isMask());for(const t of i){const i=t.getViewController(),o=t.displayToPlanePos(e),r=i.getPositionFromPlanePoint(o),a=i.getSegmentNumbersAtPosition(r);0!==a.length&&n.push({dataid:t.getDataId(),segmentnumbers:a})}return n}}class zc{isActive(){return!1}reset(){}onStart(e){}onUpdate(e,t){return!1}onEnd(){this.reset()}}class Hc extends zc{#Gs;#zs;isActive(){return void 0!==this.#Gs}reset(){this.#Gs=void 0,this.#zs=void 0}onStart(e){this.#Gs=new Hr(e[0],e[1]),this.#zs=this.#Gs.getCentroid()}onUpdate(e,t){if(void 0===this.#Gs)return!1;const n=new Hr(e[0],e[1]).getLength()/this.#Gs.getLength(),i=t.getPositionHelper();if(1===n){const n=e[0].getY()-this.#Gs.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.#zs){const n=Kl(t);if(void 0===n)return s.warn("No view layer to do touch zoom behavior"),!0;const i=n.getViewController(),o=n.displayToMainPlanePos(this.#zs),r=i.getPlanePositionFromPlanePoint(o);t.addScale(e,r),t.draw()}}return!0}onEnd(){this.#Gs=void 0,this.reset()}}function Xc(e,t){const n=t.getActiveDrawLayer();if(void 0===n)return s.warn("No draw layer to check point"),!1;const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return s.warn("No view layer to check point"),!1;const o=i.displayToPlanePos(e);return i.getViewController().validatePlanePoint(o)}class Yc{#An;#Hs;#Xs;#Ys;#Ws;#$s;#js;#Zs;#Ks;#_s=!1;constructor(e){this.#An=e,this.#Hs=e.getStyle()}setOptions(e){this.#Xs=e}setFeatures(e){if(void 0!==e.autoShapeColour&&(this.#_s=e.autoShapeColour),void 0!==e.shapeColour&&(this.#Hs.setLineColour(e.shapeColour),this.#_s=!1),void 0!==e.refMetaValidator&&(this.#js=e.refMetaValidator),void 0!==e.annotationGroupMeta&&(this.#Zs=e.annotationGroupMeta),void 0!==e.annotationMeta&&(this.#Ks=e.annotationMeta),void 0!==e.shapeName){if(!this.hasShape(e.shapeName))throw new Error(`Unknown shape: '${e.shapeName}'`);this.#Ys=e.shapeName,void 0!==this.#Xs&&(this.#Ws=new this.#Xs[this.#Ys])}}hasShape(e){return void 0!==this.#Xs?.[e]}tryBeginPlacement(e){let t=e.getActiveDrawLayer();return void 0===t&&this.#Js(e)&&this.#el(e)&&(t=this.#tl(e)),!(void 0===t||!this.#nl())}#nl(){return!(!this.#Xs||!this.#Ys)||(s.warn("DrawPreview: missing factory list or shape name"),!1)}getNPoints(){let e=0;return void 0!==this.#Ws&&(e=this.#Ws.getNPoints()),e}resetPlacement(){if(this.#$s){const e=this.#$s.getLayer();this.#$s.destroy(),this.#$s=void 0,e.draw()}}#Js(e){let t=!0;const n=this.#js;if(void 0!==n){const i=e.getActiveViewLayer().getDataId();t=n(this.#An.getDataController().get(i).image.getMeta())}return t}#el(e){const t=e.getBaseViewLayer().getDataId();return!this.#An.getDataController().get(t).image.isResampled()}getCannotCreateReason(e){let t;return this.#Js(e)||(t="reference data is invalid"),this.#el(e)||(t="base data is invalid"),t}#tl(e){const t=e.getActiveViewLayer().getDataId(),n=this.#An.createAnnotationData(t),i=this.#Zs;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.#Hs.setZoomScale(r.scale()),o}#il(e){if(this.#_s){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.#Hs.setLineColour(o)}}#ol(e,t){const n=t.getActiveDrawLayer(),i=n.getDrawController(),o=t.getViewLayerById(n.getReferenceLayerId());if(void 0===o)return void s.warn("No view layer to handle new points");const r=o.getViewController(),a=new Js,l=i.getAnnotationGroup().getColour();a.colour=void 0!==l?l:this.#Hs.getLineColour(),a.init(r);const c=this.#Ks;if(void 0!==c)for(const e of c)a.addMetaItem(e.concept,e.value);const u=e.map(e=>o.displayToPlanePos(e));return this.#Ws.setAnnotationMathShape(a,u),a}onNewPoints(e,t){this.#$s&&(this.#$s.destroy(),this.#$s=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void s.warn("No draw layer to handle new points");const i=n.getKonvaLayer();this.#il(n);const o=this.#ol(e,t);void 0!==o&&(this.#$s=this.#Ws.createShapeGroup(o,this.#Hs),n.setLabelVisibility(this.#$s),this.#$s.getChildren(Za)[0].listening(!1),i.listening(!1),i.add(this.#$s),i.draw())}onFinalPoints(e,t){this.#$s&&(this.#$s.destroy(),this.#$s=void 0);const n=t.getActiveDrawLayer();if(void 0===n)return void s.warn("No draw layer to handle final points");const i=n.getKonvaLayer(),o=n.getDrawController(),r=this.#ol(e,t);if(void 0===r)return;const a=new pc(r,o);this.#An.getUndoController().addToUndoStack(a),a.execute(),i.listening(!0)}}class Wc extends kc{#rl;#al;#sl;#ll;constructor(e,t){super(),this.#sl=new Yc(e),this.#ll=t}setOptions(e){this.#sl.setOptions(e)}setFeatures(e){this.#sl.setFeatures(e),this.#ll.setFeatures(e)}hasShape(e){return this.#sl.hasShape(e)}#cl(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ll.checkCanEdit(n)?this.#ll.trySelectShapeGroup(e,n):(this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:"Cannot edit draw, data meta is invalid"}})),!1))}#ul(){const e=this.#sl.getNPoints();void 0===e?super.setNumberOfTaps(65535):super.setNumberOfTaps(e)}resetPlacement(){this.#sl.resetPlacement(),super.onEnd()}#dl(e){const t=this.getPointList();return t.length>0&&t[t.length-1].equals(e)}onUpdate(e,t){if(!this.isActive())return;if(this.#dl(e))return;if(!Xc(e,t))return;this.#rl=e,this.#al=t;const n=this.getPointList();n.push(e),this.#sl.onNewPoints(n,t)}onTap(e,t){if(!this.isActive()){if(this.#cl(e,t))return;if(!this.#sl.tryBeginPlacement(t)){const e=this.#sl.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#ll.disableAndResetEditor(),this.#ul()}if(this.#dl(e))return;this.#al=t,super.onTap(e,t);const n=this.getPointList();n.length>1&&this.#sl.onNewPoints(n,t)}onEnd(){const e=this.getPointList(),t=this.#al,n=this.#sl.getNPoints();e.length>0&&t&&(void 0!==n?e.length===n?this.#sl.onFinalPoints(e,t):e.length!==n-1||void 0===this.#rl||this.#dl(this.#rl)?this.#sl.resetPlacement():(e.push(this.#rl),this.#sl.onFinalPoints(e,t)):e.length>2?this.#sl.onFinalPoints(e,t):this.#sl.resetPlacement()),this.#rl=void 0,this.#al=void 0,super.onEnd()}}class $c extends Ec{#ll;#rl;#al;#sl;constructor(e,t){super(),this.#ll=t,this.#sl=new Yc(e)}setOptions(e){this.#sl.setOptions(e)}setFeatures(e){this.#sl.setFeatures(e)}resetPlacement(){this.#sl.resetPlacement(),super.onEnd()}#hl(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.#sl.getNPoints()}onStart(e,t,n){if(!this.isActive()){const n=t.getActiveDrawLayer();if(void 0!==n&&this.#hl(e,n))return;if(!this.#sl.tryBeginPlacement(t)){const e=this.#sl.getCannotCreateReason(t);return void this.dispatchEvent(new CustomEvent("warn",{detail:{type:"warn",message:`Cannot create draw, ${e}`}}))}this.#ll.disableAndResetEditor()}this.#al=t,super.onStart(e,t,n)}onDrag(e,t){if(!this.isActive())return;if(!Xc(this.prevPoint,t))return;this.#rl=this.prevPoint,this.#al=t;const n=[this.startPoint,this.#rl];this.#sl.onNewPoints(n,t)}onEnd(){const e=this.#al;if(e&&void 0!==this.#rl){const t=[this.startPoint,this.#rl];this.#sl.onFinalPoints(t,e)}this.#rl=void 0,this.#al=void 0,super.onEnd()}}class jc{#An;#Aa;#et=[];#gl;#Sl;constructor(e,t){this.#An=e,this.#Aa=t}setFeatures(e){void 0!==e.drawMetaValidator&&(this.#Sl=e.drawMetaValidator)}disableAndResetEditor(){this.#Aa.disableAndResetEditor()}checkCanEdit(e){return this.#ml(e)}#ml(e){let t=!0;const n=this.#Sl;if(void 0!==n){const i=e.getDataId();t=n(this.#An.getDataController().get(i).annotationGroup.getMeta())}return t}#hl(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}#pl(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.#Aa.setEditorShape(o,n),!0)}trySelectShapeGroup(e,t){const n=this.#hl(e,t);return void 0!==n&&this.#pl(n,t)}#fl(e){const t=e.getId();return void 0===this.#et[t]&&(this.#et[t]=()=>{e.activateCurrentPositionShapes(!0)}),this.#et[t]}#vl(){return e=>{const t=e.detail?.layerid,n=this.#An.getStageController().getDrawLayers(function(e){return e.getId()===t});1===n.length&&this.#Cl(n[0],!0)}}#Dl(){void 0===this.#gl&&(this.#gl=this.#vl(),this.#An.addEventListener("drawlayeradd",this.#gl))}#yl(){void 0!==this.#gl&&(this.#An.removeEventListener("drawlayeradd",this.#gl),this.#gl=void 0)}#Cl(e,t){e.setShapeHandler(this.#Aa),e.activateCurrentPositionShapes(t),t?this.#An.addEventListener("positionchange",this.#fl(e)):this.#An.removeEventListener("positionchange",this.#fl(e))}activate(e){e||this.#Aa.onMouseOutShapeGroup();const t=this.#An.getStageController().getDrawLayers();for(const n of t)void 0!==n&&this.#Cl(n,e);e?this.#Dl():this.#yl()}}class Zc{#An;#Il;constructor(e,t){this.#An=e,this.#Il=t}#Ws;#Tl;#wl;#va;#Ll=!1;setShape(e,t,n){if(this.#Tl=e,this.#wl=t,this.#va=n,void 0!==this.#Tl){if(this.#Pl(),this.#Ws=n.getFactory(),void 0===this.#Ws)throw new Error("Could not find a factory to update shape.");this.#Al()}}getShape(){return this.#Tl}getAnnotation(){return this.#va}isActive(){return this.#Ll}enable(){this.#Ll=!0,void 0!==this.#Tl&&(this.#Ol(!0),this.#Tl.getLayer()&&this.#Tl.getLayer().draw())}disable(){this.#Ll=!1,void 0!==this.#Tl&&(this.#Ol(!1),this.#Tl.getLayer()&&this.#Tl.getLayer().draw())}reset(){this.#Tl=void 0,this.#wl=void 0,this.#va=void 0}resetAnchors(){this.#Pl(),this.#Al(),this.#Ol(!0)}#bl(e){void 0!==this.#Tl&&this.#Tl.getParent()&&this.#Tl.getParent().find(".anchor").forEach(e)}#Ol(e){this.#bl(function(t){t.visible(e)})}setAnchorsActive(e){let t;t=e?e=>{this.#xl(e)}:e=>{this.#El(e)},this.#bl(t)}#Pl(){this.#bl(function(e){e.remove()})}#Al(){if(void 0===this.#Tl||!this.#Tl.getLayer())return;if(void 0===this.#Ws)return;const e=this.#Tl.getParent(),t=this.#Ws.getAnchors(this.#va,this.#An.getStyle());for(let n=0;n<t.length;++n)this.#xl(t[n]),e.add(t[n])}#xl(t){let n;t.on("dragstart.edit",e=>{e.cancelBubble=!0,n={mathShape:this.#va.mathShape,referencePoints:this.#va.referencePoints}}),t.on("dragmove.edit",t=>{const n=t.target;n instanceof e.Shape&&void 0!==this.#Ws&&(function(e,t){const n=t.getParent();!function(e,t,n){let i=!1;e.x()<t.getX()?(e.x(t.getX()),i=!0):e.x()>n.getX()&&(e.x(n.getX()),i=!0),e.y()<t.getY()?(e.y(t.getY()),i=!0):e.y()>n.getY()&&(e.y(n.getY()),i=!0)}(t,new S(-n.x(),-n.y()),new S(e.x-n.x(),e.y-n.y()))}(this.#wl.getBaseSize(),n),void 0!==this.#Ws.constrainAnchorMove&&this.#Ws.constrainAnchorMove(n,this.#va),this.#Ws.updateAnnotationOnAnchorMove(this.#va,n),this.#Ws.updateShapeGroupOnAnchorMove(this.#va,n,this.#An.getStyle()),n.getLayer()?n.getLayer().draw():s.warn("No layer to draw the anchor!"),t.cancelBubble=!0)}),t.on("dragend.edit",t=>{const i=t.target;if(!(i instanceof e.Shape))return;this.#Ws?.onAnchorMoveEnd(i,this.#va);const o={mathShape:this.#va.mathShape,referencePoints:this.#va.referencePoints},r=new vc(this.#va,n,o,this.#wl.getDrawController());this.#An.getUndoController().addToUndoStack(r),this.#Il({type:"annotationupdate",data:this.#va,dataid:this.#wl.getDataId(),keys:Object.keys(o)}),n={mathShape:o.mathShape,referencePoints:o.referencePoints},t.cancelBubble=!0}),t.on("mousedown touchstart",e=>{e.target.moveToTop()}),t.on("mouseover.edit",t=>{const n=t.target;n instanceof e.Shape&&(n.stroke("#ddd"),n.getLayer()?n.getLayer().draw():s.warn("No layer to draw the anchor!"))}),t.on("mouseout.edit",t=>{const n=t.target;n instanceof e.Shape&&(n.stroke("#999"),n.getLayer()?n.getLayer().draw():s.warn("No layer to draw the anchor!"))})}#El(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 Kc{#Rl;constructor(){this.createTrashIcon()}createTrashIcon(){this.#Rl=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.#Rl.width(20),this.#Rl.height(20),this.#Rl.add(t),this.#Rl.add(n)}activate(e){const t=e.getKonvaStage(),n=t.scale(),i=e.getKonvaLayer(),o={x:1/n.x,y:1/n.y};this.#Rl.x(t.offset().x+t.width()/(2*n.x)),this.#Rl.y(t.offset().y+t.height()/(15*n.y)),this.#Rl.scale(o),i.add(this.#Rl),i.draw()}changeChildrenColourOnTrashHover(e,t,n){if(this.isOverTrash(e))return this.changeGroupChildrenColour(this.#Rl,"orange"),void this.changeGroupChildrenColour(t,"red");this.changeGroupChildrenColour(this.#Rl,"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.#Rl.remove()}isOverTrash(e){const t=this.#Rl.width()*Math.abs(this.#Rl.scaleX())/2,n=this.#Rl.height()*Math.abs(this.#Rl.scaleY())/2;return Math.abs(e.x-this.#Rl.x())<t&&Math.abs(e.y-this.#Rl.y())<n}}class _c extends EventTarget{#An;#Fl;#Rl;#Ml="pointer";#ql;#Ul;#Ql;#Il=e=>{this.dispatchEvent(new CustomEvent(e.type,{detail:e}))};constructor(e){super(),this.#An=e,this.#Fl=new Zc(e,this.#Il),this.#Rl=new Kc}setEditorShape(t,n){const i=n.getDrawController();if(t&&t instanceof e.Shape&&t!==this.#Fl.getShape()&&i.isAnnotationGroupEditable()){this.#Fl.disable();const e=t.getParent().id();this.#Fl.setShape(t,n,i.getAnnotation(e)),this.#Il({type:"annotationselect",annotationid:e,dataid:n.getDataId()}),this.#Fl.enable()}}getEditorShapeGroup(){let t;if(!this.#Fl.isActive()||(t=this.#Fl.getShape().getParent(),t instanceof e.Group))return t}getEditorAnnotation(){let e;return this.#Fl.isActive()&&(e=this.#Fl.getAnnotation()),e}disableAndResetEditor(){this.#Fl.disable(),this.#Fl.reset()}#Vl(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.#Ml=e}#Nl(){const e=this.#Ql.getStage();e&&(this.#Ul=e.container(),this.#ql=this.#Ul.style.cursor,this.#Ul.style.cursor=this.#Ml),this.#Ql.opacity(.75)}onMouseOutShapeGroup(){void 0!==this.#Ul&&(this.#Ul.style.cursor=this.#ql,this.#Ul=void 0,this.#ql=void 0),void 0!==this.#Ql&&this.#Ql.opacity(1)}#Bl(e){e.on("mouseover",()=>{this.#Ql=e,this.#Nl()}),e.on("mouseout",()=>{this.onMouseOutShapeGroup(),this.#Ql=void 0})}#kl(e){e.off("mouseover"),e.off("mouseout")}addShapeGroupListeners(e,t,n){this.#Bl(e),this.#Gl(e,t,n),this.#zl(e,t,n),e.on("dblclick",()=>{const e=t.textExpr,i=t=>{const i=t.textExpr,o=new vc(t,{textExpr:e},{textExpr:i},n.getDrawController());this.#An.getUndoController().addToUndoStack(o),o.execute()};void 0!==ke.openRoiDialog?ke.openRoiDialog(t,i):function(e,t){const n=prompt("Label",e.textExpr);null!==n&&(e.textExpr=n,t(e))}(t,i)})}#Gl(t,n,i){const o=i.getKonvaLayer(),r=t.getChildren(Za)[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.#Rl.activate(i),this.#Fl.setAnchorsActive(!1),o.draw()}),r.on("dragmove.draw",e=>{const a=function(e,t){return{min:new S(0,0),max:new S(e.x-Math.abs(t.width()),e.y-Math.abs(t.height()))}}(i.getBaseSize(),r);if(a&&!function(e,t,n){const i=e.getClientRect({relativeTo:e.getParent()});return i.x>t.getX()&&i.x<n.getX()&&i.y>t.getY()&&i.y<n.getY()}(r,a.min,a.max))return r.x(s.x),void r.y(s.y);const l={x:e.target.x()-s.x,y:e.target.y()-s.y},u=t.getChildren(),d=void 0===n.labelPosition;for(const t of u)t===e.target||"label"===t.name()&&!d||"connector"===t.name()||t.move(l);s={x:e.target.x(),y:e.target.y()};const h=n.getFactory();if(void 0===h)throw new Error("Cannot follow drag move without factory");h.updateAnnotationOnTranslation(n,l),h.updateLabelContent(n,t,this.#An.getStyle()),h.updateConnector(n,t);const g=vn(e.evt),m={x:g.getX(),y:g.getY()},p=this.#Vl(m,i);this.#Rl.changeChildrenColourOnTrashHover(p,t,c),o.draw()}),r.on("dragend.draw",e=>{const s=this.#An.getUndoController();if(this.#Rl.remove(),void 0===e||void 0===e.evt)return;const u=r.x(),d=r.y(),h=vn(e.evt),g={x:h.getX(),y:h.getY()},S=this.#Vl(g,i);if(this.#Rl.isOverTrash(S)){t.x(a.x),t.y(a.y),this.#Fl.disable(),this.#Fl.reset(),this.#Rl.changeGroupChildrenColour(t,c),n.mathShape=l.mathShape,n.referencePoints=l.referencePoints;const e=new fc(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 vc(n,l,e,i.getDrawController());s.addToUndoStack(t),this.#Il({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:Object.keys(e)}),l={mathShape:e.mathShape,referencePoints:e.referencePoints}}this.#Fl.setAnchorsActive(!0),this.#Fl.resetAnchors()}o.draw(),a={x:r.x(),y:r.y()}})}#zl(t,n,i){const o=t.getChildren(ja)[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 S(o.x(),o.y());n.labelPosition=t;const r=new vc(n,{labelPosition:a},{labelPosition:t},i.getDrawController());e.addToUndoStack(r),this.#Il({type:"annotationupdate",data:n,dataid:i.getDataId(),keys:["labelPosition"]}),a=t}r={x:o.x(),y:o.y()}})}removeShapeListeners(t){this.#kl(t),t.off("dblclick");const n=t.getChildren(Za)[0];n instanceof e.Shape&&(n.draggable(!1),n.off("dragstart.draw"),n.off("dragmove.draw"),n.off("dragend.draw"));const i=t.getChildren(ja)[0];i instanceof e.Label&&(i.draggable(!1),i.off("dragstart.draw"),i.off("dragend.draw"))}}class Jc{mask;dataId;offsetsLists;mode;segmentNumber;srclayerid;originalValuesLists;isSilent}class eu extends ys{#jt;#Pn;#Hl;#Xl;#Yl;#Wl;#$l;#jl;#Zl;#Kl;constructor(e){super(),this.#jt=e.mask,this.#Pn=e.dataId,this.#Hl=e.offsetsLists,this.#Xl=e.mode,this.#Yl=e.segmentNumber,this.#Wl=e.srclayerid,void 0!==e.originalValuesLists&&(this.#$l=e.originalValuesLists),this.#jl=e.isSilent??!1,this.#Zl="del"===this.#Xl?"brushremove":"brushdraw",this.#Kl="brushdraw"===this.#Zl?"brushremove":"brushdraw"}getOriginalValuesLists(){return this.#$l}getExecuteEvent(){const e="brushdraw"===this.#Zl?this.#Yl:void 0;return new CustomEvent(this.#Zl,{detail:{segmentnumber:e,dataid:this.#Pn,srclayerid:this.#Wl}})}getName(){return"Draw-brush"}execute(){if(void 0===this.#Yl)return;let e=this.#Yl;"brushremove"===this.#Zl&&(e=0),void 0===this.#$l?this.#$l=this.#jt.setAtOffsetsAndGetOriginals(this.#Hl,e):this.#jt.setAtOffsetsWithIterator(this.#Hl,e),this.#jl||this.onExecute(this.getExecuteEvent())}undo(){void 0===this.#$l?this.#$l=this.#jt.setAtOffsetsAndGetOriginals(this.#Hl,0):this.#jt.setAtOffsetsWithIterator(this.#Hl,this.#$l);const e="brushdraw"===this.#Kl?this.#Yl:void 0,t=new CustomEvent(this.#Kl,{detail:{segmentnumber:e,dataid:this.#Pn,srclayerid:this.#Wl}});this.onUndo(t)}onExecute(e){}onUndo(e){}}const tu="No source image to create mask",nu="No source image to get offsets, ID: {0}",iu="No brush origins",ou="No mask defined when adding mask slices",ru="No created mask image",au="No mask image for temporary draw command, ID: {0}",su="No mask image to get offsets from",lu="No mask image for draw command, ID: {0}",cu="No mask ID to apply mask index",uu="No mask view layers",du="No selected segment number",hu="Too many mask view layers: {0}",gu="More mask layers than expected",Su="Cannot display mask with no mask ID",mu="Cannot draw with no mask data ID",pu="Cannot draw with no offsets",fu="Cannot draw with no colour list",vu="Cannot get mask layers with no mask ID",Cu="Cannot get mask view controller: no mask ID",Du="Cannot get mask view controller: no mask layers",yu="Cannot find source data for an existing mask, ID: {0}",Iu="Unsupported scroll index: {0}";function Tu(e,...t){return e.replace(/{(\d+)}/g,(e,n)=>t[n]||"")}const wu="del";function Lu(e,t,n,i){return ta(e.worldToIndex(t),n,i)}class Pu extends EventTarget{#An;#_l=10;#Jl={min:1,max:20};#ec="del";#tc;#jt;#nc;#Qs;#ic=0;#oc;#rc;constructor(e){super(),this.#An=e.app}#ac(e){const t=this.#Jl.min,n=this.#Jl.max;return Math.min(Math.max(e,t),n-1)}getBrushSize(){return this.#_l}getBrushMode(){return this.#ec}getSelectedSegmentNumber(){return this.#tc}setBrushMode(e){this.setFeatures({brushMode:e})}setFeatures(e){if(void 0!==e.brushSizeRange&&(this.#Jl=e.brushSizeRange,this.#_l=this.#ac(this.#_l)),void 0!==e.brushSize&&(this.#_l=this.#ac(e.brushSize)),void 0!==e.brushSizeAdd){const t=this.#ac(this.#_l+e.brushSizeAdd);if(t!==this.#_l){this.#_l=t;const e=new CustomEvent("brushsizechange",{detail:{value:this.#_l}});this.dispatchEvent(e)}}void 0!==e.brushMode&&(this.#ec=e.brushMode),void 0!==e.selectedSegmentNumber&&(this.#tc=e.selectedSegmentNumber),e.createMask?this.#nc=void 0:void 0!==e.maskDataId&&(this.#nc=e.maskDataId)}#sc(e,t,n,i=!1){const o=e.getSize().getValues().slice(0,3);o[2]=1;const r=new Dt(o),a=new tt(e.getSpacing().getValues().slice(0,3)),s=new Lt([t],r,a,e.getOrientation()),l=new Uint8Array(r.getDimSize(2));l.fill(0),++this.#ic;const c=[this.#ic.toString()],u=i?new tr(s,l,c):new Ht(s,l,c);return u.setMeta(n),u.setPhotometricInterpretation("PALETTE COLOR"),u.setPaletteColourMap(new rr([0],[0],[0])),u}#lc(e,t,n,i,o,r){const l=function(e,t){const n=t.sort(function(e,t){let n=0;const i=e.get(2),o=t.get(2);return void 0!==i&&void 0!==o&&(n=i-o),n});const i=n[0].get(2);if(void 0===i)return[];const o=new a([0,0,i]),r=e.indexToWorld(o),l=n.at(-1).get(2);if(void 0===l)return[];const c=new a([0,0,l]),u=e.indexToWorld(c),d=e.getOrigins(),h=.1*e.getSpacing().get(2),g=r.get3D().getClosest(d),S=d[g],m=r.get3D().getDistance(S);m>h&&s.warn(`Large distance between origin and origin for first index: ${m}`);const p=u.get3D().getClosest(d),f=d[p],v=u.get3D().getDistance(f);return v>h&&s.warn(`Large distance between origin and origin for last index: ${v}`),[g,p]}(e,Lu(e,n,o,i));if(void 0===l||0===l.length)throw new Error(iu);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.#jt)throw new Error(ou);const m=this.#jt.getMeta();for(const e of S)m.sliceCapacity+=1,this.#jt.appendSlice(this.#sc(t,e,r))}#cc(e,t){if(!t)throw new Error(Tu(tu));const n=t.getGeometry(),i=n.worldToIndex(e).get(2);if(void 0===i)throw new Error("Z position is undefined");const o=new a([0,0,i]),r=n.getOrigins()[i],l=ur(),c=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}]}}}();l.DimensionOrganizationSequence=c.organizations,l.DimensionIndexSequence=c.indices,l.PixelRepresentation=0,l.sliceCapacity=1;const u=t.getMeta();l.PatientID=u.PatientID,l.StudyInstanceUID=u.StudyInstanceUID,l.SeriesInstanceUID=u.SeriesInstanceUID,void 0===u.FrameOfReferenceUID&&s.warn("Mask source image has no FrameOfReferenceUID."),l.FrameOfReferenceUID=u.FrameOfReferenceUID;const d=[{referencedSOPClassUID:u.SOPClassUID,referencedSOPInstanceUID:t.getImageUid(o)}],h=[];h.push({ReferencedInstanceSequence:{value:d},SeriesInstanceUID:u.SeriesInstanceUID}),l.ReferencedSeriesSequence={value:h},l.custom={referencedSeriesUID:u.SeriesInstanceUID,frameInfos:[{dimIndex:[1,1],refSegmentNumber:1,imagePosPat:r.getValues(),derivationImages:[{sourceImages:d}]}]},l.lengthUnit=t.getMeta().lengthUnit,this.#jt=this.#sc(n,r,l,!0);const g=Hi(l),S=new Tl(g);S.image=this.#jt;const m=this.#An.getDataController(),p=m.getNextDataId();if(!m.add(p,S))throw new Error("Cannot add mask data");return p}#uc(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}#dc(e){if(void 0===this.#nc)throw new Error(Su);const t=new Gu(e);t.orientation=this.#uc(e);const n=this.#An.getStageController();n.addDataViewConfig(this.#nc,t),n.render(this.#nc)}#hc(e){const t=e.getMaskReferencedSeriesUID();let n;return"undefined"!==t&&(n=this.#An.getDataController().getDataIdFromSeriesUid(t)),void 0===n&&s.warn(Tu(yu,t)),n}#gc(e){if(void 0===this.#nc)throw new Error(vu);const t=e.getViewLayersByDataId(this.#nc);if(0===t.length)throw new Error(uu);return 1!==t.length&&s.warn(Tu(hu,t.length)),t[0]}#Sc(e){if(void 0===e)throw new Error(cu);const t=this.#An.getDataController().get(e);if(void 0===t)throw new Error(su);return t.image}#mc(e,t){if(void 0===t)throw new Error("No layergroup to get mask offsets");let n;if(this.#Qs=t,n=void 0===this.#nc?t.getBaseViewLayer():t.getViewLayersByDataId(this.#nc)[0],void 0===n)return[];const i=n.getViewController(),o=i.getCurrentPosition();let r,a,l,c;if(i.equalImageMeta({Modality:"SEG"})||i.equalImageMeta({Modality:"RTSTRUCT"})){this.#jt=this.#Sc(this.#nc);const t=this.#hc(this.#jt),o=this.#An.getDataController().get(t);if(!o)throw new Error(Tu(nu,t));if(c=o.image,c.isResampled())return s.warn("Cannot update mask with resampled reference image."),[];const u=this.#An.getStageController().getViewLayersByDataId(t)[0],d=u.getViewController(),h=u.displayToPlanePos(e);l=d.getPositionFromPlanePoint(h),r=n,a=i}else{const u=n.getDataId(),d=this.#An.getDataController().get(u);if(!d)throw new Error(Tu(nu,u));if(c=d.image,c.isResampled())return s.warn("Cannot create mask on resampled image."),[];const h=n.displayToPlanePos(e);if(l=i.getPositionFromPlanePoint(h),this.#nc=this.#cc(o,c),void 0===this.#jt)throw new Error(ru);const g=t.getDivId(),S=void 0!==g;S&&this.#dc(g),r=this.#gc(t),a=r.getViewController(),S&&a.setCurrentPosition(o)}const u=c.getGeometry(),d=this.#jt.getMeta(),h=this.#jt.getGeometry(),g=i.get2DSpacing(),S=[Math.round(this.#_l/g.x),Math.round(this.#_l/g.y)];let m;const p=i.getScrollDimIndex();switch(p){case 0:m=[1,2];break;case 1:m=[0,2];break;case 2:m=[0,1];break;default:throw new Error(Tu(Iu,p))}this.#lc(u,h,l,m,S,d);const f=r.displayToPlanePos(e);return function(e,t){const n=e.getSize(),i=[];for(const e of t){const t=n.indexToOffset(e);t>=0&&i.push(t)}return i.sort(function(e,t){return e-t})}(h,Lu(h,a.getPositionFromPlanePoint(f),S,m))}#pc(e){const t=this.#fc().getId();if(void 0===this.#nc)throw new Error(cu);const n=this.#An.getDataController().get(this.#nc);if(!n)throw new Error(Tu(au,this.#nc));const i=new Jc;i.mask=n.image,i.dataId=this.#nc,i.offsetsLists=[e],i.mode=this.#ec,i.segmentNumber=this.#tc,i.srclayerid=t;const o=new eu(i);o.execute();const r=o.getOriginalValuesLists();if(void 0!==r)return r[0]}beginStroke(e,t){this.#oc=[],this.#rc=[];const n=this.#mc(e,t);if(n.length>0){this.#oc.push(n);const e=this.#pc(n);return void 0!==e&&this.#rc.push(e),!0}return!1}paintStep(e,t){const n=this.#mc(e,t);if(n.length>0){this.#oc.push(n);const e=this.#pc(n);void 0!==e&&this.#rc.push(e)}}finalizeStroke(){if(void 0===this.#nc)throw new Error(mu);if(void 0===this.#oc)throw new Error(pu);if(void 0===this.#rc)throw new Error(fu);this.#oc.reverse(),this.#rc.reverse();const e=this.#fc().getId(),t=this.#An.getDataController().get(this.#nc);if(!t)throw new Error(Tu(lu,this.#nc));const n=new Jc;n.mask=t.image,n.dataId=this.#nc,n.offsetsLists=this.#oc,n.mode=this.#ec,n.segmentNumber=this.#tc,n.srclayerid=e,n.originalValuesLists=this.#rc;const i=new eu(n);i.onExecute=e=>{this.dispatchEvent(e)},i.onUndo=e=>{this.dispatchEvent(e),this.#jt.recalculateLabels()},this.#An.getUndoController().addToUndoStack(i),this.dispatchEvent(i.getExecuteEvent()),this.#jt.recalculateLabels()}#fc(){if(void 0===this.#nc)throw new Error(Cu);if(void 0===this.#Qs)throw new Error("No current layer group");const e=this.#Qs.getViewLayersByDataId(this.#nc);if(0===e.length)throw new Error(Du);return 1!==e.length&&s.warn(gu),e[0]}}const Au=["brushsizechange","brushdraw","brushremove"];class Ou extends Ec{#An;#vc;#Cc=!1;#Dc=[];constructor(e){super(),this.#An=e,this.#vc=new Pu({app:e});for(const e of Au)this.#vc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}setFeatures(e){void 0!==e.blacklist&&(this.#Dc=e.blacklist),this.#vc.setFeatures(e)}canStart(e,t){return!(!this.#yc(t)||this.#Ic(t)||(this.#Ht(t)?(s.warn("Cannot paint on series with overlapping slices"),1):void 0===this.#vc.getSelectedSegmentNumber()&&(s.warn(du),1)))}onStart(e,t,n){super.onStart(e,t,n);const i=this.#vc.getBrushSize()/2;this.setDragThreshold({x:i,y:i}),this.#Cc=!1,2===n?.mouseDownButton&&this.#Tc(),this.#vc.beginStroke(e,t)||(this.#wc(),super.onEnd())}onDrag(e,t){const n=this.prevPoint;void 0!==n&&this.#vc.paintStep(n,t)}onEnd(){this.isActive()&&(this.#vc.finalizeStroke(),this.#wc()),super.onEnd()}reset(){this.isActive()&&(this.#vc.finalizeStroke(),this.#wc()),super.reset()}#yc(e){if(void 0===e)throw new Error("No layergroup to check for view layer");return e.getActiveLayer()instanceof mc}#Ic(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.#Dc.includes(n))return!0}return!1}#Ht(e){if(void 0===e)throw new Error("No layergroup to check for overlap");const t=e.getActiveViewLayer();if(void 0===t)throw new Error("No viewlayer to check for overlap");const n=t.getDataId(),i=this.#An.getDataController().get(n);return i.image instanceof tr&&i.image.getHasOverlap()}#Tc(){this.#Cc=!0,this.#vc.setBrushMode(wu),this.dispatchEvent(new CustomEvent("erasingactivated"))}#wc(){this.#Cc&&this.#vc.getBrushMode()===wu&&(this.#vc.setBrushMode("add"),this.dispatchEvent(new CustomEvent("erasingdeactivated"))),this.#Cc=!1}}class bu extends Ec{#An;#va;#Lc;#Pc;#Ac=[];#Oc;#bc=10;#xc=5;#Ec=0;#Rc=2e3;#Fc=[];#Hs;#ll;constructor(e,t,n){super(),this.#An=e,this.#Hs=t,this.#ll=n}setFeatures(e){this.#ll.setFeatures(e)}#Mc(e){const t=e.getActiveDrawLayer();if(void 0!==t)return e.getViewLayerById(t.getReferenceLayerId());s.warn("No draw layer to do floodfill")}#qc=(e,t)=>{const n=this.#Mc(t);if(void 0===n)return void s.warn("No view layer to get index");const i=n.displayToPlaneIndex(e);return{x:i.get(0),y:i.get(1)}};#Uc(e,t,i){this.#Fc=[];const o={data:this.#Pc?.data,width:this.#Pc?.width,height:this.#Pc?.height,bytes:4},r=n.floodFill(o,e.x,e.y,t),a=n.gaussBlurOnlyBorder(r,this.#xc);let s=n.traceContours(a);if(s=n.simplifyContours(s,this.#Ec,this.#Rc),s.length>0&&s[0].points[0].x){if(i)return s[0].points;for(let e=0,t=s[0].points.length;e<t;e++)this.#Fc.push(new S(s[0].points[e].x,s[0].points[e].y));return this.#Fc}return[]}#Qc(e,t,n){if(this.#Ac=this.#Uc(e,t,!1),0!==this.#Ac.length){const e=n.getActiveDrawLayer();if(void 0===e)return s.warn("No draw layer to paint border"),!1;const t=e.getDrawController(),i=new _r(this.#Ac);let o;if(void 0===this.#va){this.#va=new Js,this.#va.colour=this.#Hs.getLineColour();const r=n.getViewLayerById(e.getReferenceLayerId());if(void 0===r)return s.warn("No view layer to paint border"),!1;const a=r.getViewController();this.#va.init(a),this.#va.mathShape=i,o=new pc(this.#va,t)}else{const e=this.#va.mathShape;o=new vc(this.#va,{mathShape:e},{mathShape:i},t)}this.#An.getUndoController().addToUndoStack(o),o.execute()}return 0!==this.#Ac.length}#Vc(e){const t=e.getBaseViewLayer().getDataId();return this.#An.getDataController().get(t).image.isResampled()}#cl(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ll.checkCanEdit(n)?this.#ll.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.#Vc(t))return;if(!this.isActive()&&this.#cl(e,t))return;let i;this.#va=void 0;let o=t.getActiveDrawLayer();if(void 0===o){i=t.getActiveViewLayer();const e=i.getDataId(),n=this.#An.createAnnotationData(e),r=t.getDivId().replace("-layer-0","");this.#An.addAndRenderAnnotationData(n,r,e),o=t.getActiveDrawLayer(),o.getKonvaLayer().listening(!0),t.setActiveLayerByDataId(o.getDataId())}else if(i=t.getViewLayerById(o.getReferenceLayerId()),void 0===i)return void s.warn("No view layer to start floodfill");this.#Pc=i.getImageData(),void 0!==this.#Pc?(this.#Hs.setZoomScale(o.getKonvaLayer().getAbsoluteScale()),this.#Lc=this.#qc(e,t),this.#Qc(this.#Lc,this.#bc,t),super.onStart(e,t,n)):s.error("No image info found")}onUpdate(e,t){if(!this.isActive())return;const n=this.#qc(e,t);this.#Oc=Math.round(Math.sqrt(Math.pow(this.#Lc.x-n.x,2)+Math.pow(this.#Lc.y-n.y,2))/2),this.#Oc=this.#Oc<this.#bc?this.#bc:this.#Oc-this.#bc,this.#Qc(this.#Lc,this.#Oc,t),super.onUpdate(e,t)}}class xu{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 Eu{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 Ru=2/(3*Math.PI);function Fu(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 Mu{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++){Fu(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};Fu(e,t,n,i,a),Fu(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),Ru*(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}#Nc=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 Eu(this.searchGranBits,this.#Nc),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 qu extends kc{#An;#Hs;#Es;#va;#Bc=new xu;#kc=new xu;#Fc=[];#Gc=5;#zc=new Mu;#ll;constructor(e,t,n){super(),this.#An=e,this.#Hs=t,this.#ll=n,super.setNumberOfTaps(500)}setFeatures(e){this.#ll.setFeatures(e)}#Hc(e){const t=e.get(1);for(let e=0;e<t;++e)this.#Fc[e]=[]}#Xc(){this.#Bc=new xu,this.#kc=new xu}#Vc(e){const t=e.getBaseViewLayer().getDataId();return this.#An.getDataController().get(t).image.isResampled()}#cl(e,t){const n=t.getActiveDrawLayer();return void 0!==n&&(this.#ll.checkCanEdit(n)?this.#ll.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.#Vc(t))return;if(!this.isActive()&&this.#cl(e,t))return;let n,i=t.getActiveDrawLayer();n=void 0===i?t.getActiveViewLayer():t.getViewLayerById(i.getReferenceLayerId());const o=n.getViewController().getImageSize();this.#zc.setDimensions(o.get(0),o.get(1)),this.#zc.setData(n.getImageData().data);const r=n.displayToPlaneIndex(e);if(this.isActive()){const e=Math.abs(r.get(0)-this.#Es.getX()),t=Math.abs(r.get(1)-this.#Es.getY());if(e<this.#Gc&&t<this.#Gc)this.onEnd();else{this.#Bc=this.#kc,this.#Hc(o);const e={x:r.get(0),y:r.get(1)};this.#zc.doTraining(e),this.#Bc.addControlPoint(this.#kc.getPoint(0))}}else{if(this.#va=void 0,this.#Es=new S(r.get(0),r.get(1)),this.#Xc(),this.#Hc(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.#Hs.setZoomScale(i.getKonvaLayer().getAbsoluteScale());const e={x:r.get(0),y:r.get(1)};this.#zc.doTraining(e);const a=new S(r.get(0),r.get(1));this.#Bc.addPoint(a),this.#Bc.addControlPoint(a)}super.onTap(e,t)}onUpdate(e,t){if(!this.isActive())return;const n=t.getActiveDrawLayer();if(void 0===n)return void s.warn("No draw layer to update livewire");const i=t.getViewLayerById(n.getReferenceLayerId());if(void 0===i)return void s.warn("No view layer to update livewire");const o=i.displayToPlaneIndex(e);let r,a={x:o.get(0),y:o.get(1)};this.#zc.setPoint(a);let l=!1;for(;!this.#Fc[a.y][a.x]&&!l;)if(r=this.#zc.doWork(),0===r.length)l=!0;else for(let e=0;e<r.length-1;e+=2){const t=r[e],n=r[e+1];this.#Fc[t.y][t.x]=n}for(this.#kc=new xu,l=!1;a&&!l;)this.#kc.addPoint(new S(a.x,a.y)),this.#Fc[a.y]&&this.#Fc[a.y][a.x]?a=this.#Fc[a.y][a.x]:l=!0;this.#kc.appenPath(this.#Bc);const c=n.getDrawController(),u=new _r(this.#kc.pointArray);let d;if(void 0===this.#va){this.#va=new Js,this.#va.colour=this.#Hs.getLineColour();const e=i.getViewController();this.#va.init(e),this.#va.mathShape=u,d=new pc(this.#va,c)}else{const e=this.#va.mathShape;d=new vc(this.#va,{mathShape:e},{mathShape:u},c)}this.#An.getUndoController().addToUndoStack(d),d.execute(),super.onUpdate(e,t)}reset(){this.#va=void 0,this.#Xc(),this.#Fc=[],super.reset()}}const Uu={},Qu={WindowLevel:class extends Oc{#An;#hs;#ps;constructor(e){const t=new Rc,n=new Qc({dataController:e.getDataController()});super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new Jl,doubleClickBehavior:n}),this.#An=e,this.#hs=t,this.#ps=n}keydown=e=>{e.context="WindowLevel",this.#An.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){void 0!==e.strictViewLayer&&(s.warn("strictViewLayer is deprecated, use activeViewLayerOnly instead"),this.#hs.setActiveViewLayerOnly(e.strictViewLayer),this.#ps.setActiveViewLayerOnly(e.strictViewLayer)),void 0!==e.activeViewLayerOnly&&(this.#hs.setActiveViewLayerOnly(e.activeViewLayerOnly),this.#ps.setActiveViewLayerOnly(e.activeViewLayerOnly))}},Scroll:class extends Oc{#An;#Yc;constructor(e){const t=new Bc,n=new Gc;super({stageController:e.getStageController(),dragBehavior:new Fc,hoverBehavior:t,wheelBehavior:new Jl,doubleClickBehavior:new Vc,tapBehavior:n}),this.#An=e,this.#Yc=t;for(const e of this.getEventNames())n.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{e.context="Scroll",this.#An.onKeydown(e)};activate(e){e||this.cancel()}setFeatures(e){void 0!==e.displayTooltip&&this.#Yc.setTooltipEnabled(Boolean(e.displayTooltip))}init(){}getEventNames(){return["tap"]}},ZoomAndPan:class extends Oc{#An;constructor(e){const t=new Gc;super({stageController:e.getStageController(),dragBehavior:new qc,wheelBehavior:new ec,twoTouchBehavior:new Hc,tapBehavior:t}),this.#An=e;for(const e of this.getEventNames())t.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{e.context="ZoomAndPan",this.#An.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}getEventNames(){return["tap"]}},Opacity:class extends Oc{#An;constructor(e){super({stageController:e.getStageController(),dragBehavior:new Mc,wheelBehavior:new Jl}),this.#An=e}keydown=e=>{e.context="Opacity",this.#An.onKeydown(e)};activate(e){e||this.cancel()}init(){}setFeatures(e){}},Draw:class extends Oc{#An;#ll;#Wc;#$c;#Aa;constructor(e){const t=new _c(e),n=new jc(e,t),i=new Wc(e,n),o=new $c(e,n);super({stageController:e.getStageController(),dragBehavior:o,tapBehavior:i,wheelBehavior:new Jl}),this.#An=e,this.#ll=n,this.#Wc=o,this.#$c=i,this.#Aa=t;for(const e of this.getEventNames())this.#Wc.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}),this.#$c.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))}),this.#Aa.addEventListener(e,t=>{const n=t;this.dispatchEvent(new CustomEvent(e,{detail:n.detail}))})}keydown=e=>{this.#$c.isActive()||(e.context="Draw",this.#An.onKeydown(e));const t=this.#Aa.getEditorAnnotation();if(("Delete"===e.key||"Backspace"===e.key)&&void 0!==t){const e=this.#An.getStageController().getActiveLayerGroup().getActiveDrawLayer();if(void 0===e)return void s.warn("No draw layer to handle key down");const n=e.getDrawController(),i=this.#An.getUndoController(),o=new fc(t,n);i.addToUndoStack(o),o.execute(),this.#Aa.onMouseOutShapeGroup()}"Escape"===e.key&&(this.cancel(),this.#ll.disableAndResetEditor())};cancel(){this.#Wc.resetPlacement(),this.#$c.resetPlacement(),super.cancel()}activate(e){e||this.cancel(),this.#ll.activate(e)}setOptions(e){this.#Wc.setOptions(e),this.#$c.setOptions(e)}getOptionsType(){return"factory"}setFeatures(e){void 0!==e.mouseOverCursor&&this.#Aa.storeMouseOverCursor(e.mouseOverCursor),this.#Wc.setFeatures(e),this.#$c.setFeatures(e)}init(){}getEventNames(){return["annotationupdate","annotationselect","warn"]}hasShape(e){return this.#$c.hasShape(e)}},Brush:class extends Oc{#jc;#An;constructor(e){const t=new Ou(e);super({stageController:e.getStageController(),dragBehavior:t,wheelBehavior:new Jl,longTouchToDblClickMs:null}),this.#jc=t,this.#An=e;for(const e of this.getEventNames())this.#jc.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.#jc.setFeatures({brushMode:wu}):this.#jc.setFeatures({brushMode:"add"})):this.#jc.setFeatures({brushSizeAdd:-1}):this.#jc.setFeatures({brushSizeAdd:1})};contextmenu=e=>{e.preventDefault()};activate(e){e||this.cancel()}setFeatures(e){this.#jc.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:ws,Floodfill:class extends Oc{#An;#ll;#hs;#Hs=new an;constructor(e){const t=new an,n=new _c(e),i=new jc(e,n),o=new bu(e,t,i);super({stageController:e.getStageController(),dragBehavior:o,wheelBehavior:new Jl}),this.#An=e,this.#ll=i,this.#hs=o,this.#Hs=t}keydown=e=>{e.context="Floodfill",this.#An.onKeydown(e),"Escape"===e.key&&this.#ll.disableAndResetEditor()};activate(e){if(e){const e=this.#An.getStageController().getActiveLayerGroup();this.#Hs.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#Hs.getLineColour()})}else this.cancel();this.#ll.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#Hs.setLineColour(e.shapeColour),this.#hs.setFeatures(e)}},Livewire:class extends Oc{#An;#ll;#vs;#Hs;constructor(e){const t=new an,n=new _c(e),i=new jc(e,n),o=new qu(e,t,i);super({stageController:e.getStageController(),tapBehavior:o,wheelBehavior:new Jl}),this.#An=e,this.#ll=i,this.#vs=o,this.#Hs=t}keydown=e=>{e.context="Livewire",this.#An.onKeydown(e),"Escape"===e.key&&this.#ll.disableAndResetEditor()};activate(e){if(e){const e=this.#An.getStageController().getActiveLayerGroup();this.#Hs.setBaseScale(e.getBaseScale()),this.setFeatures({shapeColour:this.#Hs.getLineColour()})}else this.cancel();this.#ll.activate(e)}init(){}setFeatures(e){void 0!==e.shapeColour&&this.#Hs.setLineColour(e.shapeColour),this.#vs.setFeatures(e)}}};const Vu={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("manual"!==i[2]&&e.getWindowLevelPresetsNames().includes(i[2]))e.setWindowLevelPreset(i[2]);else{const t=new Ut(i[0],i[1]);e.setWindowLevel(t)}}}}},PositionBinder:class{getEventType=function(){return"positionchange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value,o=t.detail?.diffDims,r=e.getViewLayersByDataId(n);let a,s=!1;if(0!==r.length?(a=r[0],s=!0):a=e.getBaseViewLayer(),s&&function(e){return Array.isArray(e)&&0===e.length}(o))return;if(void 0===a)return;const l=a.getViewController();let c=!1;if(!s){const e=t.target?.getViewLayersByDataId(n)[0]?.getViewController();c=void 0===e||!l.canSyncVolume(e,i[1][3])}l.setCurrentPosition(function(e,t,n,i){const o=[...t],r=e.getCurrentPosition();if(function(e){return Array.isArray(e)&&0!==e.length&&e.every(e=>e>=3)}(i))for(let e=0;e<3;++e)o[e]=r.get(e);else if(!e.moreThanOne(e.getScrollDimIndex())){const t=e.getPositionFromPlanePoint(e.getPlanePositionFromPosition(new C(o)));for(let e=0;e<3;++e)o[e]=t.get(e)}return n&&o.length>3&&r.length()>3&&(o[3]=r.get(3)),new C(o)}(l,i[1],c,o))}}},ZoomBinder:class{getEventType=function(){return"zoomchange"};getCallback=function(e){return function(t){const n=t.detail?.value,i={x:n[0],y:n[1],z:n[2]};let o;6===n.length&&(o=new m(n[3],n[4],n[5])),e.setScale(i,o),e.draw()}}},OffsetBinder:class{getEventType=function(){return"offsetchange"};getCallback=function(e){return function(t){const n=t.detail?.value;e.setOffset({x:n[0],y:n[1],z:n[2]}),e.draw()}}},OpacityBinder:class{getEventType=function(){return"opacitychange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value;if(void 0===n)return;const o=e.getViewLayersByDataId(n),r=e.getBaseViewLayer();0!==o.length&&r!==o[0]&&(o[0].setOpacity(i),o[0].draw())}}},ColourMapBinder:class{getEventType=function(){return"colourmapchange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value,o=e.getViewLayersByDataId(n);0!==o.length&&o[0].getViewController().setColourMap(i[0])}}},MaskViewBinder:class{getEventType=function(){return"maskviewchange"};getCallback=function(e){return function(t){const n=t.detail?.dataid,i=t.detail?.value,o=e.getViewLayersByDataId(n);0!==o.length&&(o[0].setFillOpacity(i[0]),o[0].setContourThickness(i[1]))}}}};class Nu{#Zc=[];#Kc;#oa=!1;#Mr=new Dn;#_c=[];#et=null;getLayerGroup(e){return this.#Zc[e]}getNumberOfLayerGroups(){return this.#Zc.length}getActiveLayerGroup(){return this.getLayerGroup(this.#Kc)}setActiveLayerGroup(e){void 0!==this.getLayerGroup(e)?this.#Kc=e:s.warn(`No layer group to set as active with index: ${e}`)}getViewLayersByDataId(e){let t=[];for(const n of this.#Zc)t=t.concat(n.getViewLayersByDataId(e));return t}getViewLayers(e){let t=[];for(const n of this.#Zc)t=t.concat(n.getViewLayers(e));return t}getDrawLayersByDataId(e){let t=[];for(const n of this.#Zc)t=t.concat(n.getDrawLayersByDataId(e));return t}getDrawLayers(e){let t=[];for(const n of this.#Zc)t=t.concat(n.getDrawLayers(e));return t}addLayerGroup(e,t){this.#Kc=this.#Zc.length;const n=new Pc(e,t,this.#Mr);n.setImageSmoothing(this.#oa);const i=this.#et&&0!==this.#et.length;return i&&this.unbindLayerGroups(),this.#Zc.push(n),i&&this.bindLayerGroups(),n}getLayerGroupByDivId(e){return this.#Zc.find(function(t){return t.getDivId()===e})}setBinders(e){if(null==e)throw new Error("Cannot set null or undefined binders");0!==this.#_c.length&&this.unbindLayerGroups(),this.#_c=e.slice(),this.bindLayerGroups()}empty(){this.unbindLayerGroups();for(const e of this.#Zc)e.empty();this.#Zc=[],this.#Kc=void 0}removeLayersByDataId(e){for(const t of this.#Zc)t.removeLayersByDataId(e)}removeLayerGroup(e){const t=this.#Zc.findIndex(t=>t===e);if(-1===t)throw new Error("Cannot find layerGroup to remove");this.unbindLayerGroups(),e.empty(),this.#Zc.splice(t,1),this.#Kc===t&&(this.#Kc=void 0),this.bindLayerGroups()}reset(){for(const e of this.#Zc)e.reset()}resetZoomPan(){for(const e of this.#Zc)e.resetZoomPan()}resetViews(){for(const e of this.#Zc)e.resetViews()}draw(){for(const e of this.#Zc)e.draw()}fitToContainer(){let e;const t=[];for(let n=0;n<this.#Zc.length;++n){const i=this.#Zc[n].getDivToWorldSizeRatio();void 0!==i&&this.#Zc[n].shouldBind()&&(t.push(n),(void 0===e||i<e)&&(e=i))}for(let n=0;n<this.#Zc.length;++n)if(t.includes(n)&&this.#Zc[n].shouldBind())this.#Zc[n].fitToContainer(e);else{const e=this.#Zc[n].getDivToWorldSizeRatio();this.#Zc[n].fitToContainer(e)}}bindLayerGroups(){if(0!==this.#Zc.length&&1!==this.#Zc.length&&0!==this.#_c.length){this.#et=new Array(this.#Zc.length);for(let e=0;e<this.#Zc.length;++e)if(this.#Zc[e].shouldBind())for(let t=0;t<this.#_c.length;++t)this.#Jc(e,this.#_c[t])}}unbindLayerGroups(){if(0!==this.#Zc.length&&0!==this.#_c.length&&this.#et){for(let e=0;e<this.#Zc.length;++e)if(this.#Zc[e].shouldBind())for(let t=0;t<this.#_c.length;++t)this.#eu(e,this.#_c[t]);this.#et=null}}setImageSmoothing(e){this.#oa=e;for(const t of this.#Zc)t.setImageSmoothing(e)}#tu(e,t){if(!this.#et)return;void 0===this.#et[t]&&(this.#et[t]=[]);let n=this.#et[t].find(function(t){return t.binder===e});return void 0===n&&(n={binder:e,callback:n=>{this.#eu(t,e),e.getCallback(this.#Zc[t])(n),this.#Jc(t,e)}},this.#et[t].push(n)),n.callback}#Jc(e,t){for(let n=0;n<this.#Zc.length;++n)n!==e&&this.#Zc[n].shouldBind()&&this.#Zc[e].addEventListener(t.getEventType(),this.#tu(t,n))}#eu(e,t){if(this.#et)for(const n in this.#et)if(parseInt(n,10)!==e)for(const i of this.#et[n])i.binder.getEventType()===t.getEventType()&&this.#Zc[e].removeEventListener(t.getEventType(),i.callback)}}const Bu=["viewlayeradd","drawlayeradd","error","zoomchange","offsetchange","layerremove","outofrange","renderstart","renderend",...sc];class ku extends EventTarget{#nu=null;#qs;#co;#iu;#ou;#ru;constructor(e,t){super(),this.#qs=e,this.#co=t,this.#nu=new Nu,void 0!==t.binders&&this.#nu.setBinders(t.binders)}setToolboxController(e){this.#iu=e}setAddToUndoStack(e){this.#ou=e}setGetInfoData(e){this.#ru=e}getViewConfigs(e,t){if(void 0===t&&(t=!1),null===this.#co.dataViewConfigs||void 0===this.#co.dataViewConfigs)throw new Error("No available data view configuration");let n=[];return void 0!==this.#co.dataViewConfigs[e]?n=this.#co.dataViewConfigs[e]:t||void 0===this.#co.dataViewConfigs["*"]||(n=this.#co.dataViewConfigs["*"]),n}getViewConfig(e,t,n){return this.getViewConfigs(e,n).find(function(e){return e.divId===t})}getDataViewConfigs(){return this.#co.dataViewConfigs}setDataViewConfigs(e){this.#nu.empty(),this.#co.dataViewConfigs=e,this.#au(e)}addDataViewConfig(e,t,n){void 0===n&&(n=!0);const i=this.#co.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.#co.dataViewConfigs[e].push(t),void 0===this.#nu.getLayerGroupByDivId(t.divId)&&this.#su(t),void 0!==this.#qs.get(e)&&n&&this.render(e,[t])}removeDataViewConfig(e,t){const n=this.#co.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.#nu.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.#nu.removeLayerGroup(o)}}updateDataViewConfig(e,t,n){const i=this.#co.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.#nu.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.#qs.get(e)&&this.render(e,[r])}getActiveLayerGroup(){return this.#nu.getActiveLayerGroup()}setActiveLayerGroup(e){this.#nu.setActiveLayerGroup(e)}getLayerGroup(e){return this.#nu.getLayerGroup(e)}getNumberOfLayerGroups(){return this.#nu.getNumberOfLayerGroups()}getViewLayersByDataId(e){return this.#nu.getViewLayersByDataId(e)}getViewLayers(e){return this.#nu.getViewLayers(e)}getDrawLayersByDataId(e){return this.#nu.getDrawLayersByDataId(e)}getDrawLayers(e){return this.#nu.getDrawLayers(e)}getLayerGroupByDivId(e){return this.#nu.getLayerGroupByDivId(e)}getAddedScale(){return this.#nu.getActiveLayerGroup().getAddedScale()}getBaseScale(){return this.#nu.getActiveLayerGroup().getBaseScale()}getOffset(){return this.#nu.getActiveLayerGroup().getOffset()}empty(){this.#nu.empty()}removeLayersByDataId(e){this.#nu.removeLayersByDataId(e)}setBinders(e){this.#nu.setBinders(e)}fitToContainer(){this.#nu.fitToContainer()}draw(){this.#nu.draw()}resetLayout(){this.#nu.reset(),this.#nu.draw()}resetZoomPan(){this.#nu.resetZoomPan(),this.#nu.draw()}resetViews(){this.#nu.resetViews()}setImageSmoothing(e){this.#nu.setImageSmoothing(e),this.#nu.draw()}zoom(e,t,n){const i=this.#nu.getActiveLayerGroup(),o=i.getBaseViewLayer().getViewController().getCurrentScrollPosition(),r=new m(t,n,o);i.addScale(e,r),i.draw()}translate(e,t){const n=this.#nu.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.#qs.get(e),i=void 0!==n&&void 0!==n.image,o=void 0!==n&&void 0!==n.annotationGroup;if(0===this.#nu.getNumberOfLayerGroups()&&this.#au(this.#co.dataViewConfigs),void 0===t&&(t=this.getViewConfigs(e)),0!==t.length)for(let n=0;n<t.length;++n){const r=t[n],a=this.#nu.getLayerGroupByDivId(r.divId);if(!a)throw new Error(`No layer group for ${r.divId}`);!i||this.#lu(e,a)?(i&&0===a.getViewLayersByDataId(e).length?this.#cu(e,r):o&&0===a.getDrawLayersByDataId(e).length&&this.#uu(e,r),a.draw()):this.dispatchEvent(new CustomEvent("error",{detail:{error:new Error("Render error: incompatible geometries for overlay"),dataid:e}}))}else s.info(`Not rendering data: ${e} (no data view config)`)}#du=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#au(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.#su(t),n.push(t.divId))}}}#su(e){const t=this.#co.rootDocument.getElementById(e.divId),n=void 0!==this.#co.overlayConfig,i=this.#nu.addLayerGroup(t,n);this.#hu(i)}#hu(e){e.addEventListener("zoomchange",this.#du),e.addEventListener("offsetchange",this.#du),e.addEventListener("layerremove",this.#du),e.addEventListener("outofrange",this.#du),e.addEventListener("renderstart",this.#du),e.addEventListener("renderend",this.#du),e.addEventListener("basesizechange",()=>{this.#nu.fitToContainer()});for(const t of sc)e.addEventListener(t,this.#du);e.addEventListener("wlchange",e=>{const t=e.detail?.srclayerid,n=e.detail?.dataid,i=e.detail?.value,o=Tc(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=Tc(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=Tc(t).groupDivId,r=this.getViewConfig(n,o,!0);void 0!==r&&(r.colourMap=i[0])})}#lu(e,t){let n=!1;const i=t.getBaseViewLayer();if(void 0!==i){const t=this.#qs.get(i.getDataId()).image,o=this.#qs.get(e).image;if(void 0!==t&&void 0!==o){const e=t.getGeometry().getOrientation();n=o.getGeometry().getOrientation().isSimilar(e,1e-4)}}else n=!0;return n}#cu(e,t){const n=this.#qs.get(e);if(!n)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const i=this.#nu.getLayerGroupByDivId(t.divId);if(!i)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const o=n.image.getGeometry();this.#nu.unbindLayerGroups();const r=(new rc).create(n.meta,n.image),a=Je(o.getOrientation(),t.orientation),s=_e(o.getOrientation(),a);r.setOrientation(s),n.image instanceof tr&&(n.image.initializeContour(),void 0!==t.fillOpacity&&r.setFillOpacity(t.fillOpacity),void 0!==t.contourThickness&&r.setContourThickness(t.contourThickness));const l=0===i.getNumberOfViewLayers();let c=1;void 0!==t.opacity?c=t.opacity:l||(c=r.isMask()?.8:.5);const u=i.addViewLayer();u.setView(r,e);const d=o.getSize(s).get2D(),h=o.getSpacing(s).get2D();u.initialise(d,h,c);const g=u.getViewController();if(void 0!==t.wlPresetName)g.setWindowLevelPreset(t.wlPresetName);else if(void 0!==t.windowCenter&&void 0!==t.windowWidth){const e=new Ut(t.windowCenter,t.windowWidth);g.setWindowLevel(e)}void 0!==t.colourMap?g.setColourMap(t.colourMap):l||("PT"===n.image.getMeta().Modality?g.setColourMap("hot"):g.setColourMap("rainbow")),this.#qs.addEventListener("dataimageset",u.onimageset),l&&void 0!==this.#co.overlayConfig&&void 0!==this.#ru&&(i.addInfoData(this.#ru(e),e),i.bindInfoData(e));const S=[g.getCurrentIndex().getValues(),g.getCurrentPosition().getValues()];i.updateLayersToPositionChange(new CustomEvent("positionchange",{detail:{value:S,srclayerid:u.getId()}})),this.#nu.fitToContainer(),u.setOffset(i.getOffset());const m=et(o.getOrientation(),a,u.getViewController().getPlaneHelper().getTargetOrientation());if(this.#gu(m,u),l)u.setScale(i.getScale());else{const e=i.getBaseViewLayer();u.initScale(i.getScale(),e.getAbsoluteZoomOffset())}this.#nu.bindLayerGroups(),this.#iu&&this.#iu.bindLayerGroup(i,u),this.dispatchEvent(new CustomEvent("viewlayeradd",{detail:{layerid:u.getId(),layergroupid:i.getDivId(),dataid:e}})),l&&this.#iu&&this.#iu.init()}#uu(e,t){const n=this.#nu.getLayerGroupByDivId(t.divId);if(!n)throw new Error(`Cannot initialise layer with missing group, id: ${t.divId}`);const i=this.#qs.get(e);if(!i)throw new Error(`Cannot initialise layer with missing data, id: ${e}`);const o=i.annotationGroup,r=this.#Su(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.#nu.unbindLayerGroups();const s=r.getViewController();i.annotationGroup.setViewController(s);const l=this.#qs.get(a);if(!l)throw new Error(`Cannot initialise layer without reference data, id: ${a}`);const c=l.image.getGeometry(),u=Je(c.getOrientation(),t.orientation),d=_e(c.getOrientation(),u),h=c.getSize(d).get2D(),g=c.getSpacing(d).get2D(),S=n.addDrawLayer();S.initialise(h,g,r.getId());const m=new dc(c,d);S.setPlaneHelper(m);const p=[s.getCurrentIndex().getValues(),s.getCurrentPosition().getValues()];n.updateLayersToPositionChange(new CustomEvent("positionchange",{detail:{value:p,srclayerid:S.getId()}})),this.#nu.fitToContainer(),S.setOffset(n.getOffset());const f=et(c.getOrientation(),u,m.getTargetOrientation());this.#gu(f,S),S.initScale(n.getScale(),r.getAbsoluteZoomOffset()),S.setAnnotationGroup(i.annotationGroup,e,this.#ou),S.setCurrentPosition(s.getCurrentPosition(),s.getCurrentIndex()),this.#nu.bindLayerGroups(),this.#iu&&this.#iu.bindLayerGroup(n,S),this.dispatchEvent(new CustomEvent("drawlayeradd",{detail:{layerid:S.getId(),layergroupid:n.getDivId(),dataid:e}}))}#Su(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}#gu(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 Gu{divId;orientation;colourMap;opacity;fillOpacity;contourThickness;wlPresetName;windowCenter;windowWidth;constructor(e){this.divId=e}}class zu{options;constructor(e){this.options=e}}class Hu{dataViewConfigs;tools;binders;viewOnFirstLoadItem;defaultCharacterSet;overlayConfig;rootDocument;constructor(e){this.dataViewConfigs=e}}class Xu extends EventTarget{#co=null;#qs=null;#iu=null;#mu=null;#ds=null;#pu=null;#Hs=new an;#_a={};getDataController(){return this.#qs}getData(e){return s.debug("App.getData: deprecated since v0.37, please use via app.getDataController."),this.#qs.get(e)}getImage(e){let t;return s.debug("App.getImage: deprecated since v0.34, please use the getData method."),void 0!==this.#qs.get(e)&&(t=this.#qs.get(e).image),t}setImage(e,t){s.debug("App.setImage: deprecated since v0.37, please use via app.getDataController."),this.#qs.setImage(e,t)}getNextDataId(){return s.debug("App.getNextDataId: deprecated since v0.37, please use via app.getDataController."),this.#qs.getNextDataId()}addData(e,t){return s.debug("App.addData: deprecated since v0.37, please use via app.getDataController."),this.#qs.add(e,t)}getMetaData(e){let t;return s.debug("App.getMetaData: deprecated since v0.37, please use via app.getDataController."),void 0!==this.#qs.get(e)&&(t=this.#qs.get(e).meta),t}getDataIds(){return s.debug("App.getDataIds: deprecated since v0.37, please use via app.getDataController."),this.#qs.getDataIds()}getDataIdsFromSopUids(e){return s.debug("App.getDataIdsFromSopUids: deprecated since v0.37, please use via app.getDataController."),this.#qs.getDataIdsFromSopUids(e)}getDataIdFromSeriesUid(e){return s.debug("App.getDataIdFromSeriesUid: deprecated since v0.37, please use via app.getDataController."),this.#qs.getDataIdFromSeriesUid(e)}canScroll(){return s.debug("App.canScroll: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#ds.getActiveLayerGroup().getActiveViewLayer().getViewController().canScroll()}canWindowLevel(){return s.debug("App.canWindowLevel: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#ds.getActiveLayerGroup().getActiveViewLayer().getViewController().canWindowLevel()}getAddedScale(){return s.debug("App.getAddedScale: deprecated since v0.37, please access from the active layer group."),this.#ds.getAddedScale()}getBaseScale(){return s.debug("App.getBaseScale: deprecated since v0.37, please access from the active layer group."),this.#ds.getBaseScale()}getOffset(){return s.debug("App.getOffset: deprecated since v0.37, please access from the active layer group."),this.#ds.getOffset()}getToolboxController(){return this.#iu}getStageController(){return this.#ds}getUndoController(){return this.#pu}getActiveLayerGroup(){return s.debug("App.getActiveLayerGroup: deprecated since v0.37, use app.getStageController().getActiveLayerGroup()"),this.#ds.getActiveLayerGroup()}setActiveLayerGroup(e){s.debug("App.setActiveLayerGroup: deprecated since v0.37, use app.getStageController().setActiveLayerGroup()"),this.#ds.setActiveLayerGroup(e)}getViewLayersByDataId(e){return s.debug("App.getViewLayersByDataId: deprecated since v0.37, use app.getStageController().getViewLayersByDataId()"),this.#ds.getViewLayersByDataId(e)}getViewLayers(e){return s.debug("App.getViewLayers: deprecated since v0.37, use app.getStageController().getViewLayers()"),this.#ds.getViewLayers(e)}getDrawLayersByDataId(e){return s.debug("App.getDrawLayersByDataId: deprecated since v0.37, use app.getStageController().getDrawLayersByDataId()"),this.#ds.getDrawLayersByDataId(e)}getDrawLayers(e){return s.debug("App.getDrawLayers: deprecated since v0.37, use app.getStageController().getDrawLayers()"),this.#ds.getDrawLayers(e)}getLayerGroupByDivId(e){return s.debug("App.getLayerGroupByDivId: deprecated since v0.37, use app.getStageController().getLayerGroupByDivId()"),this.#ds.getLayerGroupByDivId(e)}getNumberOfLayerGroups(){return s.debug("App.getNumberOfLayerGroups: deprecated since v0.37, use app.getStageController().getNumberOfLayerGroups()"),this.#ds.getNumberOfLayerGroups()}getStyle(){return this.#Hs}addToUndoStack=e=>{s.debug("App.addToUndoStack: deprecated since v0.37, please use via app.getUndoController."),null!==this.#pu&&this.#pu.addToUndoStack(e)};removeFromUndoStack=e=>{s.debug("App.removeFromUndoStack: deprecated since v0.37, please use via app.getUndoController.");let t=!1;return null!==this.#pu&&(t=this.#pu.removeFromUndoStack(e)),t};init(e){this.#co=e,void 0===this.#co.viewOnFirstLoadItem&&(this.#co.viewOnFirstLoadItem=!0),void 0===this.#co.dataViewConfigs&&(this.#co.dataViewConfigs={}),void 0===this.#co.rootDocument&&"undefined"!=typeof document&&(this.#co.rootDocument=document),this.#mu=new Gl(this.#co.defaultCharacterSet),this.#mu.addEventListener("loadstart",this.#fu),this.#mu.addEventListener("loaditem",this.#vu),this.#mu.addEventListener("load",this.#Cu);for(const e of kl)"loadstart"!==e&&"loaditem"!==e&&"load"!==e&&this.#mu.addEventListener(e,this.#ga);this.#qs=new Ll;for(const e of yl)this.#qs.addEventListener(e,this.#ga);for(const e of zt)this.#qs.addEventListener(e,this.#ga);for(const e of Xt)this.#qs.addEventListener(e,this.#ga);this.#pu=new Hl;for(const e of zl)this.#pu.addEventListener(e,this.#ga);this.#ds=new ku(this.#qs,this.#co),this.#ds.setAddToUndoStack(e=>this.#pu.addToUndoStack(e)),this.#ds.setGetInfoData(e=>this.getInfoData(e));for(const e of Bu)this.#ds.addEventListener(e,this.#ga);if(void 0!==this.#co.tools){const e={},t=Object.keys(this.#co.tools);for(let n=0;n<t.length;++n){const i=t[n];let o=Qu[i];if(void 0===o&&(o=Uu[i]),void 0!==o){if(e[i]=new o(this),void 0!==e[i].addEventListener){const t=e[i].getEventNames();for(let n=0;n<t.length;++n)e[i].addEventListener(t[n],this.#ga)}const t=this.#co.tools[i];if(void 0!==t.options&&0!==t.options.length){let n,o="raw";if(void 0!==e[i].getOptionsType&&(o=e[i].getOptionsType()),"instance"===o||"factory"===o){n={};for(let e=0;e<t.options.length;++e){const r=t.options[e];let a=r;"factory"===o&&(a+="Factory");const l=i.charAt(0).toLowerCase()+i.slice(1);let c,u=Os[l];void 0!==u&&(c=u[a]),void 0===c&&(u=bs[l],void 0!==u&&(c=u[a])),void 0!==c?n[r]=c:s.warn(`Could not find option class for: ${r}`)}}else n=t.options;e[i].setOptions(n)}}else s.warn(`Could not initialise unknown tool: ${i}`)}this.#iu=new yn(e,this.#co.rootDocument),this.#ds.setToolboxController(this.#iu)}}reset(){this.#ds.empty(),this.#_a={},this.#pu&&this.#pu.reset()}resetLayout(){s.debug("App.resetLayout: deprecated since v0.35, prefer resetZoomPan."),this.#ds.resetLayout()}resetZoomPan(){s.debug("App.resetZoomPan: deprecated since v0.37, use app.getStageController().resetZoomPan()"),this.#ds.resetZoomPan()}resetViews(){s.debug("App.resetViews: deprecated since v0.37, use app.getStageController().resetViews()"),this.#ds.resetViews()}loadFiles=e=>{if(0===e.length)return s.warn("Ignoring empty input file list."),"-1";const t=this.#qs.getNextDataId();return this.#mu.loadFiles(e,t),t};loadURLs=(e,t)=>{if(0===e.length)return s.warn("Ignoring empty input url list."),"-1";const n=this.#qs.getNextDataId();return this.#mu.loadURLs(e,n,t),n};loadFromUri=(e,t)=>{s.debug("App.loadFromUri: deprecated since v0.36, please extract the file list and pass it to loadURLs.");const n=ln(e);n&&void 0!==n.input&&function(e,t,n){e.type&&"manifest"===e.type?hn(e.input,e.nslices,t):t(dn(e.input,e.dwvReplaceMode),n)}(n,this.loadURLs,t)};loadImageObject=e=>{const t=this.#qs.getNextDataId();return this.#mu.loadImageObject(e,t),t};abortAllLoads(){const e=this.#mu.getLoadingDataIds();for(const t of e)this.abortLoad(t)}abortLoad(e){this.#mu.abort(e),this.#qs.remove(e),this.#ds.removeLayersByDataId(e)}fitToContainer(){s.debug("App.fitToContainer: deprecated since v0.37, use app.getStageController().fitToContainer()"),this.#ds.fitToContainer()}initWLDisplay(){s.debug("App.initWLDisplay: deprecated since v0.33, please set the opacity of the desired view layer directly."),this.#ds.getActiveLayerGroup().getActiveViewLayer().getViewController().initialise()}setImageSmoothing(e){s.debug("App.setImageSmoothing: deprecated since v0.37, use app.getStageController().setImageSmoothing()"),this.#ds.setImageSmoothing(e)}getViewConfigs(e,t){return s.debug("App.getViewConfigs: deprecated since v0.37, use app.getStageController().getViewConfigs()"),this.#ds.getViewConfigs(e,t)}getViewConfig(e,t,n){return s.debug("App.getViewConfig: deprecated since v0.37, use app.getStageController().getViewConfig()"),this.#ds.getViewConfig(e,t,n)}getDataViewConfigs(){return s.debug("App.getDataViewConfigs: deprecated since v0.37, use app.getStageController().getDataViewConfigs()"),this.#ds.getDataViewConfigs()}setDataViewConfigs(e){s.debug("App.setDataViewConfigs: deprecated since v0.37, use app.getStageController().setDataViewConfigs()"),this.#ds.setDataViewConfigs(e)}addDataViewConfig(e,t,n){s.debug("App.addDataViewConfig: deprecated since v0.37, use app.getStageController().addDataViewConfig()"),this.#ds.addDataViewConfig(e,t,n)}removeDataViewConfig(e,t){s.debug("App.removeDataViewConfig: deprecated since v0.37, use app.getStageController().removeDataViewConfig()"),this.#ds.removeDataViewConfig(e,t)}updateDataViewConfig(e,t,n){s.debug("App.updateDataViewConfig: deprecated since v0.37, use app.getStageController().updateDataViewConfig()"),this.#ds.updateDataViewConfig(e,t,n)}setLayerGroupsBinders(e){const t=[];for(let n=0;n<e.length;++n)void 0!==Vu[e[n]]&&t.push(new Vu[e[n]]);this.#ds.setBinders(t)}render(e,t){s.debug("App.render: deprecated since v0.37, use app.getStageController().render()"),this.#ds.render(e,t)}zoom(e,t,n){s.debug("App.zoom: deprecated since v0.37, please access from the active layer group."),this.#ds.zoom(e,t,n)}translate(e,t){s.debug("App.translate: deprecated since v0.37, please access from the active layer group."),this.#ds.translate(e,t)}resampleMatch(e,t){const n=this.#qs.get(e);if(void 0===n)return void s.debug(`Cannot resample match, target data '${e}' is undefined`);if(void 0===n.image)return void s.debug(`Cannot resample match, target image '${e}' is undefined`);const i=this.#qs.get(t);if(void 0===i)return void s.debug(`Cannot resample match, source data '${t}' is undefined`);if(void 0===i.image)return void s.debug(`Cannot resample match, source image '${t}' is undefined`);const o=n.image.getGeometry().getOrientation(),r=i.image.getGeometry().getOrientation();o.equals(r)?s.info(`Same orientation, no resample match for data '${e}' and '${t}'`):this.resample(e,r)}resample(e,t){const n=this.#qs.get(e);if(void 0===n)return void s.debug(`Cannot resample, target data '${e}' is undefined`);if(void 0===n.image)return void s.debug(`Cannot resample, target image '${e}' is undefined`);if(n.image.getGeometry().getOrientation().equals(t))return void s.info(`Same orientation, no resample for data '${e}'`);n.image.resample(t);const i=this.#co.dataViewConfigs,o=n.image.getMeta(),r=this.#qs.getDataIds();for(let e=0;e<r.length;e++){const t=this.#qs.get(r[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===o.SeriesInstanceUID&&this.#qs.stash(r[e])}const a=this.getStageController();a.setDataViewConfigs(i);const l=this.#qs.getDataIds();for(let e=0;e<l.length;++e)a.render(l[e])}revertResample(e){const t=this.#qs.get(e);if(void 0===t)return void s.debug(`Cannot revert resample, target data '${e}' is undefined`);if(void 0===t.image)return void s.debug(`Cannot revert resample, target image '${e}' is undefined`);if(!t.image.isResampled())return void s.info(`No revert resample needed for data '${e}'`);t.image.revert();const n=this.#co.dataViewConfigs,i=t.image.getMeta(),o=this.#qs.getStashedDataIds();for(let e=0;e<o.length;e++){const t=this.#qs.getStashed(o[e]).image.getMeta();"SEG"===t.Modality&&t.SeriesInstanceUID===i.SeriesInstanceUID&&this.#qs.unstash(o[e])}const r=this.getStageController();r.setDataViewConfigs(n);const a=this.#qs.getDataIds();for(let e=0;e<a.length;++e)r.render(a[e])}setOpacity(e){s.debug("App.setOpacity: deprecated since v0.33, please set the opacity of the desired view layer directly.");const t=this.#ds.getActiveLayerGroup().getActiveViewLayer();t.setOpacity(e),t.draw()}onResize=()=>{this.getStageController().fitToContainer()};onKeydown=e=>{this.dispatchEvent(new CustomEvent("keydown",{detail:{key:e.key,code:e.code,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,context:e.context}}))};defaultOnKeydown=e=>{if(e.ctrlKey)if(e.shiftKey){const t=this.#ds.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.#pu.redo();else if("z"===e.key)this.#pu.undo();else if(" "===e.key){const e=this.#ds.getNumberOfLayerGroups();for(let t=0;t<e;++t)this.#ds.getLayerGroup(t).setShowCrosshair(!this.#ds.getLayerGroup(t).getShowCrosshair())}};resetDisplay(){this.resetLayout(),this.initWLDisplay()}resetZoom(){this.resetLayout()}setColourMap(e){s.debug("App.setColourMap: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#ds.getActiveLayerGroup().getActiveViewLayer().getViewController().setColourMap(e)}setWindowLevelPreset(e){s.debug("App.setWindowLevelPreset: deprecated since v0.33, please use the ViewController equivalent directly instead."),this.#ds.getActiveLayerGroup().getActiveViewLayer().getViewController().setWindowLevelPreset(e)}setTool(e){for(let e=0;e<this.#ds.getNumberOfLayerGroups();++e){const t=this.#ds.getLayerGroup(e),n=t.getActiveLayer();void 0!==n&&this.#iu.bindLayerGroup(t,n)}this.#iu.setSelectedTool(e)}setToolFeatures(e){this.#iu.setToolFeatures(e)}undo(){s.debug("App.undo: deprecated since v0.37, please use via app.getUndoController."),this.#pu.undo()}redo(){s.debug("App.redo: deprecated since v0.37, please use via app.getUndoController."),this.#pu.redo()}getStackSize(){return s.debug("App.getStackSize: deprecated since v0.37, please use via app.getUndoController."),this.#pu.getStackSize()}getCurrentStackIndex(){return s.debug("App.getCurrentStackIndex: deprecated since v0.37, please use via app.getUndoController."),this.#pu.getCurrentStackIndex()}getInfoData(e){let t;return void 0!==this.#_a&&(t=this.#_a[e]),t}toggleInfoDataListeners(e){const t=this.getInfoData(e);void 0!==t&&(t.isListening()?t.removeAppListeners():t.addAppListeners())}createAnnotationData(e){const t=this.#qs.get(e).image.getMeta(),n=new Tl({});n.annotationGroup=new Yt,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.#qs,o=i.getNextDataId();if(!i.add(o,e))throw new Error("Cannot add annotation data");const r=this.#ds.getViewConfigs(n).find(e=>e.divId===t);if(void 0===r)throw new Error("No reference data view config for draw");const a=new Gu(t);a.orientation=r.orientation,this.#ds.addDataViewConfig(o,a),this.#ds.render(o)}#ga=e=>{if(!1===e.detail?.propagate)return;const t=Object.assign({},e.detail);delete t.propagate,this.dispatchEvent(new CustomEvent(e.type,{detail:t}))};#fu=e=>{void 0!==this.#co.overlayConfig&&0===Object.keys(this.#_a).length&&(this.#_a[e.detail.dataid]=new jl(this,e.detail.dataid,this.#co.overlayConfig)),this.#ga(e)};#vu=e=>{void 0===e.detail.data&&s.error("Missing loaditem event data.");const t=e.detail.isfirstitem;try{t?this.#qs.add(e.detail.dataid,e.detail.data):this.#qs.update(e.detail.dataid,e.detail.data)}catch(t){return this.dispatchEvent(new CustomEvent("error",{detail:{dataid:e.detail.dataid,source:e.detail.source,error:t}})),this.abortLoad(e.detail.dataid),void this.dispatchEvent(new CustomEvent("loadend",{detail:{dataid:e.detail.dataid,source:e.detail.source}}))}this.#ga(e),void 0!==this.#_a&&void 0!==this.#_a[e.detail.dataid]&&this.#_a[e.detail.dataid].addItemMeta(e.detail.data.meta),t&&this.#co.viewOnFirstLoadItem&&0!==this.#ds.getViewConfigs(e.detail.dataid).length&&this.#ds.render(e.detail.dataid)};#Cu=e=>{const t=this.#qs.markDataAsComplete(e.detail.dataid);this.#co.viewOnFirstLoadItem&&void 0!==t.imageHasChanged&&t.imageHasChanged&&this.#ds.render(e.detail.dataid),this.#ga(e)}}class Yu extends ys{#jt;#Du;#jl;#yu;constructor(e,t,n){super(),this.#jt=e,this.#Du=t,this.#jl=void 0!==n&&n,void 0!==t.displayRGBValue?this.#yu=e.getOffsets(t.number):this.#yu=e.getOffsets(t.displayValue)}getName(){return"Delete-segment"}isValid(){return this.#jt.getMeta().custom.segments.some(e=>e.number===this.#Du.number)}execute(){if(0!==this.#yu.length){const e=this.#jt.getSegmentCollection(),t=this.#Du.number,n=this.#yu.map(function(n){return e?.getOtherValueAtOffset(n,t)??0});this.#jt.setAtOffsetsWithValues(this.#yu,n)}new er(this.#jt).removeSegment(this.#Du.number),this.#jl||this.onExecute({type:"masksegmentdelete",segmentnumber:this.#Du.number})}undo(){0!==this.#yu.length&&(void 0!==this.#Du.displayRGBValue?this.#jt.setAtOffsets(this.#yu,this.#Du.number):this.#jt.setAtOffsets(this.#yu,this.#Du.displayValue)),new er(this.#jt).addSegment(this.#Du),this.onUndo({type:"masksegmentredraw",segmentnumber:this.#Du.number})}onExecute(e){}onUndo(e){}}class Wu extends ys{#jt;#Du;#Iu;#Tu;#jl;#yu;constructor(e,t,n,i){super(),this.#jt=e,this.#Du=t,this.#Iu=n,this.#jl=void 0!==i&&i,void 0!==t.displayRGBValue?this.#Tu=t.displayRGBValue:(this.#Tu=t.displayValue,this.#yu=e.getOffsets(this.#Tu))}getName(){return"Change-segment-colour"}isValid(){let e=!0;return void 0!==this.#yu&&(e=0!==this.#yu.length),e}execute(){"number"==typeof this.#Iu?(this.#jt.setAtOffsets(this.#yu,this.#Iu),this.#Du.displayValue=this.#Iu):(this.#jt.updatePaletteColourMap(this.#Du.number,this.#Iu),this.#Du.displayRGBValue=this.#Iu),this.#jl||this.onExecute({type:"changemasksegmentcolour",segmentnumber:this.#Du.number,value:[this.#Iu]})}undo(){"number"==typeof this.#Tu?(this.#jt.setAtOffsets(this.#yu,this.#Tu),this.#Du.displayValue=this.#Tu):(this.#jt.updatePaletteColourMap(this.#Du.number,this.#Tu),this.#Du.displayRGBValue=this.#Tu),this.onUndo({type:"changemasksegmentcolour",segmentnumber:this.#Du.number,value:[this.#Tu]})}onExecute(e){}onUndo(e){}}function $u(e){const t=Object.keys(e).sort();let n="\n";n+="# Dicom-File-Format\n",n+="\n",n+="# Dicom-Meta-Information-Header\n",n+="# Used TransferSyntax: ",ge()?n+="Little Endian Explicit\n":n+="NOT Little Endian Explicit\n";const i=e["00020010"].value[0];let o,r,a=!0,s=!1;for(let l=0,c=t.length;l<c;++l)o=e[t[l]],r=q(t[l]),a&&"0002"!==r.getGroup()&&(n+="\n",n+="# Dicom-Data-Set\n",n+="# Used TransferSyntax: ",n+=Ee(i),n+="\n",a=!1,s=Le(i)),n+=`${nd(r,o,"",s)}\n`;return n}function ju(e){return"UN"===e||0!==e.length&&"O"===e[0].toUpperCase()}function Zu(e,t,n){let i="";if(void 0===n&&(n=!0),null==t)return i;const o=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e};if("SQ"!==t.vr&&1===t.value.length&&""===t.value[0])i+="(no value available)";else if(z(e)&&t.undefinedLength)i="(PixelSequence)";else if("DA"===t.vr&&n)i=Ui(Mi(t)).toLocaleDateString();else if("TM"===t.vr&&n){const e=qi(t);i=`${e.hours}:${e.minutes}:${e.seconds}`}else{const e=ju(t.vr),r="FL"===t.vr||"FD"===t.vr||"DS"===t.vr;let a=t.value;const s=t.value[0];Array.isArray(a)&&ArrayBuffer.isView(s)&&(a=t.value[0]);for(let s=0,l=a.length;s<l;++s){let l="";if(0!==s&&(l+="\\"),r){const e=Number(a[s]);!o(e)&&n?l+=e.toPrecision(4):l+=e.toString()}else if(e){let e=a[s].toString(16);e="OB"===t.vr||"UN"===t.vr?"00".substring(0,2-e.length)+e:"0000".substring(0,4-e.length)+e,l+=e}else l+=a[s];if(!(i.length+l.length<=65)){i+="...";break}i+=l}}return i}const Ku=new TextEncoder;function _u(e,t,n){const i=t.value;if(null==i)return 0;const o=qe("NONE",n);let r=0;if("SQ"===t.vr){for(const e of i)r+=ed(e,n);t.undefinedLength&&(r+=o)}else if(z(e)&&t.undefinedLength){for(const e of i)r+=o+e.byteLength;r+=o}else if("AT"===t.vr)r=4*i.length;else if("string"===J[t.vr])r=Ku.encode(i.join("\\")).length;else if(ArrayBuffer.isView(i))r=i.byteLength;else if(Array.isArray(i)&&ArrayBuffer.isView(i[0]))for(const e of i)r+=e.byteLength;else{const e=J[t.vr],n=void 0!==e?parseInt(e.replace(/\D/g,""),10):NaN;isNaN(n)||(r=i.length*n/8)}return r+r%2}function Ju(e,t){let n=0;for(const i of Object.keys(e)){const o=q(i);if(!Q(o)){const r=e[i];n+=qe(r.vr,t),n+=_u(o,r,t)}}return n}function ed(e,t){const n=qe("NONE",t);let i=n+Ju(e,t);return e[U().getKey()]?.undefinedLength&&(i+=n),i}function td(e,t,n,i,o,r,a){return`${e}${`(${t.getGroup().toLowerCase()},${t.getElement().toLowerCase()}) ${n} ${i}`.padEnd(55)} # ${o.padStart(3)}, ${r} ${a}`}function nd(e,t,n,i){const o=re(e)?.getName()??"Unknown Tag & Data",r=t.vr,a=ju(r),s=z(e)&&t.undefinedLength,l=t.undefinedLength?"u/l":_u(e,t,i).toString();let c,u=t.value.length;"SQ"!==r&&1===t.value.length&&""===t.value[0]?(c="(no value available)",u=0):s?(c=`(PixelSequence #=${t.value.length})`,u=1):"SQ"===r?(c=`(Sequence with ${t.undefinedLength?"undefined":"explicit"} length #=${t.value.length})`,u=1):a||"UL"===r||"US"===r||"SL"===r||"SS"===r||"FL"===r||"FD"===r||"AT"===r?(c=Zu(e,t,!1),a&&(u=1)):c=`[${Zu(e,t,!1)}]`;const d=[td(n,e,r,c,l,u,o)];if("SQ"===r){const e=U();for(const o of t.value){const t=Object.keys(o).sort();if(0===t.length)continue;const r=t.filter(e=>!Q(q(e))),a=!0===o[e.getKey()]?.undefinedLength,s=a?"undefined":"explicit",l=a?"u/l":Ju(o,i).toString();d.push(td(`${n} `,e,"na",`(Item with ${s} length #=${r.length})`,l,1,"Item"));for(const e of r)d.push(nd(q(e),o[e],`${n} `,i));const c=a?"":" for re-encoding";d.push(td(`${n} `,V(),"na",`(ItemDelimitationItem${c})`,"0",0,"ItemDelimitationItem"))}const o=t.undefinedLength?"":" for re-encod.";d.push(td(n,B(),"na",`(SequenceDelimitationItem${o})`,"0",0,"SequenceDelimitationItem"))}else if(s){const e=U();for(const i of t.value){const t=new le("OB");t.value=i,d.push(td(`${n} `,e,"pi",Zu(e,t,!1),i.byteLength.toString(),1,"Item"))}d.push(td(n,B(),"na","(SequenceDelimitationItem)","0",0,"SequenceDelimitationItem"))}return d.join("\n")}class id{diameter;offset1;offset2}class od{major;minor}class rd{centroid;centroidIndex;volume;count;diameters;height;id;largestSliceZ;minZ;maxZ}class ad{x;y}class sd{x;y;z}export{Js as Annotation,Yt as AnnotationGroup,il as AnnotationGroupFactory,Xu as App,Hu as AppOptions,yt as BooleanResult,nl as CADReport,Dn as CanvasSizeChecker,Wu as ChangeSegmentColourCommand,Jr as Circle,rr as ColourMap,ys as Command,Ll as DataController,le as DataElement,Yu as DeleteSegmentCommand,id as Diameter,od as Diameters,qn as DicomCode,Tl as DicomData,Ne as DicomParser,za as DicomSRContent,Zs as DicomWriter,eu as DrawBrushCommand,Jc as DrawBrushCommandProperties,Cc as DrawController,Dc as DrawLayer,_c as DrawShapeHandler,ea as Ellipse,Lt as Geometry,Nt as Histogram,Ht as Image,Ko as ImageContour,Gt as ImageHistogram,a as Index,jl as InfoData,Xl as InfoDataItem,rd as Label,Pc as LayerGroup,dr as MaskFactory,tr as MaskImage,_i as MaskSegment,er as MaskSegmentHelper,ac as MaskSegmentViewHelper,Ge as Matrix33,to as NormalisedManufacturers,c as NumberRange,Ye as Orientation,dc as PlaneHelper,C as Point,S as Point2D,m as Point3D,gc as PositionHelper,Kr as Protractor,Wt as RGB,_r as ROI,al as RTROI,rl as RTROIContour,na as Rectangle,Be as RescaleSlopeAndIntercept,tl as ResponseEvaluation,Dl as RtStructFactory,Ts as RunFilterCommand,ad as Scalar2D,sd as Scalar3D,Jl as ScrollWheelBehavior,Jo as SegmentCollection,Dt as Size,tt as Spacing,ku as StageController,F as Tag,oe as TagInfo,zu as ToolConfig,yn as ToolboxController,Hl as UndoController,g as Vector3D,cc as View,Gu as ViewConfig,Sc as ViewController,mc as ViewLayer,_l as WheelBehavior,Ut as WindowLevel,Sr as WindowPreset,Fs as WriterRule,Rs as WriterRuleActions,W as addTagsToDictionary,ml as bufferToPolygons,R as buildMultipart,ke as custom,$u as dcmdump,mo as defaultPrivateBValueRules,Qu as defaultToolList,bs as defaultToolOptions,po as defaultVolumeIdCandidates,Ir as demoCreateImage,gr as demoCreateMaskImage,lc as demoCreateView,Qt as equalWl,Gi as getAsSimpleTagValues,ul as getDefaultDicomRTStructJson,ur as getDefaultDicomSegJson,Xa as getDicomSRContentItem,ae as getDicomTagGroupName,re as getDicomTagInfo,pe as getDwvVersion,Hi as getElementsFromSimpleTagValues,ta as getEllipseIndices,wc as getLayerDetailsFromEvent,no as getManufacturer,vn as getMousePoint,io as getNormalisedManufacturer,je as getOrientationName,G as getPixelDataTag,sl as getRTStructFromElements,ia as getRectangleIndices,ut as getReferencedSeriesUID,dt as getReferencedSeriesUIDFromRTStruct,we as getReverseOrientation,Ha as getSRContent,gi as getSegmentationCode,q as getTagFromKey,fn as getTouchPoints,Re as getTypedArray,zs as getUID,cn as getURLsFromKeyValueUri,un as handleURLsFromWeasisXMLManifest,ye as hasDicomPrefix,Zt as hexToRgb,D as i18n,$t as isEqualRgb,Jt as labToUintLab,s as logger,ar as luts,hr as mergeMaskImages,zi as mergeTagValues,h as precisionRound,Kt as rgbToHex,fl as simplifyPolygon,nn as srgbToCielab,Uu as toolList,Os as toolOptions,Qs as translateWriterRules};
|
|
2
2
|
//# sourceMappingURL=dwv.node.min.js.map
|