dwv 0.32.0 → 0.32.2-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
  *
@@ -153,25 +158,13 @@ export declare class App {
153
158
  *
154
159
  * @param {object} cmd The command to add.
155
160
  * @fires UndoStack#undoadd
161
+ * @function
156
162
  */
157
163
  addToUndoStack: (cmd: object) => void;
158
164
  /**
159
165
  * Initialise the application.
160
166
  *
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
167
+ * @param {AppOptions} opt The application options
175
168
  * @example
176
169
  * // create the dwv app
177
170
  * const app = new dwv.App();
@@ -199,7 +192,7 @@ export declare class App {
199
192
  * 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
200
193
  * ]);
201
194
  */
202
- init(opt: object): void;
195
+ init(opt: AppOptions): void;
203
196
  /**
204
197
  * Reset the application.
205
198
  */
@@ -227,19 +220,20 @@ export declare class App {
227
220
  /**
228
221
  * Load a list of files. Can be image files or a state file.
229
222
  *
230
- * @param {FileList} files The list of files to load.
223
+ * @param {File[]} files The list of files to load.
231
224
  * @fires App#loadstart
232
225
  * @fires App#loadprogress
233
226
  * @fires App#loaditem
234
227
  * @fires App#loadend
235
228
  * @fires App#loaderror
236
229
  * @fires App#loadabort
230
+ * @function
237
231
  */
238
- loadFiles: (files: FileList) => void;
232
+ loadFiles: (files: File[]) => void;
239
233
  /**
240
234
  * Load a list of URLs. Can be image files or a state file.
241
235
  *
242
- * @param {Array} urls The list of urls to load.
236
+ * @param {string[]} urls The list of urls to load.
243
237
  * @param {object} [options] The options object, can contain:
244
238
  * - requestHeaders: an array of {name, value} to use as request headers
245
239
  * - withCredentials: boolean xhr.withCredentials flag to pass to the request
@@ -250,13 +244,15 @@ export declare class App {
250
244
  * @fires App#loadend
251
245
  * @fires App#loaderror
252
246
  * @fires App#loadabort
247
+ * @function
253
248
  */
254
- loadURLs: (urls: any[], options?: object) => void;
249
+ loadURLs: (urls: string[], options?: object) => void;
255
250
  /**
256
251
  * Load from an input uri.
257
252
  *
258
253
  * @param {string} uri The input uri, for example: 'window.location.href'.
259
254
  * @param {object} [options] Optional url request options.
255
+ * @function
260
256
  */
261
257
  loadFromUri: (uri: string, options?: object) => void;
262
258
  /**
@@ -270,6 +266,7 @@ export declare class App {
270
266
  * @fires App#loadend
271
267
  * @fires App#loaderror
272
268
  * @fires App#loadabort
269
+ * @function
273
270
  */
274
271
  loadImageObject: (data: any[]) => void;
275
272
  /**
@@ -289,15 +286,20 @@ export declare class App {
289
286
  * Get the data view config.
290
287
  * Carefull, returns a reference, do not modify without resetting.
291
288
  *
292
- * @returns {object} The configuration list.
289
+ * @returns {Object<string, ViewConfig[]>} The configuration list.
293
290
  */
294
- getDataViewConfig(): object;
291
+ getDataViewConfigs(): {
292
+ [x: string]: ViewConfig[];
293
+ };
295
294
  /**
296
- * Set the data view configuration (see the init options for details).
295
+ * Set the data view configuration.
296
+ * Resets the stage and recreates all the views.
297
297
  *
298
- * @param {object} configs The configuration list.
298
+ * @param {Object<string, ViewConfig[]>} configs The configuration list.
299
299
  */
300
- setDataViewConfig(configs: object): void;
300
+ setDataViewConfigs(configs: {
301
+ [x: string]: ViewConfig[];
302
+ }): void;
301
303
  /**
302
304
  * Set the layer groups binders.
303
305
  *
@@ -341,13 +343,21 @@ export declare class App {
341
343
  /**
342
344
  * Get the JSON state of the app.
343
345
  *
344
- * @returns {object} The state of the app as a JSON object.
346
+ * @returns {string} The state of the app as a JSON string.
347
+ */
348
+ getJsonState(): string;
349
+ /**
350
+ * Apply a JSON state to this app.
351
+ *
352
+ * @param {string} jsonState The state of the app as a JSON string.
345
353
  */
346
- getState(): object;
354
+ applyJsonState(jsonState: string): void;
347
355
  /**
348
356
  * Handle resize: fit the display to the window.
349
357
  * To be called once the image is loaded.
350
358
  * Can be connected to a window 'resize' event.
359
+ *
360
+ * @function
351
361
  */
352
362
  onResize: () => void;
353
363
  /**
@@ -355,6 +365,7 @@ export declare class App {
355
365
  *
356
366
  * @param {KeyboardEvent} event The key down event.
357
367
  * @fires App#keydown
368
+ * @function
358
369
  */
359
370
  onKeydown: (event: KeyboardEvent) => void;
360
371
  /**
@@ -369,6 +380,7 @@ export declare class App {
369
380
  * @param {KeyboardEvent} event The key down event.
370
381
  * @fires UndoStack#undo
371
382
  * @fires UndoStack#redo
383
+ * @function
372
384
  */
373
385
  defaultOnKeydown: (event: KeyboardEvent) => void;
374
386
  /**
@@ -382,9 +394,9 @@ export declare class App {
382
394
  /**
383
395
  * Set the colour map.
384
396
  *
385
- * @param {string} colourMap The colour map name.
397
+ * @param {string} name The colour map name.
386
398
  */
387
- setColourMap(colourMap: string): void;
399
+ setColourMap(name: string): void;
388
400
  /**
389
401
  * Set the window/level preset.
390
402
  *
@@ -430,6 +442,51 @@ export declare class App {
430
442
  #private;
431
443
  }
432
444
 
445
+ /**
446
+ * Application options.
447
+ */
448
+ export declare class AppOptions {
449
+ /**
450
+ * DataId indexed object containing the data view configurations.
451
+ *
452
+ * @type {Object<string, ViewConfig[]>}
453
+ */
454
+ dataViewConfigs: {
455
+ [x: string]: ViewConfig[];
456
+ };
457
+ /**
458
+ * Tool name indexed object containing individual tool configurations.
459
+ *
460
+ * @type {Object<string, {options: string[]}>}
461
+ */
462
+ tools: {
463
+ [x: string]: {
464
+ options: string[];
465
+ };
466
+ };
467
+ /**
468
+ * Optional array of layerGroup binder names.
469
+ *
470
+ * @type {string[]|undefined}
471
+ */
472
+ binders: string[] | undefined;
473
+ /**
474
+ * Optional boolean flag to trigger the first data render
475
+ * after the first loaded data or not. Defaults to true;
476
+ *
477
+ * @type {boolean|undefined}
478
+ */
479
+ viewOnFirstLoadItem: boolean | undefined;
480
+ /**
481
+ * Optional default chraracter set string used for DICOM parsing if
482
+ * not passed in DICOM file.
483
+ * Valid values: https://developer.mozilla.org/en-US/docs/Web/API/Encoding_API/Encodings
484
+ *
485
+ * @type {string|undefined}
486
+ */
487
+ defaultCharacterSet: string | undefined;
488
+ }
489
+
433
490
  /**
434
491
  * Build a multipart message.
435
492
  * See: https://en.wikipedia.org/wiki/MIME#Multipart_messages
@@ -443,9 +500,122 @@ export declare class App {
443
500
  export declare function buildMultipart(parts: any[], boundary: string): Uint8Array;
444
501
 
445
502
  /**
446
- * Custom UI object for client defined UI.
503
+ * Colour map: red, green and blue components
504
+ * to associate with intensity values.
505
+ */
506
+ export declare class ColourMap {
507
+ /**
508
+ * Red component: 256 values in the [0, 255] range.
509
+ *
510
+ * @type {number[]}
511
+ */
512
+ red: number[];
513
+ /**
514
+ * Green component: 256 values in the [0, 255] range.
515
+ *
516
+ * @type {number[]}
517
+ */
518
+ green: number[];
519
+ /**
520
+ * Blue component: 256 values in the [0, 255] range.
521
+ *
522
+ * @type {number[]}
523
+ */
524
+ blue: number[];
525
+ }
526
+
527
+ /**
528
+ * Create an Image from DICOM elements.
529
+ *
530
+ * @param {object} elements The DICOM elements.
531
+ * @returns {Image} The Image object.
532
+ */
533
+ export declare function createImage(elements: object): Image_2;
534
+
535
+ /**
536
+ * Create a mask Image from DICOM elements.
537
+ *
538
+ * @param {object} elements The DICOM elements.
539
+ * @returns {Image} The mask Image object.
540
+ */
541
+ export declare function createMaskImage(elements: object): Image_2;
542
+
543
+ /**
544
+ * Create a View from DICOM elements and image.
545
+ *
546
+ * @param {object} elements The DICOM elements.
547
+ * @param {Image} image The associated image.
548
+ * @returns {View} The View object.
447
549
  */
448
- export declare const customUI: {};
550
+ export declare function createView(elements: object, image: Image_2): View;
551
+
552
+ export declare namespace customUI {
553
+ /**
554
+ * Open a dialogue to edit roi data. Defaults to window.prompt.
555
+ *
556
+ * @param {object} data The roi data.
557
+ * @param {Function} callback The callback to launch on dialogue exit.
558
+ */
559
+ export function openRoiDialog(data: any, callback: Function): void;
560
+ }
561
+
562
+ /**
563
+ * DICOM data element.
564
+ */
565
+ export declare class DataElement {
566
+ /**
567
+ * @param {string} vr The element VR (Value Representation).
568
+ */
569
+ constructor(vr: string);
570
+ /**
571
+ * The element Value Representation.
572
+ *
573
+ * @type {string}
574
+ */
575
+ vr: string;
576
+ /**
577
+ * The element value.
578
+ *
579
+ * @type {Array}
580
+ */
581
+ value: any[];
582
+ /**
583
+ * The element dicom tag.
584
+ *
585
+ * @type {Tag}
586
+ */
587
+ tag: Tag;
588
+ /**
589
+ * The element Value Length.
590
+ *
591
+ * @type {number}
592
+ */
593
+ vl: number;
594
+ /**
595
+ * Flag to know if defined or undefined sequence length.
596
+ *
597
+ * @type {boolean}
598
+ */
599
+ undefinedLength: boolean;
600
+ /**
601
+ * The element start offset.
602
+ *
603
+ * @type {number}
604
+ */
605
+ startOffset: number;
606
+ /**
607
+ * The element end offset.
608
+ *
609
+ * @type {number}
610
+ */
611
+ endOffset: number;
612
+ /**
613
+ * The sequence items.
614
+ *
615
+ * @type {Array}
616
+ */
617
+ items: any[];
618
+ }
449
619
 
450
620
  /**
451
621
  * Decoder scripts to be passed to web workers for image decoding.
@@ -517,14 +687,16 @@ export declare class DicomParser {
517
687
  */
518
688
  setDecoderCharacterSet(characterSet: string): void;
519
689
  /**
520
- * Get the raw DICOM data elements.
690
+ * Get the DICOM data elements.
521
691
  *
522
- * @returns {object} The raw DICOM elements.
692
+ * @returns {Object<string, DataElement>} The data elements.
523
693
  */
524
- getDicomElements(): object;
694
+ getDicomElements(): {
695
+ [x: string]: DataElement;
696
+ };
525
697
  /**
526
698
  * Parse the complete DICOM file (given as input to the class).
527
- * Fills in the member object 'dicomElements'.
699
+ * Fills in the member object 'dataElements'.
528
700
  *
529
701
  * @param {ArrayBuffer} buffer The input array buffer.
530
702
  */
@@ -535,16 +707,27 @@ export declare class DicomParser {
535
707
  /**
536
708
  * DICOM writer.
537
709
  *
538
- * Example usage:
710
+ * @example
711
+ * // XMLHttpRequest onload callback
712
+ * const onload = function (event) {
539
713
  * const parser = new DicomParser();
540
- * parser.parse(this.response);
541
- *
714
+ * parser.parse(event.target.response);
715
+ * // create writer with parser data elements
542
716
  * const writer = new DicomWriter(parser.getDicomElements());
717
+ * // create modified buffer and put it in a Blol
543
718
  * const blob = new Blob([writer.getBuffer()], {type: 'application/dicom'});
544
- *
719
+ * // example download link
545
720
  * const element = document.getElementById("download");
546
721
  * element.href = URL.createObjectURL(blob);
547
722
  * element.download = "anonym.dcm";
723
+ * };
724
+ * // DICOM file request
725
+ * const request = new XMLHttpRequest();
726
+ * const url = 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm';
727
+ * request.open('GET', url);
728
+ * request.responseType = 'arraybuffer';
729
+ * request.onload = onload;
730
+ * request.send();
548
731
  */
549
732
  export declare class DicomWriter {
550
733
  /**
@@ -555,10 +738,16 @@ export declare class DicomWriter {
555
738
  setUseUnVrForPrivateSq(flag: boolean): void;
556
739
  /**
557
740
  * Set the writing rules.
741
+ * List of writer rules indexed by either `default`, tagName or groupName.
742
+ * Each DICOM element will be checked to see if a rule is applicable.
743
+ * First checked by tagName and then by groupName,
744
+ * if nothing is found the default rule is applied.
558
745
  *
559
- * @param {object} rules The input rules.
746
+ * @param {Object<string, WriterRule>} rules The input rules.
560
747
  */
561
- setRules(rules: object): void;
748
+ setRules(rules: {
749
+ [x: string]: WriterRule;
750
+ }): void;
562
751
  /**
563
752
  * Use a TextEncoder instead of the default text decoder.
564
753
  */
@@ -567,13 +756,23 @@ export declare class DicomWriter {
567
756
  * Use default anonymisation rules.
568
757
  */
569
758
  useDefaultAnonymisationRules(): void;
759
+ /**
760
+ * Get the element to write according to the class rules.
761
+ * Priority order: tagName, groupName, default.
762
+ *
763
+ * @param {DataElement} element The element to check
764
+ * @returns {DataElement|null} The element to write, can be null.
765
+ */
766
+ getElementToWrite(element: DataElement): DataElement | null;
570
767
  /**
571
768
  * Get the ArrayBuffer corresponding to input DICOM elements.
572
769
  *
573
- * @param {Array} dicomElements The wrapped elements to write.
770
+ * @param {Object<string, DataElement>} dataElements The elements to write.
574
771
  * @returns {ArrayBuffer} The elements as a buffer.
575
772
  */
576
- getBuffer(dicomElements: any[]): ArrayBuffer;
773
+ getBuffer(dataElements: {
774
+ [x: string]: DataElement;
775
+ }): ArrayBuffer;
577
776
  #private;
578
777
  }
579
778
 
@@ -948,6 +1147,12 @@ export declare class Geometry {
948
1147
  #private;
949
1148
  }
950
1149
 
1150
+ /**
1151
+ * List of DICOM data elements indexed via a 8 character string formed from
1152
+ * the group and element numbers.
1153
+ *
1154
+ * @typedef {Object<string, DataElement>} DataElements
1155
+ */
951
1156
  /**
952
1157
  * Get the version of the library.
953
1158
  *
@@ -956,15 +1161,20 @@ export declare class Geometry {
956
1161
  export declare function getDwvVersion(): string;
957
1162
 
958
1163
  /**
959
- * Get the DICOM elements from a DICOM json tags object.
1164
+ * Get the DICOM elements from a 'simple' DICOM json tags object.
960
1165
  * The json is a simplified version of the oficial DICOM json with
961
1166
  * tag names instead of keys and direct values (no value property) for
962
- * simple tags.
1167
+ * simple tags. See synthetic test data (in tests/dicom) for examples.
963
1168
  *
964
- * @param {object} jsonTags The DICOM json tags object.
965
- * @returns {object} The DICOM elements.
1169
+ * @param {Object<string, any>} jsonTags The DICOM
1170
+ * json tags object.
1171
+ * @returns {Object<string, DataElement>} The DICOM elements.
966
1172
  */
967
- export declare function getElementsFromJSONTags(jsonTags: object): object;
1173
+ export declare function getElementsFromJSONTags(jsonTags: {
1174
+ [x: string]: any;
1175
+ }): {
1176
+ [x: string]: DataElement;
1177
+ };
968
1178
 
969
1179
  /**
970
1180
  * Get the name of an image orientation patient.
@@ -1022,6 +1232,16 @@ export declare function getTypedArray(bitsAllocated: number, pixelRepresentation
1022
1232
  */
1023
1233
  export declare function getUID(tagName: string): string;
1024
1234
 
1235
+ /**
1236
+ * Check that an input buffer includes the DICOM prefix 'DICM'
1237
+ * after the 128 bytes preamble.
1238
+ * Ref: [DICOM File Meta]{@link https://dicom.nema.org/dicom/2013/output/chtml/part10/chapter_7.html#sect_7.1}
1239
+ *
1240
+ * @param {ArrayBuffer} buffer The buffer to check.
1241
+ * @returns {boolean} True if the buffer includes the prefix.
1242
+ */
1243
+ export declare function hasDicomPrefix(buffer: ArrayBuffer): boolean;
1244
+
1025
1245
  export declare namespace i18n {
1026
1246
  /**
1027
1247
  * Get the translated text.
@@ -1042,17 +1262,11 @@ export declare namespace i18n {
1042
1262
  * @example
1043
1263
  * // XMLHttpRequest onload callback
1044
1264
  * const onload = function (event) {
1045
- * // setup the dicom parser
1265
+ * // parse the dicom buffer
1046
1266
  * const dicomParser = new dwv.DicomParser();
1047
- * // parse the buffer
1048
1267
  * dicomParser.parse(event.target.response);
1049
- * // create the image
1050
- * const imageFactory = new dwv.ImageFactory();
1051
- * // inputs are dicom tags and buffer
1052
- * const image = imageFactory.create(
1053
- * dicomParser.getDicomElements(),
1054
- * dicomParser.getDicomElements()['7FE00010'].value[0]
1055
- * );
1268
+ * // create the image object
1269
+ * const image = dwv.createImage(dicomParser.getDicomElements());
1056
1270
  * // result div
1057
1271
  * const div = document.getElementById('dwv');
1058
1272
  * // display the image size
@@ -1662,6 +1876,7 @@ export declare class LayerGroup {
1662
1876
  * Update layers (but not the active view layer) to a position change.
1663
1877
  *
1664
1878
  * @param {object} event The position change event.
1879
+ * @function
1665
1880
  */
1666
1881
  updateLayersToPositionChange: (event: object) => void;
1667
1882
  /**
@@ -1766,14 +1981,10 @@ export declare namespace logger {
1766
1981
  /**
1767
1982
  * List of available lookup tables (lut).
1768
1983
  *
1769
- * @type {Object<string, {red: number[], green: number[], blue: number[]}>}
1984
+ * @type {Object<string, ColourMap>}
1770
1985
  */
1771
- export declare const lut: {
1772
- [x: string]: {
1773
- red: number[];
1774
- green: number[];
1775
- blue: number[];
1776
- };
1986
+ export declare const luts: {
1987
+ [x: string]: ColourMap;
1777
1988
  };
1778
1989
 
1779
1990
  /**
@@ -2440,10 +2651,12 @@ export declare class TagValueExtractor {
2440
2651
  /**
2441
2652
  * Get the time.
2442
2653
  *
2443
- * @param {object} _elements The DICOM elements.
2654
+ * @param {Object<string, DataElement>} _elements The DICOM elements.
2444
2655
  * @returns {number|undefined} The time value if available.
2445
2656
  */
2446
- getTime(_elements: object): number | undefined;
2657
+ getTime(_elements: {
2658
+ [x: string]: DataElement;
2659
+ }): number | undefined;
2447
2660
  }
2448
2661
 
2449
2662
  /**
@@ -2477,10 +2690,10 @@ export declare class Vector3D {
2477
2690
  /**
2478
2691
  * Check for Vector3D equality.
2479
2692
  *
2480
- * @param {object} rhs The other vector to compare to.
2693
+ * @param {Vector3D} rhs The other vector to compare to.
2481
2694
  * @returns {boolean} True if both vectors are equal.
2482
2695
  */
2483
- equals(rhs: object): boolean;
2696
+ equals(rhs: Vector3D): boolean;
2484
2697
  /**
2485
2698
  * Get a string representation of the Vector3D.
2486
2699
  *
@@ -2519,6 +2732,37 @@ export declare class Vector3D {
2519
2732
  *
2520
2733
  * Need to set the window lookup table once created
2521
2734
  * (either directly or with helper methods).
2735
+ *
2736
+ * @example
2737
+ * // XMLHttpRequest onload callback
2738
+ * const onload = function (event) {
2739
+ * // parse the dicom buffer
2740
+ * const dicomParser = new dwv.DicomParser();
2741
+ * dicomParser.parse(event.target.response);
2742
+ * // create the image object
2743
+ * const image = createImage(dicomParser.getDicomElements());
2744
+ * // create the view
2745
+ * const view = createView(dicomParser.getDicomElements(), image);
2746
+ * // setup canvas
2747
+ * const canvas = document.createElement('canvas');
2748
+ * canvas.width = 256;
2749
+ * canvas.height = 256;
2750
+ * const ctx = canvas.getContext("2d");
2751
+ * // update the image data
2752
+ * const imageData = ctx.createImageData(256, 256);
2753
+ * view.generateImageData(imageData);
2754
+ * ctx.putImageData(imageData, 0, 0);
2755
+ * // update html
2756
+ * const div = document.getElementById('dwv');
2757
+ * div.appendChild(canvas);;
2758
+ * };
2759
+ * // DICOM file request
2760
+ * const request = new XMLHttpRequest();
2761
+ * const url = 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm';
2762
+ * request.open('GET', url);
2763
+ * request.responseType = 'arraybuffer';
2764
+ * request.onload = onload;
2765
+ * request.send();
2522
2766
  */
2523
2767
  export declare class View {
2524
2768
  /**
@@ -2620,9 +2864,9 @@ export declare class View {
2620
2864
  /**
2621
2865
  * Set the default colour map.
2622
2866
  *
2623
- * @param {object} map The colour map.
2867
+ * @param {ColourMap} map The colour map.
2624
2868
  */
2625
- setDefaultColourMap(map: object): void;
2869
+ setDefaultColourMap(map: ColourMap): void;
2626
2870
  /**
2627
2871
  * Add window presets to the existing ones.
2628
2872
  *
@@ -2632,16 +2876,16 @@ export declare class View {
2632
2876
  /**
2633
2877
  * Get the colour map of the image.
2634
2878
  *
2635
- * @returns {object} The colour map of the image.
2879
+ * @returns {ColourMap} The colour map of the image.
2636
2880
  */
2637
- getColourMap(): object;
2881
+ getColourMap(): ColourMap;
2638
2882
  /**
2639
2883
  * Set the colour map of the image.
2640
2884
  *
2641
- * @param {object} map The colour map of the image.
2885
+ * @param {ColourMap} map The colour map of the image.
2642
2886
  * @fires View#colourchange
2643
2887
  */
2644
- setColourMap(map: object): void;
2888
+ setColourMap(map: ColourMap): void;
2645
2889
  /**
2646
2890
  * Get the current position.
2647
2891
  *
@@ -2731,9 +2975,9 @@ export declare class View {
2731
2975
  * Get the image window/level that covers the full data range.
2732
2976
  * Warning: uses the latest set rescale LUT or the default linear one.
2733
2977
  *
2734
- * @returns {object} A min/max window level.
2978
+ * @returns {WindowCenterAndWidth} A min/max window level.
2735
2979
  */
2736
- getWindowLevelMinMax(): object;
2980
+ getWindowLevelMinMax(): WindowCenterAndWidth;
2737
2981
  /**
2738
2982
  * Set the image window/level to cover the full data range.
2739
2983
  * Warning: uses the latest set rescale LUT or the default linear one.
@@ -2786,6 +3030,38 @@ export declare class View {
2786
3030
  #private;
2787
3031
  }
2788
3032
 
3033
+ /**
3034
+ * View configuration: mainly defines the ´divId´
3035
+ * of the associated HTML div.
3036
+ */
3037
+ export declare class ViewConfig {
3038
+ /**
3039
+ * Associated HTML div id.
3040
+ *
3041
+ * @type {string}
3042
+ */
3043
+ divId: string;
3044
+ /**
3045
+ * Optional orientation of the data; 'axial', 'coronal' or 'sagittal'.
3046
+ * If undefined, will use the data aquisition plane.
3047
+ *
3048
+ * @type {string|undefined}
3049
+ */
3050
+ orientation: string | undefined;
3051
+ /**
3052
+ * Optional view colour map.
3053
+ *
3054
+ * @type {ColourMap|undefined}
3055
+ */
3056
+ colourMap: ColourMap | undefined;
3057
+ /**
3058
+ * Optional layer opacity; in [0, 1] range.
3059
+ *
3060
+ * @type {number|undefined}
3061
+ */
3062
+ opacity: number | undefined;
3063
+ }
3064
+
2789
3065
  /**
2790
3066
  * View controller.
2791
3067
  */
@@ -3032,10 +3308,10 @@ export declare class ViewController {
3032
3308
  * Set the current index.
3033
3309
  *
3034
3310
  * @param {Index} index The index.
3035
- * @param {boolean} silent If true, does not fire a positionchange event.
3311
+ * @param {boolean} [silent] If true, does not fire a positionchange event.
3036
3312
  * @returns {boolean} False if not in bounds.
3037
3313
  */
3038
- setCurrentIndex(index: Index, silent: boolean): boolean;
3314
+ setCurrentIndex(index: Index, silent?: boolean): boolean;
3039
3315
  /**
3040
3316
  * Get a plane 3D position from a plane 2D position: does not compensate
3041
3317
  * for the image origin. Needed for setting the scale center...
@@ -3105,15 +3381,15 @@ export declare class ViewController {
3105
3381
  /**
3106
3382
  * Get the colour map.
3107
3383
  *
3108
- * @returns {object} The colour map.
3384
+ * @returns {ColourMap} The colour map.
3109
3385
  */
3110
- getColourMap(): object;
3386
+ getColourMap(): ColourMap;
3111
3387
  /**
3112
3388
  * Set the colour map.
3113
3389
  *
3114
- * @param {object} colourMap The colour map.
3390
+ * @param {ColourMap} colourMap The colour map.
3115
3391
  */
3116
- setColourMap(colourMap: object): void;
3392
+ setColourMap(colourMap: ColourMap): void;
3117
3393
  /**
3118
3394
  * @callback alphaFn@callback alphaFn
3119
3395
  * @param {object} value The pixel value.
@@ -3195,12 +3471,14 @@ export declare class ViewLayer {
3195
3471
  * Handle an image set event.
3196
3472
  *
3197
3473
  * @param {object} event The event.
3474
+ * @function
3198
3475
  */
3199
3476
  onimageset: (event: object) => void;
3200
3477
  /**
3201
3478
  * Handle an image change event.
3202
3479
  *
3203
3480
  * @param {object} event The event.
3481
+ * @function
3204
3482
  */
3205
3483
  onimagechange: (event: object) => void;
3206
3484
  /**
@@ -3378,7 +3656,7 @@ export declare class ViewLayer {
3378
3656
  }
3379
3657
 
3380
3658
  /**
3381
- * WindowLevel class.
3659
+ * WindowCenterAndWidth class.
3382
3660
  * <br>Pseudo-code:
3383
3661
  * <pre>
3384
3662
  * if (x &lt;= c - 0.5 - (w-1)/2), then y = ymin
@@ -3388,7 +3666,7 @@ export declare class ViewLayer {
3388
3666
  *
3389
3667
  * @see DICOM doc for [Window Center and Window Width]{@link http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.11.html#sect_C.11.2.1.2}
3390
3668
  */
3391
- export declare class WindowLevel {
3669
+ export declare class WindowCenterAndWidth {
3392
3670
  /**
3393
3671
  * @param {number} center The window center.
3394
3672
  * @param {number} width The window width.
@@ -3431,10 +3709,10 @@ export declare class WindowLevel {
3431
3709
  /**
3432
3710
  * Check for window level equality.
3433
3711
  *
3434
- * @param {WindowLevel} rhs The other window level to compare to.
3712
+ * @param {WindowCenterAndWidth} rhs The other window level to compare to.
3435
3713
  * @returns {boolean} True if both window level are equal.
3436
3714
  */
3437
- equals(rhs: WindowLevel): boolean;
3715
+ equals(rhs: WindowCenterAndWidth): boolean;
3438
3716
  /**
3439
3717
  * Get a string representation of the window level.
3440
3718
  *
@@ -3457,9 +3735,9 @@ export declare class WindowLut {
3457
3735
  /**
3458
3736
  * Get the window / level.
3459
3737
  *
3460
- * @returns {WindowLevel} The window / level.
3738
+ * @returns {WindowCenterAndWidth} The window / level.
3461
3739
  */
3462
- getWindowLevel(): WindowLevel;
3740
+ getWindowLevel(): WindowCenterAndWidth;
3463
3741
  /**
3464
3742
  * Get the signed flag.
3465
3743
  *
@@ -3482,9 +3760,9 @@ export declare class WindowLut {
3482
3760
  /**
3483
3761
  * Set the window center and width.
3484
3762
  *
3485
- * @param {WindowLevel} wl The window level.
3763
+ * @param {WindowCenterAndWidth} wl The window level.
3486
3764
  */
3487
- setWindowLevel(wl: WindowLevel): void;
3765
+ setWindowLevel(wl: WindowCenterAndWidth): void;
3488
3766
  /**
3489
3767
  * Update the lut if needed..
3490
3768
  */
@@ -3506,4 +3784,22 @@ export declare class WindowLut {
3506
3784
  #private;
3507
3785
  }
3508
3786
 
3787
+ /**
3788
+ * Writer rule.
3789
+ */
3790
+ export declare class WriterRule {
3791
+ /**
3792
+ * Rule action: `copy`, `remove`, `clear` or `replace`.
3793
+ *
3794
+ * @type {string}
3795
+ */
3796
+ action: string;
3797
+ /**
3798
+ * Value to use for replace action.
3799
+ *
3800
+ * @type {any}
3801
+ */
3802
+ value: any;
3803
+ }
3804
+
3509
3805
  export { }