@cornerstonejs/tools 3.8.6 → 3.9.1

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.
@@ -54,7 +54,7 @@ async function render(viewport, representation) {
54
54
  console.warn(`No Surfaces found for geometryId ${geometryId}. Skipping render.`);
55
55
  return;
56
56
  }
57
- const segmentIndex = geometry.data.segmentIndex;
57
+ const { segmentIndex } = geometry.data;
58
58
  const hiddenSegments = internalGetHiddenSegmentIndices(viewport.id, {
59
59
  segmentationId,
60
60
  type,
@@ -172,10 +172,11 @@ class RectangleROIStartEndThresholdTool extends RectangleROITool {
172
172
  let endCoord = endCoordinate;
173
173
  if (Array.isArray(startCoordinate)) {
174
174
  startCoord = this._getCoordinateForViewplaneNormal(startCoord, viewplaneNormal);
175
+ const indexOfDirection = this._getIndexOfCoordinatesForViewplaneNormal(viewplaneNormal);
176
+ data.handles.points.forEach((point) => {
177
+ point[indexOfDirection] = startCoord;
178
+ });
175
179
  data.startCoordinate = startCoord;
176
- data.handles.points[0][this._getIndexOfCoordinatesForViewplaneNormal(viewplaneNormal)] = startCoord;
177
- data.startCoordinate = startCoord;
178
- data.handles.points[0][this._getIndexOfCoordinatesForViewplaneNormal(viewplaneNormal)] = startCoord;
179
180
  }
180
181
  if (Array.isArray(endCoordinate)) {
181
182
  endCoord = this._getCoordinateForViewplaneNormal(endCoord, viewplaneNormal);
@@ -51,6 +51,9 @@ type NamedStatistics = {
51
51
  minLPS?: Statistics & {
52
52
  name: 'minLPS';
53
53
  };
54
+ center?: Statistics & {
55
+ name: 'center';
56
+ };
54
57
  maxIJKs?: Array<{
55
58
  value: number;
56
59
  pointIJK: Types.Point3;
@@ -17,6 +17,7 @@ function createBasicStatsState(storePointData) {
17
17
  m4: [0],
18
18
  allValues: [[]],
19
19
  pointsInShape: storePointData ? PointsManager.create3(1024) : null,
20
+ sumLPS: [0, 0, 0],
20
21
  };
21
22
  }
22
23
  function basicStatsCallback(state, newValue, pointLPS = null, pointIJK = null) {
@@ -37,6 +38,11 @@ function basicStatsCallback(state, newValue, pointLPS = null, pointIJK = null) {
37
38
  }
38
39
  const newArray = Array.isArray(newValue) ? newValue : [newValue];
39
40
  state.count += 1;
41
+ if (pointLPS) {
42
+ state.sumLPS[0] += pointLPS[0];
43
+ state.sumLPS[1] += pointLPS[1];
44
+ state.sumLPS[2] += pointLPS[2];
45
+ }
40
46
  state.max.forEach((it, idx) => {
41
47
  const value = newArray[idx];
42
48
  state.allValues[idx].push(value);
@@ -84,6 +90,7 @@ function calculateMedian(values) {
84
90
  function basicGetStatistics(state, unit) {
85
91
  const mean = state.sum.map((sum) => sum / state.count);
86
92
  const stdDev = state.m2.map((squaredDiffSum) => Math.sqrt(squaredDiffSum / state.count));
93
+ const center = state.sumLPS.map((sum) => sum / state.count);
87
94
  const skewness = state.m3.map((m3, idx) => {
88
95
  const variance = state.m2[idx] / state.count;
89
96
  if (variance === 0) {
@@ -165,9 +172,18 @@ function basicGetStatistics(state, unit) {
165
172
  unit: null,
166
173
  },
167
174
  pointsInShape: state.pointsInShape,
175
+ center: {
176
+ name: 'center',
177
+ label: 'Center',
178
+ value: center ? [...center] : null,
179
+ unit: null,
180
+ },
168
181
  array: [],
169
182
  };
170
183
  named.array.push(named.min, named.max, named.mean, named.stdDev, named.median, named.skewness, named.kurtosis, named.count, named.maxLPS, named.minLPS);
184
+ if (named.center.value) {
185
+ named.array.push(named.center);
186
+ }
171
187
  const store = state.pointsInShape !== null;
172
188
  const freshState = createBasicStatsState(store);
173
189
  state.max = freshState.max;
@@ -184,6 +200,7 @@ function basicGetStatistics(state, unit) {
184
200
  state.m4 = freshState.m4;
185
201
  state.allValues = freshState.allValues;
186
202
  state.pointsInShape = freshState.pointsInShape;
203
+ state.sumLPS = freshState.sumLPS;
187
204
  return named;
188
205
  }
189
206
  export class BasicStatsCalculator extends Calculator {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cornerstonejs/tools",
3
- "version": "3.8.6",
3
+ "version": "3.9.1",
4
4
  "description": "Cornerstone3D Tools",
5
5
  "types": "./dist/esm/index.d.ts",
6
6
  "module": "./dist/esm/index.js",
@@ -103,7 +103,7 @@
103
103
  "canvas": "^3.1.0"
104
104
  },
105
105
  "peerDependencies": {
106
- "@cornerstonejs/core": "^3.8.6",
106
+ "@cornerstonejs/core": "^3.9.1",
107
107
  "@kitware/vtk.js": "32.12.1",
108
108
  "@types/d3-array": "^3.0.4",
109
109
  "@types/d3-interpolate": "^3.0.1",
@@ -122,5 +122,5 @@
122
122
  "type": "individual",
123
123
  "url": "https://ohif.org/donate"
124
124
  },
125
- "gitHead": "02c3b0d68c4a450e2b2abdb4e4c6295d923e91b2"
125
+ "gitHead": "0511bf112a469f5ca8888a923947dda2a5525104"
126
126
  }