@cornerstonejs/core 2.16.0 → 2.17.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.
@@ -88,7 +88,7 @@ function vtkStreamingOpenGLTexture(publicAPI, model) {
88
88
  }
89
89
  function updateDynamicVolumeTexture() {
90
90
  const volume = cache.getVolume(model.volumeId);
91
- const imageIds = volume.getCurrentTimePointImageIds();
91
+ const imageIds = volume.getCurrentDimensionGroupImageIds();
92
92
  if (!imageIds.length) {
93
93
  return false;
94
94
  }
@@ -81,5 +81,5 @@ export default class BaseStreamingImageVolume extends ImageVolume implements IIm
81
81
  loadImages(): Promise<boolean>;
82
82
  private _prefetchImageIds;
83
83
  private _addScalingToVolume;
84
- protected checkTimePointCompletion(imageIdIndex: number): void;
84
+ protected checkDimensionGroupCompletion(imageIdIndex: number): void;
85
85
  }
@@ -127,7 +127,7 @@ export default class BaseStreamingImageVolume extends ImageVolume {
127
127
  }
128
128
  this.updateTextureAndTriggerEvents(imageIdIndex, imageId, imageQualityStatus);
129
129
  if (this.isDynamicVolume()) {
130
- this.checkTimePointCompletion(imageIdIndex);
130
+ this.checkDimensionGroupCompletion(imageIdIndex);
131
131
  }
132
132
  }
133
133
  errorCallback(imageId, permanent, error) {
@@ -343,5 +343,5 @@ export default class BaseStreamingImageVolume extends ImageVolume {
343
343
  }
344
344
  this.scaling = { PT: petScaling };
345
345
  }
346
- checkTimePointCompletion(imageIdIndex) { }
346
+ checkDimensionGroupCompletion(imageIdIndex) { }
347
347
  }
