dwv 0.36.0-beta.9 → 0.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dwv.d.ts CHANGED
@@ -67,9 +67,11 @@ export declare class Annotation {
67
67
  /**
68
68
  * Annotation quantification.
69
69
  *
70
- * @type {object|undefined}
70
+ * @type {Object<string, Value>|undefined}
71
71
  */
72
- quantification: object | undefined;
72
+ quantification: {
73
+ [x: string]: Value;
74
+ } | undefined;
73
75
  /**
74
76
  * Text expression. Can contain variables surrounded with '{}' that will
75
77
  * be extracted from the quantification object.
@@ -338,7 +340,6 @@ export declare class AnnotationGroupFactory {
338
340
  *
339
341
  * @param {Object<string, DataElement>} dataElements The DICOM data elements.
340
342
  * @returns {string|undefined} A possible warning.
341
- * @throws Error for missing or wrong data.
342
343
  */
343
344
  checkElements(dataElements: {
344
345
  [x: string]: DataElement;
@@ -348,7 +349,7 @@ export declare class AnnotationGroupFactory {
348
349
  *
349
350
  * @param {Object<string, DataElement>} dataElements The DICOM tags.
350
351
  * @returns {AnnotationGroup} A new annotation group.
351
- * @throws Error for missing or wrong data.
352
+ * @throws {Error} Error for missing or wrong data.
352
353
  */
353
354
  create(dataElements: {
354
355
  [x: string]: DataElement;
@@ -592,11 +593,11 @@ export declare class App {
592
593
  /**
593
594
  * Add a command to the undo stack.
594
595
  *
595
- * @param {object} cmd The command to add.
596
+ * @param {Command} cmd The command to add.
596
597
  * @fires UndoStack#undoadd
597
598
  * @function
598
599
  */
599
- addToUndoStack: (cmd: object) => void;
600
+ addToUndoStack: (cmd: Command) => void;
600
601
  /**
601
602
  * Remove a command from the undo stack.
602
603
  *
@@ -994,18 +995,18 @@ export declare class App {
994
995
  */
995
996
  getCurrentStackIndex(): number;
996
997
  /**
997
- * Get the overlay data for a data id.
998
+ * Get the info data for a data id.
998
999
  *
999
1000
  * @param {string} dataId The data id.
1000
- * @returns {OverlayData|undefined} The overlay data.
1001
+ * @returns {InfoData|undefined} The info data.
1001
1002
  */
1002
- getOverlayData(dataId: string): OverlayData | undefined;
1003
+ getInfoData(dataId: string): InfoData | undefined;
1003
1004
  /**
1004
- * Toggle overlay listeners.
1005
+ * Toggle info data listeners.
1005
1006
  *
1006
1007
  * @param {string} dataId The data id.
1007
1008
  */
1008
- toggleOverlayListeners(dataId: string): void;
1009
+ toggleInfoDataListeners(dataId: string): void;
1009
1010
  /**
1010
1011
  * Create new annotation data based on the data of
1011
1012
  * the active view layer.
@@ -1082,7 +1083,7 @@ export declare class AppOptions {
1082
1083
  */
1083
1084
  defaultCharacterSet: string | undefined;
1084
1085
  /**
1085
- * Optional overlay config.
1086
+ * Optional overlay layer config.
1086
1087
  *
1087
1088
  * @type {object|undefined}
1088
1089
  */
@@ -1148,7 +1149,7 @@ export declare class CADReport {
1148
1149
  /**
1149
1150
  * Change segment colour command.
1150
1151
  */
1151
- export declare class ChangeSegmentColourCommand {
1152
+ export declare class ChangeSegmentColourCommand extends Command {
1152
1153
  /**
1153
1154
  * @param {Image} mask The mask image.
1154
1155
  * @param {MaskSegment} segment The segment to modify.
@@ -1156,30 +1157,12 @@ export declare class ChangeSegmentColourCommand {
1156
1157
  * @param {boolean} [silent] Whether to send a creation event or not.
1157
1158
  */
1158
1159
  constructor(mask: Image_2, segment: MaskSegment, newColour: RGB | number, silent?: boolean);
1159
- /**
1160
- * Get the command name.
1161
- *
1162
- * @returns {string} The command name.
1163
- */
1164
- getName(): string;
1165
1160
  /**
1166
1161
  * Check if a command is valid and can be executed.
1167
1162
  *
1168
1163
  * @returns {boolean} True if the command is valid.
1169
1164
  */
1170
1165
  isValid(): boolean;
1171
- /**
1172
- * Execute the command.
1173
- *
1174
- * @fires ChangeSegmentColourCommand#changemasksegmentcolour
1175
- */
1176
- execute(): void;
1177
- /**
1178
- * Undo the command.
1179
- *
1180
- * @fires ChangeSegmentColourCommand#changemasksegmentcolour
1181
- */
1182
- undo(): void;
1183
1166
  /**
1184
1167
  * Handle an execute event.
1185
1168
  *
@@ -1264,9 +1247,11 @@ export declare class Circle {
1264
1247
  * @param {Index} index The index at which to get the
1265
1248
  * image values.
1266
1249
  * @param {string[]} flags A list of stat values to calculate.
1267
- * @returns {object} A quantification object.
1250
+ * @returns {Object<string, Value>} A quantification object.
1268
1251
  */
1269
- quantify(viewController: ViewController, index: Index, flags: string[]): object;
1252
+ quantify(viewController: ViewController, index: Index, flags: string[]): {
1253
+ [x: string]: Value;
1254
+ };
1270
1255
  #private;
1271
1256
  }
1272
1257
 
@@ -1301,6 +1286,26 @@ export declare class ColourMap {
1301
1286
  blue: number[];
1302
1287
  }
1303
1288
 
1289
+ /**
1290
+ * Command interface.
1291
+ */
1292
+ export declare class Command {
1293
+ /**
1294
+ * Get the command name.
1295
+ *
1296
+ * @returns {string} The command name.
1297
+ */
1298
+ getName(): string;
1299
+ /**
1300
+ * Execute the command.
1301
+ */
1302
+ execute(): void;
1303
+ /**
1304
+ * Undo the command.
1305
+ */
1306
+ undo(): void;
1307
+ }
1308
+
1304
1309
  /**
1305
1310
  * Create an Image from DICOM elements.
1306
1311
  *
@@ -1408,40 +1413,42 @@ export declare class DataElement {
1408
1413
  items: any[];
1409
1414
  }
1410
1415
 
1416
+ /**
1417
+ * Default tool list.
1418
+ *
1419
+ * @type {Object<string, any>}
1420
+ */
1421
+ export declare const defaultToolList: {
1422
+ [x: string]: any;
1423
+ };
1424
+
1425
+ /**
1426
+ * Default tool options.
1427
+ *
1428
+ * @type {Object<string, Object<string, any>>}
1429
+ */
1430
+ export declare const defaultToolOptions: {
1431
+ [x: string]: {
1432
+ [x: string]: any;
1433
+ };
1434
+ };
1435
+
1411
1436
  /**
1412
1437
  * Delete segment command.
1413
1438
  */
1414
- export declare class DeleteSegmentCommand {
1439
+ export declare class DeleteSegmentCommand extends Command {
1415
1440
  /**
1416
1441
  * @param {Image} mask The mask image.
1417
1442
  * @param {MaskSegment} segment The segment to remove.
1418
1443
  * @param {boolean} [silent] Whether to send a creation event or not.
1419
1444
  */
1420
1445
  constructor(mask: Image_2, segment: MaskSegment, silent?: boolean);
1421
- /**
1422
- * Get the command name.
1423
- *
1424
- * @returns {string} The command name.
1425
- */
1426
- getName(): string;
1427
1446
  /**
1428
1447
  * Check if a command is valid and can be executed.
1429
1448
  *
1430
1449
  * @returns {boolean} True if the command is valid.
1431
1450
  */
1432
1451
  isValid(): boolean;
1433
- /**
1434
- * Execute the command.
1435
- *
1436
- * @fires DeleteSegmentCommand#masksegmentdelete
1437
- */
1438
- execute(): void;
1439
- /**
1440
- * Undo the command.
1441
- *
1442
- * @fires DeleteSegmentCommand#masksegmentredraw
1443
- */
1444
- undo(): void;
1445
1452
  /**
1446
1453
  * Handle an execute event.
1447
1454
  *
@@ -1457,6 +1464,50 @@ export declare class DeleteSegmentCommand {
1457
1464
  #private;
1458
1465
  }
1459
1466
 
1467
+ /**
1468
+ * Diameter type.
1469
+ */
1470
+ export declare class Diameter {
1471
+ /**
1472
+ * The scaled diameter value.
1473
+ *
1474
+ * @type {Value}
1475
+ */
1476
+ diameter: Value;
1477
+ /**
1478
+ * The offset of the pixel at the start
1479
+ * of the line used to calculate this diameter.
1480
+ *
1481
+ * @type {number}
1482
+ */
1483
+ offset1: number;
1484
+ /**
1485
+ * The offset of the pixel at the end
1486
+ * of the line used to calculate this diameter.
1487
+ *
1488
+ * @type {number}
1489
+ */
1490
+ offset2: number;
1491
+ }
1492
+
1493
+ /**
1494
+ * Diameters type.
1495
+ */
1496
+ export declare class Diameters {
1497
+ /**
1498
+ * The major (longest) diameter of the segment.
1499
+ *
1500
+ * @type {Diameter}
1501
+ */
1502
+ major: Diameter;
1503
+ /**
1504
+ * The minor (longest perpendicular to the major) diameter of the segment.
1505
+ *
1506
+ * @type {Diameter}
1507
+ */
1508
+ minor: Diameter;
1509
+ }
1510
+
1460
1511
  /**
1461
1512
  * DICOM code: item of a basic code sequence.
1462
1513
  *
@@ -2300,9 +2351,11 @@ export declare class Ellipse {
2300
2351
  * @param {Index} index The index at which to get the
2301
2352
  * image values.
2302
2353
  * @param {string[]} flags A list of stat values to calculate.
2303
- * @returns {object} A quantification object.
2354
+ * @returns {Object<string, Value>} A quantification object.
2304
2355
  */
2305
- quantify(viewController: ViewController, index: Index, flags: string[]): object;
2356
+ quantify(viewController: ViewController, index: Index, flags: string[]): {
2357
+ [x: string]: Value;
2358
+ };
2306
2359
  #private;
2307
2360
  }
2308
2361
 
@@ -3156,11 +3209,11 @@ declare class Image_2 {
3156
3209
  * @param {number} i The X index.
3157
3210
  * @param {number} j The Y index.
3158
3211
  * @param {number} k The Z index.
3159
- * @param {number} f The frame number.
3212
+ * @param {number} [f] Optional frame number.
3160
3213
  * @returns {number} The value at the desired position.
3161
3214
  * Warning: No size check...
3162
3215
  */
3163
- getValue(i: number, j: number, k: number, f: number): number;
3216
+ getValue(i: number, j: number, k: number, f?: number): number;
3164
3217
  /**
3165
3218
  * Get the value of the image at a specific index.
3166
3219
  *
@@ -3175,11 +3228,11 @@ declare class Image_2 {
3175
3228
  * @param {number} i The X index.
3176
3229
  * @param {number} j The Y index.
3177
3230
  * @param {number} k The Z index.
3178
- * @param {number} f The frame number.
3231
+ * @param {number} [f] Optional frame number.
3179
3232
  * @returns {number} The rescaled value at the desired position.
3180
3233
  * Warning: No size check...
3181
3234
  */
3182
- getRescaledValue(i: number, j: number, k: number, f: number): number;
3235
+ getRescaledValue(i: number, j: number, k: number, f?: number): number;
3183
3236
  /**
3184
3237
  * Get the rescaled value of the image at a specific index.
3185
3238
  *
@@ -3394,6 +3447,101 @@ export declare class Index {
3394
3447
  #private;
3395
3448
  }
3396
3449
 
3450
+ /**
3451
+ * DICOM Header info data.
3452
+ */
3453
+ export declare class InfoData {
3454
+ /**
3455
+ * @param {App} app The associated application.
3456
+ * @param {string} dataId The associated data id.
3457
+ * @param {Object<string, InfoDataItem[]>} configs The info data config.
3458
+ */
3459
+ constructor(app: App, dataId: string, configs: {
3460
+ [x: string]: InfoDataItem[];
3461
+ });
3462
+ /**
3463
+ * Reset the data.
3464
+ */
3465
+ reset(): void;
3466
+ /**
3467
+ * Handle a new loaded item event.
3468
+ *
3469
+ * @param {Object<string, DataElement>} data The item meta data.
3470
+ */
3471
+ addItemMeta(data: {
3472
+ [x: string]: DataElement;
3473
+ }): void;
3474
+ /**
3475
+ * Handle a changed slice event.
3476
+ *
3477
+ * @param {object} event The slicechange event.
3478
+ */
3479
+ onSliceChange: (event: object) => void;
3480
+ /**
3481
+ * Is this class listening to app events.
3482
+ *
3483
+ * @returns {boolean} True is listening to app events.
3484
+ */
3485
+ isListening(): boolean;
3486
+ /**
3487
+ * Toggle info listeners.
3488
+ */
3489
+ addAppListeners(): void;
3490
+ /**
3491
+ * Toggle info listeners.
3492
+ */
3493
+ 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
+ #private;
3511
+ }
3512
+
3513
+ /**
3514
+ * Info data item class.
3515
+ */
3516
+ export declare class InfoDataItem {
3517
+ /**
3518
+ * List of tag keys.
3519
+ *
3520
+ * @type {string[]|undefined}
3521
+ */
3522
+ tags: string[] | undefined;
3523
+ /**
3524
+ * @type {string|undefined}
3525
+ */
3526
+ event: string | undefined;
3527
+ /**
3528
+ * @type {string}
3529
+ */
3530
+ pos: string;
3531
+ /**
3532
+ * @type {string}
3533
+ */
3534
+ format: string;
3535
+ /**
3536
+ * @type {string|undefined}
3537
+ */
3538
+ precision: string | undefined;
3539
+ /**
3540
+ * @type {string}
3541
+ */
3542
+ value: string;
3543
+ }
3544
+
3397
3545
  /**
3398
3546
  * Check if two rgb objects are equal.
3399
3547
  *
@@ -3403,6 +3551,60 @@ export declare class Index {
3403
3551
  */
3404
3552
  export declare function isEqualRgb(c1: RGB, c2: RGB): boolean;
3405
3553
 
3554
+ /**
3555
+ * Label type.
3556
+ */
3557
+ export declare class Label {
3558
+ /**
3559
+ * The world coordinates of the centroid.
3560
+ *
3561
+ * @type {Point}
3562
+ */
3563
+ centroid: Point;
3564
+ /**
3565
+ * The closest voxel Index to the centroid.
3566
+ *
3567
+ * @type {number[]}
3568
+ */
3569
+ centroidIndex: number[];
3570
+ /**
3571
+ * The volume of the labeled segment.
3572
+ *
3573
+ * @type {Value}
3574
+ */
3575
+ volume: Value;
3576
+ /**
3577
+ * The voxel count of the labeled segment.
3578
+ *
3579
+ * @type {number}
3580
+ */
3581
+ count: number;
3582
+ /**
3583
+ * The diameters of the segment.
3584
+ *
3585
+ * @type {Diameters}
3586
+ */
3587
+ diameters: Diameters;
3588
+ /**
3589
+ * The scaled height of the segment.
3590
+ *
3591
+ * @type {Value}
3592
+ */
3593
+ height: Value;
3594
+ /**
3595
+ * The segment label id.
3596
+ *
3597
+ * @type {number}
3598
+ */
3599
+ id: number;
3600
+ /**
3601
+ * The Z index of the largest slice of the segment.
3602
+ *
3603
+ * @type {number}
3604
+ */
3605
+ largestSliceZ: number;
3606
+ }
3607
+
3406
3608
  /**
3407
3609
  * CIE LAB value (L: [0, 100], a: [-128, 127], b: [-128, 127]) to
3408
3610
  * unsigned int CIE LAB ([0, 65535]).
@@ -3431,14 +3633,17 @@ export declare function labToUintLab(triplet: object): object;
3431
3633
  export declare class LayerGroup {
3432
3634
  /**
3433
3635
  * @param {HTMLElement} containerDiv The associated HTML div.
3636
+ * @param {boolean} [withInfoLayer] Optional with info layer flag,
3637
+ * default to false.
3434
3638
  */
3435
- constructor(containerDiv: HTMLElement);
3639
+ constructor(containerDiv: HTMLElement, withInfoLayer?: boolean);
3436
3640
  /**
3437
3641
  * Get the position helper.
3438
3642
  *
3439
- * @returns {PositionHelper} The position helper.
3643
+ * @returns {PositionHelper|undefined} The position helper or
3644
+ * undefined if no layers.
3440
3645
  */
3441
- getPositionHelper(): PositionHelper;
3646
+ getPositionHelper(): PositionHelper | undefined;
3442
3647
  /**
3443
3648
  * Get the showCrosshair flag.
3444
3649
  *
@@ -3646,6 +3851,23 @@ export declare class LayerGroup {
3646
3851
  * @returns {DrawLayer} The created layer.
3647
3852
  */
3648
3853
  addDrawLayer(): DrawLayer;
3854
+ /**
3855
+ * Add info data.
3856
+ *
3857
+ * @param {InfoData} data The data to add.
3858
+ * @param {string} dataId The associated data ID.
3859
+ */
3860
+ addInfoData(data: InfoData, dataId: string): void;
3861
+ /**
3862
+ * Bind info data.
3863
+ *
3864
+ * @param {string} dataId The associated data ID.
3865
+ */
3866
+ bindInfoData(dataId: string): void;
3867
+ /**
3868
+ * Unbind info data.
3869
+ */
3870
+ unbindInfoData(): void;
3649
3871
  /**
3650
3872
  * Empty the layer list.
3651
3873
  */
@@ -3706,6 +3928,12 @@ export declare class LayerGroup {
3706
3928
  * @returns {boolean} True if one view layer has more than one slice.
3707
3929
  */
3708
3930
  moreThanOne(dim: number): boolean;
3931
+ /**
3932
+ * Check if any layer has a valid position.
3933
+ *
3934
+ * @returns {boolean} True if any layer has a valid position.
3935
+ */
3936
+ hasAnyLayerWithValidPosition(): boolean;
3709
3937
  /**
3710
3938
  * Update layers (but not the event source layer) to a position change.
3711
3939
  *
@@ -3848,7 +4076,6 @@ export declare class MaskFactory {
3848
4076
  *
3849
4077
  * @param {Object<string, DataElement>} _dicomElements The DICOM tags.
3850
4078
  * @returns {string|undefined} A possible warning.
3851
- * @throws Error for missing or wrong data.
3852
4079
  */
3853
4080
  checkElements(_dicomElements: {
3854
4081
  [x: string]: DataElement;
@@ -3863,7 +4090,7 @@ export declare class MaskFactory {
3863
4090
  * @param {Image} [refImage] Reference image, code will use its
3864
4091
  * origins if present (best) or try to calculate them.
3865
4092
  * @returns {Image} A new Image.
3866
- * @throws Error for missing or wrong data.
4093
+ * @throws {Error} Error for missing or wrong data.
3867
4094
  */
3868
4095
  create(dataElements: {
3869
4096
  [x: string]: DataElement;
@@ -3971,6 +4198,12 @@ export declare class MaskSegmentHelper {
3971
4198
  * @param {Image} mask The associated mask image.
3972
4199
  */
3973
4200
  constructor(mask: Image_2);
4201
+ /**
4202
+ * Get the associated mask image.
4203
+ *
4204
+ * @returns {Image} The mask image.
4205
+ */
4206
+ getMask(): Image_2;
3974
4207
  /**
3975
4208
  * Check if a segment is part of the segments list.
3976
4209
  *
@@ -4018,17 +4251,19 @@ export declare class MaskSegmentHelper {
4018
4251
  */
4019
4252
  updateSegment(segment: MaskSegment): void;
4020
4253
  /**
4021
- * The overlap count of a signle segment with another segment.
4254
+ * The overlap count of a single segment with another segment.
4022
4255
  *
4023
4256
  * @typedef OverlapCount@typedef OverlapCount
4257
+ * @property {string} label The segment label.
4024
4258
  * @property {number} count The number of overlapping voxels.
4025
- * @property {number} percentage The overlap percentage between 0 and 1.
4259
+ * @property {number} percentage The overlap percentage between 0 and 100.
4026
4260
  */
4027
4261
  /**
4028
4262
  * The count of overlapping voxels of a single segment with a set of
4029
4263
  * different segments.
4030
4264
  *
4031
4265
  * @typedef Overlap@typedef Overlap
4266
+ * @property {string} label The segment label.
4032
4267
  * @property {Object.<number, OverlapCount>} overlap A Dictionary
4033
4268
  * containing the counts. The key is the segment number of the overlapping
4034
4269
  * segment.
@@ -4047,12 +4282,17 @@ export declare class MaskSegmentHelper {
4047
4282
  * Find the overlap for each segment between two segmentation masks.
4048
4283
  * It is assumed these images have the same orientation.
4049
4284
  *
4050
- * @param {Image} compare The segmentation image to find overlap with.
4285
+ * @param {MaskSegmentHelper} rhs The helper of the
4286
+ * segmentation image to find overlap with.
4051
4287
  * @returns {OverlapMap} The overlapping voxel counts. First level is the
4052
4288
  * segments from this image, second level is the compare image segments.
4053
4289
  */
4054
- findOverlap(compare: Image_2): {
4290
+ findOverlap(rhs: MaskSegmentHelper): {
4055
4291
  [x: number]: {
4292
+ /**
4293
+ * The segment label.
4294
+ */
4295
+ label: string;
4056
4296
  /**
4057
4297
  * A Dictionary
4058
4298
  * containing the counts. The key is the segment number of the overlapping
@@ -4060,12 +4300,16 @@ export declare class MaskSegmentHelper {
4060
4300
  */
4061
4301
  overlap: {
4062
4302
  [x: number]: {
4303
+ /**
4304
+ * The segment label.
4305
+ */
4306
+ label: string;
4063
4307
  /**
4064
4308
  * The number of overlapping voxels.
4065
4309
  */
4066
4310
  count: number;
4067
4311
  /**
4068
- * The overlap percentage between 0 and 1.
4312
+ * The overlap percentage between 0 and 100.
4069
4313
  */
4070
4314
  percentage: number;
4071
4315
  };
@@ -4102,18 +4346,6 @@ export declare class MaskSegmentViewHelper {
4102
4346
  * @param {number} segmentNumber The segment number.
4103
4347
  */
4104
4348
  removeFromHidden(segmentNumber: number): void;
4105
- /**
4106
- * @callback alphaFn@callback alphaFn
4107
- * @param {number|number[]} value The pixel value.
4108
- * @param {number} index The values' index.
4109
- * @returns {number} The opacity of the input value.
4110
- */
4111
- /**
4112
- * Get the alpha function to apply hidden colors.
4113
- *
4114
- * @returns {alphaFn} The corresponding alpha function.
4115
- */
4116
- getAlphaFunc(): (value: number | number[], index: number) => number;
4117
4349
  #private;
4118
4350
  }
4119
4351
 
@@ -4283,59 +4515,6 @@ export declare namespace Orientation {
4283
4515
  let Sagittal: string;
4284
4516
  }
4285
4517
 
4286
- /**
4287
- * DICOM Header overlay info.
4288
- */
4289
- export declare class OverlayData {
4290
- /**
4291
- * @param {App} app The associated application.
4292
- * @param {string} dataId The associated data id.
4293
- * @param {object} configs The overlay config.
4294
- */
4295
- constructor(app: App, dataId: string, configs: object);
4296
- /**
4297
- * Reset the data.
4298
- */
4299
- reset(): void;
4300
- /**
4301
- * Handle a new loaded item event.
4302
- *
4303
- * @param {object} data The item meta data.
4304
- */
4305
- addItemMeta(data: object): void;
4306
- /**
4307
- * Is this class listening to app events.
4308
- *
4309
- * @returns {boolean} True is listening to app events.
4310
- */
4311
- isListening(): boolean;
4312
- /**
4313
- * Toggle info listeners.
4314
- */
4315
- addAppListeners(): void;
4316
- /**
4317
- * Toggle info listeners.
4318
- */
4319
- removeAppListeners(): void;
4320
- /**
4321
- * Add an event listener to this class.
4322
- *
4323
- * @param {string} type The event type.
4324
- * @param {object} callback The method associated with the provided
4325
- * event type, will be called with the fired event.
4326
- */
4327
- addEventListener(type: string, callback: object): void;
4328
- /**
4329
- * Remove an event listener from this class.
4330
- *
4331
- * @param {string} type The event type.
4332
- * @param {object} callback The method associated with the provided
4333
- * event type.
4334
- */
4335
- removeEventListener(type: string, callback: object): void;
4336
- #private;
4337
- }
4338
-
4339
4518
  /**
4340
4519
  * Plane geometry helper.
4341
4520
  */
@@ -4910,9 +5089,11 @@ export declare class Protractor {
4910
5089
  *
4911
5090
  * @param {ViewController} _viewController The associated view controller.
4912
5091
  * @param {string[]} _flags A list of stat values to calculate.
4913
- * @returns {object} A quantification object.
5092
+ * @returns {Object<string, Value>} A quantification object.
4914
5093
  */
4915
- quantify(_viewController: ViewController, _flags: string[]): object;
5094
+ quantify(_viewController: ViewController, _flags: string[]): {
5095
+ [x: string]: Value;
5096
+ };
4916
5097
  #private;
4917
5098
  }
4918
5099
 
@@ -5003,9 +5184,11 @@ export declare class Rectangle {
5003
5184
  * @param {Index} index The index at which to get the
5004
5185
  * image values.
5005
5186
  * @param {string[]} flags A list of stat values to calculate.
5006
- * @returns {object} A quantification object.
5187
+ * @returns {Object<string, Value>} A quantification object.
5007
5188
  */
5008
- quantify(viewController: ViewController, index: Index, flags: string[]): object;
5189
+ quantify(viewController: ViewController, index: Index, flags: string[]): {
5190
+ [x: string]: Value;
5191
+ };
5009
5192
  #private;
5010
5193
  }
5011
5194
 
@@ -5313,7 +5496,7 @@ export declare class Size {
5313
5496
  *
5314
5497
  * @param {Index} index The index to convert.
5315
5498
  * @param {number} [start] Optional start dimension to base the offset on.
5316
- * @returns {number} The offset.
5499
+ * @returns {number} The offset or -1 if out of bounds.
5317
5500
  */
5318
5501
  indexToOffset(index: Index, start?: number): number;
5319
5502
  /**
@@ -5329,6 +5512,22 @@ export declare class Size {
5329
5512
  * @returns {Scalar2D} The 2D base [0,1] as {x,y}.
5330
5513
  */
5331
5514
  get2D(): Scalar2D;
5515
+ /**
5516
+ * Normalise a point to this size.
5517
+ *
5518
+ * @param {Point} point The input point.
5519
+ * @param {Point} [extra] Optional point used to fill extra dimensions.
5520
+ * @returns {Point} The result point.
5521
+ */
5522
+ normalisePoint(point: Point, extra?: Point): Point;
5523
+ /**
5524
+ * Normalise an index to this size.
5525
+ *
5526
+ * @param {Index} index The input index.
5527
+ * @param {Index} [extra] Optional index used to fill extra dimensions.
5528
+ * @returns {Index} The result point.
5529
+ */
5530
+ normaliseIndex(index: Index, extra?: Index): Index;
5332
5531
  #private;
5333
5532
  }
5334
5533
 
@@ -5671,6 +5870,20 @@ export declare const toolOptions: {
5671
5870
  };
5672
5871
  };
5673
5872
 
5873
+ /**
5874
+ * Class to store a value and a unit.
5875
+ */
5876
+ export declare class Value {
5877
+ /**
5878
+ * @type {number}
5879
+ */
5880
+ value: number;
5881
+ /**
5882
+ * @type {string|undefined}
5883
+ */
5884
+ unit: string | undefined;
5885
+ }
5886
+
5674
5887
  /**
5675
5888
  * Immutable 3D vector.
5676
5889
  */
@@ -5800,9 +6013,22 @@ export declare class View {
5800
6013
  /**
5801
6014
  * Set the associated image.
5802
6015
  *
5803
- * @param {Image} inImage The associated image.
6016
+ * @param {Image} image The associated image.
5804
6017
  */
5805
- setImage(inImage: Image_2): void;
6018
+ setImage(image: Image_2): void;
6019
+ /**
6020
+ * Check is the associated image is a mask.
6021
+ *
6022
+ * @returns {boolean} True if the associated image is a mask.
6023
+ */
6024
+ isMask(): boolean;
6025
+ /**
6026
+ * Set the mask segment view helper to handle
6027
+ * hidden segments.
6028
+ *
6029
+ * @param {MaskSegmentViewHelper} helper The helper.
6030
+ */
6031
+ setMaskViewHelper(helper: MaskSegmentViewHelper): void;
5806
6032
  /**
5807
6033
  * Get the view orientation.
5808
6034
  *
@@ -5844,14 +6070,6 @@ export declare class View {
5844
6070
  * (0 <= integer <= MAX_CONTOUR_SIZE).
5845
6071
  */
5846
6072
  setContourThickness(thickness: number): void;
5847
- /**
5848
- * Initialise the view: set initial index.
5849
- */
5850
- init(): void;
5851
- /**
5852
- * Set the initial index to the middle position.
5853
- */
5854
- setInitialIndex(): void;
5855
6073
  /**
5856
6074
  * Get the milliseconds per frame from frame rate.
5857
6075
  *
@@ -5859,12 +6077,6 @@ export declare class View {
5859
6077
  * @returns {number} The milliseconds per frame.
5860
6078
  */
5861
6079
  getPlaybackMilliseconds(recommendedDisplayFrameRate: number): number;
5862
- /**
5863
- * @callback alphaFn@callback alphaFn
5864
- * @param {number[]|number} value The pixel value.
5865
- * @param {number} index The values' index.
5866
- * @returns {number} The opacity of the input value.
5867
- */
5868
6080
  /**
5869
6081
  * Get the alpha function.
5870
6082
  *
@@ -5905,9 +6117,9 @@ export declare class View {
5905
6117
  /**
5906
6118
  * Get the current window level preset name.
5907
6119
  *
5908
- * @returns {string} The preset name.
6120
+ * @returns {string|undefined} The preset name.
5909
6121
  */
5910
- getCurrentWindowPresetName(): string;
6122
+ getCurrentWindowPresetName(): string | undefined;
5911
6123
  /**
5912
6124
  * Get the colour map of the image.
5913
6125
  *
@@ -5924,15 +6136,15 @@ export declare class View {
5924
6136
  /**
5925
6137
  * Get the current position.
5926
6138
  *
5927
- * @returns {Point} The current position.
6139
+ * @returns {Point|undefined} The current position.
5928
6140
  */
5929
- getCurrentPosition(): Point;
6141
+ getCurrentPosition(): Point | undefined;
5930
6142
  /**
5931
6143
  * Get the current index.
5932
6144
  *
5933
- * @returns {Index} The current index.
6145
+ * @returns {Index|undefined} The current index.
5934
6146
  */
5935
- getCurrentIndex(): Index;
6147
+ getCurrentIndex(): Index | undefined;
5936
6148
  /**
5937
6149
  * Get the SOP image UID of the current image.
5938
6150
  *
@@ -5980,12 +6192,12 @@ export declare class View {
5980
6192
  /**
5981
6193
  * Set current position.
5982
6194
  *
5983
- * @param {Point} position The new position.
6195
+ * @param {Point} inPosition The new position.
5984
6196
  * @param {boolean} [silent] Flag to fire event or not.
5985
6197
  * @returns {boolean} False if not in bounds.
5986
6198
  * @fires View#positionchange
5987
6199
  */
5988
- setCurrentPosition(position: Point, silent?: boolean): boolean;
6200
+ setCurrentPosition(inPosition: Point, silent?: boolean): boolean;
5989
6201
  /**
5990
6202
  * Set the view window/level.
5991
6203
  *
@@ -6215,17 +6427,12 @@ export declare class ViewController {
6215
6427
  */
6216
6428
  isPlaying(): boolean;
6217
6429
  /**
6218
- * Get the position helper.
6430
+ * Get a position helper: returns a new helper
6431
+ * based on the current view.
6219
6432
  *
6220
6433
  * @returns {PositionHelper} The helper.
6221
6434
  */
6222
6435
  getPositionHelper(): PositionHelper;
6223
- /**
6224
- * Get a clone of the position helper.
6225
- *
6226
- * @returns {PositionHelper} The helper clone.
6227
- */
6228
- getPositionHelperClone(): PositionHelper;
6229
6436
  /**
6230
6437
  * Get the current position.
6231
6438
  *
@@ -6540,6 +6747,13 @@ export declare class ViewController {
6540
6747
  * @param {alphaFn} func The function.
6541
6748
  */
6542
6749
  setViewAlphaFunction(func: (value: number[] | number, index: number) => number): void;
6750
+ /**
6751
+ * Set the mask segment view helper to handle
6752
+ * hidden segments.
6753
+ *
6754
+ * @param {MaskSegmentViewHelper} helper The helper.
6755
+ */
6756
+ setMaskViewHelper(helper: MaskSegmentViewHelper): void;
6543
6757
  /**
6544
6758
  * Get the fill opacity relative to the global opacity.
6545
6759
  *
@@ -6880,6 +7094,12 @@ export declare class ViewLayer {
6880
7094
  * event type.
6881
7095
  */
6882
7096
  removeEventListener(type: string, callback: Function): void;
7097
+ /**
7098
+ * Check if the position is valid.
7099
+ *
7100
+ * @returns {boolean} True if the position is valid.
7101
+ */
7102
+ isValidPosition(): boolean;
6883
7103
  /**
6884
7104
  * Set the current position.
6885
7105
  *