dwv 0.36.3 → 0.37.0-beta.10

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,14 +4,20 @@ import Konva from 'konva';
4
4
  * Add tags to the dictionary.
5
5
  *
6
6
  * @param {string} group The group key.
7
- * @param {Object<string, string[]>} tags The tags to add as an
7
+ * @param {Record<string, string[]>} tags The tags to add as an
8
8
  * object indexed by element key with values as:
9
9
  * [VR, multiplicity, TagName] (all strings).
10
10
  */
11
- export declare function addTagsToDictionary(group: string, tags: {
12
- [x: string]: string[];
13
- }): void;
11
+ export declare function addTagsToDictionary(group: string, tags: Record<string, string[]>): void;
14
12
 
13
+ /**
14
+ * @import {Point2D} from '../math/point.js';
15
+ * @import {Index} from '../math/index.js';
16
+ * @import {NumberValue} from '../math/number.js';
17
+ * @import {ViewController} from '../app/viewController.js';
18
+ * @import {PlaneHelper} from './planeHelper.js';
19
+ * @import {DicomCode} from '../dicom/dicomCode.js';
20
+ */
15
21
  /**
16
22
  * Image annotation.
17
23
  */
@@ -29,7 +35,7 @@ export declare class Annotation {
29
35
  */
30
36
  trackingUid: string;
31
37
  /**
32
- * Referenced image SOP isntance UID.
38
+ * Referenced image SOP instance UID.
33
39
  *
34
40
  * @type {string}
35
41
  */
@@ -67,11 +73,9 @@ export declare class Annotation {
67
73
  /**
68
74
  * Annotation quantification.
69
75
  *
70
- * @type {Object<string, Value>|undefined}
76
+ * @type {Record<string, NumberValue>|undefined}
71
77
  */
72
- quantification: {
73
- [x: string]: Value;
74
- } | undefined;
78
+ quantification: Record<string, NumberValue> | undefined;
75
79
  /**
76
80
  * Text expression. Can contain variables surrounded with '{}' that will
77
81
  * be extracted from the quantification object.
@@ -167,12 +171,10 @@ export declare class Annotation {
167
171
  /**
168
172
  * Set the annotation text expression.
169
173
  *
170
- * @param {Object.<string, string>} labelText The list of label
174
+ * @param {Record<string, string>} labelText The list of label
171
175
  * texts indexed by modality.
172
176
  */
173
- setTextExpr(labelText: {
174
- [x: string]: string;
175
- }): void;
177
+ setTextExpr(labelText: Record<string, string>): void;
176
178
  /**
177
179
  * Get the annotation label text by applying the
178
180
  * text expression on the current quantification.
@@ -196,7 +198,7 @@ export declare class Annotation {
196
198
  /**
197
199
  * Annotation group.
198
200
  */
199
- export declare class AnnotationGroup {
201
+ export declare class AnnotationGroup extends EventTarget {
200
202
  /**
201
203
  * @param {Annotation[]} [list] Optional list, will
202
204
  * create new if not provided.
@@ -279,11 +281,9 @@ export declare class AnnotationGroup {
279
281
  /**
280
282
  * Get the meta data.
281
283
  *
282
- * @returns {Object<string, any>} The meta data.
284
+ * @returns {Record<string, any>} The meta data.
283
285
  */
284
- getMeta(): {
285
- [x: string]: any;
286
- };
286
+ getMeta(): Record<string, any>;
287
287
  /**
288
288
  * Check if this list contains a meta data value.
289
289
  *
@@ -305,22 +305,6 @@ export declare class AnnotationGroup {
305
305
  * @param {string|object} value The value of the meta data.
306
306
  */
307
307
  setMetaValue(key: string, value: string | object): void;
308
- /**
309
- * Add an event listener to this class.
310
- *
311
- * @param {string} type The event type.
312
- * @param {Function} callback The function associated with the provided
313
- * event type, will be called with the fired event.
314
- */
315
- addEventListener(type: string, callback: Function): void;
316
- /**
317
- * Remove an event listener from this class.
318
- *
319
- * @param {string} type The event type.
320
- * @param {Function} callback The function associated with the provided
321
- * event type.
322
- */
323
- removeEventListener(type: string, callback: Function): void;
324
308
  #private;
325
309
  }
326
310
 
@@ -338,64 +322,50 @@ export declare class AnnotationGroupFactory {
338
322
  /**
339
323
  * Check dicom elements.
340
324
  *
341
- * @param {Object<string, DataElement>} dataElements The DICOM data elements.
325
+ * @param {Record<string, DataElement>} dataElements The DICOM data elements.
342
326
  * @returns {string|undefined} A possible warning.
343
327
  */
344
- checkElements(dataElements: {
345
- [x: string]: DataElement;
346
- }): string | undefined;
328
+ checkElements(dataElements: Record<string, DataElement>): string | undefined;
347
329
  /**
348
330
  * Get an {@link AnnotationGroup} object from the read DICOM file.
349
331
  *
350
- * @param {Object<string, DataElement>} dataElements The DICOM tags.
332
+ * @param {Record<string, DataElement>} dataElements The DICOM tags.
351
333
  * @returns {AnnotationGroup} A new annotation group.
352
334
  * @throws {Error} Error for missing or wrong data.
353
335
  */
354
- create(dataElements: {
355
- [x: string]: DataElement;
356
- }): AnnotationGroup;
336
+ create(dataElements: Record<string, DataElement>): AnnotationGroup;
357
337
  /**
358
338
  * Get an {@link CADReport} object from the read DICOM file.
359
339
  *
360
- * @param {Object<string, DataElement>} dataElements The DICOM tags.
340
+ * @param {Record<string, DataElement>} dataElements The DICOM tags.
361
341
  * @returns {CADReport|undefined} A new CAD report.
362
342
  */
363
- createCADReport(dataElements: {
364
- [x: string]: DataElement;
365
- }): CADReport | undefined;
343
+ createCADReport(dataElements: Record<string, DataElement>): CADReport | undefined;
366
344
  /**
367
345
  * Convert an annotation group into a DICOM SR object using the
368
346
  * TID 1500 template.
369
347
  *
370
348
  * @param {AnnotationGroup} annotationGroup The annotation group.
371
- * @param {Object<string, any>} [extraTags] Optional list of extra tags.
372
- * @returns {Object<string, DataElement>} A list of dicom elements.
349
+ * @param {SimpleTagValues} [extraTags] Optional list of extra tags.
350
+ * @returns {Record<string, DataElement>} A list of dicom elements.
373
351
  */
374
- toDicom(annotationGroup: AnnotationGroup, extraTags?: {
375
- [x: string]: any;
376
- }): {
377
- [x: string]: DataElement;
378
- };
352
+ toDicom(annotationGroup: AnnotationGroup, extraTags?: SimpleTagValues): Record<string, DataElement>;
379
353
  /**
380
354
  * Convert a CAD report into a DICOM CAD report SR object using
381
355
  * the TID 4100 template.
382
356
  *
383
357
  * @param {CADReport} report The CAD report.
384
- * @param {Object<string, any>} [extraTags] Optional list of extra tags.
385
- * @returns {Object<string, DataElement>} A list of dicom elements.
358
+ * @param {SimpleTagValues} [extraTags] Optional list of extra tags.
359
+ * @returns {Record<string, DataElement>} A list of dicom elements.
386
360
  */
387
- toDicomCADReport(report: CADReport, extraTags?: {
388
- [x: string]: any;
389
- }): {
390
- [x: string]: DataElement;
391
- };
361
+ toDicomCADReport(report: CADReport, extraTags?: SimpleTagValues): Record<string, DataElement>;
392
362
  #private;
393
363
  }
394
364
 
395
365
  /**
396
366
  * List of ViewConfigs indexed by dataIds.
397
367
  *
398
- * @typedef {Object<string, ViewConfig[]>} DataViewConfigs
368
+ * @typedef {Record<string, ViewConfig[]>} DataViewConfigs
399
369
  */
400
370
  /**
401
371
  * Main application class.
@@ -414,12 +384,19 @@ export declare class AnnotationGroupFactory {
414
384
  * 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
415
385
  * ]);
416
386
  */
417
- export declare class App {
387
+ export declare class App extends EventTarget {
388
+ /**
389
+ * Get the data controller.
390
+ *
391
+ * @returns {DataController} The data controller.
392
+ */
393
+ getDataController(): DataController;
418
394
  /**
419
395
  * Get a DicomData.
420
396
  *
421
397
  * @param {string} dataId The data id.
422
398
  * @returns {DicomData|undefined} The data.
399
+ * @deprecated Since v0.37, please use via app.getDataController.
423
400
  */
424
401
  getData(dataId: string): DicomData | undefined;
425
402
  /**
@@ -435,12 +412,14 @@ export declare class App {
435
412
  *
436
413
  * @param {string} dataId The data id.
437
414
  * @param {Image} img The associated image.
415
+ * @deprecated Since v0.37, please use via app.getDataController.
438
416
  */
439
417
  setImage(dataId: string, img: Image_2): void;
440
418
  /**
441
419
  * Get the next data id.
442
420
  *
443
421
  * @returns {string} The data id.
422
+ * @deprecated Since v0.37, please use via app.getDataController.
444
423
  */
445
424
  getNextDataId(): string;
446
425
  /**
@@ -449,21 +428,22 @@ export declare class App {
449
428
  * @param {string} dataId The data id.
450
429
  * @param {DicomData} data The new data.
451
430
  * @returns {boolean} False if the data cannot be added.
431
+ * @deprecated Since v0.37, please use via app.getDataController.
452
432
  */
453
433
  addData(dataId: string, data: DicomData): boolean;
454
434
  /**
455
435
  * Get the meta data.
456
436
  *
457
437
  * @param {string} dataId The data id.
458
- * @returns {Object<string, DataElement>|undefined} The list of meta data.
438
+ * @returns {Record<string, DataElement>|undefined} The list of meta data.
439
+ * @deprecated Since v0.37, please use via app.getDataController.
459
440
  */
460
- getMetaData(dataId: string): {
461
- [x: string]: DataElement;
462
- } | undefined;
441
+ getMetaData(dataId: string): Record<string, DataElement> | undefined;
463
442
  /**
464
443
  * Get the list of ids in the data storage.
465
444
  *
466
445
  * @returns {string[]} The list of data ids.
446
+ * @deprecated Since v0.37, please use via app.getDataController.
467
447
  */
468
448
  getDataIds(): string[];
469
449
  /**
@@ -471,6 +451,7 @@ export declare class App {
471
451
  *
472
452
  * @param {string[]} uids A list of UIDs.
473
453
  * @returns {string[]} The list of dataIds that contain the UIDs.
454
+ * @deprecated Since v0.37, please use via app.getDataController.
474
455
  */
475
456
  getDataIdsFromSopUids(uids: string[]): string[];
476
457
  /**
@@ -478,6 +459,7 @@ export declare class App {
478
459
  *
479
460
  * @param {string} uid The SeriesInstanceUID.
480
461
  * @returns {string} The data id.
462
+ * @deprecated Since v0.37, please use via app.getDataController.
481
463
  */
482
464
  getDataIdFromSeriesUid(uid: string): string;
483
465
  /**
@@ -501,18 +483,21 @@ export declare class App {
501
483
  * Get the active layer group scale on top of the base scale.
502
484
  *
503
485
  * @returns {Scalar3D} The scale as {x,y,z}.
486
+ * @deprecated Since v0.37, please access from the active layer group.
504
487
  */
505
488
  getAddedScale(): Scalar3D;
506
489
  /**
507
490
  * Get the base scale of the active layer group.
508
491
  *
509
492
  * @returns {Scalar3D} The scale as {x,y,z}.
493
+ * @deprecated Since v0.37, please access from the active layer group.
510
494
  */
511
495
  getBaseScale(): Scalar3D;
512
496
  /**
513
497
  * Get the layer offset of the active layer group.
514
498
  *
515
499
  * @returns {Scalar3D} The offset as {x,y,z}.
500
+ * @deprecated Since v0.37, please access from the active layer group.
516
501
  */
517
502
  getOffset(): Scalar3D;
518
503
  /**
@@ -521,17 +506,33 @@ export declare class App {
521
506
  * @returns {ToolboxController} The controller.
522
507
  */
523
508
  getToolboxController(): ToolboxController;
509
+ /**
510
+ * Get the stage controller.
511
+ *
512
+ * @returns {StageController} The stage controller.
513
+ */
514
+ getStageController(): StageController;
515
+ /**
516
+ * Get the undo controller.
517
+ *
518
+ * @returns {UndoController} The undo controller.
519
+ */
520
+ getUndoController(): UndoController;
524
521
  /**
525
522
  * Get the active layer group.
526
523
  * The layer is available after the first loaded item.
527
524
  *
528
525
  * @returns {LayerGroup|undefined} The layer group.
526
+ * @deprecated Since v0.37, use
527
+ * `app.getStageController().getActiveLayerGroup()` instead.
529
528
  */
530
529
  getActiveLayerGroup(): LayerGroup | undefined;
531
530
  /**
532
531
  * Set the active layer group.
533
532
  *
534
533
  * @param {number} index The layer group index.
534
+ * @deprecated Since v0.37, use
535
+ * `app.getStageController().setActiveLayerGroup()` instead.
535
536
  */
536
537
  setActiveLayerGroup(index: number): void;
537
538
  /**
@@ -540,6 +541,8 @@ export declare class App {
540
541
  *
541
542
  * @param {string} dataId The data id.
542
543
  * @returns {ViewLayer[]} The layers.
544
+ * @deprecated Since v0.37, use
545
+ * `app.getStageController().getViewLayersByDataId()` instead.
543
546
  */
544
547
  getViewLayersByDataId(dataId: string): ViewLayer[];
545
548
  /**
@@ -550,6 +553,8 @@ export declare class App {
550
553
  * returns all view layers.
551
554
  * @returns {ViewLayer[]} The layers that
552
555
  * satisfy the callbackFn.
556
+ * @deprecated Since v0.37, use
557
+ * `app.getStageController().getViewLayers()` instead.
553
558
  */
554
559
  getViewLayers(callbackFn?: Function): ViewLayer[];
555
560
  /**
@@ -558,6 +563,8 @@ export declare class App {
558
563
  *
559
564
  * @param {string} dataId The data id.
560
565
  * @returns {DrawLayer[]} The layers.
566
+ * @deprecated Since v0.37, use
567
+ * `app.getStageController().getDrawLayersByDataId()` instead.
561
568
  */
562
569
  getDrawLayersByDataId(dataId: string): DrawLayer[];
563
570
  /**
@@ -568,6 +575,8 @@ export declare class App {
568
575
  * returns all draw layers.
569
576
  * @returns {DrawLayer[]} The layers that
570
577
  * satisfy the callbackFn.
578
+ * @deprecated Since v0.37, use
579
+ * `app.getStageController().getDrawLayers()` instead.
571
580
  */
572
581
  getDrawLayers(callbackFn?: Function): DrawLayer[];
573
582
  /**
@@ -576,12 +585,16 @@ export declare class App {
576
585
  *
577
586
  * @param {string} divId The div id.
578
587
  * @returns {LayerGroup|undefined} The layer group.
588
+ * @deprecated Since v0.37, use
589
+ * `app.getStageController().getLayerGroupByDivId()` instead.
579
590
  */
580
591
  getLayerGroupByDivId(divId: string): LayerGroup | undefined;
581
592
  /**
582
593
  * Get the number of layer groups.
583
594
  *
584
595
  * @returns {number} The number of groups.
596
+ * @deprecated Since v0.37, use
597
+ * `app.getStageController().getNumberOfLayerGroups()` instead.
585
598
  */
586
599
  getNumberOfLayerGroups(): number;
587
600
  /**
@@ -595,6 +608,7 @@ export declare class App {
595
608
  *
596
609
  * @param {Command} cmd The command to add.
597
610
  * @fires UndoStack#undoadd
611
+ * @deprecated Since v0.37, please use via app.getUndoController.
598
612
  * @function
599
613
  */
600
614
  addToUndoStack: (cmd: Command) => void;
@@ -604,6 +618,7 @@ export declare class App {
604
618
  * @param {string} name The name of the command to remove.
605
619
  * @returns {boolean} True if the command was found and removed.
606
620
  * @fires UndoStack#undoremove
621
+ * @deprecated Since v0.37, please use via app.getUndoController.
607
622
  * @function
608
623
  */
609
624
  removeFromUndoStack: (name: string) => boolean;
@@ -632,7 +647,7 @@ export declare class App {
632
647
  * button.disabled = false;
633
648
  * button.onclick = function () {
634
649
  * // render data #0
635
- * app.render(0);
650
+ * app.getStageController().render(0);
636
651
  * };
637
652
  * });
638
653
  * // load dicom data
@@ -653,28 +668,114 @@ export declare class App {
653
668
  resetLayout(): void;
654
669
  /**
655
670
  * Reset the zoom and pan of the stage.
671
+ *
672
+ * @deprecated Since v0.37, use
673
+ * `app.getStageController().resetZoomPan()` instead.
656
674
  */
657
675
  resetZoomPan(): void;
658
676
  /**
659
677
  * Reset the position and window level of the stage.
678
+ *
679
+ * @deprecated Since v0.37, use
680
+ * `app.getStageController().resetViews()` instead.
660
681
  */
661
682
  resetViews(): void;
662
683
  /**
663
- * Add an event listener to this class.
684
+ * Load start event.
664
685
  *
665
- * @param {string} type The event type.
666
- * @param {Function} callback The function associated with the provided
667
- * event type, will be called with the fired event.
686
+ * @event App#loadstart
687
+ * @type {CustomEvent}
688
+ * @property {object} detail The event detail.
689
+ * @property {string} detail.dataid The data id.
690
+ * @property {string} detail.loadtype The load type: image or state.
691
+ * @property {*} detail.source The load source: string for an url,
692
+ * File for a file.
668
693
  */
669
- addEventListener(type: string, callback: Function): void;
670
694
  /**
671
- * Remove an event listener from this class.
695
+ * Load progress event.
672
696
  *
673
- * @param {string} type The event type.
674
- * @param {Function} callback The function associated with the provided
675
- * event type.
697
+ * @event App#loadprogress
698
+ * @type {CustomEvent}
699
+ * @property {object} detail The event detail.
700
+ * @property {string} detail.dataid The data id.
701
+ * @property {string} detail.loadtype The load type: image or state.
702
+ * @property {*} detail.source The load source: string for an url,
703
+ * File for a file.
704
+ * @property {number} detail.loaded The loaded percentage.
705
+ * @property {number} detail.total The total percentage.
706
+ */
707
+ /**
708
+ * Load item event: fired when an item has been successfully loaded.
709
+ *
710
+ * @event App#loaditem
711
+ * @type {CustomEvent}
712
+ * @property {object} detail The event detail.
713
+ * @property {string} detail.dataid The data id.
714
+ * @property {string} detail.loadtype The load type: image or state.
715
+ * @property {*} detail.source The load source: string for an url,
716
+ * File for a file.
717
+ * @property {object} detail.data The loaded meta data.
718
+ * @property {boolean} detail.isfirstitem True if the item is the first
719
+ * one loaded for the data id.
720
+ */
721
+ /**
722
+ * Load event: fired when a load finishes successfully.
723
+ *
724
+ * @event App#load
725
+ * @type {CustomEvent}
726
+ * @property {object} detail The event detail.
727
+ * @property {string} detail.dataid The data id.
728
+ * @property {string} detail.loadtype The load type: image or state.
729
+ * @property {*} detail.source The load source: string for an url,
730
+ * File for a file.
731
+ */
732
+ /**
733
+ * Load end event: fired when the load finishes,
734
+ * successfully or not.
735
+ *
736
+ * @event App#loadend
737
+ * @type {CustomEvent}
738
+ * @property {object} detail The event detail.
739
+ * @property {string} detail.dataid The data id.
740
+ * @property {string} detail.loadtype The load type: image or state.
741
+ * @property {*} detail.source The load source: string for an url,
742
+ * File for a file.
743
+ */
744
+ /**
745
+ * Load error event.
746
+ *
747
+ * @event App#error
748
+ * @type {CustomEvent}
749
+ * @property {object} detail The event detail.
750
+ * @property {string} detail.dataid The data id.
751
+ * @property {string} detail.loadtype The load type: image or state.
752
+ * @property {*} detail.source The load source: string for an url,
753
+ * File for a file.
754
+ * @property {object} detail.error The error.
755
+ * @property {object} detail.target The event target.
756
+ */
757
+ /**
758
+ * Load timeout event.
759
+ *
760
+ * @event App#timeout
761
+ * @type {CustomEvent}
762
+ * @property {object} detail The event detail.
763
+ * @property {string} detail.dataid The data id.
764
+ * @property {string} detail.loadtype The load type: image or state.
765
+ * @property {*} detail.source The load source: an url as a string.
766
+ * @property {object} detail.target The event target.
767
+ */
768
+ /**
769
+ * Load abort event.
770
+ *
771
+ * @event App#abort
772
+ * @type {CustomEvent}
773
+ * @property {object} detail The event detail.
774
+ * @property {string} detail.dataid The data id.
775
+ * @property {string} detail.loadtype The load type: image or state.
776
+ * @property {*} detail.source The load source: string for an url,
777
+ * File for a file.
676
778
  */
677
- removeEventListener(type: string, callback: Function): void;
678
779
  /**
679
780
  * Load a list of files. Can be image files or a state file.
680
781
  *
@@ -745,6 +846,9 @@ export declare class App {
745
846
  /**
746
847
  * Fit the display to the data of each layer group.
747
848
  * To be called once the image is loaded.
849
+ *
850
+ * @deprecated Since v0.37, use
851
+ * `app.getStageController().fitToContainer()` instead.
748
852
  */
749
853
  fitToContainer(): void;
750
854
  /**
@@ -759,6 +863,8 @@ export declare class App {
759
863
  * Set the imageSmoothing flag value. Default is false.
760
864
  *
761
865
  * @param {boolean} flag True to enable smoothing.
866
+ * @deprecated Since v0.37, use
867
+ * `app.getStageController().setImageSmoothing()` instead.
762
868
  */
763
869
  setImageSmoothing(flag: boolean): void;
764
870
  /**
@@ -768,37 +874,40 @@ export declare class App {
768
874
  * @param {boolean} [excludeStarConfig] Exclude the star config
769
875
  * (default to false).
770
876
  * @returns {ViewConfig[]} The list of associated configs.
877
+ * @deprecated Since v0.37, use
878
+ * `app.getStageController().getViewConfigs()` instead.
771
879
  */
772
880
  getViewConfigs(dataId: string, excludeStarConfig?: boolean): ViewConfig[];
773
881
  /**
774
- * Get the layer group configuration for a data id and group
775
- * div id.
882
+ * Get the layer group configuration for a data id and group div id.
776
883
  *
777
884
  * @param {string} dataId The data id.
778
885
  * @param {string} groupDivId The layer group div id.
779
886
  * @param {boolean} [excludeStarConfig] Exclude the star config
780
887
  * (default to false).
781
888
  * @returns {ViewConfig|undefined} The associated config.
889
+ * @deprecated Since v0.37, use
890
+ * `app.getStageController().getViewConfig()` instead.
782
891
  */
783
892
  getViewConfig(dataId: string, groupDivId: string, excludeStarConfig?: boolean): ViewConfig | undefined;
784
893
  /**
785
894
  * Get the data view config.
786
- * Carefull, returns a reference, do not modify without resetting.
895
+ * Careful, returns a reference; do not modify without resetting.
787
896
  *
788
- * @returns {Object<string, ViewConfig[]>} The configuration list.
897
+ * @returns {Record<string, ViewConfig[]>} The configuration list.
898
+ * @deprecated Since v0.37, use
899
+ * `app.getStageController().getDataViewConfigs()` instead.
789
900
  */
790
- getDataViewConfigs(): {
791
- [x: string]: ViewConfig[];
792
- };
901
+ getDataViewConfigs(): Record<string, ViewConfig[]>;
793
902
  /**
794
903
  * Set the data view configuration.
795
904
  * Resets the stage and recreates all the views.
796
905
  *
797
- * @param {Object<string, ViewConfig[]>} configs The configuration list.
906
+ * @param {Record<string, ViewConfig[]>} configs The configuration list.
907
+ * @deprecated Since v0.37, use
908
+ * `app.getStageController().setDataViewConfigs()` instead.
798
909
  */
799
- setDataViewConfigs(configs: {
800
- [x: string]: ViewConfig[];
801
- }): void;
910
+ setDataViewConfigs(configs: Record<string, ViewConfig[]>): void;
802
911
  /**
803
912
  * Add a data view config.
804
913
  *
@@ -806,6 +915,8 @@ export declare class App {
806
915
  * @param {ViewConfig} config The view configuration.
807
916
  * @param {boolean} [doRender] Render data after configuration
808
917
  * add. Defaults to true.
918
+ * @deprecated Since v0.37, use
919
+ * `app.getStageController().addDataViewConfig()` instead.
809
920
  */
810
921
  addDataViewConfig(dataId: string, config: ViewConfig, doRender?: boolean): void;
811
922
  /**
@@ -815,6 +926,8 @@ export declare class App {
815
926
  *
816
927
  * @param {string} dataId The data id.
817
928
  * @param {string} divId The div id.
929
+ * @deprecated Since v0.37, use
930
+ * `app.getStageController().removeDataViewConfig()` instead.
818
931
  */
819
932
  removeDataViewConfig(dataId: string, divId: string): void;
820
933
  /**
@@ -824,6 +937,8 @@ export declare class App {
824
937
  * @param {string} dataId The data id.
825
938
  * @param {string} divId The div id.
826
939
  * @param {ViewConfig} config The view configuration.
940
+ * @deprecated Since v0.37, use
941
+ * `app.getStageController().updateDataViewConfig()` instead.
827
942
  */
828
943
  updateDataViewConfig(dataId: string, divId: string, config: ViewConfig): void;
829
944
  /**
@@ -837,6 +952,8 @@ export declare class App {
837
952
  *
838
953
  * @param {string} dataId The data id to render.
839
954
  * @param {ViewConfig[]} [viewConfigs] The list of configs to render.
955
+ * @deprecated Since v0.37, use
956
+ * `app.getStageController().render()` instead.
840
957
  */
841
958
  render(dataId: string, viewConfigs?: ViewConfig[]): void;
842
959
  /**
@@ -845,6 +962,7 @@ export declare class App {
845
962
  * @param {number} step The step to add to the current zoom.
846
963
  * @param {number} cx The zoom center X coordinate.
847
964
  * @param {number} cy The zoom center Y coordinate.
965
+ * @deprecated Since v0.37, please access from the active layer group.
848
966
  */
849
967
  zoom(step: number, cx: number, cy: number): void;
850
968
  /**
@@ -852,6 +970,7 @@ export declare class App {
852
970
  *
853
971
  * @param {number} tx The translation along X.
854
972
  * @param {number} ty The translation along Y.
973
+ * @deprecated Since v0.37, please access from the active layer group.
855
974
  */
856
975
  translate(tx: number, ty: number): void;
857
976
  /**
@@ -912,11 +1031,12 @@ export declare class App {
912
1031
  /**
913
1032
  * Key down callback. Meant to be used in tools.
914
1033
  *
915
- * @param {KeyboardEvent} event The key down event.
1034
+ * @param {object} event The KeyboardEvent down event
1035
+ * augmented with a context.
916
1036
  * @fires App#keydown
917
1037
  * @function
918
1038
  */
919
- onKeydown: (event: KeyboardEvent) => void;
1039
+ onKeydown: (event: object) => void;
920
1040
  /**
921
1041
  * Key down event handler example.
922
1042
  * - CRTL-Z: undo,
@@ -974,24 +1094,28 @@ export declare class App {
974
1094
  * Undo the last action.
975
1095
  *
976
1096
  * @fires UndoStack#undo
1097
+ * @deprecated Since v0.37, please use via app.getUndoController.
977
1098
  */
978
1099
  undo(): void;
979
1100
  /**
980
1101
  * Redo the last action.
981
1102
  *
982
1103
  * @fires UndoStack#redo
1104
+ * @deprecated Since v0.37, please use via app.getUndoController.
983
1105
  */
984
1106
  redo(): void;
985
1107
  /**
986
1108
  * Get the undo stack size.
987
1109
  *
988
1110
  * @returns {number} The size of the stack.
1111
+ * @deprecated Since v0.37, please use via app.getUndoController.
989
1112
  */
990
1113
  getStackSize(): number;
991
1114
  /**
992
1115
  * Get the current undo stack index.
993
1116
  *
994
1117
  * @returns {number} The stack index.
1118
+ * @deprecated Since v0.37, please use via app.getUndoController.
995
1119
  */
996
1120
  getCurrentStackIndex(): number;
997
1121
  /**
@@ -1023,13 +1147,6 @@ export declare class App {
1023
1147
  * @param {string} refDataId The reference data id.
1024
1148
  */
1025
1149
  addAndRenderAnnotationData(data: DicomData, divId: string, refDataId: string): void;
1026
- /**
1027
- * Add a draw layer.
1028
- *
1029
- * @param {string} dataId The data id.
1030
- * @param {ViewConfig} viewConfig The data view config.
1031
- */
1032
- addDrawLayer(dataId: string, viewConfig: ViewConfig): void;
1033
1150
  #private;
1034
1151
  }
1035
1152
 
@@ -1038,28 +1155,22 @@ export declare class App {
1038
1155
  */
1039
1156
  export declare class AppOptions {
1040
1157
  /**
1041
- * @param {Object<string, ViewConfig[]>} [dataViewConfigs] Optional dataId
1158
+ * @param {Record<string, ViewConfig[]>} [dataViewConfigs] Optional dataId
1042
1159
  * indexed object containing the data view configurations.
1043
1160
  */
1044
- constructor(dataViewConfigs?: {
1045
- [x: string]: ViewConfig[];
1046
- });
1161
+ constructor(dataViewConfigs?: Record<string, ViewConfig[]>);
1047
1162
  /**
1048
1163
  * DataId indexed object containing the data view configurations.
1049
1164
  *
1050
- * @type {Object<string, ViewConfig[]>|undefined}
1165
+ * @type {Record<string, ViewConfig[]>|undefined}
1051
1166
  */
1052
- dataViewConfigs: {
1053
- [x: string]: ViewConfig[];
1054
- } | undefined;
1167
+ dataViewConfigs: Record<string, ViewConfig[]> | undefined;
1055
1168
  /**
1056
1169
  * Tool name indexed object containing individual tool configurations.
1057
1170
  *
1058
- * @type {Object<string, ToolConfig>|undefined}
1171
+ * @type {Record<string, ToolConfig>|undefined}
1059
1172
  */
1060
- tools: {
1061
- [x: string]: ToolConfig;
1062
- } | undefined;
1173
+ tools: Record<string, ToolConfig> | undefined;
1063
1174
  /**
1064
1175
  * Optional array of layerGroup binder names.
1065
1176
  *
@@ -1114,6 +1225,23 @@ export declare class BooleanResult {
1114
1225
  message: string | undefined;
1115
1226
  }
1116
1227
 
1228
+ /**
1229
+ * Extract polygon contours from a mask slice using Moore neighborhood tracing.
1230
+ * Returns one polygon per connected region with the given segment value.
1231
+ *
1232
+ * @param {Uint8Array} buffer The mask buffer (all slices).
1233
+ * @param {number} sliceOffset Byte offset of the slice in buffer.
1234
+ * @param {number} width Slice width in pixels.
1235
+ * @param {number} height Slice height in pixels.
1236
+ * @param {number} value Segment value to trace.
1237
+ * @returns {Array.<Array.<{x: number, y: number}>>} One polygon per
1238
+ * connected region.
1239
+ */
1240
+ export declare function bufferToPolygons(buffer: Uint8Array, sliceOffset: number, width: number, height: number, value: number): Array<Array<{
1241
+ x: number;
1242
+ y: number;
1243
+ }>>;
1244
+
1117
1245
  /**
1118
1246
  * Build a multipart message.
1119
1247
  *
@@ -1146,6 +1274,11 @@ export declare class CADReport {
1146
1274
  comment: string;
1147
1275
  }
1148
1276
 
1277
+ /**
1278
+ * @import {Image} from '../image/image.js';
1279
+ * @import {MaskSegment} from '../dicom/dicomSegment.js';
1280
+ * @import {RGB} from '../utils/colour.js';
1281
+ */
1149
1282
  /**
1150
1283
  * Change segment colour command.
1151
1284
  */
@@ -1247,11 +1380,9 @@ export declare class Circle {
1247
1380
  * @param {Index} index The index at which to get the
1248
1381
  * image values.
1249
1382
  * @param {string[]} flags A list of stat values to calculate.
1250
- * @returns {Object<string, Value>} A quantification object.
1383
+ * @returns {Record<string, NumberValue>} A quantification object.
1251
1384
  */
1252
- quantify(viewController: ViewController, index: Index, flags: string[]): {
1253
- [x: string]: Value;
1254
- };
1385
+ quantify(viewController: ViewController, index: Index, flags: string[]): Record<string, NumberValue>;
1255
1386
  #private;
1256
1387
  }
1257
1388
 
@@ -1309,52 +1440,151 @@ export declare class Command {
1309
1440
  /**
1310
1441
  * Create an Image from DICOM elements.
1311
1442
  *
1312
- * @param {Object<string, DataElement>} elements The DICOM elements.
1443
+ * @param {Record<string, DataElement>} elements The DICOM elements.
1313
1444
  * @returns {Image} The Image object.
1314
1445
  */
1315
- export declare function createImage(elements: {
1316
- [x: string]: DataElement;
1317
- }): Image_2;
1446
+ export declare function createImage(elements: Record<string, DataElement>): Image_2;
1318
1447
 
1319
1448
  /**
1320
1449
  * Create a mask Image from DICOM elements.
1321
1450
  *
1322
- * @param {Object<string, DataElement>} elements The DICOM elements.
1451
+ * @param {Record<string, DataElement>} elements The DICOM elements.
1323
1452
  * @returns {Image} The mask Image object.
1324
1453
  */
1325
- export declare function createMaskImage(elements: {
1326
- [x: string]: DataElement;
1327
- }): Image_2;
1454
+ export declare function createMaskImage(elements: Record<string, DataElement>): Image_2;
1328
1455
 
1329
1456
  /**
1330
1457
  * Create a View from DICOM elements and image.
1331
1458
  *
1332
- * @param {Object<string, DataElement>} elements The DICOM elements.
1459
+ * @param {Record<string, DataElement>} elements The DICOM elements.
1333
1460
  * @param {Image} image The associated image.
1334
1461
  * @returns {View} The View object.
1335
1462
  */
1336
- export declare function createView(elements: {
1337
- [x: string]: DataElement;
1338
- }, image: Image_2): View;
1463
+ export declare function createView(elements: Record<string, DataElement>, image: Image_2): View;
1339
1464
 
1340
1465
  export declare namespace custom {
1341
- let wlPresets: {
1342
- [x: string]: {
1343
- [x: string]: WindowLevel;
1344
- };
1345
- };
1346
- let labelTexts: {
1347
- [x: string]: {
1348
- [x: string]: string;
1349
- };
1350
- };
1466
+ let wlPresets: Record<string, Record<string, WindowLevel>>;
1467
+ let labelTexts: Record<string, Record<string, string>>;
1351
1468
  let privateBValueRules: object[];
1352
1469
  let openRoiDialog: any;
1353
1470
  let getVolumeIdTagValue: any;
1354
1471
  let getPostLoadVolumeIdTagValue: any;
1472
+ let postLoadVolumeIdCandidates: {
1473
+ name: string;
1474
+ getter: Function;
1475
+ }[];
1355
1476
  let getTagPixelUnit: any;
1356
1477
  }
1357
1478
 
1479
+ /**
1480
+ * DicomData controller.
1481
+ */
1482
+ export declare class DataController extends EventTarget {
1483
+ /**
1484
+ * Get the next data id.
1485
+ *
1486
+ * @returns {string} The data id.
1487
+ */
1488
+ getNextDataId(): string;
1489
+ /**
1490
+ * Get the list of ids in the data storage.
1491
+ *
1492
+ * @returns {string[]} The list of data ids.
1493
+ */
1494
+ getDataIds(): string[];
1495
+ /**
1496
+ * Reset the class: empty the data storage.
1497
+ */
1498
+ reset(): void;
1499
+ /**
1500
+ * Get a data at a given index.
1501
+ *
1502
+ * @param {string} dataId The data id.
1503
+ * @returns {DicomData|undefined} The DICOM data.
1504
+ */
1505
+ get(dataId: string): DicomData | undefined;
1506
+ /**
1507
+ * Get the list of dataIds that contain the input UIDs.
1508
+ *
1509
+ * @param {string[]} uids A list of UIDs.
1510
+ * @returns {string[]} The list of dataIds that contain the UIDs.
1511
+ */
1512
+ getDataIdsFromSopUids(uids: string[]): string[];
1513
+ /**
1514
+ * Get the first data id with the given SeriesInstanceUID.
1515
+ *
1516
+ * @param {string} uid The SeriesInstanceUID.
1517
+ * @returns {string} The data id.
1518
+ */
1519
+ getDataIdFromSeriesUid(uid: string): string;
1520
+ /**
1521
+ * Set the image at a given index.
1522
+ *
1523
+ * @param {string} dataId The data id.
1524
+ * @param {Image} image The image to set.
1525
+ */
1526
+ setImage(dataId: string, image: Image_2): void;
1527
+ /**
1528
+ * Add a new data.
1529
+ *
1530
+ * @param {string} dataId The data id.
1531
+ * @param {DicomData} data The data.
1532
+ * @returns {boolean} False if the data cannot be added.
1533
+ */
1534
+ add(dataId: string, data: DicomData): boolean;
1535
+ /**
1536
+ * Remove a data from the list.
1537
+ *
1538
+ * @param {string} dataId The data id.
1539
+ */
1540
+ remove(dataId: string): void;
1541
+ /**
1542
+ * Stash a data from the list.
1543
+ *
1544
+ * @param {string} dataId The data id.
1545
+ */
1546
+ stash(dataId: string): void;
1547
+ /**
1548
+ * Unstash a data from the list.
1549
+ *
1550
+ * @param {string} dataId The data id.
1551
+ */
1552
+ unstash(dataId: string): void;
1553
+ /**
1554
+ * Get the list of ids in the stashed data storage.
1555
+ *
1556
+ * @returns {string[]} The list of data ids.
1557
+ */
1558
+ getStashedDataIds(): string[];
1559
+ /**
1560
+ * Get a stashed data at a given index.
1561
+ *
1562
+ * @param {string} dataId The data id.
1563
+ * @returns {DicomData|undefined} The DICOM data.
1564
+ */
1565
+ getStashed(dataId: string): DicomData | undefined;
1566
+ /**
1567
+ * Update the current data.
1568
+ *
1569
+ * @param {string} dataId The data id.
1570
+ * @param {DicomData} data The data.
1571
+ */
1572
+ update(dataId: string, data: DicomData): void;
1573
+ /**
1574
+ * Mark a data a complete (fully loaded).
1575
+ *
1576
+ * @param {string} dataId The data id.
1577
+ * @returns {{imageHasChanged}} An object with an imageHasChanged property.
1578
+ */
1579
+ markDataAsComplete(dataId: string): {
1580
+ imageHasChanged: any;
1581
+ };
1582
+ #private;
1583
+ }
1584
+
1585
+ /**
1586
+ * @import {Tag} from './dicomTag.js';
1587
+ */
1358
1588
  /**
1359
1589
  * DICOM data element.
1360
1590
  */
@@ -1416,23 +1646,21 @@ export declare class DataElement {
1416
1646
  /**
1417
1647
  * Default tool list.
1418
1648
  *
1419
- * @type {Object<string, any>}
1649
+ * @type {Record<string, any>}
1420
1650
  */
1421
- export declare const defaultToolList: {
1422
- [x: string]: any;
1423
- };
1651
+ export declare const defaultToolList: Record<string, any>;
1424
1652
 
1425
1653
  /**
1426
1654
  * Default tool options.
1427
1655
  *
1428
- * @type {Object<string, Object<string, any>>}
1656
+ * @type {Record<string, Record<string, any>>}
1429
1657
  */
1430
- export declare const defaultToolOptions: {
1431
- [x: string]: {
1432
- [x: string]: any;
1433
- };
1434
- };
1658
+ export declare const defaultToolOptions: Record<string, Record<string, any>>;
1435
1659
 
1660
+ /**
1661
+ * @import {Image} from '../image/image.js';
1662
+ * @import {MaskSegment} from '../dicom/dicomSegment.js';
1663
+ */
1436
1664
  /**
1437
1665
  * Delete segment command.
1438
1666
  */
@@ -1464,6 +1692,10 @@ export declare class DeleteSegmentCommand extends Command {
1464
1692
  #private;
1465
1693
  }
1466
1694
 
1695
+ /**
1696
+ * @import {Point} from '../math/point.js';
1697
+ * @import {NumberValue} from '../math/number.js';
1698
+ */
1467
1699
  /**
1468
1700
  * Diameter type.
1469
1701
  */
@@ -1471,9 +1703,9 @@ export declare class Diameter {
1471
1703
  /**
1472
1704
  * The scaled diameter value.
1473
1705
  *
1474
- * @type {Value}
1706
+ * @type {NumberValue}
1475
1707
  */
1476
- diameter: Value;
1708
+ diameter: NumberValue;
1477
1709
  /**
1478
1710
  * The offset of the pixel at the start
1479
1711
  * of the line used to calculate this diameter.
@@ -1561,19 +1793,15 @@ export declare class DicomCode {
1561
1793
  */
1562
1794
  export declare class DicomData {
1563
1795
  /**
1564
- * @param {Object<string, DataElement>} meta The DICOM meta data.
1796
+ * @param {Record<string, DataElement>} meta The DICOM meta data.
1565
1797
  */
1566
- constructor(meta: {
1567
- [x: string]: DataElement;
1568
- });
1798
+ constructor(meta: Record<string, DataElement>);
1569
1799
  /**
1570
1800
  * DICOM meta data.
1571
1801
  *
1572
- * @type {Object<string, DataElement>}
1802
+ * @type {Record<string, DataElement>}
1573
1803
  */
1574
- meta: {
1575
- [x: string]: DataElement;
1576
- };
1804
+ meta: Record<string, DataElement>;
1577
1805
  /**
1578
1806
  * Image extracted from meta data.
1579
1807
  *
@@ -1680,11 +1908,9 @@ export declare class DicomParser {
1680
1908
  /**
1681
1909
  * Get the DICOM data elements.
1682
1910
  *
1683
- * @returns {Object<string, DataElement>} The data elements.
1911
+ * @returns {Record<string, DataElement>} The data elements.
1684
1912
  */
1685
- getDicomElements(): {
1686
- [x: string]: DataElement;
1687
- };
1913
+ getDicomElements(): Record<string, DataElement>;
1688
1914
  /**
1689
1915
  * Safely get an elements' first value from the parsed elements.
1690
1916
  *
@@ -1814,14 +2040,12 @@ export declare class DicomWriter {
1814
2040
  * First checked by tagKey, tagName and then by groupName,
1815
2041
  * if nothing is found the default rule is applied.
1816
2042
  *
1817
- * @param {Object<string, WriterRule>} rules The input rules.
2043
+ * @param {Record<string, WriterRule>} rules The input rules.
1818
2044
  * @param {boolean} [addMissingTags] If true, explicit tags that
1819
2045
  * have replace rule and a value will be
1820
2046
  * added if missing. Defaults to false.
1821
2047
  */
1822
- setRules(rules: {
1823
- [x: string]: WriterRule;
1824
- }, addMissingTags?: boolean): void;
2048
+ setRules(rules: Record<string, WriterRule>, addMissingTags?: boolean): void;
1825
2049
  /**
1826
2050
  * Use a TextEncoder instead of the default text decoder.
1827
2051
  */
@@ -1837,15 +2061,90 @@ export declare class DicomWriter {
1837
2061
  /**
1838
2062
  * Get the ArrayBuffer corresponding to input DICOM elements.
1839
2063
  *
1840
- * @param {Object<string, DataElement>} dataElements The elements to write.
2064
+ * @param {Record<string, DataElement>} dataElements The elements to write.
1841
2065
  * @returns {ArrayBuffer} The elements as a buffer.
1842
2066
  */
1843
- getBuffer(dataElements: {
1844
- [x: string]: DataElement;
1845
- }): ArrayBuffer;
2067
+ getBuffer(dataElements: Record<string, DataElement>): ArrayBuffer;
2068
+ #private;
2069
+ }
2070
+
2071
+ /**
2072
+ * Draw brush command.
2073
+ */
2074
+ export declare class DrawBrushCommand extends Command {
2075
+ /**
2076
+ * @param {DrawBrushCommandProperties} properties The command properties.
2077
+ */
2078
+ constructor(properties: DrawBrushCommandProperties);
2079
+ /**
2080
+ * Get the original values before applying brush.
2081
+ *
2082
+ * @returns {Array|undefined} Lists of original value iterators,
2083
+ * undefined when erasing.
2084
+ */
2085
+ getOriginalValuesLists(): any[] | undefined;
2086
+ /**
2087
+ * Get the execute event.
2088
+ *
2089
+ * @returns {CustomEvent} The event.
2090
+ */
2091
+ getExecuteEvent(): CustomEvent;
2092
+ /**
2093
+ * Handle an execute event.
2094
+ *
2095
+ * @param {CustomEvent} _event The execute event with type and id.
2096
+ */
2097
+ onExecute(_event: CustomEvent): void;
2098
+ /**
2099
+ * Handle an undo event.
2100
+ *
2101
+ * @param {CustomEvent} _event The undo event with type and id.
2102
+ */
2103
+ onUndo(_event: CustomEvent): void;
1846
2104
  #private;
1847
2105
  }
1848
2106
 
2107
+ /**
2108
+ * @import {Image} from '../image/image.js';
2109
+ */
2110
+ export declare class DrawBrushCommandProperties {
2111
+ /**
2112
+ * @type {Image}
2113
+ */
2114
+ mask: Image_2;
2115
+ /**
2116
+ * @type {string}
2117
+ */
2118
+ dataId: string;
2119
+ /**
2120
+ * @type {number[][]}
2121
+ */
2122
+ offsetsLists: number[][];
2123
+ /**
2124
+ * @type {string}
2125
+ */
2126
+ mode: string;
2127
+ /**
2128
+ * @type {number}
2129
+ */
2130
+ segmentNumber: number;
2131
+ /**
2132
+ * @type {string}
2133
+ */
2134
+ srclayerid: string;
2135
+ /**
2136
+ * @type {Array}
2137
+ */
2138
+ originalValuesLists: any[];
2139
+ /**
2140
+ * @type {boolean}
2141
+ */
2142
+ isSilent: boolean;
2143
+ }
2144
+
2145
+ /**
2146
+ * @import {Annotation} from '../image/annotation.js';
2147
+ */
1849
2148
  /**
1850
2149
  * Draw controller.
1851
2150
  */
@@ -1941,6 +2240,15 @@ export declare class DrawController {
1941
2240
  #private;
1942
2241
  }
1943
2242
 
2243
+ /**
2244
+ * @import {Point, Point3D} from '../math/point.js';
2245
+ * @import {Vector3D} from '../math/vector.js';
2246
+ * @import {Scalar2D, Scalar3D} from '../math/scalar.js';
2247
+ * @import {Image} from '../image/image.js';
2248
+ * @import {PlaneHelper} from '../image/planeHelper.js';
2249
+ * @import {AnnotationGroup} from '../image/annotationGroup.js';
2250
+ * @import {DrawShapeHandler} from '../tools/shapes/drawShapeHandler.js';
2251
+ */
1944
2252
  /**
1945
2253
  * Debug function to output the layer hierarchy as text.
1946
2254
  *
@@ -1950,6 +2258,9 @@ export declare class DrawController {
1950
2258
  */
1951
2259
  /**
1952
2260
  * Draw layer.
2261
+ *
2262
+ * Not an EventTarget in order to forward native DOM events while
2263
+ * preserving `preventDefault()` for tools (see '#fireDomEvent').
1953
2264
  */
1954
2265
  export declare class DrawLayer {
1955
2266
  /**
@@ -2215,16 +2526,11 @@ export declare class DrawLayer {
2215
2526
  /**
2216
2527
  * Draw shape handler: handle action on existing shapes.
2217
2528
  */
2218
- export declare class DrawShapeHandler {
2219
- /**
2220
- * @callback eventFn@callback eventFn
2221
- * @param {object} event The event.
2222
- */
2529
+ export declare class DrawShapeHandler extends EventTarget {
2223
2530
  /**
2224
2531
  * @param {App} app The associated application.
2225
- * @param {Function} eventCallback Event callback.
2226
2532
  */
2227
- constructor(app: App, eventCallback: Function);
2533
+ constructor(app: App);
2228
2534
  /**
2229
2535
  * Set the draw editor shape.
2230
2536
  *
@@ -2351,11 +2657,9 @@ export declare class Ellipse {
2351
2657
  * @param {Index} index The index at which to get the
2352
2658
  * image values.
2353
2659
  * @param {string[]} flags A list of stat values to calculate.
2354
- * @returns {Object<string, Value>} A quantification object.
2660
+ * @returns {Record<string, NumberValue>} A quantification object.
2355
2661
  */
2356
- quantify(viewController: ViewController, index: Index, flags: string[]): {
2357
- [x: string]: Value;
2358
- };
2662
+ quantify(viewController: ViewController, index: Index, flags: string[]): Record<string, NumberValue>;
2359
2663
  #private;
2360
2664
  }
2361
2665
 
@@ -2539,6 +2843,16 @@ export declare class Geometry {
2539
2843
  * @returns {boolean} True if both objects are equal.
2540
2844
  */
2541
2845
  equals(rhs: Geometry): boolean;
2846
+ /**
2847
+ * Check for similarity for origin and orientation, equality
2848
+ * for size and spacing.
2849
+ *
2850
+ * @param {Geometry} rhs The object to compare to.
2851
+ * @param {number} [tol] Optional number comparison tolerance,
2852
+ * defaults to Number.EPSILON.
2853
+ * @returns {boolean} True if both objects are equal.
2854
+ */
2855
+ isSimilar(rhs: Geometry, tol?: number): boolean;
2542
2856
  /**
2543
2857
  * Check that a point is within bounds.
2544
2858
  *
@@ -2593,42 +2907,60 @@ export declare class Geometry {
2593
2907
  }
2594
2908
 
2595
2909
  /**
2596
- * Get the meta data as simple elements:
2910
+ * Get the meta data as simple tag values:
2597
2911
  * - indexed by tag names instead of tag keys,
2598
2912
  * - no element object, just value if not sequence nor merged item.
2599
2913
  *
2600
- * @param {Object<string, DataElement>} metaData The meta data
2914
+ * @param {Record<string, DataElement>} dataElements The data elements
2601
2915
  * index by tag keys.
2602
- * @returns {Object<string, any>} The simple elements.
2916
+ * @returns {SimpleTagValues} The simple tag values.
2603
2917
  */
2604
- export declare function getAsSimpleElements(metaData: {
2605
- [x: string]: DataElement;
2606
- }): {
2607
- [x: string]: any;
2608
- };
2918
+ export declare function getAsSimpleTagValues(dataElements: Record<string, DataElement>): SimpleTagValues;
2919
+
2920
+ /**
2921
+ * Get the default DICOM RT Structure Set tags as an object.
2922
+ *
2923
+ * @returns {SimpleTagValues} The default tags.
2924
+ */
2925
+ export declare function getDefaultDicomRTStructJson(): SimpleTagValues;
2609
2926
 
2610
2927
  /**
2611
2928
  * Get the default DICOM seg tags as an object.
2612
2929
  *
2613
- * @returns {object} The default tags.
2930
+ * @returns {SimpleTagValues} The default tags.
2614
2931
  */
2615
- export declare function getDefaultDicomSegJson(): object;
2932
+ export declare function getDefaultDicomSegJson(): SimpleTagValues;
2616
2933
 
2617
2934
  /**
2618
2935
  * Get a simple dicom element item from a content item object.
2619
2936
  *
2620
2937
  * @param {DicomSRContent} content The content item object.
2621
- * @returns {Object<string, any>} The item as a list of (key, value) pairs.
2938
+ * @returns {SimpleTagValues} The item as a list of (key, value) pairs.
2622
2939
  */
2623
- export declare function getDicomSRContentItem(content: DicomSRContent): {
2624
- [x: string]: any;
2625
- };
2940
+ export declare function getDicomSRContentItem(content: DicomSRContent): SimpleTagValues;
2941
+
2942
+ /**
2943
+ * Get the DICOM tag group name as defined in TagGroups.
2944
+ *
2945
+ * @param {Tag} tag The DICOM tag.
2946
+ * @returns {string|undefined} The group name.
2947
+ */
2948
+ export declare function getDicomTagGroupName(tag: Tag): string | undefined;
2949
+
2950
+ /**
2951
+ * Get the DICOM tag info for a tag using the
2952
+ * local DICOM tag dictionary.
2953
+ *
2954
+ * @param {Tag} tag The DICOM tag.
2955
+ * @returns {TagInfo|undefined} The info.
2956
+ */
2957
+ export declare function getDicomTagInfo(tag: Tag): TagInfo | undefined;
2626
2958
 
2627
2959
  /**
2628
2960
  * List of DICOM data elements indexed via a 8 character string formed from
2629
2961
  * the group and element numbers.
2630
2962
  *
2631
- * @typedef {Object<string, DataElement>} DataElements
2963
+ * @typedef {Record<string, DataElement>} DataElements
2632
2964
  */
2633
2965
  /**
2634
2966
  * Get the version of the library.
@@ -2643,15 +2975,11 @@ export declare function getDwvVersion(): string;
2643
2975
  * tag names instead of keys and direct values (no value property) for
2644
2976
  * simple tags. See synthetic test data (in tests/dicom) for examples.
2645
2977
  *
2646
- * @param {Object<string, any>} simpleTags The 'simple' DICOM
2978
+ * @param {SimpleTagValues} simpleTags The 'simple' DICOM
2647
2979
  * tags object.
2648
- * @returns {Object<string, DataElement>} The DICOM elements.
2980
+ * @returns {Record<string, DataElement>} The DICOM elements.
2649
2981
  */
2650
- export declare function getElementsFromJSONTags(simpleTags: {
2651
- [x: string]: any;
2652
- }): {
2653
- [x: string]: DataElement;
2654
- };
2982
+ export declare function getElementsFromSimpleTagValues(simpleTags: SimpleTagValues): Record<string, DataElement>;
2655
2983
 
2656
2984
  /**
2657
2985
  * Get the indices that form a ellpise.
@@ -2676,31 +3004,27 @@ export declare function getLayerDetailsFromEvent(event: object): object;
2676
3004
  /**
2677
3005
  * Get the manufacturer.
2678
3006
  *
2679
- * @param {Object<string, DataElement>} elements The DICOM tags.
3007
+ * @param {Record<string, DataElement>} elements The DICOM tags.
2680
3008
  * @returns {string|undefined} The manufacturer.
2681
3009
  */
2682
- export declare function getManufacturer(elements: {
2683
- [x: string]: DataElement;
2684
- }): string | undefined;
3010
+ export declare function getManufacturer(elements: Record<string, DataElement>): string | undefined;
2685
3011
 
2686
3012
  /**
2687
3013
  * Get the offset of an input mouse event.
2688
3014
  *
2689
- * @param {object} event The event to get the offset from.
3015
+ * @param {MouseEvent} event The event to get the offset from.
2690
3016
  * @returns {Point2D} The 2D point.
2691
3017
  */
2692
- export declare function getMousePoint(event: object): Point2D;
3018
+ export declare function getMousePoint(event: MouseEvent): Point2D;
2693
3019
 
2694
3020
  /**
2695
3021
  * Get the normalised manufacturer.
2696
3022
  *
2697
- * @param {Object<string, DataElement>} elements The DICOM tags.
3023
+ * @param {Record<string, DataElement>} elements The DICOM tags.
2698
3024
  * @returns {string|undefined} The manufacturer as a unique
2699
3025
  * all lower case string.
2700
3026
  */
2701
- export declare function getNormalisedManufacturer(elements: {
2702
- [x: string]: DataElement;
2703
- }): string | undefined;
3027
+ export declare function getNormalisedManufacturer(elements: Record<string, DataElement>): string | undefined;
2704
3028
 
2705
3029
  /**
2706
3030
  * Get the name of an image orientation patient.
@@ -2732,12 +3056,23 @@ export declare function getRectangleIndices(center: Index, size: number[], dir:
2732
3056
  /**
2733
3057
  * Get the referenced series UID from the data elements.
2734
3058
  *
2735
- * @param {Object<string, DataElement>} dataElements The data elements.
3059
+ * @param {Record<string, DataElement>} dataElements The data elements.
3060
+ * @returns {string|undefined} The referenced series UID.
3061
+ */
3062
+ export declare function getReferencedSeriesUID(dataElements: Record<string, DataElement>): string | undefined;
3063
+
3064
+ /**
3065
+ * Get the referenced series UID from an RT Structure Set.
3066
+ *
3067
+ * Path: ReferencedFrameOfReferenceSequence (3006,0010) →
3068
+ * RTReferencedStudySequence (3006,0012) →
3069
+ * RTReferencedSeriesSequence (3006,0014) →
3070
+ * SeriesInstanceUID (0020,000E).
3071
+ *
3072
+ * @param {Record<string, DataElement>} dataElements The data elements.
2736
3073
  * @returns {string|undefined} The referenced series UID.
2737
3074
  */
2738
- export declare function getReferencedSeriesUID(dataElements: {
2739
- [x: string]: DataElement;
2740
- }): string | undefined;
3075
+ export declare function getReferencedSeriesUIDFromRTStruct(dataElements: Record<string, DataElement>): string | undefined;
2741
3076
 
2742
3077
  /**
2743
3078
  * Get patient orientation label in the reverse direction.
@@ -2747,6 +3082,14 @@ export declare function getReferencedSeriesUID(dataElements: {
2747
3082
  */
2748
3083
  export declare function getReverseOrientation(ori: string): string;
2749
3084
 
3085
+ /**
3086
+ * Get a list of {@link RTROI} objects from RTSTRUCT DICOM elements.
3087
+ *
3088
+ * @param {Record<string, DataElement>} dataElements The DICOM data elements.
3089
+ * @returns {RTROI[]} The list of RT ROIs.
3090
+ */
3091
+ export declare function getRTStructFromElements(dataElements: Record<string, DataElement>): RTROI[];
3092
+
2750
3093
  /**
2751
3094
  * Get a segmentation DICOM code.
2752
3095
  *
@@ -2757,12 +3100,10 @@ export declare function getSegmentationCode(): DicomCode;
2757
3100
  /**
2758
3101
  * Get a content item object from a dicom element.
2759
3102
  *
2760
- * @param {Object<string, DataElement>} dataElements The dicom element.
3103
+ * @param {Record<string, DataElement>} dataElements The dicom element.
2761
3104
  * @returns {DicomSRContent} A content item object.
2762
3105
  */
2763
- export declare function getSRContent(dataElements: {
2764
- [x: string]: DataElement;
2765
- }): DicomSRContent;
3106
+ export declare function getSRContent(dataElements: Record<string, DataElement>): DicomSRContent;
2766
3107
 
2767
3108
  /**
2768
3109
  * Split a group-element key used to store DICOM elements.
@@ -2775,10 +3116,10 @@ export declare function getTagFromKey(key: string): Tag;
2775
3116
  /**
2776
3117
  * Get the offsets of an input touch event.
2777
3118
  *
2778
- * @param {object} event The event to get the offset from.
3119
+ * @param {TouchEvent} event The event to get the offset from.
2779
3120
  * @returns {Point2D[]} The array of points.
2780
3121
  */
2781
- export declare function getTouchPoints(event: object): Point2D[];
3122
+ export declare function getTouchPoints(event: TouchEvent): Point2D[];
2782
3123
 
2783
3124
  /**
2784
3125
  * Get the appropriate TypedArray in function of arguments.
@@ -2895,7 +3236,7 @@ export declare namespace i18n {
2895
3236
  * request.onload = onload;
2896
3237
  * request.send();
2897
3238
  */
2898
- declare class Image_2 {
3239
+ declare class Image_2 extends EventTarget {
2899
3240
  /**
2900
3241
  * @param {Geometry} geometry The geometry of the image.
2901
3242
  * @param {TypedArray} buffer The image data as a one dimensional buffer.
@@ -2915,8 +3256,31 @@ declare class Image_2 {
2915
3256
  */
2916
3257
  getComplete(): boolean;
2917
3258
  /**
2918
- * Get the image UID at a given index.
2919
- *
3259
+ * Set up a segment collection from the existing image buffer.
3260
+ * Used for brush-painted masks (not created via MaskFactory).
3261
+ */
3262
+ setupSegmentCollection(): void;
3263
+ /**
3264
+ * Set the segment collection.
3265
+ *
3266
+ * @param {SegmentCollection} collection The segment collection.
3267
+ */
3268
+ setSegmentCollection(collection: SegmentCollection): void;
3269
+ /**
3270
+ * Get the segment collection.
3271
+ *
3272
+ * @returns {SegmentCollection|undefined} The segment collection.
3273
+ */
3274
+ getSegmentCollection(): SegmentCollection | undefined;
3275
+ /**
3276
+ * Check whether the mask has overlapping segments.
3277
+ *
3278
+ * @returns {boolean} True if any two segments share at least one voxel.
3279
+ */
3280
+ getHasOverlap(): boolean;
3281
+ /**
3282
+ * Get the image UID at a given index.
3283
+ *
2920
3284
  * @param {Index} [index] The index at which to get the id.
2921
3285
  * @returns {string} The UID.
2922
3286
  */
@@ -2974,6 +3338,18 @@ declare class Image_2 {
2974
3338
  * @returns {boolean} True if the data is monochrome.
2975
3339
  */
2976
3340
  isMonochrome(): boolean;
3341
+ /**
3342
+ * Check is the image is a mask.
3343
+ *
3344
+ * @returns {boolean} True if mask.
3345
+ */
3346
+ isMask(): boolean;
3347
+ /**
3348
+ * Get the UID of the series referenced by the mask, if any.
3349
+ *
3350
+ * @returns {string|undefined} The UID.
3351
+ */
3352
+ getMaskReferencedSeriesUID(): string | undefined;
2977
3353
  /**
2978
3354
  * Can the data be scrolled?
2979
3355
  *
@@ -3069,19 +3445,15 @@ declare class Image_2 {
3069
3445
  /**
3070
3446
  * Get the meta information of the image.
3071
3447
  *
3072
- * @returns {Object<string, any>} The meta information of the image.
3448
+ * @returns {Record<string, any>} The meta information of the image.
3073
3449
  */
3074
- getMeta(): {
3075
- [x: string]: any;
3076
- };
3450
+ getMeta(): Record<string, any>;
3077
3451
  /**
3078
3452
  * Set the meta information of the image.
3079
3453
  *
3080
- * @param {Object<string, any>} rhs The meta information of the image.
3454
+ * @param {Record<string, any>} rhs The meta information of the image.
3081
3455
  */
3082
- setMeta(rhs: {
3083
- [x: string]: any;
3084
- }): void;
3456
+ setMeta(rhs: Record<string, any>): void;
3085
3457
  /**
3086
3458
  * Get value at offset. Warning: No size check...
3087
3459
  *
@@ -3159,22 +3531,6 @@ declare class Image_2 {
3159
3531
  * @returns {Array} The histogram.
3160
3532
  */
3161
3533
  getHistogram(): any[];
3162
- /**
3163
- * Add an event listener to this class.
3164
- *
3165
- * @param {string} type The event type.
3166
- * @param {Function} callback The function associated with the provided
3167
- * event type, will be called with the fired event.
3168
- */
3169
- addEventListener(type: string, callback: Function): void;
3170
- /**
3171
- * Remove an event listener from this class.
3172
- *
3173
- * @param {string} type The event type.
3174
- * @param {Function} callback The function associated with the provided
3175
- * event type.
3176
- */
3177
- removeEventListener(type: string, callback: Function): void;
3178
3534
  /**
3179
3535
  * Set the inner buffer values at given offsets.
3180
3536
  *
@@ -3314,22 +3670,18 @@ declare class Image_2 {
3314
3670
  */
3315
3671
  initializeContour(): void;
3316
3672
  /**
3317
- * Get whether or not the contour buffer has been initialized.
3318
- *
3319
- * @returns {boolean} True if buffer has been initialized.
3320
- */
3321
- countourIsInitialized(): boolean;
3322
- /**
3323
- * Calculate the distance to the nearest border pixel.
3324
- * (or return the cached distance).
3673
+ * Get the image contour. Should only be available
3674
+ * for segmentation images, but can be initialized
3675
+ * for any Uint8Array image.
3325
3676
  *
3326
- * @param {number} index Index/offset of the pixel to check.
3327
- * @param {Matrix33} viewOrientation The orientation of the view.
3328
- * @returns {number} The distance to the nearest border pixel or 0.
3677
+ * @returns {ImageContour} The image contour.
3329
3678
  */
3330
- getContourDistance(index: number, viewOrientation: Matrix33): number;
3679
+ getContour(): ImageContour;
3331
3680
  /**
3332
3681
  * Recalculate labels.
3682
+ *
3683
+ * @fires Image#labelingstart
3684
+ * @fires Image#labelschanged
3333
3685
  */
3334
3686
  recalculateLabels(): void;
3335
3687
  /**
@@ -3355,6 +3707,64 @@ declare class Image_2 {
3355
3707
  }
3356
3708
  export { Image_2 as Image }
3357
3709
 
3710
+ /**
3711
+ * Image contour buffer manager.
3712
+ * Caches per-pixel distance-to-border values for contour rendering.
3713
+ * Stores 3 distance values per pixel (one per orientation: x, y, z).
3714
+ */
3715
+ export declare class ImageContour {
3716
+ /**
3717
+ * Initialize the contour buffer.
3718
+ * Should be called on every segmentation image, or any image where
3719
+ * contour rendering needs to be supported.
3720
+ *
3721
+ * @param {Uint8Array} imageBuffer The image data buffer.
3722
+ * @param {Size} imageSize The image size.
3723
+ */
3724
+ initialize(imageBuffer: Uint8Array, imageSize: Size): void;
3725
+ /**
3726
+ * Get whether or not the contour buffer has been initialized.
3727
+ *
3728
+ * @returns {boolean} True if buffer has been initialized.
3729
+ */
3730
+ isInitialized(): boolean;
3731
+ /**
3732
+ * Re-allocate contour buffer memory after an image buffer resize.
3733
+ * Updates the stored image buffer and size references.
3734
+ *
3735
+ * @param {Uint8Array} imageBuffer The new image data buffer.
3736
+ * @param {Size} imageSize The new image size.
3737
+ */
3738
+ realloc(imageBuffer: Uint8Array, imageSize: Size): void;
3739
+ /**
3740
+ * Shift contour buffer content to make room for an inserted slice.
3741
+ *
3742
+ * @param {number} contourIndexOffset Start offset of the slice to shift.
3743
+ * @param {number} contourSliceSize Size of one contour slice.
3744
+ * @param {number} contourMaxOffset End offset of content to shift.
3745
+ */
3746
+ shiftSlice(contourIndexOffset: number, contourSliceSize: number, contourMaxOffset: number): void;
3747
+ /**
3748
+ * Reset contour buffer for the values around an offset.
3749
+ * Prevents certain artifacts, especially at small brush sizes
3750
+ * and when erasing.
3751
+ *
3752
+ * @param {number} offset The offset to reset.
3753
+ */
3754
+ resetAroundOffset(offset: number): void;
3755
+ /**
3756
+ * Calculate the distance to the nearest border pixel
3757
+ * (or return the cached distance).
3758
+ * Returns 0 if the contour buffer is not initialized.
3759
+ *
3760
+ * @param {number} index Index/offset of the pixel to check.
3761
+ * @param {Matrix33} viewOrientation The orientation of the view.
3762
+ * @returns {number} The distance to the nearest border pixel or 0.
3763
+ */
3764
+ getDistance(index: number, viewOrientation: Matrix33): number;
3765
+ #private;
3766
+ }
3767
+
3358
3768
  /**
3359
3769
  * Immutable index.
3360
3770
  * Warning: the input array is NOT cloned, modifying it will
@@ -3450,15 +3860,13 @@ export declare class Index {
3450
3860
  /**
3451
3861
  * DICOM Header info data.
3452
3862
  */
3453
- export declare class InfoData {
3863
+ export declare class InfoData extends EventTarget {
3454
3864
  /**
3455
3865
  * @param {App} app The associated application.
3456
3866
  * @param {string} dataId The associated data id.
3457
- * @param {Object<string, InfoDataItem[]>} configs The info data config.
3867
+ * @param {Record<string, InfoDataItem[]>} configs The info data config.
3458
3868
  */
3459
- constructor(app: App, dataId: string, configs: {
3460
- [x: string]: InfoDataItem[];
3461
- });
3869
+ constructor(app: App, dataId: string, configs: Record<string, InfoDataItem[]>);
3462
3870
  /**
3463
3871
  * Reset the data.
3464
3872
  */
@@ -3466,17 +3874,15 @@ export declare class InfoData {
3466
3874
  /**
3467
3875
  * Handle a new loaded item event.
3468
3876
  *
3469
- * @param {Object<string, DataElement>} data The item meta data.
3877
+ * @param {Record<string, DataElement>} data The item meta data.
3470
3878
  */
3471
- addItemMeta(data: {
3472
- [x: string]: DataElement;
3473
- }): void;
3879
+ addItemMeta(data: Record<string, DataElement>): void;
3474
3880
  /**
3475
3881
  * Handle a changed slice event.
3476
3882
  *
3477
- * @param {object} event The slicechange event.
3883
+ * @param {CustomEvent} event The slicechange event.
3478
3884
  */
3479
- onSliceChange: (event: object) => void;
3885
+ onSliceChange: (event: CustomEvent) => void;
3480
3886
  /**
3481
3887
  * Is this class listening to app events.
3482
3888
  *
@@ -3491,25 +3897,13 @@ export declare class InfoData {
3491
3897
  * Toggle info listeners.
3492
3898
  */
3493
3899
  removeAppListeners(): void;
3494
- /**
3495
- * Add an event listener to this class.
3496
- *
3497
- * @param {string} type The event type.
3498
- * @param {object} callback The method associated with the provided
3499
- * event type, will be called with the fired event.
3500
- */
3501
- addEventListener(type: string, callback: object): void;
3502
- /**
3503
- * Remove an event listener from this class.
3504
- *
3505
- * @param {string} type The event type.
3506
- * @param {object} callback The method associated with the provided
3507
- * event type.
3508
- */
3509
- removeEventListener(type: string, callback: object): void;
3510
3900
  #private;
3511
3901
  }
3512
3902
 
3903
+ /**
3904
+ * @import {App} from '../app/application.js';
3905
+ * @import {DataElement} from '../dicom/dataElement.js';
3906
+ */
3513
3907
  /**
3514
3908
  * Info data item class.
3515
3909
  */
@@ -3570,9 +3964,9 @@ export declare class Label {
3570
3964
  /**
3571
3965
  * The volume of the labeled segment.
3572
3966
  *
3573
- * @type {Value}
3967
+ * @type {NumberValue}
3574
3968
  */
3575
- volume: Value;
3969
+ volume: NumberValue;
3576
3970
  /**
3577
3971
  * The voxel count of the labeled segment.
3578
3972
  *
@@ -3588,9 +3982,9 @@ export declare class Label {
3588
3982
  /**
3589
3983
  * The scaled height of the segment.
3590
3984
  *
3591
- * @type {Value}
3985
+ * @type {NumberValue}
3592
3986
  */
3593
- height: Value;
3987
+ height: NumberValue;
3594
3988
  /**
3595
3989
  * The segment label id.
3596
3990
  *
@@ -3630,7 +4024,7 @@ export declare function labToUintLab(triplet: object): object;
3630
4024
  * - planePos = viewController.getOffset3DFromPlaneOffset(pos)
3631
4025
  * no need yet for a planePos to displayPos...
3632
4026
  */
3633
- export declare class LayerGroup {
4027
+ export declare class LayerGroup extends EventTarget {
3634
4028
  /**
3635
4029
  * @param {HTMLElement} containerDiv The associated HTML div.
3636
4030
  * @param {boolean} [withInfoLayer] Optional with info layer flag,
@@ -3937,10 +4331,10 @@ export declare class LayerGroup {
3937
4331
  /**
3938
4332
  * Update layers (but not the event source layer) to a position change.
3939
4333
  *
3940
- * @param {object} event The position change event.
4334
+ * @param {CustomEvent} event The position change event.
3941
4335
  * @function
3942
4336
  */
3943
- updateLayersToPositionChange: (event: object) => void;
4337
+ updateLayersToPositionChange: (event: CustomEvent) => void;
3944
4338
  /**
3945
4339
  * Calculate the div to world size ratio needed to fit
3946
4340
  * the largest data.
@@ -4016,22 +4410,6 @@ export declare class LayerGroup {
4016
4410
  * @param {boolean} flag Whether to display the layer or not.
4017
4411
  */
4018
4412
  display(flag: boolean): void;
4019
- /**
4020
- * Add an event listener to this class.
4021
- *
4022
- * @param {string} type The event type.
4023
- * @param {Function} callback The function associated with the provided
4024
- * event type, will be called with the fired event.
4025
- */
4026
- addEventListener(type: string, callback: Function): void;
4027
- /**
4028
- * Remove an event listener from this class.
4029
- *
4030
- * @param {string} type The event type.
4031
- * @param {Function} callback The function associated with the provided
4032
- * event type.
4033
- */
4034
- removeEventListener(type: string, callback: Function): void;
4035
4413
  #private;
4036
4414
  }
4037
4415
 
@@ -4044,21 +4422,45 @@ export declare namespace logger {
4044
4422
  let ERROR: number;
4045
4423
  }
4046
4424
  let level: number;
4425
+ /**
4426
+ * Log a trace message.
4427
+ *
4428
+ * @param {string} msg The message to log.
4429
+ */
4047
4430
  export function trace(msg: string): void;
4431
+ /**
4432
+ * Log a debug message.
4433
+ * Careful: depends on console settings.
4434
+ *
4435
+ * @param {string} msg The message to log.
4436
+ */
4048
4437
  export function debug(msg: string): void;
4438
+ /**
4439
+ * Log an info message.
4440
+ *
4441
+ * @param {string} msg The message to log.
4442
+ */
4049
4443
  export function info(msg: string): void;
4444
+ /**
4445
+ * Log a warn message.
4446
+ *
4447
+ * @param {string} msg The message to log.
4448
+ */
4050
4449
  export function warn(msg: string): void;
4450
+ /**
4451
+ * Log an error message.
4452
+ *
4453
+ * @param {string} msg The message to log.
4454
+ */
4051
4455
  export function error(msg: string): void;
4052
4456
  }
4053
4457
 
4054
4458
  /**
4055
4459
  * List of available lookup tables (lut).
4056
4460
  *
4057
- * @type {Object<string, ColourMap>}
4461
+ * @type {Record<string, ColourMap>}
4058
4462
  */
4059
- export declare const luts: {
4060
- [x: string]: ColourMap;
4061
- };
4463
+ export declare const luts: Record<string, ColourMap>;
4062
4464
 
4063
4465
  /**
4064
4466
  * Mask {@link Image} factory.
@@ -4074,41 +4476,31 @@ export declare class MaskFactory {
4074
4476
  /**
4075
4477
  * Check dicom elements.
4076
4478
  *
4077
- * @param {Object<string, DataElement>} _dicomElements The DICOM tags.
4479
+ * @param {Record<string, DataElement>} _dicomElements The DICOM tags.
4078
4480
  * @returns {string|undefined} A possible warning.
4079
4481
  */
4080
- checkElements(_dicomElements: {
4081
- [x: string]: DataElement;
4082
- }): string | undefined;
4482
+ checkElements(_dicomElements: Record<string, DataElement>): string | undefined;
4083
4483
  /**
4084
4484
  * Get an {@link Image} object from the read DICOM file.
4085
4485
  *
4086
- * @param {Object<string, DataElement>} dataElements The DICOM tags.
4087
- * @param {Uint8Array | Int8Array |
4088
- * Uint16Array | Int16Array |
4089
- * Uint32Array | Int32Array} pixelBuffer The pixel buffer.
4486
+ * @param {Record<string, DataElement>} dataElements The DICOM tags.
4487
+ * @param {Uint8Array} pixelBuffer The pixel buffer.
4090
4488
  * @param {Image} [refImage] Reference image, code will use its
4091
4489
  * origins if present (best) or try to calculate them.
4092
4490
  * @returns {Image} A new Image.
4093
4491
  * @throws {Error} Error for missing or wrong data.
4094
4492
  */
4095
- create(dataElements: {
4096
- [x: string]: DataElement;
4097
- }, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array, refImage?: Image_2): Image_2;
4493
+ create(dataElements: Record<string, DataElement>, pixelBuffer: Uint8Array, refImage?: Image_2): Image_2;
4098
4494
  /**
4099
4495
  * Convert a mask image into a DICOM segmentation object.
4100
4496
  *
4101
4497
  * @param {Image} image The mask image.
4102
4498
  * @param {MaskSegment[]} segments The mask segments.
4103
4499
  * @param {Image} sourceImage The source image.
4104
- * @param {Object<string, any>} [extraTags] Optional list of extra tags.
4105
- * @returns {Object<string, DataElement>} A list of dicom elements.
4500
+ * @param {SimpleTagValues} [extraTags] Optional list of extra tags.
4501
+ * @returns {Record<string, DataElement>} A list of dicom elements.
4106
4502
  */
4107
- toDicom(image: Image_2, segments: MaskSegment[], sourceImage: Image_2, extraTags?: {
4108
- [x: string]: any;
4109
- }): {
4110
- [x: string]: DataElement;
4111
- };
4503
+ toDicom(image: Image_2, segments: MaskSegment[], sourceImage: Image_2, extraTags?: SimpleTagValues): Record<string, DataElement>;
4112
4504
  #private;
4113
4505
  }
4114
4506
 
@@ -4186,8 +4578,24 @@ export declare class MaskSegment {
4186
4578
  * @type {string|undefined}
4187
4579
  */
4188
4580
  trackingId: string | undefined;
4581
+ /**
4582
+ * RT ROI interpreted type (3006,00A4), only used for RTSTRUCT segments.
4583
+ *
4584
+ * @type {string|undefined}
4585
+ */
4586
+ interpretedType: string | undefined;
4587
+ /**
4588
+ * RT ROI interpreter name (3006,00A6), only used for RTSTRUCT segments.
4589
+ *
4590
+ * @type {string|undefined}
4591
+ */
4592
+ roiInterpreter: string | undefined;
4189
4593
  }
4190
4594
 
4595
+ /**
4596
+ * @import {Image} from './image.js';
4597
+ * @import {MaskSegment} from '../dicom/dicomSegment.js';
4598
+ */
4191
4599
  /**
4192
4600
  * Mask segment helper: helps handling the segments list,
4193
4601
  * but does *NOT* update the associated mask (use special commands
@@ -4264,7 +4672,7 @@ export declare class MaskSegmentHelper {
4264
4672
  *
4265
4673
  * @typedef Overlap@typedef Overlap
4266
4674
  * @property {string} label The segment label.
4267
- * @property {Object.<number, OverlapCount>} overlap A Dictionary
4675
+ * @property {Record<number, OverlapCount>} overlap A Dictionary
4268
4676
  * containing the counts. The key is the segment number of the overlapping
4269
4677
  * segment.
4270
4678
  * @property {number} count The voxel volume of this segment.
@@ -4276,7 +4684,7 @@ export declare class MaskSegmentHelper {
4276
4684
  * The value is a Dictionary of all of the segments in the second set
4277
4685
  * that overlap with the key segment.
4278
4686
  *
4279
- * @typedef {Object.<number, Overlap>} OverlapMap
4687
+ * @typedef {Record<number, Overlap>} OverlapMap
4280
4688
  */
4281
4689
  /**
4282
4690
  * Find the overlap for each segment between two segmentation masks.
@@ -4287,39 +4695,35 @@ export declare class MaskSegmentHelper {
4287
4695
  * @returns {OverlapMap} The overlapping voxel counts. First level is the
4288
4696
  * segments from this image, second level is the compare image segments.
4289
4697
  */
4290
- findOverlap(rhs: MaskSegmentHelper): {
4291
- [x: number]: {
4698
+ findOverlap(rhs: MaskSegmentHelper): Record<number, {
4699
+ /**
4700
+ * The segment label.
4701
+ */
4702
+ label: string;
4703
+ /**
4704
+ * A Dictionary
4705
+ * containing the counts. The key is the segment number of the overlapping
4706
+ * segment.
4707
+ */
4708
+ overlap: Record<number, {
4292
4709
  /**
4293
4710
  * The segment label.
4294
4711
  */
4295
4712
  label: string;
4296
4713
  /**
4297
- * A Dictionary
4298
- * containing the counts. The key is the segment number of the overlapping
4299
- * segment.
4714
+ * The number of overlapping voxels.
4300
4715
  */
4301
- overlap: {
4302
- [x: number]: {
4303
- /**
4304
- * The segment label.
4305
- */
4306
- label: string;
4307
- /**
4308
- * The number of overlapping voxels.
4309
- */
4310
- count: number;
4311
- /**
4312
- * The overlap percentage between 0 and 100.
4313
- */
4314
- percentage: number;
4315
- };
4316
- };
4716
+ count: number;
4317
4717
  /**
4318
- * The voxel volume of this segment.
4718
+ * The overlap percentage between 0 and 100.
4319
4719
  */
4320
- count: number;
4321
- };
4322
- };
4720
+ percentage: number;
4721
+ }>;
4722
+ /**
4723
+ * The voxel volume of this segment.
4724
+ */
4725
+ count: number;
4726
+ }>;
4323
4727
  #private;
4324
4728
  }
4325
4729
 
@@ -4388,6 +4792,15 @@ export declare class Matrix33 {
4388
4792
  * @returns {boolean} True if both matrices are similar.
4389
4793
  */
4390
4794
  isSimilar(rhs: Matrix33, tol?: number): boolean;
4795
+ /**
4796
+ * Check for Matrix33 similarity with progressive tolerance (up to 10*tol).
4797
+ *
4798
+ * @param {Matrix33} rhs The other matrix to compare to.
4799
+ * @param {number} [tol] Optional number comparison tolerance,
4800
+ * defaults to Number.EPSILON.
4801
+ * @returns {boolean} True if both matrices are similar.
4802
+ */
4803
+ isSimilarProgressive(rhs: Matrix33, tol?: number): boolean;
4391
4804
  /**
4392
4805
  * Get a string representation of the Matrix33.
4393
4806
  *
@@ -4483,6 +4896,34 @@ export declare class Matrix33 {
4483
4896
  #private;
4484
4897
  }
4485
4898
 
4899
+ /**
4900
+ * Merge two mask images into a new combined mask image.
4901
+ *
4902
+ * Segments from mask2 that share a segment number with mask1 are renumbered
4903
+ * (bumped to the next available number) to avoid conflicts. Both masks must
4904
+ * share the same spacing and orientation; the wider of the two geometries
4905
+ * (the one with more slices) is used as the merged geometry, so a mask
4906
+ * that only covers a sub-range of the other's slices does not get clipped.
4907
+ * Brush-painted masks (no per-segment SegmentCollection data) are supported.
4908
+ *
4909
+ * The returned image can be saved with the standard
4910
+ * `new MaskFactory().toDicom(merged, undefined, sourceImage)` workflow.
4911
+ *
4912
+ * @param {Image} mask1 The first mask (provides meta).
4913
+ * @param {Image} mask2 The second mask to merge into mask1.
4914
+ * @returns {Image} The new merged mask image.
4915
+ */
4916
+ export declare function mergeMaskImages(mask1: Image_2, mask2: Image_2): Image_2;
4917
+
4918
+ /**
4919
+ * Merge a simple tag value list into another. Mutates the
4920
+ * first input.
4921
+ *
4922
+ * @param {SimpleTagValues} list1 Base list, will be modified.
4923
+ * @param {SimpleTagValues} list2 List to merge into list1.
4924
+ */
4925
+ export declare function mergeTagValues(list1: SimpleTagValues, list2: SimpleTagValues): void;
4926
+
4486
4927
  export declare namespace NormalisedManufacturers {
4487
4928
  let GE: string;
4488
4929
  let SIEMENS: string;
@@ -4491,7 +4932,7 @@ export declare namespace NormalisedManufacturers {
4491
4932
  }
4492
4933
 
4493
4934
  /**
4494
- * Number range.
4935
+ * Number range: [min, max].
4495
4936
  */
4496
4937
  export declare class NumberRange {
4497
4938
  /**
@@ -4509,12 +4950,34 @@ export declare class NumberRange {
4509
4950
  max: number;
4510
4951
  }
4511
4952
 
4953
+ /**
4954
+ * Class to store a number value and a unit.
4955
+ */
4956
+ export declare class NumberValue {
4957
+ /**
4958
+ * @type {number}
4959
+ */
4960
+ value: number;
4961
+ /**
4962
+ * @type {string|undefined}
4963
+ */
4964
+ unit: string | undefined;
4965
+ }
4966
+
4512
4967
  export declare namespace Orientation {
4513
4968
  let Axial: string;
4514
4969
  let Coronal: string;
4515
4970
  let Sagittal: string;
4516
4971
  }
4517
4972
 
4973
+ /**
4974
+ * @import {Point} from '../math/point.js';
4975
+ * @import {Index} from '../math/index.js';
4976
+ * @import {Geometry} from '../image/geometry.js';
4977
+ * @import {Matrix33} from '../math/matrix.js';
4978
+ * @import {Spacing} from './spacing.js';
4979
+ * @import {Scalar2D, Scalar3D} from '../math/scalar.js';
4980
+ */
4518
4981
  /**
4519
4982
  * Plane geometry helper.
4520
4983
  */
@@ -5055,6 +5518,11 @@ export declare class PositionHelper {
5055
5518
  */
5056
5519
  export declare function precisionRound(number: number, precision: number): number;
5057
5520
 
5521
+ /**
5522
+ * @import {Point2D} from '../math/point.js';
5523
+ * @import {NumberValue} from './number.js';
5524
+ * @import {ViewController} from '../app/viewController.js';
5525
+ */
5058
5526
  /**
5059
5527
  * Protractor shape: 3 points from which to calculate an angle.
5060
5528
  */
@@ -5089,11 +5557,9 @@ export declare class Protractor {
5089
5557
  *
5090
5558
  * @param {ViewController} _viewController The associated view controller.
5091
5559
  * @param {string[]} _flags A list of stat values to calculate.
5092
- * @returns {Object<string, Value>} A quantification object.
5560
+ * @returns {Record<string, NumberValue>} A quantification object.
5093
5561
  */
5094
- quantify(_viewController: ViewController, _flags: string[]): {
5095
- [x: string]: Value;
5096
- };
5562
+ quantify(_viewController: ViewController, _flags: string[]): Record<string, NumberValue>;
5097
5563
  #private;
5098
5564
  }
5099
5565
 
@@ -5184,11 +5650,9 @@ export declare class Rectangle {
5184
5650
  * @param {Index} index The index at which to get the
5185
5651
  * image values.
5186
5652
  * @param {string[]} flags A list of stat values to calculate.
5187
- * @returns {Object<string, Value>} A quantification object.
5653
+ * @returns {Record<string, NumberValue>} A quantification object.
5188
5654
  */
5189
- quantify(viewController: ViewController, index: Index, flags: string[]): {
5190
- [x: string]: Value;
5191
- };
5655
+ quantify(viewController: ViewController, index: Index, flags: string[]): Record<string, NumberValue>;
5192
5656
  #private;
5193
5657
  }
5194
5658
 
@@ -5254,6 +5718,9 @@ export declare class ResponseEvaluation {
5254
5718
  measure: number;
5255
5719
  }
5256
5720
 
5721
+ /**
5722
+ * @import {Scalar3D} from '../math/scalar.js';
5723
+ */
5257
5724
  /**
5258
5725
  * RGB colour class.
5259
5726
  */
@@ -5345,100 +5812,367 @@ export declare class ROI {
5345
5812
  }
5346
5813
 
5347
5814
  /**
5348
- * Mutable 2D scalar ({x,y}).
5815
+ * An RT Region of Interest with its display colour and contours.
5349
5816
  */
5350
- export declare class Scalar2D {
5817
+ export declare class RTROI {
5351
5818
  /**
5352
- * X value.
5819
+ * ROI number as stored in the DICOM file.
5353
5820
  *
5354
5821
  * @type {number}
5355
5822
  */
5356
- x: number;
5823
+ number: number;
5357
5824
  /**
5358
- * Y value.
5825
+ * ROI name.
5359
5826
  *
5360
- * @type {number}
5827
+ * @type {string}
5361
5828
  */
5362
- y: number;
5363
- }
5364
-
5365
- /**
5366
- * Mutable 3D scalar ({x,y,z}).
5367
- */
5368
- export declare class Scalar3D {
5829
+ name: string;
5369
5830
  /**
5370
- * X value.
5831
+ * Display colour as {r, g, b} values in [0, 255].
5371
5832
  *
5372
- * @type {number}
5833
+ * @type {{r: number, g: number, b: number}}
5373
5834
  */
5374
- x: number;
5835
+ colour: {
5836
+ r: number;
5837
+ g: number;
5838
+ b: number;
5839
+ };
5375
5840
  /**
5376
- * Y value.
5841
+ * ROI generation algorithm (e.g. 'MANUAL', 'SEMIAUTOMATIC', 'AUTOMATIC').
5377
5842
  *
5378
- * @type {number}
5843
+ * @type {string|undefined}
5379
5844
  */
5380
- y: number;
5845
+ generationAlgorithm: string | undefined;
5381
5846
  /**
5382
- * Z value.
5847
+ * RT ROI interpreted type (e.g. 'GTV', 'CTV', 'PTV', 'ORGAN').
5383
5848
  *
5384
- * @type {number}
5849
+ * @type {string|undefined}
5385
5850
  */
5386
- z: number;
5851
+ interpretedType: string | undefined;
5852
+ /**
5853
+ * Name of the person who interpreted the ROI.
5854
+ *
5855
+ * @type {string|undefined}
5856
+ */
5857
+ roiInterpreter: string | undefined;
5858
+ /**
5859
+ * List of contours belonging to this ROI.
5860
+ *
5861
+ * @type {RTROIContour[]}
5862
+ */
5863
+ contours: RTROIContour[];
5387
5864
  }
5388
5865
 
5389
5866
  /**
5390
- * Scroll wheel class: provides a wheel event handler
5391
- * that scroll the corresponding data.
5867
+ * A single planar contour of an RT ROI.
5392
5868
  */
5393
- export declare class ScrollWheel {
5869
+ export declare class RTROIContour {
5394
5870
  /**
5395
- * @param {App} app The associated application.
5871
+ * Contour geometric type (e.g. 'CLOSED_PLANAR').
5872
+ *
5873
+ * @type {string}
5396
5874
  */
5397
- constructor(app: App);
5875
+ type: string;
5398
5876
  /**
5399
- * Handle mouse wheel event.
5877
+ * Flat array of 3D patient-space coordinates in mm:
5878
+ * [x0,y0,z0, x1,y1,z1, ...].
5400
5879
  *
5401
- * @param {WheelEvent} event The mouse wheel event.
5880
+ * @type {number[]}
5402
5881
  */
5403
- wheel(event: WheelEvent): void;
5404
- #private;
5882
+ points3D: number[];
5405
5883
  }
5406
5884
 
5407
5885
  /**
5408
- * Immutable Size class.
5409
- * Warning: the input array is NOT cloned, modifying it will
5410
- * modify the index values.
5886
+ * {@link Image} factory for DICOM RT Structure Set (RTSTRUCT).
5887
+ *
5888
+ * Rasterizes ROI contour polygons into a PALETTE COLOR mask image using
5889
+ * the same geometry as the reference CT/MR image so that the result can
5890
+ * be rendered by the existing mask pipeline.
5411
5891
  */
5412
- export declare class Size {
5892
+ export declare class RtStructFactory {
5413
5893
  /**
5414
- * @param {number[]} values The size values.
5894
+ * Get a warning string if elements are not as expected.
5895
+ *
5896
+ * @returns {string|undefined} The warning.
5415
5897
  */
5416
- constructor(values: number[]);
5898
+ getWarning(): string | undefined;
5417
5899
  /**
5418
- * Get the size value at the given array index.
5900
+ * Check dicom elements.
5419
5901
  *
5420
- * @param {number} i The index to get.
5421
- * @returns {number} The value.
5902
+ * @param {Record<string, DataElement>} _dataElements The DICOM data elements.
5903
+ * @returns {string|undefined} A possible warning.
5422
5904
  */
5423
- get(i: number): number;
5905
+ checkElements(_dataElements: Record<string, DataElement>): string | undefined;
5424
5906
  /**
5425
- * Get the length of the index.
5907
+ * Get a mask {@link Image} from RTSTRUCT DICOM elements.
5426
5908
  *
5427
- * @returns {number} The length.
5909
+ * Contours are rasterized into a Uint8Array whose voxel values are
5910
+ * segment numbers (0 = background, 1..N = ROI index).
5911
+ * A PALETTE COLOR colour map maps each segment number to the ROI's
5912
+ * display colour.
5913
+ *
5914
+ * @param {Record<string, DataElement>} dataElements The DICOM data elements.
5915
+ * @param {Image} refImage The reference image (CT/MR) that was loaded first.
5916
+ * @returns {Image} The mask image.
5917
+ * @throws {Error} If the reference image geometry cannot be used.
5428
5918
  */
5429
- length(): number;
5919
+ create(dataElements: Record<string, DataElement>, refImage: Image_2): Image_2;
5430
5920
  /**
5431
- * Get a string representation of the size.
5921
+ * Convert a mask {@link Image} into DICOM RT Structure Set elements.
5432
5922
  *
5433
- * @returns {string} The Size as a string.
5923
+ * Traces each segment's pixel regions per slice using Moore neighborhood
5924
+ * contour tracing, simplifies with Ramer-Douglas-Peucker, then maps the
5925
+ * 2D pixel coordinates back to 3D patient-space coordinates.
5926
+ *
5927
+ * @param {Image} image The mask image.
5928
+ * @param {MaskSegment[]} [segments] The mask segments; if omitted, taken
5929
+ * from image meta.
5930
+ * @param {Image} [sourceImage] Source image (provides StudyInstanceUID).
5931
+ * @param {SimpleTagValues} [extraTags] Optional extra tags to merge.
5932
+ * @returns {Record<string, DataElement>} The DICOM data elements.
5434
5933
  */
5435
- toString(): string;
5934
+ toDicom(image: Image_2, segments?: MaskSegment[], sourceImage?: Image_2, extraTags?: SimpleTagValues): Record<string, DataElement>;
5935
+ #private;
5936
+ }
5937
+
5938
+ /**
5939
+ * @import {App} from '../app/application.js';
5940
+ */
5941
+ /**
5942
+ * Run filter command.
5943
+ */
5944
+ export declare class RunFilterCommand extends Command {
5436
5945
  /**
5437
- * Get the values of this index.
5438
- *
5439
- * @returns {number[]} The array of values.
5946
+ * @param {object} filter The filter to run.
5947
+ * @param {string} dataId The data to filter.
5948
+ * @param {App} app The associated application.
5440
5949
  */
5441
- getValues(): number[];
5950
+ constructor(filter: object, dataId: string, app: App);
5951
+ /**
5952
+ * Handle an execute event.
5953
+ *
5954
+ * @param {object} _event The execute event with type and id.
5955
+ */
5956
+ onExecute(_event: object): void;
5957
+ /**
5958
+ * Handle an undo event.
5959
+ *
5960
+ * @param {object} _event The undo event with type and id.
5961
+ */
5962
+ onUndo(_event: object): void;
5963
+ #private;
5964
+ }
5965
+
5966
+ /**
5967
+ * Mutable 2D scalar ({x,y}).
5968
+ */
5969
+ export declare class Scalar2D {
5970
+ /**
5971
+ * X value.
5972
+ *
5973
+ * @type {number}
5974
+ */
5975
+ x: number;
5976
+ /**
5977
+ * Y value.
5978
+ *
5979
+ * @type {number}
5980
+ */
5981
+ y: number;
5982
+ }
5983
+
5984
+ /**
5985
+ * Mutable 3D scalar ({x,y,z}).
5986
+ */
5987
+ export declare class Scalar3D {
5988
+ /**
5989
+ * X value.
5990
+ *
5991
+ * @type {number}
5992
+ */
5993
+ x: number;
5994
+ /**
5995
+ * Y value.
5996
+ *
5997
+ * @type {number}
5998
+ */
5999
+ y: number;
6000
+ /**
6001
+ * Z value.
6002
+ *
6003
+ * @type {number}
6004
+ */
6005
+ z: number;
6006
+ }
6007
+
6008
+ /**
6009
+ * Slice / dimension scrolling on wheel ticks.
6010
+ */
6011
+ export declare class ScrollWheelBehavior extends WheelBehavior {
6012
+ }
6013
+
6014
+ /**
6015
+ * Collection of mask segments: stores per-segment, per-slice pixel data
6016
+ * and segment metadata. Builds the combined label map on demand.
6017
+ * TODO: check if mergeable with MaskSegmentHelper.
6018
+ */
6019
+ export declare class SegmentCollection {
6020
+ /**
6021
+ * @param {Geometry} geometry The mask geometry, used to size the label map.
6022
+ */
6023
+ constructor(geometry: Geometry);
6024
+ /**
6025
+ * Get all the segments.
6026
+ *
6027
+ * @returns {Map<number, Map<number, Uint8Array>>} The segment buffers,
6028
+ * indexed by segment number and slice index.
6029
+ */
6030
+ getAll(): Map<number, Map<number, Uint8Array>>;
6031
+ /**
6032
+ * Set the label map directly.
6033
+ * Used when the buffer already exists, for brush-painted masks.
6034
+ *
6035
+ * @param {Uint8Array} buffer The label map buffer.
6036
+ */
6037
+ setLabelMap(buffer: Uint8Array): void;
6038
+ /**
6039
+ * Add pixel data for one DICOM frame to the appropriate segment and slice.
6040
+ * Allocates a Uint8Array(sliceSize) on first use for each
6041
+ * (segNumber, sliceIndex) pair; merges if the same pair appears again.
6042
+ *
6043
+ * @param {number} segNumber The segment number.
6044
+ * @param {Uint8Array} pixelBuffer The raw DICOM pixel buffer.
6045
+ * @param {number} frameOffset Offset of this frame within pixelBuffer.
6046
+ * @param {number} sliceIndex The slice index in the full label map geometry.
6047
+ * @param {number} sliceSize Number of pixels per slice (ncols * nrows).
6048
+ * @param {number} value The value to write for non-zero pixels.
6049
+ */
6050
+ addFrame(segNumber: number, pixelBuffer: Uint8Array, frameOffset: number, sliceIndex: number, sliceSize: number, value: number): void;
6051
+ /**
6052
+ * Build and return the combined label map (lazy cached).
6053
+ * Iterates segments in insertion order so lower segment numbers win
6054
+ * at overlapping positions. Sets the hasOverlap flag if any voxel
6055
+ * already carries a different segment's value.
6056
+ *
6057
+ * @returns {Uint8Array} The full-volume label map.
6058
+ */
6059
+ getLabelMap(): Uint8Array;
6060
+ /**
6061
+ * Check whether any two segments share at least one voxel.
6062
+ *
6063
+ * @returns {boolean} True if overlap was detected.
6064
+ */
6065
+ getHasOverlap(): boolean;
6066
+ /**
6067
+ * Get the segment buffers. Using input image and segments since they
6068
+ * could have been modified (for example by brush).
6069
+ *
6070
+ * When per-segment data is available (MaskFactory path), builds ROI buffers
6071
+ * directly from #segments so that overlap pixels for every segment are
6072
+ * included. Falls back to label-map reconstruction for masks created via
6073
+ * setupSegmentCollection (brush path), where #segments is empty and the
6074
+ * label map is the only source of truth.
6075
+ *
6076
+ * @param {MaskSegment[]} segments The mask segments.
6077
+ * @returns {Record<string, Record<number, Uint8Array>>} The segment buffers,
6078
+ * indexed by segment index (segment.number - 1) and slice index.
6079
+ */
6080
+ getSegmentBuffers(segments: MaskSegment[]): Record<string, Record<number, Uint8Array>>;
6081
+ /**
6082
+ * Get the union ImageContour for the current visibility state,
6083
+ * building it if the set of hidden segments has changed.
6084
+ *
6085
+ * @param {MaskSegmentViewHelper|undefined} segmentViewHelper
6086
+ * Hidden-segment tracker.
6087
+ * @param {Size} imageSize The image size.
6088
+ * @returns {ImageContour} The union ImageContour.
6089
+ */
6090
+ getOrBuildUnionContour(segmentViewHelper: MaskSegmentViewHelper | undefined, imageSize: Size): ImageContour;
6091
+ #private;
6092
+ }
6093
+
6094
+ /**
6095
+ * A simple sequence (VR=SQ) tag value.
6096
+ */
6097
+ export declare type SimpleSequenceValue = {
6098
+ /**
6099
+ * The sequence items.
6100
+ */
6101
+ value: SimpleTagValues[];
6102
+ /**
6103
+ * Undefined length flag.
6104
+ */
6105
+ undefinedLength?: boolean;
6106
+ };
6107
+
6108
+ /**
6109
+ * A simple (non sequence) tag value: either a single primitive
6110
+ * or, for multi-valued VRs, an array of primitives.
6111
+ */
6112
+ export declare type SimpleTagValue = string | number | string[] | number[];
6113
+
6114
+ /**
6115
+ * The meta data as simple tag values: indexed by tag name instead of
6116
+ * tag key, with direct values (no element object) for non sequence,
6117
+ * non merged tags.
6118
+ */
6119
+ export declare type SimpleTagValues = Record<string, SimpleTagValue | SimpleSequenceValue>;
6120
+
6121
+ /**
6122
+ * Simplify a polygon using the Ramer-Douglas-Peucker algorithm.
6123
+ * Ref: {@link https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm}.
6124
+ *
6125
+ * @param {Array.<{x: number, y: number}>} pts Input vertices.
6126
+ * @param {number} epsilon Max allowed deviation in pixels.
6127
+ * @returns {Array.<{x: number, y: number}>} Simplified vertices.
6128
+ */
6129
+ export declare function simplifyPolygon(pts: Array<{
6130
+ x: number;
6131
+ y: number;
6132
+ }>, epsilon: number): Array<{
6133
+ x: number;
6134
+ y: number;
6135
+ }>;
6136
+
6137
+ /**
6138
+ * @import {Matrix33} from '../math/matrix.js';
6139
+ * @import {Scalar2D} from '../math/scalar.js';
6140
+ */
6141
+ /**
6142
+ * Immutable Size class.
6143
+ * Warning: the input array is NOT cloned, modifying it will
6144
+ * modify the index values.
6145
+ */
6146
+ export declare class Size {
6147
+ /**
6148
+ * @param {number[]} values The size values.
6149
+ */
6150
+ constructor(values: number[]);
6151
+ /**
6152
+ * Get the size value at the given array index.
6153
+ *
6154
+ * @param {number} i The index to get.
6155
+ * @returns {number} The value.
6156
+ */
6157
+ get(i: number): number;
6158
+ /**
6159
+ * Get the length of the index.
6160
+ *
6161
+ * @returns {number} The length.
6162
+ */
6163
+ length(): number;
6164
+ /**
6165
+ * Get a string representation of the size.
6166
+ *
6167
+ * @returns {string} The Size as a string.
6168
+ */
6169
+ toString(): string;
6170
+ /**
6171
+ * Get the values of this index.
6172
+ *
6173
+ * @returns {number[]} The array of values.
6174
+ */
6175
+ getValues(): number[];
5442
6176
  /**
5443
6177
  * Check if a dimension exists and has more than one element.
5444
6178
  *
@@ -5531,6 +6265,9 @@ export declare class Size {
5531
6265
  #private;
5532
6266
  }
5533
6267
 
6268
+ /**
6269
+ * @import {Scalar2D} from '../math/scalar.js';
6270
+ */
5534
6271
  /**
5535
6272
  * Immutable Spacing class.
5536
6273
  * Warning: the input array is NOT cloned, modifying it will
@@ -5590,6 +6327,252 @@ export declare class Spacing {
5590
6327
  */
5591
6328
  export declare function srgbToCielab(triplet: RGB): object;
5592
6329
 
6330
+ /**
6331
+ * Stage controller: manages the link between the data view configs
6332
+ * and the stage (layer groups, layers, rendering).
6333
+ */
6334
+ export declare class StageController extends EventTarget {
6335
+ /**
6336
+ * @param {DataController} dataController The data controller.
6337
+ * @param {object} options The app options.
6338
+ */
6339
+ constructor(dataController: DataController, options: object);
6340
+ /**
6341
+ * Set the toolbox controller.
6342
+ *
6343
+ * @param {ToolboxController} tc The toolbox controller.
6344
+ */
6345
+ setToolboxController(tc: ToolboxController): void;
6346
+ /**
6347
+ * Set the add-to-undo-stack callback.
6348
+ *
6349
+ * @param {Function} fn The callback.
6350
+ */
6351
+ setAddToUndoStack(fn: Function): void;
6352
+ /**
6353
+ * Set the info data getter callback.
6354
+ *
6355
+ * @param {Function} fn A function `(dataId) => InfoData`.
6356
+ */
6357
+ setGetInfoData(fn: Function): void;
6358
+ /**
6359
+ * Get the layer group configuration from a data id.
6360
+ *
6361
+ * @param {string} dataId The data id.
6362
+ * @param {boolean} [excludeStarConfig] Exclude the star config
6363
+ * (default to false).
6364
+ * @returns {ViewConfig[]} The list of associated configs.
6365
+ */
6366
+ getViewConfigs(dataId: string, excludeStarConfig?: boolean): ViewConfig[];
6367
+ /**
6368
+ * Get the layer group configuration for a data id and group div id.
6369
+ *
6370
+ * @param {string} dataId The data id.
6371
+ * @param {string} groupDivId The layer group div id.
6372
+ * @param {boolean} [excludeStarConfig] Exclude the star config
6373
+ * (default to false).
6374
+ * @returns {ViewConfig|undefined} The associated config.
6375
+ */
6376
+ getViewConfig(dataId: string, groupDivId: string, excludeStarConfig?: boolean): ViewConfig | undefined;
6377
+ /**
6378
+ * Get the data view config.
6379
+ * Careful, returns a reference; do not modify without resetting.
6380
+ *
6381
+ * @returns {Record<string, ViewConfig[]>} The configuration list.
6382
+ */
6383
+ getDataViewConfigs(): Record<string, ViewConfig[]>;
6384
+ /**
6385
+ * Set the data view configuration.
6386
+ * Resets the stage and recreates all the views.
6387
+ *
6388
+ * @param {Record<string, ViewConfig[]>} configs The configuration list.
6389
+ */
6390
+ setDataViewConfigs(configs: Record<string, ViewConfig[]>): void;
6391
+ /**
6392
+ * Add a data view config.
6393
+ *
6394
+ * @param {string} dataId The data id.
6395
+ * @param {ViewConfig} config The view configuration.
6396
+ * @param {boolean} [doRender] Render data after configuration
6397
+ * add. Defaults to true.
6398
+ */
6399
+ addDataViewConfig(dataId: string, config: ViewConfig, doRender?: boolean): void;
6400
+ /**
6401
+ * Remove a data view config.
6402
+ * Removes the associated layer if found, removes
6403
+ * the layer group if empty.
6404
+ *
6405
+ * @param {string} dataId The data id.
6406
+ * @param {string} divId The div id.
6407
+ */
6408
+ removeDataViewConfig(dataId: string, divId: string): void;
6409
+ /**
6410
+ * Update an existing data view config.
6411
+ * Removes and re-creates the layer if found.
6412
+ *
6413
+ * @param {string} dataId The data id.
6414
+ * @param {string} divId The div id.
6415
+ * @param {ViewConfig} config The view configuration.
6416
+ */
6417
+ updateDataViewConfig(dataId: string, divId: string, config: ViewConfig): void;
6418
+ /**
6419
+ * Get the active layer group.
6420
+ *
6421
+ * @returns {LayerGroup|undefined} The layer group.
6422
+ */
6423
+ getActiveLayerGroup(): LayerGroup | undefined;
6424
+ /**
6425
+ * Set the active layer group.
6426
+ *
6427
+ * @param {number} index The layer group index.
6428
+ */
6429
+ setActiveLayerGroup(index: number): void;
6430
+ /**
6431
+ * Get a layer group by index.
6432
+ *
6433
+ * @param {number} index The index.
6434
+ * @returns {LayerGroup} The layer group.
6435
+ */
6436
+ getLayerGroup(index: number): LayerGroup;
6437
+ /**
6438
+ * Get the number of layer groups.
6439
+ *
6440
+ * @returns {number} The number of groups.
6441
+ */
6442
+ getNumberOfLayerGroups(): number;
6443
+ /**
6444
+ * Get the view layers associated to a data id.
6445
+ *
6446
+ * @param {string} dataId The data id.
6447
+ * @returns {ViewLayer[]} The layers.
6448
+ */
6449
+ getViewLayersByDataId(dataId: string): ViewLayer[];
6450
+ /**
6451
+ * Get a list of view layers according to an input callback function.
6452
+ *
6453
+ * @param {Function} [callbackFn] A function that takes
6454
+ * a ViewLayer as input and returns a boolean. If undefined,
6455
+ * returns all view layers.
6456
+ * @returns {ViewLayer[]} The layers that satisfy the callbackFn.
6457
+ */
6458
+ getViewLayers(callbackFn?: Function): ViewLayer[];
6459
+ /**
6460
+ * Get the draw layers associated to a data id.
6461
+ *
6462
+ * @param {string} dataId The data id.
6463
+ * @returns {DrawLayer[]} The layers.
6464
+ */
6465
+ getDrawLayersByDataId(dataId: string): DrawLayer[];
6466
+ /**
6467
+ * Get a list of draw layers according to an input callback function.
6468
+ *
6469
+ * @param {Function} [callbackFn] A function that takes
6470
+ * a DrawLayer as input and returns a boolean. If undefined,
6471
+ * returns all draw layers.
6472
+ * @returns {DrawLayer[]} The layers that satisfy the callbackFn.
6473
+ */
6474
+ getDrawLayers(callbackFn?: Function): DrawLayer[];
6475
+ /**
6476
+ * Get a layer group by div id.
6477
+ *
6478
+ * @param {string} divId The div id.
6479
+ * @returns {LayerGroup|undefined} The layer group.
6480
+ */
6481
+ getLayerGroupByDivId(divId: string): LayerGroup | undefined;
6482
+ /**
6483
+ * Get the active layer group scale on top of the base scale.
6484
+ *
6485
+ * @returns {Scalar3D} The scale as {x,y,z}.
6486
+ * @deprecated Since v0.37, please access from the active layer group.
6487
+ */
6488
+ getAddedScale(): Scalar3D;
6489
+ /**
6490
+ * Get the base scale of the active layer group.
6491
+ *
6492
+ * @returns {Scalar3D} The scale as {x,y,z}.
6493
+ * @deprecated Since v0.37, please access from the active layer group.
6494
+ */
6495
+ getBaseScale(): Scalar3D;
6496
+ /**
6497
+ * Get the layer offset of the active layer group.
6498
+ *
6499
+ * @returns {Scalar3D} The offset as {x,y,z}.
6500
+ * @deprecated Since v0.37, please access from the active layer group.
6501
+ */
6502
+ getOffset(): Scalar3D;
6503
+ /**
6504
+ * Empty the stage (remove all layer groups).
6505
+ */
6506
+ empty(): void;
6507
+ /**
6508
+ * Remove layers for a specific data id.
6509
+ *
6510
+ * @param {string} dataId The data id.
6511
+ */
6512
+ removeLayersByDataId(dataId: string): void;
6513
+ /**
6514
+ * Set the layer groups binders.
6515
+ *
6516
+ * @param {object[]} instances Binder instances.
6517
+ */
6518
+ setBinders(instances: object[]): void;
6519
+ /**
6520
+ * Fit the display to the data of each layer group.
6521
+ */
6522
+ fitToContainer(): void;
6523
+ /**
6524
+ * Draw all layer groups.
6525
+ */
6526
+ draw(): void;
6527
+ /**
6528
+ * Reset zoom and pan of the stage.
6529
+ *
6530
+ * @deprecated Since v0.35, prefer resetZoomPan.
6531
+ */
6532
+ resetLayout(): void;
6533
+ /**
6534
+ * Reset the zoom and pan of the stage.
6535
+ */
6536
+ resetZoomPan(): void;
6537
+ /**
6538
+ * Reset the position and window level of the stage.
6539
+ */
6540
+ resetViews(): void;
6541
+ /**
6542
+ * Set the imageSmoothing flag value. Default is false.
6543
+ *
6544
+ * @param {boolean} flag True to enable smoothing.
6545
+ */
6546
+ setImageSmoothing(flag: boolean): void;
6547
+ /**
6548
+ * Zoom the layers of the active layer group.
6549
+ *
6550
+ * @param {number} step The step to add to the current zoom.
6551
+ * @param {number} cx The zoom center X coordinate.
6552
+ * @param {number} cy The zoom center Y coordinate.
6553
+ * @deprecated Since v0.37, please access from the active layer group.
6554
+ */
6555
+ zoom(step: number, cx: number, cy: number): void;
6556
+ /**
6557
+ * Apply a translation to the layers of the active layer group.
6558
+ *
6559
+ * @param {number} tx The translation along X.
6560
+ * @param {number} ty The translation along Y.
6561
+ */
6562
+ translate(tx: number, ty: number): void;
6563
+ /**
6564
+ * Render the current data.
6565
+ *
6566
+ * @param {string} dataId The data id to render.
6567
+ * @param {ViewConfig[]} [viewConfigs] The list of configs to render.
6568
+ */
6569
+ render(dataId: string, viewConfigs?: ViewConfig[]): void;
6570
+ #private;
6571
+ }
6572
+
6573
+ /**
6574
+ * @import {DataElement} from '../dicom/dataElement.js';
6575
+ */
5593
6576
  /**
5594
6577
  * Immutable tag.
5595
6578
  */
@@ -5612,7 +6595,7 @@ export declare class Tag {
5612
6595
  */
5613
6596
  getElement(): string;
5614
6597
  /**
5615
- * Get as string representation of the tag: 'key: name'.
6598
+ * Get as string representation of the tag: '(group,element)'.
5616
6599
  *
5617
6600
  * @returns {string} A string representing the tag.
5618
6601
  */
@@ -5630,12 +6613,6 @@ export declare class Tag {
5630
6613
  * @returns {string} The key as '########'.
5631
6614
  */
5632
6615
  getKey(): string;
5633
- /**
5634
- * Get the group name as defined in TagGroups.
5635
- *
5636
- * @returns {string} The name.
5637
- */
5638
- getGroupName(): string;
5639
6616
  /**
5640
6617
  * Does this tag have a VR.
5641
6618
  * Basically not the Item, ItemDelimitationItem nor
@@ -5653,27 +6630,45 @@ export declare class Tag {
5653
6630
  * ie if its group is an odd number.
5654
6631
  */
5655
6632
  isPrivate(): boolean;
6633
+ #private;
6634
+ }
6635
+
6636
+ /**
6637
+ * DICOM tag info: vr, multiplicity, name.
6638
+ */
6639
+ export declare class TagInfo {
6640
+ /**
6641
+ * @param {string} vr The tag Value Representation (VR).
6642
+ * @param {number} multiplicity The tag multiplicity.
6643
+ * @param {string} name The tag name.
6644
+ */
6645
+ constructor(vr: string, multiplicity: number, name: string);
5656
6646
  /**
5657
- * Get the tag Value Representation (VR) from the dicom dictionary.
6647
+ * Get the tag Value Representation (VR).
5658
6648
  *
5659
- * @returns {string|undefined} The VR.
6649
+ * @returns {string} The tag vr.
5660
6650
  */
5661
- getVrFromDictionary(): string | undefined;
6651
+ getVr(): string;
5662
6652
  /**
5663
- * Get the multiplicity from the dicom dictionary.
6653
+ * Get the tag multiplicity.
5664
6654
  *
5665
- * @returns {number|undefined} The multiplicity.
6655
+ * @returns {number} The multiplicity.
5666
6656
  */
5667
- getMultiplicityFromDictionary(): number | undefined;
6657
+ getMultiplicity(): number;
5668
6658
  /**
5669
- * Get the tag name from the dicom dictionary.
6659
+ * Get the tag name.
5670
6660
  *
5671
- * @returns {string|undefined} The VR.
6661
+ * @returns {string} The name.
5672
6662
  */
5673
- getNameFromDictionary(): string | undefined;
6663
+ getName(): string;
5674
6664
  #private;
5675
6665
  }
5676
6666
 
6667
+ /**
6668
+ * @import {LayerGroup} from '../gui/layerGroup.js';
6669
+ * @import {ViewLayer} from '../gui/viewLayer.js';
6670
+ * @import {DrawLayer} from '../gui/drawLayer.js';
6671
+ */
5677
6672
  /**
5678
6673
  * Toolbox controller.
5679
6674
  */
@@ -5717,9 +6712,9 @@ export declare class ToolboxController {
5717
6712
  *
5718
6713
  * @param {string} eventType The event type, for example
5719
6714
  * mousedown, touchstart...
5720
- * @returns {Function} The event handler.
6715
+ * @returns {EventListener} The event handler.
5721
6716
  */
5722
- getSelectedToolEventHandler(eventType: string): Function;
6717
+ getSelectedToolEventHandler(eventType: string): EventListener;
5723
6718
  /**
5724
6719
  * Set the selected tool.
5725
6720
  *
@@ -5791,11 +6786,9 @@ export declare class ToolConfig {
5791
6786
  * 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
5792
6787
  * ]);
5793
6788
  *
5794
- * @type {Object<string, any>}
6789
+ * @type {Record<string, any>}
5795
6790
  */
5796
- export declare const toolList: {
5797
- [x: string]: any;
5798
- };
6791
+ export declare const toolList: Record<string, any>;
5799
6792
 
5800
6793
  /**
5801
6794
  * List of client provided tool options to be added to
@@ -5809,7 +6802,6 @@ export declare const toolList: {
5809
6802
  * getName() {return 'love';}
5810
6803
  * static supports(mathShape) {return mathShape instanceof ROI;}
5811
6804
  * getNPoints() {return 1;}
5812
- * getTimeout() {return 0;}
5813
6805
  * setAnnotationMathShape(annotation, points) {
5814
6806
  * const px = points[0].getX();
5815
6807
  * const py = points[0].getY();
@@ -5862,26 +6854,60 @@ export declare const toolList: {
5862
6854
  * 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm'
5863
6855
  * ]);
5864
6856
  *
5865
- * @type {Object<string, Object<string, any>>}
6857
+ * @type {Record<string, Record<string, any>>}
5866
6858
  */
5867
- export declare const toolOptions: {
5868
- [x: string]: {
5869
- [x: string]: any;
5870
- };
5871
- };
6859
+ export declare const toolOptions: Record<string, Record<string, any>>;
5872
6860
 
5873
6861
  /**
5874
- * Class to store a value and a unit.
6862
+ * Undo controller.
5875
6863
  */
5876
- export declare class Value {
6864
+ export declare class UndoController extends EventTarget {
5877
6865
  /**
5878
- * @type {number}
6866
+ * Add a command to the undo stack.
6867
+ *
6868
+ * @param {object} cmd The command to add.
6869
+ * @fires UndoStack#undoadd
6870
+ * @function
5879
6871
  */
5880
- value: number;
6872
+ addToUndoStack: (cmd: object) => void;
5881
6873
  /**
5882
- * @type {string|undefined}
6874
+ * Remove a command from the undo stack.
6875
+ *
6876
+ * @param {string} name The name of the command to remove.
6877
+ * @returns {boolean} True if the command was found and removed.
6878
+ * @fires UndoStack#undoremove
6879
+ * @function
5883
6880
  */
5884
- unit: string | undefined;
6881
+ removeFromUndoStack: (name: string) => boolean;
6882
+ /**
6883
+ * Undo the last command.
6884
+ *
6885
+ * @fires UndoStack#undo
6886
+ */
6887
+ undo(): void;
6888
+ /**
6889
+ * Redo the next command.
6890
+ *
6891
+ * @fires UndoStack#redo
6892
+ */
6893
+ redo(): void;
6894
+ /**
6895
+ * Get the undo stack size.
6896
+ *
6897
+ * @returns {number} The size of the stack.
6898
+ */
6899
+ getStackSize(): number;
6900
+ /**
6901
+ * Get the current undo stack index.
6902
+ *
6903
+ * @returns {number} The stack index.
6904
+ */
6905
+ getCurrentStackIndex(): number;
6906
+ /**
6907
+ * Reset the undo/redo history.
6908
+ */
6909
+ reset(): void;
6910
+ #private;
5885
6911
  }
5886
6912
 
5887
6913
  /**
@@ -5999,7 +7025,7 @@ export declare class Vector3D {
5999
7025
  * request.onload = onload;
6000
7026
  * request.send();
6001
7027
  */
6002
- export declare class View {
7028
+ export declare class View extends EventTarget {
6003
7029
  /**
6004
7030
  * @param {Image} image The associated image.
6005
7031
  */
@@ -6093,9 +7119,9 @@ export declare class View {
6093
7119
  /**
6094
7120
  * Get the window presets.
6095
7121
  *
6096
- * @returns {object} The window presets.
7122
+ * @returns {Record<string, WindowPreset>} The window presets.
6097
7123
  */
6098
- getWindowPresets(): object;
7124
+ getWindowPresets(): Record<string, WindowPreset>;
6099
7125
  /**
6100
7126
  * Get the window presets names.
6101
7127
  *
@@ -6105,15 +7131,15 @@ export declare class View {
6105
7131
  /**
6106
7132
  * Set the window presets.
6107
7133
  *
6108
- * @param {object} presets The window presets.
7134
+ * @param {Record<string, WindowPreset>} presets The window presets.
6109
7135
  */
6110
- setWindowPresets(presets: object): void;
7136
+ setWindowPresets(presets: Record<string, WindowPreset>): void;
6111
7137
  /**
6112
7138
  * Add window presets to the existing ones.
6113
7139
  *
6114
- * @param {object} presets The window presets.
7140
+ * @param {Record<string, WindowPreset>} presets The window presets.
6115
7141
  */
6116
- addWindowPresets(presets: object): void;
7142
+ addWindowPresets(presets: Record<string, WindowPreset>): void;
6117
7143
  /**
6118
7144
  * Get the current window level preset name.
6119
7145
  *
@@ -6228,22 +7254,6 @@ export declare class View {
6228
7254
  * @param {boolean} [silent] Flag to launch events with skipGenerate.
6229
7255
  */
6230
7256
  setWindowLevelPresetById(id: number, silent?: boolean): void;
6231
- /**
6232
- * Add an event listener to this class.
6233
- *
6234
- * @param {string} type The event type.
6235
- * @param {Function} callback The function associated with the provided
6236
- * event type, will be called with the fired event.
6237
- */
6238
- addEventListener(type: string, callback: Function): void;
6239
- /**
6240
- * Remove an event listener from this class.
6241
- *
6242
- * @param {string} type The event type.
6243
- * @param {Function} callback The function associated with the provided
6244
- * event type.
6245
- */
6246
- removeEventListener(type: string, callback: Function): void;
6247
7257
  /**
6248
7258
  * Get the image window/level that covers the full data range.
6249
7259
  * Warning: uses the latest set rescale LUT or the default linear one.
@@ -6279,6 +7289,16 @@ export declare class View {
6279
7289
  #private;
6280
7290
  }
6281
7291
 
7292
+ /**
7293
+ * @import {LayerGroup} from '../gui/layerGroup.js';
7294
+ * @import {ViewLayer} from '../gui/viewLayer.js';
7295
+ * @import {DrawLayer} from '../gui/drawLayer.js';
7296
+ * @import {Image} from '../image/image.js';
7297
+ * @import {Matrix33} from '../math/matrix.js';
7298
+ * @import {DataElement} from '../dicom/dataElement.js';
7299
+ * @import {Scalar3D} from '../math/scalar.js';
7300
+ * @import {Command} from '../command/undoStack.js';
7301
+ */
6282
7302
  /**
6283
7303
  * View configuration: mainly defines the ´divId´
6284
7304
  * of the associated HTML div.
@@ -6347,6 +7367,16 @@ export declare class ViewConfig {
6347
7367
  windowWidth: number | undefined;
6348
7368
  }
6349
7369
 
7370
+ /**
7371
+ * @import {View} from '../image/view.js';
7372
+ * @import {WindowLevel} from '../image/windowLevel.js';
7373
+ * @import {WindowPreset} from '../image/windowPreset.js';
7374
+ * @import {Point} from '../math/point.js';
7375
+ * @import {Scalar2D} from '../math/scalar.js';
7376
+ * @import {Matrix33} from '../math/matrix.js';
7377
+ * @import {ViewLayer} from '../gui/viewLayer.js';
7378
+ * @import {MaskSegmentViewHelper} from '../image/maskSegmentViewHelper.js';
7379
+ */
6350
7380
  /**
6351
7381
  * View controller.
6352
7382
  */
@@ -6404,10 +7434,10 @@ export declare class ViewController {
6404
7434
  /**
6405
7435
  * Add window/level presets to the view.
6406
7436
  *
6407
- * @param {object} presets A preset object.
7437
+ * @param {Record<string, WindowPreset>} presets A preset object.
6408
7438
  * @returns {object} The list of presets.
6409
7439
  */
6410
- addWindowLevelPresets(presets: object): object;
7440
+ addWindowLevelPresets(presets: Record<string, WindowPreset>): object;
6411
7441
  /**
6412
7442
  * Set the window level to the preset with the input name.
6413
7443
  *
@@ -6804,8 +7834,16 @@ export declare class ViewController {
6804
7834
  #private;
6805
7835
  }
6806
7836
 
7837
+ /**
7838
+ * @import {Vector3D} from '../math/vector.js';
7839
+ * @import {Point, Point3D} from '../math/point.js';
7840
+ * @import {Scalar2D, Scalar3D} from '../math/scalar.js';
7841
+ */
6807
7842
  /**
6808
7843
  * View layer.
7844
+ *
7845
+ * Not an EventTarget in order to forward native DOM events while
7846
+ * preserving `preventDefault()` for tools (see '#fireDomEvent').
6809
7847
  */
6810
7848
  export declare class ViewLayer {
6811
7849
  /**
@@ -6859,10 +7897,10 @@ export declare class ViewLayer {
6859
7897
  /**
6860
7898
  * Handle an image set event.
6861
7899
  *
6862
- * @param {object} event The event.
7900
+ * @param {CustomEvent} event The event.
6863
7901
  * @function
6864
7902
  */
6865
- onimageset: (event: object) => void;
7903
+ onimageset: (event: CustomEvent) => void;
6866
7904
  /**
6867
7905
  * Bind this layer to the view image.
6868
7906
  */
@@ -6874,24 +7912,24 @@ export declare class ViewLayer {
6874
7912
  /**
6875
7913
  * Handle an image content change event.
6876
7914
  *
6877
- * @param {object} event The event.
7915
+ * @param {CustomEvent} event The event.
6878
7916
  * @function
6879
7917
  */
6880
- onimagecontentchange: (event: object) => void;
7918
+ onimagecontentchange: (event: CustomEvent) => void;
6881
7919
  /**
6882
7920
  * Handle an image change event.
6883
7921
  *
6884
- * @param {object} event The event.
7922
+ * @param {CustomEvent} event The event.
6885
7923
  * @function
6886
7924
  */
6887
- onimagegeometrychange: (event: object) => void;
7925
+ onimagegeometrychange: (event: CustomEvent) => void;
6888
7926
  /**
6889
7927
  * Handle an image resampled event.
6890
7928
  *
6891
- * @param {object} event The event.
7929
+ * @param {CustomEvent} event The event.
6892
7930
  * @function
6893
7931
  */
6894
- onimageresampled: (event: object) => void;
7932
+ onimageresampled: (event: CustomEvent) => void;
6895
7933
  /**
6896
7934
  * Get the id of the layer.
6897
7935
  *
@@ -7122,6 +8160,32 @@ export declare class ViewLayer {
7122
8160
  #private;
7123
8161
  }
7124
8162
 
8163
+ /**
8164
+ * @import {LayerGroup} from '../../gui/layerGroup.js';
8165
+ */
8166
+ /**
8167
+ * Mouse wheel handling: subclasses may override {@link WheelBehavior#onWheel}
8168
+ * (every event) and/or {@link WheelBehavior#onWheelTick}
8169
+ * (after tick threshold).
8170
+ */
8171
+ export declare class WheelBehavior {
8172
+ /**
8173
+ * Raw wheel event (every `wheel`); use with continuous effects such as zoom.
8174
+ *
8175
+ * @param {WheelEvent} _event The wheel event.
8176
+ * @param {LayerGroup|undefined} _layerGroup Layer group under the wheel.
8177
+ */
8178
+ onWheel(_event: WheelEvent, _layerGroup: LayerGroup | undefined): void;
8179
+ /**
8180
+ * Discrete wheel tick after accumulation; use for
8181
+ * slice scroll and similar stepped actions.
8182
+ *
8183
+ * @param {boolean} _up True when spin is in the positive direction.
8184
+ * @param {LayerGroup} _layerGroup Layer group under the wheel event.
8185
+ */
8186
+ onWheelTick(_up: boolean, _layerGroup: LayerGroup): void;
8187
+ }
8188
+
7125
8189
  /**
7126
8190
  * Window and Level also known as window width and center.
7127
8191
  */
@@ -7145,6 +8209,41 @@ export declare class WindowLevel {
7145
8209
  width: number;
7146
8210
  }
7147
8211
 
8212
+ /**
8213
+ * @import {WindowLevel} from './windowLevel.js';
8214
+ */
8215
+ /**
8216
+ * Window level preset: a named list of window levels.
8217
+ * The list holds a single window level unless the preset is 'perslice',
8218
+ * in which case it holds one window level per slice.
8219
+ */
8220
+ export declare class WindowPreset {
8221
+ /**
8222
+ * @param {string} name The preset name.
8223
+ * @param {WindowLevel[]} [wl] The list of window levels.
8224
+ * @param {boolean} [perslice] Flag for a per-slice window level list.
8225
+ */
8226
+ constructor(name: string, wl?: WindowLevel[], perslice?: boolean);
8227
+ /**
8228
+ * The preset name.
8229
+ *
8230
+ * @type {string}
8231
+ */
8232
+ name: string;
8233
+ /**
8234
+ * The list of window levels.
8235
+ *
8236
+ * @type {WindowLevel[]|undefined}
8237
+ */
8238
+ wl: WindowLevel[] | undefined;
8239
+ /**
8240
+ * Flag to indicate a per-slice window level list.
8241
+ *
8242
+ * @type {boolean|undefined}
8243
+ */
8244
+ perslice: boolean | undefined;
8245
+ }
8246
+
7148
8247
  /**
7149
8248
  * Writer rule.
7150
8249
  */