@@ -10,7 +10,6 @@ export declare class ImageVolume {
10
10
  private _imageIds;
11
11
  private _imageIdsIndexMap;
12
12
  private _imageURIsIndexMap;
13
- protected numFrames: number;
14
13
  protected totalNumFrames: number;
15
14
  protected cornerstoneImageMetaData: any;
16
15
  readonly volumeId: string;
@@ -39,6 +38,7 @@ export declare class ImageVolume {
39
38
  voxelManager?: IVoxelManager<number> | IVoxelManager<RGB>;
40
39
  dataType?: PixelDataTypedArrayString;
41
40
  numTimePoints?: number;
41
+ numFrames: number;
42
42
  constructor(props: ImageVolumeProps);
43
43
  get sizeInBytes(): number;
44
44
  get imageIds(): string[];
@@ -10,6 +10,7 @@ export class ImageVolume {
10
10
  this.cornerstoneImageMetaData = null;
11
11
  this.isPreScaled = false;
12
12
  this.numTimePoints = null;
13
+ this.numFrames = null;
13
14
  const { imageIds, scaling, dimensions, spacing, origin, direction, dataType, volumeId, referencedVolumeId, metadata, referencedImageIds, additionalDetails, voxelManager, numberOfComponents, } = props;
14
15
  if (!dataType) {
15
16
  throw new Error('Data type is required, please provide a data type as string such as "Uint8Array", "Float32Array", etc.');
@@ -1,10 +1,11 @@
1
1
  import type { IDynamicImageVolume, ImageVolumeProps, IStreamingVolumeProperties } from '../../types';
2
2
  import BaseStreamingImageVolume from './BaseStreamingImageVolume';
3
3
  export default class StreamingDynamicImageVolume extends BaseStreamingImageVolume implements IDynamicImageVolume {
4
- private _timePointIndex;
4
+ private _dimensionGroupNumber;
5
5
  private _splittingTag;
6
6
  private _imageIdGroups;
7
- private _loadedTimePoints;
7
+ private _loadedDimensionGroups;
8
+ numDimensionGroups: number;
8
9
  numTimePoints: number;
9
10
  constructor(imageVolumeProperties: ImageVolumeProps & {
10
11
  splittingTag: string;
@@ -13,11 +14,15 @@ export default class StreamingDynamicImageVolume extends BaseStreamingImageVolum
13
14
  private _getImageIdsToLoad;
14
15
  private _getImageIdRequests;
15
16
  getImageIdsToLoad(): string[];
16
- get timePointIndex(): number;
17
+ get dimensionGroupNumber(): number;
17
18
  set timePointIndex(index: number);
19
+ set dimensionGroupNumber(dimensionGroupNumber: number);
20
+ get timePointIndex(): number;
18
21
  scroll(delta: number): void;
22
+ getCurrentDimensionGroupImageIds(): string[];
19
23
  getCurrentTimePointImageIds(): string[];
20
24
  flatImageIdIndexToTimePointIndex(flatImageIdIndex: number): number;
25
+ flatImageIdIndexToDimensionGroupNumber(flatImageIdIndex: number): number;
21
26
  flatImageIdIndexToImageIdIndex(flatImageIdIndex: number): number;
22
27
  get splittingTag(): string;
23
28
  getImageLoadRequests: (priority: number) => {
@@ -51,6 +56,8 @@ export default class StreamingDynamicImageVolume extends BaseStreamingImageVolum
51
56
  };
52
57
  }[];
53
58
  isTimePointLoaded(timePointIndex: number): boolean;
54
- private markTimePointAsLoaded;
59
+ isDimensionGroupLoaded(dimensionGroupNumber: number): boolean;
60
+ private markDimensionGroupAsLoaded;
55
61
  protected checkTimePointCompletion(imageIdIndex: number): void;
62
+ protected checkDimensionGroupCompletion(imageIdIndex: number): void;
56
63
  }
@@ -5,8 +5,8 @@ import BaseStreamingImageVolume from './BaseStreamingImageVolume';
5
5
  export default class StreamingDynamicImageVolume extends BaseStreamingImageVolume {
6
6
  constructor(imageVolumeProperties, streamingProperties) {
7
7
  super(imageVolumeProperties, streamingProperties);
8
- this._timePointIndex = 0;
9
- this._loadedTimePoints = new Set();
8
+ this._dimensionGroupNumber = 1;
9
+ this._loadedDimensionGroups = new Set();
10
10
  this._getImageIdRequests = (imageIds, priority) => {
11
11
  return this.getImageIdsRequests(imageIds, priority);
12
12
  };
@@ -17,11 +17,12 @@ export default class StreamingDynamicImageVolume extends BaseStreamingImageVolum
17
17
  const { imageIdGroups, splittingTag } = imageVolumeProperties;
18
18
  this._splittingTag = splittingTag;
19
19
  this._imageIdGroups = imageIdGroups;
20
- this.numTimePoints = this._imageIdGroups.length;
20
+ this.numDimensionGroups = this._imageIdGroups.length;
21
+ this.numTimePoints = this.numDimensionGroups;
21
22
  }
22
23
  _getImageIdsToLoad() {
23
24
  const imageIdGroups = this._imageIdGroups;
24
- const initialImageIdGroupIndex = this._timePointIndex;
25
+ const initialImageIdGroupIndex = this._dimensionGroupNumber - 1;
25
26
  const imageIds = [...imageIdGroups[initialImageIdGroupIndex]];
26
27
  let leftIndex = initialImageIdGroupIndex - 1;
27
28
  let rightIndex = initialImageIdGroupIndex + 1;
@@ -38,42 +39,66 @@ export default class StreamingDynamicImageVolume extends BaseStreamingImageVolum
38
39
  getImageIdsToLoad() {
39
40
  return this._getImageIdsToLoad();
40
41
  }
41
- get timePointIndex() {
42
- return this._timePointIndex;
42
+ get dimensionGroupNumber() {
43
+ return this._dimensionGroupNumber;
43
44
  }
44
45
  set timePointIndex(index) {
45
- if (this._timePointIndex === index) {
46
+ console.warn('Warning: timePointIndex is deprecated. Please use dimensionGroupNumber instead. Note that timePointIndex is zero-based while dimensionGroupNumber starts at 1.');
47
+ this.dimensionGroupNumber = index + 1;
48
+ }
49
+ set dimensionGroupNumber(dimensionGroupNumber) {
50
+ if (this._dimensionGroupNumber === dimensionGroupNumber) {
46
51
  return;
47
52
  }
48
- this._timePointIndex = index;
49
- this.voxelManager.setTimePoint(index);
53
+ this._dimensionGroupNumber = dimensionGroupNumber;
54
+ this.voxelManager.setDimensionGroupNumber(dimensionGroupNumber);
50
55
  this.invalidateVolume(true);
56
+ triggerEvent(eventTarget, Events.DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED, {
57
+ volumeId: this.volumeId,
58
+ dimensionGroupNumber: dimensionGroupNumber,
59
+ numDimensionGroups: this.numDimensionGroups,
60
+ imageIdGroupIndex: dimensionGroupNumber - 1,
61
+ numImageIdGroups: this.numDimensionGroups,
62
+ splittingTag: this.splittingTag,
63
+ });
51
64
  triggerEvent(eventTarget, Events.DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED, {
52
65
  volumeId: this.volumeId,
53
- timePointIndex: index,
54
- numTimePoints: this.numTimePoints,
55
- imageIdGroupIndex: index,
56
- numImageIdGroups: this.numTimePoints,
66
+ timePointIndex: dimensionGroupNumber - 1,
67
+ numTimePoints: this.numDimensionGroups,
68
+ imageIdGroupIndex: dimensionGroupNumber - 1,
69
+ numImageIdGroups: this.numDimensionGroups,
57
70
  splittingTag: this.splittingTag,
58
71
  });
59
72
  }
73
+ get timePointIndex() {
74
+ console.warn('Warning: timePointIndex is deprecated. Please use dimensionGroupNumber instead. Note that timePointIndex is zero-based while dimensionGroupNumber starts at 1.');
75
+ return this._dimensionGroupNumber - 1;
76
+ }
60
77
  scroll(delta) {
61
- const newIndex = this._timePointIndex + delta;
62
- if (newIndex < 0) {
63
- this.timePointIndex = this.numTimePoints - 1;
78
+ const newDimensionGroupNumber = this._dimensionGroupNumber + delta;
79
+ if (newDimensionGroupNumber < 1) {
80
+ this.dimensionGroupNumber = this.numDimensionGroups;
64
81
  }
65
- else if (newIndex >= this.numTimePoints) {
66
- this.timePointIndex = 0;
82
+ else if (newDimensionGroupNumber > this.numDimensionGroups) {
83
+ this.dimensionGroupNumber = 1;
67
84
  }
68
85
  else {
69
- this.timePointIndex = newIndex;
86
+ this.dimensionGroupNumber = newDimensionGroupNumber;
70
87
  }
71
88
  }
89
+ getCurrentDimensionGroupImageIds() {
90
+ return this._imageIdGroups[this._dimensionGroupNumber - 1];
91
+ }
72
92
  getCurrentTimePointImageIds() {
73
- return this._imageIdGroups[this._timePointIndex];
93
+ console.warn('Warning: getCurrentTimePointImageIds is deprecated. Please use getCurrentDimensionGroupImageIds instead.');
94
+ return this.getCurrentDimensionGroupImageIds();
74
95
  }
75
96
  flatImageIdIndexToTimePointIndex(flatImageIdIndex) {
76
- return Math.floor(flatImageIdIndex / this._imageIdGroups[0].length);
97
+ console.warn('Warning: flatImageIdIndexToTimePointIndex is deprecated. Please use flatImageIdIndexToDimensionGroupNumber instead.');
98
+ return this.flatImageIdIndexToDimensionGroupNumber(flatImageIdIndex) - 1;
99
+ }
100
+ flatImageIdIndexToDimensionGroupNumber(flatImageIdIndex) {
101
+ return Math.floor(flatImageIdIndex / this._imageIdGroups[0].length) + 1;
77
102
  }
78
103
  flatImageIdIndexToImageIdIndex(flatImageIdIndex) {
79
104
  return flatImageIdIndex % this._imageIdGroups[0].length;
@@ -82,24 +107,36 @@ export default class StreamingDynamicImageVolume extends BaseStreamingImageVolum
82
107
  return this._splittingTag;
83
108
  }
84
109
  isTimePointLoaded(timePointIndex) {
85
- return this._loadedTimePoints.has(timePointIndex);
110
+ console.warn('Warning: isTimePointLoaded is deprecated. Please use isDimensionGroupLoaded instead. Note that timePointIndex is zero-based while dimensionGroupNumber starts at 1.');
111
+ return this.isDimensionGroupLoaded(timePointIndex + 1);
112
+ }
113
+ isDimensionGroupLoaded(dimensionGroupNumber) {
114
+ return this._loadedDimensionGroups.has(dimensionGroupNumber);
86
115
  }
87
- markTimePointAsLoaded(timePointIndex) {
88
- this._loadedTimePoints.add(timePointIndex);
116
+ markDimensionGroupAsLoaded(dimensionGroupNumber) {
117
+ this._loadedDimensionGroups.add(dimensionGroupNumber);
118
+ triggerEvent(eventTarget, Events.DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED, {
119
+ volumeId: this.volumeId,
120
+ dimensionGroupNumber: dimensionGroupNumber,
121
+ });
89
122
  triggerEvent(eventTarget, Events.DYNAMIC_VOLUME_TIME_POINT_LOADED, {
90
123
  volumeId: this.volumeId,
91
- timePointIndex,
124
+ timePointIndex: dimensionGroupNumber - 1,
92
125
  });
93
126
  }
94
127
  checkTimePointCompletion(imageIdIndex) {
95
- const timePointIndex = this.flatImageIdIndexToTimePointIndex(imageIdIndex);
96
- const imageIdsInTimePoint = this._imageIdGroups[timePointIndex];
97
- const allLoaded = imageIdsInTimePoint.every((imageId) => {
128
+ console.warn('Warning: checkTimePointCompletion is deprecated. Please use checkDimensionGroupCompletion instead.');
129
+ this.checkDimensionGroupCompletion(imageIdIndex);
130
+ }
131
+ checkDimensionGroupCompletion(imageIdIndex) {
132
+ const dimensionGroupNumber = this.flatImageIdIndexToDimensionGroupNumber(imageIdIndex);
133
+ const imageIdsInDimensionGroup = this._imageIdGroups[dimensionGroupNumber - 1];
134
+ const allLoaded = imageIdsInDimensionGroup.every((imageId) => {
98
135
  const index = this.getImageIdIndex(imageId);
99
136
  return this.cachedFrames[index] === ImageQualityStatus.FULL_RESOLUTION;
100
137
  });
101
- if (allLoaded && !this.isTimePointLoaded(timePointIndex)) {
102
- this.markTimePointAsLoaded(timePointIndex);
138
+ if (allLoaded && !this.isDimensionGroupLoaded(dimensionGroupNumber)) {
139
+ this.markDimensionGroupAsLoaded(dimensionGroupNumber);
103
140
  }
104
141
  }
105
142
  }
@@ -36,7 +36,9 @@ declare enum Events {
36
36
  CLIPPING_PLANES_UPDATED = "CORNERSTONE_CLIPPING_PLANES_UPDATED",
37
37
  WEB_WORKER_PROGRESS = "CORNERSTONE_WEB_WORKER_PROGRESS",
38
38
  COLORMAP_MODIFIED = "CORNERSTONE_COLORMAP_MODIFIED",
39
+ DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED = "DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED",
39
40
  DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED = "DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED",
41
+ DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED = "DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED",
40
42
  DYNAMIC_VOLUME_TIME_POINT_LOADED = "DYNAMIC_VOLUME_TIME_POINT_LOADED",
41
43
  GEOMETRY_LOADED = "GEOMETRY_LOADED",
42
44
  GEOMETRY_LOADED_FAILED = "GEOMETRY_LOADED_FAILED"
@@ -37,7 +37,9 @@ var Events;
37
37
  Events["CLIPPING_PLANES_UPDATED"] = "CORNERSTONE_CLIPPING_PLANES_UPDATED";
38
38
  Events["WEB_WORKER_PROGRESS"] = "CORNERSTONE_WEB_WORKER_PROGRESS";
39
39
  Events["COLORMAP_MODIFIED"] = "CORNERSTONE_COLORMAP_MODIFIED";
40
+ Events["DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED"] = "DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED";
40
41
  Events["DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED"] = "DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED";
42
+ Events["DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED"] = "DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED";
41
43
  Events["DYNAMIC_VOLUME_TIME_POINT_LOADED"] = "DYNAMIC_VOLUME_TIME_POINT_LOADED";
42
44
  Events["GEOMETRY_LOADED"] = "GEOMETRY_LOADED";
43
45
  Events["GEOMETRY_LOADED_FAILED"] = "GEOMETRY_LOADED_FAILED";
@@ -18,7 +18,7 @@ function cornerstoneStreamingDynamicImageVolumeLoader(volumeId, options) {
18
18
  const voxelManager = VoxelManager.createScalarDynamicVolumeVoxelManager({
19
19
  dimensions,
20
20
  imageIdGroups: sortedImageIdGroups,
21
- timePoint: 0,
21
+ dimensionGroupNumber: 1,
22
22
  numberOfComponents,
23
23
  });
24
24
  let streamingImageVolume = new StreamingDynamicImageVolume({
@@ -71,7 +71,7 @@ export function createAndCacheDerivedVolume(referencedVolumeId, options) {
71
71
  }
72
72
  const { metadata, dimensions, spacing, origin, direction } = referencedVolume;
73
73
  const referencedImageIds = referencedVolume.isDynamicVolume()
74
- ? referencedVolume.getCurrentTimePointImageIds()
74
+ ? referencedVolume.getCurrentDimensionGroupImageIds()
75
75
  : referencedVolume.imageIds ?? [];
76
76
  const derivedImages = createAndCacheDerivedImages(referencedImageIds, {
77
77
  targetBuffer: options.targetBuffer,
@@ -1,7 +1,10 @@
1
1
  import type IImageVolume from './IImageVolume';
2
2
  interface IDynamicImageVolume extends IImageVolume {
3
+ get dimensionGroupNumber(): number;
4
+ set dimensionGroupNumber(dimensionGroupNumber: number);
5
+ get numDimensionGroups(): number;
3
6
  get timePointIndex(): number;
4
- set timePointIndex(newTimePointIndex: number);
7
+ set timePointIndex(timePointIndex: number);
5
8
  get numTimePoints(): number;
6
9
  scroll(delta: number): void;
7
10
  }
@@ -93,10 +93,11 @@ export default class VoxelManager<T> {
93
93
  scalarData: any;
94
94
  numberOfComponents?: number;
95
95
  }): IVoxelManager<number> | IVoxelManager<RGB>;
96
- static createScalarDynamicVolumeVoxelManager({ imageIdGroups, dimensions, timePoint, numberOfComponents, }: {
96
+ static createScalarDynamicVolumeVoxelManager({ imageIdGroups, dimensions, dimensionGroupNumber, timePoint, numberOfComponents, }: {
97
97
  imageIdGroups: string[][];
98
98
  dimensions: Point3;
99
- timePoint: number;
99
+ dimensionGroupNumber?: number;
100
+ timePoint?: number;
100
101
  numberOfComponents?: number;
101
102
  }): IVoxelManager<number> | IVoxelManager<RGB>;
102
103
  static createImageVoxelManager({ width, height, scalarData, numberOfComponents, }: {
@@ -71,6 +71,7 @@ export default class VoxelManager {
71
71
  ],
72
72
  pointInShapeFn: isInObject,
73
73
  callback,
74
+ returnPoints,
74
75
  });
75
76
  return pointsInShape;
76
77
  }
@@ -570,7 +571,15 @@ export default class VoxelManager {
570
571
  scalarData,
571
572
  });
572
573
  }
573
- static createScalarDynamicVolumeVoxelManager({ imageIdGroups, dimensions, timePoint = 0, numberOfComponents = 1, }) {
574
+ static createScalarDynamicVolumeVoxelManager({ imageIdGroups, dimensions, dimensionGroupNumber = 1, timePoint = 0, numberOfComponents = 1, }) {
575
+ let activeDimensionGroup = 0;
576
+ if (dimensionGroupNumber !== undefined) {
577
+ activeDimensionGroup = dimensionGroupNumber - 1;
578
+ }
579
+ else if (timePoint !== undefined) {
580
+ console.warn('Warning: timePoint parameter is deprecated. Please use dimensionGroupNumber instead. timePoint is zero-based while dimensionGroupNumber starts at 1.');
581
+ activeDimensionGroup = timePoint;
582
+ }
574
583
  if (!numberOfComponents) {
575
584
  const firstImage = cache.getImage(imageIdGroups[0][0]);
576
585
  if (!firstImage) {
@@ -592,39 +601,59 @@ export default class VoxelManager {
592
601
  });
593
602
  });
594
603
  const voxelManager = new VoxelManager(dimensions, {
595
- _get: (index) => voxelGroups[timePoint]._get(index),
596
- _set: (index, v) => voxelGroups[timePoint]._set(index, v),
604
+ _get: (index) => voxelGroups[activeDimensionGroup]._get(index),
605
+ _set: (index, v) => voxelGroups[activeDimensionGroup]._set(index, v),
597
606
  numberOfComponents,
598
607
  _id: 'createScalarDynamicVolumeVoxelManager',
599
608
  });
600
609
  voxelManager.getScalarDataLength = () => {
601
- return voxelGroups[timePoint].getScalarDataLength();
610
+ return voxelGroups[activeDimensionGroup].getScalarDataLength();
602
611
  };
603
612
  voxelManager.getConstructor = () => {
604
- return voxelGroups[timePoint].getConstructor();
613
+ return voxelGroups[activeDimensionGroup].getConstructor();
605
614
  };
606
615
  voxelManager.getRange = () => {
607
- return voxelGroups[timePoint].getRange();
616
+ return voxelGroups[activeDimensionGroup].getRange();
608
617
  };
609
618
  voxelManager.getMiddleSliceData = () => {
610
- return voxelGroups[timePoint].getMiddleSliceData();
619
+ return voxelGroups[activeDimensionGroup].getMiddleSliceData();
611
620
  };
612
621
  voxelManager.setTimePoint = (newTimePoint) => {
613
- timePoint = newTimePoint;
614
- voxelManager._get = (index) => voxelGroups[timePoint]._get(index);
615
- voxelManager._set = (index, v) => voxelGroups[timePoint]._set(index, v);
622
+ console.warn('Warning: setTimePoint is deprecated. Please use setDimensionGroupNumber instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1.');
623
+ voxelManager.setDimensionGroupNumber(newTimePoint + 1);
624
+ };
625
+ voxelManager.setDimensionGroupNumber = (newDimensionGroupNumber) => {
626
+ activeDimensionGroup = newDimensionGroupNumber - 1;
627
+ voxelManager._get = (index) => voxelGroups[activeDimensionGroup]._get(index);
628
+ voxelManager._set = (index, v) => voxelGroups[activeDimensionGroup]._set(index, v);
616
629
  };
617
630
  voxelManager.getAtIndexAndTimePoint = (index, tp) => {
618
- return voxelGroups[tp]._get(index);
631
+ console.warn('Warning: getAtIndexAndTimePoint is deprecated. Please use getAtIndexAndDimensionGroup instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1.');
632
+ return voxelManager.getAtIndexAndDimensionGroup(index, tp + 1);
619
633
  };
620
- voxelManager.getTimePointScalarData = (tp) => {
621
- return voxelGroups[tp].getCompleteScalarDataArray();
634
+ voxelManager.getAtIndexAndDimensionGroup = (index, dimensionGroupNumber) => {
635
+ return voxelGroups[dimensionGroupNumber - 1]._get(index);
622
636
  };
623
637
  voxelManager.getTimePointScalarData = (tp) => {
624
- return voxelGroups[tp].getCompleteScalarDataArray();
638
+ console.warn('Warning: getTimePointScalarData is deprecated. Please use getDimensionGroupScalarData instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1.');
639
+ return voxelManager.getDimensionGroupScalarData(tp + 1);
640
+ };
641
+ voxelManager.getDimensionGroupScalarData = (dimensionGroupNumber) => {
642
+ return voxelGroups[dimensionGroupNumber - 1].getCompleteScalarDataArray();
625
643
  };
626
644
  voxelManager.getCurrentTimePointScalarData = () => {
627
- return voxelGroups[timePoint].getCompleteScalarDataArray();
645
+ console.warn('Warning: getCurrentTimePointScalarData is deprecated. Please use getCurrentDimensionGroupScalarData instead.');
646
+ return voxelManager.getCurrentDimensionGroupScalarData();
647
+ };
648
+ voxelManager.getCurrentDimensionGroupScalarData = () => {
649
+ return voxelGroups[activeDimensionGroup].getCompleteScalarDataArray();
650
+ };
651
+ voxelManager.getCurrentTimePoint = () => {
652
+ console.warn('Warning: getCurrentTimePoint is deprecated. Please use getCurrentDimensionGroupNumber instead. Note that timePoint is zero-based while dimensionGroupNumber starts at 1.');
653
+ return activeDimensionGroup;
654
+ };
655
+ voxelManager.getCurrentDimensionGroupNumber = () => {
656
+ return activeDimensionGroup + 1;
628
657
  };
629
658
  return voxelManager;
630
659
  }
@@ -29,10 +29,11 @@ export declare function iterateOverPointsInShape({ imageData, bounds, scalarData
29
29
  pointInShapeFn: any;
30
30
  callback: any;
31
31
  }): PointInShape[];
32
- export declare function iterateOverPointsInShapeVoxelManager({ voxelManager, bounds, imageData, pointInShapeFn, callback, }: {
32
+ export declare function iterateOverPointsInShapeVoxelManager({ voxelManager, bounds, imageData, pointInShapeFn, callback, returnPoints, }: {
33
33
  voxelManager: any;
34
34
  bounds: any;
35
35
  imageData: any;
36
36
  pointInShapeFn: any;
37
37
  callback: any;
38
+ returnPoints: any;
38
39
  }): PointInShape[];
@@ -73,7 +73,7 @@ export function iterateOverPointsInShape({ imageData, bounds, scalarData, pointI
73
73
  }
74
74
  return pointsInShape;
75
75
  }
76
- export function iterateOverPointsInShapeVoxelManager({ voxelManager, bounds, imageData, pointInShapeFn, callback, }) {
76
+ export function iterateOverPointsInShapeVoxelManager({ voxelManager, bounds, imageData, pointInShapeFn, callback, returnPoints, }) {
77
77
  const [[iMin, iMax], [jMin, jMax], [kMin, kMax]] = bounds;
78
78
  const indexToWorld = createPositionCallback(imageData);
79
79
  const pointIJK = [0, 0, 0];
@@ -88,12 +88,14 @@ export function iterateOverPointsInShapeVoxelManager({ voxelManager, bounds, ima
88
88
  if (pointInShapeFn(pointLPS, pointIJK)) {
89
89
  const index = voxelManager.toIndex(pointIJK);
90
90
  const value = voxelManager.getAtIndex(index);
91
- pointsInShape.push({
92
- value,
93
- index,
94
- pointIJK: [...pointIJK],
95
- pointLPS: pointLPS.slice(),
96
- });
91
+ if (returnPoints) {
92
+ pointsInShape.push({
93
+ value,
94
+ index,
95
+ pointIJK: [...pointIJK],
96
+ pointLPS: pointLPS.slice(),
97
+ });
98
+ }
97
99
  callback?.({ value, index, pointIJK, pointLPS });
98
100
  }
99
101
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/core",
3
- "version": "2.16.0",
3
+ "version": "2.17.0",
4
4
  "description": "Cornerstone3D Core",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/esm/index.d.ts",
@@ -82,5 +82,5 @@
82
82
  "type": "individual",
83
83
  "url": "https://ohif.org/donate"
84
84
  },
85
- "gitHead": "9cbc1919dc5f7a19762d526e3e3d42eec05a0e21"
85
+ "gitHead": "912559cd9b86ddac21f2e0d6087980fc02343f52"
86
86
  }