@cornerstonejs/core 0.36.6 → 0.38.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.
Files changed (52) hide show
  1. package/dist/cjs/RenderingEngine/VolumeViewport3D.d.ts +1 -0
  2. package/dist/cjs/RenderingEngine/VolumeViewport3D.js +3 -0
  3. package/dist/cjs/RenderingEngine/VolumeViewport3D.js.map +1 -1
  4. package/dist/cjs/cache/classes/Contour.d.ts +2 -0
  5. package/dist/cjs/cache/classes/Contour.js +1 -0
  6. package/dist/cjs/cache/classes/Contour.js.map +1 -1
  7. package/dist/cjs/cache/classes/ContourSet.d.ts +3 -0
  8. package/dist/cjs/cache/classes/ContourSet.js +14 -7
  9. package/dist/cjs/cache/classes/ContourSet.js.map +1 -1
  10. package/dist/cjs/enums/DynamicOperatorType.d.ts +6 -0
  11. package/dist/cjs/enums/DynamicOperatorType.js +10 -0
  12. package/dist/cjs/enums/DynamicOperatorType.js.map +1 -0
  13. package/dist/cjs/enums/index.d.ts +2 -1
  14. package/dist/cjs/enums/index.js +3 -1
  15. package/dist/cjs/enums/index.js.map +1 -1
  16. package/dist/cjs/loaders/geometryLoader.js +1 -0
  17. package/dist/cjs/loaders/geometryLoader.js.map +1 -1
  18. package/dist/cjs/types/ContourData.d.ts +3 -1
  19. package/dist/cjs/types/IContourSet.d.ts +1 -0
  20. package/dist/cjs/types/IGeometry.d.ts +2 -2
  21. package/dist/esm/RenderingEngine/VolumeViewport3D.d.ts +1 -0
  22. package/dist/esm/RenderingEngine/VolumeViewport3D.js +3 -0
  23. package/dist/esm/RenderingEngine/VolumeViewport3D.js.map +1 -1
  24. package/dist/esm/cache/classes/Contour.d.ts +2 -0
  25. package/dist/esm/cache/classes/Contour.js +1 -0
  26. package/dist/esm/cache/classes/Contour.js.map +1 -1
  27. package/dist/esm/cache/classes/ContourSet.d.ts +3 -0
  28. package/dist/esm/cache/classes/ContourSet.js +14 -6
  29. package/dist/esm/cache/classes/ContourSet.js.map +1 -1
  30. package/dist/esm/enums/DynamicOperatorType.d.ts +6 -0
  31. package/dist/esm/enums/DynamicOperatorType.js +8 -0
  32. package/dist/esm/enums/DynamicOperatorType.js.map +1 -0
  33. package/dist/esm/enums/index.d.ts +2 -1
  34. package/dist/esm/enums/index.js +2 -1
  35. package/dist/esm/enums/index.js.map +1 -1
  36. package/dist/esm/loaders/geometryLoader.js +1 -0
  37. package/dist/esm/loaders/geometryLoader.js.map +1 -1
  38. package/dist/esm/types/ContourData.d.ts +3 -1
  39. package/dist/esm/types/IContourSet.d.ts +1 -0
  40. package/dist/esm/types/IGeometry.d.ts +2 -2
  41. package/dist/umd/index.js +1 -1
  42. package/dist/umd/index.js.map +1 -1
  43. package/package.json +2 -2
  44. package/src/RenderingEngine/VolumeViewport3D.ts +4 -0
  45. package/src/cache/classes/Contour.ts +3 -0
  46. package/src/cache/classes/ContourSet.ts +18 -6
  47. package/src/enums/DynamicOperatorType.ts +14 -0
  48. package/src/enums/index.ts +2 -0
  49. package/src/loaders/geometryLoader.ts +1 -0
  50. package/src/types/ContourData.ts +3 -1
  51. package/src/types/IContourSet.ts +1 -0
  52. package/src/types/IGeometry.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "0.36.6",
3
+ "version": "0.38.0",
4
4
  "description": "",
5
5
  "main": "dist/umd/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -51,5 +51,5 @@
51
51
  "type": "individual",
52
52
  "url": "https://ohif.org/donate"
53
53
  },
54
- "gitHead": "0eec4b306b9ff822ddac722f5eab2dd3161d0821"
54
+ "gitHead": "9a2711ca032949079e7b96ba332b6e01b3316da8"
55
55
  }
@@ -41,6 +41,10 @@ class VolumeViewport3D extends BaseVolumeViewport {
41
41
  public getCurrentImageIdIndex = (): number | undefined => {
42
42
  return undefined;
43
43
  };
44
+
45
+ public getCurrentImageId = (): string => {
46
+ return null;
47
+ };
44
48
  }
45
49
 
46
50
  export default VolumeViewport3D;
@@ -5,6 +5,7 @@ type ContourProps = {
5
5
  id: string;
6
6
  data: ContourData;
7
7
  color: Point3;
8
+ segmentIndex: number;
8
9
  };
9
10
 
