@cornerstonejs/core 4.15.18 → 4.15.19
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.
|
@@ -531,11 +531,6 @@ class Viewport {
|
|
|
531
531
|
const spacing = imageData.getSpacing();
|
|
532
532
|
widthWorld = Math.max(spacing[0], widthWorld - spacing[0]);
|
|
533
533
|
heightWorld = Math.max(spacing[1], heightWorld - spacing[1]);
|
|
534
|
-
const extent = imageData.getExtent();
|
|
535
|
-
const widthWorld2 = (extent[1] - extent[0]) * spacing[0];
|
|
536
|
-
const heightWorld2 = (extent[3] - extent[2]) * spacing[1];
|
|
537
|
-
console.warn('extent=', extent, spacing);
|
|
538
|
-
console.log('New method would produce:', this.id, widthWorld2, heightWorld2, widthWorld, heightWorld, widthWorld2 - widthWorld, heightWorld2 - heightWorld);
|
|
539
534
|
}
|
|
540
535
|
const canvasSize = [this.sWidth, this.sHeight];
|
|
541
536
|
const boundsAspectRatio = widthWorld / heightWorld;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as metaData from '../metaData';
|
|
2
|
+
import { toFiniteNumber } from './toNumber';
|
|
2
3
|
function generateFrameImageId(baseImageId, frameNumber) {
|
|
3
4
|
const framePattern = /\/frames\/\d+/;
|
|
4
5
|
if (!framePattern.test(baseImageId)) {
|
|
@@ -67,6 +68,78 @@ function handleMultiframe4D(imageIds) {
|
|
|
67
68
|
splittingTag: 'TimeSlotVector',
|
|
68
69
|
};
|
|
69
70
|
}
|
|
71
|
+
function handleCardiac4D(imageIds) {
|
|
72
|
+
if (!imageIds || imageIds.length === 0) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
const cardiacNumberOfImages = getFiniteValue(imageIds[0], 'CardiacNumberOfImages');
|
|
76
|
+
if (cardiacNumberOfImages === undefined) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const stacks = new Map();
|
|
80
|
+
for (const imageId of imageIds) {
|
|
81
|
+
const stackId = metaData.get('StackID', imageId);
|
|
82
|
+
const inStackPositionNumber = getFiniteValue(imageId, 'InStackPositionNumber');
|
|
83
|
+
const triggerTime = getFiniteValue(imageId, 'TriggerTime');
|
|
84
|
+
if (stackId === undefined ||
|
|
85
|
+
inStackPositionNumber === undefined ||
|
|
86
|
+
triggerTime === undefined) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const stackKey = String(stackId);
|
|
90
|
+
if (!stacks.has(stackKey)) {
|
|
91
|
+
stacks.set(stackKey, new Map());
|
|
92
|
+
}
|
|
93
|
+
const positions = stacks.get(stackKey);
|
|
94
|
+
if (!positions.has(inStackPositionNumber)) {
|
|
95
|
+
positions.set(inStackPositionNumber, []);
|
|
96
|
+
}
|
|
97
|
+
positions.get(inStackPositionNumber).push({ imageId, triggerTime });
|
|
98
|
+
}
|
|
99
|
+
const sortedStackIds = Array.from(stacks.keys()).sort((a, b) => Number(a) - Number(b));
|
|
100
|
+
if (sortedStackIds.length === 0) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
const preparedStacks = [];
|
|
104
|
+
let timeCount;
|
|
105
|
+
for (const stackId of sortedStackIds) {
|
|
106
|
+
const positions = stacks.get(stackId);
|
|
107
|
+
const sortedPositions = Array.from(positions.keys()).sort((a, b) => a - b);
|
|
108
|
+
for (const position of sortedPositions) {
|
|
109
|
+
const frames = positions.get(position);
|
|
110
|
+
frames.sort((a, b) => a.triggerTime - b.triggerTime);
|
|
111
|
+
if (timeCount === undefined) {
|
|
112
|
+
timeCount = frames.length;
|
|
113
|
+
}
|
|
114
|
+
else if (frames.length !== timeCount) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
preparedStacks.push({
|
|
119
|
+
stackId,
|
|
120
|
+
positions: sortedPositions,
|
|
121
|
+
framesByPosition: positions,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (!timeCount) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const imageIdGroups = [];
|
|
128
|
+
for (let timeIndex = 0; timeIndex < timeCount; timeIndex++) {
|
|
129
|
+
const group = [];
|
|
130
|
+
for (const stack of preparedStacks) {
|
|
131
|
+
for (const position of stack.positions) {
|
|
132
|
+
const frames = stack.framesByPosition.get(position);
|
|
133
|
+
group.push(frames[timeIndex].imageId);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
imageIdGroups.push(group);
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
imageIdGroups,
|
|
140
|
+
splittingTag: 'CardiacTriggerTime',
|
|
141
|
+
};
|
|
142
|
+
}
|
|
70
143
|
const groupBy = (array, key) => {
|
|
71
144
|
return array.reduce((rv, x) => {
|
|
72
145
|
(rv[x[key]] = rv[x[key]] || []).push(x);
|
|
@@ -127,6 +200,9 @@ function getTagValue(imageId, tag) {
|
|
|
127
200
|
return undefined;
|
|
128
201
|
}
|
|
129
202
|
}
|
|
203
|
+
function getFiniteValue(imageId, tag) {
|
|
204
|
+
return toFiniteNumber(getTagValue(imageId, tag));
|
|
205
|
+
}
|
|
130
206
|
function getPhilipsPrivateBValue(imageId) {
|
|
131
207
|
const value = metaData.get('20011003', imageId);
|
|
132
208
|
try {
|
|
@@ -192,6 +268,10 @@ function splitImageIdsBy4DTags(imageIds) {
|
|
|
192
268
|
if (multiframeResult) {
|
|
193
269
|
return multiframeResult;
|
|
194
270
|
}
|
|
271
|
+
const cardiacResult = handleCardiac4D(imageIds);
|
|
272
|
+
if (cardiacResult) {
|
|
273
|
+
return cardiacResult;
|
|
274
|
+
}
|
|
195
275
|
const positionGroups = getIPPGroups(imageIds);
|
|
196
276
|
if (!positionGroups) {
|
|
197
277
|
return { imageIdGroups: [imageIds], splittingTag: null };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toFiniteNumber(value: number | undefined): number | undefined;
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "4.15.
|
|
1
|
+
export declare const version = "4.15.19";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '4.15.
|
|
1
|
+
export const version = '4.15.19';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/core",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.19",
|
|
4
4
|
"description": "Cornerstone3D Core",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"type": "individual",
|
|
98
98
|
"url": "https://ohif.org/donate"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "dd0f433bee1e2b63177b21a52cb1b2cc39f0a88f"
|
|
101
101
|
}
|