dwv 0.29.1 → 0.30.3
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/changelog.md +52 -0
- package/decoders/dwv/decode-rle.js +11 -11
- package/decoders/dwv/rle.js +93 -93
- package/decoders/pdfjs/decode-jpeg2000.js +10 -10
- package/decoders/pdfjs/decode-jpegbaseline.js +10 -10
- package/decoders/rii-mango/decode-jpegloss.js +22 -22
- package/dist/dwv.js +9373 -5897
- package/dist/dwv.min.js +2 -2
- package/locales/de/overlays.json +12 -15
- package/locales/de/translation.json +1 -2
- package/locales/en/overlays.json +11 -14
- package/locales/en/translation.json +1 -2
- package/locales/es/overlays.json +12 -15
- package/locales/es/translation.json +1 -2
- package/locales/fr/overlays.json +12 -15
- package/locales/fr/translation.json +1 -2
- package/locales/it/overlays.json +12 -15
- package/locales/it/translation.json +1 -2
- package/locales/jp/overlays.json +12 -15
- package/locales/jp/translation.json +1 -2
- package/locales/ro/overlays.json +12 -15
- package/locales/ro/translation.json +1 -2
- package/locales/ru/overlays.json +12 -15
- package/locales/ru/translation.json +1 -2
- package/locales/zh/overlays.json +13 -16
- package/locales/zh/translation.json +1 -2
- package/package.json +17 -12
- package/readme.md +4 -9
package/changelog.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v0.30.3](https://github.com/ivmartel/dwv/releases/tag/v0.30.3) - 09/12/2021
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- y.Group is not a constructor [#1055](https://github.com/ivmartel/dwv/issues/1055)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## [v0.30.2](https://github.com/ivmartel/dwv/releases/tag/v0.30.2) - 07/12/2021
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Add browserlist to package.json [#1052](https://github.com/ivmartel/dwv/issues/1052)
|
|
16
|
+
- Add engines to package.json [#1050](https://github.com/ivmartel/dwv/issues/1050)
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- require() of ES modules is not supported [#1045](https://github.com/ivmartel/dwv/issues/1045)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## [v0.30.1](https://github.com/ivmartel/dwv/releases/tag/v0.30.1) - 03/12/2021
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- Missing class for Konva [#1044](https://github.com/ivmartel/dwv/issues/1044)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## [v0.30.0](https://github.com/ivmartel/dwv/releases/tag/v0.30.0) - 02/12/2021
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- Allow for manual frame add [#1034](https://github.com/ivmartel/dwv/issues/1034)
|
|
37
|
+
- Add support for multi-resolution data [#1003](https://github.com/ivmartel/dwv/issues/1003)
|
|
38
|
+
- Remove coveralls and use karma coverage check [#1002](https://github.com/ivmartel/dwv/issues/1002)
|
|
39
|
+
- Use the same (web) worker for multiple data decode [#993](https://github.com/ivmartel/dwv/issues/993)
|
|
40
|
+
- Add text encoding in data writer [#963](https://github.com/ivmartel/dwv/issues/963)
|
|
41
|
+
- Support anisotropic pixels [#952](https://github.com/ivmartel/dwv/issues/952)
|
|
42
|
+
- Check data allocation size to avoid error [#951](https://github.com/ivmartel/dwv/issues/951)
|
|
43
|
+
- Allow to load files based on UID [#949](https://github.com/ivmartel/dwv/issues/949)
|
|
44
|
+
- Simplify image class data storage [#905](https://github.com/ivmartel/dwv/issues/905)
|
|
45
|
+
- Multi-slice view [#133](https://github.com/ivmartel/dwv/issues/133)
|
|
46
|
+
- Add MPR [#4](https://github.com/ivmartel/dwv/issues/4)
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- Check var length before accessing it [#1017](https://github.com/ivmartel/dwv/issues/1017)
|
|
51
|
+
- Drag&drop of the ruler label causes console errors [#994](https://github.com/ivmartel/dwv/issues/994)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
3
55
|
## [v0.29.1](https://github.com/ivmartel/dwv/releases/tag/v0.29.1) - 11/06/2021
|
|
4
56
|
|
|
5
57
|
### Added
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
* RLE decoder worker.
|
|
3
3
|
*/
|
|
4
4
|
// Do not warn if these variables were not defined before.
|
|
5
|
-
/* global importScripts
|
|
5
|
+
/* global importScripts */
|
|
6
6
|
|
|
7
7
|
importScripts('rle.js');
|
|
8
8
|
|
|
9
9
|
self.addEventListener('message', function (event) {
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
// decode DICOM buffer
|
|
12
|
+
var decoder = new dwv.decoder.RleDecoder();
|
|
13
|
+
// post decoded data
|
|
14
|
+
self.postMessage([decoder.decode(
|
|
15
|
+
event.data.buffer,
|
|
16
|
+
event.data.meta.bitsAllocated,
|
|
17
|
+
event.data.meta.isSigned,
|
|
18
|
+
event.data.meta.sliceSize,
|
|
19
|
+
event.data.meta.samplesPerPixel,
|
|
20
|
+
event.data.meta.planarConfiguration)]);
|
|
21
21
|
|
|
22
22
|
}, false);
|
package/decoders/dwv/rle.js
CHANGED
|
@@ -20,110 +20,110 @@ dwv.decoder.RleDecoder = function () {};
|
|
|
20
20
|
* @returns The decoded buffer.
|
|
21
21
|
* @see http://dicom.nema.org/dicom/2013/output/chtml/part05/sect_G.3.html
|
|
22
22
|
*/
|
|
23
|
-
dwv.decoder.RleDecoder.prototype.decode = function (
|
|
24
|
-
|
|
23
|
+
dwv.decoder.RleDecoder.prototype.decode = function (buffer,
|
|
24
|
+
bitsAllocated, isSigned, sliceSize, samplesPerPixel, planarConfiguration) {
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
// bytes per element
|
|
27
|
+
var bpe = bitsAllocated / 8;
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
// input
|
|
30
|
+
var inputDataView = new DataView(buffer.buffer, buffer.byteOffset);
|
|
31
|
+
var inputArray = new Int8Array(buffer.buffer, buffer.byteOffset);
|
|
32
|
+
// output
|
|
33
|
+
var outputBuffer = new ArrayBuffer(sliceSize * samplesPerPixel * bpe);
|
|
34
|
+
var outputArray = new Int8Array(outputBuffer);
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
// first value of the RLE header is the number of segments
|
|
37
|
+
var numberOfSegments = inputDataView.getInt32(0, true);
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
// index increment in output array
|
|
40
|
+
var outputIndexIncrement = 1;
|
|
41
|
+
var incrementFactor = 1;
|
|
42
|
+
if (samplesPerPixel !== 1 && planarConfiguration === 0) {
|
|
43
|
+
incrementFactor *= samplesPerPixel;
|
|
44
|
+
}
|
|
45
|
+
if (bpe !== 1) {
|
|
46
|
+
incrementFactor *= bpe;
|
|
47
|
+
}
|
|
48
|
+
outputIndexIncrement *= incrementFactor;
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
50
|
+
// loop on segments
|
|
51
|
+
var outputIndex = 0;
|
|
52
|
+
var inputIndex = 0;
|
|
53
|
+
var remainder = 0;
|
|
54
|
+
var maxOutputIndex = 0;
|
|
55
|
+
var groupOutputIndex = 0;
|
|
56
|
+
for (var segment = 0; segment < numberOfSegments; ++segment) {
|
|
57
|
+
// handle special cases:
|
|
58
|
+
// - more than one sample per pixel: one segment per channel
|
|
59
|
+
// - 16bits: sort high and low bytes
|
|
60
|
+
if (incrementFactor !== 1) {
|
|
61
|
+
remainder = segment % incrementFactor;
|
|
62
|
+
if (remainder === 0) {
|
|
63
|
+
groupOutputIndex = maxOutputIndex;
|
|
64
|
+
}
|
|
65
|
+
outputIndex = groupOutputIndex + remainder;
|
|
66
|
+
// 16bits data
|
|
67
|
+
if (bpe === 2) {
|
|
68
|
+
outputIndex += (remainder % bpe ? -1 : 1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
// RLE header: list of segment sizes
|
|
73
|
+
var segmentStartIndex = inputDataView.getInt32((segment + 1) * 4, true);
|
|
74
|
+
var nextSegmentStartIndex = inputDataView.getInt32((segment + 2) * 4, true);
|
|
75
|
+
if (segment === numberOfSegments - 1 || nextSegmentStartIndex === 0) {
|
|
76
|
+
nextSegmentStartIndex = buffer.length;
|
|
77
|
+
}
|
|
78
|
+
// decode segment
|
|
79
|
+
inputIndex = segmentStartIndex;
|
|
80
|
+
var count = 0;
|
|
81
|
+
while (inputIndex < nextSegmentStartIndex) {
|
|
82
|
+
// get the count value
|
|
83
|
+
count = inputArray[inputIndex];
|
|
84
|
+
++inputIndex;
|
|
85
|
+
// store according to count
|
|
86
|
+
if (count >= 0 && count <= 127) {
|
|
87
|
+
// output the next count+1 bytes literally
|
|
88
|
+
for (var i = 0; i < count + 1; ++i) {
|
|
89
|
+
// store
|
|
90
|
+
outputArray[outputIndex] = inputArray[inputIndex];
|
|
91
|
+
// increment indexes
|
|
92
|
+
++inputIndex;
|
|
93
|
+
outputIndex += outputIndexIncrement;
|
|
77
94
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
// output the next count+1 bytes literally
|
|
88
|
-
for (var i = 0; i < count + 1; ++i) {
|
|
89
|
-
// store
|
|
90
|
-
outputArray[outputIndex] = inputArray[inputIndex];
|
|
91
|
-
// increment indexes
|
|
92
|
-
++inputIndex;
|
|
93
|
-
outputIndex += outputIndexIncrement;
|
|
94
|
-
}
|
|
95
|
-
} else if (count <= -1 && count >= -127) {
|
|
96
|
-
// output the next byte -count+1 times
|
|
97
|
-
var value = inputArray[inputIndex];
|
|
98
|
-
++inputIndex;
|
|
99
|
-
for (var j = 0; j < -count + 1; ++j) {
|
|
100
|
-
// store
|
|
101
|
-
outputArray[outputIndex] = value;
|
|
102
|
-
// increment index
|
|
103
|
-
outputIndex += outputIndexIncrement;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
95
|
+
} else if (count <= -1 && count >= -127) {
|
|
96
|
+
// output the next byte -count+1 times
|
|
97
|
+
var value = inputArray[inputIndex];
|
|
98
|
+
++inputIndex;
|
|
99
|
+
for (var j = 0; j < -count + 1; ++j) {
|
|
100
|
+
// store
|
|
101
|
+
outputArray[outputIndex] = value;
|
|
102
|
+
// increment index
|
|
103
|
+
outputIndex += outputIndexIncrement;
|
|
106
104
|
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
108
|
+
if (outputIndex > maxOutputIndex) {
|
|
109
|
+
maxOutputIndex = outputIndex;
|
|
111
110
|
}
|
|
111
|
+
}
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
113
|
+
var decodedBuffer = null;
|
|
114
|
+
if (bitsAllocated === 8) {
|
|
115
|
+
if (isSigned) {
|
|
116
|
+
decodedBuffer = new Int8Array(outputBuffer);
|
|
117
|
+
} else {
|
|
118
|
+
decodedBuffer = new Uint8Array(outputBuffer);
|
|
119
|
+
}
|
|
120
|
+
} else if (bitsAllocated === 16) {
|
|
121
|
+
if (isSigned) {
|
|
122
|
+
decodedBuffer = new Int16Array(outputBuffer);
|
|
123
|
+
} else {
|
|
124
|
+
decodedBuffer = new Uint16Array(outputBuffer);
|
|
126
125
|
}
|
|
126
|
+
}
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
return decodedBuffer;
|
|
129
129
|
};
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* JPEG 2000 decoder worker.
|
|
3
3
|
*/
|
|
4
4
|
// Do not warn if these variables were not defined before.
|
|
5
|
-
/* global importScripts,
|
|
5
|
+
/* global importScripts, JpxImage */
|
|
6
6
|
|
|
7
|
-
importScripts('jpx.js', 'util.js', 'arithmetic_decoder.js');
|
|
7
|
+
importScripts('jpx.js', 'util.js', 'arithmetic_decoder.js');
|
|
8
8
|
|
|
9
9
|
self.addEventListener('message', function (event) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
|
|
11
|
+
// decode DICOM buffer
|
|
12
|
+
var decoder = new JpxImage();
|
|
13
|
+
decoder.parse(event.data.buffer);
|
|
14
|
+
// post decoded data
|
|
15
|
+
var res = decoder.tiles[0].items;
|
|
16
|
+
self.postMessage([res]);
|
|
17
|
+
|
|
18
18
|
}, false);
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* JPEG Baseline decoder worker.
|
|
3
3
|
*/
|
|
4
4
|
// Do not warn if these variables were not defined before.
|
|
5
|
-
/* global importScripts,
|
|
5
|
+
/* global importScripts, JpegImage */
|
|
6
6
|
|
|
7
|
-
importScripts('jpg.js');
|
|
7
|
+
importScripts('jpg.js');
|
|
8
8
|
|
|
9
9
|
self.addEventListener('message', function (event) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
|
|
11
|
+
// decode DICOM buffer
|
|
12
|
+
var decoder = new JpegImage();
|
|
13
|
+
decoder.parse(event.data.buffer);
|
|
14
|
+
// post decoded data
|
|
15
|
+
var res = decoder.getData(decoder.width, decoder.height);
|
|
16
|
+
self.postMessage([res]);
|
|
17
|
+
|
|
18
18
|
}, false);
|
|
@@ -2,33 +2,33 @@
|
|
|
2
2
|
* JPEG Lossless decoder worker.
|
|
3
3
|
*/
|
|
4
4
|
// Do not warn if these variables were not defined before.
|
|
5
|
-
/* global importScripts,
|
|
5
|
+
/* global importScripts, jpeg */
|
|
6
6
|
|
|
7
7
|
importScripts('lossless-min.js');
|
|
8
8
|
|
|
9
9
|
self.addEventListener('message', function (event) {
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
} else if (event.data.meta.bitsAllocated === 16) {
|
|
26
|
-
if (event.data.meta.isSigned) {
|
|
27
|
-
res = new Int16Array(decoded.buffer);
|
|
28
|
-
} else {
|
|
29
|
-
res = new Uint16Array(decoded.buffer);
|
|
30
|
-
}
|
|
11
|
+
// bytes per element
|
|
12
|
+
var bpe = event.data.meta.bitsAllocated / 8;
|
|
13
|
+
// decode DICOM buffer
|
|
14
|
+
var buf = new Uint8Array(event.data.buffer);
|
|
15
|
+
var decoder = new jpeg.lossless.Decoder();
|
|
16
|
+
var decoded = decoder.decode(buf.buffer, 0, buf.buffer.byteLength, bpe);
|
|
17
|
+
// post decoded data
|
|
18
|
+
var res = null;
|
|
19
|
+
if (event.data.meta.bitsAllocated === 8) {
|
|
20
|
+
if (event.data.meta.isSigned) {
|
|
21
|
+
res = new Int8Array(decoded.buffer);
|
|
22
|
+
} else {
|
|
23
|
+
res = new Uint8Array(decoded.buffer);
|
|
31
24
|
}
|
|
32
|
-
|
|
25
|
+
} else if (event.data.meta.bitsAllocated === 16) {
|
|
26
|
+
if (event.data.meta.isSigned) {
|
|
27
|
+
res = new Int16Array(decoded.buffer);
|
|
28
|
+
} else {
|
|
29
|
+
res = new Uint16Array(decoded.buffer);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
self.postMessage([res]);
|
|
33
33
|
|
|
34
34
|
}, false);
|