@cornerstonejs/tools 1.65.3 → 1.65.5
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.
- package/dist/cjs/stateManagement/annotation/annotationSelection.js +2 -1
- package/dist/cjs/stateManagement/annotation/annotationSelection.js.map +1 -1
- package/dist/cjs/tools/MIPJumpToClickTool.js +2 -1
- package/dist/cjs/tools/MIPJumpToClickTool.js.map +1 -1
- package/dist/cjs/tools/StackScrollToolMouseWheelTool.js +2 -1
- package/dist/cjs/tools/StackScrollToolMouseWheelTool.js.map +1 -1
- package/dist/cjs/tools/annotation/CircleROITool.js +4 -4
- package/dist/cjs/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/EllipticalROITool.js +5 -5
- package/dist/cjs/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js +4 -4
- package/dist/cjs/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/cjs/tools/annotation/RectangleROITool.js +4 -4
- package/dist/cjs/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationDisplayTool.js +2 -1
- package/dist/cjs/tools/base/AnnotationDisplayTool.js.map +1 -1
- package/dist/cjs/tools/base/AnnotationTool.js +2 -1
- package/dist/cjs/tools/base/AnnotationTool.js.map +1 -1
- package/dist/cjs/tools/base/BaseTool.js +2 -1
- package/dist/cjs/tools/base/BaseTool.js.map +1 -1
- package/dist/cjs/types/CalculatorTypes.d.ts +29 -1
- package/dist/cjs/types/index.d.ts +2 -2
- package/dist/cjs/utilities/getVolumeId.d.ts +1 -0
- package/dist/cjs/utilities/getVolumeId.js +16 -0
- package/dist/cjs/utilities/getVolumeId.js.map +1 -0
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.d.ts +2 -2
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.js +34 -11
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.js.map +1 -1
- package/dist/cjs/utilities/math/basic/Calculator.d.ts +2 -2
- package/dist/cjs/utilities/math/basic/Calculator.js.map +1 -1
- package/dist/esm/stateManagement/annotation/annotationSelection.js +1 -1
- package/dist/esm/stateManagement/annotation/annotationSelection.js.map +1 -1
- package/dist/esm/tools/MIPJumpToClickTool.js +2 -1
- package/dist/esm/tools/MIPJumpToClickTool.js.map +1 -1
- package/dist/esm/tools/StackScrollToolMouseWheelTool.js +2 -1
- package/dist/esm/tools/StackScrollToolMouseWheelTool.js.map +1 -1
- package/dist/esm/tools/annotation/CircleROITool.js +4 -4
- package/dist/esm/tools/annotation/CircleROITool.js.map +1 -1
- package/dist/esm/tools/annotation/EllipticalROITool.js +5 -5
- package/dist/esm/tools/annotation/EllipticalROITool.js.map +1 -1
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js +4 -4
- package/dist/esm/tools/annotation/PlanarFreehandROITool.js.map +1 -1
- package/dist/esm/tools/annotation/RectangleROITool.js +4 -4
- package/dist/esm/tools/annotation/RectangleROITool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js +2 -1
- package/dist/esm/tools/base/AnnotationDisplayTool.js.map +1 -1
- package/dist/esm/tools/base/AnnotationTool.js +2 -1
- package/dist/esm/tools/base/AnnotationTool.js.map +1 -1
- package/dist/esm/tools/base/BaseTool.js +2 -1
- package/dist/esm/tools/base/BaseTool.js.map +1 -1
- package/dist/esm/utilities/getVolumeId.js +12 -0
- package/dist/esm/utilities/getVolumeId.js.map +1 -0
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +34 -11
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js.map +1 -1
- package/dist/esm/utilities/math/basic/Calculator.js.map +1 -1
- package/dist/types/tools/MIPJumpToClickTool.d.ts.map +1 -1
- package/dist/types/tools/StackScrollToolMouseWheelTool.d.ts.map +1 -1
- package/dist/types/tools/base/AnnotationDisplayTool.d.ts.map +1 -1
- package/dist/types/tools/base/AnnotationTool.d.ts.map +1 -1
- package/dist/types/tools/base/BaseTool.d.ts.map +1 -1
- package/dist/types/types/CalculatorTypes.d.ts +29 -1
- package/dist/types/types/CalculatorTypes.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -2
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utilities/getVolumeId.d.ts +2 -0
- package/dist/types/utilities/getVolumeId.d.ts.map +1 -0
- package/dist/types/utilities/math/basic/BasicStatsCalculator.d.ts +2 -2
- package/dist/types/utilities/math/basic/BasicStatsCalculator.d.ts.map +1 -1
- package/dist/types/utilities/math/basic/Calculator.d.ts +2 -2
- package/dist/types/utilities/math/basic/Calculator.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.map +1 -1
- package/package.json +3 -3
- package/src/stateManagement/annotation/annotationSelection.ts +1 -1
- package/src/tools/MIPJumpToClickTool.ts +2 -1
- package/src/tools/StackScrollToolMouseWheelTool.ts +2 -1
- package/src/tools/annotation/CircleROITool.ts +4 -4
- package/src/tools/annotation/EllipticalROITool.ts +5 -5
- package/src/tools/annotation/PlanarFreehandROITool.ts +4 -4
- package/src/tools/annotation/RectangleROITool.ts +4 -4
- package/src/tools/base/AnnotationDisplayTool.ts +2 -1
- package/src/tools/base/AnnotationTool.ts +2 -1
- package/src/tools/base/BaseTool.ts +2 -1
- package/src/types/CalculatorTypes.ts +14 -1
- package/src/types/index.ts +4 -1
- package/src/utilities/getVolumeId.ts +13 -0
- package/src/utilities/math/basic/BasicStatsCalculator.ts +44 -14
- package/src/utilities/math/basic/Calculator.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/tools",
|
|
3
|
-
"version": "1.65.
|
|
3
|
+
"version": "1.65.5",
|
|
4
4
|
"description": "Cornerstone3D Tools",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"webpack:watch": "webpack --mode development --progress --watch --config ./.webpack/webpack.dev.js"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@cornerstonejs/core": "^1.65.
|
|
32
|
+
"@cornerstonejs/core": "^1.65.5",
|
|
33
33
|
"@icr/polyseg-wasm": "0.4.0",
|
|
34
34
|
"@types/offscreencanvas": "2019.7.3",
|
|
35
35
|
"comlink": "^4.4.1",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"type": "individual",
|
|
60
60
|
"url": "https://ohif.org/donate"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "bc54ae70cb2180d5ce42cc7eaa17633f0bb5f34a"
|
|
63
63
|
}
|
|
@@ -94,7 +94,7 @@ function getAnnotationsSelected(): Array<string> {
|
|
|
94
94
|
function getAnnotationsSelectedByToolName(toolName: string): Array<string> {
|
|
95
95
|
return getAnnotationsSelected().filter((annotationUID) => {
|
|
96
96
|
const annotation = getAnnotation(annotationUID);
|
|
97
|
-
return annotation
|
|
97
|
+
return annotation?.metadata?.toolName === toolName;
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -5,6 +5,7 @@ import { getPointInLineOfSightWithCriteria } from '../utilities/planar';
|
|
|
5
5
|
import jumpToWorld from '../utilities/viewport/jumpToWorld';
|
|
6
6
|
import { PublicToolProps, ToolProps } from '../types';
|
|
7
7
|
import { getToolGroupForViewport } from '../store/ToolGroupManager';
|
|
8
|
+
import { getVolumeId } from '../utilities/getVolumeId';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* On a Maximum Intensity Projection (MIP) viewport, MIPJumpToClickTool allows the
|
|
@@ -54,7 +55,7 @@ class MIPJumpToClickTool extends BaseTool {
|
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
const volumeId = targetId
|
|
58
|
+
const volumeId = getVolumeId(targetId);
|
|
58
59
|
|
|
59
60
|
// 3. Criteria function to search for the point (maximum intensity)
|
|
60
61
|
let maxIntensity = -Infinity;
|
|
@@ -2,6 +2,7 @@ import { getEnabledElement } from '@cornerstonejs/core';
|
|
|
2
2
|
import { BaseTool } from './base';
|
|
3
3
|
import { MouseWheelEventType } from '../types/EventTypes';
|
|
4
4
|
import scroll from '../utilities/scroll';
|
|
5
|
+
import { getVolumeId } from '../utilities/getVolumeId';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* The StackScrollMouseWheelTool is a tool that allows the user to scroll through a
|
|
@@ -35,7 +36,7 @@ class StackScrollMouseWheelTool extends BaseTool {
|
|
|
35
36
|
const delta = direction * (invert ? -1 : 1);
|
|
36
37
|
|
|
37
38
|
const targetId = this.getTargetId(viewport);
|
|
38
|
-
const volumeId = targetId
|
|
39
|
+
const volumeId = getVolumeId(targetId);
|
|
39
40
|
|
|
40
41
|
scroll(viewport, {
|
|
41
42
|
delta,
|
|
@@ -980,10 +980,10 @@ class CircleROITool extends AnnotationTool {
|
|
|
980
980
|
cachedStats[targetId] = {
|
|
981
981
|
Modality: metadata.Modality,
|
|
982
982
|
area,
|
|
983
|
-
mean: stats
|
|
984
|
-
max: stats
|
|
985
|
-
stdDev: stats
|
|
986
|
-
statsArray: stats,
|
|
983
|
+
mean: stats.mean?.value,
|
|
984
|
+
max: stats.max?.value,
|
|
985
|
+
stdDev: stats.stdDev?.value,
|
|
986
|
+
statsArray: stats.array,
|
|
987
987
|
pointsInShape: pointsInShape,
|
|
988
988
|
isEmptyArea,
|
|
989
989
|
areaUnit: getCalibratedAreaUnits(null, image),
|
|
@@ -1099,11 +1099,11 @@ class EllipticalROITool extends AnnotationTool {
|
|
|
1099
1099
|
cachedStats[targetId] = {
|
|
1100
1100
|
Modality: metadata.Modality,
|
|
1101
1101
|
area,
|
|
1102
|
-
mean: stats
|
|
1103
|
-
max: stats
|
|
1104
|
-
stdDev: stats
|
|
1105
|
-
statsArray: stats,
|
|
1106
|
-
pointsInShape
|
|
1102
|
+
mean: stats.mean?.value,
|
|
1103
|
+
max: stats.max?.value,
|
|
1104
|
+
stdDev: stats.stdDev?.value,
|
|
1105
|
+
statsArray: stats.array,
|
|
1106
|
+
pointsInShape,
|
|
1107
1107
|
isEmptyArea,
|
|
1108
1108
|
areaUnit: getCalibratedAreaUnits(null, image),
|
|
1109
1109
|
modalityUnit,
|
|
@@ -835,10 +835,10 @@ class PlanarFreehandROITool extends ContourSegmentationBaseTool {
|
|
|
835
835
|
cachedStats[targetId] = {
|
|
836
836
|
Modality: metadata.Modality,
|
|
837
837
|
area,
|
|
838
|
-
mean: stats
|
|
839
|
-
max: stats
|
|
840
|
-
stdDev: stats
|
|
841
|
-
statsArray: stats,
|
|
838
|
+
mean: stats.mean?.value,
|
|
839
|
+
max: stats.max?.value,
|
|
840
|
+
stdDev: stats.stdDev?.value,
|
|
841
|
+
statsArray: stats.array,
|
|
842
842
|
pointsInShape: pointsInShape,
|
|
843
843
|
areaUnit: getCalibratedAreaUnits(null, image),
|
|
844
844
|
modalityUnit,
|
|
@@ -954,10 +954,10 @@ class RectangleROITool extends AnnotationTool {
|
|
|
954
954
|
cachedStats[targetId] = {
|
|
955
955
|
Modality: metadata.Modality,
|
|
956
956
|
area,
|
|
957
|
-
mean: stats
|
|
958
|
-
stdDev: stats
|
|
959
|
-
max: stats
|
|
960
|
-
statsArray: stats,
|
|
957
|
+
mean: stats.mean?.value,
|
|
958
|
+
stdDev: stats.stdDev?.value,
|
|
959
|
+
max: stats.max?.value,
|
|
960
|
+
statsArray: stats.array,
|
|
961
961
|
pointsInShape: pointsInShape,
|
|
962
962
|
areaUnit: getCalibratedAreaUnits(null, image),
|
|
963
963
|
modalityUnit,
|
|
@@ -15,6 +15,7 @@ import filterAnnotationsForDisplay from '../../utilities/planar/filterAnnotation
|
|
|
15
15
|
import { getStyleProperty } from '../../stateManagement/annotation/config/helpers';
|
|
16
16
|
import { getState } from '../../stateManagement/annotation/config';
|
|
17
17
|
import { StyleSpecifier } from '../../types/AnnotationStyle';
|
|
18
|
+
import { getVolumeId } from '../../utilities/getVolumeId';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Abstract class for tools which create and display annotations on the
|
|
@@ -137,7 +138,7 @@ abstract class AnnotationDisplayTool extends BaseTool {
|
|
|
137
138
|
} else if (viewport instanceof VideoViewport) {
|
|
138
139
|
referencedImageId = targetId.split('videoId:')[1];
|
|
139
140
|
} else {
|
|
140
|
-
const volumeId = targetId
|
|
141
|
+
const volumeId = getVolumeId(targetId);
|
|
141
142
|
const imageVolume = cache.getVolume(volumeId);
|
|
142
143
|
|
|
143
144
|
referencedImageId = utilities.getClosestImageId(
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
import { addAnnotation } from '../../stateManagement/annotation/annotationState';
|
|
25
25
|
import { StyleSpecifier } from '../../types/AnnotationStyle';
|
|
26
26
|
import { triggerAnnotationModified } from '../../stateManagement/annotation/helpers/state';
|
|
27
|
+
import { getVolumeId } from '../../utilities/getVolumeId';
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* Abstract class for tools which create and display annotations on the
|
|
@@ -368,7 +369,7 @@ abstract class AnnotationTool extends AnnotationDisplayTool {
|
|
|
368
369
|
imageId?: string
|
|
369
370
|
): boolean {
|
|
370
371
|
if (viewport instanceof BaseVolumeViewport) {
|
|
371
|
-
const volumeId = targetId
|
|
372
|
+
const volumeId = getVolumeId(targetId);
|
|
372
373
|
const volume = cache.getVolume(volumeId);
|
|
373
374
|
return volume.scaling?.PT !== undefined;
|
|
374
375
|
}
|
|
@@ -3,6 +3,7 @@ import { Types } from '@cornerstonejs/core';
|
|
|
3
3
|
import ToolModes from '../../enums/ToolModes';
|
|
4
4
|
import StrategyCallbacks from '../../enums/StrategyCallbacks';
|
|
5
5
|
import { InteractionTypes, ToolProps, PublicToolProps } from '../../types';
|
|
6
|
+
import { getVolumeId } from '../../utilities/getVolumeId';
|
|
6
7
|
|
|
7
8
|
export interface IBaseTool {
|
|
8
9
|
/** ToolGroup ID the tool instance belongs to */
|
|
@@ -208,7 +209,7 @@ abstract class BaseTool implements IBaseTool {
|
|
|
208
209
|
|
|
209
210
|
return viewports[0].getImageData();
|
|
210
211
|
} else if (targetId.startsWith('volumeId:')) {
|
|
211
|
-
const volumeId = targetId
|
|
212
|
+
const volumeId = getVolumeId(targetId);
|
|
212
213
|
const viewports = utilities.getViewportsWithVolumeId(
|
|
213
214
|
volumeId,
|
|
214
215
|
renderingEngine.id
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
type Statistics = {
|
|
2
2
|
name: string;
|
|
3
|
+
label?: string;
|
|
3
4
|
value: number | number[];
|
|
4
5
|
unit: null | string;
|
|
5
6
|
};
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
type NamedStatistics = {
|
|
9
|
+
mean: Statistics & { name: 'mean' };
|
|
10
|
+
max: Statistics & { name: 'max' };
|
|
11
|
+
stdDev: Statistics & { name: 'stdDev' };
|
|
12
|
+
stdDevWithSumSquare: Statistics & { name: 'stdDevWithSumSquare' };
|
|
13
|
+
count: Statistics & { name: 'count' };
|
|
14
|
+
area?: Statistics & { name: 'area' };
|
|
15
|
+
volume?: Statistics & { name: 'volume' };
|
|
16
|
+
circumferance?: Statistics & { name: 'circumferance' };
|
|
17
|
+
array: Statistics[];
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type { Statistics, NamedStatistics };
|
package/src/types/index.ts
CHANGED
|
@@ -64,7 +64,7 @@ import type { ContourSegmentationData } from './ContourTypes';
|
|
|
64
64
|
import type IAnnotationManager from './IAnnotationManager';
|
|
65
65
|
import type AnnotationGroupSelector from './AnnotationGroupSelector';
|
|
66
66
|
import type AnnotationRenderContext from './AnnotationRenderContext';
|
|
67
|
-
import type { Statistics } from './CalculatorTypes';
|
|
67
|
+
import type { Statistics, NamedStatistics } from './CalculatorTypes';
|
|
68
68
|
import type { CanvasCoordinates } from '../utilities/math/ellipse/getCanvasEllipseCorners';
|
|
69
69
|
import {
|
|
70
70
|
LabelmapToolOperationData,
|
|
@@ -162,6 +162,9 @@ export type {
|
|
|
162
162
|
ContourSegmentationData,
|
|
163
163
|
//Statistics
|
|
164
164
|
Statistics,
|
|
165
|
+
NamedStatistics,
|
|
166
|
+
|
|
167
|
+
// Labelmap data
|
|
165
168
|
LabelmapToolOperationData,
|
|
166
169
|
LabelmapToolOperationDataStack,
|
|
167
170
|
LabelmapToolOperationDataVolume,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const getVolumeId = (targetId: string) => {
|
|
2
|
+
const prefix = 'volumeId:';
|
|
3
|
+
const str = targetId.includes(prefix)
|
|
4
|
+
? targetId.substring(prefix.length)
|
|
5
|
+
: targetId;
|
|
6
|
+
|
|
7
|
+
if (str.startsWith('nifti:')) {
|
|
8
|
+
return str;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const index = str.indexOf('?');
|
|
12
|
+
return index === -1 ? str : str.substring(0, index);
|
|
13
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Statistics } from '../../../types';
|
|
1
|
+
import { NamedStatistics, Statistics } from '../../../types';
|
|
2
2
|
import Calculator from './Calculator';
|
|
3
3
|
|
|
4
4
|
export default class BasicStatsCalculator extends Calculator {
|
|
@@ -46,15 +46,15 @@ export default class BasicStatsCalculator extends Calculator {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* Basic function that calculates statictics for a given array of points.
|
|
49
|
-
* @param points
|
|
50
49
|
* @returns An object that contains :
|
|
51
50
|
* max : The maximum value of the array
|
|
52
51
|
* mean : mean of the array
|
|
53
52
|
* stdDev : standard deviation of the array
|
|
54
53
|
* stdDevWithSumSquare : standard deviation of the array using sum²
|
|
54
|
+
* array : An array of hte above values, in order.
|
|
55
55
|
*/
|
|
56
56
|
|
|
57
|
-
static getStatistics = ():
|
|
57
|
+
static getStatistics = (): NamedStatistics => {
|
|
58
58
|
const mean = this.sum.map((sum) => sum / this.count);
|
|
59
59
|
const stdDev = this.squaredDiffSum.map((squaredDiffSum) =>
|
|
60
60
|
Math.sqrt(squaredDiffSum / this.count)
|
|
@@ -62,7 +62,46 @@ export default class BasicStatsCalculator extends Calculator {
|
|
|
62
62
|
const stdDevWithSumSquare = this.sumSquares.map((it, idx) =>
|
|
63
63
|
Math.sqrt(this.sumSquares[idx] / this.count - mean[idx] ** 2)
|
|
64
64
|
);
|
|
65
|
-
|
|
65
|
+
|
|
66
|
+
const named: NamedStatistics = {
|
|
67
|
+
max: {
|
|
68
|
+
name: 'max',
|
|
69
|
+
label: 'Max Pixel',
|
|
70
|
+
value: singleArrayAsNumber(this.max),
|
|
71
|
+
unit: null,
|
|
72
|
+
},
|
|
73
|
+
mean: {
|
|
74
|
+
name: 'mean',
|
|
75
|
+
label: 'Mean Pixel',
|
|
76
|
+
value: singleArrayAsNumber(mean),
|
|
77
|
+
unit: null,
|
|
78
|
+
},
|
|
79
|
+
stdDev: {
|
|
80
|
+
name: 'stdDev',
|
|
81
|
+
label: 'Standard Deviation',
|
|
82
|
+
value: singleArrayAsNumber(stdDev),
|
|
83
|
+
unit: null,
|
|
84
|
+
},
|
|
85
|
+
stdDevWithSumSquare: {
|
|
86
|
+
name: 'stdDevWithSumSquare',
|
|
87
|
+
value: singleArrayAsNumber(stdDevWithSumSquare),
|
|
88
|
+
unit: null,
|
|
89
|
+
},
|
|
90
|
+
count: {
|
|
91
|
+
name: 'count',
|
|
92
|
+
label: 'Pixel Count',
|
|
93
|
+
value: this.count,
|
|
94
|
+
unit: null,
|
|
95
|
+
},
|
|
96
|
+
array: [],
|
|
97
|
+
};
|
|
98
|
+
named.array.push(
|
|
99
|
+
named.max,
|
|
100
|
+
named.mean,
|
|
101
|
+
named.stdDev,
|
|
102
|
+
named.stdDevWithSumSquare,
|
|
103
|
+
named.count
|
|
104
|
+
);
|
|
66
105
|
|
|
67
106
|
this.max = [-Infinity];
|
|
68
107
|
this.sum = [0];
|
|
@@ -70,16 +109,7 @@ export default class BasicStatsCalculator extends Calculator {
|
|
|
70
109
|
this.squaredDiffSum = [0];
|
|
71
110
|
this.count = 0;
|
|
72
111
|
|
|
73
|
-
return
|
|
74
|
-
{ name: 'max', value: singleArrayAsNumber(currentMax), unit: null },
|
|
75
|
-
{ name: 'mean', value: singleArrayAsNumber(mean), unit: null },
|
|
76
|
-
{ name: 'stdDev', value: singleArrayAsNumber(stdDev), unit: null },
|
|
77
|
-
{
|
|
78
|
-
name: 'stdDevWithSumSquare',
|
|
79
|
-
value: singleArrayAsNumber(stdDevWithSumSquare),
|
|
80
|
-
unit: null,
|
|
81
|
-
},
|
|
82
|
-
];
|
|
112
|
+
return named;
|
|
83
113
|
};
|
|
84
114
|
}
|
|
85
115
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NamedStatistics } from '../../../types';
|
|
2
2
|
|
|
3
3
|
abstract class Calculator {
|
|
4
4
|
static run: ({ value }) => void;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Gets the statistics as both an array of values, as well as the named values.
|
|
7
|
+
*/
|
|
8
|
+
static getStatistics: () => NamedStatistics;
|
|
6
9
|
}
|
|
7
10
|
|
|
8
11
|
export default Calculator;
|