Add scoped DICOM series previews with 3D volume and MPR views

This commit is contained in:
SantaSpeen committed 2026-10-22 21:06:46 +03:00
1 parent 7371c29111
commit 6d8faa7d03
23 files changed
+1479 -20

No files matched your search

+13 -1
View File
@@ -10,4 +10,16 @@
Для FS потребуется индексировать файлы выбранной папки по StudyInstanceUID и SeriesInstanceUID, учитывать ориентацию, положение и расстояние между срезами. Объём строится из согласованной серии срезов или подходящего многокадрового DICOM; из одиночной обычной 2D-проекции полноценный объём не получается. Доступ к файлам и метаданным должен наследовать текущие права пользователя либо публичной ссылки.
Для старых ПК следует оставить лёгкий 2D-режим, загружать объём по запросу и ограничивать память/число кадров. Cornerstone3D использует WebGL2 для объёмов; документация также описывает CPU fallback для 2D stack. Сам просмотрщик ещё не внедрён — это результаты исследования и предложение интеграции.
## Реализация в FS
В предпросмотр встроен лёгкий 2D-режим на Daikon и отдельный, лениво загружаемый объёмный просмотр на Cornerstone3D. Внешний PACS и отдельный сервер просмотрщика не нужны. Декодирование выполняется в существующем Web Worker; поддерживаются те же пиксельные форматы и кодеки, что и в 2D. Cornerstone получает готовые значения с применёнными rescale slope/intercept.
Если открыто имя вида `prefix_123.dcm` и все файлы родительской папки принадлежат этой нумерованной серии, появляется кнопка **Открыть как 3D**. Подпапки не учитываются. Имена определяют только предложение: после нажатия проверяются Study/Series/FrameOfReference UID, уникальность SOPInstanceUID, размеры, ориентация, PixelSpacing и ImagePositionPatient. Порядок определяется координатами пациента, а не именами. Дубликаты позиций, неравномерный шаг, несовпадающие серии и наклонённые относительно сетки срезы отклоняются. Обычные одиночные снимки и многокадровые файлы остаются в 2D; сборка объёма сейчас поддерживает серии однокадровых монохромных файлов с обычными верхнеуровневыми тегами геометрии.
Объёмный режим включает вращение и масштабирование 3D, аксиальную/сагиттальную/корональную реконструкцию, прокрутку срезов, перемещение, яркость/контрастность и непрозрачность. Нужен WebGL2. На неподходящем устройстве сохраняется 2D.
Ограничения: до 2048 файлов, 64 МиБ на исходный файл, 512 МиБ суммарной загрузки и 128 МиБ Float32-вокселей. Это лимит массива объёма, а не всей памяти браузера: сборка и GPU требуют дополнительной памяти. Файлы читаются последовательно только после нажатия кнопки, загрузку можно отменить. При закрытии удаляются движок, GPU-ресурсы и принадлежащие просмотру записи кеша.
Для приватных файлов используются обычные авторизованные API; для публичных — только API текущей ссылки с её токеном. Публичная ссылка на отдельный файл не запрашивает содержимое его родительской папки.
В сборщике `xmlbuilder2` направлен на официальный браузерный bundle: серверный entry зависимости VTK требует Node EventEmitter и не запускается в браузере. CSP страницы не ослабляется, сторонние CDN не используются.
+3 -1
View File
@@ -19,6 +19,7 @@
},
"dependencies": {
"@chenfengyuan/vue-number-input": "^2.0.1",
"@cornerstonejs/core": "^5.13.1",
"@vueuse/core": "^14.4.0",
"@vueuse/integrations": "^14.4.0",
"ace-builds": "^1.45.2",
@@ -73,7 +74,8 @@
"vite": "^8.3.5",
"vite-plugin-compression2": "^2.5.3",
"vitest": "^4.1.12",
"vue-tsc": "^3.3.13"
"vue-tsc": "^3.3.13",
"xmlbuilder2": "4.0.3"
},
"packageManager": "pnpm@10.33.4+sha512.1c67b3b359b2d408119ba1ed289f34b8fc3c6873412bec6fd264fbdc82489e510fcbecb9ce9d22dae7f3b76269d8441046014bdca53b9979cd7a561ad631b800"
}
+411
View File
@@ -18,6 +18,9 @@ importers:
'@chenfengyuan/vue-number-input':
specifier: ^2.0.1
version: 2.0.1(vue@3.5.44(typescript@5.9.3))
'@cornerstonejs/core':
specifier: ^5.13.1
version: 5.13.1(@cornerstonejs/metadata@5.13.1)(@cornerstonejs/utils@5.13.1)(autoprefixer@10.6.1(postcss@8.5.31))(wslink@2.5.0)
'@vueuse/core':
specifier: ^14.4.0
version: 14.4.0(vue@3.5.44(typescript@5.9.3))
@@ -178,6 +181,9 @@ importers:
vue-tsc:
specifier: ^3.3.13
version: 3.3.13(typescript@5.9.3)
xmlbuilder2:
specifier: 4.0.3
version: 4.0.3
packages:
@@ -679,6 +685,10 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0 || ^8.0.0-0 <8.0.0
'@babel/runtime-corejs3@7.29.2':
resolution: {integrity: sha512-Lc94FOD5+0aXhdb0Tdg3RUtqT6yWbI/BbFWvlaSJ3gAb9Ks+99nHRDKADVqC37er4eCB0fHyWT+y+K3QOvJKbw==}
engines: {node: '>=6.9.0'}
'@babel/runtime@7.29.10':
resolution: {integrity: sha512-NpugTzbKgGrNe45Ui32cN8vCFFMxVtP/9rtfwv0nP5FRDAjvYBxJcLVpYA9mr1jxP6cnIT7x9LUzuDTbWYYNRA==}
engines: {node: '>=6.9.0'}
@@ -710,6 +720,22 @@ packages:
peerDependencies:
vue: ^3.0.0
'@cornerstonejs/calculate-suv@1.0.3':
resolution: {integrity: sha512-2SwVJKzC1DzyxdxJtCht9dhTND2GFjLwhhkDyyC7vJq5tIgbhxgPk1CSwovO1pxmoybAXzjOxnaubllxLgoT+w==}
engines: {node: '>=10'}
'@cornerstonejs/core@5.13.1':
resolution: {integrity: sha512-uHj+S+yih7JKcmuWTxXm/W1L5dC3lirB22uVJzRnTKgnf1ODgnZuewwkMOry5ZAXLiPBESkCsYkv8yb++Q/hcg==}
peerDependencies:
'@cornerstonejs/metadata': 5.13.1
'@cornerstonejs/utils': 5.13.1
'@cornerstonejs/metadata@5.13.1':
resolution: {integrity: sha512-na1T/RMSCPYGH0d6XFDTLsw4gJW1iljX96NUk1U1+QVKTDubBLLOX3+l+FVEOLEcmxwUaVjtoL1pLMMJykeAQQ==}
'@cornerstonejs/utils@5.13.1':
resolution: {integrity: sha512-oGOeUgUW93tmLPwvRVkSCp/DqnBf+fVDktpJWQroTgU6WPuMWMfGsZl2NETwNSU8zxV9VHAkfT9T+KpX+dWIfg==}
'@dual-bundle/import-meta-resolve@4.2.1':
resolution: {integrity: sha512-id+7YRUgoUX6CgV0DtuhirQWodeeA7Lf4i2x71JS/vtA5pRb/hIGWlw+G6MeXvsM+MXrz0VAydTGElX1rAfgPg==}
@@ -1009,6 +1035,17 @@ packages:
'@keyv/serialize@1.1.1':
resolution: {integrity: sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==}
'@kitware/vtk.js@36.4.1':
resolution: {integrity: sha512-vHgiOZTHS7wgEw6Cbuv6vS+zlTx8HgepPqq0UMTWx6T+OcmP2qJCGRpHI1eTPqKcN2SaEHIK7DSsVatTHZ9OPw==}
hasBin: true
peerDependencies:
autoprefixer: ^10.4.7
wslink: '>=1.1.0 || ^2.0.0'
'@msgpack/msgpack@2.8.0':
resolution: {integrity: sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ==}
engines: {node: '>= 10'}
'@napi-rs/canvas-android-arm64@1.0.13':
resolution: {integrity: sha512-trn7AaDzQ+yeeA0ezhkC7cB1ZDPtp4UYk0EvB5F8qtYL9jEVWtVrU30WOpI52DszoTxaTsCgf5PP4ZVaOlOIHQ==}
engines: {node: '>= 10'}
@@ -1084,6 +1121,22 @@ packages:
resolution: {integrity: sha512-b87ugZpQ5ViwqVBkjervxpwa0GmJPsKHLBNoZN6GpjWeHzTbDUGryriq+2DYW2XbB+xCqSIINQysC0/I87nPbw==}
engines: {node: '>= 10'}
'@oozcitak/dom@2.0.2':
resolution: {integrity: sha512-GjpKhkSYC3Mj4+lfwEyI1dqnsKTgwGy48ytZEhm4A/xnH/8z9M3ZVXKr/YGQi3uCLs1AEBS+x5T2JPiueEDW8w==}
engines: {node: '>=20.0'}
'@oozcitak/infra@2.0.2':
resolution: {integrity: sha512-2g+E7hoE2dgCz/APPOEK5s3rMhJvNxSMBrP+U+j1OWsIbtSpWxxlUjq1lU8RIsFJNYv7NMlnVsCuHcUzJW+8vA==}
engines: {node: '>=20.0'}
'@oozcitak/url@3.0.0':
resolution: {integrity: sha512-ZKfET8Ak1wsLAiLWNfFkZc/BraDccuTJKR6svTYc7sVjbR+Iu0vtXdiDMY4o6jaFl5TW2TlS7jbLl4VovtAJWQ==}
engines: {node: '>=20.0'}
'@oozcitak/util@10.0.0':
resolution: {integrity: sha512-hAX0pT/73190NLqBPPWSdBVGtbY6VOhWYK3qqHqtXQ1gK7kS2yz4+ivsN07hpJ6I3aeMtKP6J6npsEKOAzuTLA==}
engines: {node: '>=20.0'}
'@oxc-project/types@0.155.0':
resolution: {integrity: sha512-SeE8JPwW1xs1tHeNycjUtUBdhorRa8o4jlvjwk49R7/Z291i+4DQa7JJIgOm/TaYQZx+QrPQbVJ/9c8dMIZN8Q==}
@@ -1239,6 +1292,9 @@ packages:
'@types/web-bluetooth@0.0.21':
resolution: {integrity: sha512-oIQLCGWtcFZy2JW77j9k8nHzAOpqMHLQejDA48XXMWH6tjCQHz5RCFz1bzsmROyL6PUm+LLnUiI4BCn221inxA==}
'@types/webxr@0.5.5':
resolution: {integrity: sha512-HVOsSRTQYx3zpVl0c0FBmmmcY/60BkQLzVnpE9M1aG4f2Z0aKlBWfj4XZ2zr++XNBfkQWYcwhGlmuu44RJPDqg==}
'@typescript-eslint/eslint-plugin@8.72.0':
resolution: {integrity: sha512-aysKgysPX9XOv/dk95UkvUDe++Q3n3dJPG9CEWT3RUccxfkPJ+Qn6nhKPDhZXU6Ofo9kgwGWwKyQCnZIXTgngg==}
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
@@ -1516,6 +1572,10 @@ packages:
engines: {node: '>=0.4.0'}
hasBin: true
adm-zip@0.5.17:
resolution: {integrity: sha512-+Ut8d9LLqwEvHHJl1+PIHqoyDxFgVN847JTVM3Izi3xHDWPE4UtzzXysMZQs64DMcrJfBeS/uoEP4AD3HQHnQQ==}
engines: {node: '>=12.0'}
aes-decrypter@4.0.2:
resolution: {integrity: sha512-lc+/9s6iJvuaRe5qDlMTpCFjnwpkeOXp8qP3oiZ5jsj1MRg+SBVUmmICrhxHvc8OELSmc+fEyyxAuppY6hrWzw==}
@@ -1525,6 +1585,9 @@ packages:
alien-signals@3.2.1:
resolution: {integrity: sha512-I8FjmltrfnDFoZedi5CG8DghVYNhzb/Ijluz7tCSJH0xpd0484Kowhbb1XDYOxfJpU1p5wnM2X54dA+IfGyD1g==}
argparse@2.0.1:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
assertion-error@2.0.1:
resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==}
engines: {node: '>=12'}
@@ -1563,6 +1626,9 @@ packages:
peerDependencies:
'@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0
balanced-match@1.0.2:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
balanced-match@4.0.4:
resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==}
engines: {node: 18 || 20 || >=22}
@@ -1578,6 +1644,9 @@ packages:
boolbase@1.0.0:
resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==}
brace-expansion@1.1.21:
resolution: {integrity: sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==}
brace-expansion@5.0.12:
resolution: {integrity: sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==}
engines: {node: 20 || >=22}
@@ -1614,6 +1683,9 @@ packages:
combine-errors@3.0.3:
resolution: {integrity: sha512-C8ikRNRMygCwaTx+Ek3Yr+OuZzgZjduCOfSQBjbM8V3MfgcjSTeto/GXP6PAwKvJz/v15b7GHZvx5rOlczFw/Q==}
comlink@4.4.2:
resolution: {integrity: sha512-OxGdvBmJuNKSCMO4NTl1L47VRp6xn2wG4F/2hYzB6tiCb709otOxtEYCSvK80PtjODfXXZu8ds+Nw5kVCjqd2g==}
commander@15.0.0:
resolution: {integrity: sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==}
engines: {node: '>=22.12.0'}
@@ -1621,6 +1693,13 @@ packages:
commander@2.20.3:
resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==}
commander@9.2.0:
resolution: {integrity: sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==}
engines: {node: ^12.20.0 || >=14}
concat-map@0.0.1:
resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==}
confbox@0.1.8:
resolution: {integrity: sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==}
@@ -1638,6 +1717,9 @@ packages:
resolution: {integrity: sha512-52r6fkXgxv4GLMjmFcMWRx7X9bw071xTTdrDcdyPGRqU2oE+9pCG0bAOMifSBdLw0JRBZKEF0q3B55qPlLuE8g==}
engines: {node: '>=6.4.0'}
core-js-pure@3.51.0:
resolution: {integrity: sha512-NE4SFDJ+qzQeqHG2vVSNwopzS6zZNPYJ5kinIqs+OofTqGzOmICgT89E/yvS9XY7rwb3eU1utWXTJ9nVFqv74A==}
core-js@3.51.0:
resolution: {integrity: sha512-7bDKx/5jm5MxzsXxc93g6Z2+4ZsuT/MddrfRmTDJNAkWsYWHU8EVNEsBiIEWnMAMCHMmRfUEjkuo3jeNBOIHRw==}
@@ -1665,6 +1747,34 @@ packages:
custom-error-instance@2.1.1:
resolution: {integrity: sha512-p6JFxJc3M4OTD2li2qaHkDCw9SfMw82Ldr6OC9Je1aXiGfhx2W8p3GaoeaGrPJTUN9NirTM/KTxHWMUdR1rsUg==}
d3-array@3.2.4:
resolution: {integrity: sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==}
engines: {node: '>=12'}
d3-color@3.1.0:
resolution: {integrity: sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==}
engines: {node: '>=12'}
d3-format@3.1.2:
resolution: {integrity: sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==}
engines: {node: '>=12'}
d3-interpolate@3.0.1:
resolution: {integrity: sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==}
engines: {node: '>=12'}
d3-scale@4.0.2:
resolution: {integrity: sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==}
engines: {node: '>=12'}
d3-time-format@4.1.0:
resolution: {integrity: sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==}
engines: {node: '>=12'}
d3-time@3.1.0:
resolution: {integrity: sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==}
engines: {node: '>=12'}
d@1.0.2:
resolution: {integrity: sha512-MOqHvMWF9/9MX6nza0KgvFH4HpMU0EF5uUDXqX/BtxtU8NfB0QzRtJ8Oe/6SuS4kbhyzVJwjd97EA4PKrzJ8bw==}
engines: {node: '>=0.12'}
@@ -1675,6 +1785,10 @@ packages:
dayjs@1.11.23:
resolution: {integrity: sha512-QDTCU0M0MxR3hQfnlDJfwekQiaanm1ubOD231u73WBckQ/fsamwRLiE2GBz6D3a/xF1NgfiDLJjXBa1hYOYTtQ==}
dcmjs@0.52.0:
resolution: {integrity: sha512-0/mT9NACKnwnOnkUx7JAqmWxRcUr7HiCoptw1KhN2StNYE0Hy6+tmpI7CU+lJuBc4rFpcMCalvI8QO6JkJ+7Fg==}
engines: {node: '>=22.13'}
debug@4.4.3:
resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==}
engines: {node: '>=6.0'}
@@ -1862,6 +1976,9 @@ packages:
picomatch:
optional: true
fflate@0.7.3:
resolution: {integrity: sha512-0Zz1jOzJWERhyhsimS54VTqOteCNwRtIlh8isdL0AXLo0g7xNTfTL7oWrkmCnPhZGocKIkWHBistBrrpoNH3aw==}
fflate@0.8.3:
resolution: {integrity: sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==}
@@ -1888,6 +2005,9 @@ packages:
fraction.js@5.3.4:
resolution: {integrity: sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==}
fs.realpath@1.0.0:
resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==}
fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@@ -1900,10 +2020,20 @@ packages:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
gl-matrix@3.4.3:
resolution: {integrity: sha512-wcCp8vu8FT22BnvKVPjXa/ICBWRq/zjFfdofZy1WSpQZpphblv12/bOQLBC1rMM7SGOFS9ltVmKOHil5+Ml7gA==}
gl-matrix@3.4.4:
resolution: {integrity: sha512-latSnyDNt/8zYUB6VIJ6PCh2jBjJX6gnDsoCZ7LyW7GkqrD51EWwa9qCoGixj8YqBtETQK/xY7OmpTF8xz1DdQ==}
glob-parent@6.0.2:
resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==}
engines: {node: '>=10.13.0'}
glob@7.2.3:
resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==}
deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
global@4.4.0:
resolution: {integrity: sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==}
@@ -1942,9 +2072,27 @@ packages:
resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==}
engines: {node: '>=0.8.19'}
inflight@1.0.6:
resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==}
deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
inherits@2.0.4:
resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==}
internmap@2.0.3:
resolution: {integrity: sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==}
engines: {node: '>=12'}
interpret@1.4.0:
resolution: {integrity: sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==}
engines: {node: '>= 0.10'}
iota-array@1.0.0:
resolution: {integrity: sha512-pZ2xT+LOHckCatGQ3DcG/a+QuEqvoxqkiL7tvE8nn3uuu+f6i1TtpB5/FtWFbxUuVr5PZCx8KskuGatbJDXOWA==}
is-buffer@1.1.6:
resolution: {integrity: sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==}
is-core-module@2.17.0:
resolution: {integrity: sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==}
engines: {node: '>= 0.4'}
@@ -1979,6 +2127,10 @@ packages:
js-tokens@4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
js-yaml@4.3.2:
resolution: {integrity: sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==}
hasBin: true
jsesc@3.1.0:
resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==}
engines: {node: '>=6'}
@@ -2129,6 +2281,9 @@ packages:
lodash._stringtopath@4.8.0:
resolution: {integrity: sha512-SXL66C731p0xPDC5LZg4wI5H+dJo/EO4KTqOMwLYCH3+FmmfAKJEZCm6ohGpI+T1xwsDsJCfL4OnhorllvlTPQ==}
lodash.clonedeep@4.5.0:
resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==}
lodash.debounce@4.0.8:
resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==}
@@ -2141,6 +2296,10 @@ packages:
lodash@4.18.1:
resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==}
loglevel@1.9.2:
resolution: {integrity: sha512-HgMmCqIJSAKqo68l0rS2AanEWfkxaZ5wNiEFb5ggm08lDs9Xl2KxBlX3PTcaD2chBM1gXAYf491/M2Rv8Jwayg==}
engines: {node: '>= 0.6.0'}
lru-cache@5.1.1:
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
@@ -2182,6 +2341,9 @@ packages:
resolution: {integrity: sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==}
engines: {node: 18 || 20 || >=22}
minimatch@3.1.5:
resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==}
mitt@3.0.1:
resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==}
@@ -2211,6 +2373,9 @@ packages:
natural-compare@1.4.0:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
ndarray@1.0.19:
resolution: {integrity: sha512-B4JHA4vdyZU30ELBw3g7/p9bZupyew5a7tX1Y/gGeF2hafrPaQZhgrGQfsvgfYbgdFZjYwuEcnaobeM/WMW+HQ==}
next-tick@1.1.0:
resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==}
@@ -2231,6 +2396,9 @@ packages:
resolution: {integrity: sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==}
engines: {node: '>=12.20.0'}
once@1.4.0:
resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==}
optionator@0.9.4:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'}
@@ -2246,6 +2414,9 @@ packages:
pako@1.0.11:
resolution: {integrity: sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==}
pako@2.1.0:
resolution: {integrity: sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==}
pako@2.2.0:
resolution: {integrity: sha512-zJq6RP/5q+TO2OpFV3FHzlPnFjmkb7Nc99a5SNjJE+uu/PkpChs+NIZSSzbBoD+6kjiISXjfYdwj1ZRQ81dz/w==}
@@ -2256,6 +2427,10 @@ packages:
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
engines: {node: '>=8'}
path-is-absolute@1.0.1:
resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==}
engines: {node: '>=0.10.0'}
path-key@3.1.1:
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
engines: {node: '>=8'}
@@ -2369,6 +2544,10 @@ packages:
resolution: {integrity: sha512-Kko+Y5XQ6fM+Ce3dq3m9YGxnacYZYl9cA1wZjaF3Vbry2L3i1qVg8+CAgNPsXRArPMUMCaOR7oa9Nqntc43JKA==}
engines: {node: '>= 20.19.0'}
rechoir@0.6.2:
resolution: {integrity: sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==}
engines: {node: '>= 0.10'}
regenerate-unicode-properties@10.3.0:
resolution: {integrity: sha512-9ns8odR8e9q3otKeHj3DE80jZYKg6zVeZKE+zQmRKXFoVUcuiTGeO6iusDhPRoIQQPVPRvH+SfBhrTud4eczuw==}
engines: {node: '>=4'}
@@ -2416,6 +2595,9 @@ packages:
scule@1.3.0:
resolution: {integrity: sha512-6FtHJEvt+pVMIB9IBY+IcCJ6Z5f1iQnytgyfKMhDKgmzYG+TeH/wx1y3l27rshSbLiSanrR9ffZDrEsmjlQF2g==}
seedrandom@3.0.5:
resolution: {integrity: sha512-8OwmbklUNzwezjGInmZ+2clQmExQPvomqjL7LFqOYqtmuxRgQYqOD3mHaU+MvZn5FLUeVxVfQjwLZW/n/JFuqg==}
semver@6.3.1:
resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==}
hasBin: true
@@ -2436,6 +2618,11 @@ packages:
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
engines: {node: '>=8'}
shelljs@0.8.5:
resolution: {integrity: sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==}
engines: {node: '>=4'}
hasBin: true
siginfo@2.0.0:
resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==}
@@ -2453,6 +2640,9 @@ packages:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
engines: {node: '>=0.10.0'}
spark-md5@3.0.2:
resolution: {integrity: sha512-wcFzz9cDfbuqe0FZzfi2or1sgyIrsDwmPwfZC4hiNidPdPINjeUwNfv5kldczoEAcjl9Y1L3SM7Uz2PUEQzxQw==}
speakingurl@14.0.1:
resolution: {integrity: sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==}
engines: {node: '>=0.10.0'}
@@ -2793,6 +2983,9 @@ packages:
webpack-virtual-modules@0.6.2:
resolution: {integrity: sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==}
webworker-promise@0.5.0:
resolution: {integrity: sha512-14iR79jHAV7ozwvbfif+3wCaApT3I1g8Lo0rJZrwAu6wxZGx/08Y8KXz6as6ZLNUEEufeiEBBYrqyDBClXOsEw==}
which@2.0.2:
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
engines: {node: '>= 8'}
@@ -2807,10 +3000,20 @@ packages:
resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==}
engines: {node: '>=0.10.0'}
wrappy@1.0.2:
resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}
wslink@2.5.0:
resolution: {integrity: sha512-+m7GWH9G3Y2iAN9CP8M5z/Re2u/Q1KEXvUZ2ISGle7CF6T07z2jS8sWfgp4Y8ZRUbUCHp6IJnEL1xkbzeNn18Q==}
xml-name-validator@5.0.0:
resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==}
engines: {node: '>=18'}
xmlbuilder2@4.0.3:
resolution: {integrity: sha512-bx8Q1STctnNaaDymWnkfQLKofs0mGNN7rLLapJlGuV3VlvegD7Ls4ggMjE3aUSWItCCzU0PEv45lI87iSigiCA==}
engines: {node: '>=20.0'}
xss@1.0.14:
resolution: {integrity: sha512-og7TEJhXvn1a7kzZGQ7ETjdQVS2UfZyTlsEdDOqvQF7GoxNfY+0YLCzBy1kPdsDDx4QuNAonQPddpsn6Xl/7sw==}
engines: {node: '>= 0.10.0'}
@@ -3480,6 +3683,10 @@ snapshots:
'@babel/types': 7.29.8
esutils: 2.0.3
'@babel/runtime-corejs3@7.29.2':
dependencies:
core-js-pure: 3.51.0
'@babel/runtime@7.29.10': {}
'@babel/template@7.29.7':
@@ -3526,6 +3733,31 @@ snapshots:
dependencies:
vue: 3.5.44(typescript@5.9.3)
'@cornerstonejs/calculate-suv@1.0.3': {}
'@cornerstonejs/core@5.13.1(@cornerstonejs/metadata@5.13.1)(@cornerstonejs/utils@5.13.1)(autoprefixer@10.6.1(postcss@8.5.31))(wslink@2.5.0)':
dependencies:
'@cornerstonejs/metadata': 5.13.1
'@cornerstonejs/utils': 5.13.1
'@kitware/vtk.js': 36.4.1(autoprefixer@10.6.1(postcss@8.5.31))(wslink@2.5.0)
comlink: 4.4.2
gl-matrix: 3.4.3
loglevel: 1.9.2
transitivePeerDependencies:
- autoprefixer
- wslink
'@cornerstonejs/metadata@5.13.1':
dependencies:
'@cornerstonejs/calculate-suv': 1.0.3
'@cornerstonejs/utils': 5.13.1
dcmjs: 0.52.0
gl-matrix: 3.4.3
'@cornerstonejs/utils@5.13.1':
dependencies:
dcmjs: 0.52.0
'@dual-bundle/import-meta-resolve@4.2.1': {}
'@esbuild/aix-ppc64@0.25.12':
@@ -3746,6 +3978,25 @@ snapshots:
'@keyv/serialize@1.1.1': {}
'@kitware/vtk.js@36.4.1(autoprefixer@10.6.1(postcss@8.5.31))(wslink@2.5.0)':
dependencies:
'@types/webxr': 0.5.5
autoprefixer: 10.6.1(postcss@8.5.31)
commander: 9.2.0
d3-scale: 4.0.2
fast-deep-equal: 3.1.3
fflate: 0.7.3
gl-matrix: 3.4.3
seedrandom: 3.0.5
shelljs: 0.8.5
spark-md5: 3.0.2
utif: 3.1.0
webworker-promise: 0.5.0
wslink: 2.5.0
xmlbuilder2: 4.0.3
'@msgpack/msgpack@2.8.0': {}
'@napi-rs/canvas-android-arm64@1.0.13':
optional: true
@@ -3794,6 +4045,23 @@ snapshots:
'@napi-rs/canvas-win32-x64-msvc': 1.0.13
optional: true
'@oozcitak/dom@2.0.2':
dependencies:
'@oozcitak/infra': 2.0.2
'@oozcitak/url': 3.0.0
'@oozcitak/util': 10.0.0
'@oozcitak/infra@2.0.2':
dependencies:
'@oozcitak/util': 10.0.0
'@oozcitak/url@3.0.0':
dependencies:
'@oozcitak/infra': 2.0.2
'@oozcitak/util': 10.0.0
'@oozcitak/util@10.0.0': {}
'@oxc-project/types@0.155.0': {}
'@pkgr/core@0.3.6': {}
@@ -3887,6 +4155,8 @@ snapshots:
'@types/web-bluetooth@0.0.21': {}
'@types/webxr@0.5.5': {}
'@typescript-eslint/eslint-plugin@8.72.0(@typescript-eslint/parser@8.72.0(eslint@10.13.0)(typescript@5.9.3))(eslint@10.13.0)(typescript@5.9.3)':
dependencies:
'@eslint-community/regexpp': 4.12.2
@@ -4233,6 +4503,8 @@ snapshots:
acorn@8.19.0: {}
adm-zip@0.5.17: {}
aes-decrypter@4.0.2:
dependencies:
'@babel/runtime': 7.29.10
@@ -4249,6 +4521,8 @@ snapshots:
alien-signals@3.2.1: {}
argparse@2.0.1: {}
assertion-error@2.0.1: {}
ast-kit@2.2.0:
@@ -4301,6 +4575,8 @@ snapshots:
transitivePeerDependencies:
- supports-color
balanced-match@1.0.2: {}
balanced-match@4.0.4: {}
baseline-browser-mapping@2.11.30: {}
@@ -4309,6 +4585,11 @@ snapshots:
boolbase@1.0.0: {}
brace-expansion@1.1.21:
dependencies:
balanced-match: 1.0.2
concat-map: 0.0.1
brace-expansion@5.0.12:
dependencies:
balanced-match: 4.0.4
@@ -4349,10 +4630,16 @@ snapshots:
custom-error-instance: 2.1.1
lodash.uniqby: 4.5.0
comlink@4.4.2: {}
commander@15.0.0: {}
commander@2.20.3: {}
commander@9.2.0: {}
concat-map@0.0.1: {}
confbox@0.1.8: {}
confbox@0.3.1: {}
@@ -4365,6 +4652,8 @@ snapshots:
dependencies:
browserslist: 4.29.4
core-js-pure@3.51.0: {}
core-js@3.51.0: {}
core-util-is@1.0.3: {}
@@ -4385,6 +4674,34 @@ snapshots:
custom-error-instance@2.1.1: {}
d3-array@3.2.4:
dependencies:
internmap: 2.0.3
d3-color@3.1.0: {}
d3-format@3.1.2: {}
d3-interpolate@3.0.1:
dependencies:
d3-color: 3.1.0
d3-scale@4.0.2:
dependencies:
d3-array: 3.2.4
d3-format: 3.1.2
d3-interpolate: 3.0.1
d3-time: 3.1.0
d3-time-format: 4.1.0
d3-time-format@4.1.0:
dependencies:
d3-time: 3.1.0
d3-time@3.1.0:
dependencies:
d3-array: 3.2.4
d@1.0.2:
dependencies:
es5-ext: 0.10.64
@@ -4400,6 +4717,16 @@ snapshots:
dayjs@1.11.23: {}
dcmjs@0.52.0:
dependencies:
'@babel/runtime-corejs3': 7.29.2
adm-zip: 0.5.17
gl-matrix: 3.4.4
lodash.clonedeep: 4.5.0
loglevel: 1.9.2
ndarray: 1.0.19
pako: 2.1.0
debug@4.4.3:
dependencies:
ms: 2.1.3
@@ -4619,6 +4946,8 @@ snapshots:
optionalDependencies:
picomatch: 4.0.7
fflate@0.7.3: {}
fflate@0.8.3: {}
file-entry-cache@11.1.5:
@@ -4647,6 +4976,8 @@ snapshots:
fraction.js@5.3.4: {}
fs.realpath@1.0.0: {}
fsevents@2.3.3:
optional: true
@@ -4654,10 +4985,23 @@ snapshots:
gensync@1.0.0-beta.2: {}
gl-matrix@3.4.3: {}
gl-matrix@3.4.4: {}
glob-parent@6.0.2:
dependencies:
is-glob: 4.0.3
glob@7.2.3:
dependencies:
fs.realpath: 1.0.0
inflight: 1.0.6
inherits: 2.0.4
minimatch: 3.1.5
once: 1.4.0
path-is-absolute: 1.0.1
global@4.4.0:
dependencies:
min-document: 2.19.2
@@ -4687,8 +5031,21 @@ snapshots:
imurmurhash@0.1.4: {}
inflight@1.0.6:
dependencies:
once: 1.4.0
wrappy: 1.0.2
inherits@2.0.4: {}
internmap@2.0.3: {}
interpret@1.4.0: {}
iota-array@1.0.0: {}
is-buffer@1.1.6: {}
is-core-module@2.17.0:
dependencies:
hasown: 2.0.4
@@ -4713,6 +5070,10 @@ snapshots:
js-tokens@4.0.0: {}
js-yaml@4.3.2:
dependencies:
argparse: 2.0.1
jsesc@3.1.0: {}
json-schema-traverse@0.4.1: {}
@@ -4843,6 +5204,8 @@ snapshots:
dependencies:
lodash._basetostring: 4.12.0
lodash.clonedeep@4.5.0: {}
lodash.debounce@4.0.8: {}
lodash.throttle@4.1.1: {}
@@ -4854,6 +5217,8 @@ snapshots:
lodash@4.18.1: {}
loglevel@1.9.2: {}
lru-cache@5.1.1:
dependencies:
yallist: 3.1.1
@@ -4895,6 +5260,10 @@ snapshots:
dependencies:
brace-expansion: 5.0.12
minimatch@3.1.5:
dependencies:
brace-expansion: 1.1.21
mitt@3.0.1: {}
mlly@1.8.2:
@@ -4924,6 +5293,11 @@ snapshots:
natural-compare@1.4.0: {}
ndarray@1.0.19:
dependencies:
iota-array: 1.0.0
is-buffer: 1.1.6
next-tick@1.1.0: {}
node-releases@2.0.59: {}
@@ -4938,6 +5312,10 @@ snapshots:
obug@2.2.1: {}
once@1.4.0:
dependencies:
wrappy: 1.0.2
optionator@0.9.4:
dependencies:
deep-is: 0.1.4
@@ -4957,12 +5335,16 @@ snapshots:
pako@1.0.11: {}
pako@2.1.0: {}
pako@2.2.0: {}
path-browserify@1.0.1: {}
path-exists@4.0.0: {}
path-is-absolute@1.0.1: {}
path-key@3.1.1: {}
path-parse@1.0.7: {}
@@ -5065,6 +5447,10 @@ snapshots:
readdirp@5.1.1: {}
rechoir@0.6.2:
dependencies:
resolve: 1.22.13
regenerate-unicode-properties@10.3.0:
dependencies:
regenerate: 1.5.0
@@ -5126,6 +5512,8 @@ snapshots:
scule@1.3.0: {}
seedrandom@3.0.5: {}
semver@6.3.1: {}
semver@7.8.5: {}
@@ -5138,6 +5526,12 @@ snapshots:
shebang-regex@3.0.0: {}
shelljs@0.8.5:
dependencies:
glob: 7.2.3
interpret: 1.4.0
rechoir: 0.6.2
siginfo@2.0.0: {}
signal-exit@3.0.7: {}
@@ -5151,6 +5545,8 @@ snapshots:
source-map@0.6.1: {}
spark-md5@3.0.2: {}
speakingurl@14.0.1: {}
stackback@0.0.2: {}
@@ -5451,6 +5847,8 @@ snapshots:
webpack-virtual-modules@0.6.2: {}
webworker-promise@0.5.0: {}
which@2.0.2:
dependencies:
isexe: 2.0.0
@@ -5462,8 +5860,21 @@ snapshots:
word-wrap@1.2.5: {}
wrappy@1.0.2: {}
wslink@2.5.0:
dependencies:
'@msgpack/msgpack': 2.8.0
xml-name-validator@5.0.0: {}
xmlbuilder2@4.0.3:
dependencies:
'@oozcitak/dom': 2.0.2
'@oozcitak/infra': 2.0.2
'@oozcitak/util': 10.0.0
js-yaml: 4.3.2
xss@1.0.14:
dependencies:
commander: 2.20.3
+8 -1
View File
@@ -73,6 +73,13 @@ self.onmessage({
});
assert.equal(replies[4]?.encoding, "utf-8");
assert.ok(replies[4]?.metadata.some((entry) => entry.value === "Иван Петров"));
self.onmessage({
data: { id: 6, mode: "volumeSlice", buffer: fixture(16, { slice: 2 }) },
});
assert.equal(replies[5]?.error, undefined);
assert.deepEqual(Array.from(replies[5].slice.position), [0, 0, 2]);
assert.deepEqual(Array.from(replies[5].slice.orientation), [1, 0, 0, 0, 1, 0]);
assert.equal(replies[5].slice.pixels[0], -2048);
console.log(
"Production DICOM worker: decode, metadata and text encodings passed"
"Production DICOM worker: decode, metadata, text encodings and volume slices passed"
);
+7 -2
View File
@@ -1,12 +1,17 @@
import { fetchURL, removePrefix, createURL } from "./utils";
import { baseURL } from "@/utils/constants";
export async function fetch(url: string, password: string = "") {
export async function fetch(
url: string,
password: string = "",
options: { signal?: AbortSignal; token?: string } = {}
) {
url = removePrefix(url);
const res = await fetchURL(
`/api/public/share${url}`,
`/api/public/share${url}${options.token ? `?token=${encodeURIComponent(options.token)}` : ""}`,
{
signal: options.signal,
headers: { "X-SHARE-PASSWORD": encodeURIComponent(password) },
},
false
+119 -5
View File
@@ -7,7 +7,21 @@
>
<div class="document-tools">
<strong>DICOM</strong>
<template v-if="ready">
<button
v-if="series.length && !volume && !volumeLoading"
class="button button--flat"
@click="openVolume"
>
{{ t("documents.open3d") }} ({{ series.length }})
</button>
<button
v-if="volume || volumeLoading"
class="button button--flat"
@click="closeVolume"
>
{{ t("documents.back2d") }}
</button>
<template v-if="ready && !volume && !volumeLoading">
<label
>{{ t("documents.frame") }}
<input
@@ -29,9 +43,19 @@
</button>
</template>
</div>
<p v-if="volumeError" role="alert" class="document-error">
{{ volumeError }}
</p>
<p v-if="volumeLoading" role="status">
{{ t("documents.loading3d", { count: loaded, total: series.length }) }}
<button class="button button--flat" @click="closeVolume">
{{ t("buttons.cancel") }}
</button>
</p>
<DicomVolumeViewer v-if="volume" :volume="volume" @failed="volumeFailed" />
<p v-if="error" role="alert" class="document-error">{{ error }}</p>
<p v-else-if="!ready">{{ t("files.loading") }}</p>
<div class="document-stage">
<div v-show="!volume && !volumeLoading" class="document-stage">
<canvas
v-show="ready && !error"
ref="canvas"
@@ -41,12 +65,98 @@
</div>
</template>
<script setup lang="ts">
import { nextTick, onBeforeUnmount, ref, watch } from "vue";
import {
defineAsyncComponent,
nextTick,
onBeforeUnmount,
ref,
shallowRef,
watch,
} from "vue";
import { useI18n } from "vue-i18n";
import DicomWorker from "@/utils/dicom.worker?worker";
import { readDicomFile } from "@/utils/dicom-file";
const props = defineProps<{ source: string }>();
import { findDicomSeries } from "@/utils/dicom-context";
import { loadDicomVolume } from "@/utils/dicom-volume";
import type { DicomSource, DicomVolume } from "@/utils/dicom-series";
const DicomVolumeViewer = defineAsyncComponent({
loader: () => import("./DicomVolumeViewer.vue"),
onError: (_error, _retry, fail) => {
volumeFailed();
fail();
},
});
const props = defineProps<{ source: string; resource?: Resource }>();
const { t } = useI18n();
const series = shallowRef<DicomSource[]>([]),
volume = shallowRef<DicomVolume>();
const volumeLoading = ref(false),
volumeError = ref(""),
loaded = ref(0);
let seriesController: AbortController | undefined,
volumeController: AbortController | undefined;
function closeVolume() {
volumeController?.abort();
volumeController = undefined;
volume.value = undefined;
volumeLoading.value = false;
}
function volumeFailed() {
closeVolume();
volumeError.value = t("documents.volumeUnavailable");
}
async function openVolume() {
closeVolume();
volumeError.value = "";
const probe = document.createElement("canvas");
const gl = probe.getContext("webgl2");
if (!gl) {
volumeFailed();
return;
}
gl.getExtension("WEBGL_lose_context")?.loseContext();
const request = (volumeController = new AbortController());
volumeLoading.value = true;
loaded.value = 0;
try {
const result = await loadDicomVolume(
series.value,
request.signal,
(count) => {
loaded.value = count;
}
);
if (!request.signal.aborted) volume.value = result;
} catch (e) {
if (!request.signal.aborted)
volumeError.value = t(
e instanceof Error &&
["DICOM_VOLUME_LIMIT", "DICOM_TOO_LARGE"].includes(e.message)
? "documents.volumeLimit"
: "documents.volumeInvalid"
);
} finally {
if (volumeController === request) volumeLoading.value = false;
}
}
watch(
() => props.resource,
async (resource) => {
seriesController?.abort();
closeVolume();
volumeError.value = "";
series.value = [];
if (!resource) return;
const request = (seriesController = new AbortController());
try {
const found = await findDicomSeries(resource, request.signal);
if (!request.signal.aborted) series.value = found;
} catch {
/* A file-only share or denied parent must not reveal siblings. */
}
},
{ immediate: true }
);
const canvas = ref<HTMLCanvasElement>();
const ready = ref(false),
error = ref(""),
@@ -159,5 +269,9 @@ watch(
},
{ immediate: true }
);
onBeforeUnmount(stop);
onBeforeUnmount(() => {
stop();
closeVolume();
seriesController?.abort();
});
</script>
@@ -0,0 +1,335 @@
<template>
<div class="dicom-volume">
<div class="document-tools">
<button
v-for="view in views"
:key="view"
class="button button--flat"
:aria-pressed="mode === view"
@click="switchView(view)"
>
{{ view === "3d" ? "3D" : t(`documents.${view}`) }}
</button>
<template>
<label
>{{ t("documents.window") }}
<input v-model.number="width" type="number" min="1"
/></label>
<label
>{{ t("documents.level") }}
<input v-model.number="center" type="number"
/></label>
</template>
<template v-if="mode === '3d'">
<label
>{{ t("documents.opacity") }}
<input
v-model.number="opacity"
type="range"
min="0.05"
max="1"
step="0.05"
/></label>
</template>
<button class="button button--flat" @click="reset">
{{ t("documents.reset") }}
</button>
</div>
<p class="dicom-volume-hint">
{{ t(mode === "3d" ? "documents.volumeHint" : "documents.sliceHint") }}
</p>
<div
ref="element"
class="dicom-volume-stage"
@wheel.prevent="wheel"
@pointerdown="pointerDown"
@pointermove="pointerMove"
@pointerup="pointerUp"
@pointercancel="pointerUp"
@contextmenu.prevent
/>
</div>
</template>
<script setup lang="ts">
import { onMounted, onBeforeUnmount, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import * as core from "@cornerstonejs/core";
import type { DicomVolume } from "@/utils/dicom-series";
const props = defineProps<{ volume: DicomVolume }>();
const emit = defineEmits<{ failed: [] }>();
const { t } = useI18n();
const element = ref<HTMLDivElement>();
const views = ["3d", "axial", "sagittal", "coronal"] as const;
type Mode = (typeof views)[number];
const mode = ref<Mode>("3d"),
center = ref(props.volume.first.center),
width = ref(props.volume.first.width),
opacity = ref(0.3);
const id = `fs-dicom-${crypto.getRandomValues(new Uint32Array(2)).join("-")}`;
const viewportID = `${id}-viewport`;
let engine: InstanceType<typeof core.RenderingEngine> | undefined;
let observer: ResizeObserver | undefined,
disposed = false,
changing = false;
let drag: { id: number; x: number; y: number } | undefined;
let frame = 0;
const viewport = () => engine?.getViewport<core.BaseVolumeViewport>(viewportID);
function schedule() {
if (!frame)
frame = requestAnimationFrame(() => {
frame = 0;
engine?.render();
});
}
function applyWindow() {
if (
Number.isFinite(width.value) &&
width.value >= 1 &&
Number.isFinite(center.value)
) {
viewport()?.setProperties({
...(mode.value === "3d" && { colormap: volumeColormap() }),
voiRange: {
lower: center.value - width.value / 2,
upper: center.value + width.value / 2,
},
});
schedule();
}
}
function volumeColormap() {
return {
opacity: opacity.value,
opacityMapping: [
{ value: center.value - width.value / 2, opacity: 0 },
{ value: center.value + width.value / 2, opacity: 1 },
],
};
}
watch([center, width, opacity], applyWindow);
async function switchView(value: Mode) {
if (!engine || !element.value || disposed || changing) return;
changing = true;
try {
mode.value = value;
engine.setViewports([
{
viewportId: viewportID,
type:
value === "3d"
? core.Enums.ViewportType.VOLUME_3D
: core.Enums.ViewportType.ORTHOGRAPHIC,
element: element.value,
defaultOptions: {
background: [0, 0, 0],
orientation:
value === "sagittal"
? core.Enums.OrientationAxis.SAGITTAL
: value === "coronal"
? core.Enums.OrientationAxis.CORONAL
: core.Enums.OrientationAxis.AXIAL,
},
},
]);
await core.setVolumesForViewports(engine, [{ volumeId: id }], [viewportID]);
if (disposed) return;
viewport()?.resetCamera();
if (value === "3d")
viewport()?.setProperties({
colormap: volumeColormap(),
voiRange: {
lower: center.value - width.value / 2,
upper: center.value + width.value / 2,
},
sampleDistanceMultiplier: 2,
});
else applyWindow();
engine.render();
} catch {
if (!disposed) emit("failed");
} finally {
changing = false;
}
}
function reset() {
center.value = props.volume.first.center;
width.value = props.volume.first.width;
opacity.value = 0.3;
viewport()?.resetCamera();
schedule();
}
function wheel(event: WheelEvent) {
const view = viewport();
if (!view || changing) return;
if (mode.value !== "3d" && !event.ctrlKey)
view.scroll(event.deltaY > 0 ? 1 : -1);
else
view.setZoom(
Math.max(
0.1,
Math.min(20, view.getZoom() * (event.deltaY > 0 ? 0.9 : 1.1))
)
);
schedule();
}
function pointerDown(event: PointerEvent) {
if (event.button !== 0 || !viewport()) return;
drag = { id: event.pointerId, x: event.clientX, y: event.clientY };
element.value?.setPointerCapture(event.pointerId);
}
// Rodrigues rotation around the camera's axes keeps oblique patient geometry intact.
function rotate(
vector: number[],
axis: number[],
angle: number
): [number, number, number] {
const length = Math.hypot(...axis),
a = axis.map((v) => v / length),
c = Math.cos(angle),
s = Math.sin(angle);
const dot = vector.reduce((n, v, i) => n + v * a[i], 0);
const cross = [
a[1] * vector[2] - a[2] * vector[1],
a[2] * vector[0] - a[0] * vector[2],
a[0] * vector[1] - a[1] * vector[0],
];
return vector.map((v, i) => v * c + cross[i] * s + a[i] * dot * (1 - c)) as [
number,
number,
number,
];
}
function pointerMove(event: PointerEvent) {
const view = viewport();
if (!drag || drag.id !== event.pointerId || !view || changing) return;
const dx = event.clientX - drag.x,
dy = event.clientY - drag.y;
drag.x = event.clientX;
drag.y = event.clientY;
if (mode.value === "3d") {
const camera = view.getCamera(),
up = camera.viewUp!,
focus = camera.focalPoint!,
position = camera.position!;
let offset = position.map((v, i) => v - focus[i]);
offset = rotate(offset, up, -dx * 0.008);
const right = [
up[1] * offset[2] - up[2] * offset[1],
up[2] * offset[0] - up[0] * offset[2],
up[0] * offset[1] - up[1] * offset[0],
];
offset = rotate(offset, right, -dy * 0.008);
view.setCamera({
position: offset.map((v, i) => v + focus[i]) as [number, number, number],
viewUp: rotate(up, right, -dy * 0.008),
});
} else {
const pan = view.getPan();
view.setPan([pan[0] + dx, pan[1] + dy]);
}
schedule();
}
function pointerUp() {
drag = undefined;
}
onMounted(async () => {
try {
core.init({ rendering: { useGenericViewport: false }, debug: {} });
if (core.getShouldUseCPURendering()) throw new Error("WebGL2 unavailable");
const { first, scalarData, dimensions, spacing, origin, direction } =
props.volume;
core.volumeLoader.createLocalVolume(id, {
scalarData,
dimensions,
spacing,
origin,
direction,
metadata: {
BitsAllocated: 32,
BitsStored: 32,
HighBit: 31,
SamplesPerPixel: 1,
PixelRepresentation: 1,
PhotometricInterpretation: "MONOCHROME2",
Modality: first.modality,
FrameOfReferenceUID: first.reference,
SeriesInstanceUID: first.series,
Columns: first.cols,
Rows: first.rows,
ImageOrientationPatient: first.orientation,
PixelSpacing: first.spacing,
voiLut: [],
VOILUTFunction: "LINEAR",
},
});
engine = new core.RenderingEngine(id);
await switchView("3d");
if (disposed) return;
observer = new ResizeObserver(() => {
if (!disposed) {
engine?.resize(true, true);
}
});
observer.observe(element.value!);
} catch {
if (!disposed) emit("failed");
}
});
onBeforeUnmount(() => {
disposed = true;
observer?.disconnect();
cancelAnimationFrame(frame);
engine?.destroy();
engine = undefined;
const volume = core.cache.getVolume(id);
// Also remove slices if allocation failed before the volume entered the cache.
const images = Array.from(
{ length: props.volume.dimensions[2] },
(_, i) => `${id}_slice_${i}`
);
if (volume) {
volume.vtkOpenGLTexture.releaseGraphicsResources();
volume.vtkOpenGLTexture.delete();
core.cache.removeVolumeLoadObject(id);
volume.voxelManager?.clear();
}
for (const image of images)
if (core.cache.getImage(image))
core.cache.removeImageLoadObject(image, { force: true });
});
</script>
<style scoped>
.dicom-volume {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
overflow: hidden;
}
.dicom-volume-stage {
flex: 1;
min-height: 240px;
position: relative;
width: 100%;
background: #000;
touch-action: none;
}
.dicom-volume-hint {
font-size: 12px;
margin: 8px 12px;
text-align: center;
}
button[aria-pressed="true"] {
background: var(--surfaceSecondary);
color: var(--primaryColor);
}
@media (max-width: 600px) {
.document-tools {
gap: 5px;
padding: 6px;
}
.document-tools input {
width: 65px;
}
}
</style>
@@ -1,6 +1,10 @@
<template>
<PdfViewer v-if="kind === 'pdf'" :source="source" />
<DicomViewer v-else-if="kind === 'dicom'" :source="source" />
<DicomViewer
v-else-if="kind === 'dicom'"
:source="source"
:resource="resource"
/>
<ZipPreview v-else-if="kind === 'zip'" :source="source" :size="size || 0" />
<div
v-else
@@ -87,6 +91,7 @@ const props = defineProps<{
name: string;
type?: string;
size?: number;
resource?: Resource;
}>();
const { t } = useI18n();
const kind = computed(() => previewKind(props.name, props.type));
+13 -1
View File
@@ -361,7 +361,19 @@
"zipEmpty": "Empty archive",
"zipVisibleLimit": "Showing the first 1000 rows. Collapse folders to see other entries.",
"zipLimit": "The file list exceeds safe preview limits.",
"zipUnavailable": "Unable to read the file list. A standard ZIP and server support for range requests are required."
"zipUnavailable": "Unable to read the file list. A standard ZIP and server support for range requests are required.",
"open3d": "Open as 3D",
"back2d": "Back to 2D",
"loading3d": "Loading series: {count} / {total}",
"volumeLimit": "This series exceeds the safe 3D preview limit (128 MiB of decoded voxels, 2048 files). Use 2D preview.",
"volumeInvalid": "Cannot build a volume: the slices must belong to one study and series, have matching geometry and uniform spacing. 2D preview remains available.",
"volumeUnavailable": "3D preview is unavailable on this device. WebGL2 with volume rendering support is required.",
"axial": "Axial",
"sagittal": "Sagittal",
"coronal": "Coronal",
"opacity": "Opacity",
"volumeHint": "Drag to rotate · Scroll to zoom",
"sliceHint": "Scroll to change slice · Drag to pan · Ctrl + scroll to zoom"
},
"fileInfo": {
"dicom": "DICOM metadata",
+13 -1
View File
@@ -358,7 +358,19 @@
"zipEmpty": "Архив пуст",
"zipVisibleLimit": "Показаны первые 1000 строк. Сверните папки, чтобы увидеть остальные.",
"zipLimit": "Список файлов превышает безопасные лимиты предпросмотра.",
"zipUnavailable": "Не удалось прочитать список файлов. Требуется обычный ZIP и поддержка частичного скачивания сервером."
"zipUnavailable": "Не удалось прочитать список файлов. Требуется обычный ZIP и поддержка частичного скачивания сервером.",
"open3d": "Открыть как 3D",
"back2d": "Вернуться к 2D",
"loading3d": "Загрузка серии: {count} / {total}",
"volumeLimit": "Серия превышает безопасный лимит 3D-просмотра (128 МиБ декодированных вокселей, 2048 файлов). Используйте 2D.",
"volumeInvalid": "Не удалось построить объём: нужны срезы одного исследования и серии, с одинаковой геометрией и равномерным шагом. Просмотр в 2D доступен.",
"volumeUnavailable": "3D-просмотр недоступен на этом устройстве. Нужна поддержка WebGL2 и объёмного рендеринга.",
"axial": "Аксиально",
"sagittal": "Сагиттально",
"coronal": "Коронально",
"opacity": "Непрозрачность",
"volumeHint": "Перетаскивание — вращение · Колесо — масштаб",
"sliceHint": "Колесо — смена среза · Перетаскивание — перемещение · Ctrl + колесо — масштаб"
},
"fileInfo": {
"dicom": "Метаданные DICOM",
@@ -0,0 +1,65 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import * as files from "@/api/files";
import * as pub from "@/api/pub";
import { findDicomSeries } from "../dicom-context";
vi.mock("@/api/files", () => ({
fetch: vi.fn(),
getDownloadURL: (item: ResourceItem) => `/api/raw${item.path}`,
}));
vi.mock("@/api/pub", () => ({
fetch: vi.fn(),
getDownloadURL: (item: Resource) =>
`/api/public/dl/${item.hash}${item.path}?token=${item.token}`,
}));
const listing = {
isDir: true,
items: [1, 2].map((i) => ({
name: `scan_${i}.dcm`,
path: `/scan_${i}.dcm`,
size: 400,
})),
} as Resource;
beforeEach(() => vi.clearAllMocks());
describe("DICOM scope", () => {
it("loads authenticated siblings from the same folder", async () => {
vi.mocked(files.fetch).mockResolvedValue(listing);
const signal = new AbortController().signal;
const series = await findDicomSeries(
{ name: "scan_1.dcm", path: "/CT/scan_1.dcm" } as Resource,
signal
);
expect(files.fetch).toHaveBeenCalledWith("/files/CT/", signal);
expect(pub.fetch).not.toHaveBeenCalled();
expect(series).toHaveLength(2);
});
it("keeps protected public series inside their share and retains the token", async () => {
vi.mocked(pub.fetch).mockResolvedValue(listing);
const signal = new AbortController().signal;
const series = await findDicomSeries(
{
name: "scan_1.dcm",
path: "/scan_1.dcm",
hash: "public",
token: "secret",
} as Resource,
signal
);
expect(pub.fetch).toHaveBeenCalledWith("/s/public/", "", {
signal,
token: "secret",
});
expect(files.fetch).not.toHaveBeenCalled();
expect(series[0].source).toBe(
"/api/public/dl/public/scan_1.dcm?token=secret"
);
});
it("never looks for siblings of a single-file public share", async () => {
const series = await findDicomSeries(
{ name: "scan_1.dcm", path: "/", hash: "file" } as Resource,
new AbortController().signal
);
expect(series).toEqual([]);
expect(files.fetch).not.toHaveBeenCalled();
expect(pub.fetch).not.toHaveBeenCalled();
});
});
@@ -0,0 +1,133 @@
import { describe, expect, it, vi } from "vitest";
import {
assembleVolume,
dicomSeries,
MAX_VOLUME_BYTES,
type DicomSlice,
} from "../dicom-series";
import { fixture } from "./fixtures/dicom";
const entry = (name: string, isDir = false) => ({
name,
source: `/${name}`,
size: 100,
isDir,
});
const slice = (z: number): DicomSlice => ({
study: "study",
series: "series",
reference: "frame",
instance: `sop-${z}`,
modality: "CT",
rows: 2,
cols: 2,
orientation: [1, 0, 0, 0, 1, 0],
position: [0, 0, z],
spacing: [0.5, 0.75],
pixels: new Float32Array([z, -1000, 0, 2000]),
center: 0,
width: 4000,
});
describe("DICOM series", () => {
it("offers a single numbered series, sorted numerically, without reading files", () => {
expect(
dicomSeries("scan_10.dcm", [
entry("scan_10.dcm"),
entry("scan_2.dcm"),
entry("subdir", true),
]).map((s) => s.name)
).toEqual(["scan_2.dcm", "scan_10.dcm"]);
});
it("does not offer mixed folders, duplicate indices, unrelated or solitary files", () => {
for (const names of [
["scan_1.dcm"],
["scan_1.dcm", "notes.txt"],
["scan_1.dcm", "other_2.dcm"],
["scan_1.dcm", "scan_01.dcm"],
["scan_1.dcm", "scan_999999999999999999.dcm"],
]) {
expect(
dicomSeries(
"scan_1.dcm",
names.map((n) => entry(n))
)
).toEqual([]);
}
expect(
dicomSeries("missing_1.dcm", [entry("scan_1.dcm"), entry("scan_2.dcm")])
).toEqual([]);
});
it("orders by patient coordinates, preserves physical spacing and CT values", () => {
const volume = assembleVolume([slice(2), slice(0), slice(1)]);
expect(volume.dimensions).toEqual([2, 2, 3]);
expect(volume.spacing).toEqual([0.75, 0.5, 1]);
expect(volume.origin).toEqual([0, 0, 0]);
expect(Array.from(volume.scalarData)).toEqual([
0, -1000, 0, 2000, 1, -1000, 0, 2000, 2, -1000, 0, 2000,
]);
});
it("rejects mixed studies/series, duplicates, gaps, tilt and invalid spacing", () => {
for (const change of [
{ study: "another" },
{ series: "another" },
{ reference: "another" },
{ instance: "sop-0" },
{ position: [0, 0, 0] },
{ position: [1, 0, 1] },
{ spacing: [0, 1] },
{ orientation: [1, 0, 0, 1, 0, 0] },
{ position: [0, 0, NaN] },
]) {
expect(() =>
assembleVolume([slice(0), { ...slice(1), ...change }, slice(2)])
).toThrow("DICOM_GEOMETRY");
}
expect(() => assembleVolume([slice(0), slice(1), slice(3)])).toThrow(
"DICOM_GEOMETRY"
);
});
it("rejects excessive allocations before allocating a volume", () => {
expect(MAX_VOLUME_BYTES).toBe(128 * 1024 * 1024);
expect(() =>
assembleVolume([
{ ...slice(0), rows: 4096, cols: 4096 },
{ ...slice(1), rows: 4096, cols: 4096 },
{ ...slice(2), rows: 4096, cols: 4096 },
])
).toThrow("DICOM_VOLUME_LIMIT");
});
it("decodes real DICOM slices and validates their geometry", async () => {
const replies: { slice?: DicomSlice; error?: string }[] = [];
const scope = {
postMessage: (data: (typeof replies)[number]) => replies.push(data),
onmessage: null as unknown as (event: { data: object }) => void,
};
vi.stubGlobal("self", scope);
vi.resetModules();
try {
await import("../dicom.worker");
for (const z of [2, 0, 1])
scope.onmessage({
data: {
id: z,
mode: "volumeSlice",
buffer: fixture(16, { slice: z }),
},
});
expect(replies.map((r) => r.error)).toEqual([
undefined,
undefined,
undefined,
]);
const volume = assembleVolume(replies.map((r) => r.slice!));
expect(volume.spacing).toEqual([0.75, 0.5, 1]);
expect(volume.scalarData[0]).toBe(-2048);
scope.onmessage({
data: { id: 4, mode: "volumeSlice", buffer: fixture() },
});
expect(replies.at(-1)?.error).toBe("DICOM_GEOMETRY");
} finally {
vi.unstubAllGlobals();
}
});
});
+17 -2
View File
@@ -1,6 +1,11 @@
export function fixture(
bits = 16,
options: { charset?: string; patientBytes?: number[] } = {}
options: {
charset?: string;
patientBytes?: number[];
slice?: number;
series?: string;
} = {}
) {
const data: number[] = [...new Uint8Array(128), 68, 73, 67, 77];
const add = (group: number, element: number, vr: string, bytes: number[]) => {
@@ -23,13 +28,23 @@ export function fixture(
if (options.charset) add(8, 5, "CS", text(options.charset));
add(8, 0x20, "DA", text("20261022"));
add(8, 0x60, "CS", text("CT"));
if (options.slice != null)
add(8, 0x18, "UI", text(`1.2.3.${options.slice + 1}`));
add(0x10, 0x10, "PN", options.patientBytes || text("Example^Patient"));
add(0x10, 0x20, "LO", text("TEST-123"));
if (options.slice != null) {
add(0x20, 0x0d, "UI", text("1.2.3"));
add(0x20, 0x0e, "UI", text(options.series || "1.2.3.4"));
add(0x20, 0x32, "DS", text(`0\\0\\${options.slice}`));
add(0x20, 0x37, "DS", text("1\\0\\0\\0\\1\\0"));
add(0x20, 0x52, "UI", text("1.2.3.5"));
}
add(0x28, 2, "US", [1, 0]);
add(0x28, 4, "CS", text("MONOCHROME2"));
add(0x28, 8, "IS", text("2"));
add(0x28, 8, "IS", text(options.slice == null ? "2" : "1"));
add(0x28, 0x10, "US", [2, 0]);
add(0x28, 0x11, "US", [2, 0]);
if (options.slice != null) add(0x28, 0x30, "DS", text("0.5\\0.75"));
add(0x28, 0x100, "US", [bits, 0]);
add(0x28, 0x101, "US", [12, 0]);
add(0x28, 0x102, "US", [11, 0]);
+42
View File
@@ -0,0 +1,42 @@
import * as files from "@/api/files";
import * as pub from "@/api/pub";
import { encodePath } from "./url";
import { dicomSeries } from "./dicom-series";
export async function findDicomSeries(resource: Resource, signal: AbortSignal) {
if (
!/^.+_\d+\.dcm$/i.test(resource.name) ||
!resource.path ||
resource.path === "/"
)
return [];
const parent =
resource.path.slice(0, resource.path.lastIndexOf("/") + 1) || "/";
const listing = resource.hash
? await pub.fetch(
`/s/${encodeURIComponent(resource.hash)}${encodePath(parent)}`,
"",
{ signal, token: resource.token }
)
: await files.fetch(`/files${encodePath(parent)}`, signal);
if (!listing.isDir) return [];
return dicomSeries(
resource.name,
listing.items.map((item) => ({
name: item.name,
size: item.size,
isDir: item.isDir,
source: resource.hash
? pub.getDownloadURL(
{
...listing,
path: item.path,
hash: resource.hash,
token: resource.token,
},
true
)
: files.getDownloadURL(item, true),
}))
);
}
+3 -1
View File
@@ -2,8 +2,10 @@ export async function readDicomFile(source: string, signal: AbortSignal) {
const response = await fetch(source, { credentials: "same-origin", signal });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const limit = 64 * 1024 * 1024;
if (Number(response.headers.get("Content-Length")) > limit)
if (Number(response.headers.get("Content-Length")) > limit) {
await response.body?.cancel();
throw new Error("DICOM_TOO_LARGE");
}
const reader = response.body?.getReader();
if (!reader) throw new Error("Empty response");
const chunks: Uint8Array[] = [];
+155
View File
@@ -0,0 +1,155 @@
export interface DicomSource {
name: string;
source: string;
size: number;
isDir?: boolean;
}
export const MAX_VOLUME_BYTES = 128 * 1024 * 1024;
export const MAX_SERIES_FILES = 2048;
// Names only trigger the offer. Patient-space geometry is checked after consent.
export function dicomSeries(
name: string,
entries: DicomSource[]
): DicomSource[] {
const match = /^(.*)_(\d+)\.dcm$/i.exec(name);
const files = entries.filter((entry) => !entry.isDir);
if (!match || files.length < 2 || files.length > MAX_SERIES_FILES) return [];
const numbered = files.map((entry) => ({
entry,
match: /^(.*)_(\d+)\.dcm$/i.exec(entry.name),
}));
if (
!files.some((entry) => entry.name === name) ||
numbered.some(({ match: part }) => !part || part[1] !== match[1])
)
return [];
const indices = numbered.map(({ match: part }) => Number(part![2]));
if (
!indices.every(Number.isSafeInteger) ||
new Set(indices).size !== files.length
)
return [];
return numbered
.sort((a, b) => Number(a.match![2]) - Number(b.match![2]))
.map(({ entry }) => entry);
}
export interface DicomSlice {
study: string;
series: string;
reference: string;
instance: string;
modality: string;
rows: number;
cols: number;
orientation: number[];
position: number[];
spacing: number[];
pixels: Float32Array;
center: number;
width: number;
}
const dot = (a: number[], b: number[]) =>
a.reduce((n, v, i) => n + v * b[i], 0);
const close = (a: number[], b: number[], tolerance = 1e-4) =>
a.length === b.length && a.every((v, i) => Math.abs(v - b[i]) <= tolerance);
export function checkSlice(slice: DicomSlice, first = slice) {
if (
!slice.study ||
!slice.series ||
!slice.reference ||
!slice.instance ||
!Number.isFinite(slice.center) ||
!Number.isFinite(slice.width) ||
slice.width < 1 ||
slice.study !== first.study ||
slice.series !== first.series ||
slice.reference !== first.reference ||
slice.rows !== first.rows ||
slice.cols !== first.cols ||
![slice.rows, slice.cols].every(
(v) => Number.isSafeInteger(v) && v > 0 && v <= 4096
) ||
slice.pixels.length !== slice.rows * slice.cols ||
slice.orientation.length !== 6 ||
slice.position.length !== 3 ||
slice.spacing.length !== 2 ||
![...slice.orientation, ...slice.position, ...slice.spacing].every(
Number.isFinite
) ||
slice.spacing.some((v) => v <= 0) ||
!close(slice.orientation, first.orientation) ||
!close(slice.spacing, first.spacing) ||
Math.abs(dot(slice.orientation.slice(0, 3), slice.orientation.slice(3))) >
1e-4 ||
Math.abs(
dot(slice.orientation.slice(0, 3), slice.orientation.slice(0, 3)) - 1
) > 1e-4 ||
Math.abs(dot(slice.orientation.slice(3), slice.orientation.slice(3)) - 1) >
1e-4
)
throw new Error("DICOM_GEOMETRY");
}
export function assembleVolume(slices: DicomSlice[]) {
if (slices.length < 2 || slices.length > MAX_SERIES_FILES)
throw new Error("DICOM_GEOMETRY");
const first = slices[0];
const size = first.rows * first.cols * slices.length;
if (!Number.isSafeInteger(size) || size * 4 > MAX_VOLUME_BYTES)
throw new Error("DICOM_VOLUME_LIMIT");
slices.forEach((slice) => checkSlice(slice, first));
if (new Set(slices.map((s) => s.instance)).size !== slices.length)
throw new Error("DICOM_GEOMETRY");
const x = first.orientation.slice(0, 3),
y = first.orientation.slice(3);
const z = [
x[1] * y[2] - x[2] * y[1],
x[2] * y[0] - x[0] * y[2],
x[0] * y[1] - x[1] * y[0],
];
const ordered = [...slices].sort(
(a, b) => dot(a.position, z) - dot(b.position, z)
);
const origin = ordered[0].position;
const step =
(dot(ordered.at(-1)!.position, z) - dot(origin, z)) / (ordered.length - 1);
if (step < 0.001 || step > 100) throw new Error("DICOM_GEOMETRY");
ordered.forEach((slice, i) => {
// Reject missing/duplicate slices, gantry tilt and shifted acquisitions.
const expected = origin.map((v, j) => v + z[j] * step * i);
if (!close(slice.position, expected, Math.max(0.01, step * 0.01)))
throw new Error("DICOM_GEOMETRY");
});
const scalarData = new Float32Array(size);
ordered.forEach((slice, i) =>
scalarData.set(slice.pixels, i * first.cols * first.rows)
);
return {
scalarData,
dimensions: [first.cols, first.rows, slices.length] as [
number,
number,
number,
],
spacing: [first.spacing[1], first.spacing[0], step] as [
number,
number,
number,
],
origin: [...origin] as [number, number, number],
direction: [...x, ...y, ...z] as [
number,
number,
number,
number,
number,
number,
number,
number,
number,
],
first,
};
}
export type DicomVolume = ReturnType<typeof assembleVolume>;
+74
View File
@@ -0,0 +1,74 @@
import DicomWorker from "./dicom.worker?worker";
import { readDicomFile } from "./dicom-file";
import {
assembleVolume,
checkSlice,
MAX_VOLUME_BYTES,
MAX_SERIES_FILES,
type DicomSlice,
type DicomSource,
} from "./dicom-series";
export async function loadDicomVolume(
sources: DicomSource[],
signal: AbortSignal,
progress: (loaded: number) => void
) {
if (sources.length < 2 || sources.length > MAX_SERIES_FILES)
throw new Error("DICOM_VOLUME_LIMIT");
if (
sources.some((s) => s.size > 64 * 1024 * 1024) ||
sources.reduce((n, s) => n + s.size, 0) > 512 * 1024 * 1024
)
throw new Error("DICOM_VOLUME_LIMIT");
const worker = new DicomWorker();
const slices: DicomSlice[] = [];
let bytes = 0;
try {
for (const source of sources) {
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
const buffer = await readDicomFile(source.source, signal);
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
bytes += buffer.byteLength;
if (bytes > 512 * 1024 * 1024) throw new Error("DICOM_VOLUME_LIMIT");
const slice = await new Promise<DicomSlice>((resolve, reject) => {
const cleanup = () => {
clearTimeout(timeout);
signal.removeEventListener("abort", abort);
worker.onmessage = null;
worker.onerror = null;
};
const fail = (error: unknown) => {
cleanup();
reject(error);
};
const abort = () => fail(new DOMException("Aborted", "AbortError"));
const timeout = setTimeout(
() => fail(new Error("DICOM_DECODE_TIMEOUT")),
30000
);
signal.addEventListener("abort", abort, { once: true });
worker.onerror = () => fail(new Error("DICOM_DECODE"));
worker.onmessage = ({ data }) => {
if (data.error) fail(new Error(data.error));
else {
cleanup();
resolve(data.slice);
}
};
worker.postMessage({ id: slices.length, buffer, mode: "volumeSlice" }, [
buffer,
]);
});
checkSlice(slice, slices[0] || slice);
if (slice.pixels.byteLength * sources.length > MAX_VOLUME_BYTES)
throw new Error("DICOM_VOLUME_LIMIT");
slices.push(slice);
progress(slices.length);
}
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
return assembleVolume(slices);
} finally {
worker.terminate();
}
}
+44
View File
@@ -111,6 +111,50 @@ self.onmessage = (event: MessageEvent) => {
defaultCenter =
image.getWindowWidth() > 0 ? image.getWindowCenter() : (min + max) / 2;
}
if (mode === "volumeSlice") {
if (
frames !== 1 ||
samples !== 1 ||
!Number.isFinite(slope) ||
!Number.isFinite(intercept)
)
throw new Error("DICOM_GEOMETRY");
const tag = (group: number, element: number) => {
const value = Object.values(image.tags).find(
(t) => t.group === group && t.element === element
)?.value;
return Array.isArray(value) ? value : value == null ? [] : [value];
};
const uid = (element: number) =>
String(tag(0x20, element)[0] || "").trim();
const pixels = new Float32Array(cols * rows);
for (let i = 0; i < pixels.length; i++) {
pixels[i] = pixel(i);
if (!Number.isFinite(pixels[i])) throw new Error("DICOM_GEOMETRY");
}
self.postMessage(
{
id,
slice: {
study: uid(0x0d),
series: uid(0x0e),
reference: uid(0x52),
instance: String(tag(8, 0x18)[0] || "").trim(),
modality: String(tag(8, 0x60)[0] || ""),
position: tag(0x20, 0x32).map(Number),
orientation: tag(0x20, 0x37).map(Number),
spacing: tag(0x28, 0x30).map(Number),
rows,
cols,
pixels,
center: defaultCenter,
width: defaultWidth,
},
},
{ transfer: [pixels.buffer] }
);
return;
}
if (!raw || !Number.isInteger(frame) || frame < 0 || frame >= frames)
throw new Error("Invalid DICOM frame");
const rgba = new Uint8ClampedArray(cols * rows * 4);
+1
View File
@@ -125,6 +125,7 @@
:name="req.name"
:type="req.type"
:size="req.size"
:resource="req"
/>
</div>
<div
+6 -2
View File
@@ -75,7 +75,11 @@
:class="{ 'document-preview': isDicom || isPdf || isGenericPreview }"
>
<PdfViewer v-if="isPdf" :source="previewUrl" />
<DicomViewer v-else-if="isDicom" :source="previewUrl" />
<DicomViewer
v-else-if="isDicom"
:source="previewUrl"
:resource="fileStore.req || undefined"
/>
<div v-else-if="isEpub" class="epub-reader">
<vue-reader
:location="location"
@@ -310,7 +314,7 @@ const previewUrl = computed(() => {
return "";
}
if (fileStore.req.type === "image" && !fullSize.value) {
if (fileStore.req.type === "image" && !isDicom.value && !fullSize.value) {
return api.getPreviewURL(fileStore.req, "big");
}
+9
View File
@@ -1,5 +1,6 @@
import path from "node:path";
import fs from "node:fs";
import { createRequire } from "node:module";
import { gzipSync } from "node:zlib";
import { defineConfig, type Plugin } from "vite";
import vue from "@vitejs/plugin-vue";
@@ -82,6 +83,14 @@ const plugins = [
const resolve = {
alias: {
// VTK imports XML writers even for volumes. Use the upstream browser build;
// its Node entry requires EventEmitter and node:url at module evaluation.
xmlbuilder2: path.join(
path.dirname(
createRequire(import.meta.url).resolve("xmlbuilder2/package.json")
),
"lib/xmlbuilder2.min.js"
),
// vue: "@vue/compat",
"@/": `${path.resolve(import.meta.dirname, "src")}/`,
},
+1 -1
View File
@@ -1,4 +1,4 @@
param([string]$Version = '3.0.0-sso.24')
param([string]$Version = '3.0.0-sso.25')
$ErrorActionPreference = 'Stop'
$repo = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
Push-Location $repo
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
VERSION="${VERSION:-3.0.0-sso.24}"
VERSION="${VERSION:-3.0.0-sso.25}"
COMMIT=$(git rev-parse --short HEAD)
(cd frontend && pnpm install --frozen-lockfile && pnpm run build)
mkdir -p build/release/linux-amd64