| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127 |
117×
117×
117×
63×
54×
54×
54×
9×
9×
9×
9×
9×
9×
9×
9×
9×
9×
9×
9×
9×
9×
45×
18×
27×
9×
18×
9×
9×
9×
9×
| import { dicomParser } from '../../../externalModules.js';
import getNumberValues from './getNumberValues.js';
import parseImageId from '../parseImageId.js';
import dataSetCacheManager from '../dataSetCacheManager.js';
import getImagePixelModule from './getImagePixelModule.js';
import getLUTs from './getLUTs.js';
import getModalityLUTOutputPixelRepresentation from './getModalityLUTOutputPixelRepresentation.js';
function metaDataProvider (type, imageId) {
const parsedImageId = parseImageId(imageId);
const dataSet = dataSetCacheManager.get(parsedImageId.url);
if (!dataSet) {
return;
}
Iif (type === 'generalSeriesModule') {
return {
modality: dataSet.string('x00080060'),
seriesInstanceUID: dataSet.string('x0020000e'),
seriesNumber: dataSet.intString('x00200011'),
studyInstanceUID: dataSet.string('x0020000d'),
seriesDate: dicomParser.parseDA(dataSet.string('x00080021')),
seriesTime: dicomParser.parseTM(dataSet.string('x00080031') || '')
};
}
Iif (type === 'patientStudyModule') {
return {
patientAge: dataSet.intString('x00101010'),
patientSize: dataSet.floatString('x00101020'),
patientWeight: dataSet.floatString('x00101030')
};
}
if (type === 'imagePlaneModule') {
const imageOrientationPatient = getNumberValues(dataSet, 'x00200037', 6);
const imagePositionPatient = getNumberValues(dataSet, 'x00200032', 3);
const pixelSpacing = getNumberValues(dataSet, 'x00280030', 2);
let columnPixelSpacing = 1.0;
let rowPixelSpacing = 1.0;
Eif (pixelSpacing) {
rowPixelSpacing = pixelSpacing[0];
columnPixelSpacing = pixelSpacing[1];
}
let rowCosines = null;
let columnCosines = null;
Eif (imageOrientationPatient) {
rowCosines = [parseFloat(imageOrientationPatient[0]), parseFloat(imageOrientationPatient[1]), parseFloat(imageOrientationPatient[2])];
columnCosines = [parseFloat(imageOrientationPatient[3]), parseFloat(imageOrientationPatient[4]), parseFloat(imageOrientationPatient[5])];
}
return {
frameOfReferenceUID: dataSet.string('x00200052'),
rows: dataSet.uint16('x00280010'),
columns: dataSet.uint16('x00280011'),
imageOrientationPatient,
rowCosines,
columnCosines,
imagePositionPatient,
sliceThickness: dataSet.floatString('x00180050'),
sliceLocation: dataSet.floatString('x00201041'),
pixelSpacing,
rowPixelSpacing,
columnPixelSpacing
};
}
if (type === 'imagePixelModule') {
return getImagePixelModule(dataSet);
}
if (type === 'modalityLutModule') {
return {
rescaleIntercept: dataSet.floatString('x00281052'),
rescaleSlope: dataSet.floatString('x00281053'),
rescaleType: dataSet.string('x00281054'),
modalityLUTSequence: getLUTs(dataSet.uint16('x00280103'), dataSet.elements.x00283000)
};
}
if (type === 'voiLutModule') {
const modalityLUTOutputPixelRepresentation = getModalityLUTOutputPixelRepresentation(dataSet);
return {
windowCenter: getNumberValues(dataSet, 'x00281050', 1),
windowWidth: getNumberValues(dataSet, 'x00281051', 1),
voiLUTSequence: getLUTs(modalityLUTOutputPixelRepresentation, dataSet.elements.x00283010)
};
}
Eif (type === 'sopCommonModule') {
return {
sopClassUID: dataSet.string('x00080016'),
sopInstanceUID: dataSet.string('x00080018')
};
}
if (type === 'petIsotopeModule') {
const radiopharmaceuticalInfo = dataSet.elements.x00540016;
if (radiopharmaceuticalInfo === undefined) {
return;
}
const firstRadiopharmaceuticalInfoDataSet = radiopharmaceuticalInfo.items[0].dataSet;
return {
radiopharmaceuticalInfo: {
radiopharmaceuticalStartTime: dicomParser.parseTM(firstRadiopharmaceuticalInfoDataSet.string('x00181072') || ''),
radionuclideTotalDose: firstRadiopharmaceuticalInfoDataSet.floatString('x00181074'),
radionuclideHalfLife: firstRadiopharmaceuticalInfoDataSet.floatString('x00181075')
}
};
}
}
export default metaDataProvider;
|