dwv 0.33.0-beta.9 → 0.33.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
@@ -4,9 +4,13 @@ import Konva from 'konva';
4
4
  * Add tags to the dictionary.
5
5
  *
6
6
  * @param {string} group The group key.
7
- * @param {object} tags The tags to add.
7
+ * @param {Object<string, string[]>} tags The tags to add as an
8
+ * object indexed by element key with values as:
9
+ * [VR, multiplicity, TagName] (all strings).
8
10
  */
9
- export declare function addTagsToDictionary(group: string, tags: object): void;
11
+ export declare function addTagsToDictionary(group: string, tags: {
12
+ [x: string]: string[];
13
+ }): void;
10
14
 
11
15
  /**
12
16
  * List of ViewConfigs indexed by dataIds.
@@ -34,15 +38,9 @@ export declare class App {
34
38
  * Get the image.
35
39
  *
36
40
  * @param {string} dataId The data id.
37
- * @returns {Image} The associated image.
38
- */
39
- getImage(dataId: string): Image_2;
40
- /**
41
- * Get the last loaded image.
42
- *
43
- * @returns {Image} The image.
41
+ * @returns {Image|undefined} The associated image.
44
42
  */
45
- getLastImage(): Image_2;
43
+ getImage(dataId: string): Image_2 | undefined;
46
44
  /**
47
45
  * Set the image at the given id.
48
46
  *
@@ -50,63 +48,71 @@ export declare class App {
50
48
  * @param {Image} img The associated image.
51
49
  */
52
50
  setImage(dataId: string, img: Image_2): void;
53
- /**
54
- * Set the last image.
55
- *
56
- * @param {Image} img The associated image.
57
- */
58
- setLastImage(img: Image_2): void;
59
51
  /**
60
52
  * Add a new image.
61
53
  *
62
54
  * @param {Image} image The new image.
63
55
  * @param {object} meta The image meta.
56
+ * @param {string} source The source of the new image,
57
+ * will be passed with load events.
64
58
  * @returns {string} The new image data id.
65
59
  */
66
- addNewImage(image: Image_2, meta: object): string;
60
+ addNewImage(image: Image_2, meta: object, source: string): string;
67
61
  /**
68
62
  * Get the meta data.
69
63
  *
70
64
  * @param {string} dataId The data id.
71
- * @returns {object} The list of meta data.
65
+ * @returns {Object<string, DataElement>|undefined} The list of meta data.
72
66
  */
73
- getMetaData(dataId: string): object;
67
+ getMetaData(dataId: string): {
68
+ [x: string]: DataElement;
69
+ } | undefined;
74
70
  /**
75
71
  * Get the list of ids in the data storage.
76
72
  *
77
- * @returns {Array} The list of data ids.
73
+ * @returns {string[]} The list of data ids.
78
74
  */
79
- getDataIds(): any[];
75
+ getDataIds(): string[];
80
76
  /**
81
- * Can the data be scrolled?
77
+ * Get the list of dataIds that contain the input UIDs.
78
+ *
79
+ * @param {string[]} uids A list of UIDs.
80
+ * @returns {string[]} The list of dataIds that contain the UIDs.
81
+ */
82
+ getDataIdsFromSopUids(uids: string[]): string[];
83
+ /**
84
+ * Can the data (of the active view of the active layer) be scrolled?
82
85
  *
83
86
  * @returns {boolean} True if the data has a third dimension greater than one.
87
+ * @deprecated Please use the ViewController equivalent directly instead.
84
88
  */
85
89
  canScroll(): boolean;
86
90
  /**
87
- * Can window and level be applied to the data?
91
+ * Can window and level be applied to the data
92
+ * (of the active view of the active layer)?
88
93
  *
89
94
  * @returns {boolean} True if the data is monochrome.
95
+ * @deprecated Please use the ViewController equivalent directly instead.
90
96
  */
91
97
  canWindowLevel(): boolean;
92
98
  /**
93
- * Get the layer scale on top of the base scale.
99
+ * Get the active layer group scale on top of the base scale.
94
100
  *
95
- * @returns {object} The scale as {x,y}.
101
+ * @returns {Scalar3D} The scale as {x,y,z}.
96
102
  */
97
- getAddedScale(): object;
103
+ getAddedScale(): Scalar3D;
98
104
  /**
99
- * Get the base scale.
105
+ * Get the base scale of the active layer group.
100
106
  *
101
- * @returns {object} The scale as {x,y}.
107
+ * @returns {Scalar3D} The scale as {x,y,z}.
102
108
  */
103
- getBaseScale(): object;
109
+ getBaseScale(): Scalar3D;
104
110
  /**
105
- * Get the layer offset.
111
+ * Get the layer offset of the active layer group.
106
112
  *
107
- * @returns {object} The offset.
113
+ * @returns {Scalar3D} The offset as {x,y,z}.
108
114
  */
109
- getOffset(): object;
115
+ getOffset(): Scalar3D;
110
116
  /**
111
117
  * Get the toolbox controller.
112
118
  *
@@ -117,9 +123,15 @@ export declare class App {
117
123
  * Get the active layer group.
118
124
  * The layer is available after the first loaded item.
119
125
  *
120
- * @returns {LayerGroup} The layer group.
126
+ * @returns {LayerGroup|undefined} The layer group.
127
+ */
128
+ getActiveLayerGroup(): LayerGroup | undefined;
129
+ /**
130
+ * Set the active layer group.
131
+ *
132
+ * @param {number} index The layer group index.
121
133
  */
122
- getActiveLayerGroup(): LayerGroup;
134
+ setActiveLayerGroup(index: number): void;
123
135
  /**
124
136
  * Get the view layers associated to a data id.
125
137
  * The layer are available after the first loaded item.
@@ -167,7 +179,7 @@ export declare class App {
167
179
  /**
168
180
  * Initialise the application.
169
181
  *
170
- * @param {AppOptions} opt The application options
182
+ * @param {AppOptions} opt The application options.
171
183
  * @example
172
184
  * // create the dwv app
173
185
  * const app = new dwv.App();
@@ -229,8 +241,8 @@ export declare class App {
229
241
  * @fires App#loadprogress
230
242
  * @fires App#loaditem
231
243
  * @fires App#loadend
232
- * @fires App#loaderror
233
- * @fires App#loadabort
244
+ * @fires App#error
245
+ * @fires App#abort
234
246
  * @function
235
247
  */
236
248
  loadFiles: (files: File[]) => void;
