dwv 0.32.1 → 0.32.2-beta.1

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 CHANGED
@@ -6,6 +6,11 @@
6
6
  */
7
7
  export declare function addTagsToDictionary(group: string, tags: object): void;
8
8
 
9
+ /**
10
+ * List of ViewConfigs indexed by dataIds.
11
+ *
12
+ * @typedef {Object<string, ViewConfig[]>} DataViewConfigs
13
+ */
9
14
  /**
10
15
  * Main application class.
11
16
  *
@@ -13,9 +18,10 @@ export declare function addTagsToDictionary(group: string, tags: object): void;
13
18
  * // create the dwv app
14
19
  * const app = new dwv.App();
15
20
  * // initialise
16
- * app.init({
17
- * dataViewConfigs: {'*': [{divId: 'layerGroup0'}]}
18
- * });
21
+ * const viewConfig0 = new ViewConfig('layerGroup0');
22
+ * const viewConfigs = {'*': [viewConfig0]};
23
+ * const options = new AppOptions(viewConfigs);
24
+ * app.init(options);
19
25
  * // load dicom data
20
26
  * app.loadURLs([
21
27
  * 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
@@ -153,33 +159,22 @@ export declare class App {
153
159
  *
154
160
  * @param {object} cmd The command to add.
155
161
  * @fires UndoStack#undoadd
162
+ * @function
156
163
  */
157
164
  addToUndoStack: (cmd: object) => void;
158
165
  /**
159
166
  * Initialise the application.
160
167
  *
161
- * @param {object} opt The application option with:
162
- * - `dataViewConfigs`: data indexed object containing the data view
163
- * configurations in the form of a list of objects containing:
164
- * - divId: the HTML div id
165
- * - orientation: optional 'axial', 'coronal' or 'sagittal' orientation
166
- * string (default undefined keeps the original slice order)
167
- * - `binders`: array of layerGroup binders
168
- * - `tools`: tool name indexed object containing individual tool
169
- * configurations in the form of a list of objects containing:
170
- * - options: array of tool options
171
- * - `viewOnFirstLoadItem`: boolean flag to trigger the first data render
172
- * after the first loaded data or not
173
- * - `defaultCharacterSet`: the default chraracter set string used for DICOM
174
- * parsing
168
+ * @param {AppOptions} opt The application options
175
169
  * @example
176
170
  * // create the dwv app
177
171
  * const app = new dwv.App();
178
172
  * // initialise
179
- * app.init({
180
- * dataViewConfigs: {'*': [{divId: 'layerGroup0'}]},
181
- * viewOnFirstLoadItem: false
182
- * });
173
+ * const viewConfig0 = new ViewConfig('layerGroup0');
174
+ * const viewConfigs = {'*': [viewConfig0]};
175
+ * const options = new AppOptions(viewConfigs);
176
+ * options.viewOnFirstLoadItem = false;
177
+ * app.init(options);
183
178
  * // render button
184
179
  * const button = document.createElement('button');
185
180
  * button.id = 'render';
@@ -199,7 +194,7 @@ export declare class App {
199
194
  * 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
200
195
  * ]);
201
196
  */
202
- init(opt: object): void;
197
+ init(opt: AppOptions): void;
203
198
  /**
204
199
  * Reset the application.
205
200
  */
