dwv 0.35.0-beta.22 → 0.35.0-beta.23
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/984787daabc9f4ca39b3.js +1 -0
- package/dist/dwv.d.ts +44 -11
- package/dist/dwv.min.js +1 -1
- package/dist/dwv.min.js.map +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class LabelingWorker{#t;#n;#i;constructor(){}#e(t){if(t<0)return t;let n=t;for(;this.#n[n]!==n;)n=this.#n[n];let i=t;for(;this.#n[i]!==i;){const t=this.#n[i];this.#n[i]=n,i=t}return n}#s(t,n){this.#n[this.#e(t)]=this.#e(n)}regenerateLabels(t,n,i,e){void 0!==this.#t&&this.#t===e||(this.#t=e,this.#n=new Int32Array(e),this.#i=new Int32Array(e));for(let e=0;e<i[0];e++)for(let s=0;s<i[1];s++)for(let l=0;l<i[2];l++){const i=n[0]*e+n[1]*s+n[2]*l;this.#n[i]=i,this.#i[i]=-1;const o=t[i];if(o>0){const a=i-n[0],r=i-n[1],h=i-n[2];let u=0;e>0&&(u=t[a]);let d=0;s>0&&(d=t[r]);let f=0;l>0&&(f=t[h]);let b=0;e>0&&(b=this.#i[a]);let c=0;s>0&&(c=this.#i[r]);let g=0;l>0&&(g=this.#i[h]),u!==o&&d!==o&&f!==o?this.#i[i]=i:u===o&&d!==o&&f!==o?this.#i[i]=this.#e(b):u!==o&&d===o&&f!==o?this.#i[i]=this.#e(c):u!==o&&d!==o&&f===o?this.#i[i]=this.#e(g):u!==o&&d===o&&f===o?(this.#s(c,g),this.#i[i]=this.#e(c)):u===o&&d!==o&&f===o?(this.#s(b,g),this.#i[i]=this.#e(b)):u===o&&d===o&&f!==o?(this.#s(b,c),this.#i[i]=this.#e(b)):u===o&&d===o&&f===o&&(this.#s(b,c),this.#s(b,g),this.#i[i]=this.#e(b))}}}#l(t,n){const i=new Array(n.length);let e=t,s=0;for(let t=n.length-1;t>0;--t)s=n[t],i[t]=Math.floor(e/s),e-=i[t]*s;return i[0]=e,i}#o(t,n){const i={};for(let e=0;e<this.#i.length;e++){const s=this.#e(this.#i[e]);if(s>=0){const l=this.#l(e,n),o=i[s];void 0===o?i[s]={id:t[e],sum:l,count:1}:(o.sum[0]+=l[0],o.sum[1]+=l[1],o.sum[2]+=l[2],o.count++)}}return Object.values(i).map((t=>{const n=Array(t.sum.length).fill(0);for(let i=0;i<t.sum.length;i++)n[i]=t.sum[i]/t.count;return{id:t.id,centroidIndex:n,count:t.count}}))}calculateFromEvent(t){const n=t.imageBuffer,i=t.unitVectors,e=t.sizes,s=t.totalSize;return this.regenerateLabels(n,i,e,s),this.#o(n,i)}}const labelingWorker=new LabelingWorker;"undefined"==typeof window||window!==window.window?self.addEventListener("message",(function(t){self.postMessage({labels:labelingWorker.calculateFromEvent(t.data)})})):self.labelingWorker=labelingWorker;
|
package/dist/dwv.d.ts
CHANGED
|
@@ -17,17 +17,17 @@ export declare function addTagsToDictionary(group: string, tags: {
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class Annotation {
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Tracking id, unique within domain.
|
|
21
21
|
*
|
|
22
22
|
* @type {string}
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
trackingId: string;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Tracking Unique id.
|
|
27
27
|
*
|
|
28
28
|
* @type {string}
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
trackingUid: string;
|
|
31
31
|
/**
|
|
32
32
|
* Referenced image SOP isntance UID.
|
|
33
33
|
*
|
|
@@ -352,7 +352,8 @@ export declare class AnnotationGroupFactory {
|
|
|
352
352
|
[x: string]: DataElement;
|
|
353
353
|
}): AnnotationGroup;
|
|
354
354
|
/**
|
|
355
|
-
* Convert an annotation group into a DICOM SR object
|
|
355
|
+
* Convert an annotation group into a DICOM SR object using the
|
|
356
|
+
* TID 1500 template.
|
|
356
357
|
*
|
|
357
358
|
* @param {AnnotationGroup} annotationGroup The annotation group.
|
|
358
359
|
* @param {Object<string, any>} [extraTags] Optional list of extra tags.
|
|
@@ -363,6 +364,22 @@ export declare class AnnotationGroupFactory {
|
|
|
363
364
|
}): {
|
|
364
365
|
[x: string]: DataElement;
|
|
365
366
|
};
|
|
367
|
+
/**
|
|
368
|
+
* Convert a annotation groups into a DICOM CAD report SR object using
|
|
369
|
+
* the TID 4100 template.
|
|
370
|
+
*
|
|
371
|
+
* @param {AnnotationGroup[]} annotationGroups The annotation groups.
|
|
372
|
+
* @param {object[]} responseEvaluations List of response evaluations
|
|
373
|
+
* as {current, measure}.
|
|
374
|
+
* @param {string} comment Report comment.
|
|
375
|
+
* @param {Object<string, any>} [extraTags] Optional list of extra tags.
|
|
376
|
+
* @returns {Object<string, DataElement>} A list of dicom elements.
|
|
377
|
+
*/
|
|
378
|
+
toDicomCADReport(annotationGroups: AnnotationGroup[], responseEvaluations: object[], comment: string, extraTags?: {
|
|
379
|
+
[x: string]: any;
|
|
380
|
+
}): {
|
|
381
|
+
[x: string]: DataElement;
|
|
382
|
+
};
|
|
366
383
|
#private;
|
|
367
384
|
}
|
|
368
385
|
|
|
@@ -1406,15 +1423,19 @@ export declare class DicomCode {
|
|
|
1406
1423
|
*/
|
|
1407
1424
|
export declare class DicomData {
|
|
1408
1425
|
/**
|
|
1409
|
-
* @param {
|
|
1426
|
+
* @param {Object<string, DataElement>} meta The DICOM meta data.
|
|
1410
1427
|
*/
|
|
1411
|
-
constructor(meta:
|
|
1428
|
+
constructor(meta: {
|
|
1429
|
+
[x: string]: DataElement;
|
|
1430
|
+
});
|
|
1412
1431
|
/**
|
|
1413
1432
|
* DICOM meta data.
|
|
1414
1433
|
*
|
|
1415
|
-
* @type {
|
|
1434
|
+
* @type {Object<string, DataElement>}
|
|
1416
1435
|
*/
|
|
1417
|
-
meta:
|
|
1436
|
+
meta: {
|
|
1437
|
+
[x: string]: DataElement;
|
|
1438
|
+
};
|
|
1418
1439
|
/**
|
|
1419
1440
|
* Image extracted from meta data.
|
|
1420
1441
|
*
|
|
@@ -1427,6 +1448,12 @@ export declare class DicomData {
|
|
|
1427
1448
|
* @type {AnnotationGroup|undefined}
|
|
1428
1449
|
*/
|
|
1429
1450
|
annotationGroup: AnnotationGroup | undefined;
|
|
1451
|
+
/**
|
|
1452
|
+
* Image buffer used to build image.
|
|
1453
|
+
*
|
|
1454
|
+
* @type {any|undefined}
|
|
1455
|
+
*/
|
|
1456
|
+
buffer: any | undefined;
|
|
1430
1457
|
}
|
|
1431
1458
|
|
|
1432
1459
|
/**
|
|
@@ -2984,6 +3011,10 @@ declare class Image_2 {
|
|
|
2984
3011
|
* Note: Uses the raw buffer values.
|
|
2985
3012
|
*/
|
|
2986
3013
|
compose(rhs: Image_2, operator: Function): Image_2;
|
|
3014
|
+
/**
|
|
3015
|
+
* Recalculate labels.
|
|
3016
|
+
*/
|
|
3017
|
+
recalculateLabels(): void;
|
|
2987
3018
|
#private;
|
|
2988
3019
|
}
|
|
2989
3020
|
export { Image_2 as Image }
|
|
@@ -3511,12 +3542,14 @@ export declare class MaskFactory {
|
|
|
3511
3542
|
* @param {Uint8Array | Int8Array |
|
|
3512
3543
|
* Uint16Array | Int16Array |
|
|
3513
3544
|
* Uint32Array | Int32Array} pixelBuffer The pixel buffer.
|
|
3545
|
+
* @param {Image} [refImage] Reference image, code will use its
|
|
3546
|
+
* origins if present (best) or try to calculate them.
|
|
3514
3547
|
* @returns {Image} A new Image.
|
|
3515
3548
|
* @throws Error for missing or wrong data.
|
|
3516
3549
|
*/
|
|
3517
3550
|
create(dataElements: {
|
|
3518
3551
|
[x: string]: DataElement;
|
|
3519
|
-
}, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array): Image_2;
|
|
3552
|
+
}, pixelBuffer: Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array, refImage?: Image_2): Image_2;
|
|
3520
3553
|
/**
|
|
3521
3554
|
* Convert a mask image into a DICOM segmentation object.
|
|
3522
3555
|
*
|
|
@@ -5181,7 +5214,7 @@ export declare const toolList: {
|
|
|
5181
5214
|
* const group = new Konva.Group();
|
|
5182
5215
|
* group.name('love-group');
|
|
5183
5216
|
* group.visible(true);
|
|
5184
|
-
* group.id(annotation.
|
|
5217
|
+
* group.id(annotation.trackingUid);
|
|
5185
5218
|
* group.add(shape);
|
|
5186
5219
|
* return group;
|
|
5187
5220
|
* }
|