10
11
  /**
@@ -19,6 +20,7 @@ export class Contour implements IContour {
19
20
  points: Point3[];
20
21
  color: Point3;
21
22
  type: ContourType;
23
+ segmentIndex: number;
22
24
 
23
25
  constructor(props: ContourProps) {
24
26
  const { points, type } = props.data;
@@ -26,6 +28,7 @@ export class Contour implements IContour {
26
28
  this.points = points;
27
29
  this.type = type;
28
30
  this.color = props.color;
31
+ this.segmentIndex = props.segmentIndex;
29
32
 
30
33
  this.sizeInBytes = this._getSizeInBytes();
31
34
  }
@@ -5,6 +5,7 @@ type ContourSetProps = {
5
5
  id: string;
6
6
  data: ContourData[];
7
7
  frameOfReferenceUID: string;
8
+ segmentIndex: number;
8
9
  color?: Point3;
9
10
  };
10
11
 
@@ -17,6 +18,7 @@ export class ContourSet implements IContourSet {
17
18
  readonly sizeInBytes: number;
18
19
  readonly frameOfReferenceUID: string;
19
20
  private color: Point3 = [200, 0, 0]; // default color
21
+ private segmentIndex: number;
20
22
  contours: IContour[];
21
23
 
22
24
  constructor(props: ContourSetProps) {
@@ -24,24 +26,30 @@ export class ContourSet implements IContourSet {
24
26
  this.contours = [];
25
27
  this.color = props.color ?? this.color;
26
28
  this.frameOfReferenceUID = props.frameOfReferenceUID;
29
+ this.segmentIndex = props.segmentIndex;
27
30
 
28
31
  this._createEachContour(props.data);
29
32
  this.sizeInBytes = this._getSizeInBytes();
30
33
  }
31
34
 
32
35
  _createEachContour(contourDataArray: ContourData[]): void {
33
- for (let i = 0; i < contourDataArray.length; i++) {
36
+ contourDataArray.forEach((contourData) => {
37
+ const { points, type, color } = contourData;
38
+
34
39
  const contour = new Contour({
35
- id: `${this.id}-${i}`,
40
+ id: `${this.id}-segment-${this.segmentIndex}`,
36
41
  data: {
37
- points: contourDataArray[i].points,
38
- type: contourDataArray[i].type,
42
+ points,
43
+ type,
44
+ segmentIndex: this.segmentIndex,
45
+ color: color ?? this.color,
39
46
  },
40
- color: contourDataArray[i].color ?? this.color,
47
+ segmentIndex: this.segmentIndex,
48
+ color: color ?? this.color,
41
49
  });
42
50
 
43
51
  this.contours.push(contour);
44
- }
52
+ });
45
53
  }
46
54
 
47
55
  _getSizeInBytes(): number {
@@ -50,6 +58,10 @@ export class ContourSet implements IContourSet {
50
58
  }, 0);
51
59
  }
52
60
 
61
+ public getSegmentIndex(): number {
62
+ return this.segmentIndex;
63
+ }
64
+
53
65
  public getColor(): Point3 {
54
66
  // Currently, all contours in a contour set have the same color.
55
67
  // This may change in the future.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * DynamicOperatorType enum for cornerstone-render which defines the operator to use for generateImageFromTimeData.
3
+ * It can be either SUM, AVERAGE or SUBTRACT.
4
+ */
5
+ enum DynamicOperatorType {
6
+ /** For summing the time frames. */
7
+ SUM = 'SUM',
8
+ /** For averaging the time frames. */
9
+ AVERAGE = 'AVERAGE',
10
+ /** For subtracting two time frames */
11
+ SUBTRACT = 'SUBTRACT',
12
+ }
13
+
14
+ export default DynamicOperatorType;
@@ -8,6 +8,7 @@ import SharedArrayBufferModes from './SharedArrayBufferModes';
8
8
  import GeometryType from './GeometryType';
9
9
  import ContourType from './ContourType';
10
10
  import VOILUTFunctionType from './VOILUTFunctionType';
11
+ import DynamicOperatorType from './DynamicOperatorType';
11
12
 
12
13
  export {
13
14
  Events,
@@ -20,4 +21,5 @@ export {
20
21
  GeometryType,
21
22
  ContourType,
22
23
  VOILUTFunctionType,
24
+ DynamicOperatorType,
23
25
  };
@@ -93,6 +93,7 @@ function _createContourSet(
93
93
  data: contourSetData.data,
94
94
  color: contourSetData.color,
95
95
  frameOfReferenceUID: contourSetData.frameOfReferenceUID,
96
+ segmentIndex: contourSetData.segmentIndex,
96
97
  });
97
98
 
98
99
  const geometry: IGeometry = {
@@ -8,12 +8,14 @@ type ContourSetData = {
8
8
  data: ContourData[];
9
9
  frameOfReferenceUID: string;
10
10
  color?: Point3;
11
+ segmentIndex?: number;
11
12
  };
12
13
 
13
14
  type ContourData = {
14
15
  points: Point3[];
15
16
  type: ContourType;
16
- color?: Point3;
17
+ color: Point3;
18
+ segmentIndex: number;
17
19
  };
18
20
 
19
21
  export type { PublicContourSetData, ContourSetData, ContourData };
@@ -11,6 +11,7 @@ export interface IContourSet {
11
11
  contours: IContour[];
12
12
  _createEachContour(data: ContourData[]): void;
13
13
  getSizeInBytes(): number;
14
+ getSegmentIndex(): number;
14
15
  getColor(): any;
15
16
  /**
16
17
  * This function returns the contours of the image
@@ -1,11 +1,11 @@
1
- import { ContourSet } from '../cache/classes/ContourSet';
2
1
  import { GeometryType } from '../enums';
2
+ import { IContourSet } from './IContourSet';
3
3
 
4
4
  // interface IGeometry can be array of IContourSet
5
5
  interface IGeometry {
6
6
  id: string;
7
7
  type: GeometryType;
8
- data: ContourSet; // | Array<IClosedSurface> , etc
8
+ data: IContourSet; // | Array<IClosedSurface> , etc
9
9
  sizeInBytes: number;
10
10
  }
11
11