@cornerstonejs/tools 1.73.0 → 1.74.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.
- package/dist/cjs/types/CalculatorTypes.d.ts +7 -5
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.d.ts +12 -4
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.js +45 -23
- package/dist/cjs/utilities/math/basic/BasicStatsCalculator.js.map +1 -1
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js +44 -23
- package/dist/esm/utilities/math/basic/BasicStatsCalculator.js.map +1 -1
- package/dist/types/types/CalculatorTypes.d.ts +7 -5
- package/dist/types/types/CalculatorTypes.d.ts.map +1 -1
- package/dist/types/utilities/math/basic/BasicStatsCalculator.d.ts +12 -4
- package/dist/types/utilities/math/basic/BasicStatsCalculator.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/types/CalculatorTypes.ts +5 -2
- package/src/utilities/math/basic/BasicStatsCalculator.ts +71 -41
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
1
2
|
declare type Statistics = {
|
|
2
3
|
name: string;
|
|
3
4
|
label?: string;
|
|
@@ -11,12 +12,12 @@ declare type NamedStatistics = {
|
|
|
11
12
|
max: Statistics & {
|
|
12
13
|
name: 'max';
|
|
13
14
|
};
|
|
15
|
+
min: Statistics & {
|
|
16
|
+
name: 'min';
|
|
17
|
+
};
|
|
14
18
|
stdDev: Statistics & {
|
|
15
19
|
name: 'stdDev';
|
|
16
20
|
};
|
|
17
|
-
stdDevWithSumSquare: Statistics & {
|
|
18
|
-
name: 'stdDevWithSumSquare';
|
|
19
|
-
};
|
|
20
21
|
count: Statistics & {
|
|
21
22
|
name: 'count';
|
|
22
23
|
};
|
|
@@ -26,9 +27,10 @@ declare type NamedStatistics = {
|
|
|
26
27
|
volume?: Statistics & {
|
|
27
28
|
name: 'volume';
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
-
name: '
|
|
30
|
+
circumference?: Statistics & {
|
|
31
|
+
name: 'circumference';
|
|
31
32
|
};
|
|
33
|
+
pointsInShape?: Types.PointsManager<Types.Point3>;
|
|
32
34
|
array: Statistics[];
|
|
33
35
|
};
|
|
34
36
|
export type { Statistics, NamedStatistics };
|
|
@@ -2,12 +2,20 @@ import { NamedStatistics } from '../../../types';
|
|
|
2
2
|
import Calculator from './Calculator';
|
|
3
3
|
export default class BasicStatsCalculator extends Calculator {
|
|
4
4
|
private static max;
|
|
5
|
+
private static min;
|
|
5
6
|
private static sum;
|
|
6
|
-
private static sumSquares;
|
|
7
|
-
private static squaredDiffSum;
|
|
8
7
|
private static count;
|
|
9
|
-
static
|
|
8
|
+
private static runMean;
|
|
9
|
+
private static m2;
|
|
10
|
+
private static pointsInShape;
|
|
11
|
+
static statsInit(options: {
|
|
12
|
+
noPointsCollection: boolean;
|
|
13
|
+
}): void;
|
|
14
|
+
static statsCallback: ({ value: newValue, pointLPS }: {
|
|
10
15
|
value: any;
|
|
16
|
+
pointLPS?: any;
|
|
11
17
|
}) => void;
|
|
12
|
-
static getStatistics: (
|
|
18
|
+
static getStatistics: (options?: {
|
|
19
|
+
unit: string;
|
|
20
|
+
}) => NamedStatistics;
|
|
13
21
|
}
|
|
@@ -4,59 +4,78 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const core_1 = require("@cornerstonejs/core");
|
|
7
8
|
const Calculator_1 = __importDefault(require("./Calculator"));
|
|
9
|
+
const { PointsManager } = core_1.utilities;
|
|
8
10
|
class BasicStatsCalculator extends Calculator_1.default {
|
|
11
|
+
static statsInit(options) {
|
|
12
|
+
if (options.noPointsCollection) {
|
|
13
|
+
BasicStatsCalculator.pointsInShape = null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
9
16
|
}
|
|
10
17
|
exports.default = BasicStatsCalculator;
|
|
11
18
|
_a = BasicStatsCalculator;
|
|
12
19
|
BasicStatsCalculator.max = [-Infinity];
|
|
20
|
+
BasicStatsCalculator.min = [Infinity];
|
|
13
21
|
BasicStatsCalculator.sum = [0];
|
|
14
|
-
BasicStatsCalculator.sumSquares = [0];
|
|
15
|
-
BasicStatsCalculator.squaredDiffSum = [0];
|
|
16
22
|
BasicStatsCalculator.count = 0;
|
|
17
|
-
BasicStatsCalculator.
|
|
23
|
+
BasicStatsCalculator.runMean = [0];
|
|
24
|
+
BasicStatsCalculator.m2 = [0];
|
|
25
|
+
BasicStatsCalculator.pointsInShape = PointsManager.create3(1024);
|
|
26
|
+
BasicStatsCalculator.statsCallback = ({ value: newValue, pointLPS = null }) => {
|
|
27
|
+
var _b;
|
|
18
28
|
if (Array.isArray(newValue) &&
|
|
19
29
|
newValue.length > 1 &&
|
|
20
30
|
_a.max.length === 1) {
|
|
21
31
|
_a.max.push(_a.max[0], _a.max[0]);
|
|
32
|
+
_a.min.push(_a.min[0], _a.min[0]);
|
|
22
33
|
_a.sum.push(_a.sum[0], _a.sum[0]);
|
|
23
|
-
_a.
|
|
24
|
-
_a.
|
|
34
|
+
_a.runMean.push(0, 0);
|
|
35
|
+
_a.m2.push(_a.m2[0], _a.m2[0]);
|
|
25
36
|
}
|
|
37
|
+
(_b = _a.pointsInShape) === null || _b === void 0 ? void 0 : _b.push(pointLPS);
|
|
26
38
|
const newArray = Array.isArray(newValue) ? newValue : [newValue];
|
|
27
39
|
_a.count += 1;
|
|
28
|
-
_a.max.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
40
|
+
_a.max.map((it, idx) => {
|
|
41
|
+
const value = newArray[idx];
|
|
42
|
+
const delta = value - _a.runMean[idx];
|
|
43
|
+
_a.sum[idx] += value;
|
|
44
|
+
_a.runMean[idx] += delta / _a.count;
|
|
45
|
+
const delta2 = value - _a.runMean[idx];
|
|
46
|
+
_a.m2[idx] += delta * delta2;
|
|
47
|
+
_a.min[idx] = Math.min(_a.min[idx], value);
|
|
48
|
+
_a.max[idx] = Math.max(it, value);
|
|
49
|
+
});
|
|
32
50
|
};
|
|
33
|
-
BasicStatsCalculator.getStatistics = () => {
|
|
51
|
+
BasicStatsCalculator.getStatistics = (options) => {
|
|
34
52
|
const mean = _a.sum.map((sum) => sum / _a.count);
|
|
35
|
-
const stdDev = _a.
|
|
36
|
-
const
|
|
53
|
+
const stdDev = _a.m2.map((squaredDiffSum) => Math.sqrt(squaredDiffSum / _a.count));
|
|
54
|
+
const unit = (options === null || options === void 0 ? void 0 : options.unit) || null;
|
|
37
55
|
const named = {
|
|
38
56
|
max: {
|
|
39
57
|
name: 'max',
|
|
40
58
|
label: 'Max Pixel',
|
|
41
59
|
value: singleArrayAsNumber(_a.max),
|
|
42
|
-
unit
|
|
60
|
+
unit,
|
|
61
|
+
},
|
|
62
|
+
min: {
|
|
63
|
+
name: 'min',
|
|
64
|
+
label: 'Min Pixel',
|
|
65
|
+
value: singleArrayAsNumber(_a.min),
|
|
66
|
+
unit,
|
|
43
67
|
},
|
|
44
68
|
mean: {
|
|
45
69
|
name: 'mean',
|
|
46
70
|
label: 'Mean Pixel',
|
|
47
71
|
value: singleArrayAsNumber(mean),
|
|
48
|
-
unit
|
|
72
|
+
unit,
|
|
49
73
|
},
|
|
50
74
|
stdDev: {
|
|
51
75
|
name: 'stdDev',
|
|
52
76
|
label: 'Standard Deviation',
|
|
53
77
|
value: singleArrayAsNumber(stdDev),
|
|
54
|
-
unit
|
|
55
|
-
},
|
|
56
|
-
stdDevWithSumSquare: {
|
|
57
|
-
name: 'stdDevWithSumSquare',
|
|
58
|
-
value: singleArrayAsNumber(stdDevWithSumSquare),
|
|
59
|
-
unit: null,
|
|
78
|
+
unit,
|
|
60
79
|
},
|
|
61
80
|
count: {
|
|
62
81
|
name: 'count',
|
|
@@ -64,14 +83,17 @@ BasicStatsCalculator.getStatistics = () => {
|
|
|
64
83
|
value: _a.count,
|
|
65
84
|
unit: null,
|
|
66
85
|
},
|
|
86
|
+
pointsInShape: _a.pointsInShape,
|
|
67
87
|
array: [],
|
|
68
88
|
};
|
|
69
|
-
named.array.push(named.max, named.mean, named.stdDev, named.
|
|
89
|
+
named.array.push(named.max, named.mean, named.stdDev, named.stdDev, named.count);
|
|
70
90
|
_a.max = [-Infinity];
|
|
91
|
+
_a.min = [Infinity];
|
|
71
92
|
_a.sum = [0];
|
|
72
|
-
_a.
|
|
73
|
-
_a.
|
|
93
|
+
_a.m2 = [0];
|
|
94
|
+
_a.runMean = [0];
|
|
74
95
|
_a.count = 0;
|
|
96
|
+
_a.pointsInShape = PointsManager.create3(1024);
|
|
75
97
|
return named;
|
|
76
98
|
};
|
|
77
99
|
function singleArrayAsNumber(val) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicStatsCalculator.js","sourceRoot":"","sources":["../../../../../src/utilities/math/basic/BasicStatsCalculator.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"BasicStatsCalculator.js","sourceRoot":"","sources":["../../../../../src/utilities/math/basic/BasicStatsCalculator.ts"],"names":[],"mappings":";;;;;;AAAA,8CAAgD;AAEhD,8DAAsC;AAEtC,MAAM,EAAE,aAAa,EAAE,GAAG,gBAAS,CAAC;AAEpC,MAAqB,oBAAqB,SAAQ,oBAAU;IAcnD,MAAM,CAAC,SAAS,CAAC,OAAwC;QAC9D,IAAI,OAAO,CAAC,kBAAkB,EAAE;YAC9B,oBAAoB,CAAC,aAAa,GAAG,IAAI,CAAC;SAC3C;IACH,CAAC;;AAlBH,uCAyIC;;AAxIgB,wBAAG,GAAG,CAAC,CAAC,QAAQ,CAAE,CAAA;AAClB,wBAAG,GAAG,CAAC,QAAQ,CAAE,CAAA;AACjB,wBAAG,GAAG,CAAC,CAAC,CAAE,CAAA;AACV,0BAAK,GAAG,CAAE,CAAA;AAIV,4BAAO,GAAG,CAAC,CAAC,CAAE,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AO,CAAC,IAAI,CAAC,CAAC;IAEjD,OAAO,KAAK,CAAC;AACf,CAAE,CAAA;AAGJ,SAAS,mBAAmB,CAAC,GAAa;IACxC,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACzC,CAAC"}
|
|
@@ -1,53 +1,71 @@
|
|
|
1
|
+
import { utilities } from '@cornerstonejs/core';
|
|
1
2
|
import Calculator from './Calculator';
|
|
3
|
+
const { PointsManager } = utilities;
|
|
2
4
|
export default class BasicStatsCalculator extends Calculator {
|
|
3
5
|
static { this.max = [-Infinity]; }
|
|
6
|
+
static { this.min = [Infinity]; }
|
|
4
7
|
static { this.sum = [0]; }
|
|
5
|
-
static { this.sumSquares = [0]; }
|
|
6
|
-
static { this.squaredDiffSum = [0]; }
|
|
7
8
|
static { this.count = 0; }
|
|
8
|
-
static { this.
|
|
9
|
+
static { this.runMean = [0]; }
|
|
10
|
+
static { this.m2 = [0]; }
|
|
11
|
+
static { this.pointsInShape = PointsManager.create3(1024); }
|
|
12
|
+
static statsInit(options) {
|
|
13
|
+
if (options.noPointsCollection) {
|
|
14
|
+
BasicStatsCalculator.pointsInShape = null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
static { this.statsCallback = ({ value: newValue, pointLPS = null }) => {
|
|
9
18
|
if (Array.isArray(newValue) &&
|
|
10
19
|
newValue.length > 1 &&
|
|
11
20
|
this.max.length === 1) {
|
|
12
21
|
this.max.push(this.max[0], this.max[0]);
|
|
22
|
+
this.min.push(this.min[0], this.min[0]);
|
|
13
23
|
this.sum.push(this.sum[0], this.sum[0]);
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
24
|
+
this.runMean.push(0, 0);
|
|
25
|
+
this.m2.push(this.m2[0], this.m2[0]);
|
|
16
26
|
}
|
|
27
|
+
this.pointsInShape?.push(pointLPS);
|
|
17
28
|
const newArray = Array.isArray(newValue) ? newValue : [newValue];
|
|
18
29
|
this.count += 1;
|
|
19
|
-
this.max.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
this.max.map((it, idx) => {
|
|
31
|
+
const value = newArray[idx];
|
|
32
|
+
const delta = value - this.runMean[idx];
|
|
33
|
+
this.sum[idx] += value;
|
|
34
|
+
this.runMean[idx] += delta / this.count;
|
|
35
|
+
const delta2 = value - this.runMean[idx];
|
|
36
|
+
this.m2[idx] += delta * delta2;
|
|
37
|
+
this.min[idx] = Math.min(this.min[idx], value);
|
|
38
|
+
this.max[idx] = Math.max(it, value);
|
|
39
|
+
});
|
|
23
40
|
}; }
|
|
24
|
-
static { this.getStatistics = () => {
|
|
41
|
+
static { this.getStatistics = (options) => {
|
|
25
42
|
const mean = this.sum.map((sum) => sum / this.count);
|
|
26
|
-
const stdDev = this.
|
|
27
|
-
const
|
|
43
|
+
const stdDev = this.m2.map((squaredDiffSum) => Math.sqrt(squaredDiffSum / this.count));
|
|
44
|
+
const unit = options?.unit || null;
|
|
28
45
|
const named = {
|
|
29
46
|
max: {
|
|
30
47
|
name: 'max',
|
|
31
48
|
label: 'Max Pixel',
|
|
32
49
|
value: singleArrayAsNumber(this.max),
|
|
33
|
-
unit
|
|
50
|
+
unit,
|
|
51
|
+
},
|
|
52
|
+
min: {
|
|
53
|
+
name: 'min',
|
|
54
|
+
label: 'Min Pixel',
|
|
55
|
+
value: singleArrayAsNumber(this.min),
|
|
56
|
+
unit,
|
|
34
57
|
},
|
|
35
58
|
mean: {
|
|
36
59
|
name: 'mean',
|
|
37
60
|
label: 'Mean Pixel',
|
|
38
61
|
value: singleArrayAsNumber(mean),
|
|
39
|
-
unit
|
|
62
|
+
unit,
|
|
40
63
|
},
|
|
41
64
|
stdDev: {
|
|
42
65
|
name: 'stdDev',
|
|
43
66
|
label: 'Standard Deviation',
|
|
44
67
|
value: singleArrayAsNumber(stdDev),
|
|
45
|
-
unit
|
|
46
|
-
},
|
|
47
|
-
stdDevWithSumSquare: {
|
|
48
|
-
name: 'stdDevWithSumSquare',
|
|
49
|
-
value: singleArrayAsNumber(stdDevWithSumSquare),
|
|
50
|
-
unit: null,
|
|
68
|
+
unit,
|
|
51
69
|
},
|
|
52
70
|
count: {
|
|
53
71
|
name: 'count',
|
|
@@ -55,14 +73,17 @@ export default class BasicStatsCalculator extends Calculator {
|
|
|
55
73
|
value: this.count,
|
|
56
74
|
unit: null,
|
|
57
75
|
},
|
|
76
|
+
pointsInShape: this.pointsInShape,
|
|
58
77
|
array: [],
|
|
59
78
|
};
|
|
60
|
-
named.array.push(named.max, named.mean, named.stdDev, named.
|
|
79
|
+
named.array.push(named.max, named.mean, named.stdDev, named.stdDev, named.count);
|
|
61
80
|
this.max = [-Infinity];
|
|
81
|
+
this.min = [Infinity];
|
|
62
82
|
this.sum = [0];
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
83
|
+
this.m2 = [0];
|
|
84
|
+
this.runMean = [0];
|
|
65
85
|
this.count = 0;
|
|
86
|
+
this.pointsInShape = PointsManager.create3(1024);
|
|
66
87
|
return named;
|
|
67
88
|
}; }
|
|
68
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicStatsCalculator.js","sourceRoot":"","sources":["../../../../../src/utilities/math/basic/BasicStatsCalculator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BasicStatsCalculator.js","sourceRoot":"","sources":["../../../../../src/utilities/math/basic/BasicStatsCalculator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;AAEpC,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU;IAC1D,SAAe,QAAG,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAA;IACjC,SAAe,QAAG,GAAG,CAAC,QAAQ,CAAC,C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AAC,QAAQ,CAAC,CAAC;QACvB,IAAI,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QAEf,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;QACd,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAEjD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,EAAA;;AAGJ,SAAS,mBAAmB,CAAC,GAAa;IACxC,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACzC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Types } from '@cornerstonejs/core';
|
|
1
2
|
declare type Statistics = {
|
|
2
3
|
name: string;
|
|
3
4
|
label?: string;
|
|
@@ -11,12 +12,12 @@ declare type NamedStatistics = {
|
|
|
11
12
|
max: Statistics & {
|
|
12
13
|
name: 'max';
|
|
13
14
|
};
|
|
15
|
+
min: Statistics & {
|
|
16
|
+
name: 'min';
|
|
17
|
+
};
|
|
14
18
|
stdDev: Statistics & {
|
|
15
19
|
name: 'stdDev';
|
|
16
20
|
};
|
|
17
|
-
stdDevWithSumSquare: Statistics & {
|
|
18
|
-
name: 'stdDevWithSumSquare';
|
|
19
|
-
};
|
|
20
21
|
count: Statistics & {
|
|
21
22
|
name: 'count';
|
|
22
23
|
};
|
|
@@ -26,9 +27,10 @@ declare type NamedStatistics = {
|
|
|
26
27
|
volume?: Statistics & {
|
|
27
28
|
name: 'volume';
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
-
name: '
|
|
30
|
+
circumference?: Statistics & {
|
|
31
|
+
name: 'circumference';
|
|
31
32
|
};
|
|
33
|
+
pointsInShape?: Types.PointsManager<Types.Point3>;
|
|
32
34
|
array: Statistics[];
|
|
33
35
|
};
|
|
34
36
|
export type { Statistics, NamedStatistics };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalculatorTypes.d.ts","sourceRoot":"","sources":["../../../src/types/CalculatorTypes.ts"],"names":[],"mappings":"AAAA,aAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;CACrB,CAAC;AAEF,aAAK,eAAe,GAAG;IACrB,IAAI,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,GAAG,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAClC,
|
|
1
|
+
{"version":3,"file":"CalculatorTypes.d.ts","sourceRoot":"","sources":["../../../src/types/CalculatorTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,aAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;CACrB,CAAC;AAEF,aAAK,eAAe,GAAG;IACrB,IAAI,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACpC,GAAG,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAClC,GAAG,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,CAAC;IAClC,MAAM,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;IACxC,KAAK,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IACtC,IAAI,CAAC,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,MAAM,CAAC,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;IACzC,aAAa,CAAC,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,eAAe,CAAA;KAAE,CAAC;IACvD,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAClD,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -2,13 +2,21 @@ import { NamedStatistics } from '../../../types';
|
|
|
2
2
|
import Calculator from './Calculator';
|
|
3
3
|
export default class BasicStatsCalculator extends Calculator {
|
|
4
4
|
private static max;
|
|
5
|
+
private static min;
|
|
5
6
|
private static sum;
|
|
6
|
-
private static sumSquares;
|
|
7
|
-
private static squaredDiffSum;
|
|
8
7
|
private static count;
|
|
9
|
-
static
|
|
8
|
+
private static runMean;
|
|
9
|
+
private static m2;
|
|
10
|
+
private static pointsInShape;
|
|
11
|
+
static statsInit(options: {
|
|
12
|
+
noPointsCollection: boolean;
|
|
13
|
+
}): void;
|
|
14
|
+
static statsCallback: ({ value: newValue, pointLPS }: {
|
|
10
15
|
value: any;
|
|
16
|
+
pointLPS?: any;
|
|
11
17
|
}) => void;
|
|
12
|
-
static getStatistics: (
|
|
18
|
+
static getStatistics: (options?: {
|
|
19
|
+
unit: string;
|
|
20
|
+
}) => NamedStatistics;
|
|
13
21
|
}
|
|
14
22
|
//# sourceMappingURL=BasicStatsCalculator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasicStatsCalculator.d.ts","sourceRoot":"","sources":["../../../../../src/utilities/math/basic/BasicStatsCalculator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BasicStatsCalculator.d.ts","sourceRoot":"","sources":["../../../../../src/utilities/math/basic/BasicStatsCalculator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,UAAU,MAAM,cAAc,CAAC;AAItC,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,UAAU;IAC1D,OAAO,CAAC,MAAM,CAAC,GAAG,CAAe;IACjC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAc;IAChC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAO;IACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAK;IAIzB,OAAO,CAAC,MAAM,CAAC,OAAO,CAAO;IAC7B,OAAO,CAAC,MAAM,CAAC,EAAE,CAAO;IAGxB,OAAO,CAAC,MAAM,CAAC,aAAa,CAA+B;WAE7C,SAAS,CAAC,OAAO,EAAE;QAAE,kBAAkB,EAAE,OAAO,CAAA;KAAE;IAUhE,MAAM,CAAC,aAAa;;;UAA2C,IAAI,CA+BjE;IAWF,MAAM,CAAC,aAAa,aAAc;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,KAAG,eAAe,CAsElE;CACH"}
|