@cornerstonejs/metadata 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/metaData.js +3 -1
- package/dist/esm/utilities/Tags.js +3 -1
- package/dist/esm/utilities/definedAttributesOf.d.ts +2 -0
- package/dist/esm/utilities/definedAttributesOf.js +14 -0
- package/dist/esm/utilities/getPixelSpacingInformation.js +4 -2
- package/dist/esm/utilities/index.d.ts +1 -0
- package/dist/esm/utilities/index.js +1 -0
- package/dist/esm/utilities/logging.d.ts +2 -1
- package/dist/esm/utilities/logging.js +2 -1
- package/dist/esm/utilities/metadataProvider/cacheData.js +3 -1
- package/dist/esm/utilities/metadataProvider/compressedFrameData.js +3 -1
- package/dist/esm/utilities/metadataProvider/ecgFromInstance.js +3 -1
- package/dist/esm/utilities/splitImageIdsBy4DTags.js +6 -4
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/package.json +3 -4
- package/LICENSE +0 -21
package/dist/esm/metaData.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { getAddModuleType } from './enums/index.js';
|
|
2
|
+
import { logging as cornerstoneLogging } from '@cornerstonejs/utils';
|
|
3
|
+
const cs3dLogger = cornerstoneLogging.metadataLog.getLogger('metaData');
|
|
2
4
|
const providers = [];
|
|
3
5
|
const typedProviderValueMap = new Map();
|
|
4
6
|
const typedProviderMap = new Map();
|
|
@@ -150,7 +152,7 @@ export function getNormalized(imageId, types, metaDataProvider = getMetaData) {
|
|
|
150
152
|
}
|
|
151
153
|
}
|
|
152
154
|
catch (error) {
|
|
153
|
-
|
|
155
|
+
cs3dLogger.error(`Error retrieving ${t} data:`, error);
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
return result;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as metaData from '../metaData.js';
|
|
2
2
|
import dcmjs from 'dcmjs';
|
|
3
3
|
import { moduleDefinitions, USRegionChild, CLINICAL_TRIAL, RadiopharmaceuticalInfoModule, } from './modules/index.js';
|
|
4
|
+
import { logging as cornerstoneLogging } from '@cornerstonejs/utils';
|
|
5
|
+
const cs3dLogger = cornerstoneLogging.metadataLog.getLogger('utilities.Tags');
|
|
4
6
|
const dicomDictionary = dcmjs.data.DicomMetaDictionary.dictionary;
|
|
5
7
|
const nameMap = dcmjs.data.DicomMetaDictionary.nameMap;
|
|
6
8
|
export { USRegionChild, CLINICAL_TRIAL, RadiopharmaceuticalInfoModule };
|
|
@@ -105,7 +107,7 @@ for (const [moduleName, keywords] of moduleDefinitions) {
|
|
|
105
107
|
}
|
|
106
108
|
for (const [keyword, { hex, groups }] of tagGroups) {
|
|
107
109
|
if (!hex) {
|
|
108
|
-
|
|
110
|
+
cs3dLogger.warn(`Tags: keyword "${keyword}" not found in dcmjs nameMap`);
|
|
109
111
|
continue;
|
|
110
112
|
}
|
|
111
113
|
addTag(keyword, createTagEntry(hex, ...groups));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function definedAttributesOf(source) {
|
|
2
|
+
const result = {};
|
|
3
|
+
if (!source) {
|
|
4
|
+
return result;
|
|
5
|
+
}
|
|
6
|
+
for (const key of Object.keys(source)) {
|
|
7
|
+
const value = source[key];
|
|
8
|
+
if (value !== undefined) {
|
|
9
|
+
result[key] = value;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
export default definedAttributesOf;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isEqual } from './isEqual.js';
|
|
2
2
|
import { CalibrationTypes } from '../enums/index.js';
|
|
3
|
+
import { logging as cornerstoneLogging } from '@cornerstonejs/utils';
|
|
4
|
+
const cs3dLogger = cornerstoneLogging.metadataLog.getLogger('utilities.getPixelSpacingInformation');
|
|
3
5
|
const projectionRadiographSOPClassUIDs = new Set([
|
|
4
6
|
'1.2.840.10008.5.1.4.1.1.1',
|
|
5
7
|
'1.2.840.10008.5.1.4.1.1.1.1',
|
|
@@ -31,7 +33,7 @@ export function calculateRadiographicPixelSpacing(instance) {
|
|
|
31
33
|
const isProjection = true;
|
|
32
34
|
if (PixelSpacing && PixelSpacingCalibrationType === 'GEOMETRY') {
|
|
33
35
|
if (isEqual(PixelSpacing, ImagerPixelSpacing)) {
|
|
34
|
-
|
|
36
|
+
cs3dLogger.warn('Calibration type is geometry, but pixel spacing and imager pixel spacing identical', PixelSpacing, ImagerPixelSpacing);
|
|
35
37
|
}
|
|
36
38
|
return {
|
|
37
39
|
PixelSpacing,
|
|
@@ -64,7 +66,7 @@ export function calculateRadiographicPixelSpacing(instance) {
|
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
if (ermf) {
|
|
67
|
-
|
|
69
|
+
cs3dLogger.error('Illegal ERMF value:', ermf);
|
|
68
70
|
}
|
|
69
71
|
return {
|
|
70
72
|
PixelSpacing: PixelSpacing || ImagerPixelSpacing,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getSingleBufferFromArray } from './bulkDataFromArray.js';
|
|
2
|
+
export { definedAttributesOf } from './definedAttributesOf.js';
|
|
2
3
|
export { toNumber, toFiniteNumber } from './toNumber.js';
|
|
3
4
|
export { default as toNumberDefault } from './toNumber.js';
|
|
4
5
|
export { default as isVideoTransferSyntax, videoUIDs, } from './isVideoTransferSyntax.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { getSingleBufferFromArray } from './bulkDataFromArray.js';
|
|
2
|
+
export { definedAttributesOf } from './definedAttributesOf.js';
|
|
2
3
|
export { toNumber, toFiniteNumber } from './toNumber.js';
|
|
3
4
|
export { default as toNumberDefault } from './toNumber.js';
|
|
4
5
|
export { default as isVideoTransferSyntax, videoUIDs, } from './isVideoTransferSyntax.js';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { logging } from '@cornerstonejs/utils';
|
|
2
|
-
export declare const getRootLogger: typeof logging.getRootLogger, getLogger: typeof logging.getLogger, cs3dLog: logging.Logger, metadataLog: logging.Logger, coreLog: logging.Logger, toolsLog: logging.Logger, loaderLog: logging.Logger,
|
|
2
|
+
export declare const getRootLogger: typeof logging.getRootLogger, getLogger: typeof logging.getLogger, cs3dLog: logging.Logger, metadataLog: logging.Logger, coreLog: logging.Logger, toolsLog: logging.Logger, adaptersLog: logging.Logger, loaderLog: logging.Logger, niftiVolumeLoaderLog: logging.Logger, polySegLog: logging.Logger, labelmapInterpolationLog: logging.Logger, aiLog: logging.Logger, examplesLog: logging.Logger, dicomConsistencyLog: logging.Logger, imageConsistencyLog: logging.Logger, log: any;
|
|
3
|
+
export declare const workerLog: logging.Logger;
|
|
3
4
|
export type Logger = logging.Logger;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { logging } from '@cornerstonejs/utils';
|
|
2
|
-
export const { getRootLogger, getLogger, cs3dLog, metadataLog, coreLog, toolsLog, loaderLog, aiLog, examplesLog,
|
|
2
|
+
export const { getRootLogger, getLogger, cs3dLog, metadataLog, coreLog, toolsLog, adaptersLog, loaderLog, niftiVolumeLoaderLog, polySegLog, labelmapInterpolationLog, aiLog, examplesLog, dicomConsistencyLog, imageConsistencyLog, log, } = logging;
|
|
3
|
+
export const { workerLog } = logging;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { getAddModuleType, MetadataModules } from '../../enums/index.js';
|
|
2
2
|
import { addAddProvider, addTypedProvider, clear, clearQuery, getMetaData, } from '../../metaData.js';
|
|
3
3
|
import { BASE_IMAGE_ID, FRAME_IMAGE_IDS } from './imageIdsProviders.js';
|
|
4
|
+
import { logging as cornerstoneLogging } from '@cornerstonejs/utils';
|
|
5
|
+
const cs3dLogger = cornerstoneLogging.metadataLog.getLogger('utilities.metadataProvider.cacheData');
|
|
4
6
|
export class CacheData {
|
|
5
7
|
static setCacheDataInternal(type, query, value) {
|
|
6
8
|
let valueMap = this.mapCacheData.get(type);
|
|
@@ -142,7 +144,7 @@ export function createTypeWritableCacheProvider(type) {
|
|
|
142
144
|
return (next, query, data, options) => {
|
|
143
145
|
const cachedValue = CacheData.getCacheData(type, query);
|
|
144
146
|
if (cachedValue !== undefined) {
|
|
145
|
-
|
|
147
|
+
cs3dLogger.warn(`Metadata add skipped for "${type}" at query "${query}" because cache already has a value.`);
|
|
146
148
|
return cachedValue;
|
|
147
149
|
}
|
|
148
150
|
const addCachedValue = CacheData.getCacheData(addType, query);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { MetadataModules } from '../../enums/index.js';
|
|
2
2
|
import { addTypedProvider } from '../../metaData.js';
|
|
3
|
+
import { logging as cornerstoneLogging } from '@cornerstonejs/utils';
|
|
4
|
+
const cs3dLogger = cornerstoneLogging.metadataLog.getLogger('utilities.metadataProvider.compressedFrameData');
|
|
3
5
|
const PIXEL_DATA_KEYS = [
|
|
4
6
|
'PixelData',
|
|
5
7
|
'FramePixelData',
|
|
@@ -78,7 +80,7 @@ function getFramePixelDataFromSingleBuffer(pixelDataTag, frameIndex, numberOfFra
|
|
|
78
80
|
if (offset + frameSize > totalLength) {
|
|
79
81
|
return undefined;
|
|
80
82
|
}
|
|
81
|
-
|
|
83
|
+
cs3dLogger.warn('[compressedFrameData] Splitting single-buffer pixel data by numberOfFrames for paramap-type image; frameIndex=', frameIndex, ', numberOfFrames=', numberOfFrames, ', frameSize=', frameSize);
|
|
82
84
|
const u8 = view instanceof Uint8Array
|
|
83
85
|
? view
|
|
84
86
|
: new Uint8Array(view.buffer, view.byteOffset, view.byteLength);
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { addTypedProvider } from '../../metaData.js';
|
|
2
2
|
import { MetadataModules } from '../../enums/index.js';
|
|
3
|
+
import { logging as cornerstoneLogging } from '@cornerstonejs/utils';
|
|
4
|
+
const cs3dLogger = cornerstoneLogging.metadataLog.getLogger('utilities.metadataProvider.ecgFromInstance');
|
|
3
5
|
function base64ToUint8Array(base64) {
|
|
4
6
|
const binaryString = atob(base64);
|
|
5
7
|
const bytes = new Uint8Array(binaryString.length);
|
|
@@ -163,7 +165,7 @@ export function buildEcgModuleFromInstance(instance, imageId) {
|
|
|
163
165
|
: buffer;
|
|
164
166
|
return convertBuffer(decoded, numberOfChannels, numberOfSamples, bitsAllocated, sampleInterpretation);
|
|
165
167
|
}
|
|
166
|
-
|
|
168
|
+
cs3dLogger.warn('[ecgFromInstance] No waveform data source found. group keys:', Object.keys(group), 'waveformData keys:', Object.keys(waveformData));
|
|
167
169
|
throw new Error('[ecgFromInstance] No waveform data source found');
|
|
168
170
|
};
|
|
169
171
|
return {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as metaData from '../metaData.js';
|
|
2
2
|
import { toFiniteNumber } from './toNumber.js';
|
|
3
|
+
import { logging as cornerstoneLogging } from '@cornerstonejs/utils';
|
|
4
|
+
const cs3dLogger = cornerstoneLogging.metadataLog.getLogger('utilities.splitImageIdsBy4DTags');
|
|
3
5
|
function generateFrameImageId(baseImageId, frameNumber) {
|
|
4
6
|
const framePattern = /\/frames\/\d+/;
|
|
5
7
|
const queryFramePattern = /([?&])frame=\d+/;
|
|
@@ -32,17 +34,17 @@ function handleMultiframe4D(imageIds) {
|
|
|
32
34
|
const sliceVector = instance.SliceVector;
|
|
33
35
|
const numberOfSlices = instance.NumberOfSlices;
|
|
34
36
|
if (timeSlotVector.length !== numberOfFrames) {
|
|
35
|
-
|
|
37
|
+
cs3dLogger.warn('TimeSlotVector length does not match NumberOfFrames:', timeSlotVector.length, 'vs', numberOfFrames);
|
|
36
38
|
return null;
|
|
37
39
|
}
|
|
38
40
|
if (sliceVector) {
|
|
39
41
|
if (!Array.isArray(sliceVector)) {
|
|
40
|
-
|
|
42
|
+
cs3dLogger.warn('SliceVector exists but is not an array. Expected length:', numberOfFrames);
|
|
41
43
|
return null;
|
|
42
44
|
}
|
|
43
45
|
if (sliceVector.length !== numberOfFrames ||
|
|
44
46
|
sliceVector.some((val) => val === undefined)) {
|
|
45
|
-
|
|
47
|
+
cs3dLogger.warn('SliceVector exists but has invalid length or undefined entries. Expected length:', numberOfFrames, 'Actual length:', sliceVector.length);
|
|
46
48
|
return null;
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -64,7 +66,7 @@ function handleMultiframe4D(imageIds) {
|
|
|
64
66
|
const expectedSlicesPerTimeSlot = numberOfSlices || imageIdGroups[0]?.length;
|
|
65
67
|
const allGroupsHaveSameLength = imageIdGroups.every((group) => group.length === expectedSlicesPerTimeSlot);
|
|
66
68
|
if (!allGroupsHaveSameLength) {
|
|
67
|
-
|
|
69
|
+
cs3dLogger.warn('Multiframe 4D split resulted in uneven time slot groups. Expected', expectedSlicesPerTimeSlot, 'slices per time slot.');
|
|
68
70
|
}
|
|
69
71
|
return {
|
|
70
72
|
imageIdGroups,
|
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/metadata",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.10.2",
|
|
4
4
|
"description": "Cornerstone3D Metadata Foundation - Provider chain, DICOM stream parsing, tag modules, and series splitting",
|
|
5
5
|
"module": "./dist/esm/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@cornerstonejs/calculate-suv": "1.0.3",
|
|
84
|
-
"@cornerstonejs/utils": "5.
|
|
84
|
+
"@cornerstonejs/utils": "5.10.2",
|
|
85
85
|
"dcmjs": "0.52.0",
|
|
86
86
|
"gl-matrix": "3.4.3"
|
|
87
87
|
},
|
|
@@ -95,6 +95,5 @@
|
|
|
95
95
|
"funding": {
|
|
96
96
|
"type": "individual",
|
|
97
97
|
"url": "https://ohif.org/donate"
|
|
98
|
-
}
|
|
99
|
-
"gitHead": "b0e07ac229d4118fa46350210a0ed6ce2cd24a25"
|
|
98
|
+
}
|
|
100
99
|
}
|
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.
|