@l1yp/file-viewer 0.1.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/LICENSE +21 -0
- package/README.md +134 -0
- package/dist/FileViewer.js +7 -0
- package/dist/FileViewer.vue.d.ts +37 -0
- package/dist/FileViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/_virtual/_plugin-vue_export-helper.js +8 -0
- package/dist/components/AppxViewer.js +7 -0
- package/dist/components/AppxViewer.vue.d.ts +18 -0
- package/dist/components/AppxViewer.vue_vue_type_script_setup_true_lang.js +174 -0
- package/dist/components/ArchiveBrowser.js +7 -0
- package/dist/components/ArchiveBrowser.vue.d.ts +18 -0
- package/dist/components/ArchiveBrowser.vue_vue_type_script_setup_true_lang.js +279 -0
- package/dist/components/AudioViewer.js +7 -0
- package/dist/components/AudioViewer.vue.d.ts +21 -0
- package/dist/components/AudioViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/BinObjBrowser.js +7 -0
- package/dist/components/BinObjBrowser.vue.d.ts +19 -0
- package/dist/components/BinObjBrowser.vue_vue_type_script_setup_true_lang.js +141 -0
- package/dist/components/CertViewer.js +7 -0
- package/dist/components/CertViewer.vue.d.ts +17 -0
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js +251 -0
- package/dist/components/ClassViewer.js +7 -0
- package/dist/components/ClassViewer.vue.d.ts +15 -0
- package/dist/components/ClassViewer.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/CodeBlock.js +7 -0
- package/dist/components/CodeBlock.vue.d.ts +17 -0
- package/dist/components/CodeBlock.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/CodeView.js +7 -0
- package/dist/components/CodeView.vue.d.ts +21 -0
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +180 -0
- package/dist/components/CsvViewer.js +7 -0
- package/dist/components/CsvViewer.vue.d.ts +26 -0
- package/dist/components/CsvViewer.vue_vue_type_script_setup_true_lang.js +187 -0
- package/dist/components/DicomViewer.js +7 -0
- package/dist/components/DicomViewer.vue.d.ts +30 -0
- package/dist/components/DicomViewer.vue_vue_type_script_setup_true_lang.js +362 -0
- package/dist/components/DocxViewer.js +7 -0
- package/dist/components/DocxViewer.vue.d.ts +19 -0
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +59 -0
- package/dist/components/DrawioViewer.js +7 -0
- package/dist/components/DrawioViewer.vue.d.ts +16 -0
- package/dist/components/DrawioViewer.vue_vue_type_script_setup_true_lang.js +38 -0
- package/dist/components/DxfViewer.js +7 -0
- package/dist/components/DxfViewer.vue.d.ts +14 -0
- package/dist/components/DxfViewer.vue_vue_type_script_setup_true_lang.js +239 -0
- package/dist/components/EbookViewer.js +7 -0
- package/dist/components/EbookViewer.vue.d.ts +22 -0
- package/dist/components/EbookViewer.vue_vue_type_script_setup_true_lang.js +170 -0
- package/dist/components/EmlViewer.js +7 -0
- package/dist/components/EmlViewer.vue.d.ts +21 -0
- package/dist/components/EmlViewer.vue_vue_type_script_setup_true_lang.js +193 -0
- package/dist/components/EplViewer.js +7 -0
- package/dist/components/EplViewer.vue.d.ts +19 -0
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js +201 -0
- package/dist/components/FileViewerBody.js +7 -0
- package/dist/components/FileViewerBody.vue.d.ts +47 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +599 -0
- package/dist/components/FileViewerPanel.js +7 -0
- package/dist/components/FileViewerPanel.vue.d.ts +3 -0
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +207 -0
- package/dist/components/FontViewer.js +7 -0
- package/dist/components/FontViewer.vue.d.ts +17 -0
- package/dist/components/FontViewer.vue_vue_type_script_setup_true_lang.js +120 -0
- package/dist/components/FrontmatterCard.js +7 -0
- package/dist/components/FrontmatterCard.vue.d.ts +11 -0
- package/dist/components/FrontmatterCard.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/components/GeoViewer.js +7 -0
- package/dist/components/GeoViewer.vue.d.ts +17 -0
- package/dist/components/GeoViewer.vue_vue_type_script_setup_true_lang.js +255 -0
- package/dist/components/HarViewer.js +7 -0
- package/dist/components/HarViewer.vue.d.ts +20 -0
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js +322 -0
- package/dist/components/HexViewer.js +7 -0
- package/dist/components/HexViewer.vue.d.ts +22 -0
- package/dist/components/HexViewer.vue_vue_type_script_setup_true_lang.js +121 -0
- package/dist/components/HprofViewer.js +7 -0
- package/dist/components/HprofViewer.vue.d.ts +27 -0
- package/dist/components/HprofViewer.vue_vue_type_script_setup_true_lang.js +561 -0
- package/dist/components/ImageLightbox.js +7 -0
- package/dist/components/ImageLightbox.vue.d.ts +3 -0
- package/dist/components/ImageLightbox.vue_vue_type_script_setup_true_lang.js +86 -0
- package/dist/components/InlineText.d.ts +29 -0
- package/dist/components/InlineText.js +21 -0
- package/dist/components/JksViewer.js +7 -0
- package/dist/components/JksViewer.vue.d.ts +22 -0
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js +353 -0
- package/dist/components/JsonlViewer.js +7 -0
- package/dist/components/JsonlViewer.vue.d.ts +15 -0
- package/dist/components/JsonlViewer.vue_vue_type_script_setup_true_lang.js +103 -0
- package/dist/components/LogViewer.js +7 -0
- package/dist/components/LogViewer.vue.d.ts +29 -0
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +670 -0
- package/dist/components/LrcViewer.js +7 -0
- package/dist/components/LrcViewer.vue.d.ts +17 -0
- package/dist/components/LrcViewer.vue_vue_type_script_setup_true_lang.js +106 -0
- package/dist/components/MarkdownTable.js +7 -0
- package/dist/components/MarkdownTable.vue.d.ts +19 -0
- package/dist/components/MarkdownTable.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/components/MarkdownText.d.ts +30 -0
- package/dist/components/MarkdownText.js +21 -0
- package/dist/components/MhtViewer.js +7 -0
- package/dist/components/MhtViewer.vue.d.ts +22 -0
- package/dist/components/MhtViewer.vue_vue_type_script_setup_true_lang.js +112 -0
- package/dist/components/MindMapView.js +7 -0
- package/dist/components/MindMapView.vue.d.ts +23 -0
- package/dist/components/MindMapView.vue_vue_type_script_setup_true_lang.js +337 -0
- package/dist/components/MissingDependency.js +7 -0
- package/dist/components/MissingDependency.vue.d.ts +17 -0
- package/dist/components/MissingDependency.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/components/ModelViewer.js +7 -0
- package/dist/components/ModelViewer.vue.d.ts +18 -0
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +157 -0
- package/dist/components/MsiViewer.js +7 -0
- package/dist/components/MsiViewer.vue.d.ts +19 -0
- package/dist/components/MsiViewer.vue_vue_type_script_setup_true_lang.js +136 -0
- package/dist/components/NotebookViewer.js +7 -0
- package/dist/components/NotebookViewer.vue.d.ts +20 -0
- package/dist/components/NotebookViewer.vue_vue_type_script_setup_true_lang.js +125 -0
- package/dist/components/PdfViewer.js +7 -0
- package/dist/components/PdfViewer.vue.d.ts +19 -0
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js +114 -0
- package/dist/components/PptxViewer.js +7 -0
- package/dist/components/PptxViewer.vue.d.ts +20 -0
- package/dist/components/PptxViewer.vue_vue_type_script_setup_true_lang.js +73 -0
- package/dist/components/PsdViewer.js +7 -0
- package/dist/components/PsdViewer.vue.d.ts +15 -0
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js +218 -0
- package/dist/components/QmcAudioViewer.js +7 -0
- package/dist/components/QmcAudioViewer.vue.d.ts +18 -0
- package/dist/components/QmcAudioViewer.vue_vue_type_script_setup_true_lang.js +92 -0
- package/dist/components/RasterViewer.js +7 -0
- package/dist/components/RasterViewer.vue.d.ts +21 -0
- package/dist/components/RasterViewer.vue_vue_type_script_setup_true_lang.js +161 -0
- package/dist/components/RtfViewer.js +7 -0
- package/dist/components/RtfViewer.vue.d.ts +21 -0
- package/dist/components/RtfViewer.vue_vue_type_script_setup_true_lang.js +66 -0
- package/dist/components/SevenZipBrowser.js +7 -0
- package/dist/components/SevenZipBrowser.vue.d.ts +13 -0
- package/dist/components/SevenZipBrowser.vue_vue_type_script_setup_true_lang.js +366 -0
- package/dist/components/SqliteViewer.js +7 -0
- package/dist/components/SqliteViewer.vue.d.ts +18 -0
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js +186 -0
- package/dist/components/SubtitleViewer.js +7 -0
- package/dist/components/SubtitleViewer.vue.d.ts +15 -0
- package/dist/components/SubtitleViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/XlsxChart.js +7 -0
- package/dist/components/XlsxChart.vue.d.ts +14 -0
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +240 -0
- package/dist/components/XlsxViewer.js +7 -0
- package/dist/components/XlsxViewer.vue.d.ts +22 -0
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +814 -0
- package/dist/components/XmindViewer.js +7 -0
- package/dist/components/XmindViewer.vue.d.ts +13 -0
- package/dist/components/XmindViewer.vue_vue_type_script_setup_true_lang.js +48 -0
- package/dist/components/ZipBrowser.js +7 -0
- package/dist/components/ZipBrowser.vue.d.ts +14 -0
- package/dist/components/ZipBrowser.vue_vue_type_script_setup_true_lang.js +326 -0
- package/dist/components/ZoomImage.js +7 -0
- package/dist/components/ZoomImage.vue.d.ts +29 -0
- package/dist/components/ZoomImage.vue_vue_type_script_setup_true_lang.js +147 -0
- package/dist/components/epl/EplCodeBlock.js +7 -0
- package/dist/components/epl/EplCodeBlock.vue.d.ts +15 -0
- package/dist/components/epl/EplCodeBlock.vue_vue_type_script_setup_true_lang.js +72 -0
- package/dist/components/epl/EplDoc.js +7 -0
- package/dist/components/epl/EplDoc.vue.d.ts +19 -0
- package/dist/components/epl/EplDoc.vue_vue_type_script_setup_true_lang.js +327 -0
- package/dist/components/epl/EplMethod.js +7 -0
- package/dist/components/epl/EplMethod.vue.d.ts +14 -0
- package/dist/components/epl/EplMethod.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/components/epl/EplResource.js +7 -0
- package/dist/components/epl/EplResource.vue.d.ts +15 -0
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js +204 -0
- package/dist/components/epl/EplTree.js +7 -0
- package/dist/components/epl/EplTree.vue.d.ts +27 -0
- package/dist/components/epl/EplTree.vue_vue_type_script_setup_true_lang.js +123 -0
- package/dist/components/epl/EplVarTable.js +7 -0
- package/dist/components/epl/EplVarTable.vue.d.ts +21 -0
- package/dist/components/epl/EplVarTable.vue_vue_type_script_setup_true_lang.js +60 -0
- package/dist/components/epl/docTypes.d.ts +12 -0
- package/dist/components/epl/numbering.d.ts +21 -0
- package/dist/components/epl/numbering.js +14 -0
- package/dist/components/icons/Icon.js +7 -0
- package/dist/components/icons/Icon.vue.d.ts +14 -0
- package/dist/components/icons/Icon.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/components/icons/iconPaths.d.ts +60 -0
- package/dist/components/icons/iconPaths.js +54 -0
- package/dist/components/optionalViewer.d.ts +14 -0
- package/dist/components/optionalViewer.js +37 -0
- package/dist/components/ui/ClampBlock.d.ts +82 -0
- package/dist/components/ui/ClampBlock.js +63 -0
- package/dist/composables/useFileViewer.d.ts +428 -0
- package/dist/composables/useFileViewer.js +27 -0
- package/dist/composables/useLightbox.d.ts +33 -0
- package/dist/composables/useLightbox.js +17 -0
- package/dist/composables/useLogRules.d.ts +47 -0
- package/dist/composables/useLogRules.js +74 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.js +30 -0
- package/dist/lib/aes.d.ts +25 -0
- package/dist/lib/aes.js +99 -0
- package/dist/lib/appx.d.ts +66 -0
- package/dist/lib/appx.js +112 -0
- package/dist/lib/archive.d.ts +29 -0
- package/dist/lib/asn1.d.ts +47 -0
- package/dist/lib/asn1.js +122 -0
- package/dist/lib/binobj.d.ts +69 -0
- package/dist/lib/binobj.js +430 -0
- package/dist/lib/brotli.d.ts +14 -0
- package/dist/lib/brotli.js +16 -0
- package/dist/lib/bzip2.d.ts +14 -0
- package/dist/lib/bzip2.js +161 -0
- package/dist/lib/classfile.d.ts +72 -0
- package/dist/lib/classfile.js +210 -0
- package/dist/lib/codePreview.d.ts +22 -0
- package/dist/lib/codePreview.js +27 -0
- package/dist/lib/codefold.d.ts +14 -0
- package/dist/lib/codefold.js +30 -0
- package/dist/lib/codeformat.d.ts +21 -0
- package/dist/lib/codeformat.js +130 -0
- package/dist/lib/csv.d.ts +19 -0
- package/dist/lib/csv.js +74 -0
- package/dist/lib/des.d.ts +17 -0
- package/dist/lib/des.js +928 -0
- package/dist/lib/diagram.d.ts +5 -0
- package/dist/lib/diagram.js +479 -0
- package/dist/lib/dicom.d.ts +69 -0
- package/dist/lib/dicom.js +442 -0
- package/dist/lib/dicomCodecs.d.ts +28 -0
- package/dist/lib/dicomCodecs.js +156 -0
- package/dist/lib/dicomRender.d.ts +46 -0
- package/dist/lib/dicomRender.js +114 -0
- package/dist/lib/dxf.d.ts +86 -0
- package/dist/lib/dxf.js +399 -0
- package/dist/lib/eml.d.ts +40 -0
- package/dist/lib/eml.js +46 -0
- package/dist/lib/encoding.d.ts +28 -0
- package/dist/lib/encoding.js +44 -0
- package/dist/lib/epl/code/ast.d.ts +150 -0
- package/dist/lib/epl/code/codeDataParser.d.ts +3 -0
- package/dist/lib/epl/code/codeDataParser.js +330 -0
- package/dist/lib/epl/code/codeLines.d.ts +20 -0
- package/dist/lib/epl/code/codeLines.js +191 -0
- package/dist/lib/epl/code/structures.d.ts +86 -0
- package/dist/lib/epl/code/textCode.d.ts +29 -0
- package/dist/lib/epl/code/textCode.js +150 -0
- package/dist/lib/epl/code/variable.d.ts +25 -0
- package/dist/lib/epl/eplDocument.d.ts +21 -0
- package/dist/lib/epl/eplDocument.js +36 -0
- package/dist/lib/epl/imageList.d.ts +28 -0
- package/dist/lib/epl/imageList.js +66 -0
- package/dist/lib/epl/index.d.ts +53 -0
- package/dist/lib/epl/index.js +45 -0
- package/dist/lib/epl/io/binaryReader.d.ts +56 -0
- package/dist/lib/epl/io/binaryReader.js +119 -0
- package/dist/lib/epl/io/encoding.d.ts +16 -0
- package/dist/lib/epl/io/encoding.js +27 -0
- package/dist/lib/epl/model/eplSystemId.d.ts +64 -0
- package/dist/lib/epl/model/eplSystemId.js +16 -0
- package/dist/lib/epl/model/section.d.ts +46 -0
- package/dist/lib/epl/names/eplLibData.js +39 -0
- package/dist/lib/epl/names/idToNameMap.d.ts +33 -0
- package/dist/lib/epl/names/idToNameMap.js +130 -0
- package/dist/lib/epl/names/libNameProvider.d.ts +15 -0
- package/dist/lib/epl/names/libNameProvider.js +18 -0
- package/dist/lib/epl/program.d.ts +120 -0
- package/dist/lib/epl/program.js +134 -0
- package/dist/lib/epl/projectFileReader.d.ts +23 -0
- package/dist/lib/epl/projectFileReader.js +65 -0
- package/dist/lib/epl/sections/code.d.ts +20 -0
- package/dist/lib/epl/sections/esystemInfo.d.ts +14 -0
- package/dist/lib/epl/sections/losable.d.ts +11 -0
- package/dist/lib/epl/sections/projectConfig.d.ts +23 -0
- package/dist/lib/epl/sections/resource.d.ts +57 -0
- package/dist/lib/fb2.d.ts +14 -0
- package/dist/lib/fb2.js +62 -0
- package/dist/lib/fileType.d.ts +315 -0
- package/dist/lib/fileType.js +800 -0
- package/dist/lib/fonts.d.ts +8 -0
- package/dist/lib/fonts.js +4 -0
- package/dist/lib/format.d.ts +16 -0
- package/dist/lib/format.js +38 -0
- package/dist/lib/frontmatter.d.ts +13 -0
- package/dist/lib/frontmatter.js +23 -0
- package/dist/lib/geo.d.ts +30 -0
- package/dist/lib/geo.js +235 -0
- package/dist/lib/har.d.ts +171 -0
- package/dist/lib/har.js +397 -0
- package/dist/lib/highlight.d.ts +18 -0
- package/dist/lib/highlight.js +34 -0
- package/dist/lib/highlightLangs.d.ts +15 -0
- package/dist/lib/highlightLangs.js +93 -0
- package/dist/lib/hprof.d.ts +211 -0
- package/dist/lib/hprof.js +709 -0
- package/dist/lib/ipynb.d.ts +48 -0
- package/dist/lib/ipynb.js +130 -0
- package/dist/lib/jks.d.ts +86 -0
- package/dist/lib/jks.js +167 -0
- package/dist/lib/jsonl.d.ts +29 -0
- package/dist/lib/jsonl.js +24 -0
- package/dist/lib/lrc.d.ts +32 -0
- package/dist/lib/lrc.js +84 -0
- package/dist/lib/lzma.d.ts +70 -0
- package/dist/lib/lzma.js +204 -0
- package/dist/lib/markdown/blocks.d.ts +9 -0
- package/dist/lib/markdown/blocks.js +221 -0
- package/dist/lib/markdown/index.d.ts +3 -0
- package/dist/lib/markdown/inline.d.ts +33 -0
- package/dist/lib/markdown/inline.js +84 -0
- package/dist/lib/markdown/math.d.ts +5 -0
- package/dist/lib/markdown/math.js +25 -0
- package/dist/lib/markdown/segmentize.d.ts +11 -0
- package/dist/lib/markdown/segmentize.js +28 -0
- package/dist/lib/markdown/styles.d.ts +26 -0
- package/dist/lib/markdown/styles.js +135 -0
- package/dist/lib/mht.d.ts +51 -0
- package/dist/lib/mht.js +122 -0
- package/dist/lib/midi.d.ts +28 -0
- package/dist/lib/midi.js +84 -0
- package/dist/lib/mime.d.ts +82 -0
- package/dist/lib/mime.js +151 -0
- package/dist/lib/mindmap.d.ts +51 -0
- package/dist/lib/mindmap.js +113 -0
- package/dist/lib/mobi.d.ts +15 -0
- package/dist/lib/mobi.js +68 -0
- package/dist/lib/msi.d.ts +50 -0
- package/dist/lib/msi.js +332 -0
- package/dist/lib/optionalDep.d.ts +26 -0
- package/dist/lib/optionalDep.js +20 -0
- package/dist/lib/pkcs12.d.ts +56 -0
- package/dist/lib/pkcs12.js +356 -0
- package/dist/lib/qmc.d.ts +50 -0
- package/dist/lib/qmc.js +213 -0
- package/dist/lib/rar.d.ts +16 -0
- package/dist/lib/rar.js +40 -0
- package/dist/lib/rawPreview.d.ts +12 -0
- package/dist/lib/rawPreview.js +54 -0
- package/dist/lib/rc2.d.ts +12 -0
- package/dist/lib/rc2.js +298 -0
- package/dist/lib/resolveInput.d.ts +22 -0
- package/dist/lib/resolveInput.js +55 -0
- package/dist/lib/rtf.d.ts +53 -0
- package/dist/lib/rtf.js +413 -0
- package/dist/lib/sevenZip.d.ts +82 -0
- package/dist/lib/sevenZip.js +395 -0
- package/dist/lib/sha1.d.ts +24 -0
- package/dist/lib/sha1.js +53 -0
- package/dist/lib/sha256.d.ts +21 -0
- package/dist/lib/sha256.js +119 -0
- package/dist/lib/speechAudio.d.ts +36 -0
- package/dist/lib/speechAudio.js +85 -0
- package/dist/lib/sqlite.d.ts +38 -0
- package/dist/lib/sqlite.js +104 -0
- package/dist/lib/subtitle.d.ts +26 -0
- package/dist/lib/subtitle.js +99 -0
- package/dist/lib/tarball.d.ts +20 -0
- package/dist/lib/tarball.js +248 -0
- package/dist/lib/viewerFormats.d.ts +35 -0
- package/dist/lib/viewerFormats.js +83 -0
- package/dist/lib/viewerKind.d.ts +36 -0
- package/dist/lib/viewerKind.js +233 -0
- package/dist/lib/x509.d.ts +68 -0
- package/dist/lib/x509.js +267 -0
- package/dist/lib/xlsx.d.ts +55 -0
- package/dist/lib/xlsx.js +321 -0
- package/dist/lib/xlsxCharts.d.ts +34 -0
- package/dist/lib/xlsxCharts.js +152 -0
- package/dist/lib/xmind.d.ts +6 -0
- package/dist/lib/xmind.js +124 -0
- package/dist/lib/zip.d.ts +56 -0
- package/dist/lib/zip.js +169 -0
- package/dist/style.css +2 -0
- package/dist/types.d.ts +42 -0
- package/package.json +128 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import e from "dicom-parser";
|
|
2
|
+
//#region src/lib/dicom.ts
|
|
3
|
+
var t = {
|
|
4
|
+
transferSyntax: "x00020010",
|
|
5
|
+
samplesPerPixel: "x00280002",
|
|
6
|
+
photometric: "x00280004",
|
|
7
|
+
planarConfiguration: "x00280006",
|
|
8
|
+
numberOfFrames: "x00280008",
|
|
9
|
+
rows: "x00280010",
|
|
10
|
+
columns: "x00280011",
|
|
11
|
+
bitsAllocated: "x00280100",
|
|
12
|
+
bitsStored: "x00280101",
|
|
13
|
+
highBit: "x00280102",
|
|
14
|
+
pixelRepresentation: "x00280103",
|
|
15
|
+
windowCenter: "x00281050",
|
|
16
|
+
windowWidth: "x00281051",
|
|
17
|
+
rescaleIntercept: "x00281052",
|
|
18
|
+
rescaleSlope: "x00281053",
|
|
19
|
+
redDescriptor: "x00281101",
|
|
20
|
+
greenDescriptor: "x00281102",
|
|
21
|
+
blueDescriptor: "x00281103",
|
|
22
|
+
redData: "x00281201",
|
|
23
|
+
greenData: "x00281202",
|
|
24
|
+
blueData: "x00281203",
|
|
25
|
+
modality: "x00080060",
|
|
26
|
+
studyDescription: "x00081030",
|
|
27
|
+
seriesDescription: "x0008103e",
|
|
28
|
+
bodyPart: "x00180015",
|
|
29
|
+
pixelData: "x7fe00010"
|
|
30
|
+
}, n = class extends Error {
|
|
31
|
+
constructor(e) {
|
|
32
|
+
super(e), this.name = "DicomError";
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function r(e, t, n) {
|
|
36
|
+
let r = e.uint16(t);
|
|
37
|
+
return typeof r == "number" && Number.isFinite(r) ? r : n;
|
|
38
|
+
}
|
|
39
|
+
function i(e, t, n) {
|
|
40
|
+
let r = e.floatString(t, 0);
|
|
41
|
+
return typeof r == "number" && Number.isFinite(r) ? r : n;
|
|
42
|
+
}
|
|
43
|
+
function a(e, t) {
|
|
44
|
+
let n = e.floatString(t, 0);
|
|
45
|
+
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
46
|
+
}
|
|
47
|
+
function o(e, t) {
|
|
48
|
+
return (e.string(t) ?? "").trim();
|
|
49
|
+
}
|
|
50
|
+
function s(e) {
|
|
51
|
+
let n = e.elements[t.redData], r = e.elements[t.greenData], i = e.elements[t.blueData], a = e.elements[t.redDescriptor];
|
|
52
|
+
if (!n || !r || !i || !a) return null;
|
|
53
|
+
let o = e.uint16(t.redDescriptor, 0) ?? 0;
|
|
54
|
+
o === 0 && (o = 65536);
|
|
55
|
+
let s = e.uint16(t.redDescriptor, 2) ?? 8, c = (t) => {
|
|
56
|
+
let n = new Uint8ClampedArray(o), r = e.byteArray;
|
|
57
|
+
if (s === 16) for (let e = 0; e < o; e++) {
|
|
58
|
+
let i = t.dataOffset + e * 2;
|
|
59
|
+
n[e] = i + 1 < r.length ? r[i + 1] : 0;
|
|
60
|
+
}
|
|
61
|
+
else for (let e = 0; e < o; e++) {
|
|
62
|
+
let i = t.dataOffset + e;
|
|
63
|
+
n[e] = i < r.length ? r[i] : 0;
|
|
64
|
+
}
|
|
65
|
+
return n;
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
r: c(n),
|
|
69
|
+
g: c(r),
|
|
70
|
+
b: c(i)
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
var c = new Set([
|
|
74
|
+
"1.2.840.10008.1.2",
|
|
75
|
+
"1.2.840.10008.1.2.1",
|
|
76
|
+
"1.2.840.10008.1.2.2"
|
|
77
|
+
]), l = [
|
|
78
|
+
{
|
|
79
|
+
title: "患者",
|
|
80
|
+
specs: [
|
|
81
|
+
{
|
|
82
|
+
tag: "x00100010",
|
|
83
|
+
label: "姓名",
|
|
84
|
+
kind: "name"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
tag: "x00100020",
|
|
88
|
+
label: "ID"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
tag: "x00100030",
|
|
92
|
+
label: "出生日期",
|
|
93
|
+
kind: "date"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
tag: "x00100040",
|
|
97
|
+
label: "性别"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
tag: "x00101010",
|
|
101
|
+
label: "年龄"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
tag: "x00101030",
|
|
105
|
+
label: "体重 (kg)"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
tag: "x00101020",
|
|
109
|
+
label: "身高 (m)"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
title: "检查 (Study)",
|
|
115
|
+
specs: [
|
|
116
|
+
{
|
|
117
|
+
tag: "x00080020",
|
|
118
|
+
label: "检查日期",
|
|
119
|
+
kind: "date"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
tag: "x00080030",
|
|
123
|
+
label: "检查时间",
|
|
124
|
+
kind: "time"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
tag: "x00081030",
|
|
128
|
+
label: "检查描述"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
tag: "x00080050",
|
|
132
|
+
label: "登记号"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
tag: "x00200010",
|
|
136
|
+
label: "Study ID"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
tag: "x00080090",
|
|
140
|
+
label: "申请医师",
|
|
141
|
+
kind: "name"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
tag: "x0020000d",
|
|
145
|
+
label: "Study UID"
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
title: "序列 (Series)",
|
|
151
|
+
specs: [
|
|
152
|
+
{
|
|
153
|
+
tag: "x00080060",
|
|
154
|
+
label: "设备类型"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
tag: "x0008103e",
|
|
158
|
+
label: "序列描述"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
tag: "x00200011",
|
|
162
|
+
label: "序列号"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
tag: "x00180015",
|
|
166
|
+
label: "检查部位"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
tag: "x00185100",
|
|
170
|
+
label: "患者体位"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
tag: "x00080021",
|
|
174
|
+
label: "序列日期",
|
|
175
|
+
kind: "date"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
tag: "x00080031",
|
|
179
|
+
label: "序列时间",
|
|
180
|
+
kind: "time"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
tag: "x0020000e",
|
|
184
|
+
label: "Series UID"
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
title: "设备",
|
|
190
|
+
specs: [
|
|
191
|
+
{
|
|
192
|
+
tag: "x00080070",
|
|
193
|
+
label: "厂商"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
tag: "x00081090",
|
|
197
|
+
label: "型号"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
tag: "x00080080",
|
|
201
|
+
label: "机构"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
tag: "x00081010",
|
|
205
|
+
label: "工作站"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
tag: "x00181020",
|
|
209
|
+
label: "软件版本"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
tag: "x00080008",
|
|
213
|
+
label: "图像类型"
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
title: "采集参数",
|
|
219
|
+
specs: [
|
|
220
|
+
{
|
|
221
|
+
tag: "x00181030",
|
|
222
|
+
label: "协议名"
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
tag: "x00180050",
|
|
226
|
+
label: "层厚 (mm)"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
tag: "x00180088",
|
|
230
|
+
label: "层间距 (mm)"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
tag: "x00201041",
|
|
234
|
+
label: "层位置"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
tag: "x00180060",
|
|
238
|
+
label: "KVP"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
tag: "x00181151",
|
|
242
|
+
label: "管电流 (mA)"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
tag: "x00181150",
|
|
246
|
+
label: "曝光时间 (ms)"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
tag: "x00181152",
|
|
250
|
+
label: "曝光量 (mAs)"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
tag: "x00181210",
|
|
254
|
+
label: "卷积核"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
tag: "x00180080",
|
|
258
|
+
label: "重复时间 TR (ms)"
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
tag: "x00180081",
|
|
262
|
+
label: "回波时间 TE (ms)"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
tag: "x00180087",
|
|
266
|
+
label: "磁场强度 (T)"
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
tag: "x00181314",
|
|
270
|
+
label: "翻转角 (°)"
|
|
271
|
+
}
|
|
272
|
+
]
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
title: "图像",
|
|
276
|
+
specs: [
|
|
277
|
+
{
|
|
278
|
+
tag: "x00200013",
|
|
279
|
+
label: "实例号"
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
tag: "x00280008",
|
|
283
|
+
label: "帧数"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
tag: "x00280010",
|
|
287
|
+
label: "行 (Rows)",
|
|
288
|
+
kind: "us"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
tag: "x00280011",
|
|
292
|
+
label: "列 (Columns)",
|
|
293
|
+
kind: "us"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
tag: "x00280100",
|
|
297
|
+
label: "Bits Allocated",
|
|
298
|
+
kind: "us"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
tag: "x00280101",
|
|
302
|
+
label: "Bits Stored",
|
|
303
|
+
kind: "us"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
tag: "x00280002",
|
|
307
|
+
label: "Samples/Pixel",
|
|
308
|
+
kind: "us"
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
tag: "x00280004",
|
|
312
|
+
label: "光度"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
tag: "x00280030",
|
|
316
|
+
label: "像素间距"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
tag: "x00281050",
|
|
320
|
+
label: "窗位"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
tag: "x00281051",
|
|
324
|
+
label: "窗宽"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
tag: "x00281052",
|
|
328
|
+
label: "截距"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
tag: "x00281053",
|
|
332
|
+
label: "斜率"
|
|
333
|
+
}
|
|
334
|
+
]
|
|
335
|
+
}
|
|
336
|
+
];
|
|
337
|
+
function u(e) {
|
|
338
|
+
let t = /^(\d{4})(\d{2})(\d{2})/.exec(e);
|
|
339
|
+
return t ? `${t[1]}-${t[2]}-${t[3]}` : e;
|
|
340
|
+
}
|
|
341
|
+
function d(e) {
|
|
342
|
+
let t = /^(\d{2})(\d{2})(\d{2})/.exec(e);
|
|
343
|
+
return t ? `${t[1]}:${t[2]}:${t[3]}` : e;
|
|
344
|
+
}
|
|
345
|
+
function f(e) {
|
|
346
|
+
return e.replace(/\^+/g, " ").replace(/\s+/g, " ").trim();
|
|
347
|
+
}
|
|
348
|
+
function p(e, t) {
|
|
349
|
+
if (t.kind === "us") {
|
|
350
|
+
let n = e.uint16(t.tag);
|
|
351
|
+
return typeof n == "number" && Number.isFinite(n) ? String(n) : "";
|
|
352
|
+
}
|
|
353
|
+
let n = (e.string(t.tag) ?? "").trim();
|
|
354
|
+
return n ? t.kind === "date" ? u(n) : t.kind === "time" ? d(n) : t.kind === "name" ? f(n) : n.replace(/\\/g, " / ") : "";
|
|
355
|
+
}
|
|
356
|
+
function m(e) {
|
|
357
|
+
let t = [];
|
|
358
|
+
for (let n of l) {
|
|
359
|
+
let r = [];
|
|
360
|
+
for (let t of n.specs) {
|
|
361
|
+
let n = p(e, t);
|
|
362
|
+
n && r.push({
|
|
363
|
+
label: t.label,
|
|
364
|
+
value: n
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
r.length > 0 && t.push({
|
|
368
|
+
title: n.title,
|
|
369
|
+
rows: r
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
return t;
|
|
373
|
+
}
|
|
374
|
+
function h(l) {
|
|
375
|
+
let u = new Uint8Array(l);
|
|
376
|
+
if (u.length < 132 || u[128] !== 68 || u[129] !== 73 || u[130] !== 67 || u[131] !== 77) throw new n("不是有效的 DICOM 文件(缺少 DICM 标识)");
|
|
377
|
+
let d;
|
|
378
|
+
try {
|
|
379
|
+
d = e.parseDicom(u);
|
|
380
|
+
} catch (e) {
|
|
381
|
+
throw new n(`DICOM 解析失败:${e instanceof Error ? e.message : String(e)}`);
|
|
382
|
+
}
|
|
383
|
+
let f = d.elements[t.pixelData];
|
|
384
|
+
if (!f) throw new n("该 DICOM 不含像素数据(可能仅为结构化报告/元数据)");
|
|
385
|
+
let p = r(d, t.rows, 0), h = r(d, t.columns, 0);
|
|
386
|
+
if (p < 1 || h < 1) throw new n("像素尺寸无效");
|
|
387
|
+
let g = r(d, t.bitsAllocated, 8);
|
|
388
|
+
if (g !== 8 && g !== 16) throw new n(`暂不支持 ${g}-bit 像素(仅支持 8/16-bit)`);
|
|
389
|
+
let _ = {
|
|
390
|
+
transferSyntaxUid: o(d, t.transferSyntax) || "1.2.840.10008.1.2",
|
|
391
|
+
rows: p,
|
|
392
|
+
columns: h,
|
|
393
|
+
samplesPerPixel: r(d, t.samplesPerPixel, 1),
|
|
394
|
+
photometric: o(d, t.photometric) || "MONOCHROME2",
|
|
395
|
+
bitsAllocated: g,
|
|
396
|
+
bitsStored: r(d, t.bitsStored, g),
|
|
397
|
+
highBit: r(d, t.highBit, g - 1),
|
|
398
|
+
pixelRepresentation: r(d, t.pixelRepresentation, 0),
|
|
399
|
+
planarConfiguration: r(d, t.planarConfiguration, 0),
|
|
400
|
+
numberOfFrames: Math.max(1, d.intString(t.numberOfFrames) ?? 1),
|
|
401
|
+
windowCenter: a(d, t.windowCenter),
|
|
402
|
+
windowWidth: a(d, t.windowWidth),
|
|
403
|
+
rescaleSlope: i(d, t.rescaleSlope, 1),
|
|
404
|
+
rescaleIntercept: i(d, t.rescaleIntercept, 0),
|
|
405
|
+
palette: null,
|
|
406
|
+
modality: o(d, t.modality),
|
|
407
|
+
studyDescription: o(d, t.studyDescription),
|
|
408
|
+
seriesDescription: o(d, t.seriesDescription),
|
|
409
|
+
bodyPart: o(d, t.bodyPart)
|
|
410
|
+
};
|
|
411
|
+
_.photometric === "PALETTE COLOR" && (_.palette = s(d));
|
|
412
|
+
let v = m(d), y = !c.has(_.transferSyntaxUid), b = _.transferSyntaxUid === "1.2.840.10008.1.2.5", x = p * h * _.samplesPerPixel * (g / 8), S = _.numberOfFrames;
|
|
413
|
+
function C(t) {
|
|
414
|
+
let r = Math.min(Math.max(t, 0), S - 1);
|
|
415
|
+
if (!y) {
|
|
416
|
+
let e = f.dataOffset + r * x;
|
|
417
|
+
return u.subarray(e, e + x);
|
|
418
|
+
}
|
|
419
|
+
try {
|
|
420
|
+
if (b) return e.readEncapsulatedPixelDataFromFragments(d, f, r);
|
|
421
|
+
let t = f.basicOffsetTable;
|
|
422
|
+
if (!t || t.length === 0) try {
|
|
423
|
+
t = e.createJPEGBasicOffsetTable(d, f);
|
|
424
|
+
} catch {
|
|
425
|
+
t = [];
|
|
426
|
+
}
|
|
427
|
+
if (t && t.length > 0) return e.readEncapsulatedImageFrame(d, f, r, t);
|
|
428
|
+
let n = f.fragments?.length ?? 1;
|
|
429
|
+
return S <= 1 ? e.readEncapsulatedPixelDataFromFragments(d, f, 0, n) : e.readEncapsulatedPixelDataFromFragments(d, f, r);
|
|
430
|
+
} catch (e) {
|
|
431
|
+
throw new n(`读取第 ${r + 1} 帧像素失败:${e instanceof Error ? e.message : String(e)}`);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
return {
|
|
435
|
+
meta: _,
|
|
436
|
+
encapsulated: y,
|
|
437
|
+
tags: v,
|
|
438
|
+
frameBytes: C
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
//#endregion
|
|
442
|
+
export { n as DicomError, h as readDicom };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DICOM pixel-data decoding: turn one frame's transfer-syntax-encoded bytes into raw pixel samples.
|
|
3
|
+
*
|
|
4
|
+
* Browsers have no native DICOM/JPEG2000/JPEG-LS decoder, so compressed transfer syntaxes are decoded by the
|
|
5
|
+
* cornerstone WASM codecs (openjpeg / charls / libjpeg-turbo), lazily `import()`-ed only when a compressed
|
|
6
|
+
* frame is actually opened — so the main bundle and non-DICOM users pay nothing. Uncompressed and RLE are
|
|
7
|
+
* handled here directly (RLE is a hand-rolled PackBits unpack — no dependency needed). The *predictive
|
|
8
|
+
* lossless* JPEGs (Process 14 / SV1) are a different beast — libjpeg-turbo is DCT-only and cannot decode
|
|
9
|
+
* them — so they go through `jpeg-lossless-decoder-js` (pure JS), also lazily imported.
|
|
10
|
+
*
|
|
11
|
+
* Output contract: {@link decodeDicomFrame} returns interleaved pixel-sample BYTES laid out exactly like an
|
|
12
|
+
* uncompressed frame would be (little-endian for 16-bit), so the render layer (lib/dicomRender.ts) has a
|
|
13
|
+
* single code path regardless of how the pixels were stored.
|
|
14
|
+
*/
|
|
15
|
+
import type { DicomMeta } from './dicom';
|
|
16
|
+
export declare function transferSyntaxName(uid: string): string;
|
|
17
|
+
export declare class UnsupportedTransferSyntaxError extends Error {
|
|
18
|
+
constructor(uid: string);
|
|
19
|
+
}
|
|
20
|
+
export interface DecodedFrame {
|
|
21
|
+
/** Interleaved pixel-sample bytes (little-endian for 16-bit), laid out like an uncompressed frame. */
|
|
22
|
+
bytes: Uint8Array;
|
|
23
|
+
littleEndian: boolean;
|
|
24
|
+
bitsPerSample: number;
|
|
25
|
+
componentCount: number;
|
|
26
|
+
}
|
|
27
|
+
/** Decode one frame. Async because compressed transfer syntaxes lazy-load a WASM codec. */
|
|
28
|
+
export declare function decodeDicomFrame(meta: DicomMeta, encoded: Uint8Array): Promise<DecodedFrame>;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
//#region src/lib/dicomCodecs.ts
|
|
2
|
+
var e = {
|
|
3
|
+
IMPLICIT_LE: "1.2.840.10008.1.2",
|
|
4
|
+
EXPLICIT_LE: "1.2.840.10008.1.2.1",
|
|
5
|
+
EXPLICIT_BE: "1.2.840.10008.1.2.2",
|
|
6
|
+
DEFLATED: "1.2.840.10008.1.2.1.99",
|
|
7
|
+
RLE: "1.2.840.10008.1.2.5",
|
|
8
|
+
JPEG_BASELINE: "1.2.840.10008.1.2.4.50",
|
|
9
|
+
JPEG_EXTENDED: "1.2.840.10008.1.2.4.51",
|
|
10
|
+
JPEG_LOSSLESS_57: "1.2.840.10008.1.2.4.57",
|
|
11
|
+
JPEG_LOSSLESS_70: "1.2.840.10008.1.2.4.70",
|
|
12
|
+
JPEGLS_LOSSLESS: "1.2.840.10008.1.2.4.80",
|
|
13
|
+
JPEGLS_NEAR: "1.2.840.10008.1.2.4.81",
|
|
14
|
+
J2K_LOSSLESS: "1.2.840.10008.1.2.4.90",
|
|
15
|
+
J2K: "1.2.840.10008.1.2.4.91"
|
|
16
|
+
}, t = new Set([
|
|
17
|
+
e.IMPLICIT_LE,
|
|
18
|
+
e.EXPLICIT_LE,
|
|
19
|
+
e.EXPLICIT_BE
|
|
20
|
+
]), n = {
|
|
21
|
+
[e.IMPLICIT_LE]: "隐式 VR 小端(未压缩)",
|
|
22
|
+
[e.EXPLICIT_LE]: "显式 VR 小端(未压缩)",
|
|
23
|
+
[e.EXPLICIT_BE]: "显式 VR 大端(未压缩)",
|
|
24
|
+
[e.DEFLATED]: "Deflated 显式 VR",
|
|
25
|
+
[e.RLE]: "RLE 无损",
|
|
26
|
+
[e.JPEG_BASELINE]: "JPEG Baseline",
|
|
27
|
+
[e.JPEG_EXTENDED]: "JPEG Extended (12-bit)",
|
|
28
|
+
[e.JPEG_LOSSLESS_57]: "JPEG Lossless (P14)",
|
|
29
|
+
[e.JPEG_LOSSLESS_70]: "JPEG Lossless (P14 SV1)",
|
|
30
|
+
[e.JPEGLS_LOSSLESS]: "JPEG-LS 无损",
|
|
31
|
+
[e.JPEGLS_NEAR]: "JPEG-LS 近无损",
|
|
32
|
+
[e.J2K_LOSSLESS]: "JPEG 2000 无损",
|
|
33
|
+
[e.J2K]: "JPEG 2000"
|
|
34
|
+
};
|
|
35
|
+
function r(e) {
|
|
36
|
+
return n[e] ?? e;
|
|
37
|
+
}
|
|
38
|
+
var i = class extends Error {
|
|
39
|
+
constructor(e) {
|
|
40
|
+
super(`暂不支持的传输语法:${r(e)}(${e})`), this.name = "UnsupportedTransferSyntaxError";
|
|
41
|
+
}
|
|
42
|
+
}, a = null, o = null, s = null;
|
|
43
|
+
function c() {
|
|
44
|
+
return a ??= import("@cornerstonejs/codec-openjpeg/decode").then((e) => e.default()), a;
|
|
45
|
+
}
|
|
46
|
+
function l() {
|
|
47
|
+
return o ??= import("@cornerstonejs/codec-charls/decode").then((e) => e.default()), o;
|
|
48
|
+
}
|
|
49
|
+
function u() {
|
|
50
|
+
return s ??= import("@cornerstonejs/codec-libjpeg-turbo-8bit/decode").then((e) => e.default()), s;
|
|
51
|
+
}
|
|
52
|
+
var d = null;
|
|
53
|
+
function f() {
|
|
54
|
+
return d ??= import("jpeg-lossless-decoder-js"), d;
|
|
55
|
+
}
|
|
56
|
+
function p(e, t, n) {
|
|
57
|
+
if (!t) throw Error("codec 模块缺少解码器");
|
|
58
|
+
let r = new t();
|
|
59
|
+
try {
|
|
60
|
+
r.getEncodedBuffer(n.length).set(n), r.decode();
|
|
61
|
+
let e = r.getFrameInfo();
|
|
62
|
+
return {
|
|
63
|
+
bytes: r.getDecodedBuffer().slice(),
|
|
64
|
+
info: e
|
|
65
|
+
};
|
|
66
|
+
} finally {
|
|
67
|
+
r.delete();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function m(n, a) {
|
|
71
|
+
let o = n.transferSyntaxUid;
|
|
72
|
+
if (t.has(o)) return {
|
|
73
|
+
bytes: a,
|
|
74
|
+
littleEndian: o !== e.EXPLICIT_BE,
|
|
75
|
+
bitsPerSample: n.bitsAllocated,
|
|
76
|
+
componentCount: n.samplesPerPixel
|
|
77
|
+
};
|
|
78
|
+
if (o === e.RLE) return {
|
|
79
|
+
bytes: g(a, n),
|
|
80
|
+
littleEndian: !0,
|
|
81
|
+
bitsPerSample: n.bitsAllocated,
|
|
82
|
+
componentCount: n.samplesPerPixel
|
|
83
|
+
};
|
|
84
|
+
if (o === e.JPEG_LOSSLESS_57 || o === e.JPEG_LOSSLESS_70) try {
|
|
85
|
+
let { Decoder: e } = await f(), t = new e(), r = t.decode(a.buffer, a.byteOffset, a.byteLength);
|
|
86
|
+
return {
|
|
87
|
+
bytes: new Uint8Array(r.buffer, r.byteOffset, r.byteLength),
|
|
88
|
+
littleEndian: !0,
|
|
89
|
+
bitsPerSample: (t.numBytes || n.bitsAllocated / 8) * 8,
|
|
90
|
+
componentCount: t.numComp || n.samplesPerPixel
|
|
91
|
+
};
|
|
92
|
+
} catch (e) {
|
|
93
|
+
throw Error(`${r(o)} 解码失败:${e instanceof Error ? e.message : String(e)}`);
|
|
94
|
+
}
|
|
95
|
+
let s, d;
|
|
96
|
+
switch (o) {
|
|
97
|
+
case e.JPEG_BASELINE:
|
|
98
|
+
case e.JPEG_EXTENDED:
|
|
99
|
+
s = await u(), d = s.JPEGDecoder;
|
|
100
|
+
break;
|
|
101
|
+
case e.JPEGLS_LOSSLESS:
|
|
102
|
+
case e.JPEGLS_NEAR:
|
|
103
|
+
s = await l(), d = s.JpegLSDecoder;
|
|
104
|
+
break;
|
|
105
|
+
case e.J2K_LOSSLESS:
|
|
106
|
+
case e.J2K:
|
|
107
|
+
s = await c(), d = s.J2KDecoder;
|
|
108
|
+
break;
|
|
109
|
+
default: throw new i(o);
|
|
110
|
+
}
|
|
111
|
+
let m, h;
|
|
112
|
+
try {
|
|
113
|
+
({bytes: h, info: m} = p(s, d, a));
|
|
114
|
+
} catch (e) {
|
|
115
|
+
throw Error(`${r(o)} 解码失败:${e instanceof Error ? e.message : String(e)}`);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
bytes: h,
|
|
119
|
+
littleEndian: !0,
|
|
120
|
+
bitsPerSample: m.bitsPerSample || n.bitsAllocated,
|
|
121
|
+
componentCount: m.componentCount || n.samplesPerPixel
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function h(e, t) {
|
|
125
|
+
let n = new Uint8Array(t), r = 0, i = 0;
|
|
126
|
+
for (; i < e.length && r < t;) {
|
|
127
|
+
let a = e[i++] << 24 >> 24;
|
|
128
|
+
if (a >= 0) {
|
|
129
|
+
let o = a + 1;
|
|
130
|
+
for (let a = 0; a < o && i < e.length && r < t; a++) n[r++] = e[i++];
|
|
131
|
+
} else if (a !== -128) {
|
|
132
|
+
let o = 1 - a, s = i < e.length ? e[i++] : 0;
|
|
133
|
+
for (let e = 0; e < o && r < t; e++) n[r++] = s;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return n;
|
|
137
|
+
}
|
|
138
|
+
function g(e, t) {
|
|
139
|
+
let { rows: n, columns: r, samplesPerPixel: i, bitsAllocated: a } = t, o = n * r, s = a / 8, c = new DataView(e.buffer, e.byteOffset, e.byteLength), l = c.getUint32(0, !0), u = [];
|
|
140
|
+
for (let e = 0; e < l; e++) u.push(c.getUint32(4 + e * 4, !0));
|
|
141
|
+
let d = [];
|
|
142
|
+
for (let t = 0; t < l; t++) {
|
|
143
|
+
let n = u[t], r = t + 1 < l ? u[t + 1] : e.length;
|
|
144
|
+
d.push(h(e.subarray(n, r), o));
|
|
145
|
+
}
|
|
146
|
+
let f = new Uint8Array(o * i * s);
|
|
147
|
+
for (let e = 0; e < i; e++) for (let t = 0; t < s; t++) {
|
|
148
|
+
let n = d[e * s + t];
|
|
149
|
+
if (!n) continue;
|
|
150
|
+
let r = s - 1 - t;
|
|
151
|
+
for (let t = 0; t < o; t++) f[(t * i + e) * s + r] = n[t];
|
|
152
|
+
}
|
|
153
|
+
return f;
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { i as UnsupportedTransferSyntaxError, m as decodeDicomFrame, r as transferSyntaxName };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DICOM pixel → screen rendering: stored samples to displayable RGBA.
|
|
3
|
+
*
|
|
4
|
+
* Splits into two steps so the interactive window/level (brightness/contrast) drag stays cheap:
|
|
5
|
+
* 1. {@link buildFramePixels} — decode the raw bytes into per-pixel values ONCE per frame (apply the
|
|
6
|
+
* modality rescale LUT, honour bit depth / signedness / endianness, separate grayscale vs RGB vs
|
|
7
|
+
* palette). The expensive parse happens here.
|
|
8
|
+
* 2. {@link renderToImageData} — apply the VOI window + invert and write RGBA. Cheap enough to re-run on
|
|
9
|
+
* every drag frame, since it only maps already-decoded values.
|
|
10
|
+
*
|
|
11
|
+
* The VOI window mapping follows the DICOM PS3.3 C.11.2.1.2 LINEAR formula. MONOCHROME1 (0 = white) is
|
|
12
|
+
* handled by inverting the grayscale ramp.
|
|
13
|
+
*/
|
|
14
|
+
import type { DecodedFrame } from './dicomCodecs';
|
|
15
|
+
import type { DicomMeta, DicomPalette } from './dicom';
|
|
16
|
+
export interface FramePixels {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
mode: 'gray' | 'rgb' | 'palette';
|
|
20
|
+
/** Grayscale: per-pixel modality value (rescale slope/intercept already applied). */
|
|
21
|
+
gray?: Float32Array;
|
|
22
|
+
/** Palette: per-pixel LUT index. */
|
|
23
|
+
indices?: Int32Array;
|
|
24
|
+
palette?: DicomPalette;
|
|
25
|
+
/** RGB: interleaved R,G,B bytes (3 per pixel). */
|
|
26
|
+
rgb?: Uint8Array;
|
|
27
|
+
/** Grayscale modality-value range, for auto-windowing. */
|
|
28
|
+
minValue: number;
|
|
29
|
+
maxValue: number;
|
|
30
|
+
/** MONOCHROME1: low values display bright — the grayscale ramp is inverted. */
|
|
31
|
+
monochrome1: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface WindowParams {
|
|
34
|
+
windowCenter: number;
|
|
35
|
+
windowWidth: number;
|
|
36
|
+
invert: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Decode one frame's bytes into per-pixel values (the expensive step; do this once per frame). */
|
|
39
|
+
export declare function buildFramePixels(decoded: DecodedFrame, meta: DicomMeta): FramePixels;
|
|
40
|
+
/** A sensible default window: the file's own VOI when present, else the full modality-value range. */
|
|
41
|
+
export declare function autoWindow(fp: FramePixels): {
|
|
42
|
+
center: number;
|
|
43
|
+
width: number;
|
|
44
|
+
};
|
|
45
|
+
/** Apply the VOI window + invert and produce RGBA pixels for the canvas. Cheap — safe to call on each drag. */
|
|
46
|
+
export declare function renderToImageData(fp: FramePixels, params: WindowParams): ImageData;
|