dwv 0.32.0 → 0.32.1
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 +86 -25
- package/dist/dwv.min.js +1 -1
- package/dist/dwv.min.js.map +1 -1
- package/package.json +4 -4
- package/readme.md +3 -4
package/dist/dwv.d.ts
CHANGED
|
@@ -341,9 +341,15 @@ export declare class App {
|
|
|
341
341
|
/**
|
|
342
342
|
* Get the JSON state of the app.
|
|
343
343
|
*
|
|
344
|
-
* @returns {
|
|
344
|
+
* @returns {string} The state of the app as a JSON string.
|
|
345
345
|
*/
|
|
346
|
-
|
|
346
|
+
getJsonState(): string;
|
|
347
|
+
/**
|
|
348
|
+
* Apply a JSON state to this app.
|
|
349
|
+
*
|
|
350
|
+
* @param {string} jsonState The state of the app as a JSON string.
|
|
351
|
+
*/
|
|
352
|
+
applyJsonState(jsonState: string): void;
|
|
347
353
|
/**
|
|
348
354
|
* Handle resize: fit the display to the window.
|
|
349
355
|
* To be called once the image is loaded.
|
|
@@ -443,9 +449,39 @@ export declare class App {
|
|
|
443
449
|
export declare function buildMultipart(parts: any[], boundary: string): Uint8Array;
|
|
444
450
|
|
|
445
451
|
/**
|
|
446
|
-
*
|
|
452
|
+
* Create an Image from DICOM elements.
|
|
453
|
+
*
|
|
454
|
+
* @param {object} elements The DICOM elements.
|
|
455
|
+
* @returns {Image} The Image object.
|
|
456
|
+
*/
|
|
457
|
+
export declare function createImage(elements: object): Image_2;
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Create a mask Image from DICOM elements.
|
|
461
|
+
*
|
|
462
|
+
* @param {object} elements The DICOM elements.
|
|
463
|
+
* @returns {Image} The mask Image object.
|
|
464
|
+
*/
|
|
465
|
+
export declare function createMaskImage(elements: object): Image_2;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Create a View from DICOM elements and image.
|
|
469
|
+
*
|
|
470
|
+
* @param {object} elements The DICOM elements.
|
|
471
|
+
* @param {Image} image The associated image.
|
|
472
|
+
* @returns {View} The View object.
|
|
447
473
|
*/
|
|
448
|
-
export declare
|
|
474
|
+
export declare function createView(elements: object, image: Image_2): View;
|
|
475
|
+
|
|
476
|
+
export declare namespace customUI {
|
|
477
|
+
/**
|
|
478
|
+
* Open a dialogue to edit roi data. Defaults to window.prompt.
|
|
479
|
+
*
|
|
480
|
+
* @param {object} data The roi data.
|
|
481
|
+
* @param {Function} callback The callback to launch on dialogue exit.
|
|
482
|
+
*/
|
|
483
|
+
export function openRoiDialog(data: any, callback: Function): void;
|
|
484
|
+
}
|
|
449
485
|
|
|
450
486
|
/**
|
|
451
487
|
* Decoder scripts to be passed to web workers for image decoding.
|
|
@@ -1042,17 +1078,11 @@ export declare namespace i18n {
|
|
|
1042
1078
|
* @example
|
|
1043
1079
|
* // XMLHttpRequest onload callback
|
|
1044
1080
|
* const onload = function (event) {
|
|
1045
|
-
* //
|
|
1081
|
+
* // parse the dicom buffer
|
|
1046
1082
|
* const dicomParser = new dwv.DicomParser();
|
|
1047
|
-
* // parse the buffer
|
|
1048
1083
|
* dicomParser.parse(event.target.response);
|
|
1049
|
-
* // create the image
|
|
1050
|
-
* const
|
|
1051
|
-
* // inputs are dicom tags and buffer
|
|
1052
|
-
* const image = imageFactory.create(
|
|
1053
|
-
* dicomParser.getDicomElements(),
|
|
1054
|
-
* dicomParser.getDicomElements()['7FE00010'].value[0]
|
|
1055
|
-
* );
|
|
1084
|
+
* // create the image object
|
|
1085
|
+
* const image = createImage(dicomParser.getDicomElements());
|
|
1056
1086
|
* // result div
|
|
1057
1087
|
* const div = document.getElementById('dwv');
|
|
1058
1088
|
* // display the image size
|
|
@@ -2519,6 +2549,37 @@ export declare class Vector3D {
|
|
|
2519
2549
|
*
|
|
2520
2550
|
* Need to set the window lookup table once created
|
|
2521
2551
|
* (either directly or with helper methods).
|
|
2552
|
+
*
|
|
2553
|
+
* @example
|
|
2554
|
+
* // XMLHttpRequest onload callback
|
|
2555
|
+
* const onload = function (event) {
|
|
2556
|
+
* // parse the dicom buffer
|
|
2557
|
+
* const dicomParser = new dwv.DicomParser();
|
|
2558
|
+
* dicomParser.parse(event.target.response);
|
|
2559
|
+
* // create the image object
|
|
2560
|
+
* const image = createImage(dicomParser.getDicomElements());
|
|
2561
|
+
* // create the view
|
|
2562
|
+
* const view = createView(dicomParser.getDicomElements(), image);
|
|
2563
|
+
* // setup canvas
|
|
2564
|
+
* const canvas = document.createElement('canvas');
|
|
2565
|
+
* canvas.width = 256;
|
|
2566
|
+
* canvas.height = 256;
|
|
2567
|
+
* const ctx = canvas.getContext("2d");
|
|
2568
|
+
* // update the image data
|
|
2569
|
+
* const imageData = ctx.createImageData(256, 256);
|
|
2570
|
+
* view.generateImageData(imageData);
|
|
2571
|
+
* ctx.putImageData(imageData, 0, 0);
|
|
2572
|
+
* // update html
|
|
2573
|
+
* const div = document.getElementById('dwv');
|
|
2574
|
+
* div.appendChild(canvas);;
|
|
2575
|
+
* };
|
|
2576
|
+
* // DICOM file request
|
|
2577
|
+
* const request = new XMLHttpRequest();
|
|
2578
|
+
* const url = 'https://raw.githubusercontent.com/ivmartel/dwv/master/tests/data/bbmri-53323851.dcm';
|
|
2579
|
+
* request.open('GET', url);
|
|
2580
|
+
* request.responseType = 'arraybuffer';
|
|
2581
|
+
* request.onload = onload;
|
|
2582
|
+
* request.send();
|
|
2522
2583
|
*/
|
|
2523
2584
|
export declare class View {
|
|
2524
2585
|
/**
|
|
@@ -2731,9 +2792,9 @@ export declare class View {
|
|
|
2731
2792
|
* Get the image window/level that covers the full data range.
|
|
2732
2793
|
* Warning: uses the latest set rescale LUT or the default linear one.
|
|
2733
2794
|
*
|
|
2734
|
-
* @returns {
|
|
2795
|
+
* @returns {WindowCenterAndWidth} A min/max window level.
|
|
2735
2796
|
*/
|
|
2736
|
-
getWindowLevelMinMax():
|
|
2797
|
+
getWindowLevelMinMax(): WindowCenterAndWidth;
|
|
2737
2798
|
/**
|
|
2738
2799
|
* Set the image window/level to cover the full data range.
|
|
2739
2800
|
* Warning: uses the latest set rescale LUT or the default linear one.
|
|
@@ -3032,10 +3093,10 @@ export declare class ViewController {
|
|
|
3032
3093
|
* Set the current index.
|
|
3033
3094
|
*
|
|
3034
3095
|
* @param {Index} index The index.
|
|
3035
|
-
* @param {boolean} silent If true, does not fire a positionchange event.
|
|
3096
|
+
* @param {boolean} [silent] If true, does not fire a positionchange event.
|
|
3036
3097
|
* @returns {boolean} False if not in bounds.
|
|
3037
3098
|
*/
|
|
3038
|
-
setCurrentIndex(index: Index, silent
|
|
3099
|
+
setCurrentIndex(index: Index, silent?: boolean): boolean;
|
|
3039
3100
|
/**
|
|
3040
3101
|
* Get a plane 3D position from a plane 2D position: does not compensate
|
|
3041
3102
|
* for the image origin. Needed for setting the scale center...
|
|
@@ -3378,7 +3439,7 @@ export declare class ViewLayer {
|
|
|
3378
3439
|
}
|
|
3379
3440
|
|
|
3380
3441
|
/**
|
|
3381
|
-
*
|
|
3442
|
+
* WindowCenterAndWidth class.
|
|
3382
3443
|
* <br>Pseudo-code:
|
|
3383
3444
|
* <pre>
|
|
3384
3445
|
* if (x <= c - 0.5 - (w-1)/2), then y = ymin
|
|
@@ -3388,7 +3449,7 @@ export declare class ViewLayer {
|
|
|
3388
3449
|
*
|
|
3389
3450
|
* @see DICOM doc for [Window Center and Window Width]{@link http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.11.html#sect_C.11.2.1.2}
|
|
3390
3451
|
*/
|
|
3391
|
-
export declare class
|
|
3452
|
+
export declare class WindowCenterAndWidth {
|
|
3392
3453
|
/**
|
|
3393
3454
|
* @param {number} center The window center.
|
|
3394
3455
|
* @param {number} width The window width.
|
|
@@ -3431,10 +3492,10 @@ export declare class WindowLevel {
|
|
|
3431
3492
|
/**
|
|
3432
3493
|
* Check for window level equality.
|
|
3433
3494
|
*
|
|
3434
|
-
* @param {
|
|
3495
|
+
* @param {WindowCenterAndWidth} rhs The other window level to compare to.
|
|
3435
3496
|
* @returns {boolean} True if both window level are equal.
|
|
3436
3497
|
*/
|
|
3437
|
-
equals(rhs:
|
|
3498
|
+
equals(rhs: WindowCenterAndWidth): boolean;
|
|
3438
3499
|
/**
|
|
3439
3500
|
* Get a string representation of the window level.
|
|
3440
3501
|
*
|
|
@@ -3457,9 +3518,9 @@ export declare class WindowLut {
|
|
|
3457
3518
|
/**
|
|
3458
3519
|
* Get the window / level.
|
|
3459
3520
|
*
|
|
3460
|
-
* @returns {
|
|
3521
|
+
* @returns {WindowCenterAndWidth} The window / level.
|
|
3461
3522
|
*/
|
|
3462
|
-
getWindowLevel():
|
|
3523
|
+
getWindowLevel(): WindowCenterAndWidth;
|
|
3463
3524
|
/**
|
|
3464
3525
|
* Get the signed flag.
|
|
3465
3526
|
*
|
|
@@ -3482,9 +3543,9 @@ export declare class WindowLut {
|
|
|
3482
3543
|
/**
|
|
3483
3544
|
* Set the window center and width.
|
|
3484
3545
|
*
|
|
3485
|
-
* @param {
|
|
3546
|
+
* @param {WindowCenterAndWidth} wl The window level.
|
|
3486
3547
|
*/
|
|
3487
|
-
setWindowLevel(wl:
|
|
3548
|
+
setWindowLevel(wl: WindowCenterAndWidth): void;
|
|
3488
3549
|
/**
|
|
3489
3550
|
* Update the lut if needed..
|
|
3490
3551
|
*/
|