@@ -239,15 +251,15 @@ export declare class App {
239
251
  *
240
252
  * @param {string[]} urls The list of urls to load.
241
253
  * @param {object} [options] The options object, can contain:
242
- * - requestHeaders: an array of {name, value} to use as request headers
243
- * - withCredentials: boolean xhr.withCredentials flag to pass to the request
244
- * - batchSize: the size of the request url batch
254
+ * - requestHeaders: an array of {name, value} to use as request headers,
255
+ * - withCredentials: boolean xhr.withCredentials flag to pass to the request,
256
+ * - batchSize: the size of the request url batch.
245
257
  * @fires App#loadstart
246
258
  * @fires App#loadprogress
247
259
  * @fires App#loaditem
248
260
  * @fires App#loadend
249
- * @fires App#loaderror
250
- * @fires App#loadabort
261
+ * @fires App#error
262
+ * @fires App#abort
251
263
  * @function
252
264
  */
253
265
  loadURLs: (urls: string[], options?: object) => void;
@@ -268,15 +280,21 @@ export declare class App {
268
280
  * @fires App#loadprogress
269
281
  * @fires App#loaditem
270
282
  * @fires App#loadend
271
- * @fires App#loaderror
272
- * @fires App#loadabort
283
+ * @fires App#error
284
+ * @fires App#abort
273
285
  * @function
274
286
  */
275
287
  loadImageObject: (data: any[]) => void;
276
288
  /**
277
- * Abort the current load.
289
+ * Abort all the current loads.
290
+ */
291
+ abortAllLoads(): void;
292
+ /**
293
+ * Abort an individual data load.
294
+ *
295
+ * @param {string} dataId The data to stop loading.
278
296
  */
279
- abortLoad(): void;
297
+ abortLoad(dataId: string): void;
280
298
  /**
281
299
  * Fit the display to the data of each layer group.
282
300
  * To be called once the image is loaded.
@@ -284,6 +302,9 @@ export declare class App {
284
302
  fitToContainer(): void;
285
303
  /**
286
304
  * Init the Window/Level display
305
+ * (of the active layer of the active layer group).
306
+ *
307
+ * @deprecated Please set the opacity of the desired view layer directly.
287
308
  */
288
309
  initWLDisplay(): void;
289
310
  /**
@@ -292,6 +313,26 @@ export declare class App {
292
313
  * @param {boolean} flag True to enable smoothing.
293
314
  */
294
315
  setImageSmoothing(flag: boolean): void;
316
+ /**
317
+ * Get the layer group configuration from a data id.
318
+ *
319
+ * @param {string} dataId The data id.
320
+ * @param {boolean} [excludeStarConfig] Exclude the star config
321
+ * (default to false).
322
+ * @returns {ViewConfig[]} The list of associated configs.
323
+ */
324
+ getViewConfigs(dataId: string, excludeStarConfig?: boolean): ViewConfig[];
325
+ /**
326
+ * Get the layer group configuration for a data id and group
327
+ * div id.
328
+ *
329
+ * @param {string} dataId The data id.
330
+ * @param {string} groupDivId The layer group div id.
331
+ * @param {boolean} [excludeStarConfig] Exclude the star config
332
+ * (default to false).
333
+ * @returns {ViewConfig|undefined} The associated config.
334
+ */
335
+ getViewConfig(dataId: string, groupDivId: string, excludeStarConfig?: boolean): ViewConfig | undefined;
295
336
  /**
296
337
  * Get the data view config.
297
338
  * Carefull, returns a reference, do not modify without resetting.
@@ -321,11 +362,11 @@ export declare class App {
321
362
  * Remove a data view config.
322
363
  *
323
364
  * @param {string} dataId The data id.
324
- * @param {ViewConfig} config The view configuration.
365
+ * @param {string} divId The div id.
325
366
  */
326
- removeDataViewConfig(dataId: string, config: ViewConfig): void;
367
+ removeDataViewConfig(dataId: string, divId: string): void;
327
368
  /**
328
- * Update a data view config.
369
+ * Update an existing data view config.
329
370
  * Removes and re-creates the layer if found.
330
371
  *
331
372
  * @param {string} dataId The data id.
@@ -336,9 +377,9 @@ export declare class App {
336
377
  /**
337
378
  * Set the layer groups binders.
338
379
  *
339
- * @param {Array} list The list of binder names.
380
+ * @param {string[]} list The list of binder names.
340
381
  */
341
- setLayerGroupsBinders(list: any[]): void;
382
+ setLayerGroupsBinders(list: string[]): void;
342
383
  /**
343
384
  * Render the current data.
344
385
  *
@@ -347,7 +388,7 @@ export declare class App {
347
388
  */
348
389
  render(dataId: string, viewConfigs?: ViewConfig[]): void;
349
390
  /**
350
- * Zoom to the layers.
391
+ * Zoom the layers of the active layer group.
351
392
  *
352
393
  * @param {number} step The step to add to the current zoom.
353
394
  * @param {number} cx The zoom center X coordinate.
@@ -355,20 +396,21 @@ export declare class App {
355
396
  */
356
397
  zoom(step: number, cx: number, cy: number): void;
357
398
  /**
358
- * Apply a translation to the layers.
399
+ * Apply a translation to the layers of the active layer group.
359
400
  *
360
401
  * @param {number} tx The translation along X.
361
402
  * @param {number} ty The translation along Y.
362
403
  */
363
404
  translate(tx: number, ty: number): void;
364
405
  /**
365
- * Set the image layer opacity.
406
+ * Set the active view layer (of the active layer group) opacity.
366
407
  *
367
408
  * @param {number} alpha The opacity ([0:1] range).
409
+ * @deprecated Please set the opacity of the desired view layer directly.
368
410
  */
369
411
  setOpacity(alpha: number): void;
370
412
  /**
371
- * Set the drawings on the current stage.
413
+ * Set the drawings of the active layer group.
372
414
  *
373
415
  * @param {Array} drawings An array of drawings.
374
416
  * @param {Array} drawingsDetails An array of drawings details.
@@ -404,12 +446,14 @@ export declare class App {
404
446
  onKeydown: (event: KeyboardEvent) => void;
405
447
  /**
406
448
  * Key down event handler example.
407
- * - CRTL-Z: undo
408
- * - CRTL-Y: redo
409
- * - CRTL-ARROW_LEFT: next element on fourth dim
410
- * - CRTL-ARROW_UP: next element on third dim
411
- * - CRTL-ARROW_RIGHT: previous element on fourth dim
412
- * - CRTL-ARROW_DOWN: previous element on third dim
449
+ * - CRTL-Z: undo,
450
+ * - CRTL-Y: redo,
451
+ * - CRTL-ARROW_LEFT: next element on fourth dim,
452
+ * - CRTL-ARROW_UP: next element on third dim,
453
+ * - CRTL-ARROW_RIGHT: previous element on fourth dim,
454
+ * - CRTL-ARROW_DOWN: previous element on third dim.
455
+ *
456
+ * Applies to the active view of the active layer group.
413
457
  *
414
458
  * @param {KeyboardEvent} event The key down event.
415
459
  * @fires UndoStack#undo
@@ -418,27 +462,29 @@ export declare class App {
418
462
  */
419
463
  defaultOnKeydown: (event: KeyboardEvent) => void;
420
464
  /**
421
- * Reset the display
465
+ * Reset the display.
422
466
  */
423
467
  resetDisplay(): void;
424
468
  /**
425
- * Reset the app zoom.s
469
+ * Reset the app zoom.
426
470
  */
427
471
  resetZoom(): void;
428
472
  /**
429
- * Set the colour map.
473
+ * Set the colour map of the active view of the active layer group.
430
474
  *
431
475
  * @param {string} name The colour map name.
476
+ * @deprecated Please use the ViewController equivalent directly instead.
432
477
  */
433
478
  setColourMap(name: string): void;
434
479
  /**
435
- * Set the window/level preset.
480
+ * Set the window/level preset of the active view of the active layer group.
436
481
  *
437
- * @param {object} preset The window/level preset.
482
+ * @param {string} preset The window/level preset.
483
+ * @deprecated Please use the ViewController equivalent directly instead.
438
484
  */
439
- setWindowLevelPreset(preset: object): void;
485
+ setWindowLevelPreset(preset: string): void;
440
486
  /**
441
- * Set the tool
487
+ * Set the tool.
442
488
  *
443
489
  * @param {string} tool The tool.
444
490
  */
@@ -450,13 +496,13 @@ export declare class App {
450
496
  */
451
497
  setToolFeatures(list: object): void;
452
498
  /**
453
- * Undo the last action
499
+ * Undo the last action.
454
500
  *
455
501
  * @fires UndoStack#undo
456
502
  */
457
503
  undo(): void;
458
504
  /**
459
- * Redo the last action
505
+ * Redo the last action.
460
506
  *
461
507
  * @fires UndoStack#redo
462
508
  */
@@ -524,15 +570,16 @@ export declare class AppOptions {
524
570
  binders: string[] | undefined;
525
571
  /**
526
572
  * Optional boolean flag to trigger the first data render
527
- * after the first loaded data or not. Defaults to true;
573
+ * after the first loaded data or not. Defaults to true.
528
574
  *
529
575
  * @type {boolean|undefined}
530
576
  */
531
577
  viewOnFirstLoadItem: boolean | undefined;
532
578
  /**
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
579
+ * Optional default chraracterset string used for DICOM parsing if
580
+ * not passed in DICOM file.
581
+ *
582
+ * Valid values: {@link https://developer.mozilla.org/en-US/docs/Web/API/Encoding_API/Encodings}.
536
583
  *
537
584
  * @type {string|undefined}
538
585
  */
@@ -543,12 +590,26 @@ export declare class AppOptions {
543
590
  * @type {object|undefined}
544
591
  */
545
592
  overlayConfig: object | undefined;
593
+ /**
594
+ * DOM root document.
595
+ *
596
+ * @type {DocumentFragment}
597
+ */
598
+ rootDocument: DocumentFragment;
599
+ }
600
+
601
+ export declare namespace BLACK {
602
+ let r: number;
603
+ let g: number;
604
+ let b: number;
546
605
  }
547
606
 
548
607
  /**
549
608
  * Build a multipart message.
550
- * See: https://en.wikipedia.org/wiki/MIME#Multipart_messages
551
- * See: https://hg.orthanc-server.com/orthanc-dicomweb/file/tip/Resources/Samples/JavaScript/stow-rs.js
609
+ *
610
+ * Ref:
611
+ * - {@link https://en.wikipedia.org/wiki/MIME#Multipart_messages},
612
+ * - {@link https://hg.orthanc-server.com/orthanc-dicomweb/file/tip/Resources/Samples/JavaScript/stow-rs.js}.
552
613
  *
553
614
  * @param {Array} parts The message parts as an array of object containing
554
615
  * content headers and messages as the data property (as returned by parse).
@@ -557,9 +618,59 @@ export declare class AppOptions {
557
618
  */
558
619
  export declare function buildMultipart(parts: any[], boundary: string): Uint8Array;
559
620
 
621
+ /**
622
+ * Change segment colour command.
623
+ */
624
+ export declare class ChangeSegmentColourCommand {
625
+ /**
626
+ * @param {Image} mask The mask image.
627
+ * @param {MaskSegment} segment The segment to modify.
628
+ * @param {RGB|number} newColour The new segment colour.
629
+ * @param {boolean} [silent] Whether to send a creation event or not.
630
+ */
631
+ constructor(mask: Image_2, segment: MaskSegment, newColour: RGB | number, silent?: boolean);
632
+ /**
633
+ * Get the command name.
634
+ *
635
+ * @returns {string} The command name.
636
+ */
637
+ getName(): string;
638
+ /**
639
+ * Check if a command is valid and can be executed.
640
+ *
641
+ * @returns {boolean} True if the command is valid.
642
+ */
643
+ isValid(): boolean;
644
+ /**
645
+ * Execute the command.
646
+ *
647
+ * @fires ChangeSegmentColourCommand#changemasksegmentcolour
648
+ */
649
+ execute(): void;
650
+ /**
651
+ * Undo the command.
652
+ *
653
+ * @fires ChangeSegmentColourCommand#changemasksegmentcolour
654
+ */
655
+ undo(): void;
656
+ /**
657
+ * Handle an execute event.
658
+ *
659
+ * @param {object} _event The execute event with type and id.
660
+ */
661
+ onExecute(_event: object): void;
662
+ /**
663
+ * Handle an undo event.
664
+ *
665
+ * @param {object} _event The undo event with type and id.
666
+ */
667
+ onUndo(_event: object): void;
668
+ #private;
669
+ }
670
+
560
671
  /**
561
672
  * Colour map: red, green and blue components
562
- * to associate with intensity values.
673
+ * to associate with intensity values.
563
674
  */
564
675
  export declare class ColourMap {
565
676
  /**
@@ -591,27 +702,33 @@ export declare class ColourMap {
591
702
  /**
592
703
  * Create an Image from DICOM elements.
593
704
  *
594
- * @param {object} elements The DICOM elements.
705
+ * @param {Object<string, DataElement>} elements The DICOM elements.
595
706
  * @returns {Image} The Image object.
596
707
  */
597
- export declare function createImage(elements: object): Image_2;
708
+ export declare function createImage(elements: {
709
+ [x: string]: DataElement;
710
+ }): Image_2;
598
711
 
599
712
  /**
600
713
  * Create a mask Image from DICOM elements.
601
714
  *
602
- * @param {object} elements The DICOM elements.
715
+ * @param {Object<string, DataElement>} elements The DICOM elements.
603
716
  * @returns {Image} The mask Image object.
604
717
  */
605
- export declare function createMaskImage(elements: object): Image_2;
718
+ export declare function createMaskImage(elements: {
719
+ [x: string]: DataElement;
720
+ }): Image_2;
606
721
 
607
722
  /**
608
723
  * Create a View from DICOM elements and image.
609
724
  *
610
- * @param {object} elements The DICOM elements.
725
+ * @param {Object<string, DataElement>} elements The DICOM elements.
611
726
  * @param {Image} image The associated image.
612
727
  * @returns {View} The View object.
613
728
  */
614
- export declare function createView(elements: object, image: Image_2): View;
729
+ export declare function createView(elements: {
730
+ [x: string]: DataElement;
731
+ }, image: Image_2): View;
615
732
 
616
733
  export declare namespace customUI {
617
734
  /**
@@ -681,10 +798,6 @@ export declare class DataElement {
681
798
  items: any[];
682
799
  }
683
800
 
684
- declare type DataElements = {
685
- [x: string]: DataElement;
686
- };
687
-
688
801
  /**
689
802
  * Decoder scripts to be passed to web workers for image decoding.
690
803
  */
@@ -698,14 +811,11 @@ export declare const decoderScripts: {
698
811
  /**
699
812
  * List of default window level presets.
700
813
  *
701
- * @type {Object.<string, Object.<string, {center: number, width: number}>>}
814
+ * @type {Object.<string, Object.<string, WindowLevel>>}
702
815
  */
703
816
  export declare const defaultPresets: {
704
817
  [x: string]: {
705
- [x: string]: {
706
- center: number;
707
- width: number;
708
- };
818
+ [x: string]: WindowLevel;
709
819
  };
710
820
  };
711
821
 
@@ -717,6 +827,97 @@ export declare namespace defaults {
717
827
  };
718
828
  }
719
829
 
830
+ /**
831
+ * Delete segment command.
832
+ */
833
+ export declare class DeleteSegmentCommand {
834
+ /**
835
+ * @param {Image} mask The mask image.
836
+ * @param {MaskSegment} segment The segment to remove.
837
+ * @param {boolean} [silent] Whether to send a creation event or not.
838
+ */
839
+ constructor(mask: Image_2, segment: MaskSegment, silent?: boolean);
840
+ /**
841
+ * Get the command name.
842
+ *
843
+ * @returns {string} The command name.
844
+ */
845
+ getName(): string;
846
+ /**
847
+ * Check if a command is valid and can be executed.
848
+ *
849
+ * @returns {boolean} True if the command is valid.
850
+ */
851
+ isValid(): boolean;
852
+ /**
853
+ * Execute the command.
854
+ *
855
+ * @fires DeleteSegmentCommand#masksegmentdelete
856
+ */
857
+ execute(): void;
858
+ /**
859
+ * Undo the command.
860
+ *
861
+ * @fires DeleteSegmentCommand#masksegmentredraw
862
+ */
863
+ undo(): void;
864
+ /**
865
+ * Handle an execute event.
866
+ *
867
+ * @param {object} _event The execute event with type and id.
868
+ */
869
+ onExecute(_event: object): void;
870
+ /**
871
+ * Handle an undo event.
872
+ *
873
+ * @param {object} _event The undo event with type and id.
874
+ */
875
+ onUndo(_event: object): void;
876
+ #private;
877
+ }
878
+
879
+ /**
880
+ * DICOM code: item of a basic code sequence.
881
+ *
882
+ * Ref: {@link https://dicom.nema.org/medical/dicom/2022a/output/chtml/part03/sect_8.8.html}.
883
+ */
884
+ export declare class DicomCode {
885
+ /**
886
+ * @param {string} meaning The code meaning.
887
+ */
888
+ constructor(meaning: string);
889
+ /**
890
+ * Code meaning (0008,0104).
891
+ *
892
+ * @type {string}
893
+ */
894
+ meaning: string;
895
+ /**
896
+ * Code value (0008,0100).
897
+ *
898
+ * @type {string|undefined}
899
+ */
900
+ value: string | undefined;
901
+ /**
902
+ * Long code value (0008,0119).
903
+ *
904
+ * @type {string|undefined}
905
+ */
906
+ longValue: string | undefined;
907
+ /**
908
+ * URN code value (0008,0120).
909
+ *
910
+ * @type {string|undefined}
911
+ */
912
+ urnValue: string | undefined;
913
+ /**
914
+ * Coding scheme designator (0008,0102).
915
+ *
916
+ * @type {string|undefined}
917
+ */
918
+ schemeDesignator: string | undefined;
919
+ }
920
+
720
921
  /**
721
922
  * DicomParser class.
722
923
  *
@@ -818,31 +1019,37 @@ export declare class DicomWriter {
818
1019
  * @param {boolean} flag True to use UN VR.
819
1020
  */
820
1021
  setUseUnVrForPrivateSq(flag: boolean): void;
1022
+ /**
1023
+ * Set the vr=UN check and fix flag.
1024
+ *
1025
+ * @param {boolean} flag True to activate the check and fix.
1026
+ */
1027
+ setFixUnknownVR(flag: boolean): void;
821
1028
  /**
822
1029
  * Set the writing rules.
823
- * List of writer rules indexed by either `default`, tagName or groupName.
1030
+ * List of writer rules indexed by either `default`,
1031
+ * tagKey, tagName or groupName.
824
1032
  * Each DICOM element will be checked to see if a rule is applicable.
825
- * First checked by tagName and then by groupName,
1033
+ * First checked by tagKey, tagName and then by groupName,
826
1034
  * if nothing is found the default rule is applied.
827
1035
  *
828
1036
  * @param {Object<string, WriterRule>} rules The input rules.
1037
+ * @param {boolean} [addMissingTags] If true, explicit tags that
1038
+ * have replace rule and a value will be
1039
+ * added if missing. Defaults to false.
829
1040
  */
830
1041
  setRules(rules: {
831
1042
  [x: string]: WriterRule;
832
- }): void;
1043
+ }, addMissingTags?: boolean): void;
833
1044
  /**
834
1045
  * Use a TextEncoder instead of the default text decoder.
835
1046
  */
836
1047
  useSpecialTextEncoder(): void;
837
- /**
838
- * Use default anonymisation rules.
839
- */
840
- useDefaultAnonymisationRules(): void;
841
1048
  /**
842
1049
  * Get the element to write according to the class rules.
843
1050
  * Priority order: tagName, groupName, default.
844
1051
  *
845
- * @param {DataElement} element The element to check
1052
+ * @param {DataElement} element The element to check.
846
1053
  * @returns {DataElement|null} The element to write, can be null.
847
1054
  */
848
1055
  getElementToWrite(element: DataElement): DataElement | null;
@@ -946,6 +1153,13 @@ export declare class DrawController {
946
1153
  * DeleteCommand has been executed.
947
1154
  */
948
1155
  deleteDraws(cmdCallback: Function, exeCallback: Function): void;
1156
+ /**
1157
+ * Get the total number of draws
1158
+ * (at all positions).
1159
+ *
1160
+ * @returns {number} The total number of draws.
1161
+ */
1162
+ getNumberOfDraws(): number;
949
1163
  #private;
950
1164
  }
951
1165
 
@@ -1021,21 +1235,25 @@ export declare class DrawLayer {
1021
1235
  /**
1022
1236
  * Set the plane helper.
1023
1237
  *
1024
- * @param {object} helper The helper.
1238
+ * @param {PlaneHelper} helper The helper.
1025
1239
  */
1026
- setPlaneHelper(helper: object): void;
1240
+ setPlaneHelper(helper: PlaneHelper): void;
1027
1241
  /**
1028
1242
  * Get the id of the layer.
1029
1243
  *
1030
1244
  * @returns {string} The string id.
1031
1245
  */
1032
1246
  getId(): string;
1247
+ /**
1248
+ * Remove the HTML element from the DOM.
1249
+ */
1250
+ removeFromDOM(): void;
1033
1251
  /**
1034
1252
  * Get the layer base size (without scale).
1035
1253
  *
1036
- * @returns {object} The size as {x,y}.
1254
+ * @returns {Scalar2D} The size as {x,y}.
1037
1255
  */
1038
- getBaseSize(): object;
1256
+ getBaseSize(): Scalar2D;
1039
1257
  /**
1040
1258
  * Get the layer opacity.
1041
1259
  *
@@ -1056,6 +1274,14 @@ export declare class DrawLayer {
1056
1274
  * Add a flip offset along the layer Y axis.
1057
1275
  */
1058
1276
  addFlipOffsetY(): void;
1277
+ /**
1278
+ * Flip the scale along the layer X axis.
1279
+ */
1280
+ flipScaleX(): void;
1281
+ /**
1282
+ * Flip the scale along the layer Y axis.
1283
+ */
1284
+ flipScaleY(): void;
1059
1285
  /**
1060
1286
  * Flip the scale along the layer Z axis.
1061
1287
  */
@@ -1063,16 +1289,16 @@ export declare class DrawLayer {
1063
1289
  /**
1064
1290
  * Set the layer scale.
1065
1291
  *
1066
- * @param {object} newScale The scale as {x,y}.
1292
+ * @param {Scalar3D} newScale The scale as {x,y,z}.
1067
1293
  * @param {Point3D} [center] The scale center.
1068
1294
  */
1069
- setScale(newScale: object, center?: Point3D): void;
1295
+ setScale(newScale: Scalar3D, center?: Point3D): void;
1070
1296
  /**
1071
1297
  * Set the layer offset.
1072
1298
  *
1073
- * @param {object} newOffset The offset as {x,y}.
1299
+ * @param {Scalar3D} newOffset The offset as {x,y,z}.
1074
1300
  */
1075
- setOffset(newOffset: object): void;
1301
+ setOffset(newOffset: Scalar3D): void;
1076
1302
  /**
1077
1303
  * Set the base layer offset. Updates the layer offset.
1078
1304
  *
@@ -1095,25 +1321,25 @@ export declare class DrawLayer {
1095
1321
  isVisible(): boolean;
1096
1322
  /**
1097
1323
  * Draw the content (imageData) of the layer.
1098
- * The imageData variable needs to be set
1324
+ * The imageData variable needs to be set.
1099
1325
  */
1100
1326
  draw(): void;
1101
1327
  /**
1102
- * Initialise the layer: set the canvas and context
1328
+ * Initialise the layer: set the canvas and context.
1103
1329
  *
1104
- * @param {object} size The image size as {x,y}.
1105
- * @param {object} spacing The image spacing as {x,y}.
1330
+ * @param {Scalar2D} size The image size as {x,y}.
1331
+ * @param {Scalar2D} spacing The image spacing as {x,y}.
1106
1332
  * @param {string} dataId The associated data id.
1107
1333
  */
1108
- initialise(size: object, spacing: object, dataId: string): void;
1334
+ initialise(size: Scalar2D, spacing: Scalar2D, dataId: string): void;
1109
1335
  /**
1110
1336
  * Fit the layer to its parent container.
1111
1337
  *
1112
- * @param {number} fitScale1D The 1D fit scale.
1113
- * @param {object} fitSize The fit size as {x,y}.
1114
- * @param {object} fitOffset The fit offset as {x,y}.
1338
+ * @param {Scalar2D} containerSize The container size as {x,y}.
1339
+ * @param {number} divToWorldSizeRatio The div to world size ratio.
1340
+ * @param {Scalar2D} fitOffset The fit offset as {x,y}.
1115
1341
  */
1116
- fitToContainer(fitScale1D: number, fitSize: object, fitOffset: object): void;
1342
+ fitToContainer(containerSize: Scalar2D, divToWorldSizeRatio: number, fitOffset: Scalar2D): void;
1117
1343
  /**
1118
1344
  * Check the visibility of a given group.
1119
1345
  *
@@ -1143,6 +1369,13 @@ export declare class DrawLayer {
1143
1369
  * DeleteCommand has been executed.
1144
1370
  */
1145
1371
  deleteDraws(exeCallback: object): void;
1372
+ /**
1373
+ * Get the total number of draws of this layer
1374
+ * (at all positions).
1375
+ *
1376
+ * @returns {number|undefined} The total number of draws.
1377
+ */
1378
+ getNumberOfDraws(): number | undefined;
1146
1379
  /**
1147
1380
  * Enable and listen to container interaction events.
1148
1381
  */
@@ -1266,7 +1499,7 @@ export declare class Geometry {
1266
1499
  * Warning: the size comes as stored in DICOM, meaning that it could
1267
1500
  * be oriented.
1268
1501
  *
1269
- * @param {Matrix33} [viewOrientation] The view orientation (optional)
1502
+ * @param {Matrix33} [viewOrientation] The view orientation (optional).
1270
1503
  * @returns {Size} The object size.
1271
1504
  */
1272
1505
  getSize(viewOrientation?: Matrix33): Size;
@@ -1275,7 +1508,7 @@ export declare class Geometry {
1275
1508
  * Warning: the spacing comes as stored in DICOM, meaning that it could
1276
1509
  * be oriented.
1277
1510
  *
1278
- * @param {Matrix33} [viewOrientation] The view orientation (optional)
1511
+ * @param {Matrix33} [viewOrientation] The view orientation (optional).
1279
1512
  * @returns {Spacing} The object spacing.
1280
1513
  */
1281
1514
  getSpacing(viewOrientation?: Matrix33): Spacing;
@@ -1400,16 +1633,16 @@ export declare function getDefaultDicomSegJson(): object;
1400
1633
  export declare function getDwvVersion(): string;
1401
1634
 
1402
1635
  /**
1403
- * Get the DICOM elements from a 'simple' DICOM json tags object.
1404
- * The json is a simplified version of the oficial DICOM json with
1636
+ * Get the DICOM elements from a 'simple' DICOM tags object.
1637
+ * The input object is a simplified version of the oficial DICOM json with
1405
1638
  * tag names instead of keys and direct values (no value property) for
1406
1639
  * simple tags. See synthetic test data (in tests/dicom) for examples.
1407
1640
  *
1408
- * @param {Object<string, any>} jsonTags The DICOM
1409
- * json tags object.
1641
+ * @param {Object<string, any>} simpleTags The 'simple' DICOM
1642
+ * tags object.
1410
1643
  * @returns {Object<string, DataElement>} The DICOM elements.
1411
1644
  */
1412
- export declare function getElementsFromJSONTags(jsonTags: {
1645
+ export declare function getElementsFromJSONTags(simpleTags: {
1413
1646
  [x: string]: any;
1414
1647
  }): {
1415
1648
  [x: string]: DataElement;
@@ -1419,11 +1652,11 @@ export declare function getElementsFromJSONTags(jsonTags: {
1419
1652
  * Get the indices that form a ellpise.
1420
1653
  *
1421
1654
  * @param {Index} center The ellipse center.
1422
- * @param {Array} radius The 2 ellipse radiuses.
1423
- * @param {Array} dir The 2 ellipse directions.
1424
- * @returns {Array} The indices of the ellipse.
1655
+ * @param {number[]} radius The 2 ellipse radiuses.
1656
+ * @param {number[]} dir The 2 ellipse directions.
1657
+ * @returns {Index[]} The indices of the ellipse.
1425
1658
  */
1426
- export declare function getEllipseIndices(center: Index, radius: any[], dir: any[]): any[];
1659
+ export declare function getEllipseIndices(center: Index, radius: number[], dir: number[]): Index[];
1427
1660
 
1428
1661
  /**
1429
1662
  * Get the layer details from a mouse event.
@@ -1435,13 +1668,22 @@ export declare function getEllipseIndices(center: Index, radius: any[], dir: any
1435
1668
  */
1436
1669
  export declare function getLayerDetailsFromEvent(event: object): object;
1437
1670
 
1671
+ /**
1672
+ * Get the offset of an input mouse event.
1673
+ *
1674
+ * @param {object} event The event to get the offset from.
1675
+ * @returns {Point2D} The 2D point.
1676
+ */
1677
+ export declare function getMousePoint(event: object): Point2D;
1678
+
1438
1679
  /**
1439
1680
  * Get the name of an image orientation patient.
1440
1681
  *
1441
- * @param {Array} orientation The image orientation patient.
1442
- * @returns {string} The orientation name: axial, coronal or sagittal.
1682
+ * @param {number[]} orientation The image orientation patient.
1683
+ * @returns {string|undefined} The orientation
1684
+ * name: axial, coronal or sagittal.
1443
1685
  */
1444
- export declare function getOrientationName(orientation: any[]): string;
1686
+ export declare function getOrientationName(orientation: number[]): string | undefined;
1445
1687
 
1446
1688
  /**
1447
1689
  * Get the PixelData Tag.
@@ -1466,6 +1708,14 @@ export declare function getReverseOrientation(ori: string): string;
1466
1708
  */
1467
1709
  export declare function getTagFromKey(key: string): Tag;
1468
1710
 
1711
+ /**
1712
+ * Get the offsets of an input touch event.
1713
+ *
1714
+ * @param {object} event The event to get the offset from.
1715
+ * @returns {Point2D[]} The array of points.
1716
+ */
1717
+ export declare function getTouchPoints(event: object): Point2D[];
1718
+
1469
1719
  /**
1470
1720
  * Get the appropriate TypedArray in function of arguments.
1471
1721
  *
@@ -1481,11 +1731,14 @@ export declare function getTypedArray(bitsAllocated: number, pixelRepresentation
1481
1731
 
1482
1732
  /**
1483
1733
  * Get a UID for a DICOM tag.
1484
- * Note: Use https://github.com/uuidjs/uuid?
1485
1734
  *
1486
- * @see http://dicom.nema.org/dicom/2013/output/chtml/part05/chapter_9.html
1487
- * @see http://dicomiseasy.blogspot.com/2011/12/chapter-4-dicom-objects-in-chapter-3.html
1488
- * @see https://stackoverflow.com/questions/46304306/how-to-generate-unique-dicom-uid
1735
+ * Note: Use {@link https://github.com/uuidjs/uuid}?
1736
+ *
1737
+ * Ref:
1738
+ * - {@link http://dicom.nema.org/medical/dicom/2022a/output/chtml/part05/chapter_9.html},
1739
+ * - {@link http://dicomiseasy.blogspot.com/2011/12/chapter-4-dicom-objects-in-chapter-3.html},
1740
+ * - {@link https://stackoverflow.com/questions/46304306/how-to-generate-unique-dicom-uid}.
1741
+ *
1489
1742
  * @param {string} tagName The input tag.
1490
1743
  * @returns {string} The corresponding UID.
1491
1744
  */
@@ -1493,8 +1746,9 @@ export declare function getUID(tagName: string): string;
1493
1746
 
1494
1747
  /**
1495
1748
  * Check that an input buffer includes the DICOM prefix 'DICM'
1496
- * after the 128 bytes preamble.
1497
- * Ref: [DICOM File Meta]{@link https://dicom.nema.org/dicom/2013/output/chtml/part10/chapter_7.html#sect_7.1}
1749
+ * after the 128 bytes preamble.
1750
+ *
1751
+ * Ref: [DICOM File Meta]{@link https://dicom.nema.org/medical/dicom/2022a/output/chtml/part10/chapter_7.html#sect_7.1}.
1498
1752
  *
1499
1753
  * @param {ArrayBuffer} buffer The buffer to check.
1500
1754
  * @returns {boolean} True if the buffer includes the prefix.
@@ -1553,9 +1807,9 @@ declare class Image_2 {
1553
1807
  /**
1554
1808
  * @param {Geometry} geometry The geometry of the image.
1555
1809
  * @param {TypedArray} buffer The image data as a one dimensional buffer.
1556
- * @param {Array} [imageUids] An array of Uids indexed to slice number.
1810
+ * @param {string[]} [imageUids] An array of Uids indexed to slice number.
1557
1811
  */
1558
- constructor(geometry: Geometry, buffer: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, imageUids?: any[]);
1812
+ constructor(geometry: Geometry, buffer: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, imageUids?: string[]);
1559
1813
  /**
1560
1814
  * Get the image UID at a given index.
1561
1815
  *
@@ -1563,6 +1817,13 @@ declare class Image_2 {
1563
1817
  * @returns {string} The UID.
1564
1818
  */
1565
1819
  getImageUid(index?: Index): string;
1820
+ /**
1821
+ * Check if this image includes the input uids.
1822
+ *
1823
+ * @param {string[]} uids UIDs to test for presence.
1824
+ * @returns {boolean} True if all uids are in this image uids.
1825
+ */
1826
+ containsImageUids(uids: string[]): boolean;
1566
1827
  /**
1567
1828
  * Get the geometry of the image.
1568
1829
  *
@@ -1572,7 +1833,7 @@ declare class Image_2 {
1572
1833
  /**
1573
1834
  * Get the data buffer of the image.
1574
1835
  *
1575
- * @todo dangerous...
1836
+ * @todo Dangerous...
1576
1837
  * @returns {TypedArray} The data buffer of the image.
1577
1838
  */
1578
1839
  getBuffer(): Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array;
@@ -1586,8 +1847,15 @@ declare class Image_2 {
1586
1847
  * Can window and level be applied to the data?
1587
1848
  *
1588
1849
  * @returns {boolean} True if the data is monochrome.
1850
+ * @deprecated Please use isMonochrome instead.
1589
1851
  */
1590
1852
  canWindowLevel(): boolean;
1853
+ /**
1854
+ * Is the data monochrome.
1855
+ *
1856
+ * @returns {boolean} True if the data is monochrome.
1857
+ */
1858
+ isMonochrome(): boolean;
1591
1859
  /**
1592
1860
  * Can the data be scrolled?
1593
1861
  *
@@ -1664,15 +1932,19 @@ declare class Image_2 {
1664
1932
  /**
1665
1933
  * Get the meta information of the image.
1666
1934
  *
1667
- * @returns {object} The meta information of the image.
1935
+ * @returns {Object<string, any>} The meta information of the image.
1668
1936
  */
1669
- getMeta(): object;
1937
+ getMeta(): {
1938
+ [x: string]: any;
1939
+ };
1670
1940
  /**
1671
1941
  * Set the meta information of the image.
1672
1942
  *
1673
- * @param {object} rhs The meta information of the image.
1943
+ * @param {Object<string, any>} rhs The meta information of the image.
1674
1944
  */
1675
- setMeta(rhs: object): void;
1945
+ setMeta(rhs: {
1946
+ [x: string]: any;
1947
+ }): void;
1676
1948
  /**
1677
1949
  * Get value at offset. Warning: No size check...
1678
1950
  *
@@ -1684,19 +1956,19 @@ declare class Image_2 {
1684
1956
  * Get the offsets where the buffer equals the input value.
1685
1957
  * Loops through the whole volume, can get long for big data...
1686
1958
  *
1687
- * @param {number|object} value The value to check.
1688
- * @returns {Array} The list of offsets.
1959
+ * @param {number|RGB} value The value to check.
1960
+ * @returns {number[]} The list of offsets.
1689
1961
  */
1690
- getOffsets(value: number | object): any[];
1962
+ getOffsets(value: number | RGB): number[];
1691
1963
  /**
1692
1964
  * Check if the input values are in the buffer.
1693
1965
  * Could loop through the whole volume, can get long for big data...
1694
1966
  *
1695
1967
  * @param {Array} values The values to check.
1696
- * @returns {Array} A list of booleans for each input value,
1968
+ * @returns {boolean[]} A list of booleans for each input value,
1697
1969
  * set to true if the value is present in the buffer.
1698
1970
  */
1699
- hasValues(values: any[]): any[];
1971
+ hasValues(values: any[]): boolean[];
1700
1972
  /**
1701
1973
  * Clone the image.
1702
1974
  *
@@ -1707,6 +1979,7 @@ declare class Image_2 {
1707
1979
  * Append a slice to the image.
1708
1980
  *
1709
1981
  * @param {Image} rhs The slice to append.
1982
+ * @fires Image#imagegeometrychange
1710
1983
  */
1711
1984
  appendSlice(rhs: Image_2): void;
1712
1985
  /**
@@ -1726,15 +1999,15 @@ declare class Image_2 {
1726
1999
  /**
1727
2000
  * Get the data range.
1728
2001
  *
1729
- * @returns {object} The data range.
2002
+ * @returns {NumberRange} The data range.
1730
2003
  */
1731
- getDataRange(): object;
2004
+ getDataRange(): NumberRange;
1732
2005
  /**
1733
2006
  * Get the rescaled data range.
1734
2007
  *
1735
- * @returns {object} The rescaled data range.
2008
+ * @returns {NumberRange} The rescaled data range.
1736
2009
  */
1737
- getRescaledDataRange(): object;
2010
+ getRescaledDataRange(): NumberRange;
1738
2011
  /**
1739
2012
  * Get the histogram.
1740
2013
  *
@@ -1760,29 +2033,31 @@ declare class Image_2 {
1760
2033
  /**
1761
2034
  * Set the inner buffer values at given offsets.
1762
2035
  *
1763
- * @param {Array} offsets List of offsets where to set the data.
1764
- * @param {object} value The value to set at the given offsets.
1765
- * @fires Image#imagechange
2036
+ * @param {number[]} offsets List of offsets where to set the data.
2037
+ * @param {number|RGB} value The value to set at the given offsets.
2038
+ * @fires Image#imagecontentchange
1766
2039
  */
1767
- setAtOffsets(offsets: any[], value: object): void;
2040
+ setAtOffsets(offsets: number[], value: number | RGB): void;
1768
2041
  /**
1769
2042
  * Set the inner buffer values at given offsets.
1770
2043
  *
1771
- * @param {Array} offsetsLists List of offset lists where to set the data.
1772
- * @param {object} value The value to set at the given offsets.
2044
+ * @param {number[][]} offsetsLists List of offset lists where
2045
+ * to set the data.
2046
+ * @param {RGB} value The value to set at the given offsets.
1773
2047
  * @returns {Array} A list of objects representing the original values before
1774
2048
  * replacing them.
1775
- * @fires Image#imagechange
2049
+ * @fires Image#imagecontentchange
1776
2050
  */
1777
- setAtOffsetsAndGetOriginals(offsetsLists: any[], value: object): any[];
2051
+ setAtOffsetsAndGetOriginals(offsetsLists: number[][], value: RGB): any[];
1778
2052
  /**
1779
2053
  * Set the inner buffer values at given offsets.
1780
2054
  *
1781
- * @param {Array} offsetsLists List of offset lists where to set the data.
1782
- * @param {object|Array} value The value to set at the given offsets.
1783
- * @fires Image#imagechange
2055
+ * @param {number[][]} offsetsLists List of offset lists
2056
+ * where to set the data.
2057
+ * @param {RGB|Array} value The value to set at the given offsets.
2058
+ * @fires Image#imagecontentchange
1784
2059
  */
1785
- setAtOffsetsWithIterator(offsetsLists: any[], value: object | any[]): void;
2060
+ setAtOffsetsWithIterator(offsetsLists: number[][], value: RGB | any[]): void;
1786
2061
  /**
1787
2062
  * Get the value of the image at a specific coordinate.
1788
2063
  *
@@ -1854,20 +2129,20 @@ declare class Image_2 {
1854
2129
  *
1855
2130
  * Note: Uses raw buffer values.
1856
2131
  *
1857
- * @param {Array} weights The weights of the 2D kernel as a 3x3 matrix.
2132
+ * @param {number[]} weights The weights of the 2D kernel as a 3x3 matrix.
1858
2133
  * @returns {Image} The convoluted image.
1859
2134
  */
1860
- convolute2D(weights: any[]): Image_2;
2135
+ convolute2D(weights: number[]): Image_2;
1861
2136
  /**
1862
2137
  * Convolute an image buffer with a given 2D kernel.
1863
2138
  *
1864
2139
  * Note: Uses raw buffer values.
1865
2140
  *
1866
- * @param {Array} weights The weights of the 2D kernel as a 3x3 matrix.
2141
+ * @param {number[]} weights The weights of the 2D kernel as a 3x3 matrix.
1867
2142
  * @param {TypedArray} buffer The buffer to convolute.
1868
2143
  * @param {number} startOffset The index to start at.
1869
2144
  */
1870
- convoluteBuffer(weights: any[], buffer: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, startOffset: number): void;
2145
+ convoluteBuffer(weights: number[], buffer: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array, startOffset: number): void;
1871
2146
  /**
1872
2147
  * Transform an image using a specific operator.
1873
2148
  * WARNING: no size check!
@@ -1972,11 +2247,20 @@ export declare class Index {
1972
2247
  #private;
1973
2248
  }
1974
2249
 
2250
+ /**
2251
+ * Check if two rgb objects are equal.
2252
+ *
2253
+ * @param {RGB} c1 The first colour.
2254
+ * @param {RGB} c2 The second colour.
2255
+ * @returns {boolean} True if both colour are equal.
2256
+ */
2257
+ export declare function isEqualRgb(c1: RGB, c2: RGB): boolean;
2258
+
1975
2259
  /**
1976
2260
  * CIE LAB value (L: [0, 100], a: [-128, 127], b: [-128, 127]) to
1977
2261
  * unsigned int CIE LAB ([0, 65535]).
1978
2262
  *
1979
- * @param {object} triplet CIE XYZ triplet as {x,y,z} with CIE LAB range.
2263
+ * @param {object} triplet CIE XYZ triplet as {l,a,b} with CIE LAB range.
1980
2264
  * @returns {object} CIE LAB triplet as {l,a,b} with unsigned range.
1981
2265
  */
1982
2266
  export declare function labToUintLab(triplet: object): object;
@@ -1984,18 +2268,18 @@ export declare function labToUintLab(triplet: object): object;
1984
2268
  /**
1985
2269
  * Layer group.
1986
2270
  *
1987
- * Display position: {x,y}
1988
- * Plane position: Index (access: get(i))
1989
- * (world) Position: Point3D (access: getX, getY, getZ)
2271
+ * - Display position: {x,y},
2272
+ * - Plane position: Index (access: get(i)),
2273
+ * - (world) Position: Point3D (access: getX, getY, getZ).
1990
2274
  *
1991
2275
  * Display -> World:
1992
- * planePos = viewLayer.displayToPlanePos(displayPos)
1993
- * -> compensate for layer scale and offset
1994
- * pos = viewController.getPositionFromPlanePoint(planePos)
2276
+ * - planePos = viewLayer.displayToPlanePos(displayPos)
2277
+ * -> compensate for layer scale and offset,
2278
+ * - pos = viewController.getPositionFromPlanePoint(planePos).
1995
2279
  *
1996
- * World -> display
1997
- * planePos = viewController.getOffset3DFromPlaneOffset(pos)
1998
- * no need yet for a planePos to displayPos...
2280
+ * World -> Display:
2281
+ * - planePos = viewController.getOffset3DFromPlaneOffset(pos)
2282
+ * no need yet for a planePos to displayPos...
1999
2283
  */
2000
2284
  export declare class LayerGroup {
2001
2285
  /**
@@ -2029,33 +2313,41 @@ export declare class LayerGroup {
2029
2313
  /**
2030
2314
  * Get the layer scale.
2031
2315
  *
2032
- * @returns {object} The scale as {x,y,z}.
2316
+ * @returns {Scalar3D} The scale as {x,y,z}.
2033
2317
  */
2034
- getScale(): object;
2318
+ getScale(): Scalar3D;
2035
2319
  /**
2036
2320
  * Get the base scale.
2037
2321
  *
2038
- * @returns {object} The scale as {x,y,z}.
2322
+ * @returns {Scalar3D} The scale as {x,y,z}.
2039
2323
  */
2040
- getBaseScale(): object;
2324
+ getBaseScale(): Scalar3D;
2041
2325
  /**
2042
- * Get the added scale: the scale added to the base scale
2326
+ * Get the added scale: the scale added to the base scale.
2043
2327
  *
2044
- * @returns {object} The scale as {x,y,z}.
2328
+ * @returns {Scalar3D} The scale as {x,y,z}.
2045
2329
  */
2046
- getAddedScale(): object;
2330
+ getAddedScale(): Scalar3D;
2047
2331
  /**
2048
2332
  * Get the layer offset.
2049
2333
  *
2050
- * @returns {object} The offset as {x,y,z}.
2334
+ * @returns {Scalar3D} The offset as {x,y,z}.
2051
2335
  */
2052
- getOffset(): object;
2336
+ getOffset(): Scalar3D;
2053
2337
  /**
2054
2338
  * Get the number of layers handled by this class.
2055
2339
  *
2056
2340
  * @returns {number} The number of layers.
2057
2341
  */
2058
2342
  getNumberOfLayers(): number;
2343
+ /**
2344
+ * Check if this layerGroup contains a layer with the input id.
2345
+ *
2346
+ * @param {string} id The layer id to look for.
2347
+ * @returns {boolean} True if this group contains
2348
+ * a layer with the input id.
2349
+ */
2350
+ includes(id: string): boolean;
2059
2351
  /**
2060
2352
  * Get the number of view layers handled by this class.
2061
2353
  *
@@ -2068,6 +2360,12 @@ export declare class LayerGroup {
2068
2360
  * @returns {ViewLayer|undefined} The layer.
2069
2361
  */
2070
2362
  getActiveViewLayer(): ViewLayer | undefined;
2363
+ /**
2364
+ * Get the base view layer.
2365
+ *
2366
+ * @returns {ViewLayer|undefined} The layer.
2367
+ */
2368
+ getBaseViewLayer(): ViewLayer | undefined;
2071
2369
  /**
2072
2370
  * Get the view layers associated to a data id.
2073
2371
  *
@@ -2085,9 +2383,9 @@ export declare class LayerGroup {
2085
2383
  /**
2086
2384
  * Get the view layers data indices.
2087
2385
  *
2088
- * @returns {Array} The list of indices.
2386
+ * @returns {string[]} The list of indices.
2089
2387
  */
2090
- getViewDataIndices(): any[];
2388
+ getViewDataIndices(): string[];
2091
2389
  /**
2092
2390
  * Get the active draw layer.
2093
2391
  *
@@ -2128,12 +2426,16 @@ export declare class LayerGroup {
2128
2426
  /**
2129
2427
  * Add a view layer.
2130
2428
  *
2429
+ * The new layer will be marked as the active view layer.
2430
+ *
2131
2431
  * @returns {ViewLayer} The created layer.
2132
2432
  */
2133
2433
  addViewLayer(): ViewLayer;
2134
2434
  /**
2135
2435
  * Add a draw layer.
2136
2436
  *
2437
+ * The new layer will be marked as the active draw layer.
2438
+ *
2137
2439
  * @returns {DrawLayer} The created layer.
2138
2440
  */
2139
2441
  addDrawLayer(): DrawLayer;
@@ -2141,6 +2443,12 @@ export declare class LayerGroup {
2141
2443
  * Empty the layer list.
2142
2444
  */
2143
2445
  empty(): void;
2446
+ /**
2447
+ * Remove all layers for a specific data.
2448
+ *
2449
+ * @param {string} dataId The data to remove its layers.
2450
+ */
2451
+ removeLayersByDataId(dataId: string): void;
2144
2452
  /**
2145
2453
  * Remove a layer from this layer group.
2146
2454
  * Warning: if current active layer, the index will
@@ -2150,6 +2458,46 @@ export declare class LayerGroup {
2150
2458
  * @param {ViewLayer | DrawLayer} layer The layer to remove.
2151
2459
  */
2152
2460
  removeLayer(layer: ViewLayer | DrawLayer): void;
2461
+ /**
2462
+ * Displays a tooltip in a temporary `span`.
2463
+ * Works with css to hide/show the span only on mouse hover.
2464
+ *
2465
+ * @param {Point2D} point The update point.
2466
+ */
2467
+ showTooltip(point: Point2D): void;
2468
+ /**
2469
+ * Remove the tooltip html div.
2470
+ */
2471
+ removeTooltipDiv(): void;
2472
+ /**
2473
+ * Test if one of the view layers satisfies an input callbackFn.
2474
+ *
2475
+ * @param {Function} callbackFn A function that takes a ViewLayer as input
2476
+ * and returns a boolean.
2477
+ * @returns {boolean} True if one of the ViewLayers satisfies the callbackFn.
2478
+ */
2479
+ someViewLayer(callbackFn: Function): boolean;
2480
+ /**
2481
+ * Can the input position be set on one of the view layers.
2482
+ *
2483
+ * @param {Point} position The input position.
2484
+ * @returns {boolean} True if one view layer accepts the input position.
2485
+ */
2486
+ isPositionInBounds(position: Point): boolean;
2487
+ /**
2488
+ * Can one of the view layers be scrolled.
2489
+ *
2490
+ * @returns {boolean} True if one view layer can be scrolled.
2491
+ */
2492
+ canScroll(): boolean;
2493
+ /**
2494
+ * Does one of the view layer have more than one slice in the
2495
+ * given dimension.
2496
+ *
2497
+ * @param {number} dim The input dimension.
2498
+ * @returns {boolean} True if one view layer has more than one slice.
2499
+ */
2500
+ moreThanOne(dim: number): boolean;
2153
2501
  /**
2154
2502
  * Update layers (but not the active view layer) to a position change.
2155
2503
  *
@@ -2158,23 +2506,24 @@ export declare class LayerGroup {
2158
2506
  */
2159
2507
  updateLayersToPositionChange: (event: object) => void;
2160
2508
  /**
2161
- * Calculate the fit scale: the scale that fits the largest data.
2509
+ * Calculate the div to world size ratio needed to fit
2510
+ * the largest data.
2162
2511
  *
2163
- * @returns {number|undefined} The fit scale.
2512
+ * @returns {number|undefined} The ratio.
2164
2513
  */
2165
- calculateFitScale(): number | undefined;
2514
+ getDivToWorldSizeRatio(): number | undefined;
2166
2515
  /**
2167
- * Set the layer group fit scale.
2516
+ * Fit to container: set the layers div to world size ratio.
2168
2517
  *
2169
- * @param {number} scaleIn The fit scale.
2518
+ * @param {number} divToWorldSizeRatio The ratio.
2170
2519
  */
2171
- setFitScale(scaleIn: number): void;
2520
+ fitToContainer(divToWorldSizeRatio: number): void;
2172
2521
  /**
2173
- * Get the largest data size.
2522
+ * Get the largest data world (mm) size.
2174
2523
  *
2175
- * @returns {object|undefined} The largest size as {x,y}.
2524
+ * @returns {Scalar2D|undefined} The largest size as {x,y}.
2176
2525
  */
2177
- getMaxSize(): object | undefined;
2526
+ getMaxWorldSize(): Scalar2D | undefined;
2178
2527
  /**
2179
2528
  * Flip all layers along the Z axis without offset compensation.
2180
2529
  */
@@ -2189,24 +2538,24 @@ export declare class LayerGroup {
2189
2538
  /**
2190
2539
  * Set the layers' scale.
2191
2540
  *
2192
- * @param {object} newScale The scale to apply as {x,y,z}.
2541
+ * @param {Scalar3D} newScale The scale to apply as {x,y,z}.
2193
2542
  * @param {Point3D} [center] The scale center Point3D.
2194
2543
  * @fires LayerGroup#zoomchange
2195
2544
  */
2196
- setScale(newScale: object, center?: Point3D): void;
2545
+ setScale(newScale: Scalar3D, center?: Point3D): void;
2197
2546
  /**
2198
2547
  * Add translation to the layers.
2199
2548
  *
2200
- * @param {object} translation The translation as {x,y,z}.
2549
+ * @param {Scalar3D} translation The translation as {x,y,z}.
2201
2550
  */
2202
- addTranslation(translation: object): void;
2551
+ addTranslation(translation: Scalar3D): void;
2203
2552
  /**
2204
2553
  * Set the layers' offset.
2205
2554
  *
2206
- * @param {object} newOffset The offset as {x,y,z}.
2555
+ * @param {Scalar3D} newOffset The offset as {x,y,z}.
2207
2556
  * @fires LayerGroup#offsetchange
2208
2557
  */
2209
- setOffset(newOffset: object): void;
2558
+ setOffset(newOffset: Scalar3D): void;
2210
2559
  /**
2211
2560
  * Reset the stage to its initial scale and no offset.
2212
2561
  */
@@ -2269,77 +2618,276 @@ export declare const luts: {
2269
2618
  * Mask {@link Image} factory.
2270
2619
  */
2271
2620
  export declare class MaskFactory {
2272
- checkElements(_dicomElements: any): void;
2621
+ /**
2622
+ * Get a warning string if elements are not as expected.
2623
+ * Created by checkElements.
2624
+ *
2625
+ * @returns {string|undefined} The warning.
2626
+ */
2627
+ getWarning(): string | undefined;
2628
+ /**
2629
+ * Check dicom elements. Throws an error if not suitable.
2630
+ *
2631
+ * @param {Object<string, DataElement>} _dicomElements The DICOM tags.
2632
+ * @returns {string|undefined} A possible warning.
2633
+ */
2634
+ checkElements(_dicomElements: {
2635
+ [x: string]: DataElement;
2636
+ }): string | undefined;
2273
2637
  /**
2274
2638
  * Get an {@link Image} object from the read DICOM file.
2275
2639
  *
2276
- * @param {DataElements} dataElements The DICOM tags.
2640
+ * @param {Object<string, DataElement>} dataElements The DICOM tags.
2277
2641
  * @param {Uint8Array | Int8Array |
2278
2642
  * Uint16Array | Int16Array |
2279
2643
  * Uint32Array | Int32Array} pixelBuffer The pixel buffer.
2280
2644
  * @returns {Image} A new Image.
2281
2645
  */
2282
- create(dataElements: DataElements, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array): Image_2;
2646
+ create(dataElements: {
2647
+ [x: string]: DataElement;
2648
+ }, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array): Image_2;
2649
+ /**
2650
+ * Convert a mask image into a DICOM segmentation object.
2651
+ *
2652
+ * @param {Image} image The mask image.
2653
+ * @param {MaskSegment[]} segments The mask segments.
2654
+ * @param {Image} sourceImage The source image.
2655
+ * @param {Object<string, any>} [extraTags] Optional list of extra tags.
2656
+ * @returns {Object<string, DataElement>} A list of dicom elements.
2657
+ */
2658
+ toDicom(image: Image_2, segments: MaskSegment[], sourceImage: Image_2, extraTags?: {
2659
+ [x: string]: any;
2660
+ }): {
2661
+ [x: string]: DataElement;
2662
+ };
2663
+ #private;
2283
2664
  }
2284
2665
 
2285
2666
  /**
2286
- * Immutable 3x3 Matrix.
2667
+ * DICOM (mask) segment: item of a SegmentSequence (0062,0002).
2668
+ *
2669
+ * Ref: {@link https://dicom.nema.org/medical/dicom/2022a/output/chtml/part03/sect_C.8.20.4.html}.
2287
2670
  */
2288
- export declare class Matrix33 {
2671
+ export declare class MaskSegment {
2289
2672
  /**
2290
- * @param {number[]} values row-major ordered 9 values.
2673
+ * @param {number} number The segment number.
2674
+ * @param {string} label The segment label.
2675
+ * @param {string} algorithmType The segment number.
2291
2676
  */
2292
- constructor(values: number[]);
2677
+ constructor(number: number, label: string, algorithmType: string);
2293
2678
  /**
2294
- * Get a value of the matrix.
2679
+ * Segment number (0062,0004).
2295
2680
  *
2296
- * @param {number} row The row at wich to get the value.
2297
- * @param {number} col The column at wich to get the value.
2298
- * @returns {number|undefined} The value at the position.
2681
+ * @type {number}
2299
2682
  */
2300
- get(row: number, col: number): number | undefined;
2683
+ number: number;
2301
2684
  /**
2302
- * Get the inverse of this matrix.
2685
+ * Segment label (0062,0005).
2303
2686
  *
2304
- * @returns {Matrix33|undefined} The inverse matrix or undefined
2305
- * if the determinant is zero.
2687
+ * @type {string}
2306
2688
  */
2307
- getInverse(): Matrix33 | undefined;
2689
+ label: string;
2308
2690
  /**
2309
- * Check for Matrix33 equality.
2691
+ * Segment algorithm type (0062,0008).
2310
2692
  *
2311
- * @param {Matrix33} rhs The other matrix to compare to.
2312
- * @param {number} [p] A numeric expression for the precision to use in check
2313
- * (ex: 0.001). Defaults to Number.EPSILON if not provided.
2314
- * @returns {boolean} True if both matrices are equal.
2693
+ * @type {string}
2315
2694
  */
2316
- equals(rhs: Matrix33, p?: number): boolean;
2695
+ algorithmType: string;
2317
2696
  /**
2318
- * Get a string representation of the Matrix33.
2697
+ * Segment algorithm name (0062,0009).
2319
2698
  *
2320
- * @returns {string} The matrix as a string.
2699
+ * @type {string|undefined}
2321
2700
  */
2322
- toString(): string;
2701
+ algorithmName: string | undefined;
2323
2702
  /**
2324
- * Multiply this matrix by another.
2703
+ * Segment display value as simple value.
2325
2704
  *
2326
- * @param {Matrix33} rhs The matrix to multiply by.
2327
- * @returns {Matrix33} The product matrix.
2705
+ * @type {number|undefined}
2328
2706
  */
2329
- multiply(rhs: Matrix33): Matrix33;
2707
+ displayValue: number | undefined;
2330
2708
  /**
2331
- * Get the absolute value of this matrix.
2709
+ * Segment display value as RGB colour ({r,g,b}).
2332
2710
  *
2333
- * @returns {Matrix33} The result matrix.
2711
+ * @type {RGB|undefined}
2334
2712
  */
2335
- getAbs(): Matrix33;
2713
+ displayRGBValue: RGB | undefined;
2336
2714
  /**
2337
- * Multiply this matrix by a 3D array.
2715
+ * Segment property code: specific property
2716
+ * the segment represents (0062,000F).
2338
2717
  *
2339
- * @param {number[]} array3D The input 3D array.
2340
- * @returns {number[]} The result 3D array.
2718
+ * @type {DicomCode|undefined}
2341
2719
  */
2342
- multiplyArray3D(array3D: number[]): number[];
2720
+ propertyTypeCode: DicomCode | undefined;
2721
+ /**
2722
+ * Segment property category code: general category
2723
+ * of the property the segment represents (0062,0003).
2724
+ *
2725
+ * @type {DicomCode|undefined}
2726
+ */
2727
+ propertyCategoryCode: DicomCode | undefined;
2728
+ /**
2729
+ * Segment tracking UID (0062,0021).
2730
+ *
2731
+ * @type {string|undefined}
2732
+ */
2733
+ trackingUid: string | undefined;
2734
+ /**
2735
+ * Segment tracking id: text label for the UID (0062,0020).
2736
+ *
2737
+ * @type {string|undefined}
2738
+ */
2739
+ trackingId: string | undefined;
2740
+ }
2741
+
2742
+ /**
2743
+ * Mask segment helper: helps handling the segments list,
2744
+ * but does *NOT* update the associated mask (use special commands
2745
+ * for that such as DeleteSegmentCommand, ChangeSegmentColourCommand...).
2746
+ */
2747
+ export declare class MaskSegmentHelper {
2748
+ /**
2749
+ * @param {Image} mask The associated mask image.
2750
+ */
2751
+ constructor(mask: Image_2);
2752
+ /**
2753
+ * Check if a segment is part of the segments list.
2754
+ *
2755
+ * @param {number} segmentNumber The segment number.
2756
+ * @returns {boolean} True if the segment is included.
2757
+ */
2758
+ hasSegment(segmentNumber: number): boolean;
2759
+ /**
2760
+ * Check if a segment is present in a mask image.
2761
+ *
2762
+ * @param {number[]} numbers Array of segment numbers.
2763
+ * @returns {boolean[]} Array of boolean set to true
2764
+ * if the segment is present in the mask.
2765
+ */
2766
+ maskHasSegments(numbers: number[]): boolean[];
2767
+ /**
2768
+ * Get a segment from the inner segment list.
2769
+ *
2770
+ * @param {number} segmentNumber The segment number.
2771
+ * @returns {MaskSegment|undefined} The segment or undefined if not found.
2772
+ */
2773
+ getSegment(segmentNumber: number): MaskSegment | undefined;
2774
+ /**
2775
+ * Add a segment to the segments list.
2776
+ *
2777
+ * @param {MaskSegment} segment The segment to add.
2778
+ */
2779
+ addSegment(segment: MaskSegment): void;
2780
+ /**
2781
+ * Remove a segment from the segments list.
2782
+ *
2783
+ * @param {number} segmentNumber The segment number.
2784
+ */
2785
+ removeSegment(segmentNumber: number): void;
2786
+ /**
2787
+ * Update a segment of the segments list.
2788
+ *
2789
+ * @param {MaskSegment} segment The segment to update.
2790
+ */
2791
+ updateSegment(segment: MaskSegment): void;
2792
+ #private;
2793
+ }
2794
+
2795
+ /**
2796
+ * Mask segment view helper: handles hidden segments.
2797
+ */
2798
+ export declare class MaskSegmentViewHelper {
2799
+ /**
2800
+ * Check if a segment is in the hidden list.
2801
+ *
2802
+ * @param {number} segmentNumber The segment number.
2803
+ * @returns {boolean} True if the segment is in the list.
2804
+ */
2805
+ isHidden(segmentNumber: number): boolean;
2806
+ /**
2807
+ * Add a segment to the hidden list.
2808
+ *
2809
+ * @param {MaskSegment} segment The segment to add.
2810
+ */
2811
+ addToHidden(segment: MaskSegment): void;
2812
+ /**
2813
+ * Remove a segment from the hidden list.
2814
+ *
2815
+ * @param {number} segmentNumber The segment number.
2816
+ */
2817
+ removeFromHidden(segmentNumber: number): void;
2818
+ /**
2819
+ * @callback alphaFn@callback alphaFn
2820
+ * @param {number[]|number} value The pixel value.
2821
+ * @param {number} index The values' index.
2822
+ * @returns {number} The opacity of the input value.
2823
+ */
2824
+ /**
2825
+ * Get the alpha function to apply hidden colors.
2826
+ *
2827
+ * @returns {alphaFn} The corresponding alpha function.
2828
+ */
2829
+ getAlphaFunc(): (value: number[] | number, index: number) => number;
2830
+ #private;
2831
+ }
2832
+
2833
+ /**
2834
+ * Immutable 3x3 Matrix.
2835
+ */
2836
+ export declare class Matrix33 {
2837
+ /**
2838
+ * @param {number[]} values Row-major ordered 9 values.
2839
+ */
2840
+ constructor(values: number[]);
2841
+ /**
2842
+ * Get a value of the matrix.
2843
+ *
2844
+ * @param {number} row The row at wich to get the value.
2845
+ * @param {number} col The column at wich to get the value.
2846
+ * @returns {number|undefined} The value at the position.
2847
+ */
2848
+ get(row: number, col: number): number | undefined;
2849
+ /**
2850
+ * Get the inverse of this matrix.
2851
+ *
2852
+ * @returns {Matrix33|undefined} The inverse matrix or undefined
2853
+ * if the determinant is zero.
2854
+ */
2855
+ getInverse(): Matrix33 | undefined;
2856
+ /**
2857
+ * Check for Matrix33 equality.
2858
+ *
2859
+ * @param {Matrix33} rhs The other matrix to compare to.
2860
+ * @param {number} [p] A numeric expression for the precision to use in check
2861
+ * (ex: 0.001). Defaults to Number.EPSILON if not provided.
2862
+ * @returns {boolean} True if both matrices are equal.
2863
+ */
2864
+ equals(rhs: Matrix33, p?: number): boolean;
2865
+ /**
2866
+ * Get a string representation of the Matrix33.
2867
+ *
2868
+ * @returns {string} The matrix as a string.
2869
+ */
2870
+ toString(): string;
2871
+ /**
2872
+ * Multiply this matrix by another.
2873
+ *
2874
+ * @param {Matrix33} rhs The matrix to multiply by.
2875
+ * @returns {Matrix33} The product matrix.
2876
+ */
2877
+ multiply(rhs: Matrix33): Matrix33;
2878
+ /**
2879
+ * Get the absolute value of this matrix.
2880
+ *
2881
+ * @returns {Matrix33} The result matrix.
2882
+ */
2883
+ getAbs(): Matrix33;
2884
+ /**
2885
+ * Multiply this matrix by a 3D array.
2886
+ *
2887
+ * @param {number[]} array3D The input 3D array.
2888
+ * @returns {number[]} The result 3D array.
2889
+ */
2890
+ multiplyArray3D(array3D: number[]): number[];
2343
2891
  /**
2344
2892
  * Multiply this matrix by a 3D vector.
2345
2893
  *
@@ -2376,7 +2924,7 @@ export declare class Matrix33 {
2376
2924
  */
2377
2925
  getColAbsMax(col: number): object;
2378
2926
  /**
2379
- * Get this matrix with only zero and +/- ones instead of the maximum,
2927
+ * Get this matrix with only zero and +/- ones instead of the maximum.
2380
2928
  *
2381
2929
  * @returns {Matrix33} The simplified matrix.
2382
2930
  */
@@ -2390,6 +2938,31 @@ export declare class Matrix33 {
2390
2938
  #private;
2391
2939
  }
2392
2940
 
2941
+ /**
2942
+ * Number range.
2943
+ */
2944
+ export declare class NumberRange {
2945
+ /**
2946
+ * @param {number} min The minimum.
2947
+ * @param {number} max The maximum.
2948
+ */
2949
+ constructor(min: number, max: number);
2950
+ /**
2951
+ * @type {number}
2952
+ */
2953
+ min: number;
2954
+ /**
2955
+ * @type {number}
2956
+ */
2957
+ max: number;
2958
+ }
2959
+
2960
+ export declare namespace Orientation {
2961
+ let Axial: string;
2962
+ let Coronal: string;
2963
+ let Sagittal: string;
2964
+ }
2965
+
2393
2966
  /**
2394
2967
  * DICOM Header overlay info.
2395
2968
  */
@@ -2443,6 +3016,101 @@ export declare class OverlayData {
2443
3016
  #private;
2444
3017
  }
2445
3018
 
3019
+ /**
3020
+ * Plane geometry helper.
3021
+ */
3022
+ export declare class PlaneHelper {
3023
+ /**
3024
+ * @param {Spacing} spacing The spacing.
3025
+ * @param {Matrix33} imageOrientation The image oientation.
3026
+ * @param {Matrix33} viewOrientation The view orientation.
3027
+ */
3028
+ constructor(spacing: Spacing, imageOrientation: Matrix33, viewOrientation: Matrix33);
3029
+ /**
3030
+ * Get a 3D offset from a plane one.
3031
+ *
3032
+ * @param {Scalar2D} offset2D The plane offset as {x,y}.
3033
+ * @returns {Vector3D} The 3D world offset.
3034
+ */
3035
+ getOffset3DFromPlaneOffset(offset2D: Scalar2D): Vector3D;
3036
+ /**
3037
+ * Get a plane offset from a 3D one.
3038
+ *
3039
+ * @param {Scalar3D} offset3D The 3D offset as {x,y,z}.
3040
+ * @returns {Scalar2D} The plane offset as {x,y}.
3041
+ */
3042
+ getPlaneOffsetFromOffset3D(offset3D: Scalar3D): Scalar2D;
3043
+ /**
3044
+ * Orient an input vector from real to target space.
3045
+ *
3046
+ * @param {Vector3D} vector The input vector.
3047
+ * @returns {Vector3D} The oriented vector.
3048
+ */
3049
+ getTargetOrientedVector3D(vector: Vector3D): Vector3D;
3050
+ /**
3051
+ * De-orient an input vector from target to real space.
3052
+ *
3053
+ * @param {Vector3D} planeVector The input vector.
3054
+ * @returns {Vector3D} The de-orienteded vector.
3055
+ */
3056
+ getTargetDeOrientedVector3D(planeVector: Vector3D): Vector3D;
3057
+ /**
3058
+ * De-orient an input point from target to real space.
3059
+ *
3060
+ * @param {Point3D} planePoint The input point.
3061
+ * @returns {Point3D} The de-orienteded point.
3062
+ */
3063
+ getTargetDeOrientedPoint3D(planePoint: Point3D): Point3D;
3064
+ /**
3065
+ * Orient an input vector from target to image space.
3066
+ *
3067
+ * @param {Vector3D} planeVector The input vector.
3068
+ * @returns {Vector3D} The orienteded vector.
3069
+ */
3070
+ getImageOrientedVector3D(planeVector: Vector3D): Vector3D;
3071
+ /**
3072
+ * Orient an input point from target to image space.
3073
+ *
3074
+ * @param {Point3D} planePoint The input vector.
3075
+ * @returns {Point3D} The orienteded vector.
3076
+ */
3077
+ getImageOrientedPoint3D(planePoint: Point3D): Point3D;
3078
+ /**
3079
+ * De-orient an input vector from image to target space.
3080
+ *
3081
+ * @param {Vector3D} vector The input vector.
3082
+ * @returns {Vector3D} The de-orienteded vector.
3083
+ */
3084
+ getImageDeOrientedVector3D(vector: Vector3D): Vector3D;
3085
+ /**
3086
+ * De-orient an input point from image to target space.
3087
+ *
3088
+ * @param {Point3D} point The input point.
3089
+ * @returns {Point3D} The de-orienteded point.
3090
+ */
3091
+ getImageDeOrientedPoint3D(point: Point3D): Point3D;
3092
+ /**
3093
+ * Reorder values to follow target orientation.
3094
+ *
3095
+ * @param {Scalar3D} values Values as {x,y,z}.
3096
+ * @returns {Scalar3D} Reoriented values as {x,y,z}.
3097
+ */
3098
+ getTargetOrientedPositiveXYZ(values: Scalar3D): Scalar3D;
3099
+ /**
3100
+ * Get the (view) scroll dimension index.
3101
+ *
3102
+ * @returns {number} The index.
3103
+ */
3104
+ getScrollIndex(): number;
3105
+ /**
3106
+ * Get the native (image) scroll dimension index.
3107
+ *
3108
+ * @returns {number} The index.
3109
+ */
3110
+ getNativeScrollIndex(): number;
3111
+ #private;
3112
+ }
3113
+
2446
3114
  /**
2447
3115
  * Immutable point.
2448
3116
  * Warning: the input array is NOT cloned, modifying it will
@@ -2556,19 +3224,6 @@ export declare class Point2D {
2556
3224
  * @returns {string} The point as a string.
2557
3225
  */
2558
3226
  toString(): string;
2559
- /**
2560
- * Get the distance to another Point2D.
2561
- *
2562
- * @param {Point2D} point2D The input point.
2563
- * @returns {number} The distance to the input point.
2564
- */
2565
- getDistance(point2D: Point2D): number;
2566
- /**
2567
- * Round a Point2D.
2568
- *
2569
- * @returns {Point2D} The rounded point.
2570
- */
2571
- getRound(): Point2D;
2572
3227
  #private;
2573
3228
  }
2574
3229
 
@@ -2629,6 +3284,13 @@ export declare class Point3D {
2629
3284
  * @returns {number} Ths distance to the input point.
2630
3285
  */
2631
3286
  getDistance(point3D: Point3D): number;
3287
+ /**
3288
+ * Get the closest point to this in a Point3D list.
3289
+ *
3290
+ * @param {Point3D[]} pointList The list to check.
3291
+ * @returns {number} The index of the closest point in the input list.
3292
+ */
3293
+ getClosest(pointList: Point3D[]): number;
2632
3294
  /**
2633
3295
  * Get the difference to another Point3D.
2634
3296
  *
@@ -2641,9 +3303,11 @@ export declare class Point3D {
2641
3303
 
2642
3304
  /**
2643
3305
  * Round a float number to a given precision.
2644
- * Inspired from https://stackoverflow.com/a/49729715/3639892.
3306
+ *
3307
+ * Inspired from {@link https://stackoverflow.com/a/49729715/3639892}.
3308
+ *
2645
3309
  * Can be a solution to not have trailing zero as when
2646
- * using toFixed or toPrecision.
3310
+ * using toFixed or toPrecision.
2647
3311
  * '+number.toFixed(precision)' does not pass all the tests...
2648
3312
  *
2649
3313
  * @param {number} number The number to round.
@@ -2653,40 +3317,7 @@ export declare class Point3D {
2653
3317
  export declare function precisionRound(number: number, precision: number): number;
2654
3318
 
2655
3319
  /**
2656
- * Rescale LUT class.
2657
- * Typically converts from integer to float.
2658
- */
2659
- export declare class RescaleLut {
2660
- /**
2661
- * @param {RescaleSlopeAndIntercept} rsi The rescale slope and intercept.
2662
- * @param {number} bitsStored The number of bits used to store the data.
2663
- */
2664
- constructor(rsi: RescaleSlopeAndIntercept, bitsStored: number);
2665
- /**
2666
- * Get the Rescale Slope and Intercept (RSI).
2667
- *
2668
- * @returns {RescaleSlopeAndIntercept} The rescale slope and intercept object.
2669
- */
2670
- getRSI(): RescaleSlopeAndIntercept;
2671
- /**
2672
- * Get the length of the LUT array.
2673
- *
2674
- * @returns {number} The length of the LUT array.
2675
- */
2676
- getLength(): number;
2677
- /**
2678
- * Get the value of the LUT at the given offset.
2679
- *
2680
- * @param {number} offset The input offset in [0,2^bitsStored] range
2681
- * or full range for ID rescale.
2682
- * @returns {number} The float32 value of the LUT at the given offset.
2683
- */
2684
- getValue(offset: number): number;
2685
- #private;
2686
- }
2687
-
2688
- /**
2689
- * Rescale Slope and Intercept
3320
+ * Rescale Slope and Intercept.
2690
3321
  */
2691
3322
  export declare class RescaleSlopeAndIntercept {
2692
3323
  /**
@@ -2729,6 +3360,96 @@ export declare class RescaleSlopeAndIntercept {
2729
3360
  #private;
2730
3361
  }
2731
3362
 
3363
+ /**
3364
+ * RGB colour class.
3365
+ */
3366
+ export declare class RGB {
3367
+ /**
3368
+ * @param {number} r Red component.
3369
+ * @param {number} g Green component.
3370
+ * @param {number} b Blue component.
3371
+ */
3372
+ constructor(r: number, g: number, b: number);
3373
+ /**
3374
+ * Red component.
3375
+ *
3376
+ * @type {number}
3377
+ */
3378
+ r: number;
3379
+ /**
3380
+ * Green component.
3381
+ *
3382
+ * @type {number}
3383
+ */
3384
+ g: number;
3385
+ /**
3386
+ * Blue component.
3387
+ *
3388
+ * @type {number}
3389
+ */
3390
+ b: number;
3391
+ }
3392
+
3393
+ /**
3394
+ * Mutable 2D scalar ({x,y}).
3395
+ */
3396
+ export declare class Scalar2D {
3397
+ /**
3398
+ * X value.
3399
+ *
3400
+ * @type {number}
3401
+ */
3402
+ x: number;
3403
+ /**
3404
+ * Y value.
3405
+ *
3406
+ * @type {number}
3407
+ */
3408
+ y: number;
3409
+ }
3410
+
3411
+ /**
3412
+ * Mutable 3D scalar ({x,y,z}).
3413
+ */
3414
+ export declare class Scalar3D {
3415
+ /**
3416
+ * X value.
3417
+ *
3418
+ * @type {number}
3419
+ */
3420
+ x: number;
3421
+ /**
3422
+ * Y value.
3423
+ *
3424
+ * @type {number}
3425
+ */
3426
+ y: number;
3427
+ /**
3428
+ * Z value.
3429
+ *
3430
+ * @type {number}
3431
+ */
3432
+ z: number;
3433
+ }
3434
+
3435
+ /**
3436
+ * Scroll wheel class: provides a wheel event handler
3437
+ * that scroll the corresponding data.
3438
+ */
3439
+ export declare class ScrollWheel {
3440
+ /**
3441
+ * @param {App} app The associated application.
3442
+ */
3443
+ constructor(app: App);
3444
+ /**
3445
+ * Handle mouse wheel event.
3446
+ *
3447
+ * @param {WheelEvent} event The mouse wheel event.
3448
+ */
3449
+ wheel(event: WheelEvent): void;
3450
+ #private;
3451
+ }
3452
+
2732
3453
  /**
2733
3454
  * Immutable Size class.
2734
3455
  * Warning: the input array is NOT cloned, modifying it will
@@ -2736,9 +3457,9 @@ export declare class RescaleSlopeAndIntercept {
2736
3457
  */
2737
3458
  export declare class Size {
2738
3459
  /**
2739
- * @param {Array} values The size values.
3460
+ * @param {number[]} values The size values.
2740
3461
  */
2741
- constructor(values: any[]);
3462
+ constructor(values: number[]);
2742
3463
  /**
2743
3464
  * Get the size value at the given array index.
2744
3465
  *
@@ -2761,9 +3482,9 @@ export declare class Size {
2761
3482
  /**
2762
3483
  * Get the values of this index.
2763
3484
  *
2764
- * @returns {Array} The array of values.
3485
+ * @returns {number[]} The array of values.
2765
3486
  */
2766
- getValues(): any[];
3487
+ getValues(): number[];
2767
3488
  /**
2768
3489
  * Check if a dimension exists and has more than one element.
2769
3490
  *
@@ -2812,10 +3533,10 @@ export declare class Size {
2812
3533
  * Check that an index is within bounds.
2813
3534
  *
2814
3535
  * @param {Index} index The index to check.
2815
- * @param {Array} dirs Optional list of directions to check.
3536
+ * @param {number[]} dirs Optional list of directions to check.
2816
3537
  * @returns {boolean} True if the given coordinates are within bounds.
2817
3538
  */
2818
- isInBounds(index: Index, dirs: any[]): boolean;
3539
+ isInBounds(index: Index, dirs: number[]): boolean;
2819
3540
  /**
2820
3541
  * Convert an index to an offset in memory.
2821
3542
  *
@@ -2834,9 +3555,9 @@ export declare class Size {
2834
3555
  /**
2835
3556
  * Get the 2D base of this size.
2836
3557
  *
2837
- * @returns {object} The 2D base [0,1] as {x,y}.
3558
+ * @returns {Scalar2D} The 2D base [0,1] as {x,y}.
2838
3559
  */
2839
- get2D(): object;
3560
+ get2D(): Scalar2D;
2840
3561
  #private;
2841
3562
  }
2842
3563
 
@@ -2847,9 +3568,9 @@ export declare class Size {
2847
3568
  */
2848
3569
  export declare class Spacing {
2849
3570
  /**
2850
- * @param {Array} values The spacing values.
3571
+ * @param {number[]} values The spacing values.
2851
3572
  */
2852
- constructor(values: any[]);
3573
+ constructor(values: number[]);
2853
3574
  /**
2854
3575
  * Get the spacing value at the given array index.
2855
3576
  *
@@ -2872,9 +3593,9 @@ export declare class Spacing {
2872
3593
  /**
2873
3594
  * Get the values of this spacing.
2874
3595
  *
2875
- * @returns {Array} The array of values.
3596
+ * @returns {number[]} The array of values.
2876
3597
  */
2877
- getValues(): any[];
3598
+ getValues(): number[];
2878
3599
  /**
2879
3600
  * Check for equality.
2880
3601
  *
@@ -2885,19 +3606,19 @@ export declare class Spacing {
2885
3606
  /**
2886
3607
  * Get the 2D base of this size.
2887
3608
  *
2888
- * @returns {object} The 2D base [col,row] as {x,y}.
3609
+ * @returns {Scalar2D} The 2D base [col,row] as {x,y}.
2889
3610
  */
2890
- get2D(): object;
3611
+ get2D(): Scalar2D;
2891
3612
  #private;
2892
3613
  }
2893
3614
 
2894
3615
  /**
2895
3616
  * Convert sRGB to CIE LAB (standard illuminant D65).
2896
3617
  *
2897
- * @param {object} triplet sRGB triplet as {r,g,b}.
3618
+ * @param {RGB} triplet 'sRGB' triplet as {r,g,b}.
2898
3619
  * @returns {object} CIE LAB triplet as {l,a,b}.
2899
3620
  */
2900
- export declare function srgbToCielab(triplet: object): object;
3621
+ export declare function srgbToCielab(triplet: RGB): object;
2901
3622
 
2902
3623
  /**
2903
3624
  * Immutable tag.
@@ -2955,18 +3676,13 @@ export declare class Tag {
2955
3676
  isWithVR(): boolean;
2956
3677
  /**
2957
3678
  * Is the tag group a private tag group ?
2958
- * see: http://dicom.nema.org/medical/dicom/2015a/output/html/part05.html#sect_7.8
3679
+ *
3680
+ * See: {@link http://dicom.nema.org/medical/dicom/2022a/output/html/part05.html#sect_7.8}.
2959
3681
  *
2960
3682
  * @returns {boolean} True if the tag group is private,
2961
3683
  * ie if its group is an odd number.
2962
3684
  */
2963
3685
  isPrivate(): boolean;
2964
- /**
2965
- * Get the tag info from the dicom dictionary.
2966
- *
2967
- * @returns {Array|undefined} The info as [vr, multiplicity, name].
2968
- */
2969
- getInfoFromDictionary(): any[] | undefined;
2970
3686
  /**
2971
3687
  * Get the tag Value Representation (VR) from the dicom dictionary.
2972
3688
  *
@@ -3011,6 +3727,13 @@ export declare class ToolboxController {
3011
3727
  * Initialise.
3012
3728
  */
3013
3729
  init(): void;
3730
+ /**
3731
+ * Enable or disable shortcuts. The 'init' methods enables shortcuts
3732
+ * by default. Call this method after init to disable shortcuts.
3733
+ *
3734
+ * @param {boolean} flag True to enable shortcuts.
3735
+ */
3736
+ enableShortcuts(flag: boolean): void;
3014
3737
  /**
3015
3738
  * Get the tool list.
3016
3739
  *
@@ -3078,16 +3801,15 @@ export declare class ToolConfig {
3078
3801
  options: string[] | undefined;
3079
3802
  }
3080
3803
 
3081
- export declare namespace toolList {
3082
- { WindowLevel };
3083
- { Scroll };
3084
- { ZoomAndPan };
3085
- { Opacity };
3086
- { Draw };
3087
- { Filter };
3088
- { Floodfill };
3089
- { Livewire };
3090
- }
3804
+ /**
3805
+ * List of client provided tools to be added to
3806
+ * the default ones.
3807
+ *
3808
+ * @type {Object<string, any>}
3809
+ */
3810
+ export declare const toolList: {
3811
+ [x: string]: any;
3812
+ };
3091
3813
 
3092
3814
  /**
3093
3815
  * Immutable 3D vector.
@@ -3141,7 +3863,8 @@ export declare class Vector3D {
3141
3863
  * vector that is perpendicular to both a and b.
3142
3864
  * If both vectors are parallel, the cross product is a zero vector.
3143
3865
  *
3144
- * @see https://en.wikipedia.org/wiki/Cross_product
3866
+ * Ref: {@link https://en.wikipedia.org/wiki/Cross_product}.
3867
+ *
3145
3868
  * @param {Vector3D} vector3D The input vector.
3146
3869
  * @returns {Vector3D} The result vector.
3147
3870
  */
@@ -3149,11 +3872,19 @@ export declare class Vector3D {
3149
3872
  /**
3150
3873
  * Get the dot product with another Vector3D.
3151
3874
  *
3152
- * @see https://en.wikipedia.org/wiki/Dot_product
3875
+ * Ref: {@link https://en.wikipedia.org/wiki/Dot_product}.
3876
+ *
3153
3877
  * @param {Vector3D} vector3D The input vector.
3154
3878
  * @returns {number} The dot product.
3155
3879
  */
3156
3880
  dotProduct(vector3D: Vector3D): number;
3881
+ /**
3882
+ * Is this vector codirectional to an input one.
3883
+ *
3884
+ * @param {Vector3D} vector3D The vector to test.
3885
+ * @returns {boolean} True if codirectional, false is opposite.
3886
+ */
3887
+ isCodirectional(vector3D: Vector3D): boolean;
3157
3888
  #private;
3158
3889
  }
3159
3890
 
@@ -3228,7 +3959,7 @@ export declare class View {
3228
3959
  */
3229
3960
  init(): void;
3230
3961
  /**
3231
- * Set the initial index to 0.
3962
+ * Set the initial index to the middle position.
3232
3963
  */
3233
3964
  setInitialIndex(): void;
3234
3965
  /**
@@ -3240,31 +3971,23 @@ export declare class View {
3240
3971
  getPlaybackMilliseconds(recommendedDisplayFrameRate: number): number;
3241
3972
  /**
3242
3973
  * @callback alphaFn@callback alphaFn
3243
- * @param {object} value The pixel value.
3244
- * @param {object} index The values' index.
3245
- * @returns {number} The value to display.
3974
+ * @param {number[]|number} value The pixel value.
3975
+ * @param {number} index The values' index.
3976
+ * @returns {number} The opacity of the input value.
3246
3977
  */
3247
3978
  /**
3248
3979
  * Get the alpha function.
3249
3980
  *
3250
3981
  * @returns {alphaFn} The function.
3251
3982
  */
3252
- getAlphaFunction(): (value: object, index: object) => number;
3983
+ getAlphaFunction(): (value: number[] | number, index: number) => number;
3253
3984
  /**
3254
3985
  * Set alpha function.
3255
3986
  *
3256
3987
  * @param {alphaFn} func The function.
3257
3988
  * @fires View#alphafuncchange
3258
3989
  */
3259
- setAlphaFunction(func: (value: object, index: object) => number): void;
3260
- /**
3261
- * Get the window LUT of the image.
3262
- * Warning: can be undefined in no window/level was set.
3263
- *
3264
- * @returns {WindowLut} The window LUT of the image.
3265
- * @fires View#wlchange
3266
- */
3267
- getCurrentWindowLut(): WindowLut;
3990
+ setAlphaFunction(func: (value: number[] | number, index: number) => number): void;
3268
3991
  /**
3269
3992
  * Get the window presets.
3270
3993
  *
@@ -3274,9 +3997,9 @@ export declare class View {
3274
3997
  /**
3275
3998
  * Get the window presets names.
3276
3999
  *
3277
- * @returns {object} The list of window presets names.
4000
+ * @returns {string[]} The list of window presets names.
3278
4001
  */
3279
- getWindowPresetsNames(): object;
4002
+ getWindowPresetsNames(): string[];
3280
4003
  /**
3281
4004
  * Set the window presets.
3282
4005
  *
@@ -3321,12 +4044,13 @@ export declare class View {
3321
4044
  */
3322
4045
  getCurrentIndex(): Index;
3323
4046
  /**
3324
- * Check is the provided position can be set.
4047
+ * Check if the current position (default) or
4048
+ * the provided position is in bounds.
3325
4049
  *
3326
- * @param {Point} position The position.
4050
+ * @param {Point} [position] Optional position.
3327
4051
  * @returns {boolean} True is the position is in bounds.
3328
4052
  */
3329
- canSetPosition(position: Point): boolean;
4053
+ isPositionInBounds(position?: Point): boolean;
3330
4054
  /**
3331
4055
  * Get the first origin or at a given position.
3332
4056
  *
@@ -3339,7 +4063,7 @@ export declare class View {
3339
4063
  *
3340
4064
  * @param {Point} position The new position.
3341
4065
  * @param {boolean} silent Flag to fire event or not.
3342
- * @returns {boolean} False if not in bounds
4066
+ * @returns {boolean} False if not in bounds.
3343
4067
  * @fires View#positionchange
3344
4068
  */
3345
4069
  setCurrentPosition(position: Point, silent: boolean): boolean;
@@ -3355,14 +4079,19 @@ export declare class View {
3355
4079
  /**
3356
4080
  * Set the view window/level.
3357
4081
  *
3358
- * @param {number} center The window center.
3359
- * @param {number} width The window width.
4082
+ * @param {WindowLevel} wl The window and level.
3360
4083
  * @param {string} [name] Associated preset name, defaults to 'manual'.
3361
4084
  * Warning: uses the latest set rescale LUT or the default linear one.
3362
4085
  * @param {boolean} [silent] Flag to launch events with skipGenerate.
3363
4086
  * @fires View#wlchange
3364
4087
  */
3365
- setWindowLevel(center: number, width: number, name?: string, silent?: boolean): void;
4088
+ setWindowLevel(wl: WindowLevel, name?: string, silent?: boolean): void;
4089
+ /**
4090
+ * Get the window/level.
4091
+ *
4092
+ * @returns {WindowLevel} The window and level.
4093
+ */
4094
+ getWindowLevel(): WindowLevel;
3366
4095
  /**
3367
4096
  * Set the window level to the preset with the input name.
3368
4097
  *
@@ -3397,9 +4126,9 @@ export declare class View {
3397
4126
  * Get the image window/level that covers the full data range.
3398
4127
  * Warning: uses the latest set rescale LUT or the default linear one.
3399
4128
  *
3400
- * @returns {WindowCenterAndWidth} A min/max window level.
4129
+ * @returns {WindowLevel} A min/max window level.
3401
4130
  */
3402
- getWindowLevelMinMax(): WindowCenterAndWidth;
4131
+ getWindowLevelMinMax(): WindowLevel;
3403
4132
  /**
3404
4133
  * Set the image window/level to cover the full data range.
3405
4134
  * Warning: uses the latest set rescale LUT or the default linear one.
@@ -3413,42 +4142,12 @@ export declare class View {
3413
4142
  * otherwise generates at current index.
3414
4143
  */
3415
4144
  generateImageData(data: ImageData, index: Index): void;
3416
- /**
3417
- * Increment the provided dimension.
3418
- *
3419
- * @param {number} dim The dimension to increment.
3420
- * @param {boolean} silent Do not send event.
3421
- * @returns {boolean} False if not in bounds.
3422
- */
3423
- incrementIndex(dim: number, silent: boolean): boolean;
3424
- /**
3425
- * Decrement the provided dimension.
3426
- *
3427
- * @param {number} dim The dimension to increment.
3428
- * @param {boolean} silent Do not send event.
3429
- * @returns {boolean} False if not in bounds.
3430
- */
3431
- decrementIndex(dim: number, silent: boolean): boolean;
3432
4145
  /**
3433
4146
  * Get the scroll dimension index.
3434
4147
  *
3435
4148
  * @returns {number} The index.
3436
4149
  */
3437
4150
  getScrollIndex(): number;
3438
- /**
3439
- * Decrement the scroll dimension index.
3440
- *
3441
- * @param {boolean} silent Do not send event.
3442
- * @returns {boolean} False if not in bounds.
3443
- */
3444
- decrementScrollIndex(silent: boolean): boolean;
3445
- /**
3446
- * Increment the scroll dimension index.
3447
- *
3448
- * @param {boolean} silent Do not send event.
3449
- * @returns {boolean} False if not in bounds.
3450
- */
3451
- incrementScrollIndex(silent: boolean): boolean;
3452
4151
  #private;
3453
4152
  }
3454
4153
 
@@ -3486,6 +4185,26 @@ export declare class ViewConfig {
3486
4185
  * @type {number|undefined}
3487
4186
  */
3488
4187
  opacity: number | undefined;
4188
+ /**
4189
+ * Optional layer window level preset name.
4190
+ * If present, the preset name will be used and
4191
+ * the window centre and width ignored.
4192
+ *
4193
+ * @type {string|undefined}
4194
+ */
4195
+ wlPresetName: string | undefined;
4196
+ /**
4197
+ * Optional layer window center.
4198
+ *
4199
+ * @type {number|undefined}
4200
+ */
4201
+ windowCenter: number | undefined;
4202
+ /**
4203
+ * Optional layer window width.
4204
+ *
4205
+ * @type {number|undefined}
4206
+ */
4207
+ windowWidth: number | undefined;
3489
4208
  }
3490
4209
 
3491
4210
  /**
@@ -3500,33 +4219,15 @@ export declare class ViewController {
3500
4219
  /**
3501
4220
  * Get the plane helper.
3502
4221
  *
3503
- * @returns {object} The helper.
4222
+ * @returns {PlaneHelper} The helper.
3504
4223
  */
3505
- getPlaneHelper(): object;
4224
+ getPlaneHelper(): PlaneHelper;
3506
4225
  /**
3507
4226
  * Check is the associated image is a mask.
3508
4227
  *
3509
4228
  * @returns {boolean} True if the associated image is a mask.
3510
4229
  */
3511
4230
  isMask(): boolean;
3512
- /**
3513
- * Get the mask segment helper.
3514
- *
3515
- * @returns {object} The helper.
3516
- */
3517
- getMaskSegmentHelper(): object;
3518
- /**
3519
- * Apply the hidden segments list by setting
3520
- * the corresponding alpha function.
3521
- */
3522
- applyHiddenSegments(): void;
3523
- /**
3524
- * Delete a segment.
3525
- *
3526
- * @param {number} segmentNumber The segment number.
3527
- * @param {Function} exeCallback The post execution callback.
3528
- */
3529
- deleteSegment(segmentNumber: number, exeCallback: Function): void;
3530
4231
  /**
3531
4232
  * Initialise the controller.
3532
4233
  */
@@ -3540,9 +4241,9 @@ export declare class ViewController {
3540
4241
  /**
3541
4242
  * Get the window/level presets names.
3542
4243
  *
3543
- * @returns {Array} The presets names.
4244
+ * @returns {string[]} The presets names.
3544
4245
  */
3545
- getWindowLevelPresetsNames(): any[];
4246
+ getWindowLevelPresetsNames(): string[];
3546
4247
  /**
3547
4248
  * Add window/level presets to the view.
3548
4249
  *
@@ -3615,10 +4316,10 @@ export declare class ViewController {
3615
4316
  * Generate display image data to be given to a canvas.
3616
4317
  *
3617
4318
  * @param {ImageData} array The array to fill in.
3618
- * @param {Index} index Optional index at which to generate,
4319
+ * @param {Index} [index] Optional index at which to generate,
3619
4320
  * otherwise generates at current index.
3620
4321
  */
3621
- generateImageData(array: ImageData, index: Index): void;
4322
+ generateImageData(array: ImageData, index?: Index): void;
3622
4323
  /**
3623
4324
  * Set the associated image.
3624
4325
  *
@@ -3629,13 +4330,13 @@ export declare class ViewController {
3629
4330
  /**
3630
4331
  * Get the current view (2D) spacing.
3631
4332
  *
3632
- * @returns {Array} The spacing as a 2D array.
4333
+ * @returns {Scalar2D} The spacing as a 2D array.
3633
4334
  */
3634
- get2DSpacing(): any[];
4335
+ get2DSpacing(): Scalar2D;
3635
4336
  /**
3636
4337
  * Get the image rescaled value at the input position.
3637
4338
  *
3638
- * @param {Point} position the input position.
4339
+ * @param {Point} position The input position.
3639
4340
  * @returns {number|undefined} The image value or undefined if out of bounds
3640
4341
  * or no quantifiable (for ex RGB).
3641
4342
  */
@@ -3643,7 +4344,7 @@ export declare class ViewController {
3643
4344
  /**
3644
4345
  * Get the image pixel unit.
3645
4346
  *
3646
- * @returns {string} The unit
4347
+ * @returns {string} The unit.
3647
4348
  */
3648
4349
  getPixelUnit(): string;
3649
4350
  /**
@@ -3657,10 +4358,10 @@ export declare class ViewController {
3657
4358
  /**
3658
4359
  * Get some values from the associated image in variable regions.
3659
4360
  *
3660
- * @param {Array} regions A list of regions.
4361
+ * @param {number[][][]} regions A list of [x, y] pairs (min, max).
3661
4362
  * @returns {Array} A list of values.
3662
4363
  */
3663
- getImageVariableRegionValues(regions: any[]): any[];
4364
+ getImageVariableRegionValues(regions: number[][][]): any[];
3664
4365
  /**
3665
4366
  * Can the image values be quantified?
3666
4367
  *
@@ -3671,8 +4372,15 @@ export declare class ViewController {
3671
4372
  * Can window and level be applied to the data?
3672
4373
  *
3673
4374
  * @returns {boolean} True if possible.
4375
+ * @deprecated Please use isMonochrome instead.
3674
4376
  */
3675
4377
  canWindowLevel(): boolean;
4378
+ /**
4379
+ * Is the data monochrome.
4380
+ *
4381
+ * @returns {boolean} True if the data is monochrome.
4382
+ */
4383
+ isMonochrome(): boolean;
3676
4384
  /**
3677
4385
  * Can the data be scrolled?
3678
4386
  *
@@ -3681,17 +4389,25 @@ export declare class ViewController {
3681
4389
  */
3682
4390
  canScroll(): boolean;
3683
4391
  /**
3684
- * Get the image size.
4392
+ * Get the oriented image size.
3685
4393
  *
3686
4394
  * @returns {Size} The size.
3687
4395
  */
3688
4396
  getImageSize(): Size;
4397
+ /**
4398
+ * Is the data size larger than one in the given dimension?
4399
+ *
4400
+ * @param {number} dim The dimension.
4401
+ * @returns {boolean} True if the image size is larger than one
4402
+ * in the given dimension.
4403
+ */
4404
+ moreThanOne(dim: number): boolean;
3689
4405
  /**
3690
4406
  * Get the image world (mm) 2D size.
3691
4407
  *
3692
- * @returns {object} The 2D size as {x,y}.
4408
+ * @returns {Scalar2D} The 2D size as {x,y}.
3693
4409
  */
3694
- getImageWorldSize(): object;
4410
+ getImageWorldSize(): Scalar2D;
3695
4411
  /**
3696
4412
  * Get the image rescaled data range.
3697
4413
  *
@@ -3706,12 +4422,13 @@ export declare class ViewController {
3706
4422
  */
3707
4423
  equalImageMeta(meta: object): boolean;
3708
4424
  /**
3709
- * Check is the provided position can be set.
4425
+ * Check if the current position (default) or
4426
+ * the provided position is in bounds.
3710
4427
  *
3711
- * @param {Point} position The position.
4428
+ * @param {Point} [position] Optional position.
3712
4429
  * @returns {boolean} True is the position is in bounds.
3713
4430
  */
3714
- canSetPosition(position: Point): boolean;
4431
+ isPositionInBounds(position?: Point): boolean;
3715
4432
  /**
3716
4433
  * Set the current position.
3717
4434
  *
@@ -3722,20 +4439,19 @@ export declare class ViewController {
3722
4439
  */
3723
4440
  setCurrentPosition(pos: Point, silent?: boolean): boolean;
3724
4441
  /**
3725
- * Get a position from a 2D (x,y) position.
4442
+ * Get a world position from a 2D plane position.
3726
4443
  *
3727
- * @param {number} x The column position.
3728
- * @param {number} y The row position.
4444
+ * @param {Point2D} point2D The input point.
3729
4445
  * @returns {Point} The associated position.
3730
4446
  */
3731
- getPositionFromPlanePoint(x: number, y: number): Point;
4447
+ getPositionFromPlanePoint(point2D: Point2D): Point;
3732
4448
  /**
3733
- * Get a 2D (x,y) position from a position.
4449
+ * Get a 2D plane position from a world position.
3734
4450
  *
3735
4451
  * @param {Point} point The 3D position.
3736
- * @returns {object} The 2D position.
4452
+ * @returns {Point2D} The 2D position.
3737
4453
  */
3738
- getPlanePositionFromPosition(point: Point): object;
4454
+ getPlanePositionFromPosition(point: Point): Point2D;
3739
4455
  /**
3740
4456
  * Set the current index.
3741
4457
  *
@@ -3748,17 +4464,43 @@ export declare class ViewController {
3748
4464
  * Get a plane 3D position from a plane 2D position: does not compensate
3749
4465
  * for the image origin. Needed for setting the scale center...
3750
4466
  *
3751
- * @param {object} point2D The 2D position as {x,y}.
4467
+ * @param {Point2D} point2D The 2D position.
3752
4468
  * @returns {Point3D} The 3D point.
3753
4469
  */
3754
- getPlanePositionFromPlanePoint(point2D: object): Point3D;
4470
+ getPlanePositionFromPlanePoint(point2D: Point2D): Point3D;
3755
4471
  /**
3756
4472
  * Get a 3D offset from a plane one.
3757
4473
  *
3758
- * @param {object} offset2D The plane offset as {x,y}.
4474
+ * @param {Scalar2D} offset2D The plane offset as {x,y}.
3759
4475
  * @returns {Vector3D} The 3D world offset.
3760
4476
  */
3761
- getOffset3DFromPlaneOffset(offset2D: object): Vector3D;
4477
+ getOffset3DFromPlaneOffset(offset2D: Scalar2D): Vector3D;
4478
+ /**
4479
+ * Get the current position incremented in the input direction.
4480
+ *
4481
+ * @param {number} dim The direction in which to increment.
4482
+ * @returns {Point} The resulting point.
4483
+ */
4484
+ getIncrementPosition(dim: number): Point;
4485
+ /**
4486
+ * Get the current position decremented in the input direction.
4487
+ *
4488
+ * @param {number} dim The direction in which to decrement.
4489
+ * @returns {Point} The resulting point.
4490
+ */
4491
+ getDecrementPosition(dim: number): Point;
4492
+ /**
4493
+ * Get the current position decremented in the scroll direction.
4494
+ *
4495
+ * @returns {Point} The resulting point.
4496
+ */
4497
+ getIncrementScrollPosition(): Point;
4498
+ /**
4499
+ * Get the current position decremented in the scroll direction.
4500
+ *
4501
+ * @returns {Point} The resulting point.
4502
+ */
4503
+ getDecrementScrollPosition(): Point;
3762
4504
  /**
3763
4505
  * Increment the provided dimension.
3764
4506
  *
@@ -3800,9 +4542,9 @@ export declare class ViewController {
3800
4542
  /**
3801
4543
  * Get the window/level.
3802
4544
  *
3803
- * @returns {object} The window center and width.
4545
+ * @returns {WindowLevel} The window and level.
3804
4546
  */
3805
- getWindowLevel(): object;
4547
+ getWindowLevel(): WindowLevel;
3806
4548
  /**
3807
4549
  * Get the current window level preset name.
3808
4550
  *
@@ -3810,12 +4552,11 @@ export declare class ViewController {
3810
4552
  */
3811
4553
  getCurrentWindowPresetName(): string;
3812
4554
  /**
3813
- * Set the window/level.
4555
+ * Set the window and level.
3814
4556
  *
3815
- * @param {number} wc The window center.
3816
- * @param {number} ww The window width.
4557
+ * @param {WindowLevel} wl The window and level.
3817
4558
  */
3818
- setWindowLevel(wc: number, ww: number): void;
4559
+ setWindowLevel(wl: WindowLevel): void;
3819
4560
  /**
3820
4561
  * Get the colour map.
3821
4562
  *
@@ -3830,16 +4571,28 @@ export declare class ViewController {
3830
4571
  setColourMap(name: string): void;
3831
4572
  /**
3832
4573
  * @callback alphaFn@callback alphaFn
3833
- * @param {object} value The pixel value.
3834
- * @param {object} index The values' index.
3835
- * @returns {number} The value to display.
4574
+ * @param {number[]|number} value The pixel value.
4575
+ * @param {number} index The values' index.
4576
+ * @returns {number} The opacity of the input value.
3836
4577
  */
3837
4578
  /**
3838
4579
  * Set the view per value alpha function.
3839
4580
  *
3840
4581
  * @param {alphaFn} func The function.
3841
4582
  */
3842
- setViewAlphaFunction(func: (value: object, index: object) => number): void;
4583
+ setViewAlphaFunction(func: (value: number[] | number, index: number) => number): void;
4584
+ /**
4585
+ * Bind the view image to the provided layer.
4586
+ *
4587
+ * @param {ViewLayer} viewLayer The layer to bind.
4588
+ */
4589
+ bindImageAndLayer(viewLayer: ViewLayer): void;
4590
+ /**
4591
+ * Unbind the view image to the provided layer.
4592
+ *
4593
+ * @param {ViewLayer} viewLayer The layer to bind.
4594
+ */
4595
+ unbindImageAndLayer(viewLayer: ViewLayer): void;
3843
4596
  /**
3844
4597
  * Add an event listener to this class.
3845
4598
  *
@@ -3874,6 +4627,18 @@ export declare class ViewLayer {
3874
4627
  * @returns {string} The data id.
3875
4628
  */
3876
4629
  getDataId(): string;
4630
+ /**
4631
+ * Get the layer scale.
4632
+ *
4633
+ * @returns {Scalar2D} The scale as {x,y}.
4634
+ */
4635
+ getScale(): Scalar2D;
4636
+ /**
4637
+ * Get the layer zoom offset without the fit scale.
4638
+ *
4639
+ * @returns {Scalar2D} The offset as {x,y}.
4640
+ */
4641
+ getAbsoluteZoomOffset(): Scalar2D;
3877
4642
  /**
3878
4643
  * Set the imageSmoothing flag value.
3879
4644
  *
@@ -3906,31 +4671,50 @@ export declare class ViewLayer {
3906
4671
  * @function
3907
4672
  */
3908
4673
  onimageset: (event: object) => void;
4674
+ /**
4675
+ * Bind this layer to the view image.
4676
+ */
4677
+ bindImage(): void;
4678
+ /**
4679
+ * Unbind this layer to the view image.
4680
+ */
4681
+ unbindImage(): void;
4682
+ /**
4683
+ * Handle an image content change event.
4684
+ *
4685
+ * @param {object} event The event.
4686
+ * @function
4687
+ */
4688
+ onimagecontentchange: (event: object) => void;
3909
4689
  /**
3910
4690
  * Handle an image change event.
3911
4691
  *
3912
4692
  * @param {object} event The event.
3913
4693
  * @function
3914
4694
  */
3915
- onimagechange: (event: object) => void;
4695
+ onimagegeometrychange: (event: object) => void;
3916
4696
  /**
3917
4697
  * Get the id of the layer.
3918
4698
  *
3919
4699
  * @returns {string} The string id.
3920
4700
  */
3921
4701
  getId(): string;
4702
+ /**
4703
+ * Remove the HTML element from the DOM.
4704
+ */
4705
+ removeFromDOM(): void;
3922
4706
  /**
3923
4707
  * Get the layer base size (without scale).
3924
4708
  *
3925
- * @returns {object} The size as {x,y}.
4709
+ * @returns {Scalar2D} The size as {x,y}.
3926
4710
  */
3927
- getBaseSize(): object;
4711
+ getBaseSize(): Scalar2D;
3928
4712
  /**
3929
4713
  * Get the image world (mm) 2D size.
3930
4714
  *
3931
- * @returns {object} The 2D size as {x,y}.
4715
+ * @returns {Scalar2D} The 2D size as {x,y}.
3932
4716
  */
3933
- getImageWorldSize(): object;
4717
+ getImageWorldSize(): Scalar2D;
3934
4718
  /**
3935
4719
  * Get the layer opacity.
3936
4720
  *
@@ -3951,6 +4735,14 @@ export declare class ViewLayer {
3951
4735
  * Add a flip offset along the layer Y axis.
3952
4736
  */
3953
4737
  addFlipOffsetY(): void;
4738
+ /**
4739
+ * Flip the scale along the layer X axis.
4740
+ */
4741
+ flipScaleX(): void;
4742
+ /**
4743
+ * Flip the scale along the layer Y axis.
4744
+ */
4745
+ flipScaleY(): void;
3954
4746
  /**
3955
4747
  * Flip the scale along the layer Z axis.
3956
4748
  */
@@ -3958,65 +4750,70 @@ export declare class ViewLayer {
3958
4750
  /**
3959
4751
  * Set the layer scale.
3960
4752
  *
3961
- * @param {object} newScale The scale as {x,y}.
4753
+ * @param {Scalar3D} newScale The scale as {x,y,z}.
3962
4754
  * @param {Point3D} [center] The scale center.
3963
4755
  */
3964
- setScale(newScale: object, center?: Point3D): void;
4756
+ setScale(newScale: Scalar3D, center?: Point3D): void;
4757
+ /**
4758
+ * Initialise the layer scale.
4759
+ *
4760
+ * @param {Scalar3D} newScale The scale as {x,y,z}.
4761
+ * @param {Scalar2D} absoluteZoomOffset The zoom offset as {x,y}
4762
+ * without the fit scale (as provided by getAbsoluteZoomOffset).
4763
+ */
4764
+ initScale(newScale: Scalar3D, absoluteZoomOffset: Scalar2D): void;
3965
4765
  /**
3966
4766
  * Set the base layer offset. Updates the layer offset.
3967
4767
  *
3968
4768
  * @param {Vector3D} scrollOffset The scroll offset vector.
3969
4769
  * @param {Vector3D} planeOffset The plane offset vector.
4770
+ * @param {Point3D} [layerGroupOrigin] The layer group origin.
4771
+ * @param {Point3D} [layerGroupOrigin0] The layer group first origin.
3970
4772
  * @returns {boolean} True if the offset was updated.
3971
4773
  */
3972
- setBaseOffset(scrollOffset: Vector3D, planeOffset: Vector3D): boolean;
4774
+ setBaseOffset(scrollOffset: Vector3D, planeOffset: Vector3D, layerGroupOrigin?: Point3D, layerGroupOrigin0?: Point3D): boolean;
3973
4775
  /**
3974
4776
  * Set the layer offset.
3975
4777
  *
3976
- * @param {object} newOffset The offset as {x,y}.
4778
+ * @param {Scalar3D} newOffset The offset as {x,y,z}.
3977
4779
  */
3978
- setOffset(newOffset: object): void;
4780
+ setOffset(newOffset: Scalar3D): void;
3979
4781
  /**
3980
- * Transform a display position to an index.
4782
+ * Transform a display position to a 2D index.
3981
4783
  *
3982
- * @param {number} x The X position.
3983
- * @param {number} y The Y position.
3984
- * @returns {Index} The equivalent index.
4784
+ * @param {Point2D} point2D The input point.
4785
+ * @returns {Index} The equivalent 2D index.
3985
4786
  */
3986
- displayToPlaneIndex(x: number, y: number): Index;
4787
+ displayToPlaneIndex(point2D: Point2D): Index;
3987
4788
  /**
3988
4789
  * Remove scale from a display position.
3989
4790
  *
3990
- * @param {number} x The X position.
3991
- * @param {number} y The Y position.
3992
- * @returns {object} The de-scaled position as {x,y}.
4791
+ * @param {Point2D} point2D The input point.
4792
+ * @returns {Point2D} The de-scaled point.
3993
4793
  */
3994
- displayToPlaneScale(x: number, y: number): object;
4794
+ displayToPlaneScale(point2D: Point2D): Point2D;
3995
4795
  /**
3996
4796
  * Get a plane position from a display position.
3997
4797
  *
3998
- * @param {number} x The X position.
3999
- * @param {number} y The Y position.
4000
- * @returns {object} The plane position as {x,y}.
4798
+ * @param {Point2D} point2D The input point.
4799
+ * @returns {Point2D} The plane position.
4001
4800
  */
4002
- displayToPlanePos(x: number, y: number): object;
4801
+ displayToPlanePos(point2D: Point2D): Point2D;
4003
4802
  /**
4004
4803
  * Get a display position from a plane position.
4005
4804
  *
4006
- * @param {number} x The X position.
4007
- * @param {number} y The Y position.
4008
- * @returns {object} The display position as {x,y}, can be individually
4805
+ * @param {Point2D} point2D The input point.
4806
+ * @returns {Point2D} The display position, can be individually
4009
4807
  * undefined if out of bounds.
4010
4808
  */
4011
- planePosToDisplay(x: number, y: number): object;
4809
+ planePosToDisplay(point2D: Point2D): Point2D;
4012
4810
  /**
4013
4811
  * Get a main plane position from a display position.
4014
4812
  *
4015
- * @param {number} x The X position.
4016
- * @param {number} y The Y position.
4017
- * @returns {object} The main plane position as {x,y}.
4813
+ * @param {Point2D} point2D The input point.
4814
+ * @returns {Point2D} The main plane position.
4018
4815
  */
4019
- displayToMainPlanePos(x: number, y: number): object;
4816
+ displayToMainPlanePos(point2D: Point2D): Point2D;
4020
4817
  /**
4021
4818
  * Display the layer.
4022
4819
  *
@@ -4031,28 +4828,28 @@ export declare class ViewLayer {
4031
4828
  isVisible(): boolean;
4032
4829
  /**
4033
4830
  * Draw the content (imageData) of the layer.
4034
- * The imageData variable needs to be set
4831
+ * The imageData variable needs to be set.
4035
4832
  *
4036
4833
  * @fires App#renderstart
4037
4834
  * @fires App#renderend
4038
4835
  */
4039
4836
  draw(): void;
4040
4837
  /**
4041
- * Initialise the layer: set the canvas and context
4838
+ * Initialise the layer: set the canvas and context.
4042
4839
  *
4043
- * @param {object} size The image size as {x,y}.
4044
- * @param {object} spacing The image spacing as {x,y}.
4840
+ * @param {Scalar2D} size The image size as {x,y}.
4841
+ * @param {Scalar2D} spacing The image spacing as {x,y}.
4045
4842
  * @param {number} alpha The initial data opacity.
4046
4843
  */
4047
- initialise(size: object, spacing: object, alpha: number): void;
4844
+ initialise(size: Scalar2D, spacing: Scalar2D, alpha: number): void;
4048
4845
  /**
4049
4846
  * Fit the layer to its parent container.
4050
4847
  *
4051
- * @param {number} fitScale1D The 1D fit scale.
4052
- * @param {object} fitSize The fit size as {x,y}.
4053
- * @param {object} fitOffset The fit offset as {x,y}.
4848
+ * @param {Scalar2D} containerSize The fit size as {x,y}.
4849
+ * @param {number} divToWorldSizeRatio The div to world size ratio.
4850
+ * @param {Scalar2D} fitOffset The fit offset as {x,y}.
4054
4851
  */
4055
- fitToContainer(fitScale1D: number, fitSize: object, fitOffset: object): void;
4852
+ fitToContainer(containerSize: Scalar2D, divToWorldSizeRatio: number, fitOffset: Scalar2D): void;
4056
4853
  /**
4057
4854
  * Enable and listen to container interaction events.
4058
4855
  */
@@ -4093,101 +4890,33 @@ export declare class ViewLayer {
4093
4890
  }
4094
4891
 
4095
4892
  /**
4096
- * WindowCenterAndWidth class.
4097
- * <br>Pseudo-code:
4098
- * <pre>
4099
- * if (x &lt;= c - 0.5 - (w-1)/2), then y = ymin
4100
- * else if (x > c - 0.5 + (w-1)/2), then y = ymax,
4101
- * else y = ((x - (c - 0.5)) / (w-1) + 0.5) * (ymax - ymin) + ymin
4102
- * </pre>
4103
- *
4104
- * @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}
4893
+ * Window and Level also known as window width and center.
4105
4894
  */
4106
- export declare class WindowCenterAndWidth {
4895
+ export declare class WindowLevel {
4107
4896
  /**
4108
4897
  * @param {number} center The window center.
4109
4898
  * @param {number} width The window width.
4110
4899
  */
4111
4900
  constructor(center: number, width: number);
4112
4901
  /**
4113
- * Get the window center.
4114
- *
4115
- * @returns {number} The window center.
4116
- */
4117
- getCenter(): number;
4118
- /**
4119
- * Get the window width.
4120
- *
4121
- * @returns {number} The window width.
4122
- */
4123
- getWidth(): number;
4124
- /**
4125
- * Set the signed offset.
4126
- *
4127
- * @param {number} offset The signed data offset,
4128
- * typically: slope * ( size / 2).
4129
- */
4130
- setSignedOffset(offset: number): void;
4131
- /**
4132
- * Apply the window level on an input value.
4133
- *
4134
- * @param {number} value The value to rescale as an integer.
4135
- * @returns {number} The leveled value, in the
4136
- * [ymin, ymax] range (default [0,255]).
4137
- */
4138
- apply(value: number): number;
4139
- /**
4140
- * Check for window level equality.
4902
+ * The window center.
4141
4903
  *
4142
- * @param {WindowCenterAndWidth} rhs The other window level to compare to.
4143
- * @returns {boolean} True if both window level are equal.
4144
- */
4145
- equals(rhs: WindowCenterAndWidth): boolean;
4146
- #private;
4147
- }
4148
-
4149
- /**
4150
- * Window LUT class.
4151
- * Typically converts from float to integer.
4152
- */
4153
- export declare class WindowLut {
4154
- /**
4155
- * Construct a window LUT object, window level is set with
4156
- * the 'setWindowLevel' method.
4157
- *
4158
- * @param {RescaleLut} rescaleLut The associated rescale LUT.
4159
- * @param {boolean} isSigned Flag to know if the data is signed or not.
4160
- * @param {boolean} isDiscrete Flag to know if the input data is discrete.
4161
- */
4162
- constructor(rescaleLut: RescaleLut, isSigned: boolean, isDiscrete: boolean);
4163
- /**
4164
- * Get the window / level.
4165
- *
4166
- * @returns {WindowCenterAndWidth} The window / level.
4167
- */
4168
- getWindowLevel(): WindowCenterAndWidth;
4169
- /**
4170
- * Get the rescale lut.
4171
- *
4172
- * @returns {RescaleLut} The rescale lut.
4904
+ * @type {number}
4173
4905
  */
4174
- getRescaleLut(): RescaleLut;
4906
+ center: number;
4175
4907
  /**
4176
- * Set the window center and width.
4908
+ * The window width.
4177
4909
  *
4178
- * @param {WindowCenterAndWidth} wl The window level.
4910
+ * @type {number}
4179
4911
  */
4180
- setWindowLevel(wl: WindowCenterAndWidth): void;
4912
+ width: number;
4181
4913
  /**
4182
- * Get the value of the LUT at the given offset.
4914
+ * Check for equality.
4183
4915
  *
4184
- * @param {number} offset The input offset in [0,2^bitsStored] range
4185
- * for discrete data or full range for non discrete.
4186
- * @returns {number} The integer value (default [0,255]) of the LUT
4187
- * at the given offset.
4916
+ * @param {WindowLevel} rhs The other object to compare to.
4917
+ * @returns {boolean} True if both objects are equal.
4188
4918
  */
4189
- getValue(offset: number): number;
4190
- #private;
4919
+ equals(rhs: WindowLevel): boolean;
4191
4920
  }
4192
4921
 
4193
4922
  /**