dwv 0.37.0-beta.8 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/dist/assets/workers/jpeg2000.worker.min.js +1 -1
  2. package/dist/assets/workers/jpeg2000.worker.min.js.map +1 -1
  3. package/dist/assets/workers/jpegbaseline.worker.min.js +1 -1
  4. package/dist/assets/workers/jpegbaseline.worker.min.js.map +1 -1
  5. package/dist/assets/workers/jpegloss.worker.min.js +1 -1
  6. package/dist/assets/workers/jpegloss.worker.min.js.map +1 -1
  7. package/dist/assets/workers/labeling.worker.min.js +1 -1
  8. package/dist/assets/workers/labeling.worker.min.js.map +1 -1
  9. package/dist/assets/workers/resampling.worker.min.js +1 -1
  10. package/dist/assets/workers/resampling.worker.min.js.map +1 -1
  11. package/dist/assets/workers/rle.worker.min.js +1 -1
  12. package/dist/assets/workers/rle.worker.min.js.map +1 -1
  13. package/dist/dwv.d.ts +1333 -314
  14. package/dist/dwv.min.js +1 -1
  15. package/dist/dwv.min.js.map +1 -1
  16. package/dist/dwv.node.min.js +1 -1
  17. package/dist/dwv.node.min.js.map +1 -1
  18. package/package.json +21 -23
  19. package/readme.md +7 -3
  20. package/dev/bench/bench.html +0 -94
  21. package/dev/bench/bench.js +0 -316
  22. package/dev/bench/benchFunctionRunner.js +0 -83
  23. package/dev/bench/dataRunner.js +0 -171
  24. package/dev/bench/gui.js +0 -184
  25. package/dev/bench/listen.js +0 -70
  26. package/dev/bench/parsers/dwv-current.html +0 -45
  27. package/dev/bench/parsers/dwv-previous.html +0 -45
  28. package/dev/dicom/binaryPixGenerator.js +0 -108
  29. package/dev/dicom/dicomGenerator.js +0 -215
  30. package/dev/dicom/filePixGenerator.js +0 -96
  31. package/dev/dicom/gradSquarePixGenerator.js +0 -107
  32. package/dev/dicom/mprPixGenerator.js +0 -247
  33. package/dev/dicom/pages/anonymiser.html +0 -86
  34. package/dev/dicom/pages/anonymiser.js +0 -154
  35. package/dev/dicom/pages/diff.html +0 -34
  36. package/dev/dicom/pages/diff.js +0 -97
  37. package/dev/dicom/pages/generator.html +0 -92
  38. package/dev/dicom/pages/generator.js +0 -329
  39. package/dev/dicom/pages/synthetic-data.html +0 -19
  40. package/dev/dicom/pages/synthetic-data.js +0 -164
  41. package/dev/dicom/squarePixGenerator.js +0 -233
  42. package/dev/favicon.ico +0 -0
  43. package/dev/image/pages/colourmaps.html +0 -16
  44. package/dev/image/pages/colourmaps.js +0 -65
  45. package/dev/index.html +0 -38
  46. package/dev/pacs/dcmweb.html +0 -80
  47. package/dev/pacs/dcmweb.js +0 -577
  48. package/dev/pacs/images/acute_leukemia.png +0 -0
  49. package/dev/pacs/images/babymri-dcmdir.png +0 -0
  50. package/dev/pacs/images/babymri-rect.png +0 -0
  51. package/dev/pacs/images/babymri-zip.png +0 -0
  52. package/dev/pacs/images/babymri.png +0 -0
  53. package/dev/pacs/images/brainmri-png.png +0 -0
  54. package/dev/pacs/images/brainpet-jpg.png +0 -0
  55. package/dev/pacs/images/cerebrix.png +0 -0
  56. package/dev/pacs/images/goudurix.png +0 -0
  57. package/dev/pacs/images/multiframe-test1.png +0 -0
  58. package/dev/pacs/images/toutatix.png +0 -0
  59. package/dev/pacs/images/us.png +0 -0
  60. package/dev/pacs/index.html +0 -97
  61. package/dev/pacs/index.js +0 -287
  62. package/dev/pacs/overlays.js +0 -51
  63. package/dev/pacs/viewer.html +0 -401
  64. package/dev/pacs/viewer.js +0 -1275
  65. package/dev/pacs/viewer.rendertest.js +0 -96
  66. package/dev/pacs/viewer.ui.annot.js +0 -607
  67. package/dev/pacs/viewer.ui.brush.js +0 -181
  68. package/dev/pacs/viewer.ui.datatable.js +0 -674
  69. package/dev/pacs/viewer.ui.draw.js +0 -141
  70. package/dev/pacs/viewer.ui.icons.js +0 -88
  71. package/dev/pacs/viewer.ui.js +0 -198
  72. package/dev/pacs/viewer.ui.segment.js +0 -1369
  73. package/dev/visual/appgui.js +0 -125
  74. package/dev/visual/images/dicompyler-ct.0.jpg +0 -0
  75. package/dev/visual/images/gdcm-CR-MONO1-10-chest.jpg +0 -0
  76. package/dev/visual/images/gdcm-CT-MONO2-8-abdo.jpg +0 -0
  77. package/dev/visual/images/gdcm-US-RGB-8-epicard.jpg +0 -0
  78. package/dev/visual/images/gdcm-US-RGB-8-esopecho.jpg +0 -0
  79. package/dev/visual/images/leadtools-8BitsJpegLossyGrayScale.jpg +0 -0
  80. package/dev/visual/images/leadtools-flowers-16-mono2-rle.jpg +0 -0
  81. package/dev/visual/images/leadtools-flowers-8-mono2-rle.jpg +0 -0
  82. package/dev/visual/images/nema-ct1_j2ki.jpg +0 -0
  83. package/dev/visual/images/nema-ct1_jpll.jpg +0 -0
  84. package/dev/visual/images/nema-mr1_jply.jpg +0 -0
  85. package/dev/visual/images/nema-nm1_j2kr.jpg +0 -0
  86. package/dev/visual/images/nema-nm1_jpll.jpg +0 -0
  87. package/dev/visual/images/nema-nm1_jply.jpg +0 -0
  88. package/dev/visual/images/nema-us1_j2ki.jpg +0 -0
  89. package/dev/visual/images/nema-vl2_j2kr.jpg +0 -0
  90. package/dev/visual/images/osirix-cerebrix.jpg +0 -0
  91. package/dev/visual/images/osirix-goudurix.jpg +0 -0
  92. package/dev/visual/images/osirix-toutatix-100.jpg +0 -0
  93. package/dev/visual/index-jpeg.js +0 -104
  94. package/dev/visual/index-jpeg2000.js +0 -103
  95. package/dev/visual/index-rle.js +0 -70
  96. package/dev/visual/index.html +0 -20
  97. package/dev/visual/index.js +0 -123
  98. package/dev/visual/style.css +0 -37
