@cornerstonejs/core 0.36.5 → 0.37.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 (41) 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/loaders/geometryLoader.js +1 -0
  11. package/dist/cjs/loaders/geometryLoader.js.map +1 -1
  12. package/dist/cjs/types/ContourData.d.ts +3 -1
  13. package/dist/cjs/types/IContourSet.d.ts +1 -0
  14. package/dist/cjs/types/IGeometry.d.ts +2 -2
  15. package/dist/cjs/types/IStreamingVolumeProperties.d.ts +1 -0
  16. package/dist/esm/RenderingEngine/VolumeViewport3D.d.ts +1 -0
  17. package/dist/esm/RenderingEngine/VolumeViewport3D.js +3 -0
  18. package/dist/esm/RenderingEngine/VolumeViewport3D.js.map +1 -1
  19. package/dist/esm/cache/classes/Contour.d.ts +2 -0
  20. package/dist/esm/cache/classes/Contour.js +1 -0
  21. package/dist/esm/cache/classes/Contour.js.map +1 -1
  22. package/dist/esm/cache/classes/ContourSet.d.ts +3 -0
  23. package/dist/esm/cache/classes/ContourSet.js +14 -6
  24. package/dist/esm/cache/classes/ContourSet.js.map +1 -1
  25. package/dist/esm/loaders/geometryLoader.js +1 -0
  26. package/dist/esm/loaders/geometryLoader.js.map +1 -1
  27. package/dist/esm/types/ContourData.d.ts +3 -1
  28. package/dist/esm/types/IContourSet.d.ts +1 -0
  29. package/dist/esm/types/IGeometry.d.ts +2 -2
  30. package/dist/esm/types/IStreamingVolumeProperties.d.ts +1 -0
  31. package/dist/umd/index.js +1 -1
  32. package/dist/umd/index.js.map +1 -1
  33. package/package.json +2 -2
  34. package/src/RenderingEngine/VolumeViewport3D.ts +4 -0
  35. package/src/cache/classes/Contour.ts +3 -0
  36. package/src/cache/classes/ContourSet.ts +18 -6
  37. package/src/loaders/geometryLoader.ts +1 -0
  38. package/src/types/ContourData.ts +3 -1
  39. package/src/types/IContourSet.ts +1 -0
  40. package/src/types/IGeometry.ts +2 -2
  41. package/src/types/IStreamingVolumeProperties.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "0.36.5",
3
+ "version": "0.37.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": "5c2b9eec6cbd9715fc049529783b63cf80892ba5"
54
+ "gitHead": "1e40104275742f14a7a48b076f244610f90e8657"
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.
@@ -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
 
@@ -6,6 +6,7 @@ interface IStreamingVolumeProperties {
6
6
  loadStatus: {
7
7
  loaded: boolean;
8
8
  loading: boolean;
9
+ cancelled: boolean;
9
10
  cachedFrames: Array<boolean>;
10
11
  callbacks: Array<() => void>;
11
12
  };