@ohif/app 3.12.0-beta.80 → 3.12.0-beta.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{3190.bundle.cd955568fe4d80ab2e4b.js → 1037.bundle.7502b1bb0e5eee58a1d8.js} +51 -15
- package/dist/{1927.bundle.081901df8d9b33633806.js → 1927.bundle.da6db325e08bacb0bca0.js} +3 -3
- package/dist/{6725.bundle.0d2cdc2107924a76f362.js → 2018.bundle.48b73891bb66796a3b2d.js} +47 -14
- package/dist/{306.bundle.a2380c4b23436c127faf.js → 306.bundle.c671a09e1eacf6bcfc84.js} +1 -1
- package/dist/{3613.bundle.f5fceb4697407a89921b.js → 3613.bundle.3542f5bb1f69651bc239.js} +98 -45
- package/dist/{4019.bundle.6505ff57ca48af03da8a.js → 4019.bundle.8172183f816ea5500dd5.js} +46 -8
- package/dist/{4092.bundle.00d575990d745230c1b2.js → 4092.bundle.9ab4766b293d4e447551.js} +19 -0
- package/dist/{5400.bundle.eb0f5866140b5db31518.js → 5400.bundle.3ebba479fc068cd8c700.js} +8 -2
- package/dist/{3353.bundle.a52e42421b9407ad28ce.js → 5858.bundle.99a6b9de04c621694ffd.js} +850 -747
- package/dist/{7412.bundle.94802a6a629f62daab88.js → 7412.bundle.dd19b713fc5158ef34c1.js} +157 -139
- package/dist/{7948.bundle.ca4da4046481100dccca.js → 7948.bundle.2c6514eb65957b44b127.js} +23 -27
- package/dist/{9548.bundle.6f232a0a03e60854b49e.js → 9548.bundle.ee365804b810d67b2766.js} +2 -2
- package/dist/{1807.bundle.4fe7031d498b59f1ed68.js → 9927.bundle.174996e11c1432053378.js} +52 -21
- package/dist/{app.bundle.a16db06e6e1ae5b7b3c5.js → app.bundle.619935f4e9b60960eec1.js} +936 -689
- package/dist/{compute.bundle.f6f1236073e2a486ddfb.js → compute.bundle.ea0325cee6d2a4be77d7.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/{polySeg.bundle.d0ed88f3bfea700c211b.js → polySeg.bundle.19444130c84583d811bd.js} +3 -3
- package/dist/sw.js +1 -1
- package/package.json +21 -21
- /package/dist/{1459.bundle.d8ca1f502eeb88a6e020.js → 1459.bundle.68ad9f4d048db1ded95e.js} +0 -0
- /package/dist/{147.bundle.53fe889b205dd91c245b.js → 147.bundle.9dac0500e2fa57626fdb.js} +0 -0
- /package/dist/{1604.bundle.b8b471d4b94ff2cf56ab.js → 1604.bundle.43520d5718d17febb2cf.js} +0 -0
- /package/dist/{1919.bundle.45c73b6e5367ff362580.js → 1919.bundle.27d4d453ec440181e449.js} +0 -0
- /package/dist/{213.bundle.cf999dc57ee54e1a61d0.js → 213.bundle.0d4bbf28ab97c107cdd5.js} +0 -0
- /package/dist/{2243.bundle.12b6ee3196121df88f63.js → 2243.bundle.873b4152dd2f550e76c6.js} +0 -0
- /package/dist/{2424.bundle.bfb5c29973df67ab4d1d.js → 2424.bundle.d8e65c4cd46695af1843.js} +0 -0
- /package/dist/{2518.bundle.b21d8c66dc8deb8ba922.js → 2518.bundle.ac5afa27c4799530d767.js} +0 -0
- /package/dist/{4113.bundle.6849f66f615847ada125.js → 4113.bundle.bebb8ac4abb95780b383.js} +0 -0
- /package/dist/{414.bundle.24a6ae428cbbec6fac72.js → 414.bundle.401bcf7a053bec6d5b32.js} +0 -0
- /package/dist/{5457.bundle.1b6c9d9754568061510c.js → 5457.bundle.f137a9e71ccf98addfbf.js} +0 -0
- /package/dist/{5485.bundle.8e456ebcf976c9c50dc3.js → 5485.bundle.08a4230790c12a80eb29.js} +0 -0
- /package/dist/{6027.bundle.5be91623f59d577abbd4.js → 6027.bundle.2a306549492ad8e7c2cd.js} +0 -0
- /package/dist/{6201.bundle.c59a4ef10b5d2126f3fe.js → 6201.bundle.d06a18bf366ae85c52b2.js} +0 -0
- /package/dist/{6991.bundle.e3e4ba73befe78136d84.js → 6991.bundle.1a945d91824788fde106.js} +0 -0
- /package/dist/{7431.bundle.ad1982d7c54a5931d409.js → 7431.bundle.be686be30c718b6f0165.js} +0 -0
- /package/dist/{7639.bundle.4fc45f7230e0fa936753.js → 7639.bundle.75968faa6648c318a4db.js} +0 -0
- /package/dist/{810.bundle.d472e7b39cb1da8d5c02.js → 810.bundle.d5ba529e18a59343a305.js} +0 -0
- /package/dist/{85.bundle.ca9e53b4f5669c6af047.js → 85.bundle.9e0a56a0cc52c4656d85.js} +0 -0
- /package/dist/{8558.bundle.ed93f8a5a7b3ea9acfce.js → 8558.bundle.226b7ea0dbfc9168e743.js} +0 -0
- /package/dist/{934.bundle.9445c5082a67dba7e121.js → 934.bundle.939f1fec0da4d0d82572.js} +0 -0
- /package/dist/{9862.bundle.e2c4c129f7907500b840.js → 9862.bundle.cb4de0892ea411293655.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[
|
|
1
|
+
(globalThis["webpackChunk"] = globalThis["webpackChunk"] || []).push([[5858],{
|
|
2
2
|
|
|
3
3
|
/***/ 93720:
|
|
4
4
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
@@ -3681,7 +3681,7 @@ else {}
|
|
|
3681
3681
|
|
|
3682
3682
|
/***/ }),
|
|
3683
3683
|
|
|
3684
|
-
/***/
|
|
3684
|
+
/***/ 15858:
|
|
3685
3685
|
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
|
|
3686
3686
|
|
|
3687
3687
|
"use strict";
|
|
@@ -3746,480 +3746,454 @@ function replicate(src, dest) {
|
|
|
3746
3746
|
|
|
3747
3747
|
// EXTERNAL MODULE: ../../../node_modules/comlink/dist/esm/comlink.mjs
|
|
3748
3748
|
var comlink = __webpack_require__(99178);
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3749
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeLittleEndian.js
|
|
3750
|
+
var decodeLittleEndian = __webpack_require__(67927);
|
|
3751
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeBigEndian.js
|
|
3752
|
+
var decodeBigEndian = __webpack_require__(45155);
|
|
3753
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeRLE.js
|
|
3754
|
+
var decodeRLE = __webpack_require__(40115);
|
|
3755
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeJPEGBaseline8Bit.js
|
|
3756
|
+
var decodeJPEGBaseline8Bit = __webpack_require__(89178);
|
|
3757
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeJPEGBaseline12Bit-js.js
|
|
3758
|
+
var decodeJPEGBaseline12Bit_js = __webpack_require__(63991);
|
|
3759
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeJPEGLossless.js
|
|
3760
|
+
var decodeJPEGLossless = __webpack_require__(32856);
|
|
3761
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeJPEGLS.js
|
|
3762
|
+
var decodeJPEGLS = __webpack_require__(93119);
|
|
3763
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeJPEG2000.js
|
|
3764
|
+
var decodeJPEG2000 = __webpack_require__(90612);
|
|
3765
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeHTJ2K.js
|
|
3766
|
+
var decodeHTJ2K = __webpack_require__(53383);
|
|
3767
|
+
;// ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/scaling/scaleArray.js
|
|
3768
|
+
function scaleArray(array, scalingParameters) {
|
|
3769
|
+
const arrayLength = array.length;
|
|
3770
|
+
const { rescaleSlope, rescaleIntercept, suvbw, doseGridScaling } = scalingParameters;
|
|
3771
|
+
if (scalingParameters.modality === 'PT' &&
|
|
3772
|
+
typeof suvbw === 'number' &&
|
|
3773
|
+
!isNaN(suvbw)) {
|
|
3774
|
+
for (let i = 0; i < arrayLength; i++) {
|
|
3775
|
+
array[i] = suvbw * (array[i] * rescaleSlope + rescaleIntercept);
|
|
3764
3776
|
}
|
|
3765
3777
|
}
|
|
3766
|
-
else if (
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
arrayBuffer = arrayBuffer.slice(offset);
|
|
3772
|
-
offset = 0;
|
|
3773
|
-
}
|
|
3774
|
-
if (imageFrame.floatPixelData || imageFrame.doubleFloatPixelData) {
|
|
3775
|
-
throw new Error('Float pixel data is not supported for parsing into ImageFrame');
|
|
3776
|
-
}
|
|
3777
|
-
if (imageFrame.pixelRepresentation === 0) {
|
|
3778
|
-
imageFrame.pixelData = new Uint32Array(arrayBuffer, offset, length / 4);
|
|
3779
|
-
}
|
|
3780
|
-
else if (imageFrame.pixelRepresentation === 1) {
|
|
3781
|
-
imageFrame.pixelData = new Int32Array(arrayBuffer, offset, length / 4);
|
|
3778
|
+
else if (scalingParameters.modality === 'RTDOSE' &&
|
|
3779
|
+
typeof doseGridScaling === 'number' &&
|
|
3780
|
+
!isNaN(doseGridScaling)) {
|
|
3781
|
+
for (let i = 0; i < arrayLength; i++) {
|
|
3782
|
+
array[i] = array[i] * doseGridScaling;
|
|
3782
3783
|
}
|
|
3783
|
-
|
|
3784
|
-
|
|
3784
|
+
}
|
|
3785
|
+
else {
|
|
3786
|
+
for (let i = 0; i < arrayLength; i++) {
|
|
3787
|
+
array[i] = array[i] * rescaleSlope + rescaleIntercept;
|
|
3785
3788
|
}
|
|
3786
3789
|
}
|
|
3787
|
-
return
|
|
3790
|
+
return true;
|
|
3788
3791
|
}
|
|
3789
|
-
/* harmony default export */ const decoders_decodeLittleEndian = (decodeLittleEndian);
|
|
3790
3792
|
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3793
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/getMinMax.js
|
|
3794
|
+
var getMinMax = __webpack_require__(52842);
|
|
3795
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/getPixelDataTypeFromMinMax.js
|
|
3796
|
+
var getPixelDataTypeFromMinMax = __webpack_require__(69952);
|
|
3797
|
+
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/isColorImage.js
|
|
3798
|
+
var isColorImage = __webpack_require__(30922);
|
|
3799
|
+
;// ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/decodeImageFrameWorker.js
|
|
3800
|
+
|
|
3801
|
+
|
|
3802
|
+
|
|
3803
|
+
|
|
3804
|
+
|
|
3805
|
+
|
|
3806
|
+
|
|
3807
|
+
|
|
3808
|
+
|
|
3809
|
+
|
|
3810
|
+
|
|
3811
|
+
|
|
3812
|
+
|
|
3813
|
+
|
|
3814
|
+
|
|
3815
|
+
|
|
3816
|
+
const imageUtils = {
|
|
3817
|
+
bilinear: bilinear,
|
|
3818
|
+
replicate: replicate,
|
|
3819
|
+
};
|
|
3820
|
+
const typedArrayConstructors = {
|
|
3821
|
+
Uint8Array,
|
|
3822
|
+
Uint16Array,
|
|
3823
|
+
Int16Array,
|
|
3824
|
+
Float32Array,
|
|
3825
|
+
Uint32Array,
|
|
3826
|
+
};
|
|
3827
|
+
function postProcessDecodedPixels(imageFrame, options, start, decodeConfig) {
|
|
3828
|
+
const shouldShift = imageFrame.pixelRepresentation !== undefined &&
|
|
3829
|
+
imageFrame.pixelRepresentation === 1;
|
|
3830
|
+
const shift = shouldShift && imageFrame.bitsStored !== undefined
|
|
3831
|
+
? 32 - imageFrame.bitsStored
|
|
3832
|
+
: undefined;
|
|
3833
|
+
if (shouldShift && shift !== undefined) {
|
|
3810
3834
|
for (let i = 0; i < imageFrame.pixelData.length; i++) {
|
|
3811
|
-
imageFrame.pixelData[i] =
|
|
3835
|
+
imageFrame.pixelData[i] = (imageFrame.pixelData[i] << shift) >> shift;
|
|
3812
3836
|
}
|
|
3813
3837
|
}
|
|
3814
|
-
|
|
3815
|
-
|
|
3838
|
+
let pixelDataArray = imageFrame.pixelData;
|
|
3839
|
+
imageFrame.pixelDataLength = imageFrame.pixelData.length;
|
|
3840
|
+
const { min: minBeforeScale, max: maxBeforeScale } = (0,getMinMax/* default */.A)(imageFrame.pixelData);
|
|
3841
|
+
const canRenderFloat = typeof options.allowFloatRendering !== 'undefined'
|
|
3842
|
+
? options.allowFloatRendering
|
|
3843
|
+
: true;
|
|
3844
|
+
let invalidType = (0,isColorImage/* default */.A)(imageFrame.photometricInterpretation) &&
|
|
3845
|
+
options.targetBuffer?.offset === undefined;
|
|
3846
|
+
const willScale = options.preScale?.enabled;
|
|
3847
|
+
const hasFloatRescale = willScale &&
|
|
3848
|
+
Object.values(options.preScale.scalingParameters).some((v) => typeof v === 'number' && !Number.isInteger(v));
|
|
3849
|
+
const disableScale = !options.preScale.enabled || (!canRenderFloat && hasFloatRescale);
|
|
3850
|
+
const type = options.targetBuffer?.type;
|
|
3851
|
+
if (type && options.preScale.enabled && !disableScale) {
|
|
3852
|
+
const scalingParameters = options.preScale.scalingParameters;
|
|
3853
|
+
const scaledValues = _calculateScaledMinMax(minBeforeScale, maxBeforeScale, scalingParameters);
|
|
3854
|
+
invalidType = !(0,getPixelDataTypeFromMinMax/* validatePixelDataType */.r)(scaledValues.min, scaledValues.max, typedArrayConstructors[type]);
|
|
3816
3855
|
}
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
/* harmony default export */ const decoders_decodeBigEndian = (decodeBigEndian);
|
|
3820
|
-
|
|
3821
|
-
;// ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeRLE.js
|
|
3822
|
-
async function decodeRLE(imageFrame, pixelData) {
|
|
3823
|
-
if (imageFrame.bitsAllocated === 8) {
|
|
3824
|
-
if (imageFrame.planarConfiguration) {
|
|
3825
|
-
return decode8Planar(imageFrame, pixelData);
|
|
3826
|
-
}
|
|
3827
|
-
return decode8(imageFrame, pixelData);
|
|
3856
|
+
if (type && !invalidType) {
|
|
3857
|
+
pixelDataArray = _handleTargetBuffer(options, imageFrame, typedArrayConstructors, pixelDataArray);
|
|
3828
3858
|
}
|
|
3829
|
-
else if (
|
|
3830
|
-
|
|
3859
|
+
else if (options.preScale.enabled && !disableScale) {
|
|
3860
|
+
pixelDataArray = _handlePreScaleSetup(options, minBeforeScale, maxBeforeScale, imageFrame);
|
|
3831
3861
|
}
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
function decode8(imageFrame, pixelData) {
|
|
3835
|
-
const frameData = pixelData;
|
|
3836
|
-
const frameSize = imageFrame.rows * imageFrame.columns;
|
|
3837
|
-
const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);
|
|
3838
|
-
const header = new DataView(frameData.buffer, frameData.byteOffset);
|
|
3839
|
-
const data = new Int8Array(frameData.buffer, frameData.byteOffset);
|
|
3840
|
-
const out = new Int8Array(outFrame);
|
|
3841
|
-
let outIndex = 0;
|
|
3842
|
-
const numSegments = header.getInt32(0, true);
|
|
3843
|
-
for (let s = 0; s < numSegments; ++s) {
|
|
3844
|
-
outIndex = s;
|
|
3845
|
-
let inIndex = header.getInt32((s + 1) * 4, true);
|
|
3846
|
-
let maxIndex = header.getInt32((s + 2) * 4, true);
|
|
3847
|
-
if (maxIndex === 0) {
|
|
3848
|
-
maxIndex = frameData.length;
|
|
3849
|
-
}
|
|
3850
|
-
const endOfSegment = frameSize * numSegments;
|
|
3851
|
-
while (inIndex < maxIndex) {
|
|
3852
|
-
const n = data[inIndex++];
|
|
3853
|
-
if (n >= 0 && n <= 127) {
|
|
3854
|
-
for (let i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {
|
|
3855
|
-
out[outIndex] = data[inIndex++];
|
|
3856
|
-
outIndex += imageFrame.samplesPerPixel;
|
|
3857
|
-
}
|
|
3858
|
-
}
|
|
3859
|
-
else if (n <= -1 && n >= -127) {
|
|
3860
|
-
const value = data[inIndex++];
|
|
3861
|
-
for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {
|
|
3862
|
-
out[outIndex] = value;
|
|
3863
|
-
outIndex += imageFrame.samplesPerPixel;
|
|
3864
|
-
}
|
|
3865
|
-
}
|
|
3866
|
-
}
|
|
3862
|
+
else {
|
|
3863
|
+
pixelDataArray = _getDefaultPixelDataArray(minBeforeScale, maxBeforeScale, imageFrame);
|
|
3867
3864
|
}
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
let maxIndex = header.getInt32((s + 2) * 4, true);
|
|
3884
|
-
if (maxIndex === 0) {
|
|
3885
|
-
maxIndex = frameData.length;
|
|
3886
|
-
}
|
|
3887
|
-
const endOfSegment = frameSize * numSegments;
|
|
3888
|
-
while (inIndex < maxIndex) {
|
|
3889
|
-
const n = data[inIndex++];
|
|
3890
|
-
if (n >= 0 && n <= 127) {
|
|
3891
|
-
for (let i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {
|
|
3892
|
-
out[outIndex] = data[inIndex++];
|
|
3893
|
-
outIndex++;
|
|
3894
|
-
}
|
|
3895
|
-
}
|
|
3896
|
-
else if (n <= -1 && n >= -127) {
|
|
3897
|
-
const value = data[inIndex++];
|
|
3898
|
-
for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {
|
|
3899
|
-
out[outIndex] = value;
|
|
3900
|
-
outIndex++;
|
|
3901
|
-
}
|
|
3902
|
-
}
|
|
3865
|
+
let minAfterScale = minBeforeScale;
|
|
3866
|
+
let maxAfterScale = maxBeforeScale;
|
|
3867
|
+
if (options.preScale.enabled && !disableScale) {
|
|
3868
|
+
const scalingParameters = options.preScale.scalingParameters;
|
|
3869
|
+
_validateScalingParameters(scalingParameters);
|
|
3870
|
+
const isRequiredScaling = _isRequiredScaling(scalingParameters);
|
|
3871
|
+
if (isRequiredScaling) {
|
|
3872
|
+
scaleArray(pixelDataArray, scalingParameters);
|
|
3873
|
+
imageFrame.preScale = {
|
|
3874
|
+
...options.preScale,
|
|
3875
|
+
scaled: true,
|
|
3876
|
+
};
|
|
3877
|
+
const scaledValues = _calculateScaledMinMax(minBeforeScale, maxBeforeScale, scalingParameters);
|
|
3878
|
+
minAfterScale = scaledValues.min;
|
|
3879
|
+
maxAfterScale = scaledValues.max;
|
|
3903
3880
|
}
|
|
3904
3881
|
}
|
|
3905
|
-
|
|
3882
|
+
else if (disableScale) {
|
|
3883
|
+
imageFrame.preScale = {
|
|
3884
|
+
enabled: true,
|
|
3885
|
+
scaled: false,
|
|
3886
|
+
};
|
|
3887
|
+
minAfterScale = minBeforeScale;
|
|
3888
|
+
maxAfterScale = maxBeforeScale;
|
|
3889
|
+
}
|
|
3890
|
+
imageFrame.pixelData = pixelDataArray;
|
|
3891
|
+
imageFrame.smallestPixelValue = minAfterScale;
|
|
3892
|
+
imageFrame.largestPixelValue = maxAfterScale;
|
|
3893
|
+
const end = new Date().getTime();
|
|
3894
|
+
imageFrame.decodeTimeInMS = end - start;
|
|
3906
3895
|
return imageFrame;
|
|
3907
3896
|
}
|
|
3908
|
-
function
|
|
3909
|
-
const
|
|
3910
|
-
const
|
|
3911
|
-
const
|
|
3912
|
-
const
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
let maxIndex = header.getInt32((s + 2) * 4, true);
|
|
3921
|
-
if (maxIndex === 0) {
|
|
3922
|
-
maxIndex = frameData.length;
|
|
3923
|
-
}
|
|
3924
|
-
while (inIndex < maxIndex) {
|
|
3925
|
-
const n = data[inIndex++];
|
|
3926
|
-
if (n >= 0 && n <= 127) {
|
|
3927
|
-
for (let i = 0; i < n + 1 && outIndex < frameSize; ++i) {
|
|
3928
|
-
out[outIndex * 2 + highByte] = data[inIndex++];
|
|
3929
|
-
outIndex++;
|
|
3930
|
-
}
|
|
3931
|
-
}
|
|
3932
|
-
else if (n <= -1 && n >= -127) {
|
|
3933
|
-
const value = data[inIndex++];
|
|
3934
|
-
for (let j = 0; j < -n + 1 && outIndex < frameSize; ++j) {
|
|
3935
|
-
out[outIndex * 2 + highByte] = value;
|
|
3936
|
-
outIndex++;
|
|
3937
|
-
}
|
|
3938
|
-
}
|
|
3939
|
-
}
|
|
3940
|
-
}
|
|
3941
|
-
if (imageFrame.pixelRepresentation === 0) {
|
|
3942
|
-
imageFrame.pixelData = new Uint16Array(outFrame);
|
|
3897
|
+
function _isRequiredScaling(scalingParameters) {
|
|
3898
|
+
const { rescaleSlope, rescaleIntercept, modality, doseGridScaling, suvbw } = scalingParameters;
|
|
3899
|
+
const hasRescaleValues = typeof rescaleSlope === 'number' && typeof rescaleIntercept === 'number';
|
|
3900
|
+
const isRTDOSEWithScaling = modality === 'RTDOSE' && typeof doseGridScaling === 'number';
|
|
3901
|
+
const isPTWithSUV = modality === 'PT' && typeof suvbw === 'number';
|
|
3902
|
+
return hasRescaleValues || isRTDOSEWithScaling || isPTWithSUV;
|
|
3903
|
+
}
|
|
3904
|
+
function _handleTargetBuffer(options, imageFrame, typedArrayConstructors, pixelDataArray) {
|
|
3905
|
+
const { arrayBuffer, type, offset: rawOffset = 0, length: rawLength, rows, } = options.targetBuffer;
|
|
3906
|
+
const TypedArrayConstructor = typedArrayConstructors[type];
|
|
3907
|
+
if (!TypedArrayConstructor) {
|
|
3908
|
+
throw new Error(`target array ${type} is not supported, or doesn't exist.`);
|
|
3943
3909
|
}
|
|
3944
|
-
|
|
3945
|
-
imageFrame.
|
|
3910
|
+
if (rows && rows != imageFrame.rows) {
|
|
3911
|
+
scaleImageFrame(imageFrame, options.targetBuffer, TypedArrayConstructor);
|
|
3946
3912
|
}
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
const libjpegTurboWasm = new URL(/* asset import */ __webpack_require__(99441), __webpack_require__.b);
|
|
3957
|
-
const local = {
|
|
3958
|
-
codec: undefined,
|
|
3959
|
-
decoder: undefined,
|
|
3960
|
-
};
|
|
3961
|
-
function initLibjpegTurbo() {
|
|
3962
|
-
if (local.codec) {
|
|
3963
|
-
return Promise.resolve();
|
|
3913
|
+
const imageFrameLength = imageFrame.pixelDataLength;
|
|
3914
|
+
const offset = rawOffset;
|
|
3915
|
+
const length = rawLength !== null && rawLength !== undefined
|
|
3916
|
+
? rawLength
|
|
3917
|
+
: imageFrameLength - offset;
|
|
3918
|
+
const imageFramePixelData = imageFrame.pixelData;
|
|
3919
|
+
if (length !== imageFramePixelData.length) {
|
|
3920
|
+
throw new Error(`target array for image does not have the same length (${length}) as the decoded image length (${imageFramePixelData.length}).`);
|
|
3964
3921
|
}
|
|
3965
|
-
const
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
},
|
|
3972
|
-
});
|
|
3973
|
-
return new Promise((resolve, reject) => {
|
|
3974
|
-
libjpegTurboModule.then((instance) => {
|
|
3975
|
-
local.codec = instance;
|
|
3976
|
-
local.decoder = new instance.JPEGDecoder();
|
|
3977
|
-
resolve();
|
|
3978
|
-
}, reject);
|
|
3979
|
-
});
|
|
3980
|
-
}
|
|
3981
|
-
async function decodeAsync(compressedImageFrame, imageInfo) {
|
|
3982
|
-
await initLibjpegTurbo();
|
|
3983
|
-
const decoder = local.decoder;
|
|
3984
|
-
const encodedBufferInWASM = decoder.getEncodedBuffer(compressedImageFrame.length);
|
|
3985
|
-
encodedBufferInWASM.set(compressedImageFrame);
|
|
3986
|
-
decoder.decode();
|
|
3987
|
-
const frameInfo = decoder.getFrameInfo();
|
|
3988
|
-
const decodedPixelsInWASM = decoder.getDecodedBuffer();
|
|
3989
|
-
const encodedImageInfo = {
|
|
3990
|
-
columns: frameInfo.width,
|
|
3991
|
-
rows: frameInfo.height,
|
|
3992
|
-
bitsPerPixel: frameInfo.bitsPerSample,
|
|
3993
|
-
signed: imageInfo.signed,
|
|
3994
|
-
bytesPerPixel: imageInfo.bytesPerPixel,
|
|
3995
|
-
componentsPerPixel: frameInfo.componentCount,
|
|
3996
|
-
};
|
|
3997
|
-
const pixelData = getPixelData(frameInfo, decodedPixelsInWASM);
|
|
3998
|
-
const encodeOptions = {
|
|
3999
|
-
frameInfo,
|
|
4000
|
-
};
|
|
4001
|
-
return {
|
|
4002
|
-
...imageInfo,
|
|
4003
|
-
pixelData,
|
|
4004
|
-
imageInfo: encodedImageInfo,
|
|
4005
|
-
encodeOptions,
|
|
4006
|
-
...encodeOptions,
|
|
4007
|
-
...encodedImageInfo,
|
|
4008
|
-
};
|
|
3922
|
+
const typedArray = arrayBuffer
|
|
3923
|
+
? new TypedArrayConstructor(arrayBuffer, offset, length)
|
|
3924
|
+
: new TypedArrayConstructor(length);
|
|
3925
|
+
typedArray.set(imageFramePixelData, 0);
|
|
3926
|
+
pixelDataArray = typedArray;
|
|
3927
|
+
return pixelDataArray;
|
|
4009
3928
|
}
|
|
4010
|
-
function
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
return
|
|
3929
|
+
function _handlePreScaleSetup(options, minBeforeScale, maxBeforeScale, imageFrame) {
|
|
3930
|
+
const scalingParameters = options.preScale.scalingParameters;
|
|
3931
|
+
_validateScalingParameters(scalingParameters);
|
|
3932
|
+
const scaledValues = _calculateScaledMinMax(minBeforeScale, maxBeforeScale, scalingParameters);
|
|
3933
|
+
return _getDefaultPixelDataArray(scaledValues.min, scaledValues.max, imageFrame);
|
|
4015
3934
|
}
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
decodeConfig: {},
|
|
4022
|
-
};
|
|
4023
|
-
function initialize(decodeConfig) {
|
|
4024
|
-
decodeJPEGBaseline12Bit_js_local.decodeConfig = decodeConfig;
|
|
4025
|
-
if (decodeJPEGBaseline12Bit_js_local.JpegImage) {
|
|
4026
|
-
return Promise.resolve();
|
|
4027
|
-
}
|
|
4028
|
-
return new Promise((resolve, reject) => {
|
|
4029
|
-
__webpack_require__.e(/* import() */ 8094).then(__webpack_require__.bind(__webpack_require__, 8094))
|
|
4030
|
-
.then((module) => {
|
|
4031
|
-
decodeJPEGBaseline12Bit_js_local.JpegImage = module.default;
|
|
4032
|
-
resolve();
|
|
4033
|
-
})
|
|
4034
|
-
.catch(reject);
|
|
4035
|
-
});
|
|
3935
|
+
function _getDefaultPixelDataArray(min, max, imageFrame) {
|
|
3936
|
+
const TypedArrayConstructor = (0,getPixelDataTypeFromMinMax/* default */.A)(min, max);
|
|
3937
|
+
const typedArray = new TypedArrayConstructor(imageFrame.pixelData.length);
|
|
3938
|
+
typedArray.set(imageFrame.pixelData, 0);
|
|
3939
|
+
return typedArray;
|
|
4036
3940
|
}
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
if (typeof
|
|
4040
|
-
|
|
3941
|
+
function _calculateScaledMinMax(minValue, maxValue, scalingParameters) {
|
|
3942
|
+
const { rescaleSlope, rescaleIntercept, modality, doseGridScaling, suvbw } = scalingParameters;
|
|
3943
|
+
if (modality === 'PT' && typeof suvbw === 'number' && !isNaN(suvbw)) {
|
|
3944
|
+
return {
|
|
3945
|
+
min: suvbw * (minValue * rescaleSlope + rescaleIntercept),
|
|
3946
|
+
max: suvbw * (maxValue * rescaleSlope + rescaleIntercept),
|
|
3947
|
+
};
|
|
4041
3948
|
}
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
3949
|
+
else if (modality === 'RTDOSE' &&
|
|
3950
|
+
typeof doseGridScaling === 'number' &&
|
|
3951
|
+
!isNaN(doseGridScaling)) {
|
|
3952
|
+
return {
|
|
3953
|
+
min: minValue * doseGridScaling,
|
|
3954
|
+
max: maxValue * doseGridScaling,
|
|
3955
|
+
};
|
|
4048
3956
|
}
|
|
4049
|
-
else if (
|
|
4050
|
-
|
|
4051
|
-
return
|
|
3957
|
+
else if (typeof rescaleSlope === 'number' &&
|
|
3958
|
+
typeof rescaleIntercept === 'number') {
|
|
3959
|
+
return {
|
|
3960
|
+
min: rescaleSlope * minValue + rescaleIntercept,
|
|
3961
|
+
max: rescaleSlope * maxValue + rescaleIntercept,
|
|
3962
|
+
};
|
|
4052
3963
|
}
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
DecoderClass: undefined,
|
|
4059
|
-
decodeConfig: {},
|
|
4060
|
-
};
|
|
4061
|
-
function decodeJPEGLossless_initialize(decodeConfig) {
|
|
4062
|
-
decodeJPEGLossless_local.decodeConfig = decodeConfig;
|
|
4063
|
-
if (decodeJPEGLossless_local.DecoderClass) {
|
|
4064
|
-
return Promise.resolve();
|
|
3964
|
+
else {
|
|
3965
|
+
return {
|
|
3966
|
+
min: minValue,
|
|
3967
|
+
max: maxValue,
|
|
3968
|
+
};
|
|
4065
3969
|
}
|
|
4066
|
-
return new Promise((resolve, reject) => {
|
|
4067
|
-
__webpack_require__.e(/* import() */ 732).then(__webpack_require__.bind(__webpack_require__, 10732)).then(({ Decoder }) => {
|
|
4068
|
-
decodeJPEGLossless_local.DecoderClass = Decoder;
|
|
4069
|
-
resolve();
|
|
4070
|
-
}, reject);
|
|
4071
|
-
});
|
|
4072
3970
|
}
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
throw new Error('No JPEG Lossless decoder loaded');
|
|
4077
|
-
}
|
|
4078
|
-
const decoder = new decodeJPEGLossless_local.DecoderClass();
|
|
4079
|
-
const byteOutput = imageFrame.bitsAllocated <= 8 ? 1 : 2;
|
|
4080
|
-
const buffer = pixelData.buffer;
|
|
4081
|
-
const decompressedData = decoder.decode(buffer, pixelData.byteOffset, pixelData.length, byteOutput);
|
|
4082
|
-
if (imageFrame.pixelRepresentation === 0) {
|
|
4083
|
-
if (imageFrame.bitsAllocated === 16) {
|
|
4084
|
-
imageFrame.pixelData = new Uint16Array(decompressedData.buffer);
|
|
4085
|
-
return imageFrame;
|
|
4086
|
-
}
|
|
4087
|
-
imageFrame.pixelData = new Uint8Array(decompressedData.buffer);
|
|
4088
|
-
return imageFrame;
|
|
3971
|
+
function _validateScalingParameters(scalingParameters) {
|
|
3972
|
+
if (!scalingParameters) {
|
|
3973
|
+
throw new Error('options.preScale.scalingParameters must be defined if preScale.enabled is true, and scalingParameters cannot be derived from the metadata providers.');
|
|
4089
3974
|
}
|
|
4090
|
-
imageFrame.pixelData = new Int16Array(decompressedData.buffer);
|
|
4091
|
-
return imageFrame;
|
|
4092
|
-
}
|
|
4093
|
-
/* harmony default export */ const decoders_decodeJPEGLossless = (decodeJPEGLossless);
|
|
4094
|
-
|
|
4095
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/codec-charls/dist/charlswasm_decode.js
|
|
4096
|
-
var charlswasm_decode = __webpack_require__(93720);
|
|
4097
|
-
var charlswasm_decode_default = /*#__PURE__*/__webpack_require__.n(charlswasm_decode);
|
|
4098
|
-
;// ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeJPEGLS.js
|
|
4099
|
-
|
|
4100
|
-
const charlsWasm = new URL(/* asset import */ __webpack_require__(46920), __webpack_require__.b);
|
|
4101
|
-
const decodeJPEGLS_local = {
|
|
4102
|
-
codec: undefined,
|
|
4103
|
-
decoder: undefined,
|
|
4104
|
-
decodeConfig: {},
|
|
4105
|
-
};
|
|
4106
|
-
function getExceptionMessage(exception) {
|
|
4107
|
-
return typeof exception === 'number'
|
|
4108
|
-
? decodeJPEGLS_local.codec.getExceptionMessage(exception)
|
|
4109
|
-
: exception;
|
|
4110
3975
|
}
|
|
4111
|
-
function
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
const
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
3976
|
+
function createDestinationImage(imageFrame, targetBuffer, TypedArrayConstructor) {
|
|
3977
|
+
const { samplesPerPixel } = imageFrame;
|
|
3978
|
+
const { rows, columns } = targetBuffer;
|
|
3979
|
+
const typedLength = rows * columns * samplesPerPixel;
|
|
3980
|
+
const pixelData = new TypedArrayConstructor(typedLength);
|
|
3981
|
+
const bytesPerPixel = pixelData.byteLength / typedLength;
|
|
3982
|
+
return {
|
|
3983
|
+
pixelData,
|
|
3984
|
+
rows,
|
|
3985
|
+
columns,
|
|
3986
|
+
frameInfo: {
|
|
3987
|
+
...imageFrame.frameInfo,
|
|
3988
|
+
rows,
|
|
3989
|
+
columns,
|
|
4122
3990
|
},
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
});
|
|
3991
|
+
imageInfo: {
|
|
3992
|
+
...imageFrame.imageInfo,
|
|
3993
|
+
rows,
|
|
3994
|
+
columns,
|
|
3995
|
+
bytesPerPixel,
|
|
3996
|
+
},
|
|
3997
|
+
};
|
|
4131
3998
|
}
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
3999
|
+
function scaleImageFrame(imageFrame, targetBuffer, TypedArrayConstructor) {
|
|
4000
|
+
const dest = createDestinationImage(imageFrame, targetBuffer, TypedArrayConstructor);
|
|
4001
|
+
const { scalingType = 'replicate' } = targetBuffer;
|
|
4002
|
+
imageUtils[scalingType](imageFrame, dest);
|
|
4003
|
+
Object.assign(imageFrame, dest);
|
|
4004
|
+
imageFrame.pixelDataLength = imageFrame.pixelData.length;
|
|
4005
|
+
return imageFrame;
|
|
4006
|
+
}
|
|
4007
|
+
async function decodeImageFrame(imageFrame, transferSyntax, pixelData, decodeConfig, options, callbackFn) {
|
|
4008
|
+
const start = new Date().getTime();
|
|
4009
|
+
let decodePromise = null;
|
|
4010
|
+
let opts;
|
|
4011
|
+
switch (transferSyntax) {
|
|
4012
|
+
case '1.2.840.10008.1.2':
|
|
4013
|
+
case '1.2.840.10008.1.2.1':
|
|
4014
|
+
decodePromise = (0,decodeLittleEndian/* default */.A)(imageFrame, pixelData);
|
|
4015
|
+
break;
|
|
4016
|
+
case '1.2.840.10008.1.2.2':
|
|
4017
|
+
decodePromise = (0,decodeBigEndian/* default */.A)(imageFrame, pixelData);
|
|
4018
|
+
break;
|
|
4019
|
+
case '1.2.840.10008.1.2.1.99':
|
|
4020
|
+
decodePromise = (0,decodeLittleEndian/* default */.A)(imageFrame, pixelData);
|
|
4021
|
+
break;
|
|
4022
|
+
case '1.2.840.10008.1.2.5':
|
|
4023
|
+
decodePromise = (0,decodeRLE/* default */.A)(imageFrame, pixelData);
|
|
4024
|
+
break;
|
|
4025
|
+
case '1.2.840.10008.1.2.4.50':
|
|
4026
|
+
opts = {
|
|
4027
|
+
...imageFrame,
|
|
4028
|
+
};
|
|
4029
|
+
decodePromise = (0,decodeJPEGBaseline8Bit/* default */.A)(pixelData, opts);
|
|
4030
|
+
break;
|
|
4031
|
+
case '1.2.840.10008.1.2.4.51':
|
|
4032
|
+
decodePromise = (0,decodeJPEGBaseline12Bit_js/* default */.A)(imageFrame, pixelData);
|
|
4033
|
+
break;
|
|
4034
|
+
case '1.2.840.10008.1.2.4.57':
|
|
4035
|
+
decodePromise = (0,decodeJPEGLossless/* default */.A)(imageFrame, pixelData);
|
|
4036
|
+
break;
|
|
4037
|
+
case '1.2.840.10008.1.2.4.70':
|
|
4038
|
+
decodePromise = (0,decodeJPEGLossless/* default */.A)(imageFrame, pixelData);
|
|
4039
|
+
break;
|
|
4040
|
+
case '1.2.840.10008.1.2.4.80':
|
|
4041
|
+
opts = {
|
|
4042
|
+
signed: imageFrame.pixelRepresentation === 1,
|
|
4043
|
+
bytesPerPixel: imageFrame.bitsAllocated <= 8 ? 1 : 2,
|
|
4044
|
+
...imageFrame,
|
|
4045
|
+
};
|
|
4046
|
+
decodePromise = (0,decodeJPEGLS/* default */.A)(pixelData, opts);
|
|
4047
|
+
break;
|
|
4048
|
+
case '1.2.840.10008.1.2.4.81':
|
|
4049
|
+
opts = {
|
|
4050
|
+
signed: imageFrame.pixelRepresentation === 1,
|
|
4051
|
+
bytesPerPixel: imageFrame.bitsAllocated <= 8 ? 1 : 2,
|
|
4052
|
+
...imageFrame,
|
|
4053
|
+
};
|
|
4054
|
+
decodePromise = (0,decodeJPEGLS/* default */.A)(pixelData, opts);
|
|
4055
|
+
break;
|
|
4056
|
+
case '1.2.840.10008.1.2.4.90':
|
|
4057
|
+
opts = {
|
|
4058
|
+
...imageFrame,
|
|
4059
|
+
};
|
|
4060
|
+
decodePromise = (0,decodeJPEG2000/* default */.A)(pixelData, opts);
|
|
4061
|
+
break;
|
|
4062
|
+
case '1.2.840.10008.1.2.4.91':
|
|
4063
|
+
opts = {
|
|
4064
|
+
...imageFrame,
|
|
4065
|
+
};
|
|
4066
|
+
decodePromise = (0,decodeJPEG2000/* default */.A)(pixelData, opts);
|
|
4067
|
+
break;
|
|
4068
|
+
case '3.2.840.10008.1.2.4.96':
|
|
4069
|
+
case '1.2.840.10008.1.2.4.201':
|
|
4070
|
+
case '1.2.840.10008.1.2.4.202':
|
|
4071
|
+
case '1.2.840.10008.1.2.4.203':
|
|
4072
|
+
opts = {
|
|
4073
|
+
...imageFrame,
|
|
4074
|
+
};
|
|
4075
|
+
decodePromise = (0,decodeHTJ2K/* default */.A)(pixelData, opts);
|
|
4076
|
+
break;
|
|
4077
|
+
default:
|
|
4078
|
+
throw new Error(`no decoder for transfer syntax ${transferSyntax}`);
|
|
4165
4079
|
}
|
|
4166
|
-
|
|
4167
|
-
throw
|
|
4080
|
+
if (!decodePromise) {
|
|
4081
|
+
throw new Error('decodePromise not defined');
|
|
4168
4082
|
}
|
|
4083
|
+
const decodedFrame = await decodePromise;
|
|
4084
|
+
const postProcessed = postProcessDecodedPixels(decodedFrame, options, start, decodeConfig);
|
|
4085
|
+
callbackFn?.(postProcessed);
|
|
4086
|
+
return postProcessed;
|
|
4169
4087
|
}
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4088
|
+
const obj = {
|
|
4089
|
+
decodeTask({ imageFrame, transferSyntax, decodeConfig, options, pixelData, callbackFn, }) {
|
|
4090
|
+
return decodeImageFrame(imageFrame, transferSyntax, pixelData, decodeConfig, options, callbackFn);
|
|
4091
|
+
},
|
|
4092
|
+
};
|
|
4093
|
+
(0,comlink/* expose */.p)(obj);
|
|
4094
|
+
|
|
4095
|
+
|
|
4096
|
+
/***/ }),
|
|
4097
|
+
|
|
4098
|
+
/***/ 45155:
|
|
4099
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4100
|
+
|
|
4101
|
+
"use strict";
|
|
4102
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4103
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4104
|
+
/* harmony export */ });
|
|
4105
|
+
function swap16(val) {
|
|
4106
|
+
return ((val & 0xff) << 8) | ((val >> 8) & 0xff);
|
|
4107
|
+
}
|
|
4108
|
+
async function decodeBigEndian(imageFrame, pixelData) {
|
|
4109
|
+
if (imageFrame.bitsAllocated === 16) {
|
|
4110
|
+
let arrayBuffer = pixelData.buffer;
|
|
4111
|
+
let offset = pixelData.byteOffset;
|
|
4112
|
+
const length = pixelData.length;
|
|
4113
|
+
if (offset % 2) {
|
|
4114
|
+
arrayBuffer = arrayBuffer.slice(offset);
|
|
4115
|
+
offset = 0;
|
|
4116
|
+
}
|
|
4117
|
+
if (imageFrame.pixelRepresentation === 0) {
|
|
4118
|
+
imageFrame.pixelData = new Uint16Array(arrayBuffer, offset, length / 2);
|
|
4119
|
+
}
|
|
4120
|
+
else {
|
|
4121
|
+
imageFrame.pixelData = new Int16Array(arrayBuffer, offset, length / 2);
|
|
4122
|
+
}
|
|
4123
|
+
for (let i = 0; i < imageFrame.pixelData.length; i++) {
|
|
4124
|
+
imageFrame.pixelData[i] = swap16(imageFrame.pixelData[i]);
|
|
4174
4125
|
}
|
|
4175
|
-
return new Uint16Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength / 2);
|
|
4176
4126
|
}
|
|
4177
|
-
if (
|
|
4178
|
-
|
|
4127
|
+
else if (imageFrame.bitsAllocated === 8) {
|
|
4128
|
+
imageFrame.pixelData = pixelData;
|
|
4179
4129
|
}
|
|
4180
|
-
return
|
|
4130
|
+
return imageFrame;
|
|
4181
4131
|
}
|
|
4182
|
-
/* harmony default export */ const
|
|
4132
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeBigEndian);
|
|
4183
4133
|
|
|
4184
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/codec-openjpeg/dist/openjpegwasm_decode.js
|
|
4185
|
-
var openjpegwasm_decode = __webpack_require__(53488);
|
|
4186
|
-
var openjpegwasm_decode_default = /*#__PURE__*/__webpack_require__.n(openjpegwasm_decode);
|
|
4187
|
-
;// ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeJPEG2000.js
|
|
4188
4134
|
|
|
4189
|
-
|
|
4190
|
-
|
|
4135
|
+
/***/ }),
|
|
4136
|
+
|
|
4137
|
+
/***/ 53383:
|
|
4138
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4139
|
+
|
|
4140
|
+
"use strict";
|
|
4141
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4142
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4143
|
+
/* harmony export */ });
|
|
4144
|
+
/* unused harmony export initialize */
|
|
4145
|
+
/* harmony import */ var _cornerstonejs_codec_openjph_wasmjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(68112);
|
|
4146
|
+
/* harmony import */ var _cornerstonejs_codec_openjph_wasmjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_cornerstonejs_codec_openjph_wasmjs__WEBPACK_IMPORTED_MODULE_0__);
|
|
4147
|
+
|
|
4148
|
+
const openjphWasm = new URL(/* asset import */ __webpack_require__(12342), __webpack_require__.b);
|
|
4149
|
+
const local = {
|
|
4191
4150
|
codec: undefined,
|
|
4192
4151
|
decoder: undefined,
|
|
4193
4152
|
decodeConfig: {},
|
|
4194
4153
|
};
|
|
4195
|
-
function
|
|
4196
|
-
|
|
4197
|
-
|
|
4154
|
+
function calculateSizeAtDecompositionLevel(decompositionLevel, frameWidth, frameHeight) {
|
|
4155
|
+
const result = { width: frameWidth, height: frameHeight };
|
|
4156
|
+
while (decompositionLevel > 0) {
|
|
4157
|
+
result.width = Math.ceil(result.width / 2);
|
|
4158
|
+
result.height = Math.ceil(result.height / 2);
|
|
4159
|
+
decompositionLevel--;
|
|
4160
|
+
}
|
|
4161
|
+
return result;
|
|
4162
|
+
}
|
|
4163
|
+
function initialize(decodeConfig) {
|
|
4164
|
+
local.decodeConfig = decodeConfig;
|
|
4165
|
+
if (local.codec) {
|
|
4198
4166
|
return Promise.resolve();
|
|
4199
4167
|
}
|
|
4200
|
-
const
|
|
4168
|
+
const openJphModule = _cornerstonejs_codec_openjph_wasmjs__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
4201
4169
|
locateFile: (f) => {
|
|
4202
4170
|
if (f.endsWith('.wasm')) {
|
|
4203
|
-
return
|
|
4171
|
+
return openjphWasm.toString();
|
|
4204
4172
|
}
|
|
4205
4173
|
return f;
|
|
4206
4174
|
},
|
|
4207
4175
|
});
|
|
4208
4176
|
return new Promise((resolve, reject) => {
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4177
|
+
openJphModule.then((instance) => {
|
|
4178
|
+
local.codec = instance;
|
|
4179
|
+
local.decoder = new instance.HTJ2KDecoder();
|
|
4212
4180
|
resolve();
|
|
4213
4181
|
}, reject);
|
|
4214
4182
|
});
|
|
4215
4183
|
}
|
|
4216
|
-
async function
|
|
4217
|
-
await
|
|
4218
|
-
const decoder =
|
|
4184
|
+
async function decodeAsync(compressedImageFrame, imageInfo) {
|
|
4185
|
+
await initialize();
|
|
4186
|
+
const decoder = new local.codec.HTJ2KDecoder();
|
|
4219
4187
|
const encodedBufferInWASM = decoder.getEncodedBuffer(compressedImageFrame.length);
|
|
4220
4188
|
encodedBufferInWASM.set(compressedImageFrame);
|
|
4221
|
-
|
|
4189
|
+
const decodeLevel = imageInfo.decodeLevel || 0;
|
|
4190
|
+
decoder.decodeSubResolution(decodeLevel);
|
|
4222
4191
|
const frameInfo = decoder.getFrameInfo();
|
|
4192
|
+
if (imageInfo.decodeLevel > 0) {
|
|
4193
|
+
const { width, height } = calculateSizeAtDecompositionLevel(imageInfo.decodeLevel, frameInfo.width, frameInfo.height);
|
|
4194
|
+
frameInfo.width = width;
|
|
4195
|
+
frameInfo.height = height;
|
|
4196
|
+
}
|
|
4223
4197
|
const decodedBufferInWASM = decoder.getDecodedBuffer();
|
|
4224
4198
|
const imageFrame = new Uint8Array(decodedBufferInWASM.length);
|
|
4225
4199
|
imageFrame.set(decodedBufferInWASM);
|
|
@@ -4231,7 +4205,6 @@ async function decodeJPEG2000_decodeAsync(compressedImageFrame, imageInfo) {
|
|
|
4231
4205
|
const blockDimensions = `${decoder.getBlockDimensions().width} x ${decoder.getBlockDimensions().height}`;
|
|
4232
4206
|
const tileSize = `${decoder.getTileSize().width} x ${decoder.getTileSize().height}`;
|
|
4233
4207
|
const tileOffset = `${decoder.getTileOffset().x}, ${decoder.getTileOffset().y}`;
|
|
4234
|
-
const colorTransform = decoder.getColorSpace();
|
|
4235
4208
|
const decodedSize = `${decodedBufferInWASM.length.toLocaleString()} bytes`;
|
|
4236
4209
|
const compressionRatio = `${(decodedBufferInWASM.length / encodedBufferInWASM.length).toFixed(2)}:1`;
|
|
4237
4210
|
const encodedImageInfo = {
|
|
@@ -4242,7 +4215,10 @@ async function decodeJPEG2000_decodeAsync(compressedImageFrame, imageInfo) {
|
|
|
4242
4215
|
bytesPerPixel: imageInfo.bytesPerPixel,
|
|
4243
4216
|
componentsPerPixel: frameInfo.componentCount,
|
|
4244
4217
|
};
|
|
4245
|
-
|
|
4218
|
+
let pixelData = getPixelData(frameInfo, decodedBufferInWASM);
|
|
4219
|
+
const { buffer: b, byteOffset, byteLength } = pixelData;
|
|
4220
|
+
const pixelDataArrayBuffer = b.slice(byteOffset, byteOffset + byteLength);
|
|
4221
|
+
pixelData = new pixelData.constructor(pixelDataArrayBuffer);
|
|
4246
4222
|
const encodeOptions = {
|
|
4247
4223
|
imageOffset,
|
|
4248
4224
|
numDecompositions,
|
|
@@ -4252,7 +4228,6 @@ async function decodeJPEG2000_decodeAsync(compressedImageFrame, imageInfo) {
|
|
|
4252
4228
|
blockDimensions,
|
|
4253
4229
|
tileSize,
|
|
4254
4230
|
tileOffset,
|
|
4255
|
-
colorTransform,
|
|
4256
4231
|
decodedSize,
|
|
4257
4232
|
compressionRatio,
|
|
4258
4233
|
};
|
|
@@ -4265,7 +4240,7 @@ async function decodeJPEG2000_decodeAsync(compressedImageFrame, imageInfo) {
|
|
|
4265
4240
|
...encodedImageInfo,
|
|
4266
4241
|
};
|
|
4267
4242
|
}
|
|
4268
|
-
function
|
|
4243
|
+
function getPixelData(frameInfo, decodedBuffer) {
|
|
4269
4244
|
if (frameInfo.bitsPerSample > 8) {
|
|
4270
4245
|
if (frameInfo.isSigned) {
|
|
4271
4246
|
return new Int16Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength / 2);
|
|
@@ -4277,62 +4252,56 @@ function decodeJPEG2000_getPixelData(frameInfo, decodedBuffer) {
|
|
|
4277
4252
|
}
|
|
4278
4253
|
return new Uint8Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength);
|
|
4279
4254
|
}
|
|
4280
|
-
/* harmony default export */ const
|
|
4255
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeAsync);
|
|
4281
4256
|
|
|
4282
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/codec-openjph/dist/openjphjs.js
|
|
4283
|
-
var openjphjs = __webpack_require__(68112);
|
|
4284
|
-
var openjphjs_default = /*#__PURE__*/__webpack_require__.n(openjphjs);
|
|
4285
|
-
;// ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/decoders/decodeHTJ2K.js
|
|
4286
4257
|
|
|
4287
|
-
|
|
4288
|
-
|
|
4258
|
+
/***/ }),
|
|
4259
|
+
|
|
4260
|
+
/***/ 90612:
|
|
4261
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4262
|
+
|
|
4263
|
+
"use strict";
|
|
4264
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4265
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4266
|
+
/* harmony export */ });
|
|
4267
|
+
/* unused harmony export initialize */
|
|
4268
|
+
/* harmony import */ var _cornerstonejs_codec_openjpeg_decodewasmjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(53488);
|
|
4269
|
+
/* harmony import */ var _cornerstonejs_codec_openjpeg_decodewasmjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_cornerstonejs_codec_openjpeg_decodewasmjs__WEBPACK_IMPORTED_MODULE_0__);
|
|
4270
|
+
|
|
4271
|
+
const openjpegWasm = new URL(/* asset import */ __webpack_require__(87840), __webpack_require__.b);
|
|
4272
|
+
const local = {
|
|
4289
4273
|
codec: undefined,
|
|
4290
4274
|
decoder: undefined,
|
|
4291
4275
|
decodeConfig: {},
|
|
4292
4276
|
};
|
|
4293
|
-
function
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
result.width = Math.ceil(result.width / 2);
|
|
4297
|
-
result.height = Math.ceil(result.height / 2);
|
|
4298
|
-
decompositionLevel--;
|
|
4299
|
-
}
|
|
4300
|
-
return result;
|
|
4301
|
-
}
|
|
4302
|
-
function decodeHTJ2K_initialize(decodeConfig) {
|
|
4303
|
-
decodeHTJ2K_local.decodeConfig = decodeConfig;
|
|
4304
|
-
if (decodeHTJ2K_local.codec) {
|
|
4277
|
+
function initialize(decodeConfig) {
|
|
4278
|
+
local.decodeConfig = decodeConfig;
|
|
4279
|
+
if (local.codec) {
|
|
4305
4280
|
return Promise.resolve();
|
|
4306
4281
|
}
|
|
4307
|
-
const
|
|
4282
|
+
const openJpegModule = _cornerstonejs_codec_openjpeg_decodewasmjs__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
4308
4283
|
locateFile: (f) => {
|
|
4309
4284
|
if (f.endsWith('.wasm')) {
|
|
4310
|
-
return
|
|
4285
|
+
return openjpegWasm.toString();
|
|
4311
4286
|
}
|
|
4312
4287
|
return f;
|
|
4313
4288
|
},
|
|
4314
4289
|
});
|
|
4315
4290
|
return new Promise((resolve, reject) => {
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4291
|
+
openJpegModule.then((instance) => {
|
|
4292
|
+
local.codec = instance;
|
|
4293
|
+
local.decoder = new instance.J2KDecoder();
|
|
4319
4294
|
resolve();
|
|
4320
4295
|
}, reject);
|
|
4321
4296
|
});
|
|
4322
4297
|
}
|
|
4323
|
-
async function
|
|
4324
|
-
await
|
|
4325
|
-
const decoder =
|
|
4298
|
+
async function decodeAsync(compressedImageFrame, imageInfo) {
|
|
4299
|
+
await initialize();
|
|
4300
|
+
const decoder = local.decoder;
|
|
4326
4301
|
const encodedBufferInWASM = decoder.getEncodedBuffer(compressedImageFrame.length);
|
|
4327
4302
|
encodedBufferInWASM.set(compressedImageFrame);
|
|
4328
|
-
|
|
4329
|
-
decoder.decodeSubResolution(decodeLevel);
|
|
4303
|
+
decoder.decode();
|
|
4330
4304
|
const frameInfo = decoder.getFrameInfo();
|
|
4331
|
-
if (imageInfo.decodeLevel > 0) {
|
|
4332
|
-
const { width, height } = calculateSizeAtDecompositionLevel(imageInfo.decodeLevel, frameInfo.width, frameInfo.height);
|
|
4333
|
-
frameInfo.width = width;
|
|
4334
|
-
frameInfo.height = height;
|
|
4335
|
-
}
|
|
4336
4305
|
const decodedBufferInWASM = decoder.getDecodedBuffer();
|
|
4337
4306
|
const imageFrame = new Uint8Array(decodedBufferInWASM.length);
|
|
4338
4307
|
imageFrame.set(decodedBufferInWASM);
|
|
@@ -4344,6 +4313,7 @@ async function decodeHTJ2K_decodeAsync(compressedImageFrame, imageInfo) {
|
|
|
4344
4313
|
const blockDimensions = `${decoder.getBlockDimensions().width} x ${decoder.getBlockDimensions().height}`;
|
|
4345
4314
|
const tileSize = `${decoder.getTileSize().width} x ${decoder.getTileSize().height}`;
|
|
4346
4315
|
const tileOffset = `${decoder.getTileOffset().x}, ${decoder.getTileOffset().y}`;
|
|
4316
|
+
const colorTransform = decoder.getColorSpace();
|
|
4347
4317
|
const decodedSize = `${decodedBufferInWASM.length.toLocaleString()} bytes`;
|
|
4348
4318
|
const compressionRatio = `${(decodedBufferInWASM.length / encodedBufferInWASM.length).toFixed(2)}:1`;
|
|
4349
4319
|
const encodedImageInfo = {
|
|
@@ -4354,10 +4324,7 @@ async function decodeHTJ2K_decodeAsync(compressedImageFrame, imageInfo) {
|
|
|
4354
4324
|
bytesPerPixel: imageInfo.bytesPerPixel,
|
|
4355
4325
|
componentsPerPixel: frameInfo.componentCount,
|
|
4356
4326
|
};
|
|
4357
|
-
|
|
4358
|
-
const { buffer: b, byteOffset, byteLength } = pixelData;
|
|
4359
|
-
const pixelDataArrayBuffer = b.slice(byteOffset, byteOffset + byteLength);
|
|
4360
|
-
pixelData = new pixelData.constructor(pixelDataArrayBuffer);
|
|
4327
|
+
const pixelData = getPixelData(frameInfo, decodedBufferInWASM);
|
|
4361
4328
|
const encodeOptions = {
|
|
4362
4329
|
imageOffset,
|
|
4363
4330
|
numDecompositions,
|
|
@@ -4367,6 +4334,7 @@ async function decodeHTJ2K_decodeAsync(compressedImageFrame, imageInfo) {
|
|
|
4367
4334
|
blockDimensions,
|
|
4368
4335
|
tileSize,
|
|
4369
4336
|
tileOffset,
|
|
4337
|
+
colorTransform,
|
|
4370
4338
|
decodedSize,
|
|
4371
4339
|
compressionRatio,
|
|
4372
4340
|
};
|
|
@@ -4379,7 +4347,7 @@ async function decodeHTJ2K_decodeAsync(compressedImageFrame, imageInfo) {
|
|
|
4379
4347
|
...encodedImageInfo,
|
|
4380
4348
|
};
|
|
4381
4349
|
}
|
|
4382
|
-
function
|
|
4350
|
+
function getPixelData(frameInfo, decodedBuffer) {
|
|
4383
4351
|
if (frameInfo.bitsPerSample > 8) {
|
|
4384
4352
|
if (frameInfo.isSigned) {
|
|
4385
4353
|
return new Int16Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength / 2);
|
|
@@ -4391,335 +4359,470 @@ function decodeHTJ2K_getPixelData(frameInfo, decodedBuffer) {
|
|
|
4391
4359
|
}
|
|
4392
4360
|
return new Uint8Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength);
|
|
4393
4361
|
}
|
|
4394
|
-
/* harmony default export */ const
|
|
4395
|
-
|
|
4396
|
-
;// ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/scaling/scaleArray.js
|
|
4397
|
-
function scaleArray(array, scalingParameters) {
|
|
4398
|
-
const arrayLength = array.length;
|
|
4399
|
-
const { rescaleSlope, rescaleIntercept, suvbw, doseGridScaling } = scalingParameters;
|
|
4400
|
-
if (scalingParameters.modality === 'PT' &&
|
|
4401
|
-
typeof suvbw === 'number' &&
|
|
4402
|
-
!isNaN(suvbw)) {
|
|
4403
|
-
for (let i = 0; i < arrayLength; i++) {
|
|
4404
|
-
array[i] = suvbw * (array[i] * rescaleSlope + rescaleIntercept);
|
|
4405
|
-
}
|
|
4406
|
-
}
|
|
4407
|
-
else if (scalingParameters.modality === 'RTDOSE' &&
|
|
4408
|
-
typeof doseGridScaling === 'number' &&
|
|
4409
|
-
!isNaN(doseGridScaling)) {
|
|
4410
|
-
for (let i = 0; i < arrayLength; i++) {
|
|
4411
|
-
array[i] = array[i] * doseGridScaling;
|
|
4412
|
-
}
|
|
4413
|
-
}
|
|
4414
|
-
else {
|
|
4415
|
-
for (let i = 0; i < arrayLength; i++) {
|
|
4416
|
-
array[i] = array[i] * rescaleSlope + rescaleIntercept;
|
|
4417
|
-
}
|
|
4418
|
-
}
|
|
4419
|
-
return true;
|
|
4420
|
-
}
|
|
4421
|
-
|
|
4422
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/getMinMax.js
|
|
4423
|
-
var getMinMax = __webpack_require__(52842);
|
|
4424
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/getPixelDataTypeFromMinMax.js
|
|
4425
|
-
var getPixelDataTypeFromMinMax = __webpack_require__(69952);
|
|
4426
|
-
// EXTERNAL MODULE: ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/shared/isColorImage.js
|
|
4427
|
-
var isColorImage = __webpack_require__(30922);
|
|
4428
|
-
;// ../../../node_modules/@cornerstonejs/dicom-image-loader/dist/esm/decodeImageFrameWorker.js
|
|
4429
|
-
|
|
4362
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeAsync);
|
|
4430
4363
|
|
|
4431
4364
|
|
|
4365
|
+
/***/ }),
|
|
4432
4366
|
|
|
4367
|
+
/***/ 63991:
|
|
4368
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4433
4369
|
|
|
4370
|
+
"use strict";
|
|
4371
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4372
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4373
|
+
/* harmony export */ });
|
|
4374
|
+
/* unused harmony export initialize */
|
|
4375
|
+
const local = {
|
|
4376
|
+
JpegImage: undefined,
|
|
4377
|
+
decodeConfig: {},
|
|
4378
|
+
};
|
|
4379
|
+
function initialize(decodeConfig) {
|
|
4380
|
+
local.decodeConfig = decodeConfig;
|
|
4381
|
+
if (local.JpegImage) {
|
|
4382
|
+
return Promise.resolve();
|
|
4383
|
+
}
|
|
4384
|
+
return new Promise((resolve, reject) => {
|
|
4385
|
+
__webpack_require__.e(/* import() */ 8094).then(__webpack_require__.bind(__webpack_require__, 8094))
|
|
4386
|
+
.then((module) => {
|
|
4387
|
+
local.JpegImage = module.default;
|
|
4388
|
+
resolve();
|
|
4389
|
+
})
|
|
4390
|
+
.catch(reject);
|
|
4391
|
+
});
|
|
4392
|
+
}
|
|
4393
|
+
async function decodeJPEGBaseline12BitAsync(imageFrame, pixelData) {
|
|
4394
|
+
await initialize();
|
|
4395
|
+
if (typeof local.JpegImage === 'undefined') {
|
|
4396
|
+
throw new Error('No JPEG Baseline decoder loaded');
|
|
4397
|
+
}
|
|
4398
|
+
const jpeg = new local.JpegImage();
|
|
4399
|
+
jpeg.parse(pixelData);
|
|
4400
|
+
jpeg.colorTransform = false;
|
|
4401
|
+
if (imageFrame.bitsAllocated === 8) {
|
|
4402
|
+
imageFrame.pixelData = jpeg.getData(imageFrame.columns, imageFrame.rows);
|
|
4403
|
+
return imageFrame;
|
|
4404
|
+
}
|
|
4405
|
+
else if (imageFrame.bitsAllocated === 16) {
|
|
4406
|
+
imageFrame.pixelData = jpeg.getData16(imageFrame.columns, imageFrame.rows);
|
|
4407
|
+
return imageFrame;
|
|
4408
|
+
}
|
|
4409
|
+
}
|
|
4410
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeJPEGBaseline12BitAsync);
|
|
4434
4411
|
|
|
4435
4412
|
|
|
4413
|
+
/***/ }),
|
|
4436
4414
|
|
|
4415
|
+
/***/ 89178:
|
|
4416
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4437
4417
|
|
|
4418
|
+
"use strict";
|
|
4419
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4420
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4421
|
+
/* harmony export */ });
|
|
4422
|
+
/* unused harmony export initialize */
|
|
4423
|
+
/* harmony import */ var _cornerstonejs_codec_libjpeg_turbo_8bit_decodewasmjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(36317);
|
|
4424
|
+
/* harmony import */ var _cornerstonejs_codec_libjpeg_turbo_8bit_decodewasmjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_cornerstonejs_codec_libjpeg_turbo_8bit_decodewasmjs__WEBPACK_IMPORTED_MODULE_0__);
|
|
4438
4425
|
|
|
4426
|
+
const libjpegTurboWasm = new URL(/* asset import */ __webpack_require__(99441), __webpack_require__.b);
|
|
4427
|
+
const local = {
|
|
4428
|
+
codec: undefined,
|
|
4429
|
+
decoder: undefined,
|
|
4430
|
+
};
|
|
4431
|
+
function initLibjpegTurbo() {
|
|
4432
|
+
if (local.codec) {
|
|
4433
|
+
return Promise.resolve();
|
|
4434
|
+
}
|
|
4435
|
+
const libjpegTurboModule = _cornerstonejs_codec_libjpeg_turbo_8bit_decodewasmjs__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
4436
|
+
locateFile: (f) => {
|
|
4437
|
+
if (f.endsWith('.wasm')) {
|
|
4438
|
+
return libjpegTurboWasm.toString();
|
|
4439
|
+
}
|
|
4440
|
+
return f;
|
|
4441
|
+
},
|
|
4442
|
+
});
|
|
4443
|
+
return new Promise((resolve, reject) => {
|
|
4444
|
+
libjpegTurboModule.then((instance) => {
|
|
4445
|
+
local.codec = instance;
|
|
4446
|
+
local.decoder = new instance.JPEGDecoder();
|
|
4447
|
+
resolve();
|
|
4448
|
+
}, reject);
|
|
4449
|
+
});
|
|
4450
|
+
}
|
|
4451
|
+
async function decodeAsync(compressedImageFrame, imageInfo) {
|
|
4452
|
+
await initLibjpegTurbo();
|
|
4453
|
+
const decoder = local.decoder;
|
|
4454
|
+
const encodedBufferInWASM = decoder.getEncodedBuffer(compressedImageFrame.length);
|
|
4455
|
+
encodedBufferInWASM.set(compressedImageFrame);
|
|
4456
|
+
decoder.decode();
|
|
4457
|
+
const frameInfo = decoder.getFrameInfo();
|
|
4458
|
+
const decodedPixelsInWASM = decoder.getDecodedBuffer();
|
|
4459
|
+
const encodedImageInfo = {
|
|
4460
|
+
columns: frameInfo.width,
|
|
4461
|
+
rows: frameInfo.height,
|
|
4462
|
+
bitsPerPixel: frameInfo.bitsPerSample,
|
|
4463
|
+
signed: imageInfo.signed,
|
|
4464
|
+
bytesPerPixel: imageInfo.bytesPerPixel,
|
|
4465
|
+
componentsPerPixel: frameInfo.componentCount,
|
|
4466
|
+
};
|
|
4467
|
+
const pixelData = getPixelData(frameInfo, decodedPixelsInWASM);
|
|
4468
|
+
const encodeOptions = {
|
|
4469
|
+
frameInfo,
|
|
4470
|
+
};
|
|
4471
|
+
return {
|
|
4472
|
+
...imageInfo,
|
|
4473
|
+
pixelData,
|
|
4474
|
+
imageInfo: encodedImageInfo,
|
|
4475
|
+
encodeOptions,
|
|
4476
|
+
...encodeOptions,
|
|
4477
|
+
...encodedImageInfo,
|
|
4478
|
+
};
|
|
4479
|
+
}
|
|
4480
|
+
function getPixelData(frameInfo, decodedBuffer) {
|
|
4481
|
+
if (frameInfo.isSigned) {
|
|
4482
|
+
return new Int8Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength);
|
|
4483
|
+
}
|
|
4484
|
+
return new Uint8Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength);
|
|
4485
|
+
}
|
|
4486
|
+
const initialize = (/* unused pure expression or super */ null && (initLibjpegTurbo));
|
|
4439
4487
|
|
|
4488
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeAsync);
|
|
4440
4489
|
|
|
4441
4490
|
|
|
4491
|
+
/***/ }),
|
|
4442
4492
|
|
|
4493
|
+
/***/ 93119:
|
|
4494
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4443
4495
|
|
|
4496
|
+
"use strict";
|
|
4497
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4498
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4499
|
+
/* harmony export */ });
|
|
4500
|
+
/* unused harmony export initialize */
|
|
4501
|
+
/* harmony import */ var _cornerstonejs_codec_charls_decodewasmjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(93720);
|
|
4502
|
+
/* harmony import */ var _cornerstonejs_codec_charls_decodewasmjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_cornerstonejs_codec_charls_decodewasmjs__WEBPACK_IMPORTED_MODULE_0__);
|
|
4444
4503
|
|
|
4445
|
-
const
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
Uint8Array,
|
|
4451
|
-
Uint16Array,
|
|
4452
|
-
Int16Array,
|
|
4453
|
-
Float32Array,
|
|
4454
|
-
Uint32Array,
|
|
4504
|
+
const charlsWasm = new URL(/* asset import */ __webpack_require__(46920), __webpack_require__.b);
|
|
4505
|
+
const local = {
|
|
4506
|
+
codec: undefined,
|
|
4507
|
+
decoder: undefined,
|
|
4508
|
+
decodeConfig: {},
|
|
4455
4509
|
};
|
|
4456
|
-
function
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
}
|
|
4466
|
-
}
|
|
4467
|
-
let pixelDataArray = imageFrame.pixelData;
|
|
4468
|
-
imageFrame.pixelDataLength = imageFrame.pixelData.length;
|
|
4469
|
-
const { min: minBeforeScale, max: maxBeforeScale } = (0,getMinMax/* default */.A)(imageFrame.pixelData);
|
|
4470
|
-
const canRenderFloat = typeof options.allowFloatRendering !== 'undefined'
|
|
4471
|
-
? options.allowFloatRendering
|
|
4472
|
-
: true;
|
|
4473
|
-
let invalidType = (0,isColorImage/* default */.A)(imageFrame.photometricInterpretation) &&
|
|
4474
|
-
options.targetBuffer?.offset === undefined;
|
|
4475
|
-
const willScale = options.preScale?.enabled;
|
|
4476
|
-
const hasFloatRescale = willScale &&
|
|
4477
|
-
Object.values(options.preScale.scalingParameters).some((v) => typeof v === 'number' && !Number.isInteger(v));
|
|
4478
|
-
const disableScale = !options.preScale.enabled || (!canRenderFloat && hasFloatRescale);
|
|
4479
|
-
const type = options.targetBuffer?.type;
|
|
4480
|
-
if (type && options.preScale.enabled && !disableScale) {
|
|
4481
|
-
const scalingParameters = options.preScale.scalingParameters;
|
|
4482
|
-
const scaledValues = _calculateScaledMinMax(minBeforeScale, maxBeforeScale, scalingParameters);
|
|
4483
|
-
invalidType = !(0,getPixelDataTypeFromMinMax/* validatePixelDataType */.r)(scaledValues.min, scaledValues.max, typedArrayConstructors[type]);
|
|
4484
|
-
}
|
|
4485
|
-
if (type && !invalidType) {
|
|
4486
|
-
pixelDataArray = _handleTargetBuffer(options, imageFrame, typedArrayConstructors, pixelDataArray);
|
|
4510
|
+
function getExceptionMessage(exception) {
|
|
4511
|
+
return typeof exception === 'number'
|
|
4512
|
+
? local.codec.getExceptionMessage(exception)
|
|
4513
|
+
: exception;
|
|
4514
|
+
}
|
|
4515
|
+
function initialize(decodeConfig) {
|
|
4516
|
+
local.decodeConfig = decodeConfig;
|
|
4517
|
+
if (local.codec) {
|
|
4518
|
+
return Promise.resolve();
|
|
4487
4519
|
}
|
|
4488
|
-
|
|
4489
|
-
|
|
4520
|
+
const charlsModule = _cornerstonejs_codec_charls_decodewasmjs__WEBPACK_IMPORTED_MODULE_0___default()({
|
|
4521
|
+
locateFile: (f) => {
|
|
4522
|
+
if (f.endsWith('.wasm')) {
|
|
4523
|
+
return charlsWasm.toString();
|
|
4524
|
+
}
|
|
4525
|
+
return f;
|
|
4526
|
+
},
|
|
4527
|
+
});
|
|
4528
|
+
return new Promise((resolve, reject) => {
|
|
4529
|
+
charlsModule.then((instance) => {
|
|
4530
|
+
local.codec = instance;
|
|
4531
|
+
local.decoder = new instance.JpegLSDecoder();
|
|
4532
|
+
resolve();
|
|
4533
|
+
}, reject);
|
|
4534
|
+
});
|
|
4535
|
+
}
|
|
4536
|
+
async function decodeAsync(compressedImageFrame, imageInfo) {
|
|
4537
|
+
try {
|
|
4538
|
+
await initialize();
|
|
4539
|
+
const decoder = local.decoder;
|
|
4540
|
+
const encodedBufferInWASM = decoder.getEncodedBuffer(compressedImageFrame.length);
|
|
4541
|
+
encodedBufferInWASM.set(compressedImageFrame);
|
|
4542
|
+
decoder.decode();
|
|
4543
|
+
const frameInfo = decoder.getFrameInfo();
|
|
4544
|
+
const interleaveMode = decoder.getInterleaveMode();
|
|
4545
|
+
const nearLossless = decoder.getNearLossless();
|
|
4546
|
+
const decodedPixelsInWASM = decoder.getDecodedBuffer();
|
|
4547
|
+
const encodedImageInfo = {
|
|
4548
|
+
columns: frameInfo.width,
|
|
4549
|
+
rows: frameInfo.height,
|
|
4550
|
+
bitsPerPixel: frameInfo.bitsPerSample,
|
|
4551
|
+
signed: imageInfo.signed,
|
|
4552
|
+
bytesPerPixel: imageInfo.bytesPerPixel,
|
|
4553
|
+
componentsPerPixel: frameInfo.componentCount,
|
|
4554
|
+
};
|
|
4555
|
+
const pixelData = getPixelData(frameInfo, decodedPixelsInWASM, imageInfo.signed);
|
|
4556
|
+
const encodeOptions = {
|
|
4557
|
+
nearLossless,
|
|
4558
|
+
interleaveMode,
|
|
4559
|
+
frameInfo,
|
|
4560
|
+
};
|
|
4561
|
+
return {
|
|
4562
|
+
...imageInfo,
|
|
4563
|
+
pixelData,
|
|
4564
|
+
imageInfo: encodedImageInfo,
|
|
4565
|
+
encodeOptions,
|
|
4566
|
+
...encodeOptions,
|
|
4567
|
+
...encodedImageInfo,
|
|
4568
|
+
};
|
|
4490
4569
|
}
|
|
4491
|
-
|
|
4492
|
-
|
|
4570
|
+
catch (error) {
|
|
4571
|
+
throw getExceptionMessage(error);
|
|
4493
4572
|
}
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
if (
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
const isRequiredScaling = _isRequiredScaling(scalingParameters);
|
|
4500
|
-
if (isRequiredScaling) {
|
|
4501
|
-
scaleArray(pixelDataArray, scalingParameters);
|
|
4502
|
-
imageFrame.preScale = {
|
|
4503
|
-
...options.preScale,
|
|
4504
|
-
scaled: true,
|
|
4505
|
-
};
|
|
4506
|
-
const scaledValues = _calculateScaledMinMax(minBeforeScale, maxBeforeScale, scalingParameters);
|
|
4507
|
-
minAfterScale = scaledValues.min;
|
|
4508
|
-
maxAfterScale = scaledValues.max;
|
|
4573
|
+
}
|
|
4574
|
+
function getPixelData(frameInfo, decodedBuffer, signed) {
|
|
4575
|
+
if (frameInfo.bitsPerSample > 8) {
|
|
4576
|
+
if (signed) {
|
|
4577
|
+
return new Int16Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength / 2);
|
|
4509
4578
|
}
|
|
4579
|
+
return new Uint16Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength / 2);
|
|
4510
4580
|
}
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
enabled: true,
|
|
4514
|
-
scaled: false,
|
|
4515
|
-
};
|
|
4516
|
-
minAfterScale = minBeforeScale;
|
|
4517
|
-
maxAfterScale = maxBeforeScale;
|
|
4581
|
+
if (signed) {
|
|
4582
|
+
return new Int8Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength);
|
|
4518
4583
|
}
|
|
4519
|
-
|
|
4520
|
-
imageFrame.smallestPixelValue = minAfterScale;
|
|
4521
|
-
imageFrame.largestPixelValue = maxAfterScale;
|
|
4522
|
-
const end = new Date().getTime();
|
|
4523
|
-
imageFrame.decodeTimeInMS = end - start;
|
|
4524
|
-
return imageFrame;
|
|
4525
|
-
}
|
|
4526
|
-
function _isRequiredScaling(scalingParameters) {
|
|
4527
|
-
const { rescaleSlope, rescaleIntercept, modality, doseGridScaling, suvbw } = scalingParameters;
|
|
4528
|
-
const hasRescaleValues = typeof rescaleSlope === 'number' && typeof rescaleIntercept === 'number';
|
|
4529
|
-
const isRTDOSEWithScaling = modality === 'RTDOSE' && typeof doseGridScaling === 'number';
|
|
4530
|
-
const isPTWithSUV = modality === 'PT' && typeof suvbw === 'number';
|
|
4531
|
-
return hasRescaleValues || isRTDOSEWithScaling || isPTWithSUV;
|
|
4584
|
+
return new Uint8Array(decodedBuffer.buffer, decodedBuffer.byteOffset, decodedBuffer.byteLength);
|
|
4532
4585
|
}
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4586
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeAsync);
|
|
4587
|
+
|
|
4588
|
+
|
|
4589
|
+
/***/ }),
|
|
4590
|
+
|
|
4591
|
+
/***/ 32856:
|
|
4592
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4593
|
+
|
|
4594
|
+
"use strict";
|
|
4595
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4596
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4597
|
+
/* harmony export */ });
|
|
4598
|
+
/* unused harmony export initialize */
|
|
4599
|
+
const local = {
|
|
4600
|
+
DecoderClass: undefined,
|
|
4601
|
+
decodeConfig: {},
|
|
4602
|
+
};
|
|
4603
|
+
function initialize(decodeConfig) {
|
|
4604
|
+
local.decodeConfig = decodeConfig;
|
|
4605
|
+
if (local.DecoderClass) {
|
|
4606
|
+
return Promise.resolve();
|
|
4538
4607
|
}
|
|
4539
|
-
|
|
4540
|
-
|
|
4608
|
+
return new Promise((resolve, reject) => {
|
|
4609
|
+
__webpack_require__.e(/* import() */ 732).then(__webpack_require__.bind(__webpack_require__, 10732)).then(({ Decoder }) => {
|
|
4610
|
+
local.DecoderClass = Decoder;
|
|
4611
|
+
resolve();
|
|
4612
|
+
}, reject);
|
|
4613
|
+
});
|
|
4614
|
+
}
|
|
4615
|
+
async function decodeJPEGLossless(imageFrame, pixelData) {
|
|
4616
|
+
await initialize();
|
|
4617
|
+
if (typeof local.DecoderClass === 'undefined') {
|
|
4618
|
+
throw new Error('No JPEG Lossless decoder loaded');
|
|
4541
4619
|
}
|
|
4542
|
-
const
|
|
4543
|
-
const
|
|
4544
|
-
const
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4620
|
+
const decoder = new local.DecoderClass();
|
|
4621
|
+
const byteOutput = imageFrame.bitsAllocated <= 8 ? 1 : 2;
|
|
4622
|
+
const buffer = pixelData.buffer;
|
|
4623
|
+
const decompressedData = decoder.decode(buffer, pixelData.byteOffset, pixelData.length, byteOutput);
|
|
4624
|
+
if (imageFrame.pixelRepresentation === 0) {
|
|
4625
|
+
if (imageFrame.bitsAllocated === 16) {
|
|
4626
|
+
imageFrame.pixelData = new Uint16Array(decompressedData.buffer);
|
|
4627
|
+
return imageFrame;
|
|
4628
|
+
}
|
|
4629
|
+
imageFrame.pixelData = new Uint8Array(decompressedData.buffer);
|
|
4630
|
+
return imageFrame;
|
|
4550
4631
|
}
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
: new TypedArrayConstructor(length);
|
|
4554
|
-
typedArray.set(imageFramePixelData, 0);
|
|
4555
|
-
pixelDataArray = typedArray;
|
|
4556
|
-
return pixelDataArray;
|
|
4557
|
-
}
|
|
4558
|
-
function _handlePreScaleSetup(options, minBeforeScale, maxBeforeScale, imageFrame) {
|
|
4559
|
-
const scalingParameters = options.preScale.scalingParameters;
|
|
4560
|
-
_validateScalingParameters(scalingParameters);
|
|
4561
|
-
const scaledValues = _calculateScaledMinMax(minBeforeScale, maxBeforeScale, scalingParameters);
|
|
4562
|
-
return _getDefaultPixelDataArray(scaledValues.min, scaledValues.max, imageFrame);
|
|
4563
|
-
}
|
|
4564
|
-
function _getDefaultPixelDataArray(min, max, imageFrame) {
|
|
4565
|
-
const TypedArrayConstructor = (0,getPixelDataTypeFromMinMax/* default */.A)(min, max);
|
|
4566
|
-
const typedArray = new TypedArrayConstructor(imageFrame.pixelData.length);
|
|
4567
|
-
typedArray.set(imageFrame.pixelData, 0);
|
|
4568
|
-
return typedArray;
|
|
4632
|
+
imageFrame.pixelData = new Int16Array(decompressedData.buffer);
|
|
4633
|
+
return imageFrame;
|
|
4569
4634
|
}
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4635
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeJPEGLossless);
|
|
4636
|
+
|
|
4637
|
+
|
|
4638
|
+
/***/ }),
|
|
4639
|
+
|
|
4640
|
+
/***/ 67927:
|
|
4641
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4642
|
+
|
|
4643
|
+
"use strict";
|
|
4644
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4645
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4646
|
+
/* harmony export */ });
|
|
4647
|
+
async function decodeLittleEndian(imageFrame, pixelData) {
|
|
4648
|
+
let arrayBuffer = pixelData.buffer;
|
|
4649
|
+
let offset = pixelData.byteOffset;
|
|
4650
|
+
const length = pixelData.length;
|
|
4651
|
+
if (imageFrame.bitsAllocated === 16) {
|
|
4652
|
+
if (offset % 2) {
|
|
4653
|
+
arrayBuffer = arrayBuffer.slice(offset);
|
|
4654
|
+
offset = 0;
|
|
4655
|
+
}
|
|
4656
|
+
if (imageFrame.pixelRepresentation === 0) {
|
|
4657
|
+
imageFrame.pixelData = new Uint16Array(arrayBuffer, offset, length / 2);
|
|
4658
|
+
}
|
|
4659
|
+
else {
|
|
4660
|
+
imageFrame.pixelData = new Int16Array(arrayBuffer, offset, length / 2);
|
|
4661
|
+
}
|
|
4585
4662
|
}
|
|
4586
|
-
else if (
|
|
4587
|
-
|
|
4588
|
-
return {
|
|
4589
|
-
min: rescaleSlope * minValue + rescaleIntercept,
|
|
4590
|
-
max: rescaleSlope * maxValue + rescaleIntercept,
|
|
4591
|
-
};
|
|
4663
|
+
else if (imageFrame.bitsAllocated === 8 || imageFrame.bitsAllocated === 1) {
|
|
4664
|
+
imageFrame.pixelData = pixelData;
|
|
4592
4665
|
}
|
|
4593
|
-
else {
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
}
|
|
4666
|
+
else if (imageFrame.bitsAllocated === 32) {
|
|
4667
|
+
if (offset % 2) {
|
|
4668
|
+
arrayBuffer = arrayBuffer.slice(offset);
|
|
4669
|
+
offset = 0;
|
|
4670
|
+
}
|
|
4671
|
+
if (imageFrame.floatPixelData || imageFrame.doubleFloatPixelData) {
|
|
4672
|
+
throw new Error('Float pixel data is not supported for parsing into ImageFrame');
|
|
4673
|
+
}
|
|
4674
|
+
if (imageFrame.pixelRepresentation === 0) {
|
|
4675
|
+
imageFrame.pixelData = new Uint32Array(arrayBuffer, offset, length / 4);
|
|
4676
|
+
}
|
|
4677
|
+
else if (imageFrame.pixelRepresentation === 1) {
|
|
4678
|
+
imageFrame.pixelData = new Int32Array(arrayBuffer, offset, length / 4);
|
|
4679
|
+
}
|
|
4680
|
+
else {
|
|
4681
|
+
imageFrame.pixelData = new Float32Array(arrayBuffer, offset, length / 4);
|
|
4682
|
+
}
|
|
4598
4683
|
}
|
|
4684
|
+
return imageFrame;
|
|
4599
4685
|
}
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4686
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeLittleEndian);
|
|
4687
|
+
|
|
4688
|
+
|
|
4689
|
+
/***/ }),
|
|
4690
|
+
|
|
4691
|
+
/***/ 40115:
|
|
4692
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
4693
|
+
|
|
4694
|
+
"use strict";
|
|
4695
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
4696
|
+
/* harmony export */ A: () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
4697
|
+
/* harmony export */ });
|
|
4698
|
+
async function decodeRLE(imageFrame, pixelData) {
|
|
4699
|
+
if (imageFrame.bitsAllocated === 8) {
|
|
4700
|
+
if (imageFrame.planarConfiguration) {
|
|
4701
|
+
return decode8Planar(imageFrame, pixelData);
|
|
4702
|
+
}
|
|
4703
|
+
return decode8(imageFrame, pixelData);
|
|
4704
|
+
}
|
|
4705
|
+
else if (imageFrame.bitsAllocated === 16) {
|
|
4706
|
+
return decode16(imageFrame, pixelData);
|
|
4603
4707
|
}
|
|
4708
|
+
throw new Error('unsupported pixel format for RLE');
|
|
4604
4709
|
}
|
|
4605
|
-
function
|
|
4606
|
-
const
|
|
4607
|
-
const
|
|
4608
|
-
const
|
|
4609
|
-
const
|
|
4610
|
-
const
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4710
|
+
function decode8(imageFrame, pixelData) {
|
|
4711
|
+
const frameData = pixelData;
|
|
4712
|
+
const frameSize = imageFrame.rows * imageFrame.columns;
|
|
4713
|
+
const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);
|
|
4714
|
+
const header = new DataView(frameData.buffer, frameData.byteOffset);
|
|
4715
|
+
const data = new Int8Array(frameData.buffer, frameData.byteOffset);
|
|
4716
|
+
const out = new Int8Array(outFrame);
|
|
4717
|
+
let outIndex = 0;
|
|
4718
|
+
const numSegments = header.getInt32(0, true);
|
|
4719
|
+
for (let s = 0; s < numSegments; ++s) {
|
|
4720
|
+
outIndex = s;
|
|
4721
|
+
let inIndex = header.getInt32((s + 1) * 4, true);
|
|
4722
|
+
let maxIndex = header.getInt32((s + 2) * 4, true);
|
|
4723
|
+
if (maxIndex === 0) {
|
|
4724
|
+
maxIndex = frameData.length;
|
|
4725
|
+
}
|
|
4726
|
+
const endOfSegment = frameSize * numSegments;
|
|
4727
|
+
while (inIndex < maxIndex) {
|
|
4728
|
+
const n = data[inIndex++];
|
|
4729
|
+
if (n >= 0 && n <= 127) {
|
|
4730
|
+
for (let i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {
|
|
4731
|
+
out[outIndex] = data[inIndex++];
|
|
4732
|
+
outIndex += imageFrame.samplesPerPixel;
|
|
4733
|
+
}
|
|
4734
|
+
}
|
|
4735
|
+
else if (n <= -1 && n >= -127) {
|
|
4736
|
+
const value = data[inIndex++];
|
|
4737
|
+
for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {
|
|
4738
|
+
out[outIndex] = value;
|
|
4739
|
+
outIndex += imageFrame.samplesPerPixel;
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
}
|
|
4743
|
+
}
|
|
4744
|
+
imageFrame.pixelData = new Uint8Array(outFrame);
|
|
4745
|
+
return imageFrame;
|
|
4627
4746
|
}
|
|
4628
|
-
function
|
|
4629
|
-
const
|
|
4630
|
-
const
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4747
|
+
function decode8Planar(imageFrame, pixelData) {
|
|
4748
|
+
const frameData = pixelData;
|
|
4749
|
+
const frameSize = imageFrame.rows * imageFrame.columns;
|
|
4750
|
+
const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel);
|
|
4751
|
+
const header = new DataView(frameData.buffer, frameData.byteOffset);
|
|
4752
|
+
const data = new Int8Array(frameData.buffer, frameData.byteOffset);
|
|
4753
|
+
const out = new Int8Array(outFrame);
|
|
4754
|
+
let outIndex = 0;
|
|
4755
|
+
const numSegments = header.getInt32(0, true);
|
|
4756
|
+
for (let s = 0; s < numSegments; ++s) {
|
|
4757
|
+
outIndex = s * frameSize;
|
|
4758
|
+
let inIndex = header.getInt32((s + 1) * 4, true);
|
|
4759
|
+
let maxIndex = header.getInt32((s + 2) * 4, true);
|
|
4760
|
+
if (maxIndex === 0) {
|
|
4761
|
+
maxIndex = frameData.length;
|
|
4762
|
+
}
|
|
4763
|
+
const endOfSegment = frameSize * numSegments;
|
|
4764
|
+
while (inIndex < maxIndex) {
|
|
4765
|
+
const n = data[inIndex++];
|
|
4766
|
+
if (n >= 0 && n <= 127) {
|
|
4767
|
+
for (let i = 0; i < n + 1 && outIndex < endOfSegment; ++i) {
|
|
4768
|
+
out[outIndex] = data[inIndex++];
|
|
4769
|
+
outIndex++;
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
else if (n <= -1 && n >= -127) {
|
|
4773
|
+
const value = data[inIndex++];
|
|
4774
|
+
for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {
|
|
4775
|
+
out[outIndex] = value;
|
|
4776
|
+
outIndex++;
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
}
|
|
4780
|
+
}
|
|
4781
|
+
imageFrame.pixelData = new Uint8Array(outFrame);
|
|
4634
4782
|
return imageFrame;
|
|
4635
4783
|
}
|
|
4636
|
-
|
|
4637
|
-
const
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
break;
|
|
4669
|
-
case '1.2.840.10008.1.2.4.80':
|
|
4670
|
-
opts = {
|
|
4671
|
-
signed: imageFrame.pixelRepresentation === 1,
|
|
4672
|
-
bytesPerPixel: imageFrame.bitsAllocated <= 8 ? 1 : 2,
|
|
4673
|
-
...imageFrame,
|
|
4674
|
-
};
|
|
4675
|
-
decodePromise = decodeJPEGLS(pixelData, opts);
|
|
4676
|
-
break;
|
|
4677
|
-
case '1.2.840.10008.1.2.4.81':
|
|
4678
|
-
opts = {
|
|
4679
|
-
signed: imageFrame.pixelRepresentation === 1,
|
|
4680
|
-
bytesPerPixel: imageFrame.bitsAllocated <= 8 ? 1 : 2,
|
|
4681
|
-
...imageFrame,
|
|
4682
|
-
};
|
|
4683
|
-
decodePromise = decodeJPEGLS(pixelData, opts);
|
|
4684
|
-
break;
|
|
4685
|
-
case '1.2.840.10008.1.2.4.90':
|
|
4686
|
-
opts = {
|
|
4687
|
-
...imageFrame,
|
|
4688
|
-
};
|
|
4689
|
-
decodePromise = decodeJPEG2000(pixelData, opts);
|
|
4690
|
-
break;
|
|
4691
|
-
case '1.2.840.10008.1.2.4.91':
|
|
4692
|
-
opts = {
|
|
4693
|
-
...imageFrame,
|
|
4694
|
-
};
|
|
4695
|
-
decodePromise = decodeJPEG2000(pixelData, opts);
|
|
4696
|
-
break;
|
|
4697
|
-
case '3.2.840.10008.1.2.4.96':
|
|
4698
|
-
case '1.2.840.10008.1.2.4.201':
|
|
4699
|
-
case '1.2.840.10008.1.2.4.202':
|
|
4700
|
-
case '1.2.840.10008.1.2.4.203':
|
|
4701
|
-
opts = {
|
|
4702
|
-
...imageFrame,
|
|
4703
|
-
};
|
|
4704
|
-
decodePromise = decodeHTJ2K(pixelData, opts);
|
|
4705
|
-
break;
|
|
4706
|
-
default:
|
|
4707
|
-
throw new Error(`no decoder for transfer syntax ${transferSyntax}`);
|
|
4784
|
+
function decode16(imageFrame, pixelData) {
|
|
4785
|
+
const frameData = pixelData;
|
|
4786
|
+
const frameSize = imageFrame.rows * imageFrame.columns;
|
|
4787
|
+
const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel * 2);
|
|
4788
|
+
const header = new DataView(frameData.buffer, frameData.byteOffset);
|
|
4789
|
+
const data = new Int8Array(frameData.buffer, frameData.byteOffset);
|
|
4790
|
+
const out = new Int8Array(outFrame);
|
|
4791
|
+
const numSegments = header.getInt32(0, true);
|
|
4792
|
+
for (let s = 0; s < numSegments; ++s) {
|
|
4793
|
+
let outIndex = 0;
|
|
4794
|
+
const highByte = s === 0 ? 1 : 0;
|
|
4795
|
+
let inIndex = header.getInt32((s + 1) * 4, true);
|
|
4796
|
+
let maxIndex = header.getInt32((s + 2) * 4, true);
|
|
4797
|
+
if (maxIndex === 0) {
|
|
4798
|
+
maxIndex = frameData.length;
|
|
4799
|
+
}
|
|
4800
|
+
while (inIndex < maxIndex) {
|
|
4801
|
+
const n = data[inIndex++];
|
|
4802
|
+
if (n >= 0 && n <= 127) {
|
|
4803
|
+
for (let i = 0; i < n + 1 && outIndex < frameSize; ++i) {
|
|
4804
|
+
out[outIndex * 2 + highByte] = data[inIndex++];
|
|
4805
|
+
outIndex++;
|
|
4806
|
+
}
|
|
4807
|
+
}
|
|
4808
|
+
else if (n <= -1 && n >= -127) {
|
|
4809
|
+
const value = data[inIndex++];
|
|
4810
|
+
for (let j = 0; j < -n + 1 && outIndex < frameSize; ++j) {
|
|
4811
|
+
out[outIndex * 2 + highByte] = value;
|
|
4812
|
+
outIndex++;
|
|
4813
|
+
}
|
|
4814
|
+
}
|
|
4815
|
+
}
|
|
4708
4816
|
}
|
|
4709
|
-
if (
|
|
4710
|
-
|
|
4817
|
+
if (imageFrame.pixelRepresentation === 0) {
|
|
4818
|
+
imageFrame.pixelData = new Uint16Array(outFrame);
|
|
4711
4819
|
}
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
return
|
|
4820
|
+
else {
|
|
4821
|
+
imageFrame.pixelData = new Int16Array(outFrame);
|
|
4822
|
+
}
|
|
4823
|
+
return imageFrame;
|
|
4716
4824
|
}
|
|
4717
|
-
const
|
|
4718
|
-
decodeTask({ imageFrame, transferSyntax, decodeConfig, options, pixelData, callbackFn, }) {
|
|
4719
|
-
return decodeImageFrame(imageFrame, transferSyntax, pixelData, decodeConfig, options, callbackFn);
|
|
4720
|
-
},
|
|
4721
|
-
};
|
|
4722
|
-
(0,comlink/* expose */.p)(obj);
|
|
4825
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (decodeRLE);
|
|
4723
4826
|
|
|
4724
4827
|
|
|
4725
4828
|
/***/ }),
|