@@ -1,233 +0,0 @@
1
- import {Index} from '../../src/math/index.js';
2
- import {getRectangleIndices} from '../../src/math/rectangle.js';
3
- import {getEllipseIndices} from '../../src/math/ellipse.js';
4
-
5
- /**
6
- * Get an array find callback for an index.
7
- *
8
- * @param {Index} i0 The index to find.
9
- * @returns {Function} The find callback.
10
- */
11
- function getEqualIndexCallback(i0) {
12
- return function (index) {
13
- return index.equals(i0);
14
- };
15
- }
16
-
17
- /**
18
- * Get an increment vector for input directions.
19
- *
20
- * @param {number[]} dir The directions.
21
- * @returns {number[]} The increment vector.
22
- */
23
- function getDirIncr(dir) {
24
- let incr;
25
- if (!dir.includes(0)) {
26
- incr = [1, 0, 0];
27
- } else if (!dir.includes(1)) {
28
- incr = [0, 1, 0];
29
- } else if (!dir.includes(2)) {
30
- incr = [0, 0, 1];
31
- }
32
- return incr;
33
- }
34
-
35
- /**
36
- * SquarePixGenerator: generates pixel data with simple mono value squares.
37
- */
38
- export class SquarePixGenerator {
39
-
40
- #numberOfColumns;
41
- #numberOfRows;
42
- #numberOfSamples;
43
- #numberOfColourPlanes;
44
-
45
- #isRGB;
46
-
47
- #numberOfShapes;
48
- #sizeZoneI;
49
- #sizeZoneJ;
50
- #sizeZoneK;
51
-
52
- #configs;
53
- #indices;
54
-
55
- #background = 0;
56
- #maxValue = 200;
57
-
58
- /**
59
- * @param {object} options The generator options.
60
- */
61
- constructor(options) {
62
- this.#numberOfColumns = options.numberOfColumns;
63
- this.#numberOfRows = options.numberOfRows;
64
- this.#numberOfSamples = options.numberOfSamples;
65
- this.#numberOfColourPlanes = options.numberOfColourPlanes;
66
- this.#isRGB = options.photometricInterpretation === 'RGB';
67
-
68
- // supposing as many slices as coloums
69
- const numberOfSlices = options.numberOfSlices;
70
-
71
- const numberOfZonesI = 2;
72
- const numberOfZonesJ = 2;
73
- const numberOfZonesK = 2;
74
-
75
- this.#numberOfShapes = numberOfZonesI * numberOfZonesJ * numberOfZonesK;
76
-
77
- this.#sizeZoneI = Math.floor(this.#numberOfColumns / numberOfZonesI);
78
- this.#sizeZoneJ = Math.floor(this.#numberOfRows / numberOfZonesJ);
79
- this.#sizeZoneK = Math.floor(numberOfSlices / numberOfZonesK);
80
-
81
- const halfSizeZoneI = Math.floor(this.#sizeZoneI / 2);
82
- const halfSizeZoneJ = Math.floor(this.#sizeZoneJ / 2);
83
- const halfSizeZoneK = Math.floor(this.#sizeZoneK / 2);
84
-
85
- // const quarterSizeZoneI = Math.floor(sizeZoneI / 4);
86
- // const quarterSizeZoneJ = Math.floor(sizeZoneJ / 4);
87
- // const quarterSizeZoneK = Math.floor(sizeZoneK / 4);
88
- // const eigthSizeZoneJ = Math.floor(sizeZoneJ / 8);
89
-
90
- const squareSizes = [
91
- halfSizeZoneI, halfSizeZoneJ, halfSizeZoneK
92
- ];
93
- // square only config
94
- this.#configs = [
95
- {shape: 'rectangle', dir: [0, 1], size: squareSizes},
96
- {shape: 'rectangle', dir: [0, 1], size: squareSizes},
97
- {shape: 'rectangle', dir: [0, 1], size: squareSizes},
98
- {shape: 'rectangle', dir: [0, 1], size: squareSizes},
99
- {shape: 'rectangle', dir: [0, 1], size: squareSizes},
100
- {shape: 'rectangle', dir: [0, 1], size: squareSizes},
101
- {shape: 'rectangle', dir: [0, 1], size: squareSizes},
102
- {shape: 'rectangle', dir: [0, 1], size: squareSizes}
103
- ];
104
-
105
- // const rectSizes = [
106
- // halfSizeZoneI, halfSizeZoneJ + quarterSizeZoneJ, halfSizeZoneK
107
- // ];
108
- // const circleSizes = [
109
- // quarterSizeZoneI, quarterSizeZoneJ, quarterSizeZoneK
110
- // ];
111
- // const ellipseSizes = [
112
- // quarterSizeZoneI, quarterSizeZoneJ + eigthSizeZoneJ, quarterSizeZoneK
113
- // ];
114
-
115
- // mix of rectangles and ellipses in different directions
116
- // this.#configs = [
117
- // {shape: 'rectangle', dir: [0, 1], size: squareSizes},
118
- // {shape: 'rectangle', dir: [0, 2], size: squareSizes},
119
- // {shape: 'rectangle', dir: [1, 2], size: squareSizes},
120
- // {shape: 'rectangle', dir: [0, 1], size: rectSizes},
121
- // {shape: 'ellipse', dir: [0, 1], size: circleSizes},
122
- // {shape: 'ellipse', dir: [0, 2], size: circleSizes},
123
- // {shape: 'ellipse', dir: [1, 2], size: circleSizes},
124
- // {shape: 'ellipse', dir: [0, 1], size: ellipseSizes}
125
- // ];
126
-
127
- this.#indices = [];
128
- let shapeNumber = 0;
129
- for (let nk = 0; nk < numberOfZonesK; ++nk) {
130
- for (let nj = 0; nj < numberOfZonesJ; ++nj) {
131
- for (let ni = 0; ni < numberOfZonesI; ++ni) {
132
- const config = this.#configs[shapeNumber];
133
- const incr = getDirIncr(config.dir);
134
- const nSlices = config.size[2];
135
- const halfNSlices = Math.floor(nSlices / 2);
136
- for (let k = 0; k < nSlices; ++k) {
137
- const center = new Index([
138
- halfSizeZoneI + ni * this.#sizeZoneI +
139
- incr[0] * (k - halfNSlices),
140
- halfSizeZoneJ + nj * this.#sizeZoneJ +
141
- incr[1] * (k - halfNSlices),
142
- halfSizeZoneK + nk * this.#sizeZoneK +
143
- incr[2] * (k - halfNSlices)
144
- ]);
145
- let newIndices;
146
- if (config.shape === 'rectangle') {
147
- newIndices =
148
- getRectangleIndices(center, config.size, config.dir);
149
- } else if (config.shape === 'ellipse') {
150
- newIndices =
151
- getEllipseIndices(center, config.size, config.dir);
152
- }
153
- this.#indices.push(...newIndices);
154
- }
155
- ++shapeNumber;
156
- }
157
- }
158
- }
159
- }
160
-
161
- /**
162
- * @param {number[]} pixelBuffer The buffer.
163
- * @param {number} sliceNumber The slice number.
164
- */
165
- generate(pixelBuffer, sliceNumber) {
166
- const getFunc = this.#isRGB ? this.#getRGB : this.#getValue;
167
-
168
- // main loop
169
- let offset = 0;
170
- for (let c = 0; c < this.#numberOfColourPlanes; ++c) {
171
- for (let j = 0; j < this.#numberOfRows; ++j) {
172
- for (let i = 0; i < this.#numberOfColumns; ++i) {
173
- for (let s = 0; s < this.#numberOfSamples; ++s) {
174
- if (this.#numberOfColourPlanes !== 1) {
175
- pixelBuffer[offset] = getFunc(i, j, sliceNumber)[c];
176
- } else {
177
- pixelBuffer[offset] = getFunc(i, j, sliceNumber)[s];
178
- }
179
- ++offset;
180
- }
181
- }
182
- }
183
- }
184
- };
185
-
186
- /**
187
- * Get the shape number at a given position.
188
- *
189
- * @param {number} i The column index.
190
- * @param {number} j The row index.
191
- * @param {number} k The slice index.
192
- * @returns {number} A shape number.
193
- */
194
- #getShapeNumber(i, j, k) {
195
- return Math.floor(i / this.#sizeZoneI) +
196
- Math.floor(j / this.#sizeZoneJ) +
197
- Math.floor(k / this.#sizeZoneK);
198
- }
199
-
200
- /**
201
- * Get a simple value.
202
- *
203
- * @param {number} i The column index.
204
- * @param {number} j The row index.
205
- * @param {number} k The slice index.
206
- * @returns {number[]} The grey value.
207
- */
208
- #getValue = (i, j, k) => {
209
- let value = this.#background;
210
- if (this.#indices.find(getEqualIndexCallback(new Index([i, j, k])))) {
211
- const shapeNum = this.#getShapeNumber(i, j, k);
212
- value += Math.round(
213
- this.#maxValue * (shapeNum + 1) / this.#numberOfShapes) + i;
214
- }
215
- return [value];
216
- };
217
-
218
- /**
219
- * Get RGB values.
220
- *
221
- * @param {number} i The column index.
222
- * @param {number} j The row index.
223
- * @param {number} k The slice index.
224
- * @returns {number[]} The [R,G,B] values.
225
- */
226
- #getRGB = (i, j, k) => {
227
- let value = this.#getValue(i, j, k);
228
- if (value > 255) {
229
- value = 200;
230
- }
231
- return [value, 0, 0];
232
- };
233
- }
package/dev/favicon.ico DELETED
Binary file
@@ -1,16 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>DWV Colour Maps</title>
5
- <meta charset="UTF-8">
6
- <link rel="icon" href="../../favicon.ico"/>
7
- <style>
8
- body { font-family: Arial, Helvetica, sans-serif; }
9
- </style>
10
- </head>
11
-
12
- <body>
13
-
14
- <h1>The DWV colour maps</h1>
15
-
16
- </html>
@@ -1,65 +0,0 @@
1
-
2
- import {luts} from '../../../src/image/luts.js';
3
-
4
- /**
5
- * Setup.
6
- */
7
- function setup() {
8
- createImage('Plain', luts.plain);
9
- createImage('InvPlain', luts.invPlain);
10
- createImage('Rainbow', luts.rainbow);
11
- createImage('Hot', luts.hot);
12
- createImage('Hot Iron', luts.hot_iron);
13
- createImage('Pet', luts.pet);
14
- createImage('Hot Metal Blue', luts.hot_metal_blue);
15
- createImage('Pet 20 step', luts.pet_20step);
16
- }
17
-
18
- /**
19
- * Create the colour map image and add it to the document.
20
- *
21
- * @param {string} colourMapName The colour map name.
22
- * @param {object} colourMap The colour map values.
23
- */
24
- function createImage(colourMapName, colourMap) {
25
- // default size
26
- const height = 40;
27
- const width = 256;
28
- // create canvas
29
- const canvas = document.createElement('canvas');
30
- canvas.width = width;
31
- canvas.height = height;
32
- const context = canvas.getContext('2d');
33
- // fill in the image data
34
- const imageData = context.createImageData(canvas.width, canvas.height);
35
- for (let j = 0; j < canvas.height; ++j) {
36
- for (let i = 0; i < canvas.width; ++i) {
37
- const index = (i + j * imageData.width) * 4;
38
- imageData.data[index] = colourMap.red[i];
39
- imageData.data[index + 1] = colourMap.green[i];
40
- imageData.data[index + 2] = colourMap.blue[i];
41
- imageData.data[index + 3] = 0xff;
42
- }
43
- }
44
- // put the image data in the context
45
- context.putImageData(imageData, 0, 0);
46
-
47
- // html
48
- const div = document.createElement('div');
49
- div.id = colourMapName;
50
- const paragraph = document.createElement('p');
51
- const link = document.createElement('a');
52
- link.href = canvas.toDataURL('image/png');
53
- link.appendChild(document.createTextNode(colourMapName));
54
- // put all together
55
- paragraph.appendChild(link);
56
- div.appendChild(paragraph);
57
- div.appendChild(canvas);
58
- // add to the document
59
- document.body.appendChild(div);
60
- }
61
-
62
- // ---------------------------------------------
63
-
64
- // launch
65
- setup();
package/dev/index.html DELETED
@@ -1,38 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>DWV Tests</title>
6
- <meta charset="UTF-8">
7
- <link rel="icon" href="./favicon.ico"/>
8
- <style>
9
- body { font-family: Arial, Helvetica, sans-serif; }
10
- </style>
11
- </head>
12
-
13
- <body>
14
-
15
- <h1>DWV dev pages</h1>
16
-
17
- <p>
18
- Here are some extra web pages used to evaluate the dwv functionalities:
19
- </p>
20
- <ul>
21
- <li>Test <a href="./pacs/viewer.html">viewer</a></li>
22
- <li><a href="./pacs/index.html">Static PACS</a> (demo page) and
23
- <a href="./pacs/dcmweb.html">DICOM web browser</a></li>
24
- <li>Visual snapshot compare: <a href="./visual/index.html">DICOM</a>,
25
- <a href="./visual/index-jpeg.html">DICOM jpg</a>,
26
- <a href="./visual/index-jpeg2000.html">DICOM jpg2000</a>,
27
- <a href="./visual/index-rle.html">DICOM rle</a></li>
28
- <li>DICOM: <a href="./dicom/pages/anonymiser.html">anonymiser</a>,
29
- <a href="./dicom/pages/generator.html">generator</a>,
30
- <a href="./dicom/pages/synthetic-data.html">synthetic-data</a>,
31
- <a href="./dicom/pages/diff.html">diff</a></li>
32
- <li>Benchmark: <a href="./bench/bench.html">dicom</a></li>
33
- <li>Image: <a href="./image/pages/colourmaps.html">colour maps</a></li>
34
- </ul>
35
-
36
- </body>
37
-
38
- </html>
@@ -1,80 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>DICOM web</title>
6
- <link rel="icon" href="../favicon.ico"/>
7
- <style>
8
- body {
9
- background-color: #efefef;
10
- font-family: Arial, Helvetica, sans-serif;
11
- }
12
- table, td, th {
13
- border: 1px solid #aaa;
14
- }
15
- table {
16
- border-collapse: collapse;
17
- width: 100%;
18
- table-layout: fixed;
19
- }
20
- td, th {
21
- padding: 10px;
22
- white-space: nowrap;
23
- overflow: hidden;
24
- text-overflow: ellipsis;
25
- }
26
- #result p {
27
- padding: 2px;
28
- }
29
- .error {
30
- background-color: red;
31
- color: white;
32
- }
33
- .success, .progress {
34
- background-color: seagreen;
35
- color: white;
36
- }
37
- .info {
38
- background-color: skyblue;
39
- color: white;
40
- }
41
-
42
- </style>
43
- </head>
44
- <body>
45
-
46
- <div data-role="page">
47
- <div data-role="content">
48
-
49
- <h1>DICOM web browser</h1>
50
-
51
- <p>
52
- <label for="rooturl">Root url:</label>
53
- <input id="rooturl" type='text' size=40
54
- value="http://localhost:8080/dicom-web">
55
-
56
- <label for="token">Optional token:</label>
57
- <input id="token" type='text' size=40>
58
- </p>
59
-
60
- <p>
61
- <label for="fileinput">STOW query:</label>
62
- <input type="file" id="fileinput" multiple>
63
- <button id="stowMultipartButton">Multipart</button>
64
- <button id="stowInstancesButton">Instances</button>
65
- </p>
66
-
67
- <p>
68
- <label for="qidoArgs">QIDO query:</label>
69
- <input id="qidoArgs" type='text' size=30
70
- value="/series?">
71
- <button id="qidobutton">QIDO</button>
72
- </p>
73
-
74
- <div id="result"></div>
75
-
76
- </div><!-- /page -->
77
- </div><!-- /content -->
78
-
79
- </body>
80
- </html>