dwv 0.33.0-beta.6 → 0.33.0-beta.8
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 +666 -179
- package/dist/dwv.min.js +1 -1
- package/dist/dwv.min.js.map +1 -1
- package/package.json +8 -8
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
|
*/
|
|
@@ -554,7 +706,7 @@ export declare const defaultPresets: {
|
|
|
554
706
|
};
|
|
555
707
|
|
|
556
708
|
export declare namespace defaults {
|
|
557
|
-
|
|
709
|
+
let labelText: {
|
|
558
710
|
[x: string]: {
|
|
559
711
|
[x: string]: string;
|
|
560
712
|
};
|
|
@@ -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;
|
|
667
854
|
#private;
|
|
668
855
|
}
|
|
669
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;
|
|
945
|
+
#private;
|
|
946
|
+
}
|
|
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
|
|
|
@@ -1662,6 +2016,12 @@ export declare class LayerGroup {
|
|
|
1662
2016
|
* @returns {number} The number of layers.
|
|
1663
2017
|
*/
|
|
1664
2018
|
getNumberOfLayers(): number;
|
|
2019
|
+
/**
|
|
2020
|
+
* Get the number of view layers handled by this class.
|
|
2021
|
+
*
|
|
2022
|
+
* @returns {number} The number of layers.
|
|
2023
|
+
*/
|
|
2024
|
+
getNumberOfViewLayers(): number;
|
|
1665
2025
|
/**
|
|
1666
2026
|
* Get the active image layer.
|
|
1667
2027
|
*
|
|
@@ -1754,6 +2114,7 @@ export declare class LayerGroup {
|
|
|
1754
2114
|
* Update layers (but not the active view layer) to a position change.
|
|
1755
2115
|
*
|
|
1756
2116
|
* @param {object} event The position change event.
|
|
2117
|
+
* @function
|
|
1757
2118
|
*/
|
|
1758
2119
|
updateLayersToPositionChange: (event: object) => void;
|
|
1759
2120
|
/**
|
|
@@ -1824,30 +2185,30 @@ export declare class LayerGroup {
|
|
|
1824
2185
|
* Add an event listener to this class.
|
|
1825
2186
|
*
|
|
1826
2187
|
* @param {string} type The event type.
|
|
1827
|
-
* @param {
|
|
2188
|
+
* @param {Function} callback The function associated with the provided
|
|
1828
2189
|
* event type, will be called with the fired event.
|
|
1829
2190
|
*/
|
|
1830
|
-
addEventListener(type: string, callback:
|
|
2191
|
+
addEventListener(type: string, callback: Function): void;
|
|
1831
2192
|
/**
|
|
1832
2193
|
* Remove an event listener from this class.
|
|
1833
2194
|
*
|
|
1834
2195
|
* @param {string} type The event type.
|
|
1835
|
-
* @param {
|
|
2196
|
+
* @param {Function} callback The function associated with the provided
|
|
1836
2197
|
* event type.
|
|
1837
2198
|
*/
|
|
1838
|
-
removeEventListener(type: string, callback:
|
|
2199
|
+
removeEventListener(type: string, callback: Function): void;
|
|
1839
2200
|
#private;
|
|
1840
2201
|
}
|
|
1841
2202
|
|
|
1842
2203
|
export declare namespace logger {
|
|
1843
2204
|
export namespace levels {
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
2205
|
+
let TRACE: number;
|
|
2206
|
+
let DEBUG: number;
|
|
2207
|
+
let INFO: number;
|
|
2208
|
+
let WARN: number;
|
|
2209
|
+
let ERROR: number;
|
|
1849
2210
|
}
|
|
1850
|
-
|
|
2211
|
+
let level: number;
|
|
1851
2212
|
export function trace(msg: string): void;
|
|
1852
2213
|
export function debug(msg: string): void;
|
|
1853
2214
|
export function info(msg: string): void;
|
|
@@ -1858,14 +2219,10 @@ export declare namespace logger {
|
|
|
1858
2219
|
/**
|
|
1859
2220
|
* List of available lookup tables (lut).
|
|
1860
2221
|
*
|
|
1861
|
-
* @type {Object<string,
|
|
2222
|
+
* @type {Object<string, ColourMap>}
|
|
1862
2223
|
*/
|
|
1863
|
-
export declare const
|
|
1864
|
-
[x: string]:
|
|
1865
|
-
red: number[];
|
|
1866
|
-
green: number[];
|
|
1867
|
-
blue: number[];
|
|
1868
|
-
};
|
|
2224
|
+
export declare const luts: {
|
|
2225
|
+
[x: string]: ColourMap;
|
|
1869
2226
|
};
|
|
1870
2227
|
|
|
1871
2228
|
/**
|
|
@@ -1873,17 +2230,17 @@ export declare const lut: {
|
|
|
1873
2230
|
*/
|
|
1874
2231
|
export declare class Matrix33 {
|
|
1875
2232
|
/**
|
|
1876
|
-
* @param {
|
|
2233
|
+
* @param {number[]} values row-major ordered 9 values.
|
|
1877
2234
|
*/
|
|
1878
|
-
constructor(values:
|
|
2235
|
+
constructor(values: number[]);
|
|
1879
2236
|
/**
|
|
1880
2237
|
* Get a value of the matrix.
|
|
1881
2238
|
*
|
|
1882
2239
|
* @param {number} row The row at wich to get the value.
|
|
1883
2240
|
* @param {number} col The column at wich to get the value.
|
|
1884
|
-
* @returns {number} The value at the position.
|
|
2241
|
+
* @returns {number|undefined} The value at the position.
|
|
1885
2242
|
*/
|
|
1886
|
-
get(row: number, col: number): number;
|
|
2243
|
+
get(row: number, col: number): number | undefined;
|
|
1887
2244
|
/**
|
|
1888
2245
|
* Get the inverse of this matrix.
|
|
1889
2246
|
*
|
|
@@ -1922,10 +2279,10 @@ export declare class Matrix33 {
|
|
|
1922
2279
|
/**
|
|
1923
2280
|
* Multiply this matrix by a 3D array.
|
|
1924
2281
|
*
|
|
1925
|
-
* @param {
|
|
1926
|
-
* @returns {
|
|
2282
|
+
* @param {number[]} array3D The input 3D array.
|
|
2283
|
+
* @returns {number[]} The result 3D array.
|
|
1927
2284
|
*/
|
|
1928
|
-
multiplyArray3D(array3D:
|
|
2285
|
+
multiplyArray3D(array3D: number[]): number[];
|
|
1929
2286
|
/**
|
|
1930
2287
|
* Multiply this matrix by a 3D vector.
|
|
1931
2288
|
*
|
|
@@ -2036,9 +2393,9 @@ export declare class OverlayData {
|
|
|
2036
2393
|
*/
|
|
2037
2394
|
export declare class Point {
|
|
2038
2395
|
/**
|
|
2039
|
-
* @param {
|
|
2396
|
+
* @param {number[]} values The point values.
|
|
2040
2397
|
*/
|
|
2041
|
-
constructor(values:
|
|
2398
|
+
constructor(values: number[]);
|
|
2042
2399
|
/**
|
|
2043
2400
|
* Get the index value at the given array index.
|
|
2044
2401
|
*
|
|
@@ -2061,9 +2418,9 @@ export declare class Point {
|
|
|
2061
2418
|
/**
|
|
2062
2419
|
* Get the values of this index.
|
|
2063
2420
|
*
|
|
2064
|
-
* @returns {
|
|
2421
|
+
* @returns {number[]} The array of values.
|
|
2065
2422
|
*/
|
|
2066
|
-
getValues():
|
|
2423
|
+
getValues(): number[];
|
|
2067
2424
|
/**
|
|
2068
2425
|
* Check if the input point can be compared to this one.
|
|
2069
2426
|
*
|
|
@@ -2082,9 +2439,9 @@ export declare class Point {
|
|
|
2082
2439
|
* Compare points and return different dimensions.
|
|
2083
2440
|
*
|
|
2084
2441
|
* @param {Point} rhs The point to compare to.
|
|
2085
|
-
* @returns {
|
|
2442
|
+
* @returns {number[]} The list of different dimensions.
|
|
2086
2443
|
*/
|
|
2087
|
-
compare(rhs: Point):
|
|
2444
|
+
compare(rhs: Point): number[];
|
|
2088
2445
|
/**
|
|
2089
2446
|
* Get the 3D part of this point.
|
|
2090
2447
|
*
|
|
@@ -2569,10 +2926,91 @@ export declare class TagValueExtractor {
|
|
|
2569
2926
|
/**
|
|
2570
2927
|
* Get the time.
|
|
2571
2928
|
*
|
|
2572
|
-
* @param {
|
|
2929
|
+
* @param {Object<string, DataElement>} _elements The DICOM elements.
|
|
2573
2930
|
* @returns {number|undefined} The time value if available.
|
|
2574
2931
|
*/
|
|
2575
|
-
getTime(_elements:
|
|
2932
|
+
getTime(_elements: {
|
|
2933
|
+
[x: string]: DataElement;
|
|
2934
|
+
}): number | undefined;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* Toolbox controller.
|
|
2939
|
+
*/
|
|
2940
|
+
export declare class ToolboxController {
|
|
2941
|
+
/**
|
|
2942
|
+
* @param {object} toolList The list of tool objects.
|
|
2943
|
+
*/
|
|
2944
|
+
constructor(toolList: object);
|
|
2945
|
+
/**
|
|
2946
|
+
* Initialise.
|
|
2947
|
+
*/
|
|
2948
|
+
init(): void;
|
|
2949
|
+
/**
|
|
2950
|
+
* Get the tool list.
|
|
2951
|
+
*
|
|
2952
|
+
* @returns {Array} The list of tool objects.
|
|
2953
|
+
*/
|
|
2954
|
+
getToolList(): any[];
|
|
2955
|
+
/**
|
|
2956
|
+
* Check if a tool is in the tool list.
|
|
2957
|
+
*
|
|
2958
|
+
* @param {string} name The name to check.
|
|
2959
|
+
* @returns {boolean} The tool list element for the given name.
|
|
2960
|
+
*/
|
|
2961
|
+
hasTool(name: string): boolean;
|
|
2962
|
+
/**
|
|
2963
|
+
* Get the selected tool.
|
|
2964
|
+
*
|
|
2965
|
+
* @returns {object} The selected tool.
|
|
2966
|
+
*/
|
|
2967
|
+
getSelectedTool(): object;
|
|
2968
|
+
/**
|
|
2969
|
+
* Get the selected tool event handler.
|
|
2970
|
+
*
|
|
2971
|
+
* @param {string} eventType The event type, for example
|
|
2972
|
+
* mousedown, touchstart...
|
|
2973
|
+
* @returns {Function} The event handler.
|
|
2974
|
+
*/
|
|
2975
|
+
getSelectedToolEventHandler(eventType: string): Function;
|
|
2976
|
+
/**
|
|
2977
|
+
* Set the selected tool.
|
|
2978
|
+
*
|
|
2979
|
+
* @param {string} name The name of the tool.
|
|
2980
|
+
*/
|
|
2981
|
+
setSelectedTool(name: string): void;
|
|
2982
|
+
/**
|
|
2983
|
+
* Set the selected tool live features.
|
|
2984
|
+
*
|
|
2985
|
+
* @param {object} list The list of features.
|
|
2986
|
+
*/
|
|
2987
|
+
setToolFeatures(list: object): void;
|
|
2988
|
+
/**
|
|
2989
|
+
* Listen to layer interaction events.
|
|
2990
|
+
*
|
|
2991
|
+
* @param {LayerGroup} layerGroup The associated layer group.
|
|
2992
|
+
* @param {ViewLayer|DrawLayer} layer The layer to listen to.
|
|
2993
|
+
*/
|
|
2994
|
+
bindLayerGroup(layerGroup: LayerGroup, layer: ViewLayer | DrawLayer): void;
|
|
2995
|
+
#private;
|
|
2996
|
+
}
|
|
2997
|
+
|
|
2998
|
+
/**
|
|
2999
|
+
* Tool configuration.
|
|
3000
|
+
*/
|
|
3001
|
+
export declare class ToolConfig {
|
|
3002
|
+
/**
|
|
3003
|
+
* @param {string[]} [options] Optional tool options.
|
|
3004
|
+
*/
|
|
3005
|
+
constructor(options?: string[]);
|
|
3006
|
+
/**
|
|
3007
|
+
* Optional tool options.
|
|
3008
|
+
* For Draw: list of shape names.
|
|
3009
|
+
* For Filter: list of filter names.
|
|
3010
|
+
*
|
|
3011
|
+
* @type {string[]|undefined}
|
|
3012
|
+
*/
|
|
3013
|
+
options: string[] | undefined;
|
|
2576
3014
|
}
|
|
2577
3015
|
|
|
2578
3016
|
/**
|
|
@@ -2606,10 +3044,10 @@ export declare class Vector3D {
|
|
|
2606
3044
|
/**
|
|
2607
3045
|
* Check for Vector3D equality.
|
|
2608
3046
|
*
|
|
2609
|
-
* @param {
|
|
3047
|
+
* @param {Vector3D} rhs The other vector to compare to.
|
|
2610
3048
|
* @returns {boolean} True if both vectors are equal.
|
|
2611
3049
|
*/
|
|
2612
|
-
equals(rhs:
|
|
3050
|
+
equals(rhs: Vector3D): boolean;
|
|
2613
3051
|
/**
|
|
2614
3052
|
* Get a string representation of the Vector3D.
|
|
2615
3053
|
*
|
|
@@ -2656,9 +3094,9 @@ export declare class Vector3D {
|
|
|
2656
3094
|
* const dicomParser = new dwv.DicomParser();
|
|
2657
3095
|
* dicomParser.parse(event.target.response);
|
|
2658
3096
|
* // create the image object
|
|
2659
|
-
* const image = createImage(dicomParser.getDicomElements());
|
|
3097
|
+
* const image = dwv.createImage(dicomParser.getDicomElements());
|
|
2660
3098
|
* // create the view
|
|
2661
|
-
* const view = createView(dicomParser.getDicomElements(), image);
|
|
3099
|
+
* const view = dwv.createView(dicomParser.getDicomElements(), image);
|
|
2662
3100
|
* // setup canvas
|
|
2663
3101
|
* const canvas = document.createElement('canvas');
|
|
2664
3102
|
* canvas.width = 256;
|
|
@@ -2769,12 +3207,6 @@ export declare class View {
|
|
|
2769
3207
|
* @param {object} presets The window presets.
|
|
2770
3208
|
*/
|
|
2771
3209
|
setWindowPresets(presets: object): void;
|
|
2772
|
-
/**
|
|
2773
|
-
* Set the default colour map.
|
|
2774
|
-
*
|
|
2775
|
-
* @param {object} map The colour map.
|
|
2776
|
-
*/
|
|
2777
|
-
setDefaultColourMap(map: object): 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 {string} The colour map name.
|
|
2794
3226
|
*/
|
|
2795
|
-
getColourMap():
|
|
3227
|
+
getColourMap(): string;
|
|
2796
3228
|
/**
|
|
2797
3229
|
* Set the colour map of the image.
|
|
2798
3230
|
*
|
|
2799
|
-
* @param {
|
|
2800
|
-
* @fires View#
|
|
3231
|
+
* @param {string} name The colour map name.
|
|
3232
|
+
* @fires View#colourmapchange
|
|
2801
3233
|
*/
|
|
2802
|
-
setColourMap(
|
|
3234
|
+
setColourMap(name: string): 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,15 @@ export declare class ViewController {
|
|
|
3275
3743
|
/**
|
|
3276
3744
|
* Get the colour map.
|
|
3277
3745
|
*
|
|
3278
|
-
* @returns {
|
|
3746
|
+
* @returns {string} The colour map name.
|
|
3279
3747
|
*/
|
|
3280
|
-
getColourMap():
|
|
3748
|
+
getColourMap(): string;
|
|
3281
3749
|
/**
|
|
3282
3750
|
* Set the colour map.
|
|
3283
3751
|
*
|
|
3284
|
-
* @param {
|
|
3752
|
+
* @param {string} name The colour map name.
|
|
3285
3753
|
*/
|
|
3286
|
-
setColourMap(
|
|
3754
|
+
setColourMap(name: string): void;
|
|
3287
3755
|
/**
|
|
3288
3756
|
* @callback alphaFn@callback alphaFn
|
|
3289
3757
|
* @param {object} value The pixel value.
|
|
@@ -3296,28 +3764,22 @@ export declare class ViewController {
|
|
|
3296
3764
|
* @param {alphaFn} func The function.
|
|
3297
3765
|
*/
|
|
3298
3766
|
setViewAlphaFunction(func: (value: object, index: object) => number): void;
|
|
3299
|
-
/**
|
|
3300
|
-
* Set the colour map from a name.
|
|
3301
|
-
*
|
|
3302
|
-
* @param {string} name The name of the colour map to set.
|
|
3303
|
-
*/
|
|
3304
|
-
setColourMapFromName(name: string): void;
|
|
3305
3767
|
/**
|
|
3306
3768
|
* Add an event listener to this class.
|
|
3307
3769
|
*
|
|
3308
3770
|
* @param {string} type The event type.
|
|
3309
|
-
* @param {
|
|
3771
|
+
* @param {Function} callback The function associated with the provided
|
|
3310
3772
|
* event type, will be called with the fired event.
|
|
3311
3773
|
*/
|
|
3312
|
-
addEventListener(type: string, callback:
|
|
3774
|
+
addEventListener(type: string, callback: Function): void;
|
|
3313
3775
|
/**
|
|
3314
3776
|
* Remove an event listener from this class.
|
|
3315
3777
|
*
|
|
3316
3778
|
* @param {string} type The event type.
|
|
3317
|
-
* @param {
|
|
3779
|
+
* @param {Function} callback The function associated with the provided
|
|
3318
3780
|
* event type.
|
|
3319
3781
|
*/
|
|
3320
|
-
removeEventListener(type: string, callback:
|
|
3782
|
+
removeEventListener(type: string, callback: Function): void;
|
|
3321
3783
|
#private;
|
|
3322
3784
|
}
|
|
3323
3785
|
|
|
@@ -3365,12 +3827,14 @@ export declare class ViewLayer {
|
|
|
3365
3827
|
* Handle an image set event.
|
|
3366
3828
|
*
|
|
3367
3829
|
* @param {object} event The event.
|
|
3830
|
+
* @function
|
|
3368
3831
|
*/
|
|
3369
3832
|
onimageset: (event: object) => void;
|
|
3370
3833
|
/**
|
|
3371
3834
|
* Handle an image change event.
|
|
3372
3835
|
*
|
|
3373
3836
|
* @param {object} event The event.
|
|
3837
|
+
* @function
|
|
3374
3838
|
*/
|
|
3375
3839
|
onimagechange: (event: object) => void;
|
|
3376
3840
|
/**
|
|
@@ -3419,9 +3883,9 @@ export declare class ViewLayer {
|
|
|
3419
3883
|
* Set the layer scale.
|
|
3420
3884
|
*
|
|
3421
3885
|
* @param {object} newScale The scale as {x,y}.
|
|
3422
|
-
* @param {Point3D} center The scale center.
|
|
3886
|
+
* @param {Point3D} [center] The scale center.
|
|
3423
3887
|
*/
|
|
3424
|
-
setScale(newScale: object, center
|
|
3888
|
+
setScale(newScale: object, center?: Point3D): void;
|
|
3425
3889
|
/**
|
|
3426
3890
|
* Set the base layer offset. Updates the layer offset.
|
|
3427
3891
|
*
|
|
@@ -3465,7 +3929,8 @@ export declare class ViewLayer {
|
|
|
3465
3929
|
*
|
|
3466
3930
|
* @param {number} x The X position.
|
|
3467
3931
|
* @param {number} y The Y position.
|
|
3468
|
-
* @returns {object} The display position as {x,y}
|
|
3932
|
+
* @returns {object} The display position as {x,y}, can be individually
|
|
3933
|
+
* undefined if out of bounds.
|
|
3469
3934
|
*/
|
|
3470
3935
|
planePosToDisplay(x: number, y: number): object;
|
|
3471
3936
|
/**
|
|
@@ -3524,18 +3989,18 @@ export declare class ViewLayer {
|
|
|
3524
3989
|
* Add an event listener to this class.
|
|
3525
3990
|
*
|
|
3526
3991
|
* @param {string} type The event type.
|
|
3527
|
-
* @param {
|
|
3992
|
+
* @param {Function} callback The function associated with the provided
|
|
3528
3993
|
* event type, will be called with the fired event.
|
|
3529
3994
|
*/
|
|
3530
|
-
addEventListener(type: string, callback:
|
|
3995
|
+
addEventListener(type: string, callback: Function): void;
|
|
3531
3996
|
/**
|
|
3532
3997
|
* Remove an event listener from this class.
|
|
3533
3998
|
*
|
|
3534
3999
|
* @param {string} type The event type.
|
|
3535
|
-
* @param {
|
|
4000
|
+
* @param {Function} callback The function associated with the provided
|
|
3536
4001
|
* event type.
|
|
3537
4002
|
*/
|
|
3538
|
-
removeEventListener(type: string, callback:
|
|
4003
|
+
removeEventListener(type: string, callback: Function): void;
|
|
3539
4004
|
/**
|
|
3540
4005
|
* Set the current position.
|
|
3541
4006
|
*
|
|
@@ -3649,4 +4114,26 @@ export declare class WindowLut {
|
|
|
3649
4114
|
#private;
|
|
3650
4115
|
}
|
|
3651
4116
|
|
|
4117
|
+
/**
|
|
4118
|
+
* Writer rule.
|
|
4119
|
+
*/
|
|
4120
|
+
export declare class WriterRule {
|
|
4121
|
+
/**
|
|
4122
|
+
* @param {string} action The rule action.
|
|
4123
|
+
*/
|
|
4124
|
+
constructor(action: string);
|
|
4125
|
+
/**
|
|
4126
|
+
* Rule action: `copy`, `remove`, `clear` or `replace`.
|
|
4127
|
+
*
|
|
4128
|
+
* @type {string}
|
|
4129
|
+
*/
|
|
4130
|
+
action: string;
|
|
4131
|
+
/**
|
|
4132
|
+
* Optional value to use for replace action.
|
|
4133
|
+
*
|
|
4134
|
+
* @type {any|undefined}
|
|
4135
|
+
*/
|
|
4136
|
+
value: any | undefined;
|
|
4137
|
+
}
|
|
4138
|
+
|
|
3652
4139
|
export { }
|