dwv 0.33.0-beta.5 → 0.33.0-beta.7
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/dwv.d.ts +661 -161
- package/dist/dwv.min.js +1 -1
- package/dist/dwv.min.js.map +1 -1
- package/package.json +3 -3
package/dist/dwv.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ import Konva from 'konva';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare function addTagsToDictionary(group: string, tags: object): void;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* List of ViewConfigs indexed by dataIds.
|
|
13
|
+
*
|
|
14
|
+
* @typedef {Object<string, ViewConfig[]>} DataViewConfigs
|
|
15
|
+
*/
|
|
11
16
|
/**
|
|
12
17
|
* Main application class.
|
|
13
18
|
*
|
|
@@ -15,9 +20,10 @@ export declare function addTagsToDictionary(group: string, tags: object): void;
|
|
|
15
20
|
* // create the dwv app
|
|
16
21
|
* const app = new dwv.App();
|
|
17
22
|
* // initialise
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
23
|
+
* const viewConfig0 = new dwv.ViewConfig('layerGroup0');
|
|
24
|
+
* const viewConfigs = {'*': [viewConfig0]};
|
|
25
|
+
* const options = new dwv.AppOptions(viewConfigs);
|
|
26
|
+
* app.init(options);
|
|
21
27
|
* // load dicom data
|
|
22
28
|
* app.loadURLs([
|
|
23
29
|
* 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
|
|
@@ -104,9 +110,9 @@ export declare class App {
|
|
|
104
110
|
/**
|
|
105
111
|
* Get the toolbox controller.
|
|
106
112
|
*
|
|
107
|
-
* @returns {
|
|
113
|
+
* @returns {ToolboxController} The controller.
|
|
108
114
|
*/
|
|
109
|
-
getToolboxController():
|
|
115
|
+
getToolboxController(): ToolboxController;
|
|
110
116
|
/**
|
|
111
117
|
* Get the active layer group.
|
|
112
118
|
* The layer is available after the first loaded item.
|
|
@@ -119,17 +125,17 @@ export declare class App {
|
|
|
119
125
|
* The layer are available after the first loaded item.
|
|
120
126
|
*
|
|
121
127
|
* @param {string} dataId The data id.
|
|
122
|
-
* @returns {
|
|
128
|
+
* @returns {ViewLayer[]} The layers.
|
|
123
129
|
*/
|
|
124
|
-
getViewLayersByDataId(dataId: string):
|
|
130
|
+
getViewLayersByDataId(dataId: string): ViewLayer[];
|
|
125
131
|
/**
|
|
126
132
|
* Get the draw layers associated to a data id.
|
|
127
133
|
* The layer are available after the first loaded item.
|
|
128
134
|
*
|
|
129
135
|
* @param {string} dataId The data id.
|
|
130
|
-
* @returns {
|
|
136
|
+
* @returns {DrawLayer[]} The layers.
|
|
131
137
|
*/
|
|
132
|
-
getDrawLayersByDataId(dataId: string):
|
|
138
|
+
getDrawLayersByDataId(dataId: string): DrawLayer[];
|
|
133
139
|
/**
|
|
134
140
|
* Get a layer group by div id.
|
|
135
141
|
* The layer is available after the first loaded item.
|
|
@@ -155,34 +161,22 @@ export declare class App {
|
|
|
155
161
|
*
|
|
156
162
|
* @param {object} cmd The command to add.
|
|
157
163
|
* @fires UndoStack#undoadd
|
|
164
|
+
* @function
|
|
158
165
|
*/
|
|
159
166
|
addToUndoStack: (cmd: object) => void;
|
|
160
167
|
/**
|
|
161
168
|
* Initialise the application.
|
|
162
169
|
*
|
|
163
|
-
* @param {
|
|
164
|
-
* - `dataViewConfigs`: dataId indexed object containing the data view
|
|
165
|
-
* configurations in the form of a list of objects containing:
|
|
166
|
-
* - divId: the HTML div id
|
|
167
|
-
* - orientation: optional 'axial', 'coronal' or 'sagittal' orientation
|
|
168
|
-
* string (default undefined keeps the original slice order)
|
|
169
|
-
* - `binders`: array of layerGroup binders
|
|
170
|
-
* - `tools`: tool name indexed object containing individual tool
|
|
171
|
-
* configurations in the form of a list of objects containing:
|
|
172
|
-
* - options: array of tool options
|
|
173
|
-
* - `viewOnFirstLoadItem`: boolean flag to trigger the first data render
|
|
174
|
-
* after the first loaded data or not
|
|
175
|
-
* - `defaultCharacterSet`: the default chraracter set string used for DICOM
|
|
176
|
-
* parsing
|
|
177
|
-
* - `overlayConfig`: list of tags / properties used as overlay information.
|
|
170
|
+
* @param {AppOptions} opt The application options
|
|
178
171
|
* @example
|
|
179
172
|
* // create the dwv app
|
|
180
173
|
* const app = new dwv.App();
|
|
181
174
|
* // initialise
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
175
|
+
* const viewConfig0 = new dwv.ViewConfig('layerGroup0');
|
|
176
|
+
* const viewConfigs = {'*': [viewConfig0]};
|
|
177
|
+
* const options = new dwv.AppOptions(viewConfigs);
|
|
178
|
+
* options.viewOnFirstLoadItem = false;
|
|
179
|
+
* app.init(options);
|
|
186
180
|
* // render button
|
|
187
181
|
* const button = document.createElement('button');
|
|
188
182
|
* button.id = 'render';
|
|
@@ -202,7 +196,7 @@ export declare class App {
|
|
|
202
196
|
* 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
|
|
203
197
|
* ]);
|
|
204
198
|
*/
|
|
205
|
-
init(opt:
|
|
199
|
+
init(opt: AppOptions): void;
|
|
206
200
|
/**
|
|
207
201
|
* Reset the application.
|
|
208
202
|
*/
|
|
@@ -215,34 +209,35 @@ export declare class App {
|
|
|
215
209
|
* Add an event listener to this class.
|
|
216
210
|
*
|
|
217
211
|
* @param {string} type The event type.
|
|
218
|
-
* @param {
|
|
212
|
+
* @param {Function} callback The function associated with the provided
|
|
219
213
|
* event type, will be called with the fired event.
|
|
220
214
|
*/
|
|
221
|
-
addEventListener(type: string, callback:
|
|
215
|
+
addEventListener(type: string, callback: Function): void;
|
|
222
216
|
/**
|
|
223
217
|
* Remove an event listener from this class.
|
|
224
218
|
*
|
|
225
219
|
* @param {string} type The event type.
|
|
226
|
-
* @param {
|
|
220
|
+
* @param {Function} callback The function associated with the provided
|
|
227
221
|
* event type.
|
|
228
222
|
*/
|
|
229
|
-
removeEventListener(type: string, callback:
|
|
223
|
+
removeEventListener(type: string, callback: Function): void;
|
|
230
224
|
/**
|
|
231
225
|
* Load a list of files. Can be image files or a state file.
|
|
232
226
|
*
|
|
233
|
-
* @param {
|
|
227
|
+
* @param {File[]} files The list of files to load.
|
|
234
228
|
* @fires App#loadstart
|
|
235
229
|
* @fires App#loadprogress
|
|
236
230
|
* @fires App#loaditem
|
|
237
231
|
* @fires App#loadend
|
|
238
232
|
* @fires App#loaderror
|
|
239
233
|
* @fires App#loadabort
|
|
234
|
+
* @function
|
|
240
235
|
*/
|
|
241
|
-
loadFiles: (files:
|
|
236
|
+
loadFiles: (files: File[]) => void;
|
|
242
237
|
/**
|
|
243
238
|
* Load a list of URLs. Can be image files or a state file.
|
|
244
239
|
*
|
|
245
|
-
* @param {
|
|
240
|
+
* @param {string[]} urls The list of urls to load.
|
|
246
241
|
* @param {object} [options] The options object, can contain:
|
|
247
242
|
* - requestHeaders: an array of {name, value} to use as request headers
|
|
248
243
|
* - withCredentials: boolean xhr.withCredentials flag to pass to the request
|
|
@@ -253,13 +248,15 @@ export declare class App {
|
|
|
253
248
|
* @fires App#loadend
|
|
254
249
|
* @fires App#loaderror
|
|
255
250
|
* @fires App#loadabort
|
|
251
|
+
* @function
|
|
256
252
|
*/
|
|
257
|
-
loadURLs: (urls:
|
|
253
|
+
loadURLs: (urls: string[], options?: object) => void;
|
|
258
254
|
/**
|
|
259
255
|
* Load from an input uri.
|
|
260
256
|
*
|
|
261
257
|
* @param {string} uri The input uri, for example: 'window.location.href'.
|
|
262
258
|
* @param {object} [options] Optional url request options.
|
|
259
|
+
* @function
|
|
263
260
|
*/
|
|
264
261
|
loadFromUri: (uri: string, options?: object) => void;
|
|
265
262
|
/**
|
|
@@ -273,6 +270,7 @@ export declare class App {
|
|
|
273
270
|
* @fires App#loadend
|
|
274
271
|
* @fires App#loaderror
|
|
275
272
|
* @fires App#loadabort
|
|
273
|
+
* @function
|
|
276
274
|
*/
|
|
277
275
|
loadImageObject: (data: any[]) => void;
|
|
278
276
|
/**
|
|
@@ -298,38 +296,43 @@ export declare class App {
|
|
|
298
296
|
* Get the data view config.
|
|
299
297
|
* Carefull, returns a reference, do not modify without resetting.
|
|
300
298
|
*
|
|
301
|
-
* @returns {
|
|
299
|
+
* @returns {Object<string, ViewConfig[]>} The configuration list.
|
|
302
300
|
*/
|
|
303
|
-
|
|
301
|
+
getDataViewConfigs(): {
|
|
302
|
+
[x: string]: ViewConfig[];
|
|
303
|
+
};
|
|
304
304
|
/**
|
|
305
|
-
* Set the data view configuration
|
|
305
|
+
* Set the data view configuration.
|
|
306
|
+
* Resets the stage and recreates all the views.
|
|
306
307
|
*
|
|
307
|
-
* @param {
|
|
308
|
+
* @param {Object<string, ViewConfig[]>} configs The configuration list.
|
|
308
309
|
*/
|
|
309
|
-
|
|
310
|
+
setDataViewConfigs(configs: {
|
|
311
|
+
[x: string]: ViewConfig[];
|
|
312
|
+
}): void;
|
|
310
313
|
/**
|
|
311
314
|
* Add a data view config.
|
|
312
315
|
*
|
|
313
316
|
* @param {string} dataId The data id.
|
|
314
|
-
* @param {
|
|
317
|
+
* @param {ViewConfig} config The view configuration.
|
|
315
318
|
*/
|
|
316
|
-
addDataViewConfig(dataId: string, config:
|
|
319
|
+
addDataViewConfig(dataId: string, config: ViewConfig): void;
|
|
317
320
|
/**
|
|
318
321
|
* Remove a data view config.
|
|
319
322
|
*
|
|
320
323
|
* @param {string} dataId The data id.
|
|
321
|
-
* @param {
|
|
324
|
+
* @param {ViewConfig} config The view configuration.
|
|
322
325
|
*/
|
|
323
|
-
removeDataViewConfig(dataId: string, config:
|
|
326
|
+
removeDataViewConfig(dataId: string, config: ViewConfig): void;
|
|
324
327
|
/**
|
|
325
328
|
* Update a data view config.
|
|
326
329
|
* Removes and re-creates the layer if found.
|
|
327
330
|
*
|
|
328
331
|
* @param {string} dataId The data id.
|
|
329
332
|
* @param {string} divId The div id.
|
|
330
|
-
* @param {
|
|
333
|
+
* @param {ViewConfig} config The view configuration.
|
|
331
334
|
*/
|
|
332
|
-
updateDataViewConfig(dataId: string, divId: string, config:
|
|
335
|
+
updateDataViewConfig(dataId: string, divId: string, config: ViewConfig): void;
|
|
333
336
|
/**
|
|
334
337
|
* Set the layer groups binders.
|
|
335
338
|
*
|
|
@@ -340,9 +343,9 @@ export declare class App {
|
|
|
340
343
|
* Render the current data.
|
|
341
344
|
*
|
|
342
345
|
* @param {string} dataId The data id to render.
|
|
343
|
-
* @param {
|
|
346
|
+
* @param {ViewConfig[]} [viewConfigs] The list of configs to render.
|
|
344
347
|
*/
|
|
345
|
-
render(dataId: string, viewConfigs?:
|
|
348
|
+
render(dataId: string, viewConfigs?: ViewConfig[]): void;
|
|
346
349
|
/**
|
|
347
350
|
* Zoom to the layers.
|
|
348
351
|
*
|
|
@@ -387,6 +390,8 @@ export declare class App {
|
|
|
387
390
|
* Handle resize: fit the display to the window.
|
|
388
391
|
* To be called once the image is loaded.
|
|
389
392
|
* Can be connected to a window 'resize' event.
|
|
393
|
+
*
|
|
394
|
+
* @function
|
|
390
395
|
*/
|
|
391
396
|
onResize: () => void;
|
|
392
397
|
/**
|
|
@@ -394,6 +399,7 @@ export declare class App {
|
|
|
394
399
|
*
|
|
395
400
|
* @param {KeyboardEvent} event The key down event.
|
|
396
401
|
* @fires App#keydown
|
|
402
|
+
* @function
|
|
397
403
|
*/
|
|
398
404
|
onKeydown: (event: KeyboardEvent) => void;
|
|
399
405
|
/**
|
|
@@ -408,6 +414,7 @@ export declare class App {
|
|
|
408
414
|
* @param {KeyboardEvent} event The key down event.
|
|
409
415
|
* @fires UndoStack#undo
|
|
410
416
|
* @fires UndoStack#redo
|
|
417
|
+
* @function
|
|
411
418
|
*/
|
|
412
419
|
defaultOnKeydown: (event: KeyboardEvent) => void;
|
|
413
420
|
/**
|
|
@@ -421,9 +428,9 @@ export declare class App {
|
|
|
421
428
|
/**
|
|
422
429
|
* Set the colour map.
|
|
423
430
|
*
|
|
424
|
-
* @param {string}
|
|
431
|
+
* @param {string} name The colour map name.
|
|
425
432
|
*/
|
|
426
|
-
setColourMap(
|
|
433
|
+
setColourMap(name: string): void;
|
|
427
434
|
/**
|
|
428
435
|
* Set the window/level preset.
|
|
429
436
|
*
|
|
@@ -482,6 +489,62 @@ export declare class App {
|
|
|
482
489
|
#private;
|
|
483
490
|
}
|
|
484
491
|
|
|
492
|
+
/**
|
|
493
|
+
* Application options.
|
|
494
|
+
*/
|
|
495
|
+
export declare class AppOptions {
|
|
496
|
+
/**
|
|
497
|
+
* @param {Object<string, ViewConfig[]>} [dataViewConfigs] Optional dataId
|
|
498
|
+
* indexed object containing the data view configurations.
|
|
499
|
+
*/
|
|
500
|
+
constructor(dataViewConfigs?: {
|
|
501
|
+
[x: string]: ViewConfig[];
|
|
502
|
+
});
|
|
503
|
+
/**
|
|
504
|
+
* DataId indexed object containing the data view configurations.
|
|
505
|
+
*
|
|
506
|
+
* @type {Object<string, ViewConfig[]>|undefined}
|
|
507
|
+
*/
|
|
508
|
+
dataViewConfigs: {
|
|
509
|
+
[x: string]: ViewConfig[];
|
|
510
|
+
} | undefined;
|
|
511
|
+
/**
|
|
512
|
+
* Tool name indexed object containing individual tool configurations.
|
|
513
|
+
*
|
|
514
|
+
* @type {Object<string, ToolConfig>|undefined}
|
|
515
|
+
*/
|
|
516
|
+
tools: {
|
|
517
|
+
[x: string]: ToolConfig;
|
|
518
|
+
} | undefined;
|
|
519
|
+
/**
|
|
520
|
+
* Optional array of layerGroup binder names.
|
|
521
|
+
*
|
|
522
|
+
* @type {string[]|undefined}
|
|
523
|
+
*/
|
|
524
|
+
binders: string[] | undefined;
|
|
525
|
+
/**
|
|
526
|
+
* Optional boolean flag to trigger the first data render
|
|
527
|
+
* after the first loaded data or not. Defaults to true;
|
|
528
|
+
*
|
|
529
|
+
* @type {boolean|undefined}
|
|
530
|
+
*/
|
|
531
|
+
viewOnFirstLoadItem: boolean | undefined;
|
|
532
|
+
/**
|
|
533
|
+
* Optional default chraracter set string used for DICOM parsing if
|
|
534
|
+
* not passed in DICOM file.
|
|
535
|
+
* Valid values: https://developer.mozilla.org/en-US/docs/Web/API/Encoding_API/Encodings
|
|
536
|
+
*
|
|
537
|
+
* @type {string|undefined}
|
|
538
|
+
*/
|
|
539
|
+
defaultCharacterSet: string | undefined;
|
|
540
|
+
/**
|
|
541
|
+
* Optional overlay config.
|
|
542
|
+
*
|
|
543
|
+
* @type {object|undefined}
|
|
544
|
+
*/
|
|
545
|
+
overlayConfig: object | undefined;
|
|
546
|
+
}
|
|
547
|
+
|
|
485
548
|
/**
|
|
486
549
|
* Build a multipart message.
|
|
487
550
|
* See: https://en.wikipedia.org/wiki/MIME#Multipart_messages
|
|
@@ -494,6 +557,37 @@ export declare class App {
|
|
|
494
557
|
*/
|
|
495
558
|
export declare function buildMultipart(parts: any[], boundary: string): Uint8Array;
|
|
496
559
|
|
|
560
|
+
/**
|
|
561
|
+
* Colour map: red, green and blue components
|
|
562
|
+
* to associate with intensity values.
|
|
563
|
+
*/
|
|
564
|
+
export declare class ColourMap {
|
|
565
|
+
/**
|
|
566
|
+
* @param {number[]} red Red component.
|
|
567
|
+
* @param {number[]} green Green component.
|
|
568
|
+
* @param {number[]} blue Blue component.
|
|
569
|
+
*/
|
|
570
|
+
constructor(red: number[], green: number[], blue: number[]);
|
|
571
|
+
/**
|
|
572
|
+
* Red component: 256 values in the [0, 255] range.
|
|
573
|
+
*
|
|
574
|
+
* @type {number[]}
|
|
575
|
+
*/
|
|
576
|
+
red: number[];
|
|
577
|
+
/**
|
|
578
|
+
* Green component: 256 values in the [0, 255] range.
|
|
579
|
+
*
|
|
580
|
+
* @type {number[]}
|
|
581
|
+
*/
|
|
582
|
+
green: number[];
|
|
583
|
+
/**
|
|
584
|
+
* Blue component: 256 values in the [0, 255] range.
|
|
585
|
+
*
|
|
586
|
+
* @type {number[]}
|
|
587
|
+
*/
|
|
588
|
+
blue: number[];
|
|
589
|
+
}
|
|
590
|
+
|
|
497
591
|
/**
|
|
498
592
|
* Create an Image from DICOM elements.
|
|
499
593
|
*
|
|
@@ -529,6 +623,64 @@ export declare namespace customUI {
|
|
|
529
623
|
export function openRoiDialog(data: any, callback: Function): void;
|
|
530
624
|
}
|
|
531
625
|
|
|
626
|
+
/**
|
|
627
|
+
* DICOM data element.
|
|
628
|
+
*/
|
|
629
|
+
export declare class DataElement {
|
|
630
|
+
/**
|
|
631
|
+
* @param {string} vr The element VR (Value Representation).
|
|
632
|
+
*/
|
|
633
|
+
constructor(vr: string);
|
|
634
|
+
/**
|
|
635
|
+
* The element Value Representation.
|
|
636
|
+
*
|
|
637
|
+
* @type {string}
|
|
638
|
+
*/
|
|
639
|
+
vr: string;
|
|
640
|
+
/**
|
|
641
|
+
* The element value.
|
|
642
|
+
*
|
|
643
|
+
* @type {Array}
|
|
644
|
+
*/
|
|
645
|
+
value: any[];
|
|
646
|
+
/**
|
|
647
|
+
* The element dicom tag.
|
|
648
|
+
*
|
|
649
|
+
* @type {Tag}
|
|
650
|
+
*/
|
|
651
|
+
tag: Tag;
|
|
652
|
+
/**
|
|
653
|
+
* The element Value Length.
|
|
654
|
+
*
|
|
655
|
+
* @type {number}
|
|
656
|
+
*/
|
|
657
|
+
vl: number;
|
|
658
|
+
/**
|
|
659
|
+
* Flag to know if defined or undefined sequence length.
|
|
660
|
+
*
|
|
661
|
+
* @type {boolean}
|
|
662
|
+
*/
|
|
663
|
+
undefinedLength: boolean;
|
|
664
|
+
/**
|
|
665
|
+
* The element start offset.
|
|
666
|
+
*
|
|
667
|
+
* @type {number}
|
|
668
|
+
*/
|
|
669
|
+
startOffset: number;
|
|
670
|
+
/**
|
|
671
|
+
* The element end offset.
|
|
672
|
+
*
|
|
673
|
+
* @type {number}
|
|
674
|
+
*/
|
|
675
|
+
endOffset: number;
|
|
676
|
+
/**
|
|
677
|
+
* The sequence items.
|
|
678
|
+
*
|
|
679
|
+
* @type {Array}
|
|
680
|
+
*/
|
|
681
|
+
items: any[];
|
|
682
|
+
}
|
|
683
|
+
|
|
532
684
|
/**
|
|
533
685
|
* Decoder scripts to be passed to web workers for image decoding.
|
|
534
686
|
*/
|
|
@@ -607,14 +759,16 @@ export declare class DicomParser {
|
|
|
607
759
|
*/
|
|
608
760
|
setDecoderCharacterSet(characterSet: string): void;
|
|
609
761
|
/**
|
|
610
|
-
* Get the
|
|
762
|
+
* Get the DICOM data elements.
|
|
611
763
|
*
|
|
612
|
-
* @returns {
|
|
764
|
+
* @returns {Object<string, DataElement>} The data elements.
|
|
613
765
|
*/
|
|
614
|
-
getDicomElements():
|
|
766
|
+
getDicomElements(): {
|
|
767
|
+
[x: string]: DataElement;
|
|
768
|
+
};
|
|
615
769
|
/**
|
|
616
770
|
* Parse the complete DICOM file (given as input to the class).
|
|
617
|
-
* Fills in the member object '
|
|
771
|
+
* Fills in the member object 'dataElements'.
|
|
618
772
|
*
|
|
619
773
|
* @param {ArrayBuffer} buffer The input array buffer.
|
|
620
774
|
*/
|
|
@@ -625,16 +779,33 @@ export declare class DicomParser {
|
|
|
625
779
|
/**
|
|
626
780
|
* DICOM writer.
|
|
627
781
|
*
|
|
628
|
-
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
631
|
-
*
|
|
632
|
-
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
782
|
+
* @example
|
|
783
|
+
* // add link to html
|
|
784
|
+
* const link = document.createElement("a");
|
|
785
|
+
* link.appendChild(document.createTextNode("download"));
|
|
786
|
+
* const div = document.getElementById("dwv");
|
|
787
|
+
* div.appendChild(link);
|
|
788
|
+
* // XMLHttpRequest onload callback
|
|
789
|
+
* const onload = function (event) {
|
|
790
|
+
* const parser = new dwv.DicomParser();
|
|
791
|
+
* parser.parse(event.target.response);
|
|
792
|
+
* // create writer
|
|
793
|
+
* const writer = new dwv.DicomWriter();
|
|
794
|
+
* // get buffer using default rules
|
|
795
|
+
* const dicomBuffer = writer.getBuffer(parser.getDicomElements());
|
|
796
|
+
* // create blob
|
|
797
|
+
* const blob = new Blob([dicomBuffer], {type: 'application/dicom'});
|
|
798
|
+
* // add blob to download link
|
|
799
|
+
* link.href = URL.createObjectURL(blob);
|
|
800
|
+
* link.download = "anonym.dcm";
|
|
801
|
+
* };
|
|
802
|
+
* // DICOM file request
|
|
803
|
+
* const request = new XMLHttpRequest();
|
|
804
|
+
* const url = 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm';
|
|
805
|
+
* request.open('GET', url);
|
|
806
|
+
* request.responseType = 'arraybuffer';
|
|
807
|
+
* request.onload = onload;
|
|
808
|
+
* request.send();
|
|
638
809
|
*/
|
|
639
810
|
export declare class DicomWriter {
|
|
640
811
|
/**
|
|
@@ -645,10 +816,16 @@ export declare class DicomWriter {
|
|
|
645
816
|
setUseUnVrForPrivateSq(flag: boolean): void;
|
|
646
817
|
/**
|
|
647
818
|
* Set the writing rules.
|
|
819
|
+
* List of writer rules indexed by either `default`, tagName or groupName.
|
|
820
|
+
* Each DICOM element will be checked to see if a rule is applicable.
|
|
821
|
+
* First checked by tagName and then by groupName,
|
|
822
|
+
* if nothing is found the default rule is applied.
|
|
648
823
|
*
|
|
649
|
-
* @param {
|
|
824
|
+
* @param {Object<string, WriterRule>} rules The input rules.
|
|
650
825
|
*/
|
|
651
|
-
setRules(rules:
|
|
826
|
+
setRules(rules: {
|
|
827
|
+
[x: string]: WriterRule;
|
|
828
|
+
}): void;
|
|
652
829
|
/**
|
|
653
830
|
* Use a TextEncoder instead of the default text decoder.
|
|
654
831
|
*/
|
|
@@ -657,16 +834,153 @@ export declare class DicomWriter {
|
|
|
657
834
|
* Use default anonymisation rules.
|
|
658
835
|
*/
|
|
659
836
|
useDefaultAnonymisationRules(): void;
|
|
837
|
+
/**
|
|
838
|
+
* Get the element to write according to the class rules.
|
|
839
|
+
* Priority order: tagName, groupName, default.
|
|
840
|
+
*
|
|
841
|
+
* @param {DataElement} element The element to check
|
|
842
|
+
* @returns {DataElement|null} The element to write, can be null.
|
|
843
|
+
*/
|
|
844
|
+
getElementToWrite(element: DataElement): DataElement | null;
|
|
660
845
|
/**
|
|
661
846
|
* Get the ArrayBuffer corresponding to input DICOM elements.
|
|
662
847
|
*
|
|
663
|
-
* @param {
|
|
848
|
+
* @param {Object<string, DataElement>} dataElements The elements to write.
|
|
664
849
|
* @returns {ArrayBuffer} The elements as a buffer.
|
|
665
850
|
*/
|
|
666
|
-
getBuffer(
|
|
851
|
+
getBuffer(dataElements: {
|
|
852
|
+
[x: string]: DataElement;
|
|
853
|
+
}): ArrayBuffer;
|
|
854
|
+
#private;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Draw controller.
|
|
859
|
+
*/
|
|
860
|
+
export declare class DrawController {
|
|
861
|
+
/**
|
|
862
|
+
* @param {DrawLayer} drawLayer The draw layer.
|
|
863
|
+
*/
|
|
864
|
+
constructor(drawLayer: DrawLayer);
|
|
865
|
+
/**
|
|
866
|
+
* Get the current position group.
|
|
867
|
+
*
|
|
868
|
+
* @returns {Konva.Group|undefined} The Konva.Group.
|
|
869
|
+
*/
|
|
870
|
+
getCurrentPosGroup(): Konva.Group | undefined;
|
|
871
|
+
/**
|
|
872
|
+
* Reset: clear the layers array.
|
|
873
|
+
*/
|
|
874
|
+
reset(): void;
|
|
875
|
+
/**
|
|
876
|
+
* Get a Konva group using its id.
|
|
877
|
+
*
|
|
878
|
+
* @param {string} id The group id.
|
|
879
|
+
* @returns {object|undefined} The Konva group.
|
|
880
|
+
*/
|
|
881
|
+
getGroup(id: string): object | undefined;
|
|
882
|
+
/**
|
|
883
|
+
* Activate the current draw layer.
|
|
884
|
+
*
|
|
885
|
+
* @param {Index} index The current position.
|
|
886
|
+
* @param {number} scrollIndex The scroll index.
|
|
887
|
+
*/
|
|
888
|
+
activateDrawLayer(index: Index, scrollIndex: number): void;
|
|
889
|
+
/**
|
|
890
|
+
* Get a list of drawing display details.
|
|
891
|
+
*
|
|
892
|
+
* @returns {DrawDetails[]} A list of draw details.
|
|
893
|
+
*/
|
|
894
|
+
getDrawDisplayDetails(): DrawDetails[];
|
|
895
|
+
/**
|
|
896
|
+
* Get a list of drawing store details. Used in state.
|
|
897
|
+
*
|
|
898
|
+
* @returns {object} A list of draw details including id, text, quant...
|
|
899
|
+
* TODO Unify with getDrawDisplayDetails?
|
|
900
|
+
*/
|
|
901
|
+
getDrawStoreDetails(): object;
|
|
902
|
+
/**
|
|
903
|
+
* Set the drawings on the current stage.
|
|
904
|
+
*
|
|
905
|
+
* @param {Array} drawings An array of drawings.
|
|
906
|
+
* @param {DrawDetails[]} drawingsDetails An array of drawings details.
|
|
907
|
+
* @param {object} cmdCallback The DrawCommand callback.
|
|
908
|
+
* @param {object} exeCallback The callback to call once the
|
|
909
|
+
* DrawCommand has been executed.
|
|
910
|
+
*/
|
|
911
|
+
setDrawings(drawings: any[], drawingsDetails: DrawDetails[], cmdCallback: object, exeCallback: object): void;
|
|
912
|
+
/**
|
|
913
|
+
* Update a drawing from its details.
|
|
914
|
+
*
|
|
915
|
+
* @param {DrawDetails} drawDetails Details of the drawing to update.
|
|
916
|
+
*/
|
|
917
|
+
updateDraw(drawDetails: DrawDetails): void;
|
|
918
|
+
/**
|
|
919
|
+
* Delete a Draw from the stage.
|
|
920
|
+
*
|
|
921
|
+
* @param {Konva.Group} group The group to delete.
|
|
922
|
+
* @param {object} cmdCallback The DeleteCommand callback.
|
|
923
|
+
* @param {object} exeCallback The callback to call once the
|
|
924
|
+
* DeleteCommand has been executed.
|
|
925
|
+
*/
|
|
926
|
+
deleteDrawGroup(group: Konva.Group, cmdCallback: object, exeCallback: object): void;
|
|
927
|
+
/**
|
|
928
|
+
* Delete a Draw from the stage.
|
|
929
|
+
*
|
|
930
|
+
* @param {string} id The id of the group to delete.
|
|
931
|
+
* @param {Function} cmdCallback The DeleteCommand callback.
|
|
932
|
+
* @param {Function} exeCallback The callback to call once the
|
|
933
|
+
* DeleteCommand has been executed.
|
|
934
|
+
* @returns {boolean} False if the group cannot be found.
|
|
935
|
+
*/
|
|
936
|
+
deleteDraw(id: string, cmdCallback: Function, exeCallback: Function): boolean;
|
|
937
|
+
/**
|
|
938
|
+
* Delete all Draws from the stage.
|
|
939
|
+
*
|
|
940
|
+
* @param {Function} cmdCallback The DeleteCommand callback.
|
|
941
|
+
* @param {Function} exeCallback The callback to call once the
|
|
942
|
+
* DeleteCommand has been executed.
|
|
943
|
+
*/
|
|
944
|
+
deleteDraws(cmdCallback: Function, exeCallback: Function): void;
|
|
667
945
|
#private;
|
|
668
946
|
}
|
|
669
947
|
|
|
948
|
+
/**
|
|
949
|
+
* Draw details.
|
|
950
|
+
*/
|
|
951
|
+
export declare class DrawDetails {
|
|
952
|
+
/**
|
|
953
|
+
* The draw ID.
|
|
954
|
+
*
|
|
955
|
+
* @type {number}
|
|
956
|
+
*/
|
|
957
|
+
id: number;
|
|
958
|
+
/**
|
|
959
|
+
* The draw position: an Index converted to string.
|
|
960
|
+
*
|
|
961
|
+
* @type {string}
|
|
962
|
+
*/
|
|
963
|
+
position: string;
|
|
964
|
+
/**
|
|
965
|
+
* The draw type.
|
|
966
|
+
*
|
|
967
|
+
* @type {string}
|
|
968
|
+
*/
|
|
969
|
+
type: string;
|
|
970
|
+
/**
|
|
971
|
+
* The draw color: for example 'green', '#00ff00' or 'rgb(0,255,0)'.
|
|
972
|
+
*
|
|
973
|
+
* @type {string}
|
|
974
|
+
*/
|
|
975
|
+
color: string;
|
|
976
|
+
/**
|
|
977
|
+
* The draw meta.
|
|
978
|
+
*
|
|
979
|
+
* @type {DrawMeta}
|
|
980
|
+
*/
|
|
981
|
+
meta: DrawMeta;
|
|
982
|
+
}
|
|
983
|
+
|
|
670
984
|
/**
|
|
671
985
|
* Draw layer.
|
|
672
986
|
*/
|
|
@@ -746,9 +1060,9 @@ export declare class DrawLayer {
|
|
|
746
1060
|
* Set the layer scale.
|
|
747
1061
|
*
|
|
748
1062
|
* @param {object} newScale The scale as {x,y}.
|
|
749
|
-
* @param {Point3D} center The scale center.
|
|
1063
|
+
* @param {Point3D} [center] The scale center.
|
|
750
1064
|
*/
|
|
751
|
-
setScale(newScale: object, center
|
|
1065
|
+
setScale(newScale: object, center?: Point3D): void;
|
|
752
1066
|
/**
|
|
753
1067
|
* Set the layer offset.
|
|
754
1068
|
*
|
|
@@ -809,7 +1123,7 @@ export declare class DrawLayer {
|
|
|
809
1123
|
* @param {string} id The id of the group.
|
|
810
1124
|
* @returns {boolean} False if the group cannot be found.
|
|
811
1125
|
*/
|
|
812
|
-
|
|
1126
|
+
toggleGroupVisibility(id: string): boolean;
|
|
813
1127
|
/**
|
|
814
1128
|
* Delete a Draw from the stage.
|
|
815
1129
|
*
|
|
@@ -845,21 +1159,40 @@ export declare class DrawLayer {
|
|
|
845
1159
|
* Add an event listener to this class.
|
|
846
1160
|
*
|
|
847
1161
|
* @param {string} type The event type.
|
|
848
|
-
* @param {
|
|
1162
|
+
* @param {Function} callback The function associated with the provided
|
|
849
1163
|
* event type, will be called with the fired event.
|
|
850
1164
|
*/
|
|
851
|
-
addEventListener(type: string, callback:
|
|
1165
|
+
addEventListener(type: string, callback: Function): void;
|
|
852
1166
|
/**
|
|
853
1167
|
* Remove an event listener from this class.
|
|
854
1168
|
*
|
|
855
1169
|
* @param {string} type The event type.
|
|
856
|
-
* @param {
|
|
1170
|
+
* @param {Function} callback The function associated with the provided
|
|
857
1171
|
* event type.
|
|
858
1172
|
*/
|
|
859
|
-
removeEventListener(type: string, callback:
|
|
1173
|
+
removeEventListener(type: string, callback: Function): void;
|
|
860
1174
|
#private;
|
|
861
1175
|
}
|
|
862
1176
|
|
|
1177
|
+
/**
|
|
1178
|
+
* Draw meta data.
|
|
1179
|
+
*/
|
|
1180
|
+
export declare class DrawMeta {
|
|
1181
|
+
/**
|
|
1182
|
+
* Draw quantification.
|
|
1183
|
+
*
|
|
1184
|
+
* @type {object}
|
|
1185
|
+
*/
|
|
1186
|
+
quantification: object;
|
|
1187
|
+
/**
|
|
1188
|
+
* Draw text expression. Can contain variables surrounded with '{}' that will
|
|
1189
|
+
* be extracted from the quantification object.
|
|
1190
|
+
*
|
|
1191
|
+
* @type {string}
|
|
1192
|
+
*/
|
|
1193
|
+
textExpr: string;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
863
1196
|
/**
|
|
864
1197
|
* 2D/3D Geometry class.
|
|
865
1198
|
*/
|
|
@@ -912,9 +1245,9 @@ export declare class Geometry {
|
|
|
912
1245
|
/**
|
|
913
1246
|
* Get the object origins.
|
|
914
1247
|
*
|
|
915
|
-
* @returns {
|
|
1248
|
+
* @returns {Point3D[]} The object origins.
|
|
916
1249
|
*/
|
|
917
|
-
getOrigins():
|
|
1250
|
+
getOrigins(): Point3D[];
|
|
918
1251
|
/**
|
|
919
1252
|
* Check if a point is in the origin list.
|
|
920
1253
|
*
|
|
@@ -1007,10 +1340,10 @@ export declare class Geometry {
|
|
|
1007
1340
|
* Check that a index is within bounds.
|
|
1008
1341
|
*
|
|
1009
1342
|
* @param {Index} index The index to check.
|
|
1010
|
-
* @param {
|
|
1343
|
+
* @param {number[]} [dirs] Optional list of directions to check.
|
|
1011
1344
|
* @returns {boolean} True if the given coordinates are within bounds.
|
|
1012
1345
|
*/
|
|
1013
|
-
isIndexInBounds(index: Index, dirs?:
|
|
1346
|
+
isIndexInBounds(index: Index, dirs?: number[]): boolean;
|
|
1014
1347
|
/**
|
|
1015
1348
|
* Convert an index into world coordinates.
|
|
1016
1349
|
*
|
|
@@ -1042,6 +1375,12 @@ export declare class Geometry {
|
|
|
1042
1375
|
#private;
|
|
1043
1376
|
}
|
|
1044
1377
|
|
|
1378
|
+
/**
|
|
1379
|
+
* List of DICOM data elements indexed via a 8 character string formed from
|
|
1380
|
+
* the group and element numbers.
|
|
1381
|
+
*
|
|
1382
|
+
* @typedef {Object<string, DataElement>} DataElements
|
|
1383
|
+
*/
|
|
1045
1384
|
/**
|
|
1046
1385
|
* Get the version of the library.
|
|
1047
1386
|
*
|
|
@@ -1050,15 +1389,20 @@ export declare class Geometry {
|
|
|
1050
1389
|
export declare function getDwvVersion(): string;
|
|
1051
1390
|
|
|
1052
1391
|
/**
|
|
1053
|
-
* Get the DICOM elements from a DICOM json tags object.
|
|
1392
|
+
* Get the DICOM elements from a 'simple' DICOM json tags object.
|
|
1054
1393
|
* The json is a simplified version of the oficial DICOM json with
|
|
1055
1394
|
* tag names instead of keys and direct values (no value property) for
|
|
1056
|
-
* simple tags.
|
|
1395
|
+
* simple tags. See synthetic test data (in tests/dicom) for examples.
|
|
1057
1396
|
*
|
|
1058
|
-
* @param {
|
|
1059
|
-
*
|
|
1397
|
+
* @param {Object<string, any>} jsonTags The DICOM
|
|
1398
|
+
* json tags object.
|
|
1399
|
+
* @returns {Object<string, DataElement>} The DICOM elements.
|
|
1060
1400
|
*/
|
|
1061
|
-
export declare function getElementsFromJSONTags(jsonTags:
|
|
1401
|
+
export declare function getElementsFromJSONTags(jsonTags: {
|
|
1402
|
+
[x: string]: any;
|
|
1403
|
+
}): {
|
|
1404
|
+
[x: string]: DataElement;
|
|
1405
|
+
};
|
|
1062
1406
|
|
|
1063
1407
|
/**
|
|
1064
1408
|
* Get the name of an image orientation patient.
|
|
@@ -1116,6 +1460,16 @@ export declare function getTypedArray(bitsAllocated: number, pixelRepresentation
|
|
|
1116
1460
|
*/
|
|
1117
1461
|
export declare function getUID(tagName: string): string;
|
|
1118
1462
|
|
|
1463
|
+
/**
|
|
1464
|
+
* Check that an input buffer includes the DICOM prefix 'DICM'
|
|
1465
|
+
* after the 128 bytes preamble.
|
|
1466
|
+
* Ref: [DICOM File Meta]{@link https://dicom.nema.org/dicom/2013/output/chtml/part10/chapter_7.html#sect_7.1}
|
|
1467
|
+
*
|
|
1468
|
+
* @param {ArrayBuffer} buffer The buffer to check.
|
|
1469
|
+
* @returns {boolean} True if the buffer includes the prefix.
|
|
1470
|
+
*/
|
|
1471
|
+
export declare function hasDicomPrefix(buffer: ArrayBuffer): boolean;
|
|
1472
|
+
|
|
1119
1473
|
export declare namespace i18n {
|
|
1120
1474
|
/**
|
|
1121
1475
|
* Get the translated text.
|
|
@@ -1360,18 +1714,18 @@ declare class Image_2 {
|
|
|
1360
1714
|
* Add an event listener to this class.
|
|
1361
1715
|
*
|
|
1362
1716
|
* @param {string} type The event type.
|
|
1363
|
-
* @param {
|
|
1717
|
+
* @param {Function} callback The function associated with the provided
|
|
1364
1718
|
* event type, will be called with the fired event.
|
|
1365
1719
|
*/
|
|
1366
|
-
addEventListener(type: string, callback:
|
|
1720
|
+
addEventListener(type: string, callback: Function): void;
|
|
1367
1721
|
/**
|
|
1368
1722
|
* Remove an event listener from this class.
|
|
1369
1723
|
*
|
|
1370
1724
|
* @param {string} type The event type.
|
|
1371
|
-
* @param {
|
|
1725
|
+
* @param {Function} callback The function associated with the provided
|
|
1372
1726
|
* event type.
|
|
1373
1727
|
*/
|
|
1374
|
-
removeEventListener(type: string, callback:
|
|
1728
|
+
removeEventListener(type: string, callback: Function): void;
|
|
1375
1729
|
/**
|
|
1376
1730
|
* Set the inner buffer values at given offsets.
|
|
1377
1731
|
*
|
|
@@ -1513,9 +1867,9 @@ export { Image_2 as Image }
|
|
|
1513
1867
|
*/
|
|
1514
1868
|
export declare class Index {
|
|
1515
1869
|
/**
|
|
1516
|
-
* @param {
|
|
1870
|
+
* @param {number[]} values The index values.
|
|
1517
1871
|
*/
|
|
1518
|
-
constructor(values:
|
|
1872
|
+
constructor(values: number[]);
|
|
1519
1873
|
/**
|
|
1520
1874
|
* Get the index value at the given array index.
|
|
1521
1875
|
*
|
|
@@ -1538,9 +1892,9 @@ export declare class Index {
|
|
|
1538
1892
|
/**
|
|
1539
1893
|
* Get the values of this index.
|
|
1540
1894
|
*
|
|
1541
|
-
* @returns {
|
|
1895
|
+
* @returns {number[]} The array of values.
|
|
1542
1896
|
*/
|
|
1543
|
-
getValues():
|
|
1897
|
+
getValues(): number[];
|
|
1544
1898
|
/**
|
|
1545
1899
|
* Check if the input index can be compared to this one.
|
|
1546
1900
|
*
|
|
@@ -1559,9 +1913,9 @@ export declare class Index {
|
|
|
1559
1913
|
* Compare indices and return different dimensions.
|
|
1560
1914
|
*
|
|
1561
1915
|
* @param {Index} rhs The index to compare to.
|
|
1562
|
-
* @returns {
|
|
1916
|
+
* @returns {number[]} The list of different dimensions.
|
|
1563
1917
|
*/
|
|
1564
|
-
compare(rhs: Index):
|
|
1918
|
+
compare(rhs: Index): number[];
|
|
1565
1919
|
/**
|
|
1566
1920
|
* Add another index to this one.
|
|
1567
1921
|
*
|
|
@@ -1580,10 +1934,10 @@ export declare class Index {
|
|
|
1580
1934
|
/**
|
|
1581
1935
|
* Get a string id from the index values in the form of: '#0-1_#1-2'.
|
|
1582
1936
|
*
|
|
1583
|
-
* @param {
|
|
1937
|
+
* @param {number[]} [dims] Optional list of dimensions to use.
|
|
1584
1938
|
* @returns {string} The string id.
|
|
1585
1939
|
*/
|
|
1586
|
-
toStringId(dims?:
|
|
1940
|
+
toStringId(dims?: number[]): string;
|
|
1587
1941
|
#private;
|
|
1588
1942
|
}
|
|
1589
1943
|
|
|
@@ -1754,6 +2108,7 @@ export declare class LayerGroup {
|
|
|
1754
2108
|
* Update layers (but not the active view layer) to a position change.
|
|
1755
2109
|
*
|
|
1756
2110
|
* @param {object} event The position change event.
|
|
2111
|
+
* @function
|
|
1757
2112
|
*/
|
|
1758
2113
|
updateLayersToPositionChange: (event: object) => void;
|
|
1759
2114
|
/**
|
|
@@ -1824,18 +2179,18 @@ export declare class LayerGroup {
|
|
|
1824
2179
|
* Add an event listener to this class.
|
|
1825
2180
|
*
|
|
1826
2181
|
* @param {string} type The event type.
|
|
1827
|
-
* @param {
|
|
2182
|
+
* @param {Function} callback The function associated with the provided
|
|
1828
2183
|
* event type, will be called with the fired event.
|
|
1829
2184
|
*/
|
|
1830
|
-
addEventListener(type: string, callback:
|
|
2185
|
+
addEventListener(type: string, callback: Function): void;
|
|
1831
2186
|
/**
|
|
1832
2187
|
* Remove an event listener from this class.
|
|
1833
2188
|
*
|
|
1834
2189
|
* @param {string} type The event type.
|
|
1835
|
-
* @param {
|
|
2190
|
+
* @param {Function} callback The function associated with the provided
|
|
1836
2191
|
* event type.
|
|
1837
2192
|
*/
|
|
1838
|
-
removeEventListener(type: string, callback:
|
|
2193
|
+
removeEventListener(type: string, callback: Function): void;
|
|
1839
2194
|
#private;
|
|
1840
2195
|
}
|
|
1841
2196
|
|
|
@@ -1858,14 +2213,10 @@ export declare namespace logger {
|
|
|
1858
2213
|
/**
|
|
1859
2214
|
* List of available lookup tables (lut).
|
|
1860
2215
|
*
|
|
1861
|
-
* @type {Object<string,
|
|
2216
|
+
* @type {Object<string, ColourMap>}
|
|
1862
2217
|
*/
|
|
1863
|
-
export declare const
|
|
1864
|
-
[x: string]:
|
|
1865
|
-
red: number[];
|
|
1866
|
-
green: number[];
|
|
1867
|
-
blue: number[];
|
|
1868
|
-
};
|
|
2218
|
+
export declare const luts: {
|
|
2219
|
+
[x: string]: ColourMap;
|
|
1869
2220
|
};
|
|
1870
2221
|
|
|
1871
2222
|
/**
|
|
@@ -1873,17 +2224,17 @@ export declare const lut: {
|
|
|
1873
2224
|
*/
|
|
1874
2225
|
export declare class Matrix33 {
|
|
1875
2226
|
/**
|
|
1876
|
-
* @param {
|
|
2227
|
+
* @param {number[]} values row-major ordered 9 values.
|
|
1877
2228
|
*/
|
|
1878
|
-
constructor(values:
|
|
2229
|
+
constructor(values: number[]);
|
|
1879
2230
|
/**
|
|
1880
2231
|
* Get a value of the matrix.
|
|
1881
2232
|
*
|
|
1882
2233
|
* @param {number} row The row at wich to get the value.
|
|
1883
2234
|
* @param {number} col The column at wich to get the value.
|
|
1884
|
-
* @returns {number} The value at the position.
|
|
2235
|
+
* @returns {number|undefined} The value at the position.
|
|
1885
2236
|
*/
|
|
1886
|
-
get(row: number, col: number): number;
|
|
2237
|
+
get(row: number, col: number): number | undefined;
|
|
1887
2238
|
/**
|
|
1888
2239
|
* Get the inverse of this matrix.
|
|
1889
2240
|
*
|
|
@@ -1922,10 +2273,10 @@ export declare class Matrix33 {
|
|
|
1922
2273
|
/**
|
|
1923
2274
|
* Multiply this matrix by a 3D array.
|
|
1924
2275
|
*
|
|
1925
|
-
* @param {
|
|
1926
|
-
* @returns {
|
|
2276
|
+
* @param {number[]} array3D The input 3D array.
|
|
2277
|
+
* @returns {number[]} The result 3D array.
|
|
1927
2278
|
*/
|
|
1928
|
-
multiplyArray3D(array3D:
|
|
2279
|
+
multiplyArray3D(array3D: number[]): number[];
|
|
1929
2280
|
/**
|
|
1930
2281
|
* Multiply this matrix by a 3D vector.
|
|
1931
2282
|
*
|
|
@@ -2036,9 +2387,9 @@ export declare class OverlayData {
|
|
|
2036
2387
|
*/
|
|
2037
2388
|
export declare class Point {
|
|
2038
2389
|
/**
|
|
2039
|
-
* @param {
|
|
2390
|
+
* @param {number[]} values The point values.
|
|
2040
2391
|
*/
|
|
2041
|
-
constructor(values:
|
|
2392
|
+
constructor(values: number[]);
|
|
2042
2393
|
/**
|
|
2043
2394
|
* Get the index value at the given array index.
|
|
2044
2395
|
*
|
|
@@ -2061,9 +2412,9 @@ export declare class Point {
|
|
|
2061
2412
|
/**
|
|
2062
2413
|
* Get the values of this index.
|
|
2063
2414
|
*
|
|
2064
|
-
* @returns {
|
|
2415
|
+
* @returns {number[]} The array of values.
|
|
2065
2416
|
*/
|
|
2066
|
-
getValues():
|
|
2417
|
+
getValues(): number[];
|
|
2067
2418
|
/**
|
|
2068
2419
|
* Check if the input point can be compared to this one.
|
|
2069
2420
|
*
|
|
@@ -2082,9 +2433,9 @@ export declare class Point {
|
|
|
2082
2433
|
* Compare points and return different dimensions.
|
|
2083
2434
|
*
|
|
2084
2435
|
* @param {Point} rhs The point to compare to.
|
|
2085
|
-
* @returns {
|
|
2436
|
+
* @returns {number[]} The list of different dimensions.
|
|
2086
2437
|
*/
|
|
2087
|
-
compare(rhs: Point):
|
|
2438
|
+
compare(rhs: Point): number[];
|
|
2088
2439
|
/**
|
|
2089
2440
|
* Get the 3D part of this point.
|
|
2090
2441
|
*
|
|
@@ -2569,10 +2920,91 @@ export declare class TagValueExtractor {
|
|
|
2569
2920
|
/**
|
|
2570
2921
|
* Get the time.
|
|
2571
2922
|
*
|
|
2572
|
-
* @param {
|
|
2923
|
+
* @param {Object<string, DataElement>} _elements The DICOM elements.
|
|
2573
2924
|
* @returns {number|undefined} The time value if available.
|
|
2574
2925
|
*/
|
|
2575
|
-
getTime(_elements:
|
|
2926
|
+
getTime(_elements: {
|
|
2927
|
+
[x: string]: DataElement;
|
|
2928
|
+
}): number | undefined;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
/**
|
|
2932
|
+
* Toolbox controller.
|
|
2933
|
+
*/
|
|
2934
|
+
export declare class ToolboxController {
|
|
2935
|
+
/**
|
|
2936
|
+
* @param {object} toolList The list of tool objects.
|
|
2937
|
+
*/
|
|
2938
|
+
constructor(toolList: object);
|
|
2939
|
+
/**
|
|
2940
|
+
* Initialise.
|
|
2941
|
+
*/
|
|
2942
|
+
init(): void;
|
|
2943
|
+
/**
|
|
2944
|
+
* Get the tool list.
|
|
2945
|
+
*
|
|
2946
|
+
* @returns {Array} The list of tool objects.
|
|
2947
|
+
*/
|
|
2948
|
+
getToolList(): any[];
|
|
2949
|
+
/**
|
|
2950
|
+
* Check if a tool is in the tool list.
|
|
2951
|
+
*
|
|
2952
|
+
* @param {string} name The name to check.
|
|
2953
|
+
* @returns {boolean} The tool list element for the given name.
|
|
2954
|
+
*/
|
|
2955
|
+
hasTool(name: string): boolean;
|
|
2956
|
+
/**
|
|
2957
|
+
* Get the selected tool.
|
|
2958
|
+
*
|
|
2959
|
+
* @returns {object} The selected tool.
|
|
2960
|
+
*/
|
|
2961
|
+
getSelectedTool(): object;
|
|
2962
|
+
/**
|
|
2963
|
+
* Get the selected tool event handler.
|
|
2964
|
+
*
|
|
2965
|
+
* @param {string} eventType The event type, for example
|
|
2966
|
+
* mousedown, touchstart...
|
|
2967
|
+
* @returns {Function} The event handler.
|
|
2968
|
+
*/
|
|
2969
|
+
getSelectedToolEventHandler(eventType: string): Function;
|
|
2970
|
+
/**
|
|
2971
|
+
* Set the selected tool.
|
|
2972
|
+
*
|
|
2973
|
+
* @param {string} name The name of the tool.
|
|
2974
|
+
*/
|
|
2975
|
+
setSelectedTool(name: string): void;
|
|
2976
|
+
/**
|
|
2977
|
+
* Set the selected tool live features.
|
|
2978
|
+
*
|
|
2979
|
+
* @param {object} list The list of features.
|
|
2980
|
+
*/
|
|
2981
|
+
setToolFeatures(list: object): void;
|
|
2982
|
+
/**
|
|
2983
|
+
* Listen to layer interaction events.
|
|
2984
|
+
*
|
|
2985
|
+
* @param {LayerGroup} layerGroup The associated layer group.
|
|
2986
|
+
* @param {ViewLayer|DrawLayer} layer The layer to listen to.
|
|
2987
|
+
*/
|
|
2988
|
+
bindLayerGroup(layerGroup: LayerGroup, layer: ViewLayer | DrawLayer): void;
|
|
2989
|
+
#private;
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
/**
|
|
2993
|
+
* Tool configuration.
|
|
2994
|
+
*/
|
|
2995
|
+
export declare class ToolConfig {
|
|
2996
|
+
/**
|
|
2997
|
+
* @param {string[]} [options] Optional tool options.
|
|
2998
|
+
*/
|
|
2999
|
+
constructor(options?: string[]);
|
|
3000
|
+
/**
|
|
3001
|
+
* Optional tool options.
|
|
3002
|
+
* For Draw: list of shape names.
|
|
3003
|
+
* For Filter: list of filter names.
|
|
3004
|
+
*
|
|
3005
|
+
* @type {string[]|undefined}
|
|
3006
|
+
*/
|
|
3007
|
+
options: string[] | undefined;
|
|
2576
3008
|
}
|
|
2577
3009
|
|
|
2578
3010
|
/**
|
|
@@ -2606,10 +3038,10 @@ export declare class Vector3D {
|
|
|
2606
3038
|
/**
|
|
2607
3039
|
* Check for Vector3D equality.
|
|
2608
3040
|
*
|
|
2609
|
-
* @param {
|
|
3041
|
+
* @param {Vector3D} rhs The other vector to compare to.
|
|
2610
3042
|
* @returns {boolean} True if both vectors are equal.
|
|
2611
3043
|
*/
|
|
2612
|
-
equals(rhs:
|
|
3044
|
+
equals(rhs: Vector3D): boolean;
|
|
2613
3045
|
/**
|
|
2614
3046
|
* Get a string representation of the Vector3D.
|
|
2615
3047
|
*
|
|
@@ -2656,9 +3088,9 @@ export declare class Vector3D {
|
|
|
2656
3088
|
* const dicomParser = new dwv.DicomParser();
|
|
2657
3089
|
* dicomParser.parse(event.target.response);
|
|
2658
3090
|
* // create the image object
|
|
2659
|
-
* const image = createImage(dicomParser.getDicomElements());
|
|
3091
|
+
* const image = dwv.createImage(dicomParser.getDicomElements());
|
|
2660
3092
|
* // create the view
|
|
2661
|
-
* const view = createView(dicomParser.getDicomElements(), image);
|
|
3093
|
+
* const view = dwv.createView(dicomParser.getDicomElements(), image);
|
|
2662
3094
|
* // setup canvas
|
|
2663
3095
|
* const canvas = document.createElement('canvas');
|
|
2664
3096
|
* canvas.width = 256;
|
|
@@ -2772,9 +3204,9 @@ export declare class View {
|
|
|
2772
3204
|
/**
|
|
2773
3205
|
* Set the default colour map.
|
|
2774
3206
|
*
|
|
2775
|
-
* @param {
|
|
3207
|
+
* @param {ColourMap} map The colour map.
|
|
2776
3208
|
*/
|
|
2777
|
-
setDefaultColourMap(map:
|
|
3209
|
+
setDefaultColourMap(map: ColourMap): void;
|
|
2778
3210
|
/**
|
|
2779
3211
|
* Add window presets to the existing ones.
|
|
2780
3212
|
*
|
|
@@ -2790,16 +3222,16 @@ export declare class View {
|
|
|
2790
3222
|
/**
|
|
2791
3223
|
* Get the colour map of the image.
|
|
2792
3224
|
*
|
|
2793
|
-
* @returns {
|
|
3225
|
+
* @returns {ColourMap} The colour map of the image.
|
|
2794
3226
|
*/
|
|
2795
|
-
getColourMap():
|
|
3227
|
+
getColourMap(): ColourMap;
|
|
2796
3228
|
/**
|
|
2797
3229
|
* Set the colour map of the image.
|
|
2798
3230
|
*
|
|
2799
|
-
* @param {
|
|
3231
|
+
* @param {ColourMap} map The colour map of the image.
|
|
2800
3232
|
* @fires View#colourchange
|
|
2801
3233
|
*/
|
|
2802
|
-
setColourMap(map:
|
|
3234
|
+
setColourMap(map: ColourMap): void;
|
|
2803
3235
|
/**
|
|
2804
3236
|
* Get the current position.
|
|
2805
3237
|
*
|
|
@@ -2820,12 +3252,12 @@ export declare class View {
|
|
|
2820
3252
|
*/
|
|
2821
3253
|
canSetPosition(position: Point): boolean;
|
|
2822
3254
|
/**
|
|
2823
|
-
* Get the origin at a given position.
|
|
3255
|
+
* Get the first origin or at a given position.
|
|
2824
3256
|
*
|
|
2825
|
-
* @param {Point} position
|
|
2826
|
-
* @returns {
|
|
3257
|
+
* @param {Point} [position] Optional position.
|
|
3258
|
+
* @returns {Point3D} The origin.
|
|
2827
3259
|
*/
|
|
2828
|
-
getOrigin(position
|
|
3260
|
+
getOrigin(position?: Point): Point3D;
|
|
2829
3261
|
/**
|
|
2830
3262
|
* Set the current position.
|
|
2831
3263
|
*
|
|
@@ -2873,18 +3305,18 @@ export declare class View {
|
|
|
2873
3305
|
* Add an event listener to this class.
|
|
2874
3306
|
*
|
|
2875
3307
|
* @param {string} type The event type.
|
|
2876
|
-
* @param {
|
|
3308
|
+
* @param {Function} callback The function associated with the provided
|
|
2877
3309
|
* event type, will be called with the fired event.
|
|
2878
3310
|
*/
|
|
2879
|
-
addEventListener(type: string, callback:
|
|
3311
|
+
addEventListener(type: string, callback: Function): void;
|
|
2880
3312
|
/**
|
|
2881
3313
|
* Remove an event listener from this class.
|
|
2882
3314
|
*
|
|
2883
3315
|
* @param {string} type The event type.
|
|
2884
|
-
* @param {
|
|
3316
|
+
* @param {Function} callback The function associated with the provided
|
|
2885
3317
|
* event type.
|
|
2886
3318
|
*/
|
|
2887
|
-
removeEventListener(type: string, callback:
|
|
3319
|
+
removeEventListener(type: string, callback: Function): void;
|
|
2888
3320
|
/**
|
|
2889
3321
|
* Get the image window/level that covers the full data range.
|
|
2890
3322
|
* Warning: uses the latest set rescale LUT or the default linear one.
|
|
@@ -2944,6 +3376,42 @@ export declare class View {
|
|
|
2944
3376
|
#private;
|
|
2945
3377
|
}
|
|
2946
3378
|
|
|
3379
|
+
/**
|
|
3380
|
+
* View configuration: mainly defines the ´divId´
|
|
3381
|
+
* of the associated HTML div.
|
|
3382
|
+
*/
|
|
3383
|
+
export declare class ViewConfig {
|
|
3384
|
+
/**
|
|
3385
|
+
* @param {string} divId The associated HTML div id.
|
|
3386
|
+
*/
|
|
3387
|
+
constructor(divId: string);
|
|
3388
|
+
/**
|
|
3389
|
+
* Associated HTML div id.
|
|
3390
|
+
*
|
|
3391
|
+
* @type {string}
|
|
3392
|
+
*/
|
|
3393
|
+
divId: string;
|
|
3394
|
+
/**
|
|
3395
|
+
* Optional orientation of the data; 'axial', 'coronal' or 'sagittal'.
|
|
3396
|
+
* If undefined, will use the data aquisition plane.
|
|
3397
|
+
*
|
|
3398
|
+
* @type {string|undefined}
|
|
3399
|
+
*/
|
|
3400
|
+
orientation: string | undefined;
|
|
3401
|
+
/**
|
|
3402
|
+
* Optional view colour map name.
|
|
3403
|
+
*
|
|
3404
|
+
* @type {string|undefined}
|
|
3405
|
+
*/
|
|
3406
|
+
colourMap: string | undefined;
|
|
3407
|
+
/**
|
|
3408
|
+
* Optional layer opacity; in [0, 1] range.
|
|
3409
|
+
*
|
|
3410
|
+
* @type {number|undefined}
|
|
3411
|
+
*/
|
|
3412
|
+
opacity: number | undefined;
|
|
3413
|
+
}
|
|
3414
|
+
|
|
2947
3415
|
/**
|
|
2948
3416
|
* View controller.
|
|
2949
3417
|
*/
|
|
@@ -3055,12 +3523,12 @@ export declare class ViewController {
|
|
|
3055
3523
|
*/
|
|
3056
3524
|
getCurrentScrollIndexValue(): object;
|
|
3057
3525
|
/**
|
|
3058
|
-
* Get the origin at a given
|
|
3526
|
+
* Get the first origin or at a given position.
|
|
3059
3527
|
*
|
|
3060
|
-
* @param {Point} position
|
|
3061
|
-
* @returns {
|
|
3528
|
+
* @param {Point} [position] Opitonal position.
|
|
3529
|
+
* @returns {Point3D} The origin.
|
|
3062
3530
|
*/
|
|
3063
|
-
getOrigin(position
|
|
3531
|
+
getOrigin(position?: Point): Point3D;
|
|
3064
3532
|
/**
|
|
3065
3533
|
* Get the current scroll position value.
|
|
3066
3534
|
*
|
|
@@ -3275,15 +3743,22 @@ export declare class ViewController {
|
|
|
3275
3743
|
/**
|
|
3276
3744
|
* Get the colour map.
|
|
3277
3745
|
*
|
|
3278
|
-
* @returns {
|
|
3746
|
+
* @returns {ColourMap} The colour map.
|
|
3279
3747
|
*/
|
|
3280
|
-
getColourMap():
|
|
3748
|
+
getColourMap(): ColourMap;
|
|
3749
|
+
/**
|
|
3750
|
+
* Get the colour map name.
|
|
3751
|
+
*
|
|
3752
|
+
* @returns {string} The colour map name.
|
|
3753
|
+
*/
|
|
3754
|
+
getColourMapName(): string;
|
|
3281
3755
|
/**
|
|
3282
3756
|
* Set the colour map.
|
|
3283
3757
|
*
|
|
3284
|
-
* @param {
|
|
3758
|
+
* @param {ColourMap} map The colour map.
|
|
3759
|
+
* @param {string} [name] The colour map name.
|
|
3285
3760
|
*/
|
|
3286
|
-
setColourMap(
|
|
3761
|
+
setColourMap(map: ColourMap, name?: string): void;
|
|
3287
3762
|
/**
|
|
3288
3763
|
* @callback alphaFn@callback alphaFn
|
|
3289
3764
|
* @param {object} value The pixel value.
|
|
@@ -3306,18 +3781,18 @@ export declare class ViewController {
|
|
|
3306
3781
|
* Add an event listener to this class.
|
|
3307
3782
|
*
|
|
3308
3783
|
* @param {string} type The event type.
|
|
3309
|
-
* @param {
|
|
3784
|
+
* @param {Function} callback The function associated with the provided
|
|
3310
3785
|
* event type, will be called with the fired event.
|
|
3311
3786
|
*/
|
|
3312
|
-
addEventListener(type: string, callback:
|
|
3787
|
+
addEventListener(type: string, callback: Function): void;
|
|
3313
3788
|
/**
|
|
3314
3789
|
* Remove an event listener from this class.
|
|
3315
3790
|
*
|
|
3316
3791
|
* @param {string} type The event type.
|
|
3317
|
-
* @param {
|
|
3792
|
+
* @param {Function} callback The function associated with the provided
|
|
3318
3793
|
* event type.
|
|
3319
3794
|
*/
|
|
3320
|
-
removeEventListener(type: string, callback:
|
|
3795
|
+
removeEventListener(type: string, callback: Function): void;
|
|
3321
3796
|
#private;
|
|
3322
3797
|
}
|
|
3323
3798
|
|
|
@@ -3365,12 +3840,14 @@ export declare class ViewLayer {
|
|
|
3365
3840
|
* Handle an image set event.
|
|
3366
3841
|
*
|
|
3367
3842
|
* @param {object} event The event.
|
|
3843
|
+
* @function
|
|
3368
3844
|
*/
|
|
3369
3845
|
onimageset: (event: object) => void;
|
|
3370
3846
|
/**
|
|
3371
3847
|
* Handle an image change event.
|
|
3372
3848
|
*
|
|
3373
3849
|
* @param {object} event The event.
|
|
3850
|
+
* @function
|
|
3374
3851
|
*/
|
|
3375
3852
|
onimagechange: (event: object) => void;
|
|
3376
3853
|
/**
|
|
@@ -3419,9 +3896,9 @@ export declare class ViewLayer {
|
|
|
3419
3896
|
* Set the layer scale.
|
|
3420
3897
|
*
|
|
3421
3898
|
* @param {object} newScale The scale as {x,y}.
|
|
3422
|
-
* @param {Point3D} center The scale center.
|
|
3899
|
+
* @param {Point3D} [center] The scale center.
|
|
3423
3900
|
*/
|
|
3424
|
-
setScale(newScale: object, center
|
|
3901
|
+
setScale(newScale: object, center?: Point3D): void;
|
|
3425
3902
|
/**
|
|
3426
3903
|
* Set the base layer offset. Updates the layer offset.
|
|
3427
3904
|
*
|
|
@@ -3465,7 +3942,8 @@ export declare class ViewLayer {
|
|
|
3465
3942
|
*
|
|
3466
3943
|
* @param {number} x The X position.
|
|
3467
3944
|
* @param {number} y The Y position.
|
|
3468
|
-
* @returns {object} The display position as {x,y}
|
|
3945
|
+
* @returns {object} The display position as {x,y}, can be individually
|
|
3946
|
+
* undefined if out of bounds.
|
|
3469
3947
|
*/
|
|
3470
3948
|
planePosToDisplay(x: number, y: number): object;
|
|
3471
3949
|
/**
|
|
@@ -3524,18 +4002,18 @@ export declare class ViewLayer {
|
|
|
3524
4002
|
* Add an event listener to this class.
|
|
3525
4003
|
*
|
|
3526
4004
|
* @param {string} type The event type.
|
|
3527
|
-
* @param {
|
|
4005
|
+
* @param {Function} callback The function associated with the provided
|
|
3528
4006
|
* event type, will be called with the fired event.
|
|
3529
4007
|
*/
|
|
3530
|
-
addEventListener(type: string, callback:
|
|
4008
|
+
addEventListener(type: string, callback: Function): void;
|
|
3531
4009
|
/**
|
|
3532
4010
|
* Remove an event listener from this class.
|
|
3533
4011
|
*
|
|
3534
4012
|
* @param {string} type The event type.
|
|
3535
|
-
* @param {
|
|
4013
|
+
* @param {Function} callback The function associated with the provided
|
|
3536
4014
|
* event type.
|
|
3537
4015
|
*/
|
|
3538
|
-
removeEventListener(type: string, callback:
|
|
4016
|
+
removeEventListener(type: string, callback: Function): void;
|
|
3539
4017
|
/**
|
|
3540
4018
|
* Set the current position.
|
|
3541
4019
|
*
|
|
@@ -3649,4 +4127,26 @@ export declare class WindowLut {
|
|
|
3649
4127
|
#private;
|
|
3650
4128
|
}
|
|
3651
4129
|
|
|
4130
|
+
/**
|
|
4131
|
+
* Writer rule.
|
|
4132
|
+
*/
|
|
4133
|
+
export declare class WriterRule {
|
|
4134
|
+
/**
|
|
4135
|
+
* @param {string} action The rule action.
|
|
4136
|
+
*/
|
|
4137
|
+
constructor(action: string);
|
|
4138
|
+
/**
|
|
4139
|
+
* Rule action: `copy`, `remove`, `clear` or `replace`.
|
|
4140
|
+
*
|
|
4141
|
+
* @type {string}
|
|
4142
|
+
*/
|
|
4143
|
+
action: string;
|
|
4144
|
+
/**
|
|
4145
|
+
* Optional value to use for replace action.
|
|
4146
|
+
*
|
|
4147
|
+
* @type {any|undefined}
|
|
4148
|
+
*/
|
|
4149
|
+
value: any | undefined;
|
|
4150
|
+
}
|
|
4151
|
+
|
|
3652
4152
|
export { }
|