dwv 0.37.0-beta.13 → 0.37.0-beta.15
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/assets/workers/resampling.worker.min.js.map +1 -1
- package/dist/dwv.d.ts +298 -212
- package/dist/dwv.min.js +1 -1
- package/dist/dwv.min.js.map +1 -1
- package/dist/dwv.node.min.js +1 -1
- package/dist/dwv.node.min.js.map +1 -1
- package/package.json +19 -18
package/dist/dwv.d.ts
CHANGED
|
@@ -687,7 +687,7 @@ export declare class App extends EventTarget {
|
|
|
687
687
|
* @type {CustomEvent}
|
|
688
688
|
* @property {object} detail The event detail.
|
|
689
689
|
* @property {string} detail.dataid The data id.
|
|
690
|
-
* @property {string} detail.loadtype The load type: image
|
|
690
|
+
* @property {string} detail.loadtype The load type: image.
|
|
691
691
|
* @property {*} detail.source The load source: string for an url,
|
|
692
692
|
* File for a file.
|
|
693
693
|
*/
|
|
@@ -698,7 +698,7 @@ export declare class App extends EventTarget {
|
|
|
698
698
|
* @type {CustomEvent}
|
|
699
699
|
* @property {object} detail The event detail.
|
|
700
700
|
* @property {string} detail.dataid The data id.
|
|
701
|
-
* @property {string} detail.loadtype The load type: image
|
|
701
|
+
* @property {string} detail.loadtype The load type: image.
|
|
702
702
|
* @property {*} detail.source The load source: string for an url,
|
|
703
703
|
* File for a file.
|
|
704
704
|
* @property {number} detail.loaded The loaded percentage.
|
|
@@ -711,7 +711,7 @@ export declare class App extends EventTarget {
|
|
|
711
711
|
* @type {CustomEvent}
|
|
712
712
|
* @property {object} detail The event detail.
|
|
713
713
|
* @property {string} detail.dataid The data id.
|
|
714
|
-
* @property {string} detail.loadtype The load type: image
|
|
714
|
+
* @property {string} detail.loadtype The load type: image.
|
|
715
715
|
* @property {*} detail.source The load source: string for an url,
|
|
716
716
|
* File for a file.
|
|
717
717
|
* @property {object} detail.data The loaded meta data.
|
|
@@ -725,7 +725,7 @@ export declare class App extends EventTarget {
|
|
|
725
725
|
* @type {CustomEvent}
|
|
726
726
|
* @property {object} detail The event detail.
|
|
727
727
|
* @property {string} detail.dataid The data id.
|
|
728
|
-
* @property {string} detail.loadtype The load type: image
|
|
728
|
+
* @property {string} detail.loadtype The load type: image.
|
|
729
729
|
* @property {*} detail.source The load source: string for an url,
|
|
730
730
|
* File for a file.
|
|
731
731
|
*/
|
|
@@ -737,7 +737,7 @@ export declare class App extends EventTarget {
|
|
|
737
737
|
* @type {CustomEvent}
|
|
738
738
|
* @property {object} detail The event detail.
|
|
739
739
|
* @property {string} detail.dataid The data id.
|
|
740
|
-
* @property {string} detail.loadtype The load type: image
|
|
740
|
+
* @property {string} detail.loadtype The load type: image.
|
|
741
741
|
* @property {*} detail.source The load source: string for an url,
|
|
742
742
|
* File for a file.
|
|
743
743
|
*/
|
|
@@ -748,7 +748,7 @@ export declare class App extends EventTarget {
|
|
|
748
748
|
* @type {CustomEvent}
|
|
749
749
|
* @property {object} detail The event detail.
|
|
750
750
|
* @property {string} detail.dataid The data id.
|
|
751
|
-
* @property {string} detail.loadtype The load type: image
|
|
751
|
+
* @property {string} detail.loadtype The load type: image.
|
|
752
752
|
* @property {*} detail.source The load source: string for an url,
|
|
753
753
|
* File for a file.
|
|
754
754
|
* @property {object} detail.error The error.
|
|
@@ -761,7 +761,7 @@ export declare class App extends EventTarget {
|
|
|
761
761
|
* @type {CustomEvent}
|
|
762
762
|
* @property {object} detail The event detail.
|
|
763
763
|
* @property {string} detail.dataid The data id.
|
|
764
|
-
* @property {string} detail.loadtype The load type: image
|
|
764
|
+
* @property {string} detail.loadtype The load type: image.
|
|
765
765
|
* @property {*} detail.source The load source: an url as a string.
|
|
766
766
|
* @property {object} detail.target The event target.
|
|
767
767
|
*/
|
|
@@ -772,12 +772,12 @@ export declare class App extends EventTarget {
|
|
|
772
772
|
* @type {CustomEvent}
|
|
773
773
|
* @property {object} detail The event detail.
|
|
774
774
|
* @property {string} detail.dataid The data id.
|
|
775
|
-
* @property {string} detail.loadtype The load type: image
|
|
775
|
+
* @property {string} detail.loadtype The load type: image.
|
|
776
776
|
* @property {*} detail.source The load source: string for an url,
|
|
777
777
|
* File for a file.
|
|
778
778
|
*/
|
|
779
779
|
/**
|
|
780
|
-
* Load a list of
|
|
780
|
+
* Load a list of image files.
|
|
781
781
|
*
|
|
782
782
|
* @param {File[]} files The list of files to load.
|
|
783
783
|
* @returns {string} The data ID, '-1' if problem.
|
|
@@ -791,7 +791,7 @@ export declare class App extends EventTarget {
|
|
|
791
791
|
*/
|
|
792
792
|
loadFiles: (files: File[]) => string;
|
|
793
793
|
/**
|
|
794
|
-
* Load a list of
|
|
794
|
+
* Load a list of image URLs.
|
|
795
795
|
*
|
|
796
796
|
* @param {string[]} urls The list of urls to load.
|
|
797
797
|
* @param {object} [options] The options object, can contain:
|
|
@@ -1002,24 +1002,6 @@ export declare class App extends EventTarget {
|
|
|
1002
1002
|
* of the desired view layer directly.
|
|
1003
1003
|
*/
|
|
1004
1004
|
setOpacity(alpha: number): void;
|
|
1005
|
-
/**
|
|
1006
|
-
* Set the drawings of the active layer group.
|
|
1007
|
-
*
|
|
1008
|
-
* @deprecated Since v0.34, please switch to DICOM SR annotations.
|
|
1009
|
-
* @param {Array} drawings An array of drawings.
|
|
1010
|
-
* @param {Array} drawingsDetails An array of drawings details.
|
|
1011
|
-
* @param {string} dataId The converted data id.
|
|
1012
|
-
*/
|
|
1013
|
-
setDrawings(drawings: any[], drawingsDetails: any[], dataId: string): void;
|
|
1014
|
-
/**
|
|
1015
|
-
* Apply a JSON state to this app.
|
|
1016
|
-
*
|
|
1017
|
-
* @deprecated Since v0.34, please switch to DICOM SR
|
|
1018
|
-
* for annotations.
|
|
1019
|
-
* @param {string} jsonState The state of the app as a JSON string.
|
|
1020
|
-
* @param {string} dataId The state data id.
|
|
1021
|
-
*/
|
|
1022
|
-
applyJsonState(jsonState: string, dataId: string): void;
|
|
1023
1005
|
/**
|
|
1024
1006
|
* Handle resize: fit the display to the window.
|
|
1025
1007
|
* To be called once the image is loaded.
|
|
@@ -1275,7 +1257,7 @@ export declare class CADReport {
|
|
|
1275
1257
|
}
|
|
1276
1258
|
|
|
1277
1259
|
/**
|
|
1278
|
-
* @import {
|
|
1260
|
+
* @import {MaskImage} from '../image/maskImage.js';
|
|
1279
1261
|
* @import {MaskSegment} from '../dicom/dicomSegment.js';
|
|
1280
1262
|
* @import {RGB} from '../utils/colour.js';
|
|
1281
1263
|
*/
|
|
@@ -1284,12 +1266,12 @@ export declare class CADReport {
|
|
|
1284
1266
|
*/
|
|
1285
1267
|
export declare class ChangeSegmentColourCommand extends Command {
|
|
1286
1268
|
/**
|
|
1287
|
-
* @param {
|
|
1269
|
+
* @param {MaskImage} mask The mask image.
|
|
1288
1270
|
* @param {MaskSegment} segment The segment to modify.
|
|
1289
1271
|
* @param {RGB|number} newColour The new segment colour.
|
|
1290
1272
|
* @param {boolean} [silent] Whether to send a creation event or not.
|
|
1291
1273
|
*/
|
|
1292
|
-
constructor(mask:
|
|
1274
|
+
constructor(mask: MaskImage, segment: MaskSegment, newColour: RGB | number, silent?: boolean);
|
|
1293
1275
|
/**
|
|
1294
1276
|
* Check if a command is valid and can be executed.
|
|
1295
1277
|
*
|
|
@@ -1437,31 +1419,6 @@ export declare class Command {
|
|
|
1437
1419
|
undo(): void;
|
|
1438
1420
|
}
|
|
1439
1421
|
|
|
1440
|
-
/**
|
|
1441
|
-
* Create an Image from DICOM elements.
|
|
1442
|
-
*
|
|
1443
|
-
* @param {Record<string, DataElement>} elements The DICOM elements.
|
|
1444
|
-
* @returns {Image} The Image object.
|
|
1445
|
-
*/
|
|
1446
|
-
export declare function createImage(elements: Record<string, DataElement>): Image_2;
|
|
1447
|
-
|
|
1448
|
-
/**
|
|
1449
|
-
* Create a mask Image from DICOM elements.
|
|
1450
|
-
*
|
|
1451
|
-
* @param {Record<string, DataElement>} elements The DICOM elements.
|
|
1452
|
-
* @returns {Image} The mask Image object.
|
|
1453
|
-
*/
|
|
1454
|
-
export declare function createMaskImage(elements: Record<string, DataElement>): Image_2;
|
|
1455
|
-
|
|
1456
|
-
/**
|
|
1457
|
-
* Create a View from DICOM elements and image.
|
|
1458
|
-
*
|
|
1459
|
-
* @param {Record<string, DataElement>} elements The DICOM elements.
|
|
1460
|
-
* @param {Image} image The associated image.
|
|
1461
|
-
* @returns {View} The View object.
|
|
1462
|
-
*/
|
|
1463
|
-
export declare function createView(elements: Record<string, DataElement>, image: Image_2): View;
|
|
1464
|
-
|
|
1465
1422
|
export declare namespace custom {
|
|
1466
1423
|
let wlPresets: Record<string, Record<string, WindowLevel>>;
|
|
1467
1424
|
let labelTexts: Record<string, Record<string, string>>;
|
|
@@ -1658,7 +1615,7 @@ export declare const defaultToolList: Record<string, any>;
|
|
|
1658
1615
|
export declare const defaultToolOptions: Record<string, Record<string, any>>;
|
|
1659
1616
|
|
|
1660
1617
|
/**
|
|
1661
|
-
* @import {
|
|
1618
|
+
* @import {MaskImage} from '../image/maskImage.js';
|
|
1662
1619
|
* @import {MaskSegment} from '../dicom/dicomSegment.js';
|
|
1663
1620
|
*/
|
|
1664
1621
|
/**
|
|
@@ -1666,11 +1623,11 @@ export declare const defaultToolOptions: Record<string, Record<string, any>>;
|
|
|
1666
1623
|
*/
|
|
1667
1624
|
export declare class DeleteSegmentCommand extends Command {
|
|
1668
1625
|
/**
|
|
1669
|
-
* @param {
|
|
1626
|
+
* @param {MaskImage} mask The mask image.
|
|
1670
1627
|
* @param {MaskSegment} segment The segment to remove.
|
|
1671
1628
|
* @param {boolean} [silent] Whether to send a creation event or not.
|
|
1672
1629
|
*/
|
|
1673
|
-
constructor(mask:
|
|
1630
|
+
constructor(mask: MaskImage, segment: MaskSegment, silent?: boolean);
|
|
1674
1631
|
/**
|
|
1675
1632
|
* Check if a command is valid and can be executed.
|
|
1676
1633
|
*
|
|
@@ -1692,6 +1649,41 @@ export declare class DeleteSegmentCommand extends Command {
|
|
|
1692
1649
|
#private;
|
|
1693
1650
|
}
|
|
1694
1651
|
|
|
1652
|
+
/**
|
|
1653
|
+
* Demo Image creation from DICOM elements: takes
|
|
1654
|
+
* elements and first element of the pixel buffer
|
|
1655
|
+
* to create an image.
|
|
1656
|
+
*
|
|
1657
|
+
* Warning: not to be used in production code.
|
|
1658
|
+
*
|
|
1659
|
+
* @param {Record<string, DataElement>} elements The DICOM elements.
|
|
1660
|
+
* @returns {Image} The Image object.
|
|
1661
|
+
*/
|
|
1662
|
+
export declare function demoCreateImage(elements: Record<string, DataElement>): Image_2;
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* Demo mask Image creation from DICOM elements: takes
|
|
1666
|
+
* elements and first element of the pixel buffer
|
|
1667
|
+
* to create an image.
|
|
1668
|
+
*
|
|
1669
|
+
* Warning: not to be used in production code.
|
|
1670
|
+
*
|
|
1671
|
+
* @param {Record<string, DataElement>} elements The DICOM elements.
|
|
1672
|
+
* @returns {MaskImage} The mask Image object.
|
|
1673
|
+
*/
|
|
1674
|
+
export declare function demoCreateMaskImage(elements: Record<string, DataElement>): MaskImage;
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* Demo View creation from DICOM elements and image.
|
|
1678
|
+
*
|
|
1679
|
+
* Warning: not to be used in production code.
|
|
1680
|
+
*
|
|
1681
|
+
* @param {Record<string, DataElement>} elements The DICOM elements.
|
|
1682
|
+
* @param {Image} image The associated image.
|
|
1683
|
+
* @returns {View} The View object.
|
|
1684
|
+
*/
|
|
1685
|
+
export declare function demoCreateView(elements: Record<string, DataElement>, image: Image_2): View;
|
|
1686
|
+
|
|
1695
1687
|
/**
|
|
1696
1688
|
* @import {Point} from '../math/point.js';
|
|
1697
1689
|
* @import {NumberValue} from '../math/number.js';
|
|
@@ -1826,6 +1818,14 @@ export declare class DicomData {
|
|
|
1826
1818
|
* @type {number}
|
|
1827
1819
|
*/
|
|
1828
1820
|
numberOfFiles: number;
|
|
1821
|
+
/**
|
|
1822
|
+
* Frame number, set when the buffer only contains one frame
|
|
1823
|
+
* of a multi-frame data: frames are sent one by one and assembled
|
|
1824
|
+
* by the image (see Image.appendSlice).
|
|
1825
|
+
*
|
|
1826
|
+
* @type {number|undefined}
|
|
1827
|
+
*/
|
|
1828
|
+
frameNumber: number | undefined;
|
|
1829
1829
|
/**
|
|
1830
1830
|
* List of data creation warning.
|
|
1831
1831
|
*
|
|
@@ -2105,13 +2105,13 @@ export declare class DrawBrushCommand extends Command {
|
|
|
2105
2105
|
}
|
|
2106
2106
|
|
|
2107
2107
|
/**
|
|
2108
|
-
* @import {
|
|
2108
|
+
* @import {MaskImage} from '../image/maskImage.js';
|
|
2109
2109
|
*/
|
|
2110
2110
|
export declare class DrawBrushCommandProperties {
|
|
2111
2111
|
/**
|
|
2112
|
-
* @type {
|
|
2112
|
+
* @type {MaskImage}
|
|
2113
2113
|
*/
|
|
2114
|
-
mask:
|
|
2114
|
+
mask: MaskImage;
|
|
2115
2115
|
/**
|
|
2116
2116
|
* @type {string}
|
|
2117
2117
|
*/
|
|
@@ -2244,8 +2244,10 @@ export declare class DrawController {
|
|
|
2244
2244
|
* @import {Point, Point3D} from '../math/point.js';
|
|
2245
2245
|
* @import {Vector3D} from '../math/vector.js';
|
|
2246
2246
|
* @import {Scalar2D, Scalar3D} from '../math/scalar.js';
|
|
2247
|
+
* @import {Index} from '../math/index.js';
|
|
2247
2248
|
* @import {Image} from '../image/image.js';
|
|
2248
2249
|
* @import {PlaneHelper} from '../image/planeHelper.js';
|
|
2250
|
+
* @import {Annotation} from '../image/annotation.js';
|
|
2249
2251
|
* @import {AnnotationGroup} from '../image/annotationGroup.js';
|
|
2250
2252
|
* @import {DrawShapeHandler} from '../tools/shapes/drawShapeHandler.js';
|
|
2251
2253
|
*/
|
|
@@ -2788,7 +2790,7 @@ export declare class Geometry {
|
|
|
2788
2790
|
*/
|
|
2789
2791
|
getOrientation(): Matrix33;
|
|
2790
2792
|
/**
|
|
2791
|
-
* Get the slice position of
|
|
2793
|
+
* Get the slice position of an origin in the current slice layout.
|
|
2792
2794
|
* Slice indices increase with decreasing origins (high index -> low origin),
|
|
2793
2795
|
* this simplified the handling of reconstruction since it means
|
|
2794
2796
|
* the displayed data is in the same 'direction' as the extracted data.
|
|
@@ -2796,11 +2798,25 @@ export declare class Geometry {
|
|
|
2796
2798
|
* This implies that the index to world and reverse method do some flipping
|
|
2797
2799
|
* magic...
|
|
2798
2800
|
*
|
|
2799
|
-
*
|
|
2801
|
+
* Limitation: the codirectional (before/after) refinement below is a
|
|
2802
|
+
* strict sign check on the normal-projected residual, with no
|
|
2803
|
+
* tolerance - unlike worldToIndex's magnitude-based half-spacing
|
|
2804
|
+
* gate. That is safe for this method's one real caller
|
|
2805
|
+
* (Image#appendSlice, which only ever compares exact, already-known
|
|
2806
|
+
* slice origins - a clean, large residual, never close to zero),
|
|
2807
|
+
* but this method should not be used for an arbitrary point with a
|
|
2808
|
+
* large in-plane offset from its closest origin (eg a click
|
|
2809
|
+
* position): float noise in that offset, amplified by a
|
|
2810
|
+
* lower-precision orientation (eg gantry-tilt direction cosines
|
|
2811
|
+
* with few decimal digits), can flip the sign of a residual that
|
|
2812
|
+
* should be exactly zero. Use worldToIndex (or a plain
|
|
2813
|
+
* Point3D#getClosest) instead for that case.
|
|
2814
|
+
*
|
|
2815
|
+
* @param {Point3D} origin The origin to locate.
|
|
2800
2816
|
* @param {number} [time] Optional time index.
|
|
2801
2817
|
* @returns {number} The slice index.
|
|
2802
2818
|
*/
|
|
2803
|
-
getSliceIndex(
|
|
2819
|
+
getSliceIndex(origin: Point3D, time?: number): number;
|
|
2804
2820
|
/**
|
|
2805
2821
|
* Check if another geometry is compatible with this one, ie that
|
|
2806
2822
|
* slices with these geometries can be merged into one volume.
|
|
@@ -2810,15 +2826,6 @@ export declare class Geometry {
|
|
|
2810
2826
|
* the geometry is compatible.
|
|
2811
2827
|
*/
|
|
2812
2828
|
canAppendSlice(rhs: Geometry): BooleanResult;
|
|
2813
|
-
/**
|
|
2814
|
-
* Check if another geometry (describing a whole volume, not just
|
|
2815
|
-
* one slice) can be appended to this one as a new time point.
|
|
2816
|
-
*
|
|
2817
|
-
* @param {Geometry} rhs The geometry to check.
|
|
2818
|
-
* @returns {BooleanResult} Result with success set to true if
|
|
2819
|
-
* the geometry is compatible.
|
|
2820
|
-
*/
|
|
2821
|
-
canAppendVolume(rhs: Geometry): BooleanResult;
|
|
2822
2829
|
/**
|
|
2823
2830
|
* Check if an origin can be appended to this geometry.
|
|
2824
2831
|
*
|
|
@@ -2843,17 +2850,6 @@ export declare class Geometry {
|
|
|
2843
2850
|
* @param {number} time Optional time index.
|
|
2844
2851
|
*/
|
|
2845
2852
|
appendFrame(origin: Point3D, time: number): void;
|
|
2846
|
-
/**
|
|
2847
|
-
* Append a whole volume (one full set of slice origins) to the
|
|
2848
|
-
* geometry as a new time point. Unlike `appendFrame`, which only
|
|
2849
|
-
* stores a single origin per new time, this stores all of them
|
|
2850
|
-
* (for example when merging several complete multi-frame 3D
|
|
2851
|
-
* datasets into one 4D volume, one dataset per time point).
|
|
2852
|
-
*
|
|
2853
|
-
* @param {Point3D[]} origins The origins of the volume, one per slice.
|
|
2854
|
-
* @param {number} time The time index for this volume.
|
|
2855
|
-
*/
|
|
2856
|
-
appendVolume(origins: Point3D[], time: number): void;
|
|
2857
2853
|
/**
|
|
2858
2854
|
* Get a string representation of the geometry.
|
|
2859
2855
|
*
|
|
@@ -2916,6 +2912,18 @@ export declare class Geometry {
|
|
|
2916
2912
|
/**
|
|
2917
2913
|
* Convert world coordinates into an index.
|
|
2918
2914
|
*
|
|
2915
|
+
* Always returns an index, even for a point outside the geometry:
|
|
2916
|
+
* this does not itself mean the point is in bounds, use
|
|
2917
|
+
* isIndexInBounds/isInBounds for that. In-plane (row/column), an
|
|
2918
|
+
* out-of-bounds point extrapolates freely (eg -5 or size+12). On the
|
|
2919
|
+
* scroll axis, a point close to a real per-slice origin snaps to it;
|
|
2920
|
+
* further away, it is pinned to just past the first/last known
|
|
2921
|
+
* origin (ie the origins array length, or -1) rather than left to
|
|
2922
|
+
* drift arbitrarily far via linear extrapolation - except when there
|
|
2923
|
+
* are few or no real origins to compare against (eg a root geometry
|
|
2924
|
+
* with only its first slice known), where it still falls back to
|
|
2925
|
+
* that unclamped extrapolation.
|
|
2926
|
+
*
|
|
2919
2927
|
* @param {Point} point The point to convert.
|
|
2920
2928
|
* @returns {Index} The corresponding index.
|
|
2921
2929
|
*/
|
|
@@ -3229,14 +3237,14 @@ export declare namespace i18n {
|
|
|
3229
3237
|
* - planar configuration (default RGBRGB...).
|
|
3230
3238
|
*
|
|
3231
3239
|
* @example
|
|
3232
|
-
* import {DicomParser,
|
|
3240
|
+
* import {DicomParser, demoCreateImage} from '//esm.sh/dwv';
|
|
3233
3241
|
* // XMLHttpRequest onload callback
|
|
3234
3242
|
* const onload = function (event) {
|
|
3235
3243
|
* // parse the dicom buffer
|
|
3236
3244
|
* const dicomParser = new DicomParser();
|
|
3237
3245
|
* dicomParser.parse(event.target.response);
|
|
3238
3246
|
* // create the image object
|
|
3239
|
-
* const image =
|
|
3247
|
+
* const image = demoCreateImage(dicomParser.getDicomElements());
|
|
3240
3248
|
* // result div
|
|
3241
3249
|
* const div = document.getElementById('dwv');
|
|
3242
3250
|
* // display the image size
|
|
@@ -3280,26 +3288,19 @@ declare class Image_2 extends EventTarget {
|
|
|
3280
3288
|
*/
|
|
3281
3289
|
getComplete(): boolean;
|
|
3282
3290
|
/**
|
|
3283
|
-
*
|
|
3284
|
-
*
|
|
3285
|
-
*/
|
|
3286
|
-
setupSegmentCollection(): void;
|
|
3287
|
-
/**
|
|
3288
|
-
* Set the segment collection.
|
|
3291
|
+
* Get the initial index, used as default position by views:
|
|
3292
|
+
* the middle of the image (first frame for 4D).
|
|
3289
3293
|
*
|
|
3290
|
-
* @
|
|
3291
|
-
*/
|
|
3292
|
-
setSegmentCollection(collection: SegmentCollection): void;
|
|
3293
|
-
/**
|
|
3294
|
-
* Get the segment collection.
|
|
3295
|
-
*
|
|
3296
|
-
* @returns {SegmentCollection|undefined} The segment collection.
|
|
3294
|
+
* @returns {Index} The index.
|
|
3297
3295
|
*/
|
|
3298
|
-
|
|
3296
|
+
getInitialIndex(): Index;
|
|
3299
3297
|
/**
|
|
3300
|
-
* Check whether the
|
|
3298
|
+
* Check whether the image has overlapping segments. Always false for a
|
|
3299
|
+
* plain image; {@link MaskImage} overrides this with a real check.
|
|
3301
3300
|
*
|
|
3302
|
-
* @returns {boolean}
|
|
3301
|
+
* @returns {boolean} False.
|
|
3302
|
+
* @deprecated Since v0.37, please use `instanceof MaskImage` and
|
|
3303
|
+
* `MaskImage#getHasOverlap` instead.
|
|
3303
3304
|
*/
|
|
3304
3305
|
getHasOverlap(): boolean;
|
|
3305
3306
|
/**
|
|
@@ -3366,14 +3367,9 @@ declare class Image_2 extends EventTarget {
|
|
|
3366
3367
|
* Check is the image is a mask.
|
|
3367
3368
|
*
|
|
3368
3369
|
* @returns {boolean} True if mask.
|
|
3370
|
+
* @deprecated Since v0.37, please use `instanceof MaskImage` instead.
|
|
3369
3371
|
*/
|
|
3370
3372
|
isMask(): boolean;
|
|
3371
|
-
/**
|
|
3372
|
-
* Get the UID of the series referenced by the mask, if any.
|
|
3373
|
-
*
|
|
3374
|
-
* @returns {string|undefined} The UID.
|
|
3375
|
-
*/
|
|
3376
|
-
getMaskReferencedSeriesUID(): string | undefined;
|
|
3377
3373
|
/**
|
|
3378
3374
|
* Can the data be scrolled?
|
|
3379
3375
|
*
|
|
@@ -3485,14 +3481,6 @@ declare class Image_2 extends EventTarget {
|
|
|
3485
3481
|
* @returns {number} The value at offset.
|
|
3486
3482
|
*/
|
|
3487
3483
|
getValueAtOffset(offset: number): number;
|
|
3488
|
-
/**
|
|
3489
|
-
* Get the offsets where the buffer equals the input value.
|
|
3490
|
-
* Loops through the whole volume, can get long for big data...
|
|
3491
|
-
*
|
|
3492
|
-
* @param {number|RGB} value The value to check.
|
|
3493
|
-
* @returns {number[]} The list of offsets.
|
|
3494
|
-
*/
|
|
3495
|
-
getOffsets(value: number | RGB): number[];
|
|
3496
3484
|
/**
|
|
3497
3485
|
* Check if the input values are in the buffer.
|
|
3498
3486
|
* Could loop through the whole volume, can get long for big data...
|
|
@@ -3509,22 +3497,22 @@ declare class Image_2 extends EventTarget {
|
|
|
3509
3497
|
*/
|
|
3510
3498
|
clone(): Image_2;
|
|
3511
3499
|
/**
|
|
3512
|
-
*
|
|
3500
|
+
* Replace the inner buffer wholesale (as opposed to editing its content
|
|
3501
|
+
* in place). Primarily intended for subclass use, where a private
|
|
3502
|
+
* (`#`) field on this class isn't reachable directly.
|
|
3513
3503
|
*
|
|
3514
|
-
* @param {
|
|
3515
|
-
* @
|
|
3516
|
-
* the image can be appended.
|
|
3504
|
+
* @param {TypedArray} newBuffer The new buffer.
|
|
3505
|
+
* @fires Image#imagecontentchange
|
|
3517
3506
|
*/
|
|
3518
|
-
|
|
3507
|
+
replaceBuffer(newBuffer: Int8Array | Uint8Array | Int16Array | Uint16Array | Int32Array | Uint32Array): void;
|
|
3519
3508
|
/**
|
|
3520
|
-
* Check if another
|
|
3521
|
-
* appended to this one as a new time point.
|
|
3509
|
+
* Check if another image can be appended to this one.
|
|
3522
3510
|
*
|
|
3523
3511
|
* @param {Image} rhs The image to check.
|
|
3524
3512
|
* @returns {BooleanResult} Result with success set to true if
|
|
3525
3513
|
* the image can be appended.
|
|
3526
3514
|
*/
|
|
3527
|
-
|
|
3515
|
+
canAppendSlice(rhs: Image_2): BooleanResult;
|
|
3528
3516
|
/**
|
|
3529
3517
|
* Append a slice to the image.
|
|
3530
3518
|
*
|
|
@@ -3532,19 +3520,6 @@ declare class Image_2 extends EventTarget {
|
|
|
3532
3520
|
* @fires Image#imagegeometrychange
|
|
3533
3521
|
*/
|
|
3534
3522
|
appendSlice(rhs: Image_2): void;
|
|
3535
|
-
/**
|
|
3536
|
-
* Append a whole compatible image as a new time point (for example
|
|
3537
|
-
* merging several complete multi-frame 3D datasets into one 4D
|
|
3538
|
-
* volume, one dataset per time point). The time point is taken from
|
|
3539
|
-
* `rhs`'s geometry (`getInitialTime()`, typically tag-derived, for
|
|
3540
|
-
* example from TemporalPositionIndex) and can be out of arrival
|
|
3541
|
-
* order; unlike `appendSlice`, `rhs` here is a whole volume (more
|
|
3542
|
-
* than one slice), not a single 2D slice.
|
|
3543
|
-
*
|
|
3544
|
-
* @param {Image} rhs The image to append.
|
|
3545
|
-
* @fires Image#imagegeometrychange
|
|
3546
|
-
*/
|
|
3547
|
-
appendVolume(rhs: Image_2): void;
|
|
3548
3523
|
/**
|
|
3549
3524
|
* Append a frame buffer to the image.
|
|
3550
3525
|
*
|
|
@@ -3577,34 +3552,6 @@ declare class Image_2 extends EventTarget {
|
|
|
3577
3552
|
* @returns {Array} The histogram.
|
|
3578
3553
|
*/
|
|
3579
3554
|
getHistogram(): any[];
|
|
3580
|
-
/**
|
|
3581
|
-
* Set the inner buffer values at given offsets.
|
|
3582
|
-
*
|
|
3583
|
-
* @param {number[]} offsets List of offsets where to set the data.
|
|
3584
|
-
* @param {number|RGB} value The value to set at the given offsets.
|
|
3585
|
-
* @fires Image#imagecontentchange
|
|
3586
|
-
*/
|
|
3587
|
-
setAtOffsets(offsets: number[], value: number | RGB): void;
|
|
3588
|
-
/**
|
|
3589
|
-
* Set the inner buffer values at given offsets.
|
|
3590
|
-
*
|
|
3591
|
-
* @param {number[][]} offsetsLists List of offset lists where
|
|
3592
|
-
* to set the data.
|
|
3593
|
-
* @param {number} value The value to set at the given offsets.
|
|
3594
|
-
* @returns {Array} A list of objects representing the original values before
|
|
3595
|
-
* replacing them.
|
|
3596
|
-
* @fires Image#imagecontentchange
|
|
3597
|
-
*/
|
|
3598
|
-
setAtOffsetsAndGetOriginals(offsetsLists: number[][], value: number): any[];
|
|
3599
|
-
/**
|
|
3600
|
-
* Set the inner buffer values at given offsets.
|
|
3601
|
-
*
|
|
3602
|
-
* @param {number[][]} offsetsLists List of offset lists
|
|
3603
|
-
* where to set the data.
|
|
3604
|
-
* @param {number|Array} value The value to set at the given offsets.
|
|
3605
|
-
* @fires Image#imagecontentchange
|
|
3606
|
-
*/
|
|
3607
|
-
setAtOffsetsWithIterator(offsetsLists: number[][], value: number | any[]): void;
|
|
3608
3555
|
/**
|
|
3609
3556
|
* Get the value of the image at a specific coordinate.
|
|
3610
3557
|
*
|
|
@@ -3709,27 +3656,6 @@ declare class Image_2 extends EventTarget {
|
|
|
3709
3656
|
* Note: Uses the raw buffer values.
|
|
3710
3657
|
*/
|
|
3711
3658
|
compose(rhs: Image_2, operator: Function): Image_2;
|
|
3712
|
-
/**
|
|
3713
|
-
* Initialize the contour buffer.
|
|
3714
|
-
* Should be called on every segmentation image, or any image where
|
|
3715
|
-
* contour rendering needs to be supported.
|
|
3716
|
-
*/
|
|
3717
|
-
initializeContour(): void;
|
|
3718
|
-
/**
|
|
3719
|
-
* Get the image contour. Should only be available
|
|
3720
|
-
* for segmentation images, but can be initialized
|
|
3721
|
-
* for any Uint8Array image.
|
|
3722
|
-
*
|
|
3723
|
-
* @returns {ImageContour} The image contour.
|
|
3724
|
-
*/
|
|
3725
|
-
getContour(): ImageContour;
|
|
3726
|
-
/**
|
|
3727
|
-
* Recalculate labels.
|
|
3728
|
-
*
|
|
3729
|
-
* @fires Image#labelingstart
|
|
3730
|
-
* @fires Image#labelschanged
|
|
3731
|
-
*/
|
|
3732
|
-
recalculateLabels(): void;
|
|
3733
3659
|
/**
|
|
3734
3660
|
* Return if this image has been resampled.
|
|
3735
3661
|
*
|
|
@@ -4527,26 +4453,134 @@ export declare class MaskFactory {
|
|
|
4527
4453
|
*/
|
|
4528
4454
|
checkElements(_dicomElements: Record<string, DataElement>): string | undefined;
|
|
4529
4455
|
/**
|
|
4530
|
-
* Get
|
|
4456
|
+
* Get a {@link MaskImage} object from the read DICOM file.
|
|
4531
4457
|
*
|
|
4532
4458
|
* @param {Record<string, DataElement>} dataElements The DICOM tags.
|
|
4533
4459
|
* @param {Uint8Array} pixelBuffer The pixel buffer.
|
|
4534
4460
|
* @param {Image} [refImage] Reference image, code will use its
|
|
4535
4461
|
* origins if present (best) or try to calculate them.
|
|
4536
|
-
* @returns {
|
|
4462
|
+
* @returns {MaskImage} A new mask image.
|
|
4537
4463
|
* @throws {Error} Error for missing or wrong data.
|
|
4538
4464
|
*/
|
|
4539
|
-
create(dataElements: Record<string, DataElement>, pixelBuffer: Uint8Array, refImage?: Image_2):
|
|
4465
|
+
create(dataElements: Record<string, DataElement>, pixelBuffer: Uint8Array, refImage?: Image_2): MaskImage;
|
|
4540
4466
|
/**
|
|
4541
4467
|
* Convert a mask image into a DICOM segmentation object.
|
|
4542
4468
|
*
|
|
4543
|
-
* @param {
|
|
4469
|
+
* @param {MaskImage} image The mask image.
|
|
4544
4470
|
* @param {MaskSegment[]} segments The mask segments.
|
|
4545
4471
|
* @param {Image} sourceImage The source image.
|
|
4546
4472
|
* @param {SimpleTagValues} [extraTags] Optional list of extra tags.
|
|
4547
4473
|
* @returns {Record<string, DataElement>} A list of dicom elements.
|
|
4548
4474
|
*/
|
|
4549
|
-
toDicom(image:
|
|
4475
|
+
toDicom(image: MaskImage, segments: MaskSegment[], sourceImage: Image_2, extraTags?: SimpleTagValues): Record<string, DataElement>;
|
|
4476
|
+
#private;
|
|
4477
|
+
}
|
|
4478
|
+
|
|
4479
|
+
/**
|
|
4480
|
+
* Mask (segmentation) image class.
|
|
4481
|
+
* Extends {@link Image} with a {@link SegmentCollection} and the
|
|
4482
|
+
* segment-aware behavior built on top of it: per-segment/per-slice
|
|
4483
|
+
* bookkeeping, the brush tool's offset-editing methods, and per-segment
|
|
4484
|
+
* labeling statistics (volume/centroid/diameter).
|
|
4485
|
+
*/
|
|
4486
|
+
export declare class MaskImage extends Image_2 {
|
|
4487
|
+
/**
|
|
4488
|
+
* @param {Geometry} geometry The geometry of the image.
|
|
4489
|
+
* @param {Uint8Array} buffer The mask data as a one dimensional buffer:
|
|
4490
|
+
* one byte per voxel, 0 for background, the segment number otherwise.
|
|
4491
|
+
* @param {string[]} [imageUids] An array of Uids indexed to slice number.
|
|
4492
|
+
* @param {SegmentCollection} [segmentCollection] The segment collection,
|
|
4493
|
+
* for a mask already parsed from DICOM (its own label map already
|
|
4494
|
+
* aliases `buffer`). When omitted (brush-created masks), a fresh
|
|
4495
|
+
* collection is created and its label map is aliased to `buffer`.
|
|
4496
|
+
*/
|
|
4497
|
+
constructor(geometry: Geometry, buffer: Uint8Array, imageUids?: string[], segmentCollection?: SegmentCollection);
|
|
4498
|
+
/**
|
|
4499
|
+
* Initialize the contour buffer.
|
|
4500
|
+
* Should be called on every segmentation image, or any image where
|
|
4501
|
+
* contour rendering needs to be supported.
|
|
4502
|
+
*/
|
|
4503
|
+
initializeContour(): void;
|
|
4504
|
+
/**
|
|
4505
|
+
* Get the image contour. Should only be available
|
|
4506
|
+
* for segmentation images, but can be initialized
|
|
4507
|
+
* for any Uint8Array image.
|
|
4508
|
+
*
|
|
4509
|
+
* @returns {ImageContour} The image contour.
|
|
4510
|
+
*/
|
|
4511
|
+
getContour(): ImageContour;
|
|
4512
|
+
/**
|
|
4513
|
+
* Get the segment collection.
|
|
4514
|
+
*
|
|
4515
|
+
* @returns {SegmentCollection} The segment collection.
|
|
4516
|
+
*/
|
|
4517
|
+
getSegmentCollection(): SegmentCollection;
|
|
4518
|
+
/**
|
|
4519
|
+
* Get the UID of the series referenced by the mask, if any.
|
|
4520
|
+
*
|
|
4521
|
+
* @returns {string|undefined} The UID.
|
|
4522
|
+
*/
|
|
4523
|
+
getMaskReferencedSeriesUID(): string | undefined;
|
|
4524
|
+
/**
|
|
4525
|
+
* Get the offsets where the buffer equals the input value.
|
|
4526
|
+
* Loops through the whole volume, can get long for big data...
|
|
4527
|
+
*
|
|
4528
|
+
* @param {number|RGB} value The value to check.
|
|
4529
|
+
* @returns {number[]} The list of offsets.
|
|
4530
|
+
*/
|
|
4531
|
+
getOffsets(value: number | RGB): number[];
|
|
4532
|
+
/**
|
|
4533
|
+
* Set the inner buffer values at given offsets.
|
|
4534
|
+
*
|
|
4535
|
+
* @param {number[]} offsets List of offsets where to set the data.
|
|
4536
|
+
* @param {number|RGB} value The value to set at the given offsets.
|
|
4537
|
+
* @fires Image#imagecontentchange
|
|
4538
|
+
*/
|
|
4539
|
+
setAtOffsets(offsets: number[], value: number | RGB): void;
|
|
4540
|
+
/**
|
|
4541
|
+
* Set the inner buffer values at given offsets, each to its own value.
|
|
4542
|
+
* Used when a single uniform value cannot be used across all offsets,
|
|
4543
|
+
* for example restoring the segment still present at a voxel that used
|
|
4544
|
+
* to be hidden by an overlapping, now deleted, segment.
|
|
4545
|
+
*
|
|
4546
|
+
* @param {number[]} offsets List of offsets where to set the data.
|
|
4547
|
+
* @param {number[]} values Per-offset values, same length as offsets.
|
|
4548
|
+
* @fires Image#imagecontentchange
|
|
4549
|
+
*/
|
|
4550
|
+
setAtOffsetsWithValues(offsets: number[], values: number[]): void;
|
|
4551
|
+
/**
|
|
4552
|
+
* Set the inner buffer values at given offsets.
|
|
4553
|
+
*
|
|
4554
|
+
* @param {number[][]} offsetsLists List of offset lists where
|
|
4555
|
+
* to set the data.
|
|
4556
|
+
* @param {number} value The value to set at the given offsets.
|
|
4557
|
+
* @returns {Array} A list of objects representing the original values before
|
|
4558
|
+
* replacing them.
|
|
4559
|
+
* @fires Image#imagecontentchange
|
|
4560
|
+
*/
|
|
4561
|
+
setAtOffsetsAndGetOriginals(offsetsLists: number[][], value: number): any[];
|
|
4562
|
+
/**
|
|
4563
|
+
* Set the inner buffer values at given offsets.
|
|
4564
|
+
*
|
|
4565
|
+
* @param {number[][]} offsetsLists List of offset lists
|
|
4566
|
+
* where to set the data.
|
|
4567
|
+
* @param {number|Array} value The value to set at the given offsets.
|
|
4568
|
+
* @fires Image#imagecontentchange
|
|
4569
|
+
*/
|
|
4570
|
+
setAtOffsetsWithIterator(offsetsLists: number[][], value: number | any[]): void;
|
|
4571
|
+
/**
|
|
4572
|
+
* Recalculate labels.
|
|
4573
|
+
*
|
|
4574
|
+
* @fires Image#labelingstart
|
|
4575
|
+
* @fires Image#labelschanged
|
|
4576
|
+
*/
|
|
4577
|
+
recalculateLabels(): void;
|
|
4578
|
+
/**
|
|
4579
|
+
* Clone the mask image.
|
|
4580
|
+
*
|
|
4581
|
+
* @returns {MaskImage} A clone of this mask image.
|
|
4582
|
+
*/
|
|
4583
|
+
clone(): MaskImage;
|
|
4550
4584
|
#private;
|
|
4551
4585
|
}
|
|
4552
4586
|
|
|
@@ -4639,7 +4673,7 @@ export declare class MaskSegment {
|
|
|
4639
4673
|
}
|
|
4640
4674
|
|
|
4641
4675
|
/**
|
|
4642
|
-
* @import {
|
|
4676
|
+
* @import {MaskImage} from './maskImage.js';
|
|
4643
4677
|
* @import {MaskSegment} from '../dicom/dicomSegment.js';
|
|
4644
4678
|
*/
|
|
4645
4679
|
/**
|
|
@@ -4649,15 +4683,15 @@ export declare class MaskSegment {
|
|
|
4649
4683
|
*/
|
|
4650
4684
|
export declare class MaskSegmentHelper {
|
|
4651
4685
|
/**
|
|
4652
|
-
* @param {
|
|
4686
|
+
* @param {MaskImage} mask The associated mask image.
|
|
4653
4687
|
*/
|
|
4654
|
-
constructor(mask:
|
|
4688
|
+
constructor(mask: MaskImage);
|
|
4655
4689
|
/**
|
|
4656
4690
|
* Get the associated mask image.
|
|
4657
4691
|
*
|
|
4658
|
-
* @returns {
|
|
4692
|
+
* @returns {MaskImage} The mask image.
|
|
4659
4693
|
*/
|
|
4660
|
-
getMask():
|
|
4694
|
+
getMask(): MaskImage;
|
|
4661
4695
|
/**
|
|
4662
4696
|
* Check if a segment is part of the segments list.
|
|
4663
4697
|
*
|
|
@@ -4955,11 +4989,11 @@ export declare class Matrix33 {
|
|
|
4955
4989
|
* The returned image can be saved with the standard
|
|
4956
4990
|
* `new MaskFactory().toDicom(merged, undefined, sourceImage)` workflow.
|
|
4957
4991
|
*
|
|
4958
|
-
* @param {
|
|
4959
|
-
* @param {
|
|
4960
|
-
* @returns {
|
|
4992
|
+
* @param {MaskImage} mask1 The first mask (provides meta).
|
|
4993
|
+
* @param {MaskImage} mask2 The second mask to merge into mask1.
|
|
4994
|
+
* @returns {MaskImage} The new merged mask image.
|
|
4961
4995
|
*/
|
|
4962
|
-
export declare function mergeMaskImages(mask1:
|
|
4996
|
+
export declare function mergeMaskImages(mask1: MaskImage, mask2: MaskImage): MaskImage;
|
|
4963
4997
|
|
|
4964
4998
|
/**
|
|
4965
4999
|
* Merge a simple tag value list into another. Mutates the
|
|
@@ -5950,7 +5984,7 @@ export declare class RtStructFactory {
|
|
|
5950
5984
|
*/
|
|
5951
5985
|
checkElements(_dataElements: Record<string, DataElement>): string | undefined;
|
|
5952
5986
|
/**
|
|
5953
|
-
* Get a
|
|
5987
|
+
* Get a {@link MaskImage} from RTSTRUCT DICOM elements.
|
|
5954
5988
|
*
|
|
5955
5989
|
* Contours are rasterized into a Uint8Array whose voxel values are
|
|
5956
5990
|
* segment numbers (0 = background, 1..N = ROI index).
|
|
@@ -5959,25 +5993,25 @@ export declare class RtStructFactory {
|
|
|
5959
5993
|
*
|
|
5960
5994
|
* @param {Record<string, DataElement>} dataElements The DICOM data elements.
|
|
5961
5995
|
* @param {Image} refImage The reference image (CT/MR) that was loaded first.
|
|
5962
|
-
* @returns {
|
|
5996
|
+
* @returns {MaskImage} The mask image.
|
|
5963
5997
|
* @throws {Error} If the reference image geometry cannot be used.
|
|
5964
5998
|
*/
|
|
5965
|
-
create(dataElements: Record<string, DataElement>, refImage: Image_2):
|
|
5999
|
+
create(dataElements: Record<string, DataElement>, refImage: Image_2): MaskImage;
|
|
5966
6000
|
/**
|
|
5967
|
-
* Convert a
|
|
6001
|
+
* Convert a {@link MaskImage} into DICOM RT Structure Set elements.
|
|
5968
6002
|
*
|
|
5969
6003
|
* Traces each segment's pixel regions per slice using Moore neighborhood
|
|
5970
6004
|
* contour tracing, simplifies with Ramer-Douglas-Peucker, then maps the
|
|
5971
6005
|
* 2D pixel coordinates back to 3D patient-space coordinates.
|
|
5972
6006
|
*
|
|
5973
|
-
* @param {
|
|
6007
|
+
* @param {MaskImage} image The mask image.
|
|
5974
6008
|
* @param {MaskSegment[]} [segments] The mask segments; if omitted, taken
|
|
5975
6009
|
* from image meta.
|
|
5976
6010
|
* @param {Image} [sourceImage] Source image (provides StudyInstanceUID).
|
|
5977
6011
|
* @param {SimpleTagValues} [extraTags] Optional extra tags to merge.
|
|
5978
6012
|
* @returns {Record<string, DataElement>} The DICOM data elements.
|
|
5979
6013
|
*/
|
|
5980
|
-
toDicom(image:
|
|
6014
|
+
toDicom(image: MaskImage, segments?: MaskSegment[], sourceImage?: Image_2, extraTags?: SimpleTagValues): Record<string, DataElement>;
|
|
5981
6015
|
#private;
|
|
5982
6016
|
}
|
|
5983
6017
|
|
|
@@ -6103,6 +6137,57 @@ export declare class SegmentCollection {
|
|
|
6103
6137
|
* @returns {Uint8Array} The full-volume label map.
|
|
6104
6138
|
*/
|
|
6105
6139
|
getLabelMap(): Uint8Array;
|
|
6140
|
+
/**
|
|
6141
|
+
* Update the per-segment, per-slice buffers after a direct edit to the
|
|
6142
|
+
* shared label map (for example brush painting on a mask loaded from
|
|
6143
|
+
* DICOM, where the label map and the per-segment buffers are otherwise
|
|
6144
|
+
* two separate structures). No-op when this collection has no
|
|
6145
|
+
* per-segment data (brush-created masks), since the label map is
|
|
6146
|
+
* already the source of truth in that case.
|
|
6147
|
+
*
|
|
6148
|
+
* @param {number} offset The offset in the label map that changed.
|
|
6149
|
+
* @param {number} previousValue The segment number previously at offset.
|
|
6150
|
+
* @param {number} newValue The segment number now at offset.
|
|
6151
|
+
*/
|
|
6152
|
+
updateAtOffset(offset: number, previousValue: number, newValue: number): void;
|
|
6153
|
+
/**
|
|
6154
|
+
* Re-index the per-segment, per-slice buffers after a slice insertion
|
|
6155
|
+
* (from Image#appendSlice) that shifted existing slice
|
|
6156
|
+
* content to make room for new slices. Unlike the shared label map
|
|
6157
|
+
* (which aliases the image buffer, so the raw byte-level shift already
|
|
6158
|
+
* covers it for free), `#segments` is keyed by slice index rather than
|
|
6159
|
+
* buffer offset, so an insertion before an existing slice leaves its
|
|
6160
|
+
* entries silently pointing at the wrong (pre-shift) slice index unless
|
|
6161
|
+
* they are explicitly re-keyed here.
|
|
6162
|
+
*
|
|
6163
|
+
* @param {number} sliceIndexThreshold Slices at or after this index
|
|
6164
|
+
* (numbering as it was *before* the insertion) are shifted.
|
|
6165
|
+
* @param {number} numberOfSlices Number of slices inserted.
|
|
6166
|
+
*/
|
|
6167
|
+
shiftSlices(sliceIndexThreshold: number, numberOfSlices: number): void;
|
|
6168
|
+
/**
|
|
6169
|
+
* Get the value that a different, non-excluded segment holds at a given
|
|
6170
|
+
* label map offset. Used when deleting a segment to restore a voxel that
|
|
6171
|
+
* also belonged to another (overlapping) segment instead of losing that
|
|
6172
|
+
* other segment's presence there. Segments are checked in insertion
|
|
6173
|
+
* order, consistent with the first-wins policy used by {@link
|
|
6174
|
+
* SegmentCollection#getLabelMap}.
|
|
6175
|
+
*
|
|
6176
|
+
* @param {number} offset The offset in the label map.
|
|
6177
|
+
* @param {number} excludeSegmentNumber The segment number to ignore.
|
|
6178
|
+
* @returns {number} The other segment's stored value at that offset,
|
|
6179
|
+
* or 0 if no other segment covers it.
|
|
6180
|
+
*/
|
|
6181
|
+
getOtherValueAtOffset(offset: number, excludeSegmentNumber: number): number;
|
|
6182
|
+
/**
|
|
6183
|
+
* Create a deep copy of this collection: per-segment/per-slice buffers
|
|
6184
|
+
* and the overlap flag are copied, the lazily-built label map and union
|
|
6185
|
+
* contour caches are left unset (they rebuild on demand from the copied
|
|
6186
|
+
* per-segment data, same as a freshly constructed collection).
|
|
6187
|
+
*
|
|
6188
|
+
* @returns {SegmentCollection} The copy.
|
|
6189
|
+
*/
|
|
6190
|
+
clone(): SegmentCollection;
|
|
6106
6191
|
/**
|
|
6107
6192
|
* Check whether any two segments share at least one voxel.
|
|
6108
6193
|
*
|
|
@@ -6758,9 +6843,10 @@ export declare class ToolboxController {
|
|
|
6758
6843
|
*
|
|
6759
6844
|
* @param {string} eventType The event type, for example
|
|
6760
6845
|
* mousedown, touchstart...
|
|
6761
|
-
* @returns {EventListener} The event handler
|
|
6846
|
+
* @returns {EventListener|undefined} The event handler, undefined
|
|
6847
|
+
* if no tool is selected.
|
|
6762
6848
|
*/
|
|
6763
|
-
getSelectedToolEventHandler(eventType: string): EventListener;
|
|
6849
|
+
getSelectedToolEventHandler(eventType: string): EventListener | undefined;
|
|
6764
6850
|
/**
|
|
6765
6851
|
* Set the selected tool.
|
|
6766
6852
|
*
|
|
@@ -7040,16 +7126,16 @@ export declare class Vector3D {
|
|
|
7040
7126
|
* (either directly or with helper methods).
|
|
7041
7127
|
*
|
|
7042
7128
|
* @example
|
|
7043
|
-
* import {DicomParser,
|
|
7129
|
+
* import {DicomParser, demoCreateImage, demoCreateView} from '//esm.sh/dwv';
|
|
7044
7130
|
* // XMLHttpRequest onload callback
|
|
7045
7131
|
* const onload = function (event) {
|
|
7046
7132
|
* // parse the dicom buffer
|
|
7047
7133
|
* const dicomParser = new DicomParser();
|
|
7048
7134
|
* dicomParser.parse(event.target.response);
|
|
7049
7135
|
* // create the image object
|
|
7050
|
-
* const image =
|
|
7136
|
+
* const image = demoCreateImage(dicomParser.getDicomElements());
|
|
7051
7137
|
* // create the view
|
|
7052
|
-
* const view =
|
|
7138
|
+
* const view = demoCreateView(dicomParser.getDicomElements(), image);
|
|
7053
7139
|
* // setup canvas
|
|
7054
7140
|
* const canvas = document.createElement('canvas');
|
|
7055
7141
|
* canvas.width = 256;
|