@cornerstonejs/utils 5.8.1 → 5.10.2
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/esm/utilities/logging/index.d.ts +4 -0
- package/dist/esm/utilities/logging/index.js +4 -0
- package/dist/esm/utilities/math/toNumber.d.ts +4 -2
- package/dist/esm/utilities/math/toNumber.js +15 -5
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +2 -3
- package/LICENSE +0 -21
|
@@ -11,7 +11,11 @@ export declare const cs3dLog: Logger;
|
|
|
11
11
|
export declare const metadataLog: Logger;
|
|
12
12
|
export declare const coreLog: Logger;
|
|
13
13
|
export declare const toolsLog: Logger;
|
|
14
|
+
export declare const adaptersLog: Logger;
|
|
14
15
|
export declare const loaderLog: Logger;
|
|
16
|
+
export declare const niftiVolumeLoaderLog: Logger;
|
|
17
|
+
export declare const polySegLog: Logger;
|
|
18
|
+
export declare const labelmapInterpolationLog: Logger;
|
|
15
19
|
export declare const aiLog: Logger;
|
|
16
20
|
export declare const examplesLog: Logger;
|
|
17
21
|
export declare const workerLog: Logger;
|
|
@@ -3,7 +3,11 @@ export const cs3dLog = getRootLogger('cs3d');
|
|
|
3
3
|
export const metadataLog = cs3dLog.getLogger('metadata');
|
|
4
4
|
export const coreLog = cs3dLog.getLogger('core');
|
|
5
5
|
export const toolsLog = cs3dLog.getLogger('tools');
|
|
6
|
+
export const adaptersLog = cs3dLog.getLogger('adapters');
|
|
6
7
|
export const loaderLog = cs3dLog.getLogger('dicomImageLoader');
|
|
8
|
+
export const niftiVolumeLoaderLog = cs3dLog.getLogger('niftiVolumeLoader');
|
|
9
|
+
export const polySegLog = cs3dLog.getLogger('polymorphicSegmentation');
|
|
10
|
+
export const labelmapInterpolationLog = cs3dLog.getLogger('labelmapInterpolation');
|
|
7
11
|
export const aiLog = cs3dLog.getLogger('ai');
|
|
8
12
|
export const examplesLog = cs3dLog.getLogger('examples');
|
|
9
13
|
export const workerLog = cs3dLog.getLogger('worker');
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
type NumberLike = string | String | number | Number;
|
|
2
|
-
export declare function toFiniteNumber(value: NumberLike | undefined): number | undefined;
|
|
3
|
-
export declare function toFiniteNumber
|
|
2
|
+
export declare function toFiniteNumber(value: NumberLike | null | undefined, defaultValue?: undefined): number | undefined;
|
|
3
|
+
export declare function toFiniteNumber(value: NumberLike | null | undefined, defaultValue: number): number;
|
|
4
|
+
export declare function toFiniteNumber<T extends NumberLike>(value: ArrayLike<T> | null | undefined, defaultValue?: undefined): number[] | undefined;
|
|
5
|
+
export declare function toFiniteNumber<T extends NumberLike>(value: ArrayLike<T> | null | undefined, defaultValue: number): number[];
|
|
4
6
|
export declare function toNumber(val: NumberLike | null | undefined): number | undefined;
|
|
5
7
|
export declare function toNumber<T extends NumberLike>(val: ArrayLike<T> | Iterable<T>): number[];
|
|
6
8
|
export default toNumber;
|
|
@@ -4,17 +4,27 @@ function isNumberLike(value) {
|
|
|
4
4
|
value instanceof String ||
|
|
5
5
|
value instanceof Number);
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
if (value ===
|
|
9
|
-
return
|
|
7
|
+
function isEntryWise(value) {
|
|
8
|
+
if (typeof value !== 'object' || value === null) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
return (Symbol.iterator in value ||
|
|
12
|
+
typeof value.length === 'number');
|
|
13
|
+
}
|
|
14
|
+
export function toFiniteNumber(value, defaultValue) {
|
|
15
|
+
if (value === undefined || value === null) {
|
|
16
|
+
return defaultValue;
|
|
10
17
|
}
|
|
11
18
|
if (isNumberLike(value)) {
|
|
12
19
|
const converted = Number(value);
|
|
13
|
-
return Number.isFinite(converted) ? converted :
|
|
20
|
+
return Number.isFinite(converted) ? converted : defaultValue;
|
|
21
|
+
}
|
|
22
|
+
if (!isEntryWise(value)) {
|
|
23
|
+
return defaultValue;
|
|
14
24
|
}
|
|
15
25
|
return Array.from(value, (entry) => {
|
|
16
26
|
const converted = Number(entry);
|
|
17
|
-
return Number.isFinite(converted) ? converted :
|
|
27
|
+
return Number.isFinite(converted) ? converted : defaultValue;
|
|
18
28
|
});
|
|
19
29
|
}
|
|
20
30
|
export function toNumber(val) {
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "5.
|
|
1
|
+
export declare const version = "5.10.2";
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '5.
|
|
1
|
+
export const version = '5.10.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cornerstonejs/utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.2",
|
|
4
4
|
"description": "Cornerstone3D shared utility helpers",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -86,6 +86,5 @@
|
|
|
86
86
|
"funding": {
|
|
87
87
|
"type": "individual",
|
|
88
88
|
"url": "https://ohif.org/donate"
|
|
89
|
-
}
|
|
90
|
-
"gitHead": "b0e07ac229d4118fa46350210a0ed6ce2cd24a25"
|
|
89
|
+
}
|
|
91
90
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Open Health Imaging Foundation
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|