@@ -212,34 +207,35 @@ export declare class App {
212
207
  * Add an event listener to this class.
213
208
  *
214
209
  * @param {string} type The event type.
215
- * @param {object} callback The method associated with the provided
210
+ * @param {Function} callback The function associated with the provided
216
211
  * event type, will be called with the fired event.
217
212
  */
218
- addEventListener(type: string, callback: object): void;
213
+ addEventListener(type: string, callback: Function): void;
219
214
  /**
220
215
  * Remove an event listener from this class.
221
216
  *
222
217
  * @param {string} type The event type.
223
- * @param {object} callback The method associated with the provided
218
+ * @param {Function} callback The function associated with the provided
224
219
  * event type.
225
220
  */
226
- removeEventListener(type: string, callback: object): void;
221
+ removeEventListener(type: string, callback: Function): void;
227
222
  /**
228
223
  * Load a list of files. Can be image files or a state file.
229
224
  *
230
- * @param {FileList} files The list of files to load.
225
+ * @param {File[]} files The list of files to load.
231
226
  * @fires App#loadstart
232
227
  * @fires App#loadprogress
233
228
  * @fires App#loaditem
234
229
  * @fires App#loadend
235
230
  * @fires App#loaderror
236
231
  * @fires App#loadabort
232
+ * @function
237
233
  */
238
- loadFiles: (files: FileList) => void;
234
+ loadFiles: (files: File[]) => void;
239
235
  /**
240
236
  * Load a list of URLs. Can be image files or a state file.
241
237
  *
242
- * @param {Array} urls The list of urls to load.
238
+ * @param {string[]} urls The list of urls to load.
243
239
  * @param {object} [options] The options object, can contain:
244
240
  * - requestHeaders: an array of {name, value} to use as request headers
245
241
  * - withCredentials: boolean xhr.withCredentials flag to pass to the request
@@ -250,13 +246,15 @@ export declare class App {
250
246
  * @fires App#loadend
251
247
  * @fires App#loaderror
252
248
  * @fires App#loadabort
249
+ * @function
253
250
  */
254
- loadURLs: (urls: any[], options?: object) => void;
251
+ loadURLs: (urls: string[], options?: object) => void;
255
252
  /**
256
253
  * Load from an input uri.
257
254
  *
258
255
  * @param {string} uri The input uri, for example: 'window.location.href'.
259
256
  * @param {object} [options] Optional url request options.
257
+ * @function
260
258
  */
261
259
  loadFromUri: (uri: string, options?: object) => void;
262
260
  /**
@@ -270,6 +268,7 @@ export declare class App {
270
268
  * @fires App#loadend
271
269
  * @fires App#loaderror
272
270
  * @fires App#loadabort
271
+ * @function
273
272
  */
274
273
  loadImageObject: (data: any[]) => void;
275
274
  /**
@@ -289,15 +288,20 @@ export declare class App {
289
288
  * Get the data view config.
290
289
  * Carefull, returns a reference, do not modify without resetting.
291
290
  *
292
- * @returns {object} The configuration list.
291
+ * @returns {Object<string, ViewConfig[]>} The configuration list.
293
292
  */
294
- getDataViewConfig(): object;
293
+ getDataViewConfigs(): {
294
+ [x: string]: ViewConfig[];
295
+ };
295
296
  /**
296
- * Set the data view configuration (see the init options for details).
297
+ * Set the data view configuration.
298
+ * Resets the stage and recreates all the views.
297
299
  *
298
- * @param {object} configs The configuration list.
300
+ * @param {Object<string, ViewConfig[]>} configs The configuration list.
299
301
  */
300
- setDataViewConfig(configs: object): void;
302
+ setDataViewConfigs(configs: {
303
+ [x: string]: ViewConfig[];
304
+ }): void;
301
305
  /**
302
306
  * Set the layer groups binders.
303
307
  *
@@ -354,6 +358,8 @@ export declare class App {
354
358
  * Handle resize: fit the display to the window.
355
359
  * To be called once the image is loaded.
356
360
  * Can be connected to a window 'resize' event.
361
+ *
362
+ * @function
357
363
  */
358
364
  onResize: () => void;
359
365
  /**
@@ -361,6 +367,7 @@ export declare class App {
361
367
  *
362
368
  * @param {KeyboardEvent} event The key down event.
363
369
  * @fires App#keydown
370
+ * @function
364
371
  */
365
372
  onKeydown: (event: KeyboardEvent) => void;
366
373
  /**
@@ -375,6 +382,7 @@ export declare class App {
375
382
  * @param {KeyboardEvent} event The key down event.
376
383
  * @fires UndoStack#undo
377
384
  * @fires UndoStack#redo
385
+ * @function
378
386
  */
379
387
  defaultOnKeydown: (event: KeyboardEvent) => void;
380
388
  /**
@@ -388,9 +396,9 @@ export declare class App {
388
396
  /**
389
397
  * Set the colour map.
390
398
  *
391
- * @param {string} colourMap The colour map name.
399
+ * @param {string} name The colour map name.
392
400
  */
393
- setColourMap(colourMap: string): void;
401
+ setColourMap(name: string): void;
394
402
  /**
395
403
  * Set the window/level preset.
396
404
  *
@@ -436,6 +444,56 @@ export declare class App {
436
444
  #private;
437
445
  }
438
446
 
447
+ /**
448
+ * Application options.
449
+ */
450
+ export declare class AppOptions {
451
+ /**
452
+ * @param {Object<string, ViewConfig[]>} dataViewConfigs DataId
453
+ * indexed object containing the data view configurations.
454
+ */
455
+ constructor(dataViewConfigs: {
456
+ [x: string]: ViewConfig[];
457
+ });
458
+ /**
459
+ * DataId indexed object containing the data view configurations.
460
+ *
461
+ * @type {Object<string, ViewConfig[]>}
462
+ */
463
+ dataViewConfigs: {
464
+ [x: string]: ViewConfig[];
465
+ };
466
+ /**
467
+ * Tool name indexed object containing individual tool configurations.
468
+ *
469
+ * @type {Object<string, ToolConfig>}
470
+ */
471
+ tools: {
472
+ [x: string]: ToolConfig;
473
+ };
474
+ /**
475
+ * Optional array of layerGroup binder names.
476
+ *
477
+ * @type {string[]|undefined}
478
+ */
479
+ binders: string[] | undefined;
480
+ /**
481
+ * Optional boolean flag to trigger the first data render
482
+ * after the first loaded data or not. Defaults to true;
483
+ *
484
+ * @type {boolean|undefined}
485
+ */
486
+ viewOnFirstLoadItem: boolean | undefined;
487
+ /**
488
+ * Optional default chraracter set string used for DICOM parsing if
489
+ * not passed in DICOM file.
490
+ * Valid values: https://developer.mozilla.org/en-US/docs/Web/API/Encoding_API/Encodings
491
+ *
492
+ * @type {string|undefined}
493
+ */
494
+ defaultCharacterSet: string | undefined;
495
+ }
496
+
439
497
  /**
440
498
  * Build a multipart message.
441
499
  * See: https://en.wikipedia.org/wiki/MIME#Multipart_messages
@@ -448,6 +506,31 @@ export declare class App {
448
506
  */
449
507
  export declare function buildMultipart(parts: any[], boundary: string): Uint8Array;
450
508
 
509
+ /**
510
+ * Colour map: red, green and blue components
511
+ * to associate with intensity values.
512
+ */
513
+ export declare class ColourMap {
514
+ /**
515
+ * Red component: 256 values in the [0, 255] range.
516
+ *
517
+ * @type {number[]}
518
+ */
519
+ red: number[];
520
+ /**
521
+ * Green component: 256 values in the [0, 255] range.
522
+ *
523
+ * @type {number[]}
524
+ */
525
+ green: number[];
526
+ /**
527
+ * Blue component: 256 values in the [0, 255] range.
528
+ *
529
+ * @type {number[]}
530
+ */
531
+ blue: number[];
532
+ }
533
+
451
534
  /**
452
535
  * Create an Image from DICOM elements.
453
536
  *
@@ -483,6 +566,64 @@ export declare namespace customUI {
483
566
  export function openRoiDialog(data: any, callback: Function): void;
484
567
  }
485
568
 
569
+ /**
570
+ * DICOM data element.
571
+ */
572
+ export declare class DataElement {
573
+ /**
574
+ * @param {string} vr The element VR (Value Representation).
575
+ */
576
+ constructor(vr: string);
577
+ /**
578
+ * The element Value Representation.
579
+ *
580
+ * @type {string}
581
+ */
582
+ vr: string;
583
+ /**
584
+ * The element value.
585
+ *
586
+ * @type {Array}
587
+ */
588
+ value: any[];
589
+ /**
590
+ * The element dicom tag.
591
+ *
592
+ * @type {Tag}
593
+ */
594
+ tag: Tag;
595
+ /**
596
+ * The element Value Length.
597
+ *
598
+ * @type {number}
599
+ */
600
+ vl: number;
601
+ /**
602
+ * Flag to know if defined or undefined sequence length.
603
+ *
604
+ * @type {boolean}
605
+ */
606
+ undefinedLength: boolean;
607
+ /**
608
+ * The element start offset.
609
+ *
610
+ * @type {number}
611
+ */
612
+ startOffset: number;
613
+ /**
614
+ * The element end offset.
615
+ *
616
+ * @type {number}
617
+ */
618
+ endOffset: number;
619
+ /**
620
+ * The sequence items.
621
+ *
622
+ * @type {Array}
623
+ */
624
+ items: any[];
625
+ }
626
+
486
627
  /**
487
628
  * Decoder scripts to be passed to web workers for image decoding.
488
629
  */
@@ -553,14 +694,16 @@ export declare class DicomParser {
553
694
  */
554
695
  setDecoderCharacterSet(characterSet: string): void;
555
696
  /**
556
- * Get the raw DICOM data elements.
697
+ * Get the DICOM data elements.
557
698
  *
558
- * @returns {object} The raw DICOM elements.
699
+ * @returns {Object<string, DataElement>} The data elements.
559
700
  */
560
- getDicomElements(): object;
701
+ getDicomElements(): {
702
+ [x: string]: DataElement;
703
+ };
561
704
  /**
562
705
  * Parse the complete DICOM file (given as input to the class).
563
- * Fills in the member object 'dicomElements'.
706
+ * Fills in the member object 'dataElements'.
564
707
  *
565
708
  * @param {ArrayBuffer} buffer The input array buffer.
566
709
  */
@@ -571,16 +714,27 @@ export declare class DicomParser {
571
714
  /**
572
715
  * DICOM writer.
573
716
  *
574
- * Example usage:
717
+ * @example
718
+ * // XMLHttpRequest onload callback
719
+ * const onload = function (event) {
575
720
  * const parser = new DicomParser();
576
- * parser.parse(this.response);
577
- *
721
+ * parser.parse(event.target.response);
722
+ * // create writer with parser data elements
578
723
  * const writer = new DicomWriter(parser.getDicomElements());
724
+ * // create modified buffer and put it in a Blol
579
725
  * const blob = new Blob([writer.getBuffer()], {type: 'application/dicom'});
580
- *
726
+ * // example download link
581
727
  * const element = document.getElementById("download");
582
728
  * element.href = URL.createObjectURL(blob);
583
729
  * element.download = "anonym.dcm";
730
+ * };
731
+ * // DICOM file request
732
+ * const request = new XMLHttpRequest();
733
+ * const url = 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm';
734
+ * request.open('GET', url);
735
+ * request.responseType = 'arraybuffer';
736
+ * request.onload = onload;
737
+ * request.send();
584
738
  */
585
739
  export declare class DicomWriter {
586
740
  /**
@@ -591,10 +745,16 @@ export declare class DicomWriter {
591
745
  setUseUnVrForPrivateSq(flag: boolean): void;
592
746
  /**
593
747
  * Set the writing rules.
748
+ * List of writer rules indexed by either `default`, tagName or groupName.
749
+ * Each DICOM element will be checked to see if a rule is applicable.
750
+ * First checked by tagName and then by groupName,
751
+ * if nothing is found the default rule is applied.
594
752
  *
595
- * @param {object} rules The input rules.
753
+ * @param {Object<string, WriterRule>} rules The input rules.
596
754
  */
597
- setRules(rules: object): void;
755
+ setRules(rules: {
756
+ [x: string]: WriterRule;
757
+ }): void;
598
758
  /**
599
759
  * Use a TextEncoder instead of the default text decoder.
600
760
  */
@@ -603,13 +763,23 @@ export declare class DicomWriter {
603
763
  * Use default anonymisation rules.
604
764
  */
605
765
  useDefaultAnonymisationRules(): void;
766
+ /**
767
+ * Get the element to write according to the class rules.
768
+ * Priority order: tagName, groupName, default.
769
+ *
770
+ * @param {DataElement} element The element to check
771
+ * @returns {DataElement|null} The element to write, can be null.
772
+ */
773
+ getElementToWrite(element: DataElement): DataElement | null;
606
774
  /**
607
775
  * Get the ArrayBuffer corresponding to input DICOM elements.
608
776
  *
609
- * @param {Array} dicomElements The wrapped elements to write.
777
+ * @param {Object<string, DataElement>} dataElements The elements to write.
610
778
  * @returns {ArrayBuffer} The elements as a buffer.
611
779
  */
612
- getBuffer(dicomElements: any[]): ArrayBuffer;
780
+ getBuffer(dataElements: {
781
+ [x: string]: DataElement;
782
+ }): ArrayBuffer;
613
783
  #private;
614
784
  }
615
785
 
@@ -787,18 +957,18 @@ export declare class DrawLayer {
787
957
  * Add an event listener to this class.
788
958
  *
789
959
  * @param {string} type The event type.
790
- * @param {object} callback The method associated with the provided
960
+ * @param {Function} callback The function associated with the provided
791
961
  * event type, will be called with the fired event.
792
962
  */
793
- addEventListener(type: string, callback: object): void;
963
+ addEventListener(type: string, callback: Function): void;
794
964
  /**
795
965
  * Remove an event listener from this class.
796
966
  *
797
967
  * @param {string} type The event type.
798
- * @param {object} callback The method associated with the provided
968
+ * @param {Function} callback The function associated with the provided
799
969
  * event type.
800
970
  */
801
- removeEventListener(type: string, callback: object): void;
971
+ removeEventListener(type: string, callback: Function): void;
802
972
  #private;
803
973
  }
804
974
 
@@ -984,6 +1154,12 @@ export declare class Geometry {
984
1154
  #private;
985
1155
  }
986
1156
 
1157
+ /**
1158
+ * List of DICOM data elements indexed via a 8 character string formed from
1159
+ * the group and element numbers.
1160
+ *
1161
+ * @typedef {Object<string, DataElement>} DataElements
1162
+ */
987
1163
  /**
988
1164
  * Get the version of the library.
989
1165
  *
@@ -992,15 +1168,20 @@ export declare class Geometry {
992
1168
  export declare function getDwvVersion(): string;
993
1169
 
994
1170
  /**
995
- * Get the DICOM elements from a DICOM json tags object.
1171
+ * Get the DICOM elements from a 'simple' DICOM json tags object.
996
1172
  * The json is a simplified version of the oficial DICOM json with
997
1173
  * tag names instead of keys and direct values (no value property) for
998
- * simple tags.
1174
+ * simple tags. See synthetic test data (in tests/dicom) for examples.
999
1175
  *
1000
- * @param {object} jsonTags The DICOM json tags object.
1001
- * @returns {object} The DICOM elements.
1176
+ * @param {Object<string, any>} jsonTags The DICOM
1177
+ * json tags object.
1178
+ * @returns {Object<string, DataElement>} The DICOM elements.
1002
1179
  */
1003
- export declare function getElementsFromJSONTags(jsonTags: object): object;
1180
+ export declare function getElementsFromJSONTags(jsonTags: {
1181
+ [x: string]: any;
1182
+ }): {
1183
+ [x: string]: DataElement;
1184
+ };
1004
1185
 
1005
1186
  /**
1006
1187
  * Get the name of an image orientation patient.
@@ -1058,6 +1239,16 @@ export declare function getTypedArray(bitsAllocated: number, pixelRepresentation
1058
1239
  */
1059
1240
  export declare function getUID(tagName: string): string;
1060
1241
 
1242
+ /**
1243
+ * Check that an input buffer includes the DICOM prefix 'DICM'
1244
+ * after the 128 bytes preamble.
1245
+ * Ref: [DICOM File Meta]{@link https://dicom.nema.org/dicom/2013/output/chtml/part10/chapter_7.html#sect_7.1}
1246
+ *
1247
+ * @param {ArrayBuffer} buffer The buffer to check.
1248
+ * @returns {boolean} True if the buffer includes the prefix.
1249
+ */
1250
+ export declare function hasDicomPrefix(buffer: ArrayBuffer): boolean;
1251
+
1061
1252
  export declare namespace i18n {
1062
1253
  /**
1063
1254
  * Get the translated text.
@@ -1082,7 +1273,7 @@ export declare namespace i18n {
1082
1273
  * const dicomParser = new dwv.DicomParser();
1083
1274
  * dicomParser.parse(event.target.response);
1084
1275
  * // create the image object
1085
- * const image = createImage(dicomParser.getDicomElements());
1276
+ * const image = dwv.createImage(dicomParser.getDicomElements());
1086
1277
  * // result div
1087
1278
  * const div = document.getElementById('dwv');
1088
1279
  * // display the image size
@@ -1301,18 +1492,18 @@ declare class Image_2 {
1301
1492
  * Add an event listener to this class.
1302
1493
  *
1303
1494
  * @param {string} type The event type.
1304
- * @param {object} callback The method associated with the provided
1495
+ * @param {Function} callback The function associated with the provided
1305
1496
  * event type, will be called with the fired event.
1306
1497
  */
1307
- addEventListener(type: string, callback: object): void;
1498
+ addEventListener(type: string, callback: Function): void;
1308
1499
  /**
1309
1500
  * Remove an event listener from this class.
1310
1501
  *
1311
1502
  * @param {string} type The event type.
1312
- * @param {object} callback The method associated with the provided
1503
+ * @param {Function} callback The function associated with the provided
1313
1504
  * event type.
1314
1505
  */
1315
- removeEventListener(type: string, callback: object): void;
1506
+ removeEventListener(type: string, callback: Function): void;
1316
1507
  /**
1317
1508
  * Set the inner buffer values at given offsets.
1318
1509
  *
@@ -1454,9 +1645,9 @@ export { Image_2 as Image }
1454
1645
  */
1455
1646
  export declare class Index {
1456
1647
  /**
1457
- * @param {Array} values The index values.
1648
+ * @param {number[]} values The index values.
1458
1649
  */
1459
- constructor(values: any[]);
1650
+ constructor(values: number[]);
1460
1651
  /**
1461
1652
  * Get the index value at the given array index.
1462
1653
  *
@@ -1479,9 +1670,9 @@ export declare class Index {
1479
1670
  /**
1480
1671
  * Get the values of this index.
1481
1672
  *
1482
- * @returns {Array} The array of values.
1673
+ * @returns {number[]} The array of values.
1483
1674
  */
1484
- getValues(): any[];
1675
+ getValues(): number[];
1485
1676
  /**
1486
1677
  * Check if the input index can be compared to this one.
1487
1678
  *
@@ -1500,9 +1691,9 @@ export declare class Index {
1500
1691
  * Compare indices and return different dimensions.
1501
1692
  *
1502
1693
  * @param {Index} rhs The index to compare to.
1503
- * @returns {Array} The list of different dimensions.
1694
+ * @returns {number[]} The list of different dimensions.
1504
1695
  */
1505
- compare(rhs: Index): any[];
1696
+ compare(rhs: Index): number[];
1506
1697
  /**
1507
1698
  * Add another index to this one.
1508
1699
  *
@@ -1521,10 +1712,10 @@ export declare class Index {
1521
1712
  /**
1522
1713
  * Get a string id from the index values in the form of: '#0-1_#1-2'.
1523
1714
  *
1524
- * @param {Array} [dims] Optional list of dimensions to use.
1715
+ * @param {number[]} [dims] Optional list of dimensions to use.
1525
1716
  * @returns {string} The string id.
1526
1717
  */
1527
- toStringId(dims?: any[]): string;
1718
+ toStringId(dims?: number[]): string;
1528
1719
  #private;
1529
1720
  }
1530
1721
 
@@ -1692,6 +1883,7 @@ export declare class LayerGroup {
1692
1883
  * Update layers (but not the active view layer) to a position change.
1693
1884
  *
1694
1885
  * @param {object} event The position change event.
1886
+ * @function
1695
1887
  */
1696
1888
  updateLayersToPositionChange: (event: object) => void;
1697
1889
  /**
@@ -1762,18 +1954,18 @@ export declare class LayerGroup {
1762
1954
  * Add an event listener to this class.
1763
1955
  *
1764
1956
  * @param {string} type The event type.
1765
- * @param {object} callback The method associated with the provided
1957
+ * @param {Function} callback The function associated with the provided
1766
1958
  * event type, will be called with the fired event.
1767
1959
  */
1768
- addEventListener(type: string, callback: object): void;
1960
+ addEventListener(type: string, callback: Function): void;
1769
1961
  /**
1770
1962
  * Remove an event listener from this class.
1771
1963
  *
1772
1964
  * @param {string} type The event type.
1773
- * @param {object} callback The method associated with the provided
1965
+ * @param {Function} callback The function associated with the provided
1774
1966
  * event type.
1775
1967
  */
1776
- removeEventListener(type: string, callback: object): void;
1968
+ removeEventListener(type: string, callback: Function): void;
1777
1969
  #private;
1778
1970
  }
1779
1971
 
@@ -1796,14 +1988,10 @@ export declare namespace logger {
1796
1988
  /**
1797
1989
  * List of available lookup tables (lut).
1798
1990
  *
1799
- * @type {Object<string, {red: number[], green: number[], blue: number[]}>}
1991
+ * @type {Object<string, ColourMap>}
1800
1992
  */
1801
- export declare const lut: {
1802
- [x: string]: {
1803
- red: number[];
1804
- green: number[];
1805
- blue: number[];
1806
- };
1993
+ export declare const luts: {
1994
+ [x: string]: ColourMap;
1807
1995
  };
1808
1996
 
1809
1997
  /**
@@ -1921,9 +2109,9 @@ export declare class Matrix33 {
1921
2109
  */
1922
2110
  export declare class Point {
1923
2111
  /**
1924
- * @param {Array} values The point values.
2112
+ * @param {number[]} values The point values.
1925
2113
  */
1926
- constructor(values: any[]);
2114
+ constructor(values: number[]);
1927
2115
  /**
1928
2116
  * Get the index value at the given array index.
1929
2117
  *
@@ -1946,9 +2134,9 @@ export declare class Point {
1946
2134
  /**
1947
2135
  * Get the values of this index.
1948
2136
  *
1949
- * @returns {Array} The array of values.
2137
+ * @returns {number[]} The array of values.
1950
2138
  */
1951
- getValues(): any[];
2139
+ getValues(): number[];
1952
2140
  /**
1953
2141
  * Check if the input point can be compared to this one.
1954
2142
  *
@@ -1967,9 +2155,9 @@ export declare class Point {
1967
2155
  * Compare points and return different dimensions.
1968
2156
  *
1969
2157
  * @param {Point} rhs The point to compare to.
1970
- * @returns {Array} The list of different dimensions.
2158
+ * @returns {number[]} The list of different dimensions.
1971
2159
  */
1972
- compare(rhs: Point): any[];
2160
+ compare(rhs: Point): number[];
1973
2161
  /**
1974
2162
  * Get the 3D part of this point.
1975
2163
  *
@@ -2470,10 +2658,30 @@ export declare class TagValueExtractor {
2470
2658
  /**
2471
2659
  * Get the time.
2472
2660
  *
2473
- * @param {object} _elements The DICOM elements.
2661
+ * @param {Object<string, DataElement>} _elements The DICOM elements.
2474
2662
  * @returns {number|undefined} The time value if available.
2475
2663
  */
2476
- getTime(_elements: object): number | undefined;
2664
+ getTime(_elements: {
2665
+ [x: string]: DataElement;
2666
+ }): number | undefined;
2667
+ }
2668
+
2669
+ /**
2670
+ * Tool configuration.
2671
+ */
2672
+ export declare class ToolConfig {
2673
+ /**
2674
+ * @param {string[]} [options] Optional tool options.
2675
+ */
2676
+ constructor(options?: string[]);
2677
+ /**
2678
+ * Optional tool options.
2679
+ * For Draw: list of shape names.
2680
+ * For Filter: list of filter names.
2681
+ *
2682
+ * @type {string[]|undefined}
2683
+ */
2684
+ options: string[] | undefined;
2477
2685
  }
2478
2686
 
2479
2687
  /**
@@ -2507,10 +2715,10 @@ export declare class Vector3D {
2507
2715
  /**
2508
2716
  * Check for Vector3D equality.
2509
2717
  *
2510
- * @param {object} rhs The other vector to compare to.
2718
+ * @param {Vector3D} rhs The other vector to compare to.
2511
2719
  * @returns {boolean} True if both vectors are equal.
2512
2720
  */
2513
- equals(rhs: object): boolean;
2721
+ equals(rhs: Vector3D): boolean;
2514
2722
  /**
2515
2723
  * Get a string representation of the Vector3D.
2516
2724
  *
@@ -2681,9 +2889,9 @@ export declare class View {
2681
2889
  /**
2682
2890
  * Set the default colour map.
2683
2891
  *
2684
- * @param {object} map The colour map.
2892
+ * @param {ColourMap} map The colour map.
2685
2893
  */
2686
- setDefaultColourMap(map: object): void;
2894
+ setDefaultColourMap(map: ColourMap): void;
2687
2895
  /**
2688
2896
  * Add window presets to the existing ones.
2689
2897
  *
@@ -2693,16 +2901,16 @@ export declare class View {
2693
2901
  /**
2694
2902
  * Get the colour map of the image.
2695
2903
  *
2696
- * @returns {object} The colour map of the image.
2904
+ * @returns {ColourMap} The colour map of the image.
2697
2905
  */
2698
- getColourMap(): object;
2906
+ getColourMap(): ColourMap;
2699
2907
  /**
2700
2908
  * Set the colour map of the image.
2701
2909
  *
2702
- * @param {object} map The colour map of the image.
2910
+ * @param {ColourMap} map The colour map of the image.
2703
2911
  * @fires View#colourchange
2704
2912
  */
2705
- setColourMap(map: object): void;
2913
+ setColourMap(map: ColourMap): void;
2706
2914
  /**
2707
2915
  * Get the current position.
2708
2916
  *
@@ -2776,18 +2984,18 @@ export declare class View {
2776
2984
  * Add an event listener to this class.
2777
2985
  *
2778
2986
  * @param {string} type The event type.
2779
- * @param {object} callback The method associated with the provided
2987
+ * @param {Function} callback The function associated with the provided
2780
2988
  * event type, will be called with the fired event.
2781
2989
  */
2782
- addEventListener(type: string, callback: object): void;
2990
+ addEventListener(type: string, callback: Function): void;
2783
2991
  /**
2784
2992
  * Remove an event listener from this class.
2785
2993
  *
2786
2994
  * @param {string} type The event type.
2787
- * @param {object} callback The method associated with the provided
2995
+ * @param {Function} callback The function associated with the provided
2788
2996
  * event type.
2789
2997
  */
2790
- removeEventListener(type: string, callback: object): void;
2998
+ removeEventListener(type: string, callback: Function): void;
2791
2999
  /**
2792
3000
  * Get the image window/level that covers the full data range.
2793
3001
  * Warning: uses the latest set rescale LUT or the default linear one.
@@ -2847,6 +3055,42 @@ export declare class View {
2847
3055
  #private;
2848
3056
  }
2849
3057
 
3058
+ /**
3059
+ * View configuration: mainly defines the ´divId´
3060
+ * of the associated HTML div.
3061
+ */
3062
+ export declare class ViewConfig {
3063
+ /**
3064
+ * @param {string} divId The associated HTML div id.
3065
+ */
3066
+ constructor(divId: string);
3067
+ /**
3068
+ * Associated HTML div id.
3069
+ *
3070
+ * @type {string}
3071
+ */
3072
+ divId: string;
3073
+ /**
3074
+ * Optional orientation of the data; 'axial', 'coronal' or 'sagittal'.
3075
+ * If undefined, will use the data aquisition plane.
3076
+ *
3077
+ * @type {string|undefined}
3078
+ */
3079
+ orientation: string | undefined;
3080
+ /**
3081
+ * Optional view colour map.
3082
+ *
3083
+ * @type {ColourMap|undefined}
3084
+ */
3085
+ colourMap: ColourMap | undefined;
3086
+ /**
3087
+ * Optional layer opacity; in [0, 1] range.
3088
+ *
3089
+ * @type {number|undefined}
3090
+ */
3091
+ opacity: number | undefined;
3092
+ }
3093
+
2850
3094
  /**
2851
3095
  * View controller.
2852
3096
  */
@@ -3166,15 +3410,15 @@ export declare class ViewController {
3166
3410
  /**
3167
3411
  * Get the colour map.
3168
3412
  *
3169
- * @returns {object} The colour map.
3413
+ * @returns {ColourMap} The colour map.
3170
3414
  */
3171
- getColourMap(): object;
3415
+ getColourMap(): ColourMap;
3172
3416
  /**
3173
3417
  * Set the colour map.
3174
3418
  *
3175
- * @param {object} colourMap The colour map.
3419
+ * @param {ColourMap} colourMap The colour map.
3176
3420
  */
3177
- setColourMap(colourMap: object): void;
3421
+ setColourMap(colourMap: ColourMap): void;
3178
3422
  /**
3179
3423
  * @callback alphaFn@callback alphaFn
3180
3424
  * @param {object} value The pixel value.
@@ -3197,18 +3441,18 @@ export declare class ViewController {
3197
3441
  * Add an event listener to this class.
3198
3442
  *
3199
3443
  * @param {string} type The event type.
3200
- * @param {object} callback The method associated with the provided
3444
+ * @param {Function} callback The function associated with the provided
3201
3445
  * event type, will be called with the fired event.
3202
3446
  */
3203
- addEventListener(type: string, callback: object): void;
3447
+ addEventListener(type: string, callback: Function): void;
3204
3448
  /**
3205
3449
  * Remove an event listener from this class.
3206
3450
  *
3207
3451
  * @param {string} type The event type.
3208
- * @param {object} callback The method associated with the provided
3452
+ * @param {Function} callback The function associated with the provided
3209
3453
  * event type.
3210
3454
  */
3211
- removeEventListener(type: string, callback: object): void;
3455
+ removeEventListener(type: string, callback: Function): void;
3212
3456
  #private;
3213
3457
  }
3214
3458
 
@@ -3256,12 +3500,14 @@ export declare class ViewLayer {
3256
3500
  * Handle an image set event.
3257
3501
  *
3258
3502
  * @param {object} event The event.
3503
+ * @function
3259
3504
  */
3260
3505
  onimageset: (event: object) => void;
3261
3506
  /**
3262
3507
  * Handle an image change event.
3263
3508
  *
3264
3509
  * @param {object} event The event.
3510
+ * @function
3265
3511
  */
3266
3512
  onimagechange: (event: object) => void;
3267
3513
  /**
@@ -3411,18 +3657,18 @@ export declare class ViewLayer {
3411
3657
  * Add an event listener to this class.
3412
3658
  *
3413
3659
  * @param {string} type The event type.
3414
- * @param {object} callback The method associated with the provided
3660
+ * @param {Function} callback The function associated with the provided
3415
3661
  * event type, will be called with the fired event.
3416
3662
  */
3417
- addEventListener(type: string, callback: object): void;
3663
+ addEventListener(type: string, callback: Function): void;
3418
3664
  /**
3419
3665
  * Remove an event listener from this class.
3420
3666
  *
3421
3667
  * @param {string} type The event type.
3422
- * @param {object} callback The method associated with the provided
3668
+ * @param {Function} callback The function associated with the provided
3423
3669
  * event type.
3424
3670
  */
3425
- removeEventListener(type: string, callback: object): void;
3671
+ removeEventListener(type: string, callback: Function): void;
3426
3672
  /**
3427
3673
  * Set the current position.
3428
3674
  *
@@ -3567,4 +3813,22 @@ export declare class WindowLut {
3567
3813
  #private;
3568
3814
  }
3569
3815
 
3816
+ /**
3817
+ * Writer rule.
3818
+ */
3819
+ export declare class WriterRule {
3820
+ /**
3821
+ * Rule action: `copy`, `remove`, `clear` or `replace`.
3822
+ *
3823
+ * @type {string}
3824
+ */
3825
+ action: string;
3826
+ /**
3827
+ * Value to use for replace action.
3828
+ *
3829
+ * @type {any}
3830
+ */
3831
+ value: any;
3832
+ }
3833
+
3570
3834
  export { }